@letscooee/web-sdk 9.12.8 → 9.12.9
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 +21 -21
- package/dist/widget.min.js +26 -26
- package/package.json +3 -3
package/dist/main.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var yd=Object.create;var Ec=Object.defineProperty;var vd=Object.getOwnPropertyDescriptor;var wd=Object.getOwnPropertyNames;var bd=Object.getPrototypeOf,_d=Object.prototype.hasOwnProperty;var Ed=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of wd(e))!_d.call(t,i)&&i!==r&&Ec(t,i,{get:()=>e[i],enumerable:!(n=vd(e,i))||n.enumerable});return t};var Sd=(t,e,r)=>(r=t!=null?yd(bd(t)):{},Ed(e||!t||!t.__esModule?Ec(r,"default",{value:t,enumerable:!0}):r,t));var Id=Object.create,ta=Object.defineProperty,Cd=Object.defineProperties,Td=Object.getOwnPropertyDescriptor,xd=Object.getOwnPropertyDescriptors,Dd=Object.getOwnPropertyNames,Sc=Object.getOwnPropertySymbols,Ad=Object.getPrototypeOf,du=Object.prototype.hasOwnProperty,Nd=Object.prototype.propertyIsEnumerable,Ic=(t,e,r)=>e in t?ta(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e||={})du.call(e,r)&&Ic(t,r,e[r]);if(Sc)for(var r of Sc(e))Nd.call(e,r)&&Ic(t,r,e[r]);return t},yt=(t,e)=>Cd(t,xd(e)),di=(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')}),rs=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Od=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Dd(e))!du.call(t,i)&&i!==r&&ta(t,i,{get:()=>e[i],enumerable:!(n=Td(e,i))||n.enumerable});return t},ke=(t,e,r)=>(r=t!=null?Id(Ad(t)):{},Od(e||!t||!t.__esModule?ta(r,"default",{value:t,enumerable:!0}):r,t)),sn=rs((t,e)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(h,b){return function(){return b.apply(h,arguments)}},c=function(){var h=arguments,b=h[0],v,w;for(w=1;w<h.length;w++)for(v in h[w])!(v in b)&&h[w].hasOwnProperty(v)&&(b[v]=h[w][v]);return b},l=function(h,b){return{value:h,name:b}};n.TRACE=l(1,"TRACE"),n.DEBUG=l(2,"DEBUG"),n.INFO=l(3,"INFO"),n.TIME=l(4,"TIME"),n.WARN=l(5,"WARN"),n.ERROR=l(8,"ERROR"),n.OFF=l(99,"OFF");var p=function(h){this.context=h,this.setLevel(h.filterLevel),this.log=this.info};p.prototype={setLevel:function(h){h&&"value"in h&&(this.context.filterLevel=h)},getLevel:function(){return this.context.filterLevel},enabledFor:function(h){var b=this.context.filterLevel;return h.value>=b.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"start"])},timeEnd:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"end"])},invoke:function(h,b){i&&this.enabledFor(h)&&i(b,c({level:h},this.context))}};var d=new p({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(d,d.enabledFor),h.trace=o(d,d.trace),h.debug=o(d,d.debug),h.time=o(d,d.time),h.timeEnd=o(d,d.timeEnd),h.info=o(d,d.info),h.warn=o(d,d.warn),h.error=o(d,d.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){d.setLevel(h);for(var b in s)s.hasOwnProperty(b)&&s[b].setLevel(h)},n.getLevel=function(){return d.getLevel()},n.get=function(h){return s[h]||(s[h]=new p(c({name:h},d.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(w,_){_.name&&w.unshift("["+_.name+"]")};var b={},v=function(w,_){Function.prototype.apply.call(w,console,_)};return typeof console>"u"?function(){}:function(w,_){w=Array.prototype.slice.call(w);var k=console.log,A;_.level===n.TIME?(A=(_.name?"["+_.name+"] ":"")+w[0],w[1]==="start"?console.time?console.time(A):b[A]=new Date().getTime():console.timeEnd?console.timeEnd(A):v(k,[A+": "+(new Date().getTime()-b[A])+"ms"])):(_.level===n.WARN&&console.warn?k=console.warn:_.level===n.ERROR&&console.error?k=console.error:_.level===n.INFO&&console.info?k=console.info:_.level===n.DEBUG&&console.debug?k=console.debug:_.level===n.TRACE&&console.trace&&(k=console.trace),h.formatter(w,_),v(k,w))}},n.useDefaults=function(h){n.setLevel(h&&h.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(h))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof e<"u"&&e.exports?e.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(t)}),kd=rs((t,e)=>{"use strict";(function(r){if(typeof t=="object"&&typeof e<"u")e.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,c,l){function p(b,v){if(!c[b]){if(!o[b]){var w=typeof di=="function"&&di;if(!v&&w)return w(b,!0);if(d)return d(b,!0);var _=new Error("Cannot find module '"+b+"'");throw _.code="MODULE_NOT_FOUND",_}var k=c[b]={exports:{}};o[b][0].call(k.exports,function(A){var B=o[b][1][A];return p(B||A)},k,k.exports,s,o,c,l)}return c[b].exports}for(var d=typeof di=="function"&&di,h=0;h<l.length;h++)p(l[h]);return p}({1:[function(s,o,c){(function(l){"use strict";var p=l.MutationObserver||l.WebKitMutationObserver,d;if(p){var h=0,b=new p(A),v=l.document.createTextNode("");b.observe(v,{characterData:!0}),d=function(){v.data=h=++h%2}}else if(!l.setImmediate&&typeof l.MessageChannel<"u"){var w=new l.MessageChannel;w.port1.onmessage=A,d=function(){w.port2.postMessage(0)}}else"document"in l&&"onreadystatechange"in l.document.createElement("script")?d=function(){var G=l.document.createElement("script");G.onreadystatechange=function(){A(),G.onreadystatechange=null,G.parentNode.removeChild(G),G=null},l.document.documentElement.appendChild(G)}:d=function(){setTimeout(A,0)};var _,k=[];function A(){_=!0;for(var G,j,X=k.length;X;){for(j=k,k=[],G=-1;++G<X;)j[G]();X=k.length}_=!1}o.exports=B;function B(G){k.push(G)===1&&!_&&d()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,c){"use strict";var l=s(1);function p(){}var d={},h=["REJECTED"],b=["FULFILLED"],v=["PENDING"];o.exports=w;function w(q){if(typeof q!="function")throw new TypeError("resolver must be a function");this.state=v,this.queue=[],this.outcome=void 0,q!==p&&B(this,q)}w.prototype.catch=function(q){return this.then(null,q)},w.prototype.then=function(q,rt){if(typeof q!="function"&&this.state===b||typeof rt!="function"&&this.state===h)return this;var Q=new this.constructor(p);if(this.state!==v){var tt=this.state===b?q:rt;k(Q,tt,this.outcome)}else this.queue.push(new _(Q,q,rt));return Q};function _(q,rt,Q){this.promise=q,typeof rt=="function"&&(this.onFulfilled=rt,this.callFulfilled=this.otherCallFulfilled),typeof Q=="function"&&(this.onRejected=Q,this.callRejected=this.otherCallRejected)}_.prototype.callFulfilled=function(q){d.resolve(this.promise,q)},_.prototype.otherCallFulfilled=function(q){k(this.promise,this.onFulfilled,q)},_.prototype.callRejected=function(q){d.reject(this.promise,q)},_.prototype.otherCallRejected=function(q){k(this.promise,this.onRejected,q)};function k(q,rt,Q){l(function(){var tt;try{tt=rt(Q)}catch(lt){return d.reject(q,lt)}tt===q?d.reject(q,new TypeError("Cannot resolve promise with itself")):d.resolve(q,tt)})}d.resolve=function(q,rt){var Q=G(A,rt);if(Q.status==="error")return d.reject(q,Q.value);var tt=Q.value;if(tt)B(q,tt);else{q.state=b,q.outcome=rt;for(var lt=-1,kt=q.queue.length;++lt<kt;)q.queue[lt].callFulfilled(rt)}return q},d.reject=function(q,rt){q.state=h,q.outcome=rt;for(var Q=-1,tt=q.queue.length;++Q<tt;)q.queue[Q].callRejected(rt);return q};function A(q){var rt=q&&q.then;if(q&&(typeof q=="object"||typeof q=="function")&&typeof rt=="function")return function(){rt.apply(q,arguments)}}function B(q,rt){var Q=!1;function tt(jt){Q||(Q=!0,d.reject(q,jt))}function lt(jt){Q||(Q=!0,d.resolve(q,jt))}function kt(){rt(lt,tt)}var At=G(kt);At.status==="error"&&tt(At.value)}function G(q,rt){var Q={};try{Q.value=q(rt),Q.status="success"}catch(tt){Q.status="error",Q.value=tt}return Q}w.resolve=j;function j(q){return q instanceof this?q:d.resolve(new this(p),q)}w.reject=X;function X(q){var rt=new this(p);return d.reject(rt,q)}w.all=_t;function _t(q){var rt=this;if(Object.prototype.toString.call(q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Q=q.length,tt=!1;if(!Q)return this.resolve([]);for(var lt=new Array(Q),kt=0,At=-1,jt=new this(p);++At<Q;)Wt(q[At],At);return jt;function Wt(ft,Gt){rt.resolve(ft).then(st,function(et){tt||(tt=!0,d.reject(jt,et))});function st(et){lt[Gt]=et,++kt===Q&&!tt&&(tt=!0,d.resolve(jt,lt))}}}w.race=Dt;function Dt(q){var rt=this;if(Object.prototype.toString.call(q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Q=q.length,tt=!1;if(!Q)return this.resolve([]);for(var lt=-1,kt=new this(p);++lt<Q;)At(q[lt]);return kt;function At(jt){rt.resolve(jt).then(function(Wt){tt||(tt=!0,d.resolve(kt,Wt))},function(Wt){tt||(tt=!0,d.reject(kt,Wt))})}}},{1:1}],3:[function(s,o,c){(function(l){"use strict";typeof l.Promise!="function"&&(l.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,c){"use strict";var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g};function p(g,m){if(!(g instanceof m))throw new TypeError("Cannot call a class as a function")}function d(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var h=d();function b(){try{if(!h||!h.open)return!1;var g=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),m=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!g||m)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function v(g,m){g=g||[],m=m||{};try{return new Blob(g,m)}catch(C){if(C.name!=="TypeError")throw C;for(var y=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,I=new y,S=0;S<g.length;S+=1)I.append(g[S]);return I.getBlob(m.type)}}typeof Promise>"u"&&s(3);var w=Promise;function _(g,m){m&&g.then(function(y){m(null,y)},function(y){m(y)})}function k(g,m,y){typeof m=="function"&&g.then(m),typeof y=="function"&&g.catch(y)}function A(g){return typeof g!="string"&&(console.warn(g+" used as a key, but it is not a string."),g=String(g)),g}function B(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var G="local-forage-detect-blob-support",j=void 0,X={},_t=Object.prototype.toString,Dt="readonly",q="readwrite";function rt(g){for(var m=g.length,y=new ArrayBuffer(m),I=new Uint8Array(y),S=0;S<m;S++)I[S]=g.charCodeAt(S);return y}function Q(g){return new w(function(m){var y=g.transaction(G,q),I=v([""]);y.objectStore(G).put(I,"key"),y.onabort=function(S){S.preventDefault(),S.stopPropagation(),m(!1)},y.oncomplete=function(){var S=navigator.userAgent.match(/Chrome\/(\d+)/),C=navigator.userAgent.match(/Edge\//);m(C||!S||parseInt(S[1],10)>=43)}}).catch(function(){return!1})}function tt(g){return typeof j=="boolean"?w.resolve(j):Q(g).then(function(m){return j=m,j})}function lt(g){var m=X[g.name],y={};y.promise=new w(function(I,S){y.resolve=I,y.reject=S}),m.deferredOperations.push(y),m.dbReady?m.dbReady=m.dbReady.then(function(){return y.promise}):m.dbReady=y.promise}function kt(g){var m=X[g.name],y=m.deferredOperations.pop();if(y)return y.resolve(),y.promise}function At(g,m){var y=X[g.name],I=y.deferredOperations.pop();if(I)return I.reject(m),I.promise}function jt(g,m){return new w(function(y,I){if(X[g.name]=X[g.name]||ui(),g.db)if(m)lt(g),g.db.close();else return y(g.db);var S=[g.name];m&&S.push(g.version);var C=h.open.apply(h,S);m&&(C.onupgradeneeded=function(O){var $=C.result;try{$.createObjectStore(g.storeName),O.oldVersion<=1&&$.createObjectStore(G)}catch(W){if(W.name==="ConstraintError")console.warn('The database "'+g.name+'" has been upgraded from version '+O.oldVersion+" to version "+O.newVersion+', but the storage "'+g.storeName+'" already exists.');else throw W}}),C.onerror=function(O){O.preventDefault(),I(C.error)},C.onsuccess=function(){var O=C.result;O.onversionchange=function($){$.target.close()},y(O),kt(g)}})}function Wt(g){return jt(g,!1)}function ft(g){return jt(g,!0)}function Gt(g,m){if(!g.db)return!0;var y=!g.db.objectStoreNames.contains(g.storeName),I=g.version<g.db.version,S=g.version>g.db.version;if(I&&(g.version!==m&&console.warn('The database "'+g.name+`" can't be downgraded from version `+g.db.version+" to version "+g.version+"."),g.version=g.db.version),S||y){if(y){var C=g.db.version+1;C>g.version&&(g.version=C)}return!0}return!1}function st(g){return new w(function(m,y){var I=new FileReader;I.onerror=y,I.onloadend=function(S){var C=btoa(S.target.result||"");m({__local_forage_encoded_blob:!0,data:C,type:g.type})},I.readAsBinaryString(g)})}function et(g){var m=rt(atob(g.data));return v([m],{type:g.type})}function $t(g){return g&&g.__local_forage_encoded_blob}function ci(g){var m=this,y=m._initReady().then(function(){var I=X[m._dbInfo.name];if(I&&I.dbReady)return I.dbReady});return k(y,g,g),y}function li(g){lt(g);for(var m=X[g.name],y=m.forages,I=0;I<y.length;I++){var S=y[I];S._dbInfo.db&&(S._dbInfo.db.close(),S._dbInfo.db=null)}return g.db=null,Wt(g).then(function(C){return g.db=C,Gt(g)?ft(g):C}).then(function(C){g.db=m.db=C;for(var O=0;O<y.length;O++)y[O]._dbInfo.db=C}).catch(function(C){throw At(g,C),C})}function oe(g,m,y,I){I===void 0&&(I=1);try{var S=g.db.transaction(g.storeName,m);y(null,S)}catch(C){if(I>0&&(!g.db||C.name==="InvalidStateError"||C.name==="NotFoundError"))return w.resolve().then(function(){if(!g.db||C.name==="NotFoundError"&&!g.db.objectStoreNames.contains(g.storeName)&&g.version<=g.db.version)return g.db&&(g.version=g.db.version+1),ft(g)}).then(function(){return li(g).then(function(){oe(g,m,y,I-1)})}).catch(y);y(C)}}function ui(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Es(g){var m=this,y={db:null};if(g)for(var I in g)y[I]=g[I];var S=X[y.name];S||(S=ui(),X[y.name]=S),S.forages.push(m),m._initReady||(m._initReady=m.ready,m.ready=ci);var C=[];function O(){return w.resolve()}for(var $=0;$<S.forages.length;$++){var W=S.forages[$];W!==m&&C.push(W._initReady().catch(O))}var V=S.forages.slice(0);return w.all(C).then(function(){return y.db=S.db,Wt(y)}).then(function(F){return y.db=F,Gt(y,m._defaultConfig.version)?ft(y):F}).then(function(F){y.db=S.db=F,m._dbInfo=y;for(var J=0;J<V.length;J++){var it=V[J];it!==m&&(it._dbInfo.db=y.db,it._dbInfo.version=y.version)}})}function dn(g,m){var y=this;g=A(g);var I=new w(function(S,C){y.ready().then(function(){oe(y._dbInfo,Dt,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.get(g);V.onsuccess=function(){var F=V.result;F===void 0&&(F=null),$t(F)&&(F=et(F)),S(F)},V.onerror=function(){C(V.error)}}catch(F){C(F)}})}).catch(C)});return _(I,m),I}function Ss(g,m){var y=this,I=new w(function(S,C){y.ready().then(function(){oe(y._dbInfo,Dt,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.openCursor(),F=1;V.onsuccess=function(){var J=V.result;if(J){var it=J.value;$t(it)&&(it=et(it));var vt=g(it,J.key,F++);vt!==void 0?S(vt):J.continue()}else S()},V.onerror=function(){C(V.error)}}catch(J){C(J)}})}).catch(C)});return _(I,m),I}function Is(g,m,y){var I=this;g=A(g);var S=new w(function(C,O){var $;I.ready().then(function(){return $=I._dbInfo,_t.call(m)==="[object Blob]"?tt($.db).then(function(W){return W?m:st(m)}):m}).then(function(W){oe(I._dbInfo,q,function(V,F){if(V)return O(V);try{var J=F.objectStore(I._dbInfo.storeName);W===null&&(W=void 0);var it=J.put(W,g);F.oncomplete=function(){W===void 0&&(W=null),C(W)},F.onabort=F.onerror=function(){var vt=it.error?it.error:it.transaction.error;O(vt)}}catch(vt){O(vt)}})}).catch(O)});return _(S,y),S}function hi(g,m){var y=this;g=A(g);var I=new w(function(S,C){y.ready().then(function(){oe(y._dbInfo,q,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.delete(g);$.oncomplete=function(){S()},$.onerror=function(){C(V.error)},$.onabort=function(){var F=V.error?V.error:V.transaction.error;C(F)}}catch(F){C(F)}})}).catch(C)});return _(I,m),I}function Lr(g){var m=this,y=new w(function(I,S){m.ready().then(function(){oe(m._dbInfo,q,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.clear();O.oncomplete=function(){I()},O.onabort=O.onerror=function(){var V=W.error?W.error:W.transaction.error;S(V)}}catch(V){S(V)}})}).catch(S)});return _(y,g),y}function ae(g){var m=this,y=new w(function(I,S){m.ready().then(function(){oe(m._dbInfo,Dt,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.count();W.onsuccess=function(){I(W.result)},W.onerror=function(){S(W.error)}}catch(V){S(V)}})}).catch(S)});return _(y,g),y}function fn(g,m){var y=this,I=new w(function(S,C){if(g<0){S(null);return}y.ready().then(function(){oe(y._dbInfo,Dt,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=!1,F=W.openKeyCursor();F.onsuccess=function(){var J=F.result;if(!J){S(null);return}g===0||V?S(J.key):(V=!0,J.advance(g))},F.onerror=function(){C(F.error)}}catch(J){C(J)}})}).catch(C)});return _(I,m),I}function Cs(g){var m=this,y=new w(function(I,S){m.ready().then(function(){oe(m._dbInfo,Dt,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.openKeyCursor(),V=[];W.onsuccess=function(){var F=W.result;if(!F){I(V);return}V.push(F.key),F.continue()},W.onerror=function(){S(W.error)}}catch(F){S(F)}})}).catch(S)});return _(y,g),y}function a(g,m){m=B.apply(this,arguments);var y=this.config();g=typeof g!="function"&&g||{},g.name||(g.name=g.name||y.name,g.storeName=g.storeName||y.storeName);var I=this,S;if(!g.name)S=w.reject("Invalid arguments");else{var C=g.name===y.name&&I._dbInfo.db,O=C?w.resolve(I._dbInfo.db):Wt(g).then(function($){var W=X[g.name],V=W.forages;W.db=$;for(var F=0;F<V.length;F++)V[F]._dbInfo.db=$;return $});g.storeName?S=O.then(function($){if($.objectStoreNames.contains(g.storeName)){var W=$.version+1;lt(g);var V=X[g.name],F=V.forages;$.close();for(var J=0;J<F.length;J++){var it=F[J];it._dbInfo.db=null,it._dbInfo.version=W}var vt=new w(function(pt,Pt){var It=h.open(g.name,W);It.onerror=function(ce){var Ns=It.result;Ns.close(),Pt(ce)},It.onupgradeneeded=function(){var ce=It.result;ce.deleteObjectStore(g.storeName)},It.onsuccess=function(){var ce=It.result;ce.close(),pt(ce)}});return vt.then(function(pt){V.db=pt;for(var Pt=0;Pt<F.length;Pt++){var It=F[Pt];It._dbInfo.db=pt,kt(It._dbInfo)}}).catch(function(pt){throw(At(g,pt)||w.resolve()).catch(function(){}),pt})}}):S=O.then(function($){lt(g);var W=X[g.name],V=W.forages;$.close();for(var F=0;F<V.length;F++){var J=V[F];J._dbInfo.db=null}var it=new w(function(vt,pt){var Pt=h.deleteDatabase(g.name);Pt.onerror=function(){var It=Pt.result;It&&It.close(),pt(Pt.error)},Pt.onblocked=function(){console.warn('dropInstance blocked for database "'+g.name+'" until all open connections are closed')},Pt.onsuccess=function(){var It=Pt.result;It&&It.close(),vt(It)}});return it.then(function(vt){W.db=vt;for(var pt=0;pt<V.length;pt++){var Pt=V[pt];kt(Pt._dbInfo)}}).catch(function(vt){throw(At(g,vt)||w.resolve()).catch(function(){}),vt})})}return _(S,m),S}var u={_driver:"asyncStorage",_initStorage:Es,_support:b(),iterate:Ss,getItem:dn,setItem:Is,removeItem:hi,clear:Lr,length:ae,key:fn,keys:Cs,dropInstance:a};function f(){return typeof openDatabase=="function"}var E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D="~~local_forage_type~",M=/^~~local_forage_type~([^~]+)~/,Y="__lfsc__:",ut=Y.length,Nt="arbf",gt="blob",St="si08",Ut="ui08",hr="uic8",gn="si16",mn="si32",lc="ur16",uc="ui32",hc="fl32",pc="fl64",dc=ut+Nt.length,fc=Object.prototype.toString;function gc(g){var m=g.length*.75,y=g.length,I,S=0,C,O,$,W;g[g.length-1]==="="&&(m--,g[g.length-2]==="="&&m--);var V=new ArrayBuffer(m),F=new Uint8Array(V);for(I=0;I<y;I+=4)C=E.indexOf(g[I]),O=E.indexOf(g[I+1]),$=E.indexOf(g[I+2]),W=E.indexOf(g[I+3]),F[S++]=C<<2|O>>4,F[S++]=(O&15)<<4|$>>2,F[S++]=($&3)<<6|W&63;return V}function Ts(g){var m=new Uint8Array(g),y="",I;for(I=0;I<m.length;I+=3)y+=E[m[I]>>2],y+=E[(m[I]&3)<<4|m[I+1]>>4],y+=E[(m[I+1]&15)<<2|m[I+2]>>6],y+=E[m[I+2]&63];return m.length%3===2?y=y.substring(0,y.length-1)+"=":m.length%3===1&&(y=y.substring(0,y.length-2)+"=="),y}function Rp(g,m){var y="";if(g&&(y=fc.call(g)),g&&(y==="[object ArrayBuffer]"||g.buffer&&fc.call(g.buffer)==="[object ArrayBuffer]")){var I,S=Y;g instanceof ArrayBuffer?(I=g,S+=Nt):(I=g.buffer,y==="[object Int8Array]"?S+=St:y==="[object Uint8Array]"?S+=Ut:y==="[object Uint8ClampedArray]"?S+=hr:y==="[object Int16Array]"?S+=gn:y==="[object Uint16Array]"?S+=lc:y==="[object Int32Array]"?S+=mn:y==="[object Uint32Array]"?S+=uc:y==="[object Float32Array]"?S+=hc:y==="[object Float64Array]"?S+=pc:m(new Error("Failed to get type for BinaryArray"))),m(S+Ts(I))}else if(y==="[object Blob]"){var C=new FileReader;C.onload=function(){var O=D+g.type+"~"+Ts(this.result);m(Y+gt+O)},C.readAsArrayBuffer(g)}else try{m(JSON.stringify(g))}catch(O){console.error("Couldn't convert value into a JSON string: ",g),m(null,O)}}function Lp(g){if(g.substring(0,ut)!==Y)return JSON.parse(g);var m=g.substring(dc),y=g.substring(ut,dc),I;if(y===gt&&M.test(m)){var S=m.match(M);I=S[1],m=m.substring(S[0].length)}var C=gc(m);switch(y){case Nt:return C;case gt:return v([C],{type:I});case St:return new Int8Array(C);case Ut:return new Uint8Array(C);case hr:return new Uint8ClampedArray(C);case gn:return new Int16Array(C);case lc:return new Uint16Array(C);case mn:return new Int32Array(C);case uc:return new Uint32Array(C);case hc:return new Float32Array(C);case pc:return new Float64Array(C);default:throw new Error("Unkown type: "+y)}}var xs={serialize:Rp,deserialize:Lp,stringToBuffer:gc,bufferToString:Ts};function mc(g,m,y,I){g.executeSql("CREATE TABLE IF NOT EXISTS "+m.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],y,I)}function Mp(g){var m=this,y={db:null};if(g)for(var I in g)y[I]=typeof g[I]!="string"?g[I].toString():g[I];var S=new w(function(C,O){try{y.db=openDatabase(y.name,String(y.version),y.description,y.size)}catch($){return O($)}y.db.transaction(function($){mc($,y,function(){m._dbInfo=y,C()},function(W,V){O(V)})},O)});return y.serializer=xs,S}function Je(g,m,y,I,S,C){g.executeSql(y,I,S,function(O,$){$.code===$.SYNTAX_ERR?O.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[m.storeName],function(W,V){V.rows.length?C(W,$):mc(W,m,function(){W.executeSql(y,I,S,C)},C)},C):C(O,$)},C)}function Up(g,m){var y=this;g=A(g);var I=new w(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Je($,O,"SELECT * FROM "+O.storeName+" WHERE key = ? LIMIT 1",[g],function(W,V){var F=V.rows.length?V.rows.item(0).value:null;F&&(F=O.serializer.deserialize(F)),S(F)},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function Bp(g,m){var y=this,I=new w(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Je($,O,"SELECT * FROM "+O.storeName,[],function(W,V){for(var F=V.rows,J=F.length,it=0;it<J;it++){var vt=F.item(it),pt=vt.value;if(pt&&(pt=O.serializer.deserialize(pt)),pt=g(pt,vt.key,it+1),pt!==void 0){S(pt);return}}S()},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function yc(g,m,y,I){var S=this;g=A(g);var C=new w(function(O,$){S.ready().then(function(){m===void 0&&(m=null);var W=m,V=S._dbInfo;V.serializer.serialize(m,function(F,J){J?$(J):V.db.transaction(function(it){Je(it,V,"INSERT OR REPLACE INTO "+V.storeName+" (key, value) VALUES (?, ?)",[g,F],function(){O(W)},function(vt,pt){$(pt)})},function(it){if(it.code===it.QUOTA_ERR){if(I>0){O(yc.apply(S,[g,W,y,I-1]));return}$(it)}})})}).catch($)});return _(C,y),C}function jp(g,m,y){return yc.apply(this,[g,m,y,1])}function $p(g,m){var y=this;g=A(g);var I=new w(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Je($,O,"DELETE FROM "+O.storeName+" WHERE key = ?",[g],function(){S()},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function Fp(g){var m=this,y=new w(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Je(O,C,"DELETE FROM "+C.storeName,[],function(){I()},function($,W){S(W)})})}).catch(S)});return _(y,g),y}function Hp(g){var m=this,y=new w(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Je(O,C,"SELECT COUNT(key) as c FROM "+C.storeName,[],function($,W){var V=W.rows.item(0).c;I(V)},function($,W){S(W)})})}).catch(S)});return _(y,g),y}function Vp(g,m){var y=this,I=new w(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Je($,O,"SELECT key FROM "+O.storeName+" WHERE id = ? LIMIT 1",[g+1],function(W,V){var F=V.rows.length?V.rows.item(0).key:null;S(F)},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function qp(g){var m=this,y=new w(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Je(O,C,"SELECT key FROM "+C.storeName,[],function($,W){for(var V=[],F=0;F<W.rows.length;F++)V.push(W.rows.item(F).key);I(V)},function($,W){S(W)})})}).catch(S)});return _(y,g),y}function Wp(g){return new w(function(m,y){g.transaction(function(I){I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(S,C){for(var O=[],$=0;$<C.rows.length;$++)O.push(C.rows.item($).name);m({db:g,storeNames:O})},function(S,C){y(C)})},function(I){y(I)})})}function Gp(g,m){m=B.apply(this,arguments);var y=this.config();g=typeof g!="function"&&g||{},g.name||(g.name=g.name||y.name,g.storeName=g.storeName||y.storeName);var I=this,S;return g.name?S=new w(function(C){var O;g.name===y.name?O=I._dbInfo.db:O=openDatabase(g.name,"","",0),g.storeName?C({db:O,storeNames:[g.storeName]}):C(Wp(O))}).then(function(C){return new w(function(O,$){C.db.transaction(function(W){function V(vt){return new w(function(pt,Pt){W.executeSql("DROP TABLE IF EXISTS "+vt,[],function(){pt()},function(It,ce){Pt(ce)})})}for(var F=[],J=0,it=C.storeNames.length;J<it;J++)F.push(V(C.storeNames[J]));w.all(F).then(function(){O()}).catch(function(vt){$(vt)})},function(W){$(W)})})}):S=w.reject("Invalid arguments"),_(S,m),S}var zp={_driver:"webSQLStorage",_initStorage:Mp,_support:f(),iterate:Bp,getItem:Up,setItem:jp,removeItem:$p,clear:Fp,length:Hp,key:Vp,keys:qp,dropInstance:Gp};function Yp(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function vc(g,m){var y=g.name+"/";return g.storeName!==m.storeName&&(y+=g.storeName+"/"),y}function Kp(){var g="_localforage_support_test";try{return localStorage.setItem(g,!0),localStorage.removeItem(g),!1}catch{return!0}}function Jp(){return!Kp()||localStorage.length>0}function Xp(g){var m=this,y={};if(g)for(var I in g)y[I]=g[I];return y.keyPrefix=vc(g,m._defaultConfig),Jp()?(m._dbInfo=y,y.serializer=xs,w.resolve()):w.reject()}function Qp(g){var m=this,y=m.ready().then(function(){for(var I=m._dbInfo.keyPrefix,S=localStorage.length-1;S>=0;S--){var C=localStorage.key(S);C.indexOf(I)===0&&localStorage.removeItem(C)}});return _(y,g),y}function Zp(g,m){var y=this;g=A(g);var I=y.ready().then(function(){var S=y._dbInfo,C=localStorage.getItem(S.keyPrefix+g);return C&&(C=S.serializer.deserialize(C)),C});return _(I,m),I}function td(g,m){var y=this,I=y.ready().then(function(){for(var S=y._dbInfo,C=S.keyPrefix,O=C.length,$=localStorage.length,W=1,V=0;V<$;V++){var F=localStorage.key(V);if(F.indexOf(C)===0){var J=localStorage.getItem(F);if(J&&(J=S.serializer.deserialize(J)),J=g(J,F.substring(O),W++),J!==void 0)return J}}});return _(I,m),I}function ed(g,m){var y=this,I=y.ready().then(function(){var S=y._dbInfo,C;try{C=localStorage.key(g)}catch{C=null}return C&&(C=C.substring(S.keyPrefix.length)),C});return _(I,m),I}function rd(g){var m=this,y=m.ready().then(function(){for(var I=m._dbInfo,S=localStorage.length,C=[],O=0;O<S;O++){var $=localStorage.key(O);$.indexOf(I.keyPrefix)===0&&C.push($.substring(I.keyPrefix.length))}return C});return _(y,g),y}function nd(g){var m=this,y=m.keys().then(function(I){return I.length});return _(y,g),y}function id(g,m){var y=this;g=A(g);var I=y.ready().then(function(){var S=y._dbInfo;localStorage.removeItem(S.keyPrefix+g)});return _(I,m),I}function sd(g,m,y){var I=this;g=A(g);var S=I.ready().then(function(){m===void 0&&(m=null);var C=m;return new w(function(O,$){var W=I._dbInfo;W.serializer.serialize(m,function(V,F){if(F)$(F);else try{localStorage.setItem(W.keyPrefix+g,V),O(C)}catch(J){(J.name==="QuotaExceededError"||J.name==="NS_ERROR_DOM_QUOTA_REACHED")&&$(J),$(J)}})})});return _(S,y),S}function od(g,m){if(m=B.apply(this,arguments),g=typeof g!="function"&&g||{},!g.name){var y=this.config();g.name=g.name||y.name,g.storeName=g.storeName||y.storeName}var I=this,S;return g.name?S=new w(function(C){g.storeName?C(vc(g,I._defaultConfig)):C(g.name+"/")}).then(function(C){for(var O=localStorage.length-1;O>=0;O--){var $=localStorage.key(O);$.indexOf(C)===0&&localStorage.removeItem($)}}):S=w.reject("Invalid arguments"),_(S,m),S}var ad={_driver:"localStorageWrapper",_initStorage:Xp,_support:Yp(),iterate:td,getItem:Zp,setItem:sd,removeItem:id,clear:Qp,length:nd,key:ed,keys:rd,dropInstance:od},cd=function(g,m){return g===m||typeof g=="number"&&typeof m=="number"&&isNaN(g)&&isNaN(m)},ld=function(g,m){for(var y=g.length,I=0;I<y;){if(cd(g[I],m))return!0;I++}return!1},wc=Array.isArray||function(g){return Object.prototype.toString.call(g)==="[object Array]"},yn={},bc={},Mr={INDEXEDDB:u,WEBSQL:zp,LOCALSTORAGE:ad},ud=[Mr.INDEXEDDB._driver,Mr.WEBSQL._driver,Mr.LOCALSTORAGE._driver],pi=["dropInstance"],Ds=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(pi),hd={description:"",driver:ud.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function pd(g,m){g[m]=function(){var y=arguments;return g.ready().then(function(){return g[m].apply(g,y)})}}function As(){for(var g=1;g<arguments.length;g++){var m=arguments[g];if(m)for(var y in m)m.hasOwnProperty(y)&&(wc(m[y])?arguments[0][y]=m[y].slice():arguments[0][y]=m[y])}return arguments[0]}var dd=function(){function g(m){p(this,g);for(var y in Mr)if(Mr.hasOwnProperty(y)){var I=Mr[y],S=I._driver;this[y]=S,yn[S]||this.defineDriver(I)}this._defaultConfig=As({},hd),this._config=As({},this._defaultConfig,m),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return g.prototype.config=function(m){if((typeof m>"u"?"undefined":l(m))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var y in m){if(y==="storeName"&&(m[y]=m[y].replace(/\W/g,"_")),y==="version"&&typeof m[y]!="number")return new Error("Database version must be a number.");this._config[y]=m[y]}return"driver"in m&&m.driver?this.setDriver(this._config.driver):!0}else return typeof m=="string"?this._config[m]:this._config},g.prototype.defineDriver=function(m,y,I){var S=new w(function(C,O){try{var $=m._driver,W=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){O(W);return}for(var V=Ds.concat("_initStorage"),F=0,J=V.length;F<J;F++){var it=V[F],vt=!ld(pi,it);if((vt||m[it])&&typeof m[it]!="function"){O(W);return}}var pt=function(){for(var It=function(gd){return function(){var md=new Error("Method "+gd+" is not implemented by the current driver"),_c=w.reject(md);return _(_c,arguments[arguments.length-1]),_c}},ce=0,Ns=pi.length;ce<Ns;ce++){var Os=pi[ce];m[Os]||(m[Os]=It(Os))}};pt();var Pt=function(It){yn[$]&&console.info("Redefining LocalForage driver: "+$),yn[$]=m,bc[$]=It,C()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Pt,O):Pt(!!m._support):Pt(!0)}catch(It){O(It)}});return k(S,y,I),S},g.prototype.driver=function(){return this._driver||null},g.prototype.getDriver=function(m,y,I){var S=yn[m]?w.resolve(yn[m]):w.reject(new Error("Driver not found."));return k(S,y,I),S},g.prototype.getSerializer=function(m){var y=w.resolve(xs);return k(y,m),y},g.prototype.ready=function(m){var y=this,I=y._driverSet.then(function(){return y._ready===null&&(y._ready=y._initDriver()),y._ready});return k(I,m,m),I},g.prototype.setDriver=function(m,y,I){var S=this;wc(m)||(m=[m]);var C=this._getSupportedDrivers(m);function O(){S._config.driver=S.driver()}function $(F){return S._extend(F),O(),S._ready=S._initStorage(S._config),S._ready}function W(F){return function(){var J=0;function it(){for(;J<F.length;){var vt=F[J];return J++,S._dbInfo=null,S._ready=null,S.getDriver(vt).then($).catch(it)}O();var pt=new Error("No available storage method found.");return S._driverSet=w.reject(pt),S._driverSet}return it()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return w.resolve()}):w.resolve();return this._driverSet=V.then(function(){var F=C[0];return S._dbInfo=null,S._ready=null,S.getDriver(F).then(function(J){S._driver=J._driver,O(),S._wrapLibraryMethodsWithReady(),S._initDriver=W(C)})}).catch(function(){O();var F=new Error("No available storage method found.");return S._driverSet=w.reject(F),S._driverSet}),k(this._driverSet,y,I),this._driverSet},g.prototype.supports=function(m){return!!bc[m]},g.prototype._extend=function(m){As(this,m)},g.prototype._getSupportedDrivers=function(m){for(var y=[],I=0,S=m.length;I<S;I++){var C=m[I];this.supports(C)&&y.push(C)}return y},g.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,y=Ds.length;m<y;m++)pd(this,Ds[m])},g.prototype.createInstance=function(m){return new g(m)},g}(),fd=new dd;o.exports=fd},{3:3}]},{},[4])(4)})}),fu=rs(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLBuilder=void 0;var e=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();t.URLBuilder=e}),Pd=rs((t,e)=>{"use strict";(function(r,n){typeof t=="object"&&typeof e<"u"?e.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(t,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var c={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(c,o),function(l,p){var d=o.retries,h=o.retryDelay,b=o.retryOn;if(p&&p.retries!==void 0)if(n(p.retries))d=p.retries;else throw new i("retries must be a positive integer");if(p&&p.retryDelay!==void 0)if(n(p.retryDelay)||typeof p.retryDelay=="function")h=p.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(p&&p.retryOn)if(Array.isArray(p.retryOn)||typeof p.retryOn=="function")b=p.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(v,w){var _=function(A){var B=typeof Request<"u"&&l instanceof Request?l.clone():l;s(B,p).then(function(G){if(Array.isArray(b)&&b.indexOf(G.status)===-1)v(G);else if(typeof b=="function")try{return Promise.resolve(b(A,null,G)).then(function(j){j?k(A,null,G):v(G)}).catch(w)}catch(j){w(j)}else A<d?k(A,null,G):v(G)}).catch(function(G){if(typeof b=="function")try{Promise.resolve(b(A,G,null)).then(function(j){j?k(A,G,null):w(G)}).catch(function(j){w(j)})}catch(j){w(j)}else A<d?k(A,G,null):w(G)})};function k(A,B,G){var j=typeof h=="function"?h(A,B,G):h;setTimeout(function(){_(++A)},j)}_(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),Rd="9.12.8",H=class co{static SDK_VERSION=Rd;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=co.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");co.SDK_VERSION_CODE=parseInt(e,10)}},qe={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${H.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${H.SDK_VERSION}/dist/widget.min.js`},he=ke(sn()),T=class{static log(...t){he.default.info(...t)}static debug(...t){he.default.debug(...t)}static error(...t){he.default.error(...t)}static warn(...t){he.default.warn(...t)}static info(...t){he.default.info(...t)}static trace(...t){he.default.trace(...t)}};function Ld(t=H.LOG_PREFIX){he.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${H.SDK_VERSION}):`)}});let e=gu();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?he.default.setLevel(he.default[localStorage.cooeeLogLevel]):he.default.setLevel(qe.debug?he.default.TRACE:he.default.OFF)}function gu(){return new URL(location.href).searchParams?.get("cooee-debug")}function Md(){let t=`
|
|
1
|
+
"use strict";(()=>{var vd=Object.create;var _c=Object.defineProperty;var wd=Object.getOwnPropertyDescriptor;var bd=Object.getOwnPropertyNames;var _d=Object.getPrototypeOf,Ed=Object.prototype.hasOwnProperty;var Sd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bd(e))!Ed.call(t,i)&&i!==r&&_c(t,i,{get:()=>e[i],enumerable:!(n=wd(e,i))||n.enumerable});return t};var Id=(t,e,r)=>(r=t!=null?vd(_d(t)):{},Sd(e||!t||!t.__esModule?_c(r,"default",{value:t,enumerable:!0}):r,t));var Cd=Object.create,ta=Object.defineProperty,Td=Object.defineProperties,xd=Object.getOwnPropertyDescriptor,Dd=Object.getOwnPropertyDescriptors,Ad=Object.getOwnPropertyNames,Ec=Object.getOwnPropertySymbols,Nd=Object.getPrototypeOf,pu=Object.prototype.hasOwnProperty,Od=Object.prototype.propertyIsEnumerable,Sc=(t,e,r)=>e in t?ta(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e||={})pu.call(e,r)&&Sc(t,r,e[r]);if(Ec)for(var r of Ec(e))Od.call(e,r)&&Sc(t,r,e[r]);return t},yt=(t,e)=>Td(t,Dd(e)),di=(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')}),rs=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),kd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ad(e))!pu.call(t,i)&&i!==r&&ta(t,i,{get:()=>e[i],enumerable:!(n=xd(e,i))||n.enumerable});return t},ke=(t,e,r)=>(r=t!=null?Cd(Nd(t)):{},kd(e||!t||!t.__esModule?ta(r,"default",{value:t,enumerable:!0}):r,t)),sn=rs((t,e)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(h,b){return function(){return b.apply(h,arguments)}},c=function(){var h=arguments,b=h[0],v,w;for(w=1;w<h.length;w++)for(v in h[w])!(v in b)&&h[w].hasOwnProperty(v)&&(b[v]=h[w][v]);return b},l=function(h,b){return{value:h,name:b}};n.TRACE=l(1,"TRACE"),n.DEBUG=l(2,"DEBUG"),n.INFO=l(3,"INFO"),n.TIME=l(4,"TIME"),n.WARN=l(5,"WARN"),n.ERROR=l(8,"ERROR"),n.OFF=l(99,"OFF");var p=function(h){this.context=h,this.setLevel(h.filterLevel),this.log=this.info};p.prototype={setLevel:function(h){h&&"value"in h&&(this.context.filterLevel=h)},getLevel:function(){return this.context.filterLevel},enabledFor:function(h){var b=this.context.filterLevel;return h.value>=b.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"start"])},timeEnd:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"end"])},invoke:function(h,b){i&&this.enabledFor(h)&&i(b,c({level:h},this.context))}};var d=new p({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(d,d.enabledFor),h.trace=o(d,d.trace),h.debug=o(d,d.debug),h.time=o(d,d.time),h.timeEnd=o(d,d.timeEnd),h.info=o(d,d.info),h.warn=o(d,d.warn),h.error=o(d,d.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){d.setLevel(h);for(var b in s)s.hasOwnProperty(b)&&s[b].setLevel(h)},n.getLevel=function(){return d.getLevel()},n.get=function(h){return s[h]||(s[h]=new p(c({name:h},d.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(w,_){_.name&&w.unshift("["+_.name+"]")};var b={},v=function(w,_){Function.prototype.apply.call(w,console,_)};return typeof console>"u"?function(){}:function(w,_){w=Array.prototype.slice.call(w);var k=console.log,A;_.level===n.TIME?(A=(_.name?"["+_.name+"] ":"")+w[0],w[1]==="start"?console.time?console.time(A):b[A]=new Date().getTime():console.timeEnd?console.timeEnd(A):v(k,[A+": "+(new Date().getTime()-b[A])+"ms"])):(_.level===n.WARN&&console.warn?k=console.warn:_.level===n.ERROR&&console.error?k=console.error:_.level===n.INFO&&console.info?k=console.info:_.level===n.DEBUG&&console.debug?k=console.debug:_.level===n.TRACE&&console.trace&&(k=console.trace),h.formatter(w,_),v(k,w))}},n.useDefaults=function(h){n.setLevel(h&&h.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(h))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof e<"u"&&e.exports?e.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(t)}),Pd=rs((t,e)=>{"use strict";(function(r){if(typeof t=="object"&&typeof e<"u")e.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,c,l){function p(b,v){if(!c[b]){if(!o[b]){var w=typeof di=="function"&&di;if(!v&&w)return w(b,!0);if(d)return d(b,!0);var _=new Error("Cannot find module '"+b+"'");throw _.code="MODULE_NOT_FOUND",_}var k=c[b]={exports:{}};o[b][0].call(k.exports,function(A){var B=o[b][1][A];return p(B||A)},k,k.exports,s,o,c,l)}return c[b].exports}for(var d=typeof di=="function"&&di,h=0;h<l.length;h++)p(l[h]);return p}({1:[function(s,o,c){(function(l){"use strict";var p=l.MutationObserver||l.WebKitMutationObserver,d;if(p){var h=0,b=new p(A),v=l.document.createTextNode("");b.observe(v,{characterData:!0}),d=function(){v.data=h=++h%2}}else if(!l.setImmediate&&typeof l.MessageChannel<"u"){var w=new l.MessageChannel;w.port1.onmessage=A,d=function(){w.port2.postMessage(0)}}else"document"in l&&"onreadystatechange"in l.document.createElement("script")?d=function(){var G=l.document.createElement("script");G.onreadystatechange=function(){A(),G.onreadystatechange=null,G.parentNode.removeChild(G),G=null},l.document.documentElement.appendChild(G)}:d=function(){setTimeout(A,0)};var _,k=[];function A(){_=!0;for(var G,j,X=k.length;X;){for(j=k,k=[],G=-1;++G<X;)j[G]();X=k.length}_=!1}o.exports=B;function B(G){k.push(G)===1&&!_&&d()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,c){"use strict";var l=s(1);function p(){}var d={},h=["REJECTED"],b=["FULFILLED"],v=["PENDING"];o.exports=w;function w(q){if(typeof q!="function")throw new TypeError("resolver must be a function");this.state=v,this.queue=[],this.outcome=void 0,q!==p&&B(this,q)}w.prototype.catch=function(q){return this.then(null,q)},w.prototype.then=function(q,rt){if(typeof q!="function"&&this.state===b||typeof rt!="function"&&this.state===h)return this;var Q=new this.constructor(p);if(this.state!==v){var tt=this.state===b?q:rt;k(Q,tt,this.outcome)}else this.queue.push(new _(Q,q,rt));return Q};function _(q,rt,Q){this.promise=q,typeof rt=="function"&&(this.onFulfilled=rt,this.callFulfilled=this.otherCallFulfilled),typeof Q=="function"&&(this.onRejected=Q,this.callRejected=this.otherCallRejected)}_.prototype.callFulfilled=function(q){d.resolve(this.promise,q)},_.prototype.otherCallFulfilled=function(q){k(this.promise,this.onFulfilled,q)},_.prototype.callRejected=function(q){d.reject(this.promise,q)},_.prototype.otherCallRejected=function(q){k(this.promise,this.onRejected,q)};function k(q,rt,Q){l(function(){var tt;try{tt=rt(Q)}catch(lt){return d.reject(q,lt)}tt===q?d.reject(q,new TypeError("Cannot resolve promise with itself")):d.resolve(q,tt)})}d.resolve=function(q,rt){var Q=G(A,rt);if(Q.status==="error")return d.reject(q,Q.value);var tt=Q.value;if(tt)B(q,tt);else{q.state=b,q.outcome=rt;for(var lt=-1,kt=q.queue.length;++lt<kt;)q.queue[lt].callFulfilled(rt)}return q},d.reject=function(q,rt){q.state=h,q.outcome=rt;for(var Q=-1,tt=q.queue.length;++Q<tt;)q.queue[Q].callRejected(rt);return q};function A(q){var rt=q&&q.then;if(q&&(typeof q=="object"||typeof q=="function")&&typeof rt=="function")return function(){rt.apply(q,arguments)}}function B(q,rt){var Q=!1;function tt(jt){Q||(Q=!0,d.reject(q,jt))}function lt(jt){Q||(Q=!0,d.resolve(q,jt))}function kt(){rt(lt,tt)}var At=G(kt);At.status==="error"&&tt(At.value)}function G(q,rt){var Q={};try{Q.value=q(rt),Q.status="success"}catch(tt){Q.status="error",Q.value=tt}return Q}w.resolve=j;function j(q){return q instanceof this?q:d.resolve(new this(p),q)}w.reject=X;function X(q){var rt=new this(p);return d.reject(rt,q)}w.all=_t;function _t(q){var rt=this;if(Object.prototype.toString.call(q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Q=q.length,tt=!1;if(!Q)return this.resolve([]);for(var lt=new Array(Q),kt=0,At=-1,jt=new this(p);++At<Q;)Wt(q[At],At);return jt;function Wt(ft,Gt){rt.resolve(ft).then(st,function(et){tt||(tt=!0,d.reject(jt,et))});function st(et){lt[Gt]=et,++kt===Q&&!tt&&(tt=!0,d.resolve(jt,lt))}}}w.race=Dt;function Dt(q){var rt=this;if(Object.prototype.toString.call(q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Q=q.length,tt=!1;if(!Q)return this.resolve([]);for(var lt=-1,kt=new this(p);++lt<Q;)At(q[lt]);return kt;function At(jt){rt.resolve(jt).then(function(Wt){tt||(tt=!0,d.resolve(kt,Wt))},function(Wt){tt||(tt=!0,d.reject(kt,Wt))})}}},{1:1}],3:[function(s,o,c){(function(l){"use strict";typeof l.Promise!="function"&&(l.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,c){"use strict";var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g};function p(g,m){if(!(g instanceof m))throw new TypeError("Cannot call a class as a function")}function d(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var h=d();function b(){try{if(!h||!h.open)return!1;var g=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),m=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!g||m)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function v(g,m){g=g||[],m=m||{};try{return new Blob(g,m)}catch(C){if(C.name!=="TypeError")throw C;for(var y=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,I=new y,S=0;S<g.length;S+=1)I.append(g[S]);return I.getBlob(m.type)}}typeof Promise>"u"&&s(3);var w=Promise;function _(g,m){m&&g.then(function(y){m(null,y)},function(y){m(y)})}function k(g,m,y){typeof m=="function"&&g.then(m),typeof y=="function"&&g.catch(y)}function A(g){return typeof g!="string"&&(console.warn(g+" used as a key, but it is not a string."),g=String(g)),g}function B(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var G="local-forage-detect-blob-support",j=void 0,X={},_t=Object.prototype.toString,Dt="readonly",q="readwrite";function rt(g){for(var m=g.length,y=new ArrayBuffer(m),I=new Uint8Array(y),S=0;S<m;S++)I[S]=g.charCodeAt(S);return y}function Q(g){return new w(function(m){var y=g.transaction(G,q),I=v([""]);y.objectStore(G).put(I,"key"),y.onabort=function(S){S.preventDefault(),S.stopPropagation(),m(!1)},y.oncomplete=function(){var S=navigator.userAgent.match(/Chrome\/(\d+)/),C=navigator.userAgent.match(/Edge\//);m(C||!S||parseInt(S[1],10)>=43)}}).catch(function(){return!1})}function tt(g){return typeof j=="boolean"?w.resolve(j):Q(g).then(function(m){return j=m,j})}function lt(g){var m=X[g.name],y={};y.promise=new w(function(I,S){y.resolve=I,y.reject=S}),m.deferredOperations.push(y),m.dbReady?m.dbReady=m.dbReady.then(function(){return y.promise}):m.dbReady=y.promise}function kt(g){var m=X[g.name],y=m.deferredOperations.pop();if(y)return y.resolve(),y.promise}function At(g,m){var y=X[g.name],I=y.deferredOperations.pop();if(I)return I.reject(m),I.promise}function jt(g,m){return new w(function(y,I){if(X[g.name]=X[g.name]||ui(),g.db)if(m)lt(g),g.db.close();else return y(g.db);var S=[g.name];m&&S.push(g.version);var C=h.open.apply(h,S);m&&(C.onupgradeneeded=function(O){var $=C.result;try{$.createObjectStore(g.storeName),O.oldVersion<=1&&$.createObjectStore(G)}catch(W){if(W.name==="ConstraintError")console.warn('The database "'+g.name+'" has been upgraded from version '+O.oldVersion+" to version "+O.newVersion+', but the storage "'+g.storeName+'" already exists.');else throw W}}),C.onerror=function(O){O.preventDefault(),I(C.error)},C.onsuccess=function(){var O=C.result;O.onversionchange=function($){$.target.close()},y(O),kt(g)}})}function Wt(g){return jt(g,!1)}function ft(g){return jt(g,!0)}function Gt(g,m){if(!g.db)return!0;var y=!g.db.objectStoreNames.contains(g.storeName),I=g.version<g.db.version,S=g.version>g.db.version;if(I&&(g.version!==m&&console.warn('The database "'+g.name+`" can't be downgraded from version `+g.db.version+" to version "+g.version+"."),g.version=g.db.version),S||y){if(y){var C=g.db.version+1;C>g.version&&(g.version=C)}return!0}return!1}function st(g){return new w(function(m,y){var I=new FileReader;I.onerror=y,I.onloadend=function(S){var C=btoa(S.target.result||"");m({__local_forage_encoded_blob:!0,data:C,type:g.type})},I.readAsBinaryString(g)})}function et(g){var m=rt(atob(g.data));return v([m],{type:g.type})}function $t(g){return g&&g.__local_forage_encoded_blob}function ci(g){var m=this,y=m._initReady().then(function(){var I=X[m._dbInfo.name];if(I&&I.dbReady)return I.dbReady});return k(y,g,g),y}function li(g){lt(g);for(var m=X[g.name],y=m.forages,I=0;I<y.length;I++){var S=y[I];S._dbInfo.db&&(S._dbInfo.db.close(),S._dbInfo.db=null)}return g.db=null,Wt(g).then(function(C){return g.db=C,Gt(g)?ft(g):C}).then(function(C){g.db=m.db=C;for(var O=0;O<y.length;O++)y[O]._dbInfo.db=C}).catch(function(C){throw At(g,C),C})}function oe(g,m,y,I){I===void 0&&(I=1);try{var S=g.db.transaction(g.storeName,m);y(null,S)}catch(C){if(I>0&&(!g.db||C.name==="InvalidStateError"||C.name==="NotFoundError"))return w.resolve().then(function(){if(!g.db||C.name==="NotFoundError"&&!g.db.objectStoreNames.contains(g.storeName)&&g.version<=g.db.version)return g.db&&(g.version=g.db.version+1),ft(g)}).then(function(){return li(g).then(function(){oe(g,m,y,I-1)})}).catch(y);y(C)}}function ui(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ss(g){var m=this,y={db:null};if(g)for(var I in g)y[I]=g[I];var S=X[y.name];S||(S=ui(),X[y.name]=S),S.forages.push(m),m._initReady||(m._initReady=m.ready,m.ready=ci);var C=[];function O(){return w.resolve()}for(var $=0;$<S.forages.length;$++){var W=S.forages[$];W!==m&&C.push(W._initReady().catch(O))}var V=S.forages.slice(0);return w.all(C).then(function(){return y.db=S.db,Wt(y)}).then(function(F){return y.db=F,Gt(y,m._defaultConfig.version)?ft(y):F}).then(function(F){y.db=S.db=F,m._dbInfo=y;for(var J=0;J<V.length;J++){var it=V[J];it!==m&&(it._dbInfo.db=y.db,it._dbInfo.version=y.version)}})}function dn(g,m){var y=this;g=A(g);var I=new w(function(S,C){y.ready().then(function(){oe(y._dbInfo,Dt,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.get(g);V.onsuccess=function(){var F=V.result;F===void 0&&(F=null),$t(F)&&(F=et(F)),S(F)},V.onerror=function(){C(V.error)}}catch(F){C(F)}})}).catch(C)});return _(I,m),I}function Is(g,m){var y=this,I=new w(function(S,C){y.ready().then(function(){oe(y._dbInfo,Dt,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.openCursor(),F=1;V.onsuccess=function(){var J=V.result;if(J){var it=J.value;$t(it)&&(it=et(it));var vt=g(it,J.key,F++);vt!==void 0?S(vt):J.continue()}else S()},V.onerror=function(){C(V.error)}}catch(J){C(J)}})}).catch(C)});return _(I,m),I}function Cs(g,m,y){var I=this;g=A(g);var S=new w(function(C,O){var $;I.ready().then(function(){return $=I._dbInfo,_t.call(m)==="[object Blob]"?tt($.db).then(function(W){return W?m:st(m)}):m}).then(function(W){oe(I._dbInfo,q,function(V,F){if(V)return O(V);try{var J=F.objectStore(I._dbInfo.storeName);W===null&&(W=void 0);var it=J.put(W,g);F.oncomplete=function(){W===void 0&&(W=null),C(W)},F.onabort=F.onerror=function(){var vt=it.error?it.error:it.transaction.error;O(vt)}}catch(vt){O(vt)}})}).catch(O)});return _(S,y),S}function hi(g,m){var y=this;g=A(g);var I=new w(function(S,C){y.ready().then(function(){oe(y._dbInfo,q,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.delete(g);$.oncomplete=function(){S()},$.onerror=function(){C(V.error)},$.onabort=function(){var F=V.error?V.error:V.transaction.error;C(F)}}catch(F){C(F)}})}).catch(C)});return _(I,m),I}function Lr(g){var m=this,y=new w(function(I,S){m.ready().then(function(){oe(m._dbInfo,q,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.clear();O.oncomplete=function(){I()},O.onabort=O.onerror=function(){var V=W.error?W.error:W.transaction.error;S(V)}}catch(V){S(V)}})}).catch(S)});return _(y,g),y}function ae(g){var m=this,y=new w(function(I,S){m.ready().then(function(){oe(m._dbInfo,Dt,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.count();W.onsuccess=function(){I(W.result)},W.onerror=function(){S(W.error)}}catch(V){S(V)}})}).catch(S)});return _(y,g),y}function fn(g,m){var y=this,I=new w(function(S,C){if(g<0){S(null);return}y.ready().then(function(){oe(y._dbInfo,Dt,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=!1,F=W.openKeyCursor();F.onsuccess=function(){var J=F.result;if(!J){S(null);return}g===0||V?S(J.key):(V=!0,J.advance(g))},F.onerror=function(){C(F.error)}}catch(J){C(J)}})}).catch(C)});return _(I,m),I}function Ts(g){var m=this,y=new w(function(I,S){m.ready().then(function(){oe(m._dbInfo,Dt,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.openKeyCursor(),V=[];W.onsuccess=function(){var F=W.result;if(!F){I(V);return}V.push(F.key),F.continue()},W.onerror=function(){S(W.error)}}catch(F){S(F)}})}).catch(S)});return _(y,g),y}function a(g,m){m=B.apply(this,arguments);var y=this.config();g=typeof g!="function"&&g||{},g.name||(g.name=g.name||y.name,g.storeName=g.storeName||y.storeName);var I=this,S;if(!g.name)S=w.reject("Invalid arguments");else{var C=g.name===y.name&&I._dbInfo.db,O=C?w.resolve(I._dbInfo.db):Wt(g).then(function($){var W=X[g.name],V=W.forages;W.db=$;for(var F=0;F<V.length;F++)V[F]._dbInfo.db=$;return $});g.storeName?S=O.then(function($){if($.objectStoreNames.contains(g.storeName)){var W=$.version+1;lt(g);var V=X[g.name],F=V.forages;$.close();for(var J=0;J<F.length;J++){var it=F[J];it._dbInfo.db=null,it._dbInfo.version=W}var vt=new w(function(pt,Pt){var It=h.open(g.name,W);It.onerror=function(ce){var Os=It.result;Os.close(),Pt(ce)},It.onupgradeneeded=function(){var ce=It.result;ce.deleteObjectStore(g.storeName)},It.onsuccess=function(){var ce=It.result;ce.close(),pt(ce)}});return vt.then(function(pt){V.db=pt;for(var Pt=0;Pt<F.length;Pt++){var It=F[Pt];It._dbInfo.db=pt,kt(It._dbInfo)}}).catch(function(pt){throw(At(g,pt)||w.resolve()).catch(function(){}),pt})}}):S=O.then(function($){lt(g);var W=X[g.name],V=W.forages;$.close();for(var F=0;F<V.length;F++){var J=V[F];J._dbInfo.db=null}var it=new w(function(vt,pt){var Pt=h.deleteDatabase(g.name);Pt.onerror=function(){var It=Pt.result;It&&It.close(),pt(Pt.error)},Pt.onblocked=function(){console.warn('dropInstance blocked for database "'+g.name+'" until all open connections are closed')},Pt.onsuccess=function(){var It=Pt.result;It&&It.close(),vt(It)}});return it.then(function(vt){W.db=vt;for(var pt=0;pt<V.length;pt++){var Pt=V[pt];kt(Pt._dbInfo)}}).catch(function(vt){throw(At(g,vt)||w.resolve()).catch(function(){}),vt})})}return _(S,m),S}var u={_driver:"asyncStorage",_initStorage:Ss,_support:b(),iterate:Is,getItem:dn,setItem:Cs,removeItem:hi,clear:Lr,length:ae,key:fn,keys:Ts,dropInstance:a};function f(){return typeof openDatabase=="function"}var E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D="~~local_forage_type~",M=/^~~local_forage_type~([^~]+)~/,Y="__lfsc__:",ut=Y.length,Nt="arbf",gt="blob",St="si08",Ut="ui08",hr="uic8",gn="si16",mn="si32",cc="ur16",lc="ui32",uc="fl32",hc="fl64",pc=ut+Nt.length,dc=Object.prototype.toString;function fc(g){var m=g.length*.75,y=g.length,I,S=0,C,O,$,W;g[g.length-1]==="="&&(m--,g[g.length-2]==="="&&m--);var V=new ArrayBuffer(m),F=new Uint8Array(V);for(I=0;I<y;I+=4)C=E.indexOf(g[I]),O=E.indexOf(g[I+1]),$=E.indexOf(g[I+2]),W=E.indexOf(g[I+3]),F[S++]=C<<2|O>>4,F[S++]=(O&15)<<4|$>>2,F[S++]=($&3)<<6|W&63;return V}function xs(g){var m=new Uint8Array(g),y="",I;for(I=0;I<m.length;I+=3)y+=E[m[I]>>2],y+=E[(m[I]&3)<<4|m[I+1]>>4],y+=E[(m[I+1]&15)<<2|m[I+2]>>6],y+=E[m[I+2]&63];return m.length%3===2?y=y.substring(0,y.length-1)+"=":m.length%3===1&&(y=y.substring(0,y.length-2)+"=="),y}function Lp(g,m){var y="";if(g&&(y=dc.call(g)),g&&(y==="[object ArrayBuffer]"||g.buffer&&dc.call(g.buffer)==="[object ArrayBuffer]")){var I,S=Y;g instanceof ArrayBuffer?(I=g,S+=Nt):(I=g.buffer,y==="[object Int8Array]"?S+=St:y==="[object Uint8Array]"?S+=Ut:y==="[object Uint8ClampedArray]"?S+=hr:y==="[object Int16Array]"?S+=gn:y==="[object Uint16Array]"?S+=cc:y==="[object Int32Array]"?S+=mn:y==="[object Uint32Array]"?S+=lc:y==="[object Float32Array]"?S+=uc:y==="[object Float64Array]"?S+=hc:m(new Error("Failed to get type for BinaryArray"))),m(S+xs(I))}else if(y==="[object Blob]"){var C=new FileReader;C.onload=function(){var O=D+g.type+"~"+xs(this.result);m(Y+gt+O)},C.readAsArrayBuffer(g)}else try{m(JSON.stringify(g))}catch(O){console.error("Couldn't convert value into a JSON string: ",g),m(null,O)}}function Mp(g){if(g.substring(0,ut)!==Y)return JSON.parse(g);var m=g.substring(pc),y=g.substring(ut,pc),I;if(y===gt&&M.test(m)){var S=m.match(M);I=S[1],m=m.substring(S[0].length)}var C=fc(m);switch(y){case Nt:return C;case gt:return v([C],{type:I});case St:return new Int8Array(C);case Ut:return new Uint8Array(C);case hr:return new Uint8ClampedArray(C);case gn:return new Int16Array(C);case cc:return new Uint16Array(C);case mn:return new Int32Array(C);case lc:return new Uint32Array(C);case uc:return new Float32Array(C);case hc:return new Float64Array(C);default:throw new Error("Unkown type: "+y)}}var Ds={serialize:Lp,deserialize:Mp,stringToBuffer:fc,bufferToString:xs};function gc(g,m,y,I){g.executeSql("CREATE TABLE IF NOT EXISTS "+m.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],y,I)}function Up(g){var m=this,y={db:null};if(g)for(var I in g)y[I]=typeof g[I]!="string"?g[I].toString():g[I];var S=new w(function(C,O){try{y.db=openDatabase(y.name,String(y.version),y.description,y.size)}catch($){return O($)}y.db.transaction(function($){gc($,y,function(){m._dbInfo=y,C()},function(W,V){O(V)})},O)});return y.serializer=Ds,S}function Xe(g,m,y,I,S,C){g.executeSql(y,I,S,function(O,$){$.code===$.SYNTAX_ERR?O.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[m.storeName],function(W,V){V.rows.length?C(W,$):gc(W,m,function(){W.executeSql(y,I,S,C)},C)},C):C(O,$)},C)}function Bp(g,m){var y=this;g=A(g);var I=new w(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Xe($,O,"SELECT * FROM "+O.storeName+" WHERE key = ? LIMIT 1",[g],function(W,V){var F=V.rows.length?V.rows.item(0).value:null;F&&(F=O.serializer.deserialize(F)),S(F)},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function jp(g,m){var y=this,I=new w(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Xe($,O,"SELECT * FROM "+O.storeName,[],function(W,V){for(var F=V.rows,J=F.length,it=0;it<J;it++){var vt=F.item(it),pt=vt.value;if(pt&&(pt=O.serializer.deserialize(pt)),pt=g(pt,vt.key,it+1),pt!==void 0){S(pt);return}}S()},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function mc(g,m,y,I){var S=this;g=A(g);var C=new w(function(O,$){S.ready().then(function(){m===void 0&&(m=null);var W=m,V=S._dbInfo;V.serializer.serialize(m,function(F,J){J?$(J):V.db.transaction(function(it){Xe(it,V,"INSERT OR REPLACE INTO "+V.storeName+" (key, value) VALUES (?, ?)",[g,F],function(){O(W)},function(vt,pt){$(pt)})},function(it){if(it.code===it.QUOTA_ERR){if(I>0){O(mc.apply(S,[g,W,y,I-1]));return}$(it)}})})}).catch($)});return _(C,y),C}function $p(g,m,y){return mc.apply(this,[g,m,y,1])}function Fp(g,m){var y=this;g=A(g);var I=new w(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Xe($,O,"DELETE FROM "+O.storeName+" WHERE key = ?",[g],function(){S()},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function Hp(g){var m=this,y=new w(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Xe(O,C,"DELETE FROM "+C.storeName,[],function(){I()},function($,W){S(W)})})}).catch(S)});return _(y,g),y}function Vp(g){var m=this,y=new w(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Xe(O,C,"SELECT COUNT(key) as c FROM "+C.storeName,[],function($,W){var V=W.rows.item(0).c;I(V)},function($,W){S(W)})})}).catch(S)});return _(y,g),y}function qp(g,m){var y=this,I=new w(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Xe($,O,"SELECT key FROM "+O.storeName+" WHERE id = ? LIMIT 1",[g+1],function(W,V){var F=V.rows.length?V.rows.item(0).key:null;S(F)},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function Wp(g){var m=this,y=new w(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Xe(O,C,"SELECT key FROM "+C.storeName,[],function($,W){for(var V=[],F=0;F<W.rows.length;F++)V.push(W.rows.item(F).key);I(V)},function($,W){S(W)})})}).catch(S)});return _(y,g),y}function Gp(g){return new w(function(m,y){g.transaction(function(I){I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(S,C){for(var O=[],$=0;$<C.rows.length;$++)O.push(C.rows.item($).name);m({db:g,storeNames:O})},function(S,C){y(C)})},function(I){y(I)})})}function zp(g,m){m=B.apply(this,arguments);var y=this.config();g=typeof g!="function"&&g||{},g.name||(g.name=g.name||y.name,g.storeName=g.storeName||y.storeName);var I=this,S;return g.name?S=new w(function(C){var O;g.name===y.name?O=I._dbInfo.db:O=openDatabase(g.name,"","",0),g.storeName?C({db:O,storeNames:[g.storeName]}):C(Gp(O))}).then(function(C){return new w(function(O,$){C.db.transaction(function(W){function V(vt){return new w(function(pt,Pt){W.executeSql("DROP TABLE IF EXISTS "+vt,[],function(){pt()},function(It,ce){Pt(ce)})})}for(var F=[],J=0,it=C.storeNames.length;J<it;J++)F.push(V(C.storeNames[J]));w.all(F).then(function(){O()}).catch(function(vt){$(vt)})},function(W){$(W)})})}):S=w.reject("Invalid arguments"),_(S,m),S}var Yp={_driver:"webSQLStorage",_initStorage:Up,_support:f(),iterate:jp,getItem:Bp,setItem:$p,removeItem:Fp,clear:Hp,length:Vp,key:qp,keys:Wp,dropInstance:zp};function Kp(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function yc(g,m){var y=g.name+"/";return g.storeName!==m.storeName&&(y+=g.storeName+"/"),y}function Jp(){var g="_localforage_support_test";try{return localStorage.setItem(g,!0),localStorage.removeItem(g),!1}catch{return!0}}function Xp(){return!Jp()||localStorage.length>0}function Qp(g){var m=this,y={};if(g)for(var I in g)y[I]=g[I];return y.keyPrefix=yc(g,m._defaultConfig),Xp()?(m._dbInfo=y,y.serializer=Ds,w.resolve()):w.reject()}function Zp(g){var m=this,y=m.ready().then(function(){for(var I=m._dbInfo.keyPrefix,S=localStorage.length-1;S>=0;S--){var C=localStorage.key(S);C.indexOf(I)===0&&localStorage.removeItem(C)}});return _(y,g),y}function td(g,m){var y=this;g=A(g);var I=y.ready().then(function(){var S=y._dbInfo,C=localStorage.getItem(S.keyPrefix+g);return C&&(C=S.serializer.deserialize(C)),C});return _(I,m),I}function ed(g,m){var y=this,I=y.ready().then(function(){for(var S=y._dbInfo,C=S.keyPrefix,O=C.length,$=localStorage.length,W=1,V=0;V<$;V++){var F=localStorage.key(V);if(F.indexOf(C)===0){var J=localStorage.getItem(F);if(J&&(J=S.serializer.deserialize(J)),J=g(J,F.substring(O),W++),J!==void 0)return J}}});return _(I,m),I}function rd(g,m){var y=this,I=y.ready().then(function(){var S=y._dbInfo,C;try{C=localStorage.key(g)}catch{C=null}return C&&(C=C.substring(S.keyPrefix.length)),C});return _(I,m),I}function nd(g){var m=this,y=m.ready().then(function(){for(var I=m._dbInfo,S=localStorage.length,C=[],O=0;O<S;O++){var $=localStorage.key(O);$.indexOf(I.keyPrefix)===0&&C.push($.substring(I.keyPrefix.length))}return C});return _(y,g),y}function id(g){var m=this,y=m.keys().then(function(I){return I.length});return _(y,g),y}function sd(g,m){var y=this;g=A(g);var I=y.ready().then(function(){var S=y._dbInfo;localStorage.removeItem(S.keyPrefix+g)});return _(I,m),I}function od(g,m,y){var I=this;g=A(g);var S=I.ready().then(function(){m===void 0&&(m=null);var C=m;return new w(function(O,$){var W=I._dbInfo;W.serializer.serialize(m,function(V,F){if(F)$(F);else try{localStorage.setItem(W.keyPrefix+g,V),O(C)}catch(J){(J.name==="QuotaExceededError"||J.name==="NS_ERROR_DOM_QUOTA_REACHED")&&$(J),$(J)}})})});return _(S,y),S}function ad(g,m){if(m=B.apply(this,arguments),g=typeof g!="function"&&g||{},!g.name){var y=this.config();g.name=g.name||y.name,g.storeName=g.storeName||y.storeName}var I=this,S;return g.name?S=new w(function(C){g.storeName?C(yc(g,I._defaultConfig)):C(g.name+"/")}).then(function(C){for(var O=localStorage.length-1;O>=0;O--){var $=localStorage.key(O);$.indexOf(C)===0&&localStorage.removeItem($)}}):S=w.reject("Invalid arguments"),_(S,m),S}var cd={_driver:"localStorageWrapper",_initStorage:Qp,_support:Kp(),iterate:ed,getItem:td,setItem:od,removeItem:sd,clear:Zp,length:id,key:rd,keys:nd,dropInstance:ad},ld=function(g,m){return g===m||typeof g=="number"&&typeof m=="number"&&isNaN(g)&&isNaN(m)},ud=function(g,m){for(var y=g.length,I=0;I<y;){if(ld(g[I],m))return!0;I++}return!1},vc=Array.isArray||function(g){return Object.prototype.toString.call(g)==="[object Array]"},yn={},wc={},Mr={INDEXEDDB:u,WEBSQL:Yp,LOCALSTORAGE:cd},hd=[Mr.INDEXEDDB._driver,Mr.WEBSQL._driver,Mr.LOCALSTORAGE._driver],pi=["dropInstance"],As=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(pi),pd={description:"",driver:hd.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function dd(g,m){g[m]=function(){var y=arguments;return g.ready().then(function(){return g[m].apply(g,y)})}}function Ns(){for(var g=1;g<arguments.length;g++){var m=arguments[g];if(m)for(var y in m)m.hasOwnProperty(y)&&(vc(m[y])?arguments[0][y]=m[y].slice():arguments[0][y]=m[y])}return arguments[0]}var fd=function(){function g(m){p(this,g);for(var y in Mr)if(Mr.hasOwnProperty(y)){var I=Mr[y],S=I._driver;this[y]=S,yn[S]||this.defineDriver(I)}this._defaultConfig=Ns({},pd),this._config=Ns({},this._defaultConfig,m),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return g.prototype.config=function(m){if((typeof m>"u"?"undefined":l(m))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var y in m){if(y==="storeName"&&(m[y]=m[y].replace(/\W/g,"_")),y==="version"&&typeof m[y]!="number")return new Error("Database version must be a number.");this._config[y]=m[y]}return"driver"in m&&m.driver?this.setDriver(this._config.driver):!0}else return typeof m=="string"?this._config[m]:this._config},g.prototype.defineDriver=function(m,y,I){var S=new w(function(C,O){try{var $=m._driver,W=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){O(W);return}for(var V=As.concat("_initStorage"),F=0,J=V.length;F<J;F++){var it=V[F],vt=!ud(pi,it);if((vt||m[it])&&typeof m[it]!="function"){O(W);return}}var pt=function(){for(var It=function(md){return function(){var yd=new Error("Method "+md+" is not implemented by the current driver"),bc=w.reject(yd);return _(bc,arguments[arguments.length-1]),bc}},ce=0,Os=pi.length;ce<Os;ce++){var ks=pi[ce];m[ks]||(m[ks]=It(ks))}};pt();var Pt=function(It){yn[$]&&console.info("Redefining LocalForage driver: "+$),yn[$]=m,wc[$]=It,C()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Pt,O):Pt(!!m._support):Pt(!0)}catch(It){O(It)}});return k(S,y,I),S},g.prototype.driver=function(){return this._driver||null},g.prototype.getDriver=function(m,y,I){var S=yn[m]?w.resolve(yn[m]):w.reject(new Error("Driver not found."));return k(S,y,I),S},g.prototype.getSerializer=function(m){var y=w.resolve(Ds);return k(y,m),y},g.prototype.ready=function(m){var y=this,I=y._driverSet.then(function(){return y._ready===null&&(y._ready=y._initDriver()),y._ready});return k(I,m,m),I},g.prototype.setDriver=function(m,y,I){var S=this;vc(m)||(m=[m]);var C=this._getSupportedDrivers(m);function O(){S._config.driver=S.driver()}function $(F){return S._extend(F),O(),S._ready=S._initStorage(S._config),S._ready}function W(F){return function(){var J=0;function it(){for(;J<F.length;){var vt=F[J];return J++,S._dbInfo=null,S._ready=null,S.getDriver(vt).then($).catch(it)}O();var pt=new Error("No available storage method found.");return S._driverSet=w.reject(pt),S._driverSet}return it()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return w.resolve()}):w.resolve();return this._driverSet=V.then(function(){var F=C[0];return S._dbInfo=null,S._ready=null,S.getDriver(F).then(function(J){S._driver=J._driver,O(),S._wrapLibraryMethodsWithReady(),S._initDriver=W(C)})}).catch(function(){O();var F=new Error("No available storage method found.");return S._driverSet=w.reject(F),S._driverSet}),k(this._driverSet,y,I),this._driverSet},g.prototype.supports=function(m){return!!wc[m]},g.prototype._extend=function(m){Ns(this,m)},g.prototype._getSupportedDrivers=function(m){for(var y=[],I=0,S=m.length;I<S;I++){var C=m[I];this.supports(C)&&y.push(C)}return y},g.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,y=As.length;m<y;m++)dd(this,As[m])},g.prototype.createInstance=function(m){return new g(m)},g}(),gd=new fd;o.exports=gd},{3:3}]},{},[4])(4)})}),du=rs(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLBuilder=void 0;var e=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();t.URLBuilder=e}),Rd=rs((t,e)=>{"use strict";(function(r,n){typeof t=="object"&&typeof e<"u"?e.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(t,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var c={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(c,o),function(l,p){var d=o.retries,h=o.retryDelay,b=o.retryOn;if(p&&p.retries!==void 0)if(n(p.retries))d=p.retries;else throw new i("retries must be a positive integer");if(p&&p.retryDelay!==void 0)if(n(p.retryDelay)||typeof p.retryDelay=="function")h=p.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(p&&p.retryOn)if(Array.isArray(p.retryOn)||typeof p.retryOn=="function")b=p.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(v,w){var _=function(A){var B=typeof Request<"u"&&l instanceof Request?l.clone():l;s(B,p).then(function(G){if(Array.isArray(b)&&b.indexOf(G.status)===-1)v(G);else if(typeof b=="function")try{return Promise.resolve(b(A,null,G)).then(function(j){j?k(A,null,G):v(G)}).catch(w)}catch(j){w(j)}else A<d?k(A,null,G):v(G)}).catch(function(G){if(typeof b=="function")try{Promise.resolve(b(A,G,null)).then(function(j){j?k(A,G,null):w(G)}).catch(function(j){w(j)})}catch(j){w(j)}else A<d?k(A,G,null):w(G)})};function k(A,B,G){var j=typeof h=="function"?h(A,B,G):h;setTimeout(function(){_(++A)},j)}_(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),Ld="9.12.9",H=class lo{static SDK_VERSION=Ld;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=lo.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");lo.SDK_VERSION_CODE=parseInt(e,10)}},We={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${H.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${H.SDK_VERSION}/dist/widget.min.js`},he=ke(sn()),T=class{static log(...t){he.default.info(...t)}static debug(...t){he.default.debug(...t)}static error(...t){he.default.error(...t)}static warn(...t){he.default.warn(...t)}static info(...t){he.default.info(...t)}static trace(...t){he.default.trace(...t)}};function Md(t=H.LOG_PREFIX){he.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${H.SDK_VERSION}):`)}});let e=fu();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?he.default.setLevel(he.default[localStorage.cooeeLogLevel]):he.default.setLevel(We.debug?he.default.TRACE:he.default.OFF)}function fu(){return new URL(location.href).searchParams?.get("cooee-debug")}function Ud(){let t=`
|
|
2
2
|
display: inline-block;
|
|
3
3
|
font-size: 14px;
|
|
4
4
|
background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
|
|
@@ -13,29 +13,29 @@
|
|
|
13
13
|
`,e+=`
|
|
14
14
|
|
|
15
15
|
`,e+=`Learn more: https://www.letscooee.com
|
|
16
|
-
Cooee SDK: v${H.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 mu=(()=>{class t{static entityMap={'"':"""};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})(),ne=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}},ge=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}(ge||{}),Ai=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(Ai||{}),yu=function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t}(yu||{}),Nn=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}(Nn||{}),Pe=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}(Pe||{}),vu=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}(vu||{}),lo=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(lo||{}),Re=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}(Re||{}),ea=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(ea||{}),wu=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(wu||{}),bu=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}(bu||{}),Ni=class _u{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,s)=>s.findIndex(o=>o[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,_u.swap(e,r,n)}}},Ud=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},Eu=class{s;g;i;constructor(t){t.s&&(this.s=new re(t.s)),t.g&&(this.g=new Vd(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},Fn="a-f\\d",Bd=`#?[${Fn}]{3}[${Fn}]?`,jd=`#?[${Fn}]{6}([${Fn}]{2})?`,$d=new RegExp(`[^#${Fn}]`,"gi"),Fd=new RegExp(`^${Bd}$|^${jd}$`,"i");function Hd(t,e={}){if(typeof t!="string"||$d.test(t)||!Fd.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,s=n>>8&255,o=n&255,c=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,s,o,c];if(e.format==="css"){let l=c===1?"":` / ${Number((c*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${l})`}return{red:i,green:s,blue:o,alpha:c}}var re=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return Hd(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}},ra=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new re(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return na[this.s??1]}},na=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))(na||{}),Vd=class Su{static DEFAULT_FALLBACK=new re({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new re(e.c)),e.fb&&(this.fb=new re(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??Su.DEFAULT_FALLBACK}},qd=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new re(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},ia=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.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`}},Iu=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}},sa=(t=>(t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY",t))(sa||{}),Wd=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(e=>new Gd(e))}},Gd=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.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')`}},We=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return sa[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new re(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new re(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new Wd(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},zd=class{modifications;constructor(t={}){t.modifications?.length?this.modifications=t.modifications.map(e=>new Cc(e)):t.experiments?.length&&(this.modifications=t.experiments.map(e=>new Cc(e)))}},Cc=class{cssSelector;type;display;bg;typo;br;text;constructor(t={}){this.cssSelector=t.cssSelector??"",this.type=t.type??"OTHER",this.display=t.display,t.bg&&(this.bg=new re(t.bg)),t.typo&&(this.typo=new We(t.typo)),t.br&&(this.br=new ra(t.br)),this.text=t.text}get style(){let t={};return this.display==="HIDE"?t.display="none":this.display==="BLOCK"?t.display="block":this.display==="INLINE"&&(t.display="inline"),this.br?.r&&(t.borderRadius=this.br.r+"px"),this.br?.w&&(t.borderWidth=this.br.w+"px"),this.br?.s&&(t.borderStyle=na[this.br.s]?.toLowerCase()),this.br?.c?.h&&(t.borderColor=this.br.color?.rgba),this.bg?.h&&(t.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(t.fontSize=this.typo.fs+"px"),this.typo.lh&&(t.lineHeight=this.typo.lh),this.typo.fw&&(t.fontWeight=this.typo.fw),this.typo.ta&&(t.textAlign=this.typo.alignment),this.typo.tc.h&&(t.color=this.typo.tc.rgba),this.typo.ls&&(t.letterSpacing=this.typo.letterSpacing),this.typo.td&&(t.textDecoration=this.typo.td??"none")),t}toString(){return`Experiment(cssSelector=${this.cssSelector})`}},on=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price,this.finalPrice=t.finalPrice??t.price}},Yd=class{minValue;rewardType;label;reachingText;reachedText;discount;items;reached;calculatedAlignment;constructor(t){this.reached=t.reached??!1,this.calculatedAlignment=t.calculatedAlignment,this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(e=>new on(e))}},Kd=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(t){this.layout=t.layout??wu.ICONS,this.onlyLatestGift=t.onlyLatestGift,this.noConfetti=t.noConfetti,this.removeIneligibleItem=t.removeIneligibleItem??!0,this.restrictToLatestFreebie=t.restrictToLatestFreebie,this.rewardBasis=t.rewardBasis??"CART_AMOUNT",this.update(t)}update(t){t=t??{},this.milestones=t.milestones?.map(e=>new Yd(e))??[],this.totalProgress=t.totalProgress??0,this.coupons=t.coupons,this.reachedAmountOrCount=t.reachedAmountOrCount}},Jn=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(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}static parseToAny(t){try{return JSON.parse(t.toString())}catch{}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise(e=>setTimeout(e,t))}static hasKeys(t){return t?Object.keys(t).length>=1:!1}static convertObjectToArray(t,e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&t[n]!=null&&r.push({[n]:t[n]}),r),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce((e,r)=>(t[r]!==null&&t[r]!==void 0&&(e[r]=t[r]),e),{})}static stringify(t){return JSON.stringify(t,function(e,r){return r===void 0?null:r})}},Cu=Object.prototype.toString;function oa(t){switch(Cu.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Sr(t,Error)}}function an(t,e){return Cu.call(t)===`[object ${e}]`}function Tu(t){return an(t,"ErrorEvent")}function Tc(t){return an(t,"DOMError")}function Jd(t){return an(t,"DOMException")}function Fe(t){return an(t,"String")}function aa(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function ca(t){return t===null||aa(t)||typeof t!="object"&&typeof t!="function"}function Kr(t){return an(t,"Object")}function ns(t){return typeof Event<"u"&&Sr(t,Event)}function Xd(t){return typeof Element<"u"&&Sr(t,Element)}function Qd(t){return an(t,"RegExp")}function is(t){return!!(t&&t.then&&typeof t.then=="function")}function Zd(t){return Kr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Sr(t,e){try{return t instanceof e}catch{return!1}}function xu(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function qr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function xc(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{xu(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function tf(t,e,r=!1){return Fe(t)?Qd(e)?e.test(t):Fe(e)?r?t===e:t.includes(e):!1:!1}function ss(t,e=[],r=!1){return e.some(n=>tf(t,n,r))}function ef(t,e,r=250,n,i,s,o){if(!s.exception||!s.exception.values||!o||!Sr(o.originalException,Error))return;let c=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;c&&(s.exception.values=rf(uo(t,e,i,o.originalException,n,s.exception.values,c,0),r))}function uo(t,e,r,n,i,s,o,c){if(s.length>=r+1)return s;let l=[...s];if(Sr(n[i],Error)){Dc(o,c);let p=t(e,n[i]),d=l.length;Ac(p,i,d,c),l=uo(t,e,r,n[i],i,[p,...l],p,d)}return Array.isArray(n.errors)&&n.errors.forEach((p,d)=>{if(Sr(p,Error)){Dc(o,c);let h=t(e,p),b=l.length;Ac(h,`errors[${d}]`,b,c),l=uo(t,e,r,p,i,[h,...l],h,b)}}),l}function Dc(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=yt(x(x({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Ac(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=yt(x({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function rf(t,e){return t.map(r=>(r.value&&(r.value=qr(r.value,e)),r))}var wr="8.18.0",ht=globalThis;function la(t,e,r){let n=r||ht,i=n.__SENTRY__=n.__SENTRY__||{},s=i[wr]=i[wr]||{};return s[t]||(s[t]=e())}var ua=ht,nf=80;function Du(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],s=0,o=0,c=" > ",l=c.length,p,d=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||nf;for(;r&&s++<n&&(p=sf(r,d),!(p==="html"||s>1&&o+i.length*l+p.length>=h));)i.push(p),o+=p.length,r=r.parentNode;return i.reverse().join(c)}catch{return"<unknown>"}}function sf(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(ua.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&&e.length?e.filter(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i&&i.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&Fe(o)){let c=o.split(/\s+/);for(let l of c)n.push(`.${l}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let c=r.getAttribute(o);c&&n.push(`[${o}="${c}"]`)}return n.join("")}function of(){try{return ua.document.location.href}catch{return""}}function af(t){if(!ua.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}var Xn=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,cf="Sentry Logger ",ho=["debug","info","warn","error","log","assert","trace"],Bi={};function ha(t){if(!("console"in ht))return t();let e=ht.console,r={},n=Object.keys(Bi);n.forEach(i=>{let s=Bi[i];r[i]=e[i],e[i]=s});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function lf(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Xn?ho.forEach(r=>{e[r]=(...n)=>{t&&ha(()=>{ht.console[r](`${cf}[${r}]:`,...n)})}}):ho.forEach(r=>{e[r]=()=>{}}),e}var nt=lf(),uf=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function hf(t){return t==="http"||t==="https"}function os(t,e=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:c,publicKey:l}=t;return`${c}://${l}${e&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function pf(t){let e=uf.exec(t);if(!e){ha(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",s="",o="",c=""]=e.slice(1),l="",p=c,d=p.split("/");if(d.length>1&&(l=d.slice(0,-1).join("/"),p=d.pop()),p){let h=p.match(/^\d+/);h&&(p=h[0])}return Au({host:s,pass:i,path:l,projectId:p,port:o,protocol:r,publicKey:n})}function Au(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function df(t){if(!Xn)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(nt.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?hf(n)?e&&isNaN(parseInt(e,10))?(nt.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(nt.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(nt.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function ff(t){let e=typeof t=="string"?pf(t):Au(t);if(!(!e||!df(e)))return e}var xe=class extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}};function Ht(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&Nu(i,n),t[e]=i}function Ir(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{Xn&&nt.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Nu(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,Ir(t,"__sentry_original__",e)}catch{}}function pa(t){return t.__sentry_original__}function gf(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function Ou(t){if(oa(t))return x({message:t.message,name:t.name,stack:t.stack},Oc(t));if(ns(t)){let e=x({type:t.type,target:Nc(t.target),currentTarget:Nc(t.currentTarget)},Oc(t));return typeof CustomEvent<"u"&&Sr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Nc(t){try{return Xd(t)?Du(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Oc(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 mf(t,e=40){let r=Object.keys(Ou(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 s=r.slice(0,i).join(", ");if(!(s.length>e))return i===r.length?s:qr(s,e)}return""}function ve(t){return po(t,new Map)}function po(t,e){if(yf(t)){let r=e.get(t);if(r!==void 0)return r;let n={};e.set(t,n);for(let i of Object.keys(t))typeof t[i]<"u"&&(n[i]=po(t[i],e));return n}if(Array.isArray(t)){let r=e.get(t);if(r!==void 0)return r;let n=[];return e.set(t,n),t.forEach(i=>{n.push(po(i,e))}),n}return t}function yf(t){if(!Kr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var Cr="?",kc=/\(error: (.*)\)/,Pc=/captureMessage|captureException/;function vf(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
17
|
-
`);for(let c=n;c<o.length;c++){let l=o[c];if(l.length>1024)continue;let p=
|
|
16
|
+
Cooee SDK: v${H.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 gu=(()=>{class t{static entityMap={'"':"""};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})(),ne=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}},ge=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}(ge||{}),Ai=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(Ai||{}),mu=function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t}(mu||{}),Nn=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}(Nn||{}),Pe=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}(Pe||{}),yu=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}(yu||{}),uo=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(uo||{}),Re=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}(Re||{}),ea=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(ea||{}),vu=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(vu||{}),wu=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}(wu||{}),Ni=class bu{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,s)=>s.findIndex(o=>o[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,bu.swap(e,r,n)}}},Bd=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},_u=class{s;g;i;constructor(t){t.s&&(this.s=new re(t.s)),t.g&&(this.g=new qd(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},Fn="a-f\\d",jd=`#?[${Fn}]{3}[${Fn}]?`,$d=`#?[${Fn}]{6}([${Fn}]{2})?`,Fd=new RegExp(`[^#${Fn}]`,"gi"),Hd=new RegExp(`^${jd}$|^${$d}$`,"i");function Vd(t,e={}){if(typeof t!="string"||Fd.test(t)||!Hd.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,s=n>>8&255,o=n&255,c=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,s,o,c];if(e.format==="css"){let l=c===1?"":` / ${Number((c*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${l})`}return{red:i,green:s,blue:o,alpha:c}}var re=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return Vd(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}},ra=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new re(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return na[this.s??1]}},na=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))(na||{}),qd=class Eu{static DEFAULT_FALLBACK=new re({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new re(e.c)),e.fb&&(this.fb=new re(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??Eu.DEFAULT_FALLBACK}},Wd=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new re(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},ia=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.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`}},Su=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}},sa=(t=>(t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY",t))(sa||{}),Gd=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(e=>new zd(e))}},zd=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.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')`}},Ge=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return sa[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new re(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new re(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new Gd(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},Yd=class{modifications;constructor(t={}){t.modifications?.length?this.modifications=t.modifications.map(e=>new Ic(e)):t.experiments?.length&&(this.modifications=t.experiments.map(e=>new Ic(e)))}},Ic=class{cssSelector;type;display;bg;typo;br;text;constructor(t={}){this.cssSelector=t.cssSelector??"",this.type=t.type??"OTHER",this.display=t.display,t.bg&&(this.bg=new re(t.bg)),t.typo&&(this.typo=new Ge(t.typo)),t.br&&(this.br=new ra(t.br)),this.text=t.text}get style(){let t={};return this.display==="HIDE"?t.display="none":this.display==="BLOCK"?t.display="block":this.display==="INLINE"&&(t.display="inline"),this.br?.r&&(t.borderRadius=this.br.r+"px"),this.br?.w&&(t.borderWidth=this.br.w+"px"),this.br?.s&&(t.borderStyle=na[this.br.s]?.toLowerCase()),this.br?.c?.h&&(t.borderColor=this.br.color?.rgba),this.bg?.h&&(t.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(t.fontSize=this.typo.fs+"px"),this.typo.lh&&(t.lineHeight=this.typo.lh),this.typo.fw&&(t.fontWeight=this.typo.fw),this.typo.ta&&(t.textAlign=this.typo.alignment),this.typo.tc.h&&(t.color=this.typo.tc.rgba),this.typo.ls&&(t.letterSpacing=this.typo.letterSpacing),this.typo.td&&(t.textDecoration=this.typo.td??"none")),t}toString(){return`Experiment(cssSelector=${this.cssSelector})`}},on=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price,this.finalPrice=t.finalPrice??t.price}},Kd=class{minValue;rewardType;label;reachingText;reachedText;discount;items;reached;calculatedAlignment;constructor(t){this.reached=t.reached??!1,this.calculatedAlignment=t.calculatedAlignment,this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(e=>new on(e))}},Jd=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(t){this.layout=t.layout??vu.ICONS,this.onlyLatestGift=t.onlyLatestGift,this.noConfetti=t.noConfetti,this.removeIneligibleItem=t.removeIneligibleItem??!0,this.restrictToLatestFreebie=t.restrictToLatestFreebie,this.rewardBasis=t.rewardBasis??"CART_AMOUNT",this.update(t)}update(t){t=t??{},this.milestones=t.milestones?.map(e=>new Kd(e))??[],this.totalProgress=t.totalProgress??0,this.coupons=t.coupons,this.reachedAmountOrCount=t.reachedAmountOrCount}},Jn=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(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}static parseToAny(t){try{return JSON.parse(t.toString())}catch{}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise(e=>setTimeout(e,t))}static hasKeys(t){return t?Object.keys(t).length>=1:!1}static convertObjectToArray(t,e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&t[n]!=null&&r.push({[n]:t[n]}),r),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce((e,r)=>(t[r]!==null&&t[r]!==void 0&&(e[r]=t[r]),e),{})}static stringify(t){return JSON.stringify(t,function(e,r){return r===void 0?null:r})}},Iu=Object.prototype.toString;function oa(t){switch(Iu.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Sr(t,Error)}}function an(t,e){return Iu.call(t)===`[object ${e}]`}function Cu(t){return an(t,"ErrorEvent")}function Cc(t){return an(t,"DOMError")}function Xd(t){return an(t,"DOMException")}function He(t){return an(t,"String")}function aa(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function ca(t){return t===null||aa(t)||typeof t!="object"&&typeof t!="function"}function Kr(t){return an(t,"Object")}function ns(t){return typeof Event<"u"&&Sr(t,Event)}function Qd(t){return typeof Element<"u"&&Sr(t,Element)}function Zd(t){return an(t,"RegExp")}function is(t){return!!(t&&t.then&&typeof t.then=="function")}function tf(t){return Kr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Sr(t,e){try{return t instanceof e}catch{return!1}}function Tu(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function qr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Tc(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{Tu(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function ef(t,e,r=!1){return He(t)?Zd(e)?e.test(t):He(e)?r?t===e:t.includes(e):!1:!1}function ss(t,e=[],r=!1){return e.some(n=>ef(t,n,r))}function rf(t,e,r=250,n,i,s,o){if(!s.exception||!s.exception.values||!o||!Sr(o.originalException,Error))return;let c=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;c&&(s.exception.values=nf(ho(t,e,i,o.originalException,n,s.exception.values,c,0),r))}function ho(t,e,r,n,i,s,o,c){if(s.length>=r+1)return s;let l=[...s];if(Sr(n[i],Error)){xc(o,c);let p=t(e,n[i]),d=l.length;Dc(p,i,d,c),l=ho(t,e,r,n[i],i,[p,...l],p,d)}return Array.isArray(n.errors)&&n.errors.forEach((p,d)=>{if(Sr(p,Error)){xc(o,c);let h=t(e,p),b=l.length;Dc(h,`errors[${d}]`,b,c),l=ho(t,e,r,p,i,[h,...l],h,b)}}),l}function xc(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=yt(x(x({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Dc(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=yt(x({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function nf(t,e){return t.map(r=>(r.value&&(r.value=qr(r.value,e)),r))}var wr="8.18.0",ht=globalThis;function la(t,e,r){let n=r||ht,i=n.__SENTRY__=n.__SENTRY__||{},s=i[wr]=i[wr]||{};return s[t]||(s[t]=e())}var ua=ht,sf=80;function xu(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],s=0,o=0,c=" > ",l=c.length,p,d=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||sf;for(;r&&s++<n&&(p=of(r,d),!(p==="html"||s>1&&o+i.length*l+p.length>=h));)i.push(p),o+=p.length,r=r.parentNode;return i.reverse().join(c)}catch{return"<unknown>"}}function of(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(ua.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&&e.length?e.filter(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i&&i.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&He(o)){let c=o.split(/\s+/);for(let l of c)n.push(`.${l}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let c=r.getAttribute(o);c&&n.push(`[${o}="${c}"]`)}return n.join("")}function af(){try{return ua.document.location.href}catch{return""}}function cf(t){if(!ua.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}var Xn=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,lf="Sentry Logger ",po=["debug","info","warn","error","log","assert","trace"],Bi={};function ha(t){if(!("console"in ht))return t();let e=ht.console,r={},n=Object.keys(Bi);n.forEach(i=>{let s=Bi[i];r[i]=e[i],e[i]=s});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function uf(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Xn?po.forEach(r=>{e[r]=(...n)=>{t&&ha(()=>{ht.console[r](`${lf}[${r}]:`,...n)})}}):po.forEach(r=>{e[r]=()=>{}}),e}var nt=uf(),hf=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function pf(t){return t==="http"||t==="https"}function os(t,e=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:c,publicKey:l}=t;return`${c}://${l}${e&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function df(t){let e=hf.exec(t);if(!e){ha(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",s="",o="",c=""]=e.slice(1),l="",p=c,d=p.split("/");if(d.length>1&&(l=d.slice(0,-1).join("/"),p=d.pop()),p){let h=p.match(/^\d+/);h&&(p=h[0])}return Du({host:s,pass:i,path:l,projectId:p,port:o,protocol:r,publicKey:n})}function Du(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function ff(t){if(!Xn)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(nt.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?pf(n)?e&&isNaN(parseInt(e,10))?(nt.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(nt.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(nt.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function gf(t){let e=typeof t=="string"?df(t):Du(t);if(!(!e||!ff(e)))return e}var xe=class extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}};function Ht(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&Au(i,n),t[e]=i}function Ir(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{Xn&&nt.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Au(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,Ir(t,"__sentry_original__",e)}catch{}}function pa(t){return t.__sentry_original__}function mf(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function Nu(t){if(oa(t))return x({message:t.message,name:t.name,stack:t.stack},Nc(t));if(ns(t)){let e=x({type:t.type,target:Ac(t.target),currentTarget:Ac(t.currentTarget)},Nc(t));return typeof CustomEvent<"u"&&Sr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Ac(t){try{return Qd(t)?xu(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Nc(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 yf(t,e=40){let r=Object.keys(Nu(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 s=r.slice(0,i).join(", ");if(!(s.length>e))return i===r.length?s:qr(s,e)}return""}function ve(t){return fo(t,new Map)}function fo(t,e){if(vf(t)){let r=e.get(t);if(r!==void 0)return r;let n={};e.set(t,n);for(let i of Object.keys(t))typeof t[i]<"u"&&(n[i]=fo(t[i],e));return n}if(Array.isArray(t)){let r=e.get(t);if(r!==void 0)return r;let n=[];return e.set(t,n),t.forEach(i=>{n.push(fo(i,e))}),n}return t}function vf(t){if(!Kr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var Cr="?",Oc=/\(error: (.*)\)/,kc=/captureMessage|captureException/;function wf(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
17
|
+
`);for(let c=n;c<o.length;c++){let l=o[c];if(l.length>1024)continue;let p=Oc.test(l)?l.replace(Oc,"$1"):l;if(!p.match(/\S*Error: /)){for(let d of e){let h=d(p);if(h){s.push(h);break}}if(s.length>=50+i)break}}return bf(s.slice(i))}}function bf(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(fi(e).function||"")&&e.pop(),e.reverse(),kc.test(fi(e).function||"")&&(e.pop(),kc.test(fi(e).function||"")&&e.pop()),e.slice(0,50).map(r=>yt(x({},r),{filename:r.filename||fi(e).filename,function:r.function||Cr}))}function fi(t){return t[t.length-1]||{}}var Ps="<anonymous>";function ar(t){try{return!t||typeof t!="function"?Ps:t.name||Ps}catch{return Ps}}function Pc(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 Oi={},Rc={};function Or(t,e){Oi[t]=Oi[t]||[],Oi[t].push(e)}function kr(t,e){Rc[t]||(e(),Rc[t]=!0)}function be(t,e){let r=t&&Oi[t];if(r)for(let n of r)try{n(e)}catch(i){Xn&&nt.error(`Error while triggering instrumentation handler.
|
|
18
18
|
Type: ${t}
|
|
19
19
|
Name: ${ar(n)}
|
|
20
|
-
Error:`,i)}}function
|
|
20
|
+
Error:`,i)}}function _f(t){let e="console";Or(e,t),kr(e,Ef)}function Ef(){"console"in ht&&po.forEach(function(t){t in ht.console&&Ht(ht.console,t,function(e){return Bi[t]=e,function(...r){be("console",{args:r,level:t});let n=Bi[t];n&&n.apply(ht.console,r)}})})}var go=ht;function Sf(){if(!("fetch"in go))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function mo(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function If(){if(typeof EdgeRuntime=="string")return!0;if(!Sf())return!1;if(mo(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&&r.contentWindow.fetch&&(t=mo(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){Xn&&nt.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}var Ou=1e3;function Qn(){return Date.now()/Ou}function Cf(){let{performance:t}=ht;if(!t||!t.now)return Qn;let e=Date.now()-t.now(),r=t.timeOrigin==null?e:t.timeOrigin;return()=>(r+t.now())/Ou}var sr=Cf(),gi,mE=(()=>{let{performance:t}=ht;if(!t||!t.now){gi="none";return}let e=3600*1e3,r=t.now(),n=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+r-n):e,s=i<e,o=t.timing&&t.timing.navigationStart,c=typeof o=="number"?Math.abs(o+r-n):e,l=c<e;return s||l?i<=c?(gi="timeOrigin",t.timeOrigin):(gi="navigationStart",o):(gi="dateNow",n)})();function Tf(t){let e="fetch";Or(e,t),kr(e,xf)}function xf(){If()&&Ht(ht,"fetch",function(t){return function(...e){let{method:r,url:n}=Df(e),i={args:e,fetchData:{method:r,url:n},startTimestamp:sr()*1e3};be("fetch",x({},i));let s=new Error().stack;return t.apply(ht,e).then(o=>{let c=yt(x({},i),{endTimestamp:sr()*1e3,response:o});return be("fetch",c),o},o=>{let c=yt(x({},i),{endTimestamp:sr()*1e3,error:o});throw be("fetch",c),oa(o)&&o.stack===void 0&&(o.stack=s,Ir(o,"framesToPop",1)),o})}})}function yo(t,e){return!!t&&typeof t=="object"&&!!t[e]}function Lc(t){return typeof t=="string"?t:t?yo(t,"url")?t.url:t.toString?t.toString():"":""}function Df(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:Lc(r),method:yo(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:Lc(e),method:yo(e,"method")?String(e.method).toUpperCase():"GET"}}var mi=null;function Af(t){let e="error";Or(e,t),kr(e,Nf)}function Nf(){mi=ht.onerror,ht.onerror=function(t,e,r,n,i){return be("error",{column:n,error:i,line:r,msg:t,url:e}),mi&&!mi.__SENTRY_LOADER__?mi.apply(this,arguments):!1},ht.onerror.__SENTRY_INSTRUMENTED__=!0}var yi=null;function Of(t){let e="unhandledrejection";Or(e,t),kr(e,kf)}function kf(){yi=ht.onunhandledrejection,ht.onunhandledrejection=function(t){return be("unhandledrejection",t),yi&&!yi.__SENTRY_LOADER__?yi.apply(this,arguments):!0},ht.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Pf(){return"npm"}function Rf(){let t=typeof WeakSet=="function",e=t?new WeakSet:[];function r(i){if(t)return e.has(i)?!0:(e.add(i),!1);for(let s=0;s<e.length;s++)if(e[s]===i)return!0;return e.push(i),!1}function n(i){if(t)e.delete(i);else for(let s=0;s<e.length;s++)if(e[s]===i){e.splice(s,1);break}}return[r,n]}function _e(){let t=ht,e=t.crypto||t.msCrypto,r=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(r=()=>{let n=new Uint8Array(1);return e.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(r()&15)>>n/4).toString(16))}function ku(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Ze(t){let{message:e,event_id:r}=t;if(e)return e;let n=ku(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function vo(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type=r||"Error")}function Hn(t,e){let r=ku(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=x(x(x({},n),i),e),e&&"data"in e){let s=x(x({},i&&i.data),e.data);r.mechanism.data=s}}function Mc(t){if(t&&t.__sentry_captured__)return!0;try{Ir(t,"__sentry_captured__",!0)}catch{}return!1}function Lf(t){return Array.isArray(t)?t:[t]}function tr(t,e=100,r=1/0){try{return wo("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function Pu(t,e=3,r=100*1024){let n=tr(t,e);return jf(n)>r?Pu(t,e-1,r):n}function wo(t,e,r=1/0,n=1/0,i=Rf()){let[s,o]=i;if(e==null||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;let c=Mf(t,e);if(!c.startsWith("[object "))return c;if(e.__sentry_skip_normalization__)return e;let l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(l===0)return c.replace("object ","");if(s(e))return"[Circular ~]";let p=e;if(p&&typeof p.toJSON=="function")try{let v=p.toJSON();return wo("",v,l-1,n,i)}catch{}let d=Array.isArray(e)?[]:{},h=0,b=Nu(e);for(let v in b){if(!Object.prototype.hasOwnProperty.call(b,v))continue;if(h>=n){d[v]="[MaxProperties ~]";break}let w=b[v];d[v]=wo(v,w,l-1,n,i),h++}return o(e),d}function Mf(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(Tu(e))return"[VueViewModel]";if(tf(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${ar(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=Uf(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Uf(t){let e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function Bf(t){return~-encodeURI(t).split(/%..|./).length}function jf(t){return Bf(JSON.stringify(t))}var Ue;(function(t){t[t.PENDING=0]="PENDING";let e=1;t[t.RESOLVED=e]="RESOLVED";let r=2;t[t.REJECTED=r]="REJECTED"})(Ue||(Ue={}));function Tr(t){return new Zn(e=>{e(t)})}function ji(t){return new Zn((e,r)=>{r(t)})}var Zn=class gr{constructor(e){gr.prototype.__init.call(this),gr.prototype.__init2.call(this),gr.prototype.__init3.call(this),gr.prototype.__init4.call(this),this._state=Ue.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(r){this._reject(r)}}then(e,r){return new gr((n,i)=>{this._handlers.push([!1,s=>{if(!e)n(s);else try{n(e(s))}catch(o){i(o)}},s=>{if(!r)i(s);else try{n(r(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new gr((r,n)=>{let i,s;return this.then(o=>{s=!1,i=o,e&&e()},o=>{s=!0,i=o,e&&e()}).then(()=>{if(s){n(i);return}r(i)})})}__init(){this._resolve=e=>{this._setResult(Ue.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Ue.REJECTED,e)}}__init3(){this._setResult=(e,r)=>{if(this._state===Ue.PENDING){if(is(r)){r.then(this._resolve,this._reject);return}this._state=e,this._value=r,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Ue.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Ue.RESOLVED&&r[1](this._value),this._state===Ue.REJECTED&&r[2](this._value),r[0]=!0)})}}};function $f(t){let e=[];function r(){return t===void 0||e.length<t}function n(o){return e.splice(e.indexOf(o),1)[0]||Promise.resolve(void 0)}function i(o){if(!r())return ji(new xe("Not adding Promise because buffer limit was reached."));let c=o();return e.indexOf(c)===-1&&e.push(c),c.then(()=>n(c)).then(null,()=>n(c).then(null,()=>{})),c}function s(o){return new Zn((c,l)=>{let p=e.length;if(!p)return c(!0);let d=setTimeout(()=>{o&&o>0&&c(!1)},o);e.forEach(h=>{Tr(h).then(()=>{--p||(clearTimeout(d),c(!0))},l)})})}return{$:e,add:i,drain:s}}function Rs(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}}var Ff=["fatal","error","warning","log","info","debug"];function Hf(t){return t==="warn"?"warning":Ff.includes(t)?t:"log"}var Vf="sentry-",qf=/^sentry-/;function Wf(t){let e=Gf(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,s])=>{if(i.match(qf)){let o=i.slice(Vf.length);n[o]=s}return n},{});if(Object.keys(r).length>0)return r}function Gf(t){if(!(!t||!He(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=Uc(r);return Object.entries(n).forEach(([i,s])=>{e[i]=s}),e},{}):Uc(t)}function Uc(t){return t.split(",").map(e=>e.split("=").map(r=>decodeURIComponent(r.trim()))).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function ti(t,e=[]){return[t,e]}function zf(t,e){let[r,n]=t;return[r,[...n,e]]}function Bc(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 bo(t){return ht.__SENTRY__&&ht.__SENTRY__.encodePolyfill?ht.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function Yf(t){let[e,r]=t,n=JSON.stringify(e);function i(s){typeof n=="string"?n=typeof s=="string"?n+s:[bo(n),s]:n.push(typeof s=="string"?bo(s):s)}for(let s of r){let[o,c]=s;if(i(`
|
|
21
21
|
${JSON.stringify(o)}
|
|
22
|
-
`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let l;try{l=JSON.stringify(c)}catch{l=JSON.stringify(Ze(c))}i(l)}}return typeof n=="string"?n:Yf(n)}function Yf(t){let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function Kf(t){let e=typeof t.data=="string"?wo(t.data):t.data;return[ve({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var Jf={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",statsd:"metric_bucket"};function $c(t){return Jf[t]}function Lu(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function Xf(t,e,r,n){let i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return x(x(x({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:os(n)}),i&&{trace:ve(x({},i))})}function Qf(t,e,r){let n=[{type:"client_report"},{timestamp:r||Qn(),discarded_events:t}];return ti(e?{dsn:e}:{},[n])}function Zf(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 tg(t,e){return t[e]||t.all||0}function eg(t,e,r=Date.now()){return tg(t,e)>r}function rg(t,{statusCode:e,headers:r},n=Date.now()){let i=x({},t),s=r&&r["x-sentry-rate-limits"],o=r&&r["retry-after"];if(s)for(let c of s.trim().split(",")){let[l,p,,,d]=c.split(":",5),h=parseInt(l,10),b=(isNaN(h)?60:h)*1e3;if(!p)i.all=n+b;else for(let v of p.split(";"))v==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(i[v]=n+b):i[v]=n+b}else o?i.all=n+Zf(o,n):e===429&&(i.all=n+60*1e3);return i}function Fc(){return{traceId:_e(),spanId:_e().substring(16)}}var vi=ht;function ng(){let t=vi.chrome,e=t&&t.app&&t.app.runtime,r="history"in vi&&!!vi.history.pushState&&!!vi.history.replaceState;return!e&&r}var Ct=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function as(){return da(ht),ht}function da(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||wr,e[wr]=e[wr]||{}}function bo(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||sr(),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:_e()),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)}var _o="_sentrySpan";function Hc(t,e){e?Ir(t,_o,e):delete t[_o]}function Vc(t){return t[_o]}var ig=100,sg=class Mu{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Fc()}clone(){let e=new Mu;return e._breadcrumbs=[...this._breadcrumbs],e._tags=x({},this._tags),e._extra=x({},this._extra),e._contexts=x({},this._contexts),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._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=x({},this._sdkProcessingMetadata),e._propagationContext=x({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,Hc(e,Vc(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&&bo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=x(x({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=yt(x({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=x(x({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=yt(x({},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,i]=r instanceof Ge?[r.getScopeData(),r.getRequestSession()]:Kr(r)?[e,e.requestSession]:[],{tags:s,extra:o,user:c,contexts:l,level:p,fingerprint:d=[],propagationContext:h}=n||{};return this._tags=x(x({},this._tags),s),this._extra=x(x({},this._extra),o),this._contexts=x(x({},this._contexts),l),c&&Object.keys(c).length&&(this._user=c),p&&(this._level=p),d.length&&(this._fingerprint=d),h&&(this._propagationContext=h),i&&(this._requestSession=i),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._requestSession=void 0,this._session=void 0,Hc(this,void 0),this._attachments=[],this._propagationContext=Fc(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:ig;if(n<=0)return this;let i=x({timestamp:Qn()},e),s=this._breadcrumbs;return s.push(i),this._breadcrumbs=s.length>n?s.slice(-n):s,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:Vc(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=x(x({},this._sdkProcessingMetadata),e),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r&&r.event_id?r.event_id:_e();if(!this._client)return nt.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,yt(x({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n&&n.event_id?n.event_id:_e();if(!this._client)return nt.warn("No client configured on scope - will not capture message!"),i;let s=new Error(e);return this._client.captureMessage(e,r,yt(x({originalException:e,syntheticException:s},n),{event_id:i}),this),i}captureEvent(e,r){let n=r&&r.event_id?r.event_id:_e();return this._client?(this._client.captureEvent(e,yt(x({},r),{event_id:n}),this),n):(nt.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)}},Ge=sg;function og(){return la("defaultCurrentScope",()=>new Ge)}function ag(){return la("defaultIsolationScope",()=>new Ge)}var cg=class{constructor(t,e){let r;t?r=t:r=new Ge;let n;e?n=e:n=new Ge,this._stack=[{scope:r}],this._isolationScope=n}withScope(t){let e=this._pushScope(),r;try{r=t(e)}catch(n){throw this._popScope(),n}return is(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Jr(){let t=as(),e=da(t);return e.stack=e.stack||new cg(og(),ag())}function lg(t){return Jr().withScope(t)}function ug(t,e){let r=Jr();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function qc(t){return Jr().withScope(()=>t(Jr().getIsolationScope()))}function hg(){return{withIsolationScope:qc,withScope:lg,withSetScope:ug,withSetIsolationScope:(t,e)=>qc(e),getCurrentScope:()=>Jr().getScope(),getIsolationScope:()=>Jr().getIsolationScope()}}function fa(t){let e=da(t);return e.acs?e.acs:hg()}function ga(){let t=as();return fa(t).getCurrentScope()}function Uu(){let t=as();return fa(t).getIsolationScope()}function pg(){return la("globalScope",()=>new Ge)}function dg(...t){let e=as(),r=fa(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function ie(){return ga().getClient()}var fg="_sentryMetrics";function gg(t){let e=t[fg];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(ve(i));return r}var mg="sentry.source",yg="sentry.sample_rate",vg="sentry.op",wg="sentry.origin",bg=1;function _g(t){let{spanId:e,traceId:r}=t.spanContext(),{parent_span_id:n}=$i(t);return ve({parent_span_id:n,span_id:e,trace_id:r})}function Wc(t){return typeof t=="number"?Gc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Gc(t.getTime()):sr()}function Gc(t){return t>9999999999?t/1e3:t}function $i(t){if(Sg(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if(Eg(t)){let{attributes:n,startTime:i,name:s,endTime:o,parentSpanId:c,status:l}=t;return ve({span_id:e,trace_id:r,data:n,description:s,parent_span_id:c,start_timestamp:Wc(i),timestamp:Wc(o)||void 0,status:Cg(l),op:n[vg],origin:n[wg],_metrics_summary:gg(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function Eg(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Sg(t){return typeof t.getSpanJSON=="function"}function Ig(t){let{traceFlags:e}=t.spanContext();return e===bg}function Cg(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var Tg="_sentryRootSpan";function Bu(t){return t[Tg]||t}var ju="production",xg="_frozenDsc";function $u(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=ve({environment:r.environment||ju,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function Dg(t){let e=ie();if(!e)return{};let r=$u($i(t).trace_id||"",e),n=Bu(t),i=n[xg];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),c=o&&qf(o);if(c)return c;let l=$i(n),p=l.data||{},d=p[yg];d!=null&&(r.sample_rate=`${d}`);let h=p[mg],b=l.description;return h!=="url"&&b&&(r.transaction=b),r.sampled=String(Ig(n)),e.emit("createDsc",r,n),r}function Ag(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){Ct&&nt.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function Ng(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 Og(t,e,r,n){let i=Lu(r),s=x(x({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:os(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return ti(s,[o])}function kg(t,e,r,n){let i=Lu(r),s=t.type&&t.type!=="replay_event"?t.type:"event";Ng(t,r&&r.sdk);let o=Xf(t,i,n,e);return delete t.sdkProcessingMetadata,ti(o,[[{type:s},t]])}function Eo(t,e,r,n=0){return new Zn((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let c=o(x({},e),r);Ct&&o.id&&c===null&&nt.log(`Event processor "${o.id}" dropped event`),is(c)?c.then(l=>Eo(t,l,r,n+1).then(i)).then(null,s):Eo(t,c,r,n+1).then(i).then(null,s)}})}function Pg(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;Rg(t,e),n&&Ug(t,n),Bg(t,r),Lg(t,i),Mg(t,s)}function zc(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:d,attachments:h,propagationContext:b,transactionName:v,span:w}=e;vn(t,"extra",r),vn(t,"tags",n),vn(t,"user",i),vn(t,"contexts",s),vn(t,"sdkProcessingMetadata",c),o&&(t.level=o),v&&(t.transactionName=v),w&&(t.span=w),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext=x(x({},t.propagationContext),b)}function vn(t,e,r){if(r&&Object.keys(r).length){t[e]=x({},t[e]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[e][n]=r[n])}}function Rg(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:c}=e,l=ve(r);l&&Object.keys(l).length&&(t.extra=x(x({},l),t.extra));let p=ve(n);p&&Object.keys(p).length&&(t.tags=x(x({},p),t.tags));let d=ve(i);d&&Object.keys(d).length&&(t.user=x(x({},d),t.user));let h=ve(s);h&&Object.keys(h).length&&(t.contexts=x(x({},h),t.contexts)),o&&(t.level=o),c&&t.type!=="transaction"&&(t.transaction=c)}function Lg(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Mg(t,e){t.sdkProcessingMetadata=x(x({},t.sdkProcessingMetadata),e)}function Ug(t,e){t.contexts=x({trace:_g(e)},t.contexts),t.sdkProcessingMetadata=x({dynamicSamplingContext:Dg(e)},t.sdkProcessingMetadata);let r=Bu(e),n=$i(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function Bg(t,e){t.fingerprint=t.fingerprint?Rf(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function jg(t,e,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:c=1e3}=t,l=yt(x({},e),{event_id:e.event_id||r.event_id||_e(),timestamp:e.timestamp||Qn()}),p=r.integrations||t.integrations.map(_=>_.name);$g(l,t),Vg(l,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Fg(l,t.stackParser);let d=Wg(n,r.captureContext);r.mechanism&&Hn(l,r.mechanism);let h=i?i.getEventProcessors():[],b=pg().getScopeData();if(s){let _=s.getScopeData();zc(b,_)}if(d){let _=d.getScopeData();zc(b,_)}let v=[...r.attachments||[],...b.attachments];v.length&&(r.attachments=v),Pg(l,b);let w=[...h,...b.eventProcessors];return Eo(w,l,r).then(_=>(_&&Hg(_),typeof o=="number"&&o>0?qg(_,o,c):_))}function $g(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?r:ju),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=qr(t.message,s));let o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=qr(o.value,s));let c=t.request;c&&c.url&&(c.url=qr(c.url,s))}var Yc=new WeakMap;function Fg(t,e){let r=ht._sentryDebugIds;if(!r)return;let n,i=Yc.get(e);i?n=i:(n=new Map,Yc.set(e,n));let s=Object.entries(r).reduce((o,[c,l])=>{let p,d=n.get(c);d?p=d:(p=e(c),n.set(c,p));for(let h=p.length-1;h>=0;h--){let b=p[h];if(b.filename){o[b.filename]=l;break}}return o},{});try{t.exception.values.forEach(o=>{o.stacktrace.frames.forEach(c=>{c.filename&&(c.debug_id=s[c.filename])})})}catch{}}function Hg(t){let e={};try{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)})})}catch{}if(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 Vg(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function qg(t,e,r){if(!t)return null;let n=x(x(x(x(x({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>x(x({},i),i.data&&{data:Ze(i.data,e,r)}))}),t.user&&{user:Ze(t.user,e,r)}),t.contexts&&{contexts:Ze(t.contexts,e,r)}),t.extra&&{extra:Ze(t.extra,e,r)});return t.contexts&&t.contexts.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=Ze(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>x(x({},i),i.data&&{data:Ze(i.data,e,r)}))),n}function Wg(t,e){if(!e)return t;let r=t?t.clone():new Ge;return r.update(e),r}function Gg(t){if(t)return zg(t)?{captureContext:t}:Kg(t)?{captureContext:t}:t}function zg(t){return t instanceof Ge||typeof t=="function"}var Yg=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Kg(t){return Object.keys(t).some(e=>Yg.includes(e))}function Jg(t,e){return ga().captureException(t,Gg(e))}function Fu(t,e){return ga().captureEvent(t,e)}var Xg="7";function Qg(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function Zg(t){return`${Qg(t)}${t.projectId}/envelope/`}function tm(t,e){return gf(x({sentry_key:t.publicKey,sentry_version:Xg},e&&{sentry_client:`${e.name}/${e.version}`}))}function em(t,e,r){return e||`${Zg(t)}?${tm(t,r)}`}var Kc=[];function rm(t,e){let r={};return e.forEach(n=>{n&&Hu(t,n,r)}),r}function Jc(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function Hu(t,e,r){if(r[e.name]){Ct&&nt.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Kc.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Kc.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,s)=>n(i,s,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((s,o)=>n(s,o,t),{id:e.name});t.addEventProcessor(i)}Ct&&nt.log(`Integration installed: ${e.name}`)}var Xc="Not capturing exception because it's already been captured.",nm=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=ff(t.dsn):Ct&&nt.warn("No DSN provided, client will not send events."),this._dsn){let e=em(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport(yt(x({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},t.transportOptions),{url:e}))}}captureException(t,e,r){let n=_e();if(Uc(t))return Ct&&nt.log(Xc),n;let i=x({event_id:n},e);return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(t,e,r,n){let i=x({event_id:_e()},r),s=aa(t)?t:String(t),o=ca(t)?this.eventFromMessage(s,e,i):this.eventFromException(t,i);return this._process(o.then(c=>this._captureEvent(c,i,n))),i.event_id}captureEvent(t,e,r){let n=_e();if(e&&e.originalException&&Uc(e.originalException))return Ct&&nt.log(Xc),n;let i=x({event_id:n},e),s=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,i,s||r)),i.event_id}captureSession(t){typeof t.release!="string"?Ct&&nt.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),bo(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){let e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then(r=>e.flush(t).then(n=>r&&n))):Tr(!0)}close(t){return this.flush(t).then(e=>(this.getOptions().enabled=!1,this.emit("close"),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let e=this._integrations[t.name];Hu(this,t,this._integrations),e||Jc(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=kg(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=Gf(r,Kf(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let e=Og(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,r){if(this._options.sendClientReports){let n=`${t}:${e}`;Ct&&nt.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(t,e){let r=this._hooks[t]=this._hooks[t]||[];return r.push(e),()=>{let n=r.indexOf(e);n>-1&&r.splice(n,1)}}emit(t,...e){let r=this._hooks[t];r&&r.forEach(n=>n(...e))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,e=>(Ct&&nt.error("Error while sending event:",e),e)):(Ct&&nt.error("Transport disabled"),Tr({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=rm(this,t),Jc(this,t)}_updateSessionFromEvent(t,e){let r=!1,n=!1,i=e.exception&&e.exception.values;if(i){n=!0;for(let o of i){let c=o.mechanism;if(c&&c.handled===!1){r=!0;break}}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(bo(t,yt(x({},r&&{status:"crashed"}),{errors:t.errors||Number(n||r)})),this.captureSession(t))}_isClientDoneProcessing(t){return new Zn(e=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),e(!0)):(r+=n,t&&r>=t&&(clearInterval(i),e(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,e,r,n=Uu()){let i=this.getOptions(),s=Object.keys(this._integrations);return!e.integrations&&s.length>0&&(e.integrations=s),this.emit("preprocessEvent",t,e),t.type||n.setLastEventId(t.event_id||e.event_id),jg(i,t,e,r,this,n).then(o=>{if(o===null)return o;let c=x(x({},n.getPropagationContext()),r?r.getPropagationContext():void 0);if(!(o.contexts&&o.contexts.trace)&&c){let{traceId:l,spanId:p,parentSpanId:d,dsc:h}=c;o.contexts=x({trace:ve({trace_id:l,span_id:p,parent_span_id:d})},o.contexts);let b=h||$u(l,this);o.sdkProcessingMetadata=x({dynamicSamplingContext:b},o.sdkProcessingMetadata)}return o})}_captureEvent(t,e={},r){return this._processEvent(t,e,r).then(n=>n.event_id,n=>{if(Ct){let i=n;i.logLevel==="log"?nt.log(i.message):nt.warn(i)}})}_processEvent(t,e,r){let n=this.getOptions(),{sampleRate:i}=n,s=So(t),o=Vu(t),c=t.type||"error",l=`before send for type \`${c}\``,p=typeof i>"u"?void 0:Ag(i);if(o&&typeof p=="number"&&Math.random()>p)return this.recordDroppedEvent("sample_rate","error",t),ji(new xe(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let d=c==="replay_event"?"replay":c,h=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,r,h).then(b=>{if(b===null)throw this.recordDroppedEvent("event_processor",d,t),new xe("An event processor returned `null`, will not send event.","log");if(e.data&&e.data.__sentry__===!0)return b;let v=sm(this,n,b,e);return im(v,l)}).then(b=>{if(b===null){if(this.recordDroppedEvent("before_send",d,t),So(t)){let _=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+_}throw new xe(`${l} returned \`null\`, will not send event.`,"log")}let v=r&&r.getSession();!s&&v&&this._updateSessionFromEvent(v,b);let w=b.transaction_info;if(s&&w&&b.transaction!==t.transaction){let _="custom";b.transaction_info=yt(x({},w),{source:_})}return this.sendEvent(b,e),b}).then(null,b=>{throw b instanceof xe?b:(this.captureException(b,{data:{__sentry__:!0},originalException:b}),new xe(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
23
|
-
Reason: ${b}`))})}_process(t){this._numProcessing++,t.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([e,r])=>{let[n,i]=e.split(":");return{reason:n,category:i,quantity:r}})}};function
|
|
24
|
-
Event: ${
|
|
25
|
-
Event: ${
|
|
26
|
-
Event: ${
|
|
27
|
-
Event: ${
|
|
28
|
-
Event: ${
|
|
29
|
-
Url: ${Fi(t)}`),!0):
|
|
30
|
-
Event: ${
|
|
31
|
-
Url: ${Fi(t)}`),!0)}function wm(t,e){return t.type||!e||!e.length?!1:Sm(t).some(r=>ss(r,e))}function bm(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?ss(r,e):!1}function _m(t,e){if(!e||!e.length)return!1;let r=Fi(t);return r?ss(r,e):!1}function Em(t,e){if(!e||!e.length)return!0;let r=Fi(t);return r?ss(r,e):!0}function Sm(t){let e=[];t.message&&e.push(t.message);let r;try{r=t.exception.values[t.exception.values.length-1]}catch{}return r&&r.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`)),e}function Im(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function Cm(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 Fi(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?Cm(e):null}catch{return Ct&&nt.error(`Cannot extract url for event ${Qe(t)}`),null}}function Tm(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}var xm="Dedupe",Dm=()=>{let t;return{name:xm,processEvent(e){if(e.type)return e;try{if(Nm(e,t))return Ct&&nt.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Am=Dm;function Nm(t,e){return e?!!(Om(t,e)||km(t,e)):!1}function Om(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Wu(t,e)||!qu(t,e))}function km(t,e){let r=el(e),n=el(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Wu(t,e)||!qu(t,e))}function qu(t,e){let r=Rc(t),n=Rc(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 s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function Wu(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 el(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Ft=ht,Io=0;function Gu(){return Io>0}function Pm(){Io++,setTimeout(()=>{Io--})}function Xr(t,e={},r){if(typeof t!="function")return t;try{let i=t.__sentry_wrapped__;if(i)return i;if(pa(t))return t}catch{return t}let n=function(){let i=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);let s=i.map(o=>Xr(o,e));return t.apply(this,s)}catch(s){throw Pm(),dg(o=>{o.addEventProcessor(c=>(e.mechanism&&(yo(c,void 0,void 0),Hn(c,e.mechanism)),c.extra=yt(x({},c.extra),{arguments:i}),c)),Jg(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}Nu(n,t),Ir(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Hr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function ma(t,e){let r=ya(t,e),n={type:e&&e.name,value:Bm(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Rm(t,e,r,n){let i=ie(),s=i&&i.getOptions().normalizeDepth,o=Vm(e),c={__serialized__:Ru(e,s)};if(o)return{exception:{values:[ma(t,o)]},extra:c};let l={exception:{values:[{type:ns(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Fm(e,{isUnhandledRejection:n})}]},extra:c};if(r){let p=ya(t,r);p.length&&(l.exception.values[0].stacktrace={frames:p})}return l}function Rs(t,e){return{exception:{values:[ma(t,e)]}}}function ya(t,e){let r=e.stacktrace||e.stack||"",n=Mm(e),i=Um(e);try{return t(r,n,i)}catch{}return[]}var Lm=/Minified React error #\d+;/i;function Mm(t){return t&&Lm.test(t.message)?1:0}function Um(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Bm(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function jm(t,e,r,n){let i=r&&r.syntheticException||void 0,s=va(t,e,i,n);return Hn(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),Tr(s)}function $m(t,e,r="info",n,i){let s=n&&n.syntheticException||void 0,o=Co(t,e,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),Tr(o)}function va(t,e,r,n,i){let s;if(Tu(e)&&e.error)return Rs(t,e.error);if(Tc(e)||Jd(e)){let o=e;if("stack"in e)s=Rs(t,e);else{let c=o.name||(Tc(o)?"DOMError":"DOMException"),l=o.message?`${c}: ${o.message}`:c;s=Co(t,l,r,n),yo(s,l)}return"code"in o&&(s.tags=yt(x({},s.tags),{"DOMException.code":`${o.code}`})),s}return oa(e)?Rs(t,e):Kr(e)||ns(e)?(s=Rm(t,e,r,i),Hn(s,{synthetic:!0}),s):(s=Co(t,e,r,n),yo(s,`${e}`,void 0),Hn(s,{synthetic:!0}),s)}function Co(t,e,r,n){let i={};if(n&&r){let s=ya(t,r);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]})}if(aa(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function Fm(t,{isUnhandledRejection:e}){let r=mf(t),n=e?"promise rejection":"exception";return Tu(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:ns(t)?`Event \`${Hm(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Hm(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Vm(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function qm(t,{metadata:e,tunnel:r,dsn:n}){let i=x(x({event_id:t.event_id,sent_at:new Date().toISOString()},e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}}),!!r&&!!n&&{dsn:os(n)}),s=Wm(t);return ti(i,[s])}function Wm(t){return[{type:"user_report"},t]}var Gm=class extends nm{constructor(t){let e=x({parentSpanIsAlwaysRootSpan:!0},t),r=Ft.SENTRY_SDK_SOURCE||kf();cm(e,"browser",["browser"],r),super(e),e.sendClientReports&&Ft.document&&Ft.document.addEventListener("visibilitychange",()=>{Ft.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,e){return jm(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return $m(this._options.stackParser,t,e,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){Hr&&nt.warn("SDK not enabled, will not capture user feedback.");return}let e=qm(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(e)}_prepareEvent(t,e,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,r)}_flushOutcomes(){let t=this._clearOutcomes();if(t.length===0){Hr&&nt.log("No outcomes to send");return}if(!this._dsn){Hr&&nt.log("No dsn provided, will not send outcomes");return}Hr&&nt.log("Sending outcomes:",t);let e=Qf(t,this._options.tunnel&&os(this._dsn));this.sendEnvelope(e)}},zm=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,zt=ht,Ym=1e3,rl,To,xo;function Km(t){let e="dom";Or(e,t),kr(e,Jm)}function Jm(){if(!zt.document)return;let t=be.bind(null,"dom"),e=nl(t,!0);zt.document.addEventListener("click",e,!1),zt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=zt[r]&&zt[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Ht(n,"addEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let l=this,p=l.__sentry_instrumentation_handlers__=l.__sentry_instrumentation_handlers__||{},d=p[s]=p[s]||{refCount:0};if(!d.handler){let h=nl(t);d.handler=h,i.call(this,s,h,c)}d.refCount++}catch{}return i.call(this,s,o,c)}}),Ht(n,"removeEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let l=this,p=l.__sentry_instrumentation_handlers__||{},d=p[s];d&&(d.refCount--,d.refCount<=0&&(i.call(this,s,d.handler,c),d.handler=void 0,delete p[s]),Object.keys(p).length===0&&delete l.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,c)}}))})}function Xm(t){if(t.type!==To)return!1;try{if(!t.target||t.target._sentryId!==xo)return!1}catch{}return!0}function Qm(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function nl(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=Zm(r);if(Qm(r.type,n))return;Ir(r,"_sentryCaptured",!0),n&&!n._sentryId&&Ir(n,"_sentryId",_e());let i=r.type==="keypress"?"input":r.type;Xm(r)||(t({event:r,name:i,global:e}),To=r.type,xo=n?n._sentryId:void 0),clearTimeout(rl),rl=zt.setTimeout(()=>{xo=void 0,To=void 0},Ym)}}function Zm(t){try{return t.target}catch{return null}}var wi;function ty(t){let e="history";Or(e,t),kr(e,ey)}function ey(){if(!ng())return;let t=zt.onpopstate;zt.onpopstate=function(...r){let n=zt.location.href,i=wi;if(wi=n,be("history",{from:i,to:n}),t)try{return t.apply(this,r)}catch{}};function e(r){return function(...n){let i=n.length>2?n[2]:void 0;if(i){let s=wi,o=String(i);wi=o,be("history",{from:s,to:o})}return r.apply(this,n)}}Ht(zt.history,"pushState",e),Ht(zt.history,"replaceState",e)}var ki={};function ry(t){let e=ki[t];if(e)return e;let r=zt[t];if(go(r))return ki[t]=r.bind(zt);let n=zt.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch(i){zm&&nt.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(ki[t]=r.bind(zt))}function il(t){ki[t]=void 0}var On="__sentry_xhr_v3__";function ny(t){let e="xhr";Or(e,t),kr(e,iy)}function iy(){if(!zt.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Ht(t,"open",function(e){return function(...r){let n=sr()*1e3,i=Fe(r[0])?r[0].toUpperCase():void 0,s=sy(r[1]);if(!i||!s)return e.apply(this,r);this[On]={method:i,url:s,request_headers:{}},i==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let o=()=>{let c=this[On];if(c&&this.readyState===4){try{c.status_code=this.status}catch{}let l={endTimestamp:sr()*1e3,startTimestamp:n,xhr:this};be("xhr",l)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Ht(this,"onreadystatechange",function(c){return function(...l){return o(),c.apply(this,l)}}):this.addEventListener("readystatechange",o),Ht(this,"setRequestHeader",function(c){return function(...l){let[p,d]=l,h=this[On];return h&&Fe(p)&&Fe(d)&&(h.request_headers[p.toLowerCase()]=d),c.apply(this,l)}}),e.apply(this,r)}}),Ht(t,"send",function(e){return function(...r){let n=this[On];if(!n)return e.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:sr()*1e3,xhr:this};return be("xhr",i),e.apply(this,r)}})}function sy(t){if(Fe(t))return t;try{return t.toString()}catch{}}function oy(t,e=ry("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let c=x({body:s.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return il("fetch"),ji("No fetch implementation available");try{return e(t.url,c).then(l=>(r-=o,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return il("fetch"),r-=o,n--,ji(l)}}return am(t,i)}var ay=30,cy=50;function Do(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 ly=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,uy=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,hy=/\((\S*)(?::(\d+))(?::(\d+))\)/,py=t=>{let e=ly.exec(t);if(e){let[,n,i,s]=e;return Do(n,Cr,+i,+s)}let r=uy.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=hy.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=zu(r[1]||Cr,r[2]);return Do(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},dy=[ay,py],fy=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,gy=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,my=t=>{let e=fy.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=gy.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],n=e[1]||Cr;return[n,r]=zu(n,r),Do(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},yy=[cy,my],vy=[dy,yy],wy=vf(...vy),zu=(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]},bi=1024,by="Breadcrumbs",_y=(t={})=>{let e=x({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:by,setup(r){e.console&&bf(Cy(r)),e.dom&&Km(Iy(r,e.dom)),e.xhr&&ny(Ty(r)),e.fetch&&Cf(xy(r)),e.history&&ty(Dy(r)),e.sentry&&r.on("beforeSendEvent",Sy(r))}}},Ey=_y;function Sy(t){return function(e){ie()===t&&xr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:Qe(e)},{event:e})}}function Iy(t,e){return function(r){if(ie()!==t)return;let n,i,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>bi&&(Hr&&nt.warn(`\`dom.maxStringLength\` cannot exceed ${bi}, but a value of ${o} was configured. Sentry will use ${bi} instead.`),o=bi),typeof s=="string"&&(s=[s]);try{let l=r.event,p=Ay(l)?l.target:l;n=Du(p,{keyAttrs:s,maxStringLength:o}),i=af(p)}catch{n="<unknown>"}if(n.length===0)return;let c={category:`ui.${r.name}`,message:n};i&&(c.data={"ui.component_name":i}),xr(c,{event:r.event,name:r.name,global:r.global})}}function Cy(t){return function(e){if(ie()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:Ff(e.level),message:xc(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${xc(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;xr(r,{input:e.args,level:e.level})}}function Ty(t){return function(e){if(ie()!==t)return;let{startTimestamp:r,endTimestamp:n}=e,i=e.xhr[On];if(!r||!n||!i)return;let{method:s,url:o,status_code:c,body:l}=i,p={method:s,url:o,status_code:c},d={xhr:e.xhr,input:l,startTimestamp:r,endTimestamp:n};xr({category:"xhr",data:p,type:"http"},d)}}function xy(t){return function(e){if(ie()!==t)return;let{startTimestamp:r,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.error){let i=e.fetchData,s={data:e.error,input:e.args,startTimestamp:r,endTimestamp:n};xr({category:"fetch",data:i,level:"error",type:"http"},s)}else{let i=e.response,s=yt(x({},e.fetchData),{status_code:i&&i.status}),o={input:e.args,response:i,startTimestamp:r,endTimestamp:n};xr({category:"fetch",data:s,type:"http"},o)}}}function Dy(t){return function(e){if(ie()!==t)return;let r=e.from,n=e.to,i=Ps(Ft.location.href),s=r?Ps(r):void 0,o=Ps(n);(!s||!s.path)&&(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),xr({category:"navigation",data:{from:r,to:n}})}}function Ay(t){return!!t&&!!t.target}var Ny=["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"],Oy="BrowserApiErrors",ky=(t={})=>{let e=x({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:Oy,setupOnce(){e.setTimeout&&Ht(Ft,"setTimeout",sl),e.setInterval&&Ht(Ft,"setInterval",sl),e.requestAnimationFrame&&Ht(Ft,"requestAnimationFrame",Ry),e.XMLHttpRequest&&"XMLHttpRequest"in Ft&&Ht(XMLHttpRequest.prototype,"send",Ly);let r=e.eventTarget;r&&(Array.isArray(r)?r:Ny).forEach(My)}}},Py=ky;function sl(t){return function(...e){let r=e[0];return e[0]=Xr(r,{mechanism:{data:{function:ar(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function Ry(t){return function(e){return t.apply(this,[Xr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:ar(t)},handled:!1,type:"instrument"}})])}}function Ly(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Ht(r,n,function(i){let s={mechanism:{data:{function:n,handler:ar(i)},handled:!1,type:"instrument"}},o=pa(i);return o&&(s.mechanism.data.handler=ar(o)),Xr(i,s)})}),t.apply(this,e)}}function My(t){let e=Ft,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Ht(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=Xr(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:ar(s),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,Xr(s,{mechanism:{data:{function:"addEventListener",handler:ar(s),target:t},handled:!1,type:"instrument"}}),o])}}),Ht(r,"removeEventListener",function(n){return function(i,s,o){let c=s;try{let l=c&&c.__sentry_wrapped__;l&&n.call(this,i,l,o)}catch{}return n.call(this,i,c,o)}}))}var Uy="GlobalHandlers",By=(t={})=>{let e=x({onerror:!0,onunhandledrejection:!0},t);return{name:Uy,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&($y(r),ol("onerror")),e.onunhandledrejection&&(Fy(r),ol("onunhandledrejection"))}}},jy=By;function $y(t){Df(e=>{let{stackParser:r,attachStacktrace:n}=Yu();if(ie()!==t||Gu())return;let{msg:i,url:s,line:o,column:c,error:l}=e,p=qy(va(r,l||i,void 0,n,!1),s,o,c);p.level="error",Fu(p,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function Fy(t){Nf(e=>{let{stackParser:r,attachStacktrace:n}=Yu();if(ie()!==t||Gu())return;let i=Hy(e),s=ca(i)?Vy(i):va(r,i,void 0,n,!0);s.level="error",Fu(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Hy(t){if(ca(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 Vy(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function qy(t,e,r,n){let i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},c=o.stacktrace=o.stacktrace||{},l=c.frames=c.frames||[],p=isNaN(parseInt(n,10))?void 0:n,d=isNaN(parseInt(r,10))?void 0:r,h=Fe(e)&&e.length>0?e:of();return l.length===0&&l.push({colno:p,filename:h,function:Cr,in_app:!0,lineno:d}),t}function ol(t){Hr&&nt.log(`Global Handler attached: ${t}`)}function Yu(){let t=ie();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var Wy=()=>({name:"HttpContext",preprocessEvent(t){if(!Ft.navigator&&!Ft.location&&!Ft.document)return;let e=t.request&&t.request.url||Ft.location&&Ft.location.href,{referrer:r}=Ft.document||{},{userAgent:n}=Ft.navigator||{},i=x(x(x({},t.request&&t.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),s=yt(x(x({},t.request),e&&{url:e}),{headers:i});t.request=s}}),Gy="cause",zy=5,Yy="LinkedErrors",Ky=(t={})=>{let e=t.limit||zy,r=t.key||Gy;return{name:Yy,preprocessEvent(n,i,s){let o=s.getOptions();ef(ma,o.stackParser,o.maxValueLength,r,e,n,i)}}},Jy=Ky;function Xy(t){return[mm(),pm(),Py(),Ey(),jy(),Jy(),Am(),Wy()]}var Kt=class Ku{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ku),this.INSTANCE}captureError(e,r,n){T.error(`${r}:`,e);let i=this.getNewScope(n);i.setTag("operation",r),i.captureException(e)}captureMessage(e,r,n){this.getNewScope(n).captureMessage(e,r??"error")}setGlobalContext(e,r){this.contexts[e]=x({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e){e??={};let{extra:r,tags:n}=e,i=new Ge;if(i.setClient(this.client),i.setUser(this.user),e.triggerContext&&!e.engagementTrigger&&(e.engagementTrigger=e.triggerContext.triggerData),e.engagementTrigger){let s=e.engagementTrigger;i.setTags({"engagement.id":s.engagementID,"engagement.short_id":s.shortID,"engagement.objective":s.objective,"engagement.delivery_type":s.onsiteDeliveryType,"engagement.content_id":s.contentID,"engagement.variation":s.variation,"engagement.currency":s.currency})}return r&&i.setExtras(r),this.tags&&i.setTags(this.tags),n&&i.setTags(n),Object.keys(this.contexts).forEach(s=>{i.setContext(s,this.contexts[s])}),i.setTag("language",navigator.language),i.setTag("timezone",ev()),this.addShopifyTags(i),i}addShopifyTags(e){window.Shopify&&(e.setTag("shopify.shop",window.Shopify.shop),e.setTag("shopify.currency",window.Shopify.currency?.active),e.setTag("shopify.locale",window.Shopify.locale),e.setTag("theme.schema_name",window.Shopify.theme?.schema_name),e.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}init(){let e=Xy({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new Gm({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:oy,stackParser:wy,integrations:e,environment:qe.mode,release:`web-sdk@${H.SDK_VERSION}`,debug:qe.debug}),this.client.init()}},ot=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"},al=ke(kd());function wa(t){return al.default.createInstance({name:"lc",storeName:t,driver:al.default.LOCALSTORAGE})}var ba=class{static storage;static async get(t,e){return await this.storage?.getItem(t)??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},te=class extends ba{static storeName="ses";static{this.storage=wa(this.storeName)}},Lt=class extends ba{static storeName="usr";static{this.storage=wa(this.storeName)}},Qy=class{static format(t,e){let r=/{{\s*(\w+)\s*}}/;return e.replace(r,(n,i)=>{switch(i){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return n}})}static formatWithDelimiters(t,e=2,r=",",n="."){if(isNaN(t)||t==null)return"0";let i=(t/100).toFixed(e).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}},Ot=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(t){this._currencyCode=t}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(t){this.currentItem=new on(t)}};function Ju(t){try{return new URL(t)}catch{return}}function cl(t){return!t||t==="null"||t==="undefined"}function Zy(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function De(t,e){if(t==0&&e)return"Free";let r=Ot.get(),n=ne.get(),i=r.shopCurrencyCode||n.currency,s=r.currencyCode;s||T.warn("Currency code is not set in RuntimeData");let o=n.money?.format??r.moneyFormat,c;if(o&&i===s)c=Qy.format(t*100,o);else{let l;try{l=new Intl.NumberFormat(Xu(),{style:"currency",currency:s||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return Kt.getInstance().captureError(p,"format-currency",{extra:{currentCurrency:s,shopCurrency:i}}),""}c=l.format(t),c=c.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(c=c.concat(` ${s}`))}return c}function tv(t){return new Intl.NumberFormat(Xu(),{notation:"compact"}).format(t)}function Xu(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var _i;function ev(){if(_i)return _i;try{return _i=Intl.DateTimeFormat().resolvedOptions().timeZone,_i}catch{return""}}function _a(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function tr(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 Qu(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let s=Math.min(100*2**n,5e3);if(await Jn.sleep(s),i=r.querySelectorAll(t),i.length)return T.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;T.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${s}ms.`),n++}return T.warn(`Max attempts reached. Element not found with ${t}.`),i}async function Hi(t,e=10,r=document){return(await Qu(t,e,r)).item(0)}function rv(t,e,r=document.body){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{(o===t||o.contains(t))&&(e(),n.disconnect())})})});n.observe(r,{childList:!0})}async function Zu(){let t=await Lt.get(ot.DEVICE_ID),e=await te.get(ot.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 kn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var cs,dt,th,eh,mr,ll,rh,Ao,nh,Ea,No,Oo,nv,Vn={},ih=[],iv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Sa=Array.isArray;function nr(t,e){for(var r in e)t[r]=e[r];return t}function Ia(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function sh(t,e,r){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?cs.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Pi(t,o,n,i,null)}function Pi(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++th,__i:-1,__u:0};return i==null&&dt.vnode!=null&&dt.vnode(s),s}function cn(t){return t.children}function br(t,e){this.props=t,this.context=e}function Qr(t,e){if(e==null)return t.__?Qr(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"?Qr(t):null}function oh(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 oh(t)}}function ul(t){(!t.__d&&(t.__d=!0)&&mr.push(t)&&!Vi.__r++||ll!==dt.debounceRendering)&&((ll=dt.debounceRendering)||rh)(Vi)}function Vi(){var t,e,r,n,i,s,o,c;for(mr.sort(Ao);t=mr.shift();)t.__d&&(e=mr.length,n=void 0,s=(i=(r=t).__v).__e,o=[],c=[],r.__P&&((n=nr({},i)).__v=i.__v+1,dt.vnode&&dt.vnode(n),Ca(r.__P,n,i,r.__n,r.__P.namespaceURI,32&i.__u?[s]:null,o,s??Qr(i),!!(32&i.__u),c),n.__v=i.__v,n.__.__k[n.__i]=n,lh(o,n,c),n.__e!=s&&oh(n)),mr.length>e&&mr.sort(Ao));Vi.__r=0}function ah(t,e,r,n,i,s,o,c,l,p,d){var h,b,v,w,_,k,A=n&&n.__k||ih,B=e.length;for(l=sv(r,e,A,l,B),h=0;h<B;h++)(v=r.__k[h])!=null&&(b=v.__i===-1?Vn:A[v.__i]||Vn,v.__i=h,k=Ca(t,v,b,i,s,o,c,l,p,d),w=v.__e,v.ref&&b.ref!=v.ref&&(b.ref&&Ta(b.ref,null,v),d.push(v.ref,v.__c||w,v)),_==null&&w!=null&&(_=w),4&v.__u||b.__k===v.__k?l=ch(v,l,t):typeof v.type=="function"&&k!==void 0?l=k:w&&(l=w.nextSibling),v.__u&=-7);return r.__e=_,l}function sv(t,e,r,n,i){var s,o,c,l,p,d=r.length,h=d,b=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=s+b,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Pi(null,o,null,null,null):Sa(o)?Pi(cn,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Pi(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,c=null,(p=o.__i=ov(o,r,l,h))!==-1&&(h--,(c=r[p])&&(c.__u|=2)),c==null||c.__v===null?(p==-1&&b--,typeof o.type!="function"&&(o.__u|=4)):p!=l&&(p==l-1?b--:p==l+1?b++:(p>l?b--:b++,o.__u|=4))):t.__k[s]=null;if(h)for(s=0;s<d;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=Qr(c)),uh(c,c));return n}function ch(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=ch(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Qr(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ov(t,e,r,n){var i,s,o=t.key,c=t.type,l=e[r];if(l===null||l&&o==l.key&&c===l.type&&(2&l.__u)==0)return r;if(n>(l!=null&&(2&l.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<e.length;){if(i>=0){if((l=e[i])&&(2&l.__u)==0&&o==l.key&&c===l.type)return i;i--}if(s<e.length){if((l=e[s])&&(2&l.__u)==0&&o==l.key&&c===l.type)return s;s++}}return-1}function hl(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||iv.test(e)?r:r+"px"}function Ei(t,e,r,n,i){var s;t: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||hl(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||hl(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(nh,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?n?r.u=n.u:(r.u=Ea,t.addEventListener(e,s?Oo:No,s)):t.removeEventListener(e,s?Oo:No,s);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 t}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function pl(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Ea++;else if(e.t<r.u)return;return r(dt.event?dt.event(e):e)}}}function Ca(t,e,r,n,i,s,o,c,l,p){var d,h,b,v,w,_,k,A,B,G,j,X,_t,Dt,q,rt,Q,tt=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),s=[c=e.__e=r.__e]),(d=dt.__b)&&d(e);t:if(typeof tt=="function")try{if(A=e.props,B="prototype"in tt&&tt.prototype.render,G=(d=tt.contextType)&&n[d.__c],j=d?G?G.props.value:d.__:n,r.__c?k=(h=e.__c=r.__c).__=h.__E:(B?e.__c=h=new tt(A,j):(e.__c=h=new br(A,j),h.constructor=tt,h.render=cv),G&&G.sub(h),h.props=A,h.state||(h.state={}),h.context=j,h.__n=n,b=h.__d=!0,h.__h=[],h._sb=[]),B&&h.__s==null&&(h.__s=h.state),B&&tt.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=nr({},h.__s)),nr(h.__s,tt.getDerivedStateFromProps(A,h.__s))),v=h.props,w=h.state,h.__v=e,b)B&&tt.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),B&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(B&&tt.getDerivedStateFromProps==null&&A!==v&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(A,j),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(A,h.__s,j)===!1||e.__v==r.__v)){for(e.__v!=r.__v&&(h.props=A,h.state=h.__s,h.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(lt){lt&&(lt.__=e)}),X=0;X<h._sb.length;X++)h.__h.push(h._sb[X]);h._sb=[],h.__h.length&&o.push(h);break t}h.componentWillUpdate!=null&&h.componentWillUpdate(A,h.__s,j),B&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(v,w,_)})}if(h.context=j,h.props=A,h.__P=t,h.__e=!1,_t=dt.__r,Dt=0,B){for(h.state=h.__s,h.__d=!1,_t&&_t(e),d=h.render(h.props,h.state,h.context),q=0;q<h._sb.length;q++)h.__h.push(h._sb[q]);h._sb=[]}else do h.__d=!1,_t&&_t(e),d=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++Dt<25);h.state=h.__s,h.getChildContext!=null&&(n=nr(nr({},n),h.getChildContext())),B&&!b&&h.getSnapshotBeforeUpdate!=null&&(_=h.getSnapshotBeforeUpdate(v,w)),c=ah(t,Sa(rt=d!=null&&d.type===cn&&d.key==null?d.props.children:d)?rt:[rt],e,r,n,i,s,o,c,l,p),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),k&&(h.__E=h.__=null)}catch(lt){if(e.__v=null,l||s!=null)if(lt.then){for(e.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.__e=c}else for(Q=s.length;Q--;)Ia(s[Q]);else e.__e=r.__e,e.__k=r.__k;dt.__e(lt,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):c=e.__e=av(r.__e,e,r,n,i,s,o,l,p);return(d=dt.diffed)&&d(e),128&e.__u?void 0:c}function lh(t,e,r){for(var n=0;n<r.length;n++)Ta(r[n],r[++n],r[++n]);dt.__c&&dt.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){dt.__e(s,i.__v)}})}function av(t,e,r,n,i,s,o,c,l){var p,d,h,b,v,w,_,k=r.props,A=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"),s!=null){for(p=0;p<s.length;p++)if((v=s[p])&&"setAttribute"in v==!!B&&(B?v.localName==B:v.nodeType==3)){t=v,s[p]=null;break}}if(t==null){if(B==null)return document.createTextNode(A);t=document.createElementNS(i,B,A.is&&A),c&&(dt.__m&&dt.__m(e,s),c=!1),s=null}if(B===null)k===A||c&&t.data===A||(t.data=A);else{if(s=s&&cs.call(t.childNodes),k=r.props||Vn,!c&&s!=null)for(k={},p=0;p<t.attributes.length;p++)k[(v=t.attributes[p]).name]=v.value;for(p in k)if(v=k[p],p!="children"){if(p=="dangerouslySetInnerHTML")h=v;else if(!(p in A)){if(p=="value"&&"defaultValue"in A||p=="checked"&&"defaultChecked"in A)continue;Ei(t,p,null,v,i)}}for(p in A)v=A[p],p=="children"?b=v:p=="dangerouslySetInnerHTML"?d=v:p=="value"?w=v:p=="checked"?_=v:c&&typeof v!="function"||k[p]===v||Ei(t,p,v,k[p],i);if(d)c||h&&(d.__html===h.__html||d.__html===t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(h&&(t.innerHTML=""),ah(t,Sa(b)?b:[b],e,r,n,B=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Qr(r,0),c,l),s!=null)for(p=s.length;p--;)Ia(s[p]);c||(p="value",B=="progress"&&w==null?t.removeAttribute("value"):w!==void 0&&(w!==t[p]||B=="progress"&&!w||B=="option"&&w!==k[p])&&Ei(t,p,w,k[p],i),p="checked",_!==void 0&&_!==t[p]&&Ei(t,p,_,k[p],i))}return t}function Ta(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){dt.__e(i,r)}}function uh(t,e,r){var n,i;if(dt.unmount&&dt.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Ta(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){dt.__e(s,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&uh(n[i],e,r||typeof t.type!="function");r||Ia(t.__e),t.__c=t.__=t.__e=void 0}function cv(t,e,r){return this.constructor(t,r)}function lv(t,e,r){var n,i,s,o;e==document&&(e=document.documentElement),dt.__&&dt.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,s=[],o=[],Ca(e,t=(!n&&r||e).__k=sh(cn,null,[t]),i||Vn,Vn,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?cs.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),lh(s,t,o)}cs=ih.slice,dt={__e:function(t,e,r,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),o=i.__d),o)return i.__E=i}catch(c){t=c}throw t}},th=0,eh=function(t){return t!=null&&t.constructor==null},br.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=nr({},this.state),typeof t=="function"&&(t=t(nr({},r),this.props)),t&&nr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),ul(this))},br.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ul(this))},br.prototype.render=cn,mr=[],rh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ao=function(t,e){return t.__v.__b-e.__v.__b},Vi.__r=0,nh=/(PointerCapture)$|Capture$/i,Ea=0,No=pl(!1),Oo=pl(!0),nv=0;var ko,ee,Ls,dl,fl=0,hh=[],Mt=dt,gl=Mt.__b,ml=Mt.__r,yl=Mt.diffed,vl=Mt.__c,wl=Mt.unmount,bl=Mt.__;function uv(t,e){Mt.__h&&Mt.__h(ee,t,fl||e),fl=0;var r=ee.__H||(ee.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function ph(t,e){var r=uv(ko++,7);return dv(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function hv(){for(var t;t=hh.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Ri),t.__H.__h.forEach(Po),t.__H.__h=[]}catch(e){t.__H.__h=[],Mt.__e(e,t.__v)}}Mt.__b=function(t){ee=null,gl&&gl(t)},Mt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),bl&&bl(t,e)},Mt.__r=function(t){ml&&ml(t),ko=0;var e=(ee=t.__c).__H;e&&(Ls===ee?(e.__h=[],ee.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(Ri),e.__h.forEach(Po),e.__h=[],ko=0)),Ls=ee},Mt.diffed=function(t){yl&&yl(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(hh.push(e)!==1&&dl===Mt.requestAnimationFrame||((dl=Mt.requestAnimationFrame)||pv)(hv)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),Ls=ee=null},Mt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Ri),r.__h=r.__h.filter(function(n){return!n.__||Po(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Mt.__e(n,r.__v)}}),vl&&vl(t,e)},Mt.unmount=function(t){wl&&wl(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Ri(n)}catch(i){e=i}}),r.__H=void 0,e&&Mt.__e(e,r.__v))};var _l=typeof requestAnimationFrame=="function";function pv(t){var e,r=function(){clearTimeout(n),_l&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);_l&&(e=requestAnimationFrame(r))}function Ri(t){var e=ee,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),ee=e}function Po(t){var e=ee;t.__c=t.__(),ee=e}function dv(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var fv=Symbol.for("preact-signals");function xa(){if(Wr>1)Wr--;else{for(var t,e=!1;Un!==void 0;){var r=Un;for(Un=void 0,Ro++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&fh(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Ro=0,Wr--,e)throw t}}var wt=void 0,Un=void 0,Wr=0,Ro=0,qi=0;function dh(t){if(wt!==void 0){var e=t.n;if(e===void 0||e.t!==wt)return e={i:0,S:t,p:wt.s,n:void 0,t:wt,e:void 0,x:void 0,r:e},wt.s!==void 0&&(wt.s.n=e),wt.s=e,t.n=e,32&wt.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=wt.s,e.n=void 0,wt.s.n=e,wt.s=e),e}}function qt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}qt.prototype.brand=fv;qt.prototype.h=function(){return!0};qt.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)};qt.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)}};qt.prototype.subscribe=function(t){var e=this;return Ke(function(){var r=e.value,n=wt;wt=void 0;try{t(r)}finally{wt=n}})};qt.prototype.valueOf=function(){return this.value};qt.prototype.toString=function(){return this.value+""};qt.prototype.toJSON=function(){return this.value};qt.prototype.peek=function(){var t=wt;wt=void 0;try{return this.value}finally{wt=t}};Object.defineProperty(qt.prototype,"value",{get:function(){var t=dh(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Ro>100)throw new Error("Cycle detected");this.v=t,this.i++,qi++,Wr++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{xa()}}}});function Dr(t){return new qt(t)}function fh(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 gh(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 mh(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 ln(t){qt.call(this,void 0),this.x=t,this.s=void 0,this.g=qi-1,this.f=4}(ln.prototype=new qt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===qi))return!0;if(this.g=qi,this.f|=1,this.i>0&&!fh(this))return this.f&=-2,!0;var t=wt;try{gh(this),wt=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 wt=t,mh(this),this.f&=-2,!0};ln.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)}qt.prototype.S.call(this,t)};ln.prototype.U=function(t){if(this.t!==void 0&&(qt.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)}};ln.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(ln.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=dh(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function gv(t){return new ln(t)}function yh(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Wr++;var r=wt;wt=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Da(t),n}finally{wt=r,xa()}}}function Da(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,yh(t)}function mv(t){if(wt!==this)throw new Error("Out-of-order effect");mh(this),wt=t,this.f&=-2,8&this.f&&Da(this),xa()}function ei(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}ei.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()}};ei.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,yh(this),gh(this),Wr++;var t=wt;return wt=this,mv.bind(this,t)};ei.prototype.N=function(){2&this.f||(this.f|=2,this.o=Un,Un=this)};ei.prototype.d=function(){this.f|=8,1&this.f||Da(this)};function Ke(t){var e=new ei(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Aa,Ms;function un(t,e){dt[t]=e.bind(null,dt[t]||function(){})}function Wi(t){Ms&&Ms(),Ms=t&&t.S()}function vh(t){var e=this,r=t.data,n=vv(r);n.value=r;var i=ph(function(){for(var s=e.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return e.__$u.c=function(){var o,c=e.__$u.S(),l=i.value;c(),eh(l)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=l},gv(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}vh.displayName="_st";Object.defineProperties(qt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:vh},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});un("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var s=n[i];s instanceof qt&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});un("__r",function(t,e){Wi();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return Ke(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Aa=n,Wi(r),t(e)});un("__e",function(t,e,r,n){Wi(),Aa=void 0,t(e,r,n)});un("diffed",function(t,e){Wi(),Aa=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var s=r.U;if(s)for(var o in s){var c=s[o];c!==void 0&&!(o in n)&&(c.d(),s[o]=void 0)}else r.U=s={};for(var l in n){var p=s[l],d=n[l];p===void 0?(p=yv(r,l,d,i),s[l]=p):p.o(d,i)}}}t(e)});function yv(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=Dr(r);return{o:function(o,c){s.value=o,n=c},d:Ke(function(){var o=s.value.value;n[e]!==o&&(n[e]=o,i?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}un("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 s=n[i];s&&s.d()}}}}else{var o=e.__c;if(o){var c=o.__$u;c&&(o.__$u=void 0,c.d())}}t(e)});un("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});br.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 s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function vv(t){return ph(function(){return Dr(t)},[])}var wv=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},bv=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d}},_v=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},ls=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new wv(e))??[],this.link=t.link,this.price=new bv(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=Dr(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=Dr(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new _v(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}},He=class{id;mID;name;status;ctg;options;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=Dr(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=Dr(this.selectedVariant)}get imageURL(){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(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}setSelectedVariant(t){this.selectedOrFirstVariant.value=t}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.reviews=t.reviews,this.options=t.options,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),this.tags=t.tags,t.vars&&(this.vars=t.vars.map(e=>new ls(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new on({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,e=t.price,r=this.name,n=this.category,i=De(e.d,!0),s=this.variantImage??this.imageURL,o=this.meta,c=this.tags?.join(",")??"",l=this.reviews?.rating,p=this.reviews?.totalReviews,d=e.cmp&&e.cmp>e.d,h={name:r,price:i,image_url:s,meta:o,category:n,rating:l,reviews:p,tags:c};if(t.hasEffectivePrice()&&(h.effective_price=De(t.effectivePrice.value)),d){h.compare_price=De(e.cmp);let v=e.cmp-e.d;h.discount_percent=(v/e.cmp*100).toFixed(0),h.discount_price=De(v)}let b={name:t.name,quantity:t.quantity};return{product:h,variant:b}}},Ev=class{id;alt;sources;items;durationMS;thumbnail;card;constructor(t={}){this.id=t.id,this.alt=t.alt,this.sources=t.sources?.sort((e,r)=>r.height-e.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(e=>new He(e)):[],this.card=t.card}},Sv=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(t={}){this.videos=t.videos?.map(e=>new Ev(e))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.slidePerViewCount=t.slidePerViewCount??4,this.autoPlay=t.autoPlay??"ON",this.footerContent=t.footerContent??"FIRST_ITEM"}},Iv=Object.prototype.toString,hn=Array.isArray||function(t){return Iv.call(t)==="[object Array]"};function Na(t){return typeof t=="function"}function Cv(t){return hn(t)?"array":typeof t}function Us(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function El(t,e){return t!=null&&typeof t=="object"&&e in t}function Tv(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var xv=RegExp.prototype.test;function Dv(t,e){return xv.call(t,e)}var Av=/\S/;function Nv(t){return!Dv(Av,t)}var Ov={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function kv(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return Ov[e]})}var Pv=/\s*/,Rv=/\s+/,Sl=/\s*=/,Lv=/\s*\}/,Mv=/#|\^|\/|>|\{|&|=|!/;function Uv(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,c=!1,l="",p=0;function d(){if(o&&!c)for(;s.length;)delete i[s.pop()];else s=[];o=!1,c=!1}var h,b,v;function w(q){if(typeof q=="string"&&(q=q.split(Rv,2)),!hn(q)||q.length!==2)throw new Error("Invalid tags: "+q);h=new RegExp(Us(q[0])+"\\s*"),b=new RegExp("\\s*"+Us(q[1])),v=new RegExp("\\s*"+Us("}"+q[1]))}w(e||de.tags);for(var _=new ri(t),k,A,B,G,j,X;!_.eos();){if(k=_.pos,B=_.scanUntil(h),B)for(var _t=0,Dt=B.length;_t<Dt;++_t)G=B.charAt(_t),Nv(G)?(s.push(i.length),l+=G):(c=!0,r=!0,l+=" "),i.push(["text",G,k,k+1]),k+=1,G===`
|
|
32
|
-
`&&(d(),l="",p=0,r=!1);if(!_.scan(h))break;if(o=!0,A=_.scan(
|
|
22
|
+
`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let l;try{l=JSON.stringify(c)}catch{l=JSON.stringify(tr(c))}i(l)}}return typeof n=="string"?n:Kf(n)}function Kf(t){let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function Jf(t){let e=typeof t.data=="string"?bo(t.data):t.data;return[ve({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var Xf={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",statsd:"metric_bucket"};function jc(t){return Xf[t]}function Ru(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function Qf(t,e,r,n){let i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return x(x(x({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:os(n)}),i&&{trace:ve(x({},i))})}function Zf(t,e,r){let n=[{type:"client_report"},{timestamp:r||Qn(),discarded_events:t}];return ti(e?{dsn:e}:{},[n])}function tg(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 eg(t,e){return t[e]||t.all||0}function rg(t,e,r=Date.now()){return eg(t,e)>r}function ng(t,{statusCode:e,headers:r},n=Date.now()){let i=x({},t),s=r&&r["x-sentry-rate-limits"],o=r&&r["retry-after"];if(s)for(let c of s.trim().split(",")){let[l,p,,,d]=c.split(":",5),h=parseInt(l,10),b=(isNaN(h)?60:h)*1e3;if(!p)i.all=n+b;else for(let v of p.split(";"))v==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(i[v]=n+b):i[v]=n+b}else o?i.all=n+tg(o,n):e===429&&(i.all=n+60*1e3);return i}function $c(){return{traceId:_e(),spanId:_e().substring(16)}}var vi=ht;function ig(){let t=vi.chrome,e=t&&t.app&&t.app.runtime,r="history"in vi&&!!vi.history.pushState&&!!vi.history.replaceState;return!e&&r}var Ct=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function as(){return da(ht),ht}function da(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||wr,e[wr]=e[wr]||{}}function _o(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||sr(),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:_e()),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)}var Eo="_sentrySpan";function Fc(t,e){e?Ir(t,Eo,e):delete t[Eo]}function Hc(t){return t[Eo]}var sg=100,og=class Lu{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=$c()}clone(){let e=new Lu;return e._breadcrumbs=[...this._breadcrumbs],e._tags=x({},this._tags),e._extra=x({},this._extra),e._contexts=x({},this._contexts),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._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=x({},this._sdkProcessingMetadata),e._propagationContext=x({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,Fc(e,Hc(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&&_o(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=x(x({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=yt(x({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=x(x({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=yt(x({},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,i]=r instanceof ze?[r.getScopeData(),r.getRequestSession()]:Kr(r)?[e,e.requestSession]:[],{tags:s,extra:o,user:c,contexts:l,level:p,fingerprint:d=[],propagationContext:h}=n||{};return this._tags=x(x({},this._tags),s),this._extra=x(x({},this._extra),o),this._contexts=x(x({},this._contexts),l),c&&Object.keys(c).length&&(this._user=c),p&&(this._level=p),d.length&&(this._fingerprint=d),h&&(this._propagationContext=h),i&&(this._requestSession=i),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._requestSession=void 0,this._session=void 0,Fc(this,void 0),this._attachments=[],this._propagationContext=$c(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:sg;if(n<=0)return this;let i=x({timestamp:Qn()},e),s=this._breadcrumbs;return s.push(i),this._breadcrumbs=s.length>n?s.slice(-n):s,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:Hc(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=x(x({},this._sdkProcessingMetadata),e),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r&&r.event_id?r.event_id:_e();if(!this._client)return nt.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,yt(x({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n&&n.event_id?n.event_id:_e();if(!this._client)return nt.warn("No client configured on scope - will not capture message!"),i;let s=new Error(e);return this._client.captureMessage(e,r,yt(x({originalException:e,syntheticException:s},n),{event_id:i}),this),i}captureEvent(e,r){let n=r&&r.event_id?r.event_id:_e();return this._client?(this._client.captureEvent(e,yt(x({},r),{event_id:n}),this),n):(nt.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)}},ze=og;function ag(){return la("defaultCurrentScope",()=>new ze)}function cg(){return la("defaultIsolationScope",()=>new ze)}var lg=class{constructor(t,e){let r;t?r=t:r=new ze;let n;e?n=e:n=new ze,this._stack=[{scope:r}],this._isolationScope=n}withScope(t){let e=this._pushScope(),r;try{r=t(e)}catch(n){throw this._popScope(),n}return is(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Jr(){let t=as(),e=da(t);return e.stack=e.stack||new lg(ag(),cg())}function ug(t){return Jr().withScope(t)}function hg(t,e){let r=Jr();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function Vc(t){return Jr().withScope(()=>t(Jr().getIsolationScope()))}function pg(){return{withIsolationScope:Vc,withScope:ug,withSetScope:hg,withSetIsolationScope:(t,e)=>Vc(e),getCurrentScope:()=>Jr().getScope(),getIsolationScope:()=>Jr().getIsolationScope()}}function fa(t){let e=da(t);return e.acs?e.acs:pg()}function ga(){let t=as();return fa(t).getCurrentScope()}function Mu(){let t=as();return fa(t).getIsolationScope()}function dg(){return la("globalScope",()=>new ze)}function fg(...t){let e=as(),r=fa(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function ie(){return ga().getClient()}var gg="_sentryMetrics";function mg(t){let e=t[gg];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(ve(i));return r}var yg="sentry.source",vg="sentry.sample_rate",wg="sentry.op",bg="sentry.origin",_g=1;function Eg(t){let{spanId:e,traceId:r}=t.spanContext(),{parent_span_id:n}=$i(t);return ve({parent_span_id:n,span_id:e,trace_id:r})}function qc(t){return typeof t=="number"?Wc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Wc(t.getTime()):sr()}function Wc(t){return t>9999999999?t/1e3:t}function $i(t){if(Ig(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if(Sg(t)){let{attributes:n,startTime:i,name:s,endTime:o,parentSpanId:c,status:l}=t;return ve({span_id:e,trace_id:r,data:n,description:s,parent_span_id:c,start_timestamp:qc(i),timestamp:qc(o)||void 0,status:Tg(l),op:n[wg],origin:n[bg],_metrics_summary:mg(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function Sg(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Ig(t){return typeof t.getSpanJSON=="function"}function Cg(t){let{traceFlags:e}=t.spanContext();return e===_g}function Tg(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var xg="_sentryRootSpan";function Uu(t){return t[xg]||t}var Bu="production",Dg="_frozenDsc";function ju(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=ve({environment:r.environment||Bu,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function Ag(t){let e=ie();if(!e)return{};let r=ju($i(t).trace_id||"",e),n=Uu(t),i=n[Dg];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),c=o&&Wf(o);if(c)return c;let l=$i(n),p=l.data||{},d=p[vg];d!=null&&(r.sample_rate=`${d}`);let h=p[yg],b=l.description;return h!=="url"&&b&&(r.transaction=b),r.sampled=String(Cg(n)),e.emit("createDsc",r,n),r}function Ng(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){Ct&&nt.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function Og(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 kg(t,e,r,n){let i=Ru(r),s=x(x({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:os(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return ti(s,[o])}function Pg(t,e,r,n){let i=Ru(r),s=t.type&&t.type!=="replay_event"?t.type:"event";Og(t,r&&r.sdk);let o=Qf(t,i,n,e);return delete t.sdkProcessingMetadata,ti(o,[[{type:s},t]])}function So(t,e,r,n=0){return new Zn((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let c=o(x({},e),r);Ct&&o.id&&c===null&&nt.log(`Event processor "${o.id}" dropped event`),is(c)?c.then(l=>So(t,l,r,n+1).then(i)).then(null,s):So(t,c,r,n+1).then(i).then(null,s)}})}function Rg(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;Lg(t,e),n&&Bg(t,n),jg(t,r),Mg(t,i),Ug(t,s)}function Gc(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:d,attachments:h,propagationContext:b,transactionName:v,span:w}=e;vn(t,"extra",r),vn(t,"tags",n),vn(t,"user",i),vn(t,"contexts",s),vn(t,"sdkProcessingMetadata",c),o&&(t.level=o),v&&(t.transactionName=v),w&&(t.span=w),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext=x(x({},t.propagationContext),b)}function vn(t,e,r){if(r&&Object.keys(r).length){t[e]=x({},t[e]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[e][n]=r[n])}}function Lg(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:c}=e,l=ve(r);l&&Object.keys(l).length&&(t.extra=x(x({},l),t.extra));let p=ve(n);p&&Object.keys(p).length&&(t.tags=x(x({},p),t.tags));let d=ve(i);d&&Object.keys(d).length&&(t.user=x(x({},d),t.user));let h=ve(s);h&&Object.keys(h).length&&(t.contexts=x(x({},h),t.contexts)),o&&(t.level=o),c&&t.type!=="transaction"&&(t.transaction=c)}function Mg(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Ug(t,e){t.sdkProcessingMetadata=x(x({},t.sdkProcessingMetadata),e)}function Bg(t,e){t.contexts=x({trace:Eg(e)},t.contexts),t.sdkProcessingMetadata=x({dynamicSamplingContext:Ag(e)},t.sdkProcessingMetadata);let r=Uu(e),n=$i(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function jg(t,e){t.fingerprint=t.fingerprint?Lf(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function $g(t,e,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:c=1e3}=t,l=yt(x({},e),{event_id:e.event_id||r.event_id||_e(),timestamp:e.timestamp||Qn()}),p=r.integrations||t.integrations.map(_=>_.name);Fg(l,t),qg(l,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Hg(l,t.stackParser);let d=Gg(n,r.captureContext);r.mechanism&&Hn(l,r.mechanism);let h=i?i.getEventProcessors():[],b=dg().getScopeData();if(s){let _=s.getScopeData();Gc(b,_)}if(d){let _=d.getScopeData();Gc(b,_)}let v=[...r.attachments||[],...b.attachments];v.length&&(r.attachments=v),Rg(l,b);let w=[...h,...b.eventProcessors];return So(w,l,r).then(_=>(_&&Vg(_),typeof o=="number"&&o>0?Wg(_,o,c):_))}function Fg(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?r:Bu),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=qr(t.message,s));let o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=qr(o.value,s));let c=t.request;c&&c.url&&(c.url=qr(c.url,s))}var zc=new WeakMap;function Hg(t,e){let r=ht._sentryDebugIds;if(!r)return;let n,i=zc.get(e);i?n=i:(n=new Map,zc.set(e,n));let s=Object.entries(r).reduce((o,[c,l])=>{let p,d=n.get(c);d?p=d:(p=e(c),n.set(c,p));for(let h=p.length-1;h>=0;h--){let b=p[h];if(b.filename){o[b.filename]=l;break}}return o},{});try{t.exception.values.forEach(o=>{o.stacktrace.frames.forEach(c=>{c.filename&&(c.debug_id=s[c.filename])})})}catch{}}function Vg(t){let e={};try{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)})})}catch{}if(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 qg(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function Wg(t,e,r){if(!t)return null;let n=x(x(x(x(x({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>x(x({},i),i.data&&{data:tr(i.data,e,r)}))}),t.user&&{user:tr(t.user,e,r)}),t.contexts&&{contexts:tr(t.contexts,e,r)}),t.extra&&{extra:tr(t.extra,e,r)});return t.contexts&&t.contexts.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=tr(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>x(x({},i),i.data&&{data:tr(i.data,e,r)}))),n}function Gg(t,e){if(!e)return t;let r=t?t.clone():new ze;return r.update(e),r}function zg(t){if(t)return Yg(t)?{captureContext:t}:Jg(t)?{captureContext:t}:t}function Yg(t){return t instanceof ze||typeof t=="function"}var Kg=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Jg(t){return Object.keys(t).some(e=>Kg.includes(e))}function Xg(t,e){return ga().captureException(t,zg(e))}function $u(t,e){return ga().captureEvent(t,e)}var Qg="7";function Zg(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function tm(t){return`${Zg(t)}${t.projectId}/envelope/`}function em(t,e){return mf(x({sentry_key:t.publicKey,sentry_version:Qg},e&&{sentry_client:`${e.name}/${e.version}`}))}function rm(t,e,r){return e||`${tm(t)}?${em(t,r)}`}var Yc=[];function nm(t,e){let r={};return e.forEach(n=>{n&&Fu(t,n,r)}),r}function Kc(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function Fu(t,e,r){if(r[e.name]){Ct&&nt.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Yc.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Yc.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,s)=>n(i,s,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((s,o)=>n(s,o,t),{id:e.name});t.addEventProcessor(i)}Ct&&nt.log(`Integration installed: ${e.name}`)}var Jc="Not capturing exception because it's already been captured.",im=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=gf(t.dsn):Ct&&nt.warn("No DSN provided, client will not send events."),this._dsn){let e=rm(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport(yt(x({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},t.transportOptions),{url:e}))}}captureException(t,e,r){let n=_e();if(Mc(t))return Ct&&nt.log(Jc),n;let i=x({event_id:n},e);return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(t,e,r,n){let i=x({event_id:_e()},r),s=aa(t)?t:String(t),o=ca(t)?this.eventFromMessage(s,e,i):this.eventFromException(t,i);return this._process(o.then(c=>this._captureEvent(c,i,n))),i.event_id}captureEvent(t,e,r){let n=_e();if(e&&e.originalException&&Mc(e.originalException))return Ct&&nt.log(Jc),n;let i=x({event_id:n},e),s=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,i,s||r)),i.event_id}captureSession(t){typeof t.release!="string"?Ct&&nt.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),_o(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){let e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then(r=>e.flush(t).then(n=>r&&n))):Tr(!0)}close(t){return this.flush(t).then(e=>(this.getOptions().enabled=!1,this.emit("close"),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let e=this._integrations[t.name];Fu(this,t,this._integrations),e||Kc(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=Pg(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=zf(r,Jf(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let e=kg(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,r){if(this._options.sendClientReports){let n=`${t}:${e}`;Ct&&nt.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(t,e){let r=this._hooks[t]=this._hooks[t]||[];return r.push(e),()=>{let n=r.indexOf(e);n>-1&&r.splice(n,1)}}emit(t,...e){let r=this._hooks[t];r&&r.forEach(n=>n(...e))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,e=>(Ct&&nt.error("Error while sending event:",e),e)):(Ct&&nt.error("Transport disabled"),Tr({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=nm(this,t),Kc(this,t)}_updateSessionFromEvent(t,e){let r=!1,n=!1,i=e.exception&&e.exception.values;if(i){n=!0;for(let o of i){let c=o.mechanism;if(c&&c.handled===!1){r=!0;break}}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(_o(t,yt(x({},r&&{status:"crashed"}),{errors:t.errors||Number(n||r)})),this.captureSession(t))}_isClientDoneProcessing(t){return new Zn(e=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),e(!0)):(r+=n,t&&r>=t&&(clearInterval(i),e(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,e,r,n=Mu()){let i=this.getOptions(),s=Object.keys(this._integrations);return!e.integrations&&s.length>0&&(e.integrations=s),this.emit("preprocessEvent",t,e),t.type||n.setLastEventId(t.event_id||e.event_id),$g(i,t,e,r,this,n).then(o=>{if(o===null)return o;let c=x(x({},n.getPropagationContext()),r?r.getPropagationContext():void 0);if(!(o.contexts&&o.contexts.trace)&&c){let{traceId:l,spanId:p,parentSpanId:d,dsc:h}=c;o.contexts=x({trace:ve({trace_id:l,span_id:p,parent_span_id:d})},o.contexts);let b=h||ju(l,this);o.sdkProcessingMetadata=x({dynamicSamplingContext:b},o.sdkProcessingMetadata)}return o})}_captureEvent(t,e={},r){return this._processEvent(t,e,r).then(n=>n.event_id,n=>{if(Ct){let i=n;i.logLevel==="log"?nt.log(i.message):nt.warn(i)}})}_processEvent(t,e,r){let n=this.getOptions(),{sampleRate:i}=n,s=Io(t),o=Hu(t),c=t.type||"error",l=`before send for type \`${c}\``,p=typeof i>"u"?void 0:Ng(i);if(o&&typeof p=="number"&&Math.random()>p)return this.recordDroppedEvent("sample_rate","error",t),ji(new xe(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let d=c==="replay_event"?"replay":c,h=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,r,h).then(b=>{if(b===null)throw this.recordDroppedEvent("event_processor",d,t),new xe("An event processor returned `null`, will not send event.","log");if(e.data&&e.data.__sentry__===!0)return b;let v=om(this,n,b,e);return sm(v,l)}).then(b=>{if(b===null){if(this.recordDroppedEvent("before_send",d,t),Io(t)){let _=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+_}throw new xe(`${l} returned \`null\`, will not send event.`,"log")}let v=r&&r.getSession();!s&&v&&this._updateSessionFromEvent(v,b);let w=b.transaction_info;if(s&&w&&b.transaction!==t.transaction){let _="custom";b.transaction_info=yt(x({},w),{source:_})}return this.sendEvent(b,e),b}).then(null,b=>{throw b instanceof xe?b:(this.captureException(b,{data:{__sentry__:!0},originalException:b}),new xe(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
23
|
+
Reason: ${b}`))})}_process(t){this._numProcessing++,t.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([e,r])=>{let[n,i]=e.split(":");return{reason:n,category:i,quantity:r}})}};function sm(t,e){let r=`${e} must return \`null\` or a valid event.`;if(is(t))return t.then(n=>{if(!Kr(n)&&n!==null)throw new xe(r);return n},n=>{throw new xe(`${e} rejected with ${n}`)});if(!Kr(t)&&t!==null)throw new xe(r);return t}function om(t,e,r,n){let{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:o}=e;if(Hu(r)&&i)return i(r,n);if(Io(r)){if(r.spans&&o){let c=[];for(let l of r.spans){let p=o(l);p?c.push(p):t.recordDroppedEvent("before_send","span")}r.spans=c}if(s)return s(r,n)}return r}function Hu(t){return t.type===void 0}function Io(t){return t.type==="transaction"}var am=64;function cm(t,e,r=$f(t.bufferSize||am)){let n={},i=o=>r.drain(o);function s(o){let c=[];if(Bc(o,(h,b)=>{let v=jc(b);if(rg(n,v)){let w=Xc(h,b);t.recordDroppedEvent("ratelimit_backoff",v,w)}else c.push(h)}),c.length===0)return Tr({});let l=ti(o[0],c),p=h=>{Bc(l,(b,v)=>{let w=Xc(b,v);t.recordDroppedEvent(h,jc(v),w)})},d=()=>e({body:Yf(l)}).then(h=>(h.statusCode!==void 0&&(h.statusCode<200||h.statusCode>=300)&&Ct&&nt.warn(`Sentry responded with status code ${h.statusCode} to sent event.`),n=ng(n,h),h),h=>{throw p("network_error"),h});return r.add(d).then(h=>h,h=>{if(h instanceof xe)return Ct&&nt.error("Skipped sending event because buffer is full."),p("queue_overflow"),Tr({});throw h})}return{send:s,flush:i}}function Xc(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function lm(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(s=>({name:`${n}:@sentry/${s}`,version:wr})),version:wr}),t._metadata=i}var um=100;function xr(t,e){let r=ie(),n=Mu();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:s=um}=r.getOptions();if(s<=0)return;let o=Qn(),c=x({timestamp:o},t),l=i?ha(()=>i(c,e)):c;l!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",l,e),n.addBreadcrumb(l,s))}var Qc,hm="FunctionToString",Zc=new WeakMap,pm=()=>({name:hm,setupOnce(){Qc=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=pa(this),r=Zc.has(ie())&&e!==void 0?e:this;return Qc.apply(r,t)}}catch{}},setup(t){Zc.set(t,!0)}}),dm=pm,fm=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",`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"],gm="InboundFilters",mm=(t={})=>({name:gm,processEvent(e,r,n){let i=n.getOptions(),s=vm(t,i);return wm(e,s)?null:e}}),ym=mm;function vm(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:fm],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function wm(t,e){return e.ignoreInternal&&Cm(t)?(Ct&&nt.warn(`Event dropped due to being internal Sentry Error.
|
|
24
|
+
Event: ${Ze(t)}`),!0):bm(t,e.ignoreErrors)?(Ct&&nt.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
25
|
+
Event: ${Ze(t)}`),!0):xm(t)?(Ct&&nt.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
26
|
+
Event: ${Ze(t)}`),!0):_m(t,e.ignoreTransactions)?(Ct&&nt.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
27
|
+
Event: ${Ze(t)}`),!0):Em(t,e.denyUrls)?(Ct&&nt.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
28
|
+
Event: ${Ze(t)}.
|
|
29
|
+
Url: ${Fi(t)}`),!0):Sm(t,e.allowUrls)?!1:(Ct&&nt.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
30
|
+
Event: ${Ze(t)}.
|
|
31
|
+
Url: ${Fi(t)}`),!0)}function bm(t,e){return t.type||!e||!e.length?!1:Im(t).some(r=>ss(r,e))}function _m(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?ss(r,e):!1}function Em(t,e){if(!e||!e.length)return!1;let r=Fi(t);return r?ss(r,e):!1}function Sm(t,e){if(!e||!e.length)return!0;let r=Fi(t);return r?ss(r,e):!0}function Im(t){let e=[];t.message&&e.push(t.message);let r;try{r=t.exception.values[t.exception.values.length-1]}catch{}return r&&r.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`)),e}function Cm(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function Tm(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 Fi(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?Tm(e):null}catch{return Ct&&nt.error(`Cannot extract url for event ${Ze(t)}`),null}}function xm(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}var Dm="Dedupe",Am=()=>{let t;return{name:Dm,processEvent(e){if(e.type)return e;try{if(Om(e,t))return Ct&&nt.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Nm=Am;function Om(t,e){return e?!!(km(t,e)||Pm(t,e)):!1}function km(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!qu(t,e)||!Vu(t,e))}function Pm(t,e){let r=tl(e),n=tl(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!qu(t,e)||!Vu(t,e))}function Vu(t,e){let r=Pc(t),n=Pc(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 s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function qu(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 tl(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Ft=ht,Co=0;function Wu(){return Co>0}function Rm(){Co++,setTimeout(()=>{Co--})}function Xr(t,e={},r){if(typeof t!="function")return t;try{let i=t.__sentry_wrapped__;if(i)return i;if(pa(t))return t}catch{return t}let n=function(){let i=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);let s=i.map(o=>Xr(o,e));return t.apply(this,s)}catch(s){throw Rm(),fg(o=>{o.addEventProcessor(c=>(e.mechanism&&(vo(c,void 0,void 0),Hn(c,e.mechanism)),c.extra=yt(x({},c.extra),{arguments:i}),c)),Xg(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}Au(n,t),Ir(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Hr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function ma(t,e){let r=ya(t,e),n={type:e&&e.name,value:jm(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Lm(t,e,r,n){let i=ie(),s=i&&i.getOptions().normalizeDepth,o=qm(e),c={__serialized__:Pu(e,s)};if(o)return{exception:{values:[ma(t,o)]},extra:c};let l={exception:{values:[{type:ns(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Hm(e,{isUnhandledRejection:n})}]},extra:c};if(r){let p=ya(t,r);p.length&&(l.exception.values[0].stacktrace={frames:p})}return l}function Ls(t,e){return{exception:{values:[ma(t,e)]}}}function ya(t,e){let r=e.stacktrace||e.stack||"",n=Um(e),i=Bm(e);try{return t(r,n,i)}catch{}return[]}var Mm=/Minified React error #\d+;/i;function Um(t){return t&&Mm.test(t.message)?1:0}function Bm(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function jm(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function $m(t,e,r,n){let i=r&&r.syntheticException||void 0,s=va(t,e,i,n);return Hn(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),Tr(s)}function Fm(t,e,r="info",n,i){let s=n&&n.syntheticException||void 0,o=To(t,e,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),Tr(o)}function va(t,e,r,n,i){let s;if(Cu(e)&&e.error)return Ls(t,e.error);if(Cc(e)||Xd(e)){let o=e;if("stack"in e)s=Ls(t,e);else{let c=o.name||(Cc(o)?"DOMError":"DOMException"),l=o.message?`${c}: ${o.message}`:c;s=To(t,l,r,n),vo(s,l)}return"code"in o&&(s.tags=yt(x({},s.tags),{"DOMException.code":`${o.code}`})),s}return oa(e)?Ls(t,e):Kr(e)||ns(e)?(s=Lm(t,e,r,i),Hn(s,{synthetic:!0}),s):(s=To(t,e,r,n),vo(s,`${e}`,void 0),Hn(s,{synthetic:!0}),s)}function To(t,e,r,n){let i={};if(n&&r){let s=ya(t,r);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]})}if(aa(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function Hm(t,{isUnhandledRejection:e}){let r=yf(t),n=e?"promise rejection":"exception";return Cu(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:ns(t)?`Event \`${Vm(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Vm(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function qm(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function Wm(t,{metadata:e,tunnel:r,dsn:n}){let i=x(x({event_id:t.event_id,sent_at:new Date().toISOString()},e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}}),!!r&&!!n&&{dsn:os(n)}),s=Gm(t);return ti(i,[s])}function Gm(t){return[{type:"user_report"},t]}var zm=class extends im{constructor(t){let e=x({parentSpanIsAlwaysRootSpan:!0},t),r=Ft.SENTRY_SDK_SOURCE||Pf();lm(e,"browser",["browser"],r),super(e),e.sendClientReports&&Ft.document&&Ft.document.addEventListener("visibilitychange",()=>{Ft.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,e){return $m(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return Fm(this._options.stackParser,t,e,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){Hr&&nt.warn("SDK not enabled, will not capture user feedback.");return}let e=Wm(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(e)}_prepareEvent(t,e,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,r)}_flushOutcomes(){let t=this._clearOutcomes();if(t.length===0){Hr&&nt.log("No outcomes to send");return}if(!this._dsn){Hr&&nt.log("No dsn provided, will not send outcomes");return}Hr&&nt.log("Sending outcomes:",t);let e=Zf(t,this._options.tunnel&&os(this._dsn));this.sendEnvelope(e)}},Ym=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,zt=ht,Km=1e3,el,xo,Do;function Jm(t){let e="dom";Or(e,t),kr(e,Xm)}function Xm(){if(!zt.document)return;let t=be.bind(null,"dom"),e=rl(t,!0);zt.document.addEventListener("click",e,!1),zt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=zt[r]&&zt[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Ht(n,"addEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let l=this,p=l.__sentry_instrumentation_handlers__=l.__sentry_instrumentation_handlers__||{},d=p[s]=p[s]||{refCount:0};if(!d.handler){let h=rl(t);d.handler=h,i.call(this,s,h,c)}d.refCount++}catch{}return i.call(this,s,o,c)}}),Ht(n,"removeEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let l=this,p=l.__sentry_instrumentation_handlers__||{},d=p[s];d&&(d.refCount--,d.refCount<=0&&(i.call(this,s,d.handler,c),d.handler=void 0,delete p[s]),Object.keys(p).length===0&&delete l.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,c)}}))})}function Qm(t){if(t.type!==xo)return!1;try{if(!t.target||t.target._sentryId!==Do)return!1}catch{}return!0}function Zm(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function rl(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=ty(r);if(Zm(r.type,n))return;Ir(r,"_sentryCaptured",!0),n&&!n._sentryId&&Ir(n,"_sentryId",_e());let i=r.type==="keypress"?"input":r.type;Qm(r)||(t({event:r,name:i,global:e}),xo=r.type,Do=n?n._sentryId:void 0),clearTimeout(el),el=zt.setTimeout(()=>{Do=void 0,xo=void 0},Km)}}function ty(t){try{return t.target}catch{return null}}var wi;function ey(t){let e="history";Or(e,t),kr(e,ry)}function ry(){if(!ig())return;let t=zt.onpopstate;zt.onpopstate=function(...r){let n=zt.location.href,i=wi;if(wi=n,be("history",{from:i,to:n}),t)try{return t.apply(this,r)}catch{}};function e(r){return function(...n){let i=n.length>2?n[2]:void 0;if(i){let s=wi,o=String(i);wi=o,be("history",{from:s,to:o})}return r.apply(this,n)}}Ht(zt.history,"pushState",e),Ht(zt.history,"replaceState",e)}var ki={};function ny(t){let e=ki[t];if(e)return e;let r=zt[t];if(mo(r))return ki[t]=r.bind(zt);let n=zt.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch(i){Ym&&nt.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(ki[t]=r.bind(zt))}function nl(t){ki[t]=void 0}var On="__sentry_xhr_v3__";function iy(t){let e="xhr";Or(e,t),kr(e,sy)}function sy(){if(!zt.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Ht(t,"open",function(e){return function(...r){let n=sr()*1e3,i=He(r[0])?r[0].toUpperCase():void 0,s=oy(r[1]);if(!i||!s)return e.apply(this,r);this[On]={method:i,url:s,request_headers:{}},i==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let o=()=>{let c=this[On];if(c&&this.readyState===4){try{c.status_code=this.status}catch{}let l={endTimestamp:sr()*1e3,startTimestamp:n,xhr:this};be("xhr",l)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Ht(this,"onreadystatechange",function(c){return function(...l){return o(),c.apply(this,l)}}):this.addEventListener("readystatechange",o),Ht(this,"setRequestHeader",function(c){return function(...l){let[p,d]=l,h=this[On];return h&&He(p)&&He(d)&&(h.request_headers[p.toLowerCase()]=d),c.apply(this,l)}}),e.apply(this,r)}}),Ht(t,"send",function(e){return function(...r){let n=this[On];if(!n)return e.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:sr()*1e3,xhr:this};return be("xhr",i),e.apply(this,r)}})}function oy(t){if(He(t))return t;try{return t.toString()}catch{}}function ay(t,e=ny("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let c=x({body:s.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return nl("fetch"),ji("No fetch implementation available");try{return e(t.url,c).then(l=>(r-=o,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return nl("fetch"),r-=o,n--,ji(l)}}return cm(t,i)}var cy=30,ly=50;function Ao(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 uy=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hy=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,py=/\((\S*)(?::(\d+))(?::(\d+))\)/,dy=t=>{let e=uy.exec(t);if(e){let[,n,i,s]=e;return Ao(n,Cr,+i,+s)}let r=hy.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=py.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=Gu(r[1]||Cr,r[2]);return Ao(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},fy=[cy,dy],gy=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,my=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,yy=t=>{let e=gy.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=my.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],n=e[1]||Cr;return[n,r]=Gu(n,r),Ao(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},vy=[ly,yy],wy=[fy,vy],by=wf(...wy),Gu=(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]},bi=1024,_y="Breadcrumbs",Ey=(t={})=>{let e=x({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:_y,setup(r){e.console&&_f(Ty(r)),e.dom&&Jm(Cy(r,e.dom)),e.xhr&&iy(xy(r)),e.fetch&&Tf(Dy(r)),e.history&&ey(Ay(r)),e.sentry&&r.on("beforeSendEvent",Iy(r))}}},Sy=Ey;function Iy(t){return function(e){ie()===t&&xr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:Ze(e)},{event:e})}}function Cy(t,e){return function(r){if(ie()!==t)return;let n,i,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>bi&&(Hr&&nt.warn(`\`dom.maxStringLength\` cannot exceed ${bi}, but a value of ${o} was configured. Sentry will use ${bi} instead.`),o=bi),typeof s=="string"&&(s=[s]);try{let l=r.event,p=Ny(l)?l.target:l;n=xu(p,{keyAttrs:s,maxStringLength:o}),i=cf(p)}catch{n="<unknown>"}if(n.length===0)return;let c={category:`ui.${r.name}`,message:n};i&&(c.data={"ui.component_name":i}),xr(c,{event:r.event,name:r.name,global:r.global})}}function Ty(t){return function(e){if(ie()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:Hf(e.level),message:Tc(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${Tc(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;xr(r,{input:e.args,level:e.level})}}function xy(t){return function(e){if(ie()!==t)return;let{startTimestamp:r,endTimestamp:n}=e,i=e.xhr[On];if(!r||!n||!i)return;let{method:s,url:o,status_code:c,body:l}=i,p={method:s,url:o,status_code:c},d={xhr:e.xhr,input:l,startTimestamp:r,endTimestamp:n};xr({category:"xhr",data:p,type:"http"},d)}}function Dy(t){return function(e){if(ie()!==t)return;let{startTimestamp:r,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.error){let i=e.fetchData,s={data:e.error,input:e.args,startTimestamp:r,endTimestamp:n};xr({category:"fetch",data:i,level:"error",type:"http"},s)}else{let i=e.response,s=yt(x({},e.fetchData),{status_code:i&&i.status}),o={input:e.args,response:i,startTimestamp:r,endTimestamp:n};xr({category:"fetch",data:s,type:"http"},o)}}}function Ay(t){return function(e){if(ie()!==t)return;let r=e.from,n=e.to,i=Rs(Ft.location.href),s=r?Rs(r):void 0,o=Rs(n);(!s||!s.path)&&(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),xr({category:"navigation",data:{from:r,to:n}})}}function Ny(t){return!!t&&!!t.target}var Oy=["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"],ky="BrowserApiErrors",Py=(t={})=>{let e=x({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:ky,setupOnce(){e.setTimeout&&Ht(Ft,"setTimeout",il),e.setInterval&&Ht(Ft,"setInterval",il),e.requestAnimationFrame&&Ht(Ft,"requestAnimationFrame",Ly),e.XMLHttpRequest&&"XMLHttpRequest"in Ft&&Ht(XMLHttpRequest.prototype,"send",My);let r=e.eventTarget;r&&(Array.isArray(r)?r:Oy).forEach(Uy)}}},Ry=Py;function il(t){return function(...e){let r=e[0];return e[0]=Xr(r,{mechanism:{data:{function:ar(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function Ly(t){return function(e){return t.apply(this,[Xr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:ar(t)},handled:!1,type:"instrument"}})])}}function My(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Ht(r,n,function(i){let s={mechanism:{data:{function:n,handler:ar(i)},handled:!1,type:"instrument"}},o=pa(i);return o&&(s.mechanism.data.handler=ar(o)),Xr(i,s)})}),t.apply(this,e)}}function Uy(t){let e=Ft,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Ht(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=Xr(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:ar(s),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,Xr(s,{mechanism:{data:{function:"addEventListener",handler:ar(s),target:t},handled:!1,type:"instrument"}}),o])}}),Ht(r,"removeEventListener",function(n){return function(i,s,o){let c=s;try{let l=c&&c.__sentry_wrapped__;l&&n.call(this,i,l,o)}catch{}return n.call(this,i,c,o)}}))}var By="GlobalHandlers",jy=(t={})=>{let e=x({onerror:!0,onunhandledrejection:!0},t);return{name:By,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(Fy(r),sl("onerror")),e.onunhandledrejection&&(Hy(r),sl("onunhandledrejection"))}}},$y=jy;function Fy(t){Af(e=>{let{stackParser:r,attachStacktrace:n}=zu();if(ie()!==t||Wu())return;let{msg:i,url:s,line:o,column:c,error:l}=e,p=Wy(va(r,l||i,void 0,n,!1),s,o,c);p.level="error",$u(p,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function Hy(t){Of(e=>{let{stackParser:r,attachStacktrace:n}=zu();if(ie()!==t||Wu())return;let i=Vy(e),s=ca(i)?qy(i):va(r,i,void 0,n,!0);s.level="error",$u(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Vy(t){if(ca(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 qy(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function Wy(t,e,r,n){let i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},c=o.stacktrace=o.stacktrace||{},l=c.frames=c.frames||[],p=isNaN(parseInt(n,10))?void 0:n,d=isNaN(parseInt(r,10))?void 0:r,h=He(e)&&e.length>0?e:af();return l.length===0&&l.push({colno:p,filename:h,function:Cr,in_app:!0,lineno:d}),t}function sl(t){Hr&&nt.log(`Global Handler attached: ${t}`)}function zu(){let t=ie();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var Gy=()=>({name:"HttpContext",preprocessEvent(t){if(!Ft.navigator&&!Ft.location&&!Ft.document)return;let e=t.request&&t.request.url||Ft.location&&Ft.location.href,{referrer:r}=Ft.document||{},{userAgent:n}=Ft.navigator||{},i=x(x(x({},t.request&&t.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),s=yt(x(x({},t.request),e&&{url:e}),{headers:i});t.request=s}}),zy="cause",Yy=5,Ky="LinkedErrors",Jy=(t={})=>{let e=t.limit||Yy,r=t.key||zy;return{name:Ky,preprocessEvent(n,i,s){let o=s.getOptions();rf(ma,o.stackParser,o.maxValueLength,r,e,n,i)}}},Xy=Jy;function Qy(t){return[ym(),dm(),Ry(),Sy(),$y(),Xy(),Nm(),Gy()]}var Kt=class Yu{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Yu),this.INSTANCE}captureError(e,r,n){T.error(`${r}:`,e);let i=this.getNewScope(n);i.setTag("operation",r),i.captureException(e)}captureMessage(e,r,n){this.getNewScope(n).captureMessage(e,r??"error")}setGlobalContext(e,r){this.contexts[e]=x({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e){e??={};let{extra:r,tags:n}=e,i=new ze;if(i.setClient(this.client),i.setUser(this.user),e.triggerContext&&!e.engagementTrigger&&(e.engagementTrigger=e.triggerContext.triggerData),e.engagementTrigger){let s=e.engagementTrigger;i.setTags({"engagement.id":s.engagementID,"engagement.short_id":s.shortID,"engagement.objective":s.objective,"engagement.delivery_type":s.onsiteDeliveryType,"engagement.content_id":s.contentID,"engagement.variation":s.variation,"engagement.currency":s.currency})}return r&&i.setExtras(r),this.tags&&i.setTags(this.tags),n&&i.setTags(n),Object.keys(this.contexts).forEach(s=>{i.setContext(s,this.contexts[s])}),i.setTag("language",navigator.language),i.setTag("timezone",rv()),this.addShopifyTags(i),i}addShopifyTags(e){window.Shopify&&(e.setTag("shopify.shop",window.Shopify.shop),e.setTag("shopify.currency",window.Shopify.currency?.active),e.setTag("shopify.locale",window.Shopify.locale),e.setTag("theme.schema_name",window.Shopify.theme?.schema_name),e.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}init(){let e=Qy({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new zm({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:ay,stackParser:by,integrations:e,environment:We.mode,release:`web-sdk@${H.SDK_VERSION}`,debug:We.debug}),this.client.init()}},ot=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"},ol=ke(Pd());function wa(t){return ol.default.createInstance({name:"lc",storeName:t,driver:ol.default.LOCALSTORAGE})}var ba=class{static storage;static async get(t,e){return await this.storage?.getItem(t)??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},te=class extends ba{static storeName="ses";static{this.storage=wa(this.storeName)}},Lt=class extends ba{static storeName="usr";static{this.storage=wa(this.storeName)}},Zy=class{static format(t,e){let r=/{{\s*(\w+)\s*}}/;return e.replace(r,(n,i)=>{switch(i){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return n}})}static formatWithDelimiters(t,e=2,r=",",n="."){if(isNaN(t)||t==null)return"0";let i=(t/100).toFixed(e).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}},Ot=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(t){this._currencyCode=t}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(t){this.currentItem=new on(t)}};function Ku(t){try{return new URL(t)}catch{return}}function al(t){return!t||t==="null"||t==="undefined"}function tv(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function De(t,e){if(t==0&&e)return"Free";let r=Ot.get(),n=ne.get(),i=r.shopCurrencyCode||n.currency,s=r.currencyCode;s||T.warn("Currency code is not set in RuntimeData");let o=n.money?.format??r.moneyFormat,c;if(o&&i===s)c=Zy.format(t*100,o);else{let l;try{l=new Intl.NumberFormat(Ju(),{style:"currency",currency:s||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return Kt.getInstance().captureError(p,"format-currency",{extra:{currentCurrency:s,shopCurrency:i}}),""}c=l.format(t),c=c.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(c=c.concat(` ${s}`))}return c}function ev(t){return new Intl.NumberFormat(Ju(),{notation:"compact"}).format(t)}function Ju(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var _i;function rv(){if(_i)return _i;try{return _i=Intl.DateTimeFormat().resolvedOptions().timeZone,_i}catch{return""}}function _a(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function er(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 Xu(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let s=Math.min(100*2**n,5e3);if(await Jn.sleep(s),i=r.querySelectorAll(t),i.length)return T.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;T.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${s}ms.`),n++}return T.warn(`Max attempts reached. Element not found with ${t}.`),i}async function Hi(t,e=10,r=document){return(await Xu(t,e,r)).item(0)}function nv(t,e,r=document.body){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{(o===t||o.contains(t))&&(e(),n.disconnect())})})});n.observe(r,{childList:!0})}async function Qu(){let t=await Lt.get(ot.DEVICE_ID),e=await te.get(ot.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 kn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var cs,dt,Zu,th,mr,cl,eh,rh,nh,Ea,No,Oo,iv,Vn={},ih=[],sv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ls=Array.isArray;function je(t,e){for(var r in e)t[r]=e[r];return t}function Sa(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function sh(t,e,r){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?cs.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Pi(t,o,n,i,null)}function Pi(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Zu,__i:-1,__u:0};return i==null&&dt.vnode!=null&&dt.vnode(s),s}function cn(t){return t.children}function br(t,e){this.props=t,this.context=e}function Qr(t,e){if(e==null)return t.__?Qr(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"?Qr(t):null}function oh(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 oh(t)}}function ll(t){(!t.__d&&(t.__d=!0)&&mr.push(t)&&!Vi.__r++||cl!=dt.debounceRendering)&&((cl=dt.debounceRendering)||eh)(Vi)}function Vi(){for(var t,e,r,n,i,s,o,c=1;mr.length;)mr.length>c&&mr.sort(rh),t=mr.shift(),c=mr.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,s=[],o=[],e.__P&&((r=je({},n)).__v=n.__v+1,dt.vnode&&dt.vnode(r),Ia(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,s,i??Qr(n),!!(32&n.__u),o),r.__v=n.__v,r.__.__k[r.__i]=r,lh(s,r,o),r.__e!=i&&oh(r)));Vi.__r=0}function ah(t,e,r,n,i,s,o,c,l,p,d){var h,b,v,w,_,k,A=n&&n.__k||ih,B=e.length;for(l=ov(r,e,A,l,B),h=0;h<B;h++)(v=r.__k[h])!=null&&(b=v.__i==-1?Vn:A[v.__i]||Vn,v.__i=h,k=Ia(t,v,b,i,s,o,c,l,p,d),w=v.__e,v.ref&&b.ref!=v.ref&&(b.ref&&Ca(b.ref,null,v),d.push(v.ref,v.__c||w,v)),_==null&&w!=null&&(_=w),4&v.__u||b.__k===v.__k?l=ch(v,l,t):typeof v.type=="function"&&k!==void 0?l=k:w&&(l=w.nextSibling),v.__u&=-7);return r.__e=_,l}function ov(t,e,r,n,i){var s,o,c,l,p,d=r.length,h=d,b=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=s+b,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Pi(null,o,null,null,null):ls(o)?Pi(cn,{children:o},null,null,null):o.constructor==null&&o.__b>0?Pi(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,c=null,(p=o.__i=av(o,r,l,h))!=-1&&(h--,(c=r[p])&&(c.__u|=2)),c==null||c.__v==null?(p==-1&&(i>d?b--:i<d&&b++),typeof o.type!="function"&&(o.__u|=4)):p!=l&&(p==l-1?b--:p==l+1?b++:(p>l?b--:b++,o.__u|=4))):t.__k[s]=null;if(h)for(s=0;s<d;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=Qr(c)),hh(c,c));return n}function ch(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=ch(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Qr(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function av(t,e,r,n){var i,s,o=t.key,c=t.type,l=e[r];if(l===null&&t.key==null||l&&o==l.key&&c==l.type&&(2&l.__u)==0)return r;if(n>(l!=null&&(2&l.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<e.length;){if(i>=0){if((l=e[i])&&(2&l.__u)==0&&o==l.key&&c==l.type)return i;i--}if(s<e.length){if((l=e[s])&&(2&l.__u)==0&&o==l.key&&c==l.type)return s;s++}}return-1}function ul(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||sv.test(e)?r:r+"px"}function Ei(t,e,r,n,i){var s,o;t: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||ul(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||ul(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(nh,"$1")),o=e.toLowerCase(),e=o in t||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?n?r.u=n.u:(r.u=Ea,t.addEventListener(e,s?Oo:No,s)):t.removeEventListener(e,s?Oo:No,s);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 t}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function hl(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Ea++;else if(e.t<r.u)return;return r(dt.event?dt.event(e):e)}}}function Ia(t,e,r,n,i,s,o,c,l,p){var d,h,b,v,w,_,k,A,B,G,j,X,_t,Dt,q,rt,Q,tt=e.type;if(e.constructor!=null)return null;128&r.__u&&(l=!!(32&r.__u),s=[c=e.__e=r.__e]),(d=dt.__b)&&d(e);t:if(typeof tt=="function")try{if(A=e.props,B="prototype"in tt&&tt.prototype.render,G=(d=tt.contextType)&&n[d.__c],j=d?G?G.props.value:d.__:n,r.__c?k=(h=e.__c=r.__c).__=h.__E:(B?e.__c=h=new tt(A,j):(e.__c=h=new br(A,j),h.constructor=tt,h.render=lv),G&&G.sub(h),h.props=A,h.state||(h.state={}),h.context=j,h.__n=n,b=h.__d=!0,h.__h=[],h._sb=[]),B&&h.__s==null&&(h.__s=h.state),B&&tt.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=je({},h.__s)),je(h.__s,tt.getDerivedStateFromProps(A,h.__s))),v=h.props,w=h.state,h.__v=e,b)B&&tt.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),B&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(B&&tt.getDerivedStateFromProps==null&&A!==v&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(A,j),!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(A,h.__s,j)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(h.props=A,h.state=h.__s,h.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(lt){lt&&(lt.__=e)}),X=0;X<h._sb.length;X++)h.__h.push(h._sb[X]);h._sb=[],h.__h.length&&o.push(h);break t}h.componentWillUpdate!=null&&h.componentWillUpdate(A,h.__s,j),B&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(v,w,_)})}if(h.context=j,h.props=A,h.__P=t,h.__e=!1,_t=dt.__r,Dt=0,B){for(h.state=h.__s,h.__d=!1,_t&&_t(e),d=h.render(h.props,h.state,h.context),q=0;q<h._sb.length;q++)h.__h.push(h._sb[q]);h._sb=[]}else do h.__d=!1,_t&&_t(e),d=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++Dt<25);h.state=h.__s,h.getChildContext!=null&&(n=je(je({},n),h.getChildContext())),B&&!b&&h.getSnapshotBeforeUpdate!=null&&(_=h.getSnapshotBeforeUpdate(v,w)),rt=d,d!=null&&d.type===cn&&d.key==null&&(rt=uh(d.props.children)),c=ah(t,ls(rt)?rt:[rt],e,r,n,i,s,o,c,l,p),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),k&&(h.__E=h.__=null)}catch(lt){if(e.__v=null,l||s!=null)if(lt.then){for(e.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.__e=c}else for(Q=s.length;Q--;)Sa(s[Q]);else e.__e=r.__e,e.__k=r.__k;dt.__e(lt,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):c=e.__e=cv(r.__e,e,r,n,i,s,o,l,p);return(d=dt.diffed)&&d(e),128&e.__u?void 0:c}function lh(t,e,r){for(var n=0;n<r.length;n++)Ca(r[n],r[++n],r[++n]);dt.__c&&dt.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){dt.__e(s,i.__v)}})}function uh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:ls(t)?t.map(uh):je({},t)}function cv(t,e,r,n,i,s,o,c,l){var p,d,h,b,v,w,_,k=r.props,A=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"),s!=null){for(p=0;p<s.length;p++)if((v=s[p])&&"setAttribute"in v==!!B&&(B?v.localName==B:v.nodeType==3)){t=v,s[p]=null;break}}if(t==null){if(B==null)return document.createTextNode(A);t=document.createElementNS(i,B,A.is&&A),c&&(dt.__m&&dt.__m(e,s),c=!1),s=null}if(B==null)k===A||c&&t.data==A||(t.data=A);else{if(s=s&&cs.call(t.childNodes),k=r.props||Vn,!c&&s!=null)for(k={},p=0;p<t.attributes.length;p++)k[(v=t.attributes[p]).name]=v.value;for(p in k)if(v=k[p],p!="children"){if(p=="dangerouslySetInnerHTML")h=v;else if(!(p in A)){if(p=="value"&&"defaultValue"in A||p=="checked"&&"defaultChecked"in A)continue;Ei(t,p,null,v,i)}}for(p in A)v=A[p],p=="children"?b=v:p=="dangerouslySetInnerHTML"?d=v:p=="value"?w=v:p=="checked"?_=v:c&&typeof v!="function"||k[p]===v||Ei(t,p,v,k[p],i);if(d)c||h&&(d.__html==h.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(h&&(t.innerHTML=""),ah(e.type=="template"?t.content:t,ls(b)?b:[b],e,r,n,B=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Qr(r,0),c,l),s!=null)for(p=s.length;p--;)Sa(s[p]);c||(p="value",B=="progress"&&w==null?t.removeAttribute("value"):w!=null&&(w!==t[p]||B=="progress"&&!w||B=="option"&&w!=k[p])&&Ei(t,p,w,k[p],i),p="checked",_!=null&&_!=t[p]&&Ei(t,p,_,k[p],i))}return t}function Ca(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){dt.__e(i,r)}}function hh(t,e,r){var n,i;if(dt.unmount&&dt.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Ca(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){dt.__e(s,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&hh(n[i],e,r||typeof t.type!="function");r||Sa(t.__e),t.__c=t.__=t.__e=void 0}function lv(t,e,r){return this.constructor(t,r)}function uv(t,e,r){var n,i,s,o;e==document&&(e=document.documentElement),dt.__&&dt.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,s=[],o=[],Ia(e,t=(!n&&r||e).__k=sh(cn,null,[t]),i||Vn,Vn,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?cs.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),lh(s,t,o)}cs=ih.slice,dt={__e:function(t,e,r,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),o=i.__d),o)return i.__E=i}catch(c){t=c}throw t}},Zu=0,th=function(t){return t!=null&&t.constructor==null},br.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=je({},this.state),typeof t=="function"&&(t=t(je({},r),this.props)),t&&je(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),ll(this))},br.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ll(this))},br.prototype.render=cn,mr=[],eh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,rh=function(t,e){return t.__v.__b-e.__v.__b},Vi.__r=0,nh=/(PointerCapture)$|Capture$/i,Ea=0,No=hl(!1),Oo=hl(!0),iv=0;var ko,ee,Ms,pl,dl=0,ph=[],Mt=dt,fl=Mt.__b,gl=Mt.__r,ml=Mt.diffed,yl=Mt.__c,vl=Mt.unmount,wl=Mt.__;function hv(t,e){Mt.__h&&Mt.__h(ee,t,dl||e),dl=0;var r=ee.__H||(ee.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function dh(t,e){var r=hv(ko++,7);return fv(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function pv(){for(var t;t=ph.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Ri),t.__H.__h.forEach(Po),t.__H.__h=[]}catch(e){t.__H.__h=[],Mt.__e(e,t.__v)}}Mt.__b=function(t){ee=null,fl&&fl(t)},Mt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),wl&&wl(t,e)},Mt.__r=function(t){gl&&gl(t),ko=0;var e=(ee=t.__c).__H;e&&(Ms===ee?(e.__h=[],ee.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(Ri),e.__h.forEach(Po),e.__h=[],ko=0)),Ms=ee},Mt.diffed=function(t){ml&&ml(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(ph.push(e)!==1&&pl===Mt.requestAnimationFrame||((pl=Mt.requestAnimationFrame)||dv)(pv)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Ms=ee=null},Mt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Ri),r.__h=r.__h.filter(function(n){return!n.__||Po(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Mt.__e(n,r.__v)}}),yl&&yl(t,e)},Mt.unmount=function(t){vl&&vl(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Ri(n)}catch(i){e=i}}),r.__H=void 0,e&&Mt.__e(e,r.__v))};var bl=typeof requestAnimationFrame=="function";function dv(t){var e,r=function(){clearTimeout(n),bl&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);bl&&(e=requestAnimationFrame(r))}function Ri(t){var e=ee,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),ee=e}function Po(t){var e=ee;t.__c=t.__(),ee=e}function fv(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var gv=Symbol.for("preact-signals");function Ta(){if(Wr>1)Wr--;else{for(var t,e=!1;Un!==void 0;){var r=Un;for(Un=void 0,Ro++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&gh(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Ro=0,Wr--,e)throw t}}var wt=void 0,Un=void 0,Wr=0,Ro=0,qi=0;function fh(t){if(wt!==void 0){var e=t.n;if(e===void 0||e.t!==wt)return e={i:0,S:t,p:wt.s,n:void 0,t:wt,e:void 0,x:void 0,r:e},wt.s!==void 0&&(wt.s.n=e),wt.s=e,t.n=e,32&wt.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=wt.s,e.n=void 0,wt.s.n=e,wt.s=e),e}}function qt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}qt.prototype.brand=gv;qt.prototype.h=function(){return!0};qt.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)};qt.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)}};qt.prototype.subscribe=function(t){var e=this;return Je(function(){var r=e.value,n=wt;wt=void 0;try{t(r)}finally{wt=n}})};qt.prototype.valueOf=function(){return this.value};qt.prototype.toString=function(){return this.value+""};qt.prototype.toJSON=function(){return this.value};qt.prototype.peek=function(){var t=wt;wt=void 0;try{return this.value}finally{wt=t}};Object.defineProperty(qt.prototype,"value",{get:function(){var t=fh(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Ro>100)throw new Error("Cycle detected");this.v=t,this.i++,qi++,Wr++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Ta()}}}});function Dr(t){return new qt(t)}function gh(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 mh(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 yh(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 ln(t){qt.call(this,void 0),this.x=t,this.s=void 0,this.g=qi-1,this.f=4}(ln.prototype=new qt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===qi))return!0;if(this.g=qi,this.f|=1,this.i>0&&!gh(this))return this.f&=-2,!0;var t=wt;try{mh(this),wt=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 wt=t,yh(this),this.f&=-2,!0};ln.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)}qt.prototype.S.call(this,t)};ln.prototype.U=function(t){if(this.t!==void 0&&(qt.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)}};ln.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(ln.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=fh(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function mv(t){return new ln(t)}function vh(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Wr++;var r=wt;wt=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,xa(t),n}finally{wt=r,Ta()}}}function xa(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,vh(t)}function yv(t){if(wt!==this)throw new Error("Out-of-order effect");yh(this),wt=t,this.f&=-2,8&this.f&&xa(this),Ta()}function ei(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}ei.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()}};ei.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,vh(this),mh(this),Wr++;var t=wt;return wt=this,yv.bind(this,t)};ei.prototype.N=function(){2&this.f||(this.f|=2,this.o=Un,Un=this)};ei.prototype.d=function(){this.f|=8,1&this.f||xa(this)};function Je(t){var e=new ei(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Da,Us;function un(t,e){dt[t]=e.bind(null,dt[t]||function(){})}function Wi(t){Us&&Us(),Us=t&&t.S()}function wh(t){var e=this,r=t.data,n=wv(r);n.value=r;var i=dh(function(){for(var s=e.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return e.__$u.c=function(){var o,c=e.__$u.S(),l=i.value;c(),th(l)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=l},mv(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}wh.displayName="_st";Object.defineProperties(qt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:wh},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});un("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var s=n[i];s instanceof qt&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});un("__r",function(t,e){Wi();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return Je(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Da=n,Wi(r),t(e)});un("__e",function(t,e,r,n){Wi(),Da=void 0,t(e,r,n)});un("diffed",function(t,e){Wi(),Da=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var s=r.U;if(s)for(var o in s){var c=s[o];c!==void 0&&!(o in n)&&(c.d(),s[o]=void 0)}else r.U=s={};for(var l in n){var p=s[l],d=n[l];p===void 0?(p=vv(r,l,d,i),s[l]=p):p.o(d,i)}}}t(e)});function vv(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=Dr(r);return{o:function(o,c){s.value=o,n=c},d:Je(function(){var o=s.value.value;n[e]!==o&&(n[e]=o,i?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}un("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 s=n[i];s&&s.d()}}}}else{var o=e.__c;if(o){var c=o.__$u;c&&(o.__$u=void 0,c.d())}}t(e)});un("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});br.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 s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function wv(t){return dh(function(){return Dr(t)},[])}var bv=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},_v=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d}},Ev=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},us=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new bv(e))??[],this.link=t.link,this.price=new _v(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=Dr(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=Dr(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new Ev(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}},Ve=class{id;mID;name;status;ctg;options;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=Dr(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=Dr(this.selectedVariant)}get imageURL(){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(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}setSelectedVariant(t){this.selectedOrFirstVariant.value=t}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.reviews=t.reviews,this.options=t.options,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),this.tags=t.tags,t.vars&&(this.vars=t.vars.map(e=>new us(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new on({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,e=t.price,r=this.name,n=this.category,i=De(e.d,!0),s=this.variantImage??this.imageURL,o=this.meta,c=this.tags?.join(",")??"",l=this.reviews?.rating,p=this.reviews?.totalReviews,d=e.cmp&&e.cmp>e.d,h={name:r,price:i,image_url:s,meta:o,category:n,rating:l,reviews:p,tags:c};if(t.hasEffectivePrice()&&(h.effective_price=De(t.effectivePrice.value)),d){h.compare_price=De(e.cmp);let v=e.cmp-e.d;h.discount_percent=(v/e.cmp*100).toFixed(0),h.discount_price=De(v)}let b={name:t.name,quantity:t.quantity};return{product:h,variant:b}}},Sv=class{id;alt;sources;items;durationMS;thumbnail;card;constructor(t={}){this.id=t.id,this.alt=t.alt,this.sources=t.sources?.sort((e,r)=>r.height-e.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(e=>new Ve(e)):[],this.card=t.card}},Iv=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(t={}){this.videos=t.videos?.map(e=>new Sv(e))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.slidePerViewCount=t.slidePerViewCount??4,this.autoPlay=t.autoPlay??"ON",this.footerContent=t.footerContent??"FIRST_ITEM"}},Cv=Object.prototype.toString,hn=Array.isArray||function(t){return Cv.call(t)==="[object Array]"};function Aa(t){return typeof t=="function"}function Tv(t){return hn(t)?"array":typeof t}function Bs(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function _l(t,e){return t!=null&&typeof t=="object"&&e in t}function xv(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Dv=RegExp.prototype.test;function Av(t,e){return Dv.call(t,e)}var Nv=/\S/;function Ov(t){return!Av(Nv,t)}var kv={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Pv(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return kv[e]})}var Rv=/\s*/,Lv=/\s+/,El=/\s*=/,Mv=/\s*\}/,Uv=/#|\^|\/|>|\{|&|=|!/;function Bv(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,c=!1,l="",p=0;function d(){if(o&&!c)for(;s.length;)delete i[s.pop()];else s=[];o=!1,c=!1}var h,b,v;function w(q){if(typeof q=="string"&&(q=q.split(Lv,2)),!hn(q)||q.length!==2)throw new Error("Invalid tags: "+q);h=new RegExp(Bs(q[0])+"\\s*"),b=new RegExp("\\s*"+Bs(q[1])),v=new RegExp("\\s*"+Bs("}"+q[1]))}w(e||de.tags);for(var _=new ri(t),k,A,B,G,j,X;!_.eos();){if(k=_.pos,B=_.scanUntil(h),B)for(var _t=0,Dt=B.length;_t<Dt;++_t)G=B.charAt(_t),Ov(G)?(s.push(i.length),l+=G):(c=!0,r=!0,l+=" "),i.push(["text",G,k,k+1]),k+=1,G===`
|
|
32
|
+
`&&(d(),l="",p=0,r=!1);if(!_.scan(h))break;if(o=!0,A=_.scan(Uv)||"name",_.scan(Rv),A==="="?(B=_.scanUntil(El),_.scan(El),_.scanUntil(b)):A==="{"?(B=_.scanUntil(v),_.scan(Mv),_.scanUntil(b),A="&"):B=_.scanUntil(b),!_.scan(b))throw new Error("Unclosed tag at "+_.pos);if(A==">"?j=[A,B,k,_.pos,l,p,r]:j=[A,B,k,_.pos],p++,i.push(j),A==="#"||A==="^")n.push(j);else if(A==="/"){if(X=n.pop(),!X)throw new Error('Unopened section "'+B+'" at '+k);if(X[1]!==B)throw new Error('Unclosed section "'+X[1]+'" at '+k)}else A==="name"||A==="{"||A==="&"?c=!0:A==="="&&w(B)}if(d(),X=n.pop(),X)throw new Error('Unclosed section "'+X[1]+'" at '+_.pos);return $v(jv(i))}function jv(t){for(var e=[],r,n,i=0,s=t.length;i<s;++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 $v(t){for(var e=[],r=e,n=[],i,s,o=0,c=t.length;o<c;++o)switch(i=t[o],i[0]){case"#":case"^":r.push(i),n.push(i),r=i[4]=[];break;case"/":s=n.pop(),s[5]=i[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(i)}return e}function ri(t){this.string=t,this.tail=t,this.pos=0}ri.prototype.eos=function(){return this.tail===""};ri.prototype.scan=function(t){var e=this.tail.match(t);if(!e||e.index!==0)return"";var r=e[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};ri.prototype.scanUntil=function(t){var e=this.tail.search(t),r;switch(e){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=r.length,r};function Zr(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Zr.prototype.push=function(t){return new Zr(t,this)};Zr.prototype.lookup=function(t){var e=this.cache,r;if(e.hasOwnProperty(t))r=e[t];else{for(var n=this,i,s,o,c=!1;n;){if(t.indexOf(".")>0)for(i=n.view,s=t.split("."),o=0;i!=null&&o<s.length;)o===s.length-1&&(c=_l(i,s[o])||xv(i,s[o])),i=i[s[o++]];else i=n.view[t],c=_l(n.view,t);if(c){r=i;break}n=n.parent}e[t]=r}return Aa(r)&&(r=r.call(this.view)),r};function Jt(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Jt.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Jt.prototype.parse=function(t,e){var r=this.templateCache,n=t+":"+(e||de.tags).join(":"),i=typeof r<"u",s=i?r.get(n):void 0;return s==null&&(s=Bv(t,e),i&&r.set(n,s)),s};Jt.prototype.render=function(t,e,r,n){var i=this.getConfigTags(n),s=this.parse(t,i),o=e instanceof Zr?e:new Zr(e,void 0);return this.renderTokens(s,o,r,t,n)};Jt.prototype.renderTokens=function(t,e,r,n,i){for(var s="",o,c,l,p=0,d=t.length;p<d;++p)l=void 0,o=t[p],c=o[0],c==="#"?l=this.renderSection(o,e,r,n,i):c==="^"?l=this.renderInverted(o,e,r,n,i):c===">"?l=this.renderPartial(o,e,r,i):c==="&"?l=this.unescapedValue(o,e):c==="name"?l=this.escapedValue(o,e,i):c==="text"&&(l=this.rawValue(o)),l!==void 0&&(s+=l);return s};Jt.prototype.renderSection=function(t,e,r,n,i){var s=this,o="",c=e.lookup(t[1]);function l(h){return s.render(h,e,r,i)}if(c){if(hn(c))for(var p=0,d=c.length;p<d;++p)o+=this.renderTokens(t[4],e.push(c[p]),r,n,i);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")o+=this.renderTokens(t[4],e.push(c),r,n,i);else if(Aa(c)){if(typeof n!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,n.slice(t[3],t[5]),l),c!=null&&(o+=c)}else o+=this.renderTokens(t[4],e,r,n,i);return o}};Jt.prototype.renderInverted=function(t,e,r,n,i){var s=e.lookup(t[1]);if(!s||hn(s)&&s.length===0)return this.renderTokens(t[4],e,r,n,i)};Jt.prototype.indentPartial=function(t,e,r){for(var n=e.replace(/[^ \t]/g,""),i=t.split(`
|
|
33
33
|
`),s=0;s<i.length;s++)i[s].length&&(s>0||!r)&&(i[s]=n+i[s]);return i.join(`
|
|
34
|
-
`)};Jt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=Na(r)?r(t[1]):r[t[1]];if(s!=null){var o=t[6],c=t[5],l=t[4],p=s;c==0&&l&&(p=this.indentPartial(s,l,o));var d=this.parse(p,i);return this.renderTokens(d,e,r,p,n)}}};Jt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};Jt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||de.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===de.escape?String(i):n(i)};Jt.prototype.rawValue=function(t){return t[1]};Jt.prototype.getConfigTags=function(t){return hn(t)?t:t&&typeof t=="object"?t.tags:void 0};Jt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!hn(t))return t.escape};var de={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){qn.templateCache=t},get templateCache(){return qn.templateCache}},qn=new Jt;de.clearCache=function(){return qn.clearCache()};de.parse=function(t,e){return qn.parse(t,e)};de.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Cv(t)+'" was given as the first argument for mustache#render(template, view, partials)');return qn.render(t,e,r,n)};de.escape=kv;de.Scanner=ri;de.Context=Zr;de.Writer=Jt;var Ve=de,Wn=class Le{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;constructor(){}static get(){return Le._instance||(Le._instance=new Le),Le._instance}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Le.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Le.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return window.CooeeSDK.uaParser.getDevice().type==="mobile"}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,s=e.spc,o=Le.get().getWidth(),c=Le.get().getHeight();r&&(o=o?Math.min(o,r):r,c=c?Math.min(c,r):r),c&&(o-=s.getHorizontal(),c-=s.getVertical(),o/c<n/i?this.scalingFactor=o/n:this.scalingFactor=c/i,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(e){return this.doc.createElement(e)}appendChild(e,r){e.appendChild(r)}setStyles(e,r){Object.assign(e.style,r)}setStyle(e,r,n){if(r){if(!n){e.style.removeProperty(r);return}e.style.setProperty(r,n,"important")}}setAttribute(e,r,n){e.setAttribute(r,n)}removeInApp(e){let r=document.querySelector(`.${e.rootClassName}`);r&&r.parentElement.removeChild(r)}setParentContainer(e){this.parentContainer=e,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}},$v="?from=cooee";function Oa(){return!!window.Shopify}function Fv(){if(Oa())return window.Shopify.shop?.split(".")?.[0]}function Hv(t){let e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}function Gi(){return window.Shopify?.routes?.root??"/"}function Bn(t){return Gi()+t+$v}var Vv=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},qv=class Lo{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,s=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(T.debug(`Lock retry ${i}`),n=await this.acquire(e,s),!n);)await this.sleep(Lo.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,s)}}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),s=i?JSON.parse(i):null;if(s&&n<=s.expiry)return!1;let o={owner:r,expiry:n+Lo.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(o)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(T.debug(`${r}: Lock acquired!`),!0):(T.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),T.debug(`${r}: Lock released`)):T.debug(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}},xt=class wh{static CURRENT;token;items;total_price;original_total_price;items_subtotal_price;currency;item_count;attributes;cart_level_discount_applications;lock=new Vv;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new wh),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Lt.set(ot.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await te.get(ot.ID),r=await Lt.get(ot.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){T.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()};T.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();T.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,Ot.get().currencyCode=this.currency,T.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 T.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){T.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},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){T.debug("Not fetching cart");return}T.debug("Fetching cart");let r=Bn("cart.js"),n=await(await fetch(r)).json();this.update(n)}},Wv=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}},Gv=class{enabled;constructor(t){this.enabled=t.enabled}},zv=class extends Gv{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},Yv=class{productQuantity;constructor(t){t??={},this.productQuantity=new zv(t.productQuantity)}},ni=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new Eu(t.bg)),t.br&&(this.br=new ra(t.br)),t.shd&&(this.shd=new qd(t.shd)),t.spc&&(this.spc=new ia(t.spc)),this.trf=new Iu(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return ka[this.t]}get click(){return this.clc}},ka=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.PRODUCT_RATING=19]="PRODUCT_RATING",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(ka||{}),bh=class extends ni{constructor(t){super(t)}},Pa=class extends ni{src;constructor(t){super(t),this.src=t.src}},us=class extends ni{typo;constructor(t){super(t);let e=x(x({},t.f),t.typo);t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new We(e)}get color(){return this.typography.tc}get typography(){return this.typo}},Mo=class extends us{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},Kv=class extends ni{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},_h=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let r=new Date;t===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),l=Math.floor(s%(1e3*60*60)/(1e3*60)),p=Math.floor(s%(1e3*60)/1e3);e({days:o,hours:c,minutes:l,seconds:p})},1e3);return n}},Eh=class extends us{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new _h(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Jv=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new re(t.c??{})}get text(){return this.txt}get color(){return this.c}},Ra=class extends us{ph;constructor(t){super(t),this.ph=new Jv(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},Sh=class extends Ra{constructor(t){t??={},super(t)}},Ih=class extends Ra{},Ch=class extends Ra{},Th=class extends Pa{},hs=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(hs||{}),Xv=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.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[]}}},Il=class extends ni{gvt;max;cover;anim;embedded;position;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new Xv(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new ia({pl:H.IN_APP_DEFAULT_PADDING,pr:H.IN_APP_DEFAULT_PADDING,pt:H.IN_APP_DEFAULT_PADDING,pb:H.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},Qv=class extends Il{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new Kv(t.cont),this.mob=new Il(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(e=>{e.t===1?this.elems.push(new Pa(e)):e.t===2?this.elems.push(new Mo(e)):e.t===3?this.elems.push(new Mo(e)):e.t===100?this.elems.push(new bh(e)):e.t===51?this.elems.push(new Ih(e)):e.t===52?this.elems.push(new Ch(e)):e.t===61?this.elems.push(new Eh(e)):e.t===15||e.t===16?this.elems.push(new Sh(e)):e.t===13&&this.elems.push(new Th(e))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},e,r;return this.gvt===1?(e="flex-start",r="flex-start"):this.gvt===2?(e="center",r="flex-start"):this.gvt===3?(e="flex-end",r="flex-start"):this.gvt===4?(e="flex-start",r="center"):this.gvt===6?(e="flex-end",r="center"):this.gvt===7?(e="flex-start",r="flex-end"):this.gvt===8?(e="center",r="flex-end"):this.gvt===9?(e="flex-end",r="flex-end"):(e="center",r="center"),t.alignItems=r,t.justifyContent=e,t.overflow="visible",t}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}},xh=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}},Zv=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}},tw=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}},Cl=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new ia(t.spc),t.size&&(this.size=new tw(t.size)),t.bg&&(this.bg=new Eu(t.bg)),t.br&&(this.br=new ra(t.br)),t.typo&&(this.typo=new We(t.typo)),t.lout&&(this.lout=new Zv(t.lout)),t.flex&&(this.flex=new xh(t.flex))}},Dh=class{sm;lg;constructor(t){t??={},this.sm=new Cl(t.sm),this.lg=new Cl(t.lg)}},lr=class{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new Dh(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return ka[this.t]}},Ne=class extends lr{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text}},Uo=class extends Ne{constructor(t,e){super(t,e??3)}},Ah=class extends lr{value;constructor(t){super(6,t),t??={},this.value=t.value}},Nh=class extends Ne{showChips;optionsConfig;constructor(t=15,e){super(e,t),e??={},this.showChips=e.showChips??!1,this.optionsConfig=e.optionsConfig??{}}},ew=class extends lr{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new re(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}},rw=ke(sn()),nw=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new re(t.color)}},iw=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new re(t.color)}},Oh=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new iw(t.navigation),this.pagination=new nw(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},sw=class extends lr{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=tn.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new Oh(t.conf),this.allowedTypes=t.allowedTypes}},ow=class extends Ne{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new _h(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},La=class extends lr{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=tn.getParsedElement(e);r&&this.elems.push(r)})}},Bo=class extends lr{src;sm;lg;constructor(t,e){super(e??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}},tn=class kh{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=kh.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new Ne(e);case 3:return new Uo(e);case 6:return new Ah(e);case 11:return new aw(e);case 12:return new Ma(e);case 61:return new ow(e);case 4:return new La(e);case 1:return new Bo(e);case 13:return new Bo(e,13);case 14:return new Ne(e,14);case 15:case 16:return new Nh(e.t,e);case 18:return new Uo(e,18);case 62:return new sw(e);case 19:return new ew(e);default:rw.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"}}},Ma=class extends lr{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=tn.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new Ah(t.cBox)),this.elems.push(new Bo(t.img,13));let e=new Ne(t.title,14);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);let r=new Ne(t.price);r.text="{{ product.price }}",r.hide=!t.show?.price;let n=new Ne(t.compareAt);n.text="{{ product.compare_price }}",n.hide=!t.show?.price,t.compareAt||(n.style=new Dh(r.style),n.style.lg.typo=new We(yt(x({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new We(yt(x({},n.style.sm.typo),{td:"line-through"})));let i=new La({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:tn.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new Nh(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let o=new Uo(t.btn,18);o.hide=!t.show?.btn,this.elems.push(o)}}t.symbol&&(this.symbol=new Ne(t.symbol))}},aw=class extends lr{conf;prod;constructor(t){super(11,t),t??={},this.conf=new cw(t.conf),this.prod=new Ma(t.prod)}},Tl=class extends Oh{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},cw=class{lg;sm;constructor(t){t??={},this.lg=new Tl(t.lg),this.sm=new Tl(t.sm)}},lw=class extends La{constructor(t){super(t)}},Ph=class{cont;elems=[];constructor(t){t=t??{},this.cont=new lw(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=tn.getParsedElement(t);return e&&this.elems.push(e),e}},uw=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Ai.EXCLUSION}isABTesting(){return this.contentType===Ai.ABTESTING}isSingleContent(){return this.contentType===Ai.SINGLE}},Rh=class{videoConfig;constructor(t){t??={},t.videoConfig&&(this.videoConfig=new Sv(t.videoConfig))}},Ar=class Lh extends uw{static SWIPER_ELEMENTS=new Set([11,62]);nudgeID;contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=Dr({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=Ot.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new Ph(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.embeddedItems=e.embeddedItems?.map(r=>new on(r)),this.items=e.items?.map(r=>new He(r))??[],this.nonMutableItems=e.items?.map(r=>new He(r))??[],this.collections=e.collections?.map(r=>new Wv(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 Yv(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 zd(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new Kd(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new Ud(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new He(e.bundleFrom)),e.content&&(this.content=new Rh(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===Re.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===lo.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===lo.PAGE_EMBED}isProgressBar(){return this.objective===Re.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Re.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Re.CART_RECOVERY}isProductPromotion(){return this.objective===Re.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===yu.COLLECTION}isBYOB(){return this.objective===Re.BYOB}isStickyATC(){return this.objective===Re.STICKY_ATC}isShoppableVideo(){return this.objective===Re.SHOPPABLE_VIDEO}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},s={};if(n){let l=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:l.mID,image:n.variantImage,price:De(l.price.d),comparePrice:De(l.price.cmp),quantity:n.quantity},s={quantity:l.quantity}}let o={productCount:xt.getCurrent().item_count},c=Ve.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(c=c.replace(new RegExp(H.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new Qv(JSON.parse(c))}calculateDiscountData(e,r){let n=Ni.sum(e,o=>o.selectedOrFirstVariant.value.price.d),i=Ni.sum(e,o=>{let c=o.selectedOrFirstVariant.value.price;return c.cmp??c.d}),s={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(s);return}if(ge.BXGY===this.discount.type&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,s.discountPercentage,!0),s.discountAmount=s.actualPrice-Ni.sum(e,o=>o.selectedOrFirstVariant.value.effectivePrice.value);else if([ge.UNIQUE_FLAT_ITEMS,ge.STATIC,ge.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],s.discountAmount=s.actualPrice*s.discountPercentage/100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===ge.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)s.discountAmount=s.actualPrice-this.discount.values[0],s.discountPercentage=s.discountAmount/s.actualPrice*100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===ge.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((c,l)=>l.selectedOrFirstVariant.value.price.d-c.selectedOrFirstVariant.value.price.d);let o=e[e.length-1];o.selectedOrFirstVariant.value.effectivePrice.value=0,s.discountAmount=o.selectedOrFirstVariant.value.price.d,s.discountPercentage=s.discountAmount/s.actualPrice*100}s.discountedPrice=s.actualPrice-s.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(s)}getPrivateAttributesForLineItem(){return ne.get().skipItemAttribute?{}:{[H.VIA]:"Cooee",[H.CAMPAIGN_ATTRIBUTE]:this.shortID,[H.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return ne.get().skipItemAttribute?[]:[{key:H.VIA,value:"Cooee"},{key:H.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:H.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[ge.UNIQUE_FIXED_ITEMS,ge.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){let e=this.widget?.elems.find(n=>Lh.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=Wn.get().isMobile()?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}getCartMagicVariables(){let e=xt.getCurrent();return{productCount:e.item_count,amount:De(e.total_price/100),originalAmount:De(e.original_total_price/100)}}updateEffectivePrice(e,r,n=!1){let i=Ot.get().getCurrentItem();e.forEach(s=>{let o=s.selectedOrFirstVariant.value,c=o.price;if(n&&s.mID===i.mID)o.effectivePrice.value=c.d;else{let l=c.d*r/100;o.effectivePrice.value=c.d-l}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:tv(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{r[n]=De(e[n])}),r}};function hw(t,e){return e={exports:{}},t(e,e.exports),e.exports}var pw=mw,dw=vw,fw=_w,Ae=[],ue=[],gw=typeof Uint8Array<"u"?Uint8Array:Array,Bs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pr=0,xl=Bs.length;pr<xl;++pr)Ae[pr]=Bs[pr],ue[Bs.charCodeAt(pr)]=pr;var pr,xl;ue[45]=62;ue[95]=63;function Mh(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 mw(t){var e=Mh(t),r=e[0],n=e[1];return(r+n)*3/4-n}function yw(t,e,r){return(e+r)*3/4-r}function vw(t){var e,r=Mh(t),n=r[0],i=r[1],s=new gw(yw(t,n,i)),o=0,c=i>0?n-4:n,l;for(l=0;l<c;l+=4)e=ue[t.charCodeAt(l)]<<18|ue[t.charCodeAt(l+1)]<<12|ue[t.charCodeAt(l+2)]<<6|ue[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ue[t.charCodeAt(l)]<<2|ue[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=ue[t.charCodeAt(l)]<<10|ue[t.charCodeAt(l+1)]<<4|ue[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function ww(t){return Ae[t>>18&63]+Ae[t>>12&63]+Ae[t>>6&63]+Ae[t&63]}function bw(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(ww(n));return i.join("")}function _w(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(bw(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],i.push(Ae[e>>2]+Ae[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ae[e>>10]+Ae[e>>4&63]+Ae[e<<2&63]+"=")),i.join("")}var js={byteLength:pw,toByteArray:dw,fromByteArray:fw},Ew=function(t,e,r,n,i){var s,o,c=i*8-n-1,l=(1<<c)-1,p=l>>1,d=-7,h=r?i-1:0,b=r?-1:1,v=t[e+h];for(h+=b,s=v&(1<<-d)-1,v>>=-d,d+=c;d>0;s=s*256+t[e+h],h+=b,d-=8);for(o=s&(1<<-d)-1,s>>=-d,d+=n;d>0;o=o*256+t[e+h],h+=b,d-=8);if(s===0)s=1-p;else{if(s===l)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-p}return(v?-1:1)*o*Math.pow(2,s-n)},Sw=function(t,e,r,n,i,s){var o,c,l,p=s*8-i-1,d=(1<<p)-1,h=d>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,w=n?1:-1,_=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=d):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+h>=1?e+=b/l:e+=b*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=d?(c=0,o=d):o+h>=1?(c=(e*l-1)*Math.pow(2,i),o=o+h):(c=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+v]=c&255,v+=w,c/=256,i-=8);for(o=o<<i|c,p+=i;p>0;t[r+v]=o&255,v+=w,o/=256,p-=8);t[r+v-w]|=_*128},Ur={read:Ew,write:Sw},ps=hw(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=A,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.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 a=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(a,u),a.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(a){if(a>n)throw new RangeError('The value "'+a+'" is invalid for option "size"');var u=new Uint8Array(a);return Object.setPrototypeOf(u,o.prototype),u}function o(a,u,f){if(typeof a=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(a)}return c(a,u,f)}o.poolSize=8192;function c(a,u,f){if(typeof a=="string")return h(a,u);if(ArrayBuffer.isView(a))return v(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(ae(a,ArrayBuffer)||a&&ae(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ae(a,SharedArrayBuffer)||a&&ae(a.buffer,SharedArrayBuffer)))return w(a,u,f);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var E=a.valueOf&&a.valueOf();if(E!=null&&E!==a)return o.from(E,u,f);var D=_(a);if(D)return D;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return o.from(a[Symbol.toPrimitive]("string"),u,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}o.from=function(a,u,f){return c(a,u,f)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function p(a,u,f){return l(a),a<=0?s(a):u!==void 0?typeof f=="string"?s(a).fill(u,f):s(a).fill(u):s(a)}o.alloc=function(a,u,f){return p(a,u,f)};function d(a){return l(a),s(a<0?0:k(a)|0)}o.allocUnsafe=function(a){return d(a)},o.allocUnsafeSlow=function(a){return d(a)};function h(a,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var f=B(a,u)|0,E=s(f),D=E.write(a,u);return D!==f&&(E=E.slice(0,D)),E}function b(a){for(var u=a.length<0?0:k(a.length)|0,f=s(u),E=0;E<u;E+=1)f[E]=a[E]&255;return f}function v(a){if(ae(a,Uint8Array)){var u=new Uint8Array(a);return w(u.buffer,u.byteOffset,u.byteLength)}return b(a)}function w(a,u,f){if(u<0||a.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<u+(f||0))throw new RangeError('"length" is outside of buffer bounds');var E;return u===void 0&&f===void 0?E=new Uint8Array(a):f===void 0?E=new Uint8Array(a,u):E=new Uint8Array(a,u,f),Object.setPrototypeOf(E,o.prototype),E}function _(a){if(o.isBuffer(a)){var u=k(a.length)|0,f=s(u);return f.length===0||a.copy(f,0,0,u),f}if(a.length!==void 0)return typeof a.length!="number"||fn(a.length)?s(0):b(a);if(a.type==="Buffer"&&Array.isArray(a.data))return b(a.data)}function k(a){if(a>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return a|0}function A(a){return+a!=a&&(a=0),o.alloc(+a)}o.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==o.prototype},o.compare=function(a,u){if(ae(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),ae(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(a)||!o.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===u)return 0;for(var f=a.length,E=u.length,D=0,M=Math.min(f,E);D<M;++D)if(a[D]!==u[D]){f=a[D],E=u[D];break}return f<E?-1:E<f?1:0},o.isEncoding=function(a){switch(String(a).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}},o.concat=function(a,u){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return o.alloc(0);var f;if(u===void 0)for(u=0,f=0;f<a.length;++f)u+=a[f].length;var E=o.allocUnsafe(u),D=0;for(f=0;f<a.length;++f){var M=a[f];if(ae(M,Uint8Array))D+M.length>E.length?o.from(M).copy(E,D):Uint8Array.prototype.set.call(E,M,D);else if(o.isBuffer(M))M.copy(E,D);else throw new TypeError('"list" argument must be an Array of Buffers');D+=M.length}return E};function B(a,u){if(o.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||ae(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var f=a.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&f===0)return 0;for(var D=!1;;)switch(u){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return dn(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return hi(a).length;default:if(D)return E?-1:dn(a).length;u=(""+u).toLowerCase(),D=!0}}o.byteLength=B;function G(a,u,f){var E=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,u>>>=0,f<=u))return"";for(a||(a="utf8");;)switch(a){case"hex":return Gt(this,u,f);case"utf8":case"utf-8":return kt(this,u,f);case"ascii":return Wt(this,u,f);case"latin1":case"binary":return ft(this,u,f);case"base64":return lt(this,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return st(this,u,f);default:if(E)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),E=!0}}o.prototype._isBuffer=!0;function j(a,u,f){var E=a[u];a[u]=a[f],a[f]=E}o.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<a;u+=2)j(this,u,u+1);return this},o.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<a;u+=4)j(this,u,u+3),j(this,u+1,u+2);return this},o.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<a;u+=8)j(this,u,u+7),j(this,u+1,u+6),j(this,u+2,u+5),j(this,u+3,u+4);return this},o.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?kt(this,0,a):G.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(a){if(!o.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:o.compare(this,a)===0},o.prototype.inspect=function(){var a="",u=e.INSPECT_MAX_BYTES;return a=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(a+=" ... "),"<Buffer "+a+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(a,u,f,E,D){if(ae(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),!o.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(u===void 0&&(u=0),f===void 0&&(f=a?a.length:0),E===void 0&&(E=0),D===void 0&&(D=this.length),u<0||f>a.length||E<0||D>this.length)throw new RangeError("out of range index");if(E>=D&&u>=f)return 0;if(E>=D)return-1;if(u>=f)return 1;if(u>>>=0,f>>>=0,E>>>=0,D>>>=0,this===a)return 0;for(var M=D-E,Y=f-u,ut=Math.min(M,Y),Nt=this.slice(E,D),gt=a.slice(u,f),St=0;St<ut;++St)if(Nt[St]!==gt[St]){M=Nt[St],Y=gt[St];break}return M<Y?-1:Y<M?1:0};function X(a,u,f,E,D){if(a.length===0)return-1;if(typeof f=="string"?(E=f,f=0):f>2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,fn(f)&&(f=D?0:a.length-1),f<0&&(f=a.length+f),f>=a.length){if(D)return-1;f=a.length-1}else if(f<0)if(D)f=0;else return-1;if(typeof u=="string"&&(u=o.from(u,E)),o.isBuffer(u))return u.length===0?-1:_t(a,u,f,E,D);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(a,u,f):Uint8Array.prototype.lastIndexOf.call(a,u,f):_t(a,[u],f,E,D);throw new TypeError("val must be string, number or Buffer")}function _t(a,u,f,E,D){var M=1,Y=a.length,ut=u.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(a.length<2||u.length<2)return-1;M=2,Y/=2,ut/=2,f/=2}function Nt(gn,mn){return M===1?gn[mn]:gn.readUInt16BE(mn*M)}var gt;if(D){var St=-1;for(gt=f;gt<Y;gt++)if(Nt(a,gt)===Nt(u,St===-1?0:gt-St)){if(St===-1&&(St=gt),gt-St+1===ut)return St*M}else St!==-1&&(gt-=gt-St),St=-1}else for(f+ut>Y&&(f=Y-ut),gt=f;gt>=0;gt--){for(var Ut=!0,hr=0;hr<ut;hr++)if(Nt(a,gt+hr)!==Nt(u,hr)){Ut=!1;break}if(Ut)return gt}return-1}o.prototype.includes=function(a,u,f){return this.indexOf(a,u,f)!==-1},o.prototype.indexOf=function(a,u,f){return X(this,a,u,f,!0)},o.prototype.lastIndexOf=function(a,u,f){return X(this,a,u,f,!1)};function Dt(a,u,f,E){f=Number(f)||0;var D=a.length-f;E?(E=Number(E),E>D&&(E=D)):E=D;var M=u.length;E>M/2&&(E=M/2);for(var Y=0;Y<E;++Y){var ut=parseInt(u.substr(Y*2,2),16);if(fn(ut))return Y;a[f+Y]=ut}return Y}function q(a,u,f,E){return Lr(dn(u,a.length-f),a,f,E)}function rt(a,u,f,E){return Lr(Ss(u),a,f,E)}function Q(a,u,f,E){return Lr(hi(u),a,f,E)}function tt(a,u,f,E){return Lr(Is(u,a.length-f),a,f,E)}o.prototype.write=function(a,u,f,E){if(u===void 0)E="utf8",f=this.length,u=0;else if(f===void 0&&typeof u=="string")E=u,f=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(f)?(f=f>>>0,E===void 0&&(E="utf8")):(E=f,f=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var D=this.length-u;if((f===void 0||f>D)&&(f=D),a.length>0&&(f<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");E||(E="utf8");for(var M=!1;;)switch(E){case"hex":return Dt(this,a,u,f);case"utf8":case"utf-8":return q(this,a,u,f);case"ascii":case"latin1":case"binary":return rt(this,a,u,f);case"base64":return Q(this,a,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tt(this,a,u,f);default:if(M)throw new TypeError("Unknown encoding: "+E);E=(""+E).toLowerCase(),M=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lt(a,u,f){return u===0&&f===a.length?js.fromByteArray(a):js.fromByteArray(a.slice(u,f))}function kt(a,u,f){f=Math.min(a.length,f);for(var E=[],D=u;D<f;){var M=a[D],Y=null,ut=M>239?4:M>223?3:M>191?2:1;if(D+ut<=f){var Nt,gt,St,Ut;switch(ut){case 1:M<128&&(Y=M);break;case 2:Nt=a[D+1],(Nt&192)===128&&(Ut=(M&31)<<6|Nt&63,Ut>127&&(Y=Ut));break;case 3:Nt=a[D+1],gt=a[D+2],(Nt&192)===128&&(gt&192)===128&&(Ut=(M&15)<<12|(Nt&63)<<6|gt&63,Ut>2047&&(Ut<55296||Ut>57343)&&(Y=Ut));break;case 4:Nt=a[D+1],gt=a[D+2],St=a[D+3],(Nt&192)===128&&(gt&192)===128&&(St&192)===128&&(Ut=(M&15)<<18|(Nt&63)<<12|(gt&63)<<6|St&63,Ut>65535&&Ut<1114112&&(Y=Ut))}}Y===null?(Y=65533,ut=1):Y>65535&&(Y-=65536,E.push(Y>>>10&1023|55296),Y=56320|Y&1023),E.push(Y),D+=ut}return jt(E)}var At=4096;function jt(a){var u=a.length;if(u<=At)return String.fromCharCode.apply(String,a);for(var f="",E=0;E<u;)f+=String.fromCharCode.apply(String,a.slice(E,E+=At));return f}function Wt(a,u,f){var E="";f=Math.min(a.length,f);for(var D=u;D<f;++D)E+=String.fromCharCode(a[D]&127);return E}function ft(a,u,f){var E="";f=Math.min(a.length,f);for(var D=u;D<f;++D)E+=String.fromCharCode(a[D]);return E}function Gt(a,u,f){var E=a.length;(!u||u<0)&&(u=0),(!f||f<0||f>E)&&(f=E);for(var D="",M=u;M<f;++M)D+=Cs[a[M]];return D}function st(a,u,f){for(var E=a.slice(u,f),D="",M=0;M<E.length-1;M+=2)D+=String.fromCharCode(E[M]+E[M+1]*256);return D}o.prototype.slice=function(a,u){var f=this.length;a=~~a,u=u===void 0?f:~~u,a<0?(a+=f,a<0&&(a=0)):a>f&&(a=f),u<0?(u+=f,u<0&&(u=0)):u>f&&(u=f),u<a&&(u=a);var E=this.subarray(a,u);return Object.setPrototypeOf(E,o.prototype),E};function et(a,u,f){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+u>f)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(a,u,f){a=a>>>0,u=u>>>0,f||et(a,u,this.length);for(var E=this[a],D=1,M=0;++M<u&&(D*=256);)E+=this[a+M]*D;return E},o.prototype.readUintBE=o.prototype.readUIntBE=function(a,u,f){a=a>>>0,u=u>>>0,f||et(a,u,this.length);for(var E=this[a+--u],D=1;u>0&&(D*=256);)E+=this[a+--u]*D;return E},o.prototype.readUint8=o.prototype.readUInt8=function(a,u){return a=a>>>0,u||et(a,1,this.length),this[a]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(a,u){return a=a>>>0,u||et(a,2,this.length),this[a]|this[a+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(a,u){return a=a>>>0,u||et(a,2,this.length),this[a]<<8|this[a+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(a,u){return a=a>>>0,u||et(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(a,u){return a=a>>>0,u||et(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},o.prototype.readIntLE=function(a,u,f){a=a>>>0,u=u>>>0,f||et(a,u,this.length);for(var E=this[a],D=1,M=0;++M<u&&(D*=256);)E+=this[a+M]*D;return D*=128,E>=D&&(E-=Math.pow(2,8*u)),E},o.prototype.readIntBE=function(a,u,f){a=a>>>0,u=u>>>0,f||et(a,u,this.length);for(var E=u,D=1,M=this[a+--E];E>0&&(D*=256);)M+=this[a+--E]*D;return D*=128,M>=D&&(M-=Math.pow(2,8*u)),M},o.prototype.readInt8=function(a,u){return a=a>>>0,u||et(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},o.prototype.readInt16LE=function(a,u){a=a>>>0,u||et(a,2,this.length);var f=this[a]|this[a+1]<<8;return f&32768?f|4294901760:f},o.prototype.readInt16BE=function(a,u){a=a>>>0,u||et(a,2,this.length);var f=this[a+1]|this[a]<<8;return f&32768?f|4294901760:f},o.prototype.readInt32LE=function(a,u){return a=a>>>0,u||et(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},o.prototype.readInt32BE=function(a,u){return a=a>>>0,u||et(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},o.prototype.readFloatLE=function(a,u){return a=a>>>0,u||et(a,4,this.length),Ur.read(this,a,!0,23,4)},o.prototype.readFloatBE=function(a,u){return a=a>>>0,u||et(a,4,this.length),Ur.read(this,a,!1,23,4)},o.prototype.readDoubleLE=function(a,u){return a=a>>>0,u||et(a,8,this.length),Ur.read(this,a,!0,52,8)},o.prototype.readDoubleBE=function(a,u){return a=a>>>0,u||et(a,8,this.length),Ur.read(this,a,!1,52,8)};function $t(a,u,f,E,D,M){if(!o.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>D||u<M)throw new RangeError('"value" argument is out of bounds');if(f+E>a.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(a,u,f,E){if(a=+a,u=u>>>0,f=f>>>0,!E){var D=Math.pow(2,8*f)-1;$t(this,a,u,f,D,0)}var M=1,Y=0;for(this[u]=a&255;++Y<f&&(M*=256);)this[u+Y]=a/M&255;return u+f},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(a,u,f,E){if(a=+a,u=u>>>0,f=f>>>0,!E){var D=Math.pow(2,8*f)-1;$t(this,a,u,f,D,0)}var M=f-1,Y=1;for(this[u+M]=a&255;--M>=0&&(Y*=256);)this[u+M]=a/Y&255;return u+f},o.prototype.writeUint8=o.prototype.writeUInt8=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,1,255,0),this[u]=a&255,u+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,2,65535,0),this[u]=a&255,this[u+1]=a>>>8,u+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,2,65535,0),this[u]=a>>>8,this[u+1]=a&255,u+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,4,4294967295,0),this[u+3]=a>>>24,this[u+2]=a>>>16,this[u+1]=a>>>8,this[u]=a&255,u+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,4,4294967295,0),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4},o.prototype.writeIntLE=function(a,u,f,E){if(a=+a,u=u>>>0,!E){var D=Math.pow(2,8*f-1);$t(this,a,u,f,D-1,-D)}var M=0,Y=1,ut=0;for(this[u]=a&255;++M<f&&(Y*=256);)a<0&&ut===0&&this[u+M-1]!==0&&(ut=1),this[u+M]=(a/Y>>0)-ut&255;return u+f},o.prototype.writeIntBE=function(a,u,f,E){if(a=+a,u=u>>>0,!E){var D=Math.pow(2,8*f-1);$t(this,a,u,f,D-1,-D)}var M=f-1,Y=1,ut=0;for(this[u+M]=a&255;--M>=0&&(Y*=256);)a<0&&ut===0&&this[u+M+1]!==0&&(ut=1),this[u+M]=(a/Y>>0)-ut&255;return u+f},o.prototype.writeInt8=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,1,127,-128),a<0&&(a=255+a+1),this[u]=a&255,u+1},o.prototype.writeInt16LE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,2,32767,-32768),this[u]=a&255,this[u+1]=a>>>8,u+2},o.prototype.writeInt16BE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,2,32767,-32768),this[u]=a>>>8,this[u+1]=a&255,u+2},o.prototype.writeInt32LE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,4,2147483647,-2147483648),this[u]=a&255,this[u+1]=a>>>8,this[u+2]=a>>>16,this[u+3]=a>>>24,u+4},o.prototype.writeInt32BE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4};function ci(a,u,f,E,D,M){if(f+E>a.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function li(a,u,f,E,D){return u=+u,f=f>>>0,D||ci(a,u,f,4),Ur.write(a,u,f,E,23,4),f+4}o.prototype.writeFloatLE=function(a,u,f){return li(this,a,u,!0,f)},o.prototype.writeFloatBE=function(a,u,f){return li(this,a,u,!1,f)};function oe(a,u,f,E,D){return u=+u,f=f>>>0,D||ci(a,u,f,8),Ur.write(a,u,f,E,52,8),f+8}o.prototype.writeDoubleLE=function(a,u,f){return oe(this,a,u,!0,f)},o.prototype.writeDoubleBE=function(a,u,f){return oe(this,a,u,!1,f)},o.prototype.copy=function(a,u,f,E){if(!o.isBuffer(a))throw new TypeError("argument should be a Buffer");if(f||(f=0),!E&&E!==0&&(E=this.length),u>=a.length&&(u=a.length),u||(u=0),E>0&&E<f&&(E=f),E===f||a.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(f<0||f>=this.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("sourceEnd out of bounds");E>this.length&&(E=this.length),a.length-u<E-f&&(E=a.length-u+f);var D=E-f;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,f,E):Uint8Array.prototype.set.call(a,this.subarray(f,E),u),D},o.prototype.fill=function(a,u,f,E){if(typeof a=="string"){if(typeof u=="string"?(E=u,u=0,f=this.length):typeof f=="string"&&(E=f,f=this.length),E!==void 0&&typeof E!="string")throw new TypeError("encoding must be a string");if(typeof E=="string"&&!o.isEncoding(E))throw new TypeError("Unknown encoding: "+E);if(a.length===1){var D=a.charCodeAt(0);(E==="utf8"&&D<128||E==="latin1")&&(a=D)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(u<0||this.length<u||this.length<f)throw new RangeError("Out of range index");if(f<=u)return this;u=u>>>0,f=f===void 0?this.length:f>>>0,a||(a=0);var M;if(typeof a=="number")for(M=u;M<f;++M)this[M]=a;else{var Y=o.isBuffer(a)?a:o.from(a,E),ut=Y.length;if(ut===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(M=0;M<f-u;++M)this[M+u]=Y[M%ut]}return this};var ui=/[^+/0-9A-Za-z-_]/g;function Es(a){if(a=a.split("=")[0],a=a.trim().replace(ui,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function dn(a,u){u=u||1/0;for(var f,E=a.length,D=null,M=[],Y=0;Y<E;++Y){if(f=a.charCodeAt(Y),f>55295&&f<57344){if(!D){if(f>56319){(u-=3)>-1&&M.push(239,191,189);continue}else if(Y+1===E){(u-=3)>-1&&M.push(239,191,189);continue}D=f;continue}if(f<56320){(u-=3)>-1&&M.push(239,191,189),D=f;continue}f=(D-55296<<10|f-56320)+65536}else D&&(u-=3)>-1&&M.push(239,191,189);if(D=null,f<128){if((u-=1)<0)break;M.push(f)}else if(f<2048){if((u-=2)<0)break;M.push(f>>6|192,f&63|128)}else if(f<65536){if((u-=3)<0)break;M.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((u-=4)<0)break;M.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error("Invalid code point")}return M}function Ss(a){for(var u=[],f=0;f<a.length;++f)u.push(a.charCodeAt(f)&255);return u}function Is(a,u){for(var f,E,D,M=[],Y=0;Y<a.length&&!((u-=2)<0);++Y)f=a.charCodeAt(Y),E=f>>8,D=f%256,M.push(D),M.push(E);return M}function hi(a){return js.toByteArray(Es(a))}function Lr(a,u,f,E){for(var D=0;D<E&&!(D+f>=u.length||D>=a.length);++D)u[D+f]=a[D];return D}function ae(a,u){return a instanceof u||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===u.name}function fn(a){return a!==a}var Cs=function(){for(var a="0123456789abcdef",u=new Array(256),f=0;f<16;++f)for(var E=f*16,D=0;D<16;++D)u[E+D]=a[f]+a[D];return u}()}),ct=ps.Buffer;ps.SlowBuffer;ps.INSPECT_MAX_BYTES;ps.kMaxLength;var jo=function(t,e){return jo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},jo(t,e)};function ds(t,e){jo(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var _r=function(t){ds(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),Tt=function(t){ds(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 Si(t){return t&&t.Math==Math&&t}function Uh(){return Si(typeof globalThis=="object"&&globalThis)||Si(typeof window=="object"&&window)||Si(typeof self=="object"&&self)||Si(typeof global=="object"&&global)||Function("return this")()}function Iw(){var t=Uh();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Cw=function(t){var e=Iw()?"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(e);for(var r=ct.alloc(t),n=0;n<t;++n)r[n]=Math.floor(Math.random()*256);return r},Tw=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(ct.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(ct.alloc(e))}:Cw}},Bh=Tw();function xw(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Ua(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Dw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Aw(t){return ii(t)&&Object.prototype.toString.call(t)==="[object Date]"}function ii(t){return typeof t=="object"&&t!==null}function fs(t,e){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function zi(t){if(ArrayBuffer.isView(t))return ct.from(t.buffer,t.byteOffset,t.byteLength);if(xw(t))return ct.from(t);throw new Tt("Must use either Buffer or TypedArray")}var Nw=/^(?:[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,jh=function(t){return typeof t=="string"&&Nw.test(t)},$o=function(t){if(!jh(t))throw new Tt('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 ct.from(e,"hex")},Dl=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")},mE=Math.pow(2,63)-1,yE=-Math.pow(2,63),Ow=Math.pow(2,53),kw=-Math.pow(2,53),$h=4,Er=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 Tt("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=ct.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=ct.from(e,"binary"):Array.isArray(e)?this.buffer=ct.from(e):this.buffer=zi(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Tt("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Tt("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 Tt("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=ct.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=ct.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(zi(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 Al(this.buffer.slice(0,this.position));throw new _r('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=ct.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=ct.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=$o(e.$uuid)),!n)throw new Tt("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===$h?new Al(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(Er.prototype,"_bsontype",{value:"Binary"});var $s=16,Al=function(t){ds(e,t);function e(r){var n=this,i,s;if(r==null)i=e.generate();else if(r instanceof e)i=ct.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===$s)i=zi(r);else if(typeof r=="string")i=$o(r);else throw new Tt("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,$h)||this,n.__id=s,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Dl(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=Dl(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 Er(this.id,Er.SUBTYPE_UUID)},e.generate=function(){var r=Bh($s);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ct.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?jh(r):Ua(r)?r.length!==$s?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=$o(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}(Er),gs=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(gs.prototype,"_bsontype",{value:"Code"});function Pw(t){return ii(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var Gn=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var s=e.split(".");s.length===2&&(n=s.shift(),e=s.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(Gn.prototype,"_bsontype",{value:"DBRef"});var le=void 0;try{le=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 Nl=65536,Rw=1<<24,Vr=Nl*Nl,Fh=Vr*Vr,Ol=Fh/2,kl={},Pl={},K=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,s;return r?(e>>>=0,(s=0<=e&&e<256)&&(i=Pl[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(Pl[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=kl[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(kl[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>=Fh)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Ol)return t.MIN_VALUE;if(e+1>=Ol)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%Vr|0,e/Vr|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 s=t.fromNumber(Math.pow(n,8)),o=t.ZERO,c=0;c<e.length;c+=8){var l=Math.min(8,e.length-c),p=parseInt(e.substring(c,c+l),n);if(l<8){var d=t.fromNumber(Math.pow(n,l));o=o.mul(d).add(t.fromNumber(p))}else o=o.mul(s),o=o.add(t.fromNumber(p))}return o.unsigned=r,o},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 ii(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,s=this.low&65535,o=e.high>>>16,c=e.high&65535,l=e.low>>>16,p=e.low&65535,d=0,h=0,b=0,v=0;return v+=s+p,b+=v>>>16,v&=65535,b+=i+l,h+=b>>>16,b&=65535,h+=n+c,d+=h>>>16,h&=65535,d+=r+o,d&=65535,t.fromBits(b<<16|v,d<<16|h,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(le){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?le.div_u:le.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,le.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;s=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 o=this.shr(1);return n=o.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}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();s=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(n)/Math.LN2),l=c<=48?1:Math.pow(2,c-48),p=t.fromNumber(n),d=p.mul(e);d.isNegative()||d.gt(i);)n-=l,p=t.fromNumber(n,this.unsigned),d=p.mul(e);p.isZero()&&(p=t.ONE),s=s.add(p),i=i.sub(d)}return s},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)),le){var r=(this.unsigned?le.rem_u:le.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,le.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)),le){var r=le.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,le.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,s=this.low>>>16,o=this.low&65535,c=e.high>>>16,l=e.high&65535,p=e.low>>>16,d=e.low&65535,h=0,b=0,v=0,w=0;return w+=o*d,v+=w>>>16,w&=65535,v+=s*d,b+=v>>>16,v&=65535,v+=o*p,b+=v>>>16,v&=65535,b+=i*d,h+=b>>>16,b&=65535,b+=s*p,h+=b>>>16,b&=65535,b+=o*l,h+=b>>>16,b&=65535,h+=n*d+i*p+s*l+o*c,h&=65535,t.fromBits(v<<16|w,h<<16|b,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)*Vr+(this.low>>>0):this.high*Vr+(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 s=t.fromNumber(Math.pow(e,6),this.unsigned),o=this,c="";;){var l=o.div(s),p=o.sub(l.mul(s)).toInt()>>>0,d=p.toString(e);if(o=l,o.isZero())return d+c;for(;d.length<6;)d="0"+d;c=""+d+c}},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(Rw),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(K.prototype,"__isLong__",{value:!0});Object.defineProperty(K.prototype,"_bsontype",{value:"Long"});var Lw=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Mw=/^(\+|-)?(Infinity|inf)$/i,Uw=/^(\+|-)?NaN$/i,wn=6111,Fs=-6176,Rl=6176,Bw=34,Hs=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ll=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ml=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),jw=/^([-+])?(\d+)?$/,$w=31,Ul=16383,Fw=30,Hw=31;function Bl(t){return!isNaN(parseInt(t,10))}function Vw(t){var e=K.fromNumber(1e9),r=K.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 K(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function qw(t,e){if(!t&&!e)return{high:K.fromNumber(0),low:K.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new K(t.getLowBits(),0),i=e.shiftRightUnsigned(32),s=new K(e.getLowBits(),0),o=r.multiply(i),c=r.multiply(s),l=n.multiply(i),p=n.multiply(s);return o=o.add(c.shiftRightUnsigned(32)),c=new K(c.getLowBits(),0).add(l).add(p.shiftRightUnsigned(32)),o=o.add(c.shiftRightUnsigned(32)),p=c.shiftLeft(32).add(new K(p.getLowBits(),0)),{high:o,low:p}}function Ww(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,s=e.low>>>0;if(i<s)return!0}return!1}function Br(t,e){throw new Tt('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Ba=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Ua(e)){if(e.byteLength!==16)throw new Tt("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Tt("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,s=0,o=0,c=0,l=0,p=0,d=[0],h=0,b=0,v=0,w=0,_=0,k=0,A=new K(0,0),B=new K(0,0),G=0,j=0;if(e.length>=7e3)throw new Tt(""+e+" not a valid Decimal128 string");var X=e.match(Lw),_t=e.match(Mw),Dt=e.match(Uw);if(!X&&!_t&&!Dt||e.length===0)throw new Tt(""+e+" not a valid Decimal128 string");if(X){var q=X[2],rt=X[4],Q=X[5],tt=X[6];rt&&tt===void 0&&Br(e,"missing exponent power"),rt&&q===void 0&&Br(e,"missing exponent base"),rt===void 0&&(Q||tt)&&Br(e,"missing e before exponent")}if((e[j]==="+"||e[j]==="-")&&(r=e[j++]==="-"),!Bl(e[j])&&e[j]!=="."){if(e[j]==="i"||e[j]==="I")return new t(ct.from(r?Ll:Ml));if(e[j]==="N")return new t(ct.from(Hs))}for(;Bl(e[j])||e[j]===".";){if(e[j]==="."){n&&Br(e,"contains multiple periods"),n=!0,j=j+1;continue}h<34&&(e[j]!=="0"||i)&&(i||(p=o),i=!0,d[b++]=parseInt(e[j],10),h=h+1),i&&(c=c+1),n&&(l=l+1),o=o+1,j=j+1}if(n&&!o)throw new Tt(""+e+" not a valid Decimal128 string");if(e[j]==="e"||e[j]==="E"){var lt=e.substr(++j).match(jw);if(!lt||!lt[2])return new t(ct.from(Hs));_=parseInt(lt[0],10),j=j+lt[0].length}if(e[j])return new t(ct.from(Hs));if(v=0,!h)v=0,w=0,d[0]=0,c=1,h=1,s=0;else if(w=h-1,s=c,s!==1)for(;d[p+s-1]===0;)s=s-1;for(_<=l&&l-_>16384?_=Fs:_=_-l;_>wn;){if(w=w+1,w-v>Bw){var kt=d.join("");if(kt.match(/^0+$/)){_=wn;break}Br(e,"overflow")}_=_-1}for(;_<Fs||h<c;){if(w===0&&s<h){_=Fs,s=0;break}if(h<c?c=c-1:w=w-1,_<wn)_=_+1;else{var kt=d.join("");if(kt.match(/^0+$/)){_=wn;break}Br(e,"overflow")}}if(w-v+1<s){var At=o;n&&(p=p+1,At=At+1),r&&(p=p+1,At=At+1);var jt=parseInt(e[p+w+1],10),Wt=0;if(jt>=5&&(Wt=1,jt===5)){for(Wt=d[w]%2===1?1:0,k=p+w+2;k<At;k++)if(parseInt(e[k],10)){Wt=1;break}}if(Wt){for(var ft=w;ft>=0;ft--)if(++d[ft]>9&&(d[ft]=0,ft===0))if(_<wn)_=_+1,d[ft]=1;else return new t(ct.from(r?Ll:Ml))}}if(A=K.fromNumber(0),B=K.fromNumber(0),s===0)A=K.fromNumber(0),B=K.fromNumber(0);else if(w-v<17){var ft=v;for(B=K.fromNumber(d[ft++]),A=new K(0,0);ft<=w;ft++)B=B.multiply(K.fromNumber(10)),B=B.add(K.fromNumber(d[ft]))}else{var ft=v;for(A=K.fromNumber(d[ft++]);ft<=w-17;ft++)A=A.multiply(K.fromNumber(10)),A=A.add(K.fromNumber(d[ft]));for(B=K.fromNumber(d[ft++]);ft<=w;ft++)B=B.multiply(K.fromNumber(10)),B=B.add(K.fromNumber(d[ft]))}var Gt=qw(A,K.fromString("100000000000000000"));Gt.low=Gt.low.add(B),Ww(Gt.low,B)&&(Gt.high=Gt.high.add(K.fromNumber(1))),G=_+Rl;var st={low:K.fromNumber(0),high:K.fromNumber(0)};Gt.high.shiftRightUnsigned(49).and(K.fromNumber(1)).equals(K.fromNumber(1))?(st.high=st.high.or(K.fromNumber(3).shiftLeft(61)),st.high=st.high.or(K.fromNumber(G).and(K.fromNumber(16383).shiftLeft(47))),st.high=st.high.or(Gt.high.and(K.fromNumber(0x7fffffffffff)))):(st.high=st.high.or(K.fromNumber(G&16383).shiftLeft(49)),st.high=st.high.or(Gt.high.and(K.fromNumber(562949953421311)))),st.low=Gt.low,r&&(st.high=st.high.or(K.fromString("9223372036854775808")));var et=ct.alloc(16);return j=0,et[j++]=st.low.low&255,et[j++]=st.low.low>>8&255,et[j++]=st.low.low>>16&255,et[j++]=st.low.low>>24&255,et[j++]=st.low.high&255,et[j++]=st.low.high>>8&255,et[j++]=st.low.high>>16&255,et[j++]=st.low.high>>24&255,et[j++]=st.high.low&255,et[j++]=st.high.low>>8&255,et[j++]=st.high.low>>16&255,et[j++]=st.high.low>>24&255,et[j++]=st.high.high&255,et[j++]=st.high.high>>8&255,et[j++]=st.high.high>>16&255,et[j++]=st.high.high>>24&255,new t(et)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,c,l={parts:[0,0,0,0]},p,d,h=[];s=0;var b=this.bytes,v=b[s++]|b[s++]<<8|b[s++]<<16|b[s++]<<24,w=b[s++]|b[s++]<<8|b[s++]<<16|b[s++]<<24,_=b[s++]|b[s++]<<8|b[s++]<<16|b[s++]<<24,k=b[s++]|b[s++]<<8|b[s++]<<16|b[s++]<<24;s=0;var A={low:new K(v,w),high:new K(_,k)};A.high.lessThan(K.ZERO)&&h.push("-");var B=k>>26&$w;if(B>>3===3){if(B===Fw)return h.join("")+"Infinity";if(B===Hw)return"NaN";e=k>>15&Ul,c=8+(k>>14&1)}else c=k>>14&7,e=k>>17&Ul;var G=e-Rl;if(l.parts[0]=(k&16383)+((c&15)<<14),l.parts[1]=_,l.parts[2]=w,l.parts[3]=v,l.parts[0]===0&&l.parts[1]===0&&l.parts[2]===0&&l.parts[3]===0)o=!0;else for(d=3;d>=0;d--){var j=0,X=Vw(l);if(l=X.quotient,j=X.rem.low,!!j)for(p=8;p>=0;p--)n[d*9+p]=j%10,j=Math.floor(j/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var _t=r-1+G;if(_t>=34||_t<=-7||G>0){if(r>34)return h.push("".concat(0)),G>0?h.push("E+".concat(G)):G<0&&h.push("E".concat(G)),h.join("");h.push("".concat(n[s++])),r=r-1,r&&h.push(".");for(var i=0;i<r;i++)h.push("".concat(n[s++]));h.push("E"),_t>0?h.push("+".concat(_t)):h.push("".concat(_t))}else if(G>=0)for(var i=0;i<r;i++)h.push("".concat(n[s++]));else{var Dt=r+G;if(Dt>0)for(var i=0;i<Dt;i++)h.push("".concat(n[s++]));else h.push("0");for(h.push(".");Dt++<0;)h.push("0");for(var i=0;i<r-Math.max(Dt-1,0);i++)h.push("".concat(n[s++]))}return h.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(Ba.prototype,"_bsontype",{value:"Decimal128"});var ms=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(ms.prototype,"_bsontype",{value:"Double"});var ys=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(ys.prototype,"_bsontype",{value:"Int32"});var ja=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(ja.prototype,"_bsontype",{value:"MaxKey"});var $a=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($a.prototype,"_bsontype",{value:"MinKey"});var Gw=new RegExp("^[0-9a-fA-F]{24}$"),dr=null,Se=Symbol("id"),Yt=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 Tt("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=ct.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Se]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Se]=r instanceof ct?r:zi(r);else if(typeof r=="string")if(r.length===12){var n=ct.from(r);if(n.byteLength===12)this[Se]=n;else throw new Tt("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Gw.test(r))this[Se]=ct.from(r,"hex");else throw new Tt("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Tt("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[Se]},set:function(e){this[Se]=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=ct.alloc(12);return n.writeUInt32BE(e,0),dr===null&&(dr=Bh(5)),n[4]=dr[0],n[5]=dr[1],n[6]=dr[2],n[7]=dr[3],n[8]=dr[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[Se][11]===e[Se][11]&&this[Se].equals(e[Se]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Ua(this.id))return e===ct.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 ct.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=ct.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 Tt("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(ct.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(Yt.prototype,"generate",{value:fs(function(t){return Yt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Yt.prototype,"getInc",{value:fs(function(){return Yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Yt.prototype,"get_inc",{value:fs(function(){return Yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Yt,"get_inc",{value:fs(function(){return Yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Yt.prototype,"_bsontype",{value:"ObjectID"});function zw(t){return t.split("").sort().join("")}var zn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=zw(r??""),this.pattern.indexOf("\0")!==-1)throw new _r("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new _r("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 _r("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 Tt("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(zn.prototype,"_bsontype",{value:"BSONRegExp"});var Fa=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(Fa.prototype,"_bsontype",{value:"Symbol"});var Yw=K,Hh=function(t){ds(e,t);function e(r,n){var i=this;return i instanceof e?(K.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:ii(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(K.fromInt(r,!0))},e.fromNumber=function(r){return new e(K.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(K.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=K.MAX_UNSIGNED_VALUE,e}(Yw);function Kw(t){return ii(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var Vh=2147483647,qh=-2147483648,Wh=9223372036854776e3,Gh=-9223372036854776e3,Jw={$oid:Yt,$binary:Er,$uuid:Er,$symbol:Fa,$numberInt:ys,$numberDecimal:Ba,$numberDouble:ms,$numberLong:K,$minKey:$a,$maxKey:ja,$regex:zn,$regularExpression:zn,$timestamp:Hh};function zh(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<=Vh)return new ys(t);if(t>=Gh&&t<=Wh)return K.fromNumber(t)}return new ms(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(h){return h.startsWith("$")&&t[h]!=null}),n=0;n<r.length;n++){var i=Jw[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var s=t.$date,o=new Date;return e.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):K.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&e.relaxed&&o.setTime(s),o}if(t.$code!=null){var c=Object.assign({},t);return t.$scope&&(c.$scope=zh(t.$scope)),gs.fromExtendedJSON(t)}if(Pw(t)||t.$dbPointer){var l=t.$ref?t:t.$dbPointer;if(l instanceof Gn)return l;var p=Object.keys(l).filter(function(h){return h.startsWith("$")}),d=!0;if(p.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(d=!1)}),d)return Gn.fromExtendedJSON(l)}return t}function Xw(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return er(r,e)}finally{e.seenObjects.pop()}})}function jl(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function er(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(A){return A.obj===t});if(r!==-1){var n=e.seenObjects.map(function(A){return A.propertyName}),i=n.slice(0,r).map(function(A){return"".concat(A," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(A){return"".concat(A," -> ")}).join(""),c=n[n.length-1],l=" ".repeat(i.length+s.length/2),p="-".repeat(o.length+(s.length+c.length)/2-1);throw new Tt(`Converting circular structure to EJSON:
|
|
34
|
+
`)};Jt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=Aa(r)?r(t[1]):r[t[1]];if(s!=null){var o=t[6],c=t[5],l=t[4],p=s;c==0&&l&&(p=this.indentPartial(s,l,o));var d=this.parse(p,i);return this.renderTokens(d,e,r,p,n)}}};Jt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};Jt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||de.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===de.escape?String(i):n(i)};Jt.prototype.rawValue=function(t){return t[1]};Jt.prototype.getConfigTags=function(t){return hn(t)?t:t&&typeof t=="object"?t.tags:void 0};Jt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!hn(t))return t.escape};var de={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){qn.templateCache=t},get templateCache(){return qn.templateCache}},qn=new Jt;de.clearCache=function(){return qn.clearCache()};de.parse=function(t,e){return qn.parse(t,e)};de.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Tv(t)+'" was given as the first argument for mustache#render(template, view, partials)');return qn.render(t,e,r,n)};de.escape=Pv;de.Scanner=ri;de.Context=Zr;de.Writer=Jt;var qe=de,Wn=class Le{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;constructor(){}static get(){return Le._instance||(Le._instance=new Le),Le._instance}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Le.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Le.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return window.CooeeSDK.uaParser.getDevice().type==="mobile"}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,s=e.spc,o=Le.get().getWidth(),c=Le.get().getHeight();r&&(o=o?Math.min(o,r):r,c=c?Math.min(c,r):r),c&&(o-=s.getHorizontal(),c-=s.getVertical(),o/c<n/i?this.scalingFactor=o/n:this.scalingFactor=c/i,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(e){return this.doc.createElement(e)}appendChild(e,r){e.appendChild(r)}setStyles(e,r){Object.assign(e.style,r)}setStyle(e,r,n){if(r){if(!n){e.style.removeProperty(r);return}e.style.setProperty(r,n,"important")}}setAttribute(e,r,n){e.setAttribute(r,n)}removeInApp(e){let r=document.querySelector(`.${e.rootClassName}`);r&&r.parentElement.removeChild(r)}setParentContainer(e){this.parentContainer=e,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}},Fv="?from=cooee";function Na(){return!!window.Shopify}function Hv(){if(Na())return window.Shopify.shop?.split(".")?.[0]}function Vv(t){let e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}function Gi(){return window.Shopify?.routes?.root??"/"}function Bn(t){return Gi()+t+Fv}var qv=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},Wv=class Lo{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,s=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(T.debug(`Lock retry ${i}`),n=await this.acquire(e,s),!n);)await this.sleep(Lo.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,s)}}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),s=i?JSON.parse(i):null;if(s&&n<=s.expiry)return!1;let o={owner:r,expiry:n+Lo.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(o)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(T.debug(`${r}: Lock acquired!`),!0):(T.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),T.debug(`${r}: Lock released`)):T.debug(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}},xt=class bh{static CURRENT;token;items;total_price;original_total_price;items_subtotal_price;currency;item_count;attributes;cart_level_discount_applications;lock=new qv;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new bh),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Lt.set(ot.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await te.get(ot.ID),r=await Lt.get(ot.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){T.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()};T.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();T.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,Ot.get().currencyCode=this.currency,T.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 T.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){T.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},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){T.debug("Not fetching cart");return}T.debug("Fetching cart");let r=Bn("cart.js"),n=await(await fetch(r)).json();this.update(n)}},Gv=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}},zv=class{enabled;constructor(t){this.enabled=t.enabled}},Yv=class extends zv{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},Kv=class{productQuantity;constructor(t){t??={},this.productQuantity=new Yv(t.productQuantity)}},ni=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new _u(t.bg)),t.br&&(this.br=new ra(t.br)),t.shd&&(this.shd=new Wd(t.shd)),t.spc&&(this.spc=new ia(t.spc)),this.trf=new Su(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Oa[this.t]}get click(){return this.clc}},Oa=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.PRODUCT_RATING=19]="PRODUCT_RATING",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Oa||{}),_h=class extends ni{constructor(t){super(t)}},ka=class extends ni{src;constructor(t){super(t),this.src=t.src}},hs=class extends ni{typo;constructor(t){super(t);let e=x(x({},t.f),t.typo);t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new Ge(e)}get color(){return this.typography.tc}get typography(){return this.typo}},Mo=class extends hs{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},Jv=class extends ni{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},Eh=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let r=new Date;t===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),l=Math.floor(s%(1e3*60*60)/(1e3*60)),p=Math.floor(s%(1e3*60)/1e3);e({days:o,hours:c,minutes:l,seconds:p})},1e3);return n}},Sh=class extends hs{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new Eh(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Xv=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new re(t.c??{})}get text(){return this.txt}get color(){return this.c}},Pa=class extends hs{ph;constructor(t){super(t),this.ph=new Xv(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},Ih=class extends Pa{constructor(t){t??={},super(t)}},Ch=class extends Pa{},Th=class extends Pa{},xh=class extends ka{},ps=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(ps||{}),Qv=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.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[]}}},Sl=class extends ni{gvt;max;cover;anim;embedded;position;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new Qv(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new ia({pl:H.IN_APP_DEFAULT_PADDING,pr:H.IN_APP_DEFAULT_PADDING,pt:H.IN_APP_DEFAULT_PADDING,pb:H.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},Zv=class extends Sl{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new Jv(t.cont),this.mob=new Sl(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(e=>{e.t===1?this.elems.push(new ka(e)):e.t===2?this.elems.push(new Mo(e)):e.t===3?this.elems.push(new Mo(e)):e.t===100?this.elems.push(new _h(e)):e.t===51?this.elems.push(new Ch(e)):e.t===52?this.elems.push(new Th(e)):e.t===61?this.elems.push(new Sh(e)):e.t===15||e.t===16?this.elems.push(new Ih(e)):e.t===13&&this.elems.push(new xh(e))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},e,r;return this.gvt===1?(e="flex-start",r="flex-start"):this.gvt===2?(e="center",r="flex-start"):this.gvt===3?(e="flex-end",r="flex-start"):this.gvt===4?(e="flex-start",r="center"):this.gvt===6?(e="flex-end",r="center"):this.gvt===7?(e="flex-start",r="flex-end"):this.gvt===8?(e="center",r="flex-end"):this.gvt===9?(e="flex-end",r="flex-end"):(e="center",r="center"),t.alignItems=r,t.justifyContent=e,t.overflow="visible",t}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}},Dh=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}},tw=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}},ew=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}},Il=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new ia(t.spc),t.size&&(this.size=new ew(t.size)),t.bg&&(this.bg=new _u(t.bg)),t.br&&(this.br=new ra(t.br)),t.typo&&(this.typo=new Ge(t.typo)),t.lout&&(this.lout=new tw(t.lout)),t.flex&&(this.flex=new Dh(t.flex))}},Ah=class{sm;lg;constructor(t){t??={},this.sm=new Il(t.sm),this.lg=new Il(t.lg)}},lr=class{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new Ah(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return Oa[this.t]}},Ne=class extends lr{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text}},Uo=class extends Ne{constructor(t,e){super(t,e??3)}},Nh=class extends lr{value;constructor(t){super(6,t),t??={},this.value=t.value}},Oh=class extends Ne{showChips;optionsConfig;constructor(t=15,e){super(e,t),e??={},this.showChips=e.showChips??!1,this.optionsConfig=e.optionsConfig??{}}},rw=class extends lr{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new re(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}},nw=ke(sn()),iw=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new re(t.color)}},sw=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new re(t.color)}},kh=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new sw(t.navigation),this.pagination=new iw(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},ow=class extends lr{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=tn.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new kh(t.conf),this.allowedTypes=t.allowedTypes}},aw=class extends Ne{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new Eh(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Ra=class extends lr{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=tn.getParsedElement(e);r&&this.elems.push(r)})}},Bo=class extends lr{src;sm;lg;constructor(t,e){super(e??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}},tn=class Ph{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=Ph.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new Ne(e);case 3:return new Uo(e);case 6:return new Nh(e);case 11:return new cw(e);case 12:return new La(e);case 61:return new aw(e);case 4:return new Ra(e);case 1:return new Bo(e);case 13:return new Bo(e,13);case 14:return new Ne(e,14);case 15:case 16:return new Oh(e.t,e);case 18:return new Uo(e,18);case 62:return new ow(e);case 19:return new rw(e);default:nw.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"}}},La=class extends lr{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=tn.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new Nh(t.cBox)),this.elems.push(new Bo(t.img,13));let e=new Ne(t.title,14);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);let r=new Ne(t.price);r.text="{{ product.price }}",r.hide=!t.show?.price;let n=new Ne(t.compareAt);n.text="{{ product.compare_price }}",n.hide=!t.show?.price,t.compareAt||(n.style=new Ah(r.style),n.style.lg.typo=new Ge(yt(x({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new Ge(yt(x({},n.style.sm.typo),{td:"line-through"})));let i=new Ra({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:tn.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new Oh(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let o=new Uo(t.btn,18);o.hide=!t.show?.btn,this.elems.push(o)}}t.symbol&&(this.symbol=new Ne(t.symbol))}},cw=class extends lr{conf;prod;constructor(t){super(11,t),t??={},this.conf=new lw(t.conf),this.prod=new La(t.prod)}},Cl=class extends kh{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},lw=class{lg;sm;constructor(t){t??={},this.lg=new Cl(t.lg),this.sm=new Cl(t.sm)}},uw=class extends Ra{constructor(t){super(t)}},Rh=class{cont;elems=[];constructor(t){t=t??{},this.cont=new uw(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=tn.getParsedElement(t);return e&&this.elems.push(e),e}},hw=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Ai.EXCLUSION}isABTesting(){return this.contentType===Ai.ABTESTING}isSingleContent(){return this.contentType===Ai.SINGLE}},Lh=class{videoConfig;constructor(t){t??={},t.videoConfig&&(this.videoConfig=new Iv(t.videoConfig))}},Ar=class Mh extends hw{static SWIPER_ELEMENTS=new Set([11,62]);nudgeID;contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=Dr({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=Ot.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new Rh(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.embeddedItems=e.embeddedItems?.map(r=>new on(r)),this.items=e.items?.map(r=>new Ve(r))??[],this.nonMutableItems=e.items?.map(r=>new Ve(r))??[],this.collections=e.collections?.map(r=>new Gv(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 Kv(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 Yd(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new Jd(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new Bd(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Ve(e.bundleFrom)),e.content&&(this.content=new Lh(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===Re.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===uo.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===uo.PAGE_EMBED}isProgressBar(){return this.objective===Re.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Re.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Re.CART_RECOVERY}isProductPromotion(){return this.objective===Re.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===mu.COLLECTION}isBYOB(){return this.objective===Re.BYOB}isStickyATC(){return this.objective===Re.STICKY_ATC}isShoppableVideo(){return this.objective===Re.SHOPPABLE_VIDEO}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},s={};if(n){let l=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:l.mID,image:n.variantImage,price:De(l.price.d),comparePrice:De(l.price.cmp),quantity:n.quantity},s={quantity:l.quantity}}let o={productCount:xt.getCurrent().item_count},c=qe.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(c=c.replace(new RegExp(H.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new Zv(JSON.parse(c))}calculateDiscountData(e,r){let n=Ni.sum(e,o=>o.selectedOrFirstVariant.value.price.d),i=Ni.sum(e,o=>{let c=o.selectedOrFirstVariant.value.price;return c.cmp??c.d}),s={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(s);return}if(ge.BXGY===this.discount.type&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,s.discountPercentage,!0),s.discountAmount=s.actualPrice-Ni.sum(e,o=>o.selectedOrFirstVariant.value.effectivePrice.value);else if([ge.UNIQUE_FLAT_ITEMS,ge.STATIC,ge.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],s.discountAmount=s.actualPrice*s.discountPercentage/100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===ge.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)s.discountAmount=s.actualPrice-this.discount.values[0],s.discountPercentage=s.discountAmount/s.actualPrice*100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===ge.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((c,l)=>l.selectedOrFirstVariant.value.price.d-c.selectedOrFirstVariant.value.price.d);let o=e[e.length-1];o.selectedOrFirstVariant.value.effectivePrice.value=0,s.discountAmount=o.selectedOrFirstVariant.value.price.d,s.discountPercentage=s.discountAmount/s.actualPrice*100}s.discountedPrice=s.actualPrice-s.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(s)}getPrivateAttributesForLineItem(){return ne.get().skipItemAttribute?{}:{[H.VIA]:"Cooee",[H.CAMPAIGN_ATTRIBUTE]:this.shortID,[H.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return ne.get().skipItemAttribute?[]:[{key:H.VIA,value:"Cooee"},{key:H.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:H.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[ge.UNIQUE_FIXED_ITEMS,ge.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){let e=this.widget?.elems.find(n=>Mh.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=Wn.get().isMobile()?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}getCartMagicVariables(){let e=xt.getCurrent();return{productCount:e.item_count,amount:De(e.total_price/100),originalAmount:De(e.original_total_price/100)}}updateEffectivePrice(e,r,n=!1){let i=Ot.get().getCurrentItem();e.forEach(s=>{let o=s.selectedOrFirstVariant.value,c=o.price;if(n&&s.mID===i.mID)o.effectivePrice.value=c.d;else{let l=c.d*r/100;o.effectivePrice.value=c.d-l}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:ev(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{r[n]=De(e[n])}),r}};function pw(t,e){return e={exports:{}},t(e,e.exports),e.exports}var dw=yw,fw=ww,gw=Ew,Ae=[],ue=[],mw=typeof Uint8Array<"u"?Uint8Array:Array,js="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pr=0,Tl=js.length;pr<Tl;++pr)Ae[pr]=js[pr],ue[js.charCodeAt(pr)]=pr;var pr,Tl;ue[45]=62;ue[95]=63;function Uh(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 yw(t){var e=Uh(t),r=e[0],n=e[1];return(r+n)*3/4-n}function vw(t,e,r){return(e+r)*3/4-r}function ww(t){var e,r=Uh(t),n=r[0],i=r[1],s=new mw(vw(t,n,i)),o=0,c=i>0?n-4:n,l;for(l=0;l<c;l+=4)e=ue[t.charCodeAt(l)]<<18|ue[t.charCodeAt(l+1)]<<12|ue[t.charCodeAt(l+2)]<<6|ue[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ue[t.charCodeAt(l)]<<2|ue[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=ue[t.charCodeAt(l)]<<10|ue[t.charCodeAt(l+1)]<<4|ue[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function bw(t){return Ae[t>>18&63]+Ae[t>>12&63]+Ae[t>>6&63]+Ae[t&63]}function _w(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(bw(n));return i.join("")}function Ew(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(_w(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],i.push(Ae[e>>2]+Ae[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ae[e>>10]+Ae[e>>4&63]+Ae[e<<2&63]+"=")),i.join("")}var $s={byteLength:dw,toByteArray:fw,fromByteArray:gw},Sw=function(t,e,r,n,i){var s,o,c=i*8-n-1,l=(1<<c)-1,p=l>>1,d=-7,h=r?i-1:0,b=r?-1:1,v=t[e+h];for(h+=b,s=v&(1<<-d)-1,v>>=-d,d+=c;d>0;s=s*256+t[e+h],h+=b,d-=8);for(o=s&(1<<-d)-1,s>>=-d,d+=n;d>0;o=o*256+t[e+h],h+=b,d-=8);if(s===0)s=1-p;else{if(s===l)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-p}return(v?-1:1)*o*Math.pow(2,s-n)},Iw=function(t,e,r,n,i,s){var o,c,l,p=s*8-i-1,d=(1<<p)-1,h=d>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,w=n?1:-1,_=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=d):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+h>=1?e+=b/l:e+=b*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=d?(c=0,o=d):o+h>=1?(c=(e*l-1)*Math.pow(2,i),o=o+h):(c=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+v]=c&255,v+=w,c/=256,i-=8);for(o=o<<i|c,p+=i;p>0;t[r+v]=o&255,v+=w,o/=256,p-=8);t[r+v-w]|=_*128},Ur={read:Sw,write:Iw},ds=pw(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=A,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.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 a=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(a,u),a.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(a){if(a>n)throw new RangeError('The value "'+a+'" is invalid for option "size"');var u=new Uint8Array(a);return Object.setPrototypeOf(u,o.prototype),u}function o(a,u,f){if(typeof a=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(a)}return c(a,u,f)}o.poolSize=8192;function c(a,u,f){if(typeof a=="string")return h(a,u);if(ArrayBuffer.isView(a))return v(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(ae(a,ArrayBuffer)||a&&ae(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ae(a,SharedArrayBuffer)||a&&ae(a.buffer,SharedArrayBuffer)))return w(a,u,f);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var E=a.valueOf&&a.valueOf();if(E!=null&&E!==a)return o.from(E,u,f);var D=_(a);if(D)return D;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return o.from(a[Symbol.toPrimitive]("string"),u,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}o.from=function(a,u,f){return c(a,u,f)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function p(a,u,f){return l(a),a<=0?s(a):u!==void 0?typeof f=="string"?s(a).fill(u,f):s(a).fill(u):s(a)}o.alloc=function(a,u,f){return p(a,u,f)};function d(a){return l(a),s(a<0?0:k(a)|0)}o.allocUnsafe=function(a){return d(a)},o.allocUnsafeSlow=function(a){return d(a)};function h(a,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var f=B(a,u)|0,E=s(f),D=E.write(a,u);return D!==f&&(E=E.slice(0,D)),E}function b(a){for(var u=a.length<0?0:k(a.length)|0,f=s(u),E=0;E<u;E+=1)f[E]=a[E]&255;return f}function v(a){if(ae(a,Uint8Array)){var u=new Uint8Array(a);return w(u.buffer,u.byteOffset,u.byteLength)}return b(a)}function w(a,u,f){if(u<0||a.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<u+(f||0))throw new RangeError('"length" is outside of buffer bounds');var E;return u===void 0&&f===void 0?E=new Uint8Array(a):f===void 0?E=new Uint8Array(a,u):E=new Uint8Array(a,u,f),Object.setPrototypeOf(E,o.prototype),E}function _(a){if(o.isBuffer(a)){var u=k(a.length)|0,f=s(u);return f.length===0||a.copy(f,0,0,u),f}if(a.length!==void 0)return typeof a.length!="number"||fn(a.length)?s(0):b(a);if(a.type==="Buffer"&&Array.isArray(a.data))return b(a.data)}function k(a){if(a>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return a|0}function A(a){return+a!=a&&(a=0),o.alloc(+a)}o.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==o.prototype},o.compare=function(a,u){if(ae(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),ae(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(a)||!o.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===u)return 0;for(var f=a.length,E=u.length,D=0,M=Math.min(f,E);D<M;++D)if(a[D]!==u[D]){f=a[D],E=u[D];break}return f<E?-1:E<f?1:0},o.isEncoding=function(a){switch(String(a).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}},o.concat=function(a,u){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return o.alloc(0);var f;if(u===void 0)for(u=0,f=0;f<a.length;++f)u+=a[f].length;var E=o.allocUnsafe(u),D=0;for(f=0;f<a.length;++f){var M=a[f];if(ae(M,Uint8Array))D+M.length>E.length?o.from(M).copy(E,D):Uint8Array.prototype.set.call(E,M,D);else if(o.isBuffer(M))M.copy(E,D);else throw new TypeError('"list" argument must be an Array of Buffers');D+=M.length}return E};function B(a,u){if(o.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||ae(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var f=a.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&f===0)return 0;for(var D=!1;;)switch(u){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return dn(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return hi(a).length;default:if(D)return E?-1:dn(a).length;u=(""+u).toLowerCase(),D=!0}}o.byteLength=B;function G(a,u,f){var E=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,u>>>=0,f<=u))return"";for(a||(a="utf8");;)switch(a){case"hex":return Gt(this,u,f);case"utf8":case"utf-8":return kt(this,u,f);case"ascii":return Wt(this,u,f);case"latin1":case"binary":return ft(this,u,f);case"base64":return lt(this,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return st(this,u,f);default:if(E)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),E=!0}}o.prototype._isBuffer=!0;function j(a,u,f){var E=a[u];a[u]=a[f],a[f]=E}o.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<a;u+=2)j(this,u,u+1);return this},o.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<a;u+=4)j(this,u,u+3),j(this,u+1,u+2);return this},o.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<a;u+=8)j(this,u,u+7),j(this,u+1,u+6),j(this,u+2,u+5),j(this,u+3,u+4);return this},o.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?kt(this,0,a):G.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(a){if(!o.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:o.compare(this,a)===0},o.prototype.inspect=function(){var a="",u=e.INSPECT_MAX_BYTES;return a=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(a+=" ... "),"<Buffer "+a+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(a,u,f,E,D){if(ae(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),!o.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(u===void 0&&(u=0),f===void 0&&(f=a?a.length:0),E===void 0&&(E=0),D===void 0&&(D=this.length),u<0||f>a.length||E<0||D>this.length)throw new RangeError("out of range index");if(E>=D&&u>=f)return 0;if(E>=D)return-1;if(u>=f)return 1;if(u>>>=0,f>>>=0,E>>>=0,D>>>=0,this===a)return 0;for(var M=D-E,Y=f-u,ut=Math.min(M,Y),Nt=this.slice(E,D),gt=a.slice(u,f),St=0;St<ut;++St)if(Nt[St]!==gt[St]){M=Nt[St],Y=gt[St];break}return M<Y?-1:Y<M?1:0};function X(a,u,f,E,D){if(a.length===0)return-1;if(typeof f=="string"?(E=f,f=0):f>2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,fn(f)&&(f=D?0:a.length-1),f<0&&(f=a.length+f),f>=a.length){if(D)return-1;f=a.length-1}else if(f<0)if(D)f=0;else return-1;if(typeof u=="string"&&(u=o.from(u,E)),o.isBuffer(u))return u.length===0?-1:_t(a,u,f,E,D);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(a,u,f):Uint8Array.prototype.lastIndexOf.call(a,u,f):_t(a,[u],f,E,D);throw new TypeError("val must be string, number or Buffer")}function _t(a,u,f,E,D){var M=1,Y=a.length,ut=u.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(a.length<2||u.length<2)return-1;M=2,Y/=2,ut/=2,f/=2}function Nt(gn,mn){return M===1?gn[mn]:gn.readUInt16BE(mn*M)}var gt;if(D){var St=-1;for(gt=f;gt<Y;gt++)if(Nt(a,gt)===Nt(u,St===-1?0:gt-St)){if(St===-1&&(St=gt),gt-St+1===ut)return St*M}else St!==-1&&(gt-=gt-St),St=-1}else for(f+ut>Y&&(f=Y-ut),gt=f;gt>=0;gt--){for(var Ut=!0,hr=0;hr<ut;hr++)if(Nt(a,gt+hr)!==Nt(u,hr)){Ut=!1;break}if(Ut)return gt}return-1}o.prototype.includes=function(a,u,f){return this.indexOf(a,u,f)!==-1},o.prototype.indexOf=function(a,u,f){return X(this,a,u,f,!0)},o.prototype.lastIndexOf=function(a,u,f){return X(this,a,u,f,!1)};function Dt(a,u,f,E){f=Number(f)||0;var D=a.length-f;E?(E=Number(E),E>D&&(E=D)):E=D;var M=u.length;E>M/2&&(E=M/2);for(var Y=0;Y<E;++Y){var ut=parseInt(u.substr(Y*2,2),16);if(fn(ut))return Y;a[f+Y]=ut}return Y}function q(a,u,f,E){return Lr(dn(u,a.length-f),a,f,E)}function rt(a,u,f,E){return Lr(Is(u),a,f,E)}function Q(a,u,f,E){return Lr(hi(u),a,f,E)}function tt(a,u,f,E){return Lr(Cs(u,a.length-f),a,f,E)}o.prototype.write=function(a,u,f,E){if(u===void 0)E="utf8",f=this.length,u=0;else if(f===void 0&&typeof u=="string")E=u,f=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(f)?(f=f>>>0,E===void 0&&(E="utf8")):(E=f,f=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var D=this.length-u;if((f===void 0||f>D)&&(f=D),a.length>0&&(f<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");E||(E="utf8");for(var M=!1;;)switch(E){case"hex":return Dt(this,a,u,f);case"utf8":case"utf-8":return q(this,a,u,f);case"ascii":case"latin1":case"binary":return rt(this,a,u,f);case"base64":return Q(this,a,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tt(this,a,u,f);default:if(M)throw new TypeError("Unknown encoding: "+E);E=(""+E).toLowerCase(),M=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lt(a,u,f){return u===0&&f===a.length?$s.fromByteArray(a):$s.fromByteArray(a.slice(u,f))}function kt(a,u,f){f=Math.min(a.length,f);for(var E=[],D=u;D<f;){var M=a[D],Y=null,ut=M>239?4:M>223?3:M>191?2:1;if(D+ut<=f){var Nt,gt,St,Ut;switch(ut){case 1:M<128&&(Y=M);break;case 2:Nt=a[D+1],(Nt&192)===128&&(Ut=(M&31)<<6|Nt&63,Ut>127&&(Y=Ut));break;case 3:Nt=a[D+1],gt=a[D+2],(Nt&192)===128&&(gt&192)===128&&(Ut=(M&15)<<12|(Nt&63)<<6|gt&63,Ut>2047&&(Ut<55296||Ut>57343)&&(Y=Ut));break;case 4:Nt=a[D+1],gt=a[D+2],St=a[D+3],(Nt&192)===128&&(gt&192)===128&&(St&192)===128&&(Ut=(M&15)<<18|(Nt&63)<<12|(gt&63)<<6|St&63,Ut>65535&&Ut<1114112&&(Y=Ut))}}Y===null?(Y=65533,ut=1):Y>65535&&(Y-=65536,E.push(Y>>>10&1023|55296),Y=56320|Y&1023),E.push(Y),D+=ut}return jt(E)}var At=4096;function jt(a){var u=a.length;if(u<=At)return String.fromCharCode.apply(String,a);for(var f="",E=0;E<u;)f+=String.fromCharCode.apply(String,a.slice(E,E+=At));return f}function Wt(a,u,f){var E="";f=Math.min(a.length,f);for(var D=u;D<f;++D)E+=String.fromCharCode(a[D]&127);return E}function ft(a,u,f){var E="";f=Math.min(a.length,f);for(var D=u;D<f;++D)E+=String.fromCharCode(a[D]);return E}function Gt(a,u,f){var E=a.length;(!u||u<0)&&(u=0),(!f||f<0||f>E)&&(f=E);for(var D="",M=u;M<f;++M)D+=Ts[a[M]];return D}function st(a,u,f){for(var E=a.slice(u,f),D="",M=0;M<E.length-1;M+=2)D+=String.fromCharCode(E[M]+E[M+1]*256);return D}o.prototype.slice=function(a,u){var f=this.length;a=~~a,u=u===void 0?f:~~u,a<0?(a+=f,a<0&&(a=0)):a>f&&(a=f),u<0?(u+=f,u<0&&(u=0)):u>f&&(u=f),u<a&&(u=a);var E=this.subarray(a,u);return Object.setPrototypeOf(E,o.prototype),E};function et(a,u,f){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+u>f)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(a,u,f){a=a>>>0,u=u>>>0,f||et(a,u,this.length);for(var E=this[a],D=1,M=0;++M<u&&(D*=256);)E+=this[a+M]*D;return E},o.prototype.readUintBE=o.prototype.readUIntBE=function(a,u,f){a=a>>>0,u=u>>>0,f||et(a,u,this.length);for(var E=this[a+--u],D=1;u>0&&(D*=256);)E+=this[a+--u]*D;return E},o.prototype.readUint8=o.prototype.readUInt8=function(a,u){return a=a>>>0,u||et(a,1,this.length),this[a]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(a,u){return a=a>>>0,u||et(a,2,this.length),this[a]|this[a+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(a,u){return a=a>>>0,u||et(a,2,this.length),this[a]<<8|this[a+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(a,u){return a=a>>>0,u||et(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(a,u){return a=a>>>0,u||et(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},o.prototype.readIntLE=function(a,u,f){a=a>>>0,u=u>>>0,f||et(a,u,this.length);for(var E=this[a],D=1,M=0;++M<u&&(D*=256);)E+=this[a+M]*D;return D*=128,E>=D&&(E-=Math.pow(2,8*u)),E},o.prototype.readIntBE=function(a,u,f){a=a>>>0,u=u>>>0,f||et(a,u,this.length);for(var E=u,D=1,M=this[a+--E];E>0&&(D*=256);)M+=this[a+--E]*D;return D*=128,M>=D&&(M-=Math.pow(2,8*u)),M},o.prototype.readInt8=function(a,u){return a=a>>>0,u||et(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},o.prototype.readInt16LE=function(a,u){a=a>>>0,u||et(a,2,this.length);var f=this[a]|this[a+1]<<8;return f&32768?f|4294901760:f},o.prototype.readInt16BE=function(a,u){a=a>>>0,u||et(a,2,this.length);var f=this[a+1]|this[a]<<8;return f&32768?f|4294901760:f},o.prototype.readInt32LE=function(a,u){return a=a>>>0,u||et(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},o.prototype.readInt32BE=function(a,u){return a=a>>>0,u||et(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},o.prototype.readFloatLE=function(a,u){return a=a>>>0,u||et(a,4,this.length),Ur.read(this,a,!0,23,4)},o.prototype.readFloatBE=function(a,u){return a=a>>>0,u||et(a,4,this.length),Ur.read(this,a,!1,23,4)},o.prototype.readDoubleLE=function(a,u){return a=a>>>0,u||et(a,8,this.length),Ur.read(this,a,!0,52,8)},o.prototype.readDoubleBE=function(a,u){return a=a>>>0,u||et(a,8,this.length),Ur.read(this,a,!1,52,8)};function $t(a,u,f,E,D,M){if(!o.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>D||u<M)throw new RangeError('"value" argument is out of bounds');if(f+E>a.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(a,u,f,E){if(a=+a,u=u>>>0,f=f>>>0,!E){var D=Math.pow(2,8*f)-1;$t(this,a,u,f,D,0)}var M=1,Y=0;for(this[u]=a&255;++Y<f&&(M*=256);)this[u+Y]=a/M&255;return u+f},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(a,u,f,E){if(a=+a,u=u>>>0,f=f>>>0,!E){var D=Math.pow(2,8*f)-1;$t(this,a,u,f,D,0)}var M=f-1,Y=1;for(this[u+M]=a&255;--M>=0&&(Y*=256);)this[u+M]=a/Y&255;return u+f},o.prototype.writeUint8=o.prototype.writeUInt8=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,1,255,0),this[u]=a&255,u+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,2,65535,0),this[u]=a&255,this[u+1]=a>>>8,u+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,2,65535,0),this[u]=a>>>8,this[u+1]=a&255,u+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,4,4294967295,0),this[u+3]=a>>>24,this[u+2]=a>>>16,this[u+1]=a>>>8,this[u]=a&255,u+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,4,4294967295,0),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4},o.prototype.writeIntLE=function(a,u,f,E){if(a=+a,u=u>>>0,!E){var D=Math.pow(2,8*f-1);$t(this,a,u,f,D-1,-D)}var M=0,Y=1,ut=0;for(this[u]=a&255;++M<f&&(Y*=256);)a<0&&ut===0&&this[u+M-1]!==0&&(ut=1),this[u+M]=(a/Y>>0)-ut&255;return u+f},o.prototype.writeIntBE=function(a,u,f,E){if(a=+a,u=u>>>0,!E){var D=Math.pow(2,8*f-1);$t(this,a,u,f,D-1,-D)}var M=f-1,Y=1,ut=0;for(this[u+M]=a&255;--M>=0&&(Y*=256);)a<0&&ut===0&&this[u+M+1]!==0&&(ut=1),this[u+M]=(a/Y>>0)-ut&255;return u+f},o.prototype.writeInt8=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,1,127,-128),a<0&&(a=255+a+1),this[u]=a&255,u+1},o.prototype.writeInt16LE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,2,32767,-32768),this[u]=a&255,this[u+1]=a>>>8,u+2},o.prototype.writeInt16BE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,2,32767,-32768),this[u]=a>>>8,this[u+1]=a&255,u+2},o.prototype.writeInt32LE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,4,2147483647,-2147483648),this[u]=a&255,this[u+1]=a>>>8,this[u+2]=a>>>16,this[u+3]=a>>>24,u+4},o.prototype.writeInt32BE=function(a,u,f){return a=+a,u=u>>>0,f||$t(this,a,u,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4};function ci(a,u,f,E,D,M){if(f+E>a.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function li(a,u,f,E,D){return u=+u,f=f>>>0,D||ci(a,u,f,4),Ur.write(a,u,f,E,23,4),f+4}o.prototype.writeFloatLE=function(a,u,f){return li(this,a,u,!0,f)},o.prototype.writeFloatBE=function(a,u,f){return li(this,a,u,!1,f)};function oe(a,u,f,E,D){return u=+u,f=f>>>0,D||ci(a,u,f,8),Ur.write(a,u,f,E,52,8),f+8}o.prototype.writeDoubleLE=function(a,u,f){return oe(this,a,u,!0,f)},o.prototype.writeDoubleBE=function(a,u,f){return oe(this,a,u,!1,f)},o.prototype.copy=function(a,u,f,E){if(!o.isBuffer(a))throw new TypeError("argument should be a Buffer");if(f||(f=0),!E&&E!==0&&(E=this.length),u>=a.length&&(u=a.length),u||(u=0),E>0&&E<f&&(E=f),E===f||a.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(f<0||f>=this.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("sourceEnd out of bounds");E>this.length&&(E=this.length),a.length-u<E-f&&(E=a.length-u+f);var D=E-f;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,f,E):Uint8Array.prototype.set.call(a,this.subarray(f,E),u),D},o.prototype.fill=function(a,u,f,E){if(typeof a=="string"){if(typeof u=="string"?(E=u,u=0,f=this.length):typeof f=="string"&&(E=f,f=this.length),E!==void 0&&typeof E!="string")throw new TypeError("encoding must be a string");if(typeof E=="string"&&!o.isEncoding(E))throw new TypeError("Unknown encoding: "+E);if(a.length===1){var D=a.charCodeAt(0);(E==="utf8"&&D<128||E==="latin1")&&(a=D)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(u<0||this.length<u||this.length<f)throw new RangeError("Out of range index");if(f<=u)return this;u=u>>>0,f=f===void 0?this.length:f>>>0,a||(a=0);var M;if(typeof a=="number")for(M=u;M<f;++M)this[M]=a;else{var Y=o.isBuffer(a)?a:o.from(a,E),ut=Y.length;if(ut===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(M=0;M<f-u;++M)this[M+u]=Y[M%ut]}return this};var ui=/[^+/0-9A-Za-z-_]/g;function Ss(a){if(a=a.split("=")[0],a=a.trim().replace(ui,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function dn(a,u){u=u||1/0;for(var f,E=a.length,D=null,M=[],Y=0;Y<E;++Y){if(f=a.charCodeAt(Y),f>55295&&f<57344){if(!D){if(f>56319){(u-=3)>-1&&M.push(239,191,189);continue}else if(Y+1===E){(u-=3)>-1&&M.push(239,191,189);continue}D=f;continue}if(f<56320){(u-=3)>-1&&M.push(239,191,189),D=f;continue}f=(D-55296<<10|f-56320)+65536}else D&&(u-=3)>-1&&M.push(239,191,189);if(D=null,f<128){if((u-=1)<0)break;M.push(f)}else if(f<2048){if((u-=2)<0)break;M.push(f>>6|192,f&63|128)}else if(f<65536){if((u-=3)<0)break;M.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((u-=4)<0)break;M.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error("Invalid code point")}return M}function Is(a){for(var u=[],f=0;f<a.length;++f)u.push(a.charCodeAt(f)&255);return u}function Cs(a,u){for(var f,E,D,M=[],Y=0;Y<a.length&&!((u-=2)<0);++Y)f=a.charCodeAt(Y),E=f>>8,D=f%256,M.push(D),M.push(E);return M}function hi(a){return $s.toByteArray(Ss(a))}function Lr(a,u,f,E){for(var D=0;D<E&&!(D+f>=u.length||D>=a.length);++D)u[D+f]=a[D];return D}function ae(a,u){return a instanceof u||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===u.name}function fn(a){return a!==a}var Ts=function(){for(var a="0123456789abcdef",u=new Array(256),f=0;f<16;++f)for(var E=f*16,D=0;D<16;++D)u[E+D]=a[f]+a[D];return u}()}),ct=ds.Buffer;ds.SlowBuffer;ds.INSPECT_MAX_BYTES;ds.kMaxLength;var jo=function(t,e){return jo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},jo(t,e)};function fs(t,e){jo(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var _r=function(t){fs(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),Tt=function(t){fs(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 Si(t){return t&&t.Math==Math&&t}function Bh(){return Si(typeof globalThis=="object"&&globalThis)||Si(typeof window=="object"&&window)||Si(typeof self=="object"&&self)||Si(typeof global=="object"&&global)||Function("return this")()}function Cw(){var t=Bh();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Tw=function(t){var e=Cw()?"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(e);for(var r=ct.alloc(t),n=0;n<t;++n)r[n]=Math.floor(Math.random()*256);return r},xw=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(ct.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(ct.alloc(e))}:Tw}},jh=xw();function Dw(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Ma(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Aw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Nw(t){return ii(t)&&Object.prototype.toString.call(t)==="[object Date]"}function ii(t){return typeof t=="object"&&t!==null}function gs(t,e){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function zi(t){if(ArrayBuffer.isView(t))return ct.from(t.buffer,t.byteOffset,t.byteLength);if(Dw(t))return ct.from(t);throw new Tt("Must use either Buffer or TypedArray")}var Ow=/^(?:[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,$h=function(t){return typeof t=="string"&&Ow.test(t)},$o=function(t){if(!$h(t))throw new Tt('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 ct.from(e,"hex")},xl=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")},yE=Math.pow(2,63)-1,vE=-Math.pow(2,63),kw=Math.pow(2,53),Pw=-Math.pow(2,53),Fh=4,Er=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 Tt("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=ct.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=ct.from(e,"binary"):Array.isArray(e)?this.buffer=ct.from(e):this.buffer=zi(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Tt("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Tt("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 Tt("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=ct.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=ct.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(zi(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 Dl(this.buffer.slice(0,this.position));throw new _r('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=ct.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=ct.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=$o(e.$uuid)),!n)throw new Tt("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===Fh?new Dl(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(Er.prototype,"_bsontype",{value:"Binary"});var Fs=16,Dl=function(t){fs(e,t);function e(r){var n=this,i,s;if(r==null)i=e.generate();else if(r instanceof e)i=ct.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===Fs)i=zi(r);else if(typeof r=="string")i=$o(r);else throw new Tt("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,Fh)||this,n.__id=s,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=xl(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=xl(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 Er(this.id,Er.SUBTYPE_UUID)},e.generate=function(){var r=jh(Fs);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ct.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?$h(r):Ma(r)?r.length!==Fs?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=$o(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}(Er),ms=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(ms.prototype,"_bsontype",{value:"Code"});function Rw(t){return ii(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var Gn=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var s=e.split(".");s.length===2&&(n=s.shift(),e=s.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(Gn.prototype,"_bsontype",{value:"DBRef"});var le=void 0;try{le=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 Al=65536,Lw=1<<24,Vr=Al*Al,Hh=Vr*Vr,Nl=Hh/2,Ol={},kl={},K=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,s;return r?(e>>>=0,(s=0<=e&&e<256)&&(i=kl[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(kl[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=Ol[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(Ol[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>=Hh)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Nl)return t.MIN_VALUE;if(e+1>=Nl)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%Vr|0,e/Vr|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 s=t.fromNumber(Math.pow(n,8)),o=t.ZERO,c=0;c<e.length;c+=8){var l=Math.min(8,e.length-c),p=parseInt(e.substring(c,c+l),n);if(l<8){var d=t.fromNumber(Math.pow(n,l));o=o.mul(d).add(t.fromNumber(p))}else o=o.mul(s),o=o.add(t.fromNumber(p))}return o.unsigned=r,o},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 ii(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,s=this.low&65535,o=e.high>>>16,c=e.high&65535,l=e.low>>>16,p=e.low&65535,d=0,h=0,b=0,v=0;return v+=s+p,b+=v>>>16,v&=65535,b+=i+l,h+=b>>>16,b&=65535,h+=n+c,d+=h>>>16,h&=65535,d+=r+o,d&=65535,t.fromBits(b<<16|v,d<<16|h,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(le){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?le.div_u:le.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,le.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;s=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 o=this.shr(1);return n=o.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}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();s=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(n)/Math.LN2),l=c<=48?1:Math.pow(2,c-48),p=t.fromNumber(n),d=p.mul(e);d.isNegative()||d.gt(i);)n-=l,p=t.fromNumber(n,this.unsigned),d=p.mul(e);p.isZero()&&(p=t.ONE),s=s.add(p),i=i.sub(d)}return s},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)),le){var r=(this.unsigned?le.rem_u:le.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,le.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)),le){var r=le.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,le.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,s=this.low>>>16,o=this.low&65535,c=e.high>>>16,l=e.high&65535,p=e.low>>>16,d=e.low&65535,h=0,b=0,v=0,w=0;return w+=o*d,v+=w>>>16,w&=65535,v+=s*d,b+=v>>>16,v&=65535,v+=o*p,b+=v>>>16,v&=65535,b+=i*d,h+=b>>>16,b&=65535,b+=s*p,h+=b>>>16,b&=65535,b+=o*l,h+=b>>>16,b&=65535,h+=n*d+i*p+s*l+o*c,h&=65535,t.fromBits(v<<16|w,h<<16|b,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)*Vr+(this.low>>>0):this.high*Vr+(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 s=t.fromNumber(Math.pow(e,6),this.unsigned),o=this,c="";;){var l=o.div(s),p=o.sub(l.mul(s)).toInt()>>>0,d=p.toString(e);if(o=l,o.isZero())return d+c;for(;d.length<6;)d="0"+d;c=""+d+c}},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(Lw),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(K.prototype,"__isLong__",{value:!0});Object.defineProperty(K.prototype,"_bsontype",{value:"Long"});var Mw=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Uw=/^(\+|-)?(Infinity|inf)$/i,Bw=/^(\+|-)?NaN$/i,wn=6111,Hs=-6176,Pl=6176,jw=34,Vs=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Rl=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ll=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),$w=/^([-+])?(\d+)?$/,Fw=31,Ml=16383,Hw=30,Vw=31;function Ul(t){return!isNaN(parseInt(t,10))}function qw(t){var e=K.fromNumber(1e9),r=K.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 K(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Ww(t,e){if(!t&&!e)return{high:K.fromNumber(0),low:K.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new K(t.getLowBits(),0),i=e.shiftRightUnsigned(32),s=new K(e.getLowBits(),0),o=r.multiply(i),c=r.multiply(s),l=n.multiply(i),p=n.multiply(s);return o=o.add(c.shiftRightUnsigned(32)),c=new K(c.getLowBits(),0).add(l).add(p.shiftRightUnsigned(32)),o=o.add(c.shiftRightUnsigned(32)),p=c.shiftLeft(32).add(new K(p.getLowBits(),0)),{high:o,low:p}}function Gw(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,s=e.low>>>0;if(i<s)return!0}return!1}function Br(t,e){throw new Tt('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Ua=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Ma(e)){if(e.byteLength!==16)throw new Tt("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Tt("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,s=0,o=0,c=0,l=0,p=0,d=[0],h=0,b=0,v=0,w=0,_=0,k=0,A=new K(0,0),B=new K(0,0),G=0,j=0;if(e.length>=7e3)throw new Tt(""+e+" not a valid Decimal128 string");var X=e.match(Mw),_t=e.match(Uw),Dt=e.match(Bw);if(!X&&!_t&&!Dt||e.length===0)throw new Tt(""+e+" not a valid Decimal128 string");if(X){var q=X[2],rt=X[4],Q=X[5],tt=X[6];rt&&tt===void 0&&Br(e,"missing exponent power"),rt&&q===void 0&&Br(e,"missing exponent base"),rt===void 0&&(Q||tt)&&Br(e,"missing e before exponent")}if((e[j]==="+"||e[j]==="-")&&(r=e[j++]==="-"),!Ul(e[j])&&e[j]!=="."){if(e[j]==="i"||e[j]==="I")return new t(ct.from(r?Rl:Ll));if(e[j]==="N")return new t(ct.from(Vs))}for(;Ul(e[j])||e[j]===".";){if(e[j]==="."){n&&Br(e,"contains multiple periods"),n=!0,j=j+1;continue}h<34&&(e[j]!=="0"||i)&&(i||(p=o),i=!0,d[b++]=parseInt(e[j],10),h=h+1),i&&(c=c+1),n&&(l=l+1),o=o+1,j=j+1}if(n&&!o)throw new Tt(""+e+" not a valid Decimal128 string");if(e[j]==="e"||e[j]==="E"){var lt=e.substr(++j).match($w);if(!lt||!lt[2])return new t(ct.from(Vs));_=parseInt(lt[0],10),j=j+lt[0].length}if(e[j])return new t(ct.from(Vs));if(v=0,!h)v=0,w=0,d[0]=0,c=1,h=1,s=0;else if(w=h-1,s=c,s!==1)for(;d[p+s-1]===0;)s=s-1;for(_<=l&&l-_>16384?_=Hs:_=_-l;_>wn;){if(w=w+1,w-v>jw){var kt=d.join("");if(kt.match(/^0+$/)){_=wn;break}Br(e,"overflow")}_=_-1}for(;_<Hs||h<c;){if(w===0&&s<h){_=Hs,s=0;break}if(h<c?c=c-1:w=w-1,_<wn)_=_+1;else{var kt=d.join("");if(kt.match(/^0+$/)){_=wn;break}Br(e,"overflow")}}if(w-v+1<s){var At=o;n&&(p=p+1,At=At+1),r&&(p=p+1,At=At+1);var jt=parseInt(e[p+w+1],10),Wt=0;if(jt>=5&&(Wt=1,jt===5)){for(Wt=d[w]%2===1?1:0,k=p+w+2;k<At;k++)if(parseInt(e[k],10)){Wt=1;break}}if(Wt){for(var ft=w;ft>=0;ft--)if(++d[ft]>9&&(d[ft]=0,ft===0))if(_<wn)_=_+1,d[ft]=1;else return new t(ct.from(r?Rl:Ll))}}if(A=K.fromNumber(0),B=K.fromNumber(0),s===0)A=K.fromNumber(0),B=K.fromNumber(0);else if(w-v<17){var ft=v;for(B=K.fromNumber(d[ft++]),A=new K(0,0);ft<=w;ft++)B=B.multiply(K.fromNumber(10)),B=B.add(K.fromNumber(d[ft]))}else{var ft=v;for(A=K.fromNumber(d[ft++]);ft<=w-17;ft++)A=A.multiply(K.fromNumber(10)),A=A.add(K.fromNumber(d[ft]));for(B=K.fromNumber(d[ft++]);ft<=w;ft++)B=B.multiply(K.fromNumber(10)),B=B.add(K.fromNumber(d[ft]))}var Gt=Ww(A,K.fromString("100000000000000000"));Gt.low=Gt.low.add(B),Gw(Gt.low,B)&&(Gt.high=Gt.high.add(K.fromNumber(1))),G=_+Pl;var st={low:K.fromNumber(0),high:K.fromNumber(0)};Gt.high.shiftRightUnsigned(49).and(K.fromNumber(1)).equals(K.fromNumber(1))?(st.high=st.high.or(K.fromNumber(3).shiftLeft(61)),st.high=st.high.or(K.fromNumber(G).and(K.fromNumber(16383).shiftLeft(47))),st.high=st.high.or(Gt.high.and(K.fromNumber(0x7fffffffffff)))):(st.high=st.high.or(K.fromNumber(G&16383).shiftLeft(49)),st.high=st.high.or(Gt.high.and(K.fromNumber(562949953421311)))),st.low=Gt.low,r&&(st.high=st.high.or(K.fromString("9223372036854775808")));var et=ct.alloc(16);return j=0,et[j++]=st.low.low&255,et[j++]=st.low.low>>8&255,et[j++]=st.low.low>>16&255,et[j++]=st.low.low>>24&255,et[j++]=st.low.high&255,et[j++]=st.low.high>>8&255,et[j++]=st.low.high>>16&255,et[j++]=st.low.high>>24&255,et[j++]=st.high.low&255,et[j++]=st.high.low>>8&255,et[j++]=st.high.low>>16&255,et[j++]=st.high.low>>24&255,et[j++]=st.high.high&255,et[j++]=st.high.high>>8&255,et[j++]=st.high.high>>16&255,et[j++]=st.high.high>>24&255,new t(et)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,c,l={parts:[0,0,0,0]},p,d,h=[];s=0;var b=this.bytes,v=b[s++]|b[s++]<<8|b[s++]<<16|b[s++]<<24,w=b[s++]|b[s++]<<8|b[s++]<<16|b[s++]<<24,_=b[s++]|b[s++]<<8|b[s++]<<16|b[s++]<<24,k=b[s++]|b[s++]<<8|b[s++]<<16|b[s++]<<24;s=0;var A={low:new K(v,w),high:new K(_,k)};A.high.lessThan(K.ZERO)&&h.push("-");var B=k>>26&Fw;if(B>>3===3){if(B===Hw)return h.join("")+"Infinity";if(B===Vw)return"NaN";e=k>>15&Ml,c=8+(k>>14&1)}else c=k>>14&7,e=k>>17&Ml;var G=e-Pl;if(l.parts[0]=(k&16383)+((c&15)<<14),l.parts[1]=_,l.parts[2]=w,l.parts[3]=v,l.parts[0]===0&&l.parts[1]===0&&l.parts[2]===0&&l.parts[3]===0)o=!0;else for(d=3;d>=0;d--){var j=0,X=qw(l);if(l=X.quotient,j=X.rem.low,!!j)for(p=8;p>=0;p--)n[d*9+p]=j%10,j=Math.floor(j/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var _t=r-1+G;if(_t>=34||_t<=-7||G>0){if(r>34)return h.push("".concat(0)),G>0?h.push("E+".concat(G)):G<0&&h.push("E".concat(G)),h.join("");h.push("".concat(n[s++])),r=r-1,r&&h.push(".");for(var i=0;i<r;i++)h.push("".concat(n[s++]));h.push("E"),_t>0?h.push("+".concat(_t)):h.push("".concat(_t))}else if(G>=0)for(var i=0;i<r;i++)h.push("".concat(n[s++]));else{var Dt=r+G;if(Dt>0)for(var i=0;i<Dt;i++)h.push("".concat(n[s++]));else h.push("0");for(h.push(".");Dt++<0;)h.push("0");for(var i=0;i<r-Math.max(Dt-1,0);i++)h.push("".concat(n[s++]))}return h.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(Ua.prototype,"_bsontype",{value:"Decimal128"});var ys=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(ys.prototype,"_bsontype",{value:"Double"});var vs=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(vs.prototype,"_bsontype",{value:"Int32"});var Ba=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(Ba.prototype,"_bsontype",{value:"MaxKey"});var ja=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(ja.prototype,"_bsontype",{value:"MinKey"});var zw=new RegExp("^[0-9a-fA-F]{24}$"),dr=null,Se=Symbol("id"),Yt=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 Tt("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=ct.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Se]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Se]=r instanceof ct?r:zi(r);else if(typeof r=="string")if(r.length===12){var n=ct.from(r);if(n.byteLength===12)this[Se]=n;else throw new Tt("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&zw.test(r))this[Se]=ct.from(r,"hex");else throw new Tt("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Tt("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[Se]},set:function(e){this[Se]=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=ct.alloc(12);return n.writeUInt32BE(e,0),dr===null&&(dr=jh(5)),n[4]=dr[0],n[5]=dr[1],n[6]=dr[2],n[7]=dr[3],n[8]=dr[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[Se][11]===e[Se][11]&&this[Se].equals(e[Se]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Ma(this.id))return e===ct.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 ct.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=ct.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 Tt("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(ct.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(Yt.prototype,"generate",{value:gs(function(t){return Yt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Yt.prototype,"getInc",{value:gs(function(){return Yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Yt.prototype,"get_inc",{value:gs(function(){return Yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Yt,"get_inc",{value:gs(function(){return Yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Yt.prototype,"_bsontype",{value:"ObjectID"});function Yw(t){return t.split("").sort().join("")}var zn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Yw(r??""),this.pattern.indexOf("\0")!==-1)throw new _r("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new _r("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 _r("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 Tt("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(zn.prototype,"_bsontype",{value:"BSONRegExp"});var $a=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($a.prototype,"_bsontype",{value:"Symbol"});var Kw=K,Vh=function(t){fs(e,t);function e(r,n){var i=this;return i instanceof e?(K.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:ii(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(K.fromInt(r,!0))},e.fromNumber=function(r){return new e(K.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(K.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=K.MAX_UNSIGNED_VALUE,e}(Kw);function Jw(t){return ii(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var qh=2147483647,Wh=-2147483648,Gh=9223372036854776e3,zh=-9223372036854776e3,Xw={$oid:Yt,$binary:Er,$uuid:Er,$symbol:$a,$numberInt:vs,$numberDecimal:Ua,$numberDouble:ys,$numberLong:K,$minKey:ja,$maxKey:Ba,$regex:zn,$regularExpression:zn,$timestamp:Vh};function Yh(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Wh&&t<=qh)return new vs(t);if(t>=zh&&t<=Gh)return K.fromNumber(t)}return new ys(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(h){return h.startsWith("$")&&t[h]!=null}),n=0;n<r.length;n++){var i=Xw[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var s=t.$date,o=new Date;return e.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):K.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&e.relaxed&&o.setTime(s),o}if(t.$code!=null){var c=Object.assign({},t);return t.$scope&&(c.$scope=Yh(t.$scope)),ms.fromExtendedJSON(t)}if(Rw(t)||t.$dbPointer){var l=t.$ref?t:t.$dbPointer;if(l instanceof Gn)return l;var p=Object.keys(l).filter(function(h){return h.startsWith("$")}),d=!0;if(p.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(d=!1)}),d)return Gn.fromExtendedJSON(l)}return t}function Qw(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return rr(r,e)}finally{e.seenObjects.pop()}})}function Bl(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function rr(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(A){return A.obj===t});if(r!==-1){var n=e.seenObjects.map(function(A){return A.propertyName}),i=n.slice(0,r).map(function(A){return"".concat(A," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(A){return"".concat(A," -> ")}).join(""),c=n[n.length-1],l=" ".repeat(i.length+s.length/2),p="-".repeat(o.length+(s.length+c.length)/2-1);throw new Tt(`Converting circular structure to EJSON:
|
|
35
35
|
`+" ".concat(i).concat(s).concat(o).concat(c,`
|
|
36
|
-
`)+" ".concat(l,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Xw(t,e);if(t===void 0)return null;if(t instanceof Date||Aw(t)){var d=t.getTime(),h=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:jl(t)}:e.relaxed&&h?{$date:jl(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var b=t>=qh&&t<=Vh,v=t>=Gh&&t<=Wh;if(b)return{$numberInt:t.toString()};if(v)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Dw(t)){var w=t.flags;if(w===void 0){var _=t.toString().match(/[gimuy]*$/);_&&(w=_[0])}var k=new zn(t.source,w);return k.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Zw(t,e):t}var Qw={Binary:function(t){return new Er(t.value(),t.sub_type)},Code:function(t){return new gs(t.code,t.scope)},DBRef:function(t){return new Gn(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Ba(t.bytes)},Double:function(t){return new ms(t.value)},Int32:function(t){return new ys(t.value)},Long:function(t){return K.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 ja},MinKey:function(){return new $a},ObjectID:function(t){return new Yt(t)},ObjectId:function(t){return new Yt(t)},BSONRegExp:function(t){return new zn(t.pattern,t.options)},Symbol:function(t){return new Fa(t.value)},Timestamp:function(t){return Hh.fromBits(t.low,t.high)}};function Zw(t,e){if(t==null||typeof t!="object")throw new _r("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 s=er(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):n[i]=s}finally{e.seenObjects.pop()}}return n}else if(Kw(t)){var o=t;if(typeof o.toExtendedJSON!="function"){var c=Qw[t._bsontype];if(!c)throw new Tt("Unrecognized or invalid _bsontype: "+t._bsontype);o=c(o)}return r==="Code"&&o.scope?o=new gs(o.code,er(o.scope,e)):r==="DBRef"&&o.oid&&(o=new Gn(er(o.collection,e),er(o.oid,e),er(o.db,e),er(o.fields,e))),o.toExtendedJSON(e)}else throw new _r("_bsontype must be a string, but was: "+typeof r)}var $l;(function(t){function e(s,o){var c=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof c.relaxed=="boolean"&&(c.strict=!c.relaxed),typeof c.strict=="boolean"&&(c.relaxed=!c.strict),JSON.parse(s,function(l,p){if(l.indexOf("\0")!==-1)throw new _r("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(l)));return zh(p,c)})}t.parse=e;function r(s,o,c,l){c!=null&&typeof c=="object"&&(l=c,c=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(l=o,o=void 0,c=0);var p=Object.assign({relaxed:!0,legacy:!1},l,{seenObjects:[{propertyName:"(root)",obj:null}]}),d=er(s,p);return JSON.stringify(d,o,c)}t.stringify=r;function n(s,o){return o=o||{},JSON.parse(r(s,o))}t.serialize=n;function i(s,o){return o=o||{},e(JSON.stringify(s),o)}t.deserialize=i})($l||($l={}));var Fl,Hl=Uh();Hl.Map?Fl=Hl.Map:Fl=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],s=n[1];this._keys.push(i),this._values[i]={v:s,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 vE=K.fromNumber(Ow),wE=K.fromNumber(kw),Vs=new Uint8Array(8),bE=new DataView(Vs.buffer,Vs.byteOffset,Vs.byteLength),tb=1024*1024*17,_E=ct.alloc(tb),Ha=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}},Bt=class{constructor(t,e={},r,n){this.name=t,this.properties=e,this.id=n?new Yt(n):new Yt,this.occurred=new Date,r&&(this.trigger=new Ha(r)),this.newEvent=!n}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale},ye=class{static SWIPER_CSS="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";static injectScriptURL(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}static injectRawScript(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}static injectRawCSS(t,e=document.head){if(!t)return;let r=document.createElement("style");r.textContent=t,e.appendChild(r)}static injectSwiperCSS(t=document.head){this.injectStylesheet(this.SWIPER_CSS,t)}static injectStylesheet(t,e=document.head){if(!t)return;let r=document.createElement("link");r.rel="stylesheet",r.href=t,t===this.SWIPER_CSS&&(r.crossOrigin="anonymous",r.onload=n=>{let i=n.currentTarget?.sheet?.cssRules;if(i){for(let s of i)if(s.type==CSSRule.FONT_FACE_RULE){let o=t.split("/"),c=o.slice(0,o.length-1).join("/"),l=s.cssText;l=l.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${c}/$4")`);let p=document.createElement("style");p.appendChild(document.createTextNode(l)),document.head.appendChild(p)}}}),e.appendChild(r)}static async loadSwiperScript(){window.CooeeSDK.Swiper||(window.CooeeSDK.Swiper=(await import("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs")).Swiper)}},eb="2.0.4",Fo=500,Vl="user-agent",en="",ql="?",Yi="function",ir="undefined",rn="object",Ho="string",Xt="browser",Be="cpu",Te="device",me="engine",pe="os",Gr="result",L="name",N="type",R="vendor",U="version",Qt="architecture",Yn="major",P="model",Pn="console",Z="mobile",mt="tablet",Rt="smarttv",Ie="wearable",Ii="xr",Rn="embedded",bn="inapp",Va="brands",yr="formFactors",qa="fullVersionList",zr="platform",Wa="platformVersion",vs="bitness",ur="sec-ch-ua",rb=ur+"-full-version-list",nb=ur+"-arch",ib=ur+"-"+vs,sb=ur+"-form-factors",ob=ur+"-"+Z,ab=ur+"-"+P,Yh=ur+"-"+zr,cb=Yh+"-version",Kh=[Va,qa,Z,P,zr,Wa,Qt,yr,vs],Ci="Amazon",jr="Apple",Wl="ASUS",Gl="BlackBerry",fr="Google",zl="Huawei",qs="Lenovo",Yl="Honor",Ti="LG",Ws="Microsoft",Gs="Motorola",zs="Nvidia",Kl="OnePlus",Ys="OPPO",_n="Samsung",Jl="Sharp",En="Sony",Ks="Xiaomi",Js="Zebra",Xl="Chrome",Ql="Chromium",Xe="Chromecast",Li="Edge",Sn="Firefox",In="Opera",Xs="Facebook",Zl="Sogou",$r="Mobile ",Cn=" Browser",Vo="Windows",lb=typeof window!==ir,Zt=lb&&window.navigator?window.navigator:void 0,rr=Zt&&Zt.userAgentData?Zt.userAgentData:void 0,ub=function(t,e){var r={},n=e;if(!Ki(e)){n={};for(var i in e)for(var s in e[i])n[s]=e[i][s].concat(n[s]?n[s]:[])}for(var o in t)r[o]=n[o]&&n[o].length%2===0?n[o].concat(t[o]):t[o];return r},ws=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},qo=function(t,e){if(typeof t===rn&&t.length>0){for(var r in t)if(je(e)==je(t[r]))return!0;return!1}return pn(t)?je(e)==je(t):!1},Ki=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Ki(t[r]):!1)},pn=function(t){return typeof t===Ho},Qs=function(t){if(t){for(var e=[],r=nn(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Ji(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Ji(r[n]);return e}},je=function(t){return pn(t)?t.toLowerCase():t},Zs=function(t){return pn(t)?nn(/[^\d\.]/g,t).split(".")[0]:void 0},$e=function(t){for(var e in t){var r=t[e];typeof r==rn&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},nn=function(t,e){return pn(e)?e.replace(t,en):e},Tn=function(t){return nn(/\\?\"/g,t)},Ji=function(t,e){if(pn(t))return t=nn(/^\s\s*/,t),typeof e===ir?t:t.substring(0,Fo)},to=function(t,e){if(!(!t||!e))for(var r=0,n,i,s,o,c,l;r<e.length&&!c;){var p=e[r],d=e[r+1];for(n=i=0;n<p.length&&!c&&p[n];)if(c=p[n++].exec(t),c)for(s=0;s<d.length;s++)l=c[++i],o=d[s],typeof o===rn&&o.length>0?o.length===2?typeof o[1]==Yi?this[o[0]]=o[1].call(this,l):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===Yi&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=l?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=l?o[1].call(this,l,o[2]):void 0:o.length==3?this[o[0]]=l?l.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=l?o[3].call(this,l.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=l?o[3].apply(this,[l.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=l||void 0;r+=2}},Ce=function(t,e){for(var r in e)if(typeof e[r]===rn&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(qo(e[r][n],t))return r===ql?void 0:r}else if(qo(e[r],t))return r===ql?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},tu={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:""},eu={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"},ru={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[U,[L,$r+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[U,[L,Li+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[U,[L,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[L,U],[/opios[\/ ]+([\w\.]+)/i],[U,[L,In+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[U,[L,In+" GX"]],[/\bopr\/([\w\.]+)/i],[U,[L,In]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[U,[L,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[U,[L,"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],[L,U],[/quark(?:pc)?\/([-\w\.]+)/i],[U,[L,"Quark"]],[/\bddg\/([\w\.]+)/i],[U,[L,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[U,[L,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[U,[L,"WeChat"]],[/konqueror\/([\w\.]+)/i],[U,[L,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[U,[L,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[U,[L,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[U,[L,"Smart "+qs+Cn]],[/(avast|avg)\/([\w\.]+)/i],[[L,/(.+)/,"$1 Secure"+Cn],U],[/\bfocus\/([\w\.]+)/i],[U,[L,Sn+" Focus"]],[/\bopt\/([\w\.]+)/i],[U,[L,In+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[U,[L,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[U,[L,"Dolphin"]],[/coast\/([\w\.]+)/i],[U,[L,In+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[U,[L,"MIUI"+Cn]],[/fxios\/([\w\.-]+)/i],[U,[L,$r+Sn]],[/\bqihoobrowser\/?([\w\.]*)/i],[U,[L,"360"]],[/\b(qq)\/([\w\.]+)/i],[[L,/(.+)/,"$1Browser"],U],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[L,/(.+)/,"$1"+Cn],U],[/samsungbrowser\/([\w\.]+)/i],[U,[L,_n+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[U,[L,Zl+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[L,Zl+" Mobile"],U],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[L,U],[/(lbbrowser|rekonq)/i],[L],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[U,L],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[L,Xs],U,[N,bn]],[/(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],[L,U,[N,bn]],[/\bgsa\/([\w\.]+) .*safari\//i],[U,[L,"GSA"],[N,bn]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[U,[L,"TikTok"],[N,bn]],[/\[(linkedin)app\]/i],[L,[N,bn]],[/(chromium)[\/ ]([-\w\.]+)/i],[L,U],[/headlesschrome(?:\/([\w\.]+)| )/i],[U,[L,Xl+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[U,[L,Li+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[L,Xl+" WebView"],U],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[U,[L,"Android"+Cn]],[/chrome\/([\w\.]+) mobile/i],[U,[L,$r+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[L,U],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[U,[L,$r+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[L,$r+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[U,L],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[L,[U,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[L,U],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[L,$r+Sn],U],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[L,"Netscape"],U],[/(wolvic|librewolf)\/([\w\.]+)/i],[L,U],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[U,[L,Sn+" 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],[L,[U,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[L,[U,/[^\d\.]+./,en]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Qt,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Qt,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Qt,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Qt,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Qt,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Qt,/ower/,en,je]],[/ sun4\w[;\)]/i],[[Qt,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Qt,je]]],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],[P,[R,_n],[N,mt]],[/\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],[P,[R,_n],[N,Z]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[P,[R,jr],[N,Z]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[P,[R,jr],[N,mt]],[/(macintosh);/i],[P,[R,jr]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[P,[R,Jl],[N,Z]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[P,[R,Yl],[N,mt]],[/honor([-\w ]+)[;\)]/i],[P,[R,Yl],[N,Z]],[/\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],[P,[R,zl],[N,mt]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[P,[R,zl],[N,Z]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[P,/_/g," "],[R,Ks],[N,mt]],[/\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],[[P,/_/g," "],[R,Ks],[N,Z]],[/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],[P,[R,Kl],[N,Z]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[P,[R,Ys],[N,Z]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[P,[R,Ce,{OnePlus:["203","304","403","404","413","415"],"*":Ys}],[N,mt]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[P,[R,"BLU"],[N,Z]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[P,[R,"Vivo"],[N,Z]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[P,[R,"Realme"],[N,Z]],[/(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],[P,[R,qs],[N,mt]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[P,[R,qs],[N,Z]],[/\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],[P,[R,Gs],[N,Z]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[P,[R,Gs],[N,mt]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[P,[R,Ti],[N,mt]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[P,[R,Ti],[N,Z]],[/(nokia) (t[12][01])/i],[R,P,[N,mt]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[P,/_/g," "],[N,Z],[R,"Nokia"]],[/(pixel (c|tablet))\b/i],[P,[R,fr],[N,mt]],[/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],[P,[R,fr],[N,Z]],[/(google) (pixelbook( go)?)/i],[R,P],[/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],[P,[R,En],[N,Z]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[P,"Xperia Tablet"],[R,En],[N,mt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[P,[R,Ci],[N,mt]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[P,/(.+)/g,"Fire Phone $1"],[R,Ci],[N,Z]],[/(playbook);[-\w\),; ]+(rim)/i],[P,R,[N,mt]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[P,[R,Gl],[N,Z]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[P,[R,Wl],[N,mt]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[P,[R,Wl],[N,Z]],[/(nexus 9)/i],[P,[R,"HTC"],[N,mt]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[R,[P,/_/g," "],[N,Z]],[/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],[P,[R,"TCL"],[N,mt]],[/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],[P,[R,"TCL"],[N,Z]],[/(itel) ((\w+))/i],[[R,je],P,[N,Ce,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[P,[R,"Acer"],[N,mt]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[P,[R,"Meizu"],[N,Z]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[P,[R,"Ulefone"],[N,Z]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[P,[R,"Energizer"],[N,Z]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[P,[R,"Cat"],[N,Z]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[P,[R,"Smartfren"],[N,Z]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[P,[R,"Nothing"],[N,Z]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[P,[R,"Archos"],[N,mt]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[P,[R,"Archos"],[N,Z]],[/; (n159v)/i],[P,[R,"HMD"],[N,Z]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[R,P,[N,mt]],[/(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],[R,P,[N,Z]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[R,P,[N,mt]],[/(surface duo)/i],[P,[R,Ws],[N,mt]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[P,[R,"Fairphone"],[N,Z]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[P,[R,zs],[N,mt]],[/(sprint) (\w+)/i],[R,P,[N,Z]],[/(kin\.[onetw]{3})/i],[[P,/\./g," "],[R,Ws],[N,Z]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[P,[R,Js],[N,mt]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[P,[R,Js],[N,Z]],[/smart-tv.+(samsung)/i],[R,[N,Rt]],[/hbbtv.+maple;(\d+)/i],[[P,/^/,"SmartTV"],[R,_n],[N,Rt]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[R,P,[N,Rt]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[R,Ti],[N,Rt]],[/(apple) ?tv/i],[R,[P,jr+" TV"],[N,Rt]],[/crkey.*devicetype\/chromecast/i],[[P,Xe+" Third Generation"],[R,fr],[N,Rt]],[/crkey.*devicetype\/([^/]*)/i],[[P,/^/,"Chromecast "],[R,fr],[N,Rt]],[/fuchsia.*crkey/i],[[P,Xe+" Nest Hub"],[R,fr],[N,Rt]],[/crkey/i],[[P,Xe],[R,fr],[N,Rt]],[/(portaltv)/i],[P,[R,Xs],[N,Rt]],[/droid.+aft(\w+)( bui|\))/i],[P,[R,Ci],[N,Rt]],[/(shield \w+ tv)/i],[P,[R,zs],[N,Rt]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[P,[R,Jl],[N,Rt]],[/(bravia[\w ]+)( bui|\))/i],[P,[R,En],[N,Rt]],[/(mi(tv|box)-?\w+) bui/i],[P,[R,Ks],[N,Rt]],[/Hbbtv.*(technisat) (.*);/i],[R,P,[N,Rt]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[R,/.+\/(\w+)/,"$1",Ce,{LG:"lge"}],[P,Ji],[N,Rt]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[P,[N,Rt]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[N,Rt]],[/(playstation \w+)/i],[P,[R,En],[N,Pn]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[P,[R,Ws],[N,Pn]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[R,P,[N,Pn]],[/droid.+; (shield)( bui|\))/i],[P,[R,zs],[N,Pn]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[P,[R,_n],[N,Ie]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[R,P,[N,Ie]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[P,[R,Ys],[N,Ie]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[P,[R,jr],[N,Ie]],[/(opwwe\d{3})/i],[P,[R,Kl],[N,Ie]],[/(moto 360)/i],[P,[R,Gs],[N,Ie]],[/(smartwatch 3)/i],[P,[R,En],[N,Ie]],[/(g watch r)/i],[P,[R,Ti],[N,Ie]],[/droid.+; (wt63?0{2,3})\)/i],[P,[R,Js],[N,Ie]],[/droid.+; (glass) \d/i],[P,[R,fr],[N,Ii]],[/(pico) (4|neo3(?: link|pro)?)/i],[R,P,[N,Ii]],[/(quest( \d| pro)?s?).+vr/i],[P,[R,Xs],[N,Ii]],[/mobile vr; rv.+firefox/i],[[N,Ii]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[R,[N,Rn]],[/(aeobc)\b/i],[P,[R,Ci],[N,Rn]],[/(homepod).+mac os/i],[P,[R,jr],[N,Rn]],[/windows iot/i],[[N,Rn]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[P,[N,Ce,{mobile:"Mobile",xr:"VR","*":mt}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[N,mt]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[N,Z]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[P,[R,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[U,[L,Li+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[L,U],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[U,[L,"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],[L,U],[/ladybird\//i],[[L,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[U,L]],os:[[/(windows nt) (6\.[23]); arm/i],[[L,/N/,"R"],[U,Ce,tu]],[/(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],[L,U],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[U,/(;|\))/g,"",Ce,tu],[L,Vo]],[/(windows ce)\/?([\d\.]*)/i],[L,U],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[U,/_/g,"."],[L,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[L,"macOS"],[U,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[U,[L,Xe+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[U,[L,Xe+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[U,[L,Xe+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[U,[L,Xe+" Linux"]],[/crkey\/([\d\.]+)/i],[U,[L,Xe]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[U,L],[/(ubuntu) ([\w\.]+) like android/i],[[L,/(.+)/,"$1 Touch"],U],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[L,U],[/\(bb(10);/i],[U,[L,Gl]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[U,[L,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[U,[L,Sn+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[U,[L,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[U,Ce,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[L,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[U,[L,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[L,"Chrome OS"],U],[/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],[L,U],[/(sunos) ?([\d\.]*)/i],[[L,"Solaris"],U],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[L,U]]},xi=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return $e.call(t.init,[[Xt,[L,U,Yn,N]],[Be,[Qt]],[Te,[N,P,R]],[me,[L,U]],[pe,[L,U]]]),$e.call(t.isIgnore,[[Xt,[U,Yn]],[me,[U]],[pe,[U]]]),$e.call(t.isIgnoreRgx,[[Xt,/ ?browser$/i],[pe,/ ?os$/i]]),$e.call(t.toString,[[Xt,[L,U]],[Be,[Qt]],[Te,[R,P]],[me,[L,U]],[pe,[L,U]]]),t}(),pb=function(t,e){var r=xi.init[e],n=xi.isIgnore[e]||0,i=xi.isIgnoreRgx[e]||0,s=xi.toString[e]||0;function o(){$e.call(this,r)}return o.prototype.getItem=function(){return t},o.prototype.withClientHints=function(){return rr?rr.getHighEntropyValues(Kh).then(function(c){return t.setCH(new Jh(c,!1)).parseCH().get()}):t.parseCH().get()},o.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=Gr&&(o.prototype.is=function(c){var l=!1;for(var p in this)if(this.hasOwnProperty(p)&&!qo(n,p)&&je(i?nn(i,this[p]):this[p])==je(i?nn(i,c):c)){if(l=!0,c!=ir)break}else if(c==ir&&l){l=!l;break}return l},o.prototype.toString=function(){var c=en;for(var l in s)typeof this[s[l]]!==ir&&(c+=(c?" ":en)+this[s[l]]);return c||ir}),rr||(o.prototype.then=function(c){var l=this,p=function(){for(var h in l)l.hasOwnProperty(h)&&(this[h]=l[h])};p.prototype={is:o.prototype.is,toString:o.prototype.toString};var d=new p;return c(d),d}),new o};function Jh(t,e){if(t=t||{},$e.call(this,Kh),e)$e.call(this,[[Va,Qs(t[ur])],[qa,Qs(t[rb])],[Z,/\?1/.test(t[ob])],[P,Tn(t[ab])],[zr,Tn(t[Yh])],[Wa,Tn(t[cb])],[Qt,Tn(t[nb])],[yr,Qs(t[sb])],[vs,Tn(t[ib])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==ir&&(this[r]=t[r])}function nu(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,s){return this.data[i]=s,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Zt&&Zt.userAgent==this.ua)switch(this.itemType){case Xt:Zt.brave&&typeof Zt.brave.isBrave==Yi&&this.set(L,"Brave");break;case Te:!this.get(N)&&rr&&rr[Z]&&this.set(N,Z),this.get(P)=="Macintosh"&&Zt&&typeof Zt.standalone!==ir&&Zt.maxTouchPoints&&Zt.maxTouchPoints>2&&this.set(P,"iPad").set(N,mt);break;case pe:!this.get(L)&&rr&&rr[zr]&&this.set(L,rr[zr]);break;case Gr:var i=this.data,s=function(o){return i[o].getItem().detectFeature().get()};this.set(Xt,s(Xt)).set(Be,s(Be)).set(Te,s(Te)).set(me,s(me)).set(pe,s(pe))}return this},this.parseUA=function(){return this.itemType!=Gr&&to.call(this.data,this.ua,this.rgxMap),this.itemType==Xt&&this.set(Yn,Zs(this.get(U))),this},this.parseCH=function(){var i=this.uaCH,s=this.rgxMap;switch(this.itemType){case Xt:case me:var o=i[qa]||i[Va],c;if(o)for(var l in o){var p=o[l].brand||o[l],d=o[l].version;this.itemType==Xt&&!/not.a.brand/i.test(p)&&(!c||/Chrom/.test(c)&&p!=Ql||c==Li&&/WebView2/.test(p))&&(p=Ce(p,hb),c=this.get(L),c&&!/Chrom/.test(c)&&/Chrom/.test(p)||this.set(L,p).set(U,d).set(Yn,Zs(d)),c=p),this.itemType==me&&p==Ql&&this.set(U,d)}break;case Be:var h=i[Qt];h&&(h&&i[vs]=="64"&&(h+="64"),to.call(this.data,h+";",s));break;case Te:if(i[Z]&&this.set(N,Z),i[P]&&(this.set(P,i[P]),!this.get(N)||!this.get(R))){var b={};to.call(b,"droid 9; "+i[P]+")",s),!this.get(N)&&b.type&&this.set(N,b.type),!this.get(R)&&b.vendor&&this.set(R,b.vendor)}if(i[yr]){var v;if(typeof i[yr]!="string")for(var w=0;!v&&w<i[yr].length;)v=Ce(i[yr][w++],eu);else v=Ce(i[yr],eu);this.set(N,v)}break;case pe:var _=i[zr];if(_){var k=i[Wa];_==Vo&&(k=parseInt(Zs(k),10)>=13?"11":"10"),this.set(L,_).set(U,k)}this.get(L)==Vo&&i[P]=="Xbox"&&this.set(L,"Xbox").set(U,void 0);break;case Gr:var A=this.data,B=function(G){return A[G].getItem().setCH(i).parseCH().get()};this.set(Xt,B(Xt)).set(Be,B(Be)).set(Te,B(Te)).set(me,B(me)).set(pe,B(pe))}return this},$e.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",pb(this,t)]]),this}function ze(t,e,r){if(typeof t===rn?(Ki(t,!0)?(typeof e===rn&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===Ho&&!Ki(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Yi){var n={};r.forEach(function(l,p){n[p]=l}),r=n}if(!(this instanceof ze))return new ze(t,e,r).getResult();var i=typeof t===Ho?t:r&&r[Vl]?r[Vl]:Zt&&Zt.userAgent?Zt.userAgent:en,s=new Jh(r,!0),o=e?ub(ru,e):ru,c=function(l){return l==Gr?function(){return new nu(l,i,o,s).set("ua",i).set(Xt,this.getBrowser()).set(Be,this.getCPU()).set(Te,this.getDevice()).set(me,this.getEngine()).set(pe,this.getOS()).get()}:function(){return new nu(l,i,o[l],s).parseUA().get()}};return $e.call(this,[["getBrowser",c(Xt)],["getCPU",c(Be)],["getDevice",c(Te)],["getEngine",c(me)],["getOS",c(pe)],["getResult",c(Gr)],["getUA",function(){return i}],["setUA",function(l){return pn(l)&&(i=l.length>Fo?Ji(l,Fo):l),this}]]).setUA(i),this}ze.VERSION=eb;ze.BROWSER=ws([L,U,Yn,N]);ze.CPU=ws([Qt]);ze.DEVICE=ws([P,R,N,Pn,Z,Rt,mt,Ie,Rn]);ze.ENGINE=ze.OS=ws([L,U]);var at=class{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}};function Et(t){return typeof t=="function"}function Xh(t){let e=t(r=>{Error.call(r),r.stack=new Error().stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var eo=Xh(t=>function(e){t(this),this.message=e?`${e.length} errors occurred during unsubscription:
|
|
36
|
+
`)+" ".concat(l,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Qw(t,e);if(t===void 0)return null;if(t instanceof Date||Nw(t)){var d=t.getTime(),h=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:Bl(t)}:e.relaxed&&h?{$date:Bl(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var b=t>=Wh&&t<=qh,v=t>=zh&&t<=Gh;if(b)return{$numberInt:t.toString()};if(v)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Aw(t)){var w=t.flags;if(w===void 0){var _=t.toString().match(/[gimuy]*$/);_&&(w=_[0])}var k=new zn(t.source,w);return k.toExtendedJSON(e)}return t!=null&&typeof t=="object"?tb(t,e):t}var Zw={Binary:function(t){return new Er(t.value(),t.sub_type)},Code:function(t){return new ms(t.code,t.scope)},DBRef:function(t){return new Gn(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Ua(t.bytes)},Double:function(t){return new ys(t.value)},Int32:function(t){return new vs(t.value)},Long:function(t){return K.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 Ba},MinKey:function(){return new ja},ObjectID:function(t){return new Yt(t)},ObjectId:function(t){return new Yt(t)},BSONRegExp:function(t){return new zn(t.pattern,t.options)},Symbol:function(t){return new $a(t.value)},Timestamp:function(t){return Vh.fromBits(t.low,t.high)}};function tb(t,e){if(t==null||typeof t!="object")throw new _r("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 s=rr(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):n[i]=s}finally{e.seenObjects.pop()}}return n}else if(Jw(t)){var o=t;if(typeof o.toExtendedJSON!="function"){var c=Zw[t._bsontype];if(!c)throw new Tt("Unrecognized or invalid _bsontype: "+t._bsontype);o=c(o)}return r==="Code"&&o.scope?o=new ms(o.code,rr(o.scope,e)):r==="DBRef"&&o.oid&&(o=new Gn(rr(o.collection,e),rr(o.oid,e),rr(o.db,e),rr(o.fields,e))),o.toExtendedJSON(e)}else throw new _r("_bsontype must be a string, but was: "+typeof r)}var jl;(function(t){function e(s,o){var c=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof c.relaxed=="boolean"&&(c.strict=!c.relaxed),typeof c.strict=="boolean"&&(c.relaxed=!c.strict),JSON.parse(s,function(l,p){if(l.indexOf("\0")!==-1)throw new _r("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(l)));return Yh(p,c)})}t.parse=e;function r(s,o,c,l){c!=null&&typeof c=="object"&&(l=c,c=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(l=o,o=void 0,c=0);var p=Object.assign({relaxed:!0,legacy:!1},l,{seenObjects:[{propertyName:"(root)",obj:null}]}),d=rr(s,p);return JSON.stringify(d,o,c)}t.stringify=r;function n(s,o){return o=o||{},JSON.parse(r(s,o))}t.serialize=n;function i(s,o){return o=o||{},e(JSON.stringify(s),o)}t.deserialize=i})(jl||(jl={}));var $l,Fl=Bh();Fl.Map?$l=Fl.Map:$l=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],s=n[1];this._keys.push(i),this._values[i]={v:s,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 wE=K.fromNumber(kw),bE=K.fromNumber(Pw),qs=new Uint8Array(8),_E=new DataView(qs.buffer,qs.byteOffset,qs.byteLength),eb=1024*1024*17,EE=ct.alloc(eb),Fa=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}},Bt=class{constructor(t,e={},r,n){this.name=t,this.properties=e,this.id=n?new Yt(n):new Yt,this.occurred=new Date,r&&(this.trigger=new Fa(r)),this.newEvent=!n}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale},ye=class{static SWIPER_CSS="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";static injectScriptURL(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}static injectRawScript(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}static injectRawCSS(t,e=document.head){if(!t)return;let r=document.createElement("style");r.textContent=t,e.appendChild(r)}static injectSwiperCSS(t=document.head){this.injectStylesheet(this.SWIPER_CSS,t)}static injectStylesheet(t,e=document.head){if(!t)return;let r=document.createElement("link");r.rel="stylesheet",r.href=t,t===this.SWIPER_CSS&&(r.crossOrigin="anonymous",r.onload=n=>{let i=n.currentTarget?.sheet?.cssRules;if(i){for(let s of i)if(s.type==CSSRule.FONT_FACE_RULE){let o=t.split("/"),c=o.slice(0,o.length-1).join("/"),l=s.cssText;l=l.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${c}/$4")`);let p=document.createElement("style");p.appendChild(document.createTextNode(l)),document.head.appendChild(p)}}}),e.appendChild(r)}static async loadSwiperScript(){window.CooeeSDK.Swiper||(window.CooeeSDK.Swiper=(await import("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs")).Swiper)}},rb="2.0.4",Fo=500,Hl="user-agent",en="",Vl="?",Yi="function",ir="undefined",rn="object",Ho="string",Xt="browser",Be="cpu",Te="device",me="engine",pe="os",Gr="result",L="name",N="type",R="vendor",U="version",Qt="architecture",Yn="major",P="model",Pn="console",Z="mobile",mt="tablet",Rt="smarttv",Ie="wearable",Ii="xr",Rn="embedded",bn="inapp",Ha="brands",yr="formFactors",Va="fullVersionList",zr="platform",qa="platformVersion",ws="bitness",ur="sec-ch-ua",nb=ur+"-full-version-list",ib=ur+"-arch",sb=ur+"-"+ws,ob=ur+"-form-factors",ab=ur+"-"+Z,cb=ur+"-"+P,Kh=ur+"-"+zr,lb=Kh+"-version",Jh=[Ha,Va,Z,P,zr,qa,Qt,yr,ws],Ci="Amazon",jr="Apple",ql="ASUS",Wl="BlackBerry",fr="Google",Gl="Huawei",Ws="Lenovo",zl="Honor",Ti="LG",Gs="Microsoft",zs="Motorola",Ys="Nvidia",Yl="OnePlus",Ks="OPPO",_n="Samsung",Kl="Sharp",En="Sony",Js="Xiaomi",Xs="Zebra",Jl="Chrome",Xl="Chromium",Qe="Chromecast",Li="Edge",Sn="Firefox",In="Opera",Qs="Facebook",Ql="Sogou",$r="Mobile ",Cn=" Browser",Vo="Windows",ub=typeof window!==ir,Zt=ub&&window.navigator?window.navigator:void 0,nr=Zt&&Zt.userAgentData?Zt.userAgentData:void 0,hb=function(t,e){var r={},n=e;if(!Ki(e)){n={};for(var i in e)for(var s in e[i])n[s]=e[i][s].concat(n[s]?n[s]:[])}for(var o in t)r[o]=n[o]&&n[o].length%2===0?n[o].concat(t[o]):t[o];return r},bs=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},qo=function(t,e){if(typeof t===rn&&t.length>0){for(var r in t)if($e(e)==$e(t[r]))return!0;return!1}return pn(t)?$e(e)==$e(t):!1},Ki=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Ki(t[r]):!1)},pn=function(t){return typeof t===Ho},Zs=function(t){if(t){for(var e=[],r=nn(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Ji(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Ji(r[n]);return e}},$e=function(t){return pn(t)?t.toLowerCase():t},to=function(t){return pn(t)?nn(/[^\d\.]/g,t).split(".")[0]:void 0},Fe=function(t){for(var e in t){var r=t[e];typeof r==rn&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},nn=function(t,e){return pn(e)?e.replace(t,en):e},Tn=function(t){return nn(/\\?\"/g,t)},Ji=function(t,e){if(pn(t))return t=nn(/^\s\s*/,t),typeof e===ir?t:t.substring(0,Fo)},eo=function(t,e){if(!(!t||!e))for(var r=0,n,i,s,o,c,l;r<e.length&&!c;){var p=e[r],d=e[r+1];for(n=i=0;n<p.length&&!c&&p[n];)if(c=p[n++].exec(t),c)for(s=0;s<d.length;s++)l=c[++i],o=d[s],typeof o===rn&&o.length>0?o.length===2?typeof o[1]==Yi?this[o[0]]=o[1].call(this,l):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===Yi&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=l?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=l?o[1].call(this,l,o[2]):void 0:o.length==3?this[o[0]]=l?l.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=l?o[3].call(this,l.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=l?o[3].apply(this,[l.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=l||void 0;r+=2}},Ce=function(t,e){for(var r in e)if(typeof e[r]===rn&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(qo(e[r][n],t))return r===Vl?void 0:r}else if(qo(e[r],t))return r===Vl?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},Zl={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:""},tu={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},pb={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"},eu={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[U,[L,$r+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[U,[L,Li+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[U,[L,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[L,U],[/opios[\/ ]+([\w\.]+)/i],[U,[L,In+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[U,[L,In+" GX"]],[/\bopr\/([\w\.]+)/i],[U,[L,In]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[U,[L,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[U,[L,"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],[L,U],[/quark(?:pc)?\/([-\w\.]+)/i],[U,[L,"Quark"]],[/\bddg\/([\w\.]+)/i],[U,[L,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[U,[L,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[U,[L,"WeChat"]],[/konqueror\/([\w\.]+)/i],[U,[L,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[U,[L,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[U,[L,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[U,[L,"Smart "+Ws+Cn]],[/(avast|avg)\/([\w\.]+)/i],[[L,/(.+)/,"$1 Secure"+Cn],U],[/\bfocus\/([\w\.]+)/i],[U,[L,Sn+" Focus"]],[/\bopt\/([\w\.]+)/i],[U,[L,In+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[U,[L,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[U,[L,"Dolphin"]],[/coast\/([\w\.]+)/i],[U,[L,In+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[U,[L,"MIUI"+Cn]],[/fxios\/([\w\.-]+)/i],[U,[L,$r+Sn]],[/\bqihoobrowser\/?([\w\.]*)/i],[U,[L,"360"]],[/\b(qq)\/([\w\.]+)/i],[[L,/(.+)/,"$1Browser"],U],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[L,/(.+)/,"$1"+Cn],U],[/samsungbrowser\/([\w\.]+)/i],[U,[L,_n+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[U,[L,Ql+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[L,Ql+" Mobile"],U],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[L,U],[/(lbbrowser|rekonq)/i],[L],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[U,L],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[L,Qs],U,[N,bn]],[/(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],[L,U,[N,bn]],[/\bgsa\/([\w\.]+) .*safari\//i],[U,[L,"GSA"],[N,bn]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[U,[L,"TikTok"],[N,bn]],[/\[(linkedin)app\]/i],[L,[N,bn]],[/(chromium)[\/ ]([-\w\.]+)/i],[L,U],[/headlesschrome(?:\/([\w\.]+)| )/i],[U,[L,Jl+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[U,[L,Li+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[L,Jl+" WebView"],U],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[U,[L,"Android"+Cn]],[/chrome\/([\w\.]+) mobile/i],[U,[L,$r+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[L,U],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[U,[L,$r+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[L,$r+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[U,L],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[L,[U,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[L,U],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[L,$r+Sn],U],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[L,"Netscape"],U],[/(wolvic|librewolf)\/([\w\.]+)/i],[L,U],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[U,[L,Sn+" 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],[L,[U,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[L,[U,/[^\d\.]+./,en]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Qt,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Qt,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Qt,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Qt,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Qt,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Qt,/ower/,en,$e]],[/ sun4\w[;\)]/i],[[Qt,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Qt,$e]]],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],[P,[R,_n],[N,mt]],[/\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],[P,[R,_n],[N,Z]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[P,[R,jr],[N,Z]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[P,[R,jr],[N,mt]],[/(macintosh);/i],[P,[R,jr]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[P,[R,Kl],[N,Z]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[P,[R,zl],[N,mt]],[/honor([-\w ]+)[;\)]/i],[P,[R,zl],[N,Z]],[/\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],[P,[R,Gl],[N,mt]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[P,[R,Gl],[N,Z]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[P,/_/g," "],[R,Js],[N,mt]],[/\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],[[P,/_/g," "],[R,Js],[N,Z]],[/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],[P,[R,Yl],[N,Z]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[P,[R,Ks],[N,Z]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[P,[R,Ce,{OnePlus:["203","304","403","404","413","415"],"*":Ks}],[N,mt]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[P,[R,"BLU"],[N,Z]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[P,[R,"Vivo"],[N,Z]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[P,[R,"Realme"],[N,Z]],[/(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],[P,[R,Ws],[N,mt]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[P,[R,Ws],[N,Z]],[/\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],[P,[R,zs],[N,Z]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[P,[R,zs],[N,mt]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[P,[R,Ti],[N,mt]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[P,[R,Ti],[N,Z]],[/(nokia) (t[12][01])/i],[R,P,[N,mt]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[P,/_/g," "],[N,Z],[R,"Nokia"]],[/(pixel (c|tablet))\b/i],[P,[R,fr],[N,mt]],[/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],[P,[R,fr],[N,Z]],[/(google) (pixelbook( go)?)/i],[R,P],[/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],[P,[R,En],[N,Z]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[P,"Xperia Tablet"],[R,En],[N,mt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[P,[R,Ci],[N,mt]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[P,/(.+)/g,"Fire Phone $1"],[R,Ci],[N,Z]],[/(playbook);[-\w\),; ]+(rim)/i],[P,R,[N,mt]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[P,[R,Wl],[N,Z]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[P,[R,ql],[N,mt]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[P,[R,ql],[N,Z]],[/(nexus 9)/i],[P,[R,"HTC"],[N,mt]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[R,[P,/_/g," "],[N,Z]],[/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],[P,[R,"TCL"],[N,mt]],[/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],[P,[R,"TCL"],[N,Z]],[/(itel) ((\w+))/i],[[R,$e],P,[N,Ce,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[P,[R,"Acer"],[N,mt]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[P,[R,"Meizu"],[N,Z]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[P,[R,"Ulefone"],[N,Z]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[P,[R,"Energizer"],[N,Z]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[P,[R,"Cat"],[N,Z]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[P,[R,"Smartfren"],[N,Z]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[P,[R,"Nothing"],[N,Z]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[P,[R,"Archos"],[N,mt]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[P,[R,"Archos"],[N,Z]],[/; (n159v)/i],[P,[R,"HMD"],[N,Z]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[R,P,[N,mt]],[/(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],[R,P,[N,Z]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[R,P,[N,mt]],[/(surface duo)/i],[P,[R,Gs],[N,mt]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[P,[R,"Fairphone"],[N,Z]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[P,[R,Ys],[N,mt]],[/(sprint) (\w+)/i],[R,P,[N,Z]],[/(kin\.[onetw]{3})/i],[[P,/\./g," "],[R,Gs],[N,Z]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[P,[R,Xs],[N,mt]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[P,[R,Xs],[N,Z]],[/smart-tv.+(samsung)/i],[R,[N,Rt]],[/hbbtv.+maple;(\d+)/i],[[P,/^/,"SmartTV"],[R,_n],[N,Rt]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[R,P,[N,Rt]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[R,Ti],[N,Rt]],[/(apple) ?tv/i],[R,[P,jr+" TV"],[N,Rt]],[/crkey.*devicetype\/chromecast/i],[[P,Qe+" Third Generation"],[R,fr],[N,Rt]],[/crkey.*devicetype\/([^/]*)/i],[[P,/^/,"Chromecast "],[R,fr],[N,Rt]],[/fuchsia.*crkey/i],[[P,Qe+" Nest Hub"],[R,fr],[N,Rt]],[/crkey/i],[[P,Qe],[R,fr],[N,Rt]],[/(portaltv)/i],[P,[R,Qs],[N,Rt]],[/droid.+aft(\w+)( bui|\))/i],[P,[R,Ci],[N,Rt]],[/(shield \w+ tv)/i],[P,[R,Ys],[N,Rt]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[P,[R,Kl],[N,Rt]],[/(bravia[\w ]+)( bui|\))/i],[P,[R,En],[N,Rt]],[/(mi(tv|box)-?\w+) bui/i],[P,[R,Js],[N,Rt]],[/Hbbtv.*(technisat) (.*);/i],[R,P,[N,Rt]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[R,/.+\/(\w+)/,"$1",Ce,{LG:"lge"}],[P,Ji],[N,Rt]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[P,[N,Rt]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[N,Rt]],[/(playstation \w+)/i],[P,[R,En],[N,Pn]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[P,[R,Gs],[N,Pn]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[R,P,[N,Pn]],[/droid.+; (shield)( bui|\))/i],[P,[R,Ys],[N,Pn]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[P,[R,_n],[N,Ie]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[R,P,[N,Ie]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[P,[R,Ks],[N,Ie]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[P,[R,jr],[N,Ie]],[/(opwwe\d{3})/i],[P,[R,Yl],[N,Ie]],[/(moto 360)/i],[P,[R,zs],[N,Ie]],[/(smartwatch 3)/i],[P,[R,En],[N,Ie]],[/(g watch r)/i],[P,[R,Ti],[N,Ie]],[/droid.+; (wt63?0{2,3})\)/i],[P,[R,Xs],[N,Ie]],[/droid.+; (glass) \d/i],[P,[R,fr],[N,Ii]],[/(pico) (4|neo3(?: link|pro)?)/i],[R,P,[N,Ii]],[/(quest( \d| pro)?s?).+vr/i],[P,[R,Qs],[N,Ii]],[/mobile vr; rv.+firefox/i],[[N,Ii]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[R,[N,Rn]],[/(aeobc)\b/i],[P,[R,Ci],[N,Rn]],[/(homepod).+mac os/i],[P,[R,jr],[N,Rn]],[/windows iot/i],[[N,Rn]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[P,[N,Ce,{mobile:"Mobile",xr:"VR","*":mt}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[N,mt]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[N,Z]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[P,[R,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[U,[L,Li+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[L,U],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[U,[L,"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],[L,U],[/ladybird\//i],[[L,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[U,L]],os:[[/(windows nt) (6\.[23]); arm/i],[[L,/N/,"R"],[U,Ce,Zl]],[/(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],[L,U],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[U,/(;|\))/g,"",Ce,Zl],[L,Vo]],[/(windows ce)\/?([\d\.]*)/i],[L,U],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[U,/_/g,"."],[L,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[L,"macOS"],[U,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[U,[L,Qe+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[U,[L,Qe+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[U,[L,Qe+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[U,[L,Qe+" Linux"]],[/crkey\/([\d\.]+)/i],[U,[L,Qe]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[U,L],[/(ubuntu) ([\w\.]+) like android/i],[[L,/(.+)/,"$1 Touch"],U],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[L,U],[/\(bb(10);/i],[U,[L,Wl]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[U,[L,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[U,[L,Sn+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[U,[L,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[U,Ce,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[L,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[U,[L,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[L,"Chrome OS"],U],[/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],[L,U],[/(sunos) ?([\d\.]*)/i],[[L,"Solaris"],U],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[L,U]]},xi=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Fe.call(t.init,[[Xt,[L,U,Yn,N]],[Be,[Qt]],[Te,[N,P,R]],[me,[L,U]],[pe,[L,U]]]),Fe.call(t.isIgnore,[[Xt,[U,Yn]],[me,[U]],[pe,[U]]]),Fe.call(t.isIgnoreRgx,[[Xt,/ ?browser$/i],[pe,/ ?os$/i]]),Fe.call(t.toString,[[Xt,[L,U]],[Be,[Qt]],[Te,[R,P]],[me,[L,U]],[pe,[L,U]]]),t}(),db=function(t,e){var r=xi.init[e],n=xi.isIgnore[e]||0,i=xi.isIgnoreRgx[e]||0,s=xi.toString[e]||0;function o(){Fe.call(this,r)}return o.prototype.getItem=function(){return t},o.prototype.withClientHints=function(){return nr?nr.getHighEntropyValues(Jh).then(function(c){return t.setCH(new Xh(c,!1)).parseCH().get()}):t.parseCH().get()},o.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=Gr&&(o.prototype.is=function(c){var l=!1;for(var p in this)if(this.hasOwnProperty(p)&&!qo(n,p)&&$e(i?nn(i,this[p]):this[p])==$e(i?nn(i,c):c)){if(l=!0,c!=ir)break}else if(c==ir&&l){l=!l;break}return l},o.prototype.toString=function(){var c=en;for(var l in s)typeof this[s[l]]!==ir&&(c+=(c?" ":en)+this[s[l]]);return c||ir}),nr||(o.prototype.then=function(c){var l=this,p=function(){for(var h in l)l.hasOwnProperty(h)&&(this[h]=l[h])};p.prototype={is:o.prototype.is,toString:o.prototype.toString};var d=new p;return c(d),d}),new o};function Xh(t,e){if(t=t||{},Fe.call(this,Jh),e)Fe.call(this,[[Ha,Zs(t[ur])],[Va,Zs(t[nb])],[Z,/\?1/.test(t[ab])],[P,Tn(t[cb])],[zr,Tn(t[Kh])],[qa,Tn(t[lb])],[Qt,Tn(t[ib])],[yr,Zs(t[ob])],[ws,Tn(t[sb])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==ir&&(this[r]=t[r])}function ru(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,s){return this.data[i]=s,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Zt&&Zt.userAgent==this.ua)switch(this.itemType){case Xt:Zt.brave&&typeof Zt.brave.isBrave==Yi&&this.set(L,"Brave");break;case Te:!this.get(N)&&nr&&nr[Z]&&this.set(N,Z),this.get(P)=="Macintosh"&&Zt&&typeof Zt.standalone!==ir&&Zt.maxTouchPoints&&Zt.maxTouchPoints>2&&this.set(P,"iPad").set(N,mt);break;case pe:!this.get(L)&&nr&&nr[zr]&&this.set(L,nr[zr]);break;case Gr:var i=this.data,s=function(o){return i[o].getItem().detectFeature().get()};this.set(Xt,s(Xt)).set(Be,s(Be)).set(Te,s(Te)).set(me,s(me)).set(pe,s(pe))}return this},this.parseUA=function(){return this.itemType!=Gr&&eo.call(this.data,this.ua,this.rgxMap),this.itemType==Xt&&this.set(Yn,to(this.get(U))),this},this.parseCH=function(){var i=this.uaCH,s=this.rgxMap;switch(this.itemType){case Xt:case me:var o=i[Va]||i[Ha],c;if(o)for(var l in o){var p=o[l].brand||o[l],d=o[l].version;this.itemType==Xt&&!/not.a.brand/i.test(p)&&(!c||/Chrom/.test(c)&&p!=Xl||c==Li&&/WebView2/.test(p))&&(p=Ce(p,pb),c=this.get(L),c&&!/Chrom/.test(c)&&/Chrom/.test(p)||this.set(L,p).set(U,d).set(Yn,to(d)),c=p),this.itemType==me&&p==Xl&&this.set(U,d)}break;case Be:var h=i[Qt];h&&(h&&i[ws]=="64"&&(h+="64"),eo.call(this.data,h+";",s));break;case Te:if(i[Z]&&this.set(N,Z),i[P]&&(this.set(P,i[P]),!this.get(N)||!this.get(R))){var b={};eo.call(b,"droid 9; "+i[P]+")",s),!this.get(N)&&b.type&&this.set(N,b.type),!this.get(R)&&b.vendor&&this.set(R,b.vendor)}if(i[yr]){var v;if(typeof i[yr]!="string")for(var w=0;!v&&w<i[yr].length;)v=Ce(i[yr][w++],tu);else v=Ce(i[yr],tu);this.set(N,v)}break;case pe:var _=i[zr];if(_){var k=i[qa];_==Vo&&(k=parseInt(to(k),10)>=13?"11":"10"),this.set(L,_).set(U,k)}this.get(L)==Vo&&i[P]=="Xbox"&&this.set(L,"Xbox").set(U,void 0);break;case Gr:var A=this.data,B=function(G){return A[G].getItem().setCH(i).parseCH().get()};this.set(Xt,B(Xt)).set(Be,B(Be)).set(Te,B(Te)).set(me,B(me)).set(pe,B(pe))}return this},Fe.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",db(this,t)]]),this}function Ye(t,e,r){if(typeof t===rn?(Ki(t,!0)?(typeof e===rn&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===Ho&&!Ki(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Yi){var n={};r.forEach(function(l,p){n[p]=l}),r=n}if(!(this instanceof Ye))return new Ye(t,e,r).getResult();var i=typeof t===Ho?t:r&&r[Hl]?r[Hl]:Zt&&Zt.userAgent?Zt.userAgent:en,s=new Xh(r,!0),o=e?hb(eu,e):eu,c=function(l){return l==Gr?function(){return new ru(l,i,o,s).set("ua",i).set(Xt,this.getBrowser()).set(Be,this.getCPU()).set(Te,this.getDevice()).set(me,this.getEngine()).set(pe,this.getOS()).get()}:function(){return new ru(l,i,o[l],s).parseUA().get()}};return Fe.call(this,[["getBrowser",c(Xt)],["getCPU",c(Be)],["getDevice",c(Te)],["getEngine",c(me)],["getOS",c(pe)],["getResult",c(Gr)],["getUA",function(){return i}],["setUA",function(l){return pn(l)&&(i=l.length>Fo?Ji(l,Fo):l),this}]]).setUA(i),this}Ye.VERSION=rb;Ye.BROWSER=bs([L,U,Yn,N]);Ye.CPU=bs([Qt]);Ye.DEVICE=bs([P,R,N,Pn,Z,Rt,mt,Ie,Rn]);Ye.ENGINE=Ye.OS=bs([L,U]);var at=class{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}};function Et(t){return typeof t=="function"}function Qh(t){let e=t(r=>{Error.call(r),r.stack=new Error().stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var ro=Qh(t=>function(e){t(this),this.message=e?`${e.length} errors occurred during unsubscription:
|
|
37
37
|
${e.map((r,n)=>`${n+1}) ${r.toString()}`).join(`
|
|
38
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=e});function Xi(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Nr=class Wo{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 s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(Et(n))try{n()}catch(s){e=s instanceof eo?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{iu(s)}catch(o){e=e??[],o instanceof eo?e=[...e,...o.errors]:e.push(o)}}if(e)throw new eo(e)}}add(e){var r;if(e&&e!==this)if(this.closed)iu(e);else{if(e instanceof Wo){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)&&Xi(r,e)}remove(e){let{_finalizers:r}=this;r&&Xi(r,e),e instanceof Wo&&e._removeParent(this)}};Nr.EMPTY=(()=>{let t=new Nr;return t.closed=!0,t})();var Qh=Nr.EMPTY;function Zh(t){return t instanceof Nr||t&&"closed"in t&&Et(t.remove)&&Et(t.add)&&Et(t.unsubscribe)}function iu(t){Et(t)?t():t.unsubscribe()}var Pr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Qi={setTimeout(t,e,...r){let{delegate:n}=Qi;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=Qi;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function tp(t){Qi.setTimeout(()=>{let{onUnhandledError:e}=Pr;if(e)e(t);else throw t})}function su(){}var db=Ga("C",void 0,void 0);function fb(t){return Ga("E",void 0,t)}function gb(t){return Ga("N",t,void 0)}function Ga(t,e,r){return{kind:t,value:e,error:r}}var vr=null;function Mi(t){if(Pr.useDeprecatedSynchronousErrorHandling){let e=!vr;if(e&&(vr={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=vr;if(vr=null,r)throw n}}else t()}function mb(t){Pr.useDeprecatedSynchronousErrorHandling&&vr&&(vr.errorThrown=!0,vr.error=t)}var za=class extends Nr{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Zh(t)&&t.add(this)):this.destination=bb}static create(t,e,r){return new Go(t,e,r)}next(t){this.isStopped?no(gb(t),this):this._next(t)}error(t){this.isStopped?no(fb(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?no(db,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},yb=Function.prototype.bind;function ro(t,e){return yb.call(t,e)}var vb=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Di(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Di(r)}else Di(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Di(e)}}},Go=class extends za{constructor(t,e,r){super();let n;if(Et(t)||!t)n={next:t??void 0,error:e??void 0,complete:r??void 0};else{let i;this&&Pr.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&ro(t.next,i),error:t.error&&ro(t.error,i),complete:t.complete&&ro(t.complete,i)}):n=t}this.destination=new vb(n)}};function Di(t){Pr.useDeprecatedSynchronousErrorHandling?mb(t):tp(t)}function wb(t){throw t}function no(t,e){let{onStoppedNotification:r}=Pr;r&&Qi.setTimeout(()=>r(t,e))}var bb={closed:!0,next:su,error:wb,complete:su},Ya=typeof Symbol=="function"&&Symbol.observable||"@@observable";function _b(t){return t}function Eb(t){return t.length===0?_b:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var Ye=(()=>{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 s=Ib(r)?r:new Go(r,n,i);return Mi(()=>{let{operator:o,source:c}=this;s.add(o?o.call(s,c):c?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=ou(n),new n((i,s)=>{let o=new Go({next:c=>{try{r(c)}catch(l){s(l),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[Ya](){return this}pipe(...r){return Eb(r)(this)}toPromise(r){return r=ou(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return t.create=e=>new t(e),t})();function ou(t){var e;return(e=t??Pr.Promise)!==null&&e!==void 0?e:Promise}function Sb(t){return t&&Et(t.next)&&Et(t.error)&&Et(t.complete)}function Ib(t){return t&&t instanceof za||Sb(t)&&Zh(t)}function Cb(t){return Et(t?.lift)}function Ka(t){return e=>{if(Cb(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 Zi(t,e,r,n,i){return new Tb(t,e,r,n,i)}var Tb=class extends za{constructor(t,e,r,n,i,s){super(t),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=e?function(o){try{e(o)}catch(c){t.error(c)}}:super._next,this._error=n?function(o){try{n(o)}catch(c){t.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){t.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}},xb=Xh(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),cr=(()=>{class t extends Ye{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new au(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new xb}next(r){Mi(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){Mi(()=>{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(){Mi(()=>{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:s}=this;return n||i?Qh:(this.currentObservers=null,s.push(r),new Nr(()=>{this.currentObservers=null,Xi(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new Ye;return r.source=this,r}}return t.create=(e,r)=>new au(e,r),t})(),au=class extends cr{constructor(t,e){super(),this.destination=t,this.source=e}next(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,t)}error(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,t)}complete(){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||e===void 0||e.call(t)}_subscribe(t){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(t))!==null&&r!==void 0?r:Qh}},Db=class extends cr{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let e=super._subscribe(t);return!e.closed&&t.next(this._value),e}getValue(){let{hasError:t,thrownError:e,_value:r}=this;if(t)throw e;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}},Ja={now(){return(Ja.delegate||Date).now()},delegate:void 0},Ab=class extends cr{constructor(t=1/0,e=1/0,r=Ja){super(),this._bufferSize=t,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,e)}next(t){let{isStopped:e,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;e||(r.push(t),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!t.closed;s+=r?1:2)t.next(i[s]);return this._checkFinalizedStatuses(t),e}_trimBuffer(){let{_bufferSize:t,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*t;if(t<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=e.now(),o=0;for(let c=1;c<r.length&&r[c]<=s;c+=2)o=c;o&&r.splice(0,o+1)}}},Nb=class extends Nr{constructor(t,e){super()}schedule(t,e=0){return this}},ts={setInterval(t,e,...r){let{delegate:n}=ts;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=ts;return(e?.clearInterval||clearInterval)(t)},delegate:void 0},Ob=class extends Nb{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){var r;if(this.closed)return this;this.state=t;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,e),this}requestAsyncId(t,e,r=0){return ts.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&ts.clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(t,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let r=!1,n;try{this.work(t)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:t,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,Xi(r,this),t!=null&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null,super.unsubscribe()}}},zo=class ep{constructor(e,r=ep.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};zo.now=Ja.now;var kb=class extends zo{constructor(t,e=zo.now){super(t,e),this.actions=[],this._active=!1}flush(t){let{actions:e}=this;if(this._active){e.push(t);return}let r;this._active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},Pb=new kb(Ob);function Rb(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(d){try{p(n.next(d))}catch(h){o(h)}}function l(d){try{p(n.throw(d))}catch(h){o(h)}}function p(d){d.done?s(d.value):i(d.value).then(c,l)}p((n=n.apply(t,e||[])).next())})}function cu(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 Yr(t){return this instanceof Yr?(this.v=t,this):new Yr(t)}function Lb(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(v){return function(w){return Promise.resolve(w).then(v,h)}}function c(v,w){n[v]&&(i[v]=function(_){return new Promise(function(k,A){s.push([v,_,k,A])>1||l(v,_)})},w&&(i[v]=w(i[v])))}function l(v,w){try{p(n[v](w))}catch(_){b(s[0][3],_)}}function p(v){v.value instanceof Yr?Promise.resolve(v.value.v).then(d,h):b(s[0][2],v)}function d(v){l("next",v)}function h(v){l("throw",v)}function b(v,w){v(w),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Mb(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 cu=="function"?cu(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(c,l){o=t[s](o),i(c,l,o.done,o.value)})}}function i(s,o,c,l){Promise.resolve(l).then(function(p){s({value:p,done:c})},o)}}var rp=t=>t&&typeof t.length=="number"&&typeof t!="function";function Ub(t){return Et(t?.then)}function Bb(t){return Et(t[Ya])}function jb(t){return Symbol.asyncIterator&&Et(t?.[Symbol.asyncIterator])}function $b(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 Fb(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Hb=Fb();function Vb(t){return Et(t?.[Hb])}function qb(t){return Lb(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:n}=yield Yr(e.read());if(n)return yield Yr(void 0);yield yield Yr(r)}}finally{e.releaseLock()}})}function Wb(t){return Et(t?.getReader)}function Xa(t){if(t instanceof Ye)return t;if(t!=null){if(Bb(t))return Gb(t);if(rp(t))return zb(t);if(Ub(t))return Yb(t);if(jb(t))return np(t);if(Vb(t))return Kb(t);if(Wb(t))return Jb(t)}throw $b(t)}function Gb(t){return new Ye(e=>{let r=t[Ya]();if(Et(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function zb(t){return new Ye(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function Yb(t){return new Ye(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,tp)})}function Kb(t){return new Ye(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function np(t){return new Ye(e=>{Xb(t,e).catch(r=>e.error(r))})}function Jb(t){return np(qb(t))}function Xb(t,e){var r,n,i,s;return Rb(this,void 0,void 0,function*(){try{for(r=Mb(t);n=yield r.next(),!n.done;){let o=n.value;if(e.next(o),e.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}e.complete()})}function Qb(t,e,r,n=0,i=!1){let s=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!i)return s}function Qa(t,e){return Ka((r,n)=>{let i=0;r.subscribe(Zi(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:Zb}=Array;function t_(t,e){return Zb(e)?t(...e):t(e)}function e_(t){return Qa(e=>t_(t,e))}function r_(t,e,r,n,i,s,o,c){let l=[],p=0,d=0,h=!1,b=()=>{h&&!l.length&&!p&&e.complete()},v=_=>p<n?w(_):l.push(_),w=_=>{s&&e.next(_),p++;let k=!1;Xa(r(_,d++)).subscribe(Zi(e,A=>{i?.(A),s?v(A):e.next(A)},()=>{k=!0},void 0,()=>{if(k)try{for(p--;l.length&&p<n;){let A=l.shift();o?Qb(e,o,()=>w(A)):w(A)}b()}catch(A){e.error(A)}}))};return t.subscribe(Zi(e,v,()=>{h=!0,b()})),()=>{c?.()}}function ip(t,e,r=1/0){return Et(e)?ip((n,i)=>Qa((s,o)=>e(n,s,i,o))(Xa(t(n,i))),r):(typeof e=="number"&&(r=e),Ka((n,i)=>r_(n,i,t,r)))}var n_=["addListener","removeListener"],i_=["addEventListener","removeEventListener"],s_=["on","off"];function es(t,e,r,n){if(Et(r)&&(n=r,r=void 0),n)return es(t,e,r).pipe(e_(n));let[i,s]=c_(t)?i_.map(o=>c=>t[o](e,c,r)):o_(t)?n_.map(lu(t,e)):a_(t)?s_.map(lu(t,e)):[];if(!i&&rp(t))return ip(o=>es(o,e,r))(Xa(t));if(!i)throw new TypeError("Invalid event target");return new Ye(o=>{let c=(...l)=>o.next(1<l.length?l:l[0]);return i(c),()=>s(c)})}function lu(t,e){return r=>n=>t[r](e,n)}function o_(t){return Et(t.addListener)&&Et(t.removeListener)}function a_(t){return Et(t.on)&&Et(t.off)}function c_(t){return Et(t.addEventListener)&&Et(t.removeEventListener)}function si(t,e=Pb){return Ka((r,n)=>{let i=null,s=null,o=null,c=()=>{if(i){i.unsubscribe(),i=null;let p=s;s=null,n.next(p)}};function l(){let p=o+t,d=e.now();if(d<p){i=this.schedule(void 0,p-d),n.add(i);return}c()}r.subscribe(Zi(n,p=>{s=p,o=e.now(),i||(i=e.schedule(l,t),n.add(i))},()=>{c(),n.complete()},void 0,()=>{s=i=null}))})}var l_=ke(fu()),uu=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 t;try{t=new l_.URLBuilder(location.href)}catch{return{}}let e={};this.UTM_PARAMS.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(this.TW_PARAMS).forEach(n=>{let i=t.getQueryParam(this.TW_PARAMS[n]);i&&(r[n]=i)}),x(x({},r),e)}},bs=class sp{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 sp(x({origin:location.origin,path:e,qs:location.search,referrer:uu.getReferrer(),name:Ot.get().pageName},uu.getUTMParams()))}},u_=" 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/",h_=/bot|crawl|http|lighthouse|scan|search|spider/i,xn;function p_(){if(xn instanceof RegExp)return xn;try{xn=new RegExp(u_,"i")}catch{xn=h_}return xn}function d_(t){return!!t&&p_().test(t)}var f_=ke(fu()),g_=class Yo{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 f_.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new Yo(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Yo(r)}},Ko={d:(t,e)=>{for(var r in e)Ko.o(e,r)&&!Ko.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Za={};Ko.d(Za,{A:()=>m_,k:()=>tc});var Dn=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(p){try{l(n.next(p))}catch(d){s(d)}}function c(p){try{l(n.throw(p))}catch(d){s(d)}}function l(p){var d;p.done?i(p.value):(d=p.value,d instanceof r?d:new r(function(h){h(d)})).then(o,c)}l((n=n.apply(t,e||[])).next())})},An=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(l){return function(p){return function(d){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,d[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&d[0]?n.return:d[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,d[1])).done)return i;switch(n=0,i&&(d=[2&d[0],i.value]),d[0]){case 0:case 1:i=d;break;case 4:return o.label++,{value:d[1],done:!1};case 5:o.label++,n=d[1],d=[0];continue;case 7:d=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||d[0]!==6&&d[0]!==2)){o=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){o.label=d[1];break}if(d[0]===6&&o.label<i[1]){o.label=i[1],i=d;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(d);break}i[2]&&o.ops.pop(),o.trys.pop();continue}d=e.call(t,o)}catch(h){d=[6,h],n=0}finally{r=i=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([l,p])}}};function tc(){return Dn(this,void 0,Promise,function(){return An(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function s(v){i||(i=!0,e({isPrivate:v,browserName:n}))}function o(){var v=0,w=parseInt("-1");try{w.toFixed(w)}catch(_){v=_.message.length}return v}function c(){return navigator.msSaveBlob!==void 0&&function(v){try{return v===eval.toString().length}catch{return!1}}(39)}function l(){var v;return Dn(this,void 0,void 0,function(){var w,_;return An(this,function(k){switch(k.label){case 0:return k.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return k.sent(),s(!1),[3,3];case 2:return w=k.sent(),_=w,w instanceof Error&&(_=(v=w.message)!==null&&v!==void 0?v:w),typeof _!="string"?(s(!1),[2]):(s(!!_.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var v;return Dn(this,void 0,Promise,function(){return An(this,function(w){switch(w.label){case 0:return((v=navigator.storage)===null||v===void 0?void 0:v.getDirectory)===void 0?[3,2]:[4,l()];case 1:return w.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?function(){var _=String(Math.random());try{var k=indexedDB.open(_,1);k.onupgradeneeded=function(A){var B=A.target.result,G=function(j){s(j)};try{B.createObjectStore("t",{autoIncrement:!0}).put(new Blob),G(!1)}catch(j){(j.message||"").includes("are not yet supported")?G(!0):G(!1)}finally{B.close(),indexedDB.deleteDatabase(_)}},k.onerror=function(){return s(!1)}}catch{s(!1)}}():function(){var _=window.openDatabase,k=window.localStorage;try{_(null,null,null,null)}catch{return void s(!0)}try{k.setItem("test","1"),k.removeItem("test")}catch{return void s(!0)}s(!1)}(),w.label=3;case 3:return[2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(v,w){var _;s(Math.round(w/1048576)<2*Math.round(((_=window).performance!==void 0&&_.performance.memory!==void 0&&_.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(v){r(new Error("detectIncognito somehow failed to query storage quota: "+v.message))})}function h(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0,window.webkitRequestFileSystem)(0,1,function(){s(!1)},function(){s(!0)})}function b(){return Dn(this,void 0,Promise,function(){var v,w;return An(this,function(_){switch(_.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];_.label=1;case 1:return _.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return _.sent(),s(!1),[3,4];case 3:return v=_.sent(),typeof(w=v instanceof Error&&typeof v.message=="string"?v.message:String(v))!="string"?(s(!1),[2]):(s(w.includes("Security error")),[2]);case 4:return s(navigator.serviceWorker===void 0),[2]}})})}(function(){return Dn(this,void 0,Promise,function(){return An(this,function(v){switch(v.label){case 0:return o()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return v.sent(),[3,6];case 2:return o()!==51?[3,3]:(w=navigator.userAgent,n=w.match(/Chrome/)?navigator.brave!==void 0?"Brave":w.match(/Edg/)?"Edge":w.match(/OPR/)?"Opera":"Chrome":"Chromium",h(),[3,6]);case 3:return o()!==25?[3,5]:(n="Firefox",[4,b()]);case 4:return v.sent(),[3,6];case 5:c()?(n="Internet Explorer",s(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),v.label=6;case 6:return[2]}var w})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=tc);var m_=tc,y_=Za.A,EE=Za.k,v_=ke(sn()),w_=class{result={};async safeGet(){try{return await this.get()}catch(t){return Kt.getInstance().captureError(t,"device-properties"),this.result}}async get(){let t=this.result,e=window.CooeeSDK.uaParser;this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),t.referrer=document.referrer,t.host=location.origin,t.path=location.pathname,t.qs=location.search,t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0);let r=e.getResult();return t.browser=r.browser,t.device=r.device,t.engine=r.engine,t.cpu=r.cpu,t.os=r.os,t.navigatorUA=navigator.userAgent,await Promise.all([this.getBatteryInfo(),this.getLocation(),this.checkIncognito()]),t}getDeviceMemory(){let t=navigator;if(!t.deviceMemory)return;let e=t.deviceMemory;this.result.mem={tot:e*1024}}getNetworkType(){let t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){let t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){if(!document.body)return;let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||!navigator.permissions.query)){if((await navigator.permissions.query.bind(navigator.permissions)({name:"geolocation"})).state!="granted"){console.log("getLocation:155");return}return new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()},()=>t())})}}async getBatteryInfo(){if("getBattery"in navigator)try{let t=await navigator.getBattery();this.result.bat={l:t.level*100,c:t.charging}}catch{}}async checkIncognito(){try{(await y_())?.isPrivate&&(this.result.incognito=!0)}catch(t){v_.default.error("Unable to detect private/incognito window",t)}}},op=class{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;let e=hs[t]?.toLowerCase();e&&(T.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},ap=class{constructor(t,e){this._startTime=t,this._triggerData=e}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),H.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=x({eventName:t,duration:r},e);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach(r=>{if(r.id===t){r.isValid=e;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t?.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:e=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(e>r)return T.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%100;return n<e?e:n>r?r:n}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}},b_=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof us&&this.loadFamily(e.typography?.fam)})}async loadFamily(t){if(!t?.fonts||this.loadedFonts.indexOf(t.name)>-1)return;let e=[];t.fonts.forEach(r=>{if(r.url){let n=new FontFace(H.COOEE+t.name,r.getURL(),r.getFontDescriptor());e.push(n.load())}}),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach(r=>{document.fonts.add(r)})}},io=ke(sn()),ec=class cp{static INSTANCE=new cp;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new cr),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new cr),this.topics[e].asObservable()}},Ee=class fe{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=ne.get().website??{};currentState=!1;drawerSubject=new Db({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=[fe.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(H.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return fe._instance||(fe._instance=new fe),fe._instance}static forceUpdate(){fe._instance?.destroy(),fe._instance=new fe}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return io.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){T.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(H.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){T.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===fe.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){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,s=e.items[0].price;window.cartGiftUpdate(n,s,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?xt.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(xt.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():(T.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(H.CTA_AFTER_REFRESH_UI)),r&&ec.get().broadcast(H.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(H.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(!Oa())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Hi(e),!this.cartDrawerElement){io.default.warn("Max attempts exhausted to find cart drawer");return}io.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let e=(await Hi(this.shadowParentElementSelector))?.shadowRoot;e?.mode==="open"&&(this.cartDrawerShadowElement=e,this.createMutationObservers())}isVisible(){if(!this.cartDrawerElement)return!1;if(this.cartDrawerElement.tagName.toLowerCase()===fe.DEFAULT_SELECTOR&&this.cartDrawerElement.open)return!0;if(this.cartDrawerElement.id==="cart-drawer__container")return this.cartDrawerElement.classList.contains("cart-drawer-open");let e=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=e.top<=r&&e.bottom>=0,s=e.left<=n&&e.right>=0,o=i&&s,c=getComputedStyle(this.cartDrawerElement),l=c.display!=="none"&&c.visibility!=="hidden"&&parseFloat(c.opacity)>0,p=!this.cartDrawerElement.hidden,d=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,h=c.transform.match(/matrix\(([^)]+)\)/),b=0,v=0;if(h){let j=h[1].split(", ").map(parseFloat);b=j[4],v=j[5]}let w=b+e.left>n||b+e.right<0||v+e.top>r||v+e.bottom<0,_=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),k=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),A=_*k,B=e.width*e.height,G=B>0&&A/B>=.1;return(o||!w)&&l&&p&&d&&G}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||(rv(this.cartDrawerElement,()=>{this.initialize()}),this.watchForCartToggle())}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new cr;this.mutationObserver?.disconnect(),this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(si(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 xt.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([H.EVENT_OPEN_CART])}destroy(){document.removeEventListener(H.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationObserver?.disconnect(),this.drawerSubject?.complete()}},__=ke(Pd()),Jo=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return Oa()}},E_=(0,__.default)(fetch),S_={retryDelay:H.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=H.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},Rr=class lp{static INSTANCE;apiToken="";deviceID="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new lp),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{T.log("Updated user profile"),await Xo.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{T.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{T.log("Sent Order")}).catch(r=>{T.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(()=>{T.log("Updated device property")}).catch(async r=>{T.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(!Jo.isECommerceApp()&&!Jo.getFlags().allowEvents)return T.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=qe.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){return Kt.getInstance().captureError(c,"http-request",{extra:{body:JSON.stringify(n)}}),{}}let o={method:e,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(e,r){let n=x(x({},S_),r),i=await E_(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),r.forEach((c,l)=>{o.setRequestHeader(l,c)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(c){s(c)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",H.SDK),e.set("cooee-sdk-code",H.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",H.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),qe.debug&&e.set("cooee-sdk-debug",String(1)),e}},I_=`
|
|
38
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=e});function Xi(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Nr=class Wo{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 s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(Et(n))try{n()}catch(s){e=s instanceof ro?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{nu(s)}catch(o){e=e??[],o instanceof ro?e=[...e,...o.errors]:e.push(o)}}if(e)throw new ro(e)}}add(e){var r;if(e&&e!==this)if(this.closed)nu(e);else{if(e instanceof Wo){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)&&Xi(r,e)}remove(e){let{_finalizers:r}=this;r&&Xi(r,e),e instanceof Wo&&e._removeParent(this)}};Nr.EMPTY=(()=>{let t=new Nr;return t.closed=!0,t})();var Zh=Nr.EMPTY;function tp(t){return t instanceof Nr||t&&"closed"in t&&Et(t.remove)&&Et(t.add)&&Et(t.unsubscribe)}function nu(t){Et(t)?t():t.unsubscribe()}var Pr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Qi={setTimeout(t,e,...r){let{delegate:n}=Qi;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=Qi;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function ep(t){Qi.setTimeout(()=>{let{onUnhandledError:e}=Pr;if(e)e(t);else throw t})}function iu(){}var fb=Wa("C",void 0,void 0);function gb(t){return Wa("E",void 0,t)}function mb(t){return Wa("N",t,void 0)}function Wa(t,e,r){return{kind:t,value:e,error:r}}var vr=null;function Mi(t){if(Pr.useDeprecatedSynchronousErrorHandling){let e=!vr;if(e&&(vr={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=vr;if(vr=null,r)throw n}}else t()}function yb(t){Pr.useDeprecatedSynchronousErrorHandling&&vr&&(vr.errorThrown=!0,vr.error=t)}var Ga=class extends Nr{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,tp(t)&&t.add(this)):this.destination=_b}static create(t,e,r){return new Go(t,e,r)}next(t){this.isStopped?io(mb(t),this):this._next(t)}error(t){this.isStopped?io(gb(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?io(fb,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},vb=Function.prototype.bind;function no(t,e){return vb.call(t,e)}var wb=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Di(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Di(r)}else Di(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Di(e)}}},Go=class extends Ga{constructor(t,e,r){super();let n;if(Et(t)||!t)n={next:t??void 0,error:e??void 0,complete:r??void 0};else{let i;this&&Pr.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&no(t.next,i),error:t.error&&no(t.error,i),complete:t.complete&&no(t.complete,i)}):n=t}this.destination=new wb(n)}};function Di(t){Pr.useDeprecatedSynchronousErrorHandling?yb(t):ep(t)}function bb(t){throw t}function io(t,e){let{onStoppedNotification:r}=Pr;r&&Qi.setTimeout(()=>r(t,e))}var _b={closed:!0,next:iu,error:bb,complete:iu},za=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Eb(t){return t}function Sb(t){return t.length===0?Eb:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var Ke=(()=>{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 s=Cb(r)?r:new Go(r,n,i);return Mi(()=>{let{operator:o,source:c}=this;s.add(o?o.call(s,c):c?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=su(n),new n((i,s)=>{let o=new Go({next:c=>{try{r(c)}catch(l){s(l),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[za](){return this}pipe(...r){return Sb(r)(this)}toPromise(r){return r=su(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return t.create=e=>new t(e),t})();function su(t){var e;return(e=t??Pr.Promise)!==null&&e!==void 0?e:Promise}function Ib(t){return t&&Et(t.next)&&Et(t.error)&&Et(t.complete)}function Cb(t){return t&&t instanceof Ga||Ib(t)&&tp(t)}function Tb(t){return Et(t?.lift)}function Ya(t){return e=>{if(Tb(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 Zi(t,e,r,n,i){return new xb(t,e,r,n,i)}var xb=class extends Ga{constructor(t,e,r,n,i,s){super(t),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=e?function(o){try{e(o)}catch(c){t.error(c)}}:super._next,this._error=n?function(o){try{n(o)}catch(c){t.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){t.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}},Db=Qh(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),cr=(()=>{class t extends Ke{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new ou(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new Db}next(r){Mi(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){Mi(()=>{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(){Mi(()=>{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:s}=this;return n||i?Zh:(this.currentObservers=null,s.push(r),new Nr(()=>{this.currentObservers=null,Xi(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new Ke;return r.source=this,r}}return t.create=(e,r)=>new ou(e,r),t})(),ou=class extends cr{constructor(t,e){super(),this.destination=t,this.source=e}next(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,t)}error(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,t)}complete(){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||e===void 0||e.call(t)}_subscribe(t){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(t))!==null&&r!==void 0?r:Zh}},Ab=class extends cr{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let e=super._subscribe(t);return!e.closed&&t.next(this._value),e}getValue(){let{hasError:t,thrownError:e,_value:r}=this;if(t)throw e;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}},Ka={now(){return(Ka.delegate||Date).now()},delegate:void 0},Nb=class extends cr{constructor(t=1/0,e=1/0,r=Ka){super(),this._bufferSize=t,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,e)}next(t){let{isStopped:e,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;e||(r.push(t),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!t.closed;s+=r?1:2)t.next(i[s]);return this._checkFinalizedStatuses(t),e}_trimBuffer(){let{_bufferSize:t,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*t;if(t<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=e.now(),o=0;for(let c=1;c<r.length&&r[c]<=s;c+=2)o=c;o&&r.splice(0,o+1)}}},Ob=class extends Nr{constructor(t,e){super()}schedule(t,e=0){return this}},ts={setInterval(t,e,...r){let{delegate:n}=ts;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=ts;return(e?.clearInterval||clearInterval)(t)},delegate:void 0},kb=class extends Ob{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){var r;if(this.closed)return this;this.state=t;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,e),this}requestAsyncId(t,e,r=0){return ts.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&ts.clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(t,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let r=!1,n;try{this.work(t)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:t,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,Xi(r,this),t!=null&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null,super.unsubscribe()}}},zo=class rp{constructor(e,r=rp.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};zo.now=Ka.now;var Pb=class extends zo{constructor(t,e=zo.now){super(t,e),this.actions=[],this._active=!1}flush(t){let{actions:e}=this;if(this._active){e.push(t);return}let r;this._active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},Rb=new Pb(kb);function Lb(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(d){try{p(n.next(d))}catch(h){o(h)}}function l(d){try{p(n.throw(d))}catch(h){o(h)}}function p(d){d.done?s(d.value):i(d.value).then(c,l)}p((n=n.apply(t,e||[])).next())})}function au(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 Yr(t){return this instanceof Yr?(this.v=t,this):new Yr(t)}function Mb(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(v){return function(w){return Promise.resolve(w).then(v,h)}}function c(v,w){n[v]&&(i[v]=function(_){return new Promise(function(k,A){s.push([v,_,k,A])>1||l(v,_)})},w&&(i[v]=w(i[v])))}function l(v,w){try{p(n[v](w))}catch(_){b(s[0][3],_)}}function p(v){v.value instanceof Yr?Promise.resolve(v.value.v).then(d,h):b(s[0][2],v)}function d(v){l("next",v)}function h(v){l("throw",v)}function b(v,w){v(w),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Ub(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 au=="function"?au(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(c,l){o=t[s](o),i(c,l,o.done,o.value)})}}function i(s,o,c,l){Promise.resolve(l).then(function(p){s({value:p,done:c})},o)}}var np=t=>t&&typeof t.length=="number"&&typeof t!="function";function Bb(t){return Et(t?.then)}function jb(t){return Et(t[za])}function $b(t){return Symbol.asyncIterator&&Et(t?.[Symbol.asyncIterator])}function Fb(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 Hb(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Vb=Hb();function qb(t){return Et(t?.[Vb])}function Wb(t){return Mb(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:n}=yield Yr(e.read());if(n)return yield Yr(void 0);yield yield Yr(r)}}finally{e.releaseLock()}})}function Gb(t){return Et(t?.getReader)}function Ja(t){if(t instanceof Ke)return t;if(t!=null){if(jb(t))return zb(t);if(np(t))return Yb(t);if(Bb(t))return Kb(t);if($b(t))return ip(t);if(qb(t))return Jb(t);if(Gb(t))return Xb(t)}throw Fb(t)}function zb(t){return new Ke(e=>{let r=t[za]();if(Et(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Yb(t){return new Ke(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function Kb(t){return new Ke(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,ep)})}function Jb(t){return new Ke(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function ip(t){return new Ke(e=>{Qb(t,e).catch(r=>e.error(r))})}function Xb(t){return ip(Wb(t))}function Qb(t,e){var r,n,i,s;return Lb(this,void 0,void 0,function*(){try{for(r=Ub(t);n=yield r.next(),!n.done;){let o=n.value;if(e.next(o),e.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}e.complete()})}function Zb(t,e,r,n=0,i=!1){let s=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!i)return s}function Xa(t,e){return Ya((r,n)=>{let i=0;r.subscribe(Zi(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:t_}=Array;function e_(t,e){return t_(e)?t(...e):t(e)}function r_(t){return Xa(e=>e_(t,e))}function n_(t,e,r,n,i,s,o,c){let l=[],p=0,d=0,h=!1,b=()=>{h&&!l.length&&!p&&e.complete()},v=_=>p<n?w(_):l.push(_),w=_=>{s&&e.next(_),p++;let k=!1;Ja(r(_,d++)).subscribe(Zi(e,A=>{i?.(A),s?v(A):e.next(A)},()=>{k=!0},void 0,()=>{if(k)try{for(p--;l.length&&p<n;){let A=l.shift();o?Zb(e,o,()=>w(A)):w(A)}b()}catch(A){e.error(A)}}))};return t.subscribe(Zi(e,v,()=>{h=!0,b()})),()=>{c?.()}}function sp(t,e,r=1/0){return Et(e)?sp((n,i)=>Xa((s,o)=>e(n,s,i,o))(Ja(t(n,i))),r):(typeof e=="number"&&(r=e),Ya((n,i)=>n_(n,i,t,r)))}var i_=["addListener","removeListener"],s_=["addEventListener","removeEventListener"],o_=["on","off"];function es(t,e,r,n){if(Et(r)&&(n=r,r=void 0),n)return es(t,e,r).pipe(r_(n));let[i,s]=l_(t)?s_.map(o=>c=>t[o](e,c,r)):a_(t)?i_.map(cu(t,e)):c_(t)?o_.map(cu(t,e)):[];if(!i&&np(t))return sp(o=>es(o,e,r))(Ja(t));if(!i)throw new TypeError("Invalid event target");return new Ke(o=>{let c=(...l)=>o.next(1<l.length?l:l[0]);return i(c),()=>s(c)})}function cu(t,e){return r=>n=>t[r](e,n)}function a_(t){return Et(t.addListener)&&Et(t.removeListener)}function c_(t){return Et(t.on)&&Et(t.off)}function l_(t){return Et(t.addEventListener)&&Et(t.removeEventListener)}function si(t,e=Rb){return Ya((r,n)=>{let i=null,s=null,o=null,c=()=>{if(i){i.unsubscribe(),i=null;let p=s;s=null,n.next(p)}};function l(){let p=o+t,d=e.now();if(d<p){i=this.schedule(void 0,p-d),n.add(i);return}c()}r.subscribe(Zi(n,p=>{s=p,o=e.now(),i||(i=e.schedule(l,t),n.add(i))},()=>{c(),n.complete()},void 0,()=>{s=i=null}))})}var u_=ke(du()),lu=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 t;try{t=new u_.URLBuilder(location.href)}catch{return{}}let e={};this.UTM_PARAMS.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(this.TW_PARAMS).forEach(n=>{let i=t.getQueryParam(this.TW_PARAMS[n]);i&&(r[n]=i)}),x(x({},r),e)}},_s=class op{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 op(x({origin:location.origin,path:e,qs:location.search,referrer:lu.getReferrer(),name:Ot.get().pageName},lu.getUTMParams()))}},h_=" 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/",p_=/bot|crawl|http|lighthouse|scan|search|spider/i,xn;function d_(){if(xn instanceof RegExp)return xn;try{xn=new RegExp(h_,"i")}catch{xn=p_}return xn}function f_(t){return!!t&&d_().test(t)}var g_=ke(du()),m_=class Yo{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 g_.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new Yo(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Yo(r)}},Ko={d:(t,e)=>{for(var r in e)Ko.o(e,r)&&!Ko.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Qa={};Ko.d(Qa,{A:()=>y_,k:()=>Za});var Dn=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(p){try{l(n.next(p))}catch(d){s(d)}}function c(p){try{l(n.throw(p))}catch(d){s(d)}}function l(p){var d;p.done?i(p.value):(d=p.value,d instanceof r?d:new r(function(h){h(d)})).then(o,c)}l((n=n.apply(t,e||[])).next())})},An=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(l){return function(p){return function(d){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,d[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&d[0]?n.return:d[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,d[1])).done)return i;switch(n=0,i&&(d=[2&d[0],i.value]),d[0]){case 0:case 1:i=d;break;case 4:return o.label++,{value:d[1],done:!1};case 5:o.label++,n=d[1],d=[0];continue;case 7:d=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||d[0]!==6&&d[0]!==2)){o=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){o.label=d[1];break}if(d[0]===6&&o.label<i[1]){o.label=i[1],i=d;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(d);break}i[2]&&o.ops.pop(),o.trys.pop();continue}d=e.call(t,o)}catch(h){d=[6,h],n=0}finally{r=i=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([l,p])}}};function Za(){return Dn(this,void 0,Promise,function(){return An(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function s(v){i||(i=!0,e({isPrivate:v,browserName:n}))}function o(){var v=0,w=parseInt("-1");try{w.toFixed(w)}catch(_){v=_.message.length}return v}function c(){return navigator.msSaveBlob!==void 0&&function(v){try{return v===eval.toString().length}catch{return!1}}(39)}function l(){var v;return Dn(this,void 0,void 0,function(){var w,_;return An(this,function(k){switch(k.label){case 0:return k.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return k.sent(),s(!1),[3,3];case 2:return w=k.sent(),_=w,w instanceof Error&&(_=(v=w.message)!==null&&v!==void 0?v:w),typeof _!="string"?(s(!1),[2]):(s(!!_.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var v;return Dn(this,void 0,Promise,function(){return An(this,function(w){switch(w.label){case 0:return((v=navigator.storage)===null||v===void 0?void 0:v.getDirectory)===void 0?[3,2]:[4,l()];case 1:return w.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?function(){var _=String(Math.random());try{var k=indexedDB.open(_,1);k.onupgradeneeded=function(A){var B=A.target.result,G=function(j){s(j)};try{B.createObjectStore("t",{autoIncrement:!0}).put(new Blob),G(!1)}catch(j){(j.message||"").includes("are not yet supported")?G(!0):G(!1)}finally{B.close(),indexedDB.deleteDatabase(_)}},k.onerror=function(){return s(!1)}}catch{s(!1)}}():function(){var _=window.openDatabase,k=window.localStorage;try{_(null,null,null,null)}catch{return void s(!0)}try{k.setItem("test","1"),k.removeItem("test")}catch{return void s(!0)}s(!1)}(),w.label=3;case 3:return[2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(v,w){var _;s(Math.round(w/1048576)<2*Math.round(((_=window).performance!==void 0&&_.performance.memory!==void 0&&_.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(v){r(new Error("detectIncognito somehow failed to query storage quota: "+v.message))})}function h(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0,window.webkitRequestFileSystem)(0,1,function(){s(!1)},function(){s(!0)})}function b(){return Dn(this,void 0,Promise,function(){var v,w;return An(this,function(_){switch(_.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];_.label=1;case 1:return _.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return _.sent(),s(!1),[3,4];case 3:return v=_.sent(),typeof(w=v instanceof Error&&typeof v.message=="string"?v.message:String(v))!="string"?(s(!1),[2]):(s(w.includes("Security error")),[2]);case 4:return s(navigator.serviceWorker===void 0),[2]}})})}(function(){return Dn(this,void 0,Promise,function(){return An(this,function(v){switch(v.label){case 0:return o()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return v.sent(),[3,6];case 2:return o()!==51?[3,3]:(w=navigator.userAgent,n=w.match(/Chrome/)?navigator.brave!==void 0?"Brave":w.match(/Edg/)?"Edge":w.match(/OPR/)?"Opera":"Chrome":"Chromium",h(),[3,6]);case 3:return o()!==25?[3,5]:(n="Firefox",[4,b()]);case 4:return v.sent(),[3,6];case 5:c()?(n="Internet Explorer",s(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),v.label=6;case 6:return[2]}var w})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Za);var y_=Za,v_=Qa.A,SE=Qa.k,w_=ke(sn()),b_=class{result={};async safeGet(){try{return await this.get()}catch(t){return Kt.getInstance().captureError(t,"device-properties"),this.result}}async get(){let t=this.result,e=window.CooeeSDK.uaParser;this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),t.referrer=document.referrer,t.host=location.origin,t.path=location.pathname,t.qs=location.search,t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0);let r=e.getResult();return t.browser=r.browser,t.device=r.device,t.engine=r.engine,t.cpu=r.cpu,t.os=r.os,t.navigatorUA=navigator.userAgent,await Promise.all([this.getBatteryInfo(),this.getLocationSilently(),this.checkIncognito()]),t}getDeviceMemory(){let t=navigator;if(!t.deviceMemory)return;let e=t.deviceMemory;this.result.mem={tot:e*1024}}getNetworkType(){let t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){let t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){if(!document.body)return;let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r}async getLocationSilently(){try{await this.getLocation()}catch(t){T.error("Unable to get location",t)}}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()},()=>t())})}async getBatteryInfo(){if("getBattery"in navigator)try{let t=await navigator.getBattery();this.result.bat={l:t.level*100,c:t.charging}}catch{}}async checkIncognito(){try{(await v_())?.isPrivate&&(this.result.incognito=!0)}catch(t){w_.default.error("Unable to detect private/incognito window",t)}}},ap=class{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;let e=ps[t]?.toLowerCase();e&&(T.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},cp=class{constructor(t,e){this._startTime=t,this._triggerData=e}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),H.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=x({eventName:t,duration:r},e);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach(r=>{if(r.id===t){r.isValid=e;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t?.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:e=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(e>r)return T.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%100;return n<e?e:n>r?r:n}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}},__=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof hs&&this.loadFamily(e.typography?.fam)})}async loadFamily(t){if(!t?.fonts||this.loadedFonts.indexOf(t.name)>-1)return;let e=[];t.fonts.forEach(r=>{if(r.url){let n=new FontFace(H.COOEE+t.name,r.getURL(),r.getFontDescriptor());e.push(n.load())}}),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach(r=>{document.fonts.add(r)})}},so=ke(sn()),tc=class lp{static INSTANCE=new lp;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new cr),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new cr),this.topics[e].asObservable()}},Ee=class fe{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=ne.get().website??{};currentState=!1;drawerSubject=new Ab({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=[fe.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(H.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return fe._instance||(fe._instance=new fe),fe._instance}static forceUpdate(){fe._instance?.destroy(),fe._instance=new fe}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return so.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){T.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(H.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){T.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===fe.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){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,s=e.items[0].price;window.cartGiftUpdate(n,s,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?xt.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(xt.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():(T.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(H.CTA_AFTER_REFRESH_UI)),r&&tc.get().broadcast(H.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(H.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(!Na())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Hi(e),!this.cartDrawerElement){so.default.warn("Max attempts exhausted to find cart drawer");return}so.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let e=(await Hi(this.shadowParentElementSelector))?.shadowRoot;e?.mode==="open"&&(this.cartDrawerShadowElement=e,this.createMutationObservers())}isVisible(){if(!this.cartDrawerElement)return!1;if(this.cartDrawerElement.tagName.toLowerCase()===fe.DEFAULT_SELECTOR&&this.cartDrawerElement.open)return!0;if(this.cartDrawerElement.id==="cart-drawer__container")return this.cartDrawerElement.classList.contains("cart-drawer-open");let e=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=e.top<=r&&e.bottom>=0,s=e.left<=n&&e.right>=0,o=i&&s,c=getComputedStyle(this.cartDrawerElement),l=c.display!=="none"&&c.visibility!=="hidden"&&parseFloat(c.opacity)>0,p=!this.cartDrawerElement.hidden,d=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,h=c.transform.match(/matrix\(([^)]+)\)/),b=0,v=0;if(h){let j=h[1].split(", ").map(parseFloat);b=j[4],v=j[5]}let w=b+e.left>n||b+e.right<0||v+e.top>r||v+e.bottom<0,_=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),k=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),A=_*k,B=e.width*e.height,G=B>0&&A/B>=.1;return(o||!w)&&l&&p&&d&&G}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||(nv(this.cartDrawerElement,()=>{this.initialize()}),this.watchForCartToggle())}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new cr;this.mutationObserver?.disconnect(),this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(si(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 xt.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([H.EVENT_OPEN_CART])}destroy(){document.removeEventListener(H.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationObserver?.disconnect(),this.drawerSubject?.complete()}},E_=ke(Rd()),Jo=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return Na()}},S_=(0,E_.default)(fetch),I_={retryDelay:H.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=H.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},Rr=class up{static INSTANCE;apiToken="";deviceID="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new up),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{T.log("Updated user profile"),await Xo.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{T.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{T.log("Sent Order")}).catch(r=>{T.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(()=>{T.log("Updated device property")}).catch(async r=>{T.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(!Jo.isECommerceApp()&&!Jo.getFlags().allowEvents)return T.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=We.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){return Kt.getInstance().captureError(c,"http-request",{extra:{body:JSON.stringify(n)}}),{}}let o={method:e,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(e,r){let n=x(x({},I_),r),i=await S_(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),r.forEach((c,l)=>{o.setRequestHeader(l,c)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(c){s(c)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",H.SDK),e.set("cooee-sdk-code",H.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",H.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),We.debug&&e.set("cooee-sdk-debug",String(1)),e}},C_=`
|
|
39
39
|
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
40
40
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
41
41
|
cart {
|
|
@@ -47,7 +47,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
`,jn=class{static navigate(t,e,r){let n=`${location.origin}/discount/${t}`;switch(T.log(`Applying discount code ${t}`,e,r),e){case Pe.CART_PAGE:location.href=`${n}?redirect=/cart`;break;case Pe.CART_DRAWER:location.href=`${n}?redirect=${location.pathname}#${H.HASH_OPEN_CART_DRAWER}=1`;break;case Pe.SHOPIFY_CHECKOUT:location.href=`${n}?redirect=/checkout`;break;case Pe.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${n}?redirect=/cart#${H.HASH_INITIATE_CHECKOUT}=1`);break;default:location.href=`${n}?redirect=${r||location.pathname}`}}static navigateWithoutDiscount(t,e){let r=Ee.get();switch(t){case Pe.CART_PAGE:location.href="/cart";break;case Pe.SHOPIFY_CHECKOUT:location.href="/checkout";break;case Pe.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#${H.HASH_INITIATE_CHECKOUT}=1`);break;case Pe.CART_DRAWER:{r.open();break}}e&&r.refreshUI(e)}static async applyWithStorefront(t){let e=ne.get().storefrontToken;if(!e)throw new Error("Storefront token not set for the store");let r=new Headers;r.append("Content-Type","application/json"),r.append("X-Shopify-Storefront-Access-Token",e);let n=JSON.stringify({query:
|
|
50
|
+
`,jn=class{static navigate(t,e,r){let n=`${location.origin}/discount/${t}`;switch(T.log(`Applying discount code ${t}`,e,r),e){case Pe.CART_PAGE:location.href=`${n}?redirect=/cart`;break;case Pe.CART_DRAWER:location.href=`${n}?redirect=${location.pathname}#${H.HASH_OPEN_CART_DRAWER}=1`;break;case Pe.SHOPIFY_CHECKOUT:location.href=`${n}?redirect=/checkout`;break;case Pe.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${n}?redirect=/cart#${H.HASH_INITIATE_CHECKOUT}=1`);break;default:location.href=`${n}?redirect=${r||location.pathname}`}}static navigateWithoutDiscount(t,e){let r=Ee.get();switch(t){case Pe.CART_PAGE:location.href="/cart";break;case Pe.SHOPIFY_CHECKOUT:location.href="/checkout";break;case Pe.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#${H.HASH_INITIATE_CHECKOUT}=1`);break;case Pe.CART_DRAWER:{r.open();break}}e&&r.refreshUI(e)}static async applyWithStorefront(t){let e=ne.get().storefrontToken;if(!e)throw new Error("Storefront token not set for the store");let r=new Headers;r.append("Content-Type","application/json"),r.append("X-Shopify-Storefront-Access-Token",e);let n=JSON.stringify({query:C_,variables:{cartId:`gid://shopify/Cart/${xt.getCurrent().token}`,discountCodes:t}}),i={method:"POST",headers:r,body:n};T.debug(`Applying ${t.length} coupons on cart`),await Rr.getInstance().request(H.GRAPHQL_API_PATH,i)}static checkThirdPartyMethods(t){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.openRzpCheckout?window.openRzpCheckout():location.href=t}},T_=`
|
|
51
51
|
mutation cartCreate($input: CartInput) {
|
|
52
52
|
cartCreate(input: $input) {
|
|
53
53
|
cart {
|
|
@@ -60,11 +60,11 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
`,rc=class{sentryService=at.get(Kt);async addToCart(t,e){if(!t.length)return;let r=t.map(c=>{let{vID:l,quantity:p}=this.getVIDAndQuantity(c);return{id:l?+l:+c.mID,quantity:p,properties:e.getPrivateAttributesForLineItem()}}),n=Bn("cart/add.js"),i={items:r},s=Ee.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let o=JSON.stringify(i);try{let c=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(c.status===200||c.status===302)return T.log(`Added ${t.length} items to Cart`),tr("Product added to your cart"),c.json()}catch(c){tr("Failed to add product in cart. Please try again"),this.sentryService.captureError(c,"cart-item-add",{extra:{body:o},engagementTrigger:e})}}async updateLineItem(t,e){if(!Jn.hasKeys(e)){T.warn("No update fields provided");return}let r=Bn("cart/change.js"),n=x({id:t.key},e),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});if(s.status===200||s.status===302){let o=await s.json();T.log(`Updated ${t}`),xt.getCurrent().update(o)}}catch(s){tr("Failed to update item in cart"),this.sentryService.captureError(s,"cart-item-update",{extra:{body:i}})}}async copyDiscountCode(t){if(t)try{await navigator.clipboard.writeText(t),T.log(`Code-${t} copied`),tr("Discount code copied")}catch(e){T.error("Failed to copy code",e)}}goToItem(t){if(!t?.link)return;let e=Hv(t.link);e&&(location.pathname=Gi()+"products/"+e)}async upgradeToSubscription(t,e){if(!t){T.warn("Trying to upgrade to subscription with no item");return}let r=await xt.getCurrent().getNormalisedCart(),n=t.selectedOrFirstVariant.value,i=r.items.findIndex(p=>p.vID===n.mID),s=n.selectedSellingPlan.value,o=Bn("cart/change.js"),c={line:i+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},l=JSON.stringify(c);try{let p=await fetch(o,{body:l,method:"post",headers:{"Content-Type":"application/json"}});if(p.status===200||p.status===302){T.log(`Upgraded ${t} selling plan`),tr("Line item updated");let d=await p.json();return xt.getCurrent().update(d),d}}catch(p){tr("Failed to update subscription"),this.sentryService.captureError(p,"cart-switch-subscription",{extra:{body:l},engagementTrigger:e})}}async createNewCart(t,e,r){let n=ne.get().storefrontToken;if(!n)throw new Error("Storefront token not set for the store");if(!t?.vID){T.error("No variant ID found to perform Buy now",t);return}let i=e?[e]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:r.getKVFormatPrivateAttributesForLineItem()}],o=await Zu(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",n);let l=JSON.stringify({query:C_,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await Rr.getInstance().request(H.GRAPHQL_API_PATH,{method:"POST",headers:c,body:l})).data?.cartCreate?.cart?.checkoutUrl}async process(t){let e=t.clickAction,r=t.items,n=t.triggerData;if(e.at){let i=e;if(T.log(`Performing ${JSON.stringify(i)} action`),i.at===101)r?.length&&this.goToItem(r[0]);else if(i.at===102)r?.length&&await this.addToCart(r,n);else if(i.at===103)await this.copyDiscountCode(n.discount.code);else if(i.at===105)Ee.get().open();else if(i.at===104){let s=t.collections;if(!s?.length)return;location.pathname=Gi()+"collections/"+s[0].handle}}e.applyDiscount&&n.discount?.code&&jn.navigate(n.discount.code,n.redirectBehaviour)}getVIDAndQuantity(t){let e,r;if(t instanceof on)e=t.vID,r=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,r=1}return{vID:e,quantity:r}}},T_=class{static updateIdentity(t){if(!this.isInstalled())return;let e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),T.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},x_=class{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=Vt.getInstance(),this.triggerContext=e}async execute(){let t=this.containsCTA()?H.EVENT_TRIGGER_CLICKED:H.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(t),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:T.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 t=this.action.gu.u;Ju(t)||(t=`//${t}`),window.open(t,"_self")}}async closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),await this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){T.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(t=>console.log(t)).catch(t=>console.error(t))}}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return t?Object.keys(t).length===0:!0}async collectFormData(){let t={};for(let e of this.triggerContext.inputs){if(!e.isValid)return;let r=document.getElementById(e.id).value;e.type===51?t.email=r:e.type===52&&(t.mobile=r)}await this.closeTriggerAndSendEvent(H.EVENT_FORM_SUBMITTED,{form:t}),tr("Coupon applied on cart"),T_.updateIdentity(t)}async dispatchEvent(){let t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};await new rc().process(e);let r={action:this.containsCTA()?H.CAMPAIGN_CLICKED_ACTIVITY:H.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(H.POPUP_ACTIVITY_EVENT,{detail:r}))}},up=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let e={display:t.disp};return t.of&&(e.objectFit=t.of),t.pos==="absolute"&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){let e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};let e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};let e={};if(t.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:t.glossy.fallback.rgba};if(e[n]=i,e[r]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let r=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,r){if(r??={},t.type==="LINEAR"){let n=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(n+=`, ${t.c3}`),n+=")",r[e]=n}return r}getColourStyles(t,e="color",r){return r??={},t?t.grad?this.getGradientStyles(t.grad,e,r):(t.hex&&(r[e]=t.rgba),r):r}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}},oi=class{renderer=Wn.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,r){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=r,this.stylesConverter=new up(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let t=yt(x(x(x(x({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let t=this.inappElement.alpha;if(!isNaN(t)){let e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){let t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let t=new Iu(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){let t=this.inappElement.clc;!t||Object.keys(t).length===0||(this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation(),new x_(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},_s=class extends oi{constructor(t,e,r){super(t,e,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=H.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){let r=[];e.u&&r.push("underline"),e.st&&r.push("line-through"),r.length||r.push("normal"),this.renderer.setStyle(t,"font-weight",e.b?"bold":"normal"),this.renderer.setStyle(t,"font-style",e.i?"italic":"normal"),this.renderer.setStyle(t,"text-decoration",r.join(" ")),this.renderer.setStyle(t,"color",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){let t=this.inappElement.typography.ta,e=t?sa[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}},D_=class extends _s{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(t=>{let e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)}),this.processCommonBlocks()}},A_=class extends oi{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},hp=class extends oi{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}},N_=class pp extends oi{constructor(e,r,n){super(e,r,n),this.parent=e,this.inappHTMLEl=this.renderer.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(H.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",pp.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let e=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(this.renderer.setStyle(this.inappHTMLEl,"width","100%"),this.renderer.setStyle(this.inappHTMLEl,"height","100%")):(this.renderer.setStyle(this.inappHTMLEl,"width","100vw"),this.renderer.setStyle(this.inappHTMLEl,"height","100vh")),this.renderer.setStyle(this.inappHTMLEl,"top","0"),this.renderer.setStyle(this.inappHTMLEl,"left","0");else{let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(e.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(e.h)+r.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return x(x({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded()){this.renderer.setStyle(this.inappHTMLEl,"position","block");return}this.renderer.setStyle(this.inappHTMLEl,"position","absolute")}else this.renderer.setStyle(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}},O_=class extends oi{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(H.IN_APP_CONTAINER_NAME),this}},k_=class Me extends _s{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=yt(x(x(x({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=>this.renderer.setStyles(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(Me.DAYS)),e.hour&&this.elements.push(this.getChild(Me.HOURS)),e.minute&&this.elements.push(this.getChild(Me.MINUTES)),e.second&&this.elements.push(this.getChild(Me.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=this.renderer.createElement("div"),n=this.renderer.createElement("span"),i=this.renderer.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,this.renderer.setStyle(i,"font-size","0.5em"),this.renderer.setStyle(i,"text-align","center"),this.renderer.setStyle(i,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),this.renderer.setStyle(r,"display","flex"),this.renderer.setStyle(r,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(r,"justify-content","center"),this.renderer.setStyle(r,"align-items","center"),this.renderer.setStyle(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-${Me.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Me.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Me.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Me.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}},P_=class extends _s{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",e=>{e.stopPropagation()}),t.addEventListener("change",()=>{let e=new ls(JSON.parse(t.value));this.updateItems(e)})}updateItems(t){let e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=t.imgs[0]??e.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length){e.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach(n=>{e.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(t,e,r){let n=this.renderer.createElement("option");return n.text=t,n.value=JSON.stringify(e),r&&(n.selected=!0),e||(n.disabled=!0),n}},dp=class extends _s{borderColor="";constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let t=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}},R_=class fp extends dp{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.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(fp.EMAIL_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},L_=class gp extends dp{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(gp.MOBILE_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},M_=class extends hp{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},mp=class Ln{static ACTIVE_TRIGGER_DATA;renderer=Wn.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=Vt.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}setParentContainer(e){this.parent=e??document.body,this.renderer.setParentContainer(this.parent)}render(e){this.renderEngagement(new Ar(e))}async renderEngagement(e){if(this.triggerContext=new ap(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(this.renderer.isMobile()||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(!Ee.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=Ee.get().onToggle().subscribe(({open:e})=>{!e&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){Ln.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){Kt.getInstance().captureError(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&Ln.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Ha(Ln.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(Ot.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=H.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new N_(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw T.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new Bt(H.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:H.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(H.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new Bt(r,e,this.triggerContext.triggerData);n.name===H.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 Ih?new R_(e,r,n).render():r instanceof Ch?new L_(e,r,n).render():r instanceof Mo?new D_(e,r,n).render():r instanceof Th?new M_(e,r,n).render():r instanceof Pa?new hp(e,r,n).render():r instanceof bh?new A_(e,r,n).render():r instanceof Eh?new k_(e,r,n).render():r instanceof Sh?new P_(e,r,n).render():T.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new O_(this.rootContainer,r,e).render().getHTMLElement(),new b_().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),Ln.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(){Wn.get().removeInApp(this.triggerContext)}skipTrigger(e,r){let n=new Bt(H.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 s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),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"})}},U_=class{triggerData;safeHttpService=Vt.getInstance();render(t){t.contentSource===ea.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let e=t.detail;if(e.formId!==this.triggerData.klaviyoFormID){T.warn("Received invalid trigger callback");return}switch(e.type){case"open":this.safeHttpService.sendEvent(new Bt(H.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(e);this.safeHttpService.sendEvent(new Bt(H.EVENT_FORM_SUBMITTED,{form:r},this.triggerData)),this.safeHttpService.updateProfile(r);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new Bt(H.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData));break}}getFormDetails(t){let e={id:t.formId},r=t.metaData;if(Jn.hasKeys(r)){let n=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(r).forEach(o=>{n.includes(o)||(e[o]=r[o])}),e.email=r.$email??r.email,e.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(e.name=i+" "+s)}return e}},B_=class{static trackIntent(t){if(!this.isInstalled()){T.log("Facebook pixel not installed");return}if(!ne.get().pixelPush){T.log("Facebook pixel push not enabled");return}let e=hs[t.intent]?.toLowerCase(),r=t.segmentName;!e&&!r||(T.debug(`Sending ${e} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},yp=class{static itemMap=new Map;static async refreshItems(t){if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let i=(await xt.getCurrent().getNormalisedCart()).items.map(s=>s.mID);t.items=t.items.filter(s=>!i.includes(s.mID))}if(ne.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await this.refreshVideoItems(t.content.videoConfig,t),t.items;let e=t.items.length,r=t.items.map(i=>this.updatedItem(i,t)),n=(await Promise.all(r)).filter(i=>i!=null);if(e&&!n.length){let i="Failed to fetch any product from Ajax API",s=new Bt(H.EVENT_CAMPAIGN_FAILED,{reason:i,currency:t.currency},t);throw Vt.getInstance().sendEvent(s),new Error(i)}if(t.isCartRecovery()){let i=xt.getCurrent().items,s=[];for(let o of n)for(let c of o.vars){if(!c.isAvailable)continue;let l=i.find(h=>h.variant_id.toString()===c.mID);if(!l)continue;let p=new He(o);p.name=l.title;let d=new ls(c);d.name=l.variant_title,d.price.d=l.discounted_price/100,p.variants=[d],s.push(p)}return s}return n}static async refreshVideoItems(t,e){await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>await this.updatedItem(n,e)||n))}))}static async updatedItem(t,e){if(this.itemMap.has(t.mID))return this.itemMap.get(t.mID);let r=t,n=Kt.getInstance(),i=at.get(Rr),s,o=`/products/${r.slug}.js`;try{s=await i.request(o)}catch(l){return n.captureError(l,"fetch-shopify-product",{extra:{item:r,path:o},engagementTrigger:e}),null}if(!s)return T.error("Item not found after AJAX call for:",r),null;r.name=s.title,r.tags=s.tags;let c=r.selectedOrFirstVariant.value;return r.vars.map(l=>{let p=s.variants.find(d=>d.id===+l.mID);l.name=p.title,l.isAvailable=p.available,l.price.d=p.price?p.price/100:p.price,l.price.effective=l.price.d,l.price.cmp=p.compare_at_price?p.compare_at_price/100:p.compare_at_price,+c.mID===p.id&&(c.effectivePrice.value=l.price.d)}),this.itemMap.set(r.mID,r),r}},nc=class vp{static INSTANCE;httpService=at.get(Rr);sentryService=at.get(Kt);sessionManager=at.get(we);runtime=Ot.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new vp),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>T.error(`Failed to send ${e.name}`,r))}async send(e){if(T.debug(`Sending event ${e.name}`),Oe.log(`Sending event ${e.name} with id ${e.id}`),this.shouldReject(e)){T.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==H.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=>{T.log("\u2705 Event tracked:",e.name),Oe.log(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{T.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(T.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=bs.parseFromCurrent()}async addShopifyContext(e){try{e.cart=await xt.getCurrent().getNormalisedCart()}catch(r){T.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{this.sentryService.captureError(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){T.log(`Nothing to engage after ${e.name}`);return}T.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData),Oe.log(`\u{1F4E3} Campaign #${r.triggerData.shortID}) will be shown`);let n=new Ar(r.triggerData);n.occurred=e.occurred;let i;try{i=await yp.refreshItems(n)}catch(s){T.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===ea.KLAVIYO){new U_().render(n);return}new mp().renderEngagement(n).catch(s=>{this.sentryService.captureError(s,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(op.trackIntent(e.intent),B_.trackIntent(e),Oe.log(`Intent is <strong>${hs[e.intent]}</strong>`))}addShopifyAttributes(){xt.getCurrent().addCooeeAttributes().catch(e=>{T.error("Fail to add attributes in cart",e)})}},Vt=class wp{static INSTANCE;httpApiService=Rr.getInstance();eventAPIService=nc.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new wp),this.INSTANCE}sendEvent(e){T.debug(`Waiting for auth to send event ${e.name}`),we.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){we.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){we.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){we.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}},Oe=class{static isOn=!1;static element;static logs=[];static watch(){let t=gu();(t==="1"||t==="on")&&Vt.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),t==="on"?sessionStorage.cooeeDebug="1":t==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar(),this.log(`Cooee SDK v${H.SDK_VERSION} loaded`))}static log(t){this.isOn&&(this.logs.unshift({time:new Date,message:t}),this.element&&(this.element.logs=[...this.logs]))}static renderDebugBar(){this.element=document.createElement("cooee-debugger"),this.element.logs=this.logs,_a(()=>{document.body.appendChild(this.element)})}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},hu=class extends ba{static storeName="app";static{this.storage=wa(this.storeName)}},j_=class{static processConfiguration(){let t=ne.get();!t.gaMeasurementID||!t.gaEnabled||this.sendClientID()}static async sendClientID(){let t=await this.getClientID();t&&Vt.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){let t=await Lt.get(ot.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Lt.set(ot.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){let t=ne.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},$_=class bp{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new bp),this.INSTANCE}init(){hu.get(ot.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){T.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);hu.set(ot.APP_CONFIG,r).catch(n=>T.error(n)),j_.processConfiguration(),r.website&&(ye.injectRawScript(r.website.commonJS),ye.injectRawCSS(r.website.commonCSS)),Ee.get().onToggle().subscribe(async({open:n})=>{T.info("Cart drawer is now",n?"open":"closed"),n&&(at.get(Kn).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=bt.globalRef.config.update(e);return Ee.forceUpdate(),T.debug("App configurations",r),r}async trackViewCartEvent(){let e=await xt.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};Vt.getInstance().sendEvent(new Bt(H.EVENT_VIEW_CART,n))}},Xo=class _p{static INSTANCE;httpAPIService=Rr.getInstance();coreService=$_.getInstance();sentryService=Kt.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new _p),this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Lt.set(ot.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Lt.set(ot.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Lt.set(ot.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),T.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);T.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw T.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Lt.get(ot.SDK_TOKEN),!this.sdkToken){T.warn("No SDK token found in local storage");return}this.userID=await Lt.get(ot.ID),this.deviceID=await Lt.get(ot.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){T.debug("SDK Token:",this.sdkToken),T.log("Device ID:",this.deviceID),T.log("User ID:",this.userID),op.trackDeviceID(this.deviceID),Oe.log(`Device ID: ${this.deviceID}`),this.userID&&Oe.log(`User ID: ${this.userID}`),this.httpAPIService.setAPIToken(this.sdkToken),this.httpAPIService.setDeviceId(this.deviceID),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(e){let r=await new w_().safeGet(),n=await Lt.get(ot.DEVICE_ID);return n||(n=new Yt().toHexString(),await Lt.set(ot.DEVICE_ID,n)),yt(x({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:H.SDK,page:bs.parseFromCurrent(),ad:g_.getAdParams(),occurred:this.getSessionStartTime(Ot.get().jsLoadTime),currentItem:Ot.get().getCurrentItem(),cart:await xt.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Lt.get(ot.FIRST_SEEN),r=e?new Date(e):new Date;e||await Lt.set(ot.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>H.IDLE_TIME_IN_SECONDS?new Date:e}},we=class Mn{static replaySubject=new Ab(1);static INSTANCE;sentryService=at.get(Kt);constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Mn),this.INSTANCE}init(e){if(T.debug("Initialising SDK",e),d_(navigator.userAgent)){T.info("This seems to be a bot. Disabling SDK");return}Xo.getInstance().init(e),Mn.INSTANCE.checkSessionOnPageLoad().then(async()=>{Mn.replaySubject.next(!0),Mn.replaySubject.complete()}).catch(r=>{T.error("Unable to initiate session",r)})}getCurrentSessionID(){return te.set(ot.SESSION_LAST_USED_TIME,new Date().getTime()),te.get(ot.ID,"")}async checkSessionOnPageLoad(){await qv.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 this.sentryService.setTags({"cooee_session.number":e[1]}),this.sentryService.setGlobalContext("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){let r=!1;if(await this.isNewSessionRequired()?(Oe.log("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();Oe.log(`Session ID: ${n[0]} & number: ${n[1]}`),await Xo.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await te.set(ot.SESSION_SYNCED,!0)}}async startNewSession(){T.debug("Starting new session"),await te.clear(),T.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Yt().toHexString();T.debug("New session ID to be used",r);let n=await Lt.get(ot.SESSION_NUMBER,0)+1;await Promise.all([Lt.set(ot.SESSION_NUMBER,n),te.set(ot.ID,r),te.set(ot.SESSION_LAST_USED_TIME,e.getTime()),te.set(ot.SESSION_LANDING_PAGE,bs.parseFromCurrent())])}getLandingPage(){return te.get(ot.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Lt.get(ot.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await te.get(ot.ID))return!0;let e=await te.get(ot.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>H.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await te.get(ot.SESSION_SYNCED,!1)}},F_=ke(sn()),H_=ke(sn()),ic=class{constructor(t){this.triggerContext=t}safeHTTP=Vt.getInstance();eventAPIService=nc.getInstance();async execute(t){let e=Ot.get().getCurrentItem(),r=t.clickAction;if(!r)return;let n=t.item,i=this.triggerContext,s=new rc,o=i.triggerData.redirectBehaviour,c=!!i.triggerData.discount.type&&!!r?.applyDiscount,l={selectedVariants:i.triggerData.nonMutableItems.map(_=>({itemMID:_.mID,mID:_.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},p="",d=[],h=[];if(n?h=[n.toEmbed()]:t.embeddedItem&&(h=[t.embeddedItem]),r.at===108){let _=i.selectedItems;if(h=t.embeddedItems??_.map(k=>k.toEmbed()),i.shouldGiveFBTDiscount||t.embeddedItems?.length){let k;t.embeddedItems?k=t.embeddedItems.map(B=>({itemMID:B.mID,mID:B.vID,quantity:B.quantity})):k=_.map(B=>({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID}));let A=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&A&&(k.push({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,isPrimary:!0}),h.unshift(A.toEmbed())),l.selectedVariants=k,i.triggerData.isBundleOnPDP()&&l.selectedVariants.forEach(B=>{B.mID===e.vID&&(B.isPrimary=!0)})}else l=void 0;d=t.embeddedItems??_}else if(r.at===107){let _=await xt.getCurrent().getNormalisedCart();h=_.items,l.selectedVariants=_.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(r.at===102)d=n?[n]:[t.embeddedItem];else if(r.at===101)p=n?Gi()+"products/"+n.slug:t.embeddedItem?.link;else if(r.at===4){let _=Ju(r.gu?.u);_&&(p=_.href)}else if(r.at===109){let _=await s.upgradeToSubscription(n,i.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Ee.get().refreshUI(_)}else if(r.at===104){let _=this.triggerContext.triggerData.collections?.[0];_&&(p="collections/"+_.handle)}if(this.sendTriggerClicked(h,{from:"button"},t.video),T.debug({redirectPath:p,redirectBehaviour:o,hasDiscount:c}),!c&&p){location.href=p;return}let b,v=!1;try{b=await this.getOrGenerateDiscountCode(l),T.debug("Discount code (if any) to apply",b)}catch(_){if(!this.triggerContext.triggerData.isBYOB()){H_.default.error("Unable to get a discount code",_);return}}if(b&&r.at===103)await s.copyDiscountCode(b);else if(r.at===110){let _=await s.createNewCart(e,b,i.triggerData);_&&(location.href=_);return}try{b&&await jn.applyWithStorefront([b])}catch(_){T.error(_),v=!0}let w;if(d?.length&&(w=await s.addToCart(d,i.triggerData)),v&&b){jn.navigate(b,o,p);return}if(p){location.href=p;return}jn.navigateWithoutDiscount(o,w)}sendTriggerClicked(t,e,r){let n=new Bt(H.EVENT_TRIGGER_CLICKED,e,this.triggerContext.triggerData);n.items=t,r?.id&&(n.videos=[r.id]),this.eventAPIService.sendSilently(n)}async getOrGenerateDiscountCode(t){let e=this.triggerContext.triggerData.discount;if(!e?.type)return;let r="";if(e.type===ge.STATIC){if(!e.code)throw Kt.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(t){if(r=await this.generateDiscount(t),!r)throw T.error("No discount code found",t),new Error("Discount code not found or generated");return r}}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw tr("Failed to generate a discount code"),Kt.getInstance().captureError(e,"backend-generate-discount",{extra:{discountData:JSON.stringify(t)},triggerContext:this.triggerContext}),e}}},se=class extends br{stylesConverter=new up(1);renderer=Wn.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new ic(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),x(x(yt(x(x(x(x(x(x({},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(t){if(!t?.op)return!0;let{lhs:e,rhs:r}=t;switch(t.op){case"eq":return e===r;case"gt":return+e>+r;case"gte":return+e>=+r;case"lt":return+e<+r;case"lte":return+e<=+r;case"ne":return e!==r;case"null":return e==null;case"empty":return e.trim()==="";case"in":return new RegExp(`\\b${r}\\b`).test(e);case"nin":return!new RegExp(`\\b${r}\\b`).test(e);default:return T.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){let t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle=x(x({},this.mediaStyle),t.style.sm))}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t,e){t.stopPropagation(),!e.clickAction&&(e.clickAction=this.props.element.clc),await this.clickExecutor.execute(e)}},V_=0,SE=Array.isArray;function z(t,e,r,n,i,s){e||(e={});var o,c,l=e;if("ref"in l)for(c in l={},e)c=="ref"?o=e[c]:l[c]=e[c];var p={type:t,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--V_,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(c in o)l[c]===void 0&&(l[c]=o[c]);return dt.vnode&&dt.vnode(p),p}var ai=class extends se{componentDidMount(){this.setState(()=>({text:this.props.element.text})),Ke(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){let t=this.getCompiledStyles(),e=this.state.text;return e||(t.display="none",e=""),z("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:z("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData,cart:t.getCartMagicVariables()},r=Ve.render(JSON.stringify(this.props.element),e),n=new Ne(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let t={},e=this.mediaStyle.typo??new We;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return x({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},Ep=class extends ai{render(){return z("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:t=>this.onClick(t,{item:this.props.item}),children:z("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return yt(x({},super.getComponentStyles()),{cursor:"pointer"})}},q_=class extends br{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?z("div",{style:x(x({},this.getElementStyle()),this.props.styles),children:[z("span",{children:this.props.time}),z("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):z("div",{style:x(x({},this.getElementStyle()),this.props.styles),children:[z("span",{style:this.getTimeLabelStyle(),children:this.props.label}),z("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}},W_=class extends ai{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>x({},this.labels)),this.processAndStartTimer()}render(){return z("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(t=>z(q_,{styles:this.getCompiledStyles(),label:t,time:this.state[t],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 x(x({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState(()=>x({},this.labels))})}},G_=class extends se{componentDidMount(){Ke(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return z("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:z("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){let{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){let t={},e=this.mediaStyle.typo??new We;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return yt(x({},this.getTypoStyles()),{display:"flex"})}},sc=class extends se{constructor(t,e){super(t,e)}render(){let t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return z("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(t){this.props.element.clc?.at===vu.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(t,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let t=this.mediaStyle.lout;if(!t||t.pos!=="absolute")return{};let e={zIndex:t.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){let e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},oc=class extends se{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return z("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:z(ac,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let t=this.mediaStyle.flex??new xh,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return t.wrap==="nowrap"&&t.scroll&&(t.dir==="column"?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}},z_=class extends oc{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return z("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:z(Sp,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},Y_=class extends se{render(){return z("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(){Ke(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new We;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),x(x({},t),this.getTypoStyles())}createSelectItems(){let t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(z("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(let r of e.sellingPlans??[])t.push(z("option",{value:r.mID,selected:r.isSelected,children:r.name}));return t}onChange(t){let e=t.target.value;e?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===e):this.props.selectedVariant.selectedSellingPlan.value=void 0}},K_=class extends se{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),Ve.escape=mu.escapeHtml}render(){let t=this.getCompiledStyles(),e=this.getRating();return e||(t.display="none",e=""),z("div",{style:t,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:e}})}getRating(){let t=this.props.element.fullStar,e=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};t=Ve.render(t,{svg:r}),e=Ve.render(e,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=t;else{let s=5,o=`${n.rating}`.split(".");for(let c=0;c<+o[0];c++)i+=t,s--;o[1]&&(i+=e,s--);for(let c=0;c<s;c++)i+=t.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},J_=class extends se{render(){return z("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(){Ke(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new We;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(t.visibility="hidden"),x(x({},t),this.getTypoStyles())}createSelectItems(){let t=[];for(let e of this.props.item.vars)t.push(z("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){let e=t.target.value,r=this.props.item.vars.find(n=>n.mID===e);this.props.item.setSelectedVariant(r)}},Sp=class extends se{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}renderElement(t){if(!(t.hide||!this.matchWhenCondition(t.when))){if(t.t===4){let e=t;return z(z_,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===6)return this.props.triggerContext.triggerData.isBundle()?z(G_,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(t.t===13){let e=t,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;e.lg=e.sm={src:n,name:r.name,secondarySrc:i};let s=z(sc,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:z("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(t.t===14)return this.renderProductTitle(t);if(t.t===15){let e=t;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:e.showChips?z("cooee-product-options-picker",{item:this.props.item,element:e}):z(J_,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===16?z(Y_,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===19?z(K_,{element:t,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):t.t===18||t.t===3?z(Ep,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):z(ac,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}renderProductTitle(t){let e=z(ai,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:z("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:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},Ip=class extends se{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=Ve.render(t,this.getProductData());if(this.productElement=new Ma(JSON.parse(e)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return z("div",{style:x({},this.getCompiledStyles()),class:"lc-single-product",children:z(Sp,{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 t=this.props.item,e=t.selectedOrFirstVariant.value,r=t.getTemplateVariables();r.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let n=this.props.triggerContext.triggerData.discount.type===ge.BXGY;return!e.hasEffectivePrice()&&n&&(r.product.effective_price=De(e.effectivePrice.value),r.product.price=""),r.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity,{product:r.product,variant:r.variant,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function Cp(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)=>`
|
|
63
|
+
`,ec=class{sentryService=at.get(Kt);async addToCart(t,e){if(!t.length)return;let r=t.map(c=>{let{vID:l,quantity:p}=this.getVIDAndQuantity(c);return{id:l?+l:+c.mID,quantity:p,properties:e.getPrivateAttributesForLineItem()}}),n=Bn("cart/add.js"),i={items:r},s=Ee.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let o=JSON.stringify(i);try{let c=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(c.status===200||c.status===302)return T.log(`Added ${t.length} items to Cart`),er("Product added to your cart"),c.json()}catch(c){er("Failed to add product in cart. Please try again"),this.sentryService.captureError(c,"cart-item-add",{extra:{body:o},engagementTrigger:e})}}async updateLineItem(t,e){if(!Jn.hasKeys(e)){T.warn("No update fields provided");return}let r=Bn("cart/change.js"),n=x({id:t.key},e),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});if(s.status===200||s.status===302){let o=await s.json();T.log(`Updated ${t}`),xt.getCurrent().update(o)}}catch(s){er("Failed to update item in cart"),this.sentryService.captureError(s,"cart-item-update",{extra:{body:i}})}}async copyDiscountCode(t){if(t)try{await navigator.clipboard.writeText(t),T.log(`Code-${t} copied`),er("Discount code copied")}catch(e){T.error("Failed to copy code",e)}}goToItem(t){if(!t?.link)return;let e=Vv(t.link);e&&(location.pathname=Gi()+"products/"+e)}async upgradeToSubscription(t,e){if(!t){T.warn("Trying to upgrade to subscription with no item");return}let r=await xt.getCurrent().getNormalisedCart(),n=t.selectedOrFirstVariant.value,i=r.items.findIndex(p=>p.vID===n.mID),s=n.selectedSellingPlan.value,o=Bn("cart/change.js"),c={line:i+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},l=JSON.stringify(c);try{let p=await fetch(o,{body:l,method:"post",headers:{"Content-Type":"application/json"}});if(p.status===200||p.status===302){T.log(`Upgraded ${t} selling plan`),er("Line item updated");let d=await p.json();return xt.getCurrent().update(d),d}}catch(p){er("Failed to update subscription"),this.sentryService.captureError(p,"cart-switch-subscription",{extra:{body:l},engagementTrigger:e})}}async createNewCart(t,e,r){let n=ne.get().storefrontToken;if(!n)throw new Error("Storefront token not set for the store");if(!t?.vID){T.error("No variant ID found to perform Buy now",t);return}let i=e?[e]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:r.getKVFormatPrivateAttributesForLineItem()}],o=await Qu(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",n);let l=JSON.stringify({query:T_,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await Rr.getInstance().request(H.GRAPHQL_API_PATH,{method:"POST",headers:c,body:l})).data?.cartCreate?.cart?.checkoutUrl}async process(t){let e=t.clickAction,r=t.items,n=t.triggerData;if(e.at){let i=e;if(T.log(`Performing ${JSON.stringify(i)} action`),i.at===101)r?.length&&this.goToItem(r[0]);else if(i.at===102)r?.length&&await this.addToCart(r,n);else if(i.at===103)await this.copyDiscountCode(n.discount.code);else if(i.at===105)Ee.get().open();else if(i.at===104){let s=t.collections;if(!s?.length)return;location.pathname=Gi()+"collections/"+s[0].handle}}e.applyDiscount&&n.discount?.code&&jn.navigate(n.discount.code,n.redirectBehaviour)}getVIDAndQuantity(t){let e,r;if(t instanceof on)e=t.vID,r=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,r=1}return{vID:e,quantity:r}}},x_=class{static updateIdentity(t){if(!this.isInstalled())return;let e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),T.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},D_=class{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=Vt.getInstance(),this.triggerContext=e}async execute(){let t=this.containsCTA()?H.EVENT_TRIGGER_CLICKED:H.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(t),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:T.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 t=this.action.gu.u;Ku(t)||(t=`//${t}`),window.open(t,"_self")}}async closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),await this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){T.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(t=>console.log(t)).catch(t=>console.error(t))}}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return t?Object.keys(t).length===0:!0}async collectFormData(){let t={};for(let e of this.triggerContext.inputs){if(!e.isValid)return;let r=document.getElementById(e.id).value;e.type===51?t.email=r:e.type===52&&(t.mobile=r)}await this.closeTriggerAndSendEvent(H.EVENT_FORM_SUBMITTED,{form:t}),er("Coupon applied on cart"),x_.updateIdentity(t)}async dispatchEvent(){let t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};await new ec().process(e);let r={action:this.containsCTA()?H.CAMPAIGN_CLICKED_ACTIVITY:H.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(H.POPUP_ACTIVITY_EVENT,{detail:r}))}},hp=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let e={display:t.disp};return t.of&&(e.objectFit=t.of),t.pos==="absolute"&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){let e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};let e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};let e={};if(t.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:t.glossy.fallback.rgba};if(e[n]=i,e[r]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let r=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,r){if(r??={},t.type==="LINEAR"){let n=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(n+=`, ${t.c3}`),n+=")",r[e]=n}return r}getColourStyles(t,e="color",r){return r??={},t?t.grad?this.getGradientStyles(t.grad,e,r):(t.hex&&(r[e]=t.rgba),r):r}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}},oi=class{renderer=Wn.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,r){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=r,this.stylesConverter=new hp(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let t=yt(x(x(x(x({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let t=this.inappElement.alpha;if(!isNaN(t)){let e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){let t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let t=new Su(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){let t=this.inappElement.clc;!t||Object.keys(t).length===0||(this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation(),new D_(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},Es=class extends oi{constructor(t,e,r){super(t,e,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=H.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){let r=[];e.u&&r.push("underline"),e.st&&r.push("line-through"),r.length||r.push("normal"),this.renderer.setStyle(t,"font-weight",e.b?"bold":"normal"),this.renderer.setStyle(t,"font-style",e.i?"italic":"normal"),this.renderer.setStyle(t,"text-decoration",r.join(" ")),this.renderer.setStyle(t,"color",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){let t=this.inappElement.typography.ta,e=t?sa[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}},A_=class extends Es{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(t=>{let e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)}),this.processCommonBlocks()}},N_=class extends oi{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},pp=class extends oi{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}},O_=class dp extends oi{constructor(e,r,n){super(e,r,n),this.parent=e,this.inappHTMLEl=this.renderer.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(H.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",dp.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let e=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(this.renderer.setStyle(this.inappHTMLEl,"width","100%"),this.renderer.setStyle(this.inappHTMLEl,"height","100%")):(this.renderer.setStyle(this.inappHTMLEl,"width","100vw"),this.renderer.setStyle(this.inappHTMLEl,"height","100vh")),this.renderer.setStyle(this.inappHTMLEl,"top","0"),this.renderer.setStyle(this.inappHTMLEl,"left","0");else{let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(e.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(e.h)+r.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return x(x({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded()){this.renderer.setStyle(this.inappHTMLEl,"position","block");return}this.renderer.setStyle(this.inappHTMLEl,"position","absolute")}else this.renderer.setStyle(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}},k_=class extends oi{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(H.IN_APP_CONTAINER_NAME),this}},P_=class Me extends Es{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=yt(x(x(x({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=>this.renderer.setStyles(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(Me.DAYS)),e.hour&&this.elements.push(this.getChild(Me.HOURS)),e.minute&&this.elements.push(this.getChild(Me.MINUTES)),e.second&&this.elements.push(this.getChild(Me.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=this.renderer.createElement("div"),n=this.renderer.createElement("span"),i=this.renderer.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,this.renderer.setStyle(i,"font-size","0.5em"),this.renderer.setStyle(i,"text-align","center"),this.renderer.setStyle(i,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),this.renderer.setStyle(r,"display","flex"),this.renderer.setStyle(r,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(r,"justify-content","center"),this.renderer.setStyle(r,"align-items","center"),this.renderer.setStyle(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-${Me.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Me.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Me.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Me.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}},R_=class extends Es{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",e=>{e.stopPropagation()}),t.addEventListener("change",()=>{let e=new us(JSON.parse(t.value));this.updateItems(e)})}updateItems(t){let e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=t.imgs[0]??e.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length){e.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach(n=>{e.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(t,e,r){let n=this.renderer.createElement("option");return n.text=t,n.value=JSON.stringify(e),r&&(n.selected=!0),e||(n.disabled=!0),n}},fp=class extends Es{borderColor="";constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let t=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}},L_=class gp extends fp{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.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(gp.EMAIL_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},M_=class mp extends fp{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(mp.MOBILE_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},U_=class extends pp{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},yp=class Ln{static ACTIVE_TRIGGER_DATA;renderer=Wn.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=Vt.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}setParentContainer(e){this.parent=e??document.body,this.renderer.setParentContainer(this.parent)}render(e){this.renderEngagement(new Ar(e))}async renderEngagement(e){if(this.triggerContext=new cp(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(this.renderer.isMobile()||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(!Ee.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=Ee.get().onToggle().subscribe(({open:e})=>{!e&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){Ln.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){Kt.getInstance().captureError(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&Ln.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Fa(Ln.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(Ot.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=H.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new O_(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw T.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new Bt(H.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:H.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(H.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new Bt(r,e,this.triggerContext.triggerData);n.name===H.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 Ch?new L_(e,r,n).render():r instanceof Th?new M_(e,r,n).render():r instanceof Mo?new A_(e,r,n).render():r instanceof xh?new U_(e,r,n).render():r instanceof ka?new pp(e,r,n).render():r instanceof _h?new N_(e,r,n).render():r instanceof Sh?new P_(e,r,n).render():r instanceof Ih?new R_(e,r,n).render():T.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new k_(this.rootContainer,r,e).render().getHTMLElement(),new __().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),Ln.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(){Wn.get().removeInApp(this.triggerContext)}skipTrigger(e,r){let n=new Bt(H.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 s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),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"})}},B_=class{triggerData;safeHttpService=Vt.getInstance();render(t){t.contentSource===ea.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let e=t.detail;if(e.formId!==this.triggerData.klaviyoFormID){T.warn("Received invalid trigger callback");return}switch(e.type){case"open":this.safeHttpService.sendEvent(new Bt(H.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(e);this.safeHttpService.sendEvent(new Bt(H.EVENT_FORM_SUBMITTED,{form:r},this.triggerData)),this.safeHttpService.updateProfile(r);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new Bt(H.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData));break}}getFormDetails(t){let e={id:t.formId},r=t.metaData;if(Jn.hasKeys(r)){let n=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(r).forEach(o=>{n.includes(o)||(e[o]=r[o])}),e.email=r.$email??r.email,e.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(e.name=i+" "+s)}return e}},j_=class{static trackIntent(t){if(!this.isInstalled()){T.log("Facebook pixel not installed");return}if(!ne.get().pixelPush){T.log("Facebook pixel push not enabled");return}let e=ps[t.intent]?.toLowerCase(),r=t.segmentName;!e&&!r||(T.debug(`Sending ${e} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},vp=class{static itemMap=new Map;static async refreshItems(t){if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let i=(await xt.getCurrent().getNormalisedCart()).items.map(s=>s.mID);t.items=t.items.filter(s=>!i.includes(s.mID))}if(ne.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await this.refreshVideoItems(t.content.videoConfig,t),t.items;let e=t.items.length,r=t.items.map(i=>this.updatedItem(i,t)),n=(await Promise.all(r)).filter(i=>i!=null);if(e&&!n.length){let i="Failed to fetch any product from Ajax API",s=new Bt(H.EVENT_CAMPAIGN_FAILED,{reason:i,currency:t.currency},t);throw Vt.getInstance().sendEvent(s),new Error(i)}if(t.isCartRecovery()){let i=xt.getCurrent().items,s=[];for(let o of n)for(let c of o.vars){if(!c.isAvailable)continue;let l=i.find(h=>h.variant_id.toString()===c.mID);if(!l)continue;let p=new Ve(o);p.name=l.title;let d=new us(c);d.name=l.variant_title,d.price.d=l.discounted_price/100,p.variants=[d],s.push(p)}return s}return n}static async refreshVideoItems(t,e){await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>await this.updatedItem(n,e)||n))}))}static async updatedItem(t,e){if(this.itemMap.has(t.mID))return this.itemMap.get(t.mID);let r=t,n=Kt.getInstance(),i=at.get(Rr),s,o=`/products/${r.slug}.js`;try{s=await i.request(o)}catch(l){return n.captureError(l,"fetch-shopify-product",{extra:{item:r,path:o},engagementTrigger:e}),null}if(!s)return T.error("Item not found after AJAX call for:",r),null;r.name=s.title,r.tags=s.tags;let c=r.selectedOrFirstVariant.value;return r.vars.map(l=>{let p=s.variants.find(d=>d.id===+l.mID);l.name=p.title,l.isAvailable=p.available,l.price.d=p.price?p.price/100:p.price,l.price.effective=l.price.d,l.price.cmp=p.compare_at_price?p.compare_at_price/100:p.compare_at_price,+c.mID===p.id&&(c.effectivePrice.value=l.price.d)}),this.itemMap.set(r.mID,r),r}},rc=class wp{static INSTANCE;httpService=at.get(Rr);sentryService=at.get(Kt);sessionManager=at.get(we);runtime=Ot.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new wp),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>T.error(`Failed to send ${e.name}`,r))}async send(e){if(T.debug(`Sending event ${e.name}`),Oe.log(`Sending event ${e.name} with id ${e.id}`),this.shouldReject(e)){T.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==H.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=>{T.log("\u2705 Event tracked:",e.name),Oe.log(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{T.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(T.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=_s.parseFromCurrent()}async addShopifyContext(e){try{e.cart=await xt.getCurrent().getNormalisedCart()}catch(r){T.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{this.sentryService.captureError(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){T.log(`Nothing to engage after ${e.name}`);return}T.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData),Oe.log(`\u{1F4E3} Campaign #${r.triggerData.shortID}) will be shown`);let n=new Ar(r.triggerData);n.occurred=e.occurred;let i;try{i=await vp.refreshItems(n)}catch(s){T.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===ea.KLAVIYO){new B_().render(n);return}new yp().renderEngagement(n).catch(s=>{this.sentryService.captureError(s,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(ap.trackIntent(e.intent),j_.trackIntent(e),Oe.log(`Intent is <strong>${ps[e.intent]}</strong>`))}addShopifyAttributes(){xt.getCurrent().addCooeeAttributes().catch(e=>{T.error("Fail to add attributes in cart",e)})}},Vt=class bp{static INSTANCE;httpApiService=Rr.getInstance();eventAPIService=rc.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new bp),this.INSTANCE}sendEvent(e){T.debug(`Waiting for auth to send event ${e.name}`),we.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){we.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){we.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){we.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}},Oe=class{static isOn=!1;static element;static logs=[];static watch(){let t=fu();(t==="1"||t==="on")&&Vt.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),t==="on"?sessionStorage.cooeeDebug="1":t==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar(),this.log(`Cooee SDK v${H.SDK_VERSION} loaded`))}static log(t){this.isOn&&(this.logs.unshift({time:new Date,message:t}),this.element&&(this.element.logs=[...this.logs]))}static renderDebugBar(){this.element=document.createElement("cooee-debugger"),this.element.logs=this.logs,_a(()=>{document.body.appendChild(this.element)})}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},uu=class extends ba{static storeName="app";static{this.storage=wa(this.storeName)}},$_=class{static processConfiguration(){let t=ne.get();!t.gaMeasurementID||!t.gaEnabled||this.sendClientID()}static async sendClientID(){let t=await this.getClientID();t&&Vt.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){let t=await Lt.get(ot.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Lt.set(ot.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){let t=ne.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},F_=class _p{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new _p),this.INSTANCE}init(){uu.get(ot.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){T.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);uu.set(ot.APP_CONFIG,r).catch(n=>T.error(n)),$_.processConfiguration(),r.website&&(ye.injectRawScript(r.website.commonJS),ye.injectRawCSS(r.website.commonCSS)),Ee.get().onToggle().subscribe(async({open:n})=>{T.info("Cart drawer is now",n?"open":"closed"),n&&(at.get(Kn).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=bt.globalRef.config.update(e);return Ee.forceUpdate(),T.debug("App configurations",r),r}async trackViewCartEvent(){let e=await xt.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};Vt.getInstance().sendEvent(new Bt(H.EVENT_VIEW_CART,n))}},Xo=class Ep{static INSTANCE;httpAPIService=Rr.getInstance();coreService=F_.getInstance();sentryService=Kt.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ep),this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Lt.set(ot.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Lt.set(ot.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Lt.set(ot.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),T.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);T.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw T.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Lt.get(ot.SDK_TOKEN),!this.sdkToken){T.warn("No SDK token found in local storage");return}this.userID=await Lt.get(ot.ID),this.deviceID=await Lt.get(ot.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){T.debug("SDK Token:",this.sdkToken),T.log("Device ID:",this.deviceID),T.log("User ID:",this.userID),ap.trackDeviceID(this.deviceID),Oe.log(`Device ID: ${this.deviceID}`),this.userID&&Oe.log(`User ID: ${this.userID}`),this.httpAPIService.setAPIToken(this.sdkToken),this.httpAPIService.setDeviceId(this.deviceID),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(e){let r=await new b_().safeGet(),n=await Lt.get(ot.DEVICE_ID);return n||(n=new Yt().toHexString(),await Lt.set(ot.DEVICE_ID,n)),yt(x({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:H.SDK,page:_s.parseFromCurrent(),ad:m_.getAdParams(),occurred:this.getSessionStartTime(Ot.get().jsLoadTime),currentItem:Ot.get().getCurrentItem(),cart:await xt.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Lt.get(ot.FIRST_SEEN),r=e?new Date(e):new Date;e||await Lt.set(ot.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>H.IDLE_TIME_IN_SECONDS?new Date:e}},we=class Mn{static replaySubject=new Nb(1);static INSTANCE;sentryService=at.get(Kt);constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Mn),this.INSTANCE}init(e){if(T.debug("Initialising SDK",e),f_(navigator.userAgent)){T.info("This seems to be a bot. Disabling SDK");return}Xo.getInstance().init(e),Mn.INSTANCE.checkSessionOnPageLoad().then(async()=>{Mn.replaySubject.next(!0),Mn.replaySubject.complete()}).catch(r=>{T.error("Unable to initiate session",r)})}getCurrentSessionID(){return te.set(ot.SESSION_LAST_USED_TIME,new Date().getTime()),te.get(ot.ID,"")}async checkSessionOnPageLoad(){await Wv.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 this.sentryService.setTags({"cooee_session.number":e[1]}),this.sentryService.setGlobalContext("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){let r=!1;if(await this.isNewSessionRequired()?(Oe.log("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();Oe.log(`Session ID: ${n[0]} & number: ${n[1]}`),await Xo.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await te.set(ot.SESSION_SYNCED,!0)}}async startNewSession(){T.debug("Starting new session"),await te.clear(),T.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Yt().toHexString();T.debug("New session ID to be used",r);let n=await Lt.get(ot.SESSION_NUMBER,0)+1;await Promise.all([Lt.set(ot.SESSION_NUMBER,n),te.set(ot.ID,r),te.set(ot.SESSION_LAST_USED_TIME,e.getTime()),te.set(ot.SESSION_LANDING_PAGE,_s.parseFromCurrent())])}getLandingPage(){return te.get(ot.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Lt.get(ot.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await te.get(ot.ID))return!0;let e=await te.get(ot.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>H.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await te.get(ot.SESSION_SYNCED,!1)}},H_=ke(sn()),V_=ke(sn()),nc=class{constructor(t){this.triggerContext=t}safeHTTP=Vt.getInstance();eventAPIService=rc.getInstance();async execute(t){let e=Ot.get().getCurrentItem(),r=t.clickAction;if(!r)return;let n=t.item,i=this.triggerContext,s=new ec,o=i.triggerData.redirectBehaviour,c=!!i.triggerData.discount.type&&!!r?.applyDiscount,l={selectedVariants:i.triggerData.nonMutableItems.map(_=>({itemMID:_.mID,mID:_.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},p="",d=[],h=[];if(n?h=[n.toEmbed()]:t.embeddedItem&&(h=[t.embeddedItem]),r.at===108){let _=i.selectedItems;if(h=t.embeddedItems??_.map(k=>k.toEmbed()),i.shouldGiveFBTDiscount||t.embeddedItems?.length){let k;t.embeddedItems?k=t.embeddedItems.map(B=>({itemMID:B.mID,mID:B.vID,quantity:B.quantity})):k=_.map(B=>({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID}));let A=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&A&&(k.push({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,isPrimary:!0}),h.unshift(A.toEmbed())),l.selectedVariants=k,i.triggerData.isBundleOnPDP()&&l.selectedVariants.forEach(B=>{B.mID===e.vID&&(B.isPrimary=!0)})}else l=void 0;d=t.embeddedItems??_}else if(r.at===107){let _=await xt.getCurrent().getNormalisedCart();h=_.items,l.selectedVariants=_.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(r.at===102)d=n?[n]:[t.embeddedItem];else if(r.at===101)p=n?Gi()+"products/"+n.slug:t.embeddedItem?.link;else if(r.at===4){let _=Ku(r.gu?.u);_&&(p=_.href)}else if(r.at===109){let _=await s.upgradeToSubscription(n,i.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Ee.get().refreshUI(_)}else if(r.at===104){let _=this.triggerContext.triggerData.collections?.[0];_&&(p="collections/"+_.handle)}if(this.sendTriggerClicked(h,{from:"button"},t.video),T.debug({redirectPath:p,redirectBehaviour:o,hasDiscount:c}),!c&&p){location.href=p;return}let b,v=!1;try{b=await this.getOrGenerateDiscountCode(l),T.debug("Discount code (if any) to apply",b)}catch(_){if(!this.triggerContext.triggerData.isBYOB()){V_.default.error("Unable to get a discount code",_);return}}if(b&&r.at===103)await s.copyDiscountCode(b);else if(r.at===110){let _=await s.createNewCart(e,b,i.triggerData);_&&(location.href=_);return}try{b&&await jn.applyWithStorefront([b])}catch(_){T.error(_),v=!0}let w;if(d?.length&&(w=await s.addToCart(d,i.triggerData)),v&&b){jn.navigate(b,o,p);return}if(p){location.href=p;return}jn.navigateWithoutDiscount(o,w)}sendTriggerClicked(t,e,r){let n=new Bt(H.EVENT_TRIGGER_CLICKED,e,this.triggerContext.triggerData);n.items=t,r?.id&&(n.videos=[r.id]),this.eventAPIService.sendSilently(n)}async getOrGenerateDiscountCode(t){let e=this.triggerContext.triggerData.discount;if(!e?.type)return;let r="";if(e.type===ge.STATIC){if(!e.code)throw Kt.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(t){if(r=await this.generateDiscount(t),!r)throw T.error("No discount code found",t),new Error("Discount code not found or generated");return r}}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw er("Failed to generate a discount code"),Kt.getInstance().captureError(e,"backend-generate-discount",{extra:{discountData:JSON.stringify(t)},triggerContext:this.triggerContext}),e}}},se=class extends br{stylesConverter=new hp(1);renderer=Wn.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new nc(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),x(x(yt(x(x(x(x(x(x({},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(t){if(!t?.op)return!0;let{lhs:e,rhs:r}=t;switch(t.op){case"eq":return e===r;case"gt":return+e>+r;case"gte":return+e>=+r;case"lt":return+e<+r;case"lte":return+e<=+r;case"ne":return e!==r;case"null":return e==null;case"empty":return e.trim()==="";case"in":return new RegExp(`\\b${r}\\b`).test(e);case"nin":return!new RegExp(`\\b${r}\\b`).test(e);default:return T.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){let t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle=x(x({},this.mediaStyle),t.style.sm))}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t,e){t.stopPropagation(),!e.clickAction&&(e.clickAction=this.props.element.clc),await this.clickExecutor.execute(e)}},q_=0,IE=Array.isArray;function z(t,e,r,n,i,s){e||(e={});var o,c,l=e;if("ref"in l)for(c in l={},e)c=="ref"?o=e[c]:l[c]=e[c];var p={type:t,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--q_,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(c in o)l[c]===void 0&&(l[c]=o[c]);return dt.vnode&&dt.vnode(p),p}var ai=class extends se{componentDidMount(){this.setState(()=>({text:this.props.element.text})),Je(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){let t=this.getCompiledStyles(),e=this.state.text;return e||(t.display="none",e=""),z("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:z("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData,cart:t.getCartMagicVariables()},r=qe.render(JSON.stringify(this.props.element),e),n=new Ne(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ge;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return x({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},Sp=class extends ai{render(){return z("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:t=>this.onClick(t,{item:this.props.item}),children:z("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return yt(x({},super.getComponentStyles()),{cursor:"pointer"})}},W_=class extends br{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?z("div",{style:x(x({},this.getElementStyle()),this.props.styles),children:[z("span",{children:this.props.time}),z("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):z("div",{style:x(x({},this.getElementStyle()),this.props.styles),children:[z("span",{style:this.getTimeLabelStyle(),children:this.props.label}),z("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}},G_=class extends ai{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>x({},this.labels)),this.processAndStartTimer()}render(){return z("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(t=>z(W_,{styles:this.getCompiledStyles(),label:t,time:this.state[t],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 x(x({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState(()=>x({},this.labels))})}},z_=class extends se{componentDidMount(){Je(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return z("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:z("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){let{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ge;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return yt(x({},this.getTypoStyles()),{display:"flex"})}},ic=class extends se{constructor(t,e){super(t,e)}render(){let t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return z("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(t){this.props.element.clc?.at===yu.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(t,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let t=this.mediaStyle.lout;if(!t||t.pos!=="absolute")return{};let e={zIndex:t.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){let e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},sc=class extends se{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return z("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:z(oc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let t=this.mediaStyle.flex??new Dh,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return t.wrap==="nowrap"&&t.scroll&&(t.dir==="column"?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}},Y_=class extends sc{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return z("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:z(Ip,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},K_=class extends se{render(){return z("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(){Je(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ge;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),x(x({},t),this.getTypoStyles())}createSelectItems(){let t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(z("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(let r of e.sellingPlans??[])t.push(z("option",{value:r.mID,selected:r.isSelected,children:r.name}));return t}onChange(t){let e=t.target.value;e?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===e):this.props.selectedVariant.selectedSellingPlan.value=void 0}},J_=class extends se{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),qe.escape=gu.escapeHtml}render(){let t=this.getCompiledStyles(),e=this.getRating();return e||(t.display="none",e=""),z("div",{style:t,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:e}})}getRating(){let t=this.props.element.fullStar,e=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};t=qe.render(t,{svg:r}),e=qe.render(e,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=t;else{let s=5,o=`${n.rating}`.split(".");for(let c=0;c<+o[0];c++)i+=t,s--;o[1]&&(i+=e,s--);for(let c=0;c<s;c++)i+=t.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},X_=class extends se{render(){return z("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(){Je(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ge;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(t.visibility="hidden"),x(x({},t),this.getTypoStyles())}createSelectItems(){let t=[];for(let e of this.props.item.vars)t.push(z("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){let e=t.target.value,r=this.props.item.vars.find(n=>n.mID===e);this.props.item.setSelectedVariant(r)}},Ip=class extends se{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}renderElement(t){if(!(t.hide||!this.matchWhenCondition(t.when))){if(t.t===4){let e=t;return z(Y_,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===6)return this.props.triggerContext.triggerData.isBundle()?z(z_,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(t.t===13){let e=t,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;e.lg=e.sm={src:n,name:r.name,secondarySrc:i};let s=z(ic,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:z("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(t.t===14)return this.renderProductTitle(t);if(t.t===15){let e=t;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:e.showChips?z("cooee-product-options-picker",{item:this.props.item,element:e}):z(X_,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===16?z(K_,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===19?z(J_,{element:t,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):t.t===18||t.t===3?z(Sp,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):z(oc,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}renderProductTitle(t){let e=z(ai,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:z("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:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},Cp=class extends se{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=qe.render(t,this.getProductData());if(this.productElement=new La(JSON.parse(e)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return z("div",{style:x({},this.getCompiledStyles()),class:"lc-single-product",children:z(Ip,{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 t=this.props.item,e=t.selectedOrFirstVariant.value,r=t.getTemplateVariables();r.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let n=this.props.triggerContext.triggerData.discount.type===ge.BXGY;return!e.hasEffectivePrice()&&n&&(r.product.effective_price=De(e.effectivePrice.value),r.product.price=""),r.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity,{product:r.product,variant:r.variant,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function Tp(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)=>`
|
|
64
64
|
<span class="${i}"
|
|
65
65
|
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
66
66
|
`,renderProgressbar:n=>`
|
|
67
67
|
<span class="${n}"
|
|
68
68
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
69
69
|
</span>
|
|
70
|
-
`},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 Tp(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),z("div",{class:"swiper-container",ref:e,children:[z("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&z("div",{class:"swiper-button-next",style:n,children:z("span",{})}),t.navigation.enabled&&z("div",{class:"swiper-button-prev",style:n,children:z("span",{})}),t.pagination.enabled&&z("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var X_=class extends se{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=this.renderer.isMobile()?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&&ye.loadSwiperScript().then(()=>{this.swiperInstance=Cp(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.triggerContext.triggerData.items;t.splice(this.configuration.maxItems??10);let e;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>t?.map(i=>z("div",{class:"swiper-slide",children:this.getProductFragment(i)}));e=z("div",{style:yt(x({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Tp(this.configuration,r,n)})}else e=z("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map((r,n)=>this.getProductFragment(r,n!==t.length-1))});return e}getComponentStyles(){let t=[0,2].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(e.flexDirection==="row"){if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${i}, auto)`}}return e}getProductFragment(t,e=!1){return z(cn,{children:[z(Ip,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&z("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:z(ai,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},Q_=class extends se{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){ye.loadSwiperScript().then(()=>{this.swiperInstance=Cp(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.element,e=n=>{this.swiperRef=n},r=()=>t.values?.map(n=>z("div",{class:"swiper-slide",onClick:i=>this.onClick(i,{clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return Tp(t.conf,e,r)}getComponentStyles(){return{}}renderElement(t){let e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case 1:return z(sc,{element:e,triggerContext:this.props.triggerContext});case 4:return z(oc,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:T.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){let r=JSON.stringify(t),n=Ve.render(r,{form:e});return tn.getParsedElement(JSON.parse(n))}getClickAction(t){let e=x({},this.props.element.clc),r=JSON.stringify(e),n=Ve.render(r,{form:t});return JSON.parse(n)}},ac=class extends se{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),Ke(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(t){if(!t.hide){if(t.t===4){let e=t;return z(oc,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===61)return z(W_,{element:t,triggerContext:this.props.triggerContext});if(t.t===3)return this.state.showButton?z(Ep,{element:t,triggerContext:this.props.triggerContext}):void 0;if(t.t===2)return z(ai,{element:t,triggerContext:this.props.triggerContext});if(t.t===1)return z(sc,{element:t,triggerContext:this.props.triggerContext});if(t.t===11)return z(X_,{element:t,triggerContext:this.props.triggerContext});if(t.t===12)return z(Ip,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(t.t===62)return z(Q_,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},Z_=class extends se{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){Ke(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return z(cn,{children:[z("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:t=>{this.onClick(t,{clickAction:this.clickAction})},children:z(ac,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&z("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t,e){if(this.isClickable)return super.onClick(t,e)}},or=class Fr{constructor(e){this.engagementTrigger=e,this.triggerContext=new ap(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=Ot.get();widgetAPIService=at.get(Kn);eventAPIService=at.get(nc);sentryService=at.get(Kt);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>{this.sentryService.captureError(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){T.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),Fr.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){T.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){F_.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}afterRootContainerCreated(){}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){T.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(T.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new He(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new He(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new He(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&Jn.hasKeys(e.props)&&(this.engagementTrigger.props=x(x({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new Rh(e.content)),this.triggerContext.triggerData.widget=this.widget=new Ph(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.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){Fr.renderedEngagements.push(this)}async getVariation(){T.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){T.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){T.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((s,o)=>{s.forEach(async c=>{if(c.isIntersecting){T.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=es(window,"scroll").pipe(si(Fr.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(Fr.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?H.EVENT_CAMPAIGN_HOLDOUT:H.EVENT_TRIGGER_DISPLAYED,i=new Bt(n,r,this.engagementTrigger);i.name===H.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.eventAPIService.sendSilently(i),Fr.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=xt.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 ic(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,n=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=n/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return T.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(H.SHADOW_SPLITTER)){let l=n.split(H.SHADOW_SPLITTER),p=ne.get().website.commonCSS;i=(await Hi(l[0].trim()))?.shadowRoot,n=l[1].trim(),i&&(ye.injectRawCSS(p,i),ye.injectStylesheet(qe.styleURL,i))}T.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await Hi(n,10,i??document);if(!s)return T.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),c=this.getParentElement(o);if(!e)return c;switch(r.position){case Nn.BEFORE:{s.parentElement?.insertBefore(c,s);break}case Nn.INSIDE_FIRST:{s.insertBefore(c,s.firstChild);break}case Nn.INSIDE_LAST:{s.appendChild(c);break}case Nn.AFTER:default:s.parentElement?.insertBefore(c,s.nextSibling)}return c}async startRendering(){Oe.log(`Campaign #${this.engagementTrigger.shortID} will be rendered`);let e;try{e=await yp.refreshItems(this.engagementTrigger)}catch(r){T.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){T.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("_","-"),s=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${s} ${i}`,n.dataset.engagementId=s,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 r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=ne.get().website.commonCSS;ye.injectRawCSS(n,r),ye.injectStylesheet(qe.styleURL,r),ye.injectSwiperCSS(r),e=r}lv(sh(Z_,{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 s of i)Ni.remove(r,s)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},$n=class xp extends or{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){xp.renderedEngagements.push(this)}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(!Ee.get().isOpen()&&this.runtimeData.pageName!=="cart"){T.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},tE=class Dp{constructor(e,r){this.engagementTrigger=e,this.element=r,this.cartItems=xt.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){T.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){T.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new Dp(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(d=>d.mID===e.id.toString());if(!n)return;let i=new ls(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let d of i.sellingPlans??[])d.mID===s.id.toString()&&(d.isSelected=!0,i.changeSellingPlan(d));let o=new He(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(c);let l=new Ar(this.engagementTrigger);l.placement.selector=`.${c}`,l.items=[o];let p=new $n(l);p.renderSilently(),this.watchForCartItemDeletion(p,c)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(T.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))})}},eE=class extends $n{ctaExecutor=new rc;constructor(t){super(t)}update(t){super.update(t),this.engagementTrigger.progressBarConfig.update(t.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(t=>{Kt.getInstance().captureError(t,"apply-milestones",{engagementTrigger:this.engagementTrigger})})}async checkMilestone(){let t=await xt.getCurrent().getNormalisedCart(),e=this.engagementTrigger.progressBarConfig,r,n=[],i=[],s=[],o,c,l=[...e.milestones];for(let d of l){if(d.rewardType!==bu.FREE_AUTO_GIFT)continue;let h=d.items[0],b=d.reached,v=t.items.find(w=>(w.vID===h.vID||w.mID===h.mID)&&w.properties[H.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);b&&(o=d,c=v),v&&n.push(v),!b&&v&&e.removeIneligibleItem?(T.debug(`Removing free gift ${v.vID} from cart`),s.push(v)):b&&!v&&(T.debug(`Adding free gift ${h.vID} to cart`),i.push(h))}e.restrictToLatestFreebie&&o&&(c?(n=n.filter(d=>d.vID!==c.vID),i=[]):i=[o.items[0]],s.push(...n)),s.length&&await this.removeFreeGifts(s),i.length&&(r=await this.ctaExecutor.addToCart(i,this.engagementTrigger));let p=e.coupons;if(p?.length)try{await jn.applyWithStorefront(p.map(d=>d.couponCode)),Ee.get().refreshUI(r,!1)}catch(d){this.sentryService.captureError(d,"cart-apply-discount",{extra:{coupons:p},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(t){await Promise.all(t.map(e=>this.ctaExecutor.updateLineItem(e,{quantity:0})))}},rE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-shoppable-videos")}},nE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}},iE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){let t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(H.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){let e=this.engagementTrigger,r=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,n=t.detail;if(!Jn.hasKeys(n)){T.error(`No detail received for ${r}`);return}T.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==e.shortID&&i!==e.engagementID){T.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(c=>new on({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new ic(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},so=class{runtimeData=Ot.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;let e=[...$n.renderedEngagements];$n.renderedEngagements.length=0;for(let r of t)T.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,e)&&(T.log(`${r} is new`),r.isProgressBar()?new eE(r).renderSilently():r.isSubscriptionUpsell()?tE.renderCartUpsell(r):new $n(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...or.renderedEngagements];or.renderedEngagements.length=0;for(let r of t)T.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,e)&&(T.log(`${r} is new`),r.isShoppableVideo()?new rE(r).renderSilently():r.isBYOB()?new iE(r).renderSilently():r.isStickyATC()?new nE(r).renderSilently():new or(r).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){let r=e.findIndex(n=>n.isSameTrigger(t));return r<0||t.isSubscriptionUpsell()?!1:(e[r].update(t),e[r].renderSilently(),e.splice(r,1),!0)}removeOldWidgets(t){for(let e of t)e.destroy()}},Ap=class{runtimeData=Ot.get();httpService=at.get(Rr);sessionManager=at.get(we);constructor(){}async getWidgetProps(){let t={};t.engagementIDs=this.addAvailableEngagementShortIDs(),t.locale=this.runtimeData.locale,await this.addSessionContext(t),t.currentItem=this.runtimeData.getCurrentItem();try{t.cart=await xt.getCurrent().getNormalisedCart()}catch(i){T.error("Error fetching Shopify cart before sending widget call",i)}let e=new URLSearchParams(location.search),r=e.get("cooee-preview");r?t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)):this.runtimeData.previewIDs?.length&&(t.previewIDs=this.runtimeData.previewIDs);let n=e.get("cooee-variant");return n?t.previewVariant=n:this.runtimeData.previewVariant&&(t.previewVariant=this.runtimeData.previewVariant),t}async addSessionContext(t){let e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=bs.parseFromCurrent()}addAvailableEngagementShortIDs(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}},Kn=class Np extends Ap{static INSTANCE;loadWidgetsSubject=new cr;constructor(){super(),this.loadWidgetsSubject.pipe(si(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>T.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>T.error("Unable to initiate page widgets",e))}),ec.get().subscriber(H.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Np),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>T.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>T.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();T.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ar(i));new so().processPageWidgetResponse(n)}).catch(r=>{T.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();T.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ar(i));new so().processCartWidgetResponse(n)}).catch(r=>{T.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",x(x({},e),r))}renderCachedCartWidgets(){new so().processCartWidgetResponse(this.runtimeData.cartEngagements)}},sE=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=at.get(cc)}execute(t){for(let e of t)e.experimentConfig&&(this.executeExperiment(e),this.trackExperimentRan(e));if(document.querySelector("#lc-hide-body")?.remove(),!document.body){at.get(Kt).captureMessage("No body element found","error");return}this.setupMutationObserver()}async executeExperiment(t){let e=t.experimentConfig?.modifications;if(!e?.length){T.log("Nothing to experiment",t.toString());return}for(let r of e){if(!r.cssSelector){T.debug("No CSS Selector available",t?.toString());continue}this.modifications.push(r);let n=Array.from(document.querySelectorAll(r.cssSelector));this.executeSingleModification(r,n)}}executeSingleModification(t,e){if(e?.length)for(let r of e)Object.assign(r.style,t.style),t.type==="TEXT"&&t.text&&(r.innerHTML=t.text)}trackExperimentRan(t){if(t.id==="preview"){T.warn("Skipping experiment attribution as its preview",t.toString());return}this.eventAPIService.trackExperiment({name:H.EVENT_EXPERIMENT_START,experiment:new Ha(t)}).catch(e=>{T.error("Fail to track experiment",e)})}setupMutationObserver(){new MutationObserver(t=>{t.forEach(e=>{e.addedNodes.forEach(r=>{r instanceof HTMLElement&&this.modifications.forEach(n=>{r.matches&&r.matches(n.cssSelector)?(T.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,[r])):r.querySelectorAll&&(T.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,Array.from(r.querySelectorAll(n.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}},cc=class Op extends Ap{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Op),this.INSTANCE}loadExperimentSilently(){Lt.get(ot.SDK_TOKEN).then(e=>{e?this.loadExperiments().catch(r=>T.error("Unable to initiate experiment",r)):we.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>T.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let e=await this.getWidgetProps();T.log("Load experiments",e),this.httpService.post("/v1/engagement/experiments",e).then(async r=>{let n=r.experiments.map(i=>new Ar(i));new sE().execute(n)}).catch(r=>{T.error("Error sending experiment getter",r)})}async trackExperiment(e){await this.addSessionContext(e),await this.httpService.post("/v1/event/experiment",e)}},oE=class{runtimeData=Ot.get();widgetAPIService=at.get(Kn);experimentAPIService=at.get(cc);meddle(){let t=bt.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let t=bt.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},t.previewWidget=bt.previewWidget.bind(bt),t.previewPopup=bt.previewPopup.bind(bt)}overwritePush(t,e){kn(t,"push",e)}meddleAccount(){this.overwritePush(bt.globalRef.account,(...t)=>{this.processAccount(t[0])}),bt.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(bt.globalRef.events,(...t)=>{this.processEvent(t[0])}),bt.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(bt.globalRef.profile,(...t)=>{this.processProfile(t[0])}),bt.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(bt.globalRef.screen,(...t)=>{this.processPageName(t[0])}),bt.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&bt.authenticate(t),t.flags&&Jo.setFlags(t.flags))}processEvent(t){t&&(H.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?bt.sendEvent(t[0],t[1],x({occurred:this.runtimeData.jsLoadTime},t[2])):bt.sendEvent(t[0],t[1],t[2]))}processProfile(t){t&&bt.updateProfile(t)}processPageName(t){t&&bt.setPageName(t)}meddlePage(){this.overwritePush(bt.globalRef.page,(...t)=>{this.processPage(t[0])}),bt.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.locale&&(this.runtimeData.locale=t.locale),t.pageName&&bt.setPageName(t.pageName),t.activeExperiment&&(this.runtimeData.activeExperiment=t.activeExperiment)}},oo=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=H.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}},ao=class Ui{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=at.get(Vt);lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ui),this.INSTANCE}resetScrollID(e){oo.remove(H.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}_a(()=>{this.observeWindowScroll()})}observeWindowScroll(){es(window,"scroll").pipe(si(Ui.DEBOUNCE_TIME),Qa(()=>{let e=this.getPercentScrolledY();if(e>100){T.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)>=Ui.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=oo.getString(H.SESSION_STORAGE_SCROLL_ID,""),i=new Bt(H.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),oo.setString(H.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)}},aE=class kp{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=at.get(Vt);runtimeData=Ot.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){T.info("Not sending background event as user was inactive on website");return}T.info(`Sending background event with ${e} seconds`);let r={};r[kp.ACTIVE_DURATION]=e,this.apiService.sendEvent(new Bt(H.EVENT_APP_BACKGROUND,r))}},cE=class{compareCartItemSubject=new cr;constructor(){this.compareCartItemSubject.pipe(si(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){t.performEvent(this._url).catch(r=>T.error("Unable to process cart change in XMLHttpRequest",r))}),e.apply(this,arguments)},T.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=function(r){return e.apply(window,arguments).then(n=>(t.performEvent(r.toString()).catch(i=>T.error("Unable to process cart change in fetch",i)),n))},T.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(Ot.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){let r=t?.items,n=e.items,i=[],s=[];if(T.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let c=r?.find(l=>l.vID===o.vID);if(c){if(c.quantity!==o.quantity){let l=c.quantity<o.quantity,p=Math.abs(c.quantity-o.quantity),d=yt(x({},o),{quantity:p});l?i.push(d):s.push(d)}r&&Zy(r,c)}else i.push(o)}),r)for(let o of r)s.push(o);T.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(H.EVENT_ADD_TO_CART,{items:i}),s.length&&t.token===e.token&&this.sendEvent(H.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&ec.get().broadcast(H.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(t,e){let r=new Bt(t,e);at.get(Vt).sendEvent(r)}async compareCartItems(){let t=await Lt.get(ot.CURRENT_CART,{}),e=await xt.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}},lE=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=async function(r,n){try{await t.modifyRequest(r,n)}catch(i){Kt.getInstance().captureError(i,"modify-graphql-request",{extra:{body:JSON.stringify(n?.body)}})}return e(r,n)},T.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;T.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(t){let e=t.variables.input.attributes??[],r=await Zu();return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}sendBuyNowEvent(){let t=Ot.get().getCurrentItem();if(!t)return;let e=new Bt(H.EVENT_BUY_NOW_CLICKED,{items:[t]});Vt.getInstance().sendEvent(e)}},Pp=class{constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=t=>{let e=t.currentTarget,r=new Bt(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});Vt.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(t=>T.error(t))}async listen(){this.elements=await Qu(this.selectorString),this.elements.forEach(t=>{t.addEventListener("click",this.clickListenerCallback)})}removeClickListener(t){this.elements?.forEach(e=>{e.removeEventListener("click",t)})}},uE=class Qo extends Pp{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(Qo.selectors,H.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Qo),this.INSTANCE}},hE=class Zo extends Pp{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(Zo.selectors,H.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Zo),this.INSTANCE}},pE=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(){_a(()=>{T.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let t=window.location.hash?.substring(1);if(t)if(t.includes(H.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(H.THIRD_PARTY_CHECKOUT_EVENT));let e=document.querySelector(this.selector);if(!e){T.debug("No clickable cart checkout button found");return}T.debug("Clickable cart checkout button found",e),e.click()}else t.includes(H.HASH_OPEN_CART_DRAWER)&&Ee.get().open()}},pu=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await xt.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new Bt(H.EVENT_CHECKOUT_STARTED,e);Vt.getInstance().sendEvent(r)})}},dE=class{async migrate(){}};Ve.escape=mu.escapeHtml;var bt=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new dE().migrate(),this.autoAuthenticate(),new oE().meddle(),at.get(cc).loadExperimentSilently(),new aE().listen(),new cE().listen(),new lE().listen(),new pE().listen(),at.get(ao).listen(),at.get(hE).listenSilently(),at.get(uE).listenSilently(),at.get(Kn).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Oe.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||kn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,kn(this.globalRef,"config",new ne),kn(this.globalRef,"runtimeData",new Ot),kn(this.globalRef,"uaParser",new ze),T.debug("Global reference initialised")}static injectWidgetAssets(){ye.injectScriptURL(qe.widgetURL,"cooee-widget-sdk"),ye.injectStylesheet(qe.styleURL)}static autoAuthenticate(){let t=Fv();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;let e=t.appID?.trim(),r=t.shopifyShop;if((cl(e)||e.length!==24)&&cl(r)){T.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,at.get(we).init(t)}static sendEvent(t,e,r){let n=new Bt(t,e,r?.triggerData);r?.occurred&&(n.occurred=r.occurred),at.get(Vt).sendEvent(n)}static updateProfile(t){for(let e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");at.get(Vt).updateProfile(t)}static setPageName(t){if(!t)return;let e=Ot.get(),r=e.pageName;if(t===r)return;if(e.pageName=t,t==="cart"&&at.get(Kn).loadOrRenderWidgetsAfterCartChange(),H.BLACKLISTED_PAGE_NAMES.some(s=>t.includes(s))){at.get(ao).resetScrollID();return}let n={};r&&(n.ps=r);let i=new Bt(H.EVENT_SCREEN_VIEW,n);i.occurred=e.jsLoadTime,at.get(Vt).sendEvent(i),at.get(ao).resetScrollID(i.occurred)}static previewPopup(t,e){new mp(e).render(t)}static previewWidget(t){new or(new Ar(t)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){T.error(t)}window.addEventListener("message",t=>{if(T.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}static attachGoKwikListeners(){let t=Ot.get();window.addEventListener("kp-modal:opened",()=>{t.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",e=>{let{token:r}=e.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?pu.attachCheckoutListener():window.addEventListener("gokwikLoaded",pu.attachCheckoutListener)}static storePreviewParams(){let t=Ot.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");r&&(t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=e.get("cooee-variant");n&&(t.previewVariant=n)}};Ld();Md();T.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(T.debug("Execution order:","IIFE start"),await bt.initForMerchantWebsiteOnly(),await bt.initForAll(),T.debug("Execution order:","IIFE end")))());T.debug("Execution order:","bottom");})();
|
|
70
|
+
`},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 xp(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),z("div",{class:"swiper-container",ref:e,children:[z("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&z("div",{class:"swiper-button-next",style:n,children:z("span",{})}),t.navigation.enabled&&z("div",{class:"swiper-button-prev",style:n,children:z("span",{})}),t.pagination.enabled&&z("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var Q_=class extends se{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=this.renderer.isMobile()?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&&ye.loadSwiperScript().then(()=>{this.swiperInstance=Tp(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.triggerContext.triggerData.items;t.splice(this.configuration.maxItems??10);let e;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>t?.map(i=>z("div",{class:"swiper-slide",children:this.getProductFragment(i)}));e=z("div",{style:yt(x({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:xp(this.configuration,r,n)})}else e=z("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map((r,n)=>this.getProductFragment(r,n!==t.length-1))});return e}getComponentStyles(){let t=[0,2].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(e.flexDirection==="row"){if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${i}, auto)`}}return e}getProductFragment(t,e=!1){return z(cn,{children:[z(Cp,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&z("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:z(ai,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},Z_=class extends se{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){ye.loadSwiperScript().then(()=>{this.swiperInstance=Tp(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.element,e=n=>{this.swiperRef=n},r=()=>t.values?.map(n=>z("div",{class:"swiper-slide",onClick:i=>this.onClick(i,{clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return xp(t.conf,e,r)}getComponentStyles(){return{}}renderElement(t){let e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case 1:return z(ic,{element:e,triggerContext:this.props.triggerContext});case 4:return z(sc,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:T.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){let r=JSON.stringify(t),n=qe.render(r,{form:e});return tn.getParsedElement(JSON.parse(n))}getClickAction(t){let e=x({},this.props.element.clc),r=JSON.stringify(e),n=qe.render(r,{form:t});return JSON.parse(n)}},oc=class extends se{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),Je(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(t){if(!t.hide){if(t.t===4){let e=t;return z(sc,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===61)return z(G_,{element:t,triggerContext:this.props.triggerContext});if(t.t===3)return this.state.showButton?z(Sp,{element:t,triggerContext:this.props.triggerContext}):void 0;if(t.t===2)return z(ai,{element:t,triggerContext:this.props.triggerContext});if(t.t===1)return z(ic,{element:t,triggerContext:this.props.triggerContext});if(t.t===11)return z(Q_,{element:t,triggerContext:this.props.triggerContext});if(t.t===12)return z(Cp,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(t.t===62)return z(Z_,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},tE=class extends se{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){Je(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return z(cn,{children:[z("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:t=>{this.onClick(t,{clickAction:this.clickAction})},children:z(oc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&z("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t,e){if(this.isClickable)return super.onClick(t,e)}},or=class Fr{constructor(e){this.engagementTrigger=e,this.triggerContext=new cp(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=Ot.get();widgetAPIService=at.get(Kn);eventAPIService=at.get(rc);sentryService=at.get(Kt);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>{this.sentryService.captureError(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){T.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),Fr.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){T.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){H_.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}afterRootContainerCreated(){}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){T.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(T.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Ve(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Ve(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Ve(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&Jn.hasKeys(e.props)&&(this.engagementTrigger.props=x(x({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new Lh(e.content)),this.triggerContext.triggerData.widget=this.widget=new Rh(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.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){Fr.renderedEngagements.push(this)}async getVariation(){T.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){T.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){T.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((s,o)=>{s.forEach(async c=>{if(c.isIntersecting){T.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=es(window,"scroll").pipe(si(Fr.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(Fr.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?H.EVENT_CAMPAIGN_HOLDOUT:H.EVENT_TRIGGER_DISPLAYED,i=new Bt(n,r,this.engagementTrigger);i.name===H.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.eventAPIService.sendSilently(i),Fr.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=xt.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 nc(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,n=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=n/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return T.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(H.SHADOW_SPLITTER)){let l=n.split(H.SHADOW_SPLITTER),p=ne.get().website.commonCSS;i=(await Hi(l[0].trim()))?.shadowRoot,n=l[1].trim(),i&&(ye.injectRawCSS(p,i),ye.injectStylesheet(We.styleURL,i))}T.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await Hi(n,10,i??document);if(!s)return T.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),c=this.getParentElement(o);if(!e)return c;switch(r.position){case Nn.BEFORE:{s.parentElement?.insertBefore(c,s);break}case Nn.INSIDE_FIRST:{s.insertBefore(c,s.firstChild);break}case Nn.INSIDE_LAST:{s.appendChild(c);break}case Nn.AFTER:default:s.parentElement?.insertBefore(c,s.nextSibling)}return c}async startRendering(){Oe.log(`Campaign #${this.engagementTrigger.shortID} will be rendered`);let e;try{e=await vp.refreshItems(this.engagementTrigger)}catch(r){T.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){T.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("_","-"),s=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${s} lc-${i}`,n.dataset.engagementId=s,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 r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=ne.get().website.commonCSS;ye.injectRawCSS(n,r),ye.injectStylesheet(We.styleURL,r),ye.injectSwiperCSS(r),e=r}uv(sh(tE,{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 s of i)Ni.remove(r,s)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},$n=class Dp extends or{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){Dp.renderedEngagements.push(this)}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(!Ee.get().isOpen()&&this.runtimeData.pageName!=="cart"){T.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},eE=class Ap{constructor(e,r){this.engagementTrigger=e,this.element=r,this.cartItems=xt.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){T.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){T.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new Ap(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(d=>d.mID===e.id.toString());if(!n)return;let i=new us(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let d of i.sellingPlans??[])d.mID===s.id.toString()&&(d.isSelected=!0,i.changeSellingPlan(d));let o=new Ve(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(c);let l=new Ar(this.engagementTrigger);l.placement.selector=`.${c}`,l.items=[o];let p=new $n(l);p.renderSilently(),this.watchForCartItemDeletion(p,c)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(T.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))})}},rE=class extends $n{ctaExecutor=new ec;constructor(t){super(t)}update(t){super.update(t),this.engagementTrigger.progressBarConfig.update(t.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(t=>{Kt.getInstance().captureError(t,"apply-milestones",{engagementTrigger:this.engagementTrigger})})}async checkMilestone(){let t=await xt.getCurrent().getNormalisedCart(),e=this.engagementTrigger.progressBarConfig,r,n=[],i=[],s=[],o,c,l=[...e.milestones];for(let d of l){if(d.rewardType!==wu.FREE_AUTO_GIFT)continue;let h=d.items[0],b=d.reached,v=t.items.find(w=>(w.vID===h.vID||w.mID===h.mID)&&w.properties[H.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);b&&(o=d,c=v),v&&n.push(v),!b&&v&&e.removeIneligibleItem?(T.debug(`Removing free gift ${v.vID} from cart`),s.push(v)):b&&!v&&(T.debug(`Adding free gift ${h.vID} to cart`),i.push(h))}e.restrictToLatestFreebie&&o&&(c?(n=n.filter(d=>d.vID!==c.vID),i=[]):i=[o.items[0]],s.push(...n)),s.length&&await this.removeFreeGifts(s),i.length&&(r=await this.ctaExecutor.addToCart(i,this.engagementTrigger));let p=e.coupons;if(p?.length)try{await jn.applyWithStorefront(p.map(d=>d.couponCode)),Ee.get().refreshUI(r,!1)}catch(d){this.sentryService.captureError(d,"cart-apply-discount",{extra:{coupons:p},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(t){await Promise.all(t.map(e=>this.ctaExecutor.updateLineItem(e,{quantity:0})))}},nE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-shoppable-videos")}},iE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}},sE=class extends or{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){let t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(H.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){let e=this.engagementTrigger,r=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,n=t.detail;if(!Jn.hasKeys(n)){T.error(`No detail received for ${r}`);return}T.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==e.shortID&&i!==e.engagementID){T.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(c=>new on({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new nc(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},oo=class{runtimeData=Ot.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;let e=[...$n.renderedEngagements];$n.renderedEngagements.length=0;for(let r of t)T.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,e)&&(T.log(`${r} is new`),r.isProgressBar()?new rE(r).renderSilently():r.isSubscriptionUpsell()?eE.renderCartUpsell(r):new $n(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...or.renderedEngagements];or.renderedEngagements.length=0;for(let r of t)T.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,e)&&(T.log(`${r} is new`),r.isShoppableVideo()?new nE(r).renderSilently():r.isBYOB()?new sE(r).renderSilently():r.isStickyATC()?new iE(r).renderSilently():new or(r).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){let r=e.findIndex(n=>n.isSameTrigger(t));return r<0||t.isSubscriptionUpsell()?!1:(e[r].update(t),e[r].renderSilently(),e.splice(r,1),!0)}removeOldWidgets(t){for(let e of t)e.destroy()}},Np=class{runtimeData=Ot.get();httpService=at.get(Rr);sessionManager=at.get(we);constructor(){}async getWidgetProps(){let t={};t.engagementIDs=this.addAvailableEngagementShortIDs(),t.locale=this.runtimeData.locale,await this.addSessionContext(t),t.currentItem=this.runtimeData.getCurrentItem();try{t.cart=await xt.getCurrent().getNormalisedCart()}catch(i){T.error("Error fetching Shopify cart before sending widget call",i)}let e=new URLSearchParams(location.search),r=e.get("cooee-preview");r?t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)):this.runtimeData.previewIDs?.length&&(t.previewIDs=this.runtimeData.previewIDs);let n=e.get("cooee-variant");return n?t.previewVariant=n:this.runtimeData.previewVariant&&(t.previewVariant=this.runtimeData.previewVariant),t}async addSessionContext(t){let e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=_s.parseFromCurrent()}addAvailableEngagementShortIDs(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}},Kn=class Op extends Np{static INSTANCE;loadWidgetsSubject=new cr;constructor(){super(),this.loadWidgetsSubject.pipe(si(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>T.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>T.error("Unable to initiate page widgets",e))}),tc.get().subscriber(H.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Op),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>T.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>T.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();T.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ar(i));new oo().processPageWidgetResponse(n)}).catch(r=>{T.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();T.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Ar(i));new oo().processCartWidgetResponse(n)}).catch(r=>{T.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",x(x({},e),r))}renderCachedCartWidgets(){new oo().processCartWidgetResponse(this.runtimeData.cartEngagements)}},oE=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=at.get(ac)}execute(t){for(let e of t)e.experimentConfig&&(this.executeExperiment(e),this.trackExperimentRan(e));if(document.querySelector("#lc-hide-body")?.remove(),!document.body){at.get(Kt).captureMessage("No body element found","error");return}this.setupMutationObserver()}async executeExperiment(t){let e=t.experimentConfig?.modifications;if(!e?.length){T.log("Nothing to experiment",t.toString());return}for(let r of e){if(!r.cssSelector){T.debug("No CSS Selector available",t?.toString());continue}this.modifications.push(r);let n=Array.from(document.querySelectorAll(r.cssSelector));this.executeSingleModification(r,n)}}executeSingleModification(t,e){if(e?.length)for(let r of e)Object.assign(r.style,t.style),t.type==="TEXT"&&t.text&&(r.innerHTML=t.text)}trackExperimentRan(t){if(t.id==="preview"){T.warn("Skipping experiment attribution as its preview",t.toString());return}this.eventAPIService.trackExperiment({name:H.EVENT_EXPERIMENT_START,experiment:new Fa(t)}).catch(e=>{T.error("Fail to track experiment",e)})}setupMutationObserver(){new MutationObserver(t=>{t.forEach(e=>{e.addedNodes.forEach(r=>{r instanceof HTMLElement&&this.modifications.forEach(n=>{r.matches&&r.matches(n.cssSelector)?(T.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,[r])):r.querySelectorAll&&(T.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,Array.from(r.querySelectorAll(n.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}},ac=class kp extends Np{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new kp),this.INSTANCE}loadExperimentSilently(){Lt.get(ot.SDK_TOKEN).then(e=>{e?this.loadExperiments().catch(r=>T.error("Unable to initiate experiment",r)):we.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>T.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let e=await this.getWidgetProps();T.log("Load experiments",e),this.httpService.post("/v1/engagement/experiments",e).then(async r=>{let n=r.experiments.map(i=>new Ar(i));new oE().execute(n)}).catch(r=>{T.error("Error sending experiment getter",r)})}async trackExperiment(e){await this.addSessionContext(e),await this.httpService.post("/v1/event/experiment",e)}},aE=class{runtimeData=Ot.get();widgetAPIService=at.get(Kn);experimentAPIService=at.get(ac);meddle(){let t=bt.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let t=bt.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},t.previewWidget=bt.previewWidget.bind(bt),t.previewPopup=bt.previewPopup.bind(bt)}overwritePush(t,e){kn(t,"push",e)}meddleAccount(){this.overwritePush(bt.globalRef.account,(...t)=>{this.processAccount(t[0])}),bt.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(bt.globalRef.events,(...t)=>{this.processEvent(t[0])}),bt.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(bt.globalRef.profile,(...t)=>{this.processProfile(t[0])}),bt.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(bt.globalRef.screen,(...t)=>{this.processPageName(t[0])}),bt.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&bt.authenticate(t),t.flags&&Jo.setFlags(t.flags))}processEvent(t){t&&(H.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?bt.sendEvent(t[0],t[1],x({occurred:this.runtimeData.jsLoadTime},t[2])):bt.sendEvent(t[0],t[1],t[2]))}processProfile(t){t&&bt.updateProfile(t)}processPageName(t){t&&bt.setPageName(t)}meddlePage(){this.overwritePush(bt.globalRef.page,(...t)=>{this.processPage(t[0])}),bt.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.locale&&(this.runtimeData.locale=t.locale),t.pageName&&bt.setPageName(t.pageName),t.activeExperiment&&(this.runtimeData.activeExperiment=t.activeExperiment)}},ao=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=H.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}},co=class Ui{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=at.get(Vt);lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ui),this.INSTANCE}resetScrollID(e){ao.remove(H.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}_a(()=>{this.observeWindowScroll()})}observeWindowScroll(){es(window,"scroll").pipe(si(Ui.DEBOUNCE_TIME),Xa(()=>{let e=this.getPercentScrolledY();if(e>100){T.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)>=Ui.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=ao.getString(H.SESSION_STORAGE_SCROLL_ID,""),i=new Bt(H.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),ao.setString(H.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)}},cE=class Pp{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=at.get(Vt);runtimeData=Ot.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){T.info("Not sending background event as user was inactive on website");return}T.info(`Sending background event with ${e} seconds`);let r={};r[Pp.ACTIVE_DURATION]=e,this.apiService.sendEvent(new Bt(H.EVENT_APP_BACKGROUND,r))}},lE=class{compareCartItemSubject=new cr;constructor(){this.compareCartItemSubject.pipe(si(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){t.performEvent(this._url).catch(r=>T.error("Unable to process cart change in XMLHttpRequest",r))}),e.apply(this,arguments)},T.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=function(r){return e.apply(window,arguments).then(n=>(t.performEvent(r.toString()).catch(i=>T.error("Unable to process cart change in fetch",i)),n))},T.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(Ot.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){let r=t?.items,n=e.items,i=[],s=[];if(T.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let c=r?.find(l=>l.vID===o.vID);if(c){if(c.quantity!==o.quantity){let l=c.quantity<o.quantity,p=Math.abs(c.quantity-o.quantity),d=yt(x({},o),{quantity:p});l?i.push(d):s.push(d)}r&&tv(r,c)}else i.push(o)}),r)for(let o of r)s.push(o);T.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(H.EVENT_ADD_TO_CART,{items:i}),s.length&&t.token===e.token&&this.sendEvent(H.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&tc.get().broadcast(H.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(t,e){let r=new Bt(t,e);at.get(Vt).sendEvent(r)}async compareCartItems(){let t=await Lt.get(ot.CURRENT_CART,{}),e=await xt.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}},uE=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=async function(r,n){try{await t.modifyRequest(r,n)}catch(i){Kt.getInstance().captureError(i,"modify-graphql-request",{extra:{body:JSON.stringify(n?.body)}})}return e(r,n)},T.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;T.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(t){let e=t.variables.input.attributes??[],r=await Qu();return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}sendBuyNowEvent(){let t=Ot.get().getCurrentItem();if(!t)return;let e=new Bt(H.EVENT_BUY_NOW_CLICKED,{items:[t]});Vt.getInstance().sendEvent(e)}},Rp=class{constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=t=>{let e=t.currentTarget,r=new Bt(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});Vt.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(t=>T.error(t))}async listen(){this.elements=await Xu(this.selectorString),this.elements.forEach(t=>{t.addEventListener("click",this.clickListenerCallback)})}removeClickListener(t){this.elements?.forEach(e=>{e.removeEventListener("click",t)})}},hE=class Qo extends Rp{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(Qo.selectors,H.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Qo),this.INSTANCE}},pE=class Zo extends Rp{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(Zo.selectors,H.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Zo),this.INSTANCE}},dE=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(){_a(()=>{T.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let t=window.location.hash?.substring(1);if(t)if(t.includes(H.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(H.THIRD_PARTY_CHECKOUT_EVENT));let e=document.querySelector(this.selector);if(!e){T.debug("No clickable cart checkout button found");return}T.debug("Clickable cart checkout button found",e),e.click()}else t.includes(H.HASH_OPEN_CART_DRAWER)&&Ee.get().open()}},hu=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await xt.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new Bt(H.EVENT_CHECKOUT_STARTED,e);Vt.getInstance().sendEvent(r)})}},fE=class{async migrate(){}};qe.escape=gu.escapeHtml;var bt=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new fE().migrate(),this.autoAuthenticate(),new aE().meddle(),at.get(ac).loadExperimentSilently(),new cE().listen(),new lE().listen(),new uE().listen(),new dE().listen(),at.get(co).listen(),at.get(pE).listenSilently(),at.get(hE).listenSilently(),at.get(Kn).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Oe.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||kn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,kn(this.globalRef,"config",new ne),kn(this.globalRef,"runtimeData",new Ot),kn(this.globalRef,"uaParser",new Ye),T.debug("Global reference initialised")}static injectWidgetAssets(){ye.injectScriptURL(We.widgetURL,"cooee-widget-sdk"),ye.injectStylesheet(We.styleURL)}static autoAuthenticate(){let t=Hv();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;let e=t.appID?.trim(),r=t.shopifyShop;if((al(e)||e.length!==24)&&al(r)){T.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,at.get(we).init(t)}static sendEvent(t,e,r){let n=new Bt(t,e,r?.triggerData);r?.occurred&&(n.occurred=r.occurred),at.get(Vt).sendEvent(n)}static updateProfile(t){for(let e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");at.get(Vt).updateProfile(t)}static setPageName(t){if(!t)return;let e=Ot.get(),r=e.pageName;if(t===r)return;if(e.pageName=t,t==="cart"&&at.get(Kn).loadOrRenderWidgetsAfterCartChange(),H.BLACKLISTED_PAGE_NAMES.some(s=>t.includes(s))){at.get(co).resetScrollID();return}let n={};r&&(n.ps=r);let i=new Bt(H.EVENT_SCREEN_VIEW,n);i.occurred=e.jsLoadTime,at.get(Vt).sendEvent(i),at.get(co).resetScrollID(i.occurred)}static previewPopup(t,e){new yp(e).render(t)}static previewWidget(t){new or(new Ar(t)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){T.error(t)}window.addEventListener("message",t=>{if(T.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}static attachGoKwikListeners(){let t=Ot.get();window.addEventListener("kp-modal:opened",()=>{t.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",e=>{let{token:r}=e.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?hu.attachCheckoutListener():window.addEventListener("gokwikLoaded",hu.attachCheckoutListener)}static storePreviewParams(){let t=Ot.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");r&&(t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=e.get("cooee-variant");n&&(t.previewVariant=n)}};Md();Ud();T.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(T.debug("Execution order:","IIFE start"),await bt.initForMerchantWebsiteOnly(),await bt.initForAll(),T.debug("Execution order:","IIFE end")))());T.debug("Execution order:","bottom");})();
|