@letscooee/web-sdk 9.14.0 → 9.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.min.js +28 -22
- package/dist/widget.min.js +29 -32
- package/package.json +1 -2
package/dist/main.min.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
var qy=Object.create;var Bl=Object.defineProperty,Ky=Object.defineProperties,Xy=Object.getOwnPropertyDescriptor,Jy=Object.getOwnPropertyDescriptors,Qy=Object.getOwnPropertyNames,ks=Object.getOwnPropertySymbols,Zy=Object.getPrototypeOf,Ul=Object.prototype.hasOwnProperty,qf=Object.prototype.propertyIsEnumerable;var zf=(t,e,r)=>e in t?Bl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S=(t,e)=>{for(var r in e||={})Ul.call(e,r)&&zf(t,r,e[r]);if(ks)for(var r of ks(e))qf.call(e,r)&&zf(t,r,e[r]);return t},Z=(t,e)=>Ky(t,Jy(e));var _o=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Kf=(t,e)=>{var r={};for(var n in t)Ul.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&ks)for(var n of ks(t))e.indexOf(n)<0&&qf.call(t,n)&&(r[n]=t[n]);return r};var Fs=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ev=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qy(e))!Ul.call(t,i)&&i!==r&&Bl(t,i,{get:()=>e[i],enumerable:!(n=Xy(e,i))||n.enumerable});return t};var ur=(t,e,r)=>(r=t!=null?qy(Zy(t)):{},ev(e||!t||!t.__esModule?Bl(r,"default",{value:t,enumerable:!0}):r,t));var bn=Fs((Jf,Hs)=>{"use strict";(function(t){"use strict";var e={};e.VERSION="1.6.1";var r,n={},i=function(p,f){return function(){return f.apply(p,arguments)}},o=function(){var p=arguments,f=p[0],m,v;for(v=1;v<p.length;v++)for(m in p[v])!(m in f)&&p[v].hasOwnProperty(m)&&(f[m]=p[v][m]);return f},s=function(p,f){return{value:p,name:f}};e.TRACE=s(1,"TRACE"),e.DEBUG=s(2,"DEBUG"),e.INFO=s(3,"INFO"),e.TIME=s(4,"TIME"),e.WARN=s(5,"WARN"),e.ERROR=s(8,"ERROR"),e.OFF=s(99,"OFF");var a=function(p){this.context=p,this.setLevel(p.filterLevel),this.log=this.info};a.prototype={setLevel:function(p){p&&"value"in p&&(this.context.filterLevel=p)},getLevel:function(){return this.context.filterLevel},enabledFor:function(p){var f=this.context.filterLevel;return p.value>=f.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"start"])},timeEnd:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"end"])},invoke:function(p,f){r&&this.enabledFor(p)&&r(f,o({level:p},this.context))}};var c=new a({filterLevel:e.OFF});(function(){var p=e;p.enabledFor=i(c,c.enabledFor),p.trace=i(c,c.trace),p.debug=i(c,c.debug),p.time=i(c,c.time),p.timeEnd=i(c,c.timeEnd),p.info=i(c,c.info),p.warn=i(c,c.warn),p.error=i(c,c.error),p.log=p.info})(),e.setHandler=function(p){r=p},e.setLevel=function(p){c.setLevel(p);for(var f in n)n.hasOwnProperty(f)&&n[f].setLevel(p)},e.getLevel=function(){return c.getLevel()},e.get=function(p){return n[p]||(n[p]=new a(o({name:p},c.context)))},e.createDefaultHandler=function(p){p=p||{},p.formatter=p.formatter||function(y,T){T.name&&y.unshift("["+T.name+"]")};var f={},m=function(v,y){Function.prototype.apply.call(v,console,y)};return typeof console>"u"?function(){}:function(v,y){v=Array.prototype.slice.call(v);var T=console.log,R;y.level===e.TIME?(R=(y.name?"["+y.name+"] ":"")+v[0],v[1]==="start"?console.time?console.time(R):f[R]=new Date().getTime():console.timeEnd?console.timeEnd(R):m(T,[R+": "+(new Date().getTime()-f[R])+"ms"])):(y.level===e.WARN&&console.warn?T=console.warn:y.level===e.ERROR&&console.error?T=console.error:y.level===e.INFO&&console.info?T=console.info:y.level===e.DEBUG&&console.debug?T=console.debug:y.level===e.TRACE&&console.trace&&(T=console.trace),p.formatter(v,y),m(T,v))}},e.useDefaults=function(p){e.setLevel(p&&p.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(p))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof Hs<"u"&&Hs.exports?Hs.exports=e:(e._prevLogger=t.Logger,e.noConflict=function(){return t.Logger=e._prevLogger,e},t.Logger=e)})(Jf)});var tm=Fs((em,Yl)=>{"use strict";(function(t){if(typeof em=="object"&&typeof Yl<"u")Yl.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return function n(i,o,s){function a(f,m){if(!o[f]){if(!i[f]){var v=typeof _o=="function"&&_o;if(!m&&v)return v(f,!0);if(c)return c(f,!0);var y=new Error("Cannot find module '"+f+"'");throw y.code="MODULE_NOT_FOUND",y}var T=o[f]={exports:{}};i[f][0].call(T.exports,function(R){var A=i[f][1][R];return a(A||R)},T,T.exports,n,i,o,s)}return o[f].exports}for(var c=typeof _o=="function"&&_o,p=0;p<s.length;p++)a(s[p]);return a}({1:[function(n,i,o){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,c;if(a){var p=0,f=new a(R),m=s.document.createTextNode("");f.observe(m,{characterData:!0}),c=function(){m.data=p=++p%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var v=new s.MessageChannel;v.port1.onmessage=R,c=function(){v.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?c=function(){var N=s.document.createElement("script");N.onreadystatechange=function(){R(),N.onreadystatechange=null,N.parentNode.removeChild(N),N=null},s.document.documentElement.appendChild(N)}:c=function(){setTimeout(R,0)};var y,T=[];function R(){y=!0;for(var N,B,P=T.length;P;){for(B=T,T=[],N=-1;++N<P;)B[N]();P=T.length}y=!1}i.exports=A;function A(N){T.push(N)===1&&!y&&c()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function a(){}var c={},p=["REJECTED"],f=["FULFILLED"],m=["PENDING"];i.exports=v;function v(W){if(typeof W!="function")throw new TypeError("resolver must be a function");this.state=m,this.queue=[],this.outcome=void 0,W!==a&&A(this,W)}v.prototype.catch=function(W){return this.then(null,W)},v.prototype.then=function(W,re){if(typeof W!="function"&&this.state===f||typeof re!="function"&&this.state===p)return this;var Q=new this.constructor(a);if(this.state!==m){var ae=this.state===f?W:re;T(Q,ae,this.outcome)}else this.queue.push(new y(Q,W,re));return Q};function y(W,re,Q){this.promise=W,typeof re=="function"&&(this.onFulfilled=re,this.callFulfilled=this.otherCallFulfilled),typeof Q=="function"&&(this.onRejected=Q,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(W){c.resolve(this.promise,W)},y.prototype.otherCallFulfilled=function(W){T(this.promise,this.onFulfilled,W)},y.prototype.callRejected=function(W){c.reject(this.promise,W)},y.prototype.otherCallRejected=function(W){T(this.promise,this.onRejected,W)};function T(W,re,Q){s(function(){var ae;try{ae=re(Q)}catch(Oe){return c.reject(W,Oe)}ae===W?c.reject(W,new TypeError("Cannot resolve promise with itself")):c.resolve(W,ae)})}c.resolve=function(W,re){var Q=N(R,re);if(Q.status==="error")return c.reject(W,Q.value);var ae=Q.value;if(ae)A(W,ae);else{W.state=f,W.outcome=re;for(var Oe=-1,we=W.queue.length;++Oe<we;)W.queue[Oe].callFulfilled(re)}return W},c.reject=function(W,re){W.state=p,W.outcome=re;for(var Q=-1,ae=W.queue.length;++Q<ae;)W.queue[Q].callRejected(re);return W};function R(W){var re=W&&W.then;if(W&&(typeof W=="object"||typeof W=="function")&&typeof re=="function")return function(){re.apply(W,arguments)}}function A(W,re){var Q=!1;function ae(Ge){Q||(Q=!0,c.reject(W,Ge))}function Oe(Ge){Q||(Q=!0,c.resolve(W,Ge))}function we(){re(Oe,ae)}var Pe=N(we);Pe.status==="error"&&ae(Pe.value)}function N(W,re){var Q={};try{Q.value=W(re),Q.status="success"}catch(ae){Q.status="error",Q.value=ae}return Q}v.resolve=B;function B(W){return W instanceof this?W:c.resolve(new this(a),W)}v.reject=P;function P(W){var re=new this(a);return c.reject(re,W)}v.all=q;function q(W){var re=this;if(Object.prototype.toString.call(W)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Q=W.length,ae=!1;if(!Q)return this.resolve([]);for(var Oe=new Array(Q),we=0,Pe=-1,Ge=new this(a);++Pe<Q;)rt(W[Pe],Pe);return Ge;function rt(lr,er){re.resolve(lr).then(Ne,function(nt){ae||(ae=!0,c.reject(Ge,nt))});function Ne(nt){Oe[er]=nt,++we===Q&&!ae&&(ae=!0,c.resolve(Ge,Oe))}}}v.race=de;function de(W){var re=this;if(Object.prototype.toString.call(W)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Q=W.length,ae=!1;if(!Q)return this.resolve([]);for(var Oe=-1,we=new this(a);++Oe<Q;)Pe(W[Oe]);return we;function Pe(Ge){re.resolve(Ge).then(function(rt){ae||(ae=!0,c.resolve(we,rt))},function(rt){ae||(ae=!0,c.reject(we,rt))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function a(d,_){if(!(d instanceof _))throw new TypeError("Cannot call a class as a function")}function c(){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 p=c();function f(){try{if(!p||!p.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),_=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||_)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function m(d,_){d=d||[],_=_||{};try{return new Blob(d,_)}catch(w){if(w.name!=="TypeError")throw w;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,I=new g,C=0;C<d.length;C+=1)I.append(d[C]);return I.getBlob(_.type)}}typeof Promise>"u"&&n(3);var v=Promise;function y(d,_){_&&d.then(function(g){_(null,g)},function(g){_(g)})}function T(d,_,g){typeof _=="function"&&d.then(_),typeof g=="function"&&d.catch(g)}function R(d){return typeof d!="string"&&(console.warn(d+" used as a key, but it is not a string."),d=String(d)),d}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var N="local-forage-detect-blob-support",B=void 0,P={},q=Object.prototype.toString,de="readonly",W="readwrite";function re(d){for(var _=d.length,g=new ArrayBuffer(_),I=new Uint8Array(g),C=0;C<_;C++)I[C]=d.charCodeAt(C);return g}function Q(d){return new v(function(_){var g=d.transaction(N,W),I=m([""]);g.objectStore(N).put(I,"key"),g.onabort=function(C){C.preventDefault(),C.stopPropagation(),_(!1)},g.oncomplete=function(){var C=navigator.userAgent.match(/Chrome\/(\d+)/),w=navigator.userAgent.match(/Edge\//);_(w||!C||parseInt(C[1],10)>=43)}}).catch(function(){return!1})}function ae(d){return typeof B=="boolean"?v.resolve(B):Q(d).then(function(_){return B=_,B})}function Oe(d){var _=P[d.name],g={};g.promise=new v(function(I,C){g.resolve=I,g.reject=C}),_.deferredOperations.push(g),_.dbReady?_.dbReady=_.dbReady.then(function(){return g.promise}):_.dbReady=g.promise}function we(d){var _=P[d.name],g=_.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Pe(d,_){var g=P[d.name],I=g.deferredOperations.pop();if(I)return I.reject(_),I.promise}function Ge(d,_){return new v(function(g,I){if(P[d.name]=P[d.name]||fo(),d.db)if(_)Oe(d),d.db.close();else return g(d.db);var C=[d.name];_&&C.push(d.version);var w=p.open.apply(p,C);_&&(w.onupgradeneeded=function(L){var V=w.result;try{V.createObjectStore(d.storeName),L.oldVersion<=1&&V.createObjectStore(N)}catch(j){if(j.name==="ConstraintError")console.warn('The database "'+d.name+'" has been upgraded from version '+L.oldVersion+" to version "+L.newVersion+', but the storage "'+d.storeName+'" already exists.');else throw j}}),w.onerror=function(L){L.preventDefault(),I(w.error)},w.onsuccess=function(){var L=w.result;L.onversionchange=function(V){V.target.close()},g(L),we(d)}})}function rt(d){return Ge(d,!1)}function lr(d){return Ge(d,!0)}function er(d,_){if(!d.db)return!0;var g=!d.db.objectStoreNames.contains(d.storeName),I=d.version<d.db.version,C=d.version>d.db.version;if(I&&(d.version!==_&&console.warn('The database "'+d.name+`" can't be downgraded from version `+d.db.version+" to version "+d.version+"."),d.version=d.db.version),C||g){if(g){var w=d.db.version+1;w>d.version&&(d.version=w)}return!0}return!1}function Ne(d){return new v(function(_,g){var I=new FileReader;I.onerror=g,I.onloadend=function(C){var w=btoa(C.target.result||"");_({__local_forage_encoded_blob:!0,data:w,type:d.type})},I.readAsBinaryString(d)})}function nt(d){var _=re(atob(d.data));return m([_],{type:d.type})}function he(d){return d&&d.__local_forage_encoded_blob}function ue(d){var _=this,g=_._initReady().then(function(){var I=P[_._dbInfo.name];if(I&&I.dbReady)return I.dbReady});return T(g,d,d),g}function dt(d){Oe(d);for(var _=P[d.name],g=_.forages,I=0;I<g.length;I++){var C=g[I];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return d.db=null,rt(d).then(function(w){return d.db=w,er(d)?lr(d):w}).then(function(w){d.db=_.db=w;for(var L=0;L<g.length;L++)g[L]._dbInfo.db=w}).catch(function(w){throw Pe(d,w),w})}function Ut(d,_,g,I){I===void 0&&(I=1);try{var C=d.db.transaction(d.storeName,_);g(null,C)}catch(w){if(I>0&&(!d.db||w.name==="InvalidStateError"||w.name==="NotFoundError"))return v.resolve().then(function(){if(!d.db||w.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),lr(d)}).then(function(){return dt(d).then(function(){Ut(d,_,g,I-1)})}).catch(g);g(w)}}function fo(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ms(d){var _=this,g={db:null};if(d)for(var I in d)g[I]=d[I];var C=P[g.name];C||(C=fo(),P[g.name]=C),C.forages.push(_),_._initReady||(_._initReady=_.ready,_.ready=ue);var w=[];function L(){return v.resolve()}for(var V=0;V<C.forages.length;V++){var j=C.forages[V];j!==_&&w.push(j._initReady().catch(L))}var G=C.forages.slice(0);return v.all(w).then(function(){return g.db=C.db,rt(g)}).then(function(z){return g.db=z,er(g,_._defaultConfig.version)?lr(g):z}).then(function(z){g.db=C.db=z,_._dbInfo=g;for(var X=0;X<G.length;X++){var pe=G[X];pe!==_&&(pe._dbInfo.db=g.db,pe._dbInfo.version=g.version)}})}function Tl(d,_){var g=this;d=R(d);var I=new v(function(C,w){g.ready().then(function(){Ut(g._dbInfo,de,function(L,V){if(L)return w(L);try{var j=V.objectStore(g._dbInfo.storeName),G=j.get(d);G.onsuccess=function(){var z=G.result;z===void 0&&(z=null),he(z)&&(z=nt(z)),C(z)},G.onerror=function(){w(G.error)}}catch(z){w(z)}})}).catch(w)});return y(I,_),I}function Cl(d,_){var g=this,I=new v(function(C,w){g.ready().then(function(){Ut(g._dbInfo,de,function(L,V){if(L)return w(L);try{var j=V.objectStore(g._dbInfo.storeName),G=j.openCursor(),z=1;G.onsuccess=function(){var X=G.result;if(X){var pe=X.value;he(pe)&&(pe=nt(pe));var Se=d(pe,X.key,z++);Se!==void 0?C(Se):X.continue()}else C()},G.onerror=function(){w(G.error)}}catch(X){w(X)}})}).catch(w)});return y(I,_),I}function mo(d,_,g){var I=this;d=R(d);var C=new v(function(w,L){var V;I.ready().then(function(){return V=I._dbInfo,q.call(_)==="[object Blob]"?ae(V.db).then(function(j){return j?_:Ne(_)}):_}).then(function(j){Ut(I._dbInfo,W,function(G,z){if(G)return L(G);try{var X=z.objectStore(I._dbInfo.storeName);j===null&&(j=void 0);var pe=X.put(j,d);z.oncomplete=function(){j===void 0&&(j=null),w(j)},z.onabort=z.onerror=function(){var Se=pe.error?pe.error:pe.transaction.error;L(Se)}}catch(Se){L(Se)}})}).catch(L)});return y(C,g),C}function xl(d,_){var g=this;d=R(d);var I=new v(function(C,w){g.ready().then(function(){Ut(g._dbInfo,W,function(L,V){if(L)return w(L);try{var j=V.objectStore(g._dbInfo.storeName),G=j.delete(d);V.oncomplete=function(){C()},V.onerror=function(){w(G.error)},V.onabort=function(){var z=G.error?G.error:G.transaction.error;w(z)}}catch(z){w(z)}})}).catch(w)});return y(I,_),I}function Rl(d){var _=this,g=new v(function(I,C){_.ready().then(function(){Ut(_._dbInfo,W,function(w,L){if(w)return C(w);try{var V=L.objectStore(_._dbInfo.storeName),j=V.clear();L.oncomplete=function(){I()},L.onabort=L.onerror=function(){var G=j.error?j.error:j.transaction.error;C(G)}}catch(G){C(G)}})}).catch(C)});return y(g,d),g}function Bs(d){var _=this,g=new v(function(I,C){_.ready().then(function(){Ut(_._dbInfo,de,function(w,L){if(w)return C(w);try{var V=L.objectStore(_._dbInfo.storeName),j=V.count();j.onsuccess=function(){I(j.result)},j.onerror=function(){C(j.error)}}catch(G){C(G)}})}).catch(C)});return y(g,d),g}function ii(d,_){var g=this,I=new v(function(C,w){if(d<0){C(null);return}g.ready().then(function(){Ut(g._dbInfo,de,function(L,V){if(L)return w(L);try{var j=V.objectStore(g._dbInfo.storeName),G=!1,z=j.openKeyCursor();z.onsuccess=function(){var X=z.result;if(!X){C(null);return}d===0||G?C(X.key):(G=!0,X.advance(d))},z.onerror=function(){w(z.error)}}catch(X){w(X)}})}).catch(w)});return y(I,_),I}function kt(d){var _=this,g=new v(function(I,C){_.ready().then(function(){Ut(_._dbInfo,de,function(w,L){if(w)return C(w);try{var V=L.objectStore(_._dbInfo.storeName),j=V.openKeyCursor(),G=[];j.onsuccess=function(){var z=j.result;if(!z){I(G);return}G.push(z.key),z.continue()},j.onerror=function(){C(j.error)}}catch(z){C(z)}})}).catch(C)});return y(g,d),g}function ho(d,_){_=A.apply(this,arguments);var g=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||g.name,d.storeName=d.storeName||g.storeName);var I=this,C;if(!d.name)C=v.reject("Invalid arguments");else{var w=d.name===g.name&&I._dbInfo.db,L=w?v.resolve(I._dbInfo.db):rt(d).then(function(V){var j=P[d.name],G=j.forages;j.db=V;for(var z=0;z<G.length;z++)G[z]._dbInfo.db=V;return V});d.storeName?C=L.then(function(V){if(V.objectStoreNames.contains(d.storeName)){var j=V.version+1;Oe(d);var G=P[d.name],z=G.forages;V.close();for(var X=0;X<z.length;X++){var pe=z[X];pe._dbInfo.db=null,pe._dbInfo.version=j}var Se=new v(function(Ie,We){var Ve=p.open(d.name,j);Ve.onerror=function(Ft){var Eo=Ve.result;Eo.close(),We(Ft)},Ve.onupgradeneeded=function(){var Ft=Ve.result;Ft.deleteObjectStore(d.storeName)},Ve.onsuccess=function(){var Ft=Ve.result;Ft.close(),Ie(Ft)}});return Se.then(function(Ie){G.db=Ie;for(var We=0;We<z.length;We++){var Ve=z[We];Ve._dbInfo.db=Ie,we(Ve._dbInfo)}}).catch(function(Ie){throw(Pe(d,Ie)||v.resolve()).catch(function(){}),Ie})}}):C=L.then(function(V){Oe(d);var j=P[d.name],G=j.forages;V.close();for(var z=0;z<G.length;z++){var X=G[z];X._dbInfo.db=null}var pe=new v(function(Se,Ie){var We=p.deleteDatabase(d.name);We.onerror=function(){var Ve=We.result;Ve&&Ve.close(),Ie(We.error)},We.onblocked=function(){console.warn('dropInstance blocked for database "'+d.name+'" until all open connections are closed')},We.onsuccess=function(){var Ve=We.result;Ve&&Ve.close(),Se(Ve)}});return pe.then(function(Se){j.db=Se;for(var Ie=0;Ie<G.length;Ie++){var We=G[Ie];we(We._dbInfo)}}).catch(function(Se){throw(Pe(d,Se)||v.resolve()).catch(function(){}),Se})})}return y(C,_),C}var Al={_driver:"asyncStorage",_initStorage:Ms,_support:f(),iterate:Cl,getItem:Tl,setItem:mo,removeItem:xl,clear:Rl,length:Bs,key:ii,keys:kt,dropInstance:ho};function h(){return typeof openDatabase=="function"}var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",E=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",F=x.length,$="arbf",me="blob",_e="si08",Ae="ui08",Ye="uic8",Le="si16",Sn="si32",go="ur16",yo="ui32",Bf="fl32",Uf="fl64",kf=F+$.length,Ff=Object.prototype.toString;function Hf(d){var _=d.length*.75,g=d.length,I,C=0,w,L,V,j;d[d.length-1]==="="&&(_--,d[d.length-2]==="="&&_--);var G=new ArrayBuffer(_),z=new Uint8Array(G);for(I=0;I<g;I+=4)w=l.indexOf(d[I]),L=l.indexOf(d[I+1]),V=l.indexOf(d[I+2]),j=l.indexOf(d[I+3]),z[C++]=w<<2|L>>4,z[C++]=(L&15)<<4|V>>2,z[C++]=(V&3)<<6|j&63;return G}function Dl(d){var _=new Uint8Array(d),g="",I;for(I=0;I<_.length;I+=3)g+=l[_[I]>>2],g+=l[(_[I]&3)<<4|_[I+1]>>4],g+=l[(_[I+1]&15)<<2|_[I+2]>>6],g+=l[_[I+2]&63];return _.length%3===2?g=g.substring(0,g.length-1)+"=":_.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function uy(d,_){var g="";if(d&&(g=Ff.call(d)),d&&(g==="[object ArrayBuffer]"||d.buffer&&Ff.call(d.buffer)==="[object ArrayBuffer]")){var I,C=x;d instanceof ArrayBuffer?(I=d,C+=$):(I=d.buffer,g==="[object Int8Array]"?C+=_e:g==="[object Uint8Array]"?C+=Ae:g==="[object Uint8ClampedArray]"?C+=Ye:g==="[object Int16Array]"?C+=Le:g==="[object Uint16Array]"?C+=go:g==="[object Int32Array]"?C+=Sn:g==="[object Uint32Array]"?C+=yo:g==="[object Float32Array]"?C+=Bf:g==="[object Float64Array]"?C+=Uf:_(new Error("Failed to get type for BinaryArray"))),_(C+Dl(I))}else if(g==="[object Blob]"){var w=new FileReader;w.onload=function(){var L=u+d.type+"~"+Dl(this.result);_(x+me+L)},w.readAsArrayBuffer(d)}else try{_(JSON.stringify(d))}catch(L){console.error("Couldn't convert value into a JSON string: ",d),_(null,L)}}function py(d){if(d.substring(0,F)!==x)return JSON.parse(d);var _=d.substring(kf),g=d.substring(F,kf),I;if(g===me&&E.test(_)){var C=_.match(E);I=C[1],_=_.substring(C[0].length)}var w=Hf(_);switch(g){case $:return w;case me:return m([w],{type:I});case _e:return new Int8Array(w);case Ae:return new Uint8Array(w);case Ye:return new Uint8ClampedArray(w);case Le:return new Int16Array(w);case go:return new Uint16Array(w);case Sn:return new Int32Array(w);case yo:return new Uint32Array(w);case Bf:return new Float32Array(w);case Uf:return new Float64Array(w);default:throw new Error("Unkown type: "+g)}}var Nl={serialize:uy,deserialize:py,stringToBuffer:Hf,bufferToString:Dl};function Vf(d,_,g,I){d.executeSql("CREATE TABLE IF NOT EXISTS "+_.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,I)}function fy(d){var _=this,g={db:null};if(d)for(var I in d)g[I]=typeof d[I]!="string"?d[I].toString():d[I];var C=new v(function(w,L){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(V){return L(V)}g.db.transaction(function(V){Vf(V,g,function(){_._dbInfo=g,w()},function(j,G){L(G)})},L)});return g.serializer=Nl,C}function Kr(d,_,g,I,C,w){d.executeSql(g,I,C,function(L,V){V.code===V.SYNTAX_ERR?L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[_.storeName],function(j,G){G.rows.length?w(j,V):Vf(j,_,function(){j.executeSql(g,I,C,w)},w)},w):w(L,V)},w)}function my(d,_){var g=this;d=R(d);var I=new v(function(C,w){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(V){Kr(V,L,"SELECT * FROM "+L.storeName+" WHERE key = ? LIMIT 1",[d],function(j,G){var z=G.rows.length?G.rows.item(0).value:null;z&&(z=L.serializer.deserialize(z)),C(z)},function(j,G){w(G)})})}).catch(w)});return y(I,_),I}function dy(d,_){var g=this,I=new v(function(C,w){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(V){Kr(V,L,"SELECT * FROM "+L.storeName,[],function(j,G){for(var z=G.rows,X=z.length,pe=0;pe<X;pe++){var Se=z.item(pe),Ie=Se.value;if(Ie&&(Ie=L.serializer.deserialize(Ie)),Ie=d(Ie,Se.key,pe+1),Ie!==void 0){C(Ie);return}}C()},function(j,G){w(G)})})}).catch(w)});return y(I,_),I}function $f(d,_,g,I){var C=this;d=R(d);var w=new v(function(L,V){C.ready().then(function(){_===void 0&&(_=null);var j=_,G=C._dbInfo;G.serializer.serialize(_,function(z,X){X?V(X):G.db.transaction(function(pe){Kr(pe,G,"INSERT OR REPLACE INTO "+G.storeName+" (key, value) VALUES (?, ?)",[d,z],function(){L(j)},function(Se,Ie){V(Ie)})},function(pe){if(pe.code===pe.QUOTA_ERR){if(I>0){L($f.apply(C,[d,j,g,I-1]));return}V(pe)}})})}).catch(V)});return y(w,g),w}function hy(d,_,g){return $f.apply(this,[d,_,g,1])}function gy(d,_){var g=this;d=R(d);var I=new v(function(C,w){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(V){Kr(V,L,"DELETE FROM "+L.storeName+" WHERE key = ?",[d],function(){C()},function(j,G){w(G)})})}).catch(w)});return y(I,_),I}function yy(d){var _=this,g=new v(function(I,C){_.ready().then(function(){var w=_._dbInfo;w.db.transaction(function(L){Kr(L,w,"DELETE FROM "+w.storeName,[],function(){I()},function(V,j){C(j)})})}).catch(C)});return y(g,d),g}function vy(d){var _=this,g=new v(function(I,C){_.ready().then(function(){var w=_._dbInfo;w.db.transaction(function(L){Kr(L,w,"SELECT COUNT(key) as c FROM "+w.storeName,[],function(V,j){var G=j.rows.item(0).c;I(G)},function(V,j){C(j)})})}).catch(C)});return y(g,d),g}function Ey(d,_){var g=this,I=new v(function(C,w){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(V){Kr(V,L,"SELECT key FROM "+L.storeName+" WHERE id = ? LIMIT 1",[d+1],function(j,G){var z=G.rows.length?G.rows.item(0).key:null;C(z)},function(j,G){w(G)})})}).catch(w)});return y(I,_),I}function _y(d){var _=this,g=new v(function(I,C){_.ready().then(function(){var w=_._dbInfo;w.db.transaction(function(L){Kr(L,w,"SELECT key FROM "+w.storeName,[],function(V,j){for(var G=[],z=0;z<j.rows.length;z++)G.push(j.rows.item(z).key);I(G)},function(V,j){C(j)})})}).catch(C)});return y(g,d),g}function Sy(d){return new v(function(_,g){d.transaction(function(I){I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,w){for(var L=[],V=0;V<w.rows.length;V++)L.push(w.rows.item(V).name);_({db:d,storeNames:L})},function(C,w){g(w)})},function(I){g(I)})})}function by(d,_){_=A.apply(this,arguments);var g=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||g.name,d.storeName=d.storeName||g.storeName);var I=this,C;return d.name?C=new v(function(w){var L;d.name===g.name?L=I._dbInfo.db:L=openDatabase(d.name,"","",0),d.storeName?w({db:L,storeNames:[d.storeName]}):w(Sy(L))}).then(function(w){return new v(function(L,V){w.db.transaction(function(j){function G(Se){return new v(function(Ie,We){j.executeSql("DROP TABLE IF EXISTS "+Se,[],function(){Ie()},function(Ve,Ft){We(Ft)})})}for(var z=[],X=0,pe=w.storeNames.length;X<pe;X++)z.push(G(w.storeNames[X]));v.all(z).then(function(){L()}).catch(function(Se){V(Se)})},function(j){V(j)})})}):C=v.reject("Invalid arguments"),y(C,_),C}var wy={_driver:"webSQLStorage",_initStorage:fy,_support:h(),iterate:dy,getItem:my,setItem:hy,removeItem:gy,clear:yy,length:vy,key:Ey,keys:_y,dropInstance:by};function Iy(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Wf(d,_){var g=d.name+"/";return d.storeName!==_.storeName&&(g+=d.storeName+"/"),g}function Ty(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function Cy(){return!Ty()||localStorage.length>0}function xy(d){var _=this,g={};if(d)for(var I in d)g[I]=d[I];return g.keyPrefix=Wf(d,_._defaultConfig),Cy()?(_._dbInfo=g,g.serializer=Nl,v.resolve()):v.reject()}function Ry(d){var _=this,g=_.ready().then(function(){for(var I=_._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var w=localStorage.key(C);w.indexOf(I)===0&&localStorage.removeItem(w)}});return y(g,d),g}function Ay(d,_){var g=this;d=R(d);var I=g.ready().then(function(){var C=g._dbInfo,w=localStorage.getItem(C.keyPrefix+d);return w&&(w=C.serializer.deserialize(w)),w});return y(I,_),I}function Dy(d,_){var g=this,I=g.ready().then(function(){for(var C=g._dbInfo,w=C.keyPrefix,L=w.length,V=localStorage.length,j=1,G=0;G<V;G++){var z=localStorage.key(G);if(z.indexOf(w)===0){var X=localStorage.getItem(z);if(X&&(X=C.serializer.deserialize(X)),X=d(X,z.substring(L),j++),X!==void 0)return X}}});return y(I,_),I}function Ny(d,_){var g=this,I=g.ready().then(function(){var C=g._dbInfo,w;try{w=localStorage.key(d)}catch{w=null}return w&&(w=w.substring(C.keyPrefix.length)),w});return y(I,_),I}function Oy(d){var _=this,g=_.ready().then(function(){for(var I=_._dbInfo,C=localStorage.length,w=[],L=0;L<C;L++){var V=localStorage.key(L);V.indexOf(I.keyPrefix)===0&&w.push(V.substring(I.keyPrefix.length))}return w});return y(g,d),g}function Py(d){var _=this,g=_.keys().then(function(I){return I.length});return y(g,d),g}function Ly(d,_){var g=this;d=R(d);var I=g.ready().then(function(){var C=g._dbInfo;localStorage.removeItem(C.keyPrefix+d)});return y(I,_),I}function My(d,_,g){var I=this;d=R(d);var C=I.ready().then(function(){_===void 0&&(_=null);var w=_;return new v(function(L,V){var j=I._dbInfo;j.serializer.serialize(_,function(G,z){if(z)V(z);else try{localStorage.setItem(j.keyPrefix+d,G),L(w)}catch(X){(X.name==="QuotaExceededError"||X.name==="NS_ERROR_DOM_QUOTA_REACHED")&&V(X),V(X)}})})});return y(C,g),C}function By(d,_){if(_=A.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var g=this.config();d.name=d.name||g.name,d.storeName=d.storeName||g.storeName}var I=this,C;return d.name?C=new v(function(w){d.storeName?w(Wf(d,I._defaultConfig)):w(d.name+"/")}).then(function(w){for(var L=localStorage.length-1;L>=0;L--){var V=localStorage.key(L);V.indexOf(w)===0&&localStorage.removeItem(V)}}):C=v.reject("Invalid arguments"),y(C,_),C}var Uy={_driver:"localStorageWrapper",_initStorage:xy,_support:Iy(),iterate:Dy,getItem:Ay,setItem:My,removeItem:Ly,clear:Ry,length:Py,key:Ny,keys:Oy,dropInstance:By},ky=function(_,g){return _===g||typeof _=="number"&&typeof g=="number"&&isNaN(_)&&isNaN(g)},Fy=function(_,g){for(var I=_.length,C=0;C<I;){if(ky(_[C],g))return!0;C++}return!1},jf=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},vo={},Gf={},oi={INDEXEDDB:Al,WEBSQL:wy,LOCALSTORAGE:Uy},Hy=[oi.INDEXEDDB._driver,oi.WEBSQL._driver,oi.LOCALSTORAGE._driver],Us=["dropInstance"],Ol=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Us),Vy={description:"",driver:Hy.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function $y(d,_){d[_]=function(){var g=arguments;return d.ready().then(function(){return d[_].apply(d,g)})}}function Pl(){for(var d=1;d<arguments.length;d++){var _=arguments[d];if(_)for(var g in _)_.hasOwnProperty(g)&&(jf(_[g])?arguments[0][g]=_[g].slice():arguments[0][g]=_[g])}return arguments[0]}var Wy=function(){function d(_){a(this,d);for(var g in oi)if(oi.hasOwnProperty(g)){var I=oi[g],C=I._driver;this[g]=C,vo[C]||this.defineDriver(I)}this._defaultConfig=Pl({},Vy),this._config=Pl({},this._defaultConfig,_),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var I in g){if(I==="storeName"&&(g[I]=g[I].replace(/\W/g,"_")),I==="version"&&typeof g[I]!="number")return new Error("Database version must be a number.");this._config[I]=g[I]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},d.prototype.defineDriver=function(g,I,C){var w=new v(function(L,V){try{var j=g._driver,G=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){V(G);return}for(var z=Ol.concat("_initStorage"),X=0,pe=z.length;X<pe;X++){var Se=z[X],Ie=!Fy(Us,Se);if((Ie||g[Se])&&typeof g[Se]!="function"){V(G);return}}var We=function(){for(var Eo=function(Yy){return function(){var zy=new Error("Method "+Yy+" is not implemented by the current driver"),Yf=v.reject(zy);return y(Yf,arguments[arguments.length-1]),Yf}},Ll=0,Gy=Us.length;Ll<Gy;Ll++){var Ml=Us[Ll];g[Ml]||(g[Ml]=Eo(Ml))}};We();var Ve=function(Eo){vo[j]&&console.info("Redefining LocalForage driver: "+j),vo[j]=g,Gf[j]=Eo,L()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(Ve,V):Ve(!!g._support):Ve(!0)}catch(Ft){V(Ft)}});return T(w,I,C),w},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(g,I,C){var w=vo[g]?v.resolve(vo[g]):v.reject(new Error("Driver not found."));return T(w,I,C),w},d.prototype.getSerializer=function(g){var I=v.resolve(Nl);return T(I,g),I},d.prototype.ready=function(g){var I=this,C=I._driverSet.then(function(){return I._ready===null&&(I._ready=I._initDriver()),I._ready});return T(C,g,g),C},d.prototype.setDriver=function(g,I,C){var w=this;jf(g)||(g=[g]);var L=this._getSupportedDrivers(g);function V(){w._config.driver=w.driver()}function j(X){return w._extend(X),V(),w._ready=w._initStorage(w._config),w._ready}function G(X){return function(){var pe=0;function Se(){for(;pe<X.length;){var Ie=X[pe];return pe++,w._dbInfo=null,w._ready=null,w.getDriver(Ie).then(j).catch(Se)}V();var We=new Error("No available storage method found.");return w._driverSet=v.reject(We),w._driverSet}return Se()}}var z=this._driverSet!==null?this._driverSet.catch(function(){return v.resolve()}):v.resolve();return this._driverSet=z.then(function(){var X=L[0];return w._dbInfo=null,w._ready=null,w.getDriver(X).then(function(pe){w._driver=pe._driver,V(),w._wrapLibraryMethodsWithReady(),w._initDriver=G(L)})}).catch(function(){V();var X=new Error("No available storage method found.");return w._driverSet=v.reject(X),w._driverSet}),T(this._driverSet,I,C),this._driverSet},d.prototype.supports=function(g){return!!Gf[g]},d.prototype._extend=function(g){Pl(this,g)},d.prototype._getSupportedDrivers=function(g){for(var I=[],C=0,w=g.length;C<w;C++){var L=g[C];this.supports(L)&&I.push(L)}return I},d.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,I=Ol.length;g<I;g++)$y(this,Ol[g])},d.prototype.createInstance=function(g){return new d(g)},d}(),jy=new Wy;i.exports=jy},{3:3}]},{},[4])(4)})});var _f=Fs(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.URLBuilder=void 0;var $b=function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t}();Lc.URLBuilder=$b});var iy=Fs((Pf,Lf)=>{"use strict";(function(t,e){typeof Pf=="object"&&typeof Lf<"u"?Lf.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.fetchRetry=e())})(Pf,function(){"use strict";var t=function(n,i){if(i=i||{},typeof n!="function")throw new r("fetch must be a function");if(typeof i!="object")throw new r("defaults must be an object");if(i.retries!==void 0&&!e(i.retries))throw new r("retries must be a positive integer");if(i.retryDelay!==void 0&&!e(i.retryDelay)&&typeof i.retryDelay!="function")throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(i.retryOn!==void 0&&!Array.isArray(i.retryOn)&&typeof i.retryOn!="function")throw new r("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return i=Object.assign(o,i),function(a,c){var p=i.retries,f=i.retryDelay,m=i.retryOn;if(c&&c.retries!==void 0)if(e(c.retries))p=c.retries;else throw new r("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(e(c.retryDelay)||typeof c.retryDelay=="function")f=c.retryDelay;else throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")m=c.retryOn;else throw new r("retryOn property expects an array or function");return new Promise(function(v,y){var T=function(A){var N=typeof Request<"u"&&a instanceof Request?a.clone():a;n(N,c).then(function(B){if(Array.isArray(m)&&m.indexOf(B.status)===-1)v(B);else if(typeof m=="function")try{return Promise.resolve(m(A,null,B)).then(function(P){P?R(A,null,B):v(B)}).catch(y)}catch(P){y(P)}else A<p?R(A,null,B):v(B)}).catch(function(B){if(typeof m=="function")try{Promise.resolve(m(A,B,null)).then(function(P){P?R(A,B,null):y(B)}).catch(function(P){y(P)})}catch(P){y(P)}else A<p?R(A,B,null):y(B)})};function R(A,N,B){var P=typeof f=="function"?f(A,N,B):f;setTimeout(function(){T(++A)},P)}T(0)})}};function e(n){return Number.isInteger(n)&&n>=0}function r(n){this.name="ArgumentError",this.message=n}return t})});var Xf="9.14.0";var D=class t{static SDK_VERSION=Xf;static SDK_VERSION_CODE;static SDK="WEB";static LOG_PREFIX="CooeeSDK";static COOEE="cooee";static SESSION_STORAGE_SCROLL_ID="sleid";static IDLE_TIME_IN_SECONDS=30*60;static IN_APP_WRAPPER_NAME="cooee-wrapper";static IN_APP_CONTAINER_NAME="cooee-container";static IN_APP_DEFAULT_PADDING=15;static EVENT_SCREEN_VIEW="CE Screen View";static EVENT_APP_BACKGROUND="CE App Background";static EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed";static EVENT_CAMPAIGN_HOLDOUT="CE Campaign Holdout";static EVENT_CAMPAIGN_REJECTED="CE Campaign Rejected";static EVENT_CAMPAIGN_FAILED="CE Campaign Failed";static EVENT_TRIGGER_CLOSED="CE Trigger Closed";static EVENT_SCROLL="CE Scroll";static EVENT_TRIGGER_CLICKED="CE Trigger Clicked";static EVENT_FORM_SUBMITTED="CE Form Submitted";static EVENT_EXPERIMENT_START="CE Experiment Start";static EVENT_VIDEO_DIALOG_CLOSED="CE Video Dialog Closed";static EVENT_VIDEO_DIALOG_OPENED="CE Video Dialog Opened";static EVENT_VIDEO_CHANGE="CE Video Changed";static EVENT_LAST_VIDEO_ENDED="CE Last Video Ended";static EVENT_VIDEO_MUTED="CE Video Muted";static EVENT_VIDEO_UNMUTED="CE Video Unmuted";static EVENT_ADD_TO_CART_CLICKED="CE Add To Cart Clicked";static EVENT_VIEW_ITEM_CLICKED="CE View Item Clicked";static EVENT_MORE_ITEM_INFO_CLICKED="CE More Item Info Clicked";static EVENT_OPEN_CART_CLICKED="CE Open Cart Clicked";static EVENT_ADD_TO_CART="Add To Cart";static EVENT_REMOVE_FROM_CART="Remove From Cart";static EVENT_VIEW_ITEM="View Item";static EVENT_VIEW_CART="View Cart";static EVENT_OPEN_CART="Open Cart";static EVENT_VIEW_COLLECTION="View Collection";static EVENT_BUY_NOW_CLICKED="Buy Now Clicked";static EVENT_CHECKOUT_STARTED="Checkout Started";static EVENT_REVIEW_CLICKED="Review Clicked";static EVENT_ITEM_THUMBNAIL_CLICKED="Item Thumbnail Clicked";static JS_LOAD_WHITELIST_EVENTS=[this.EVENT_VIEW_ITEM,this.EVENT_VIEW_CART,this.EVENT_VIEW_COLLECTION];static HASH_INITIATE_CHECKOUT="initiate-checkout";static HASH_OPEN_CART_DRAWER="open-cart-drawer";static ADD_BUNDLE_CTA_INBOUND_EVENT="letscooee:inbound:cta:add-bundle";static CTA_OPEN_CART_EVENT="letscooee:outbound:open-cart";static CTA_AFTER_REFRESH_UI="letscooee:outbound:refresh-ui";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static SHADOW_SPLITTER=":shadow";static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static CONTENT_ATTRIBUTE="_letscooee_content";static VIA="_via";static PAYMENT_MODAL_DETAILS=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}];static{let e=t.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");t.SDK_VERSION_CODE=parseInt(e,10)}};var It={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${D.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${D.SDK_VERSION}/dist/widget.min.js`};var Dt=ur(bn());var b=class{static log(...e){Dt.default.info(...e)}static debug(...e){Dt.default.debug(...e)}static error(...e){Dt.default.error(...e)}static warn(...e){Dt.default.warn(...e)}static info(...e){Dt.default.info(...e)}static trace(...e){Dt.default.trace(...e)}};function Qf(t=D.LOG_PREFIX){Dt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${D.SDK_VERSION}):`)}});let e=kl();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Dt.default.setLevel(Dt.default[localStorage.cooeeLogLevel]):Dt.default.setLevel(It.debug?Dt.default.TRACE:Dt.default.OFF)}function kl(){return new URL(location.href).searchParams?.get("cooee-debug")}function Zf(){let t=`
|
|
1
|
+
var Vy=Object.create;var Ll=Object.defineProperty,$y=Object.defineProperties,Wy=Object.getOwnPropertyDescriptor,jy=Object.getOwnPropertyDescriptors,Gy=Object.getOwnPropertyNames,$s=Object.getOwnPropertySymbols,Yy=Object.getPrototypeOf,Ml=Object.prototype.hasOwnProperty,Vf=Object.prototype.propertyIsEnumerable;var Hf=(t,e,r)=>e in t?Ll(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_=(t,e)=>{for(var r in e||={})Ml.call(e,r)&&Hf(t,r,e[r]);if($s)for(var r of $s(e))Vf.call(e,r)&&Hf(t,r,e[r]);return t},ee=(t,e)=>$y(t,jy(e));var xo=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var $f=(t,e)=>{var r={};for(var n in t)Ml.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&$s)for(var n of $s(t))e.indexOf(n)<0&&Vf.call(t,n)&&(r[n]=t[n]);return r};var Ro=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var zy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Gy(e))!Ml.call(t,i)&&i!==r&&Ll(t,i,{get:()=>e[i],enumerable:!(n=Wy(e,i))||n.enumerable});return t};var gr=(t,e,r)=>(r=t!=null?Vy(Yy(t)):{},zy(e||!t||!t.__esModule?Ll(r,"default",{value:t,enumerable:!0}):r,t));var Bn=Ro((jf,Ws)=>{"use strict";(function(t){"use strict";var e={};e.VERSION="1.6.1";var r,n={},i=function(p,m){return function(){return m.apply(p,arguments)}},o=function(){var p=arguments,m=p[0],f,E;for(E=1;E<p.length;E++)for(f in p[E])!(f in m)&&p[E].hasOwnProperty(f)&&(m[f]=p[E][f]);return m},s=function(p,m){return{value:p,name:m}};e.TRACE=s(1,"TRACE"),e.DEBUG=s(2,"DEBUG"),e.INFO=s(3,"INFO"),e.TIME=s(4,"TIME"),e.WARN=s(5,"WARN"),e.ERROR=s(8,"ERROR"),e.OFF=s(99,"OFF");var a=function(p){this.context=p,this.setLevel(p.filterLevel),this.log=this.info};a.prototype={setLevel:function(p){p&&"value"in p&&(this.context.filterLevel=p)},getLevel:function(){return this.context.filterLevel},enabledFor:function(p){var m=this.context.filterLevel;return p.value>=m.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"start"])},timeEnd:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"end"])},invoke:function(p,m){r&&this.enabledFor(p)&&r(m,o({level:p},this.context))}};var c=new a({filterLevel:e.OFF});(function(){var p=e;p.enabledFor=i(c,c.enabledFor),p.trace=i(c,c.trace),p.debug=i(c,c.debug),p.time=i(c,c.time),p.timeEnd=i(c,c.timeEnd),p.info=i(c,c.info),p.warn=i(c,c.warn),p.error=i(c,c.error),p.log=p.info})(),e.setHandler=function(p){r=p},e.setLevel=function(p){c.setLevel(p);for(var m in n)n.hasOwnProperty(m)&&n[m].setLevel(p)},e.getLevel=function(){return c.getLevel()},e.get=function(p){return n[p]||(n[p]=new a(o({name:p},c.context)))},e.createDefaultHandler=function(p){p=p||{},p.formatter=p.formatter||function(y,T){T.name&&y.unshift("["+T.name+"]")};var m={},f=function(E,y){Function.prototype.apply.call(E,console,y)};return typeof console>"u"?function(){}:function(E,y){E=Array.prototype.slice.call(E);var T=console.log,D;y.level===e.TIME?(D=(y.name?"["+y.name+"] ":"")+E[0],E[1]==="start"?console.time?console.time(D):m[D]=new Date().getTime():console.timeEnd?console.timeEnd(D):f(T,[D+": "+(new Date().getTime()-m[D])+"ms"])):(y.level===e.WARN&&console.warn?T=console.warn:y.level===e.ERROR&&console.error?T=console.error:y.level===e.INFO&&console.info?T=console.info:y.level===e.DEBUG&&console.debug?T=console.debug:y.level===e.TRACE&&console.trace&&(T=console.trace),p.formatter(E,y),f(T,E))}},e.useDefaults=function(p){e.setLevel(p&&p.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(p))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof Ws<"u"&&Ws.exports?Ws.exports=e:(e._prevLogger=t.Logger,e.noConflict=function(){return t.Logger=e._prevLogger,e},t.Logger=e)})(jf)});var qf=Ro((zf,jl)=>{"use strict";(function(t){if(typeof zf=="object"&&typeof jl<"u")jl.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return function n(i,o,s){function a(m,f){if(!o[m]){if(!i[m]){var E=typeof xo=="function"&&xo;if(!f&&E)return E(m,!0);if(c)return c(m,!0);var y=new Error("Cannot find module '"+m+"'");throw y.code="MODULE_NOT_FOUND",y}var T=o[m]={exports:{}};i[m][0].call(T.exports,function(D){var O=i[m][1][D];return a(O||D)},T,T.exports,n,i,o,s)}return o[m].exports}for(var c=typeof xo=="function"&&xo,p=0;p<s.length;p++)a(s[p]);return a}({1:[function(n,i,o){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,c;if(a){var p=0,m=new a(D),f=s.document.createTextNode("");m.observe(f,{characterData:!0}),c=function(){f.data=p=++p%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=D,c=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?c=function(){var k=s.document.createElement("script");k.onreadystatechange=function(){D(),k.onreadystatechange=null,k.parentNode.removeChild(k),k=null},s.document.documentElement.appendChild(k)}:c=function(){setTimeout(D,0)};var y,T=[];function D(){y=!0;for(var k,z,L=T.length;L;){for(z=T,T=[],k=-1;++k<L;)z[k]();L=T.length}y=!1}i.exports=O;function O(k){T.push(k)===1&&!y&&c()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function a(){}var c={},p=["REJECTED"],m=["FULFILLED"],f=["PENDING"];i.exports=E;function E(J){if(typeof J!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,J!==a&&O(this,J)}E.prototype.catch=function(J){return this.then(null,J)},E.prototype.then=function(J,ce){if(typeof J!="function"&&this.state===m||typeof ce!="function"&&this.state===p)return this;var ae=new this.constructor(a);if(this.state!==f){var me=this.state===m?J:ce;T(ae,me,this.outcome)}else this.queue.push(new y(ae,J,ce));return ae};function y(J,ce,ae){this.promise=J,typeof ce=="function"&&(this.onFulfilled=ce,this.callFulfilled=this.otherCallFulfilled),typeof ae=="function"&&(this.onRejected=ae,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(J){c.resolve(this.promise,J)},y.prototype.otherCallFulfilled=function(J){T(this.promise,this.onFulfilled,J)},y.prototype.callRejected=function(J){c.reject(this.promise,J)},y.prototype.otherCallRejected=function(J){T(this.promise,this.onRejected,J)};function T(J,ce,ae){s(function(){var me;try{me=ce(ae)}catch(Ue){return c.reject(J,Ue)}me===J?c.reject(J,new TypeError("Cannot resolve promise with itself")):c.resolve(J,me)})}c.resolve=function(J,ce){var ae=k(D,ce);if(ae.status==="error")return c.reject(J,ae.value);var me=ae.value;if(me)O(J,me);else{J.state=m,J.outcome=ce;for(var Ue=-1,Ce=J.queue.length;++Ue<Ce;)J.queue[Ue].callFulfilled(ce)}return J},c.reject=function(J,ce){J.state=p,J.outcome=ce;for(var ae=-1,me=J.queue.length;++ae<me;)J.queue[ae].callRejected(ce);return J};function D(J){var ce=J&&J.then;if(J&&(typeof J=="object"||typeof J=="function")&&typeof ce=="function")return function(){ce.apply(J,arguments)}}function O(J,ce){var ae=!1;function me(Ke){ae||(ae=!0,c.reject(J,Ke))}function Ue(Ke){ae||(ae=!0,c.resolve(J,Ke))}function Ce(){ce(Ue,me)}var De=k(Ce);De.status==="error"&&me(De.value)}function k(J,ce){var ae={};try{ae.value=J(ce),ae.status="success"}catch(me){ae.status="error",ae.value=me}return ae}E.resolve=z;function z(J){return J instanceof this?J:c.resolve(new this(a),J)}E.reject=L;function L(J){var ce=new this(a);return c.reject(ce,J)}E.all=Z;function Z(J){var ce=this;if(Object.prototype.toString.call(J)!=="[object Array]")return this.reject(new TypeError("must be an array"));var ae=J.length,me=!1;if(!ae)return this.resolve([]);for(var Ue=new Array(ae),Ce=0,De=-1,Ke=new this(a);++De<ae;)Ze(J[De],De);return Ke;function Ze(kt,A){ce.resolve(kt).then(R,function(W){me||(me=!0,c.reject(Ke,W))});function R(W){Ue[A]=W,++Ce===ae&&!me&&(me=!0,c.resolve(Ke,Ue))}}}E.race=be;function be(J){var ce=this;if(Object.prototype.toString.call(J)!=="[object Array]")return this.reject(new TypeError("must be an array"));var ae=J.length,me=!1;if(!ae)return this.resolve([]);for(var Ue=-1,Ce=new this(a);++Ue<ae;)De(J[Ue]);return Ce;function De(Ke){ce.resolve(Ke).then(function(Ze){me||(me=!0,c.resolve(Ce,Ze))},function(Ze){me||(me=!0,c.reject(Ce,Ze))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function a(d,b){if(!(d instanceof b))throw new TypeError("Cannot call a class as a function")}function c(){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 p=c();function m(){try{if(!p||!p.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),b=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||b)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function f(d,b){d=d||[],b=b||{};try{return new Blob(d,b)}catch(w){if(w.name!=="TypeError")throw w;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,I=new g,C=0;C<d.length;C+=1)I.append(d[C]);return I.getBlob(b.type)}}typeof Promise>"u"&&n(3);var E=Promise;function y(d,b){b&&d.then(function(g){b(null,g)},function(g){b(g)})}function T(d,b,g){typeof b=="function"&&d.then(b),typeof g=="function"&&d.catch(g)}function D(d){return typeof d!="string"&&(console.warn(d+" used as a key, but it is not a string."),d=String(d)),d}function O(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var k="local-forage-detect-blob-support",z=void 0,L={},Z=Object.prototype.toString,be="readonly",J="readwrite";function ce(d){for(var b=d.length,g=new ArrayBuffer(b),I=new Uint8Array(g),C=0;C<b;C++)I[C]=d.charCodeAt(C);return g}function ae(d){return new E(function(b){var g=d.transaction(k,J),I=f([""]);g.objectStore(k).put(I,"key"),g.onabort=function(C){C.preventDefault(),C.stopPropagation(),b(!1)},g.oncomplete=function(){var C=navigator.userAgent.match(/Chrome\/(\d+)/),w=navigator.userAgent.match(/Edge\//);b(w||!C||parseInt(C[1],10)>=43)}}).catch(function(){return!1})}function me(d){return typeof z=="boolean"?E.resolve(z):ae(d).then(function(b){return z=b,z})}function Ue(d){var b=L[d.name],g={};g.promise=new E(function(I,C){g.resolve=I,g.reject=C}),b.deferredOperations.push(g),b.dbReady?b.dbReady=b.dbReady.then(function(){return g.promise}):b.dbReady=g.promise}function Ce(d){var b=L[d.name],g=b.deferredOperations.pop();if(g)return g.resolve(),g.promise}function De(d,b){var g=L[d.name],I=g.deferredOperations.pop();if(I)return I.reject(b),I.promise}function Ke(d,b){return new E(function(g,I){if(L[d.name]=L[d.name]||Xe(),d.db)if(b)Ue(d),d.db.close();else return g(d.db);var C=[d.name];b&&C.push(d.version);var w=p.open.apply(p,C);b&&(w.onupgradeneeded=function(B){var Y=w.result;try{Y.createObjectStore(d.storeName),B.oldVersion<=1&&Y.createObjectStore(k)}catch(q){if(q.name==="ConstraintError")console.warn('The database "'+d.name+'" has been upgraded from version '+B.oldVersion+" to version "+B.newVersion+', but the storage "'+d.storeName+'" already exists.');else throw q}}),w.onerror=function(B){B.preventDefault(),I(w.error)},w.onsuccess=function(){var B=w.result;B.onversionchange=function(Y){Y.target.close()},g(B),Ce(d)}})}function Ze(d){return Ke(d,!1)}function kt(d){return Ke(d,!0)}function A(d,b){if(!d.db)return!0;var g=!d.db.objectStoreNames.contains(d.storeName),I=d.version<d.db.version,C=d.version>d.db.version;if(I&&(d.version!==b&&console.warn('The database "'+d.name+`" can't be downgraded from version `+d.db.version+" to version "+d.version+"."),d.version=d.db.version),C||g){if(g){var w=d.db.version+1;w>d.version&&(d.version=w)}return!0}return!1}function R(d){return new E(function(b,g){var I=new FileReader;I.onerror=g,I.onloadend=function(C){var w=btoa(C.target.result||"");b({__local_forage_encoded_blob:!0,data:w,type:d.type})},I.readAsBinaryString(d)})}function W(d){var b=ce(atob(d.data));return f([b],{type:d.type})}function F(d){return d&&d.__local_forage_encoded_blob}function V(d){var b=this,g=b._initReady().then(function(){var I=L[b._dbInfo.name];if(I&&I.dbReady)return I.dbReady});return T(g,d,d),g}function ie(d){Ue(d);for(var b=L[d.name],g=b.forages,I=0;I<g.length;I++){var C=g[I];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return d.db=null,Ze(d).then(function(w){return d.db=w,A(d)?kt(d):w}).then(function(w){d.db=b.db=w;for(var B=0;B<g.length;B++)g[B]._dbInfo.db=w}).catch(function(w){throw De(d,w),w})}function de(d,b,g,I){I===void 0&&(I=1);try{var C=d.db.transaction(d.storeName,b);g(null,C)}catch(w){if(I>0&&(!d.db||w.name==="InvalidStateError"||w.name==="NotFoundError"))return E.resolve().then(function(){if(!d.db||w.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),kt(d)}).then(function(){return ie(d).then(function(){de(d,b,g,I-1)})}).catch(g);g(w)}}function Xe(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function rt(d){var b=this,g={db:null};if(d)for(var I in d)g[I]=d[I];var C=L[g.name];C||(C=Xe(),L[g.name]=C),C.forages.push(b),b._initReady||(b._initReady=b.ready,b.ready=V);var w=[];function B(){return E.resolve()}for(var Y=0;Y<C.forages.length;Y++){var q=C.forages[Y];q!==b&&w.push(q._initReady().catch(B))}var K=C.forages.slice(0);return E.all(w).then(function(){return g.db=C.db,Ze(g)}).then(function(Q){return g.db=Q,A(g,b._defaultConfig.version)?kt(g):Q}).then(function(Q){g.db=C.db=Q,b._dbInfo=g;for(var re=0;re<K.length;re++){var Ee=K[re];Ee!==b&&(Ee._dbInfo.db=g.db,Ee._dbInfo.version=g.version)}})}function nt(d,b){var g=this;d=D(d);var I=new E(function(C,w){g.ready().then(function(){de(g._dbInfo,be,function(B,Y){if(B)return w(B);try{var q=Y.objectStore(g._dbInfo.storeName),K=q.get(d);K.onsuccess=function(){var Q=K.result;Q===void 0&&(Q=null),F(Q)&&(Q=W(Q)),C(Q)},K.onerror=function(){w(K.error)}}catch(Q){w(Q)}})}).catch(w)});return y(I,b),I}function St(d,b){var g=this,I=new E(function(C,w){g.ready().then(function(){de(g._dbInfo,be,function(B,Y){if(B)return w(B);try{var q=Y.objectStore(g._dbInfo.storeName),K=q.openCursor(),Q=1;K.onsuccess=function(){var re=K.result;if(re){var Ee=re.value;F(Ee)&&(Ee=W(Ee));var Pe=d(Ee,re.key,Q++);Pe!==void 0?C(Pe):re.continue()}else C()},K.onerror=function(){w(K.error)}}catch(re){w(re)}})}).catch(w)});return y(I,b),I}function wt(d,b,g){var I=this;d=D(d);var C=new E(function(w,B){var Y;I.ready().then(function(){return Y=I._dbInfo,Z.call(b)==="[object Blob]"?me(Y.db).then(function(q){return q?b:R(b)}):b}).then(function(q){de(I._dbInfo,J,function(K,Q){if(K)return B(K);try{var re=Q.objectStore(I._dbInfo.storeName);q===null&&(q=void 0);var Ee=re.put(q,d);Q.oncomplete=function(){q===void 0&&(q=null),w(q)},Q.onabort=Q.onerror=function(){var Pe=Ee.error?Ee.error:Ee.transaction.error;B(Pe)}}catch(Pe){B(Pe)}})}).catch(B)});return y(C,g),C}function at(d,b){var g=this;d=D(d);var I=new E(function(C,w){g.ready().then(function(){de(g._dbInfo,J,function(B,Y){if(B)return w(B);try{var q=Y.objectStore(g._dbInfo.storeName),K=q.delete(d);Y.oncomplete=function(){C()},Y.onerror=function(){w(K.error)},Y.onabort=function(){var Q=K.error?K.error:K.transaction.error;w(Q)}}catch(Q){w(Q)}})}).catch(w)});return y(I,b),I}function we(d){var b=this,g=new E(function(I,C){b.ready().then(function(){de(b._dbInfo,J,function(w,B){if(w)return C(w);try{var Y=B.objectStore(b._dbInfo.storeName),q=Y.clear();B.oncomplete=function(){I()},B.onabort=B.onerror=function(){var K=q.error?q.error:q.transaction.error;C(K)}}catch(K){C(K)}})}).catch(C)});return y(g,d),g}function We(d){var b=this,g=new E(function(I,C){b.ready().then(function(){de(b._dbInfo,be,function(w,B){if(w)return C(w);try{var Y=B.objectStore(b._dbInfo.storeName),q=Y.count();q.onsuccess=function(){I(q.result)},q.onerror=function(){C(q.error)}}catch(K){C(K)}})}).catch(C)});return y(g,d),g}function Ne(d,b){var g=this,I=new E(function(C,w){if(d<0){C(null);return}g.ready().then(function(){de(g._dbInfo,be,function(B,Y){if(B)return w(B);try{var q=Y.objectStore(g._dbInfo.storeName),K=!1,Q=q.openKeyCursor();Q.onsuccess=function(){var re=Q.result;if(!re){C(null);return}d===0||K?C(re.key):(K=!0,re.advance(d))},Q.onerror=function(){w(Q.error)}}catch(re){w(re)}})}).catch(w)});return y(I,b),I}function je(d){var b=this,g=new E(function(I,C){b.ready().then(function(){de(b._dbInfo,be,function(w,B){if(w)return C(w);try{var Y=B.objectStore(b._dbInfo.storeName),q=Y.openKeyCursor(),K=[];q.onsuccess=function(){var Q=q.result;if(!Q){I(K);return}K.push(Q.key),Q.continue()},q.onerror=function(){C(q.error)}}catch(Q){C(Q)}})}).catch(C)});return y(g,d),g}function Oe(d,b){b=O.apply(this,arguments);var g=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||g.name,d.storeName=d.storeName||g.storeName);var I=this,C;if(!d.name)C=E.reject("Invalid arguments");else{var w=d.name===g.name&&I._dbInfo.db,B=w?E.resolve(I._dbInfo.db):Ze(d).then(function(Y){var q=L[d.name],K=q.forages;q.db=Y;for(var Q=0;Q<K.length;Q++)K[Q]._dbInfo.db=Y;return Y});d.storeName?C=B.then(function(Y){if(Y.objectStoreNames.contains(d.storeName)){var q=Y.version+1;Ue(d);var K=L[d.name],Q=K.forages;Y.close();for(var re=0;re<Q.length;re++){var Ee=Q[re];Ee._dbInfo.db=null,Ee._dbInfo.version=q}var Pe=new E(function(Le,ot){var et=p.open(d.name,q);et.onerror=function(Zt){var Co=et.result;Co.close(),ot(Zt)},et.onupgradeneeded=function(){var Zt=et.result;Zt.deleteObjectStore(d.storeName)},et.onsuccess=function(){var Zt=et.result;Zt.close(),Le(Zt)}});return Pe.then(function(Le){K.db=Le;for(var ot=0;ot<Q.length;ot++){var et=Q[ot];et._dbInfo.db=Le,Ce(et._dbInfo)}}).catch(function(Le){throw(De(d,Le)||E.resolve()).catch(function(){}),Le})}}):C=B.then(function(Y){Ue(d);var q=L[d.name],K=q.forages;Y.close();for(var Q=0;Q<K.length;Q++){var re=K[Q];re._dbInfo.db=null}var Ee=new E(function(Pe,Le){var ot=p.deleteDatabase(d.name);ot.onerror=function(){var et=ot.result;et&&et.close(),Le(ot.error)},ot.onblocked=function(){console.warn('dropInstance blocked for database "'+d.name+'" until all open connections are closed')},ot.onsuccess=function(){var et=ot.result;et&&et.close(),Pe(et)}});return Ee.then(function(Pe){q.db=Pe;for(var Le=0;Le<K.length;Le++){var ot=K[Le];Ce(ot._dbInfo)}}).catch(function(Pe){throw(De(d,Pe)||E.resolve()).catch(function(){}),Pe})})}return y(C,b),C}var Gt={_driver:"asyncStorage",_initStorage:rt,_support:m(),iterate:St,getItem:nt,setItem:wt,removeItem:at,clear:we,length:We,key:Ne,keys:je,dropInstance:Oe};function h(){return typeof openDatabase=="function"}var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",P=x.length,j="arbf",pe="blob",Se="si08",he="ui08",ke="uic8",Ve="si16",it="si32",mr="ur16",zr="ui32",vi="fl32",dr="fl64",hr=P+j.length,Of=Object.prototype.toString;function Pf(d){var b=d.length*.75,g=d.length,I,C=0,w,B,Y,q;d[d.length-1]==="="&&(b--,d[d.length-2]==="="&&b--);var K=new ArrayBuffer(b),Q=new Uint8Array(K);for(I=0;I<g;I+=4)w=l.indexOf(d[I]),B=l.indexOf(d[I+1]),Y=l.indexOf(d[I+2]),q=l.indexOf(d[I+3]),Q[C++]=w<<2|B>>4,Q[C++]=(B&15)<<4|Y>>2,Q[C++]=(Y&3)<<6|q&63;return K}function Rl(d){var b=new Uint8Array(d),g="",I;for(I=0;I<b.length;I+=3)g+=l[b[I]>>2],g+=l[(b[I]&3)<<4|b[I+1]>>4],g+=l[(b[I+1]&15)<<2|b[I+2]>>6],g+=l[b[I+2]&63];return b.length%3===2?g=g.substring(0,g.length-1)+"=":b.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function ny(d,b){var g="";if(d&&(g=Of.call(d)),d&&(g==="[object ArrayBuffer]"||d.buffer&&Of.call(d.buffer)==="[object ArrayBuffer]")){var I,C=x;d instanceof ArrayBuffer?(I=d,C+=j):(I=d.buffer,g==="[object Int8Array]"?C+=Se:g==="[object Uint8Array]"?C+=he:g==="[object Uint8ClampedArray]"?C+=ke:g==="[object Int16Array]"?C+=Ve:g==="[object Uint16Array]"?C+=mr:g==="[object Int32Array]"?C+=it:g==="[object Uint32Array]"?C+=zr:g==="[object Float32Array]"?C+=vi:g==="[object Float64Array]"?C+=dr:b(new Error("Failed to get type for BinaryArray"))),b(C+Rl(I))}else if(g==="[object Blob]"){var w=new FileReader;w.onload=function(){var B=u+d.type+"~"+Rl(this.result);b(x+pe+B)},w.readAsArrayBuffer(d)}else try{b(JSON.stringify(d))}catch(B){console.error("Couldn't convert value into a JSON string: ",d),b(null,B)}}function iy(d){if(d.substring(0,P)!==x)return JSON.parse(d);var b=d.substring(hr),g=d.substring(P,hr),I;if(g===pe&&v.test(b)){var C=b.match(v);I=C[1],b=b.substring(C[0].length)}var w=Pf(b);switch(g){case j:return w;case pe:return f([w],{type:I});case Se:return new Int8Array(w);case he:return new Uint8Array(w);case ke:return new Uint8ClampedArray(w);case Ve:return new Int16Array(w);case mr:return new Uint16Array(w);case it:return new Int32Array(w);case zr:return new Uint32Array(w);case vi:return new Float32Array(w);case dr:return new Float64Array(w);default:throw new Error("Unkown type: "+g)}}var Al={serialize:ny,deserialize:iy,stringToBuffer:Pf,bufferToString:Rl};function Lf(d,b,g,I){d.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,I)}function oy(d){var b=this,g={db:null};if(d)for(var I in d)g[I]=typeof d[I]!="string"?d[I].toString():d[I];var C=new E(function(w,B){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(Y){return B(Y)}g.db.transaction(function(Y){Lf(Y,g,function(){b._dbInfo=g,w()},function(q,K){B(K)})},B)});return g.serializer=Al,C}function fn(d,b,g,I,C,w){d.executeSql(g,I,C,function(B,Y){Y.code===Y.SYNTAX_ERR?B.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(q,K){K.rows.length?w(q,Y):Lf(q,b,function(){q.executeSql(g,I,C,w)},w)},w):w(B,Y)},w)}function sy(d,b){var g=this;d=D(d);var I=new E(function(C,w){g.ready().then(function(){var B=g._dbInfo;B.db.transaction(function(Y){fn(Y,B,"SELECT * FROM "+B.storeName+" WHERE key = ? LIMIT 1",[d],function(q,K){var Q=K.rows.length?K.rows.item(0).value:null;Q&&(Q=B.serializer.deserialize(Q)),C(Q)},function(q,K){w(K)})})}).catch(w)});return y(I,b),I}function ay(d,b){var g=this,I=new E(function(C,w){g.ready().then(function(){var B=g._dbInfo;B.db.transaction(function(Y){fn(Y,B,"SELECT * FROM "+B.storeName,[],function(q,K){for(var Q=K.rows,re=Q.length,Ee=0;Ee<re;Ee++){var Pe=Q.item(Ee),Le=Pe.value;if(Le&&(Le=B.serializer.deserialize(Le)),Le=d(Le,Pe.key,Ee+1),Le!==void 0){C(Le);return}}C()},function(q,K){w(K)})})}).catch(w)});return y(I,b),I}function Mf(d,b,g,I){var C=this;d=D(d);var w=new E(function(B,Y){C.ready().then(function(){b===void 0&&(b=null);var q=b,K=C._dbInfo;K.serializer.serialize(b,function(Q,re){re?Y(re):K.db.transaction(function(Ee){fn(Ee,K,"INSERT OR REPLACE INTO "+K.storeName+" (key, value) VALUES (?, ?)",[d,Q],function(){B(q)},function(Pe,Le){Y(Le)})},function(Ee){if(Ee.code===Ee.QUOTA_ERR){if(I>0){B(Mf.apply(C,[d,q,g,I-1]));return}Y(Ee)}})})}).catch(Y)});return y(w,g),w}function cy(d,b,g){return Mf.apply(this,[d,b,g,1])}function ly(d,b){var g=this;d=D(d);var I=new E(function(C,w){g.ready().then(function(){var B=g._dbInfo;B.db.transaction(function(Y){fn(Y,B,"DELETE FROM "+B.storeName+" WHERE key = ?",[d],function(){C()},function(q,K){w(K)})})}).catch(w)});return y(I,b),I}function uy(d){var b=this,g=new E(function(I,C){b.ready().then(function(){var w=b._dbInfo;w.db.transaction(function(B){fn(B,w,"DELETE FROM "+w.storeName,[],function(){I()},function(Y,q){C(q)})})}).catch(C)});return y(g,d),g}function py(d){var b=this,g=new E(function(I,C){b.ready().then(function(){var w=b._dbInfo;w.db.transaction(function(B){fn(B,w,"SELECT COUNT(key) as c FROM "+w.storeName,[],function(Y,q){var K=q.rows.item(0).c;I(K)},function(Y,q){C(q)})})}).catch(C)});return y(g,d),g}function fy(d,b){var g=this,I=new E(function(C,w){g.ready().then(function(){var B=g._dbInfo;B.db.transaction(function(Y){fn(Y,B,"SELECT key FROM "+B.storeName+" WHERE id = ? LIMIT 1",[d+1],function(q,K){var Q=K.rows.length?K.rows.item(0).key:null;C(Q)},function(q,K){w(K)})})}).catch(w)});return y(I,b),I}function my(d){var b=this,g=new E(function(I,C){b.ready().then(function(){var w=b._dbInfo;w.db.transaction(function(B){fn(B,w,"SELECT key FROM "+w.storeName,[],function(Y,q){for(var K=[],Q=0;Q<q.rows.length;Q++)K.push(q.rows.item(Q).key);I(K)},function(Y,q){C(q)})})}).catch(C)});return y(g,d),g}function dy(d){return new E(function(b,g){d.transaction(function(I){I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,w){for(var B=[],Y=0;Y<w.rows.length;Y++)B.push(w.rows.item(Y).name);b({db:d,storeNames:B})},function(C,w){g(w)})},function(I){g(I)})})}function hy(d,b){b=O.apply(this,arguments);var g=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||g.name,d.storeName=d.storeName||g.storeName);var I=this,C;return d.name?C=new E(function(w){var B;d.name===g.name?B=I._dbInfo.db:B=openDatabase(d.name,"","",0),d.storeName?w({db:B,storeNames:[d.storeName]}):w(dy(B))}).then(function(w){return new E(function(B,Y){w.db.transaction(function(q){function K(Pe){return new E(function(Le,ot){q.executeSql("DROP TABLE IF EXISTS "+Pe,[],function(){Le()},function(et,Zt){ot(Zt)})})}for(var Q=[],re=0,Ee=w.storeNames.length;re<Ee;re++)Q.push(K(w.storeNames[re]));E.all(Q).then(function(){B()}).catch(function(Pe){Y(Pe)})},function(q){Y(q)})})}):C=E.reject("Invalid arguments"),y(C,b),C}var gy={_driver:"webSQLStorage",_initStorage:oy,_support:h(),iterate:ay,getItem:sy,setItem:cy,removeItem:ly,clear:uy,length:py,key:fy,keys:my,dropInstance:hy};function yy(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Bf(d,b){var g=d.name+"/";return d.storeName!==b.storeName&&(g+=d.storeName+"/"),g}function vy(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function Ey(){return!vy()||localStorage.length>0}function _y(d){var b=this,g={};if(d)for(var I in d)g[I]=d[I];return g.keyPrefix=Bf(d,b._defaultConfig),Ey()?(b._dbInfo=g,g.serializer=Al,E.resolve()):E.reject()}function by(d){var b=this,g=b.ready().then(function(){for(var I=b._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var w=localStorage.key(C);w.indexOf(I)===0&&localStorage.removeItem(w)}});return y(g,d),g}function Sy(d,b){var g=this;d=D(d);var I=g.ready().then(function(){var C=g._dbInfo,w=localStorage.getItem(C.keyPrefix+d);return w&&(w=C.serializer.deserialize(w)),w});return y(I,b),I}function wy(d,b){var g=this,I=g.ready().then(function(){for(var C=g._dbInfo,w=C.keyPrefix,B=w.length,Y=localStorage.length,q=1,K=0;K<Y;K++){var Q=localStorage.key(K);if(Q.indexOf(w)===0){var re=localStorage.getItem(Q);if(re&&(re=C.serializer.deserialize(re)),re=d(re,Q.substring(B),q++),re!==void 0)return re}}});return y(I,b),I}function Iy(d,b){var g=this,I=g.ready().then(function(){var C=g._dbInfo,w;try{w=localStorage.key(d)}catch{w=null}return w&&(w=w.substring(C.keyPrefix.length)),w});return y(I,b),I}function Ty(d){var b=this,g=b.ready().then(function(){for(var I=b._dbInfo,C=localStorage.length,w=[],B=0;B<C;B++){var Y=localStorage.key(B);Y.indexOf(I.keyPrefix)===0&&w.push(Y.substring(I.keyPrefix.length))}return w});return y(g,d),g}function Cy(d){var b=this,g=b.keys().then(function(I){return I.length});return y(g,d),g}function xy(d,b){var g=this;d=D(d);var I=g.ready().then(function(){var C=g._dbInfo;localStorage.removeItem(C.keyPrefix+d)});return y(I,b),I}function Ry(d,b,g){var I=this;d=D(d);var C=I.ready().then(function(){b===void 0&&(b=null);var w=b;return new E(function(B,Y){var q=I._dbInfo;q.serializer.serialize(b,function(K,Q){if(Q)Y(Q);else try{localStorage.setItem(q.keyPrefix+d,K),B(w)}catch(re){(re.name==="QuotaExceededError"||re.name==="NS_ERROR_DOM_QUOTA_REACHED")&&Y(re),Y(re)}})})});return y(C,g),C}function Ay(d,b){if(b=O.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var g=this.config();d.name=d.name||g.name,d.storeName=d.storeName||g.storeName}var I=this,C;return d.name?C=new E(function(w){d.storeName?w(Bf(d,I._defaultConfig)):w(d.name+"/")}).then(function(w){for(var B=localStorage.length-1;B>=0;B--){var Y=localStorage.key(B);Y.indexOf(w)===0&&localStorage.removeItem(Y)}}):C=E.reject("Invalid arguments"),y(C,b),C}var Dy={_driver:"localStorageWrapper",_initStorage:_y,_support:yy(),iterate:wy,getItem:Sy,setItem:Ry,removeItem:xy,clear:by,length:Cy,key:Iy,keys:Ty,dropInstance:Ay},Ny=function(b,g){return b===g||typeof b=="number"&&typeof g=="number"&&isNaN(b)&&isNaN(g)},Oy=function(b,g){for(var I=b.length,C=0;C<I;){if(Ny(b[C],g))return!0;C++}return!1},Uf=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},To={},kf={},Ei={INDEXEDDB:Gt,WEBSQL:gy,LOCALSTORAGE:Dy},Py=[Ei.INDEXEDDB._driver,Ei.WEBSQL._driver,Ei.LOCALSTORAGE._driver],Vs=["dropInstance"],Dl=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Vs),Ly={description:"",driver:Py.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function My(d,b){d[b]=function(){var g=arguments;return d.ready().then(function(){return d[b].apply(d,g)})}}function Nl(){for(var d=1;d<arguments.length;d++){var b=arguments[d];if(b)for(var g in b)b.hasOwnProperty(g)&&(Uf(b[g])?arguments[0][g]=b[g].slice():arguments[0][g]=b[g])}return arguments[0]}var By=function(){function d(b){a(this,d);for(var g in Ei)if(Ei.hasOwnProperty(g)){var I=Ei[g],C=I._driver;this[g]=C,To[C]||this.defineDriver(I)}this._defaultConfig=Nl({},Ly),this._config=Nl({},this._defaultConfig,b),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var I in g){if(I==="storeName"&&(g[I]=g[I].replace(/\W/g,"_")),I==="version"&&typeof g[I]!="number")return new Error("Database version must be a number.");this._config[I]=g[I]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},d.prototype.defineDriver=function(g,I,C){var w=new E(function(B,Y){try{var q=g._driver,K=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){Y(K);return}for(var Q=Dl.concat("_initStorage"),re=0,Ee=Q.length;re<Ee;re++){var Pe=Q[re],Le=!Oy(Vs,Pe);if((Le||g[Pe])&&typeof g[Pe]!="function"){Y(K);return}}var ot=function(){for(var Co=function(Fy){return function(){var Hy=new Error("Method "+Fy+" is not implemented by the current driver"),Ff=E.reject(Hy);return y(Ff,arguments[arguments.length-1]),Ff}},Ol=0,ky=Vs.length;Ol<ky;Ol++){var Pl=Vs[Ol];g[Pl]||(g[Pl]=Co(Pl))}};ot();var et=function(Co){To[q]&&console.info("Redefining LocalForage driver: "+q),To[q]=g,kf[q]=Co,B()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(et,Y):et(!!g._support):et(!0)}catch(Zt){Y(Zt)}});return T(w,I,C),w},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(g,I,C){var w=To[g]?E.resolve(To[g]):E.reject(new Error("Driver not found."));return T(w,I,C),w},d.prototype.getSerializer=function(g){var I=E.resolve(Al);return T(I,g),I},d.prototype.ready=function(g){var I=this,C=I._driverSet.then(function(){return I._ready===null&&(I._ready=I._initDriver()),I._ready});return T(C,g,g),C},d.prototype.setDriver=function(g,I,C){var w=this;Uf(g)||(g=[g]);var B=this._getSupportedDrivers(g);function Y(){w._config.driver=w.driver()}function q(re){return w._extend(re),Y(),w._ready=w._initStorage(w._config),w._ready}function K(re){return function(){var Ee=0;function Pe(){for(;Ee<re.length;){var Le=re[Ee];return Ee++,w._dbInfo=null,w._ready=null,w.getDriver(Le).then(q).catch(Pe)}Y();var ot=new Error("No available storage method found.");return w._driverSet=E.reject(ot),w._driverSet}return Pe()}}var Q=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=Q.then(function(){var re=B[0];return w._dbInfo=null,w._ready=null,w.getDriver(re).then(function(Ee){w._driver=Ee._driver,Y(),w._wrapLibraryMethodsWithReady(),w._initDriver=K(B)})}).catch(function(){Y();var re=new Error("No available storage method found.");return w._driverSet=E.reject(re),w._driverSet}),T(this._driverSet,I,C),this._driverSet},d.prototype.supports=function(g){return!!kf[g]},d.prototype._extend=function(g){Nl(this,g)},d.prototype._getSupportedDrivers=function(g){for(var I=[],C=0,w=g.length;C<w;C++){var B=g[C];this.supports(B)&&I.push(B)}return I},d.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,I=Dl.length;g<I;g++)My(this,Dl[g])},d.prototype.createInstance=function(g){return new d(g)},d}(),Uy=new By;i.exports=Uy},{3:3}]},{},[4])(4)})});var Ih=Ro((ec,wh)=>{"use strict";(function(t,e){typeof ec=="object"&&typeof wh<"u"?e(ec):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(ec,function(t){"use strict";function e(A){var R,W,F=new Error(A);return R=F,W=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,W):R.__proto__=W,F}function r(A,R,W){var F=R.slice(0,W).split(/\n/),V=F.length,ie=F[V-1].length+1;throw e(A+=" at line "+V+" col "+ie+`:
|
|
2
|
+
|
|
3
|
+
`+R.split(/\n/)[V-1]+`
|
|
4
|
+
`+Array(ie).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,i=!1;try{i=new Function("return (async function(){}).constructor")()}catch(A){if(!(A instanceof SyntaxError))throw A}function o(A,R){return Object.prototype.hasOwnProperty.call(A,R)}function s(A,R,W){for(var F in R)o(R,F)&&(R[F]==null||typeof R[F]!="object"||F!=="storage"&&F!=="prefixes"||W?A[F]=R[F]:A[F]=s({},R[F]));return A}var a=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,p=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,m=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,f=/[.*+\-?^${}()|[\]\\]/g;function E(A){return f.test(A)?A.replace(f,"\\$&"):A}function y(A,R){R.rmWhitespace&&(A=A.replace(/[\r\n]+/g,`
|
|
5
|
+
`).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,p.lastIndex=0,m.lastIndex=0;var W=R.prefixes,F=[W.h,W.b,W.i,W.r,W.c,W.e].reduce(function(at,we){return at&&we?at+"|"+E(we):we?E(we):at},""),V=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+E(R.tags[1])+")","g"),ie=new RegExp("([^]*?)"+E(R.tags[0])+"(-|_)?\\s*("+F+")?\\s*","g"),de=0,Xe=!1;function rt(at,we){var We,Ne={f:[]},je=0,Oe="c";function Gt(pe){var Se=A.slice(de,pe),he=Se.trim();if(Oe==="f")he==="safe"?Ne.raw=!0:R.async&&a.test(he)?(he=he.replace(a,""),Ne.f.push([he,"",!0])):Ne.f.push([he,""]);else if(Oe==="fp")Ne.f[Ne.f.length-1][1]+=he;else if(Oe==="err"){if(he){var ke=Se.search(/\S/);r("invalid syntax",A,de+ke)}}else Ne[Oe]=he;de=pe+1}for(we==="h"||we==="b"||we==="c"?Oe="n":we==="r"&&(Ne.raw=!0,we="i"),V.lastIndex=de;(We=V.exec(A))!==null;){var h=We[1],l=We[2],u=We[3],v=We[4],x=We[5],P=We.index;if(h)h==="("?(je===0&&(Oe==="n"?(Gt(P),Oe="p"):Oe==="f"&&(Gt(P),Oe="fp")),je++):h===")"?--je===0&&Oe!=="c"&&(Gt(P),Oe="err"):je===0&&h==="|"?(Gt(P),Oe="f"):h==="=>"&&(Gt(P),de+=1,Oe="res");else if(l)if(l==="/*"){var j=A.indexOf("*/",V.lastIndex);j===-1&&r("unclosed comment",A,We.index),V.lastIndex=j+2}else l==="'"?(p.lastIndex=We.index,p.exec(A)?V.lastIndex=p.lastIndex:r("unclosed string",A,We.index)):l==='"'?(m.lastIndex=We.index,m.exec(A)?V.lastIndex=m.lastIndex:r("unclosed string",A,We.index)):l==="`"&&(c.lastIndex=We.index,c.exec(A)?V.lastIndex=c.lastIndex:r("unclosed string",A,We.index));else if(u)return Gt(P),de=P+We[0].length,ie.lastIndex=de,Xe=x,v&&we==="h"&&(we="s"),Ne.t=we,Ne}return r("unclosed tag",A,at),Ne}var nt=function at(we,We){we.b=[],we.d=[];var Ne,je=!1,Oe=[];function Gt(ke,Ve){ke&&(ke=function(it,mr,zr,vi){var dr,hr;return typeof mr.autoTrim=="string"?dr=hr=mr.autoTrim:Array.isArray(mr.autoTrim)&&(dr=mr.autoTrim[1],hr=mr.autoTrim[0]),(zr||zr===!1)&&(dr=zr),(vi||vi===!1)&&(hr=vi),dr==="slurp"&&hr==="slurp"?it.trim():(dr==="_"||dr==="slurp"?it=String.prototype.trimLeft?it.trimLeft():it.replace(/^[\s\uFEFF\xA0]+/,""):dr!=="-"&&dr!=="nl"||(it=it.replace(/^(?:\n|\r|\r\n)/,"")),hr==="_"||hr==="slurp"?it=String.prototype.trimRight?it.trimRight():it.replace(/[\s\uFEFF\xA0]+$/,""):hr!=="-"&&hr!=="nl"||(it=it.replace(/(?:\n|\r|\r\n)$/,"")),it)}(ke,R,Xe,Ve))&&(ke=ke.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Oe.push(ke))}for(;(Ne=ie.exec(A))!==null;){var h,l=Ne[1],u=Ne[2],v=Ne[3]||"";for(var x in W)if(W[x]===v){h=x;break}Gt(l,u),de=Ne.index+Ne[0].length,h||r("unrecognized tag type: "+v,A,de);var P=rt(Ne.index,h),j=P.t;if(j==="h"){var pe=P.n||"";R.async&&a.test(pe)&&(P.a=!0,P.n=pe.replace(a,"")),P=at(P),Oe.push(P)}else if(j==="c"){if(we.n===P.n)return je?(je.d=Oe,we.b.push(je)):we.d=Oe,we;r("Helper start and end don't match",A,Ne.index+Ne[0].length)}else if(j==="b"){je?(je.d=Oe,we.b.push(je)):we.d=Oe;var Se=P.n||"";R.async&&a.test(Se)&&(P.a=!0,P.n=Se.replace(a,"")),je=P,Oe=[]}else if(j==="s"){var he=P.n||"";R.async&&a.test(he)&&(P.a=!0,P.n=he.replace(a,"")),Oe.push(P)}else Oe.push(P)}if(!We)throw e('unclosed helper "'+we.n+'"');return Gt(A.slice(de,A.length),!1),we.d=Oe,we}({f:[]},!0);if(R.plugins)for(var St=0;St<R.plugins.length;St++){var wt=R.plugins[St];wt.processAST&&(nt.d=wt.processAST(nt.d,R))}return nt.d}function T(A,R){var W=y(A,R),F="var tR='';"+(R.useWith?"with("+R.varName+"||{}){":"")+L(W,R)+"if(cb){cb(null,tR)} return tR"+(R.useWith?"}":"");if(R.plugins)for(var V=0;V<R.plugins.length;V++){var ie=R.plugins[V];ie.processFnString&&(F=ie.processFnString(F,R))}return F}function D(A,R){for(var W=0;W<R.length;W++){var F=R[W][0],V=R[W][1];A=(R[W][2]?"await ":"")+"c.l('F','"+F+"')("+A,V&&(A+=","+V),A+=")"}return A}function O(A,R,W,F,V,ie){var de="{exec:"+(V?"async ":"")+z(W,R,A)+",params:["+F+"]";return ie&&(de+=",name:'"+ie+"'"),V&&(de+=",async:true"),de+="}"}function k(A,R){for(var W="[",F=0;F<A.length;F++){var V=A[F];W+=O(R,V.res||"",V.d,V.p||"",V.a,V.n),F<A.length&&(W+=",")}return W+="]"}function z(A,R,W){return"function("+R+"){var tR='';"+L(A,W)+"return tR}"}function L(A,R){for(var W=0,F=A.length,V="";W<F;W++){var ie=A[W];if(typeof ie=="string")V+="tR+='"+ie+"';";else{var de=ie.t,Xe=ie.c||"",rt=ie.f,nt=ie.n||"",St=ie.p||"",wt=ie.res||"",at=ie.b,we=!!ie.a;if(de==="i"){R.defaultFilter&&(Xe="c.l('F','"+R.defaultFilter+"')("+Xe+")");var We=D(Xe,rt);!ie.raw&&R.autoEscape&&(We="c.l('F','e')("+We+")"),V+="tR+="+We+";"}else if(de==="h")if(R.storage.nativeHelpers.get(nt))V+=R.storage.nativeHelpers.get(nt)(ie,R);else{var Ne=(we?"await ":"")+"c.l('H','"+nt+"')("+O(R,wt,ie.d,St,we);Ne+=at?","+k(at,R):",[]",V+="tR+="+D(Ne+=",c)",rt)+";"}else de==="s"?V+="tR+="+D((we?"await ":"")+"c.l('H','"+nt+"')({params:["+St+"]},[],c)",rt)+";":de==="e"&&(V+=Xe+`
|
|
6
|
+
`)}}return V}var Z=function(){function A(R){this.cache=R}return A.prototype.define=function(R,W){this.cache[R]=W},A.prototype.get=function(R){return this.cache[R]},A.prototype.remove=function(R){delete this.cache[R]},A.prototype.reset=function(){this.cache={}},A.prototype.load=function(R){s(this.cache,R,!0)},A}();function be(A,R,W,F){if(R&&R.length>0)throw e((F?"Native":"")+"Helper '"+A+"' doesn't accept blocks");if(W&&W.length>0)throw e((F?"Native":"")+"Helper '"+A+"' doesn't accept filters")}var J={"&":"&","<":"<",">":">",'"':""","'":"'"};function ce(A){return J[A]}var ae=new Z({}),me=new Z({each:function(A,R){var W="",F=A.params[0];if(be("each",R,!1),A.async)return new Promise(function(ie){(function de(Xe,rt,nt,St,wt){nt(Xe[rt],rt).then(function(at){St+=at,rt===Xe.length-1?wt(St):de(Xe,rt+1,nt,St,wt)})})(F,0,A.exec,W,ie)});for(var V=0;V<F.length;V++)W+=A.exec(F[V],V);return W},foreach:function(A,R){var W=A.params[0];if(be("foreach",R,!1),A.async)return new Promise(function(ie){(function de(Xe,rt,nt,St,wt,at){St(rt[nt],Xe[rt[nt]]).then(function(we){wt+=we,nt===rt.length-1?at(wt):de(Xe,rt,nt+1,St,wt,at)})})(W,Object.keys(W),0,A.exec,"",ie)});var F="";for(var V in W)o(W,V)&&(F+=A.exec(V,W[V]));return F},include:function(A,R,W){be("include",R,!1);var F=W.storage.templates.get(A.params[0]);if(!F)throw e('Could not fetch template "'+A.params[0]+'"');return F(A.params[1],W)},extends:function(A,R,W){var F=A.params[1]||{};F.content=A.exec();for(var V=0;V<R.length;V++){var ie=R[V];F[ie.name]=ie.exec()}var de=W.storage.templates.get(A.params[0]);if(!de)throw e('Could not fetch template "'+A.params[0]+'"');return de(F,W)},useScope:function(A,R){return be("useScope",R,!1),A.exec(A.params[0])}}),Ue=new Z({if:function(A,R){be("if",!1,A.f,!0);var W="if("+A.p+"){"+L(A.d,R)+"}";if(A.b)for(var F=0;F<A.b.length;F++){var V=A.b[F];V.n==="else"?W+="else{"+L(V.d,R)+"}":V.n==="elif"&&(W+="else if("+V.p+"){"+L(V.d,R)+"}")}return W},try:function(A,R){if(be("try",!1,A.f,!0),!A.b||A.b.length!==1||A.b[0].n!=="catch")throw e("native helper 'try' only accepts 1 block, 'catch'");var W="try{"+L(A.d,R)+"}",F=A.b[0];return W+="catch"+(F.res?"("+F.res+")":"")+"{"+L(F.d,R)+"}"},block:function(A,R){return be("block",A.b,A.f,!0),"if(!"+R.varName+"["+A.p+"]){tR+=("+z(A.d,"",R)+")()}else{tR+="+R.varName+"["+A.p+"]}"}}),Ce=new Z({e:function(A){var R=String(A);return/[&<>"']/.test(R)?R.replace(/[&<>"']/g,ce):R}}),De={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(A,R){if(A==="H"){var W=this.storage.helpers.get(R);if(W)return W;throw e("Can't find helper '"+R+"'")}if(A==="F"){var F=this.storage.filters.get(R);if(F)return F;throw e("Can't find filter '"+R+"'")}},async:!1,storage:{helpers:me,nativeHelpers:Ue,filters:Ce,templates:ae},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function Ke(A,R){var W={};return s(W,De),R&&s(W,R),A&&s(W,A),W.l.bind(W),W}function Ze(A,R){var W,F=Ke(R||{}),V=Function;if(F.async){if(!i)throw e("This environment doesn't support async/await");V=i}if(F.varName&&(W=F.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(W)===!1))throw e("options.varName must be a valid JS identifier");try{return new V(F.varName,"c","cb",T(A,F))}catch(ie){throw ie instanceof SyntaxError?e(`Bad template syntax
|
|
7
|
+
|
|
8
|
+
`+ie.message+`
|
|
9
|
+
`+Array(ie.message.length+1).join("=")+`
|
|
10
|
+
`+T(A,F)):ie}}function kt(A,R){var W;return R.cache&&R.name&&R.storage.templates.get(R.name)?R.storage.templates.get(R.name):(W=typeof A=="function"?A:Ze(A,R),R.cache&&R.name&&R.storage.templates.define(R.name,W),W)}De.l.bind(De),t.compile=Ze,t.compileScope=L,t.compileScopeIntoFunction=z,t.compileToString=T,t.defaultConfig=De,t.filters=Ce,t.getConfig=Ke,t.helpers=me,t.nativeHelpers=Ue,t.parse=y,t.render=function(A,R,W,F){var V=Ke(W||{});if(!V.async)return kt(A,V)(R,V);if(!F){if(typeof n=="function")return new n(function(ie,de){try{ie(kt(A,V)(R,V))}catch(Xe){de(Xe)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{kt(A,V)(R,V,F)}catch(ie){return F(ie)}},t.templates=ae,Object.defineProperty(t,"__esModule",{value:!0})})});var gf=Ro(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.URLBuilder=void 0;var ES=function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t}();Uc.URLBuilder=ES});var Jg=Ro((Af,Df)=>{"use strict";(function(t,e){typeof Af=="object"&&typeof Df<"u"?Df.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.fetchRetry=e())})(Af,function(){"use strict";var t=function(n,i){if(i=i||{},typeof n!="function")throw new r("fetch must be a function");if(typeof i!="object")throw new r("defaults must be an object");if(i.retries!==void 0&&!e(i.retries))throw new r("retries must be a positive integer");if(i.retryDelay!==void 0&&!e(i.retryDelay)&&typeof i.retryDelay!="function")throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(i.retryOn!==void 0&&!Array.isArray(i.retryOn)&&typeof i.retryOn!="function")throw new r("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return i=Object.assign(o,i),function(a,c){var p=i.retries,m=i.retryDelay,f=i.retryOn;if(c&&c.retries!==void 0)if(e(c.retries))p=c.retries;else throw new r("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(e(c.retryDelay)||typeof c.retryDelay=="function")m=c.retryDelay;else throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")f=c.retryOn;else throw new r("retryOn property expects an array or function");return new Promise(function(E,y){var T=function(O){var k=typeof Request<"u"&&a instanceof Request?a.clone():a;n(k,c).then(function(z){if(Array.isArray(f)&&f.indexOf(z.status)===-1)E(z);else if(typeof f=="function")try{return Promise.resolve(f(O,null,z)).then(function(L){L?D(O,null,z):E(z)}).catch(y)}catch(L){y(L)}else O<p?D(O,null,z):E(z)}).catch(function(z){if(typeof f=="function")try{Promise.resolve(f(O,z,null)).then(function(L){L?D(O,z,null):y(z)}).catch(function(L){y(L)})}catch(L){y(L)}else O<p?D(O,z,null):y(z)})};function D(O,k,z){var L=typeof m=="function"?m(O,k,z):m;setTimeout(function(){T(++O)},L)}T(0)})}};function e(n){return Number.isInteger(n)&&n>=0}function r(n){this.name="ArgumentError",this.message=n}return t})});var Wf="9.14.1";var N=class t{static SDK_VERSION=Wf;static SDK_VERSION_CODE;static SDK="WEB";static LOG_PREFIX="CooeeSDK";static COOEE="cooee";static SESSION_STORAGE_SCROLL_ID="sleid";static IDLE_TIME_IN_SECONDS=30*60;static IN_APP_WRAPPER_NAME="cooee-wrapper";static IN_APP_CONTAINER_NAME="cooee-container";static IN_APP_DEFAULT_PADDING=15;static EVENT_SCREEN_VIEW="CE Screen View";static EVENT_APP_BACKGROUND="CE App Background";static EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed";static EVENT_CAMPAIGN_HOLDOUT="CE Campaign Holdout";static EVENT_CAMPAIGN_REJECTED="CE Campaign Rejected";static EVENT_CAMPAIGN_FAILED="CE Campaign Failed";static EVENT_TRIGGER_CLOSED="CE Trigger Closed";static EVENT_SCROLL="CE Scroll";static EVENT_TRIGGER_CLICKED="CE Trigger Clicked";static EVENT_FORM_SUBMITTED="CE Form Submitted";static EVENT_EXPERIMENT_START="CE Experiment Start";static EVENT_VIDEO_DIALOG_CLOSED="CE Video Dialog Closed";static EVENT_VIDEO_DIALOG_OPENED="CE Video Dialog Opened";static EVENT_VIDEO_CHANGE="CE Video Changed";static EVENT_LAST_VIDEO_ENDED="CE Last Video Ended";static EVENT_VIDEO_MUTED="CE Video Muted";static EVENT_VIDEO_UNMUTED="CE Video Unmuted";static EVENT_ADD_TO_CART_CLICKED="CE Add To Cart Clicked";static EVENT_VIEW_ITEM_CLICKED="CE View Item Clicked";static EVENT_MORE_ITEM_INFO_CLICKED="CE More Item Info Clicked";static EVENT_OPEN_CART_CLICKED="CE Open Cart Clicked";static EVENT_ADD_TO_CART="Add To Cart";static EVENT_REMOVE_FROM_CART="Remove From Cart";static EVENT_VIEW_ITEM="View Item";static EVENT_VIEW_CART="View Cart";static EVENT_OPEN_CART="Open Cart";static EVENT_VIEW_COLLECTION="View Collection";static EVENT_BUY_NOW_CLICKED="Buy Now Clicked";static EVENT_CHECKOUT_STARTED="Checkout Started";static EVENT_REVIEW_CLICKED="Review Clicked";static EVENT_ITEM_THUMBNAIL_CLICKED="Item Thumbnail Clicked";static JS_LOAD_WHITELIST_EVENTS=[this.EVENT_VIEW_ITEM,this.EVENT_VIEW_CART,this.EVENT_VIEW_COLLECTION];static HASH_INITIATE_CHECKOUT="initiate-checkout";static HASH_OPEN_CART_DRAWER="open-cart-drawer";static ADD_BUNDLE_CTA_INBOUND_EVENT="letscooee:inbound:cta:add-bundle";static CTA_OPEN_CART_EVENT="letscooee:outbound:open-cart";static CTA_AFTER_REFRESH_UI="letscooee:outbound:refresh-ui";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static SHADOW_SPLITTER=":shadow";static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static CONTENT_ATTRIBUTE="_letscooee_content";static VIA="_via";static PAYMENT_MODAL_DETAILS=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}];static{let e=t.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");t.SDK_VERSION_CODE=parseInt(e,10)}};var Ft={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget.min.js`};var Yt=gr(Bn());var S=class{static log(...e){Yt.default.info(...e)}static debug(...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)}static trace(...e){Yt.default.trace(...e)}};function Gf(t=N.LOG_PREFIX){Yt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${N.SDK_VERSION}):`)}});let e=Bl();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Yt.default.setLevel(Yt.default[localStorage.cooeeLogLevel]):Yt.default.setLevel(Ft.debug?Yt.default.TRACE:Yt.default.OFF)}function Bl(){return new URL(location.href).searchParams?.get("cooee-debug")}function Yf(){let t=`
|
|
2
11
|
display: inline-block;
|
|
3
12
|
font-size: 14px;
|
|
4
13
|
background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
|
|
@@ -13,35 +22,32 @@ var qy=Object.create;var Bl=Object.defineProperty,Ky=Object.defineProperties,Xy=
|
|
|
13
22
|
`,e+=`
|
|
14
23
|
|
|
15
24
|
`,e+=`Learn more: https://www.letscooee.com
|
|
16
|
-
Cooee SDK: v${D.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}var Me=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(e){return e??={},this.gaEnabled=e.gaEnabled,this.gaMeasurementID=e.gaMeasurementID,this.pixelPush=e.pixelPush,this.website=e.website??{},this.currencyCount=e.currencyCount??0,this.money=e.money,this.currency=e.currency,this.storefrontToken=e.storefrontToken,this.skipItemAttribute=e.skipItemAttribute,this}};var Ht=function(t){return t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",t[t.BXGY=6]="BXGY",t}(Ht||{});var So=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(So||{});var Fl=function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t}(Fl||{});var si=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}(si||{}),Vt=function(t){return t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer",t}(Vt||{});var Hl=function(t){return t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",t}(Hl||{}),Vs=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(Vs||{}),tr=function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t.BUY_NOW="BUY_NOW",t.STICKY_ATC="STICKY_ATC",t.EXPERIMENT="EXPERIMENT",t.SAVINGS_BAR="SAVINGS_BAR",t}(tr||{}),bo=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(bo||{}),Vl=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Vl||{}),$l=function(t){return t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT",t.UI_ONLY="UI_ONLY",t}($l||{});var Or=class t{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,t.swap(e,r,n)}}};var $s=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}};var wn=class{s;g;i;constructor(e){e.s&&(this.s=new Be(e.s)),e.g&&(this.g=new wo(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var Io="a-f\\d",rv=`#?[${Io}]{3}[${Io}]?`,nv=`#?[${Io}]{6}([${Io}]{2})?`,iv=new RegExp(`[^#${Io}]`,"gi"),ov=new RegExp(`^${rv}$|^${nv}$`,"i");function Wl(t,e={}){if(typeof t!="string"||iv.test(t)||!ov.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,o=n>>8&255,s=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,o,s,a];if(e.format==="css"){let c=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${c})`}return{red:i,green:o,blue:s,alpha:a}}var Be=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return Wl(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var Pr=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new Be(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Ws[this.s??1]}},Ws=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(Ws||{});var wo=class t{static DEFAULT_FALLBACK=new Be({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new Be(e.c)),e.fb&&(this.fb=new Be(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??t.DEFAULT_FALLBACK}};var To=class{blur;spr;clr;x;y;constructor(e){e=e??{},this.blur=e.blur??0,this.spr=e.spr??0,this.x=e.x??0,this.y=e.y??0,this.clr=new Be(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}};var Lr=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(e){e=e??{},this.pl=e.pl??0,this.pr=e.pr??0,this.pt=e.pt??0,this.pb=e.pb??0,this.ml=e.ml??0,this.mr=e.mr??0,this.mt=e.mt??0,this.mb=e.mb??0,this.cent=e.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}};var In=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}};var ai=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(ai||{});var js=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!=="Arial"?e.name:""),this.name=e.name,this.fonts=e.fonts?.map(r=>new jl(r))}},jl=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}};var ze=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return ai[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new Be(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new Be(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new js(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}};var Gs=class{modifications;constructor(e={}){e.modifications?.length?this.modifications=e.modifications.map(r=>new Ys(r)):e.experiments?.length&&(this.modifications=e.experiments.map(r=>new Ys(r)))}};var Ys=class{cssSelector;type;display;bg;typo;br;text;image;constructor(e={}){this.cssSelector=e.cssSelector??"",this.type=e.type??"OTHER",this.display=e.display,e.bg&&(this.bg=new Be(e.bg)),e.typo&&(this.typo=new ze(e.typo)),e.br&&(this.br=new Pr(e.br)),this.text=e.text,this.image=e.image}get style(){let e={};return this.display==="HIDE"?e.display="none":this.display==="BLOCK"?e.display="block":this.display==="INLINE"&&(e.display="inline"),this.br?.r&&(e.borderRadius=this.br.r+"px"),this.br?.w&&(e.borderWidth=this.br.w+"px"),this.br?.s&&(e.borderStyle=Ws[this.br.s]?.toLowerCase()),this.br?.c?.h&&(e.borderColor=this.br.color?.rgba),this.bg?.h&&(e.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(e.fontSize=this.typo.fs+"px"),this.typo.lh&&(e.lineHeight=this.typo.lh),this.typo.fw&&(e.fontWeight=this.typo.fw),this.typo.ta&&(e.textAlign=this.typo.alignment),this.typo.tc.h&&(e.color=this.typo.tc.rgba),this.typo.ls&&(e.letterSpacing=this.typo.letterSpacing),this.typo.td&&(e.textDecoration=this.typo.td??"none")),e}toString(){return`Experiment(cssSelector=${this.cssSelector})`}};var ht=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(e){this.id=e.id,this.mID=e.mID,this.vID=e.vID,this.vName=e.vName,this.imageURL=e.imageURL,this.name=e.name,this.link=e.link,this.quantity=e.quantity,this.price=e.price,this.finalPrice=e.finalPrice??e.price}};var Gl=class{minValue;rewardType;label;reachingText;reachedText;discount;items;reached;calculatedAlignment;constructor(e){this.reached=e.reached??!1,this.calculatedAlignment=e.calculatedAlignment,this.minValue=e.minValue,this.rewardType=e.rewardType,this.label=e.label,this.reachingText=e.reachingText,this.reachedText=e.reachedText,this.discount=e.discount,this.items=e.items?.map(r=>new ht(r))}};var zs=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(e){this.layout=e.layout??Vl.ICONS,this.onlyLatestGift=e.onlyLatestGift,this.noConfetti=e.noConfetti,this.removeIneligibleItem=e.removeIneligibleItem??!0,this.restrictToLatestFreebie=e.restrictToLatestFreebie,this.rewardBasis=e.rewardBasis??"CART_AMOUNT",this.update(e)}update(e){e=e??{},this.milestones=e.milestones?.map(r=>new Gl(r))??[],this.totalProgress=e.totalProgress??0,this.coupons=e.coupons,this.reachedAmountOrCount=e.reachedAmountOrCount}};var qs=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(e={}){this.animateNumber=e.animateNumber??!0,this.animation=e.animation??"SLOT_MACHINE",this.animationDuration=e.animationDuration??1e3,this.text=e.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=e.iconURL,this.totalSavings=e.totalSavings??0}};var $t=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}static parseToAny(e){try{return JSON.parse(e.toString())}catch{}return e.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(e.toString()):e}static async sleep(e){return new Promise(r=>setTimeout(r,e))}static hasKeys(e){return e?Object.keys(e).length>=1:!1}static convertObjectToArray(e,r){return r.reduce((n,i)=>(e.hasOwnProperty(i)&&e[i]!=null&&n.push({[i]:e[i]}),n),[])}static removeNullUndefinedKeys(e){return Object.keys(e).reduce((r,n)=>(e[n]!==null&&e[n]!==void 0&&(r[n]=e[n]),r),{})}static stringify(e){return JSON.stringify(e,function(r,n){return n===void 0?null:n})}};var ne=class{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart";static MUTED="muted"};var zl=ur(tm());function ci(t){return zl.default.createInstance({name:"lc",storeName:t,driver:zl.default.LOCALSTORAGE})}var Xr=class{static storage;static async get(e,r){return await this.storage?.getItem(e)??r}static set(e,r){return this.storage?.setItem(e,r)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var it=class extends Xr{static storeName="ses";static{this.storage=ci(this.storeName)}};var Te=class extends Xr{static storeName="usr";static{this.storage=ci(this.storeName)}};var te=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var oe=globalThis;var pr="9.42.0";function Tn(){return Cn(oe),oe}function Cn(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||pr,e[pr]=e[pr]||{}}function Mr(t,e,r=oe){let n=r.__SENTRY__=r.__SENTRY__||{},i=n[pr]=n[pr]||{};return i[t]||(i[t]=e())}var ql=["debug","info","warn","error","log","assert","trace"],sv="Sentry Logger ",li={};function Jr(t){if(!("console"in oe))return t();let e=oe.console,r={},n=Object.keys(li);n.forEach(i=>{let o=li[i];r[i]=e[i],e[i]=o});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function av(){Xl().enabled=!0}function cv(){Xl().enabled=!1}function rm(){return Xl().enabled}function lv(...t){Kl("log",...t)}function uv(...t){Kl("warn",...t)}function pv(...t){Kl("error",...t)}function Kl(t,...e){te&&rm()&&Jr(()=>{oe.console[t](`${sv}[${t}]:`,...e)})}function Xl(){return te?Mr("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var K={enable:av,disable:cv,isEnabled:rm,log:lv,warn:uv,error:pv};var fr="?",nm=/\(error: (.*)\)/,im=/captureMessage|captureException/;function Ql(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let o=[],s=r.split(`
|
|
17
|
-
`);for(let a=n;a<s.length;a++){let c=s[a];if(c.length>1024)continue;let p=
|
|
25
|
+
Cooee SDK: v${N.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}var Ge=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(e){return e??={},this.gaEnabled=e.gaEnabled,this.gaMeasurementID=e.gaMeasurementID,this.pixelPush=e.pixelPush,this.website=e.website??{},this.currencyCount=e.currencyCount??0,this.money=e.money,this.currency=e.currency,this.storefrontToken=e.storefrontToken,this.skipItemAttribute=e.skipItemAttribute,this}};var er=function(t){return t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",t[t.BXGY=6]="BXGY",t}(er||{});var Ao=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(Ao||{});var Ul=function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t}(Ul||{});var _i=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}(_i||{}),tr=function(t){return t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer",t}(tr||{});var kl=function(t){return t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",t}(kl||{}),js=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(js||{}),yr=function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t.BUY_NOW="BUY_NOW",t.STICKY_ATC="STICKY_ATC",t.EXPERIMENT="EXPERIMENT",t.SAVINGS_BAR="SAVINGS_BAR",t}(yr||{}),Do=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(Do||{}),Fl=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Fl||{}),Hl=function(t){return t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT",t.UI_ONLY="UI_ONLY",t}(Hl||{});var qr=class t{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,t.swap(e,r,n)}}};var Gs=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}};var Un=class{s;g;i;constructor(e){e.s&&(this.s=new Ye(e.s)),e.g&&(this.g=new No(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var Oo="a-f\\d",Ky=`#?[${Oo}]{3}[${Oo}]?`,Xy=`#?[${Oo}]{6}([${Oo}]{2})?`,Jy=new RegExp(`[^#${Oo}]`,"gi"),Qy=new RegExp(`^${Ky}$|^${Xy}$`,"i");function Vl(t,e={}){if(typeof t!="string"||Jy.test(t)||!Qy.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,o=n>>8&255,s=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,o,s,a];if(e.format==="css"){let c=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${c})`}return{red:i,green:o,blue:s,alpha:a}}var Ye=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return Vl(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var Kr=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new Ye(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Ys[this.s??1]}},Ys=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(Ys||{});var No=class t{static DEFAULT_FALLBACK=new Ye({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new Ye(e.c)),e.fb&&(this.fb=new Ye(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??t.DEFAULT_FALLBACK}};var Po=class{blur;spr;clr;x;y;constructor(e){e=e??{},this.blur=e.blur??0,this.spr=e.spr??0,this.x=e.x??0,this.y=e.y??0,this.clr=new Ye(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}};var Xr=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(e){e=e??{},this.pl=e.pl??0,this.pr=e.pr??0,this.pt=e.pt??0,this.pb=e.pb??0,this.ml=e.ml??0,this.mr=e.mr??0,this.mt=e.mt??0,this.mb=e.mb??0,this.cent=e.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}};var kn=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}};var bi=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(bi||{});var zs=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!=="Arial"?e.name:""),this.name=e.name,this.fonts=e.fonts?.map(r=>new $l(r))}},$l=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}};var ct=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return bi[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new Ye(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new Ye(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new zs(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}};var qs=class{modifications;constructor(e={}){e.modifications?.length?this.modifications=e.modifications.map(r=>new Ks(r)):e.experiments?.length&&(this.modifications=e.experiments.map(r=>new Ks(r)))}};var Ks=class{cssSelector;type;display;bg;typo;br;text;image;constructor(e={}){this.cssSelector=e.cssSelector??"",this.type=e.type??"OTHER",this.display=e.display,e.bg&&(this.bg=new Ye(e.bg)),e.typo&&(this.typo=new ct(e.typo)),e.br&&(this.br=new Kr(e.br)),this.text=e.text,this.image=e.image}get style(){let e={};return this.display==="HIDE"?e.display="none":this.display==="BLOCK"?e.display="block":this.display==="INLINE"&&(e.display="inline"),this.br?.r&&(e.borderRadius=this.br.r+"px"),this.br?.w&&(e.borderWidth=this.br.w+"px"),this.br?.s&&(e.borderStyle=Ys[this.br.s]?.toLowerCase()),this.br?.c?.h&&(e.borderColor=this.br.color?.rgba),this.bg?.h&&(e.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(e.fontSize=this.typo.fs+"px"),this.typo.lh&&(e.lineHeight=this.typo.lh),this.typo.fw&&(e.fontWeight=this.typo.fw),this.typo.ta&&(e.textAlign=this.typo.alignment),this.typo.tc.h&&(e.color=this.typo.tc.rgba),this.typo.ls&&(e.letterSpacing=this.typo.letterSpacing),this.typo.td&&(e.textDecoration=this.typo.td??"none")),e}toString(){return`Experiment(cssSelector=${this.cssSelector})`}};var At=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(e){this.id=e.id,this.mID=e.mID,this.vID=e.vID,this.vName=e.vName,this.imageURL=e.imageURL,this.name=e.name,this.link=e.link,this.quantity=e.quantity,this.price=e.price,this.finalPrice=e.finalPrice??e.price}};var Wl=class{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;constructor(e){this.reached=e.reached??!1,this.calculatedAlignment=e.calculatedAlignment,this.minValue=e.minValue,this.rewardType=e.rewardType,this.label=e.label,this.reachingText=e.reachingText,this.reachedText=e.reachedText,this.discount=e.discount,this.items=e.items?.map(r=>new At(r)),this.isUIOnly=e.isUIOnly,this.allowATC=e.allowATC}};var Xs=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(e){this.layout=e.layout??Fl.ICONS,this.onlyLatestGift=e.onlyLatestGift,this.noConfetti=e.noConfetti,this.removeIneligibleItem=e.removeIneligibleItem??!0,this.restrictToLatestFreebie=e.restrictToLatestFreebie,this.rewardBasis=e.rewardBasis??"CART_AMOUNT",this.update(e)}update(e){e=e??{},this.milestones=e.milestones?.map(r=>new Wl(r))??[],this.totalProgress=e.totalProgress??0,this.coupons=e.coupons,this.reachedAmountOrCount=e.reachedAmountOrCount}};var Js=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(e={}){this.animateNumber=e.animateNumber??!0,this.animation=e.animation??"SLOT_MACHINE",this.animationDuration=e.animationDuration??1e3,this.text=e.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=e.iconURL,this.totalSavings=e.totalSavings??0}};var rr=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}static parseToAny(e){try{return JSON.parse(e.toString())}catch{}return e.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(e.toString()):e}static async sleep(e){return new Promise(r=>setTimeout(r,e))}static hasKeys(e){return e?Object.keys(e).length>=1:!1}static convertObjectToArray(e,r){return r.reduce((n,i)=>(e.hasOwnProperty(i)&&e[i]!=null&&n.push({[i]:e[i]}),n),[])}static removeNullUndefinedKeys(e){return Object.keys(e).reduce((r,n)=>(e[n]!==null&&e[n]!==void 0&&(r[n]=e[n]),r),{})}static stringify(e){return JSON.stringify(e,function(r,n){return n===void 0?null:n})}};var le=class{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart";static MUTED="muted"};var Gl=gr(qf());function Si(t){return Gl.default.createInstance({name:"lc",storeName:t,driver:Gl.default.LOCALSTORAGE})}var mn=class{static storage;static async get(e,r){return await this.storage?.getItem(e)??r}static set(e,r){return this.storage?.setItem(e,r)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var yt=class extends mn{static storeName="ses";static{this.storage=Si(this.storeName)}};var Me=class extends mn{static storeName="usr";static{this.storage=Si(this.storeName)}};var se=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var fe=globalThis;var Tr="9.42.0";function Fn(){return Hn(fe),fe}function Hn(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Tr,e[Tr]=e[Tr]||{}}function Jr(t,e,r=fe){let n=r.__SENTRY__=r.__SENTRY__||{},i=n[Tr]=n[Tr]||{};return i[t]||(i[t]=e())}var Yl=["debug","info","warn","error","log","assert","trace"],Zy="Sentry Logger ",wi={};function dn(t){if(!("console"in fe))return t();let e=fe.console,r={},n=Object.keys(wi);n.forEach(i=>{let o=wi[i];r[i]=e[i],e[i]=o});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function ev(){ql().enabled=!0}function tv(){ql().enabled=!1}function Kf(){return ql().enabled}function rv(...t){zl("log",...t)}function nv(...t){zl("warn",...t)}function iv(...t){zl("error",...t)}function zl(t,...e){se&&Kf()&&dn(()=>{fe.console[t](`${Zy}[${t}]:`,...e)})}function ql(){return se?Jr("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var te={enable:ev,disable:tv,isEnabled:Kf,log:rv,warn:nv,error:iv};var Cr="?",Xf=/\(error: (.*)\)/,Jf=/captureMessage|captureException/;function Xl(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let o=[],s=r.split(`
|
|
26
|
+
`);for(let a=n;a<s.length;a++){let c=s[a];if(c.length>1024)continue;let p=Xf.test(c)?c.replace(Xf,"$1"):c;if(!p.match(/\S*Error: /)){for(let m of e){let f=m(p);if(f){o.push(f);break}}if(o.length>=50+i)break}}return Qf(o.slice(i))}}function Qf(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(Qs(e).function||"")&&e.pop(),e.reverse(),Jf.test(Qs(e).function||"")&&(e.pop(),Jf.test(Qs(e).function||"")&&e.pop()),e.slice(0,50).map(r=>ee(_({},r),{filename:r.filename||Qs(e).filename,function:r.function||Cr}))}function Qs(t){return t[t.length-1]||{}}var Kl="<anonymous>";function nr(t){try{return!t||typeof t!="function"?Kl:t.name||Kl}catch{return Kl}}function Zs(t){let e=t.exception;if(e){let r=[];try{return e.values.forEach(n=>{n.stacktrace.frames&&r.push(...n.stacktrace.frames)}),r}catch{return}}}var ea={},Zf={};function Ot(t,e){ea[t]=ea[t]||[],ea[t].push(e)}function Pt(t,e){if(!Zf[t]){Zf[t]=!0;try{e()}catch(r){se&&te.error(`Error while instrumenting ${t}`,r)}}}function lt(t,e){let r=t&&ea[t];if(r)for(let n of r)try{n(e)}catch(i){se&&te.error(`Error while triggering instrumentation handler.
|
|
18
27
|
Type: ${t}
|
|
19
|
-
Name: ${
|
|
20
|
-
Error:`,i)}}var Zl=null;function eu(t){let e="error";vt(e,t),Et(e,fv)}function fv(){Zl=oe.onerror,oe.onerror=function(t,e,r,n,i){return qe("error",{column:n,error:i,line:r,msg:t,url:e}),Zl?Zl.apply(this,arguments):!1},oe.onerror.__SENTRY_INSTRUMENTED__=!0}var tu=null;function ru(t){let e="unhandledrejection";vt(e,t),Et(e,mv)}function mv(){tu=oe.onunhandledrejection,oe.onunhandledrejection=function(t){return qe("unhandledrejection",t),tu?tu.apply(this,arguments):!0},oe.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var am=Object.prototype.toString;function xn(t){switch(am.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return rr(t,Error)}}function ui(t,e){return am.call(t)===`[object ${e}]`}function Qs(t){return ui(t,"ErrorEvent")}function Zs(t){return ui(t,"DOMError")}function nu(t){return ui(t,"DOMException")}function _t(t){return ui(t,"String")}function pi(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Rn(t){return t===null||pi(t)||typeof t!="object"&&typeof t!="function"}function Br(t){return ui(t,"Object")}function An(t){return typeof Event<"u"&&rr(t,Event)}function iu(t){return typeof Element<"u"&&rr(t,Element)}function ou(t){return ui(t,"RegExp")}function Ur(t){return!!(t?.then&&typeof t.then=="function")}function su(t){return Br(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function rr(t,e){try{return t instanceof e}catch{return!1}}function Co(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function cm(t){return typeof Request<"u"&&rr(t,Request)}var au=oe,dv=80;function xo(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],o=0,s=0,a=" > ",c=a.length,p,f=Array.isArray(e)?e:e.keyAttrs,m=!Array.isArray(e)&&e.maxStringLength||dv;for(;r&&o++<n&&(p=hv(r,f),!(p==="html"||o>1&&s+i.length*c+p.length>=m));)i.push(p),s+=p.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function hv(t,e){let r=t,n=[];if(!r?.tagName)return"";if(au.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e?.length?e.filter(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(i?.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let s=r.className;if(s&&_t(s)){let a=s.split(/\s+/);for(let c of a)n.push(`.${c}`)}}let o=["aria-label","type","name","title","alt"];for(let s of o){let a=r.getAttribute(s);a&&n.push(`[${s}="${a}"]`)}return n.join("")}function Ro(){try{return au.document.location.href}catch{return""}}function cu(t){if(!au.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function Qr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function ea(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{Co(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function lm(t,e,r=!1){return _t(t)?ou(e)?e.test(t):_t(e)?r?t===e:t.includes(e):!1:!1}function fi(t,e=[],r=!1){return e.some(n=>lm(t,n,r))}function Ke(t,e,r){if(!(e in t))return;let n=t[e];if(typeof n!="function")return;let i=r(n);typeof i=="function"&&ta(i,n);try{t[e]=i}catch{te&&K.log(`Failed to replace method "${e}" in object`,t)}}function Nt(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{te&&K.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ta(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,Nt(t,"__sentry_original__",e)}catch{}}function Dn(t){return t.__sentry_original__}function ra(t){if(xn(t))return S({message:t.message,name:t.name,stack:t.stack},pm(t));if(An(t)){let e=S({type:t.type,target:um(t.target),currentTarget:um(t.currentTarget)},pm(t));return typeof CustomEvent<"u"&&rr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function um(t){try{return iu(t)?xo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function pm(t){if(typeof t=="object"&&t!==null){let e={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function lu(t,e=40){let r=Object.keys(ra(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return Qr(n,e);for(let i=r.length;i>0;i--){let o=r.slice(0,i).join(", ");if(!(o.length>e))return i===r.length?o:Qr(o,e)}return""}function gv(){let t=oe;return t.crypto||t.msCrypto}function Xe(t=gv()){let e=()=>Math.random()*16;try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{let r=new Uint8Array(1);return t.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(e()&15)>>r/4).toString(16))}function fm(t){return t.exception?.values?.[0]}function mr(t){let{message:e,event_id:r}=t;if(e)return e;let n=fm(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function mi(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=r||"Error")}function dr(t,e){let r=fm(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=S(S(S({},n),i),e),e&&"data"in e){let o=S(S({},i?.data),e.data);r.mechanism.data=o}}function na(t){if(yv(t))return!0;try{Nt(t,"__sentry_captured__",!0)}catch{}return!1}function yv(t){try{return t.__sentry_captured__}catch{}}var dm=1e3;function hr(){return Date.now()/dm}function vv(){let{performance:t}=oe;if(!t?.now||!t.timeOrigin)return hr;let e=t.timeOrigin;return()=>(e+t.now())/dm}var mm;function Tt(){return(mm??(mm=vv()))()}function hm(t){let e=Tt(),r={sid:Xe(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Ev(r)};return t&&kr(r,t),r}function kr(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Tt(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Xe()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function gm(t,e){let r={};e?r={status:e}:t.status==="ok"&&(r={status:"exited"}),kr(t,r)}function Ev(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function Zr(t,e,r=2){if(!e||typeof e!="object"||r<=0)return e;if(t&&Object.keys(e).length===0)return t;let n=S({},t);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Zr(n[i],e[i],r-1));return n}function uu(){return Xe()}function ia(){return Xe().substring(16)}var pu="_sentrySpan";function fu(t,e){e?Nt(t,pu,e):delete t[pu]}function mu(t){return t[pu]}var _v=100,lt=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:uu(),sampleRand:Math.random()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags=S({},this._tags),e._extra=S({},this._extra),e._contexts=S({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata=S({},this._sdkProcessingMetadata),e._propagationContext=S({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,fu(e,mu(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&kr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags=S(S({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=Z(S({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=S(S({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=Z(S({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,n=r instanceof t?r.getScopeData():Br(r)?e:void 0,{tags:i,extra:o,user:s,contexts:a,level:c,fingerprint:p=[],propagationContext:f}=n||{};return this._tags=S(S({},this._tags),i),this._extra=S(S({},this._extra),o),this._contexts=S(S({},this._contexts),a),s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),p.length&&(this._fingerprint=p),f&&(this._propagationContext=f),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,fu(this,void 0),this._attachments=[],this.setPropagationContext({traceId:uu(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:_v;if(n<=0)return this;let i=Z(S({timestamp:hr()},e),{message:e.message?Qr(e.message,2048):e.message});return this._breadcrumbs.push(i),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:mu(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Zr(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r?.event_id||Xe();if(!this._client)return te&&K.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,Z(S({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n?.event_id||Xe();if(!this._client)return te&&K.warn("No client configured on scope - will not capture message!"),i;let o=new Error(e);return this._client.captureMessage(e,r,Z(S({originalException:e,syntheticException:o},n),{event_id:i}),this),i}captureEvent(e,r){let n=r?.event_id||Xe();return this._client?(this._client.captureEvent(e,Z(S({},r),{event_id:n}),this),n):(te&&K.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function ym(){return Mr("defaultCurrentScope",()=>new lt)}function vm(){return Mr("defaultIsolationScope",()=>new lt)}var du=class{constructor(e,r){let n;e?n=e:n=new lt;let i;r?i=r:i=new lt,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){let r=this._pushScope(),n;try{n=e(r)}catch(i){throw this._popScope(),i}return Ur(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function di(){let t=Tn(),e=Cn(t);return e.stack=e.stack||new du(ym(),vm())}function Sv(t){return di().withScope(t)}function bv(t,e){let r=di();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function Em(t){return di().withScope(()=>t(di().getIsolationScope()))}function _m(){return{withIsolationScope:Em,withScope:Sv,withSetScope:bv,withSetIsolationScope:(t,e)=>Em(e),getCurrentScope:()=>di().getScope(),getIsolationScope:()=>di().getIsolationScope()}}function oa(t){let e=Cn(t);return e.acs?e.acs:_m()}function nr(){let t=Tn();return oa(t).getCurrentScope()}function gr(){let t=Tn();return oa(t).getIsolationScope()}function sa(){return Mr("globalScope",()=>new lt)}function Ao(...t){let e=Tn(),r=oa(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Ue(){return nr().getClient()}function hu(t){let e=t.getPropagationContext(),{traceId:r,parentSpanId:n,propagationSpanId:i}=e,o={trace_id:r,span_id:i||ia()};return n&&(o.parent_span_id=n),o}var aa="sentry.source",gu="sentry.sample_rate",Sm="sentry.previous_trace_sample_rate",yu="sentry.op",vu="sentry.origin";var Eu="sentry.profile_id",_u="sentry.exclusive_time";var wv="_sentryScope",Iv="_sentryIsolationScope";function ca(t){return{scope:t[wv],isolationScope:t[Iv]}}var Tv="sentry-",Cv=/^sentry-/;function wm(t){let e=xv(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,o])=>{if(i.match(Cv)){let s=i.slice(Tv.length);n[s]=o}return n},{});if(Object.keys(r).length>0)return r}function xv(t){if(!(!t||!_t(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=bm(r);return Object.entries(n).forEach(([i,o])=>{e[i]=o}),e},{}):bm(t)}function bm(t){return t.split(",").map(e=>e.split("=").map(r=>{try{return decodeURIComponent(r.trim())}catch{return}})).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function Im(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var Rm=1,Tm=!1;function Su(t){let{spanId:e,traceId:r,isRemote:n}=t.spanContext(),i=n?e:hi(t).parent_span_id,o=ca(t).scope,s=n?o?.getPropagationContext().propagationSpanId||ia():e;return{parent_span_id:i,span_id:s,trace_id:r}}function Rv(t){if(t&&t.length>0)return t.map(s=>{var a=s,{context:c}=a,p=c,{spanId:e,traceId:r,traceFlags:n}=p,i=Kf(p,["spanId","traceId","traceFlags"]),{attributes:o}=a;return S({span_id:e,trace_id:r,sampled:n===Rm,attributes:o},i)})}function Cm(t){return typeof t=="number"?xm(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?xm(t.getTime()):Tt()}function xm(t){return t>9999999999?t/1e3:t}function hi(t){if(Dv(t))return t.getSpanJSON();let{spanId:e,traceId:r}=t.spanContext();if(Av(t)){let{attributes:n,startTime:i,name:o,endTime:s,status:a,links:c}=t,p="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:r,data:n,description:o,parent_span_id:p,start_timestamp:Cm(i),timestamp:Cm(s)||void 0,status:Nv(a),op:n[yu],origin:n[vu],links:Rv(c)}}return{span_id:e,trace_id:r,start_timestamp:0,data:{}}}function Av(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Dv(t){return typeof t.getSpanJSON=="function"}function Am(t){let{traceFlags:e}=t.spanContext();return e===Rm}function Nv(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var Ov="_sentryRootSpan";function Do(t){return t[Ov]||t}function bu(){Tm||(Jr(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),Tm=!0)}function Dm(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||Ue()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}var gi="production";var Pv=/^o(\d+)\./,Lv=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Mv(t){return t==="http"||t==="https"}function en(t,e=!1){let{host:r,path:n,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${s}`}function Bv(t){let e=Lv.exec(t);if(!e){Jr(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",o="",s="",a=""]=e.slice(1),c="",p=a,f=p.split("/");if(f.length>1&&(c=f.slice(0,-1).join("/"),p=f.pop()),p){let m=p.match(/^\d+/);m&&(p=m[0])}return Nm({host:o,pass:i,path:c,projectId:p,port:s,protocol:r,publicKey:n})}function Nm(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Uv(t){if(!te)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(K.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?Mv(n)?e&&isNaN(parseInt(e,10))?(K.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(K.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(K.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function Om(t){return t.match(Pv)?.[1]}function Pm(t){let e=typeof t=="string"?Bv(t):Nm(t);if(!(!e||!Uv(e)))return e}var kv="_frozenDsc";function Lm(t,e){let r=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{},o;r.orgId?o=String(r.orgId):i&&(o=Om(i));let s={environment:r.environment||gi,release:r.release,public_key:n,trace_id:t,org_id:o};return e.emit("createDsc",s),s}function Mm(t,e){let r=e.getPropagationContext();return r.dsc||Lm(r.traceId,t)}function wu(t){let e=Ue();if(!e)return{};let r=Do(t),n=hi(r),i=n.data,o=r.spanContext().traceState,s=o?.get("sentry.sample_rate")??i[gu]??i[Sm];function a(T){return(typeof s=="number"||typeof s=="string")&&(T.sample_rate=`${s}`),T}let c=r[kv];if(c)return a(c);let p=o?.get("sentry.dsc"),f=p&&wm(p);if(f)return a(f);let m=Lm(t.spanContext().traceId,e),v=i[aa],y=n.description;return v!=="url"&&y&&(m.transaction=y),Dm()&&(m.sampled=String(Am(r)),m.sample_rand=o?.get("sentry.sample_rand")??ca(r).scope?.getPropagationContext().sampleRand.toString()),a(m),e.emit("createDsc",m,r),m}function jt(t,e=100,r=1/0){try{return Iu("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function la(t,e=3,r=100*1024){let n=jt(t,e);return $v(n)>r?la(t,e-1,r):n}function Iu(t,e,r=1/0,n=1/0,i=Wv()){let[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=Fv(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(c===0)return a.replace("object ","");if(o(e))return"[Circular ~]";let p=e;if(p&&typeof p.toJSON=="function")try{let y=p.toJSON();return Iu("",y,c-1,n,i)}catch{}let f=Array.isArray(e)?[]:{},m=0,v=ra(e);for(let y in v){if(!Object.prototype.hasOwnProperty.call(v,y))continue;if(m>=n){f[y]="[MaxProperties ~]";break}let T=v[y];f[y]=Iu(y,T,c-1,n,i),m++}return s(e),f}function Fv(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Co(e))return"[VueViewModel]";if(su(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${Wt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=Hv(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Hv(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function Vv(t){return~-encodeURI(t).split(/%..|./).length}function $v(t){return Vv(JSON.stringify(t))}function Wv(){let t=new WeakSet;function e(n){return t.has(n)?!0:(t.add(n),!1)}function r(n){t.delete(n)}return[e,r]}function Fr(t,e=[]){return[t,e]}function Bm(t,e){let[r,n]=t;return[r,[...n,e]]}function Cu(t,e){let r=t[1];for(let n of r){let i=n[0].type;if(e(n,i))return!0}return!1}function Tu(t){let e=Cn(oe);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Um(t){let[e,r]=t,n=JSON.stringify(e);function i(o){typeof n=="string"?n=typeof o=="string"?n+o:[Tu(n),o]:n.push(typeof o=="string"?Tu(o):o)}for(let o of r){let[s,a]=o;if(i(`
|
|
28
|
+
Name: ${nr(n)}
|
|
29
|
+
Error:`,i)}}var Jl=null;function Ql(t){let e="error";Ot(e,t),Pt(e,ov)}function ov(){Jl=fe.onerror,fe.onerror=function(t,e,r,n,i){return lt("error",{column:n,error:i,line:r,msg:t,url:e}),Jl?Jl.apply(this,arguments):!1},fe.onerror.__SENTRY_INSTRUMENTED__=!0}var Zl=null;function eu(t){let e="unhandledrejection";Ot(e,t),Pt(e,sv)}function sv(){Zl=fe.onunhandledrejection,fe.onunhandledrejection=function(t){return lt("unhandledrejection",t),Zl?Zl.apply(this,arguments):!0},fe.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var em=Object.prototype.toString;function Vn(t){switch(em.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return vr(t,Error)}}function Ii(t,e){return em.call(t)===`[object ${e}]`}function ta(t){return Ii(t,"ErrorEvent")}function ra(t){return Ii(t,"DOMError")}function tu(t){return Ii(t,"DOMException")}function Lt(t){return Ii(t,"String")}function Ti(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function $n(t){return t===null||Ti(t)||typeof t!="object"&&typeof t!="function"}function Qr(t){return Ii(t,"Object")}function Wn(t){return typeof Event<"u"&&vr(t,Event)}function ru(t){return typeof Element<"u"&&vr(t,Element)}function nu(t){return Ii(t,"RegExp")}function Zr(t){return!!(t?.then&&typeof t.then=="function")}function iu(t){return Qr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function vr(t,e){try{return t instanceof e}catch{return!1}}function Lo(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function tm(t){return typeof Request<"u"&&vr(t,Request)}var ou=fe,av=80;function Mo(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],o=0,s=0,a=" > ",c=a.length,p,m=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||av;for(;r&&o++<n&&(p=cv(r,m),!(p==="html"||o>1&&s+i.length*c+p.length>=f));)i.push(p),s+=p.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function cv(t,e){let r=t,n=[];if(!r?.tagName)return"";if(ou.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e?.length?e.filter(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(i?.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let s=r.className;if(s&&Lt(s)){let a=s.split(/\s+/);for(let c of a)n.push(`.${c}`)}}let o=["aria-label","type","name","title","alt"];for(let s of o){let a=r.getAttribute(s);a&&n.push(`[${s}="${a}"]`)}return n.join("")}function Bo(){try{return ou.document.location.href}catch{return""}}function su(t){if(!ou.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function hn(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function na(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{Lo(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function rm(t,e,r=!1){return Lt(t)?nu(e)?e.test(t):Lt(e)?r?t===e:t.includes(e):!1:!1}function Ci(t,e=[],r=!1){return e.some(n=>rm(t,n,r))}function ut(t,e,r){if(!(e in t))return;let n=t[e];if(typeof n!="function")return;let i=r(n);typeof i=="function"&&ia(i,n);try{t[e]=i}catch{se&&te.log(`Failed to replace method "${e}" in object`,t)}}function zt(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{se&&te.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ia(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,zt(t,"__sentry_original__",e)}catch{}}function jn(t){return t.__sentry_original__}function oa(t){if(Vn(t))return _({message:t.message,name:t.name,stack:t.stack},im(t));if(Wn(t)){let e=_({type:t.type,target:nm(t.target),currentTarget:nm(t.currentTarget)},im(t));return typeof CustomEvent<"u"&&vr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function nm(t){try{return ru(t)?Mo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function im(t){if(typeof t=="object"&&t!==null){let e={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function au(t,e=40){let r=Object.keys(oa(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return hn(n,e);for(let i=r.length;i>0;i--){let o=r.slice(0,i).join(", ");if(!(o.length>e))return i===r.length?o:hn(o,e)}return""}function lv(){let t=fe;return t.crypto||t.msCrypto}function pt(t=lv()){let e=()=>Math.random()*16;try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{let r=new Uint8Array(1);return t.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(e()&15)>>r/4).toString(16))}function om(t){return t.exception?.values?.[0]}function xr(t){let{message:e,event_id:r}=t;if(e)return e;let n=om(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function xi(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=r||"Error")}function Rr(t,e){let r=om(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=_(_(_({},n),i),e),e&&"data"in e){let o=_(_({},i?.data),e.data);r.mechanism.data=o}}function sa(t){if(uv(t))return!0;try{zt(t,"__sentry_captured__",!0)}catch{}return!1}function uv(t){try{return t.__sentry_captured__}catch{}}var am=1e3;function Ar(){return Date.now()/am}function pv(){let{performance:t}=fe;if(!t?.now||!t.timeOrigin)return Ar;let e=t.timeOrigin;return()=>(e+t.now())/am}var sm;function Ht(){return(sm??(sm=pv()))()}function cm(t){let e=Ht(),r={sid:pt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>fv(r)};return t&&en(r,t),r}function en(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ht(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:pt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function lm(t,e){let r={};e?r={status:e}:t.status==="ok"&&(r={status:"exited"}),en(t,r)}function fv(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function gn(t,e,r=2){if(!e||typeof e!="object"||r<=0)return e;if(t&&Object.keys(e).length===0)return t;let n=_({},t);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=gn(n[i],e[i],r-1));return n}function cu(){return pt()}function aa(){return pt().substring(16)}var lu="_sentrySpan";function uu(t,e){e?zt(t,lu,e):delete t[lu]}function pu(t){return t[lu]}var mv=100,It=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:cu(),sampleRand:Math.random()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags=_({},this._tags),e._extra=_({},this._extra),e._contexts=_({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata=_({},this._sdkProcessingMetadata),e._propagationContext=_({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,uu(e,pu(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&en(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags=_(_({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=ee(_({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=_(_({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=ee(_({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,n=r instanceof t?r.getScopeData():Qr(r)?e:void 0,{tags:i,extra:o,user:s,contexts:a,level:c,fingerprint:p=[],propagationContext:m}=n||{};return this._tags=_(_({},this._tags),i),this._extra=_(_({},this._extra),o),this._contexts=_(_({},this._contexts),a),s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),p.length&&(this._fingerprint=p),m&&(this._propagationContext=m),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,uu(this,void 0),this._attachments=[],this.setPropagationContext({traceId:cu(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:mv;if(n<=0)return this;let i=ee(_({timestamp:Ar()},e),{message:e.message?hn(e.message,2048):e.message});return this._breadcrumbs.push(i),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:pu(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=gn(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r?.event_id||pt();if(!this._client)return se&&te.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,ee(_({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n?.event_id||pt();if(!this._client)return se&&te.warn("No client configured on scope - will not capture message!"),i;let o=new Error(e);return this._client.captureMessage(e,r,ee(_({originalException:e,syntheticException:o},n),{event_id:i}),this),i}captureEvent(e,r){let n=r?.event_id||pt();return this._client?(this._client.captureEvent(e,ee(_({},r),{event_id:n}),this),n):(se&&te.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function um(){return Jr("defaultCurrentScope",()=>new It)}function pm(){return Jr("defaultIsolationScope",()=>new It)}var fu=class{constructor(e,r){let n;e?n=e:n=new It;let i;r?i=r:i=new It,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){let r=this._pushScope(),n;try{n=e(r)}catch(i){throw this._popScope(),i}return Zr(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Ri(){let t=Fn(),e=Hn(t);return e.stack=e.stack||new fu(um(),pm())}function dv(t){return Ri().withScope(t)}function hv(t,e){let r=Ri();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function fm(t){return Ri().withScope(()=>t(Ri().getIsolationScope()))}function mm(){return{withIsolationScope:fm,withScope:dv,withSetScope:hv,withSetIsolationScope:(t,e)=>fm(e),getCurrentScope:()=>Ri().getScope(),getIsolationScope:()=>Ri().getIsolationScope()}}function ca(t){let e=Hn(t);return e.acs?e.acs:mm()}function Er(){let t=Fn();return ca(t).getCurrentScope()}function Dr(){let t=Fn();return ca(t).getIsolationScope()}function la(){return Jr("globalScope",()=>new It)}function Uo(...t){let e=Fn(),r=ca(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function ze(){return Er().getClient()}function mu(t){let e=t.getPropagationContext(),{traceId:r,parentSpanId:n,propagationSpanId:i}=e,o={trace_id:r,span_id:i||aa()};return n&&(o.parent_span_id=n),o}var ua="sentry.source",du="sentry.sample_rate",dm="sentry.previous_trace_sample_rate",hu="sentry.op",gu="sentry.origin";var yu="sentry.profile_id",vu="sentry.exclusive_time";var gv="_sentryScope",yv="_sentryIsolationScope";function pa(t){return{scope:t[gv],isolationScope:t[yv]}}var vv="sentry-",Ev=/^sentry-/;function gm(t){let e=_v(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,o])=>{if(i.match(Ev)){let s=i.slice(vv.length);n[s]=o}return n},{});if(Object.keys(r).length>0)return r}function _v(t){if(!(!t||!Lt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=hm(r);return Object.entries(n).forEach(([i,o])=>{e[i]=o}),e},{}):hm(t)}function hm(t){return t.split(",").map(e=>e.split("=").map(r=>{try{return decodeURIComponent(r.trim())}catch{return}})).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function ym(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var bm=1,vm=!1;function Eu(t){let{spanId:e,traceId:r,isRemote:n}=t.spanContext(),i=n?e:Ai(t).parent_span_id,o=pa(t).scope,s=n?o?.getPropagationContext().propagationSpanId||aa():e;return{parent_span_id:i,span_id:s,trace_id:r}}function bv(t){if(t&&t.length>0)return t.map(s=>{var a=s,{context:c}=a,p=c,{spanId:e,traceId:r,traceFlags:n}=p,i=$f(p,["spanId","traceId","traceFlags"]),{attributes:o}=a;return _({span_id:e,trace_id:r,sampled:n===bm,attributes:o},i)})}function Em(t){return typeof t=="number"?_m(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?_m(t.getTime()):Ht()}function _m(t){return t>9999999999?t/1e3:t}function Ai(t){if(wv(t))return t.getSpanJSON();let{spanId:e,traceId:r}=t.spanContext();if(Sv(t)){let{attributes:n,startTime:i,name:o,endTime:s,status:a,links:c}=t,p="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:r,data:n,description:o,parent_span_id:p,start_timestamp:Em(i),timestamp:Em(s)||void 0,status:Iv(a),op:n[hu],origin:n[gu],links:bv(c)}}return{span_id:e,trace_id:r,start_timestamp:0,data:{}}}function Sv(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function wv(t){return typeof t.getSpanJSON=="function"}function Sm(t){let{traceFlags:e}=t.spanContext();return e===bm}function Iv(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var Tv="_sentryRootSpan";function ko(t){return t[Tv]||t}function _u(){vm||(dn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),vm=!0)}function wm(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||ze()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}var Di="production";var Cv=/^o(\d+)\./,xv=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Rv(t){return t==="http"||t==="https"}function yn(t,e=!1){let{host:r,path:n,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${s}`}function Av(t){let e=xv.exec(t);if(!e){dn(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",o="",s="",a=""]=e.slice(1),c="",p=a,m=p.split("/");if(m.length>1&&(c=m.slice(0,-1).join("/"),p=m.pop()),p){let f=p.match(/^\d+/);f&&(p=f[0])}return Im({host:o,pass:i,path:c,projectId:p,port:s,protocol:r,publicKey:n})}function Im(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Dv(t){if(!se)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(te.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?Rv(n)?e&&isNaN(parseInt(e,10))?(te.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(te.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(te.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function Tm(t){return t.match(Cv)?.[1]}function Cm(t){let e=typeof t=="string"?Av(t):Im(t);if(!(!e||!Dv(e)))return e}var Nv="_frozenDsc";function xm(t,e){let r=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{},o;r.orgId?o=String(r.orgId):i&&(o=Tm(i));let s={environment:r.environment||Di,release:r.release,public_key:n,trace_id:t,org_id:o};return e.emit("createDsc",s),s}function Rm(t,e){let r=e.getPropagationContext();return r.dsc||xm(r.traceId,t)}function bu(t){let e=ze();if(!e)return{};let r=ko(t),n=Ai(r),i=n.data,o=r.spanContext().traceState,s=o?.get("sentry.sample_rate")??i[du]??i[dm];function a(T){return(typeof s=="number"||typeof s=="string")&&(T.sample_rate=`${s}`),T}let c=r[Nv];if(c)return a(c);let p=o?.get("sentry.dsc"),m=p&&gm(p);if(m)return a(m);let f=xm(t.spanContext().traceId,e),E=i[ua],y=n.description;return E!=="url"&&y&&(f.transaction=y),wm()&&(f.sampled=String(Sm(r)),f.sample_rand=o?.get("sentry.sample_rand")??pa(r).scope?.getPropagationContext().sampleRand.toString()),a(f),e.emit("createDsc",f,r),f}function ir(t,e=100,r=1/0){try{return Su("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function fa(t,e=3,r=100*1024){let n=ir(t,e);return Mv(n)>r?fa(t,e-1,r):n}function Su(t,e,r=1/0,n=1/0,i=Bv()){let[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=Ov(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(c===0)return a.replace("object ","");if(o(e))return"[Circular ~]";let p=e;if(p&&typeof p.toJSON=="function")try{let y=p.toJSON();return Su("",y,c-1,n,i)}catch{}let m=Array.isArray(e)?[]:{},f=0,E=oa(e);for(let y in E){if(!Object.prototype.hasOwnProperty.call(E,y))continue;if(f>=n){m[y]="[MaxProperties ~]";break}let T=E[y];m[y]=Su(y,T,c-1,n,i),f++}return s(e),m}function Ov(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Lo(e))return"[VueViewModel]";if(iu(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${nr(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=Pv(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Pv(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function Lv(t){return~-encodeURI(t).split(/%..|./).length}function Mv(t){return Lv(JSON.stringify(t))}function Bv(){let t=new WeakSet;function e(n){return t.has(n)?!0:(t.add(n),!1)}function r(n){t.delete(n)}return[e,r]}function tn(t,e=[]){return[t,e]}function Am(t,e){let[r,n]=t;return[r,[...n,e]]}function Iu(t,e){let r=t[1];for(let n of r){let i=n[0].type;if(e(n,i))return!0}return!1}function wu(t){let e=Hn(fe);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Dm(t){let[e,r]=t,n=JSON.stringify(e);function i(o){typeof n=="string"?n=typeof o=="string"?n+o:[wu(n),o]:n.push(typeof o=="string"?wu(o):o)}for(let o of r){let[s,a]=o;if(i(`
|
|
21
30
|
${JSON.stringify(s)}
|
|
22
|
-
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(jt(a))}i(c)}}return typeof n=="string"?n:jv(n)}function jv(t){let e=t.reduce((i,o)=>i+o.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function km(t){let e=typeof t.data=="string"?Tu(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var Gv={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function xu(t){return Gv[t]}function Ru(t){if(!t?.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function Fm(t,e,r,n){let i=t.sdkProcessingMetadata?.dynamicSamplingContext;return S(S(S({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:en(n)}),i&&{trace:i})}function Yv(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function Hm(t,e,r,n){let i=Ru(r),o=S(S({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:en(e)}),s="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Fr(o,[s])}function Vm(t,e,r,n){let i=Ru(r),o=t.type&&t.type!=="replay_event"?t.type:"event";Yv(t,r?.sdk);let s=Fm(t,i,n,e);return delete t.sdkProcessingMetadata,Fr(s,[[{type:o},t]])}var Au=0,$m=1,Wm=2;function Gt(t){return new ir(e=>{e(t)})}function tn(t){return new ir((e,r)=>{r(t)})}var ir=class t{constructor(e){this._state=Au,this._handlers=[],this._runExecutor(e)}then(e,r){return new t((n,i)=>{this._handlers.push([!1,o=>{if(!e)n(o);else try{n(e(o))}catch(s){i(s)}},o=>{if(!r)i(o);else try{n(r(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new t((r,n)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{if(o){n(i);return}r(i)})})}_executeHandlers(){if(this._state===Au)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===$m&&r[1](this._value),this._state===Wm&&r[2](this._value),r[0]=!0)})}_runExecutor(e){let r=(o,s)=>{if(this._state===Au){if(Ur(s)){s.then(n,i);return}this._state=o,this._value=s,this._executeHandlers()}},n=o=>{r($m,o)},i=o=>{r(Wm,o)};try{e(n,i)}catch(o){i(o)}}};function ua(t,e,r,n=0){return new ir((i,o)=>{let s=t[n];if(e===null||typeof s!="function")i(e);else{let a=s(S({},e),r);te&&s.id&&a===null&&K.log(`Event processor "${s.id}" dropped event`),Ur(a)?a.then(c=>ua(t,c,r,n+1).then(i)).then(null,o):ua(t,a,r,n+1).then(i).then(null,o)}})}function jm(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=e;zv(t,e),n&&Xv(t,n),Jv(t,r),qv(t,i),Kv(t,o)}function Du(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:p,eventProcessors:f,attachments:m,propagationContext:v,transactionName:y,span:T}=e;pa(t,"extra",r),pa(t,"tags",n),pa(t,"user",i),pa(t,"contexts",o),t.sdkProcessingMetadata=Zr(t.sdkProcessingMetadata,a,2),s&&(t.level=s),y&&(t.transactionName=y),T&&(t.span=T),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),f.length&&(t.eventProcessors=[...t.eventProcessors,...f]),m.length&&(t.attachments=[...t.attachments,...m]),t.propagationContext=S(S({},t.propagationContext),v)}function pa(t,e,r){t[e]=Zr(t[e],r,1)}function zv(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(r).length&&(t.extra=S(S({},r),t.extra)),Object.keys(n).length&&(t.tags=S(S({},n),t.tags)),Object.keys(i).length&&(t.user=S(S({},i),t.user)),Object.keys(o).length&&(t.contexts=S(S({},o),t.contexts)),s&&(t.level=s),a&&t.type!=="transaction"&&(t.transaction=a)}function qv(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Kv(t,e){t.sdkProcessingMetadata=S(S({},t.sdkProcessingMetadata),e)}function Xv(t,e){t.contexts=S({trace:Su(e)},t.contexts),t.sdkProcessingMetadata=S({dynamicSamplingContext:wu(e)},t.sdkProcessingMetadata);let r=Do(e),n=hi(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function Jv(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}var fa,Gm,ma;function Ym(t){let e=oe._sentryDebugIds;if(!e)return{};let r=Object.keys(e);return ma&&r.length===Gm||(Gm=r.length,ma=r.reduce((n,i)=>{fa||(fa={});let o=fa[i];if(o)n[o[0]]=o[1];else{let s=t(i);for(let a=s.length-1;a>=0;a--){let p=s[a]?.filename,f=e[i];if(p&&f){n[p]=f,fa[i]=[p,f];break}}}return n},{})),ma}function zm(t,e,r,n,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c=Z(S({},e),{event_id:e.event_id||r.event_id||Xe(),timestamp:e.timestamp||hr()}),p=r.integrations||t.integrations.map(A=>A.name);Qv(c,t),tE(c,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Zv(c,t.stackParser);let f=nE(n,r.captureContext);r.mechanism&&dr(c,r.mechanism);let m=i?i.getEventProcessors():[],v=sa().getScopeData();if(o){let A=o.getScopeData();Du(v,A)}if(f){let A=f.getScopeData();Du(v,A)}let y=[...r.attachments||[],...v.attachments];y.length&&(r.attachments=y),jm(c,v);let T=[...m,...v.eventProcessors];return ua(T,c,r).then(A=>(A&&eE(A),typeof s=="number"&&s>0?rE(A,s,a):A))}function Qv(t,e){let{environment:r,release:n,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||r||gi,!t.release&&n&&(t.release=n),!t.dist&&i&&(t.dist=i);let s=t.request;s?.url&&(s.url=Qr(s.url,o))}function Zv(t,e){let r=Ym(e);t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=r[i.filename])})})}function eE(t){let e={};if(t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function tE(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function rE(t,e,r){if(!t)return null;let n=S(S(S(S(S({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>S(S({},i),i.data&&{data:jt(i.data,e,r)}))}),t.user&&{user:jt(t.user,e,r)}),t.contexts&&{contexts:jt(t.contexts,e,r)}),t.extra&&{extra:jt(t.extra,e,r)});return t.contexts?.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=jt(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>S(S({},i),i.data&&{data:jt(i.data,e,r)}))),t.contexts?.flags&&n.contexts&&(n.contexts.flags=jt(t.contexts.flags,3,r)),n}function nE(t,e){if(!e)return t;let r=t?t.clone():new lt;return r.update(e),r}function qm(t){if(t)return iE(t)?{captureContext:t}:sE(t)?{captureContext:t}:t}function iE(t){return t instanceof lt||typeof t=="function"}var oE=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function sE(t){return Object.keys(t).some(e=>oE.includes(e))}function da(t,e){return nr().captureException(t,qm(e))}function ha(t,e){let r=typeof e=="string"?e:void 0,n=typeof e!="string"?{captureContext:e}:void 0;return nr().captureMessage(t,r,n)}function No(t,e){return nr().captureEvent(t,e)}function Oo(t){let e=gr(),r=nr(),{userAgent:n}=oe.navigator||{},i=hm(S(S({user:r.getUser()||e.getUser()},n&&{userAgent:n}),t)),o=e.getSession();return o?.status==="ok"&&kr(o,{status:"exited"}),ga(),e.setSession(i),i}function ga(){let t=gr(),r=nr().getSession()||t.getSession();r&&gm(r),Xm(),t.setSession()}function Xm(){let t=gr(),e=Ue(),r=t.getSession();r&&e&&e.captureSession(r)}function Po(t=!1){if(t){ga();return}Xm()}var aE="7";function cE(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function lE(t){return`${cE(t)}${t.projectId}/envelope/`}function uE(t,e){let r={sentry_version:aE};return t.publicKey&&(r.sentry_key=t.publicKey),e&&(r.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(r).toString()}function Jm(t,e,r){return e||`${lE(t)}?${uE(t,r)}`}var Qm=[];function Zm(t,e){let r={};return e.forEach(n=>{n&&Ou(t,n,r)}),r}function Nu(t,e){for(let r of e)r?.afterAllSetup&&r.afterAllSetup(t)}function Ou(t,e,r){if(r[e.name]){te&&K.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Qm.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Qm.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>n(i,o,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((o,s)=>n(o,s,t),{id:e.name});t.addEventProcessor(i)}te&&K.log(`Integration installed: ${e.name}`)}function ed(t,e,r){let n=[{type:"client_report"},{timestamp:r||hr(),discarded_events:t}];return Fr(e?{dsn:e}:{},[n])}function ya(t){let e=[];t.message&&e.push(t.message);try{let r=t.exception.values[t.exception.values.length-1];r?.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`))}catch{}return e}function td(t){let{trace_id:e,parent_span_id:r,span_id:n,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:r,span_id:n??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[Eu],exclusive_time:s?.[_u],measurements:t.measurements,is_segment:!0}}function rd(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:S(S(S({},t.data),t.profile_id&&{[Eu]:t.profile_id}),t.exclusive_time&&{[_u]:t.exclusive_time})}},measurements:t.measurements}}var nd="Not capturing exception because it's already been captured.",id="Discarded session because of missing or non-string release",ad=Symbol.for("SentryInternalError"),cd=Symbol.for("SentryDoNotSendEventError");function va(t){return{message:t,[ad]:!0}}function Pu(t){return{message:t,[cd]:!0}}function od(t){return!!t&&typeof t=="object"&&ad in t}function sd(t){return!!t&&typeof t=="object"&&cd in t}var Lo=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Pm(e.dsn):te&&K.warn("No DSN provided, client will not send events."),this._dsn){let r=Jm(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(Z(S({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:r}))}}captureException(e,r,n){let i=Xe();if(na(e))return te&&K.log(nd),i;let o=S({event_id:i},r);return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,n))),o.event_id}captureMessage(e,r,n,i){let o=S({event_id:Xe()},n),s=pi(e)?e:String(e),a=Rn(e)?this.eventFromMessage(s,r,o):this.eventFromException(e,o);return this._process(a.then(c=>this._captureEvent(c,o,i))),o.event_id}captureEvent(e,r,n){let i=Xe();if(r?.originalException&&na(r.originalException))return te&&K.log(nd),i;let o=S({event_id:i},r),s=e.sdkProcessingMetadata||{},a=s.capturedSpanScope,c=s.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,a||n,c)),o.event_id}captureSession(e){this.sendSession(e),kr(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let r=this._transport;return r?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>r.flush(e).then(i=>n&&i))):Gt(!0)}close(e){return this.flush(e).then(r=>(this.getOptions().enabled=!1,this.emit("close"),r))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let r=this._integrations[e.name];Ou(this,e,this._integrations),r||Nu(this,[e])}sendEvent(e,r={}){this.emit("beforeSendEvent",e,r);let n=Vm(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=Bm(n,km(o));let i=this.sendEnvelope(n);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){let{release:r,environment:n=gi}=this._options;if("aggregates"in e){let o=e.attrs||{};if(!o.release&&!r){te&&K.warn(id);return}o.release=o.release||r,o.environment=o.environment||n,e.attrs=o}else{if(!e.release&&!r){te&&K.warn(id);return}e.release=e.release||r,e.environment=e.environment||n}this.emit("beforeSendSession",e);let i=Hm(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,r,n=1){if(this._options.sendClientReports){let i=`${e}:${r}`;te&&K.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}on(e,r){let n=this._hooks[e]=this._hooks[e]||[];return n.push(r),()=>{let i=n.indexOf(r);i>-1&&n.splice(i,1)}}emit(e,...r){let n=this._hooks[e];n&&n.forEach(i=>i(...r))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,r=>(te&&K.error("Error while sending envelope:",r),r)):(te&&K.error("Transport disabled"),Gt({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Zm(this,e),Nu(this,e)}_updateSessionFromEvent(e,r){let n=r.level==="fatal",i=!1,o=r.exception?.values;if(o){i=!0;for(let c of o)if(c.mechanism?.handled===!1){n=!0;break}}let s=e.status==="ok";(s&&e.errors===0||s&&n)&&(kr(e,Z(S({},n&&{status:"crashed"}),{errors:e.errors||Number(i||n)})),this.captureSession(e))}_isClientDoneProcessing(e){return new ir(r=>{let n=0,i=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),r(!0)):(n+=i,e&&n>=e&&(clearInterval(o),r(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,r,n,i){let o=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s?.length&&(r.integrations=s),this.emit("preprocessEvent",e,r),e.type||i.setLastEventId(e.event_id||r.event_id),zm(o,e,r,n,this,i).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,r),a.contexts=S({trace:hu(n)},a.contexts);let c=Mm(this,n);return a.sdkProcessingMetadata=S({dynamicSamplingContext:c},a.sdkProcessingMetadata),a})}_captureEvent(e,r={},n=nr(),i=gr()){return te&&Lu(e)&&K.log(`Captured error event \`${ya(e)[0]||"<unknown>"}\``),this._processEvent(e,r,n,i).then(o=>o.event_id,o=>{te&&(sd(o)?K.log(o.message):od(o)?K.warn(o.message):K.warn(o))})}_processEvent(e,r,n,i){let o=this.getOptions(),{sampleRate:s}=o,a=ld(e),c=Lu(e),p=e.type||"error",f=`before send for type \`${p}\``,m=typeof s>"u"?void 0:Im(s);if(c&&typeof m=="number"&&Math.random()>m)return this.recordDroppedEvent("sample_rate","error"),tn(Pu(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let v=p==="replay_event"?"replay":p;return this._prepareEvent(e,r,n,i).then(y=>{if(y===null)throw this.recordDroppedEvent("event_processor",v),Pu("An event processor returned `null`, will not send event.");if(r.data&&r.data.__sentry__===!0)return y;let R=mE(this,o,y,r);return fE(R,f)}).then(y=>{if(y===null){if(this.recordDroppedEvent("before_send",v),a){let N=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",N)}throw Pu(`${f} returned \`null\`, will not send event.`)}let T=n.getSession()||i.getSession();if(c&&T&&this._updateSessionFromEvent(T,y),a){let A=y.sdkProcessingMetadata?.spanCountBeforeProcessing||0,N=y.spans?y.spans.length:0,B=A-N;B>0&&this.recordDroppedEvent("before_send","span",B)}let R=y.transaction_info;if(a&&R&&y.transaction!==e.transaction){let A="custom";y.transaction_info=Z(S({},R),{source:A})}return this.sendEvent(y,r),y}).then(null,y=>{throw sd(y)||od(y)?y:(this.captureException(y,{data:{__sentry__:!0},originalException:y}),va(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
23
|
-
Reason: ${y}`))})}_process(e){this._numProcessing++,e.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([r,n])=>{let[i,o]=r.split(":");return{reason:i,category:o,quantity:n}})}_flushOutcomes(){te
|
|
24
|
-
Event: ${
|
|
25
|
-
Event: ${
|
|
26
|
-
Event: ${
|
|
27
|
-
Event: ${
|
|
28
|
-
Url: ${
|
|
29
|
-
Event: ${
|
|
30
|
-
Url: ${Sa(t)}`),!0}return!1}function TE(t,e){return e?.length?ya(t).some(r=>fi(r,e)):!1}function CE(t,e){if(!e?.length)return!1;let r=t.transaction;return r?fi(r,e):!1}function xE(t,e){if(!e?.length)return!1;let r=Sa(t);return r?fi(r,e):!1}function RE(t,e){if(!e?.length)return!0;let r=Sa(t);return r?fi(r,e):!0}function AE(t=[]){for(let e=t.length-1;e>=0;e--){let r=t[e];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Sa(t){try{let r=[...t.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?AE(r):null}catch{return te&&K.error(`Cannot extract url for event ${mr(t)}`),null}}function DE(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function Vu(t,e,r,n,i,o){if(!i.exception?.values||!o||!rr(o.originalException,Error))return;let s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=Hu(t,e,n,o.originalException,r,i.exception.values,s,0))}function Hu(t,e,r,n,i,o,s,a){if(o.length>=r+1)return o;let c=[...o];if(rr(n[i],Error)){vd(s,a);let p=t(e,n[i]),f=c.length;Ed(p,i,f,a),c=Hu(t,e,r,n[i],i,[p,...c],p,f)}return Array.isArray(n.errors)&&n.errors.forEach((p,f)=>{if(rr(p,Error)){vd(s,a);let m=t(e,p),v=c.length;Ed(m,`errors[${f}]`,v,a),c=Hu(t,e,r,p,i,[m,...c],m,v)}}),c}function vd(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(S(S({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Ed(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(S({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function $u(t){let e="console";vt(e,t),Et(e,NE)}function NE(){"console"in oe&&ql.forEach(function(t){t in oe.console&&Ke(oe.console,t,function(e){return li[t]=e,function(...r){qe("console",{args:r,level:t}),li[t]?.apply(oe.console,r)}})})}function Wu(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var OE="Dedupe",PE=()=>{let t;return{name:OE,processEvent(e){if(e.type)return e;try{if(LE(e,t))return te&&K.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},wa=PE;function LE(t,e){return e?!!(ME(t,e)||BE(t,e)):!1}function ME(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!bd(t,e)||!Sd(t,e))}function BE(t,e){let r=_d(e),n=_d(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!bd(t,e)||!Sd(t,e))}function Sd(t,e){let r=Xs(t),n=Xs(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let o=n[i],s=r[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function bd(t,e){let r=t.fingerprint,n=e.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function _d(t){return t.exception?.values?.[0]}function Bo(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let r=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:r,hash:n,relative:e[5]+r+n}}function Ia(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var Uo=oe;function ju(){return"history"in Uo&&!!Uo.history}function UE(){if(!("fetch"in Uo))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function ko(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Gu(){if(typeof EdgeRuntime=="string")return!0;if(!UE())return!1;if(ko(Uo.fetch))return!0;let t=!1,e=Uo.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=ko(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){te&&K.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function zu(t,e){let r="fetch";vt(r,t),Et(r,()=>kE(void 0,e))}function kE(t,e=!1){e&&!Gu()||Ke(oe,"fetch",function(r){return function(...n){let i=new Error,{method:o,url:s}=FE(n),a={args:n,fetchData:{method:o,url:s},startTimestamp:Tt()*1e3,virtualError:i,headers:HE(n)};return t||qe("fetch",S({},a)),r.apply(oe,n).then(async c=>(t?t(c):qe("fetch",Z(S({},a),{endTimestamp:Tt()*1e3,response:c})),c),c=>{if(qe("fetch",Z(S({},a),{endTimestamp:Tt()*1e3,error:c})),xn(c)&&c.stack===void 0&&(c.stack=i.stack,Nt(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{let p=new URL(a.fetchData.url);c.message=`${c.message} (${p.host})`}catch{}throw c})}})}function Yu(t,e){return!!t&&typeof t=="object"&&!!t[e]}function wd(t){return typeof t=="string"?t:t?Yu(t,"url")?t.url:t.toString?t.toString():"":""}function FE(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:wd(r),method:Yu(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:wd(e),method:Yu(e,"method")?String(e.method).toUpperCase():"GET"}}function HE(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(cm(e))return new Headers(e.headers)}catch{}}function qu(){return"npm"}var Fe=oe,Ku=0;function Xu(){return Ku>0}function e_(){Ku++,setTimeout(()=>{Ku--})}function Nn(t,e={}){function r(i){return typeof i=="function"}if(!r(t))return t;try{let i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(Dn(t))return t}catch{return t}let n=function(...i){try{let o=i.map(s=>Nn(s,e));return t.apply(this,o)}catch(o){throw e_(),Ao(s=>{s.addEventProcessor(a=>(e.mechanism&&(mi(a,void 0,void 0),dr(a,e.mechanism)),a.extra=Z(S({},a.extra),{arguments:i}),a)),da(o)}),o}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}ta(n,t),Nt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function Id(){let t=Ro(),{referrer:e}=Fe.document||{},{userAgent:r}=Fe.navigator||{},n=S(S({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function Ta(t,e){let r=Zu(t,e),n={type:o_(e),value:s_(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function t_(t,e,r,n){let o=Ue()?.getOptions().normalizeDepth,s=l_(e),a={__serialized__:la(e,o)};if(s)return{exception:{values:[Ta(t,s)]},extra:a};let c={exception:{values:[{type:An(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:a_(e,{isUnhandledRejection:n})}]},extra:a};if(r){let p=Zu(t,r);p.length&&(c.exception.values[0].stacktrace={frames:p})}return c}function Ju(t,e){return{exception:{values:[Ta(t,e)]}}}function Zu(t,e){let r=e.stacktrace||e.stack||"",n=n_(e),i=i_(e);try{return t(r,n,i)}catch{}return[]}var r_=/Minified React error #\d+;/i;function n_(t){return t&&r_.test(t.message)?1:0}function i_(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Td(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function o_(t){let e=t?.name;return!e&&Td(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function s_(t){let e=t?.message;return Td(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Cd(t,e,r,n){let i=r?.syntheticException||void 0,o=Ca(t,e,i,n);return dr(o),o.level="error",r?.event_id&&(o.event_id=r.event_id),Gt(o)}function xd(t,e,r="info",n,i){let o=n?.syntheticException||void 0,s=Qu(t,e,o,i);return s.level=r,n?.event_id&&(s.event_id=n.event_id),Gt(s)}function Ca(t,e,r,n,i){let o;if(Qs(e)&&e.error)return Ju(t,e.error);if(Zs(e)||nu(e)){let s=e;if("stack"in e)o=Ju(t,e);else{let a=s.name||(Zs(s)?"DOMError":"DOMException"),c=s.message?`${a}: ${s.message}`:a;o=Qu(t,c,r,n),mi(o,c)}return"code"in s&&(o.tags=Z(S({},o.tags),{"DOMException.code":`${s.code}`})),o}return xn(e)?Ju(t,e):Br(e)||An(e)?(o=t_(t,e,r,i),dr(o,{synthetic:!0}),o):(o=Qu(t,e,r,n),mi(o,`${e}`,void 0),dr(o,{synthetic:!0}),o)}function Qu(t,e,r,n){let i={};if(n&&r){let o=Zu(t,r);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),dr(i,{synthetic:!0})}if(pi(e)){let{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function a_(t,{isUnhandledRejection:e}){let r=lu(t),n=e?"promise rejection":"exception";return Qs(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:An(t)?`Event \`${c_(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function c_(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function l_(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var u_=5e3,Fo=class extends Lo{constructor(e){let r=p_(e),n=Fe.SENTRY_SDK_SOURCE||qu();ku(r,"browser",["browser"],n),super(r);let{sendDefaultPii:i,sendClientReports:o,enableLogs:s,_experiments:a}=this._options,c=s??a?.enableLogs;Fe.document&&(o||c)&&Fe.document.addEventListener("visibilitychange",()=>{Fe.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),c&&Mo(this))}),c&&(this.on("flush",()=>{Mo(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{Mo(this)},u_)})),i&&(this.on("postprocessEvent",Bu),this.on("beforeSendSession",Uu))}eventFromException(e,r){return Cd(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return xd(this._options.stackParser,e,r,n,this._options.attachStacktrace)}_prepareEvent(e,r,n,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n,i)}};function p_(t){return S({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Fe.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var Rd=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Je=oe;var f_=1e3,Ad,ep,tp;function rp(t){let e="dom";vt(e,t),Et(e,m_)}function m_(){if(!Je.document)return;let t=qe.bind(null,"dom"),e=Dd(t,!0);Je.document.addEventListener("click",e,!1),Je.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let i=Je[r]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(Ke(i,"addEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},f=p[s]=p[s]||{refCount:0};if(!f.handler){let m=Dd(t);f.handler=m,o.call(this,s,m,c)}f.refCount++}catch{}return o.call(this,s,a,c)}}),Ke(i,"removeEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__||{},f=p[s];f&&(f.refCount--,f.refCount<=0&&(o.call(this,s,f.handler,c),f.handler=void 0,delete p[s]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,c)}}))})}function d_(t){if(t.type!==ep)return!1;try{if(!t.target||t.target._sentryId!==tp)return!1}catch{}return!0}function h_(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function Dd(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=g_(r);if(h_(r.type,n))return;Nt(r,"_sentryCaptured",!0),n&&!n._sentryId&&Nt(n,"_sentryId",Xe());let i=r.type==="keypress"?"input":r.type;d_(r)||(t({event:r,name:i,global:e}),ep=r.type,tp=n?n._sentryId:void 0),clearTimeout(Ad),Ad=Je.setTimeout(()=>{tp=void 0,ep=void 0},f_)}}function g_(t){try{return t.target}catch{return null}}var xa;function Ho(t){let e="history";vt(e,t),Et(e,y_)}function y_(){if(Je.addEventListener("popstate",()=>{let e=Je.location.href,r=xa;if(xa=e,r===e)return;qe("history",{from:r,to:e})}),!ju())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let i=xa,o=v_(String(n));if(xa=o,i===o)return e.apply(this,r);qe("history",{from:i,to:o})}return e.apply(this,r)}}Ke(Je.history,"pushState",t),Ke(Je.history,"replaceState",t)}function v_(t){try{return new URL(t,Je.location.origin).toString()}catch{return t}}var Ra={};function np(t){let e=Ra[t];if(e)return e;let r=Je[t];if(ko(r))return Ra[t]=r.bind(Je);let n=Je.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let o=i.contentWindow;o?.[t]&&(r=o[t]),n.head.removeChild(i)}catch(i){Rd&&K.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Ra[t]=r.bind(Je))}function Aa(t){Ra[t]=void 0}var On="__sentry_xhr_v3__";function ip(t){let e="xhr";vt(e,t),Et(e,E_)}function E_(){if(!Je.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let i=new Error,o=Tt()*1e3,s=_t(n[0])?n[0].toUpperCase():void 0,a=__(n[1]);if(!s||!a)return e.apply(r,n);r[On]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let c=()=>{let p=r[On];if(p&&r.readyState===4){try{p.status_code=r.status}catch{}let f={endTimestamp:Tt()*1e3,startTimestamp:o,xhr:r,virtualError:i};qe("xhr",f)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(p,f,m){return c(),p.apply(f,m)}}):r.addEventListener("readystatechange",c),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(p,f,m){let[v,y]=m,T=f[On];return T&&_t(v)&&_t(y)&&(T.request_headers[v.toLowerCase()]=y),p.apply(f,m)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let i=r[On];if(!i)return e.apply(r,n);n[0]!==void 0&&(i.body=n[0]);let o={startTimestamp:Tt()*1e3,xhr:r};return qe("xhr",o),e.apply(r,n)}})}function __(t){if(_t(t))return t;try{return t.toString()}catch{}}function op(t,e=np("fetch")){let r=0,n=0;function i(o){let s=o.body.length;r+=s,n++;let a=S({body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return Aa("fetch"),tn("No fetch implementation available");try{return e(t.url,a).then(c=>(r-=s,n--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return Aa("fetch"),r-=s,n--,tn(c)}}return Ea(t,i)}var S_=30;var b_=50;function sp(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?fr:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var w_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,I_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,T_=/\((\S*)(?::(\d+))(?::(\d+))\)/,C_=t=>{let e=w_.exec(t);if(e){let[,n,i,o]=e;return sp(n,fr,+i,+o)}let r=I_.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=T_.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[i,o]=Ld(r[1]||fr,r[2]);return sp(o,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Nd=[S_,C_],x_=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,R_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,A_=t=>{let e=x_.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let o=R_.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let n=e[3],i=e[1]||fr;return[i,n]=Ld(i,n),sp(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Od=[b_,A_];var Pd=[Nd,Od],ap=Ql(...Pd),Ld=(t,e)=>{let r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:fr,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var yi=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Da=1024,D_="Breadcrumbs",N_=(t={})=>{let e=S({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:D_,setup(r){e.console&&$u(L_(r)),e.dom&&rp(P_(r,e.dom)),e.xhr&&ip(M_(r)),e.fetch&&zu(B_(r)),e.history&&Ho(U_(r)),e.sentry&&r.on("beforeSendEvent",O_(r))}}},Md=N_;function O_(t){return function(r){Ue()===t&&yr({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:mr(r)},{event:r})}}function P_(t,e){return function(n){if(Ue()!==t)return;let i,o,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>Da&&(yi&&K.warn(`\`dom.maxStringLength\` cannot exceed ${Da}, but a value of ${a} was configured. Sentry will use ${Da} instead.`),a=Da),typeof s=="string"&&(s=[s]);try{let p=n.event,f=k_(p)?p.target:p;i=xo(f,{keyAttrs:s,maxStringLength:a}),o=cu(f)}catch{i="<unknown>"}if(i.length===0)return;let c={category:`ui.${n.name}`,message:i};o&&(c.data={"ui.component_name":o}),yr(c,{event:n.event,name:n.name,global:n.global})}}function L_(t){return function(r){if(Ue()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:Wu(r.level),message:ea(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${ea(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;yr(n,{input:r.args,level:r.level})}}function M_(t){return function(r){if(Ue()!==t)return;let{startTimestamp:n,endTimestamp:i}=r,o=r.xhr[On];if(!n||!i||!o)return;let{method:s,url:a,status_code:c,body:p}=o,f={method:s,url:a,status_code:c},m={xhr:r.xhr,input:p,startTimestamp:n,endTimestamp:i},v={category:"xhr",data:f,type:"http",level:Ia(c)};t.emit("beforeOutgoingRequestBreadcrumb",v,m),yr(v,m)}}function B_(t){return function(r){if(Ue()!==t)return;let{startTimestamp:n,endTimestamp:i}=r;if(i&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.fetchData.method,r.fetchData.url,r.error){let o=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:i},a={category:"fetch",data:o,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,s),yr(a,s)}else{let o=r.response,s=Z(S({},r.fetchData),{status_code:o?.status});r.fetchData.request_body_size,r.fetchData.response_body_size,o?.status;let a={input:r.args,response:o,startTimestamp:n,endTimestamp:i},c={category:"fetch",data:s,type:"http",level:Ia(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,a),yr(c,a)}}}function U_(t){return function(r){if(Ue()!==t)return;let n=r.from,i=r.to,o=Bo(Fe.location.href),s=n?Bo(n):void 0,a=Bo(i);s?.path||(s=o),o.protocol===a.protocol&&o.host===a.host&&(i=a.relative),o.protocol===s.protocol&&o.host===s.host&&(n=s.relative),yr({category:"navigation",data:{from:n,to:i}})}}function k_(t){return!!t&&!!t.target}var F_=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],H_="BrowserApiErrors",V_=(t={})=>{let e=S({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:H_,setupOnce(){e.setTimeout&&Ke(Fe,"setTimeout",Bd),e.setInterval&&Ke(Fe,"setInterval",Bd),e.requestAnimationFrame&&Ke(Fe,"requestAnimationFrame",$_),e.XMLHttpRequest&&"XMLHttpRequest"in Fe&&Ke(XMLHttpRequest.prototype,"send",W_);let r=e.eventTarget;r&&(Array.isArray(r)?r:F_).forEach(i=>j_(i,e))}}},Ud=V_;function Bd(t){return function(...e){let r=e[0];return e[0]=Nn(r,{mechanism:{data:{function:Wt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function $_(t){return function(e){return t.apply(this,[Nn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Wt(t)},handled:!1,type:"instrument"}})])}}function W_(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in r&&typeof r[i]=="function"&&Ke(r,i,function(o){let s={mechanism:{data:{function:i,handler:Wt(o)},handled:!1,type:"instrument"}},a=Dn(o);return a&&(s.mechanism.data.handler=Wt(a)),Nn(o,s)})}),t.apply(this,e)}}function j_(t,e){let n=Fe[t]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(Ke(n,"addEventListener",function(i){return function(o,s,a){try{G_(s)&&(s.handleEvent=Nn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Wt(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&Y_(this,o,s),i.apply(this,[o,Nn(s,{mechanism:{data:{function:"addEventListener",handler:Wt(s),target:t},handled:!1,type:"instrument"}}),a])}}),Ke(n,"removeEventListener",function(i){return function(o,s,a){try{let c=s.__sentry_wrapped__;c&&i.call(this,o,c,a)}catch{}return i.call(this,o,s,a)}}))}function G_(t){return typeof t.handleEvent=="function"}function Y_(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var kd=()=>({name:"BrowserSession",setupOnce(){if(typeof Fe.document>"u"){yi&&K.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Oo({ignoreDuration:!0}),Po(),Ho(({from:t,to:e})=>{t!==void 0&&t!==e&&(Oo({ignoreDuration:!0}),Po())})}});var z_="GlobalHandlers",q_=(t={})=>{let e=S({onerror:!0,onunhandledrejection:!0},t);return{name:z_,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(K_(r),Fd("onerror")),e.onunhandledrejection&&(X_(r),Fd("onunhandledrejection"))}}},Hd=q_;function K_(t){eu(e=>{let{stackParser:r,attachStacktrace:n}=Vd();if(Ue()!==t||Xu())return;let{msg:i,url:o,line:s,column:a,error:c}=e,p=Z_(Ca(r,c||i,void 0,n,!1),o,s,a);p.level="error",No(p,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function X_(t){ru(e=>{let{stackParser:r,attachStacktrace:n}=Vd();if(Ue()!==t||Xu())return;let i=J_(e),o=Rn(i)?Q_(i):Ca(r,i,void 0,n,!0);o.level="error",No(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function J_(t){if(Rn(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function Q_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function Z_(t,e,r,n){let i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],p=n,f=r,m=_t(e)&&e.length>0?e:Ro();return c.length===0&&c.push({colno:p,filename:m,function:fr,in_app:!0,lineno:f}),t}function Fd(t){yi&&K.log(`Global Handler attached: ${t}`)}function Vd(){return Ue()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var $d=()=>({name:"HttpContext",preprocessEvent(t){if(!Fe.navigator&&!Fe.location&&!Fe.document)return;let e=Id(),r=S(S({},e.headers),t.request?.headers);t.request=Z(S(S({},e),t.request),{headers:r})}});var eS="cause",tS=5,rS="LinkedErrors",nS=(t={})=>{let e=t.limit||tS,r=t.key||eS;return{name:rS,preprocessEvent(n,i,o){let s=o.getOptions();Vu(Ta,s.stackParser,r,e,n,i)}}},Wd=nS;function cp(t){return[ba(),_a(),Ud(),Md(),Hd(),Wd(),wa(),$d(),kd()]}var Oa={},Pa,lp,jd;(()=>{let t=cp({}).filter(e=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(e.name));lp=new Fo({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:op,stackParser:ap,integrations:t,environment:It.mode,release:`web-sdk@${D.SDK_VERSION}`,debug:It.debug}),lp.init()})();var La=class t{static INSTANCE;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}captureError(e,r,n){be(e,r,n)}};function be(t,e,r){b.error(`${e}:`,t);let n=pp(r);n.setTag("operation",e),n.captureException(t)}function up(t,e,r){pp(r).captureMessage(t,e??"error")}async function Ma(t,e,r){let n="";try{t=t.clone();let o=await t.json();n=JSON.stringify(o)}catch{}if(!n)try{n=await t.text()}catch{}let i=pp(r);i.setTag("operation",e),i.setExtra("responseText",n),i.setExtra("statusText",t.statusText),up(`${e} failed with ${t.status}`,"error",r)}function Gd(t){jd=t}function Vo(t,e){Oa[t]=S({context:e},Oa[t])}function Yd(t){Pa=S(S({},Pa),t)}function pp(t){t??={};let{extra:e,tags:r}=t,n=new lt;if(n.setClient(lp),n.setUser(jd),t.triggerContext&&!t.engagementTrigger&&(t.engagementTrigger=t.triggerContext.triggerData),t.engagementTrigger){let i=t.engagementTrigger;n.setTags({"engagement.id":i.engagementID,"engagement.short_id":i.shortID,"engagement.objective":i.objective,"engagement.delivery_type":i.onsiteDeliveryType,"engagement.content_id":i.contentID,"engagement.variation":i.variation,"engagement.currency":i.currency})}return e&&n.setExtras(e),r&&n.setTags(r),Pa&&n.setTags(Pa),Object.keys(Oa).forEach(i=>{n.setContext(i,Oa[i])}),n.setTag("language",navigator.language),n.setTag("timezone",zd()),iS(n),n}function iS(t){window.Shopify&&(t.setTag("shopify.shop",window.Shopify.shop),t.setTag("shopify.currency",window.Shopify.currency?.active),t.setTag("shopify.locale",window.Shopify.locale),t.setTag("theme.schema_name",window.Shopify.theme?.schema_name),t.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}var Ba=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(e,2);case"amount_no_decimals":return this.formatWithDelimiters(e,0);case"amount_with_comma_separator":return this.formatWithDelimiters(e,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(e,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(e,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(e,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(e,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(e,2," ",".");default:return i}})}static formatWithDelimiters(e,r=2,n=",",i="."){if(isNaN(e)||e==null)return"0";let s=(e/100).toFixed(r).split("."),a=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),c=s[1]?i+s[1]:"";return a+c}};var ce=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;activeExperiment;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(e){this._currencyCode=e}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(e){this.currentItem=new ht(e)}};function ka(t){try{return new URL(t)}catch{return}}function fp(t){return!t||t==="null"||t==="undefined"}function qd(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function St(t,e){if(t==0&&e)return"Free";let r=ce.get(),n=Me.get(),i=r.shopCurrencyCode||n.currency,o=r.currencyCode;o||b.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,a;if(s&&i===o)a=Ba.format(t*100,s);else{let c;try{c=new Intl.NumberFormat(Xd(),{style:"currency",currency:o||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return be(p,"format-currency",{extra:{currentCurrency:o,shopCurrency:i}}),""}a=c.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&o!=="INR"&&(a=a.concat(` ${o}`))}return a}function Kd(t){return new Intl.NumberFormat(Xd(),{notation:"compact"}).format(t)}function Xd(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var Ua;function zd(){if(Ua)return Ua;try{return Ua=Intl.DateTimeFormat().resolvedOptions().timeZone,Ua}catch{return""}}function vi(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function Yt(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},3e3)}async function mp(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let o=Math.min(100*2**n,5e3);if(await $t.sleep(o),i=r.querySelectorAll(t),i.length)return b.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;b.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${o}ms.`),n++}return b.warn(`Max attempts reached. Element not found with ${t}.`),i}async function Ei(t,e=10,r=document){return(await mp(t,e,r)).item(0)}function Jd(t,e,r=document.body){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{(s===t||s.contains(t))&&(e(),n.disconnect())})})});n.observe(r,{childList:!0})}async function Fa(){let t=await Te.get(ne.DEVICE_ID),e=await it.get(ne.ID,"");return[{key:"letscooee_did",value:t},{key:"letscooee_sid",value:e},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}]}function Pn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var Wa,ve,rh,gp,Ln,Qd,nh,ih,oh,yp,dp,hp,oS,$o={},sh=[],sS=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ja=Array.isArray;function Hr(t,e){for(var r in e)t[r]=e[r];return t}function vp(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ep(t,e,r){var n,i,o,s={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?Wa.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return Va(t,s,n,i,null)}function Va(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++rh,__i:-1,__u:0};return i==null&&ve.vnode!=null&&ve.vnode(o),o}function Er(t){return t.children}function vr(t,e){this.props=t,this.context=e}function _i(t,e){if(e==null)return t.__?_i(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?_i(t):null}function ah(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return ah(t)}}function Zd(t){(!t.__d&&(t.__d=!0)&&Ln.push(t)&&!$a.__r++||Qd!=ve.debounceRendering)&&((Qd=ve.debounceRendering)||nh)($a)}function $a(){for(var t,e,r,n,i,o,s,a=1;Ln.length;)Ln.length>a&&Ln.sort(ih),t=Ln.shift(),a=Ln.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,o=[],s=[],e.__P&&((r=Hr({},n)).__v=n.__v+1,ve.vnode&&ve.vnode(r),_p(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??_i(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,uh(o,r,s),r.__e!=i&&ah(r)));$a.__r=0}function ch(t,e,r,n,i,o,s,a,c,p,f){var m,v,y,T,R,A,N=n&&n.__k||sh,B=e.length;for(c=aS(r,e,N,c,B),m=0;m<B;m++)(y=r.__k[m])!=null&&(v=y.__i==-1?$o:N[y.__i]||$o,y.__i=m,A=_p(t,y,v,i,o,s,a,c,p,f),T=y.__e,y.ref&&v.ref!=y.ref&&(v.ref&&Sp(v.ref,null,y),f.push(y.ref,y.__c||T,y)),R==null&&T!=null&&(R=T),4&y.__u||v.__k===y.__k?c=lh(y,c,t):typeof y.type=="function"&&A!==void 0?c=A:T&&(c=T.nextSibling),y.__u&=-7);return r.__e=R,c}function aS(t,e,r,n,i){var o,s,a,c,p,f=r.length,m=f,v=0;for(t.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(c=o+v,(s=t.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?Va(null,s,null,null,null):ja(s)?Va(Er,{children:s},null,null,null):s.constructor==null&&s.__b>0?Va(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(p=s.__i=cS(s,r,c,m))!=-1&&(m--,(a=r[p])&&(a.__u|=2)),a==null||a.__v==null?(p==-1&&(i>f?v--:i<f&&v++),typeof s.type!="function"&&(s.__u|=4)):p!=c&&(p==c-1?v--:p==c+1?v++:(p>c?v--:v++,s.__u|=4))):t.__k[o]=null;if(m)for(o=0;o<f;o++)(a=r[o])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=_i(a)),fh(a,a));return n}function lh(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=lh(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=_i(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function cS(t,e,r,n){var i,o,s=t.key,a=t.type,c=e[r];if(c===null&&t.key==null||c&&s==c.key&&a==c.type&&(2&c.__u)==0)return r;if(n>(c!=null&&(2&c.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<e.length;){if(i>=0){if((c=e[i])&&(2&c.__u)==0&&s==c.key&&a==c.type)return i;i--}if(o<e.length){if((c=e[o])&&(2&c.__u)==0&&s==c.key&&a==c.type)return o;o++}}return-1}function eh(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||sS.test(e)?r:r+"px"}function Ha(t,e,r,n,i){var o,s;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||eh(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||eh(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(oh,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=yp,t.addEventListener(e,o?hp:dp,o)):t.removeEventListener(e,o?hp:dp,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function th(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=yp++;else if(e.t<r.u)return;return r(ve.event?ve.event(e):e)}}}function _p(t,e,r,n,i,o,s,a,c,p){var f,m,v,y,T,R,A,N,B,P,q,de,W,re,Q,ae,Oe,we=e.type;if(e.constructor!=null)return null;128&r.__u&&(c=!!(32&r.__u),o=[a=e.__e=r.__e]),(f=ve.__b)&&f(e);e:if(typeof we=="function")try{if(N=e.props,B="prototype"in we&&we.prototype.render,P=(f=we.contextType)&&n[f.__c],q=f?P?P.props.value:f.__:n,r.__c?A=(m=e.__c=r.__c).__=m.__E:(B?e.__c=m=new we(N,q):(e.__c=m=new vr(N,q),m.constructor=we,m.render=uS),P&&P.sub(m),m.props=N,m.state||(m.state={}),m.context=q,m.__n=n,v=m.__d=!0,m.__h=[],m._sb=[]),B&&m.__s==null&&(m.__s=m.state),B&&we.getDerivedStateFromProps!=null&&(m.__s==m.state&&(m.__s=Hr({},m.__s)),Hr(m.__s,we.getDerivedStateFromProps(N,m.__s))),y=m.props,T=m.state,m.__v=e,v)B&&we.getDerivedStateFromProps==null&&m.componentWillMount!=null&&m.componentWillMount(),B&&m.componentDidMount!=null&&m.__h.push(m.componentDidMount);else{if(B&&we.getDerivedStateFromProps==null&&N!==y&&m.componentWillReceiveProps!=null&&m.componentWillReceiveProps(N,q),!m.__e&&m.shouldComponentUpdate!=null&&m.shouldComponentUpdate(N,m.__s,q)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(m.props=N,m.state=m.__s,m.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Pe){Pe&&(Pe.__=e)}),de=0;de<m._sb.length;de++)m.__h.push(m._sb[de]);m._sb=[],m.__h.length&&s.push(m);break e}m.componentWillUpdate!=null&&m.componentWillUpdate(N,m.__s,q),B&&m.componentDidUpdate!=null&&m.__h.push(function(){m.componentDidUpdate(y,T,R)})}if(m.context=q,m.props=N,m.__P=t,m.__e=!1,W=ve.__r,re=0,B){for(m.state=m.__s,m.__d=!1,W&&W(e),f=m.render(m.props,m.state,m.context),Q=0;Q<m._sb.length;Q++)m.__h.push(m._sb[Q]);m._sb=[]}else do m.__d=!1,W&&W(e),f=m.render(m.props,m.state,m.context),m.state=m.__s;while(m.__d&&++re<25);m.state=m.__s,m.getChildContext!=null&&(n=Hr(Hr({},n),m.getChildContext())),B&&!v&&m.getSnapshotBeforeUpdate!=null&&(R=m.getSnapshotBeforeUpdate(y,T)),ae=f,f!=null&&f.type===Er&&f.key==null&&(ae=ph(f.props.children)),a=ch(t,ja(ae)?ae:[ae],e,r,n,i,o,s,a,c,p),m.base=e.__e,e.__u&=-161,m.__h.length&&s.push(m),A&&(m.__E=m.__=null)}catch(Pe){if(e.__v=null,c||o!=null)if(Pe.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(Oe=o.length;Oe--;)vp(o[Oe]);else e.__e=r.__e,e.__k=r.__k;ve.__e(Pe,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=lS(r.__e,e,r,n,i,o,s,c,p);return(f=ve.diffed)&&f(e),128&e.__u?void 0:a}function uh(t,e,r){for(var n=0;n<r.length;n++)Sp(r[n],r[++n],r[++n]);ve.__c&&ve.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){ve.__e(o,i.__v)}})}function ph(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:ja(t)?t.map(ph):Hr({},t)}function lS(t,e,r,n,i,o,s,a,c){var p,f,m,v,y,T,R,A=r.props,N=e.props,B=e.type;if(B=="svg"?i="http://www.w3.org/2000/svg":B=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(p=0;p<o.length;p++)if((y=o[p])&&"setAttribute"in y==!!B&&(B?y.localName==B:y.nodeType==3)){t=y,o[p]=null;break}}if(t==null){if(B==null)return document.createTextNode(N);t=document.createElementNS(i,B,N.is&&N),a&&(ve.__m&&ve.__m(e,o),a=!1),o=null}if(B==null)A===N||a&&t.data==N||(t.data=N);else{if(o=o&&Wa.call(t.childNodes),A=r.props||$o,!a&&o!=null)for(A={},p=0;p<t.attributes.length;p++)A[(y=t.attributes[p]).name]=y.value;for(p in A)if(y=A[p],p!="children"){if(p=="dangerouslySetInnerHTML")m=y;else if(!(p in N)){if(p=="value"&&"defaultValue"in N||p=="checked"&&"defaultChecked"in N)continue;Ha(t,p,null,y,i)}}for(p in N)y=N[p],p=="children"?v=y:p=="dangerouslySetInnerHTML"?f=y:p=="value"?T=y:p=="checked"?R=y:a&&typeof y!="function"||A[p]===y||Ha(t,p,y,A[p],i);if(f)a||m&&(f.__html==m.__html||f.__html==t.innerHTML)||(t.innerHTML=f.__html),e.__k=[];else if(m&&(t.innerHTML=""),ch(e.type=="template"?t.content:t,ja(v)?v:[v],e,r,n,B=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&_i(r,0),a,c),o!=null)for(p=o.length;p--;)vp(o[p]);a||(p="value",B=="progress"&&T==null?t.removeAttribute("value"):T!=null&&(T!==t[p]||B=="progress"&&!T||B=="option"&&T!=A[p])&&Ha(t,p,T,A[p],i),p="checked",R!=null&&R!=t[p]&&Ha(t,p,R,A[p],i))}return t}function Sp(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){ve.__e(i,r)}}function fh(t,e,r){var n,i;if(ve.unmount&&ve.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Sp(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){ve.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&fh(n[i],e,r||typeof t.type!="function");r||vp(t.__e),t.__c=t.__=t.__e=void 0}function uS(t,e,r){return this.constructor(t,r)}function mh(t,e,r){var n,i,o,s;e==document&&(e=document.documentElement),ve.__&&ve.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],s=[],_p(e,t=(!n&&r||e).__k=Ep(Er,null,[t]),i||$o,$o,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Wa.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,s),uh(o,t,s)}Wa=sh.slice,ve={__e:function(t,e,r,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},rh=0,gp=function(t){return t!=null&&t.constructor==null},vr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Hr({},this.state),typeof t=="function"&&(t=t(Hr({},r),this.props)),t&&Hr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Zd(this))},vr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Zd(this))},vr.prototype.render=Er,Ln=[],nh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ih=function(t,e){return t.__v.__b-e.__v.__b},$a.__r=0,oh=/(PointerCapture)$|Capture$/i,yp=0,dp=th(!1),hp=th(!0),oS=0;var wp,Ot,bp,dh,hh=0,wh=[],Qe=ve,gh=Qe.__b,yh=Qe.__r,vh=Qe.diffed,Eh=Qe.__c,_h=Qe.unmount,Sh=Qe.__;function pS(t,e){Qe.__h&&Qe.__h(Ot,t,hh||e),hh=0;var r=Ot.__H||(Ot.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Tp(t,e){var r=pS(wp++,7);return dS(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function fS(){for(var t;t=wh.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Ga),t.__H.__h.forEach(Ip),t.__H.__h=[]}catch(e){t.__H.__h=[],Qe.__e(e,t.__v)}}Qe.__b=function(t){Ot=null,gh&&gh(t)},Qe.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Sh&&Sh(t,e)},Qe.__r=function(t){yh&&yh(t),wp=0;var e=(Ot=t.__c).__H;e&&(bp===Ot?(e.__h=[],Ot.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(Ga),e.__h.forEach(Ip),e.__h=[],wp=0)),bp=Ot},Qe.diffed=function(t){vh&&vh(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(wh.push(e)!==1&&dh===Qe.requestAnimationFrame||((dh=Qe.requestAnimationFrame)||mS)(fS)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),bp=Ot=null},Qe.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Ga),r.__h=r.__h.filter(function(n){return!n.__||Ip(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Qe.__e(n,r.__v)}}),Eh&&Eh(t,e)},Qe.unmount=function(t){_h&&_h(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Ga(n)}catch(i){e=i}}),r.__H=void 0,e&&Qe.__e(e,r.__v))};var bh=typeof requestAnimationFrame=="function";function mS(t){var e,r=function(){clearTimeout(n),bh&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);bh&&(e=requestAnimationFrame(r))}function Ga(t){var e=Ot,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Ot=e}function Ip(t){var e=Ot;t.__c=t.__(),Ot=e}function dS(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var hS=Symbol.for("preact-signals");function xp(){if(Si>1)Si--;else{for(var t,e=!1;Wo!==void 0;){var r=Wo;for(Wo=void 0,Cp++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Th(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Cp=0,Si--,e)throw t}}var De=void 0;var Wo=void 0,Si=0,Cp=0,Ya=0;function Ih(t){if(De!==void 0){var e=t.n;if(e===void 0||e.t!==De)return e={i:0,S:t,p:De.s,n:void 0,t:De,e:void 0,x:void 0,r:e},De.s!==void 0&&(De.s.n=e),De.s=e,t.n=e,32&De.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=De.s,e.n=void 0,De.s.n=e,De.s=e),e}}function Ze(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Ze.prototype.brand=hS;Ze.prototype.h=function(){return!0};Ze.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};Ze.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};Ze.prototype.subscribe=function(t){var e=this;return ut(function(){var r=e.value,n=De;De=void 0;try{t(r)}finally{De=n}})};Ze.prototype.valueOf=function(){return this.value};Ze.prototype.toString=function(){return this.value+""};Ze.prototype.toJSON=function(){return this.value};Ze.prototype.peek=function(){var t=De;De=void 0;try{return this.value}finally{De=t}};Object.defineProperty(Ze.prototype,"value",{get:function(){var t=Ih(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Cp>100)throw new Error("Cycle detected");this.v=t,this.i++,Ya++,Si++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{xp()}}}});function zt(t){return new Ze(t)}function Th(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Ch(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function xh(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function bi(t){Ze.call(this,void 0),this.x=t,this.s=void 0,this.g=Ya-1,this.f=4}(bi.prototype=new Ze).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ya))return!0;if(this.g=Ya,this.f|=1,this.i>0&&!Th(this))return this.f&=-2,!0;var t=De;try{Ch(this),De=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return De=t,xh(this),this.f&=-2,!0};bi.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}Ze.prototype.S.call(this,t)};bi.prototype.U=function(t){if(this.t!==void 0&&(Ze.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};bi.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(bi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Ih(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Rp(t){return new bi(t)}function Rh(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Si++;var r=De;De=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Ap(t),n}finally{De=r,xp()}}}function Ap(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Rh(t)}function gS(t){if(De!==this)throw new Error("Out-of-order effect");xh(this),De=t,this.f&=-2,8&this.f&&Ap(this),xp()}function jo(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}jo.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};jo.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Rh(this),Ch(this),Si++;var t=De;return De=this,gS.bind(this,t)};jo.prototype.N=function(){2&this.f||(this.f|=2,this.o=Wo,Wo=this)};jo.prototype.d=function(){this.f|=8,1&this.f||Ap(this)};function ut(t){var e=new jo(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Np,Dp;function wi(t,e){ve[t]=e.bind(null,ve[t]||function(){})}function za(t){Dp&&Dp(),Dp=t&&t.S()}function Ah(t){var e=this,r=t.data,n=vS(r);n.value=r;var i=Tp(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),c=i.value;a(),gp(c)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=c},Rp(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}Ah.displayName="_st";Object.defineProperties(Ze.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ah},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});wi("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Ze&&(r||(e.__np=r={}),r[i]=o,n[i]=o.peek())}}t(e)});wi("__r",function(t,e){za();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return ut(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Np=n,za(r),t(e)});wi("__e",function(t,e,r,n){za(),Np=void 0,t(e,r,n)});wi("diffed",function(t,e){za(),Np=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var o=r.U;if(o)for(var s in o){var a=o[s];a!==void 0&&!(s in n)&&(a.d(),o[s]=void 0)}else r.U=o={};for(var c in n){var p=o[c],f=n[c];p===void 0?(p=yS(r,c,f,i),o[c]=p):p.o(f,i)}}}t(e)});function yS(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,o=zt(r);return{o:function(s,a){o.value=s,n=a},d:ut(function(){var s=o.value.value;n[e]!==s&&(n[e]=s,i?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}wi("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});wi("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});vr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function vS(t){return Tp(function(){return zt(t)},[])}var qa=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var Ka=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var Op=class{id;mID;name;groupID;groupName;isSelected;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.name=e.name,this.groupID=e.groupID,this.groupName=e.groupName,this.isSelected=e.isSelected??!1}},_r=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new qa(r))??[],this.link=e.link,this.price=new Ka(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.selectedOptions=e.selectedOptions??[],this.effectivePrice=zt(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=zt(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new Op(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};var gt=class{id;mID;name;status;ctg;options;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=zt(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=zt(this.selectedVariant)}get firstImageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(e=>e.isAvailable)??this.vars[0]}hasVariants(){return this.vars[0]!=null&&this.vars[0].name!=="Default Title"}setSelectedVariant(e){this.selectedOrFirstVariant.value=e}update(e){return this.id=e.id,this.mID=e.mID,this.name=e.name,this.status=e.status,this.ctg=e.ctg,this.imgs=e.imgs,this.desc=e.desc,this.sDesc=e.sDesc,this.link=e.link,this.slug=e.slug,this.quantity=e.quantity,this.meta=e.meta,this.category=e.category,this.videos=e.videos,this.reviews=e.reviews,this.options=e.options,this.portraitVideos=e.videos?.filter(r=>r.orientation==="PORTRAIT"),this.tags=e.tags,e.vars&&(this.vars=e.vars.map(r=>new _r(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new ht({id:this.id,mID:this.mID,vID:e.mID,vName:e.name,name:this.name,link:this.link,slug:this.slug,price:e.price.d,imageURL:e.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let e=this.selectedOrFirstVariant.value,r=e.price,n=this.name,i=this.category,o=St(r.d,!0),s=this.variantImage??this.firstImageURL,a=this.meta,c=this.tags?.join(",")??"",p=this.reviews?.rating,f=this.reviews?.totalReviews,m=r.cmp&&r.cmp>r.d,v={name:n,price:o,image_url:s,meta:a,category:i,rating:p,reviews:f,tags:c};if(e.hasEffectivePrice()&&(v.effective_price=St(e.effectivePrice.value)),m){v.compare_price=St(r.cmp);let T=r.cmp-r.d;v.discount_percent=(T/r.cmp*100).toFixed(0),v.discount_price=St(T)}let y={name:e.name,quantity:e.quantity};return{product:v,variant:y}}};var Xa=class{id;alt;sources;items;durationMS;thumbnail;card;constructor(e={}){this.id=e.id,this.alt=e.alt,this.sources=e.sources?.sort((r,n)=>n.height-r.height),this.durationMS=e.durationMS,this.thumbnail=e.thumbnail,this.items=e.items?e.items.map(r=>new gt(r)):[],this.card=e.card}};var Ja=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(e={}){this.videos=e.videos?.map(r=>new Xa(r))??[],this.source=e.source,this.template=e.template,this.detailPopup=e.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=e.heading,this.showMuteButton=e.showMuteButton,this.slidePerViewCount=e.slidePerViewCount??4,this.autoPlay=e.autoPlay??"ON",this.footerContent=e.footerContent??"FIRST_ITEM"}};var ES=Object.prototype.toString,Ti=Array.isArray||function(e){return ES.call(e)==="[object Array]"};function Lp(t){return typeof t=="function"}function _S(t){return Ti(t)?"array":typeof t}function Pp(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Dh(t,e){return t!=null&&typeof t=="object"&&e in t}function SS(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var bS=RegExp.prototype.test;function wS(t,e){return bS.call(t,e)}var IS=/\S/;function TS(t){return!wS(IS,t)}var CS={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function xS(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return CS[r]})}var RS=/\s*/,AS=/\s+/,Nh=/\s*=/,DS=/\s*\}/,NS=/#|\^|\/|>|\{|&|=|!/;function OS(t,e){if(!t)return[];var r=!1,n=[],i=[],o=[],s=!1,a=!1,c="",p=0;function f(){if(s&&!a)for(;o.length;)delete i[o.pop()];else o=[];s=!1,a=!1}var m,v,y;function T(Q){if(typeof Q=="string"&&(Q=Q.split(AS,2)),!Ti(Q)||Q.length!==2)throw new Error("Invalid tags: "+Q);m=new RegExp(Pp(Q[0])+"\\s*"),v=new RegExp("\\s*"+Pp(Q[1])),y=new RegExp("\\s*"+Pp("}"+Q[1]))}T(e||qt.tags);for(var R=new Yo(t),A,N,B,P,q,de;!R.eos();){if(A=R.pos,B=R.scanUntil(m),B)for(var W=0,re=B.length;W<re;++W)P=B.charAt(W),TS(P)?(o.push(i.length),c+=P):(a=!0,r=!0,c+=" "),i.push(["text",P,A,A+1]),A+=1,P===`
|
|
31
|
-
`&&(f(),c="",p=0,r=!1);if(!R.scan(m))break;if(s=!0,N=R.scan(NS)||"name",R.scan(RS),N==="="?(B=R.scanUntil(Nh),R.scan(Nh),R.scanUntil(v)):N==="{"?(B=R.scanUntil(y),R.scan(DS),R.scanUntil(v),N="&"):B=R.scanUntil(v),!R.scan(v))throw new Error("Unclosed tag at "+R.pos);if(N==">"?q=[N,B,A,R.pos,c,p,r]:q=[N,B,A,R.pos],p++,i.push(q),N==="#"||N==="^")n.push(q);else if(N==="/"){if(de=n.pop(),!de)throw new Error('Unopened section "'+B+'" at '+A);if(de[1]!==B)throw new Error('Unclosed section "'+de[1]+'" at '+A)}else N==="name"||N==="{"||N==="&"?a=!0:N==="="&&T(B)}if(f(),de=n.pop(),de)throw new Error('Unclosed section "'+de[1]+'" at '+R.pos);return LS(PS(i))}function PS(t){for(var e=[],r,n,i=0,o=t.length;i<o;++i)r=t[i],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(e.push(r),n=r));return e}function LS(t){for(var e=[],r=e,n=[],i,o,s=0,a=t.length;s<a;++s)switch(i=t[s],i[0]){case"#":case"^":r.push(i),n.push(i),r=i[4]=[];break;case"/":o=n.pop(),o[5]=i[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(i)}return e}function Yo(t){this.string=t,this.tail=t,this.pos=0}Yo.prototype.eos=function(){return this.tail===""};Yo.prototype.scan=function(e){var r=this.tail.match(e);if(!r||r.index!==0)return"";var n=r[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};Yo.prototype.scanUntil=function(e){var r=this.tail.search(e),n;switch(r){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=n.length,n};function Ii(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Ii.prototype.push=function(e){return new Ii(e,this)};Ii.prototype.lookup=function(e){var r=this.cache,n;if(r.hasOwnProperty(e))n=r[e];else{for(var i=this,o,s,a,c=!1;i;){if(e.indexOf(".")>0)for(o=i.view,s=e.split("."),a=0;o!=null&&a<s.length;)a===s.length-1&&(c=Dh(o,s[a])||SS(o,s[a])),o=o[s[a++]];else o=i.view[e],c=Dh(i.view,e);if(c){n=o;break}i=i.parent}r[e]=n}return Lp(n)&&(n=n.call(this.view)),n};function bt(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}bt.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};bt.prototype.parse=function(e,r){var n=this.templateCache,i=e+":"+(r||qt.tags).join(":"),o=typeof n<"u",s=o?n.get(i):void 0;return s==null&&(s=OS(e,r),o&&n.set(i,s)),s};bt.prototype.render=function(e,r,n,i){var o=this.getConfigTags(i),s=this.parse(e,o),a=r instanceof Ii?r:new Ii(r,void 0);return this.renderTokens(s,a,n,e,i)};bt.prototype.renderTokens=function(e,r,n,i,o){for(var s="",a,c,p,f=0,m=e.length;f<m;++f)p=void 0,a=e[f],c=a[0],c==="#"?p=this.renderSection(a,r,n,i,o):c==="^"?p=this.renderInverted(a,r,n,i,o):c===">"?p=this.renderPartial(a,r,n,o):c==="&"?p=this.unescapedValue(a,r):c==="name"?p=this.escapedValue(a,r,o):c==="text"&&(p=this.rawValue(a)),p!==void 0&&(s+=p);return s};bt.prototype.renderSection=function(e,r,n,i,o){var s=this,a="",c=r.lookup(e[1]);function p(v){return s.render(v,r,n,o)}if(c){if(Ti(c))for(var f=0,m=c.length;f<m;++f)a+=this.renderTokens(e[4],r.push(c[f]),n,i,o);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")a+=this.renderTokens(e[4],r.push(c),n,i,o);else if(Lp(c)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(r.view,i.slice(e[3],e[5]),p),c!=null&&(a+=c)}else a+=this.renderTokens(e[4],r,n,i,o);return a}};bt.prototype.renderInverted=function(e,r,n,i,o){var s=r.lookup(e[1]);if(!s||Ti(s)&&s.length===0)return this.renderTokens(e[4],r,n,i,o)};bt.prototype.indentPartial=function(e,r,n){for(var i=r.replace(/[^ \t]/g,""),o=e.split(`
|
|
32
|
-
`),s=0;s<o.length;s++)o[s].length&&(s>0||!n)&&(o[s]=i+o[s]);return o.join(`
|
|
33
|
-
`)};bt.prototype.renderPartial=function(e,r,n,i){if(n){var o=this.getConfigTags(i),s=Lp(n)?n(e[1]):n[e[1]];if(s!=null){var a=e[6],c=e[5],p=e[4],f=s;c==0&&p&&(f=this.indentPartial(s,p,a));var m=this.parse(f,o);return this.renderTokens(m,r,n,f,i)}}};bt.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};bt.prototype.escapedValue=function(e,r,n){var i=this.getConfigEscape(n)||qt.escape,o=r.lookup(e[1]);if(o!=null)return typeof o=="number"&&i===qt.escape?String(o):i(o)};bt.prototype.rawValue=function(e){return e[1]};bt.prototype.getConfigTags=function(e){return Ti(e)?e:e&&typeof e=="object"?e.tags:void 0};bt.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Ti(e))return e.escape};var qt={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Go.templateCache=t},get templateCache(){return Go.templateCache}},Go=new bt;qt.clearCache=function(){return Go.clearCache()};qt.parse=function(e,r){return Go.parse(e,r)};qt.render=function(e,r,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+_S(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Go.render(e,r,n,i)};qt.escape=xS;qt.Scanner=Yo;qt.Context=Ii;qt.Writer=bt;var Mp=qt;Mp.escape=BS;var MS={'"':""","\\":"\","\n":"<br>"};function BS(t){return String(t).replace(/["\\\n]/g,e=>MS[e])}var Ci=(t,e)=>Mp.render(t,e),Mn=(t,e)=>{let r=JSON.stringify(t),n=Ci(r,e);try{return JSON.parse(n)}catch(i){throw La.getInstance().captureError(i,"variable-replacement",{extra:{before:t,after:n}}),i}};var US="?from=cooee";function zo(){return!!window.Shopify}function Oh(){if(zo())return window.Shopify.shop?.split(".")?.[0]}function Ph(t){let n=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function xi(){return window.Shopify?.routes?.root??"/"}function Bn(t){return xi()+t+US}var Qa=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e()}else this.isLocked=!1}},Za=class t{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){if(e=`__cooee_${e}_lock__`,"locks"in navigator&&!this.isInAppBrowser())return navigator.locks.request(e,r);let n=!1,i=0,o=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(b.debug(`Lock retry ${i}`),n=await this.acquire(e,o),!n);)await this.sleep(t.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,o)}}static isInAppBrowser(){let e=navigator.userAgent||"",r=/iPhone|iPad|iPod/i.test(e),n=/(FBAV|FBAN|Instagram)/i.test(e);return r&&n}static async acquire(e,r){let n=Date.now(),i=localStorage.getItem(e),o=i?JSON.parse(i):null;if(o&&n<=o.expiry)return!1;let s={owner:r,expiry:n+t.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(s)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(b.debug(`${r}: Lock acquired!`),!0):(b.debug(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(e,r){let n=localStorage.getItem(e);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(e),b.debug(`${r}: Lock released`)):b.debug(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}};var se=class t{static CURRENT;token;items;total_price;original_total_price;items_subtotal_price;currency;item_count;attributes;cart_level_discount_applications;total_discount;lock=new Qa;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Te.set(ne.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await it.get(ne.ID),r=await Te.get(ne.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){b.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};b.debug("Updating Shopify cart with attributes:",n);let i=Bn("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();b.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.total_discount=e.total_discount,ce.get().currencyCode=this.currency,b.log("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,itemsSubtotalPrice:this.items_subtotal_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return b.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){b.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},o=n.selling_plan_allocation?.selling_plan;if(!o){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){b.debug("Not fetching cart");return}b.debug("Fetching cart");let r=Bn("cart.js"),n=await(await fetch(r)).json();this.update(n)}};var ec=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL}};var Bp=class{enabled;constructor(e){this.enabled=e.enabled}},Up=class extends Bp{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},tc=class{productQuantity;constructor(e){e??={},this.productQuantity=new Up(e.productQuantity)}};var Pt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new wn(e.bg)),e.br&&(this.br=new Pr(e.br)),e.shd&&(this.shd=new To(e.shd)),e.spc&&(this.spc=new Lr(e.spc)),this.trf=new In(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return ke[this.t]}get click(){return this.clc}},ke=(P=>(P[P.IMAGE=1]="IMAGE",P[P.TEXT=2]="TEXT",P[P.BUTTON=3]="BUTTON",P[P.FLEXBOX=4]="FLEXBOX",P[P.MULTI_COLUMN=5]="MULTI_COLUMN",P[P.CHECKBOX=6]="CHECKBOX",P[P.PRODUCTS=11]="PRODUCTS",P[P.PRODUCT=12]="PRODUCT",P[P.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",P[P.PRODUCT_TITLE=14]="PRODUCT_TITLE",P[P.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",P[P.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",P[P.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",P[P.PRODUCT_RATING=19]="PRODUCT_RATING",P[P.EMAIL_INPUT=51]="EMAIL_INPUT",P[P.PHONE_INPUT=52]="PHONE_INPUT",P[P.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",P[P.CAROUSEL=62]="CAROUSEL",P[P.SHAPE=100]="SHAPE",P))(ke||{});var Un=class extends Pt{constructor(e){super(e)}};var Vr=class extends Pt{src;constructor(e){super(e),this.src=e.src}};var Sr=class extends Pt{typo;constructor(e){super(e);let r=S(S({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new ze(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var rn=class extends Sr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var rc=class extends Pt{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var Ri=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0}start(e,r){let n=new Date;e===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let a=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),p=Math.floor(s%(1e3*60*60)/(1e3*60)),f=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:c,minutes:p,seconds:f})},1e3);return i}};var Ai=class extends Sr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new Ri(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var nc=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new Be(e.c??{})}get text(){return this.txt}get color(){return this.c}};var nn=class extends Sr{ph;constructor(e){super(e),this.ph=new nc(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var Di=class extends nn{constructor(e){e??={},super(e)}};var Ni=class extends nn{};var Oi=class extends nn{};var Pi=class extends Vr{};var kn=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(kn||{});var ic=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}};var qo=class extends Pt{gvt;max;cover;anim;embedded;position;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new ic(e.anim),this.embedded=e.embedded,this.position=e.position??1,this.spc||(this.spc=new Lr({pl:D.IN_APP_DEFAULT_PADDING,pr:D.IN_APP_DEFAULT_PADDING,pt:D.IN_APP_DEFAULT_PADDING,pb:D.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}};var oc=class extends qo{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new rc(e.cont),this.mob=new qo(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new Vr(r)):r.t===2?this.elems.push(new rn(r)):r.t===3?this.elems.push(new rn(r)):r.t===100?this.elems.push(new Un(r)):r.t===51?this.elems.push(new Ni(r)):r.t===52?this.elems.push(new Oi(r)):r.t===61?this.elems.push(new Ai(r)):r.t===15||r.t===16?this.elems.push(new Di(r)):r.t===13&&this.elems.push(new Pi(r))})}getStylesForWrapper(){if(this.cover)return{};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:"50%",left:0,transform:"translateY(-50%)"}:e={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},e.overflow="visible",e}getFlexStylesForContainer(){let e={display:"flex",flexDirection:"row"},r,n;return this.gvt===1?(r="flex-start",n="flex-start"):this.gvt===2?(r="center",n="flex-start"):this.gvt===3?(r="flex-end",n="flex-start"):this.gvt===4?(r="flex-start",n="center"):this.gvt===6?(r="flex-end",n="center"):this.gvt===7?(r="flex-start",n="flex-end"):this.gvt===8?(r="center",n="flex-end"):this.gvt===9?(r="flex-end",n="flex-end"):(r="center",n="center"),e.alignItems=n,e.justifyContent=r,e.overflow="visible",e}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}};var Li=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??"row",this.wrap=e.wrap??"nowrap",this.jc=e.jc??"flex-start",this.ai=e.ai??"flex-start",this.scroll=e.scroll}};var sc=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex}};var ac=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??"100%",this.h=e.h??"auto",this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH}};var cc=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Lr(e.spc),e.size&&(this.size=new ac(e.size)),e.bg&&(this.bg=new wn(e.bg)),e.br&&(this.br=new Pr(e.br)),e.typo&&(this.typo=new ze(e.typo)),e.lout&&(this.lout=new sc(e.lout)),e.flex&&(this.flex=new Li(e.flex))}},Mi=class{sm;lg;constructor(e){e??={},this.sm=new cc(e.sm),this.lg=new cc(e.lg)}};var ot=class{t;style;hide;when;clc;l;constructor(e,r){r??={},this.t=e,this.style=new Mi(r.style),this.hide=r.hide,this.l=r.l,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return ke[this.t]}};var st=class extends ot{text;constructor(e,r){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(r??2,e),e??={},this.text=e.text}};var Fn=class extends st{constructor(e,r){super(e,r??3)}};var Bi=class extends ot{value;constructor(e){super(6,e),e??={},this.value=e.value}};var Ui=class extends st{showChips;optionsConfig;constructor(e=15,r){super(r,e),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var lc=class extends ot{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new Be(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var Lh=ur(bn());var kp=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new Be(e.color)}},Fp=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new Be(e.color)}},Ko=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(e){e??={},this.navigation=new Fp(e.navigation),this.pagination=new kp(e.pagination),this.autoplay=e.autoplay,this.slidesPerView=e.slidesPerView??1,this.maxInRow=e.maxInRow??e.slidesPerView??4,this.gap=e.gap??0}},uc=class extends ot{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=Lt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new Ko(e.conf),this.allowedTypes=e.allowedTypes}};var pc=class extends st{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new Ri(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var on=class extends ot{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=Lt.getParsedElement(r);n&&this.elems.push(n)})}};var Hn=class extends ot{src;sm;lg;constructor(e,r){super(r??1,e),e&&this.update(e)}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg}};var Lt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=t.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new st(e);case 3:return new Fn(e);case 6:return new Bi(e);case 11:return new fc(e);case 12:return new sn(e);case 61:return new pc(e);case 4:return new on(e);case 1:return new Hn(e);case 13:return new Hn(e,13);case 14:return new st(e,14);case 15:case 16:return new Ui(e.t,e);case 18:return new Fn(e,18);case 62:return new uc(e);case 19:return new lc(e);default:Lh.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}};var sn=class extends ot{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=Lt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new Bi(e.cBox)),this.elems.push(new Hn(e.img,13));let r=new st(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new st(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let i=new st(e.compareAt);i.text="{{ product.compare_price }}",i.hide=!e.show?.price,e.compareAt||(i.style=new Mi(n.style),i.style.lg.typo=new ze(Z(S({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new ze(Z(S({},i.style.sm.typo),{td:"line-through"})));let o=new on({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Lt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new Ui(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new Fn(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new st(e.symbol))}};var fc=class extends ot{conf;prod;constructor(e){super(11,e),e??={},this.conf=new Hp(e.conf),this.prod=new sn(e.prod)}};var mc=class extends Ko{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},Hp=class{lg;sm;constructor(e){e??={},this.lg=new mc(e.lg),this.sm=new mc(e.sm)}};var dc=class extends on{constructor(e){super(e)}};var ki=class{cont;elems=[];constructor(e){e=e??{},this.cont=new dc(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=Lt.getParsedElement(e);return r&&this.elems.push(r),r}};function hc(t,e){return kS(t,e,0,5)}function kS(t,e,r=0,n=50){if(e){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let i of e){if(i.t===t)return i;let o="elems"in i?i.elems:[];if(o?.length>0){let s=hc(t,o);if(s)return s}}}}var Vp=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===So.EXCLUSION}isABTesting(){return this.contentType===So.ABTESTING}isSingleContent(){return this.contentType===So.SINGLE}},Xo=class{videoConfig;savingsBarConfig;constructor(e){this.update(e)}update(e){e??={},e.videoConfig&&(this.videoConfig=new Ja(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new qs(e.savingsBarConfig))}},pt=class extends Vp{contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;entryAnimation;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=zt({});constructor(e){super(e),this.id=e.id,this.currency=ce.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new ki(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??"NONE",this.embeddedItems=e.embeddedItems?.map(r=>new ht(r)),this.items=e.items?.map(r=>new gt(r))??[],this.nonMutableItems=e.items?.map(r=>new gt(r))??[],this.collections=e.collections?.map(r=>new ec(r))??[],this.discount=e.discount,this.placement=e.placement,this.customerData=e.customerData,this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new tc(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new Gs(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new zs(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new $s(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new gt(e.bundleFrom)),e.content&&(this.content=new Xo(e.content))}shouldDelay(){return this.delay>0}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===tr.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Vs.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Vs.PAGE_EMBED}isProgressBar(){return this.objective===tr.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===tr.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===tr.CART_RECOVERY}isProductPromotion(){return this.objective===tr.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===Fl.COLLECTION}isBYOB(){return this.objective===tr.BYOB}isStickyATC(){return this.objective===tr.STICKY_ATC}isShoppableVideo(){return this.objective===tr.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===tr.SAVINGS_BAR}processPopup(e){let r=this.items[0],n={},i={};if(r){let a=r.selectedOrFirstVariant.value;n={name:r.name,id:r.mID,link:r.link,vID:a.mID,image:r.variantImage,price:St(a.price.d),comparePrice:St(a.price.cmp),quantity:r.quantity},i={quantity:a.quantity}}let o={productCount:se.getCurrent().item_count},s=Ci(JSON.stringify(e),{product:n,variant:i,cart:o,discount:this.discount,customer:this.customerData});return r&&(s=s.replace(new RegExp(D.PLACEHOLDER_IMAGE,"gi"),r.variantImage??r.firstImageURL)),new oc(JSON.parse(s))}calculateDiscountData(e,r){let n=Or.sum(e,s=>s.selectedOrFirstVariant.value.price.d),i=Or.sum(e,s=>{let a=s.selectedOrFirstVariant.value.price;return a.cmp??a.d}),o={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(o);return}if(Ht.BXGY===this.discount.type&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,o.discountPercentage,!0),o.discountAmount=o.actualPrice-Or.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([Ht.UNIQUE_FLAT_ITEMS,Ht.STATIC,Ht.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===Ht.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)o.discountAmount=o.actualPrice-this.discount.values[0],o.discountPercentage=o.discountAmount/o.actualPrice*100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===Ht.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,c)=>c.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,o.discountAmount=s.selectedOrFirstVariant.value.price.d,o.discountPercentage=o.discountAmount/o.actualPrice*100}o.discountedPrice=o.actualPrice-o.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(o)}getPrivateAttributesForLineItem(){return Me.get().skipItemAttribute?{}:{[D.VIA]:"Cooee",[D.CAMPAIGN_ATTRIBUTE]:this.shortID,[D.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Me.get().skipItemAttribute?[]:[{key:D.VIA,value:"Cooee"},{key:D.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:D.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){if(hc(62,this.widget?.elems))return!0;let r=hc(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){return`Engagement(id=${this.shortID})`}getCartMagicVariables(){let e=se.getCurrent(),r=Or.sum(e.items,n=>n.discounts?.reduce((i,o)=>i+(o.amount??0),0)??0);return{productCount:e.item_count,product_count:e.item_count,amount:St(e.total_price/100),originalAmount:St(e.original_total_price/100),total_line_items_discount:St(r/100),total_discount:St(e.total_discount/100)}}updateEffectivePrice(e,r,n=!1){let i=ce.get().getCurrentItem();e.forEach(o=>{let s=o.selectedOrFirstVariant.value,a=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=a.d;else{let c=a.d*r/100;s.effectivePrice.value=a.d-c}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:Kd(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{r[n]=St(e[n])}),r}};function HS(t,e){return e={exports:{}},t(e,e.exports),e.exports}var VS=GS,$S=zS,WS=XS,wr=[],Xt=[],jS=typeof Uint8Array<"u"?Uint8Array:Array,$p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Vn=0,Mh=$p.length;Vn<Mh;++Vn)wr[Vn]=$p[Vn],Xt[$p.charCodeAt(Vn)]=Vn;var Vn,Mh;Xt[45]=62;Xt[95]=63;function Jh(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function GS(t){var e=Jh(t),r=e[0],n=e[1];return(r+n)*3/4-n}function YS(t,e,r){return(e+r)*3/4-r}function zS(t){var e,r=Jh(t),n=r[0],i=r[1],o=new jS(YS(t,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=Xt[t.charCodeAt(c)]<<18|Xt[t.charCodeAt(c+1)]<<12|Xt[t.charCodeAt(c+2)]<<6|Xt[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=Xt[t.charCodeAt(c)]<<2|Xt[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=Xt[t.charCodeAt(c)]<<10|Xt[t.charCodeAt(c+1)]<<4|Xt[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function qS(t){return wr[t>>18&63]+wr[t>>12&63]+wr[t>>6&63]+wr[t&63]}function KS(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(qS(n));return i.join("")}function XS(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(KS(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(wr[e>>2]+wr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(wr[e>>10]+wr[e>>4&63]+wr[e<<2&63]+"=")),i.join("")}var Wp={byteLength:VS,toByteArray:$S,fromByteArray:WS};var JS=function(e,r,n,i,o){var s,a,c=o*8-i-1,p=(1<<c)-1,f=p>>1,m=-7,v=n?o-1:0,y=n?-1:1,T=e[r+v];for(v+=y,s=T&(1<<-m)-1,T>>=-m,m+=c;m>0;s=s*256+e[r+v],v+=y,m-=8);for(a=s&(1<<-m)-1,s>>=-m,m+=i;m>0;a=a*256+e[r+v],v+=y,m-=8);if(s===0)s=1-f;else{if(s===p)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-f}return(T?-1:1)*a*Math.pow(2,s-i)},QS=function(e,r,n,i,o,s){var a,c,p,f=s*8-o-1,m=(1<<f)-1,v=m>>1,y=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:s-1,R=i?1:-1,A=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=m):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+v>=1?r+=y/p:r+=y*Math.pow(2,1-v),r*p>=2&&(a++,p/=2),a+v>=m?(c=0,a=m):a+v>=1?(c=(r*p-1)*Math.pow(2,o),a=a+v):(c=r*Math.pow(2,v-1)*Math.pow(2,o),a=0));o>=8;e[n+T]=c&255,T+=R,c/=256,o-=8);for(a=a<<o|c,f+=o;f>0;e[n+T]=a&255,T+=R,a/=256,f-=8);e[n+T-R]|=A*128},Fi={read:JS,write:QS},vc=HS(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=N,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.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 i(){try{var h=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(h,l),h.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(h){if(h>n)throw new RangeError('The value "'+h+'" is invalid for option "size"');var l=new Uint8Array(h);return Object.setPrototypeOf(l,s.prototype),l}function s(h,l,u){if(typeof h=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(h)}return a(h,l,u)}s.poolSize=8192;function a(h,l,u){if(typeof h=="string")return m(h,l);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h));if(kt(h,ArrayBuffer)||h&&kt(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(kt(h,SharedArrayBuffer)||h&&kt(h.buffer,SharedArrayBuffer)))return T(h,l,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var E=h.valueOf&&h.valueOf();if(E!=null&&E!==h)return s.from(E,l,u);var x=R(h);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return s.from(h[Symbol.toPrimitive]("string"),l,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h))}s.from=function(h,l,u){return a(h,l,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function p(h,l,u){return c(h),h<=0?o(h):l!==void 0?typeof u=="string"?o(h).fill(l,u):o(h).fill(l):o(h)}s.alloc=function(h,l,u){return p(h,l,u)};function f(h){return c(h),o(h<0?0:A(h)|0)}s.allocUnsafe=function(h){return f(h)},s.allocUnsafeSlow=function(h){return f(h)};function m(h,l){if((typeof l!="string"||l==="")&&(l="utf8"),!s.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var u=B(h,l)|0,E=o(u),x=E.write(h,l);return x!==u&&(E=E.slice(0,x)),E}function v(h){for(var l=h.length<0?0:A(h.length)|0,u=o(l),E=0;E<l;E+=1)u[E]=h[E]&255;return u}function y(h){if(kt(h,Uint8Array)){var l=new Uint8Array(h);return T(l.buffer,l.byteOffset,l.byteLength)}return v(h)}function T(h,l,u){if(l<0||h.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<l+(u||0))throw new RangeError('"length" is outside of buffer bounds');var E;return l===void 0&&u===void 0?E=new Uint8Array(h):u===void 0?E=new Uint8Array(h,l):E=new Uint8Array(h,l,u),Object.setPrototypeOf(E,s.prototype),E}function R(h){if(s.isBuffer(h)){var l=A(h.length)|0,u=o(l);return u.length===0||h.copy(u,0,0,l),u}if(h.length!==void 0)return typeof h.length!="number"||ho(h.length)?o(0):v(h);if(h.type==="Buffer"&&Array.isArray(h.data))return v(h.data)}function A(h){if(h>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return h|0}function N(h){return+h!=h&&(h=0),s.alloc(+h)}s.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==s.prototype},s.compare=function(l,u){if(kt(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),kt(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(l)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===u)return 0;for(var E=l.length,x=u.length,F=0,$=Math.min(E,x);F<$;++F)if(l[F]!==u[F]){E=l[F],x=u[F];break}return E<x?-1:x<E?1:0},s.isEncoding=function(l){switch(String(l).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}},s.concat=function(l,u){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return s.alloc(0);var E;if(u===void 0)for(u=0,E=0;E<l.length;++E)u+=l[E].length;var x=s.allocUnsafe(u),F=0;for(E=0;E<l.length;++E){var $=l[E];if(kt($,Uint8Array))F+$.length>x.length?s.from($).copy(x,F):Uint8Array.prototype.set.call(x,$,F);else if(s.isBuffer($))$.copy(x,F);else throw new TypeError('"list" argument must be an Array of Buffers');F+=$.length}return x};function B(h,l){if(s.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||kt(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(h));var u=h.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&u===0)return 0;for(var x=!1;;)switch(l){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return mo(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return Bs(h).length;default:if(x)return E?-1:mo(h).length;l=(""+l).toLowerCase(),x=!0}}s.byteLength=B;function P(h,l,u){var E=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,l>>>=0,u<=l))return"";for(h||(h="utf8");;)switch(h){case"hex":return nt(this,l,u);case"utf8":case"utf-8":return Ge(this,l,u);case"ascii":return er(this,l,u);case"latin1":case"binary":return Ne(this,l,u);case"base64":return Pe(this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return he(this,l,u);default:if(E)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),E=!0}}s.prototype._isBuffer=!0;function q(h,l,u){var E=h[l];h[l]=h[u],h[u]=E}s.prototype.swap16=function(){var l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<l;u+=2)q(this,u,u+1);return this},s.prototype.swap32=function(){var l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<l;u+=4)q(this,u,u+3),q(this,u+1,u+2);return this},s.prototype.swap64=function(){var l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<l;u+=8)q(this,u,u+7),q(this,u+1,u+6),q(this,u+2,u+5),q(this,u+3,u+4);return this},s.prototype.toString=function(){var l=this.length;return l===0?"":arguments.length===0?Ge(this,0,l):P.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(l){if(!s.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:s.compare(this,l)===0},s.prototype.inspect=function(){var l="",u=e.INSPECT_MAX_BYTES;return l=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(l+=" ... "),"<Buffer "+l+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(l,u,E,x,F){if(kt(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),!s.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(l));if(u===void 0&&(u=0),E===void 0&&(E=l?l.length:0),x===void 0&&(x=0),F===void 0&&(F=this.length),u<0||E>l.length||x<0||F>this.length)throw new RangeError("out of range index");if(x>=F&&u>=E)return 0;if(x>=F)return-1;if(u>=E)return 1;if(u>>>=0,E>>>=0,x>>>=0,F>>>=0,this===l)return 0;for(var $=F-x,me=E-u,_e=Math.min($,me),Ae=this.slice(x,F),Ye=l.slice(u,E),Le=0;Le<_e;++Le)if(Ae[Le]!==Ye[Le]){$=Ae[Le],me=Ye[Le];break}return $<me?-1:me<$?1:0};function de(h,l,u,E,x){if(h.length===0)return-1;if(typeof u=="string"?(E=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,ho(u)&&(u=x?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(x)return-1;u=h.length-1}else if(u<0)if(x)u=0;else return-1;if(typeof l=="string"&&(l=s.from(l,E)),s.isBuffer(l))return l.length===0?-1:W(h,l,u,E,x);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(h,l,u):Uint8Array.prototype.lastIndexOf.call(h,l,u):W(h,[l],u,E,x);throw new TypeError("val must be string, number or Buffer")}function W(h,l,u,E,x){var F=1,$=h.length,me=l.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(h.length<2||l.length<2)return-1;F=2,$/=2,me/=2,u/=2}function _e(go,yo){return F===1?go[yo]:go.readUInt16BE(yo*F)}var Ae;if(x){var Ye=-1;for(Ae=u;Ae<$;Ae++)if(_e(h,Ae)===_e(l,Ye===-1?0:Ae-Ye)){if(Ye===-1&&(Ye=Ae),Ae-Ye+1===me)return Ye*F}else Ye!==-1&&(Ae-=Ae-Ye),Ye=-1}else for(u+me>$&&(u=$-me),Ae=u;Ae>=0;Ae--){for(var Le=!0,Sn=0;Sn<me;Sn++)if(_e(h,Ae+Sn)!==_e(l,Sn)){Le=!1;break}if(Le)return Ae}return-1}s.prototype.includes=function(l,u,E){return this.indexOf(l,u,E)!==-1},s.prototype.indexOf=function(l,u,E){return de(this,l,u,E,!0)},s.prototype.lastIndexOf=function(l,u,E){return de(this,l,u,E,!1)};function re(h,l,u,E){u=Number(u)||0;var x=h.length-u;E?(E=Number(E),E>x&&(E=x)):E=x;var F=l.length;E>F/2&&(E=F/2);for(var $=0;$<E;++$){var me=parseInt(l.substr($*2,2),16);if(ho(me))return $;h[u+$]=me}return $}function Q(h,l,u,E){return ii(mo(l,h.length-u),h,u,E)}function ae(h,l,u,E){return ii(xl(l),h,u,E)}function Oe(h,l,u,E){return ii(Bs(l),h,u,E)}function we(h,l,u,E){return ii(Rl(l,h.length-u),h,u,E)}s.prototype.write=function(l,u,E,x){if(u===void 0)x="utf8",E=this.length,u=0;else if(E===void 0&&typeof u=="string")x=u,E=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(E)?(E=E>>>0,x===void 0&&(x="utf8")):(x=E,E=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var F=this.length-u;if((E===void 0||E>F)&&(E=F),l.length>0&&(E<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");for(var $=!1;;)switch(x){case"hex":return re(this,l,u,E);case"utf8":case"utf-8":return Q(this,l,u,E);case"ascii":case"latin1":case"binary":return ae(this,l,u,E);case"base64":return Oe(this,l,u,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return we(this,l,u,E);default:if($)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),$=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pe(h,l,u){return l===0&&u===h.length?Wp.fromByteArray(h):Wp.fromByteArray(h.slice(l,u))}function Ge(h,l,u){u=Math.min(h.length,u);for(var E=[],x=l;x<u;){var F=h[x],$=null,me=F>239?4:F>223?3:F>191?2:1;if(x+me<=u){var _e,Ae,Ye,Le;switch(me){case 1:F<128&&($=F);break;case 2:_e=h[x+1],(_e&192)===128&&(Le=(F&31)<<6|_e&63,Le>127&&($=Le));break;case 3:_e=h[x+1],Ae=h[x+2],(_e&192)===128&&(Ae&192)===128&&(Le=(F&15)<<12|(_e&63)<<6|Ae&63,Le>2047&&(Le<55296||Le>57343)&&($=Le));break;case 4:_e=h[x+1],Ae=h[x+2],Ye=h[x+3],(_e&192)===128&&(Ae&192)===128&&(Ye&192)===128&&(Le=(F&15)<<18|(_e&63)<<12|(Ae&63)<<6|Ye&63,Le>65535&&Le<1114112&&($=Le))}}$===null?($=65533,me=1):$>65535&&($-=65536,E.push($>>>10&1023|55296),$=56320|$&1023),E.push($),x+=me}return lr(E)}var rt=4096;function lr(h){var l=h.length;if(l<=rt)return String.fromCharCode.apply(String,h);for(var u="",E=0;E<l;)u+=String.fromCharCode.apply(String,h.slice(E,E+=rt));return u}function er(h,l,u){var E="";u=Math.min(h.length,u);for(var x=l;x<u;++x)E+=String.fromCharCode(h[x]&127);return E}function Ne(h,l,u){var E="";u=Math.min(h.length,u);for(var x=l;x<u;++x)E+=String.fromCharCode(h[x]);return E}function nt(h,l,u){var E=h.length;(!l||l<0)&&(l=0),(!u||u<0||u>E)&&(u=E);for(var x="",F=l;F<u;++F)x+=Al[h[F]];return x}function he(h,l,u){for(var E=h.slice(l,u),x="",F=0;F<E.length-1;F+=2)x+=String.fromCharCode(E[F]+E[F+1]*256);return x}s.prototype.slice=function(l,u){var E=this.length;l=~~l,u=u===void 0?E:~~u,l<0?(l+=E,l<0&&(l=0)):l>E&&(l=E),u<0?(u+=E,u<0&&(u=0)):u>E&&(u=E),u<l&&(u=l);var x=this.subarray(l,u);return Object.setPrototypeOf(x,s.prototype),x};function ue(h,l,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+l>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(l,u,E){l=l>>>0,u=u>>>0,E||ue(l,u,this.length);for(var x=this[l],F=1,$=0;++$<u&&(F*=256);)x+=this[l+$]*F;return x},s.prototype.readUintBE=s.prototype.readUIntBE=function(l,u,E){l=l>>>0,u=u>>>0,E||ue(l,u,this.length);for(var x=this[l+--u],F=1;u>0&&(F*=256);)x+=this[l+--u]*F;return x},s.prototype.readUint8=s.prototype.readUInt8=function(l,u){return l=l>>>0,u||ue(l,1,this.length),this[l]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(l,u){return l=l>>>0,u||ue(l,2,this.length),this[l]|this[l+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(l,u){return l=l>>>0,u||ue(l,2,this.length),this[l]<<8|this[l+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(l,u){return l=l>>>0,u||ue(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(l,u){return l=l>>>0,u||ue(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},s.prototype.readIntLE=function(l,u,E){l=l>>>0,u=u>>>0,E||ue(l,u,this.length);for(var x=this[l],F=1,$=0;++$<u&&(F*=256);)x+=this[l+$]*F;return F*=128,x>=F&&(x-=Math.pow(2,8*u)),x},s.prototype.readIntBE=function(l,u,E){l=l>>>0,u=u>>>0,E||ue(l,u,this.length);for(var x=u,F=1,$=this[l+--x];x>0&&(F*=256);)$+=this[l+--x]*F;return F*=128,$>=F&&($-=Math.pow(2,8*u)),$},s.prototype.readInt8=function(l,u){return l=l>>>0,u||ue(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},s.prototype.readInt16LE=function(l,u){l=l>>>0,u||ue(l,2,this.length);var E=this[l]|this[l+1]<<8;return E&32768?E|4294901760:E},s.prototype.readInt16BE=function(l,u){l=l>>>0,u||ue(l,2,this.length);var E=this[l+1]|this[l]<<8;return E&32768?E|4294901760:E},s.prototype.readInt32LE=function(l,u){return l=l>>>0,u||ue(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},s.prototype.readInt32BE=function(l,u){return l=l>>>0,u||ue(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},s.prototype.readFloatLE=function(l,u){return l=l>>>0,u||ue(l,4,this.length),Fi.read(this,l,!0,23,4)},s.prototype.readFloatBE=function(l,u){return l=l>>>0,u||ue(l,4,this.length),Fi.read(this,l,!1,23,4)},s.prototype.readDoubleLE=function(l,u){return l=l>>>0,u||ue(l,8,this.length),Fi.read(this,l,!0,52,8)},s.prototype.readDoubleBE=function(l,u){return l=l>>>0,u||ue(l,8,this.length),Fi.read(this,l,!1,52,8)};function dt(h,l,u,E,x,F){if(!s.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>x||l<F)throw new RangeError('"value" argument is out of bounds');if(u+E>h.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(l,u,E,x){if(l=+l,u=u>>>0,E=E>>>0,!x){var F=Math.pow(2,8*E)-1;dt(this,l,u,E,F,0)}var $=1,me=0;for(this[u]=l&255;++me<E&&($*=256);)this[u+me]=l/$&255;return u+E},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(l,u,E,x){if(l=+l,u=u>>>0,E=E>>>0,!x){var F=Math.pow(2,8*E)-1;dt(this,l,u,E,F,0)}var $=E-1,me=1;for(this[u+$]=l&255;--$>=0&&(me*=256);)this[u+$]=l/me&255;return u+E},s.prototype.writeUint8=s.prototype.writeUInt8=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,1,255,0),this[u]=l&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,2,65535,0),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,2,65535,0),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,4,4294967295,0),this[u+3]=l>>>24,this[u+2]=l>>>16,this[u+1]=l>>>8,this[u]=l&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,4,4294967295,0),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4},s.prototype.writeIntLE=function(l,u,E,x){if(l=+l,u=u>>>0,!x){var F=Math.pow(2,8*E-1);dt(this,l,u,E,F-1,-F)}var $=0,me=1,_e=0;for(this[u]=l&255;++$<E&&(me*=256);)l<0&&_e===0&&this[u+$-1]!==0&&(_e=1),this[u+$]=(l/me>>0)-_e&255;return u+E},s.prototype.writeIntBE=function(l,u,E,x){if(l=+l,u=u>>>0,!x){var F=Math.pow(2,8*E-1);dt(this,l,u,E,F-1,-F)}var $=E-1,me=1,_e=0;for(this[u+$]=l&255;--$>=0&&(me*=256);)l<0&&_e===0&&this[u+$+1]!==0&&(_e=1),this[u+$]=(l/me>>0)-_e&255;return u+E},s.prototype.writeInt8=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,1,127,-128),l<0&&(l=255+l+1),this[u]=l&255,u+1},s.prototype.writeInt16LE=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,2,32767,-32768),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeInt16BE=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,2,32767,-32768),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeInt32LE=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,4,2147483647,-2147483648),this[u]=l&255,this[u+1]=l>>>8,this[u+2]=l>>>16,this[u+3]=l>>>24,u+4},s.prototype.writeInt32BE=function(l,u,E){return l=+l,u=u>>>0,E||dt(this,l,u,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4};function Ut(h,l,u,E,x,F){if(u+E>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function fo(h,l,u,E,x){return l=+l,u=u>>>0,x||Ut(h,l,u,4),Fi.write(h,l,u,E,23,4),u+4}s.prototype.writeFloatLE=function(l,u,E){return fo(this,l,u,!0,E)},s.prototype.writeFloatBE=function(l,u,E){return fo(this,l,u,!1,E)};function Ms(h,l,u,E,x){return l=+l,u=u>>>0,x||Ut(h,l,u,8),Fi.write(h,l,u,E,52,8),u+8}s.prototype.writeDoubleLE=function(l,u,E){return Ms(this,l,u,!0,E)},s.prototype.writeDoubleBE=function(l,u,E){return Ms(this,l,u,!1,E)},s.prototype.copy=function(l,u,E,x){if(!s.isBuffer(l))throw new TypeError("argument should be a Buffer");if(E||(E=0),!x&&x!==0&&(x=this.length),u>=l.length&&(u=l.length),u||(u=0),x>0&&x<E&&(x=E),x===E||l.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),l.length-u<x-E&&(x=l.length-u+E);var F=x-E;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,E,x):Uint8Array.prototype.set.call(l,this.subarray(E,x),u),F},s.prototype.fill=function(l,u,E,x){if(typeof l=="string"){if(typeof u=="string"?(x=u,u=0,E=this.length):typeof E=="string"&&(x=E,E=this.length),x!==void 0&&typeof x!="string")throw new TypeError("encoding must be a string");if(typeof x=="string"&&!s.isEncoding(x))throw new TypeError("Unknown encoding: "+x);if(l.length===1){var F=l.charCodeAt(0);(x==="utf8"&&F<128||x==="latin1")&&(l=F)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(u<0||this.length<u||this.length<E)throw new RangeError("Out of range index");if(E<=u)return this;u=u>>>0,E=E===void 0?this.length:E>>>0,l||(l=0);var $;if(typeof l=="number")for($=u;$<E;++$)this[$]=l;else{var me=s.isBuffer(l)?l:s.from(l,x),_e=me.length;if(_e===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for($=0;$<E-u;++$)this[$+u]=me[$%_e]}return this};var Tl=/[^+/0-9A-Za-z-_]/g;function Cl(h){if(h=h.split("=")[0],h=h.trim().replace(Tl,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function mo(h,l){l=l||1/0;for(var u,E=h.length,x=null,F=[],$=0;$<E;++$){if(u=h.charCodeAt($),u>55295&&u<57344){if(!x){if(u>56319){(l-=3)>-1&&F.push(239,191,189);continue}else if($+1===E){(l-=3)>-1&&F.push(239,191,189);continue}x=u;continue}if(u<56320){(l-=3)>-1&&F.push(239,191,189),x=u;continue}u=(x-55296<<10|u-56320)+65536}else x&&(l-=3)>-1&&F.push(239,191,189);if(x=null,u<128){if((l-=1)<0)break;F.push(u)}else if(u<2048){if((l-=2)<0)break;F.push(u>>6|192,u&63|128)}else if(u<65536){if((l-=3)<0)break;F.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((l-=4)<0)break;F.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return F}function xl(h){for(var l=[],u=0;u<h.length;++u)l.push(h.charCodeAt(u)&255);return l}function Rl(h,l){for(var u,E,x,F=[],$=0;$<h.length&&!((l-=2)<0);++$)u=h.charCodeAt($),E=u>>8,x=u%256,F.push(x),F.push(E);return F}function Bs(h){return Wp.toByteArray(Cl(h))}function ii(h,l,u,E){for(var x=0;x<E&&!(x+u>=l.length||x>=h.length);++x)l[x+u]=h[x];return x}function kt(h,l){return h instanceof l||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===l.name}function ho(h){return h!==h}var Al=function(){for(var h="0123456789abcdef",l=new Array(256),u=0;u<16;++u)for(var E=u*16,x=0;x<16;++x)l[E+x]=h[u]+h[x];return l}()}),Ee=vc.Buffer;vc.SlowBuffer;vc.INSPECT_MAX_BYTES;vc.kMaxLength;var qp=function(e,r){return qp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},qp(e,r)};function Ec(t,e){qp(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Wn=function(t){Ec(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),He=function(t){Ec(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function gc(t){return t&&t.Math==Math&&t}function Qh(){return gc(typeof globalThis=="object"&&globalThis)||gc(typeof window=="object"&&window)||gc(typeof self=="object"&&self)||gc(typeof global=="object"&&global)||Function("return this")()}function ZS(){var t=Qh();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var eb=function(e){var r=ZS()?"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(r);for(var n=Ee.alloc(e),i=0;i<e;++i)n[i]=Math.floor(Math.random()*256);return n},tb=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Ee.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(Ee.alloc(e))}:eb}},Zh=tb();function rb(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Xp(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function nb(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ib(t){return es(t)&&Object.prototype.toString.call(t)==="[object Date]"}function es(t){return typeof t=="object"&&t!==null}function _c(t,e){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function yc(t){if(ArrayBuffer.isView(t))return Ee.from(t.buffer,t.byteOffset,t.byteLength);if(rb(t))return Ee.from(t);throw new He("Must use either Buffer or TypedArray")}var ob=/^(?:[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,eg=function(t){return typeof t=="string"&&ob.test(t)},Kp=function(t){if(!eg(t))throw new He('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return Ee.from(e,"hex")},Bh=function(t,e){return e===void 0&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")};var uM=Math.pow(2,63)-1,pM=-Math.pow(2,63),sb=Math.pow(2,53),ab=-Math.pow(2,53);var tg=4;var jn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new He("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=Ee.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=Ee.from(e,"binary"):Array.isArray(e)?this.buffer=Ee.from(e):this.buffer=yc(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new He("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new He("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new He("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=Ee.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(e,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+e.length){var n=Ee.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(yc(e),r),this.position=r+e.byteLength>this.position?r+e.length:this.position):typeof e=="string"&&(this.buffer.write(e,r,e.length,"binary"),this.position=r+e.length>this.position?r+e.length:this.position)},t.prototype.read=function(e,r){return r=r&&r>0?r:this.position,this.buffer.slice(e,e+r)},t.prototype.value=function(e){return e=!!e,e&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new Uh(this.buffer.slice(0,this.position));throw new Wn('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=Ee.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=Ee.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=Kp(e.$uuid)),!n)throw new He("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===tg?new Uh(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(jn.prototype,"_bsontype",{value:"Binary"});var jp=16,Uh=function(t){Ec(e,t);function e(r){var n=this,i,o;if(r==null)i=e.generate();else if(r instanceof e)i=Ee.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===jp)i=yc(r);else if(typeof r=="string")i=Kp(r);else throw new He("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 n=t.call(this,i,tg)||this,n.__id=o,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Bh(r))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(r){if(r===void 0&&(r=!0),e.cacheHexString&&this.__id)return this.__id;var n=Bh(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new jn(this.id,jn.SUBTYPE_UUID)},e.generate=function(){var r=Zh(jp);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ee.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?eg(r):Xp(r)?r.length!==jp?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=Kp(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(jn),Sc=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t}();Object.defineProperty(Sc.prototype,"_bsontype",{value:"Code"});function cb(t){return es(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var Qo=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");o.length===2&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(Qo.prototype,"_bsontype",{value:"DBRef"});var Kt=void 0;try{Kt=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 kh=65536,lb=1<<24,Vi=kh*kh,rg=Vi*Vi,Fh=rg/2,Hh={},Vh={},ee=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(e>>>=0,(o=0<=e&&e<256)&&(i=Vh[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),o&&(Vh[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(i=Hh[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(Hh[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=rg)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Fh)return t.MIN_VALUE;if(e+1>=Fh)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%Vi|0,e/Vi|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),p=parseInt(e.substring(a,a+c),n);if(c<8){var f=t.fromNumber(Math.pow(n,c));s=s.mul(f).add(t.fromNumber(p))}else s=s.mul(o),s=s.add(t.fromNumber(p))}return s.unsigned=r,s},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return es(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,p=e.low&65535,f=0,m=0,v=0,y=0;return y+=o+p,v+=y>>>16,y&=65535,v+=i+c,m+=v>>>16,v&=65535,m+=n+a,f+=m>>>16,m&=65535,f+=r+s,f&=65535,t.fromBits(v<<16|y,f<<16|m,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Kt){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?Kt.div_u:Kt.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Kt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Math.pow(2,a-48),p=t.fromNumber(n),f=p.mul(e);f.isNegative()||f.gt(i);)n-=c,p=t.fromNumber(n,this.unsigned),f=p.mul(e);p.isZero()&&(p=t.ONE),o=o.add(p),i=i.sub(f)}return o},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Kt){var r=(this.unsigned?Kt.rem_u:Kt.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Kt.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Kt){var r=Kt.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,Kt.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,p=e.low>>>16,f=e.low&65535,m=0,v=0,y=0,T=0;return T+=s*f,y+=T>>>16,T&=65535,y+=o*f,v+=y>>>16,y&=65535,y+=s*p,v+=y>>>16,y&=65535,v+=i*f,m+=v>>>16,v&=65535,v+=o*p,m+=v>>>16,v&=65535,v+=s*c,m+=v>>>16,v&=65535,m+=n*f+i*p+o*c+s*a,m&=65535,t.fromBits(y<<16|T,m<<16|v,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*Vi+(this.low>>>0):this.high*Vi+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),p=s.sub(c.mul(o)).toInt()>>>0,f=p.toString(e);if(s=c,s.isZero())return f+a;for(;f.length<6;)f="0"+f;a=""+f+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(lb),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(ee.prototype,"__isLong__",{value:!0});Object.defineProperty(ee.prototype,"_bsontype",{value:"Long"});var ub=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,pb=/^(\+|-)?(Infinity|inf)$/i,fb=/^(\+|-)?NaN$/i,Jo=6111,Gp=-6176,$h=6176,mb=34,Yp=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Wh=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),jh=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),db=/^([-+])?(\d+)?$/,hb=31,Gh=16383,gb=30,yb=31;function Yh(t){return!isNaN(parseInt(t,10))}function vb(t){var e=ee.fromNumber(1e9),r=ee.fromNumber(0);if(!t.parts[0]&&!t.parts[1]&&!t.parts[2]&&!t.parts[3])return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new ee(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Eb(t,e){if(!t&&!e)return{high:ee.fromNumber(0),low:ee.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new ee(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new ee(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),c=n.multiply(i),p=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new ee(a.getLowBits(),0).add(c).add(p.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),p=a.shiftLeft(32).add(new ee(p.getLowBits(),0)),{high:s,low:p}}function _b(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,o=e.low>>>0;if(i<o)return!0}return!1}function Hi(t,e){throw new He('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Jp=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Xp(e)){if(e.byteLength!==16)throw new He("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new He("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,o=0,s=0,a=0,c=0,p=0,f=[0],m=0,v=0,y=0,T=0,R=0,A=0,N=new ee(0,0),B=new ee(0,0),P=0,q=0;if(e.length>=7e3)throw new He(""+e+" not a valid Decimal128 string");var de=e.match(ub),W=e.match(pb),re=e.match(fb);if(!de&&!W&&!re||e.length===0)throw new He(""+e+" not a valid Decimal128 string");if(de){var Q=de[2],ae=de[4],Oe=de[5],we=de[6];ae&&we===void 0&&Hi(e,"missing exponent power"),ae&&Q===void 0&&Hi(e,"missing exponent base"),ae===void 0&&(Oe||we)&&Hi(e,"missing e before exponent")}if((e[q]==="+"||e[q]==="-")&&(r=e[q++]==="-"),!Yh(e[q])&&e[q]!=="."){if(e[q]==="i"||e[q]==="I")return new t(Ee.from(r?Wh:jh));if(e[q]==="N")return new t(Ee.from(Yp))}for(;Yh(e[q])||e[q]===".";){if(e[q]==="."){n&&Hi(e,"contains multiple periods"),n=!0,q=q+1;continue}m<34&&(e[q]!=="0"||i)&&(i||(p=s),i=!0,f[v++]=parseInt(e[q],10),m=m+1),i&&(a=a+1),n&&(c=c+1),s=s+1,q=q+1}if(n&&!s)throw new He(""+e+" not a valid Decimal128 string");if(e[q]==="e"||e[q]==="E"){var Pe=e.substr(++q).match(db);if(!Pe||!Pe[2])return new t(Ee.from(Yp));R=parseInt(Pe[0],10),q=q+Pe[0].length}if(e[q])return new t(Ee.from(Yp));if(y=0,!m)y=0,T=0,f[0]=0,a=1,m=1,o=0;else if(T=m-1,o=a,o!==1)for(;f[p+o-1]===0;)o=o-1;for(R<=c&&c-R>16384?R=Gp:R=R-c;R>Jo;){if(T=T+1,T-y>mb){var Ge=f.join("");if(Ge.match(/^0+$/)){R=Jo;break}Hi(e,"overflow")}R=R-1}for(;R<Gp||m<a;){if(T===0&&o<m){R=Gp,o=0;break}if(m<a?a=a-1:T=T-1,R<Jo)R=R+1;else{var Ge=f.join("");if(Ge.match(/^0+$/)){R=Jo;break}Hi(e,"overflow")}}if(T-y+1<o){var rt=s;n&&(p=p+1,rt=rt+1),r&&(p=p+1,rt=rt+1);var lr=parseInt(e[p+T+1],10),er=0;if(lr>=5&&(er=1,lr===5)){for(er=f[T]%2===1?1:0,A=p+T+2;A<rt;A++)if(parseInt(e[A],10)){er=1;break}}if(er){for(var Ne=T;Ne>=0;Ne--)if(++f[Ne]>9&&(f[Ne]=0,Ne===0))if(R<Jo)R=R+1,f[Ne]=1;else return new t(Ee.from(r?Wh:jh))}}if(N=ee.fromNumber(0),B=ee.fromNumber(0),o===0)N=ee.fromNumber(0),B=ee.fromNumber(0);else if(T-y<17){var Ne=y;for(B=ee.fromNumber(f[Ne++]),N=new ee(0,0);Ne<=T;Ne++)B=B.multiply(ee.fromNumber(10)),B=B.add(ee.fromNumber(f[Ne]))}else{var Ne=y;for(N=ee.fromNumber(f[Ne++]);Ne<=T-17;Ne++)N=N.multiply(ee.fromNumber(10)),N=N.add(ee.fromNumber(f[Ne]));for(B=ee.fromNumber(f[Ne++]);Ne<=T;Ne++)B=B.multiply(ee.fromNumber(10)),B=B.add(ee.fromNumber(f[Ne]))}var nt=Eb(N,ee.fromString("100000000000000000"));nt.low=nt.low.add(B),_b(nt.low,B)&&(nt.high=nt.high.add(ee.fromNumber(1))),P=R+$h;var he={low:ee.fromNumber(0),high:ee.fromNumber(0)};nt.high.shiftRightUnsigned(49).and(ee.fromNumber(1)).equals(ee.fromNumber(1))?(he.high=he.high.or(ee.fromNumber(3).shiftLeft(61)),he.high=he.high.or(ee.fromNumber(P).and(ee.fromNumber(16383).shiftLeft(47))),he.high=he.high.or(nt.high.and(ee.fromNumber(0x7fffffffffff)))):(he.high=he.high.or(ee.fromNumber(P&16383).shiftLeft(49)),he.high=he.high.or(nt.high.and(ee.fromNumber(562949953421311)))),he.low=nt.low,r&&(he.high=he.high.or(ee.fromString("9223372036854775808")));var ue=Ee.alloc(16);return q=0,ue[q++]=he.low.low&255,ue[q++]=he.low.low>>8&255,ue[q++]=he.low.low>>16&255,ue[q++]=he.low.low>>24&255,ue[q++]=he.low.high&255,ue[q++]=he.low.high>>8&255,ue[q++]=he.low.high>>16&255,ue[q++]=he.low.high>>24&255,ue[q++]=he.high.low&255,ue[q++]=he.high.low>>8&255,ue[q++]=he.high.low>>16&255,ue[q++]=he.high.low>>24&255,ue[q++]=he.high.high&255,ue[q++]=he.high.high>>8&255,ue[q++]=he.high.high>>16&255,ue[q++]=he.high.high>>24&255,new t(ue)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,a,c={parts:[0,0,0,0]},p,f,m=[];o=0;var v=this.bytes,y=v[o++]|v[o++]<<8|v[o++]<<16|v[o++]<<24,T=v[o++]|v[o++]<<8|v[o++]<<16|v[o++]<<24,R=v[o++]|v[o++]<<8|v[o++]<<16|v[o++]<<24,A=v[o++]|v[o++]<<8|v[o++]<<16|v[o++]<<24;o=0;var N={low:new ee(y,T),high:new ee(R,A)};N.high.lessThan(ee.ZERO)&&m.push("-");var B=A>>26&hb;if(B>>3===3){if(B===gb)return m.join("")+"Infinity";if(B===yb)return"NaN";e=A>>15&Gh,a=8+(A>>14&1)}else a=A>>14&7,e=A>>17&Gh;var P=e-$h;if(c.parts[0]=(A&16383)+((a&15)<<14),c.parts[1]=R,c.parts[2]=T,c.parts[3]=y,c.parts[0]===0&&c.parts[1]===0&&c.parts[2]===0&&c.parts[3]===0)s=!0;else for(f=3;f>=0;f--){var q=0,de=vb(c);if(c=de.quotient,q=de.rem.low,!!q)for(p=8;p>=0;p--)n[f*9+p]=q%10,q=Math.floor(q/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var W=r-1+P;if(W>=34||W<=-7||P>0){if(r>34)return m.push("".concat(0)),P>0?m.push("E+".concat(P)):P<0&&m.push("E".concat(P)),m.join("");m.push("".concat(n[o++])),r=r-1,r&&m.push(".");for(var i=0;i<r;i++)m.push("".concat(n[o++]));m.push("E"),W>0?m.push("+".concat(W)):m.push("".concat(W))}else if(P>=0)for(var i=0;i<r;i++)m.push("".concat(n[o++]));else{var re=r+P;if(re>0)for(var i=0;i<re;i++)m.push("".concat(n[o++]));else m.push("0");for(m.push(".");re++<0;)m.push("0");for(var i=0;i<r-Math.max(re-1,0);i++)m.push("".concat(n[o++]))}return m.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Jp.prototype,"_bsontype",{value:"Decimal128"});var bc=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.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()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t}();Object.defineProperty(bc.prototype,"_bsontype",{value:"Double"});var wc=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(wc.prototype,"_bsontype",{value:"Int32"});var Qp=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(Qp.prototype,"_bsontype",{value:"MaxKey"});var Zp=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(Zp.prototype,"_bsontype",{value:"MinKey"});var Sb=new RegExp("^[0-9a-fA-F]{24}$"),$n=null,br=Symbol("id"),et=function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new He("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=Ee.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[br]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[br]=r instanceof Ee?r:yc(r);else if(typeof r=="string")if(r.length===12){var n=Ee.from(r);if(n.byteLength===12)this[br]=n;else throw new He("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Sb.test(r))this[br]=Ee.from(r,"hex");else throw new He("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new He("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[br]},set:function(e){this[br]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=Ee.alloc(12);return n.writeUInt32BE(e,0),$n===null&&($n=Zh(5)),n[4]=$n[0],n[5]=$n[1],n[6]=$n[2],n[7]=$n[3],n[8]=$n[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[br][11]===e[br][11]&&this[br].equals(e[br]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Xp(this.id))return e===Ee.prototype.toString.call(this.id,"latin1");if(typeof e=="string"&&t.isValid(e)&&e.length===24)return e.toLowerCase()===this.toHexString();if(typeof e=="string"&&t.isValid(e)&&e.length===12)return Ee.from(e).equals(this.id);if(typeof e=="object"&&"toHexString"in e&&typeof e.toHexString=="function"){var r=e.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},t.prototype.getTimestamp=function(){var e=new Date,r=this.id.readUInt32BE(0);return e.setTime(Math.floor(r)*1e3),e},t.createPk=function(){return new t},t.createFromTime=function(e){var r=Ee.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new He("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Ee.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(Math.random()*16777215),t}();Object.defineProperty(et.prototype,"generate",{value:_c(function(t){return et.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(et.prototype,"getInc",{value:_c(function(){return et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(et.prototype,"get_inc",{value:_c(function(){return et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(et,"get_inc",{value:_c(function(){return et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(et.prototype,"_bsontype",{value:"ObjectID"});function bb(t){return t.split("").sort().join("")}var Zo=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=bb(r??""),this.pattern.indexOf("\0")!==-1)throw new Wn("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new Wn("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new Wn("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new He("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(Zo.prototype,"_bsontype",{value:"BSONRegExp"});var ef=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(ef.prototype,"_bsontype",{value:"Symbol"});var wb=ee,ng=function(t){Ec(e,t);function e(r,n){var i=this;return i instanceof e?(ee.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:es(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(ee.fromInt(r,!0))},e.fromNumber=function(r){return new e(ee.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(ee.fromString(r,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(r){return new e(r.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=ee.MAX_UNSIGNED_VALUE,e}(wb);function Ib(t){return es(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var ig=2147483647,og=-2147483648,sg=9223372036854776e3,ag=-9223372036854776e3,Tb={$oid:et,$binary:jn,$uuid:jn,$symbol:ef,$numberInt:wc,$numberDecimal:Jp,$numberDouble:bc,$numberLong:ee,$minKey:Zp,$maxKey:Qp,$regex:Zo,$regularExpression:Zo,$timestamp:ng};function cg(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=og&&t<=ig)return new wc(t);if(t>=ag&&t<=sg)return ee.fromNumber(t)}return new bc(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(m){return m.startsWith("$")&&t[m]!=null}),n=0;n<r.length;n++){var i=Tb[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var o=t.$date,s=new Date;return e.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):ee.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&e.relaxed&&s.setTime(o),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=cg(t.$scope)),Sc.fromExtendedJSON(t)}if(cb(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof Qo)return c;var p=Object.keys(c).filter(function(m){return m.startsWith("$")}),f=!0;if(p.forEach(function(m){["$ref","$id","$db"].indexOf(m)===-1&&(f=!1)}),f)return Qo.fromExtendedJSON(c)}return t}function Cb(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return an(r,e)}finally{e.seenObjects.pop()}})}function zh(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function an(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(N){return N.obj===t});if(r!==-1){var n=e.seenObjects.map(function(N){return N.propertyName}),i=n.slice(0,r).map(function(N){return"".concat(N," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(N){return"".concat(N," -> ")}).join(""),a=n[n.length-1],c=" ".repeat(i.length+o.length/2),p="-".repeat(s.length+(o.length+a.length)/2-1);throw new He(`Converting circular structure to EJSON:
|
|
31
|
+
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(ir(a))}i(c)}}return typeof n=="string"?n:Uv(n)}function Uv(t){let e=t.reduce((i,o)=>i+o.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function Nm(t){let e=typeof t.data=="string"?wu(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var kv={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Tu(t){return kv[t]}function Cu(t){if(!t?.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function Om(t,e,r,n){let i=t.sdkProcessingMetadata?.dynamicSamplingContext;return _(_(_({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:yn(n)}),i&&{trace:i})}function Fv(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function Pm(t,e,r,n){let i=Cu(r),o=_(_({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:yn(e)}),s="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return tn(o,[s])}function Lm(t,e,r,n){let i=Cu(r),o=t.type&&t.type!=="replay_event"?t.type:"event";Fv(t,r?.sdk);let s=Om(t,i,n,e);return delete t.sdkProcessingMetadata,tn(s,[[{type:o},t]])}var xu=0,Mm=1,Bm=2;function or(t){return new _r(e=>{e(t)})}function vn(t){return new _r((e,r)=>{r(t)})}var _r=class t{constructor(e){this._state=xu,this._handlers=[],this._runExecutor(e)}then(e,r){return new t((n,i)=>{this._handlers.push([!1,o=>{if(!e)n(o);else try{n(e(o))}catch(s){i(s)}},o=>{if(!r)i(o);else try{n(r(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new t((r,n)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{if(o){n(i);return}r(i)})})}_executeHandlers(){if(this._state===xu)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Mm&&r[1](this._value),this._state===Bm&&r[2](this._value),r[0]=!0)})}_runExecutor(e){let r=(o,s)=>{if(this._state===xu){if(Zr(s)){s.then(n,i);return}this._state=o,this._value=s,this._executeHandlers()}},n=o=>{r(Mm,o)},i=o=>{r(Bm,o)};try{e(n,i)}catch(o){i(o)}}};function ma(t,e,r,n=0){return new _r((i,o)=>{let s=t[n];if(e===null||typeof s!="function")i(e);else{let a=s(_({},e),r);se&&s.id&&a===null&&te.log(`Event processor "${s.id}" dropped event`),Zr(a)?a.then(c=>ma(t,c,r,n+1).then(i)).then(null,o):ma(t,a,r,n+1).then(i).then(null,o)}})}function Um(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=e;Hv(t,e),n&&Wv(t,n),jv(t,r),Vv(t,i),$v(t,o)}function Ru(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:p,eventProcessors:m,attachments:f,propagationContext:E,transactionName:y,span:T}=e;da(t,"extra",r),da(t,"tags",n),da(t,"user",i),da(t,"contexts",o),t.sdkProcessingMetadata=gn(t.sdkProcessingMetadata,a,2),s&&(t.level=s),y&&(t.transactionName=y),T&&(t.span=T),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),m.length&&(t.eventProcessors=[...t.eventProcessors,...m]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext=_(_({},t.propagationContext),E)}function da(t,e,r){t[e]=gn(t[e],r,1)}function Hv(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(r).length&&(t.extra=_(_({},r),t.extra)),Object.keys(n).length&&(t.tags=_(_({},n),t.tags)),Object.keys(i).length&&(t.user=_(_({},i),t.user)),Object.keys(o).length&&(t.contexts=_(_({},o),t.contexts)),s&&(t.level=s),a&&t.type!=="transaction"&&(t.transaction=a)}function Vv(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function $v(t,e){t.sdkProcessingMetadata=_(_({},t.sdkProcessingMetadata),e)}function Wv(t,e){t.contexts=_({trace:Eu(e)},t.contexts),t.sdkProcessingMetadata=_({dynamicSamplingContext:bu(e)},t.sdkProcessingMetadata);let r=ko(e),n=Ai(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function jv(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}var ha,km,ga;function Fm(t){let e=fe._sentryDebugIds;if(!e)return{};let r=Object.keys(e);return ga&&r.length===km||(km=r.length,ga=r.reduce((n,i)=>{ha||(ha={});let o=ha[i];if(o)n[o[0]]=o[1];else{let s=t(i);for(let a=s.length-1;a>=0;a--){let p=s[a]?.filename,m=e[i];if(p&&m){n[p]=m,ha[i]=[p,m];break}}}return n},{})),ga}function Hm(t,e,r,n,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c=ee(_({},e),{event_id:e.event_id||r.event_id||pt(),timestamp:e.timestamp||Ar()}),p=r.integrations||t.integrations.map(O=>O.name);Gv(c,t),qv(c,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Yv(c,t.stackParser);let m=Xv(n,r.captureContext);r.mechanism&&Rr(c,r.mechanism);let f=i?i.getEventProcessors():[],E=la().getScopeData();if(o){let O=o.getScopeData();Ru(E,O)}if(m){let O=m.getScopeData();Ru(E,O)}let y=[...r.attachments||[],...E.attachments];y.length&&(r.attachments=y),Um(c,E);let T=[...f,...E.eventProcessors];return ma(T,c,r).then(O=>(O&&zv(O),typeof s=="number"&&s>0?Kv(O,s,a):O))}function Gv(t,e){let{environment:r,release:n,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||r||Di,!t.release&&n&&(t.release=n),!t.dist&&i&&(t.dist=i);let s=t.request;s?.url&&(s.url=hn(s.url,o))}function Yv(t,e){let r=Fm(e);t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=r[i.filename])})})}function zv(t){let e={};if(t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function qv(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function Kv(t,e,r){if(!t)return null;let n=_(_(_(_(_({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>_(_({},i),i.data&&{data:ir(i.data,e,r)}))}),t.user&&{user:ir(t.user,e,r)}),t.contexts&&{contexts:ir(t.contexts,e,r)}),t.extra&&{extra:ir(t.extra,e,r)});return t.contexts?.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=ir(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>_(_({},i),i.data&&{data:ir(i.data,e,r)}))),t.contexts?.flags&&n.contexts&&(n.contexts.flags=ir(t.contexts.flags,3,r)),n}function Xv(t,e){if(!e)return t;let r=t?t.clone():new It;return r.update(e),r}function Vm(t){if(t)return Jv(t)?{captureContext:t}:Zv(t)?{captureContext:t}:t}function Jv(t){return t instanceof It||typeof t=="function"}var Qv=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function Zv(t){return Object.keys(t).some(e=>Qv.includes(e))}function ya(t,e){return Er().captureException(t,Vm(e))}function va(t,e){let r=typeof e=="string"?e:void 0,n=typeof e!="string"?{captureContext:e}:void 0;return Er().captureMessage(t,r,n)}function Fo(t,e){return Er().captureEvent(t,e)}function Ho(t){let e=Dr(),r=Er(),{userAgent:n}=fe.navigator||{},i=cm(_(_({user:r.getUser()||e.getUser()},n&&{userAgent:n}),t)),o=e.getSession();return o?.status==="ok"&&en(o,{status:"exited"}),Ea(),e.setSession(i),i}function Ea(){let t=Dr(),r=Er().getSession()||t.getSession();r&&lm(r),Wm(),t.setSession()}function Wm(){let t=Dr(),e=ze(),r=t.getSession();r&&e&&e.captureSession(r)}function Vo(t=!1){if(t){Ea();return}Wm()}var eE="7";function tE(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function rE(t){return`${tE(t)}${t.projectId}/envelope/`}function nE(t,e){let r={sentry_version:eE};return t.publicKey&&(r.sentry_key=t.publicKey),e&&(r.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(r).toString()}function jm(t,e,r){return e||`${rE(t)}?${nE(t,r)}`}var Gm=[];function Ym(t,e){let r={};return e.forEach(n=>{n&&Du(t,n,r)}),r}function Au(t,e){for(let r of e)r?.afterAllSetup&&r.afterAllSetup(t)}function Du(t,e,r){if(r[e.name]){se&&te.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Gm.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Gm.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>n(i,o,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((o,s)=>n(o,s,t),{id:e.name});t.addEventProcessor(i)}se&&te.log(`Integration installed: ${e.name}`)}function zm(t,e,r){let n=[{type:"client_report"},{timestamp:r||Ar(),discarded_events:t}];return tn(e?{dsn:e}:{},[n])}function _a(t){let e=[];t.message&&e.push(t.message);try{let r=t.exception.values[t.exception.values.length-1];r?.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`))}catch{}return e}function qm(t){let{trace_id:e,parent_span_id:r,span_id:n,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:r,span_id:n??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[yu],exclusive_time:s?.[vu],measurements:t.measurements,is_segment:!0}}function Km(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:_(_(_({},t.data),t.profile_id&&{[yu]:t.profile_id}),t.exclusive_time&&{[vu]:t.exclusive_time})}},measurements:t.measurements}}var Xm="Not capturing exception because it's already been captured.",Jm="Discarded session because of missing or non-string release",ed=Symbol.for("SentryInternalError"),td=Symbol.for("SentryDoNotSendEventError");function ba(t){return{message:t,[ed]:!0}}function Nu(t){return{message:t,[td]:!0}}function Qm(t){return!!t&&typeof t=="object"&&ed in t}function Zm(t){return!!t&&typeof t=="object"&&td in t}var $o=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Cm(e.dsn):se&&te.warn("No DSN provided, client will not send events."),this._dsn){let r=jm(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(ee(_({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:r}))}}captureException(e,r,n){let i=pt();if(sa(e))return se&&te.log(Xm),i;let o=_({event_id:i},r);return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,n))),o.event_id}captureMessage(e,r,n,i){let o=_({event_id:pt()},n),s=Ti(e)?e:String(e),a=$n(e)?this.eventFromMessage(s,r,o):this.eventFromException(e,o);return this._process(a.then(c=>this._captureEvent(c,o,i))),o.event_id}captureEvent(e,r,n){let i=pt();if(r?.originalException&&sa(r.originalException))return se&&te.log(Xm),i;let o=_({event_id:i},r),s=e.sdkProcessingMetadata||{},a=s.capturedSpanScope,c=s.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,a||n,c)),o.event_id}captureSession(e){this.sendSession(e),en(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let r=this._transport;return r?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>r.flush(e).then(i=>n&&i))):or(!0)}close(e){return this.flush(e).then(r=>(this.getOptions().enabled=!1,this.emit("close"),r))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let r=this._integrations[e.name];Du(this,e,this._integrations),r||Au(this,[e])}sendEvent(e,r={}){this.emit("beforeSendEvent",e,r);let n=Lm(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=Am(n,Nm(o));let i=this.sendEnvelope(n);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){let{release:r,environment:n=Di}=this._options;if("aggregates"in e){let o=e.attrs||{};if(!o.release&&!r){se&&te.warn(Jm);return}o.release=o.release||r,o.environment=o.environment||n,e.attrs=o}else{if(!e.release&&!r){se&&te.warn(Jm);return}e.release=e.release||r,e.environment=e.environment||n}this.emit("beforeSendSession",e);let i=Pm(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,r,n=1){if(this._options.sendClientReports){let i=`${e}:${r}`;se&&te.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}on(e,r){let n=this._hooks[e]=this._hooks[e]||[];return n.push(r),()=>{let i=n.indexOf(r);i>-1&&n.splice(i,1)}}emit(e,...r){let n=this._hooks[e];n&&n.forEach(i=>i(...r))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,r=>(se&&te.error("Error while sending envelope:",r),r)):(se&&te.error("Transport disabled"),or({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Ym(this,e),Au(this,e)}_updateSessionFromEvent(e,r){let n=r.level==="fatal",i=!1,o=r.exception?.values;if(o){i=!0;for(let c of o)if(c.mechanism?.handled===!1){n=!0;break}}let s=e.status==="ok";(s&&e.errors===0||s&&n)&&(en(e,ee(_({},n&&{status:"crashed"}),{errors:e.errors||Number(i||n)})),this.captureSession(e))}_isClientDoneProcessing(e){return new _r(r=>{let n=0,i=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),r(!0)):(n+=i,e&&n>=e&&(clearInterval(o),r(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,r,n,i){let o=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s?.length&&(r.integrations=s),this.emit("preprocessEvent",e,r),e.type||i.setLastEventId(e.event_id||r.event_id),Hm(o,e,r,n,this,i).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,r),a.contexts=_({trace:mu(n)},a.contexts);let c=Rm(this,n);return a.sdkProcessingMetadata=_({dynamicSamplingContext:c},a.sdkProcessingMetadata),a})}_captureEvent(e,r={},n=Er(),i=Dr()){return se&&Ou(e)&&te.log(`Captured error event \`${_a(e)[0]||"<unknown>"}\``),this._processEvent(e,r,n,i).then(o=>o.event_id,o=>{se&&(Zm(o)?te.log(o.message):Qm(o)?te.warn(o.message):te.warn(o))})}_processEvent(e,r,n,i){let o=this.getOptions(),{sampleRate:s}=o,a=rd(e),c=Ou(e),p=e.type||"error",m=`before send for type \`${p}\``,f=typeof s>"u"?void 0:ym(s);if(c&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error"),vn(Nu(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let E=p==="replay_event"?"replay":p;return this._prepareEvent(e,r,n,i).then(y=>{if(y===null)throw this.recordDroppedEvent("event_processor",E),Nu("An event processor returned `null`, will not send event.");if(r.data&&r.data.__sentry__===!0)return y;let D=sE(this,o,y,r);return oE(D,m)}).then(y=>{if(y===null){if(this.recordDroppedEvent("before_send",E),a){let k=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",k)}throw Nu(`${m} returned \`null\`, will not send event.`)}let T=n.getSession()||i.getSession();if(c&&T&&this._updateSessionFromEvent(T,y),a){let O=y.sdkProcessingMetadata?.spanCountBeforeProcessing||0,k=y.spans?y.spans.length:0,z=O-k;z>0&&this.recordDroppedEvent("before_send","span",z)}let D=y.transaction_info;if(a&&D&&y.transaction!==e.transaction){let O="custom";y.transaction_info=ee(_({},D),{source:O})}return this.sendEvent(y,r),y}).then(null,y=>{throw Zm(y)||Qm(y)?y:(this.captureException(y,{data:{__sentry__:!0},originalException:y}),ba(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
32
|
+
Reason: ${y}`))})}_process(e){this._numProcessing++,e.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([r,n])=>{let[i,o]=r.split(":");return{reason:i,category:o,quantity:n}})}_flushOutcomes(){se&&te.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){se&&te.log("No outcomes to send");return}if(!this._dsn){se&&te.log("No dsn provided, will not send outcomes");return}se&&te.log("Sending outcomes:",e);let r=zm(e,this._options.tunnel&&yn(this._dsn));this.sendEnvelope(r)}};function oE(t,e){let r=`${e} must return \`null\` or a valid event.`;if(Zr(t))return t.then(n=>{if(!Qr(n)&&n!==null)throw ba(r);return n},n=>{throw ba(`${e} rejected with ${n}`)});if(!Qr(t)&&t!==null)throw ba(r);return t}function sE(t,e,r,n){let{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s}=e,a=r;if(Ou(a)&&i)return i(a,n);if(rd(a)){if(s){let c=s(qm(a));if(c?a=gn(r,Km(c)):_u(),a.spans){let p=[];for(let m of a.spans){let f=s(m);f?p.push(f):(_u(),p.push(m))}a.spans=p}}if(o){if(a.spans){let c=a.spans.length;a.sdkProcessingMetadata=ee(_({},r.sdkProcessingMetadata),{spanCountBeforeProcessing:c})}return o(a,n)}}return a}function Ou(t){return t.type===void 0}function rd(t){return t.type==="transaction"}function aE(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function nd(t,e,r,n){let i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),r&&n&&(i.dsn=yn(n)),tn(i,[aE(t)])}function Wo(t,e){let r=e??cE(t)??[];if(r.length===0)return;let n=t.getOptions(),i=nd(r,n._metadata,n.tunnel,t.getDsn());id().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(i)}function cE(t){return id().get(t)}function id(){return Jr("clientToLogBufferMap",()=>new WeakMap)}var Pu=Symbol.for("SentryBufferFullError");function od(t){let e=[];function r(){return t===void 0||e.length<t}function n(s){return e.splice(e.indexOf(s),1)[0]||Promise.resolve(void 0)}function i(s){if(!r())return vn(Pu);let a=s();return e.indexOf(a)===-1&&e.push(a),a.then(()=>n(a)).then(null,()=>n(a).then(null,()=>{})),a}function o(s){return new _r((a,c)=>{let p=e.length;if(!p)return a(!0);let m=setTimeout(()=>{s&&s>0&&a(!1)},s);e.forEach(f=>{or(f).then(()=>{--p||(clearTimeout(m),a(!0))},c)})})}return{$:e,add:i,drain:o}}function lE(t,e=Date.now()){let r=parseInt(`${t}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${t}`);return isNaN(n)?6e4:n-e}function uE(t,e){return t[e]||t.all||0}function sd(t,e,r=Date.now()){return uE(t,e)>r}function ad(t,{statusCode:e,headers:r},n=Date.now()){let i=_({},t),o=r?.["x-sentry-rate-limits"],s=r?.["retry-after"];if(o)for(let a of o.trim().split(",")){let[c,p,,,m]=a.split(":",5),f=parseInt(c,10),E=(isNaN(f)?60:f)*1e3;if(!p)i.all=n+E;else for(let y of p.split(";"))y==="metric_bucket"?(!m||m.split(";").includes("custom"))&&(i[y]=n+E):i[y]=n+E}else s?i.all=n+lE(s,n):e===429&&(i.all=n+60*1e3);return i}var pE=64;function Sa(t,e,r=od(t.bufferSize||pE)){let n={},i=s=>r.drain(s);function o(s){let a=[];if(Iu(s,(f,E)=>{let y=Tu(E);sd(n,y)?t.recordDroppedEvent("ratelimit_backoff",y):a.push(f)}),a.length===0)return or({});let c=tn(s[0],a),p=f=>{Iu(c,(E,y)=>{t.recordDroppedEvent(f,Tu(y))})},m=()=>e({body:Dm(c)}).then(f=>(f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&se&&te.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),n=ad(n,f),f),f=>{throw p("network_error"),se&&te.error("Encountered error running transport request:",f),f});return r.add(m).then(f=>f,f=>{if(f===Pu)return se&&te.error("Skipped sending event because buffer is full."),p("queue_overflow"),or({});throw f})}return{send:o,flush:i}}function Lu(t){t.user?.ip_address===void 0&&(t.user=ee(_({},t.user),{ip_address:"{{auto}}"}))}function Mu(t){"aggregates"in t?t.attrs?.ip_address===void 0&&(t.attrs=ee(_({},t.attrs),{ip_address:"{{auto}}"})):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function Bu(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(o=>({name:`${n}:@sentry/${o}`,version:Tr})),version:Tr}),t._metadata=i}var fE=100;function Nr(t,e){let r=ze(),n=Dr();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:o=fE}=r.getOptions();if(o<=0)return;let s=Ar(),a=_({timestamp:s},t),c=i?dn(()=>i(a,e)):a;c!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",c,e),n.addBreadcrumb(c,o))}var cd,mE="FunctionToString",ld=new WeakMap,dE=()=>({name:mE,setupOnce(){cd=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=jn(this),r=ld.has(ze())&&e!==void 0?e:this;return cd.apply(r,t)}}catch{}},setup(t){ld.set(t,!0)}}),wa=dE;var hE=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],gE="EventFilters",Uu=(t={})=>{let e;return{name:gE,setup(r){let n=r.getOptions();e=ud(t,n)},processEvent(r,n,i){if(!e){let o=i.getOptions();e=ud(t,o)}return yE(r,e)?null:r}}},Ta=(t={})=>ee(_({},Uu(t)),{name:"InboundFilters"});function ud(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:hE],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function yE(t,e){if(t.type){if(t.type==="transaction"&&EE(t,e.ignoreTransactions))return se&&te.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
33
|
+
Event: ${xr(t)}`),!0}else{if(vE(t,e.ignoreErrors))return se&&te.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
34
|
+
Event: ${xr(t)}`),!0;if(wE(t))return se&&te.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
35
|
+
Event: ${xr(t)}`),!0;if(_E(t,e.denyUrls))return se&&te.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
36
|
+
Event: ${xr(t)}.
|
|
37
|
+
Url: ${Ia(t)}`),!0;if(!bE(t,e.allowUrls))return se&&te.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
38
|
+
Event: ${xr(t)}.
|
|
39
|
+
Url: ${Ia(t)}`),!0}return!1}function vE(t,e){return e?.length?_a(t).some(r=>Ci(r,e)):!1}function EE(t,e){if(!e?.length)return!1;let r=t.transaction;return r?Ci(r,e):!1}function _E(t,e){if(!e?.length)return!1;let r=Ia(t);return r?Ci(r,e):!1}function bE(t,e){if(!e?.length)return!0;let r=Ia(t);return r?Ci(r,e):!0}function SE(t=[]){for(let e=t.length-1;e>=0;e--){let r=t[e];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Ia(t){try{let r=[...t.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?SE(r):null}catch{return se&&te.error(`Cannot extract url for event ${xr(t)}`),null}}function wE(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function Fu(t,e,r,n,i,o){if(!i.exception?.values||!o||!vr(o.originalException,Error))return;let s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=ku(t,e,n,o.originalException,r,i.exception.values,s,0))}function ku(t,e,r,n,i,o,s,a){if(o.length>=r+1)return o;let c=[...o];if(vr(n[i],Error)){pd(s,a);let p=t(e,n[i]),m=c.length;fd(p,i,m,a),c=ku(t,e,r,n[i],i,[p,...c],p,m)}return Array.isArray(n.errors)&&n.errors.forEach((p,m)=>{if(vr(p,Error)){pd(s,a);let f=t(e,p),E=c.length;fd(f,`errors[${m}]`,E,a),c=ku(t,e,r,p,i,[f,...c],f,E)}}),c}function pd(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=ee(_(_({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function fd(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=ee(_({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function Hu(t){let e="console";Ot(e,t),Pt(e,IE)}function IE(){"console"in fe&&Yl.forEach(function(t){t in fe.console&&ut(fe.console,t,function(e){return wi[t]=e,function(...r){lt("console",{args:r,level:t}),wi[t]?.apply(fe.console,r)}})})}function Vu(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var TE="Dedupe",CE=()=>{let t;return{name:TE,processEvent(e){if(e.type)return e;try{if(xE(e,t))return se&&te.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Ca=CE;function xE(t,e){return e?!!(RE(t,e)||AE(t,e)):!1}function RE(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!hd(t,e)||!dd(t,e))}function AE(t,e){let r=md(e),n=md(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!hd(t,e)||!dd(t,e))}function dd(t,e){let r=Zs(t),n=Zs(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let o=n[i],s=r[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function hd(t,e){let r=t.fingerprint,n=e.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function md(t){return t.exception?.values?.[0]}function jo(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let r=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:r,hash:n,relative:e[5]+r+n}}function xa(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var Go=fe;function $u(){return"history"in Go&&!!Go.history}function DE(){if(!("fetch"in Go))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Yo(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Wu(){if(typeof EdgeRuntime=="string")return!0;if(!DE())return!1;if(Yo(Go.fetch))return!0;let t=!1,e=Go.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=Yo(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){se&&te.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function Gu(t,e){let r="fetch";Ot(r,t),Pt(r,()=>NE(void 0,e))}function NE(t,e=!1){e&&!Wu()||ut(fe,"fetch",function(r){return function(...n){let i=new Error,{method:o,url:s}=OE(n),a={args:n,fetchData:{method:o,url:s},startTimestamp:Ht()*1e3,virtualError:i,headers:PE(n)};return t||lt("fetch",_({},a)),r.apply(fe,n).then(async c=>(t?t(c):lt("fetch",ee(_({},a),{endTimestamp:Ht()*1e3,response:c})),c),c=>{if(lt("fetch",ee(_({},a),{endTimestamp:Ht()*1e3,error:c})),Vn(c)&&c.stack===void 0&&(c.stack=i.stack,zt(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{let p=new URL(a.fetchData.url);c.message=`${c.message} (${p.host})`}catch{}throw c})}})}function ju(t,e){return!!t&&typeof t=="object"&&!!t[e]}function gd(t){return typeof t=="string"?t:t?ju(t,"url")?t.url:t.toString?t.toString():"":""}function OE(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:gd(r),method:ju(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:gd(e),method:ju(e,"method")?String(e.method).toUpperCase():"GET"}}function PE(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(tm(e))return new Headers(e.headers)}catch{}}function Yu(){return"npm"}var Je=fe,zu=0;function qu(){return zu>0}function zE(){zu++,setTimeout(()=>{zu--})}function Gn(t,e={}){function r(i){return typeof i=="function"}if(!r(t))return t;try{let i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(jn(t))return t}catch{return t}let n=function(...i){try{let o=i.map(s=>Gn(s,e));return t.apply(this,o)}catch(o){throw zE(),Uo(s=>{s.addEventProcessor(a=>(e.mechanism&&(xi(a,void 0,void 0),Rr(a,e.mechanism)),a.extra=ee(_({},a.extra),{arguments:i}),a)),ya(o)}),o}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}ia(n,t),zt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function yd(){let t=Bo(),{referrer:e}=Je.document||{},{userAgent:r}=Je.navigator||{},n=_(_({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function Ra(t,e){let r=Ju(t,e),n={type:QE(e),value:ZE(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function qE(t,e,r,n){let o=ze()?.getOptions().normalizeDepth,s=r_(e),a={__serialized__:fa(e,o)};if(s)return{exception:{values:[Ra(t,s)]},extra:a};let c={exception:{values:[{type:Wn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:e_(e,{isUnhandledRejection:n})}]},extra:a};if(r){let p=Ju(t,r);p.length&&(c.exception.values[0].stacktrace={frames:p})}return c}function Ku(t,e){return{exception:{values:[Ra(t,e)]}}}function Ju(t,e){let r=e.stacktrace||e.stack||"",n=XE(e),i=JE(e);try{return t(r,n,i)}catch{}return[]}var KE=/Minified React error #\d+;/i;function XE(t){return t&&KE.test(t.message)?1:0}function JE(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function vd(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function QE(t){let e=t?.name;return!e&&vd(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function ZE(t){let e=t?.message;return vd(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Ed(t,e,r,n){let i=r?.syntheticException||void 0,o=Aa(t,e,i,n);return Rr(o),o.level="error",r?.event_id&&(o.event_id=r.event_id),or(o)}function _d(t,e,r="info",n,i){let o=n?.syntheticException||void 0,s=Xu(t,e,o,i);return s.level=r,n?.event_id&&(s.event_id=n.event_id),or(s)}function Aa(t,e,r,n,i){let o;if(ta(e)&&e.error)return Ku(t,e.error);if(ra(e)||tu(e)){let s=e;if("stack"in e)o=Ku(t,e);else{let a=s.name||(ra(s)?"DOMError":"DOMException"),c=s.message?`${a}: ${s.message}`:a;o=Xu(t,c,r,n),xi(o,c)}return"code"in s&&(o.tags=ee(_({},o.tags),{"DOMException.code":`${s.code}`})),o}return Vn(e)?Ku(t,e):Qr(e)||Wn(e)?(o=qE(t,e,r,i),Rr(o,{synthetic:!0}),o):(o=Xu(t,e,r,n),xi(o,`${e}`,void 0),Rr(o,{synthetic:!0}),o)}function Xu(t,e,r,n){let i={};if(n&&r){let o=Ju(t,r);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Rr(i,{synthetic:!0})}if(Ti(e)){let{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function e_(t,{isUnhandledRejection:e}){let r=au(t),n=e?"promise rejection":"exception";return ta(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:Wn(t)?`Event \`${t_(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function t_(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function r_(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var n_=5e3,zo=class extends $o{constructor(e){let r=i_(e),n=Je.SENTRY_SDK_SOURCE||Yu();Bu(r,"browser",["browser"],n),super(r);let{sendDefaultPii:i,sendClientReports:o,enableLogs:s,_experiments:a}=this._options,c=s??a?.enableLogs;Je.document&&(o||c)&&Je.document.addEventListener("visibilitychange",()=>{Je.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),c&&Wo(this))}),c&&(this.on("flush",()=>{Wo(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{Wo(this)},n_)})),i&&(this.on("postprocessEvent",Lu),this.on("beforeSendSession",Mu))}eventFromException(e,r){return Ed(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return _d(this._options.stackParser,e,r,n,this._options.attachStacktrace)}_prepareEvent(e,r,n,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n,i)}};function i_(t){return _({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Je.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var bd=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var ft=fe;var o_=1e3,Sd,Qu,Zu;function ep(t){let e="dom";Ot(e,t),Pt(e,s_)}function s_(){if(!ft.document)return;let t=lt.bind(null,"dom"),e=wd(t,!0);ft.document.addEventListener("click",e,!1),ft.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let i=ft[r]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(ut(i,"addEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},m=p[s]=p[s]||{refCount:0};if(!m.handler){let f=wd(t);m.handler=f,o.call(this,s,f,c)}m.refCount++}catch{}return o.call(this,s,a,c)}}),ut(i,"removeEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__||{},m=p[s];m&&(m.refCount--,m.refCount<=0&&(o.call(this,s,m.handler,c),m.handler=void 0,delete p[s]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,c)}}))})}function a_(t){if(t.type!==Qu)return!1;try{if(!t.target||t.target._sentryId!==Zu)return!1}catch{}return!0}function c_(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function wd(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=l_(r);if(c_(r.type,n))return;zt(r,"_sentryCaptured",!0),n&&!n._sentryId&&zt(n,"_sentryId",pt());let i=r.type==="keypress"?"input":r.type;a_(r)||(t({event:r,name:i,global:e}),Qu=r.type,Zu=n?n._sentryId:void 0),clearTimeout(Sd),Sd=ft.setTimeout(()=>{Zu=void 0,Qu=void 0},o_)}}function l_(t){try{return t.target}catch{return null}}var Da;function qo(t){let e="history";Ot(e,t),Pt(e,u_)}function u_(){if(ft.addEventListener("popstate",()=>{let e=ft.location.href,r=Da;if(Da=e,r===e)return;lt("history",{from:r,to:e})}),!$u())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let i=Da,o=p_(String(n));if(Da=o,i===o)return e.apply(this,r);lt("history",{from:i,to:o})}return e.apply(this,r)}}ut(ft.history,"pushState",t),ut(ft.history,"replaceState",t)}function p_(t){try{return new URL(t,ft.location.origin).toString()}catch{return t}}var Na={};function tp(t){let e=Na[t];if(e)return e;let r=ft[t];if(Yo(r))return Na[t]=r.bind(ft);let n=ft.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let o=i.contentWindow;o?.[t]&&(r=o[t]),n.head.removeChild(i)}catch(i){bd&&te.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Na[t]=r.bind(ft))}function Oa(t){Na[t]=void 0}var Yn="__sentry_xhr_v3__";function rp(t){let e="xhr";Ot(e,t),Pt(e,f_)}function f_(){if(!ft.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let i=new Error,o=Ht()*1e3,s=Lt(n[0])?n[0].toUpperCase():void 0,a=m_(n[1]);if(!s||!a)return e.apply(r,n);r[Yn]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let c=()=>{let p=r[Yn];if(p&&r.readyState===4){try{p.status_code=r.status}catch{}let m={endTimestamp:Ht()*1e3,startTimestamp:o,xhr:r,virtualError:i};lt("xhr",m)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(p,m,f){return c(),p.apply(m,f)}}):r.addEventListener("readystatechange",c),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(p,m,f){let[E,y]=f,T=m[Yn];return T&&Lt(E)&&Lt(y)&&(T.request_headers[E.toLowerCase()]=y),p.apply(m,f)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let i=r[Yn];if(!i)return e.apply(r,n);n[0]!==void 0&&(i.body=n[0]);let o={startTimestamp:Ht()*1e3,xhr:r};return lt("xhr",o),e.apply(r,n)}})}function m_(t){if(Lt(t))return t;try{return t.toString()}catch{}}function np(t,e=tp("fetch")){let r=0,n=0;function i(o){let s=o.body.length;r+=s,n++;let a=_({body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return Oa("fetch"),vn("No fetch implementation available");try{return e(t.url,a).then(c=>(r-=s,n--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return Oa("fetch"),r-=s,n--,vn(c)}}return Sa(t,i)}var d_=30;var h_=50;function ip(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?Cr:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var g_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,y_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,v_=/\((\S*)(?::(\d+))(?::(\d+))\)/,E_=t=>{let e=g_.exec(t);if(e){let[,n,i,o]=e;return ip(n,Cr,+i,+o)}let r=y_.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=v_.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[i,o]=xd(r[1]||Cr,r[2]);return ip(o,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Id=[d_,E_],__=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,b_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,S_=t=>{let e=__.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let o=b_.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let n=e[3],i=e[1]||Cr;return[i,n]=xd(i,n),ip(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Td=[h_,S_];var Cd=[Id,Td],op=Xl(...Cd),xd=(t,e)=>{let r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:Cr,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var Ni=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Pa=1024,w_="Breadcrumbs",I_=(t={})=>{let e=_({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:w_,setup(r){e.console&&Hu(x_(r)),e.dom&&ep(C_(r,e.dom)),e.xhr&&rp(R_(r)),e.fetch&&Gu(A_(r)),e.history&&qo(D_(r)),e.sentry&&r.on("beforeSendEvent",T_(r))}}},Rd=I_;function T_(t){return function(r){ze()===t&&Nr({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:xr(r)},{event:r})}}function C_(t,e){return function(n){if(ze()!==t)return;let i,o,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>Pa&&(Ni&&te.warn(`\`dom.maxStringLength\` cannot exceed ${Pa}, but a value of ${a} was configured. Sentry will use ${Pa} instead.`),a=Pa),typeof s=="string"&&(s=[s]);try{let p=n.event,m=N_(p)?p.target:p;i=Mo(m,{keyAttrs:s,maxStringLength:a}),o=su(m)}catch{i="<unknown>"}if(i.length===0)return;let c={category:`ui.${n.name}`,message:i};o&&(c.data={"ui.component_name":o}),Nr(c,{event:n.event,name:n.name,global:n.global})}}function x_(t){return function(r){if(ze()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:Vu(r.level),message:na(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${na(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;Nr(n,{input:r.args,level:r.level})}}function R_(t){return function(r){if(ze()!==t)return;let{startTimestamp:n,endTimestamp:i}=r,o=r.xhr[Yn];if(!n||!i||!o)return;let{method:s,url:a,status_code:c,body:p}=o,m={method:s,url:a,status_code:c},f={xhr:r.xhr,input:p,startTimestamp:n,endTimestamp:i},E={category:"xhr",data:m,type:"http",level:xa(c)};t.emit("beforeOutgoingRequestBreadcrumb",E,f),Nr(E,f)}}function A_(t){return function(r){if(ze()!==t)return;let{startTimestamp:n,endTimestamp:i}=r;if(i&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.fetchData.method,r.fetchData.url,r.error){let o=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:i},a={category:"fetch",data:o,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Nr(a,s)}else{let o=r.response,s=ee(_({},r.fetchData),{status_code:o?.status});r.fetchData.request_body_size,r.fetchData.response_body_size,o?.status;let a={input:r.args,response:o,startTimestamp:n,endTimestamp:i},c={category:"fetch",data:s,type:"http",level:xa(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,a),Nr(c,a)}}}function D_(t){return function(r){if(ze()!==t)return;let n=r.from,i=r.to,o=jo(Je.location.href),s=n?jo(n):void 0,a=jo(i);s?.path||(s=o),o.protocol===a.protocol&&o.host===a.host&&(i=a.relative),o.protocol===s.protocol&&o.host===s.host&&(n=s.relative),Nr({category:"navigation",data:{from:n,to:i}})}}function N_(t){return!!t&&!!t.target}var O_=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],P_="BrowserApiErrors",L_=(t={})=>{let e=_({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:P_,setupOnce(){e.setTimeout&&ut(Je,"setTimeout",Ad),e.setInterval&&ut(Je,"setInterval",Ad),e.requestAnimationFrame&&ut(Je,"requestAnimationFrame",M_),e.XMLHttpRequest&&"XMLHttpRequest"in Je&&ut(XMLHttpRequest.prototype,"send",B_);let r=e.eventTarget;r&&(Array.isArray(r)?r:O_).forEach(i=>U_(i,e))}}},Dd=L_;function Ad(t){return function(...e){let r=e[0];return e[0]=Gn(r,{mechanism:{data:{function:nr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function M_(t){return function(e){return t.apply(this,[Gn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:nr(t)},handled:!1,type:"instrument"}})])}}function B_(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in r&&typeof r[i]=="function"&&ut(r,i,function(o){let s={mechanism:{data:{function:i,handler:nr(o)},handled:!1,type:"instrument"}},a=jn(o);return a&&(s.mechanism.data.handler=nr(a)),Gn(o,s)})}),t.apply(this,e)}}function U_(t,e){let n=Je[t]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(ut(n,"addEventListener",function(i){return function(o,s,a){try{k_(s)&&(s.handleEvent=Gn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:nr(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&F_(this,o,s),i.apply(this,[o,Gn(s,{mechanism:{data:{function:"addEventListener",handler:nr(s),target:t},handled:!1,type:"instrument"}}),a])}}),ut(n,"removeEventListener",function(i){return function(o,s,a){try{let c=s.__sentry_wrapped__;c&&i.call(this,o,c,a)}catch{}return i.call(this,o,s,a)}}))}function k_(t){return typeof t.handleEvent=="function"}function F_(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var Nd=()=>({name:"BrowserSession",setupOnce(){if(typeof Je.document>"u"){Ni&&te.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Ho({ignoreDuration:!0}),Vo(),qo(({from:t,to:e})=>{t!==void 0&&t!==e&&(Ho({ignoreDuration:!0}),Vo())})}});var H_="GlobalHandlers",V_=(t={})=>{let e=_({onerror:!0,onunhandledrejection:!0},t);return{name:H_,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&($_(r),Od("onerror")),e.onunhandledrejection&&(W_(r),Od("onunhandledrejection"))}}},Pd=V_;function $_(t){Ql(e=>{let{stackParser:r,attachStacktrace:n}=Ld();if(ze()!==t||qu())return;let{msg:i,url:o,line:s,column:a,error:c}=e,p=Y_(Aa(r,c||i,void 0,n,!1),o,s,a);p.level="error",Fo(p,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function W_(t){eu(e=>{let{stackParser:r,attachStacktrace:n}=Ld();if(ze()!==t||qu())return;let i=j_(e),o=$n(i)?G_(i):Aa(r,i,void 0,n,!0);o.level="error",Fo(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function j_(t){if($n(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function G_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function Y_(t,e,r,n){let i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],p=n,m=r,f=Lt(e)&&e.length>0?e:Bo();return c.length===0&&c.push({colno:p,filename:f,function:Cr,in_app:!0,lineno:m}),t}function Od(t){Ni&&te.log(`Global Handler attached: ${t}`)}function Ld(){return ze()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var Md=()=>({name:"HttpContext",preprocessEvent(t){if(!Je.navigator&&!Je.location&&!Je.document)return;let e=yd(),r=_(_({},e.headers),t.request?.headers);t.request=ee(_(_({},e),t.request),{headers:r})}});var z_="cause",q_=5,K_="LinkedErrors",X_=(t={})=>{let e=t.limit||q_,r=t.key||z_;return{name:K_,preprocessEvent(n,i,o){let s=o.getOptions();Fu(Ra,s.stackParser,r,e,n,i)}}},Bd=X_;function sp(t){return[Ta(),wa(),Dd(),Rd(),Pd(),Bd(),Ca(),Md(),Nd()]}var Ma={},Ba,ap,Ud;(()=>{let t=sp({}).filter(e=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(e.name));ap=new zo({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:np,stackParser:op,integrations:t,environment:Ft.mode,release:`web-sdk@${N.SDK_VERSION}`,debug:Ft.debug}),ap.init()})();function xe(t,e,r){S.error(`${e}:`,t);let n=lp(r);n.setTag("operation",e),n.captureException(t)}function cp(t,e,r){lp(r).captureMessage(t,e??"error")}async function Ua(t,e,r){let n="";try{t=t.clone();let o=await t.json();n=JSON.stringify(o)}catch{}if(!n)try{n=await t.text()}catch{}let i=lp(r);i.setTag("operation",e),i.setExtra("responseText",n),i.setExtra("statusText",t.statusText),cp(`${e} failed with ${t.status}`,"error",r)}function kd(t){Ud=t}function Ko(t,e){Ma[t]=_({context:e},Ma[t])}function Fd(t){Ba=_(_({},Ba),t)}function lp(t){t??={};let{extra:e,tags:r}=t,n=new It;if(n.setClient(ap),n.setUser(Ud),t.triggerContext&&!t.engagementTrigger&&(t.engagementTrigger=t.triggerContext.triggerData),t.engagementTrigger){let i=t.engagementTrigger;n.setTags({"engagement.id":i.engagementID,"engagement.short_id":i.shortID,"engagement.objective":i.objective,"engagement.delivery_type":i.onsiteDeliveryType,"engagement.content_id":i.contentID,"engagement.variation":i.variation,"engagement.currency":i.currency})}return e&&n.setExtras(e),r&&n.setTags(r),Ba&&n.setTags(Ba),Object.keys(Ma).forEach(i=>{n.setContext(i,Ma[i])}),n.setTag("language",navigator.language),n.setTag("timezone",Hd()),J_(n),n}function J_(t){window.Shopify&&(t.setTag("shopify.shop",window.Shopify.shop),t.setTag("shopify.currency",window.Shopify.currency?.active),t.setTag("shopify.locale",window.Shopify.locale),t.setTag("theme.schema_name",window.Shopify.theme?.schema_name),t.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}var ka=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(e,2);case"amount_no_decimals":return this.formatWithDelimiters(e,0);case"amount_with_comma_separator":return this.formatWithDelimiters(e,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(e,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(e,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(e,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(e,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(e,2," ",".");default:return i}})}static formatWithDelimiters(e,r=2,n=",",i="."){if(isNaN(e)||e==null)return"0";let s=(e/100).toFixed(r).split("."),a=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),c=s[1]?i+s[1]:"";return a+c}};var ye=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;activeExperiment;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(e){this._currencyCode=e}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(e){this.currentItem=new At(e)}};function Ha(t){try{return new URL(t)}catch{return}}function up(t){return!t||t==="null"||t==="undefined"}function Vd(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function Mt(t,e,r){return{[t]:pp(e,r),[t+"_wo_currency"]:e}}function pp(t,e){if(t==0&&e)return"Free";let r=ye.get(),n=Ge.get(),i=r.shopCurrencyCode||n.currency,o=r.currencyCode;o||S.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,a;if(s&&i===o)a=ka.format(t*100,s);else{let c;try{c=new Intl.NumberFormat(Wd(),{style:"currency",currency:o||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return xe(p,"format-currency",{extra:{currentCurrency:o,shopCurrency:i}}),""}a=c.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&o!=="INR"&&(a=a.concat(` ${o}`))}return a}function $d(t){return new Intl.NumberFormat(Wd(),{notation:"compact"}).format(t)}function Wd(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var Fa;function Hd(){if(Fa)return Fa;try{return Fa=Intl.DateTimeFormat().resolvedOptions().timeZone,Fa}catch{return""}}function Oi(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function sr(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},3e3)}async function fp(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let o=Math.min(100*2**n,5e3);if(await rr.sleep(o),i=r.querySelectorAll(t),i.length)return S.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;S.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${o}ms.`),n++}return S.warn(`Max attempts reached. Element not found with ${t}.`),i}async function Pi(t,e=10,r=document){return(await fp(t,e,r)).item(0)}function jd(t,e,r=document.body){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{(s===t||s.contains(t))&&(e(),n.disconnect())})})});n.observe(r,{childList:!0})}async function Va(){let t=await Me.get(le.DEVICE_ID),e=await yt.get(le.ID,"");return[{key:"letscooee_did",value:t},{key:"letscooee_sid",value:e},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}]}function zn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var Ga,Re,Kd,hp,qn,Gd,Xd,Jd,Qd,gp,mp,dp,Q_,Xo={},Zd=[],Z_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ya=Array.isArray;function rn(t,e){for(var r in e)t[r]=e[r];return t}function yp(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function vp(t,e,r){var n,i,o,s={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?Ga.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return Wa(t,s,n,i,null)}function Wa(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Kd,__i:-1,__u:0};return i==null&&Re.vnode!=null&&Re.vnode(o),o}function Pr(t){return t.children}function Or(t,e){this.props=t,this.context=e}function Li(t,e){if(e==null)return t.__?Li(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?Li(t):null}function eh(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return eh(t)}}function Yd(t){(!t.__d&&(t.__d=!0)&&qn.push(t)&&!ja.__r++||Gd!=Re.debounceRendering)&&((Gd=Re.debounceRendering)||Xd)(ja)}function ja(){for(var t,e,r,n,i,o,s,a=1;qn.length;)qn.length>a&&qn.sort(Jd),t=qn.shift(),a=qn.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,o=[],s=[],e.__P&&((r=rn({},n)).__v=n.__v+1,Re.vnode&&Re.vnode(r),Ep(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??Li(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,nh(o,r,s),r.__e!=i&&eh(r)));ja.__r=0}function th(t,e,r,n,i,o,s,a,c,p,m){var f,E,y,T,D,O,k=n&&n.__k||Zd,z=e.length;for(c=eb(r,e,k,c,z),f=0;f<z;f++)(y=r.__k[f])!=null&&(E=y.__i==-1?Xo:k[y.__i]||Xo,y.__i=f,O=Ep(t,y,E,i,o,s,a,c,p,m),T=y.__e,y.ref&&E.ref!=y.ref&&(E.ref&&_p(E.ref,null,y),m.push(y.ref,y.__c||T,y)),D==null&&T!=null&&(D=T),4&y.__u||E.__k===y.__k?c=rh(y,c,t):typeof y.type=="function"&&O!==void 0?c=O:T&&(c=T.nextSibling),y.__u&=-7);return r.__e=D,c}function eb(t,e,r,n,i){var o,s,a,c,p,m=r.length,f=m,E=0;for(t.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(c=o+E,(s=t.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?Wa(null,s,null,null,null):Ya(s)?Wa(Pr,{children:s},null,null,null):s.constructor==null&&s.__b>0?Wa(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(p=s.__i=tb(s,r,c,f))!=-1&&(f--,(a=r[p])&&(a.__u|=2)),a==null||a.__v==null?(p==-1&&(i>m?E--:i<m&&E++),typeof s.type!="function"&&(s.__u|=4)):p!=c&&(p==c-1?E--:p==c+1?E++:(p>c?E--:E++,s.__u|=4))):t.__k[o]=null;if(f)for(o=0;o<m;o++)(a=r[o])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=Li(a)),oh(a,a));return n}function rh(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=rh(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Li(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function tb(t,e,r,n){var i,o,s=t.key,a=t.type,c=e[r];if(c===null&&t.key==null||c&&s==c.key&&a==c.type&&(2&c.__u)==0)return r;if(n>(c!=null&&(2&c.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<e.length;){if(i>=0){if((c=e[i])&&(2&c.__u)==0&&s==c.key&&a==c.type)return i;i--}if(o<e.length){if((c=e[o])&&(2&c.__u)==0&&s==c.key&&a==c.type)return o;o++}}return-1}function zd(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||Z_.test(e)?r:r+"px"}function $a(t,e,r,n,i){var o,s;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||zd(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||zd(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Qd,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=gp,t.addEventListener(e,o?dp:mp,o)):t.removeEventListener(e,o?dp:mp,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function qd(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=gp++;else if(e.t<r.u)return;return r(Re.event?Re.event(e):e)}}}function Ep(t,e,r,n,i,o,s,a,c,p){var m,f,E,y,T,D,O,k,z,L,Z,be,J,ce,ae,me,Ue,Ce=e.type;if(e.constructor!=null)return null;128&r.__u&&(c=!!(32&r.__u),o=[a=e.__e=r.__e]),(m=Re.__b)&&m(e);e:if(typeof Ce=="function")try{if(k=e.props,z="prototype"in Ce&&Ce.prototype.render,L=(m=Ce.contextType)&&n[m.__c],Z=m?L?L.props.value:m.__:n,r.__c?O=(f=e.__c=r.__c).__=f.__E:(z?e.__c=f=new Ce(k,Z):(e.__c=f=new Or(k,Z),f.constructor=Ce,f.render=nb),L&&L.sub(f),f.props=k,f.state||(f.state={}),f.context=Z,f.__n=n,E=f.__d=!0,f.__h=[],f._sb=[]),z&&f.__s==null&&(f.__s=f.state),z&&Ce.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=rn({},f.__s)),rn(f.__s,Ce.getDerivedStateFromProps(k,f.__s))),y=f.props,T=f.state,f.__v=e,E)z&&Ce.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),z&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(z&&Ce.getDerivedStateFromProps==null&&k!==y&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(k,Z),!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(k,f.__s,Z)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(f.props=k,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(De){De&&(De.__=e)}),be=0;be<f._sb.length;be++)f.__h.push(f._sb[be]);f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(k,f.__s,Z),z&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(y,T,D)})}if(f.context=Z,f.props=k,f.__P=t,f.__e=!1,J=Re.__r,ce=0,z){for(f.state=f.__s,f.__d=!1,J&&J(e),m=f.render(f.props,f.state,f.context),ae=0;ae<f._sb.length;ae++)f.__h.push(f._sb[ae]);f._sb=[]}else do f.__d=!1,J&&J(e),m=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++ce<25);f.state=f.__s,f.getChildContext!=null&&(n=rn(rn({},n),f.getChildContext())),z&&!E&&f.getSnapshotBeforeUpdate!=null&&(D=f.getSnapshotBeforeUpdate(y,T)),me=m,m!=null&&m.type===Pr&&m.key==null&&(me=ih(m.props.children)),a=th(t,Ya(me)?me:[me],e,r,n,i,o,s,a,c,p),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),O&&(f.__E=f.__=null)}catch(De){if(e.__v=null,c||o!=null)if(De.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(Ue=o.length;Ue--;)yp(o[Ue]);else e.__e=r.__e,e.__k=r.__k;Re.__e(De,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=rb(r.__e,e,r,n,i,o,s,c,p);return(m=Re.diffed)&&m(e),128&e.__u?void 0:a}function nh(t,e,r){for(var n=0;n<r.length;n++)_p(r[n],r[++n],r[++n]);Re.__c&&Re.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){Re.__e(o,i.__v)}})}function ih(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Ya(t)?t.map(ih):rn({},t)}function rb(t,e,r,n,i,o,s,a,c){var p,m,f,E,y,T,D,O=r.props,k=e.props,z=e.type;if(z=="svg"?i="http://www.w3.org/2000/svg":z=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(p=0;p<o.length;p++)if((y=o[p])&&"setAttribute"in y==!!z&&(z?y.localName==z:y.nodeType==3)){t=y,o[p]=null;break}}if(t==null){if(z==null)return document.createTextNode(k);t=document.createElementNS(i,z,k.is&&k),a&&(Re.__m&&Re.__m(e,o),a=!1),o=null}if(z==null)O===k||a&&t.data==k||(t.data=k);else{if(o=o&&Ga.call(t.childNodes),O=r.props||Xo,!a&&o!=null)for(O={},p=0;p<t.attributes.length;p++)O[(y=t.attributes[p]).name]=y.value;for(p in O)if(y=O[p],p!="children"){if(p=="dangerouslySetInnerHTML")f=y;else if(!(p in k)){if(p=="value"&&"defaultValue"in k||p=="checked"&&"defaultChecked"in k)continue;$a(t,p,null,y,i)}}for(p in k)y=k[p],p=="children"?E=y:p=="dangerouslySetInnerHTML"?m=y:p=="value"?T=y:p=="checked"?D=y:a&&typeof y!="function"||O[p]===y||$a(t,p,y,O[p],i);if(m)a||f&&(m.__html==f.__html||m.__html==t.innerHTML)||(t.innerHTML=m.__html),e.__k=[];else if(f&&(t.innerHTML=""),th(e.type=="template"?t.content:t,Ya(E)?E:[E],e,r,n,z=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&Li(r,0),a,c),o!=null)for(p=o.length;p--;)yp(o[p]);a||(p="value",z=="progress"&&T==null?t.removeAttribute("value"):T!=null&&(T!==t[p]||z=="progress"&&!T||z=="option"&&T!=O[p])&&$a(t,p,T,O[p],i),p="checked",D!=null&&D!=t[p]&&$a(t,p,D,O[p],i))}return t}function _p(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){Re.__e(i,r)}}function oh(t,e,r){var n,i;if(Re.unmount&&Re.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||_p(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){Re.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&oh(n[i],e,r||typeof t.type!="function");r||yp(t.__e),t.__c=t.__=t.__e=void 0}function nb(t,e,r){return this.constructor(t,r)}function sh(t,e,r){var n,i,o,s;e==document&&(e=document.documentElement),Re.__&&Re.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],s=[],Ep(e,t=(!n&&r||e).__k=vp(Pr,null,[t]),i||Xo,Xo,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Ga.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,s),nh(o,t,s)}Ga=Zd.slice,Re={__e:function(t,e,r,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},Kd=0,hp=function(t){return t!=null&&t.constructor==null},Or.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=rn({},this.state),typeof t=="function"&&(t=t(rn({},r),this.props)),t&&rn(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Yd(this))},Or.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Yd(this))},Or.prototype.render=Pr,qn=[],Xd=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Jd=function(t,e){return t.__v.__b-e.__v.__b},ja.__r=0,Qd=/(PointerCapture)$|Capture$/i,gp=0,mp=qd(!1),dp=qd(!0),Q_=0;var Sp,qt,bp,ah,ch=0,gh=[],mt=Re,lh=mt.__b,uh=mt.__r,ph=mt.diffed,fh=mt.__c,mh=mt.unmount,dh=mt.__;function ib(t,e){mt.__h&&mt.__h(qt,t,ch||e),ch=0;var r=qt.__H||(qt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Ip(t,e){var r=ib(Sp++,7);return ab(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function ob(){for(var t;t=gh.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(za),t.__H.__h.forEach(wp),t.__H.__h=[]}catch(e){t.__H.__h=[],mt.__e(e,t.__v)}}mt.__b=function(t){qt=null,lh&&lh(t)},mt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),dh&&dh(t,e)},mt.__r=function(t){uh&&uh(t),Sp=0;var e=(qt=t.__c).__H;e&&(bp===qt?(e.__h=[],qt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(za),e.__h.forEach(wp),e.__h=[],Sp=0)),bp=qt},mt.diffed=function(t){ph&&ph(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(gh.push(e)!==1&&ah===mt.requestAnimationFrame||((ah=mt.requestAnimationFrame)||sb)(ob)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),bp=qt=null},mt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(za),r.__h=r.__h.filter(function(n){return!n.__||wp(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],mt.__e(n,r.__v)}}),fh&&fh(t,e)},mt.unmount=function(t){mh&&mh(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{za(n)}catch(i){e=i}}),r.__H=void 0,e&&mt.__e(e,r.__v))};var hh=typeof requestAnimationFrame=="function";function sb(t){var e,r=function(){clearTimeout(n),hh&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);hh&&(e=requestAnimationFrame(r))}function za(t){var e=qt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),qt=e}function wp(t){var e=qt;t.__c=t.__(),qt=e}function ab(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var cb=Symbol.for("preact-signals");function Cp(){if(Mi>1)Mi--;else{for(var t,e=!1;Jo!==void 0;){var r=Jo;for(Jo=void 0,Tp++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&vh(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Tp=0,Mi--,e)throw t}}var $e=void 0;var Jo=void 0,Mi=0,Tp=0,qa=0;function yh(t){if($e!==void 0){var e=t.n;if(e===void 0||e.t!==$e)return e={i:0,S:t,p:$e.s,n:void 0,t:$e,e:void 0,x:void 0,r:e},$e.s!==void 0&&($e.s.n=e),$e.s=e,t.n=e,32&$e.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=$e.s,e.n=void 0,$e.s.n=e,$e.s=e),e}}function dt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}dt.prototype.brand=cb;dt.prototype.h=function(){return!0};dt.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};dt.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};dt.prototype.subscribe=function(t){var e=this;return Tt(function(){var r=e.value,n=$e;$e=void 0;try{t(r)}finally{$e=n}})};dt.prototype.valueOf=function(){return this.value};dt.prototype.toString=function(){return this.value+""};dt.prototype.toJSON=function(){return this.value};dt.prototype.peek=function(){var t=$e;$e=void 0;try{return this.value}finally{$e=t}};Object.defineProperty(dt.prototype,"value",{get:function(){var t=yh(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Tp>100)throw new Error("Cycle detected");this.v=t,this.i++,qa++,Mi++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Cp()}}}});function ar(t){return new dt(t)}function vh(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Eh(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function _h(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function Bi(t){dt.call(this,void 0),this.x=t,this.s=void 0,this.g=qa-1,this.f=4}(Bi.prototype=new dt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===qa))return!0;if(this.g=qa,this.f|=1,this.i>0&&!vh(this))return this.f&=-2,!0;var t=$e;try{Eh(this),$e=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return $e=t,_h(this),this.f&=-2,!0};Bi.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}dt.prototype.S.call(this,t)};Bi.prototype.U=function(t){if(this.t!==void 0&&(dt.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Bi.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(Bi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=yh(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function xp(t){return new Bi(t)}function bh(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Mi++;var r=$e;$e=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Rp(t),n}finally{$e=r,Cp()}}}function Rp(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,bh(t)}function lb(t){if($e!==this)throw new Error("Out-of-order effect");_h(this),$e=t,this.f&=-2,8&this.f&&Rp(this),Cp()}function Qo(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Qo.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};Qo.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,bh(this),Eh(this),Mi++;var t=$e;return $e=this,lb.bind(this,t)};Qo.prototype.N=function(){2&this.f||(this.f|=2,this.o=Jo,Jo=this)};Qo.prototype.d=function(){this.f|=8,1&this.f||Rp(this)};function Tt(t){var e=new Qo(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Dp,Ap;function Ui(t,e){Re[t]=e.bind(null,Re[t]||function(){})}function Ka(t){Ap&&Ap(),Ap=t&&t.S()}function Sh(t){var e=this,r=t.data,n=pb(r);n.value=r;var i=Ip(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),c=i.value;a(),hp(c)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=c},xp(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}Sh.displayName="_st";Object.defineProperties(dt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Sh},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Ui("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof dt&&(r||(e.__np=r={}),r[i]=o,n[i]=o.peek())}}t(e)});Ui("__r",function(t,e){Ka();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return Tt(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Dp=n,Ka(r),t(e)});Ui("__e",function(t,e,r,n){Ka(),Dp=void 0,t(e,r,n)});Ui("diffed",function(t,e){Ka(),Dp=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var o=r.U;if(o)for(var s in o){var a=o[s];a!==void 0&&!(s in n)&&(a.d(),o[s]=void 0)}else r.U=o={};for(var c in n){var p=o[c],m=n[c];p===void 0?(p=ub(r,c,m,i),o[c]=p):p.o(m,i)}}}t(e)});function ub(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,o=ar(r);return{o:function(s,a){o.value=s,n=a},d:Tt(function(){var s=o.value.value;n[e]!==s&&(n[e]=s,i?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}Ui("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});Ui("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});Or.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function pb(t){return Ip(function(){return ar(t)},[])}var Xa=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var Ja=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var Np=class{id;mID;name;groupID;groupName;isSelected;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.name=e.name,this.groupID=e.groupID,this.groupName=e.groupName,this.isSelected=e.isSelected??!1}},Lr=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new Xa(r))??[],this.link=e.link,this.price=new Ja(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.selectedOptions=e.selectedOptions??[],this.effectivePrice=ar(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=ar(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new Np(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};var Dt=class{id;mID;name;status;ctg;options;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=ar(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=ar(this.selectedVariant)}get firstImageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(e=>e.isAvailable)??this.vars[0]}hasVariants(){return this.vars[0]!=null&&this.vars[0].name!=="Default Title"}setSelectedVariant(e){this.selectedOrFirstVariant.value=e}update(e){return this.id=e.id,this.mID=e.mID,this.name=e.name,this.status=e.status,this.ctg=e.ctg,this.imgs=e.imgs,this.desc=e.desc,this.sDesc=e.sDesc,this.link=e.link,this.slug=e.slug,this.quantity=e.quantity,this.meta=e.meta,this.category=e.category,this.videos=e.videos,this.reviews=e.reviews,this.options=e.options,this.portraitVideos=e.videos?.filter(r=>r.orientation==="PORTRAIT"),this.tags=e.tags,e.vars&&(this.vars=e.vars.map(r=>new Lr(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new At({id:this.id,mID:this.mID,vID:e.mID,vName:e.name,name:this.name,link:this.link,slug:this.slug,price:e.price.d,imageURL:e.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let e=this.selectedOrFirstVariant.value,r=e.price,n=this.name,i=this.category,o=this.variantImage??this.firstImageURL,s=this.meta,a=this.tags?.join(",")??"",c=this.reviews?.rating,p=this.reviews?.totalReviews,m=r.cmp&&r.cmp>r.d,f=ee(_({name:n},Mt("price",r.d,!0)),{image_url:o,meta:s,category:i,rating:c,reviews:p,tags:a});if(e.hasEffectivePrice()){let y=Mt("effective_price",e.effectivePrice.value,!0);Object.assign(f,y)}if(m){let y=r.cmp-r.d,T={discount_percent:(y/r.cmp*100).toFixed(0)};Object.assign(f,T),Object.assign(f,Mt("compare_price",r.cmp)),Object.assign(f,Mt("discount_price",y))}let E={name:e.name,quantity:e.quantity};return{product:f,variant:E}}};var Qa=class{id;alt;sources;items;durationMS;thumbnail;card;constructor(e={}){this.id=e.id,this.alt=e.alt,this.sources=e.sources?.sort((r,n)=>n.height-r.height),this.durationMS=e.durationMS,this.thumbnail=e.thumbnail,this.items=e.items?e.items.map(r=>new Dt(r)):[],this.card=e.card}};var Za=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(e={}){this.videos=e.videos?.map(r=>new Qa(r))??[],this.source=e.source,this.template=e.template,this.detailPopup=e.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=e.heading,this.showMuteButton=e.showMuteButton,this.slidePerViewCount=e.slidePerViewCount??4,this.autoPlay=e.autoPlay??"ON",this.footerContent=e.footerContent??"FIRST_ITEM"}};var Bt=gr(Ih());Bt.filters.define("default",function(t){return typeof t>"u"||t==null?"":mb(t)});+Bt.filters.define("max",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r>n?e:t});Bt.filters.define("min",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r<n?e:t});Bt.filters.define("fallback",(t,e)=>t==null||t===""?e:t);Bt.filters.define("manipulate_quantity",(t,e,r)=>{if(e??=1,r??=100,e>r)return S.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%r;return n<e?e:n});Bt.filters.define("apply_discount_perc",(t,e,r=1/0)=>{if(t=+t,isNaN(t))return S.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return S.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let n=t*e/100;return t-Math.min(r,n)});Bt.filters.define("apply_discount_fixed",(t,e)=>(t=+t,isNaN(t)?(S.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,t-e)));Bt.filters.define("currency",t=>(t=+t,isNaN(t)?(S.error("Need value as a number for `currency` filter"),NaN):pp(t)));Bt.defaultConfig.defaultFilter="default";Bt.defaultConfig.useWith=!0;Bt.defaultConfig.autoEscape=!1;var fb={'"':""","\\":"\","\n":"\\n"};function mb(t){return String(t).replace(/["\\\n]/g,e=>fb[e])}var ki=(t,e,r)=>{e=_({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return Bt.render(t,e)}catch(n){throw xe(n,"squirrelly-render",{extra:{template:t,values:e},triggerContext:r}),n}},Kn=(t,e,r)=>{let n=JSON.stringify(t),i=ki(n,e,r);try{return JSON.parse(i)}catch(o){throw xe(o,"variable-replacement",{extra:{before:t,after:i},triggerContext:r}),o}};var db="?from=cooee";function Zo(){return!!window.Shopify}function Th(){if(Zo())return window.Shopify.shop?.split(".")?.[0]}function Ch(t){let n=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function Fi(){return window.Shopify?.routes?.root??"/"}function Xn(t){return Fi()+t+db}var tc=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e()}else this.isLocked=!1}},rc=class t{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){if(e=`__cooee_${e}_lock__`,"locks"in navigator&&!this.isInAppBrowser())return navigator.locks.request(e,r);let n=!1,i=0,o=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(S.debug(`Lock retry ${i}`),n=await this.acquire(e,o),!n);)await this.sleep(t.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,o)}}static isInAppBrowser(){let e=navigator.userAgent||"",r=/iPhone|iPad|iPod/i.test(e),n=/(FBAV|FBAN|Instagram)/i.test(e);return r&&n}static async acquire(e,r){let n=Date.now(),i=localStorage.getItem(e),o=i?JSON.parse(i):null;if(o&&n<=o.expiry)return!1;let s={owner:r,expiry:n+t.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(s)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(S.debug(`${r}: Lock acquired!`),!0):(S.debug(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(e,r){let n=localStorage.getItem(e);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(e),S.debug(`${r}: Lock released`)):S.debug(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}};var ge=class t{static CURRENT;token;items;total_price;original_total_price;items_subtotal_price;currency;item_count;attributes;cart_level_discount_applications;total_discount;lock=new tc;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Me.set(le.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await yt.get(le.ID),r=await Me.get(le.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){S.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};S.debug("Updating Shopify cart with attributes:",n);let i=Xn("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();S.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.total_discount=e.total_discount,ye.get().currencyCode=this.currency,S.log("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,itemsSubtotalPrice:this.items_subtotal_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return S.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){S.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},o=n.selling_plan_allocation?.selling_plan;if(!o){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){S.debug("Not fetching cart");return}S.debug("Fetching cart");let r=Xn("cart.js"),n=await(await fetch(r)).json();this.update(n)}};var nc=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL}};var Op=class{enabled;constructor(e){this.enabled=e.enabled}},Pp=class extends Op{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},ic=class{productQuantity;constructor(e){e??={},this.productQuantity=new Pp(e.productQuantity)}};var Kt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new Un(e.bg)),e.br&&(this.br=new Kr(e.br)),e.shd&&(this.shd=new Po(e.shd)),e.spc&&(this.spc=new Xr(e.spc)),this.trf=new kn(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return qe[this.t]}get click(){return this.clc}},qe=(L=>(L[L.IMAGE=1]="IMAGE",L[L.TEXT=2]="TEXT",L[L.BUTTON=3]="BUTTON",L[L.FLEXBOX=4]="FLEXBOX",L[L.MULTI_COLUMN=5]="MULTI_COLUMN",L[L.CHECKBOX=6]="CHECKBOX",L[L.PRODUCTS=11]="PRODUCTS",L[L.PRODUCT=12]="PRODUCT",L[L.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",L[L.PRODUCT_TITLE=14]="PRODUCT_TITLE",L[L.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",L[L.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",L[L.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",L[L.PRODUCT_RATING=19]="PRODUCT_RATING",L[L.EMAIL_INPUT=51]="EMAIL_INPUT",L[L.PHONE_INPUT=52]="PHONE_INPUT",L[L.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",L[L.CAROUSEL=62]="CAROUSEL",L[L.SHAPE=100]="SHAPE",L))(qe||{});var Jn=class extends Kt{constructor(e){super(e)}};var nn=class extends Kt{src;constructor(e){super(e),this.src=e.src}};var Mr=class extends Kt{typo;constructor(e){super(e);let r=_(_({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new ct(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var En=class extends Mr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var oc=class extends Kt{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var Hi=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0}start(e,r){let n=new Date;e===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let a=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),p=Math.floor(s%(1e3*60*60)/(1e3*60)),m=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:c,minutes:p,seconds:m})},1e3);return i}};var Vi=class extends Mr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new Hi(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var sc=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new Ye(e.c??{})}get text(){return this.txt}get color(){return this.c}};var _n=class extends Mr{ph;constructor(e){super(e),this.ph=new sc(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var $i=class extends _n{constructor(e){e??={},super(e)}};var Wi=class extends _n{};var ji=class extends _n{};var Gi=class extends nn{};var Qn=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(Qn||{});var ac=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}};var es=class extends Kt{gvt;max;cover;anim;embedded;position;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new ac(e.anim),this.embedded=e.embedded,this.position=e.position??1,this.spc||(this.spc=new Xr({pl:N.IN_APP_DEFAULT_PADDING,pr:N.IN_APP_DEFAULT_PADDING,pt:N.IN_APP_DEFAULT_PADDING,pb:N.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}};var cc=class extends es{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new oc(e.cont),this.mob=new es(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new nn(r)):r.t===2?this.elems.push(new En(r)):r.t===3?this.elems.push(new En(r)):r.t===100?this.elems.push(new Jn(r)):r.t===51?this.elems.push(new Wi(r)):r.t===52?this.elems.push(new ji(r)):r.t===61?this.elems.push(new Vi(r)):r.t===15||r.t===16?this.elems.push(new $i(r)):r.t===13&&this.elems.push(new Gi(r))})}getStylesForWrapper(){if(this.cover)return{};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:"50%",left:0,transform:"translateY(-50%)"}:e={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},e.overflow="visible",e}getFlexStylesForContainer(){let e={display:"flex",flexDirection:"row"},r,n;return this.gvt===1?(r="flex-start",n="flex-start"):this.gvt===2?(r="center",n="flex-start"):this.gvt===3?(r="flex-end",n="flex-start"):this.gvt===4?(r="flex-start",n="center"):this.gvt===6?(r="flex-end",n="center"):this.gvt===7?(r="flex-start",n="flex-end"):this.gvt===8?(r="center",n="flex-end"):this.gvt===9?(r="flex-end",n="flex-end"):(r="center",n="center"),e.alignItems=n,e.justifyContent=r,e.overflow="visible",e}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}};var Yi=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??"row",this.wrap=e.wrap??"nowrap",this.jc=e.jc??"flex-start",this.ai=e.ai??"flex-start",this.scroll=e.scroll}};var lc=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex}};var uc=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??"100%",this.h=e.h??"auto",this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH}};var pc=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Xr(e.spc),e.size&&(this.size=new uc(e.size)),e.bg&&(this.bg=new Un(e.bg)),e.br&&(this.br=new Kr(e.br)),e.typo&&(this.typo=new ct(e.typo)),e.lout&&(this.lout=new lc(e.lout)),e.flex&&(this.flex=new Yi(e.flex))}},zi=class{sm;lg;constructor(e){e??={},this.sm=new pc(e.sm),this.lg=new pc(e.lg)}};var vt=class{t;style;hide;when;clc;l;constructor(e,r){r??={},this.t=e,this.style=new zi(r.style),this.hide=r.hide,this.l=r.l,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return qe[this.t]}};var Et=class extends vt{text;constructor(e,r){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(r??2,e),e??={},this.text=e.text}};var Zn=class extends Et{constructor(e,r){super(e,r??3)}};var qi=class extends vt{value;constructor(e){super(6,e),e??={},this.value=e.value}};var Ki=class extends Et{showChips;optionsConfig;constructor(e=15,r){super(r,e),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var fc=class extends vt{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new Ye(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var xh=gr(Bn());var Lp=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new Ye(e.color)}},Mp=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new Ye(e.color)}},ts=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(e){e??={},this.navigation=new Mp(e.navigation),this.pagination=new Lp(e.pagination),this.autoplay=e.autoplay,this.slidesPerView=e.slidesPerView??1,this.maxInRow=e.maxInRow??e.slidesPerView??4,this.gap=e.gap??0}},mc=class extends vt{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=Xt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new ts(e.conf),this.allowedTypes=e.allowedTypes}};var dc=class extends Et{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new Hi(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var bn=class extends vt{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=Xt.getParsedElement(r);n&&this.elems.push(n)})}};var ei=class extends vt{src;sm;lg;constructor(e,r){super(r??1,e),e&&this.update(e)}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg}};var Xt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=t.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new Et(e);case 3:return new Zn(e);case 6:return new qi(e);case 11:return new hc(e);case 12:return new Sn(e);case 61:return new dc(e);case 4:return new bn(e);case 1:return new ei(e);case 13:return new ei(e,13);case 14:return new Et(e,14);case 15:case 16:return new Ki(e.t,e);case 18:return new Zn(e,18);case 62:return new mc(e);case 19:return new fc(e);default:xh.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}};var Sn=class extends vt{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=Xt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new qi(e.cBox)),this.elems.push(new ei(e.img,13));let r=new Et(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new Et(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let i=new Et(e.compareAt);i.text="{{ product.compare_price }}",i.hide=!e.show?.price,e.compareAt||(i.style=new zi(n.style),i.style.lg.typo=new ct(ee(_({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new ct(ee(_({},i.style.sm.typo),{td:"line-through"})));let o=new bn({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Xt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new Ki(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new Zn(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new Et(e.symbol))}};var hc=class extends vt{conf;prod;constructor(e){super(11,e),e??={},this.conf=new Bp(e.conf),this.prod=new Sn(e.prod)}};var gc=class extends ts{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},Bp=class{lg;sm;constructor(e){e??={},this.lg=new gc(e.lg),this.sm=new gc(e.sm)}};var yc=class extends bn{constructor(e){super(e)}};var Xi=class{cont;elems=[];constructor(e){e=e??{},this.cont=new yc(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=Xt.getParsedElement(e);return r&&this.elems.push(r),r}};function vc(t,e){return hb(t,e,0,5)}function hb(t,e,r=0,n=50){if(e){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let i of e){if(i.t===t)return i;let o="elems"in i?i.elems:[];if(o?.length>0){let s=vc(t,o);if(s)return s}}}}var Br=class{constructor(e,r){this._startTime=e;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e==="test"&&(e="test-"+this.startTime.getTime().toString()),N.IN_APP_WRAPPER_NAME+"-"+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e}closeInApp(e,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=_({eventName:e,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(e,r){this.inputFields.push({id:e,type:r,isValid:!1})}updateValidation(e,r){this.inputFields.forEach(n=>{if(n.id===e){n.isValid=r;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return S.error("Invalid range: min should be less than or equal to max."),e;if(e>=r&&e<=n)return e;let i=e%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}};var Up=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Ao.EXCLUSION}isABTesting(){return this.contentType===Ao.ABTESTING}isSingleContent(){return this.contentType===Ao.SINGLE}},rs=class{videoConfig;savingsBarConfig;constructor(e){this.update(e)}update(e){e??={},e.videoConfig&&(this.videoConfig=new Za(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new Js(e.savingsBarConfig))}},Ct=class extends Up{contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;entryAnimation;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=ar({});constructor(e){super(e),this.id=e.id,this.currency=ye.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new Xi(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??"NONE",this.embeddedItems=e.embeddedItems?.map(r=>new At(r)),this.items=e.items?.map(r=>new Dt(r))??[],this.nonMutableItems=e.items?.map(r=>new Dt(r))??[],this.collections=e.collections?.map(r=>new nc(r))??[],this.discount=e.discount,this.placement=e.placement,this.customerData=e.customerData,this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new ic(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new qs(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new Xs(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new Gs(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Dt(e.bundleFrom)),e.content&&(this.content=new rs(e.content))}shouldDelay(){return this.delay>0}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===yr.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===js.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===js.PAGE_EMBED}isProgressBar(){return this.objective===yr.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===yr.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===yr.CART_RECOVERY}isProductPromotion(){return this.objective===yr.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===Ul.COLLECTION}isBYOB(){return this.objective===yr.BYOB}isStickyATC(){return this.objective===yr.STICKY_ATC}isShoppableVideo(){return this.objective===yr.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===yr.SAVINGS_BAR}processPopup(e){let r=this.items[0],n={},i={};if(r){let a=r.selectedOrFirstVariant.value;n=ee(_(_({name:r.name,id:r.mID,link:r.link,vID:a.mID,image:r.variantImage},Mt("price",a.price.d)),Mt("comparePrice",a.price.cmp)),{quantity:r.quantity}),i={quantity:a.quantity}}let o={productCount:ge.getCurrent().item_count},s=ki(JSON.stringify(e),{product:n,variant:i,cart:o,discount:this.discount,customer:this.customerData},new Br(new Date,this));return r&&(s=s.replace(new RegExp(N.PLACEHOLDER_IMAGE,"gi"),r.variantImage??r.firstImageURL)),new cc(JSON.parse(s))}calculateDiscountData(e,r){let n=qr.sum(e,s=>s.selectedOrFirstVariant.value.price.d),i=qr.sum(e,s=>{let a=s.selectedOrFirstVariant.value.price;return a.cmp??a.d}),o={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(o);return}if(er.BXGY===this.discount.type&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,o.discountPercentage,!0),o.discountAmount=o.actualPrice-qr.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([er.UNIQUE_FLAT_ITEMS,er.STATIC,er.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===er.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)o.discountAmount=o.actualPrice-this.discount.values[0],o.discountPercentage=o.discountAmount/o.actualPrice*100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===er.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,c)=>c.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,o.discountAmount=s.selectedOrFirstVariant.value.price.d,o.discountPercentage=o.discountAmount/o.actualPrice*100}o.discountedPrice=o.actualPrice-o.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(o)}getPrivateAttributesForLineItem(){return Ge.get().skipItemAttribute?{}:{[N.VIA]:"Cooee",[N.CAMPAIGN_ATTRIBUTE]:this.shortID,[N.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Ge.get().skipItemAttribute?[]:[{key:N.VIA,value:"Cooee"},{key:N.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:N.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){if(vc(62,this.widget?.elems))return!0;let r=vc(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){return`Engagement(id=${this.shortID})`}getCartMagicVariables(){let e=ge.getCurrent(),r=qr.sum(e.items,n=>n.discounts?.reduce((i,o)=>i+(o.amount??0),0)??0);return _(_(_(_({productCount:e.item_count,product_count:e.item_count},Mt("amount",e.total_price/100)),Mt("originalAmount",e.original_total_price/100)),Mt("total_line_items_discount",r/100)),Mt("total_discount",e.total_discount/100))}updateEffectivePrice(e,r,n=!1){let i=ye.get().getCurrentItem();e.forEach(o=>{let s=o.selectedOrFirstVariant.value,a=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=a.d;else{let c=a.d*r/100;s.effectivePrice.value=a.d-c}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:$d(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,Mt(n,e[n]))}),r}};function yb(t,e){return e={exports:{}},t(e,e.exports),e.exports}var vb=Sb,Eb=Ib,_b=xb,kr=[],lr=[],bb=typeof Uint8Array<"u"?Uint8Array:Array,kp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ti=0,Rh=kp.length;ti<Rh;++ti)kr[ti]=kp[ti],lr[kp.charCodeAt(ti)]=ti;var ti,Rh;lr[45]=62;lr[95]=63;function jh(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Sb(t){var e=jh(t),r=e[0],n=e[1];return(r+n)*3/4-n}function wb(t,e,r){return(e+r)*3/4-r}function Ib(t){var e,r=jh(t),n=r[0],i=r[1],o=new bb(wb(t,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=lr[t.charCodeAt(c)]<<18|lr[t.charCodeAt(c+1)]<<12|lr[t.charCodeAt(c+2)]<<6|lr[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=lr[t.charCodeAt(c)]<<2|lr[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=lr[t.charCodeAt(c)]<<10|lr[t.charCodeAt(c+1)]<<4|lr[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Tb(t){return kr[t>>18&63]+kr[t>>12&63]+kr[t>>6&63]+kr[t&63]}function Cb(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Tb(n));return i.join("")}function xb(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Cb(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(kr[e>>2]+kr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(kr[e>>10]+kr[e>>4&63]+kr[e<<2&63]+"=")),i.join("")}var Fp={byteLength:vb,toByteArray:Eb,fromByteArray:_b};var Rb=function(e,r,n,i,o){var s,a,c=o*8-i-1,p=(1<<c)-1,m=p>>1,f=-7,E=n?o-1:0,y=n?-1:1,T=e[r+E];for(E+=y,s=T&(1<<-f)-1,T>>=-f,f+=c;f>0;s=s*256+e[r+E],E+=y,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=i;f>0;a=a*256+e[r+E],E+=y,f-=8);if(s===0)s=1-m;else{if(s===p)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-m}return(T?-1:1)*a*Math.pow(2,s-i)},Ab=function(e,r,n,i,o,s){var a,c,p,m=s*8-o-1,f=(1<<m)-1,E=f>>1,y=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:s-1,D=i?1:-1,O=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+E>=1?r+=y/p:r+=y*Math.pow(2,1-E),r*p>=2&&(a++,p/=2),a+E>=f?(c=0,a=f):a+E>=1?(c=(r*p-1)*Math.pow(2,o),a=a+E):(c=r*Math.pow(2,E-1)*Math.pow(2,o),a=0));o>=8;e[n+T]=c&255,T+=D,c/=256,o-=8);for(a=a<<o|c,m+=o;m>0;e[n+T]=a&255,T+=D,a/=256,m-=8);e[n+T-D]|=O*128},Ji={read:Rb,write:Ab},bc=yb(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=k,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.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 i(){try{var h=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(h,l),h.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(h){if(h>n)throw new RangeError('The value "'+h+'" is invalid for option "size"');var l=new Uint8Array(h);return Object.setPrototypeOf(l,s.prototype),l}function s(h,l,u){if(typeof h=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(h)}return a(h,l,u)}s.poolSize=8192;function a(h,l,u){if(typeof h=="string")return f(h,l);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h));if(je(h,ArrayBuffer)||h&&je(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(je(h,SharedArrayBuffer)||h&&je(h.buffer,SharedArrayBuffer)))return T(h,l,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var v=h.valueOf&&h.valueOf();if(v!=null&&v!==h)return s.from(v,l,u);var x=D(h);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return s.from(h[Symbol.toPrimitive]("string"),l,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h))}s.from=function(h,l,u){return a(h,l,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function p(h,l,u){return c(h),h<=0?o(h):l!==void 0?typeof u=="string"?o(h).fill(l,u):o(h).fill(l):o(h)}s.alloc=function(h,l,u){return p(h,l,u)};function m(h){return c(h),o(h<0?0:O(h)|0)}s.allocUnsafe=function(h){return m(h)},s.allocUnsafeSlow=function(h){return m(h)};function f(h,l){if((typeof l!="string"||l==="")&&(l="utf8"),!s.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var u=z(h,l)|0,v=o(u),x=v.write(h,l);return x!==u&&(v=v.slice(0,x)),v}function E(h){for(var l=h.length<0?0:O(h.length)|0,u=o(l),v=0;v<l;v+=1)u[v]=h[v]&255;return u}function y(h){if(je(h,Uint8Array)){var l=new Uint8Array(h);return T(l.buffer,l.byteOffset,l.byteLength)}return E(h)}function T(h,l,u){if(l<0||h.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<l+(u||0))throw new RangeError('"length" is outside of buffer bounds');var v;return l===void 0&&u===void 0?v=new Uint8Array(h):u===void 0?v=new Uint8Array(h,l):v=new Uint8Array(h,l,u),Object.setPrototypeOf(v,s.prototype),v}function D(h){if(s.isBuffer(h)){var l=O(h.length)|0,u=o(l);return u.length===0||h.copy(u,0,0,l),u}if(h.length!==void 0)return typeof h.length!="number"||Oe(h.length)?o(0):E(h);if(h.type==="Buffer"&&Array.isArray(h.data))return E(h.data)}function O(h){if(h>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return h|0}function k(h){return+h!=h&&(h=0),s.alloc(+h)}s.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==s.prototype},s.compare=function(l,u){if(je(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),je(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(l)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===u)return 0;for(var v=l.length,x=u.length,P=0,j=Math.min(v,x);P<j;++P)if(l[P]!==u[P]){v=l[P],x=u[P];break}return v<x?-1:x<v?1:0},s.isEncoding=function(l){switch(String(l).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}},s.concat=function(l,u){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return s.alloc(0);var v;if(u===void 0)for(u=0,v=0;v<l.length;++v)u+=l[v].length;var x=s.allocUnsafe(u),P=0;for(v=0;v<l.length;++v){var j=l[v];if(je(j,Uint8Array))P+j.length>x.length?s.from(j).copy(x,P):Uint8Array.prototype.set.call(x,j,P);else if(s.isBuffer(j))j.copy(x,P);else throw new TypeError('"list" argument must be an Array of Buffers');P+=j.length}return x};function z(h,l){if(s.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||je(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(h));var u=h.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&u===0)return 0;for(var x=!1;;)switch(l){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return wt(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return We(h).length;default:if(x)return v?-1:wt(h).length;l=(""+l).toLowerCase(),x=!0}}s.byteLength=z;function L(h,l,u){var v=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,l>>>=0,u<=l))return"";for(h||(h="utf8");;)switch(h){case"hex":return W(this,l,u);case"utf8":case"utf-8":return Ke(this,l,u);case"ascii":return A(this,l,u);case"latin1":case"binary":return R(this,l,u);case"base64":return De(this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,l,u);default:if(v)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),v=!0}}s.prototype._isBuffer=!0;function Z(h,l,u){var v=h[l];h[l]=h[u],h[u]=v}s.prototype.swap16=function(){var l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<l;u+=2)Z(this,u,u+1);return this},s.prototype.swap32=function(){var l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<l;u+=4)Z(this,u,u+3),Z(this,u+1,u+2);return this},s.prototype.swap64=function(){var l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<l;u+=8)Z(this,u,u+7),Z(this,u+1,u+6),Z(this,u+2,u+5),Z(this,u+3,u+4);return this},s.prototype.toString=function(){var l=this.length;return l===0?"":arguments.length===0?Ke(this,0,l):L.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(l){if(!s.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:s.compare(this,l)===0},s.prototype.inspect=function(){var l="",u=e.INSPECT_MAX_BYTES;return l=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(l+=" ... "),"<Buffer "+l+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(l,u,v,x,P){if(je(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),!s.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(l));if(u===void 0&&(u=0),v===void 0&&(v=l?l.length:0),x===void 0&&(x=0),P===void 0&&(P=this.length),u<0||v>l.length||x<0||P>this.length)throw new RangeError("out of range index");if(x>=P&&u>=v)return 0;if(x>=P)return-1;if(u>=v)return 1;if(u>>>=0,v>>>=0,x>>>=0,P>>>=0,this===l)return 0;for(var j=P-x,pe=v-u,Se=Math.min(j,pe),he=this.slice(x,P),ke=l.slice(u,v),Ve=0;Ve<Se;++Ve)if(he[Ve]!==ke[Ve]){j=he[Ve],pe=ke[Ve];break}return j<pe?-1:pe<j?1:0};function be(h,l,u,v,x){if(h.length===0)return-1;if(typeof u=="string"?(v=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Oe(u)&&(u=x?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(x)return-1;u=h.length-1}else if(u<0)if(x)u=0;else return-1;if(typeof l=="string"&&(l=s.from(l,v)),s.isBuffer(l))return l.length===0?-1:J(h,l,u,v,x);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(h,l,u):Uint8Array.prototype.lastIndexOf.call(h,l,u):J(h,[l],u,v,x);throw new TypeError("val must be string, number or Buffer")}function J(h,l,u,v,x){var P=1,j=h.length,pe=l.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(h.length<2||l.length<2)return-1;P=2,j/=2,pe/=2,u/=2}function Se(mr,zr){return P===1?mr[zr]:mr.readUInt16BE(zr*P)}var he;if(x){var ke=-1;for(he=u;he<j;he++)if(Se(h,he)===Se(l,ke===-1?0:he-ke)){if(ke===-1&&(ke=he),he-ke+1===pe)return ke*P}else ke!==-1&&(he-=he-ke),ke=-1}else for(u+pe>j&&(u=j-pe),he=u;he>=0;he--){for(var Ve=!0,it=0;it<pe;it++)if(Se(h,he+it)!==Se(l,it)){Ve=!1;break}if(Ve)return he}return-1}s.prototype.includes=function(l,u,v){return this.indexOf(l,u,v)!==-1},s.prototype.indexOf=function(l,u,v){return be(this,l,u,v,!0)},s.prototype.lastIndexOf=function(l,u,v){return be(this,l,u,v,!1)};function ce(h,l,u,v){u=Number(u)||0;var x=h.length-u;v?(v=Number(v),v>x&&(v=x)):v=x;var P=l.length;v>P/2&&(v=P/2);for(var j=0;j<v;++j){var pe=parseInt(l.substr(j*2,2),16);if(Oe(pe))return j;h[u+j]=pe}return j}function ae(h,l,u,v){return Ne(wt(l,h.length-u),h,u,v)}function me(h,l,u,v){return Ne(at(l),h,u,v)}function Ue(h,l,u,v){return Ne(We(l),h,u,v)}function Ce(h,l,u,v){return Ne(we(l,h.length-u),h,u,v)}s.prototype.write=function(l,u,v,x){if(u===void 0)x="utf8",v=this.length,u=0;else if(v===void 0&&typeof u=="string")x=u,v=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(v)?(v=v>>>0,x===void 0&&(x="utf8")):(x=v,v=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var P=this.length-u;if((v===void 0||v>P)&&(v=P),l.length>0&&(v<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");for(var j=!1;;)switch(x){case"hex":return ce(this,l,u,v);case"utf8":case"utf-8":return ae(this,l,u,v);case"ascii":case"latin1":case"binary":return me(this,l,u,v);case"base64":return Ue(this,l,u,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ce(this,l,u,v);default:if(j)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),j=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function De(h,l,u){return l===0&&u===h.length?Fp.fromByteArray(h):Fp.fromByteArray(h.slice(l,u))}function Ke(h,l,u){u=Math.min(h.length,u);for(var v=[],x=l;x<u;){var P=h[x],j=null,pe=P>239?4:P>223?3:P>191?2:1;if(x+pe<=u){var Se,he,ke,Ve;switch(pe){case 1:P<128&&(j=P);break;case 2:Se=h[x+1],(Se&192)===128&&(Ve=(P&31)<<6|Se&63,Ve>127&&(j=Ve));break;case 3:Se=h[x+1],he=h[x+2],(Se&192)===128&&(he&192)===128&&(Ve=(P&15)<<12|(Se&63)<<6|he&63,Ve>2047&&(Ve<55296||Ve>57343)&&(j=Ve));break;case 4:Se=h[x+1],he=h[x+2],ke=h[x+3],(Se&192)===128&&(he&192)===128&&(ke&192)===128&&(Ve=(P&15)<<18|(Se&63)<<12|(he&63)<<6|ke&63,Ve>65535&&Ve<1114112&&(j=Ve))}}j===null?(j=65533,pe=1):j>65535&&(j-=65536,v.push(j>>>10&1023|55296),j=56320|j&1023),v.push(j),x+=pe}return kt(v)}var Ze=4096;function kt(h){var l=h.length;if(l<=Ze)return String.fromCharCode.apply(String,h);for(var u="",v=0;v<l;)u+=String.fromCharCode.apply(String,h.slice(v,v+=Ze));return u}function A(h,l,u){var v="";u=Math.min(h.length,u);for(var x=l;x<u;++x)v+=String.fromCharCode(h[x]&127);return v}function R(h,l,u){var v="";u=Math.min(h.length,u);for(var x=l;x<u;++x)v+=String.fromCharCode(h[x]);return v}function W(h,l,u){var v=h.length;(!l||l<0)&&(l=0),(!u||u<0||u>v)&&(u=v);for(var x="",P=l;P<u;++P)x+=Gt[h[P]];return x}function F(h,l,u){for(var v=h.slice(l,u),x="",P=0;P<v.length-1;P+=2)x+=String.fromCharCode(v[P]+v[P+1]*256);return x}s.prototype.slice=function(l,u){var v=this.length;l=~~l,u=u===void 0?v:~~u,l<0?(l+=v,l<0&&(l=0)):l>v&&(l=v),u<0?(u+=v,u<0&&(u=0)):u>v&&(u=v),u<l&&(u=l);var x=this.subarray(l,u);return Object.setPrototypeOf(x,s.prototype),x};function V(h,l,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+l>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||V(l,u,this.length);for(var x=this[l],P=1,j=0;++j<u&&(P*=256);)x+=this[l+j]*P;return x},s.prototype.readUintBE=s.prototype.readUIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||V(l,u,this.length);for(var x=this[l+--u],P=1;u>0&&(P*=256);)x+=this[l+--u]*P;return x},s.prototype.readUint8=s.prototype.readUInt8=function(l,u){return l=l>>>0,u||V(l,1,this.length),this[l]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(l,u){return l=l>>>0,u||V(l,2,this.length),this[l]|this[l+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(l,u){return l=l>>>0,u||V(l,2,this.length),this[l]<<8|this[l+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(l,u){return l=l>>>0,u||V(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(l,u){return l=l>>>0,u||V(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},s.prototype.readIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||V(l,u,this.length);for(var x=this[l],P=1,j=0;++j<u&&(P*=256);)x+=this[l+j]*P;return P*=128,x>=P&&(x-=Math.pow(2,8*u)),x},s.prototype.readIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||V(l,u,this.length);for(var x=u,P=1,j=this[l+--x];x>0&&(P*=256);)j+=this[l+--x]*P;return P*=128,j>=P&&(j-=Math.pow(2,8*u)),j},s.prototype.readInt8=function(l,u){return l=l>>>0,u||V(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},s.prototype.readInt16LE=function(l,u){l=l>>>0,u||V(l,2,this.length);var v=this[l]|this[l+1]<<8;return v&32768?v|4294901760:v},s.prototype.readInt16BE=function(l,u){l=l>>>0,u||V(l,2,this.length);var v=this[l+1]|this[l]<<8;return v&32768?v|4294901760:v},s.prototype.readInt32LE=function(l,u){return l=l>>>0,u||V(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},s.prototype.readInt32BE=function(l,u){return l=l>>>0,u||V(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},s.prototype.readFloatLE=function(l,u){return l=l>>>0,u||V(l,4,this.length),Ji.read(this,l,!0,23,4)},s.prototype.readFloatBE=function(l,u){return l=l>>>0,u||V(l,4,this.length),Ji.read(this,l,!1,23,4)},s.prototype.readDoubleLE=function(l,u){return l=l>>>0,u||V(l,8,this.length),Ji.read(this,l,!0,52,8)},s.prototype.readDoubleBE=function(l,u){return l=l>>>0,u||V(l,8,this.length),Ji.read(this,l,!1,52,8)};function ie(h,l,u,v,x,P){if(!s.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>x||l<P)throw new RangeError('"value" argument is out of bounds');if(u+v>h.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(l,u,v,x){if(l=+l,u=u>>>0,v=v>>>0,!x){var P=Math.pow(2,8*v)-1;ie(this,l,u,v,P,0)}var j=1,pe=0;for(this[u]=l&255;++pe<v&&(j*=256);)this[u+pe]=l/j&255;return u+v},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(l,u,v,x){if(l=+l,u=u>>>0,v=v>>>0,!x){var P=Math.pow(2,8*v)-1;ie(this,l,u,v,P,0)}var j=v-1,pe=1;for(this[u+j]=l&255;--j>=0&&(pe*=256);)this[u+j]=l/pe&255;return u+v},s.prototype.writeUint8=s.prototype.writeUInt8=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,1,255,0),this[u]=l&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,2,65535,0),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,2,65535,0),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,4,4294967295,0),this[u+3]=l>>>24,this[u+2]=l>>>16,this[u+1]=l>>>8,this[u]=l&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,4,4294967295,0),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4},s.prototype.writeIntLE=function(l,u,v,x){if(l=+l,u=u>>>0,!x){var P=Math.pow(2,8*v-1);ie(this,l,u,v,P-1,-P)}var j=0,pe=1,Se=0;for(this[u]=l&255;++j<v&&(pe*=256);)l<0&&Se===0&&this[u+j-1]!==0&&(Se=1),this[u+j]=(l/pe>>0)-Se&255;return u+v},s.prototype.writeIntBE=function(l,u,v,x){if(l=+l,u=u>>>0,!x){var P=Math.pow(2,8*v-1);ie(this,l,u,v,P-1,-P)}var j=v-1,pe=1,Se=0;for(this[u+j]=l&255;--j>=0&&(pe*=256);)l<0&&Se===0&&this[u+j+1]!==0&&(Se=1),this[u+j]=(l/pe>>0)-Se&255;return u+v},s.prototype.writeInt8=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,1,127,-128),l<0&&(l=255+l+1),this[u]=l&255,u+1},s.prototype.writeInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,2,32767,-32768),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,2,32767,-32768),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,4,2147483647,-2147483648),this[u]=l&255,this[u+1]=l>>>8,this[u+2]=l>>>16,this[u+3]=l>>>24,u+4},s.prototype.writeInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||ie(this,l,u,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4};function de(h,l,u,v,x,P){if(u+v>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function Xe(h,l,u,v,x){return l=+l,u=u>>>0,x||de(h,l,u,4),Ji.write(h,l,u,v,23,4),u+4}s.prototype.writeFloatLE=function(l,u,v){return Xe(this,l,u,!0,v)},s.prototype.writeFloatBE=function(l,u,v){return Xe(this,l,u,!1,v)};function rt(h,l,u,v,x){return l=+l,u=u>>>0,x||de(h,l,u,8),Ji.write(h,l,u,v,52,8),u+8}s.prototype.writeDoubleLE=function(l,u,v){return rt(this,l,u,!0,v)},s.prototype.writeDoubleBE=function(l,u,v){return rt(this,l,u,!1,v)},s.prototype.copy=function(l,u,v,x){if(!s.isBuffer(l))throw new TypeError("argument should be a Buffer");if(v||(v=0),!x&&x!==0&&(x=this.length),u>=l.length&&(u=l.length),u||(u=0),x>0&&x<v&&(x=v),x===v||l.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(v<0||v>=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),l.length-u<x-v&&(x=l.length-u+v);var P=x-v;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,v,x):Uint8Array.prototype.set.call(l,this.subarray(v,x),u),P},s.prototype.fill=function(l,u,v,x){if(typeof l=="string"){if(typeof u=="string"?(x=u,u=0,v=this.length):typeof v=="string"&&(x=v,v=this.length),x!==void 0&&typeof x!="string")throw new TypeError("encoding must be a string");if(typeof x=="string"&&!s.isEncoding(x))throw new TypeError("Unknown encoding: "+x);if(l.length===1){var P=l.charCodeAt(0);(x==="utf8"&&P<128||x==="latin1")&&(l=P)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(u<0||this.length<u||this.length<v)throw new RangeError("Out of range index");if(v<=u)return this;u=u>>>0,v=v===void 0?this.length:v>>>0,l||(l=0);var j;if(typeof l=="number")for(j=u;j<v;++j)this[j]=l;else{var pe=s.isBuffer(l)?l:s.from(l,x),Se=pe.length;if(Se===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(j=0;j<v-u;++j)this[j+u]=pe[j%Se]}return this};var nt=/[^+/0-9A-Za-z-_]/g;function St(h){if(h=h.split("=")[0],h=h.trim().replace(nt,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function wt(h,l){l=l||1/0;for(var u,v=h.length,x=null,P=[],j=0;j<v;++j){if(u=h.charCodeAt(j),u>55295&&u<57344){if(!x){if(u>56319){(l-=3)>-1&&P.push(239,191,189);continue}else if(j+1===v){(l-=3)>-1&&P.push(239,191,189);continue}x=u;continue}if(u<56320){(l-=3)>-1&&P.push(239,191,189),x=u;continue}u=(x-55296<<10|u-56320)+65536}else x&&(l-=3)>-1&&P.push(239,191,189);if(x=null,u<128){if((l-=1)<0)break;P.push(u)}else if(u<2048){if((l-=2)<0)break;P.push(u>>6|192,u&63|128)}else if(u<65536){if((l-=3)<0)break;P.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((l-=4)<0)break;P.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return P}function at(h){for(var l=[],u=0;u<h.length;++u)l.push(h.charCodeAt(u)&255);return l}function we(h,l){for(var u,v,x,P=[],j=0;j<h.length&&!((l-=2)<0);++j)u=h.charCodeAt(j),v=u>>8,x=u%256,P.push(x),P.push(v);return P}function We(h){return Fp.toByteArray(St(h))}function Ne(h,l,u,v){for(var x=0;x<v&&!(x+u>=l.length||x>=h.length);++x)l[x+u]=h[x];return x}function je(h,l){return h instanceof l||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===l.name}function Oe(h){return h!==h}var Gt=function(){for(var h="0123456789abcdef",l=new Array(256),u=0;u<16;++u)for(var v=u*16,x=0;x<16;++x)l[v+x]=h[u]+h[x];return l}()}),Ae=bc.Buffer;bc.SlowBuffer;bc.INSPECT_MAX_BYTES;bc.kMaxLength;var jp=function(e,r){return jp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},jp(e,r)};function Sc(t,e){jp(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var ni=function(t){Sc(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),Qe=function(t){Sc(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function Ec(t){return t&&t.Math==Math&&t}function Gh(){return Ec(typeof globalThis=="object"&&globalThis)||Ec(typeof window=="object"&&window)||Ec(typeof self=="object"&&self)||Ec(typeof global=="object"&&global)||Function("return this")()}function Db(){var t=Gh();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Nb=function(e){var r=Db()?"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(r);for(var n=Ae.alloc(e),i=0;i<e;++i)n[i]=Math.floor(Math.random()*256);return n},Ob=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Ae.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(Ae.alloc(e))}:Nb}},Yh=Ob();function Pb(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Yp(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Lb(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Mb(t){return ss(t)&&Object.prototype.toString.call(t)==="[object Date]"}function ss(t){return typeof t=="object"&&t!==null}function wc(t,e){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function _c(t){if(ArrayBuffer.isView(t))return Ae.from(t.buffer,t.byteOffset,t.byteLength);if(Pb(t))return Ae.from(t);throw new Qe("Must use either Buffer or TypedArray")}var Bb=/^(?:[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,zh=function(t){return typeof t=="string"&&Bb.test(t)},Gp=function(t){if(!zh(t))throw new Qe('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return Ae.from(e,"hex")},Ah=function(t,e){return e===void 0&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")};var K1=Math.pow(2,63)-1,X1=-Math.pow(2,63),Ub=Math.pow(2,53),kb=-Math.pow(2,53);var qh=4;var ii=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new Qe("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=Ae.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=Ae.from(e,"binary"):Array.isArray(e)?this.buffer=Ae.from(e):this.buffer=_c(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Qe("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Qe("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new Qe("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=Ae.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(e,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+e.length){var n=Ae.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(_c(e),r),this.position=r+e.byteLength>this.position?r+e.length:this.position):typeof e=="string"&&(this.buffer.write(e,r,e.length,"binary"),this.position=r+e.length>this.position?r+e.length:this.position)},t.prototype.read=function(e,r){return r=r&&r>0?r:this.position,this.buffer.slice(e,e+r)},t.prototype.value=function(e){return e=!!e,e&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new Dh(this.buffer.slice(0,this.position));throw new ni('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=Ae.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=Ae.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=Gp(e.$uuid)),!n)throw new Qe("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===qh?new Dh(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(ii.prototype,"_bsontype",{value:"Binary"});var Hp=16,Dh=function(t){Sc(e,t);function e(r){var n=this,i,o;if(r==null)i=e.generate();else if(r instanceof e)i=Ae.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===Hp)i=_c(r);else if(typeof r=="string")i=Gp(r);else throw new Qe("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 n=t.call(this,i,qh)||this,n.__id=o,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Ah(r))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(r){if(r===void 0&&(r=!0),e.cacheHexString&&this.__id)return this.__id;var n=Ah(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new ii(this.id,ii.SUBTYPE_UUID)},e.generate=function(){var r=Yh(Hp);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ae.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?zh(r):Yp(r)?r.length!==Hp?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=Gp(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(ii),Ic=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t}();Object.defineProperty(Ic.prototype,"_bsontype",{value:"Code"});function Fb(t){return ss(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var is=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");o.length===2&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(is.prototype,"_bsontype",{value:"DBRef"});var cr=void 0;try{cr=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 Nh=65536,Hb=1<<24,Zi=Nh*Nh,Kh=Zi*Zi,Oh=Kh/2,Ph={},Lh={},oe=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(e>>>=0,(o=0<=e&&e<256)&&(i=Lh[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),o&&(Lh[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(i=Ph[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(Ph[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=Kh)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Oh)return t.MIN_VALUE;if(e+1>=Oh)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%Zi|0,e/Zi|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),p=parseInt(e.substring(a,a+c),n);if(c<8){var m=t.fromNumber(Math.pow(n,c));s=s.mul(m).add(t.fromNumber(p))}else s=s.mul(o),s=s.add(t.fromNumber(p))}return s.unsigned=r,s},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return ss(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,p=e.low&65535,m=0,f=0,E=0,y=0;return y+=o+p,E+=y>>>16,y&=65535,E+=i+c,f+=E>>>16,E&=65535,f+=n+a,m+=f>>>16,f&=65535,m+=r+s,m&=65535,t.fromBits(E<<16|y,m<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(cr){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?cr.div_u:cr.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,cr.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Math.pow(2,a-48),p=t.fromNumber(n),m=p.mul(e);m.isNegative()||m.gt(i);)n-=c,p=t.fromNumber(n,this.unsigned),m=p.mul(e);p.isZero()&&(p=t.ONE),o=o.add(p),i=i.sub(m)}return o},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),cr){var r=(this.unsigned?cr.rem_u:cr.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,cr.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),cr){var r=cr.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,cr.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,p=e.low>>>16,m=e.low&65535,f=0,E=0,y=0,T=0;return T+=s*m,y+=T>>>16,T&=65535,y+=o*m,E+=y>>>16,y&=65535,y+=s*p,E+=y>>>16,y&=65535,E+=i*m,f+=E>>>16,E&=65535,E+=o*p,f+=E>>>16,E&=65535,E+=s*c,f+=E>>>16,E&=65535,f+=n*m+i*p+o*c+s*a,f&=65535,t.fromBits(y<<16|T,f<<16|E,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*Zi+(this.low>>>0):this.high*Zi+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),p=s.sub(c.mul(o)).toInt()>>>0,m=p.toString(e);if(s=c,s.isZero())return m+a;for(;m.length<6;)m="0"+m;a=""+m+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(Hb),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(oe.prototype,"__isLong__",{value:!0});Object.defineProperty(oe.prototype,"_bsontype",{value:"Long"});var Vb=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,$b=/^(\+|-)?(Infinity|inf)$/i,Wb=/^(\+|-)?NaN$/i,ns=6111,Vp=-6176,Mh=6176,jb=34,$p=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Bh=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Uh=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Gb=/^([-+])?(\d+)?$/,Yb=31,kh=16383,zb=30,qb=31;function Fh(t){return!isNaN(parseInt(t,10))}function Kb(t){var e=oe.fromNumber(1e9),r=oe.fromNumber(0);if(!t.parts[0]&&!t.parts[1]&&!t.parts[2]&&!t.parts[3])return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new oe(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Xb(t,e){if(!t&&!e)return{high:oe.fromNumber(0),low:oe.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new oe(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new oe(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),c=n.multiply(i),p=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new oe(a.getLowBits(),0).add(c).add(p.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),p=a.shiftLeft(32).add(new oe(p.getLowBits(),0)),{high:s,low:p}}function Jb(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,o=e.low>>>0;if(i<o)return!0}return!1}function Qi(t,e){throw new Qe('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var zp=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Yp(e)){if(e.byteLength!==16)throw new Qe("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Qe("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,o=0,s=0,a=0,c=0,p=0,m=[0],f=0,E=0,y=0,T=0,D=0,O=0,k=new oe(0,0),z=new oe(0,0),L=0,Z=0;if(e.length>=7e3)throw new Qe(""+e+" not a valid Decimal128 string");var be=e.match(Vb),J=e.match($b),ce=e.match(Wb);if(!be&&!J&&!ce||e.length===0)throw new Qe(""+e+" not a valid Decimal128 string");if(be){var ae=be[2],me=be[4],Ue=be[5],Ce=be[6];me&&Ce===void 0&&Qi(e,"missing exponent power"),me&&ae===void 0&&Qi(e,"missing exponent base"),me===void 0&&(Ue||Ce)&&Qi(e,"missing e before exponent")}if((e[Z]==="+"||e[Z]==="-")&&(r=e[Z++]==="-"),!Fh(e[Z])&&e[Z]!=="."){if(e[Z]==="i"||e[Z]==="I")return new t(Ae.from(r?Bh:Uh));if(e[Z]==="N")return new t(Ae.from($p))}for(;Fh(e[Z])||e[Z]===".";){if(e[Z]==="."){n&&Qi(e,"contains multiple periods"),n=!0,Z=Z+1;continue}f<34&&(e[Z]!=="0"||i)&&(i||(p=s),i=!0,m[E++]=parseInt(e[Z],10),f=f+1),i&&(a=a+1),n&&(c=c+1),s=s+1,Z=Z+1}if(n&&!s)throw new Qe(""+e+" not a valid Decimal128 string");if(e[Z]==="e"||e[Z]==="E"){var De=e.substr(++Z).match(Gb);if(!De||!De[2])return new t(Ae.from($p));D=parseInt(De[0],10),Z=Z+De[0].length}if(e[Z])return new t(Ae.from($p));if(y=0,!f)y=0,T=0,m[0]=0,a=1,f=1,o=0;else if(T=f-1,o=a,o!==1)for(;m[p+o-1]===0;)o=o-1;for(D<=c&&c-D>16384?D=Vp:D=D-c;D>ns;){if(T=T+1,T-y>jb){var Ke=m.join("");if(Ke.match(/^0+$/)){D=ns;break}Qi(e,"overflow")}D=D-1}for(;D<Vp||f<a;){if(T===0&&o<f){D=Vp,o=0;break}if(f<a?a=a-1:T=T-1,D<ns)D=D+1;else{var Ke=m.join("");if(Ke.match(/^0+$/)){D=ns;break}Qi(e,"overflow")}}if(T-y+1<o){var Ze=s;n&&(p=p+1,Ze=Ze+1),r&&(p=p+1,Ze=Ze+1);var kt=parseInt(e[p+T+1],10),A=0;if(kt>=5&&(A=1,kt===5)){for(A=m[T]%2===1?1:0,O=p+T+2;O<Ze;O++)if(parseInt(e[O],10)){A=1;break}}if(A){for(var R=T;R>=0;R--)if(++m[R]>9&&(m[R]=0,R===0))if(D<ns)D=D+1,m[R]=1;else return new t(Ae.from(r?Bh:Uh))}}if(k=oe.fromNumber(0),z=oe.fromNumber(0),o===0)k=oe.fromNumber(0),z=oe.fromNumber(0);else if(T-y<17){var R=y;for(z=oe.fromNumber(m[R++]),k=new oe(0,0);R<=T;R++)z=z.multiply(oe.fromNumber(10)),z=z.add(oe.fromNumber(m[R]))}else{var R=y;for(k=oe.fromNumber(m[R++]);R<=T-17;R++)k=k.multiply(oe.fromNumber(10)),k=k.add(oe.fromNumber(m[R]));for(z=oe.fromNumber(m[R++]);R<=T;R++)z=z.multiply(oe.fromNumber(10)),z=z.add(oe.fromNumber(m[R]))}var W=Xb(k,oe.fromString("100000000000000000"));W.low=W.low.add(z),Jb(W.low,z)&&(W.high=W.high.add(oe.fromNumber(1))),L=D+Mh;var F={low:oe.fromNumber(0),high:oe.fromNumber(0)};W.high.shiftRightUnsigned(49).and(oe.fromNumber(1)).equals(oe.fromNumber(1))?(F.high=F.high.or(oe.fromNumber(3).shiftLeft(61)),F.high=F.high.or(oe.fromNumber(L).and(oe.fromNumber(16383).shiftLeft(47))),F.high=F.high.or(W.high.and(oe.fromNumber(0x7fffffffffff)))):(F.high=F.high.or(oe.fromNumber(L&16383).shiftLeft(49)),F.high=F.high.or(W.high.and(oe.fromNumber(562949953421311)))),F.low=W.low,r&&(F.high=F.high.or(oe.fromString("9223372036854775808")));var V=Ae.alloc(16);return Z=0,V[Z++]=F.low.low&255,V[Z++]=F.low.low>>8&255,V[Z++]=F.low.low>>16&255,V[Z++]=F.low.low>>24&255,V[Z++]=F.low.high&255,V[Z++]=F.low.high>>8&255,V[Z++]=F.low.high>>16&255,V[Z++]=F.low.high>>24&255,V[Z++]=F.high.low&255,V[Z++]=F.high.low>>8&255,V[Z++]=F.high.low>>16&255,V[Z++]=F.high.low>>24&255,V[Z++]=F.high.high&255,V[Z++]=F.high.high>>8&255,V[Z++]=F.high.high>>16&255,V[Z++]=F.high.high>>24&255,new t(V)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,a,c={parts:[0,0,0,0]},p,m,f=[];o=0;var E=this.bytes,y=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,T=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,D=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,O=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24;o=0;var k={low:new oe(y,T),high:new oe(D,O)};k.high.lessThan(oe.ZERO)&&f.push("-");var z=O>>26&Yb;if(z>>3===3){if(z===zb)return f.join("")+"Infinity";if(z===qb)return"NaN";e=O>>15&kh,a=8+(O>>14&1)}else a=O>>14&7,e=O>>17&kh;var L=e-Mh;if(c.parts[0]=(O&16383)+((a&15)<<14),c.parts[1]=D,c.parts[2]=T,c.parts[3]=y,c.parts[0]===0&&c.parts[1]===0&&c.parts[2]===0&&c.parts[3]===0)s=!0;else for(m=3;m>=0;m--){var Z=0,be=Kb(c);if(c=be.quotient,Z=be.rem.low,!!Z)for(p=8;p>=0;p--)n[m*9+p]=Z%10,Z=Math.floor(Z/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var J=r-1+L;if(J>=34||J<=-7||L>0){if(r>34)return f.push("".concat(0)),L>0?f.push("E+".concat(L)):L<0&&f.push("E".concat(L)),f.join("");f.push("".concat(n[o++])),r=r-1,r&&f.push(".");for(var i=0;i<r;i++)f.push("".concat(n[o++]));f.push("E"),J>0?f.push("+".concat(J)):f.push("".concat(J))}else if(L>=0)for(var i=0;i<r;i++)f.push("".concat(n[o++]));else{var ce=r+L;if(ce>0)for(var i=0;i<ce;i++)f.push("".concat(n[o++]));else f.push("0");for(f.push(".");ce++<0;)f.push("0");for(var i=0;i<r-Math.max(ce-1,0);i++)f.push("".concat(n[o++]))}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(zp.prototype,"_bsontype",{value:"Decimal128"});var Tc=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.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()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t}();Object.defineProperty(Tc.prototype,"_bsontype",{value:"Double"});var Cc=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(Cc.prototype,"_bsontype",{value:"Int32"});var qp=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(qp.prototype,"_bsontype",{value:"MaxKey"});var Kp=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(Kp.prototype,"_bsontype",{value:"MinKey"});var Qb=new RegExp("^[0-9a-fA-F]{24}$"),ri=null,Ur=Symbol("id"),ht=function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new Qe("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=Ae.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Ur]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Ur]=r instanceof Ae?r:_c(r);else if(typeof r=="string")if(r.length===12){var n=Ae.from(r);if(n.byteLength===12)this[Ur]=n;else throw new Qe("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Qb.test(r))this[Ur]=Ae.from(r,"hex");else throw new Qe("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Qe("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Ur]},set:function(e){this[Ur]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=Ae.alloc(12);return n.writeUInt32BE(e,0),ri===null&&(ri=Yh(5)),n[4]=ri[0],n[5]=ri[1],n[6]=ri[2],n[7]=ri[3],n[8]=ri[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[Ur][11]===e[Ur][11]&&this[Ur].equals(e[Ur]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Yp(this.id))return e===Ae.prototype.toString.call(this.id,"latin1");if(typeof e=="string"&&t.isValid(e)&&e.length===24)return e.toLowerCase()===this.toHexString();if(typeof e=="string"&&t.isValid(e)&&e.length===12)return Ae.from(e).equals(this.id);if(typeof e=="object"&&"toHexString"in e&&typeof e.toHexString=="function"){var r=e.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},t.prototype.getTimestamp=function(){var e=new Date,r=this.id.readUInt32BE(0);return e.setTime(Math.floor(r)*1e3),e},t.createPk=function(){return new t},t.createFromTime=function(e){var r=Ae.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new Qe("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Ae.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(Math.random()*16777215),t}();Object.defineProperty(ht.prototype,"generate",{value:wc(function(t){return ht.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(ht.prototype,"getInc",{value:wc(function(){return ht.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(ht.prototype,"get_inc",{value:wc(function(){return ht.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(ht,"get_inc",{value:wc(function(){return ht.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(ht.prototype,"_bsontype",{value:"ObjectID"});function Zb(t){return t.split("").sort().join("")}var os=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Zb(r??""),this.pattern.indexOf("\0")!==-1)throw new ni("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new ni("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new ni("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new Qe("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(os.prototype,"_bsontype",{value:"BSONRegExp"});var Xp=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(Xp.prototype,"_bsontype",{value:"Symbol"});var eS=oe,Xh=function(t){Sc(e,t);function e(r,n){var i=this;return i instanceof e?(oe.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:ss(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(oe.fromInt(r,!0))},e.fromNumber=function(r){return new e(oe.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(oe.fromString(r,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(r){return new e(r.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=oe.MAX_UNSIGNED_VALUE,e}(eS);function tS(t){return ss(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var Jh=2147483647,Qh=-2147483648,Zh=9223372036854776e3,eg=-9223372036854776e3,rS={$oid:ht,$binary:ii,$uuid:ii,$symbol:Xp,$numberInt:Cc,$numberDecimal:zp,$numberDouble:Tc,$numberLong:oe,$minKey:Kp,$maxKey:qp,$regex:os,$regularExpression:os,$timestamp:Xh};function tg(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Qh&&t<=Jh)return new Cc(t);if(t>=eg&&t<=Zh)return oe.fromNumber(t)}return new Tc(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(f){return f.startsWith("$")&&t[f]!=null}),n=0;n<r.length;n++){var i=rS[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var o=t.$date,s=new Date;return e.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):oe.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&e.relaxed&&s.setTime(o),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=tg(t.$scope)),Ic.fromExtendedJSON(t)}if(Fb(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof is)return c;var p=Object.keys(c).filter(function(f){return f.startsWith("$")}),m=!0;if(p.forEach(function(f){["$ref","$id","$db"].indexOf(f)===-1&&(m=!1)}),m)return is.fromExtendedJSON(c)}return t}function nS(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return wn(r,e)}finally{e.seenObjects.pop()}})}function Hh(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function wn(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(k){return k.obj===t});if(r!==-1){var n=e.seenObjects.map(function(k){return k.propertyName}),i=n.slice(0,r).map(function(k){return"".concat(k," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(k){return"".concat(k," -> ")}).join(""),a=n[n.length-1],c=" ".repeat(i.length+o.length/2),p="-".repeat(s.length+(o.length+a.length)/2-1);throw new Qe(`Converting circular structure to EJSON:
|
|
34
40
|
`+" ".concat(i).concat(o).concat(s).concat(a,`
|
|
35
|
-
`)+" ".concat(c,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Cb(t,e);if(t===void 0)return null;if(t instanceof Date||ib(t)){var f=t.getTime(),m=f>-1&&f<2534023188e5;return e.legacy?e.relaxed&&m?{$date:t.getTime()}:{$date:zh(t)}:e.relaxed&&m?{$date:zh(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var v=t>=og&&t<=ig,y=t>=ag&&t<=sg;if(v)return{$numberInt:t.toString()};if(y)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||nb(t)){var T=t.flags;if(T===void 0){var R=t.toString().match(/[gimuy]*$/);R&&(T=R[0])}var A=new Zo(t.source,T);return A.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Rb(t,e):t}var xb={Binary:function(t){return new jn(t.value(),t.sub_type)},Code:function(t){return new Sc(t.code,t.scope)},DBRef:function(t){return new Qo(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Jp(t.bytes)},Double:function(t){return new bc(t.value)},Int32:function(t){return new wc(t.value)},Long:function(t){return ee.fromBits(t.low!=null?t.low:t.low_,t.low!=null?t.high:t.high_,t.low!=null?t.unsigned:t.unsigned_)},MaxKey:function(){return new Qp},MinKey:function(){return new Zp},ObjectID:function(t){return new et(t)},ObjectId:function(t){return new et(t)},BSONRegExp:function(t){return new Zo(t.pattern,t.options)},Symbol:function(t){return new ef(t.value)},Timestamp:function(t){return ng.fromBits(t.low,t.high)}};function Rb(t,e){if(t==null||typeof t!="object")throw new Wn("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=an(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{e.seenObjects.pop()}}return n}else if(Ib(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var a=xb[t._bsontype];if(!a)throw new He("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return r==="Code"&&s.scope?s=new Sc(s.code,an(s.scope,e)):r==="DBRef"&&s.oid&&(s=new Qo(an(s.collection,e),an(s.oid,e),an(s.db,e),an(s.fields,e))),s.toExtendedJSON(e)}else throw new Wn("_bsontype must be a string, but was: "+typeof r)}var qh;(function(t){function e(o,s){var a=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(o,function(c,p){if(c.indexOf("\0")!==-1)throw new Wn("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(c)));return cg(p,a)})}t.parse=e;function r(o,s,a,c){a!=null&&typeof a=="object"&&(c=a,a=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(c=s,s=void 0,a=0);var p=Object.assign({relaxed:!0,legacy:!1},c,{seenObjects:[{propertyName:"(root)",obj:null}]}),f=an(o,p);return JSON.stringify(f,s,a)}t.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}t.serialize=n;function i(o,s){return s=s||{},e(JSON.stringify(o),s)}t.deserialize=i})(qh||(qh={}));var Kh,Xh=Qh();Xh.Map?Kh=Xh.Map:Kh=function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var fM=ee.fromNumber(sb),mM=ee.fromNumber(ab);var zp=new Uint8Array(8),dM=new DataView(zp.buffer,zp.byteOffset,zp.byteLength);var Ab=1024*1024*17,hM=Ee.alloc(Ab);var cn=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(e){e=e||{},this.triggerID=e.id||e.triggerID,this.nudgeID=e.nudgeID,this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.contentID=e.contentID,this.variation=e.variation,this.props=e.props,this.objective=e.objective,this.onsiteDeliveryType=e.onsiteDeliveryType,this.holdout=e.holdout}};var ye=class{constructor(e,r={},n,i){this.name=e;this.properties=r;this.id=i?new et(i):new et,this.occurred=new Date,n&&(this.trigger=new cn(n)),this.newEvent=!i}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale};var at=class{static SWIPER_CSS="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";static injectScriptURL(e,r){if(!e)return;let n=document.createElement("script");n.id=r??"",n.src=e,n.type="module",document.head.appendChild(n)}static injectRawScript(e){if(!e)return;let r=document.createElement("script");r.id="cooee-app-script",r.innerHTML=e,document.head.appendChild(r)}static injectRawCSS(e,r=document.head){if(!e)return;let n=document.createElement("style");n.textContent=e,r.appendChild(n)}static injectSwiperCSS(e=document.head){this.injectStylesheet(this.SWIPER_CSS,e)}static injectStylesheet(e,r=document.head){if(!e)return;let n=document.createElement("link");n.rel="stylesheet",n.href=e,e===this.SWIPER_CSS&&(n.crossOrigin="anonymous",n.onload=i=>{let s=i.currentTarget?.sheet?.cssRules;if(s){for(let a of s)if(a.type==CSSRule.FONT_FACE_RULE){let c=e.split("/"),p=c.slice(0,c.length-1).join("/"),f=a.cssText;f=f.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${p}/$4")`);let m=document.createElement("style");m.appendChild(document.createTextNode(f)),document.head.appendChild(m)}}}),r.appendChild(n)}static async loadSwiperScript(){window.CooeeSDK.Swiper||(window.CooeeSDK.Swiper=(await import("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs")).Swiper)}};var Db="2.0.4",mf=500,lg="user-agent",Yi="",ug="?",Ac="function",pn="undefined",zi="object",df="string",Ct="browser",$r="cpu",Cr="device",or="engine",Jt="os",ji="result",k="name",O="type",U="vendor",H="version",xt="architecture",us="major",M="model",cs="console",ie="mobile",xe="tablet",je="smarttv",Ir="wearable",Ic="xr",ls="embedded",ts="inapp",yf="brands",Yn="formFactors",vf="fullVersionList",Gi="platform",Ef="platformVersion",Oc="bitness",fn="sec-ch-ua",Nb=fn+"-full-version-list",Ob=fn+"-arch",Pb=fn+"-"+Oc,Lb=fn+"-form-factors",Mb=fn+"-"+ie,Bb=fn+"-"+M,Ig=fn+"-"+Gi,Ub=Ig+"-version",Tg=[yf,vf,ie,M,Gi,Ef,xt,Yn,Oc],Tc="Amazon",$i="Apple",pg="ASUS",fg="BlackBerry",Gn="Google",mg="Huawei",tf="Lenovo",dg="Honor",Cc="LG",rf="Microsoft",nf="Motorola",of="Nvidia",hg="OnePlus",sf="OPPO",rs="Samsung",gg="Sharp",ns="Sony",af="Xiaomi",cf="Zebra",yg="Chrome",vg="Chromium",ln="Chromecast",Rc="Edge",is="Firefox",os="Opera",lf="Facebook",Eg="Sogou",Wi="Mobile ",ss=" Browser",hf="Windows",kb=typeof window!==pn,Rt=kb&&window.navigator?window.navigator:void 0,un=Rt&&Rt.userAgentData?Rt.userAgentData:void 0,Fb=function(t,e){var r={},n=e;if(!Dc(e)){n={};for(var i in e)for(var o in e[i])n[o]=e[i][o].concat(n[o]?n[o]:[])}for(var s in t)r[s]=n[s]&&n[s].length%2===0?n[s].concat(t[s]):t[s];return r},Pc=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},gf=function(t,e){if(typeof t===zi&&t.length>0){for(var r in t)if(Wr(e)==Wr(t[r]))return!0;return!1}return Ki(t)?Wr(e)==Wr(t):!1},Dc=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Dc(t[r]):!1)},Ki=function(t){return typeof t===df},uf=function(t){if(t){for(var e=[],r=qi(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Nc(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Nc(r[n]);return e}},Wr=function(t){return Ki(t)?t.toLowerCase():t},pf=function(t){return Ki(t)?qi(/[^\d\.]/g,t).split(".")[0]:void 0},jr=function(t){for(var e in t){var r=t[e];typeof r==zi&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},qi=function(t,e){return Ki(e)?e.replace(t,Yi):e},as=function(t){return qi(/\\?\"/g,t)},Nc=function(t,e){if(Ki(t))return t=qi(/^\s\s*/,t),typeof e===pn?t:t.substring(0,mf)},ff=function(t,e){if(!(!t||!e))for(var r=0,n,i,o,s,a,c;r<e.length&&!a;){var p=e[r],f=e[r+1];for(n=i=0;n<p.length&&!a&&p[n];)if(a=p[n++].exec(t),a)for(o=0;o<f.length;o++)c=a[++i],s=f[o],typeof s===zi&&s.length>0?s.length===2?typeof s[1]==Ac?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===Ac&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=c?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=c?s[1].call(this,c,s[2]):void 0:s.length==3?this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=c?s[3].apply(this,[c.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=c||void 0;r+=2}},Tr=function(t,e){for(var r in e)if(typeof e[r]===zi&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(gf(e[r][n],t))return r===ug?void 0:r}else if(gf(e[r],t))return r===ug?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},_g={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},Sg={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Hb={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},bg={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[H,[k,Wi+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[H,[k,Rc+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[H,[k,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[k,H],[/opios[\/ ]+([\w\.]+)/i],[H,[k,os+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[H,[k,os+" GX"]],[/\bopr\/([\w\.]+)/i],[H,[k,os]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[H,[k,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[H,[k,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[k,H],[/quark(?:pc)?\/([-\w\.]+)/i],[H,[k,"Quark"]],[/\bddg\/([\w\.]+)/i],[H,[k,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[H,[k,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[H,[k,"WeChat"]],[/konqueror\/([\w\.]+)/i],[H,[k,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[H,[k,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[H,[k,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[H,[k,"Smart "+tf+ss]],[/(avast|avg)\/([\w\.]+)/i],[[k,/(.+)/,"$1 Secure"+ss],H],[/\bfocus\/([\w\.]+)/i],[H,[k,is+" Focus"]],[/\bopt\/([\w\.]+)/i],[H,[k,os+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[H,[k,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[H,[k,"Dolphin"]],[/coast\/([\w\.]+)/i],[H,[k,os+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[H,[k,"MIUI"+ss]],[/fxios\/([\w\.-]+)/i],[H,[k,Wi+is]],[/\bqihoobrowser\/?([\w\.]*)/i],[H,[k,"360"]],[/\b(qq)\/([\w\.]+)/i],[[k,/(.+)/,"$1Browser"],H],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[k,/(.+)/,"$1"+ss],H],[/samsungbrowser\/([\w\.]+)/i],[H,[k,rs+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[H,[k,Eg+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[k,Eg+" Mobile"],H],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[k,H],[/(lbbrowser|rekonq)/i],[k],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[H,k],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[k,lf],H,[O,ts]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[k,H,[O,ts]],[/\bgsa\/([\w\.]+) .*safari\//i],[H,[k,"GSA"],[O,ts]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[H,[k,"TikTok"],[O,ts]],[/\[(linkedin)app\]/i],[k,[O,ts]],[/(chromium)[\/ ]([-\w\.]+)/i],[k,H],[/headlesschrome(?:\/([\w\.]+)| )/i],[H,[k,yg+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[H,[k,Rc+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[k,yg+" WebView"],H],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[H,[k,"Android"+ss]],[/chrome\/([\w\.]+) mobile/i],[H,[k,Wi+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[k,H],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[H,[k,Wi+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[k,Wi+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[H,k],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[k,[H,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[k,H],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[k,Wi+is],H],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[k,"Netscape"],H],[/(wolvic|librewolf)\/([\w\.]+)/i],[k,H],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[H,[k,is+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[k,[H,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[k,[H,/[^\d\.]+./,Yi]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[xt,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[xt,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[xt,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[xt,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[xt,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[xt,/ower/,Yi,Wr]],[/ sun4\w[;\)]/i],[[xt,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[xt,Wr]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[M,[U,rs],[O,xe]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[M,[U,rs],[O,ie]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[M,[U,$i],[O,ie]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[M,[U,$i],[O,xe]],[/(macintosh);/i],[M,[U,$i]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[M,[U,gg],[O,ie]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[M,[U,dg],[O,xe]],[/honor([-\w ]+)[;\)]/i],[M,[U,dg],[O,ie]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[M,[U,mg],[O,xe]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[M,[U,mg],[O,ie]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[M,/_/g," "],[U,af],[O,xe]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[M,/_/g," "],[U,af],[O,ie]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[M,[U,hg],[O,ie]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[M,[U,sf],[O,ie]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[M,[U,Tr,{OnePlus:["203","304","403","404","413","415"],"*":sf}],[O,xe]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[M,[U,"BLU"],[O,ie]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[M,[U,"Vivo"],[O,ie]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[M,[U,"Realme"],[O,ie]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[M,[U,tf],[O,xe]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[M,[U,tf],[O,ie]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[M,[U,nf],[O,ie]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[M,[U,nf],[O,xe]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[M,[U,Cc],[O,xe]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[M,[U,Cc],[O,ie]],[/(nokia) (t[12][01])/i],[U,M,[O,xe]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[M,/_/g," "],[O,ie],[U,"Nokia"]],[/(pixel (c|tablet))\b/i],[M,[U,Gn],[O,xe]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[M,[U,Gn],[O,ie]],[/(google) (pixelbook( go)?)/i],[U,M],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[M,[U,ns],[O,ie]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[M,"Xperia Tablet"],[U,ns],[O,xe]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[M,[U,Tc],[O,xe]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[M,/(.+)/g,"Fire Phone $1"],[U,Tc],[O,ie]],[/(playbook);[-\w\),; ]+(rim)/i],[M,U,[O,xe]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[M,[U,fg],[O,ie]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[M,[U,pg],[O,xe]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[M,[U,pg],[O,ie]],[/(nexus 9)/i],[M,[U,"HTC"],[O,xe]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[U,[M,/_/g," "],[O,ie]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[M,[U,"TCL"],[O,xe]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[M,[U,"TCL"],[O,ie]],[/(itel) ((\w+))/i],[[U,Wr],M,[O,Tr,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[M,[U,"Acer"],[O,xe]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[M,[U,"Meizu"],[O,ie]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[M,[U,"Ulefone"],[O,ie]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[M,[U,"Energizer"],[O,ie]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[M,[U,"Cat"],[O,ie]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[M,[U,"Smartfren"],[O,ie]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[M,[U,"Nothing"],[O,ie]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[M,[U,"Archos"],[O,xe]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[M,[U,"Archos"],[O,ie]],[/; (n159v)/i],[M,[U,"HMD"],[O,ie]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[U,M,[O,xe]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[U,M,[O,ie]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[U,M,[O,xe]],[/(surface duo)/i],[M,[U,rf],[O,xe]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[M,[U,"Fairphone"],[O,ie]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[M,[U,of],[O,xe]],[/(sprint) (\w+)/i],[U,M,[O,ie]],[/(kin\.[onetw]{3})/i],[[M,/\./g," "],[U,rf],[O,ie]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[M,[U,cf],[O,xe]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[M,[U,cf],[O,ie]],[/smart-tv.+(samsung)/i],[U,[O,je]],[/hbbtv.+maple;(\d+)/i],[[M,/^/,"SmartTV"],[U,rs],[O,je]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[U,M,[O,je]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[U,Cc],[O,je]],[/(apple) ?tv/i],[U,[M,$i+" TV"],[O,je]],[/crkey.*devicetype\/chromecast/i],[[M,ln+" Third Generation"],[U,Gn],[O,je]],[/crkey.*devicetype\/([^/]*)/i],[[M,/^/,"Chromecast "],[U,Gn],[O,je]],[/fuchsia.*crkey/i],[[M,ln+" Nest Hub"],[U,Gn],[O,je]],[/crkey/i],[[M,ln],[U,Gn],[O,je]],[/(portaltv)/i],[M,[U,lf],[O,je]],[/droid.+aft(\w+)( bui|\))/i],[M,[U,Tc],[O,je]],[/(shield \w+ tv)/i],[M,[U,of],[O,je]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[M,[U,gg],[O,je]],[/(bravia[\w ]+)( bui|\))/i],[M,[U,ns],[O,je]],[/(mi(tv|box)-?\w+) bui/i],[M,[U,af],[O,je]],[/Hbbtv.*(technisat) (.*);/i],[U,M,[O,je]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[U,/.+\/(\w+)/,"$1",Tr,{LG:"lge"}],[M,Nc],[O,je]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[M,[O,je]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[O,je]],[/(playstation \w+)/i],[M,[U,ns],[O,cs]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[M,[U,rf],[O,cs]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[U,M,[O,cs]],[/droid.+; (shield)( bui|\))/i],[M,[U,of],[O,cs]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[M,[U,rs],[O,Ir]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[U,M,[O,Ir]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[M,[U,sf],[O,Ir]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[M,[U,$i],[O,Ir]],[/(opwwe\d{3})/i],[M,[U,hg],[O,Ir]],[/(moto 360)/i],[M,[U,nf],[O,Ir]],[/(smartwatch 3)/i],[M,[U,ns],[O,Ir]],[/(g watch r)/i],[M,[U,Cc],[O,Ir]],[/droid.+; (wt63?0{2,3})\)/i],[M,[U,cf],[O,Ir]],[/droid.+; (glass) \d/i],[M,[U,Gn],[O,Ic]],[/(pico) (4|neo3(?: link|pro)?)/i],[U,M,[O,Ic]],[/(quest( \d| pro)?s?).+vr/i],[M,[U,lf],[O,Ic]],[/mobile vr; rv.+firefox/i],[[O,Ic]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[U,[O,ls]],[/(aeobc)\b/i],[M,[U,Tc],[O,ls]],[/(homepod).+mac os/i],[M,[U,$i],[O,ls]],[/windows iot/i],[[O,ls]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[M,[O,Tr,{mobile:"Mobile",xr:"VR","*":xe}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[O,xe]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[O,ie]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[M,[U,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[H,[k,Rc+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[k,H],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[H,[k,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[k,H],[/ladybird\//i],[[k,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[H,k]],os:[[/(windows nt) (6\.[23]); arm/i],[[k,/N/,"R"],[H,Tr,_g]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[k,H],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[H,/(;|\))/g,"",Tr,_g],[k,hf]],[/(windows ce)\/?([\d\.]*)/i],[k,H],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[H,/_/g,"."],[k,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[k,"macOS"],[H,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[H,[k,ln+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[H,[k,ln+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[H,[k,ln+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[H,[k,ln+" Linux"]],[/crkey\/([\d\.]+)/i],[H,[k,ln]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[H,k],[/(ubuntu) ([\w\.]+) like android/i],[[k,/(.+)/,"$1 Touch"],H],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[k,H],[/\(bb(10);/i],[H,[k,fg]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[H,[k,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[H,[k,is+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[H,[k,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[H,Tr,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[k,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[H,[k,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[k,"Chrome OS"],H],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[k,H],[/(sunos) ?([\d\.]*)/i],[[k,"Solaris"],H],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[k,H]]},xc=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return jr.call(t.init,[[Ct,[k,H,us,O]],[$r,[xt]],[Cr,[O,M,U]],[or,[k,H]],[Jt,[k,H]]]),jr.call(t.isIgnore,[[Ct,[H,us]],[or,[H]],[Jt,[H]]]),jr.call(t.isIgnoreRgx,[[Ct,/ ?browser$/i],[Jt,/ ?os$/i]]),jr.call(t.toString,[[Ct,[k,H]],[$r,[xt]],[Cr,[U,M]],[or,[k,H]],[Jt,[k,H]]]),t}(),Vb=function(t,e){var r=xc.init[e],n=xc.isIgnore[e]||0,i=xc.isIgnoreRgx[e]||0,o=xc.toString[e]||0;function s(){jr.call(this,r)}return s.prototype.getItem=function(){return t},s.prototype.withClientHints=function(){return un?un.getHighEntropyValues(Tg).then(function(a){return t.setCH(new Cg(a,!1)).parseCH().get()}):t.parseCH().get()},s.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=ji&&(s.prototype.is=function(a){var c=!1;for(var p in this)if(this.hasOwnProperty(p)&&!gf(n,p)&&Wr(i?qi(i,this[p]):this[p])==Wr(i?qi(i,a):a)){if(c=!0,a!=pn)break}else if(a==pn&&c){c=!c;break}return c},s.prototype.toString=function(){var a=Yi;for(var c in o)typeof this[o[c]]!==pn&&(a+=(a?" ":Yi)+this[o[c]]);return a||pn}),un||(s.prototype.then=function(a){var c=this,p=function(){for(var m in c)c.hasOwnProperty(m)&&(this[m]=c[m])};p.prototype={is:s.prototype.is,toString:s.prototype.toString};var f=new p;return a(f),f}),new s};function Cg(t,e){if(t=t||{},jr.call(this,Tg),e)jr.call(this,[[yf,uf(t[fn])],[vf,uf(t[Nb])],[ie,/\?1/.test(t[Mb])],[M,as(t[Bb])],[Gi,as(t[Ig])],[Ef,as(t[Ub])],[xt,as(t[Ob])],[Yn,uf(t[Lb])],[Oc,as(t[Pb])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==pn&&(this[r]=t[r])}function wg(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Rt&&Rt.userAgent==this.ua)switch(this.itemType){case Ct:Rt.brave&&typeof Rt.brave.isBrave==Ac&&this.set(k,"Brave");break;case Cr:!this.get(O)&&un&&un[ie]&&this.set(O,ie),this.get(M)=="Macintosh"&&Rt&&typeof Rt.standalone!==pn&&Rt.maxTouchPoints&&Rt.maxTouchPoints>2&&this.set(M,"iPad").set(O,xe);break;case Jt:!this.get(k)&&un&&un[Gi]&&this.set(k,un[Gi]);break;case ji:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(Ct,o(Ct)).set($r,o($r)).set(Cr,o(Cr)).set(or,o(or)).set(Jt,o(Jt))}return this},this.parseUA=function(){return this.itemType!=ji&&ff.call(this.data,this.ua,this.rgxMap),this.itemType==Ct&&this.set(us,pf(this.get(H))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Ct:case or:var s=i[vf]||i[yf],a;if(s)for(var c in s){var p=s[c].brand||s[c],f=s[c].version;this.itemType==Ct&&!/not.a.brand/i.test(p)&&(!a||/Chrom/.test(a)&&p!=vg||a==Rc&&/WebView2/.test(p))&&(p=Tr(p,Hb),a=this.get(k),a&&!/Chrom/.test(a)&&/Chrom/.test(p)||this.set(k,p).set(H,f).set(us,pf(f)),a=p),this.itemType==or&&p==vg&&this.set(H,f)}break;case $r:var m=i[xt];m&&(m&&i[Oc]=="64"&&(m+="64"),ff.call(this.data,m+";",o));break;case Cr:if(i[ie]&&this.set(O,ie),i[M]&&(this.set(M,i[M]),!this.get(O)||!this.get(U))){var v={};ff.call(v,"droid 9; "+i[M]+")",o),!this.get(O)&&v.type&&this.set(O,v.type),!this.get(U)&&v.vendor&&this.set(U,v.vendor)}if(i[Yn]){var y;if(typeof i[Yn]!="string")for(var T=0;!y&&T<i[Yn].length;)y=Tr(i[Yn][T++],Sg);else y=Tr(i[Yn],Sg);this.set(O,y)}break;case Jt:var R=i[Gi];if(R){var A=i[Ef];R==hf&&(A=parseInt(pf(A),10)>=13?"11":"10"),this.set(k,R).set(H,A)}this.get(k)==hf&&i[M]=="Xbox"&&this.set(k,"Xbox").set(H,void 0);break;case ji:var N=this.data,B=function(P){return N[P].getItem().setCH(i).parseCH().get()};this.set(Ct,B(Ct)).set($r,B($r)).set(Cr,B(Cr)).set(or,B(or)).set(Jt,B(Jt))}return this},jr.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",Vb(this,t)]]),this}function xr(t,e,r){if(typeof t===zi?(Dc(t,!0)?(typeof e===zi&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===df&&!Dc(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Ac){var n={};r.forEach(function(c,p){n[p]=c}),r=n}if(!(this instanceof xr))return new xr(t,e,r).getResult();var i=typeof t===df?t:r&&r[lg]?r[lg]:Rt&&Rt.userAgent?Rt.userAgent:Yi,o=new Cg(r,!0),s=e?Fb(bg,e):bg,a=function(c){return c==ji?function(){return new wg(c,i,s,o).set("ua",i).set(Ct,this.getBrowser()).set($r,this.getCPU()).set(Cr,this.getDevice()).set(or,this.getEngine()).set(Jt,this.getOS()).get()}:function(){return new wg(c,i,s[c],o).parseUA().get()}};return jr.call(this,[["getBrowser",a(Ct)],["getCPU",a($r)],["getDevice",a(Cr)],["getEngine",a(or)],["getOS",a(Jt)],["getResult",a(ji)],["getUA",function(){return i}],["setUA",function(c){return Ki(c)&&(i=c.length>mf?Nc(c,mf):c),this}]]).setUA(i),this}xr.VERSION=Db;xr.BROWSER=Pc([k,H,us,O]);xr.CPU=Pc([xt]);xr.DEVICE=Pc([M,U,O,cs,ie,je,xe,Ir,ls]);xr.ENGINE=xr.OS=Pc([k,H]);var mn=class{constructor(e,r){this._startTime=e;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e==="test"&&(e="test-"+this.startTime.getTime().toString()),D.IN_APP_WRAPPER_NAME+"-"+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e}closeInApp(e,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=S({eventName:e,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(e,r){this.inputFields.push({id:e,type:r,isValid:!1})}updateValidation(e,r){this.inputFields.forEach(n=>{if(n.id===e){n.isValid=r;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return b.error("Invalid range: min should be less than or equal to max."),e;if(e>=r&&e<=n)return e;let i=e%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}};var le=class{static storage=new Map;static get(e){return this.storage.has(e)||this.storage.set(e,e.getInstance()),this.storage.get(e)}};var ly=ur(bn());var xg=ur(_f());var ps=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let e;try{e=new xg.URLBuilder(location.href)}catch{return{}}let r={};this.UTM_PARAMS.forEach(i=>{let o=e.getQueryParam(i);o&&(r[i]=o)});let n={};return Object.keys(this.TW_PARAMS).forEach(i=>{let o=e.getQueryParam(this.TW_PARAMS[i]);o&&(n[i]=o)}),S(S({},n),r)}};var Rr=class t{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}static parseFromCurrent(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new t(S({origin:location.origin,path:e,qs:location.search,referrer:ps.getReferrer(),name:ce.get().pageName},ps.getUTMParams()))}};var Wb=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",jb=/bot|crawl|http|lighthouse|scan|search|spider/i,fs;function Gb(){if(fs instanceof RegExp)return fs;try{fs=new RegExp(Wb,"i")}catch{fs=jb}return fs}function Rg(t){return!!t&&Gb().test(t)}function fe(t){return typeof t=="function"}function Mc(t){let r=t(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Bc=Mc(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
|
|
41
|
+
`)+" ".concat(c,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return nS(t,e);if(t===void 0)return null;if(t instanceof Date||Mb(t)){var m=t.getTime(),f=m>-1&&m<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:Hh(t)}:e.relaxed&&f?{$date:Hh(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var E=t>=Qh&&t<=Jh,y=t>=eg&&t<=Zh;if(E)return{$numberInt:t.toString()};if(y)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Lb(t)){var T=t.flags;if(T===void 0){var D=t.toString().match(/[gimuy]*$/);D&&(T=D[0])}var O=new os(t.source,T);return O.toExtendedJSON(e)}return t!=null&&typeof t=="object"?oS(t,e):t}var iS={Binary:function(t){return new ii(t.value(),t.sub_type)},Code:function(t){return new Ic(t.code,t.scope)},DBRef:function(t){return new is(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new zp(t.bytes)},Double:function(t){return new Tc(t.value)},Int32:function(t){return new Cc(t.value)},Long:function(t){return oe.fromBits(t.low!=null?t.low:t.low_,t.low!=null?t.high:t.high_,t.low!=null?t.unsigned:t.unsigned_)},MaxKey:function(){return new qp},MinKey:function(){return new Kp},ObjectID:function(t){return new ht(t)},ObjectId:function(t){return new ht(t)},BSONRegExp:function(t){return new os(t.pattern,t.options)},Symbol:function(t){return new Xp(t.value)},Timestamp:function(t){return Xh.fromBits(t.low,t.high)}};function oS(t,e){if(t==null||typeof t!="object")throw new ni("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=wn(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{e.seenObjects.pop()}}return n}else if(tS(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var a=iS[t._bsontype];if(!a)throw new Qe("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return r==="Code"&&s.scope?s=new Ic(s.code,wn(s.scope,e)):r==="DBRef"&&s.oid&&(s=new is(wn(s.collection,e),wn(s.oid,e),wn(s.db,e),wn(s.fields,e))),s.toExtendedJSON(e)}else throw new ni("_bsontype must be a string, but was: "+typeof r)}var Vh;(function(t){function e(o,s){var a=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(o,function(c,p){if(c.indexOf("\0")!==-1)throw new ni("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(c)));return tg(p,a)})}t.parse=e;function r(o,s,a,c){a!=null&&typeof a=="object"&&(c=a,a=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(c=s,s=void 0,a=0);var p=Object.assign({relaxed:!0,legacy:!1},c,{seenObjects:[{propertyName:"(root)",obj:null}]}),m=wn(o,p);return JSON.stringify(m,s,a)}t.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}t.serialize=n;function i(o,s){return s=s||{},e(JSON.stringify(o),s)}t.deserialize=i})(Vh||(Vh={}));var $h,Wh=Gh();Wh.Map?$h=Wh.Map:$h=function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var J1=oe.fromNumber(Ub),Q1=oe.fromNumber(kb);var Wp=new Uint8Array(8),Z1=new DataView(Wp.buffer,Wp.byteOffset,Wp.byteLength);var sS=1024*1024*17,eM=Ae.alloc(sS);var In=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(e){e=e||{},this.triggerID=e.id||e.triggerID,this.nudgeID=e.nudgeID,this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.contentID=e.contentID,this.variation=e.variation,this.props=e.props,this.objective=e.objective,this.onsiteDeliveryType=e.onsiteDeliveryType,this.holdout=e.holdout}};var Te=class{constructor(e,r={},n,i){this.name=e;this.properties=r;this.id=i?new ht(i):new ht,this.occurred=new Date,n&&(this.trigger=new In(n)),this.newEvent=!i}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale};var _t=class{static SWIPER_CSS="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";static injectScriptURL(e,r){if(!e)return;let n=document.createElement("script");n.id=r??"",n.src=e,n.type="module",document.head.appendChild(n)}static injectRawScript(e){if(!e)return;let r=document.createElement("script");r.id="cooee-app-script",r.innerHTML=e,document.head.appendChild(r)}static injectRawCSS(e,r=document.head){if(!e)return;let n=document.createElement("style");n.textContent=e,r.appendChild(n)}static injectSwiperCSS(e=document.head){this.injectStylesheet(this.SWIPER_CSS,e)}static injectStylesheet(e,r=document.head){if(!e)return;let n=document.createElement("link");n.rel="stylesheet",n.href=e,e===this.SWIPER_CSS&&(n.crossOrigin="anonymous",n.onload=i=>{let s=i.currentTarget?.sheet?.cssRules;if(s){for(let a of s)if(a.type==CSSRule.FONT_FACE_RULE){let c=e.split("/"),p=c.slice(0,c.length-1).join("/"),m=a.cssText;m=m.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${p}/$4")`);let f=document.createElement("style");f.appendChild(document.createTextNode(m)),document.head.appendChild(f)}}}),r.appendChild(n)}static async loadSwiperScript(){window.CooeeSDK.Swiper||(window.CooeeSDK.Swiper=(await import("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs")).Swiper)}};var aS="2.0.4",lf=500,rg="user-agent",io="",ng="?",Oc="function",xn="undefined",oo="object",uf="string",Vt="browser",on="cpu",Vr="device",br="engine",ur="os",ro="result",$="name",M="type",H="vendor",G="version",$t="architecture",gs="major",U="model",ds="console",ue="mobile",Fe="tablet",st="smarttv",Fr="wearable",xc="xr",hs="embedded",as="inapp",mf="brands",si="formFactors",df="fullVersionList",no="platform",hf="platformVersion",Mc="bitness",Rn="sec-ch-ua",cS=Rn+"-full-version-list",lS=Rn+"-arch",uS=Rn+"-"+Mc,pS=Rn+"-form-factors",fS=Rn+"-"+ue,mS=Rn+"-"+U,yg=Rn+"-"+no,dS=yg+"-version",vg=[mf,df,ue,U,no,hf,$t,si,Mc],Rc="Amazon",eo="Apple",ig="ASUS",og="BlackBerry",oi="Google",sg="Huawei",Jp="Lenovo",ag="Honor",Ac="LG",Qp="Microsoft",Zp="Motorola",ef="Nvidia",cg="OnePlus",tf="OPPO",cs="Samsung",lg="Sharp",ls="Sony",rf="Xiaomi",nf="Zebra",ug="Chrome",pg="Chromium",Tn="Chromecast",Nc="Edge",us="Firefox",ps="Opera",of="Facebook",fg="Sogou",to="Mobile ",fs=" Browser",pf="Windows",hS=typeof window!==xn,Wt=hS&&window.navigator?window.navigator:void 0,Cn=Wt&&Wt.userAgentData?Wt.userAgentData:void 0,gS=function(t,e){var r={},n=e;if(!Pc(e)){n={};for(var i in e)for(var o in e[i])n[o]=e[i][o].concat(n[o]?n[o]:[])}for(var s in t)r[s]=n[s]&&n[s].length%2===0?n[s].concat(t[s]):t[s];return r},Bc=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},ff=function(t,e){if(typeof t===oo&&t.length>0){for(var r in t)if(sn(e)==sn(t[r]))return!0;return!1}return ao(t)?sn(e)==sn(t):!1},Pc=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Pc(t[r]):!1)},ao=function(t){return typeof t===uf},sf=function(t){if(t){for(var e=[],r=so(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Lc(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Lc(r[n]);return e}},sn=function(t){return ao(t)?t.toLowerCase():t},af=function(t){return ao(t)?so(/[^\d\.]/g,t).split(".")[0]:void 0},an=function(t){for(var e in t){var r=t[e];typeof r==oo&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},so=function(t,e){return ao(e)?e.replace(t,io):e},ms=function(t){return so(/\\?\"/g,t)},Lc=function(t,e){if(ao(t))return t=so(/^\s\s*/,t),typeof e===xn?t:t.substring(0,lf)},cf=function(t,e){if(!(!t||!e))for(var r=0,n,i,o,s,a,c;r<e.length&&!a;){var p=e[r],m=e[r+1];for(n=i=0;n<p.length&&!a&&p[n];)if(a=p[n++].exec(t),a)for(o=0;o<m.length;o++)c=a[++i],s=m[o],typeof s===oo&&s.length>0?s.length===2?typeof s[1]==Oc?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===Oc&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=c?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=c?s[1].call(this,c,s[2]):void 0:s.length==3?this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=c?s[3].apply(this,[c.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=c||void 0;r+=2}},Hr=function(t,e){for(var r in e)if(typeof e[r]===oo&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(ff(e[r][n],t))return r===ng?void 0:r}else if(ff(e[r],t))return r===ng?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},mg={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},dg={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},yS={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},hg={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[G,[$,to+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[G,[$,Nc+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[G,[$,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[$,G],[/opios[\/ ]+([\w\.]+)/i],[G,[$,ps+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[G,[$,ps+" GX"]],[/\bopr\/([\w\.]+)/i],[G,[$,ps]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[G,[$,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[G,[$,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[$,G],[/quark(?:pc)?\/([-\w\.]+)/i],[G,[$,"Quark"]],[/\bddg\/([\w\.]+)/i],[G,[$,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[G,[$,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[G,[$,"WeChat"]],[/konqueror\/([\w\.]+)/i],[G,[$,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[G,[$,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[G,[$,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[G,[$,"Smart "+Jp+fs]],[/(avast|avg)\/([\w\.]+)/i],[[$,/(.+)/,"$1 Secure"+fs],G],[/\bfocus\/([\w\.]+)/i],[G,[$,us+" Focus"]],[/\bopt\/([\w\.]+)/i],[G,[$,ps+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[G,[$,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[G,[$,"Dolphin"]],[/coast\/([\w\.]+)/i],[G,[$,ps+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[G,[$,"MIUI"+fs]],[/fxios\/([\w\.-]+)/i],[G,[$,to+us]],[/\bqihoobrowser\/?([\w\.]*)/i],[G,[$,"360"]],[/\b(qq)\/([\w\.]+)/i],[[$,/(.+)/,"$1Browser"],G],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[$,/(.+)/,"$1"+fs],G],[/samsungbrowser\/([\w\.]+)/i],[G,[$,cs+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[G,[$,fg+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[$,fg+" Mobile"],G],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[$,G],[/(lbbrowser|rekonq)/i],[$],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[G,$],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[$,of],G,[M,as]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[$,G,[M,as]],[/\bgsa\/([\w\.]+) .*safari\//i],[G,[$,"GSA"],[M,as]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[G,[$,"TikTok"],[M,as]],[/\[(linkedin)app\]/i],[$,[M,as]],[/(chromium)[\/ ]([-\w\.]+)/i],[$,G],[/headlesschrome(?:\/([\w\.]+)| )/i],[G,[$,ug+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[G,[$,Nc+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[$,ug+" WebView"],G],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[G,[$,"Android"+fs]],[/chrome\/([\w\.]+) mobile/i],[G,[$,to+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[$,G],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[G,[$,to+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[$,to+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[G,$],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[$,[G,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[$,G],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[$,to+us],G],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[$,"Netscape"],G],[/(wolvic|librewolf)\/([\w\.]+)/i],[$,G],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[G,[$,us+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[$,[G,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[$,[G,/[^\d\.]+./,io]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[$t,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[$t,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[$t,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[$t,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[$t,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[$t,/ower/,io,sn]],[/ sun4\w[;\)]/i],[[$t,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[$t,sn]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[U,[H,cs],[M,Fe]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[U,[H,cs],[M,ue]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[U,[H,eo],[M,ue]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[U,[H,eo],[M,Fe]],[/(macintosh);/i],[U,[H,eo]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[U,[H,lg],[M,ue]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[U,[H,ag],[M,Fe]],[/honor([-\w ]+)[;\)]/i],[U,[H,ag],[M,ue]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[U,[H,sg],[M,Fe]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[U,[H,sg],[M,ue]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[U,/_/g," "],[H,rf],[M,Fe]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[U,/_/g," "],[H,rf],[M,ue]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[U,[H,cg],[M,ue]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[U,[H,tf],[M,ue]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[U,[H,Hr,{OnePlus:["203","304","403","404","413","415"],"*":tf}],[M,Fe]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[U,[H,"BLU"],[M,ue]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[U,[H,"Vivo"],[M,ue]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[U,[H,"Realme"],[M,ue]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[U,[H,Jp],[M,Fe]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[U,[H,Jp],[M,ue]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[U,[H,Zp],[M,ue]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[U,[H,Zp],[M,Fe]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[U,[H,Ac],[M,Fe]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[U,[H,Ac],[M,ue]],[/(nokia) (t[12][01])/i],[H,U,[M,Fe]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[U,/_/g," "],[M,ue],[H,"Nokia"]],[/(pixel (c|tablet))\b/i],[U,[H,oi],[M,Fe]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[U,[H,oi],[M,ue]],[/(google) (pixelbook( go)?)/i],[H,U],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[U,[H,ls],[M,ue]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[U,"Xperia Tablet"],[H,ls],[M,Fe]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[U,[H,Rc],[M,Fe]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[U,/(.+)/g,"Fire Phone $1"],[H,Rc],[M,ue]],[/(playbook);[-\w\),; ]+(rim)/i],[U,H,[M,Fe]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[U,[H,og],[M,ue]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[U,[H,ig],[M,Fe]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[U,[H,ig],[M,ue]],[/(nexus 9)/i],[U,[H,"HTC"],[M,Fe]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[H,[U,/_/g," "],[M,ue]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[U,[H,"TCL"],[M,Fe]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[U,[H,"TCL"],[M,ue]],[/(itel) ((\w+))/i],[[H,sn],U,[M,Hr,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[U,[H,"Acer"],[M,Fe]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[U,[H,"Meizu"],[M,ue]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[U,[H,"Ulefone"],[M,ue]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[U,[H,"Energizer"],[M,ue]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[U,[H,"Cat"],[M,ue]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[U,[H,"Smartfren"],[M,ue]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[U,[H,"Nothing"],[M,ue]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[U,[H,"Archos"],[M,Fe]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[U,[H,"Archos"],[M,ue]],[/; (n159v)/i],[U,[H,"HMD"],[M,ue]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[H,U,[M,Fe]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[H,U,[M,ue]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[H,U,[M,Fe]],[/(surface duo)/i],[U,[H,Qp],[M,Fe]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[U,[H,"Fairphone"],[M,ue]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[U,[H,ef],[M,Fe]],[/(sprint) (\w+)/i],[H,U,[M,ue]],[/(kin\.[onetw]{3})/i],[[U,/\./g," "],[H,Qp],[M,ue]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[U,[H,nf],[M,Fe]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[U,[H,nf],[M,ue]],[/smart-tv.+(samsung)/i],[H,[M,st]],[/hbbtv.+maple;(\d+)/i],[[U,/^/,"SmartTV"],[H,cs],[M,st]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[H,U,[M,st]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[H,Ac],[M,st]],[/(apple) ?tv/i],[H,[U,eo+" TV"],[M,st]],[/crkey.*devicetype\/chromecast/i],[[U,Tn+" Third Generation"],[H,oi],[M,st]],[/crkey.*devicetype\/([^/]*)/i],[[U,/^/,"Chromecast "],[H,oi],[M,st]],[/fuchsia.*crkey/i],[[U,Tn+" Nest Hub"],[H,oi],[M,st]],[/crkey/i],[[U,Tn],[H,oi],[M,st]],[/(portaltv)/i],[U,[H,of],[M,st]],[/droid.+aft(\w+)( bui|\))/i],[U,[H,Rc],[M,st]],[/(shield \w+ tv)/i],[U,[H,ef],[M,st]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[U,[H,lg],[M,st]],[/(bravia[\w ]+)( bui|\))/i],[U,[H,ls],[M,st]],[/(mi(tv|box)-?\w+) bui/i],[U,[H,rf],[M,st]],[/Hbbtv.*(technisat) (.*);/i],[H,U,[M,st]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[H,/.+\/(\w+)/,"$1",Hr,{LG:"lge"}],[U,Lc],[M,st]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[U,[M,st]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[M,st]],[/(playstation \w+)/i],[U,[H,ls],[M,ds]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[U,[H,Qp],[M,ds]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[H,U,[M,ds]],[/droid.+; (shield)( bui|\))/i],[U,[H,ef],[M,ds]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[U,[H,cs],[M,Fr]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[H,U,[M,Fr]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[U,[H,tf],[M,Fr]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[U,[H,eo],[M,Fr]],[/(opwwe\d{3})/i],[U,[H,cg],[M,Fr]],[/(moto 360)/i],[U,[H,Zp],[M,Fr]],[/(smartwatch 3)/i],[U,[H,ls],[M,Fr]],[/(g watch r)/i],[U,[H,Ac],[M,Fr]],[/droid.+; (wt63?0{2,3})\)/i],[U,[H,nf],[M,Fr]],[/droid.+; (glass) \d/i],[U,[H,oi],[M,xc]],[/(pico) (4|neo3(?: link|pro)?)/i],[H,U,[M,xc]],[/(quest( \d| pro)?s?).+vr/i],[U,[H,of],[M,xc]],[/mobile vr; rv.+firefox/i],[[M,xc]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[H,[M,hs]],[/(aeobc)\b/i],[U,[H,Rc],[M,hs]],[/(homepod).+mac os/i],[U,[H,eo],[M,hs]],[/windows iot/i],[[M,hs]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[U,[M,Hr,{mobile:"Mobile",xr:"VR","*":Fe}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[M,Fe]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[M,ue]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[U,[H,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[G,[$,Nc+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[$,G],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[G,[$,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[$,G],[/ladybird\//i],[[$,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[G,$]],os:[[/(windows nt) (6\.[23]); arm/i],[[$,/N/,"R"],[G,Hr,mg]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[$,G],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[G,/(;|\))/g,"",Hr,mg],[$,pf]],[/(windows ce)\/?([\d\.]*)/i],[$,G],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[G,/_/g,"."],[$,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[$,"macOS"],[G,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[G,[$,Tn+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[G,[$,Tn+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[G,[$,Tn+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[G,[$,Tn+" Linux"]],[/crkey\/([\d\.]+)/i],[G,[$,Tn]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[G,$],[/(ubuntu) ([\w\.]+) like android/i],[[$,/(.+)/,"$1 Touch"],G],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[$,G],[/\(bb(10);/i],[G,[$,og]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[G,[$,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[G,[$,us+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[G,[$,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[G,Hr,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[$,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[G,[$,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[$,"Chrome OS"],G],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[$,G],[/(sunos) ?([\d\.]*)/i],[[$,"Solaris"],G],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[$,G]]},Dc=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return an.call(t.init,[[Vt,[$,G,gs,M]],[on,[$t]],[Vr,[M,U,H]],[br,[$,G]],[ur,[$,G]]]),an.call(t.isIgnore,[[Vt,[G,gs]],[br,[G]],[ur,[G]]]),an.call(t.isIgnoreRgx,[[Vt,/ ?browser$/i],[ur,/ ?os$/i]]),an.call(t.toString,[[Vt,[$,G]],[on,[$t]],[Vr,[H,U]],[br,[$,G]],[ur,[$,G]]]),t}(),vS=function(t,e){var r=Dc.init[e],n=Dc.isIgnore[e]||0,i=Dc.isIgnoreRgx[e]||0,o=Dc.toString[e]||0;function s(){an.call(this,r)}return s.prototype.getItem=function(){return t},s.prototype.withClientHints=function(){return Cn?Cn.getHighEntropyValues(vg).then(function(a){return t.setCH(new Eg(a,!1)).parseCH().get()}):t.parseCH().get()},s.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=ro&&(s.prototype.is=function(a){var c=!1;for(var p in this)if(this.hasOwnProperty(p)&&!ff(n,p)&&sn(i?so(i,this[p]):this[p])==sn(i?so(i,a):a)){if(c=!0,a!=xn)break}else if(a==xn&&c){c=!c;break}return c},s.prototype.toString=function(){var a=io;for(var c in o)typeof this[o[c]]!==xn&&(a+=(a?" ":io)+this[o[c]]);return a||xn}),Cn||(s.prototype.then=function(a){var c=this,p=function(){for(var f in c)c.hasOwnProperty(f)&&(this[f]=c[f])};p.prototype={is:s.prototype.is,toString:s.prototype.toString};var m=new p;return a(m),m}),new s};function Eg(t,e){if(t=t||{},an.call(this,vg),e)an.call(this,[[mf,sf(t[Rn])],[df,sf(t[cS])],[ue,/\?1/.test(t[fS])],[U,ms(t[mS])],[no,ms(t[yg])],[hf,ms(t[dS])],[$t,ms(t[lS])],[si,sf(t[pS])],[Mc,ms(t[uS])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==xn&&(this[r]=t[r])}function gg(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Wt&&Wt.userAgent==this.ua)switch(this.itemType){case Vt:Wt.brave&&typeof Wt.brave.isBrave==Oc&&this.set($,"Brave");break;case Vr:!this.get(M)&&Cn&&Cn[ue]&&this.set(M,ue),this.get(U)=="Macintosh"&&Wt&&typeof Wt.standalone!==xn&&Wt.maxTouchPoints&&Wt.maxTouchPoints>2&&this.set(U,"iPad").set(M,Fe);break;case ur:!this.get($)&&Cn&&Cn[no]&&this.set($,Cn[no]);break;case ro:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(Vt,o(Vt)).set(on,o(on)).set(Vr,o(Vr)).set(br,o(br)).set(ur,o(ur))}return this},this.parseUA=function(){return this.itemType!=ro&&cf.call(this.data,this.ua,this.rgxMap),this.itemType==Vt&&this.set(gs,af(this.get(G))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Vt:case br:var s=i[df]||i[mf],a;if(s)for(var c in s){var p=s[c].brand||s[c],m=s[c].version;this.itemType==Vt&&!/not.a.brand/i.test(p)&&(!a||/Chrom/.test(a)&&p!=pg||a==Nc&&/WebView2/.test(p))&&(p=Hr(p,yS),a=this.get($),a&&!/Chrom/.test(a)&&/Chrom/.test(p)||this.set($,p).set(G,m).set(gs,af(m)),a=p),this.itemType==br&&p==pg&&this.set(G,m)}break;case on:var f=i[$t];f&&(f&&i[Mc]=="64"&&(f+="64"),cf.call(this.data,f+";",o));break;case Vr:if(i[ue]&&this.set(M,ue),i[U]&&(this.set(U,i[U]),!this.get(M)||!this.get(H))){var E={};cf.call(E,"droid 9; "+i[U]+")",o),!this.get(M)&&E.type&&this.set(M,E.type),!this.get(H)&&E.vendor&&this.set(H,E.vendor)}if(i[si]){var y;if(typeof i[si]!="string")for(var T=0;!y&&T<i[si].length;)y=Hr(i[si][T++],dg);else y=Hr(i[si],dg);this.set(M,y)}break;case ur:var D=i[no];if(D){var O=i[hf];D==pf&&(O=parseInt(af(O),10)>=13?"11":"10"),this.set($,D).set(G,O)}this.get($)==pf&&i[U]=="Xbox"&&this.set($,"Xbox").set(G,void 0);break;case ro:var k=this.data,z=function(L){return k[L].getItem().setCH(i).parseCH().get()};this.set(Vt,z(Vt)).set(on,z(on)).set(Vr,z(Vr)).set(br,z(br)).set(ur,z(ur))}return this},an.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",vS(this,t)]]),this}function $r(t,e,r){if(typeof t===oo?(Pc(t,!0)?(typeof e===oo&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===uf&&!Pc(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Oc){var n={};r.forEach(function(c,p){n[p]=c}),r=n}if(!(this instanceof $r))return new $r(t,e,r).getResult();var i=typeof t===uf?t:r&&r[rg]?r[rg]:Wt&&Wt.userAgent?Wt.userAgent:io,o=new Eg(r,!0),s=e?gS(hg,e):hg,a=function(c){return c==ro?function(){return new gg(c,i,s,o).set("ua",i).set(Vt,this.getBrowser()).set(on,this.getCPU()).set(Vr,this.getDevice()).set(br,this.getEngine()).set(ur,this.getOS()).get()}:function(){return new gg(c,i,s[c],o).parseUA().get()}};return an.call(this,[["getBrowser",a(Vt)],["getCPU",a(on)],["getDevice",a(Vr)],["getEngine",a(br)],["getOS",a(ur)],["getResult",a(ro)],["getUA",function(){return i}],["setUA",function(c){return ao(c)&&(i=c.length>lf?Lc(c,lf):c),this}]]).setUA(i),this}$r.VERSION=aS;$r.BROWSER=Bc([$,G,gs,M]);$r.CPU=Bc([$t]);$r.DEVICE=Bc([U,H,M,ds,ue,st,Fe,Fr,hs]);$r.ENGINE=$r.OS=Bc([$,G]);var ve=class{static storage=new Map;static get(e){return this.storage.has(e)||this.storage.set(e,e.getInstance()),this.storage.get(e)}};var ry=gr(Bn());var _g=gr(gf());var ys=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let e;try{e=new _g.URLBuilder(location.href)}catch{return{}}let r={};this.UTM_PARAMS.forEach(i=>{let o=e.getQueryParam(i);o&&(r[i]=o)});let n={};return Object.keys(this.TW_PARAMS).forEach(i=>{let o=e.getQueryParam(this.TW_PARAMS[i]);o&&(n[i]=o)}),_(_({},n),r)}};var Wr=class t{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}static parseFromCurrent(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new t(_({origin:location.origin,path:e,qs:location.search,referrer:ys.getReferrer(),name:ye.get().pageName},ys.getUTMParams()))}};var _S=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",bS=/bot|crawl|http|lighthouse|scan|search|spider/i,vs;function SS(){if(vs instanceof RegExp)return vs;try{vs=new RegExp(_S,"i")}catch{vs=bS}return vs}function bg(t){return!!t&&SS().test(t)}function _e(t){return typeof t=="function"}function kc(t){let r=t(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Fc=kc(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
|
|
36
42
|
${r.map((n,i)=>`${i+1}) ${n.toString()}`).join(`
|
|
37
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function zn(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Qt=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(fe(n))try{n()}catch(o){e=o instanceof Bc?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{Ag(o)}catch(s){e=e??[],s instanceof Bc?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Bc(e)}}add(e){var r;if(e&&e!==this)if(this.closed)Ag(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&zn(r,e)}remove(e){let{_finalizers:r}=this;r&&zn(r,e),e instanceof t&&e._removeParent(this)}};Qt.EMPTY=(()=>{let t=new Qt;return t.closed=!0,t})();var Sf=Qt.EMPTY;function Uc(t){return t instanceof Qt||t&&"closed"in t&&fe(t.remove)&&fe(t.add)&&fe(t.unsubscribe)}function Ag(t){fe(t)?t():t.unsubscribe()}var sr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Xi={setTimeout(t,e,...r){let{delegate:n}=Xi;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=Xi;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function kc(t){Xi.setTimeout(()=>{let{onUnhandledError:e}=sr;if(e)e(t);else throw t})}function bf(){}var Dg=wf("C",void 0,void 0);function Ng(t){return wf("E",void 0,t)}function Og(t){return wf("N",t,void 0)}function wf(t,e,r){return{kind:t,value:e,error:r}}var qn=null;function Ji(t){if(sr.useDeprecatedSynchronousErrorHandling){let e=!qn;if(e&&(qn={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=qn;if(qn=null,r)throw n}}else t()}function Pg(t){sr.useDeprecatedSynchronousErrorHandling&&qn&&(qn.errorThrown=!0,qn.error=t)}var Kn=class extends Qt{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Uc(e)&&e.add(this)):this.destination=qb}static create(e,r,n){return new Qi(e,r,n)}next(e){this.isStopped?Tf(Og(e),this):this._next(e)}error(e){this.isStopped?Tf(Ng(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?Tf(Dg,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},Yb=Function.prototype.bind;function If(t,e){return Yb.call(t,e)}var Cf=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(n){Fc(n)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(n){Fc(n)}else Fc(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){Fc(r)}}},Qi=class extends Kn{constructor(e,r,n){super();let i;if(fe(e)||!e)i={next:e??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&sr.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&If(e.next,o),error:e.error&&If(e.error,o),complete:e.complete&&If(e.complete,o)}):i=e}this.destination=new Cf(i)}};function Fc(t){sr.useDeprecatedSynchronousErrorHandling?Pg(t):kc(t)}function zb(t){throw t}function Tf(t,e){let{onStoppedNotification:r}=sr;r&&Xi.setTimeout(()=>r(t,e))}var qb={closed:!0,next:bf,error:zb,complete:bf};var Zi=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Lg(t){return t}function Mg(t){return t.length===0?Lg:t.length===1?t[0]:function(r){return t.reduce((n,i)=>i(n),r)}}var At=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let o=Xb(r)?r:new Qi(r,n,i);return Ji(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Bg(n),new n((i,o)=>{let s=new Qi({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[Zi](){return this}pipe(...r){return Mg(r)(this)}toPromise(r){return r=Bg(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function Bg(t){var e;return(e=t??sr.Promise)!==null&&e!==void 0?e:Promise}function Kb(t){return t&&fe(t.next)&&fe(t.error)&&fe(t.complete)}function Xb(t){return t&&t instanceof Kn||Kb(t)&&Uc(t)}function Jb(t){return fe(t?.lift)}function dn(t){return e=>{if(Jb(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Gr(t,e,r,n,i){return new xf(t,e,r,n,i)}var xf=class extends Kn{constructor(e,r,n,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var Ug=Mc(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var wt=(()=>{class t extends At{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new Hc(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new Ug}next(r){Ji(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){Ji(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){Ji(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:o}=this;return n||i?Sf:(this.currentObservers=null,o.push(r),new Qt(()=>{this.currentObservers=null,zn(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new At;return r.source=this,r}}return t.create=(e,r)=>new Hc(e,r),t})(),Hc=class extends wt{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)}error(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:Sf}};var ms=class extends wt{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:n}=this;if(e)throw r;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var ds={now(){return(ds.delegate||Date).now()},delegate:void 0};var hs=class extends wt{constructor(e=1/0,r=1/0,n=ds){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(e),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=n?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),a=0;for(let c=1;c<n.length&&n[c]<=s;c+=2)a=c;a&&n.splice(0,a+1)}}};var Vc=class extends Qt{constructor(e,r){super()}schedule(e,r=0){return this}};var gs={setInterval(t,e,...r){let{delegate:n}=gs;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=gs;return(e?.clearInterval||clearInterval)(t)},delegate:void 0};var $c=class extends Vc{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var n;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,n=0){return gs.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&gs.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(e,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let n=!1,i;try{this.work(e)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,zn(n,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var eo=class t{constructor(e,r=t.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};eo.now=ds.now;var Wc=class extends eo{constructor(e,r=eo.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,n){for(;e=r.shift();)e.unsubscribe();throw n}}};var kg=new Wc($c);function Hg(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(f){try{p(n.next(f))}catch(m){s(m)}}function c(f){try{p(n.throw(f))}catch(m){s(m)}}function p(f){f.done?o(f.value):i(f.value).then(a,c)}p((n=n.apply(t,e||[])).next())})}function Fg(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Xn(t){return this instanceof Xn?(this.v=t,this):new Xn(t)}function Vg(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(y){return function(T){return Promise.resolve(T).then(y,m)}}function a(y,T){n[y]&&(i[y]=function(R){return new Promise(function(A,N){o.push([y,R,A,N])>1||c(y,R)})},T&&(i[y]=T(i[y])))}function c(y,T){try{p(n[y](T))}catch(R){v(o[0][3],R)}}function p(y){y.value instanceof Xn?Promise.resolve(y.value.v).then(f,m):v(o[0][2],y)}function f(y){c("next",y)}function m(y){c("throw",y)}function v(y,T){y(T),o.shift(),o.length&&c(o[0][0],o[0][1])}}function $g(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Fg=="function"?Fg(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(p){o({value:p,done:a})},s)}}var jc=t=>t&&typeof t.length=="number"&&typeof t!="function";function Wg(t){return fe(t?.then)}function jg(t){return fe(t[Zi])}function Gg(t){return Symbol.asyncIterator&&fe(t?.[Symbol.asyncIterator])}function Yg(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Qb(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var zg=Qb();function qg(t){return fe(t?.[zg])}function Kg(t){return Vg(this,arguments,function*(){let r=t.getReader();try{for(;;){let{value:n,done:i}=yield Xn(r.read());if(i)return yield Xn(void 0);yield yield Xn(n)}}finally{r.releaseLock()}})}function Xg(t){return fe(t?.getReader)}function to(t){if(t instanceof At)return t;if(t!=null){if(jg(t))return Zb(t);if(jc(t))return ew(t);if(Wg(t))return tw(t);if(Gg(t))return Jg(t);if(qg(t))return rw(t);if(Xg(t))return nw(t)}throw Yg(t)}function Zb(t){return new At(e=>{let r=t[Zi]();if(fe(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ew(t){return new At(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function tw(t){return new At(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,kc)})}function rw(t){return new At(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Jg(t){return new At(e=>{iw(t,e).catch(r=>e.error(r))})}function nw(t){return Jg(Kg(t))}function iw(t,e){var r,n,i,o;return Hg(this,void 0,void 0,function*(){try{for(r=$g(t);n=yield r.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function Qg(t,e,r,n=0,i=!1){let o=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!i)return o}function Yr(t,e){return dn((r,n)=>{let i=0;r.subscribe(Gr(n,o=>{n.next(t.call(e,o,i++))}))})}var{isArray:ow}=Array;function sw(t,e){return ow(e)?t(...e):t(e)}function Gc(t){return Yr(e=>sw(t,e))}function Zg(t,e,r,n,i,o,s,a){let c=[],p=0,f=0,m=!1,v=()=>{m&&!c.length&&!p&&e.complete()},y=R=>p<n?T(R):c.push(R),T=R=>{o&&e.next(R),p++;let A=!1;to(r(R,f++)).subscribe(Gr(e,N=>{i?.(N),o?y(N):e.next(N)},()=>{A=!0},void 0,()=>{if(A)try{for(p--;c.length&&p<n;){let N=c.shift();s?Qg(e,s,()=>T(N)):T(N)}v()}catch(N){e.error(N)}}))};return t.subscribe(Gr(e,y,()=>{m=!0,v()})),()=>{a?.()}}function Rf(t,e,r=1/0){return fe(e)?Rf((n,i)=>Yr((o,s)=>e(n,o,i,s))(to(t(n,i))),r):(typeof e=="number"&&(r=e),dn((n,i)=>Zg(n,i,t,r)))}var aw=["addListener","removeListener"],cw=["addEventListener","removeEventListener"],lw=["on","off"];function Jn(t,e,r,n){if(fe(r)&&(n=r,r=void 0),n)return Jn(t,e,r).pipe(Gc(n));let[i,o]=fw(t)?cw.map(s=>a=>t[s](e,a,r)):uw(t)?aw.map(ey(t,e)):pw(t)?lw.map(ey(t,e)):[];if(!i&&jc(t))return Rf(s=>Jn(s,e,r))(to(t));if(!i)throw new TypeError("Invalid event target");return new At(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function ey(t,e){return r=>n=>t[r](e,n)}function uw(t){return fe(t.addListener)&&fe(t.removeListener)}function pw(t){return fe(t.on)&&fe(t.off)}function fw(t){return fe(t.addEventListener)&&fe(t.removeEventListener)}function Yc(t,e,r){return r?Yc(t,e).pipe(Gc(r)):new At(n=>{let i=(...s)=>n.next(s.length===1?s[0]:s),o=t(i);return fe(e)?()=>e(i,o):void 0})}function Af(t,e){return dn((r,n)=>{let i=0;r.subscribe(Gr(n,o=>t.call(e,o,i++)&&n.next(o)))})}function Mt(t,e=kg){return dn((r,n)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let p=o;o=null,n.next(p)}};function c(){let p=s+t,f=e.now();if(f<p){i=this.schedule(void 0,p-f),n.add(i);return}a()}r.subscribe(Gr(n,p=>{o=p,s=e.now(),i||(i=e.schedule(c,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{o=i=null}))})}var ty=ur(_f()),zc=class t{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new ty.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new t(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new t(r)}};var Df={d:(t,e)=>{for(var r in e)Df.o(e,r)&&!Df.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Nf={};Df.d(Nf,{A:()=>mw,k:()=>Of});var ys=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(p){try{c(n.next(p))}catch(f){o(f)}}function a(p){try{c(n.throw(p))}catch(f){o(f)}}function c(p){var f;p.done?i(p.value):(f=p.value,f instanceof r?f:new r(function(m){m(f)})).then(s,a)}c((n=n.apply(t,e||[])).next())})},vs=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(p){return function(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&f[0]?n.return:f[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,f[1])).done)return i;switch(n=0,i&&(f=[2&f[0],i.value]),f[0]){case 0:case 1:i=f;break;case 4:return s.label++,{value:f[1],done:!1};case 5:s.label++,n=f[1],f=[0];continue;case 7:f=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||f[0]!==6&&f[0]!==2)){s=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){s.label=f[1];break}if(f[0]===6&&s.label<i[1]){s.label=i[1],i=f;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(f);break}i[2]&&s.ops.pop(),s.trys.pop();continue}f=e.call(t,s)}catch(m){f=[6,m],n=0}finally{r=i=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([c,p])}}};function Of(){return ys(this,void 0,Promise,function(){return vs(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function o(y){i||(i=!0,e({isPrivate:y,browserName:n}))}function s(){var y=0,T=parseInt("-1");try{T.toFixed(T)}catch(R){y=R.message.length}return y}function a(){return navigator.msSaveBlob!==void 0&&function(y){try{return y===eval.toString().length}catch{return!1}}(39)}function c(){var y;return ys(this,void 0,void 0,function(){var T,R;return vs(this,function(A){switch(A.label){case 0:return A.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return A.sent(),o(!1),[3,3];case 2:return T=A.sent(),R=T,T instanceof Error&&(R=(y=T.message)!==null&&y!==void 0?y:T),typeof R!="string"?(o(!1),[2]):(o(!!R.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var y;return ys(this,void 0,Promise,function(){return vs(this,function(T){switch(T.label){case 0:return((y=navigator.storage)===null||y===void 0?void 0:y.getDirectory)===void 0?[3,2]:[4,c()];case 1:return T.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?function(){var R=String(Math.random());try{var A=indexedDB.open(R,1);A.onupgradeneeded=function(N){var B=N.target.result,P=function(q){o(q)};try{B.createObjectStore("t",{autoIncrement:!0}).put(new Blob),P(!1)}catch(q){(q.message||"").includes("are not yet supported")?P(!0):P(!1)}finally{B.close(),indexedDB.deleteDatabase(R)}},A.onerror=function(){return o(!1)}}catch{o(!1)}}():function(){var R=window.openDatabase,A=window.localStorage;try{R(null,null,null,null)}catch{return void o(!0)}try{A.setItem("test","1"),A.removeItem("test")}catch{return void o(!0)}o(!1)}(),T.label=3;case 3:return[2]}})})}function f(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(y,T){var R;o(Math.round(T/1048576)<2*Math.round(((R=window).performance!==void 0&&R.performance.memory!==void 0&&R.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(y){r(new Error("detectIncognito somehow failed to query storage quota: "+y.message))})}function m(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?f():(0,window.webkitRequestFileSystem)(0,1,function(){o(!1)},function(){o(!0)})}function v(){return ys(this,void 0,Promise,function(){var y,T;return vs(this,function(R){switch(R.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];R.label=1;case 1:return R.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return R.sent(),o(!1),[3,4];case 3:return y=R.sent(),typeof(T=y instanceof Error&&typeof y.message=="string"?y.message:String(y))!="string"?(o(!1),[2]):(o(T.includes("Security error")),[2]);case 4:return o(navigator.serviceWorker===void 0),[2]}})})}(function(){return ys(this,void 0,Promise,function(){return vs(this,function(y){switch(y.label){case 0:return s()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return y.sent(),[3,6];case 2:return s()!==51?[3,3]:(T=navigator.userAgent,n=T.match(/Chrome/)?navigator.brave!==void 0?"Brave":T.match(/Edg/)?"Edge":T.match(/OPR/)?"Opera":"Chrome":"Chromium",m(),[3,6]);case 3:return s()!==25?[3,5]:(n="Firefox",[4,v()]);case 4:return y.sent(),[3,6];case 5:a()?(n="Internet Explorer",o(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),y.label=6;case 6:return[2]}var T})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Of);var mw=Of,ry=Nf.A,Sk=Nf.k;var ny=ur(bn()),qc=class{result={};async safeGet(){try{return await this.get()}catch(e){return be(e,"device-properties"),this.result}}async get(){let e=this.result,r=window.CooeeSDK.uaParser;this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),e.referrer=document.referrer,e.host=location.origin,e.path=location.pathname,e.qs=location.search,e.locale=navigator.language,e.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},e.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(e.headless=!0);let n=r.getResult();return e.browser=n.browser,e.device=n.device,e.engine=n.engine,e.cpu=n.cpu,e.os=n.os,e.navigatorUA=navigator.userAgent,await Promise.all([this.getBatteryInfo(),this.getLocationSilently(),this.checkIncognito()]),e}getDeviceMemory(){let e=navigator;if(!e.deviceMemory)return;let r=e.deviceMemory;this.result.mem={tot:r*1024}}getNetworkType(){let e=navigator,r=e.connection||e.mozConnection||e.webkitConnection;r?.effectiveType&&(this.result.net={type:r.effectiveType})}getOrientation(){let e=screen.orientation?.type;e&&(this.result.orientation=e)}getDPI(){if(!document.body)return;let e=document.createElement("div");e.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(e);let r=window.devicePixelRatio||1,n=e.offsetWidth*r;return document.body.removeChild(e),n}async getLocationSilently(){try{await this.getLocation()}catch(e){b.error("Unable to get location",e)}}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{this.result.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})}async getBatteryInfo(){if("getBattery"in navigator)try{let r=await navigator.getBattery();this.result.bat={l:r.level*100,c:r.charging}}catch{}}async checkIncognito(){try{(await ry())?.isPrivate&&(this.result.incognito=!0)}catch(e){ny.default.error("Unable to detect private/incognito window",e)}}};var ro=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=kn[e]?.toLowerCase();r&&(b.debug(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var oy=ur(iy());var Qn=class{static _flags={};static getFlags(){return this._flags}static setFlags(e){this._flags=e??{}}static isECommerceApp(){return zo()}};var dw=(0,oy.default)(fetch),hw={retryDelay:D.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=D.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},yt=class t{static INSTANCE;apiToken="";deviceID="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{b.log("Updated user profile"),await Zn.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{b.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{b.log("Sent Order")}).catch(r=>{b.error("Error sending track order",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{b.log("Updated device property")}).catch(async r=>{b.error("Error saving device property",r)})}setAPIToken(e){this.apiToken=e??""}setDeviceId(e){this.deviceID=e??""}setFirstSeen(e){this.firstSeen=e?.toUTCString()??""}get(e){return this.requestBackend("GET",e)}post(e,r){return this.requestBackend("POST",e,r)}put(e,r){return this.requestBackend("PUT",e,r)}async requestBackend(e,r,n){if(!Qn.isECommerceApp()&&!Qn.getFlags().allowEvents)return b.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=It.apiURL+r);let i=this.getDefaultHeaders(),o="keepalive"in new Request("");if(n&&!o&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(a){return be(a,"http-request",{extra:{body:JSON.stringify(n)}}),{}}let s={method:e,headers:i,keepalive:!0};return n&&(s.body=JSON.stringify(n)),this.request(r,s)}async request(e,r){let n=S(S({},hw),r),i=await dw(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,o)=>{let s=new XMLHttpRequest;s.open("POST",e,!0),r.forEach((a,c)=>{s.setRequestHeader(c,a)}),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(s.status>=200&&s.status<300)try{s.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(s.responseText)):o(new Error("Content-Type of response header is not json"))}catch(a){o(a)}else o(new Error(`Received status - ${s.status}(${s.statusText})`))},s.onerror=()=>{o(new Error("Network error occurred during the request."))},s.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",D.SDK),e.set("cooee-sdk-code",D.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",D.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),this.deviceID&&e.append("cooee-device-id",this.deviceID),It.debug&&e.set("cooee-sdk-debug",String(1)),e}};var ge=class t{static INSTANCE;httpApiService=yt.getInstance();eventAPIService=hn.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendEvent(e){b.debug(`Waiting for auth to send event ${e.name}`),tt.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){tt.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){tt.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){tt.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}};var ft=class{static isOn=!1;static element;static logs=[];static watch(){let e=kl();(e==="1"||e==="on")&&ge.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar(),this.log(`Cooee SDK v${D.SDK_VERSION} loaded`))}static log(e){this.isOn&&(this.logs.unshift({time:new Date,message:e}),this.element&&(this.element.logs=[...this.logs]))}static renderDebugBar(){this.element=document.createElement("cooee-debugger"),this.element.logs=this.logs,vi(()=>{document.body.appendChild(this.element)})}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}};var Es=class extends Xr{static storeName="app";static{this.storage=ci(this.storeName)}};var Kc=ur(bn());var gn=class t{static INSTANCE=new t;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new wt),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new wt),this.topics[e].asObservable()}};var $e=class t{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Me.get().website??{};currentState=!1;drawerSubject=new ms({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[t.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener(D.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return t._instance||(t._instance=new t),t._instance}static forceUpdate(){t._instance?.destroy(),t._instance=new t}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return Kc.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){b.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(D.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){b.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===t.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e)}catch(n){be(n,"execute-cooeeUpdateCartDrawer")}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,o=e.items[0].price;window.cartGiftUpdate(n,o,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer)window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?se.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(se.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():(b.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent(D.CTA_AFTER_REFRESH_UI,{detail:{responseJSON:e,currentCart:se.getCurrent()}})),r&&gn.get().broadcast(D.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(D.SHADOW_SPLITTER);r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!zo())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Ei(e),!this.cartDrawerElement){Kc.default.warn("Max attempts exhausted to find cart drawer");return}Kc.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let r=(await Ei(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}isVisible(){if(!this.cartDrawerElement)return!1;if(this.cartDrawerElement.tagName.toLowerCase()===t.DEFAULT_SELECTOR&&this.cartDrawerElement.open)return!0;if(this.cartDrawerElement.id==="cart-drawer__container")return this.cartDrawerElement.classList.contains("cart-drawer-open");let r=this.cartDrawerElement.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,i=(window.innerWidth||document.documentElement.clientWidth)+.5,o=r.top<=n&&r.bottom>=0,s=r.left<=i&&r.right>=0,a=o&&s,c=getComputedStyle(this.cartDrawerElement),p=c.display!=="none"&&c.visibility!=="hidden"&&parseFloat(c.opacity)>0,f=!this.cartDrawerElement.hidden,m=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,v=c.transform.match(/matrix\(([^)]+)\)/),y=0,T=0;if(v){let de=v[1].split(", ").map(parseFloat);y=de[4],T=de[5]}let R=y+r.left>i||y+r.right<0||T+r.top>n||T+r.bottom<0,A=Math.max(0,Math.min(r.right,i)-Math.max(r.left,0)),N=Math.max(0,Math.min(r.bottom,n)-Math.max(r.top,0)),B=A*N,P=r.width*r.height,q=P>0&&B/P>=.1;return(a||!R)&&p&&f&&m&&q}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||(Jd(this.cartDrawerElement,()=>{this.initialize()}),this.watchForCartToggle())}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new wt;this.mutationObserver?.disconnect(),this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(Mt(500)).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,this.drawerSubject.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){return!this.selector||!this.cartDrawerShadowElement?!1:!!this.cartDrawerShadowElement.querySelector(this.selector)}async updateBubble(){let e=(await se.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push([D.EVENT_OPEN_CART])}destroy(){document.removeEventListener(D.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationObserver?.disconnect(),this.drawerSubject?.complete()}};var Xc=class{static processConfiguration(){let e=Me.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&ge.getInstance().updateDeviceProps({gaClientID:e})}static async getClientID(){let e=await Te.get(ne.GA_CLIENT_ID),r=await this.getClientIDViaGTag();if(e!==r)return await Te.set(ne.GA_CLIENT_ID,r),r}static async getClientIDViaGTag(){let r=Me.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",i=>{n(i)})})}};var gw=t=>t,sy=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function ay(t,e={childList:!0,subtree:!0},r=500,n=gw){return Yc(i=>{let o=new MutationObserver(s=>i(s));return o.observe(t,e),o},(i,o)=>o.disconnect()).pipe(Yr(i=>n(i)),Af(i=>i.length>0),Mt(r))}var cy=ur(bn());var no=class{static itemMap=new Map;static async refreshItems(e){for(let s of e.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(s,e)}catch(a){b.error(a)}if(e.isCartEmbed()&&!e.isSubscriptionUpsell()){let a=(await se.getCurrent().getNormalisedCart()).items.map(c=>c.mID);e.items=e.items.filter(c=>!a.includes(c.mID))}if(Me.get().currencyCount<=1)return e.items;if(e.isShoppableVideo())return await this.refreshVideoItems(e.content.videoConfig,e),e.items;let r=e.items.length,n=e.items.map(s=>this.updatedItem(s,e)),o=(await Promise.all(n)).filter(s=>s!=null);if(r&&!o.length){let s="Failed to fetch any product from Ajax API",a=new ye(D.EVENT_CAMPAIGN_FAILED,{reason:s,currency:e.currency},e);throw ge.getInstance().sendEvent(a),new Error(s)}if(e.isCartRecovery()){let s=se.getCurrent().items,a=[];for(let c of o)for(let p of c.vars){if(!p.isAvailable)continue;let f=s.find(y=>y.variant_id.toString()===p.mID);if(!f)continue;let m=new gt(c);m.name=f.title;let v=new _r(p);v.name=f.variant_title,v.price.d=f.discounted_price/100,m.variants=[v],a.push(m)}return a}return o}static async refreshVideoItems(e,r){await Promise.all(e.videos.map(async n=>{n.items=await Promise.all(n.items.map(async i=>{let o=await this.updatedItem(i,r);return o||i}))}))}static async updatedItem(e,r){if(this.itemMap.has(e.mID))return this.itemMap.get(e.mID);let n=e,i=le.get(yt),o,s=`/products/${n.slug}.js`;try{o=await i.request(s)}catch(c){return be(c,"fetch-shopify-product",{extra:{item:n,path:s},engagementTrigger:r}),null}if(!o)return b.error("Item not found after AJAX call for:",n),null;n.name=o.title,n.tags=o.tags;let a=n.selectedOrFirstVariant.value;return n.vars.map(c=>{let p=o.variants.find(f=>f.id===+c.mID);c.name=p.title,c.isAvailable=p.available,c.price.d=p.price?p.price/100:p.price,c.price.effective=c.price.d,c.price.cmp=p.compare_at_price?p.compare_at_price/100:p.compare_at_price,+a.mID===p.id&&(a.effectivePrice.value=c.price.d)}),this.itemMap.set(n.mID,n),n}};function ar(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function ei(t,e){Object.assign(t.style,e)}function J(t,e,r){if(e){if(!r){t.style.removeProperty(e);return}t.style.setProperty(e,r,"important")}}var io=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let r={display:e.disp};return e.of&&(r.objectFit=e.of),e.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=e.right+"px",r.left=e.left+"px",r.top=e.top+"px",r.bottom=e.bottom+"px"),r}getSizeStyles(e){let r={};return e?.w&&(r.width=e.w),e?.h&&(r.height=e.h),e?.maxW&&(r.maxWidth=e.maxW),e?.maxH&&(r.maxHeight=e.maxH),e?.minW&&(r.minWidth=e.minW),e?.minH&&(r.minHeight=e.minH),r}getBorderStyles(e){if(!e)return{};let r={};return e.radius&&e.radius>0&&(r.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(r.borderWidth=this.getSizePx(e.width),r.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(e){return e?{gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:"100%"}:{}}getSpaceStyles(e){let r={};return e?(r.paddingTop=this.getSizePx(e.pt),r.paddingBottom=this.getSizePx(e.pb),r.paddingLeft=this.getSizePx(e.pl),r.paddingRight=this.getSizePx(e.pr),r.marginTop=this.getSizePx(e.mt),r.marginBottom=this.getSizePx(e.mb),r.marginLeft=e.cent?"auto":this.getSizePx(e.ml),r.marginRight=e.cent?"auto":this.getSizePx(e.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(e){if(!e)return{};let r={};if(e.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${e.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:e.glossy.fallback.rgba};if(r[i]=o,r[n]=o,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",r)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",r);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let n=(e.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${e.img.src}") no-repeat center`,r.backgroundSize="cover",e.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,r.backdropFilter=`opacity(${e.img.a})`)}return r}getGradientStyles(e,r,n){if(n??={},e.type==="LINEAR"){let i=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(i+=`, ${e.c3}`),i+=")",n[r]=i}return n}getColourStyles(e,r="color",n){return n??={},e?e.grad?this.getGradientStyles(e.grad,r,n):(e.hex&&(n[r]=e.rgba),n):n}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}};var Re=class extends vr{stylesConverter=new io(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=ar()?"sm":"lg",this.clickExecutor=new Ar(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),S(S(Z(S(S(S(S(S(S({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return!0;let{lhs:r,rhs:n}=e;switch(e.op){case"eq":return r===n;case"gt":return+r>+n;case"gte":return+r>=+n;case"lt":return+r<+n;case"lte":return+r<=+n;case"ne":return r!==n;case"null":return r==null;case"empty":return r.trim()==="";case"in":return new RegExp(`\\b${n}\\b`).test(r);case"nin":return!new RegExp(`\\b${n}\\b`).test(r);default:return b.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,ar()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=S(S({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e,r){e.stopPropagation(),!r.clickAction&&(r.clickAction=this.props.element.clc),await this.clickExecutor.execute(r)}};var yw=0,WF=Array.isArray;function Y(t,e,r,n,i,o){e||(e={});var s,a,c=e;if("ref"in c)for(a in c={},e)a=="ref"?s=e[a]:c[a]=e[a];var p={type:t,props:c,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--yw,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return ve.vnode&&ve.vnode(p),p}var Bt=class extends Re{componentDidMount(){this.setState(()=>({text:this.props.element.text})),ut(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),r=this.state.text;return r||(e.display="none",r=""),Y("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:Y("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:r}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,r={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},n=Mn(this.props.element,r),i=new st(n);if(!this.matchWhenCondition(i.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:i.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ze;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily=r.fam.name||"inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,e.textDecoration=r.td??"none",this.stylesConverter.getColourStyles(r.tc,"color",e),e}getComponentStyles(){return S({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var ti=class extends Bt{render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:Y("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return Z(S({},super.getComponentStyles()),{cursor:"pointer"})}};var Mf=class extends vr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?Y("div",{style:S(S({},this.getElementStyle()),this.props.styles),children:[Y("span",{children:this.props.time}),Y("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):Y("div",{style:S(S({},this.getElementStyle()),this.props.styles),children:[Y("span",{style:this.getTimeLabelStyle(),children:this.props.label}),Y("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},_s=class extends Bt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>S({},this.labels)),this.processAndStartTimer()}render(){return Y("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>Y(Mf,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return S(S({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,"0"),this.labels.Hours=String(e.hours).padStart(2,"0"),this.labels.Minutes=String(e.minutes).padStart(2,"0"),this.labels.Seconds=String(e.seconds).padStart(2,"0"),this.setState(()=>S({},this.labels))})}};function Jc(t,e){if(!t)return;let r=new window.CooeeSDK.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
|
|
43
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function ai(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var pr=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(_e(n))try{n()}catch(o){e=o instanceof Fc?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{Sg(o)}catch(s){e=e??[],s instanceof Fc?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Fc(e)}}add(e){var r;if(e&&e!==this)if(this.closed)Sg(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&ai(r,e)}remove(e){let{_finalizers:r}=this;r&&ai(r,e),e instanceof t&&e._removeParent(this)}};pr.EMPTY=(()=>{let t=new pr;return t.closed=!0,t})();var yf=pr.EMPTY;function Hc(t){return t instanceof pr||t&&"closed"in t&&_e(t.remove)&&_e(t.add)&&_e(t.unsubscribe)}function Sg(t){_e(t)?t():t.unsubscribe()}var Sr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var co={setTimeout(t,e,...r){let{delegate:n}=co;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=co;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Vc(t){co.setTimeout(()=>{let{onUnhandledError:e}=Sr;if(e)e(t);else throw t})}function vf(){}var wg=Ef("C",void 0,void 0);function Ig(t){return Ef("E",void 0,t)}function Tg(t){return Ef("N",t,void 0)}function Ef(t,e,r){return{kind:t,value:e,error:r}}var ci=null;function lo(t){if(Sr.useDeprecatedSynchronousErrorHandling){let e=!ci;if(e&&(ci={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=ci;if(ci=null,r)throw n}}else t()}function Cg(t){Sr.useDeprecatedSynchronousErrorHandling&&ci&&(ci.errorThrown=!0,ci.error=t)}var li=class extends pr{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Hc(e)&&e.add(this)):this.destination=TS}static create(e,r,n){return new uo(e,r,n)}next(e){this.isStopped?bf(Tg(e),this):this._next(e)}error(e){this.isStopped?bf(Ig(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?bf(wg,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},wS=Function.prototype.bind;function _f(t,e){return wS.call(t,e)}var Sf=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(n){$c(n)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(n){$c(n)}else $c(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){$c(r)}}},uo=class extends li{constructor(e,r,n){super();let i;if(_e(e)||!e)i={next:e??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&Sr.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&_f(e.next,o),error:e.error&&_f(e.error,o),complete:e.complete&&_f(e.complete,o)}):i=e}this.destination=new Sf(i)}};function $c(t){Sr.useDeprecatedSynchronousErrorHandling?Cg(t):Vc(t)}function IS(t){throw t}function bf(t,e){let{onStoppedNotification:r}=Sr;r&&co.setTimeout(()=>r(t,e))}var TS={closed:!0,next:vf,error:IS,complete:vf};var po=typeof Symbol=="function"&&Symbol.observable||"@@observable";function xg(t){return t}function Rg(t){return t.length===0?xg:t.length===1?t[0]:function(r){return t.reduce((n,i)=>i(n),r)}}var jt=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let o=xS(r)?r:new uo(r,n,i);return lo(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Ag(n),new n((i,o)=>{let s=new uo({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[po](){return this}pipe(...r){return Rg(r)(this)}toPromise(r){return r=Ag(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function Ag(t){var e;return(e=t??Sr.Promise)!==null&&e!==void 0?e:Promise}function CS(t){return t&&_e(t.next)&&_e(t.error)&&_e(t.complete)}function xS(t){return t&&t instanceof li||CS(t)&&Hc(t)}function RS(t){return _e(t?.lift)}function An(t){return e=>{if(RS(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function cn(t,e,r,n,i){return new wf(t,e,r,n,i)}var wf=class extends li{constructor(e,r,n,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var Dg=kc(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Ut=(()=>{class t extends jt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new Wc(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new Dg}next(r){lo(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){lo(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){lo(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:o}=this;return n||i?yf:(this.currentObservers=null,o.push(r),new pr(()=>{this.currentObservers=null,ai(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new jt;return r.source=this,r}}return t.create=(e,r)=>new Wc(e,r),t})(),Wc=class extends Ut{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)}error(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:yf}};var Es=class extends Ut{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:n}=this;if(e)throw r;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var _s={now(){return(_s.delegate||Date).now()},delegate:void 0};var bs=class extends Ut{constructor(e=1/0,r=1/0,n=_s){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(e),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=n?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),a=0;for(let c=1;c<n.length&&n[c]<=s;c+=2)a=c;a&&n.splice(0,a+1)}}};var jc=class extends pr{constructor(e,r){super()}schedule(e,r=0){return this}};var Ss={setInterval(t,e,...r){let{delegate:n}=Ss;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=Ss;return(e?.clearInterval||clearInterval)(t)},delegate:void 0};var Gc=class extends jc{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var n;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,n=0){return Ss.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&Ss.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(e,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let n=!1,i;try{this.work(e)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,ai(n,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var fo=class t{constructor(e,r=t.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};fo.now=_s.now;var Yc=class extends fo{constructor(e,r=fo.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,n){for(;e=r.shift();)e.unsubscribe();throw n}}};var Ng=new Yc(Gc);function Pg(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(m){try{p(n.next(m))}catch(f){s(f)}}function c(m){try{p(n.throw(m))}catch(f){s(f)}}function p(m){m.done?o(m.value):i(m.value).then(a,c)}p((n=n.apply(t,e||[])).next())})}function Og(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ui(t){return this instanceof ui?(this.v=t,this):new ui(t)}function Lg(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(y){return function(T){return Promise.resolve(T).then(y,f)}}function a(y,T){n[y]&&(i[y]=function(D){return new Promise(function(O,k){o.push([y,D,O,k])>1||c(y,D)})},T&&(i[y]=T(i[y])))}function c(y,T){try{p(n[y](T))}catch(D){E(o[0][3],D)}}function p(y){y.value instanceof ui?Promise.resolve(y.value.v).then(m,f):E(o[0][2],y)}function m(y){c("next",y)}function f(y){c("throw",y)}function E(y,T){y(T),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Mg(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Og=="function"?Og(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(p){o({value:p,done:a})},s)}}var zc=t=>t&&typeof t.length=="number"&&typeof t!="function";function Bg(t){return _e(t?.then)}function Ug(t){return _e(t[po])}function kg(t){return Symbol.asyncIterator&&_e(t?.[Symbol.asyncIterator])}function Fg(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function AS(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Hg=AS();function Vg(t){return _e(t?.[Hg])}function $g(t){return Lg(this,arguments,function*(){let r=t.getReader();try{for(;;){let{value:n,done:i}=yield ui(r.read());if(i)return yield ui(void 0);yield yield ui(n)}}finally{r.releaseLock()}})}function Wg(t){return _e(t?.getReader)}function mo(t){if(t instanceof jt)return t;if(t!=null){if(Ug(t))return DS(t);if(zc(t))return NS(t);if(Bg(t))return OS(t);if(kg(t))return jg(t);if(Vg(t))return PS(t);if(Wg(t))return LS(t)}throw Fg(t)}function DS(t){return new jt(e=>{let r=t[po]();if(_e(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function NS(t){return new jt(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function OS(t){return new jt(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Vc)})}function PS(t){return new jt(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function jg(t){return new jt(e=>{MS(t,e).catch(r=>e.error(r))})}function LS(t){return jg($g(t))}function MS(t,e){var r,n,i,o;return Pg(this,void 0,void 0,function*(){try{for(r=Mg(t);n=yield r.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function Gg(t,e,r,n=0,i=!1){let o=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!i)return o}function ln(t,e){return An((r,n)=>{let i=0;r.subscribe(cn(n,o=>{n.next(t.call(e,o,i++))}))})}var{isArray:BS}=Array;function US(t,e){return BS(e)?t(...e):t(e)}function qc(t){return ln(e=>US(t,e))}function Yg(t,e,r,n,i,o,s,a){let c=[],p=0,m=0,f=!1,E=()=>{f&&!c.length&&!p&&e.complete()},y=D=>p<n?T(D):c.push(D),T=D=>{o&&e.next(D),p++;let O=!1;mo(r(D,m++)).subscribe(cn(e,k=>{i?.(k),o?y(k):e.next(k)},()=>{O=!0},void 0,()=>{if(O)try{for(p--;c.length&&p<n;){let k=c.shift();s?Gg(e,s,()=>T(k)):T(k)}E()}catch(k){e.error(k)}}))};return t.subscribe(cn(e,y,()=>{f=!0,E()})),()=>{a?.()}}function If(t,e,r=1/0){return _e(e)?If((n,i)=>ln((o,s)=>e(n,o,i,s))(mo(t(n,i))),r):(typeof e=="number"&&(r=e),An((n,i)=>Yg(n,i,t,r)))}var kS=["addListener","removeListener"],FS=["addEventListener","removeEventListener"],HS=["on","off"];function pi(t,e,r,n){if(_e(r)&&(n=r,r=void 0),n)return pi(t,e,r).pipe(qc(n));let[i,o]=WS(t)?FS.map(s=>a=>t[s](e,a,r)):VS(t)?kS.map(zg(t,e)):$S(t)?HS.map(zg(t,e)):[];if(!i&&zc(t))return If(s=>pi(s,e,r))(mo(t));if(!i)throw new TypeError("Invalid event target");return new jt(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function zg(t,e){return r=>n=>t[r](e,n)}function VS(t){return _e(t.addListener)&&_e(t.removeListener)}function $S(t){return _e(t.on)&&_e(t.off)}function WS(t){return _e(t.addEventListener)&&_e(t.removeEventListener)}function Kc(t,e,r){return r?Kc(t,e).pipe(qc(r)):new jt(n=>{let i=(...s)=>n.next(s.length===1?s[0]:s),o=t(i);return _e(e)?()=>e(i,o):void 0})}function Tf(t,e){return An((r,n)=>{let i=0;r.subscribe(cn(n,o=>t.call(e,o,i++)&&n.next(o)))})}function Jt(t,e=Ng){return An((r,n)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let p=o;o=null,n.next(p)}};function c(){let p=s+t,m=e.now();if(m<p){i=this.schedule(void 0,p-m),n.add(i);return}a()}r.subscribe(cn(n,p=>{o=p,s=e.now(),i||(i=e.schedule(c,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{o=i=null}))})}var qg=gr(gf()),Xc=class t{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new qg.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new t(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new t(r)}};var Cf={d:(t,e)=>{for(var r in e)Cf.o(e,r)&&!Cf.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},xf={};Cf.d(xf,{A:()=>jS,k:()=>Rf});var ws=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(p){try{c(n.next(p))}catch(m){o(m)}}function a(p){try{c(n.throw(p))}catch(m){o(m)}}function c(p){var m;p.done?i(p.value):(m=p.value,m instanceof r?m:new r(function(f){f(m)})).then(s,a)}c((n=n.apply(t,e||[])).next())})},Is=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(p){return function(m){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,m[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&m[0]?n.return:m[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,m[1])).done)return i;switch(n=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return s.label++,{value:m[1],done:!1};case 5:s.label++,n=m[1],m=[0];continue;case 7:m=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){s=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){s.label=m[1];break}if(m[0]===6&&s.label<i[1]){s.label=i[1],i=m;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(m);break}i[2]&&s.ops.pop(),s.trys.pop();continue}m=e.call(t,s)}catch(f){m=[6,f],n=0}finally{r=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([c,p])}}};function Rf(){return ws(this,void 0,Promise,function(){return Is(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function o(y){i||(i=!0,e({isPrivate:y,browserName:n}))}function s(){var y=0,T=parseInt("-1");try{T.toFixed(T)}catch(D){y=D.message.length}return y}function a(){return navigator.msSaveBlob!==void 0&&function(y){try{return y===eval.toString().length}catch{return!1}}(39)}function c(){var y;return ws(this,void 0,void 0,function(){var T,D;return Is(this,function(O){switch(O.label){case 0:return O.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return O.sent(),o(!1),[3,3];case 2:return T=O.sent(),D=T,T instanceof Error&&(D=(y=T.message)!==null&&y!==void 0?y:T),typeof D!="string"?(o(!1),[2]):(o(!!D.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var y;return ws(this,void 0,Promise,function(){return Is(this,function(T){switch(T.label){case 0:return((y=navigator.storage)===null||y===void 0?void 0:y.getDirectory)===void 0?[3,2]:[4,c()];case 1:return T.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?function(){var D=String(Math.random());try{var O=indexedDB.open(D,1);O.onupgradeneeded=function(k){var z=k.target.result,L=function(Z){o(Z)};try{z.createObjectStore("t",{autoIncrement:!0}).put(new Blob),L(!1)}catch(Z){(Z.message||"").includes("are not yet supported")?L(!0):L(!1)}finally{z.close(),indexedDB.deleteDatabase(D)}},O.onerror=function(){return o(!1)}}catch{o(!1)}}():function(){var D=window.openDatabase,O=window.localStorage;try{D(null,null,null,null)}catch{return void o(!0)}try{O.setItem("test","1"),O.removeItem("test")}catch{return void o(!0)}o(!1)}(),T.label=3;case 3:return[2]}})})}function m(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(y,T){var D;o(Math.round(T/1048576)<2*Math.round(((D=window).performance!==void 0&&D.performance.memory!==void 0&&D.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(y){r(new Error("detectIncognito somehow failed to query storage quota: "+y.message))})}function f(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?m():(0,window.webkitRequestFileSystem)(0,1,function(){o(!1)},function(){o(!0)})}function E(){return ws(this,void 0,Promise,function(){var y,T;return Is(this,function(D){switch(D.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];D.label=1;case 1:return D.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return D.sent(),o(!1),[3,4];case 3:return y=D.sent(),typeof(T=y instanceof Error&&typeof y.message=="string"?y.message:String(y))!="string"?(o(!1),[2]):(o(T.includes("Security error")),[2]);case 4:return o(navigator.serviceWorker===void 0),[2]}})})}(function(){return ws(this,void 0,Promise,function(){return Is(this,function(y){switch(y.label){case 0:return s()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return y.sent(),[3,6];case 2:return s()!==51?[3,3]:(T=navigator.userAgent,n=T.match(/Chrome/)?navigator.brave!==void 0?"Brave":T.match(/Edg/)?"Edge":T.match(/OPR/)?"Opera":"Chrome":"Chromium",f(),[3,6]);case 3:return s()!==25?[3,5]:(n="Firefox",[4,E()]);case 4:return y.sent(),[3,6];case 5:a()?(n="Internet Explorer",o(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),y.label=6;case 6:return[2]}var T})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Rf);var jS=Rf,Kg=xf.A,rk=xf.k;var Xg=gr(Bn()),Jc=class{result={};async safeGet(){try{return await this.get()}catch(e){return xe(e,"device-properties"),this.result}}async get(){let e=this.result,r=window.CooeeSDK.uaParser;this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),e.referrer=document.referrer,e.host=location.origin,e.path=location.pathname,e.qs=location.search,e.locale=navigator.language,e.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},e.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(e.headless=!0);let n=r.getResult();return e.browser=n.browser,e.device=n.device,e.engine=n.engine,e.cpu=n.cpu,e.os=n.os,e.navigatorUA=navigator.userAgent,await Promise.all([this.getBatteryInfo(),this.getLocationSilently(),this.checkIncognito()]),e}getDeviceMemory(){let e=navigator;if(!e.deviceMemory)return;let r=e.deviceMemory;this.result.mem={tot:r*1024}}getNetworkType(){let e=navigator,r=e.connection||e.mozConnection||e.webkitConnection;r?.effectiveType&&(this.result.net={type:r.effectiveType})}getOrientation(){let e=screen.orientation?.type;e&&(this.result.orientation=e)}getDPI(){if(!document.body)return;let e=document.createElement("div");e.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(e);let r=window.devicePixelRatio||1,n=e.offsetWidth*r;return document.body.removeChild(e),n}async getLocationSilently(){try{await this.getLocation()}catch(e){S.error("Unable to get location",e)}}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{this.result.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})}async getBatteryInfo(){if("getBattery"in navigator)try{let r=await navigator.getBattery();this.result.bat={l:r.level*100,c:r.charging}}catch{}}async checkIncognito(){try{(await Kg())?.isPrivate&&(this.result.incognito=!0)}catch(e){Xg.default.error("Unable to detect private/incognito window",e)}}};var ho=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=Qn[e]?.toLowerCase();r&&(S.debug(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var Qg=gr(Jg());var fi=class{static _flags={};static getFlags(){return this._flags}static setFlags(e){this._flags=e??{}}static isECommerceApp(){return Zo()}};var GS=(0,Qg.default)(fetch),YS={retryDelay:N.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=N.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},Nt=class t{static INSTANCE;apiToken="";deviceID="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{S.log("Updated user profile"),await mi.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{S.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{S.log("Sent Order")}).catch(r=>{S.error("Error sending track order",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{S.log("Updated device property")}).catch(async r=>{S.error("Error saving device property",r)})}setAPIToken(e){this.apiToken=e??""}setDeviceId(e){this.deviceID=e??""}setFirstSeen(e){this.firstSeen=e?.toUTCString()??""}get(e){return this.requestBackend("GET",e)}post(e,r){return this.requestBackend("POST",e,r)}put(e,r){return this.requestBackend("PUT",e,r)}async requestBackend(e,r,n){if(!fi.isECommerceApp()&&!fi.getFlags().allowEvents)return S.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Ft.apiURL+r);let i=this.getDefaultHeaders(),o="keepalive"in new Request("");if(n&&!o&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(a){return xe(a,"http-request",{extra:{body:JSON.stringify(n)}}),{}}let s={method:e,headers:i,keepalive:!0};return n&&(s.body=JSON.stringify(n)),this.request(r,s)}async request(e,r){let n=_(_({},YS),r),i=await GS(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,o)=>{let s=new XMLHttpRequest;s.open("POST",e,!0),r.forEach((a,c)=>{s.setRequestHeader(c,a)}),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(s.status>=200&&s.status<300)try{s.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(s.responseText)):o(new Error("Content-Type of response header is not json"))}catch(a){o(a)}else o(new Error(`Received status - ${s.status}(${s.statusText})`))},s.onerror=()=>{o(new Error("Network error occurred during the request."))},s.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",N.SDK),e.set("cooee-sdk-code",N.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",N.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),this.deviceID&&e.append("cooee-device-id",this.deviceID),Ft.debug&&e.set("cooee-sdk-debug",String(1)),e}};var Ie=class t{static INSTANCE;httpApiService=Nt.getInstance();eventAPIService=Dn.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendEvent(e){S.debug(`Waiting for auth to send event ${e.name}`),gt.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){gt.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){gt.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){gt.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}};var xt=class{static isOn=!1;static element;static logs=[];static watch(){let e=Bl();(e==="1"||e==="on")&&Ie.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar(),this.log(`Cooee SDK v${N.SDK_VERSION} loaded`))}static log(e){this.isOn&&(this.logs.unshift({time:new Date,message:e}),this.element&&(this.element.logs=[...this.logs]))}static renderDebugBar(){this.element=document.createElement("cooee-debugger"),this.element.logs=this.logs,Oi(()=>{document.body.appendChild(this.element)})}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}};var Ts=class extends mn{static storeName="app";static{this.storage=Si(this.storeName)}};var Qc=gr(Bn());var Nn=class t{static INSTANCE=new t;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new Ut),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new Ut),this.topics[e].asObservable()}};var tt=class t{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Ge.get().website??{};currentState=!1;drawerSubject=new Es({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[t.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener(N.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return t._instance||(t._instance=new t),t._instance}static forceUpdate(){t._instance?.destroy(),t._instance=new t}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return Qc.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){S.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(N.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){S.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===t.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e)}catch(n){xe(n,"execute-cooeeUpdateCartDrawer")}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,o=e.items[0].price;window.cartGiftUpdate(n,o,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer)window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?ge.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(ge.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():(S.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent(N.CTA_AFTER_REFRESH_UI,{detail:{responseJSON:e,currentCart:ge.getCurrent()}})),r&&Nn.get().broadcast(N.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(N.SHADOW_SPLITTER);r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!Zo())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Pi(e),!this.cartDrawerElement){Qc.default.warn("Max attempts exhausted to find cart drawer");return}Qc.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let r=(await Pi(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}isVisible(){if(!this.cartDrawerElement)return!1;if(this.cartDrawerElement.tagName.toLowerCase()===t.DEFAULT_SELECTOR&&this.cartDrawerElement.open)return!0;if(this.cartDrawerElement.id==="cart-drawer__container")return this.cartDrawerElement.classList.contains("cart-drawer-open");let r=this.cartDrawerElement.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,i=(window.innerWidth||document.documentElement.clientWidth)+.5,o=r.top<=n&&r.bottom>=0,s=r.left<=i&&r.right>=0,a=o&&s,c=getComputedStyle(this.cartDrawerElement),p=c.display!=="none"&&c.visibility!=="hidden"&&parseFloat(c.opacity)>0,m=!this.cartDrawerElement.hidden,f=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,E=c.transform.match(/matrix\(([^)]+)\)/),y=0,T=0;if(E){let be=E[1].split(", ").map(parseFloat);y=be[4],T=be[5]}let D=y+r.left>i||y+r.right<0||T+r.top>n||T+r.bottom<0,O=Math.max(0,Math.min(r.right,i)-Math.max(r.left,0)),k=Math.max(0,Math.min(r.bottom,n)-Math.max(r.top,0)),z=O*k,L=r.width*r.height,Z=L>0&&z/L>=.1;return(a||!D)&&p&&m&&f&&Z}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||(jd(this.cartDrawerElement,()=>{this.initialize()}),this.watchForCartToggle())}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new Ut;this.mutationObserver?.disconnect(),this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(Jt(500)).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,this.drawerSubject.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){return!this.selector||!this.cartDrawerShadowElement?!1:!!this.cartDrawerShadowElement.querySelector(this.selector)}async updateBubble(){let e=(await ge.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push([N.EVENT_OPEN_CART])}destroy(){document.removeEventListener(N.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationObserver?.disconnect(),this.drawerSubject?.complete()}};var Zc=class{static processConfiguration(){let e=Ge.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&Ie.getInstance().updateDeviceProps({gaClientID:e})}static async getClientID(){let e=await Me.get(le.GA_CLIENT_ID),r=await this.getClientIDViaGTag();if(e!==r)return await Me.set(le.GA_CLIENT_ID,r),r}static async getClientIDViaGTag(){let r=Ge.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",i=>{n(i)})})}};var zS=t=>t,Zg=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function ey(t,e={childList:!0,subtree:!0},r=500,n=zS){return Kc(i=>{let o=new MutationObserver(s=>i(s));return o.observe(t,e),o},(i,o)=>o.disconnect()).pipe(ln(i=>n(i)),Tf(i=>i.length>0),Jt(r))}var ty=gr(Bn());var go=class{static itemMap=new Map;static async refreshItems(e){for(let s of e.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(s,e)}catch(a){S.error(a)}if(e.isCartEmbed()&&!e.isSubscriptionUpsell()){let a=(await ge.getCurrent().getNormalisedCart()).items.map(c=>c.mID);e.items=e.items.filter(c=>!a.includes(c.mID))}if(Ge.get().currencyCount<=1)return e.items;if(e.isShoppableVideo())return await this.refreshVideoItems(e.content.videoConfig,e),e.items;let r=e.items.length,n=e.items.map(s=>this.updatedItem(s,e)),o=(await Promise.all(n)).filter(s=>s!=null);if(r&&!o.length){let s="Failed to fetch any product from Ajax API",a=new Te(N.EVENT_CAMPAIGN_FAILED,{reason:s,currency:e.currency},e);throw Ie.getInstance().sendEvent(a),new Error(s)}if(e.isCartRecovery()){let s=ge.getCurrent().items,a=[];for(let c of o)for(let p of c.vars){if(!p.isAvailable)continue;let m=s.find(y=>y.variant_id.toString()===p.mID);if(!m)continue;let f=new Dt(c);f.name=m.title;let E=new Lr(p);E.name=m.variant_title,E.price.d=m.discounted_price/100,f.variants=[E],a.push(f)}return a}return o}static async refreshVideoItems(e,r){await Promise.all(e.videos.map(async n=>{n.items=await Promise.all(n.items.map(async i=>{let o=await this.updatedItem(i,r);return o||i}))}))}static async updatedItem(e,r){if(this.itemMap.has(e.mID))return this.itemMap.get(e.mID);let n=e,i=ve.get(Nt),o,s=`/products/${n.slug}.js`;try{o=await i.request(s)}catch(c){return xe(c,"fetch-shopify-product",{extra:{item:n,path:s},engagementTrigger:r}),null}if(!o)return S.error("Item not found after AJAX call for:",n),null;n.name=o.title,n.tags=o.tags;let a=n.selectedOrFirstVariant.value;return n.vars.map(c=>{let p=o.variants.find(m=>m.id===+c.mID);c.name=p.title,c.isAvailable=p.available,c.price.d=p.price?p.price/100:p.price,c.price.effective=c.price.d,c.price.cmp=p.compare_at_price?p.compare_at_price/100:p.compare_at_price,+a.mID===p.id&&(a.effectivePrice.value=c.price.d)}),this.itemMap.set(n.mID,n),n}};function wr(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function di(t,e){Object.assign(t.style,e)}function ne(t,e,r){if(e){if(!r){t.style.removeProperty(e);return}t.style.setProperty(e,r,"important")}}var yo=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let r={display:e.disp};return e.of&&(r.objectFit=e.of),e.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=e.right+"px",r.left=e.left+"px",r.top=e.top+"px",r.bottom=e.bottom+"px"),r}getSizeStyles(e){let r={};return e?.w&&(r.width=e.w),e?.h&&(r.height=e.h),e?.maxW&&(r.maxWidth=e.maxW),e?.maxH&&(r.maxHeight=e.maxH),e?.minW&&(r.minWidth=e.minW),e?.minH&&(r.minHeight=e.minH),r}getBorderStyles(e){if(!e)return{};let r={};return e.radius&&e.radius>0&&(r.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(r.borderWidth=this.getSizePx(e.width),r.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(e){return e?{gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:"100%"}:{}}getSpaceStyles(e){let r={};return e?(r.paddingTop=this.getSizePx(e.pt),r.paddingBottom=this.getSizePx(e.pb),r.paddingLeft=this.getSizePx(e.pl),r.paddingRight=this.getSizePx(e.pr),r.marginTop=this.getSizePx(e.mt),r.marginBottom=this.getSizePx(e.mb),r.marginLeft=e.cent?"auto":this.getSizePx(e.ml),r.marginRight=e.cent?"auto":this.getSizePx(e.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(e){if(!e)return{};let r={};if(e.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${e.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:e.glossy.fallback.rgba};if(r[i]=o,r[n]=o,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",r)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",r);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let n=(e.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${e.img.src}") no-repeat center`,r.backgroundSize="cover",e.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,r.backdropFilter=`opacity(${e.img.a})`)}return r}getGradientStyles(e,r,n){if(n??={},e.type==="LINEAR"){let i=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(i+=`, ${e.c3}`),i+=")",n[r]=i}return n}getColourStyles(e,r="color",n){return n??={},e?e.grad?this.getGradientStyles(e.grad,r,n):(e.hex&&(n[r]=e.rgba),n):n}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}};var He=class extends Or{stylesConverter=new yo(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=wr()?"sm":"lg",this.clickExecutor=new jr(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),_(_(ee(_(_(_(_(_(_({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return!0;let{lhs:r,rhs:n}=e;switch(e.op){case"eq":return r===n;case"gt":return+r>+n;case"gte":return+r>=+n;case"lt":return+r<+n;case"lte":return+r<=+n;case"ne":return r!==n;case"null":return r==null;case"empty":return r.trim()==="";case"in":return new RegExp(`\\b${n}\\b`).test(r);case"nin":return!new RegExp(`\\b${n}\\b`).test(r);default:return S.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,wr()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=_(_({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e,r){e.stopPropagation(),!r.clickAction&&(r.clickAction=this.props.element.clc),await this.clickExecutor.execute(r)}};var qS=0,IF=Array.isArray;function X(t,e,r,n,i,o){e||(e={});var s,a,c=e;if("ref"in c)for(a in c={},e)a=="ref"?s=e[a]:c[a]=e[a];var p={type:t,props:c,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--qS,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return Re.vnode&&Re.vnode(p),p}var Qt=class extends He{componentDidMount(){this.setState(()=>({text:this.props.element.text})),Tt(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),r=this.state.text;return r||(e.display="none",r=""),X("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:X("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:r}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,r={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},n=Kn(this.props.element,r,this.props.triggerContext),i=new Et(n);if(!this.matchWhenCondition(i.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:i.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ct;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily=r.fam.name||"inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,e.textDecoration=r.td??"none",this.stylesConverter.getColourStyles(r.tc,"color",e),e}getComponentStyles(){return _({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var hi=class extends Qt{render(){return X("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:X("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return ee(_({},super.getComponentStyles()),{cursor:"pointer"})}};var Nf=class extends Or{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?X("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[X("span",{children:this.props.time}),X("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):X("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[X("span",{style:this.getTimeLabelStyle(),children:this.props.label}),X("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},Cs=class extends Qt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>_({},this.labels)),this.processAndStartTimer()}render(){return X("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>X(Nf,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return _(_({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,"0"),this.labels.Hours=String(e.hours).padStart(2,"0"),this.labels.Minutes=String(e.minutes).padStart(2,"0"),this.labels.Seconds=String(e.seconds).padStart(2,"0"),this.setState(()=>_({},this.labels))})}};function el(t,e){if(!t)return;let r=new window.CooeeSDK.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
|
|
38
44
|
<span class="${i}"
|
|
39
45
|
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
40
46
|
`,renderProgressbar:n=>`
|
|
41
47
|
<span class="${n}"
|
|
42
48
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
43
49
|
</span>
|
|
44
|
-
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function Qc(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),Y("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[Y("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&Y("div",{class:"swiper-button-next",style:n,children:Y("span",{})}),t.navigation.enabled&&Y("div",{class:"swiper-button-prev",style:n,children:Y("span",{})}),t.pagination.enabled&&Y("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var Ss=class extends Re{componentDidMount(){ut(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:Y("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ze;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Z(S({},this.getTypoStyles()),{display:"flex"})}};var zr=class extends Re{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return Y("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===Hl.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var qr=class extends Re{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(yn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Li,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var bs=class extends qr{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(oo,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var ws=class extends Re{render(){return Y("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){ut(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ze;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),S(S({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push(Y("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(Y("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var Is=class extends Re{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),Y("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=Ci(this.props.element.fullStar,{svg:e}),n=Ci(this.props.element.halfStart,{svg:e}),i=this.props.review;if(!i?.rating)return"";let o="";if(this.props.element.showSingleStar)o=r;else{let s=5,a=`${i.rating}`.split(".");for(let c=0;c<+a[0];c++)o+=r,s--;a[1]&&(o+=n,s--);for(let c=0;c<s;c++)o+=r.replace(this.colorRegex,'fill="#f1f1f1"')}return o}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var Ts=class extends Re{render(){return Y("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){ut(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ze;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),S(S({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(Y("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(i=>i.mID===r);this.props.item.setSelectedVariant(n)}};var oo=class extends Re{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:Y(bs,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?Y(Ss,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,i=n.variantImage??n.firstImageURL,o=n.variantSecondaryImage??n.secondaryImageURL;r.lg=r.sm={src:i,name:n.name,secondarySrc:o};let s=Y(zr,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:Y("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:r.showChips?Y("cooee-product-options-picker",{item:this.props.item,element:r}):Y(Ts,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?Y(ws,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?Y(Is,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?Y(ti,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):Y(yn,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=Y(Bt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:Y("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}};var ri=class extends Re{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=Mn(this.props.element,this.getProductData());if(this.productElement=new sn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return Y("div",{style:S({},this.getCompiledStyles()),class:"lc-single-product",children:Y(oo,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let e=this.props.item,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let i=this.props.triggerContext.triggerData.discount?.type===Ht.BXGY;return!r.hasEffectivePrice()&&i&&(n.product.effective_price=St(r.effectivePrice.value),n.product.price=""),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};var Cs=class extends Re{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=ar()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&at.loadSwiperScript().then(()=>{this.swiperInstance=Jc(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=o=>{this.swiperRef=o},i=()=>e?.map(o=>Y("div",{class:"swiper-slide",children:this.getProductFragment(o)}));r=Y("div",{style:Z(S({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Qc(this.configuration,n,i)})}else r=Y("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,i)=>this.getProductFragment(n,i!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,i=n.items.length,o;n.isBundle()?o=this.props.element.prod.symbol?.hide!==!0?i*2-1:i:o=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${o}, auto)`}}return r}getProductFragment(e,r=!1){return Y(Er,{children:[Y(ri,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&Y("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Y(Bt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var xs=class extends Re{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){at.loadSwiperScript().then(()=>{this.swiperInstance=Jc(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=i=>{this.swiperRef=i},n=()=>e.values?.map(i=>Y("div",{class:"swiper-slide",onClick:o=>this.onClick(o,{clickAction:this.getClickAction(i)}),children:this.renderElement(i)}));return Qc(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return Y(zr,{element:r,triggerContext:this.props.triggerContext});case 4:return Y(qr,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:b.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=Mn(e,{form:r});return Lt.getParsedElement(n)}getClickAction(e){return Mn(this.props.element.clc??{},{form:e})}};var yn=class extends Re{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),ut(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return Y(qr,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return Y(_s,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?Y(ti,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return Y(Bt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return Y(zr,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return Y(Cs,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return Y(ri,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return Y(xs,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var Rs=class extends Re{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=(this.clickAction?.at===4||this.clickAction?.at===105)&&this.clickAction.gu?.u}componentDidMount(){ut(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return Y(Er,{children:[Y("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:Y(yn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&Y("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}async onClick(e,r){if(this.isClickable)return super.onClick(e,r)}};var mt=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new mn(new Date,this.engagementTrigger)}static renderedEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=ce.get();widgetAPIService=le.get(cr);eventAPIService=le.get(hn);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>{be(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){b.log(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){b.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),!this.shouldStopRendering()&&(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}update(e){cy.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}rerender(){this.rootContainer?.isConnected||(this.preDestroy(),this.renderSilently())}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}afterRootContainerCreated(){}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){b.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(b.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new gt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new gt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new gt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&$t.hasKeys(e.props)&&(this.engagementTrigger.props=S(S({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new Xo(e.content)),this.triggerContext.triggerData.widget=this.widget=new ki(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.triggerContext.triggerData.manipulation=e.manipulation,this.triggerContext.triggerData.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){this instanceof ct?ct.renderedEngagements.add(this):t.renderedEngagements.add(this)}removeFromRendered(){this instanceof ct?ct.renderedEngagements.delete(this):t.renderedEngagements.delete(this)}async getVariation(){b.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(e)}catch(r){b.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){b.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((o,s)=>{o.forEach(async a=>{if(a.isIntersecting){b.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let c=await this.getVariation();n(c),s.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=Jn(window,"scroll").pipe(Mt(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=this.isExclusionWithBVariation?D.EVENT_CAMPAIGN_HOLDOUT:D.EVENT_TRIGGER_DISPLAYED,o=new ye(i,n,this.engagementTrigger);o.name===D.EVENT_CAMPAIGN_HOLDOUT&&(o.trigger.holdout=!0),this.eventAPIService.sendSilently(o),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=se.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),r.addEventListener("cooeeEvent",n=>{let i=n.detail;this.eventAPIService.sendSilently(i)}),r.addEventListener("cooeeCTA",n=>{new Ar(this.triggerContext).execute(n.detail)}),this.rootContainer.appendChild(r),this.addToRendered(),r}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,i=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,o=e.width*e.height,s=i/o*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return b.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(D.SHADOW_SPLITTER)){let c=n.split(D.SHADOW_SPLITTER),p=Me.get().website.commonCSS;i=(await Ei(c[0].trim()))?.shadowRoot,n=c[1].trim(),i&&(at.injectRawCSS(p,i),at.injectStylesheet(It.styleURL,i))}b.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let o=await Ei(n,10,i??document);if(!o)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case si.BEFORE:{o.parentElement?.insertBefore(a,o);break}case si.INSIDE_FIRST:{o.insertBefore(a,o.firstChild);break}case si.INSIDE_LAST:{o.appendChild(a);break}case si.AFTER:default:o.parentElement?.insertBefore(a,o.nextSibling)}return a}async startRendering(){ft.log(`Campaign #${this.engagementTrigger.shortID} will be rendered`);let e;try{e=await no.refreshItems(this.engagementTrigger)}catch(r){b.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){b.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),o=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${o} lc-${i}`,n.dataset.engagementId=o,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let n=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),i=Me.get().website.commonCSS;at.injectRawCSS(i,n),at.injectStylesheet(It.styleURL,n),at.injectSwiperCSS(n),e=n}mh(Ep(Rs,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let o of i)Or.remove(r,o)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var ct=class extends mt{static renderedEngagements=new Set;constructor(e){super(e)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!$e.get().isOpen()&&this.runtimeData.pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var Zc=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=se.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){b.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new t(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(f=>f.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(f=>f.mID===e.id.toString());if(!n)return;let i=new _r(n),o=e.selling_plan_allocation?.selling_plan;if(o)for(let f of i.sellingPlans??[])f.mID===o.id.toString()&&(f.isSelected=!0,i.changeSellingPlan(f));let s=new gt(r);s.vars=[i],s.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let c=new pt(this.engagementTrigger);c.placement.selector=`.${a}`,c.items=[s];let p=new ct(c);p.renderSilently(),this.watchForCartItemDeletion(p,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{s===this.element&&(b.debug(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var vw=`
|
|
50
|
+
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function tl(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),X("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[X("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&X("div",{class:"swiper-button-next",style:n,children:X("span",{})}),t.navigation.enabled&&X("div",{class:"swiper-button-prev",style:n,children:X("span",{})}),t.pagination.enabled&&X("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var xs=class extends He{componentDidMount(){Tt(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return X("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:X("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ct;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return ee(_({},this.getTypoStyles()),{display:"flex"})}};var un=class extends He{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return X("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===kl.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var pn=class extends He{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return X("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:X(On,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Yi,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var Rs=class extends pn{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return X("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:X(vo,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var As=class extends He{render(){return X("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){Tt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ct;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push(X("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(X("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var Ds=class extends He{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),X("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=ki(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=ki(this.props.element.halfStart,{svg:e},this.props.triggerContext),i=this.props.review;if(!i?.rating)return"";let o="";if(this.props.element.showSingleStar)o=r;else{let s=5,a=`${i.rating}`.split(".");for(let c=0;c<+a[0];c++)o+=r,s--;a[1]&&(o+=n,s--);for(let c=0;c<s;c++)o+=r.replace(this.colorRegex,'fill="#f1f1f1"')}return o}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var Ns=class extends He{render(){return X("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){Tt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ct;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(X("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(i=>i.mID===r);this.props.item.setSelectedVariant(n)}};var vo=class extends He{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:X(Rs,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?X(xs,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,i=n.variantImage??n.firstImageURL,o=n.variantSecondaryImage??n.secondaryImageURL;r.lg=r.sm={src:i,name:n.name,secondarySrc:o};let s=X(un,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:X("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:r.showChips?X("cooee-product-options-picker",{item:this.props.item,element:r}):X(Ns,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?X(As,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?X(Ds,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?X(hi,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):X(On,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=X(Qt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:X("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}};var gi=class extends He{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=Kn(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new Sn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return X("div",{style:_({},this.getCompiledStyles()),class:"lc-single-product",children:X(vo,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let e=this.props.item,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let i=this.props.triggerContext.triggerData.discount?.type===er.BXGY;return!r.hasEffectivePrice()&&i&&(n.product=ee(_(_({},n.product),Mt("effective_price",r.effectivePrice.value)),{price:""})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};var Os=class extends He{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=wr()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&_t.loadSwiperScript().then(()=>{this.swiperInstance=el(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=o=>{this.swiperRef=o},i=()=>e?.map(o=>X("div",{class:"swiper-slide",children:this.getProductFragment(o)}));r=X("div",{style:ee(_({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:tl(this.configuration,n,i)})}else r=X("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,i)=>this.getProductFragment(n,i!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,i=n.items.length,o;n.isBundle()?o=this.props.element.prod.symbol?.hide!==!0?i*2-1:i:o=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${o}, auto)`}}return r}getProductFragment(e,r=!1){return X(Pr,{children:[X(gi,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&X("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:X(Qt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var Ps=class extends He{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){_t.loadSwiperScript().then(()=>{this.swiperInstance=el(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=i=>{this.swiperRef=i},n=()=>e.values?.map(i=>X("div",{class:"swiper-slide",onClick:o=>this.onClick(o,{clickAction:this.getClickAction(i)}),children:this.renderElement(i)}));return tl(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return X(un,{element:r,triggerContext:this.props.triggerContext});case 4:return X(pn,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:S.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=Kn(e,{form:r},this.props.triggerContext);return Xt.getParsedElement(n)}getClickAction(e){return Kn(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var On=class extends He{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),Tt(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return X(pn,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return X(Cs,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?X(hi,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return X(Qt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return X(un,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return X(Os,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return X(gi,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return X(Ps,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var Ls=class extends He{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=(this.clickAction?.at===4||this.clickAction?.at===105)&&this.clickAction.gu?.u}componentDidMount(){Tt(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return X(Pr,{children:[X("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:X(On,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&X("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}async onClick(e,r){if(this.isClickable)return super.onClick(e,r)}};var Rt=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Br(new Date,this.engagementTrigger)}static renderedEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=ye.get();widgetAPIService=ve.get(Ir);eventAPIService=ve.get(Dn);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>{xe(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){S.log(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){S.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),!this.shouldStopRendering()&&(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}update(e){ty.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}rerender(){this.rootContainer?.isConnected||(this.preDestroy(),this.renderSilently())}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}afterRootContainerCreated(){}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){S.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(S.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Dt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Dt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Dt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&rr.hasKeys(e.props)&&(this.engagementTrigger.props=_(_({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new rs(e.content)),this.triggerContext.triggerData.widget=this.widget=new Xi(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.triggerContext.triggerData.manipulation=e.manipulation,this.triggerContext.triggerData.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){this instanceof bt?bt.renderedEngagements.add(this):t.renderedEngagements.add(this)}removeFromRendered(){this instanceof bt?bt.renderedEngagements.delete(this):t.renderedEngagements.delete(this)}async getVariation(){S.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(e)}catch(r){S.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){S.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((o,s)=>{o.forEach(async a=>{if(a.isIntersecting){S.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let c=await this.getVariation();n(c),s.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=pi(window,"scroll").pipe(Jt(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=this.isExclusionWithBVariation?N.EVENT_CAMPAIGN_HOLDOUT:N.EVENT_TRIGGER_DISPLAYED,o=new Te(i,n,this.engagementTrigger);o.name===N.EVENT_CAMPAIGN_HOLDOUT&&(o.trigger.holdout=!0),this.eventAPIService.sendSilently(o),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=ge.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),r.addEventListener("cooeeEvent",n=>{let i=n.detail;this.eventAPIService.sendSilently(i)}),r.addEventListener("cooeeCTA",n=>{new jr(this.triggerContext).execute(n.detail)}),this.rootContainer.appendChild(r),this.addToRendered(),r}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,i=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,o=e.width*e.height,s=i/o*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return S.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(N.SHADOW_SPLITTER)){let c=n.split(N.SHADOW_SPLITTER),p=Ge.get().website.commonCSS;i=(await Pi(c[0].trim()))?.shadowRoot,n=c[1].trim(),i&&(_t.injectRawCSS(p,i),_t.injectStylesheet(Ft.styleURL,i))}S.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let o=await Pi(n,10,i??document);if(!o)return S.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case _i.BEFORE:{o.parentElement?.insertBefore(a,o);break}case _i.INSIDE_FIRST:{o.insertBefore(a,o.firstChild);break}case _i.INSIDE_LAST:{o.appendChild(a);break}case _i.AFTER:default:o.parentElement?.insertBefore(a,o.nextSibling)}return a}async startRendering(){xt.log(`Campaign #${this.engagementTrigger.shortID} will be rendered`);let e;try{e=await go.refreshItems(this.engagementTrigger)}catch(r){S.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){S.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),o=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${o} lc-${i}`,n.dataset.engagementId=o,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let n=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),i=Ge.get().website.commonCSS;_t.injectRawCSS(i,n),_t.injectStylesheet(Ft.styleURL,n),_t.injectSwiperCSS(n),e=n}sh(vp(Ls,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let o of i)qr.remove(r,o)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var bt=class extends Rt{static renderedEngagements=new Set;constructor(e){super(e)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!tt.get().isOpen()&&this.runtimeData.pageName!=="cart"){S.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var rl=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=ge.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){S.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){S.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new t(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(m=>m.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(m=>m.mID===e.id.toString());if(!n)return;let i=new Lr(n),o=e.selling_plan_allocation?.selling_plan;if(o)for(let m of i.sellingPlans??[])m.mID===o.id.toString()&&(m.isSelected=!0,i.changeSellingPlan(m));let s=new Dt(r);s.vars=[i],s.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let c=new Ct(this.engagementTrigger);c.placement.selector=`.${a}`,c.items=[s];let p=new bt(c);p.renderSilently(),this.watchForCartItemDeletion(p,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{s===this.element&&(S.debug(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var KS=`
|
|
45
51
|
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
46
52
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
47
53
|
cart {
|
|
@@ -53,7 +59,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
|
-
`,
|
|
62
|
+
`,Gr=class{static navigate(e,r,n){let i=`${location.origin}/discount/${e}`;switch(S.log(`Applying discount code ${e}`,r,n),r){case tr.CART_PAGE:location.href=`${i}?redirect=/cart`;break;case tr.CART_DRAWER:location.href=`${i}?redirect=${location.pathname}#${N.HASH_OPEN_CART_DRAWER}=1`;break;case tr.SHOPIFY_CHECKOUT:location.href=`${i}?redirect=/checkout`;break;case tr.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${i}?redirect=/cart#${N.HASH_INITIATE_CHECKOUT}=1`);break;default:location.href=`${i}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(e,r){let n=tt.get();switch(e){case tr.CART_PAGE:location.href="/cart";break;case tr.SHOPIFY_CHECKOUT:location.href="/checkout";break;case tr.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#${N.HASH_INITIATE_CHECKOUT}=1`);break;case tr.CART_DRAWER:{n.open();break}}r&&n.refreshUI(r)}static async applyWithStorefront(e){let r=Ge.get().storefrontToken;if(!r)throw new Error("Storefront token not set for the store");let n=new Headers;n.append("Content-Type","application/json"),n.append("X-Shopify-Storefront-Access-Token",r);let i=JSON.stringify({query:KS,variables:{cartId:`gid://shopify/Cart/${ge.getCurrent().token}`,discountCodes:e}}),o={method:"POST",headers:n,body:i};S.debug(`Applying ${e.length} coupons on cart`),await Nt.getInstance().request(N.GRAPHQL_API_PATH,o)}static checkThirdPartyMethods(e){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=e}};var XS=`
|
|
57
63
|
mutation cartCreate($input: CartInput) {
|
|
58
64
|
cartCreate(input: $input) {
|
|
59
65
|
cart {
|
|
@@ -66,4 +72,4 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
|
-
`,vn=class{async addToCart(e,r){if(!e.length)return;let n=e.map(c=>{let{vID:p,quantity:f}=this.getVIDAndQuantity(c);return{id:p?+p:+c.mID,quantity:f,properties:r.getPrivateAttributesForLineItem()}}),i=Bn("cart/add.js"),o={items:n},s=$e.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{o.sections_url=window.location.pathname,o.sections=window.cooeeGetCartSections()}catch(c){be(c,"execute-cooeeGetCartSections",{engagementTrigger:r})}else s.isMiniCart()?o.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(o.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let a=JSON.stringify(o);try{let c=await fetch(i,{body:a,method:"post",headers:{"Content-Type":"application/json"}});if(c&&!c.ok&&(await Ma(c,"cart-item-add"),c.status>400&&c.status<500)){let p=await c.json();Yt(p.description||"Failed to add product in cart. Please try again")}if(c.status===200||c.status===302)return b.log(`Added ${e.length} items to Cart`),Yt("Product added to your cart"),c.json()}catch(c){Yt("Failed to add product in cart. Please try again"),be(c,"cart-item-add",{extra:{body:a},engagementTrigger:r})}}async updateLineItem(e,r){if(!$t.hasKeys(r)){b.warn("No update fields provided");return}let n=Bn("cart/change.js"),i=S({id:e.key},r),o=JSON.stringify(i);try{let s=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(s&&!s.ok&&await Ma(s,"cart-item-update"),s.status===200||s.status===302){let a=await s.json();b.log(`Updated ${e}`),se.getCurrent().update(a)}}catch(s){Yt("Failed to update item in cart"),be(s,"cart-item-update",{extra:{body:o}})}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),b.log(`Code-${e} copied`),Yt("Discount code copied")}catch(r){b.error("Failed to copy code",r)}}getProductURL(e){if(!e?.link)return;let r=Ph(e.link);if(r)return xi()+"products/"+r}async upgradeToSubscription(e,r){if(!e){b.warn("Trying to upgrade to subscription with no item");return}let n=await se.getCurrent().getNormalisedCart(),i=e.selectedOrFirstVariant.value,o=n.items.findIndex(f=>f.vID===i.mID),s=i.selectedSellingPlan.value,a=Bn("cart/change.js"),c={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()},p=JSON.stringify(c);try{let f=await fetch(a,{body:p,method:"post",headers:{"Content-Type":"application/json"}});if(f&&!f.ok&&await Ma(f,"cart-switch-subscription"),f.status===200||f.status===302){b.log(`Upgraded ${e} selling plan`),Yt("Line item updated");let m=await f.json();return se.getCurrent().update(m),m}}catch(f){Yt("Failed to update subscription"),be(f,"cart-switch-subscription",{extra:{body:p},engagementTrigger:r})}}async createNewCart(e,r,n){let i=Me.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");if(!e?.vID){b.error("No variant ID found to perform Buy now",e);return}let o=r?[r]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],a=await Fa(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",i);let p=JSON.stringify({query:Ew,variables:{input:{lines:s,discountCodes:o,attributes:a}}});return(await yt.getInstance().request(D.GRAPHQL_API_PATH,{method:"POST",headers:c,body:p})).data?.cartCreate?.cart?.checkoutUrl}async process(e){let r=e.clickAction,n=e.items,i=e.triggerData,o;if(r.at){let s=r;if(b.log(`Performing ${JSON.stringify(s)} action`),s.at===101)o=this.getProductURL(n[0]);else if(s.at===102)n?.length&&await this.addToCart(n,i);else if(s.at===103)await this.copyDiscountCode(i.discount?.code);else if(s.at===105)$e.get().open();else if(s.at===104){let a=e.collections;if(!a?.length)return;o=xi()+"collections/"+a[0].handle}}r.applyDiscount&&i.discount?.code?Dr.navigate(i.discount.code,i.redirectBehaviour,o):o&&(location.pathname=o)}getVIDAndQuantity(e){let r,n;if(e instanceof ht)r=e.vID,n=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=1}return{vID:r,quantity:n}}};var el=class extends ct{ctaExecutor=new vn;constructor(e){super(e)}update(e){super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),this.checkMilestoneSilently(),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneSilently()}checkMilestoneSilently(){this.checkMilestone().catch(e=>{be(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})})}async checkMilestone(){let e=await se.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n,i=[],o=[],s=[],a,c,p=[...r.milestones];for(let m of p){if(m.rewardType!==$l.FREE_AUTO_GIFT)continue;let v=m.items[0],y=m.reached,T=e.items.find(R=>(R.vID===v.vID||R.mID===v.mID)&&R.properties[D.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);y&&(a=m,c=T),T&&i.push(T),!y&&T&&r.removeIneligibleItem?(b.debug(`Removing free gift ${T.vID} from cart`),s.push(T)):y&&!T&&(b.debug(`Adding free gift ${v.vID} to cart`),o.push(v))}r.restrictToLatestFreebie&&a&&(c?(i=i.filter(m=>m.vID!==c.vID),o=[]):o=[a.items[0]],s.push(...i)),s.length&&await this.removeFreeGifts(s),o.length&&(n=await this.ctaExecutor.addToCart(o,this.engagementTrigger));let f=r.coupons;if(f?.length)try{await Dr.applyWithStorefront(f.map(m=>m.couponCode)),$e.get().refreshUI(n,!1)}catch(m){be(m,"cart-apply-discount",{extra:{coupons:f},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(e){await Promise.all(e.map(r=>this.ctaExecutor.updateLineItem(r,{quantity:0})))}};var Ds=class extends ct{constructor(e){super(e)}update(e){super.update(e),this.engagementTrigger.content.update(e.content),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var tl=class extends mt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-shoppable-videos")}};var rl=class extends mt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var nl=class extends mt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(D.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,i=e.detail;if(!$t.hasKeys(i)){b.error(`No detail received for ${n}`);return}b.log("Detail received for BYOB",i);let o=i.campaignID??i.campaignId??i.campaign_id;if(o!==r.shortID&&o!==r.engagementID){b.warn(`Current ${n} is not BYOB. Received: ${o}`);return}let s=i.items;if(!s?.length)return;let a=s.map(c=>new ht({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new Ar(this.triggerContext).execute({embeddedItems:a,clickAction:{at:108,applyDiscount:!0}})}};var so=class{runtimeData=ce.get();static{ay(document.body,{childList:!0,subtree:!0},500,sy).subscribe(()=>{mt.renderedEngagements.forEach(e=>e.rerender()),ct.renderedEngagements.forEach(e=>e.rerender())})}processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let r=[...ct.renderedEngagements];ct.renderedEngagements.clear();for(let n of e)b.log(`\u{1F4E3} ${n} received as cart embed`),!this.findAndUpdateCurrent(n,r)&&(b.log(`${n} is new`),n.isProgressBar()?new el(n).renderSilently():n.isSubscriptionUpsell()?Zc.renderCartUpsell(n):n.isSavingsBar()?new Ds(n).renderSilently():new ct(n).renderSilently());this.removeOldWidgets(r)}processPageWidgetResponse(e){let r=[...mt.renderedEngagements];mt.renderedEngagements.clear();for(let n of e)b.log(`\u{1F4E3} ${n} received as page embed`),!this.findAndUpdateCurrent(n,r)&&(b.log(`${n} is new`),n.isShoppableVideo()?new tl(n).renderSilently():n.isBYOB()?new nl(n).renderSilently():n.isStickyATC()?new rl(n).renderSilently():n.isSavingsBar()?new Ds(n).renderSilently():new mt(n).renderSilently());this.removeOldWidgets(r)}findAndUpdateCurrent(e,r){let n=r.findIndex(i=>i.isSameTrigger(e));return n<0||e.isSubscriptionUpsell()?!1:(r[n].update(e),r[n].renderSilently(),r.splice(n,1),!0)}removeOldWidgets(e){for(let r of e)r.destroy()}};var ao=class{runtimeData=ce.get();httpService=le.get(yt);sessionManager=le.get(tt);constructor(){}async getWidgetProps(){let e={};e.engagementIDs=this.addAvailableEngagementShortIDs(),e.locale=this.runtimeData.locale,await this.addSessionContext(e),e.currentItem=this.runtimeData.getCurrentItem();try{e.cart=await se.getCurrent().getNormalisedCart()}catch(o){b.error("Error fetching Shopify cart before sending widget call",o)}let r=new URLSearchParams(location.search),n=r.get("cooee-preview");n?e.previewIDs=n.trim().split(",").filter(o=>Number.isInteger(+o)):this.runtimeData.previewIDs?.length&&(e.previewIDs=this.runtimeData.previewIDs);let i=r.get("cooee-variant");return i?e.previewVariant=i:this.runtimeData.previewVariant&&(e.previewVariant=this.runtimeData.previewVariant),e}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=Rr.parseFromCurrent()}addAvailableEngagementShortIDs(){let e=document.querySelectorAll(".letscooee-engagement"),r=[];return e.forEach(n=>{let i=n.dataset.engagementId;i&&+i&&r.push(i)}),r}};var cr=class t extends ao{static INSTANCE;loadWidgetsSubject=new wt;constructor(){super(),this.loadWidgetsSubject.pipe(Mt(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>b.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>b.error("Unable to initiate page widgets",e))}),gn.get().subscriber(D.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){tt.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>b.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){tt.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>b.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){tt.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();b.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new pt(i));new so().processPageWidgetResponse(n)}).catch(r=>{b.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();b.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new pt(i));new so().processCartWidgetResponse(n)}).catch(r=>{b.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",S(S({},e),r))}renderCachedCartWidgets(){new so().processCartWidgetResponse(this.runtimeData.cartEngagements)}};var il=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){Es.get(ne.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){b.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Es.set(ne.APP_CONFIG,r).catch(n=>b.error(n)),Xc.processConfiguration(),r.website&&(at.injectRawScript(r.website.commonJS),at.injectRawCSS(r.website.commonCSS)),$e.get().onToggle().subscribe(async({open:n})=>{b.info("Cart drawer is now",n?"open":"closed"),n&&(le.get(cr).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Ce.globalRef.config.update(e);return $e.forceUpdate(),b.debug("App configurations",r),r}async trackViewCartEvent(){let e=await se.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};ge.getInstance().sendEvent(new ye(D.EVENT_VIEW_CART,n))}};var Zn=class t{static INSTANCE;httpAPIService=yt.getInstance();coreService=il.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Te.set(ne.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Te.set(ne.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Te.set(ne.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),b.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);b.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw b.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Te.get(ne.SDK_TOKEN),!this.sdkToken){b.warn("No SDK token found in local storage");return}this.userID=await Te.get(ne.ID),this.deviceID=await Te.get(ne.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){b.debug("SDK Token:",this.sdkToken),b.log("Device ID:",this.deviceID),b.log("User ID:",this.userID),ro.trackDeviceID(this.deviceID),ft.log(`Device ID: ${this.deviceID}`),this.userID&&ft.log(`User ID: ${this.userID}`),this.httpAPIService.setAPIToken(this.sdkToken),this.httpAPIService.setDeviceId(this.deviceID),Vo("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),Gd({id:this.deviceID})}async getSessionValidateData(e){let r=await new qc().safeGet(),n=await Te.get(ne.DEVICE_ID);return n||(n=new et().toHexString(),await Te.set(ne.DEVICE_ID,n)),Z(S({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:D.SDK,page:Rr.parseFromCurrent(),ad:zc.getAdParams(),occurred:this.getSessionStartTime(ce.get().jsLoadTime),currentItem:ce.get().getCurrentItem(),cart:await se.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Te.get(ne.FIRST_SEEN),r=e?new Date(e):new Date;e||await Te.set(ne.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),Vo("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>D.IDLE_TIME_IN_SECONDS?new Date:e}};var tt=class t{static replaySubject=new hs(1);static INSTANCE;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(e){if(b.debug("Initialising SDK",e),Rg(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}Zn.getInstance().init(e),t.INSTANCE.checkSessionOnPageLoad().then(async()=>{t.replaySubject.next(!0),t.replaySubject.complete()}).catch(r=>{b.error("Unable to initiate session",r)})}getCurrentSessionID(){return it.set(ne.SESSION_LAST_USED_TIME,new Date().getTime()),it.get(ne.ID,"")}async checkSessionOnPageLoad(){await Za.request("validate_session",async()=>{await this.checkForNewSession(!0)})}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let e=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return Yd({"cooee_session.number":e[1]}),Vo("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){let r=!1;if(await this.isNewSessionRequired()?(ft.log("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();ft.log(`Session ID: ${n[0]} & number: ${n[1]}`),await Zn.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await it.set(ne.SESSION_SYNCED,!0)}}async startNewSession(){b.debug("Starting new session"),await it.clear(),b.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new et().toHexString();b.debug("New session ID to be used",r);let n=await Te.get(ne.SESSION_NUMBER,0)+1;await Promise.all([Te.set(ne.SESSION_NUMBER,n),it.set(ne.ID,r),it.set(ne.SESSION_LAST_USED_TIME,e.getTime()),it.set(ne.SESSION_LANDING_PAGE,Rr.parseFromCurrent())])}getLandingPage(){return it.get(ne.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Te.get(ne.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await it.get(ne.ID))return!0;let e=await it.get(ne.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>D.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await it.get(ne.SESSION_SYNCED,!1)}};var ol=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(r=>{r instanceof Sr&&this.loadFamily(r.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let r=[];e.fonts.forEach(i=>{if(i.url){let o=new FontFace(D.COOEE+e.name,i.getURL(),i.getFontDescriptor());r.push(o.load())}}),this.loadedFonts.push(e.name),(await Promise.all(r)).forEach(i=>{document.fonts.add(i)})}};var sl=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),b.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var al=class{apiService;action;triggerContext;constructor(e,r){this.action=e,this.apiService=ge.getInstance(),this.triggerContext=r}async execute(){let e=this.containsCTA()?D.EVENT_TRIGGER_CLICKED:D.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(e),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:await this.collectFormData();break;case void 0:case 105:break;default:b.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;ka(e)||(e=`//${e}`),window.open(e,"_self")}}async closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),await this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){b.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(r=>console.log(r)).catch(r=>console.error(r))}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}async collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let i=document.getElementById(r.id).value;r.type===51?e.email=i:r.type===52&&(e.mobile=i)}await this.closeTriggerAndSendEvent(D.EVENT_FORM_SUBMITTED,{form:e}),Yt("Coupon applied on cart"),sl.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new vn().process(r);let n={action:this.containsCTA()?D.CAMPAIGN_CLICKED_ACTIVITY:D.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(D.POPUP_ACTIVITY_EVENT,{detail:n}))}};var Zt=class{renderer=En.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new io(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=Z(S(S(S(S({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});ei(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&J(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&J(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let e={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};ei(this.inappHTMLEl,e)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let r=(e/100).toFixed(2);J(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?J(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):J(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new In(this.inappElement.trf);e&&e.rotate&&J(this.inappHTMLEl,"transform",`rotate(${e.rotate}deg)`)}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation(),new al(e,this.triggerContext).execute()}),J(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var Nr=class extends Zt{constructor(e,r,n){super(e,r,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let e={},r=this.inappElement.typography;return r&&(e.fontSize=this.stylesConverter.getSizePx(r.fs),e.fontFamily=D.COOEE+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),ei(this.inappHTMLEl,e),e}processPart(e,r){let n=[];r.u&&n.push("underline"),r.st&&n.push("line-through"),n.length||n.push("normal"),J(e,"font-weight",r.b?"bold":"normal"),J(e,"font-style",r.i?"italic":"normal"),J(e,"text-decoration",n.join(" ")),J(e,"color",r.c??"inherit"),J(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?ai[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),J(this.inappHTMLEl,"text-align",r)}};var Ns=class extends Nr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=document.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.inappHTMLEl.appendChild(r)}),this.processCommonBlocks()}};var Os=class extends Zt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var ni=class extends Zt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),J(this.inappHTMLEl,"max-width","none"),J(this.inappHTMLEl,"max-height","none"),J(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var Ps=class t extends Zt{constructor(r,n,i){super(r,n,i);this.parent=r;this.inappHTMLEl=document.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(D.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),J(this.inappHTMLEl,"z-index",t.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let r=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(J(this.inappHTMLEl,"width","100%"),J(this.inappHTMLEl,"height","100%")):(J(this.inappHTMLEl,"width","100vw"),J(this.inappHTMLEl,"height","100vh")),J(this.inappHTMLEl,"top","0"),J(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,i=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),o=this.stylesConverter.getScaledSize(r.h)+n.getVertical();J(this.inappHTMLEl,"width",i+"px"),J(this.inappHTMLEl,"height",o+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return S(S({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded()){J(this.inappHTMLEl,"position","block");return}J(this.inappHTMLEl,"position","absolute")}else J(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var cl=class extends Zt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),J(this.inappHTMLEl,"position","relative"),J(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(D.IN_APP_CONTAINER_NAME),this}};var ll=class t extends Nr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=Z(S(S(S({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>ei(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(t.DAYS)),e.hour&&this.elements.push(this.getChild(t.HOURS)),e.minute&&this.elements.push(this.getChild(t.MINUTES)),e.second&&this.elements.push(this.getChild(t.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=document.createElement("div"),n=document.createElement("span"),i=document.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,J(i,"font-size","0.5em"),J(i,"text-align","center"),J(i,"font-family","inherit"),J(n,"text-align","center"),J(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),J(r,"display","flex"),J(r,"flex-direction",this.inappElement.horizontal?"":"column"),J(r,"justify-content","center"),J(r,"align-items","center"),J(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${t.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${t.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${t.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${t.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}};var ul=class extends Nr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){J(this.inappHTMLEl,"background","#ffffff00"),J(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener("click",r=>{r.stopPropagation()}),e.addEventListener("change",()=>{let r=new _r(JSON.parse(e.value));this.updateItems(r)})}updateItems(e){let r=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[r.toEmbed(e)];let n=this.parentHTMLEl.querySelector("#coo-13");if(!n)return;let i=e.imgs[0]??r.imgs?.at(0);i?.url&&n.setAttribute("src",i.url)}addOptions(){let e=this.triggerContext.triggerData.items,r=this.inappHTMLEl;if(!e?.length){r.add(this.createOption(this.inappElement.placeholderText));return}let n=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(i=>{r.add(this.createOption(i.name??"Default",i,i.mID===n?.vID))})}createOption(e,r,n){let i=document.createElement("option");return i.text=e,i.value=JSON.stringify(r),n&&(i.selected=!0),r||(i.disabled=!0),i}};var co=class extends Nr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("input"),this.insertElement()}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute("placeholder",this.inappElement.placeholderText),J(this.inappHTMLEl,"background","#ffffff00"),J(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t)}};var pl=class t extends co{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","email"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.EMAIL_REGEX)?(J(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(J(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var fl=class t extends co{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","tel"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.MOBILE_REGEX)?(J(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(J(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var ml=class extends ni{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var En=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static ACTIVE_TRIGGER_DATA;static _instance;safeHTTP;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){t._instance=this,this.safeHTTP=ge.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}static get(){return t._instance}render(e){this.renderEngagement(new pt(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,o=e.spc,s=this.getWidth(),a=this.getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=o.getHorizontal(),a-=o.getVertical(),s/a<n/i?this.scalingFactor=s/n:this.scalingFactor=a/i,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.parent&&this.isParentNotBody()&&J(this.parent,"position","relative")}isParentNotBody(){return this.parent!==document.body}getWidth(){return this.parent&&this.parent!==document.body?this.parent.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){if(this.triggerContext=new mn(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(ar()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!$e.get().isOpen()||!ar()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=$e.get().onToggle().subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){t.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){be(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),ar()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&t.ACTIVE_TRIGGER_DATA){let n={triggerShown:new cn(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(ce.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=D.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new Ps(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw b.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new ye(D.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:D.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(D.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new ye(r,e,this.triggerContext.triggerData);n.name===D.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof Ni?new pl(e,r,n).render():r instanceof Oi?new fl(e,r,n).render():r instanceof rn?new Ns(e,r,n).render():r instanceof Pi?new ml(e,r,n).render():r instanceof Vr?new ni(e,r,n).render():r instanceof Un?new Os(e,r,n).render():r instanceof Ai?new ll(e,r,n).render():r instanceof Di?new ul(e,r,n).render():b.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new cl(this.rootContainer,r,e).render().getHTMLElement(),new ol().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),t.ACTIVE_TRIGGER_DATA=void 0;let n=this.containerHTMLElement.animate(r,{duration:500,easing:"ease-in-out"});n.onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e)}skipTrigger(e,r){let n=new ye(D.EVENT_CAMPAIGN_REJECTED,r,e);this.safeHTTP.sendEvent(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let o=i.bg?.img?.src;if(o&&n.push(this.getPromise(o)),i.t===1){let s=i.src;if(!s)return;n.push(this.getPromise(s))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}};var dl=class{triggerData;safeHttpService=ge.getInstance();render(e){e.contentSource===bo.KLAVIYO&&(this.triggerData=e,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",e.klaviyoFormID]))}handleKlaviyoEvents(e){if(e.type!=="klaviyoForms")return;let r=e.detail;if(r.formId!==this.triggerData.klaviyoFormID){b.warn("Received invalid trigger callback");return}switch(r.type){case"open":this.safeHttpService.sendEvent(new ye(D.EVENT_TRIGGER_DISPLAYED,{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);this.safeHttpService.sendEvent(new ye(D.EVENT_FORM_SUBMITTED,{form:n},this.triggerData)),this.safeHttpService.updateProfile(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new ye(D.EVENT_TRIGGER_CLOSED,{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if($t.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{i.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};var hl=class{static trackIntent(e){if(!this.isInstalled()){b.log("Facebook pixel not installed");return}if(!Me.get().pixelPush){b.log("Facebook pixel push not enabled");return}let n=kn[e.intent]?.toLowerCase(),i=e.segmentName;!n&&!i||(b.debug(`Sending ${n} intent and ${i} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:n,segment_value:e.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}};var hn=class t{static INSTANCE;httpService=le.get(yt);sessionManager=le.get(tt);runtime=ce.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>b.error(`Failed to send ${e.name}`,r))}async send(e){if(b.debug(`Sending event ${e.name}`),ft.log(`Sending event ${e.name} with id ${e.id}`),this.shouldReject(e)){b.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==D.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),e.locale=this.runtime.locale,this.httpService.post("/v1/event/track",e).then(async r=>{b.log("\u2705 Event tracked:",e.name),ft.log(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{b.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(b.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=Rr.parseFromCurrent()}async addShopifyContext(e){try{e.cart=await se.getCurrent().getNormalisedCart()}catch(r){b.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{be(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){b.log(`Nothing to engage after ${e.name}`);return}b.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData),ft.log(`\u{1F4E3} Campaign #${r.triggerData.shortID}) will be shown`);let n=new pt(r.triggerData);n.occurred=e.occurred;let i;try{i=await no.refreshItems(n)}catch(o){b.error("Failed to refresh the products",o);return}if(n.items=i,n.contentSource===bo.KLAVIYO){new dl().render(n);return}new En().renderEngagement(n).catch(o=>{be(o,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(ro.trackIntent(e.intent),hl.trackIntent(e),ft.log(`Intent is <strong>${kn[e.intent]}</strong>`))}addShopifyAttributes(){se.getCurrent().addCooeeAttributes().catch(e=>{b.error("Fail to add attributes in cart",e)})}};var Ar=class{constructor(e){this.triggerContext=e}safeHTTP=ge.getInstance();eventAPIService=hn.getInstance();async execute(e){let r=ce.get().getCurrentItem(),n=e.clickAction;if(!n)return;let i=e.item,o=this.triggerContext,s=new vn,a=o.triggerData.redirectBehaviour,c=!!o.triggerData.discount?.type&&!!n?.applyDiscount,p={selectedVariants:o.triggerData.nonMutableItems.map(A=>({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,variantID:A.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},f="",m=[],v=[];if(i?v=[i.toEmbed()]:e.embeddedItem&&(v=[e.embeddedItem]),n.at===108){let A=o.selectedItems;if(v=e.embeddedItems??A.map(N=>N.toEmbed()),o.shouldGiveFBTDiscount||e.embeddedItems?.length){let N;e.embeddedItems?N=e.embeddedItems.map(P=>({itemMID:P.mID,mID:P.vID,variantID:P.vID,quantity:P.quantity})):N=A.map(P=>({itemMID:P.mID,mID:P.selectedOrFirstVariant.value.mID,variantID:P.selectedOrFirstVariant.value.mID}));let B=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&B&&(N.push({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID,isPrimary:!0}),v.unshift(B.toEmbed())),p.selectedVariants=N,o.triggerData.isBundleOnPDP()&&p.selectedVariants.forEach(P=>{P.mID===r.vID&&(P.isPrimary=!0)})}else p=void 0;m=e.embeddedItems??A}else if(n.at===107){let A=await se.getCurrent().getNormalisedCart();v=A.items,p.selectedVariants=A.items.map(N=>({itemMID:N.mID,mID:N.vID}))}else if(n.at===102)m=i?[i]:[e.embeddedItem];else if(n.at===101)f=i?xi()+"products/"+i.slug:e.embeddedItem?.link;else if(n.at===4){let A=ka(n.gu?.u);A&&(f=A.href)}else if(n.at===109){let A=await s.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),$e.get().refreshUI(A)}else if(n.at===104){let A=this.triggerContext.triggerData.collections?.[0];A&&(f="collections/"+A.handle)}if(this.sendTriggerClicked(v,{from:"button"},e.video),b.debug({redirectPath:f,redirectBehaviour:a,hasDiscount:c}),!c&&f){location.href=f;return}let y,T=!1;try{y=await this.getOrGenerateDiscountCode(p),b.debug("Discount code (if any) to apply",y)}catch(A){if(!this.triggerContext.triggerData.isBYOB()){ly.default.error("Unable to get a discount code",A);return}}if(y&&n.at===103)await s.copyDiscountCode(y);else if(n.at===110){let A=await s.createNewCart(r,y,o.triggerData);A&&(location.href=A);return}try{y&&await Dr.applyWithStorefront([y])}catch(A){b.error(A),T=!0}let R;if(m?.length&&(R=await s.addToCart(m,o.triggerData)),T&&y){Dr.navigate(y,a,f);return}if(f){location.href=f;return}Dr.navigateWithoutDiscount(a,R)}sendTriggerClicked(e,r,n){let i=new ye(D.EVENT_TRIGGER_CLICKED,r,this.triggerContext.triggerData);i.items=e,n?.id&&(i.videos=[n.id]),this.eventAPIService.sendSilently(i)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===Ht.STATIC){if(!r.code)throw up("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await this.generateDiscount(e),!n)throw b.error("No discount code found",e),new Error("Discount code not found or generated");return n}}async generateDiscount(e){try{return(await this.safeHTTP.generateDiscount(e))?.code}catch(r){throw Yt("Failed to generate a discount code"),be(r,"backend-generate-discount",{extra:{discountData:JSON.stringify(e)},triggerContext:this.triggerContext}),r}}};var gl=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=le.get(_n)}execute(e){for(let r of e){if(!r.experimentConfig)continue;this.executeExperiment(r)&&this.trackExperimentRan(r)}if(document.querySelector("#lc-hide-body")?.remove(),!document.body){ha("No body element found","error");return}this.setupMutationObserver()}executeExperiment(e){let r=e.experimentConfig?.modifications;return r?.length?r.some(n=>{if(!n.cssSelector)return b.debug("No CSS Selector available",e?.toString()),!1;this.modifications.push(n);let i=Array.from(document.querySelectorAll(n.cssSelector));return i?.length?(this.executeSingleModification(n,i),!0):!1}):(b.log("Nothing to experiment",e.toString()),!0)}executeSingleModification(e,r){if(r?.length)for(let n of r)Object.assign(n.style,e.style),e.type==="TEXT"&&e.text?n.innerHTML=e.text:e.type==="IMAGE"&&this.updateImage(e,n)}trackExperimentRan(e){if(e.id==="preview"){b.warn("Skipping experiment attribution as its preview",e.toString());return}this.eventAPIService.trackExperiment({name:D.EVENT_EXPERIMENT_START,experiment:new cn(e)}).catch(r=>{b.error("Fail to track experiment",r)})}setupMutationObserver(){new MutationObserver(r=>{r.forEach(n=>{n.addedNodes.forEach(i=>{i instanceof HTMLElement&&this.modifications.forEach(o=>{i.matches&&i.matches(o.cssSelector)?(b.debug("Re-applying experiment",o.toString()),this.executeSingleModification(o,[i])):i.querySelectorAll&&(b.debug("Re-applying experiment",o.toString()),this.executeSingleModification(o,Array.from(i.querySelectorAll(o.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}updateImage(e,r){let n=e.image?.lg?.src,i=e.image?.sm?.src;!n&&!i||(r instanceof HTMLPictureElement?this.updatePictureElement({desktop:n,mobile:i},r):this.updateImageElement({desktop:n,mobile:i},r))}updateImageElement(e,r){ar()&&e.mobile?(r.setAttribute("src",e.mobile),r.removeAttribute("srcset")):e.desktop&&(r.setAttribute("src",e.desktop),r.removeAttribute("srcset"))}updatePictureElement(e,r){if(r.innerHTML="",e.mobile){let i=document.createElement("source");i.srcset=e.mobile,i.media="(max-width: 767px)",r.append(i)}if(e.desktop){let i=document.createElement("source");i.srcset=e.desktop,i.media="(min-width: 768px)",r.append(i)}let n=document.createElement("img");n.src=e.desktop??e.mobile??"",r.append(n)}};var _n=class t extends ao{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadExperimentSilently(){Te.get(ne.SDK_TOKEN).then(e=>{e?this.loadExperiments().catch(r=>b.error("Unable to initiate experiment",r)):tt.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>b.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let e=await this.getWidgetProps();b.log("Load experiments",e),this.httpService.post("/v1/engagement/experiments",e).then(async r=>{let n=r.experiments.map(i=>new pt(i));new gl().execute(n)}).catch(r=>{b.error("Error sending experiment getter",r)})}async trackExperiment(e){await this.addSessionContext(e),await this.httpService.post("/v1/event/experiment",e)}};var yl=class{runtimeData=ce.get();widgetAPIService=le.get(cr);experimentAPIService=le.get(_n);meddle(){let e=Ce.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Ce.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},e.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Ce.previewWidget.bind(Ce),e.previewPopup=Ce.previewPopup.bind(Ce)}overwritePush(e,r){Pn(e,"push",r)}meddleAccount(){this.overwritePush(Ce.globalRef.account,(...e)=>{this.processAccount(e[0])}),Ce.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Ce.globalRef.events,(...e)=>{this.processEvent(e[0])}),Ce.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Ce.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Ce.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Ce.authenticate(e),e.flags&&Qn.setFlags(e.flags))}processEvent(e){e&&(D.JS_LOAD_WHITELIST_EVENTS.includes(e[0])?Ce.sendEvent(e[0],e[1],S({occurred:this.runtimeData.jsLoadTime},e[2])):Ce.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Ce.updateProfile(e)}processPageName(e){e&&Ce.setPageName(e)}meddlePage(){this.overwritePush(Ce.globalRef.page,(...e)=>{this.processPage(e[0])}),Ce.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&this.runtimeData.setCurrentItem(e.currentItem),e.currency&&(this.runtimeData.currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&Ce.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiment=e.activeExperiment)}async testCartUpdate(){if(this.runtimeData.pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=window.ShopifyAnalytics?.meta??{},r=e.selectedVariantId;if(r||(e.product?.variants?.length>0&&(r=e.product.variants[0].id),r||(r=this.runtimeData.getCurrentItem()?.vID)),!r){window.alert("Could not find a variant to test. Please try a different product page");return}let n=new pt({id:"preview",shortID:"1",redirectBehaviour:Vt.CART_DRAWER});await new Ar(new mn(new Date,n)).execute({clickAction:{at:102},embeddedItem:new ht({vID:r})})}};var lo=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=D.COOEE.concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var uo=class t{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=le.get(ge);lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}resetScrollID(e){lo.remove(D.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}vi(()=>{this.observeWindowScroll()})}observeWindowScroll(){Jn(window,"scroll").pipe(Mt(t.DEBOUNCE_TIME),Yr(()=>{let e=this.getPercentScrolledY();if(e>100){b.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=t.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=lo.getString(D.SESSION_STORAGE_SCROLL_ID,""),i=new ye(D.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),lo.setString(D.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}};var vl=class t{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=le.get(ge);runtimeData=ce.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){b.info("Not sending background event as user was inactive on website");return}b.info(`Sending background event with ${e} seconds`);let r={};r[t.ACTIVE_DURATION]=e,this.apiService.sendEvent(new ye(D.EVENT_APP_BACKGROUND,r))}};var El=class{compareCartItemSubject=new wt;constructor(){this.compareCartItemSubject.pipe(Mt(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let e=this,r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){e.performEvent(this._url).catch(n=>b.error("Unable to process cart change in XMLHttpRequest",n))}),r.apply(this,arguments)},b.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=function(n){return r.apply(window,arguments).then(i=>(e.performEvent(n.toString()).catch(o=>b.error("Unable to process cart change in fetch",o)),i))},b.debug("Securely overwritten window.fetch method")}async performEvent(e){this.isCartManipulationURL(e)&&(ce.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(e){return/\/cart\/(add|change|update|clear)/.test(e)}sendChangesAsEvents(e,r){let n=e?.items,i=r.items,o=[],s=[];if(b.debug(`Comparing cart change with old count ${n?.length} to new count ${i.length}`),i?.forEach(a=>{let c=n?.find(p=>p.vID===a.vID);if(c){if(c.quantity!==a.quantity){let p=c.quantity<a.quantity,f=Math.abs(c.quantity-a.quantity),m=Z(S({},a),{quantity:f});p?o.push(m):s.push(m)}n&&qd(n,c)}else o.push(a)}),n)for(let a of n)s.push(a);b.debug(`Cart delta: added: ${o.length}, removed: ${s.length}`),o.length&&this.sendEvent(D.EVENT_ADD_TO_CART,{items:o}),s.length&&e.token===r.token&&this.sendEvent(D.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||o.length)&&gn.get().broadcast(D.CART_UPDATE_BROADCAST,{itemsAdded:o,itemsRemoved:s})}sendEvent(e,r){let n=new ye(e,r);le.get(ge).sendEvent(n)}async compareCartItems(){let e=await Te.get(ne.CURRENT_CART,{}),r=await se.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,r)}};var _l=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=async function(n,i){try{await e.modifyRequest(n,i)}catch(o){be(o,"modify-graphql-request",{extra:{body:JSON.stringify(i?.body)}})}return r(n,i)},b.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(e,r){let n=typeof e=="string"?e:e instanceof Request?e.url:"";if(!(n.includes("graphql.json")&&r?.method==="POST")||!r.body)return;let i;if(typeof r.body=="string")try{i=JSON.parse(r.body)}catch{return}else i=r.body;i?.variables?.input&&(b.debug("Intercepted fetch request of:",n),i?.query.includes("cartCreate")&&(r.body=await this.updatedBody(i),this.sendBuyNowEvent()))}async updatedBody(e){let r=e.variables.input.attributes??[],n=await Fa();return e.variables.input.attributes=[...r,...n],JSON.stringify(e)}sendBuyNowEvent(){let e=ce.get().getCurrentItem();if(!e)return;let r=new ye(D.EVENT_BUY_NOW_CLICKED,{items:[e]});ge.getInstance().sendEvent(r)}};var po=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new ye(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});ge.getInstance().sendEvent(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>b.error(e))}async listen(){this.elements=await mp(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Sl=class t extends po{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(t.selectors,D.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var bl=class t extends po{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(t.selectors,D.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var wl=class{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){vi(()=>{b.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let e=window.location.hash?.substring(1);if(e)if(e.includes(D.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(D.THIRD_PARTY_CHECKOUT_EVENT));let r=document.querySelector(this.selector);if(!r){b.debug("No clickable cart checkout button found");return}b.debug("Clickable cart checkout button found",r),r.click()}else e.includes(D.HASH_OPEN_CART_DRAWER)&&$e.get().open()}};var Ls=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let e=await se.getCurrent().getNormalisedCart(),r={via:"GoKwik",items:e.items,cartToken:e.token,amount:{value:e.amount,currency:e.currency}},n=new ye(D.EVENT_CHECKOUT_STARTED,r);ge.getInstance().sendEvent(n)})}};var Il=class{async migrate(){}};var Ce=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new Il().migrate(),this.autoAuthenticate(),new yl().meddle(),le.get(_n).loadExperimentSilently(),new vl().listen(),new El().listen(),new _l().listen(),new wl().listen(),le.get(uo).listen(),le.get(bl).listenSilently(),le.get(Sl).listenSilently(),le.get(cr).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),ft.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||Pn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Pn(this.globalRef,"config",new Me),Pn(this.globalRef,"runtimeData",new ce),Pn(this.globalRef,"uaParser",new xr),b.debug("Global reference initialised")}static injectWidgetAssets(){at.injectScriptURL(It.widgetURL,"cooee-widget-sdk"),at.injectStylesheet(It.styleURL)}static autoAuthenticate(){let e=Oh();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;let r=e.appID?.trim(),n=e.shopifyShop;if((fp(r)||r.length!==24)&&fp(n)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,le.get(tt).init(e)}static sendEvent(e,r,n){let i=new ye(e,r,n?.triggerData);n?.occurred&&(i.occurred=n.occurred),le.get(ge).sendEvent(i)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");le.get(ge).updateProfile(e)}static setPageName(e){if(!e)return;let r=ce.get(),n=r.pageName;if(e===n)return;if(r.pageName=e,e==="cart"&&le.get(cr).loadOrRenderWidgetsAfterCartChange(),D.BLACKLISTED_PAGE_NAMES.some(s=>e.includes(s))){le.get(uo).resetScrollID();return}let i={};n&&(i.ps=n);let o=new ye(D.EVENT_SCREEN_VIEW,i);o.occurred=r.jsLoadTime,le.get(ge).sendEvent(o),le.get(uo).resetScrollID(o.occurred)}static previewPopup(e,r){new En(r).render(e)}static previewWidget(e){new mt(new pt(e)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(e){b.error(e)}window.addEventListener("message",e=>{if(b.debug("Received event",e),!e.origin.includes("letscooee.com")&&!e.origin.includes("localhost"))return;let r=e.data;typeof r=="object"&&(r.action==="POPUP_PREVIEW"?(this.previewPopup(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)):r.action==="WIDGET_PREVIEW"&&(this.previewWidget(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)))})}}static attachGoKwikListeners(){let e=ce.get();window.addEventListener("kp-modal:opened",()=>{e.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",r=>{let{token:n}=r.detail;n&&this.updateProfile({goKwikToken:n})}),window.gokwikSdk?Ls.attachCheckoutListener():window.addEventListener("gokwikLoaded",Ls.attachCheckoutListener)}static storePreviewParams(){let e=ce.get(),r=new URLSearchParams(location.search),n=r.get("cooee-preview");n&&(e.previewIDs=n.trim().split(",").filter(o=>Number.isInteger(+o)));let i=r.get("cooee-variant");i&&(e.previewVariant=i)}};Qf();Zf();b.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.debug("Execution order:","IIFE start"),await Ce.initForMerchantWebsiteOnly(),await Ce.initForAll(),b.debug("Execution order:","IIFE end")))());b.debug("Execution order:","bottom");
|
|
75
|
+
`,Pn=class{async addToCart(e,r){if(!e.length)return;let n=e.map(c=>{let{vID:p,quantity:m}=this.getVIDAndQuantity(c);return{id:p?+p:+c.mID,quantity:m,properties:r.getPrivateAttributesForLineItem()}}),i=Xn("cart/add.js"),o={items:n},s=tt.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{o.sections_url=window.location.pathname,o.sections=window.cooeeGetCartSections()}catch(c){xe(c,"execute-cooeeGetCartSections",{engagementTrigger:r})}else s.isMiniCart()?o.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(o.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let a=JSON.stringify(o);try{let c=await fetch(i,{body:a,method:"post",headers:{"Content-Type":"application/json"}});if(c&&!c.ok&&(await Ua(c,"cart-item-add"),c.status>400&&c.status<500)){let p=await c.json();sr(p.description||"Failed to add product in cart. Please try again")}if(c.status===200||c.status===302)return S.log(`Added ${e.length} items to Cart`),sr("Product added to your cart"),c.json()}catch(c){sr("Failed to add product in cart. Please try again"),xe(c,"cart-item-add",{extra:{body:a},engagementTrigger:r})}}async updateLineItem(e,r){if(!rr.hasKeys(r)){S.warn("No update fields provided");return}let n=Xn("cart/change.js"),i=_({id:e.key},r),o=JSON.stringify(i);try{let s=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(s&&!s.ok&&await Ua(s,"cart-item-update"),s.status===200||s.status===302){let a=await s.json();S.log(`Updated ${e}`),ge.getCurrent().update(a)}}catch(s){sr("Failed to update item in cart"),xe(s,"cart-item-update",{extra:{body:o}})}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),S.log(`Code-${e} copied`),sr("Discount code copied")}catch(r){S.error("Failed to copy code",r)}}getProductURL(e){if(!e?.link)return;let r=Ch(e.link);if(r)return Fi()+"products/"+r}async upgradeToSubscription(e,r){if(!e){S.warn("Trying to upgrade to subscription with no item");return}let n=await ge.getCurrent().getNormalisedCart(),i=e.selectedOrFirstVariant.value,o=n.items.findIndex(m=>m.vID===i.mID),s=i.selectedSellingPlan.value,a=Xn("cart/change.js"),c={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()},p=JSON.stringify(c);try{let m=await fetch(a,{body:p,method:"post",headers:{"Content-Type":"application/json"}});if(m&&!m.ok&&await Ua(m,"cart-switch-subscription"),m.status===200||m.status===302){S.log(`Upgraded ${e} selling plan`),sr("Line item updated");let f=await m.json();return ge.getCurrent().update(f),f}}catch(m){sr("Failed to update subscription"),xe(m,"cart-switch-subscription",{extra:{body:p},engagementTrigger:r})}}async createNewCart(e,r,n){let i=Ge.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");if(!e?.vID){S.error("No variant ID found to perform Buy now",e);return}let o=r?[r]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],a=await Va(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",i);let p=JSON.stringify({query:XS,variables:{input:{lines:s,discountCodes:o,attributes:a}}});return(await Nt.getInstance().request(N.GRAPHQL_API_PATH,{method:"POST",headers:c,body:p})).data?.cartCreate?.cart?.checkoutUrl}async process(e){let r=e.clickAction,n=e.items,i=e.triggerData,o;if(r.at){let s=r;if(S.log(`Performing ${JSON.stringify(s)} action`),s.at===101)o=this.getProductURL(n[0]);else if(s.at===102)n?.length&&await this.addToCart(n,i);else if(s.at===103)await this.copyDiscountCode(i.discount?.code);else if(s.at===105)tt.get().open();else if(s.at===104){let a=e.collections;if(!a?.length)return;o=Fi()+"collections/"+a[0].handle}}r.applyDiscount&&i.discount?.code?Gr.navigate(i.discount.code,i.redirectBehaviour,o):o&&(location.pathname=o)}getVIDAndQuantity(e){let r,n;if(e instanceof At)r=e.vID,n=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=1}return{vID:r,quantity:n}}};var nl=class extends bt{ctaExecutor=new Pn;constructor(e){super(e)}update(e){super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),this.checkMilestoneSilently(),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneSilently()}checkMilestoneSilently(){this.checkMilestone().catch(e=>{xe(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})})}async checkMilestone(){let e=await ge.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n,i=[],o=[],s=[],a,c,p=[...r.milestones];for(let f of p){if(f.rewardType!==Hl.FREE_AUTO_GIFT)continue;if(f.isUIOnly&&!f.allowATC){S.debug(`Skipping milestone ${f.label} as it is UI only and does not allow ATC`);continue}let E=f.items[0],y=f.reached,T=e.items.find(D=>(D.vID===E.vID||D.mID===E.mID)&&D.properties[N.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);y&&(a=f,c=T),T&&i.push(T),!y&&T&&r.removeIneligibleItem?(S.debug(`Removing free gift ${T.vID} from cart`),s.push(T)):y&&!T&&(S.debug(`Adding free gift ${E.vID} to cart`),o.push(E))}r.restrictToLatestFreebie&&a&&(c?(i=i.filter(f=>f.vID!==c.vID),o=[]):o=[a.items[0]],s.push(...i)),s.length&&await this.removeFreeGifts(s),o.length&&(n=await this.ctaExecutor.addToCart(o,this.engagementTrigger));let m=r.coupons;if(m?.length)try{await Gr.applyWithStorefront(m.map(f=>f.couponCode)),tt.get().refreshUI(n,!1)}catch(f){xe(f,"cart-apply-discount",{extra:{coupons:m},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(e){await Promise.all(e.map(r=>this.ctaExecutor.updateLineItem(r,{quantity:0})))}};var Bs=class extends bt{constructor(e){super(e)}update(e){super.update(e),this.engagementTrigger.content.update(e.content),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var il=class extends Rt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-shoppable-videos")}};var ol=class extends Rt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var sl=class extends Rt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(N.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,i=e.detail;if(!rr.hasKeys(i)){S.error(`No detail received for ${n}`);return}S.log("Detail received for BYOB",i);let o=i.campaignID??i.campaignId??i.campaign_id;if(o!==r.shortID&&o!==r.engagementID){S.warn(`Current ${n} is not BYOB. Received: ${o}`);return}let s=i.items;if(!s?.length)return;let a=s.map(c=>new At({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new jr(this.triggerContext).execute({embeddedItems:a,clickAction:{at:108,applyDiscount:!0}})}};var Eo=class{runtimeData=ye.get();static{ey(document.body,{childList:!0,subtree:!0},500,Zg).subscribe(()=>{Rt.renderedEngagements.forEach(e=>e.rerender()),bt.renderedEngagements.forEach(e=>e.rerender())})}processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let r=[...bt.renderedEngagements];bt.renderedEngagements.clear();for(let n of e)S.log(`\u{1F4E3} ${n} received as cart embed`),!this.findAndUpdateCurrent(n,r)&&(S.log(`${n} is new`),n.isProgressBar()?new nl(n).renderSilently():n.isSubscriptionUpsell()?rl.renderCartUpsell(n):n.isSavingsBar()?new Bs(n).renderSilently():new bt(n).renderSilently());this.removeOldWidgets(r)}processPageWidgetResponse(e){let r=[...Rt.renderedEngagements];Rt.renderedEngagements.clear();for(let n of e)S.log(`\u{1F4E3} ${n} received as page embed`),!this.findAndUpdateCurrent(n,r)&&(S.log(`${n} is new`),n.isShoppableVideo()?new il(n).renderSilently():n.isBYOB()?new sl(n).renderSilently():n.isStickyATC()?new ol(n).renderSilently():n.isSavingsBar()?new Bs(n).renderSilently():new Rt(n).renderSilently());this.removeOldWidgets(r)}findAndUpdateCurrent(e,r){let n=r.findIndex(i=>i.isSameTrigger(e));return n<0||e.isSubscriptionUpsell()?!1:(r[n].update(e),r[n].renderSilently(),r.splice(n,1),!0)}removeOldWidgets(e){for(let r of e)r.destroy()}};var _o=class{runtimeData=ye.get();httpService=ve.get(Nt);sessionManager=ve.get(gt);constructor(){}async getWidgetProps(){let e={};e.engagementIDs=this.addAvailableEngagementShortIDs(),e.locale=this.runtimeData.locale,await this.addSessionContext(e),e.currentItem=this.runtimeData.getCurrentItem();try{e.cart=await ge.getCurrent().getNormalisedCart()}catch(o){S.error("Error fetching Shopify cart before sending widget call",o)}let r=new URLSearchParams(location.search),n=r.get("cooee-preview");n?e.previewIDs=n.trim().split(",").filter(o=>Number.isInteger(+o)):this.runtimeData.previewIDs?.length&&(e.previewIDs=this.runtimeData.previewIDs);let i=r.get("cooee-variant");return i?e.previewVariant=i:this.runtimeData.previewVariant&&(e.previewVariant=this.runtimeData.previewVariant),e}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=Wr.parseFromCurrent()}addAvailableEngagementShortIDs(){let e=document.querySelectorAll(".letscooee-engagement"),r=[];return e.forEach(n=>{let i=n.dataset.engagementId;i&&+i&&r.push(i)}),r}};var Ir=class t extends _o{static INSTANCE;loadWidgetsSubject=new Ut;constructor(){super(),this.loadWidgetsSubject.pipe(Jt(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>S.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>S.error("Unable to initiate page widgets",e))}),Nn.get().subscriber(N.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){gt.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>S.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){gt.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>S.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){gt.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();S.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ct(i));new Eo().processPageWidgetResponse(n)}).catch(r=>{S.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();S.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ct(i));new Eo().processCartWidgetResponse(n)}).catch(r=>{S.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",_(_({},e),r))}renderCachedCartWidgets(){new Eo().processCartWidgetResponse(this.runtimeData.cartEngagements)}};var al=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){Ts.get(le.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){S.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Ts.set(le.APP_CONFIG,r).catch(n=>S.error(n)),Zc.processConfiguration(),r.website&&(_t.injectRawScript(r.website.commonJS),_t.injectRawCSS(r.website.commonCSS)),tt.get().onToggle().subscribe(async({open:n})=>{S.info("Cart drawer is now",n?"open":"closed"),n&&(ve.get(Ir).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Be.globalRef.config.update(e);return tt.forceUpdate(),S.debug("App configurations",r),r}async trackViewCartEvent(){let e=await ge.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};Ie.getInstance().sendEvent(new Te(N.EVENT_VIEW_CART,n))}};var mi=class t{static INSTANCE;httpAPIService=Nt.getInstance();coreService=al.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Me.set(le.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Me.set(le.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Me.set(le.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),S.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);S.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw S.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Me.get(le.SDK_TOKEN),!this.sdkToken){S.warn("No SDK token found in local storage");return}this.userID=await Me.get(le.ID),this.deviceID=await Me.get(le.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){S.debug("SDK Token:",this.sdkToken),S.log("Device ID:",this.deviceID),S.log("User ID:",this.userID),ho.trackDeviceID(this.deviceID),xt.log(`Device ID: ${this.deviceID}`),this.userID&&xt.log(`User ID: ${this.userID}`),this.httpAPIService.setAPIToken(this.sdkToken),this.httpAPIService.setDeviceId(this.deviceID),Ko("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),kd({id:this.deviceID})}async getSessionValidateData(e){let r=await new Jc().safeGet(),n=await Me.get(le.DEVICE_ID);return n||(n=new ht().toHexString(),await Me.set(le.DEVICE_ID,n)),ee(_({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:N.SDK,page:Wr.parseFromCurrent(),ad:Xc.getAdParams(),occurred:this.getSessionStartTime(ye.get().jsLoadTime),currentItem:ye.get().getCurrentItem(),cart:await ge.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Me.get(le.FIRST_SEEN),r=e?new Date(e):new Date;e||await Me.set(le.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),Ko("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>N.IDLE_TIME_IN_SECONDS?new Date:e}};var gt=class t{static replaySubject=new bs(1);static INSTANCE;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(e){if(S.debug("Initialising SDK",e),bg(navigator.userAgent)){S.info("This seems to be a bot. Disabling SDK");return}mi.getInstance().init(e),t.INSTANCE.checkSessionOnPageLoad().then(async()=>{t.replaySubject.next(!0),t.replaySubject.complete()}).catch(r=>{S.error("Unable to initiate session",r)})}getCurrentSessionID(){return yt.set(le.SESSION_LAST_USED_TIME,new Date().getTime()),yt.get(le.ID,"")}async checkSessionOnPageLoad(){await rc.request("validate_session",async()=>{await this.checkForNewSession(!0)})}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let e=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return Fd({"cooee_session.number":e[1]}),Ko("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){let r=!1;if(await this.isNewSessionRequired()?(xt.log("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();xt.log(`Session ID: ${n[0]} & number: ${n[1]}`),await mi.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await yt.set(le.SESSION_SYNCED,!0)}}async startNewSession(){S.debug("Starting new session"),await yt.clear(),S.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new ht().toHexString();S.debug("New session ID to be used",r);let n=await Me.get(le.SESSION_NUMBER,0)+1;await Promise.all([Me.set(le.SESSION_NUMBER,n),yt.set(le.ID,r),yt.set(le.SESSION_LAST_USED_TIME,e.getTime()),yt.set(le.SESSION_LANDING_PAGE,Wr.parseFromCurrent())])}getLandingPage(){return yt.get(le.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Me.get(le.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await yt.get(le.ID))return!0;let e=await yt.get(le.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>N.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await yt.get(le.SESSION_SYNCED,!1)}};var cl=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(r=>{r instanceof Mr&&this.loadFamily(r.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let r=[];e.fonts.forEach(i=>{if(i.url){let o=new FontFace(N.COOEE+e.name,i.getURL(),i.getFontDescriptor());r.push(o.load())}}),this.loadedFonts.push(e.name),(await Promise.all(r)).forEach(i=>{document.fonts.add(i)})}};var ll=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),S.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var ul=class{apiService;action;triggerContext;constructor(e,r){this.action=e,this.apiService=Ie.getInstance(),this.triggerContext=r}async execute(){let e=this.containsCTA()?N.EVENT_TRIGGER_CLICKED:N.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(e),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:await this.collectFormData();break;case void 0:case 105:break;default:S.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;Ha(e)||(e=`//${e}`),window.open(e,"_self")}}async closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),await this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){S.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(r=>console.log(r)).catch(r=>console.error(r))}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}async collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let i=document.getElementById(r.id).value;r.type===51?e.email=i:r.type===52&&(e.mobile=i)}await this.closeTriggerAndSendEvent(N.EVENT_FORM_SUBMITTED,{form:e}),sr("Coupon applied on cart"),ll.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new Pn().process(r);let n={action:this.containsCTA()?N.CAMPAIGN_CLICKED_ACTIVITY:N.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.POPUP_ACTIVITY_EVENT,{detail:n}))}};var fr=class{renderer=Ln.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new yo(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=ee(_(_(_(_({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});di(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&ne(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&ne(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let e={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};di(this.inappHTMLEl,e)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let r=(e/100).toFixed(2);ne(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?ne(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):ne(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new kn(this.inappElement.trf);e&&e.rotate&&ne(this.inappHTMLEl,"transform",`rotate(${e.rotate}deg)`)}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation(),new ul(e,this.triggerContext).execute()}),ne(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var Yr=class extends fr{constructor(e,r,n){super(e,r,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let e={},r=this.inappElement.typography;return r&&(e.fontSize=this.stylesConverter.getSizePx(r.fs),e.fontFamily=N.COOEE+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),di(this.inappHTMLEl,e),e}processPart(e,r){let n=[];r.u&&n.push("underline"),r.st&&n.push("line-through"),n.length||n.push("normal"),ne(e,"font-weight",r.b?"bold":"normal"),ne(e,"font-style",r.i?"italic":"normal"),ne(e,"text-decoration",n.join(" ")),ne(e,"color",r.c??"inherit"),ne(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?bi[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),ne(this.inappHTMLEl,"text-align",r)}};var Us=class extends Yr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=document.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.inappHTMLEl.appendChild(r)}),this.processCommonBlocks()}};var ks=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var yi=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),ne(this.inappHTMLEl,"max-width","none"),ne(this.inappHTMLEl,"max-height","none"),ne(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var Fs=class t extends fr{constructor(r,n,i){super(r,n,i);this.parent=r;this.inappHTMLEl=document.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(N.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),ne(this.inappHTMLEl,"z-index",t.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let r=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(ne(this.inappHTMLEl,"width","100%"),ne(this.inappHTMLEl,"height","100%")):(ne(this.inappHTMLEl,"width","100vw"),ne(this.inappHTMLEl,"height","100vh")),ne(this.inappHTMLEl,"top","0"),ne(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,i=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),o=this.stylesConverter.getScaledSize(r.h)+n.getVertical();ne(this.inappHTMLEl,"width",i+"px"),ne(this.inappHTMLEl,"height",o+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return _(_({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded()){ne(this.inappHTMLEl,"position","block");return}ne(this.inappHTMLEl,"position","absolute")}else ne(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var pl=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),ne(this.inappHTMLEl,"position","relative"),ne(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(N.IN_APP_CONTAINER_NAME),this}};var fl=class t extends Yr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=ee(_(_(_({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>di(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(t.DAYS)),e.hour&&this.elements.push(this.getChild(t.HOURS)),e.minute&&this.elements.push(this.getChild(t.MINUTES)),e.second&&this.elements.push(this.getChild(t.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=document.createElement("div"),n=document.createElement("span"),i=document.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,ne(i,"font-size","0.5em"),ne(i,"text-align","center"),ne(i,"font-family","inherit"),ne(n,"text-align","center"),ne(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),ne(r,"display","flex"),ne(r,"flex-direction",this.inappElement.horizontal?"":"column"),ne(r,"justify-content","center"),ne(r,"align-items","center"),ne(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${t.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${t.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${t.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${t.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}};var ml=class extends Yr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){ne(this.inappHTMLEl,"background","#ffffff00"),ne(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener("click",r=>{r.stopPropagation()}),e.addEventListener("change",()=>{let r=new Lr(JSON.parse(e.value));this.updateItems(r)})}updateItems(e){let r=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[r.toEmbed(e)];let n=this.parentHTMLEl.querySelector("#coo-13");if(!n)return;let i=e.imgs[0]??r.imgs?.at(0);i?.url&&n.setAttribute("src",i.url)}addOptions(){let e=this.triggerContext.triggerData.items,r=this.inappHTMLEl;if(!e?.length){r.add(this.createOption(this.inappElement.placeholderText));return}let n=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(i=>{r.add(this.createOption(i.name??"Default",i,i.mID===n?.vID))})}createOption(e,r,n){let i=document.createElement("option");return i.text=e,i.value=JSON.stringify(r),n&&(i.selected=!0),r||(i.disabled=!0),i}};var bo=class extends Yr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("input"),this.insertElement()}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute("placeholder",this.inappElement.placeholderText),ne(this.inappHTMLEl,"background","#ffffff00"),ne(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t)}};var dl=class t extends bo{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","email"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.EMAIL_REGEX)?(ne(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(ne(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var hl=class t extends bo{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","tel"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.MOBILE_REGEX)?(ne(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(ne(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var gl=class extends yi{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var Ln=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static ACTIVE_TRIGGER_DATA;static _instance;safeHTTP;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){t._instance=this,this.safeHTTP=Ie.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}static get(){return t._instance}render(e){this.renderEngagement(new Ct(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,o=e.spc,s=this.getWidth(),a=this.getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=o.getHorizontal(),a-=o.getVertical(),s/a<n/i?this.scalingFactor=s/n:this.scalingFactor=a/i,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.parent&&this.isParentNotBody()&&ne(this.parent,"position","relative")}isParentNotBody(){return this.parent!==document.body}getWidth(){return this.parent&&this.parent!==document.body?this.parent.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){if(this.triggerContext=new Br(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(wr()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!tt.get().isOpen()||!wr()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=tt.get().onToggle().subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){t.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){xe(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),wr()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&t.ACTIVE_TRIGGER_DATA){let n={triggerShown:new In(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(ye.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=N.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new Fs(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw S.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new Te(N.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:N.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new Te(r,e,this.triggerContext.triggerData);n.name===N.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof Wi?new dl(e,r,n).render():r instanceof ji?new hl(e,r,n).render():r instanceof En?new Us(e,r,n).render():r instanceof Gi?new gl(e,r,n).render():r instanceof nn?new yi(e,r,n).render():r instanceof Jn?new ks(e,r,n).render():r instanceof Vi?new fl(e,r,n).render():r instanceof $i?new ml(e,r,n).render():S.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new pl(this.rootContainer,r,e).render().getHTMLElement(),new cl().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),t.ACTIVE_TRIGGER_DATA=void 0;let n=this.containerHTMLElement.animate(r,{duration:500,easing:"ease-in-out"});n.onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e)}skipTrigger(e,r){let n=new Te(N.EVENT_CAMPAIGN_REJECTED,r,e);this.safeHTTP.sendEvent(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let o=i.bg?.img?.src;if(o&&n.push(this.getPromise(o)),i.t===1){let s=i.src;if(!s)return;n.push(this.getPromise(s))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}};var yl=class{triggerData;safeHttpService=Ie.getInstance();render(e){e.contentSource===Do.KLAVIYO&&(this.triggerData=e,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",e.klaviyoFormID]))}handleKlaviyoEvents(e){if(e.type!=="klaviyoForms")return;let r=e.detail;if(r.formId!==this.triggerData.klaviyoFormID){S.warn("Received invalid trigger callback");return}switch(r.type){case"open":this.safeHttpService.sendEvent(new Te(N.EVENT_TRIGGER_DISPLAYED,{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);this.safeHttpService.sendEvent(new Te(N.EVENT_FORM_SUBMITTED,{form:n},this.triggerData)),this.safeHttpService.updateProfile(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new Te(N.EVENT_TRIGGER_CLOSED,{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(rr.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{i.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};var vl=class{static trackIntent(e){if(!this.isInstalled()){S.log("Facebook pixel not installed");return}if(!Ge.get().pixelPush){S.log("Facebook pixel push not enabled");return}let n=Qn[e.intent]?.toLowerCase(),i=e.segmentName;!n&&!i||(S.debug(`Sending ${n} intent and ${i} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:n,segment_value:e.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}};var Dn=class t{static INSTANCE;httpService=ve.get(Nt);sessionManager=ve.get(gt);runtime=ye.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>S.error(`Failed to send ${e.name}`,r))}async send(e){if(S.debug(`Sending event ${e.name}`),xt.log(`Sending event ${e.name} with id ${e.id}`),this.shouldReject(e)){S.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==N.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),e.locale=this.runtime.locale,this.httpService.post("/v1/event/track",e).then(async r=>{S.log("\u2705 Event tracked:",e.name),xt.log(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{S.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(S.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=Wr.parseFromCurrent()}async addShopifyContext(e){try{e.cart=await ge.getCurrent().getNormalisedCart()}catch(r){S.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{xe(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){S.log(`Nothing to engage after ${e.name}`);return}S.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData),xt.log(`\u{1F4E3} Campaign #${r.triggerData.shortID}) will be shown`);let n=new Ct(r.triggerData);n.occurred=e.occurred;let i;try{i=await go.refreshItems(n)}catch(o){S.error("Failed to refresh the products",o);return}if(n.items=i,n.contentSource===Do.KLAVIYO){new yl().render(n);return}new Ln().renderEngagement(n).catch(o=>{xe(o,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(ho.trackIntent(e.intent),vl.trackIntent(e),xt.log(`Intent is <strong>${Qn[e.intent]}</strong>`))}addShopifyAttributes(){ge.getCurrent().addCooeeAttributes().catch(e=>{S.error("Fail to add attributes in cart",e)})}};var jr=class{constructor(e){this.triggerContext=e}safeHTTP=Ie.getInstance();eventAPIService=Dn.getInstance();async execute(e){let r=ye.get().getCurrentItem(),n=e.clickAction;if(!n)return;let i=e.item,o=this.triggerContext,s=new Pn,a=o.triggerData.redirectBehaviour,c=!!o.triggerData.discount?.type&&!!n?.applyDiscount,p={selectedVariants:o.triggerData.nonMutableItems.map(O=>({itemMID:O.mID,mID:O.selectedOrFirstVariant.value.mID,variantID:O.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},m="",f=[],E=[];if(i?E=[i.toEmbed()]:e.embeddedItem&&(E=[e.embeddedItem]),n.at===108){let O=o.selectedItems;if(E=e.embeddedItems??O.map(k=>k.toEmbed()),o.shouldGiveFBTDiscount||e.embeddedItems?.length){let k;e.embeddedItems?k=e.embeddedItems.map(L=>({itemMID:L.mID,mID:L.vID,variantID:L.vID,quantity:L.quantity})):k=O.map(L=>({itemMID:L.mID,mID:L.selectedOrFirstVariant.value.mID,variantID:L.selectedOrFirstVariant.value.mID}));let z=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&z&&(k.push({itemMID:z.mID,mID:z.selectedOrFirstVariant.value.mID,isPrimary:!0}),E.unshift(z.toEmbed())),p.selectedVariants=k,o.triggerData.isBundleOnPDP()&&p.selectedVariants.forEach(L=>{L.mID===r.vID&&(L.isPrimary=!0)})}else p=void 0;f=e.embeddedItems??O}else if(n.at===107){let O=await ge.getCurrent().getNormalisedCart();E=O.items,p.selectedVariants=O.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(n.at===102)f=i?[i]:[e.embeddedItem];else if(n.at===101)m=i?Fi()+"products/"+i.slug:e.embeddedItem?.link;else if(n.at===4){let O=Ha(n.gu?.u);O&&(m=O.href)}else if(n.at===109){let O=await s.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),tt.get().refreshUI(O)}else if(n.at===104){let O=this.triggerContext.triggerData.collections?.[0];O&&(m="collections/"+O.handle)}if(this.sendTriggerClicked(E,{from:"button"},e.video),S.debug({redirectPath:m,redirectBehaviour:a,hasDiscount:c}),!c&&m){location.href=m;return}let y,T=!1;try{y=await this.getOrGenerateDiscountCode(p),S.debug("Discount code (if any) to apply",y)}catch(O){if(!this.triggerContext.triggerData.isBYOB()){ry.default.error("Unable to get a discount code",O);return}}if(y&&n.at===103)await s.copyDiscountCode(y);else if(n.at===110){let O=await s.createNewCart(r,y,o.triggerData);O&&(location.href=O);return}try{y&&await Gr.applyWithStorefront([y])}catch(O){S.error(O),T=!0}let D;if(f?.length&&(D=await s.addToCart(f,o.triggerData)),T&&y){Gr.navigate(y,a,m);return}if(m){location.href=m;return}Gr.navigateWithoutDiscount(a,D)}sendTriggerClicked(e,r,n){let i=new Te(N.EVENT_TRIGGER_CLICKED,r,this.triggerContext.triggerData);i.items=e,n?.id&&(i.videos=[n.id]),this.eventAPIService.sendSilently(i)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===er.STATIC){if(!r.code)throw cp("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await this.generateDiscount(e),!n)throw S.error("No discount code found",e),new Error("Discount code not found or generated");return n}}async generateDiscount(e){try{return(await this.safeHTTP.generateDiscount(e))?.code}catch(r){throw sr("Failed to generate a discount code"),xe(r,"backend-generate-discount",{extra:{discountData:JSON.stringify(e)},triggerContext:this.triggerContext}),r}}};var El=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=ve.get(Mn)}execute(e){for(let r of e){if(!r.experimentConfig)continue;this.executeExperiment(r)&&this.trackExperimentRan(r)}if(document.querySelector("#lc-hide-body")?.remove(),!document.body){va("No body element found","error");return}this.setupMutationObserver()}executeExperiment(e){let r=e.experimentConfig?.modifications;return r?.length?r.some(n=>{if(!n.cssSelector)return S.debug("No CSS Selector available",e?.toString()),!1;this.modifications.push(n);let i=Array.from(document.querySelectorAll(n.cssSelector));return i?.length?(this.executeSingleModification(n,i),!0):!1}):(S.log("Nothing to experiment",e.toString()),!0)}executeSingleModification(e,r){if(r?.length)for(let n of r)Object.assign(n.style,e.style),e.type==="TEXT"&&e.text?n.innerHTML=e.text:e.type==="IMAGE"&&this.updateImage(e,n)}trackExperimentRan(e){if(e.id==="preview"){S.warn("Skipping experiment attribution as its preview",e.toString());return}this.eventAPIService.trackExperiment({name:N.EVENT_EXPERIMENT_START,experiment:new In(e)}).catch(r=>{S.error("Fail to track experiment",r)})}setupMutationObserver(){new MutationObserver(r=>{r.forEach(n=>{n.addedNodes.forEach(i=>{i instanceof HTMLElement&&this.modifications.forEach(o=>{i.matches&&i.matches(o.cssSelector)?(S.debug("Re-applying experiment",o.toString()),this.executeSingleModification(o,[i])):i.querySelectorAll&&(S.debug("Re-applying experiment",o.toString()),this.executeSingleModification(o,Array.from(i.querySelectorAll(o.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}updateImage(e,r){let n=e.image?.lg?.src,i=e.image?.sm?.src;!n&&!i||(r instanceof HTMLPictureElement?this.updatePictureElement({desktop:n,mobile:i},r):this.updateImageElement({desktop:n,mobile:i},r))}updateImageElement(e,r){wr()&&e.mobile?(r.setAttribute("src",e.mobile),r.removeAttribute("srcset")):e.desktop&&(r.setAttribute("src",e.desktop),r.removeAttribute("srcset"))}updatePictureElement(e,r){if(r.innerHTML="",e.mobile){let i=document.createElement("source");i.srcset=e.mobile,i.media="(max-width: 767px)",r.append(i)}if(e.desktop){let i=document.createElement("source");i.srcset=e.desktop,i.media="(min-width: 768px)",r.append(i)}let n=document.createElement("img");n.src=e.desktop??e.mobile??"",r.append(n)}};var Mn=class t extends _o{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadExperimentSilently(){Me.get(le.SDK_TOKEN).then(e=>{e?this.loadExperiments().catch(r=>S.error("Unable to initiate experiment",r)):gt.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>S.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let e=await this.getWidgetProps();S.log("Load experiments",e),this.httpService.post("/v1/engagement/experiments",e).then(async r=>{let n=r.experiments.map(i=>new Ct(i));new El().execute(n)}).catch(r=>{S.error("Error sending experiment getter",r)})}async trackExperiment(e){await this.addSessionContext(e),await this.httpService.post("/v1/event/experiment",e)}};var _l=class{runtimeData=ye.get();widgetAPIService=ve.get(Ir);experimentAPIService=ve.get(Mn);meddle(){let e=Be.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Be.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},e.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Be.previewWidget.bind(Be),e.previewPopup=Be.previewPopup.bind(Be)}overwritePush(e,r){zn(e,"push",r)}meddleAccount(){this.overwritePush(Be.globalRef.account,(...e)=>{this.processAccount(e[0])}),Be.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Be.globalRef.events,(...e)=>{this.processEvent(e[0])}),Be.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Be.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Be.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Be.authenticate(e),e.flags&&fi.setFlags(e.flags))}processEvent(e){e&&(N.JS_LOAD_WHITELIST_EVENTS.includes(e[0])?Be.sendEvent(e[0],e[1],_({occurred:this.runtimeData.jsLoadTime},e[2])):Be.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Be.updateProfile(e)}processPageName(e){e&&Be.setPageName(e)}meddlePage(){this.overwritePush(Be.globalRef.page,(...e)=>{this.processPage(e[0])}),Be.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&this.runtimeData.setCurrentItem(e.currentItem),e.currency&&(this.runtimeData.currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&Be.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiment=e.activeExperiment)}async testCartUpdate(){if(this.runtimeData.pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=window.ShopifyAnalytics?.meta??{},r=e.selectedVariantId;if(r||(e.product?.variants?.length>0&&(r=e.product.variants[0].id),r||(r=this.runtimeData.getCurrentItem()?.vID)),!r){window.alert("Could not find a variant to test. Please try a different product page");return}let n=new Ct({id:"preview",shortID:"1",redirectBehaviour:tr.CART_DRAWER});await new jr(new Br(new Date,n)).execute({clickAction:{at:102},embeddedItem:new At({vID:r})})}};var So=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=N.COOEE.concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var wo=class t{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=ve.get(Ie);lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}resetScrollID(e){So.remove(N.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}Oi(()=>{this.observeWindowScroll()})}observeWindowScroll(){pi(window,"scroll").pipe(Jt(t.DEBOUNCE_TIME),ln(()=>{let e=this.getPercentScrolledY();if(e>100){S.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=t.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=So.getString(N.SESSION_STORAGE_SCROLL_ID,""),i=new Te(N.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),So.setString(N.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}};var bl=class t{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=ve.get(Ie);runtimeData=ye.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){S.info("Not sending background event as user was inactive on website");return}S.info(`Sending background event with ${e} seconds`);let r={};r[t.ACTIVE_DURATION]=e,this.apiService.sendEvent(new Te(N.EVENT_APP_BACKGROUND,r))}};var Sl=class{compareCartItemSubject=new Ut;constructor(){this.compareCartItemSubject.pipe(Jt(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let e=this,r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){e.performEvent(this._url).catch(n=>S.error("Unable to process cart change in XMLHttpRequest",n))}),r.apply(this,arguments)},S.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=function(n){return r.apply(window,arguments).then(i=>(e.performEvent(n.toString()).catch(o=>S.error("Unable to process cart change in fetch",o)),i))},S.debug("Securely overwritten window.fetch method")}async performEvent(e){this.isCartManipulationURL(e)&&(ye.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(e){return/\/cart\/(add|change|update|clear)/.test(e)}sendChangesAsEvents(e,r){let n=e?.items,i=r.items,o=[],s=[];if(S.debug(`Comparing cart change with old count ${n?.length} to new count ${i.length}`),i?.forEach(a=>{let c=n?.find(p=>p.vID===a.vID);if(c){if(c.quantity!==a.quantity){let p=c.quantity<a.quantity,m=Math.abs(c.quantity-a.quantity),f=ee(_({},a),{quantity:m});p?o.push(f):s.push(f)}n&&Vd(n,c)}else o.push(a)}),n)for(let a of n)s.push(a);S.debug(`Cart delta: added: ${o.length}, removed: ${s.length}`),o.length&&this.sendEvent(N.EVENT_ADD_TO_CART,{items:o}),s.length&&e.token===r.token&&this.sendEvent(N.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||o.length)&&Nn.get().broadcast(N.CART_UPDATE_BROADCAST,{itemsAdded:o,itemsRemoved:s})}sendEvent(e,r){let n=new Te(e,r);ve.get(Ie).sendEvent(n)}async compareCartItems(){let e=await Me.get(le.CURRENT_CART,{}),r=await ge.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,r)}};var wl=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=async function(n,i){try{await e.modifyRequest(n,i)}catch(o){xe(o,"modify-graphql-request",{extra:{body:JSON.stringify(i?.body)}})}return r(n,i)},S.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(e,r){let n=typeof e=="string"?e:e instanceof Request?e.url:"";if(!(n.includes("graphql.json")&&r?.method==="POST")||!r.body)return;let i;if(typeof r.body=="string")try{i=JSON.parse(r.body)}catch{return}else i=r.body;i?.variables?.input&&(S.debug("Intercepted fetch request of:",n),i?.query.includes("cartCreate")&&(r.body=await this.updatedBody(i),this.sendBuyNowEvent()))}async updatedBody(e){let r=e.variables.input.attributes??[],n=await Va();return e.variables.input.attributes=[...r,...n],JSON.stringify(e)}sendBuyNowEvent(){let e=ye.get().getCurrentItem();if(!e)return;let r=new Te(N.EVENT_BUY_NOW_CLICKED,{items:[e]});Ie.getInstance().sendEvent(r)}};var Io=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new Te(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});Ie.getInstance().sendEvent(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>S.error(e))}async listen(){this.elements=await fp(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Il=class t extends Io{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(t.selectors,N.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Tl=class t extends Io{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(t.selectors,N.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Cl=class{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){Oi(()=>{S.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let e=window.location.hash?.substring(1);if(e)if(e.includes(N.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(N.THIRD_PARTY_CHECKOUT_EVENT));let r=document.querySelector(this.selector);if(!r){S.debug("No clickable cart checkout button found");return}S.debug("Clickable cart checkout button found",r),r.click()}else e.includes(N.HASH_OPEN_CART_DRAWER)&&tt.get().open()}};var Hs=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let e=await ge.getCurrent().getNormalisedCart(),r={via:"GoKwik",items:e.items,cartToken:e.token,amount:{value:e.amount,currency:e.currency}},n=new Te(N.EVENT_CHECKOUT_STARTED,r);Ie.getInstance().sendEvent(n)})}};var xl=class{async migrate(){}};var Be=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new xl().migrate(),this.autoAuthenticate(),new _l().meddle(),ve.get(Mn).loadExperimentSilently(),new bl().listen(),new Sl().listen(),new wl().listen(),new Cl().listen(),ve.get(wo).listen(),ve.get(Tl).listenSilently(),ve.get(Il).listenSilently(),ve.get(Ir).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),xt.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||zn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,zn(this.globalRef,"config",new Ge),zn(this.globalRef,"runtimeData",new ye),zn(this.globalRef,"uaParser",new $r),S.debug("Global reference initialised")}static injectWidgetAssets(){_t.injectScriptURL(Ft.widgetURL,"cooee-widget-sdk"),_t.injectStylesheet(Ft.styleURL)}static autoAuthenticate(){let e=Th();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;let r=e.appID?.trim(),n=e.shopifyShop;if((up(r)||r.length!==24)&&up(n)){S.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,ve.get(gt).init(e)}static sendEvent(e,r,n){let i=new Te(e,r,n?.triggerData);n?.occurred&&(i.occurred=n.occurred),ve.get(Ie).sendEvent(i)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");ve.get(Ie).updateProfile(e)}static setPageName(e){if(!e)return;let r=ye.get(),n=r.pageName;if(e===n)return;if(r.pageName=e,e==="cart"&&ve.get(Ir).loadOrRenderWidgetsAfterCartChange(),N.BLACKLISTED_PAGE_NAMES.some(s=>e.includes(s))){ve.get(wo).resetScrollID();return}let i={};n&&(i.ps=n);let o=new Te(N.EVENT_SCREEN_VIEW,i);o.occurred=r.jsLoadTime,ve.get(Ie).sendEvent(o),ve.get(wo).resetScrollID(o.occurred)}static previewPopup(e,r){new Ln(r).render(e)}static previewWidget(e){new Rt(new Ct(e)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(e){S.error(e)}window.addEventListener("message",e=>{if(S.debug("Received event",e),!e.origin.includes("letscooee.com")&&!e.origin.includes("localhost"))return;let r=e.data;typeof r=="object"&&(r.action==="POPUP_PREVIEW"?(this.previewPopup(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)):r.action==="WIDGET_PREVIEW"&&(this.previewWidget(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)))})}}static attachGoKwikListeners(){let e=ye.get();window.addEventListener("kp-modal:opened",()=>{e.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",r=>{let{token:n}=r.detail;n&&this.updateProfile({goKwikToken:n})}),window.gokwikSdk?Hs.attachCheckoutListener():window.addEventListener("gokwikLoaded",Hs.attachCheckoutListener)}static storePreviewParams(){let e=ye.get(),r=new URLSearchParams(location.search),n=r.get("cooee-preview");n&&(e.previewIDs=n.trim().split(",").filter(o=>Number.isInteger(+o)));let i=r.get("cooee-variant");i&&(e.previewVariant=i)}};Gf();Yf();S.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(S.debug("Execution order:","IIFE start"),await Be.initForMerchantWebsiteOnly(),await Be.initForAll(),S.debug("Execution order:","IIFE end")))());S.debug("Execution order:","bottom");
|