@letscooee/web-sdk 11.0.0-rc.1 → 11.0.0-rc.11

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 CHANGED
@@ -1,13 +1,13 @@
1
- var dv=Object.create;var Gl=Object.defineProperty,hv=Object.defineProperties,gv=Object.getOwnPropertyDescriptor,yv=Object.getOwnPropertyDescriptors,vv=Object.getOwnPropertyNames,Xs=Object.getOwnPropertySymbols,Ev=Object.getPrototypeOf,Yl=Object.prototype.hasOwnProperty,Zf=Object.prototype.propertyIsEnumerable;var jl=(t,e,r)=>e in t?Gl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_=(t,e)=>{for(var r in e||={})Yl.call(e,r)&&jl(t,r,e[r]);if(Xs)for(var r of Xs(e))Zf.call(e,r)&&jl(t,r,e[r]);return t},re=(t,e)=>hv(t,yv(e));var Do=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var em=(t,e)=>{var r={};for(var n in t)Yl.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Xs)for(var n of Xs(t))e.indexOf(n)<0&&Zf.call(t,n)&&(r[n]=t[n]);return r};var No=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var _v=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vv(e))!Yl.call(t,i)&&i!==r&&Gl(t,i,{get:()=>e[i],enumerable:!(n=gv(e,i))||n.enumerable});return t};var xr=(t,e,r)=>(r=t!=null?dv(Ev(t)):{},_v(e||!t||!t.__esModule?Gl(r,"default",{value:t,enumerable:!0}):r,t));var ee=(t,e,r)=>jl(t,typeof e!="symbol"?e+"":e,r);var wi=No((rm,Js)=>{"use strict";(function(t){"use strict";var e={};e.VERSION="1.6.1";var r,n={},i=function(p,d){return function(){return d.apply(p,arguments)}},o=function(){var p=arguments,d=p[0],f,E;for(E=1;E<p.length;E++)for(f in p[E])!(f in d)&&p[E].hasOwnProperty(f)&&(d[f]=p[E][f]);return d},s=function(p,d){return{value:p,name:d}};e.TRACE=s(1,"TRACE"),e.DEBUG=s(2,"DEBUG"),e.INFO=s(3,"INFO"),e.TIME=s(4,"TIME"),e.WARN=s(5,"WARN"),e.ERROR=s(8,"ERROR"),e.OFF=s(99,"OFF");var a=function(p){this.context=p,this.setLevel(p.filterLevel),this.log=this.info};a.prototype={setLevel:function(p){p&&"value"in p&&(this.context.filterLevel=p)},getLevel:function(){return this.context.filterLevel},enabledFor:function(p){var d=this.context.filterLevel;return p.value>=d.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"start"])},timeEnd:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"end"])},invoke:function(p,d){r&&this.enabledFor(p)&&r(d,o({level:p},this.context))}};var c=new a({filterLevel:e.OFF});(function(){var p=e;p.enabledFor=i(c,c.enabledFor),p.trace=i(c,c.trace),p.debug=i(c,c.debug),p.time=i(c,c.time),p.timeEnd=i(c,c.timeEnd),p.info=i(c,c.info),p.warn=i(c,c.warn),p.error=i(c,c.error),p.log=p.info})(),e.setHandler=function(p){r=p},e.setLevel=function(p){c.setLevel(p);for(var d in n)n.hasOwnProperty(d)&&n[d].setLevel(p)},e.getLevel=function(){return c.getLevel()},e.get=function(p){return n[p]||(n[p]=new a(o({name:p},c.context)))},e.createDefaultHandler=function(p){p=p||{},p.formatter=p.formatter||function(y,I){I.name&&y.unshift("["+I.name+"]")};var d={},f=function(E,y){Function.prototype.apply.call(E,console,y)};return typeof console>"u"?function(){}:function(E,y){E=Array.prototype.slice.call(E);var I=console.log,D;y.level===e.TIME?(D=(y.name?"["+y.name+"] ":"")+E[0],E[1]==="start"?console.time?console.time(D):d[D]=new Date().getTime():console.timeEnd?console.timeEnd(D):f(I,[D+": "+(new Date().getTime()-d[D])+"ms"])):(y.level===e.WARN&&console.warn?I=console.warn:y.level===e.ERROR&&console.error?I=console.error:y.level===e.INFO&&console.info?I=console.info:y.level===e.DEBUG&&console.debug?I=console.debug:y.level===e.TRACE&&console.trace&&(I=console.trace),p.formatter(E,y),f(I,E))}},e.useDefaults=function(p){e.setLevel(p&&p.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(p))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof Js<"u"&&Js.exports?Js.exports=e:(e._prevLogger=t.Logger,e.noConflict=function(){return t.Logger=e._prevLogger,e},t.Logger=e)})(rm)});var ql=No(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.URLBuilder=void 0;var wv=function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t}();Qs.URLBuilder=wv});var um=No((lm,nu)=>{"use strict";(function(t){if(typeof lm=="object"&&typeof nu<"u")nu.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return function n(i,o,s){function a(d,f){if(!o[d]){if(!i[d]){var E=typeof Do=="function"&&Do;if(!f&&E)return E(d,!0);if(c)return c(d,!0);var y=new Error("Cannot find module '"+d+"'");throw y.code="MODULE_NOT_FOUND",y}var I=o[d]={exports:{}};i[d][0].call(I.exports,function(D){var k=i[d][1][D];return a(k||D)},I,I.exports,n,i,o,s)}return o[d].exports}for(var c=typeof Do=="function"&&Do,p=0;p<s.length;p++)a(s[p]);return a}({1:[function(n,i,o){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,c;if(a){var p=0,d=new a(D),f=s.document.createTextNode("");d.observe(f,{characterData:!0}),c=function(){f.data=p=++p%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=D,c=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?c=function(){var O=s.document.createElement("script");O.onreadystatechange=function(){D(),O.onreadystatechange=null,O.parentNode.removeChild(O),O=null},s.document.documentElement.appendChild(O)}:c=function(){setTimeout(D,0)};var y,I=[];function D(){y=!0;for(var O,$,B=I.length;B;){for($=I,I=[],O=-1;++O<B;)$[O]();B=I.length}y=!1}i.exports=k;function k(O){I.push(O)===1&&!y&&c()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function a(){}var c={},p=["REJECTED"],d=["FULFILLED"],f=["PENDING"];i.exports=E;function E(Q){if(typeof Q!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,Q!==a&&k(this,Q)}E.prototype.catch=function(Q){return this.then(null,Q)},E.prototype.then=function(Q,ue){if(typeof Q!="function"&&this.state===d||typeof ue!="function"&&this.state===p)return this;var le=new this.constructor(a);if(this.state!==f){var ge=this.state===d?Q:ue;I(le,ge,this.outcome)}else this.queue.push(new y(le,Q,ue));return le};function y(Q,ue,le){this.promise=Q,typeof ue=="function"&&(this.onFulfilled=ue,this.callFulfilled=this.otherCallFulfilled),typeof le=="function"&&(this.onRejected=le,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(Q){c.resolve(this.promise,Q)},y.prototype.otherCallFulfilled=function(Q){I(this.promise,this.onFulfilled,Q)},y.prototype.callRejected=function(Q){c.reject(this.promise,Q)},y.prototype.otherCallRejected=function(Q){I(this.promise,this.onRejected,Q)};function I(Q,ue,le){s(function(){var ge;try{ge=ue(le)}catch(ke){return c.reject(Q,ke)}ge===Q?c.reject(Q,new TypeError("Cannot resolve promise with itself")):c.resolve(Q,ge)})}c.resolve=function(Q,ue){var le=O(D,ue);if(le.status==="error")return c.reject(Q,le.value);var ge=le.value;if(ge)k(Q,ge);else{Q.state=d,Q.outcome=ue;for(var ke=-1,Re=Q.queue.length;++ke<Re;)Q.queue[ke].callFulfilled(ue)}return Q},c.reject=function(Q,ue){Q.state=p,Q.outcome=ue;for(var le=-1,ge=Q.queue.length;++le<ge;)Q.queue[le].callRejected(ue);return Q};function D(Q){var ue=Q&&Q.then;if(Q&&(typeof Q=="object"||typeof Q=="function")&&typeof ue=="function")return function(){ue.apply(Q,arguments)}}function k(Q,ue){var le=!1;function ge(Xe){le||(le=!0,c.reject(Q,Xe))}function ke(Xe){le||(le=!0,c.resolve(Q,Xe))}function Re(){ue(ke,ge)}var Ne=O(Re);Ne.status==="error"&&ge(Ne.value)}function O(Q,ue){var le={};try{le.value=Q(ue),le.status="success"}catch(ge){le.status="error",le.value=ge}return le}E.resolve=$;function $(Q){return Q instanceof this?Q:c.resolve(new this(a),Q)}E.reject=B;function B(Q){var ue=new this(a);return c.reject(ue,Q)}E.all=q;function q(Q){var ue=this;if(Object.prototype.toString.call(Q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var le=Q.length,ge=!1;if(!le)return this.resolve([]);for(var ke=new Array(le),Re=0,Ne=-1,Xe=new this(a);++Ne<le;)tt(Q[Ne],Ne);return Xe;function tt(kt,A){ue.resolve(kt).then(R,function(j){ge||(ge=!0,c.reject(Xe,j))});function R(j){ke[A]=j,++Re===le&&!ge&&(ge=!0,c.resolve(Xe,ke))}}}E.race=Se;function Se(Q){var ue=this;if(Object.prototype.toString.call(Q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var le=Q.length,ge=!1;if(!le)return this.resolve([]);for(var ke=-1,Re=new this(a);++ke<le;)Ne(Q[ke]);return Re;function Ne(Xe){ue.resolve(Xe).then(function(tt){ge||(ge=!0,c.resolve(Re,tt))},function(tt){ge||(ge=!0,c.reject(Re,tt))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m};function a(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function c(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var p=c();function d(){try{if(!p||!p.open)return!1;var m=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),b=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!m||b)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function f(m,b){m=m||[],b=b||{};try{return new Blob(m,b)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new g,x=0;x<m.length;x+=1)T.append(m[x]);return T.getBlob(b.type)}}typeof Promise>"u"&&n(3);var E=Promise;function y(m,b){b&&m.then(function(g){b(null,g)},function(g){b(g)})}function I(m,b,g){typeof b=="function"&&m.then(b),typeof g=="function"&&m.catch(g)}function D(m){return typeof m!="string"&&(console.warn(m+" used as a key, but it is not a string."),m=String(m)),m}function k(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var O="local-forage-detect-blob-support",$=void 0,B={},q=Object.prototype.toString,Se="readonly",Q="readwrite";function ue(m){for(var b=m.length,g=new ArrayBuffer(b),T=new Uint8Array(g),x=0;x<b;x++)T[x]=m.charCodeAt(x);return g}function le(m){return new E(function(b){var g=m.transaction(O,Q),T=f([""]);g.objectStore(O).put(T,"key"),g.onabort=function(x){x.preventDefault(),x.stopPropagation(),b(!1)},g.oncomplete=function(){var x=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);b(S||!x||parseInt(x[1],10)>=43)}}).catch(function(){return!1})}function ge(m){return typeof $=="boolean"?E.resolve($):le(m).then(function(b){return $=b,$})}function ke(m){var b=B[m.name],g={};g.promise=new E(function(T,x){g.resolve=T,g.reject=x}),b.deferredOperations.push(g),b.dbReady?b.dbReady=b.dbReady.then(function(){return g.promise}):b.dbReady=g.promise}function Re(m){var b=B[m.name],g=b.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Ne(m,b){var g=B[m.name],T=g.deferredOperations.pop();if(T)return T.reject(b),T.promise}function Xe(m,b){return new E(function(g,T){if(B[m.name]=B[m.name]||Je(),m.db)if(b)ke(m),m.db.close();else return g(m.db);var x=[m.name];b&&x.push(m.version);var S=p.open.apply(p,x);b&&(S.onupgradeneeded=function(M){var z=S.result;try{z.createObjectStore(m.storeName),M.oldVersion<=1&&z.createObjectStore(O)}catch(K){if(K.name==="ConstraintError")console.warn('The database "'+m.name+'" has been upgraded from version '+M.oldVersion+" to version "+M.newVersion+', but the storage "'+m.storeName+'" already exists.');else throw K}}),S.onerror=function(M){M.preventDefault(),T(S.error)},S.onsuccess=function(){var M=S.result;M.onversionchange=function(z){z.target.close()},g(M),Re(m)}})}function tt(m){return Xe(m,!1)}function kt(m){return Xe(m,!0)}function A(m,b){if(!m.db)return!0;var g=!m.db.objectStoreNames.contains(m.storeName),T=m.version<m.db.version,x=m.version>m.db.version;if(T&&(m.version!==b&&console.warn('The database "'+m.name+`" can't be downgraded from version `+m.db.version+" to version "+m.version+"."),m.version=m.db.version),x||g){if(g){var S=m.db.version+1;S>m.version&&(m.version=S)}return!0}return!1}function R(m){return new E(function(b,g){var T=new FileReader;T.onerror=g,T.onloadend=function(x){var S=btoa(x.target.result||"");b({__local_forage_encoded_blob:!0,data:S,type:m.type})},T.readAsBinaryString(m)})}function j(m){var b=ue(atob(m.data));return f([b],{type:m.type})}function F(m){return m&&m.__local_forage_encoded_blob}function V(m){var b=this,g=b._initReady().then(function(){var T=B[b._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return I(g,m,m),g}function se(m){ke(m);for(var b=B[m.name],g=b.forages,T=0;T<g.length;T++){var x=g[T];x._dbInfo.db&&(x._dbInfo.db.close(),x._dbInfo.db=null)}return m.db=null,tt(m).then(function(S){return m.db=S,A(m)?kt(m):S}).then(function(S){m.db=b.db=S;for(var M=0;M<g.length;M++)g[M]._dbInfo.db=S}).catch(function(S){throw Ne(m,S),S})}function ye(m,b,g,T){T===void 0&&(T=1);try{var x=m.db.transaction(m.storeName,b);g(null,x)}catch(S){if(T>0&&(!m.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return E.resolve().then(function(){if(!m.db||S.name==="NotFoundError"&&!m.db.objectStoreNames.contains(m.storeName)&&m.version<=m.db.version)return m.db&&(m.version=m.db.version+1),kt(m)}).then(function(){return se(m).then(function(){ye(m,b,g,T-1)})}).catch(g);g(S)}}function Je(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function it(m){var b=this,g={db:null};if(m)for(var T in m)g[T]=m[T];var x=B[g.name];x||(x=Je(),B[g.name]=x),x.forages.push(b),b._initReady||(b._initReady=b.ready,b.ready=V);var S=[];function M(){return E.resolve()}for(var z=0;z<x.forages.length;z++){var K=x.forages[z];K!==b&&S.push(K._initReady().catch(M))}var X=x.forages.slice(0);return E.all(S).then(function(){return g.db=x.db,tt(g)}).then(function(Z){return g.db=Z,A(g,b._defaultConfig.version)?kt(g):Z}).then(function(Z){g.db=x.db=Z,b._dbInfo=g;for(var ie=0;ie<X.length;ie++){var be=X[ie];be!==b&&(be._dbInfo.db=g.db,be._dbInfo.version=g.version)}})}function ot(m,b){var g=this;m=D(m);var T=new E(function(x,S){g.ready().then(function(){ye(g._dbInfo,Se,function(M,z){if(M)return S(M);try{var K=z.objectStore(g._dbInfo.storeName),X=K.get(m);X.onsuccess=function(){var Z=X.result;Z===void 0&&(Z=null),F(Z)&&(Z=j(Z)),x(Z)},X.onerror=function(){S(X.error)}}catch(Z){S(Z)}})}).catch(S)});return y(T,b),T}function St(m,b){var g=this,T=new E(function(x,S){g.ready().then(function(){ye(g._dbInfo,Se,function(M,z){if(M)return S(M);try{var K=z.objectStore(g._dbInfo.storeName),X=K.openCursor(),Z=1;X.onsuccess=function(){var ie=X.result;if(ie){var be=ie.value;F(be)&&(be=j(be));var Le=m(be,ie.key,Z++);Le!==void 0?x(Le):ie.continue()}else x()},X.onerror=function(){S(X.error)}}catch(ie){S(ie)}})}).catch(S)});return y(T,b),T}function It(m,b,g){var T=this;m=D(m);var x=new E(function(S,M){var z;T.ready().then(function(){return z=T._dbInfo,q.call(b)==="[object Blob]"?ge(z.db).then(function(K){return K?b:R(b)}):b}).then(function(K){ye(T._dbInfo,Q,function(X,Z){if(X)return M(X);try{var ie=Z.objectStore(T._dbInfo.storeName);K===null&&(K=void 0);var be=ie.put(K,m);Z.oncomplete=function(){K===void 0&&(K=null),S(K)},Z.onabort=Z.onerror=function(){var Le=be.error?be.error:be.transaction.error;M(Le)}}catch(Le){M(Le)}})}).catch(M)});return y(x,g),x}function ut(m,b){var g=this;m=D(m);var T=new E(function(x,S){g.ready().then(function(){ye(g._dbInfo,Q,function(M,z){if(M)return S(M);try{var K=z.objectStore(g._dbInfo.storeName),X=K.delete(m);z.oncomplete=function(){x()},z.onerror=function(){S(X.error)},z.onabort=function(){var Z=X.error?X.error:X.transaction.error;S(Z)}}catch(Z){S(Z)}})}).catch(S)});return y(T,b),T}function xe(m){var b=this,g=new E(function(T,x){b.ready().then(function(){ye(b._dbInfo,Q,function(S,M){if(S)return x(S);try{var z=M.objectStore(b._dbInfo.storeName),K=z.clear();M.oncomplete=function(){T()},M.onabort=M.onerror=function(){var X=K.error?K.error:K.transaction.error;x(X)}}catch(X){x(X)}})}).catch(x)});return y(g,m),g}function je(m){var b=this,g=new E(function(T,x){b.ready().then(function(){ye(b._dbInfo,Se,function(S,M){if(S)return x(S);try{var z=M.objectStore(b._dbInfo.storeName),K=z.count();K.onsuccess=function(){T(K.result)},K.onerror=function(){x(K.error)}}catch(X){x(X)}})}).catch(x)});return y(g,m),g}function Oe(m,b){var g=this,T=new E(function(x,S){if(m<0){x(null);return}g.ready().then(function(){ye(g._dbInfo,Se,function(M,z){if(M)return S(M);try{var K=z.objectStore(g._dbInfo.storeName),X=!1,Z=K.openKeyCursor();Z.onsuccess=function(){var ie=Z.result;if(!ie){x(null);return}m===0||X?x(ie.key):(X=!0,ie.advance(m))},Z.onerror=function(){S(Z.error)}}catch(ie){S(ie)}})}).catch(S)});return y(T,b),T}function Ge(m){var b=this,g=new E(function(T,x){b.ready().then(function(){ye(b._dbInfo,Se,function(S,M){if(S)return x(S);try{var z=M.objectStore(b._dbInfo.storeName),K=z.openKeyCursor(),X=[];K.onsuccess=function(){var Z=K.result;if(!Z){T(X);return}X.push(Z.key),Z.continue()},K.onerror=function(){x(K.error)}}catch(Z){x(Z)}})}).catch(x)});return y(g,m),g}function Pe(m,b){b=k.apply(this,arguments);var g=this.config();m=typeof m!="function"&&m||{},m.name||(m.name=m.name||g.name,m.storeName=m.storeName||g.storeName);var T=this,x;if(!m.name)x=E.reject("Invalid arguments");else{var S=m.name===g.name&&T._dbInfo.db,M=S?E.resolve(T._dbInfo.db):tt(m).then(function(z){var K=B[m.name],X=K.forages;K.db=z;for(var Z=0;Z<X.length;Z++)X[Z]._dbInfo.db=z;return z});m.storeName?x=M.then(function(z){if(z.objectStoreNames.contains(m.storeName)){var K=z.version+1;ke(m);var X=B[m.name],Z=X.forages;z.close();for(var ie=0;ie<Z.length;ie++){var be=Z[ie];be._dbInfo.db=null,be._dbInfo.version=K}var Le=new E(function(Me,at){var rt=p.open(m.name,K);rt.onerror=function(Qt){var Ao=rt.result;Ao.close(),at(Qt)},rt.onupgradeneeded=function(){var Qt=rt.result;Qt.deleteObjectStore(m.storeName)},rt.onsuccess=function(){var Qt=rt.result;Qt.close(),Me(Qt)}});return Le.then(function(Me){X.db=Me;for(var at=0;at<Z.length;at++){var rt=Z[at];rt._dbInfo.db=Me,Re(rt._dbInfo)}}).catch(function(Me){throw(Ne(m,Me)||E.resolve()).catch(function(){}),Me})}}):x=M.then(function(z){ke(m);var K=B[m.name],X=K.forages;z.close();for(var Z=0;Z<X.length;Z++){var ie=X[Z];ie._dbInfo.db=null}var be=new E(function(Le,Me){var at=p.deleteDatabase(m.name);at.onerror=function(){var rt=at.result;rt&&rt.close(),Me(at.error)},at.onblocked=function(){console.warn('dropInstance blocked for database "'+m.name+'" until all open connections are closed')},at.onsuccess=function(){var rt=at.result;rt&&rt.close(),Le(rt)}});return be.then(function(Le){K.db=Le;for(var Me=0;Me<X.length;Me++){var at=X[Me];Re(at._dbInfo)}}).catch(function(Le){throw(Ne(m,Le)||E.resolve()).catch(function(){}),Le})})}return y(x,b),x}var jt={_driver:"asyncStorage",_initStorage:it,_support:d(),iterate:St,getItem:ot,setItem:It,removeItem:ut,clear:xe,length:je,key:Oe,keys:Ge,dropInstance:Pe};function h(){return typeof openDatabase=="function"}var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,C="__lfsc__:",N=C.length,G="arbf",me="blob",Ie="si08",ve="ui08",Fe="uic8",Ve="si16",st="si32",dr="ur16",Kr="ui32",_i="fl32",hr="fl64",gr=N+G.length,Gf=Object.prototype.toString;function Yf(m){var b=m.length*.75,g=m.length,T,x=0,S,M,z,K;m[m.length-1]==="="&&(b--,m[m.length-2]==="="&&b--);var X=new ArrayBuffer(b),Z=new Uint8Array(X);for(T=0;T<g;T+=4)S=l.indexOf(m[T]),M=l.indexOf(m[T+1]),z=l.indexOf(m[T+2]),K=l.indexOf(m[T+3]),Z[x++]=S<<2|M>>4,Z[x++]=(M&15)<<4|z>>2,Z[x++]=(z&3)<<6|K&63;return X}function kl(m){var b=new Uint8Array(m),g="",T;for(T=0;T<b.length;T+=3)g+=l[b[T]>>2],g+=l[(b[T]&3)<<4|b[T+1]>>4],g+=l[(b[T+1]&15)<<2|b[T+2]>>6],g+=l[b[T+2]&63];return b.length%3===2?g=g.substring(0,g.length-1)+"=":b.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function Dy(m,b){var g="";if(m&&(g=Gf.call(m)),m&&(g==="[object ArrayBuffer]"||m.buffer&&Gf.call(m.buffer)==="[object ArrayBuffer]")){var T,x=C;m instanceof ArrayBuffer?(T=m,x+=G):(T=m.buffer,g==="[object Int8Array]"?x+=Ie:g==="[object Uint8Array]"?x+=ve:g==="[object Uint8ClampedArray]"?x+=Fe:g==="[object Int16Array]"?x+=Ve:g==="[object Uint16Array]"?x+=dr:g==="[object Int32Array]"?x+=st:g==="[object Uint32Array]"?x+=Kr:g==="[object Float32Array]"?x+=_i:g==="[object Float64Array]"?x+=hr:b(new Error("Failed to get type for BinaryArray"))),b(x+kl(T))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var M=u+m.type+"~"+kl(this.result);b(C+me+M)},S.readAsArrayBuffer(m)}else try{b(JSON.stringify(m))}catch(M){console.error("Couldn't convert value into a JSON string: ",m),b(null,M)}}function Ny(m){if(m.substring(0,N)!==C)return JSON.parse(m);var b=m.substring(gr),g=m.substring(N,gr),T;if(g===me&&v.test(b)){var x=b.match(v);T=x[1],b=b.substring(x[0].length)}var S=Yf(b);switch(g){case G:return S;case me:return f([S],{type:T});case Ie:return new Int8Array(S);case ve:return new Uint8Array(S);case Fe:return new Uint8ClampedArray(S);case Ve:return new Int16Array(S);case dr:return new Uint16Array(S);case st:return new Int32Array(S);case Kr:return new Uint32Array(S);case _i:return new Float32Array(S);case hr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var Fl={serialize:Dy,deserialize:Ny,stringToBuffer:Yf,bufferToString:kl};function zf(m,b,g,T){m.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,T)}function Oy(m){var b=this,g={db:null};if(m)for(var T in m)g[T]=typeof m[T]!="string"?m[T].toString():m[T];var x=new E(function(S,M){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(z){return M(z)}g.db.transaction(function(z){zf(z,g,function(){b._dbInfo=g,S()},function(K,X){M(X)})},M)});return g.serializer=Fl,x}function gn(m,b,g,T,x,S){m.executeSql(g,T,x,function(M,z){z.code===z.SYNTAX_ERR?M.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(K,X){X.rows.length?S(K,z):zf(K,b,function(){K.executeSql(g,T,x,S)},S)},S):S(M,z)},S)}function Py(m,b){var g=this;m=D(m);var T=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"SELECT * FROM "+M.storeName+" WHERE key = ? LIMIT 1",[m],function(K,X){var Z=X.rows.length?X.rows.item(0).value:null;Z&&(Z=M.serializer.deserialize(Z)),x(Z)},function(K,X){S(X)})})}).catch(S)});return y(T,b),T}function Ly(m,b){var g=this,T=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"SELECT * FROM "+M.storeName,[],function(K,X){for(var Z=X.rows,ie=Z.length,be=0;be<ie;be++){var Le=Z.item(be),Me=Le.value;if(Me&&(Me=M.serializer.deserialize(Me)),Me=m(Me,Le.key,be+1),Me!==void 0){x(Me);return}}x()},function(K,X){S(X)})})}).catch(S)});return y(T,b),T}function qf(m,b,g,T){var x=this;m=D(m);var S=new E(function(M,z){x.ready().then(function(){b===void 0&&(b=null);var K=b,X=x._dbInfo;X.serializer.serialize(b,function(Z,ie){ie?z(ie):X.db.transaction(function(be){gn(be,X,"INSERT OR REPLACE INTO "+X.storeName+" (key, value) VALUES (?, ?)",[m,Z],function(){M(K)},function(Le,Me){z(Me)})},function(be){if(be.code===be.QUOTA_ERR){if(T>0){M(qf.apply(x,[m,K,g,T-1]));return}z(be)}})})}).catch(z)});return y(S,g),S}function My(m,b,g){return qf.apply(this,[m,b,g,1])}function By(m,b){var g=this;m=D(m);var T=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"DELETE FROM "+M.storeName+" WHERE key = ?",[m],function(){x()},function(K,X){S(X)})})}).catch(S)});return y(T,b),T}function Uy(m){var b=this,g=new E(function(T,x){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(M){gn(M,S,"DELETE FROM "+S.storeName,[],function(){T()},function(z,K){x(K)})})}).catch(x)});return y(g,m),g}function ky(m){var b=this,g=new E(function(T,x){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(M){gn(M,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(z,K){var X=K.rows.item(0).c;T(X)},function(z,K){x(K)})})}).catch(x)});return y(g,m),g}function Fy(m,b){var g=this,T=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"SELECT key FROM "+M.storeName+" WHERE id = ? LIMIT 1",[m+1],function(K,X){var Z=X.rows.length?X.rows.item(0).key:null;x(Z)},function(K,X){S(X)})})}).catch(S)});return y(T,b),T}function Hy(m){var b=this,g=new E(function(T,x){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(M){gn(M,S,"SELECT key FROM "+S.storeName,[],function(z,K){for(var X=[],Z=0;Z<K.rows.length;Z++)X.push(K.rows.item(Z).key);T(X)},function(z,K){x(K)})})}).catch(x)});return y(g,m),g}function $y(m){return new E(function(b,g){m.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(x,S){for(var M=[],z=0;z<S.rows.length;z++)M.push(S.rows.item(z).name);b({db:m,storeNames:M})},function(x,S){g(S)})},function(T){g(T)})})}function Vy(m,b){b=k.apply(this,arguments);var g=this.config();m=typeof m!="function"&&m||{},m.name||(m.name=m.name||g.name,m.storeName=m.storeName||g.storeName);var T=this,x;return m.name?x=new E(function(S){var M;m.name===g.name?M=T._dbInfo.db:M=openDatabase(m.name,"","",0),m.storeName?S({db:M,storeNames:[m.storeName]}):S($y(M))}).then(function(S){return new E(function(M,z){S.db.transaction(function(K){function X(Le){return new E(function(Me,at){K.executeSql("DROP TABLE IF EXISTS "+Le,[],function(){Me()},function(rt,Qt){at(Qt)})})}for(var Z=[],ie=0,be=S.storeNames.length;ie<be;ie++)Z.push(X(S.storeNames[ie]));E.all(Z).then(function(){M()}).catch(function(Le){z(Le)})},function(K){z(K)})})}):x=E.reject("Invalid arguments"),y(x,b),x}var Wy={_driver:"webSQLStorage",_initStorage:Oy,_support:h(),iterate:Ly,getItem:Py,setItem:My,removeItem:By,clear:Uy,length:ky,key:Fy,keys:Hy,dropInstance:Vy};function jy(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Kf(m,b){var g=m.name+"/";return m.storeName!==b.storeName&&(g+=m.storeName+"/"),g}function Gy(){var m="_localforage_support_test";try{return localStorage.setItem(m,!0),localStorage.removeItem(m),!1}catch{return!0}}function Yy(){return!Gy()||localStorage.length>0}function zy(m){var b=this,g={};if(m)for(var T in m)g[T]=m[T];return g.keyPrefix=Kf(m,b._defaultConfig),Yy()?(b._dbInfo=g,g.serializer=Fl,E.resolve()):E.reject()}function qy(m){var b=this,g=b.ready().then(function(){for(var T=b._dbInfo.keyPrefix,x=localStorage.length-1;x>=0;x--){var S=localStorage.key(x);S.indexOf(T)===0&&localStorage.removeItem(S)}});return y(g,m),g}function Ky(m,b){var g=this;m=D(m);var T=g.ready().then(function(){var x=g._dbInfo,S=localStorage.getItem(x.keyPrefix+m);return S&&(S=x.serializer.deserialize(S)),S});return y(T,b),T}function Xy(m,b){var g=this,T=g.ready().then(function(){for(var x=g._dbInfo,S=x.keyPrefix,M=S.length,z=localStorage.length,K=1,X=0;X<z;X++){var Z=localStorage.key(X);if(Z.indexOf(S)===0){var ie=localStorage.getItem(Z);if(ie&&(ie=x.serializer.deserialize(ie)),ie=m(ie,Z.substring(M),K++),ie!==void 0)return ie}}});return y(T,b),T}function Jy(m,b){var g=this,T=g.ready().then(function(){var x=g._dbInfo,S;try{S=localStorage.key(m)}catch{S=null}return S&&(S=S.substring(x.keyPrefix.length)),S});return y(T,b),T}function Qy(m){var b=this,g=b.ready().then(function(){for(var T=b._dbInfo,x=localStorage.length,S=[],M=0;M<x;M++){var z=localStorage.key(M);z.indexOf(T.keyPrefix)===0&&S.push(z.substring(T.keyPrefix.length))}return S});return y(g,m),g}function Zy(m){var b=this,g=b.keys().then(function(T){return T.length});return y(g,m),g}function ev(m,b){var g=this;m=D(m);var T=g.ready().then(function(){var x=g._dbInfo;localStorage.removeItem(x.keyPrefix+m)});return y(T,b),T}function tv(m,b,g){var T=this;m=D(m);var x=T.ready().then(function(){b===void 0&&(b=null);var S=b;return new E(function(M,z){var K=T._dbInfo;K.serializer.serialize(b,function(X,Z){if(Z)z(Z);else try{localStorage.setItem(K.keyPrefix+m,X),M(S)}catch(ie){(ie.name==="QuotaExceededError"||ie.name==="NS_ERROR_DOM_QUOTA_REACHED")&&z(ie),z(ie)}})})});return y(x,g),x}function rv(m,b){if(b=k.apply(this,arguments),m=typeof m!="function"&&m||{},!m.name){var g=this.config();m.name=m.name||g.name,m.storeName=m.storeName||g.storeName}var T=this,x;return m.name?x=new E(function(S){m.storeName?S(Kf(m,T._defaultConfig)):S(m.name+"/")}).then(function(S){for(var M=localStorage.length-1;M>=0;M--){var z=localStorage.key(M);z.indexOf(S)===0&&localStorage.removeItem(z)}}):x=E.reject("Invalid arguments"),y(x,b),x}var nv={_driver:"localStorageWrapper",_initStorage:zy,_support:jy(),iterate:Xy,getItem:Ky,setItem:tv,removeItem:ev,clear:qy,length:Zy,key:Jy,keys:Qy,dropInstance:rv},iv=function(b,g){return b===g||typeof b=="number"&&typeof g=="number"&&isNaN(b)&&isNaN(g)},ov=function(b,g){for(var T=b.length,x=0;x<T;){if(iv(b[x],g))return!0;x++}return!1},Xf=Array.isArray||function(m){return Object.prototype.toString.call(m)==="[object Array]"},Ro={},Jf={},bi={INDEXEDDB:jt,WEBSQL:Wy,LOCALSTORAGE:nv},sv=[bi.INDEXEDDB._driver,bi.WEBSQL._driver,bi.LOCALSTORAGE._driver],Ks=["dropInstance"],Hl=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Ks),av={description:"",driver:sv.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function cv(m,b){m[b]=function(){var g=arguments;return m.ready().then(function(){return m[b].apply(m,g)})}}function $l(){for(var m=1;m<arguments.length;m++){var b=arguments[m];if(b)for(var g in b)b.hasOwnProperty(g)&&(Xf(b[g])?arguments[0][g]=b[g].slice():arguments[0][g]=b[g])}return arguments[0]}var lv=function(){function m(b){a(this,m);for(var g in bi)if(bi.hasOwnProperty(g)){var T=bi[g],x=T._driver;this[g]=x,Ro[x]||this.defineDriver(T)}this._defaultConfig=$l({},av),this._config=$l({},this._defaultConfig,b),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return m.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in g){if(T==="storeName"&&(g[T]=g[T].replace(/\W/g,"_")),T==="version"&&typeof g[T]!="number")return new Error("Database version must be a number.");this._config[T]=g[T]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},m.prototype.defineDriver=function(g,T,x){var S=new E(function(M,z){try{var K=g._driver,X=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){z(X);return}for(var Z=Hl.concat("_initStorage"),ie=0,be=Z.length;ie<be;ie++){var Le=Z[ie],Me=!ov(Ks,Le);if((Me||g[Le])&&typeof g[Le]!="function"){z(X);return}}var at=function(){for(var Ao=function(fv){return function(){var mv=new Error("Method "+fv+" is not implemented by the current driver"),Qf=E.reject(mv);return y(Qf,arguments[arguments.length-1]),Qf}},Vl=0,pv=Ks.length;Vl<pv;Vl++){var Wl=Ks[Vl];g[Wl]||(g[Wl]=Ao(Wl))}};at();var rt=function(Ao){Ro[K]&&console.info("Redefining LocalForage driver: "+K),Ro[K]=g,Jf[K]=Ao,M()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(rt,z):rt(!!g._support):rt(!0)}catch(Qt){z(Qt)}});return I(S,T,x),S},m.prototype.driver=function(){return this._driver||null},m.prototype.getDriver=function(g,T,x){var S=Ro[g]?E.resolve(Ro[g]):E.reject(new Error("Driver not found."));return I(S,T,x),S},m.prototype.getSerializer=function(g){var T=E.resolve(Fl);return I(T,g),T},m.prototype.ready=function(g){var T=this,x=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return I(x,g,g),x},m.prototype.setDriver=function(g,T,x){var S=this;Xf(g)||(g=[g]);var M=this._getSupportedDrivers(g);function z(){S._config.driver=S.driver()}function K(ie){return S._extend(ie),z(),S._ready=S._initStorage(S._config),S._ready}function X(ie){return function(){var be=0;function Le(){for(;be<ie.length;){var Me=ie[be];return be++,S._dbInfo=null,S._ready=null,S.getDriver(Me).then(K).catch(Le)}z();var at=new Error("No available storage method found.");return S._driverSet=E.reject(at),S._driverSet}return Le()}}var Z=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=Z.then(function(){var ie=M[0];return S._dbInfo=null,S._ready=null,S.getDriver(ie).then(function(be){S._driver=be._driver,z(),S._wrapLibraryMethodsWithReady(),S._initDriver=X(M)})}).catch(function(){z();var ie=new Error("No available storage method found.");return S._driverSet=E.reject(ie),S._driverSet}),I(this._driverSet,T,x),this._driverSet},m.prototype.supports=function(g){return!!Jf[g]},m.prototype._extend=function(g){$l(this,g)},m.prototype._getSupportedDrivers=function(g){for(var T=[],x=0,S=g.length;x<S;x++){var M=g[x];this.supports(M)&&T.push(M)}return T},m.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,T=Hl.length;g<T;g++)cv(this,Hl[g])},m.prototype.createInstance=function(g){return new m(g)},m}(),uv=new lv;i.exports=uv},{3:3}]},{},[4])(4)})});var pm=No((ou,su)=>{"use strict";(function(t,e){typeof ou=="object"&&typeof su<"u"?su.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.fetchRetry=e())})(ou,function(){"use strict";var t=function(n,i){if(i=i||{},typeof n!="function")throw new r("fetch must be a function");if(typeof i!="object")throw new r("defaults must be an object");if(i.retries!==void 0&&!e(i.retries))throw new r("retries must be a positive integer");if(i.retryDelay!==void 0&&!e(i.retryDelay)&&typeof i.retryDelay!="function")throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(i.retryOn!==void 0&&!Array.isArray(i.retryOn)&&typeof i.retryOn!="function")throw new r("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return i=Object.assign(o,i),function(a,c){var p=i.retries,d=i.retryDelay,f=i.retryOn;if(c&&c.retries!==void 0)if(e(c.retries))p=c.retries;else throw new r("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(e(c.retryDelay)||typeof c.retryDelay=="function")d=c.retryDelay;else throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")f=c.retryOn;else throw new r("retryOn property expects an array or function");return new Promise(function(E,y){var I=function(k){var O=typeof Request<"u"&&a instanceof Request?a.clone():a;n(O,c).then(function($){if(Array.isArray(f)&&f.indexOf($.status)===-1)E($);else if(typeof f=="function")try{return Promise.resolve(f(k,null,$)).then(function(B){B?D(k,null,$):E($)}).catch(y)}catch(B){y(B)}else k<p?D(k,null,$):E($)}).catch(function($){if(typeof f=="function")try{Promise.resolve(f(k,$,null)).then(function(B){B?D(k,$,null):y($)}).catch(function(B){y(B)})}catch(B){y(B)}else k<p?D(k,$,null):y($)})};function D(k,O,$){var B=typeof d=="function"?d(k,O,$):d;setTimeout(function(){I(++k)},B)}I(0)})}};function e(n){return Number.isInteger(n)&&n>=0}function r(n){this.name="ArgumentError",this.message=n}return t})});var Wh=No((lc,Vh)=>{"use strict";(function(t,e){typeof lc=="object"&&typeof Vh<"u"?e(lc):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(lc,function(t){"use strict";function e(A){var R,j,F=new Error(A);return R=F,j=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,j):R.__proto__=j,F}function r(A,R,j){var F=R.slice(0,j).split(/\n/),V=F.length,se=F[V-1].length+1;throw e(A+=" at line "+V+" col "+se+`:
1
+ import{a as _,b as Z,c as Po,d as fm,e as Lo,f as Cr,g as bi}from"./chunk-V7UGKYBN.js";var wi=Lo((vm,ra)=>{"use strict";(function(t){"use strict";var e={};e.VERSION="1.6.1";var r,n={},i=function(p,d){return function(){return d.apply(p,arguments)}},o=function(){var p=arguments,d=p[0],f,E;for(E=1;E<p.length;E++)for(f in p[E])!(f in d)&&p[E].hasOwnProperty(f)&&(d[f]=p[E][f]);return d},s=function(p,d){return{value:p,name:d}};e.TRACE=s(1,"TRACE"),e.DEBUG=s(2,"DEBUG"),e.INFO=s(3,"INFO"),e.TIME=s(4,"TIME"),e.WARN=s(5,"WARN"),e.ERROR=s(8,"ERROR"),e.OFF=s(99,"OFF");var a=function(p){this.context=p,this.setLevel(p.filterLevel),this.log=this.info};a.prototype={setLevel:function(p){p&&"value"in p&&(this.context.filterLevel=p)},getLevel:function(){return this.context.filterLevel},enabledFor:function(p){var d=this.context.filterLevel;return p.value>=d.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"start"])},timeEnd:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"end"])},invoke:function(p,d){r&&this.enabledFor(p)&&r(d,o({level:p},this.context))}};var c=new a({filterLevel:e.OFF});(function(){var p=e;p.enabledFor=i(c,c.enabledFor),p.trace=i(c,c.trace),p.debug=i(c,c.debug),p.time=i(c,c.time),p.timeEnd=i(c,c.timeEnd),p.info=i(c,c.info),p.warn=i(c,c.warn),p.error=i(c,c.error),p.log=p.info})(),e.setHandler=function(p){r=p},e.setLevel=function(p){c.setLevel(p);for(var d in n)n.hasOwnProperty(d)&&n[d].setLevel(p)},e.getLevel=function(){return c.getLevel()},e.get=function(p){return n[p]||(n[p]=new a(o({name:p},c.context)))},e.createDefaultHandler=function(p){p=p||{},p.formatter=p.formatter||function(y,I){I.name&&y.unshift("["+I.name+"]")};var d={},f=function(E,y){Function.prototype.apply.call(E,console,y)};return typeof console>"u"?function(){}:function(E,y){E=Array.prototype.slice.call(E);var I=console.log,D;y.level===e.TIME?(D=(y.name?"["+y.name+"] ":"")+E[0],E[1]==="start"?console.time?console.time(D):d[D]=new Date().getTime():console.timeEnd?console.timeEnd(D):f(I,[D+": "+(new Date().getTime()-d[D])+"ms"])):(y.level===e.WARN&&console.warn?I=console.warn:y.level===e.ERROR&&console.error?I=console.error:y.level===e.INFO&&console.info?I=console.info:y.level===e.DEBUG&&console.debug?I=console.debug:y.level===e.TRACE&&console.trace&&(I=console.trace),p.formatter(E,y),f(I,E))}},e.useDefaults=function(p){e.setLevel(p&&p.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(p))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof ra<"u"&&ra.exports?ra.exports=e:(e._prevLogger=t.Logger,e.noConflict=function(){return t.Logger=e._prevLogger,e},t.Logger=e)})(vm)});var au=Lo(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.URLBuilder=void 0;var Lv=(function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t})();na.URLBuilder=Lv});var xm=Lo((Tm,gu)=>{"use strict";(function(t){if(typeof Tm=="object"&&typeof gu<"u")gu.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return(function n(i,o,s){function a(d,f){if(!o[d]){if(!i[d]){var E=typeof Po=="function"&&Po;if(!f&&E)return E(d,!0);if(c)return c(d,!0);var y=new Error("Cannot find module '"+d+"'");throw y.code="MODULE_NOT_FOUND",y}var I=o[d]={exports:{}};i[d][0].call(I.exports,function(D){var U=i[d][1][D];return a(U||D)},I,I.exports,n,i,o,s)}return o[d].exports}for(var c=typeof Po=="function"&&Po,p=0;p<s.length;p++)a(s[p]);return a})({1:[function(n,i,o){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,c;if(a){var p=0,d=new a(D),f=s.document.createTextNode("");d.observe(f,{characterData:!0}),c=function(){f.data=p=++p%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=D,c=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?c=function(){var N=s.document.createElement("script");N.onreadystatechange=function(){D(),N.onreadystatechange=null,N.parentNode.removeChild(N),N=null},s.document.documentElement.appendChild(N)}:c=function(){setTimeout(D,0)};var y,I=[];function D(){y=!0;for(var N,H,M=I.length;M;){for(H=I,I=[],N=-1;++N<M;)H[N]();M=I.length}y=!1}i.exports=U;function U(N){I.push(N)===1&&!y&&c()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function a(){}var c={},p=["REJECTED"],d=["FULFILLED"],f=["PENDING"];i.exports=E;function E(J){if(typeof J!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,J!==a&&U(this,J)}E.prototype.catch=function(J){return this.then(null,J)},E.prototype.then=function(J,ae){if(typeof J!="function"&&this.state===d||typeof ae!="function"&&this.state===p)return this;var se=new this.constructor(a);if(this.state!==f){var me=this.state===d?J:ae;I(se,me,this.outcome)}else this.queue.push(new y(se,J,ae));return se};function y(J,ae,se){this.promise=J,typeof ae=="function"&&(this.onFulfilled=ae,this.callFulfilled=this.otherCallFulfilled),typeof se=="function"&&(this.onRejected=se,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(J){c.resolve(this.promise,J)},y.prototype.otherCallFulfilled=function(J){I(this.promise,this.onFulfilled,J)},y.prototype.callRejected=function(J){c.reject(this.promise,J)},y.prototype.otherCallRejected=function(J){I(this.promise,this.onRejected,J)};function I(J,ae,se){s(function(){var me;try{me=ae(se)}catch(Le){return c.reject(J,Le)}me===J?c.reject(J,new TypeError("Cannot resolve promise with itself")):c.resolve(J,me)})}c.resolve=function(J,ae){var se=N(D,ae);if(se.status==="error")return c.reject(J,se.value);var me=se.value;if(me)U(J,me);else{J.state=d,J.outcome=ae;for(var Le=-1,Ie=J.queue.length;++Le<Ie;)J.queue[Le].callFulfilled(ae)}return J},c.reject=function(J,ae){J.state=p,J.outcome=ae;for(var se=-1,me=J.queue.length;++se<me;)J.queue[se].callRejected(ae);return J};function D(J){var ae=J&&J.then;if(J&&(typeof J=="object"||typeof J=="function")&&typeof ae=="function")return function(){ae.apply(J,arguments)}}function U(J,ae){var se=!1;function me(qe){se||(se=!0,c.reject(J,qe))}function Le(qe){se||(se=!0,c.resolve(J,qe))}function Ie(){ae(Le,me)}var Ce=N(Ie);Ce.status==="error"&&me(Ce.value)}function N(J,ae){var se={};try{se.value=J(ae),se.status="success"}catch(me){se.status="error",se.value=me}return se}E.resolve=H;function H(J){return J instanceof this?J:c.resolve(new this(a),J)}E.reject=M;function M(J){var ae=new this(a);return c.reject(ae,J)}E.all=q;function q(J){var ae=this;if(Object.prototype.toString.call(J)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=J.length,me=!1;if(!se)return this.resolve([]);for(var Le=new Array(se),Ie=0,Ce=-1,qe=new this(a);++Ce<se;)Ze(J[Ce],Ce);return qe;function Ze(Bt,A){ae.resolve(Bt).then(R,function(W){me||(me=!0,c.reject(qe,W))});function R(W){Le[A]=W,++Ie===se&&!me&&(me=!0,c.resolve(qe,Le))}}}E.race=Ee;function Ee(J){var ae=this;if(Object.prototype.toString.call(J)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=J.length,me=!1;if(!se)return this.resolve([]);for(var Le=-1,Ie=new this(a);++Le<se;)Ce(J[Le]);return Ie;function Ce(qe){ae.resolve(qe).then(function(Ze){me||(me=!0,c.resolve(Ie,Ze))},function(Ze){me||(me=!0,c.reject(Ie,Ze))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m};function a(m,w){if(!(m instanceof w))throw new TypeError("Cannot call a class as a function")}function c(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var p=c();function d(){try{if(!p||!p.open)return!1;var m=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),w=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!m||w)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function f(m,w){m=m||[],w=w||{};try{return new Blob(m,w)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new g,x=0;x<m.length;x+=1)T.append(m[x]);return T.getBlob(w.type)}}typeof Promise>"u"&&n(3);var E=Promise;function y(m,w){w&&m.then(function(g){w(null,g)},function(g){w(g)})}function I(m,w,g){typeof w=="function"&&m.then(w),typeof g=="function"&&m.catch(g)}function D(m){return typeof m!="string"&&(console.warn(m+" used as a key, but it is not a string."),m=String(m)),m}function U(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var N="local-forage-detect-blob-support",H=void 0,M={},q=Object.prototype.toString,Ee="readonly",J="readwrite";function ae(m){for(var w=m.length,g=new ArrayBuffer(w),T=new Uint8Array(g),x=0;x<w;x++)T[x]=m.charCodeAt(x);return g}function se(m){return new E(function(w){var g=m.transaction(N,J),T=f([""]);g.objectStore(N).put(T,"key"),g.onabort=function(x){x.preventDefault(),x.stopPropagation(),w(!1)},g.oncomplete=function(){var x=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);w(S||!x||parseInt(x[1],10)>=43)}}).catch(function(){return!1})}function me(m){return typeof H=="boolean"?E.resolve(H):se(m).then(function(w){return H=w,H})}function Le(m){var w=M[m.name],g={};g.promise=new E(function(T,x){g.resolve=T,g.reject=x}),w.deferredOperations.push(g),w.dbReady?w.dbReady=w.dbReady.then(function(){return g.promise}):w.dbReady=g.promise}function Ie(m){var w=M[m.name],g=w.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Ce(m,w){var g=M[m.name],T=g.deferredOperations.pop();if(T)return T.reject(w),T.promise}function qe(m,w){return new E(function(g,T){if(M[m.name]=M[m.name]||Ke(),m.db)if(w)Le(m),m.db.close();else return g(m.db);var x=[m.name];w&&x.push(m.version);var S=p.open.apply(p,x);w&&(S.onupgradeneeded=function(L){var Y=S.result;try{Y.createObjectStore(m.storeName),L.oldVersion<=1&&Y.createObjectStore(N)}catch(z){if(z.name==="ConstraintError")console.warn('The database "'+m.name+'" has been upgraded from version '+L.oldVersion+" to version "+L.newVersion+', but the storage "'+m.storeName+'" already exists.');else throw z}}),S.onerror=function(L){L.preventDefault(),T(S.error)},S.onsuccess=function(){var L=S.result;L.onversionchange=function(Y){Y.target.close()},g(L),Ie(m)}})}function Ze(m){return qe(m,!1)}function Bt(m){return qe(m,!0)}function A(m,w){if(!m.db)return!0;var g=!m.db.objectStoreNames.contains(m.storeName),T=m.version<m.db.version,x=m.version>m.db.version;if(T&&(m.version!==w&&console.warn('The database "'+m.name+`" can't be downgraded from version `+m.db.version+" to version "+m.version+"."),m.version=m.db.version),x||g){if(g){var S=m.db.version+1;S>m.version&&(m.version=S)}return!0}return!1}function R(m){return new E(function(w,g){var T=new FileReader;T.onerror=g,T.onloadend=function(x){var S=btoa(x.target.result||"");w({__local_forage_encoded_blob:!0,data:S,type:m.type})},T.readAsBinaryString(m)})}function W(m){var w=ae(atob(m.data));return f([w],{type:m.type})}function k(m){return m&&m.__local_forage_encoded_blob}function $(m){var w=this,g=w._initReady().then(function(){var T=M[w._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return I(g,m,m),g}function ne(m){Le(m);for(var w=M[m.name],g=w.forages,T=0;T<g.length;T++){var x=g[T];x._dbInfo.db&&(x._dbInfo.db.close(),x._dbInfo.db=null)}return m.db=null,Ze(m).then(function(S){return m.db=S,A(m)?Bt(m):S}).then(function(S){m.db=w.db=S;for(var L=0;L<g.length;L++)g[L]._dbInfo.db=S}).catch(function(S){throw Ce(m,S),S})}function he(m,w,g,T){T===void 0&&(T=1);try{var x=m.db.transaction(m.storeName,w);g(null,x)}catch(S){if(T>0&&(!m.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return E.resolve().then(function(){if(!m.db||S.name==="NotFoundError"&&!m.db.objectStoreNames.contains(m.storeName)&&m.version<=m.db.version)return m.db&&(m.version=m.db.version+1),Bt(m)}).then(function(){return ne(m).then(function(){he(m,w,g,T-1)})}).catch(g);g(S)}}function Ke(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function rt(m){var w=this,g={db:null};if(m)for(var T in m)g[T]=m[T];var x=M[g.name];x||(x=Ke(),M[g.name]=x),x.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=$);var S=[];function L(){return E.resolve()}for(var Y=0;Y<x.forages.length;Y++){var z=x.forages[Y];z!==w&&S.push(z._initReady().catch(L))}var K=x.forages.slice(0);return E.all(S).then(function(){return g.db=x.db,Ze(g)}).then(function(Q){return g.db=Q,A(g,w._defaultConfig.version)?Bt(g):Q}).then(function(Q){g.db=x.db=Q,w._dbInfo=g;for(var te=0;te<K.length;te++){var ve=K[te];ve!==w&&(ve._dbInfo.db=g.db,ve._dbInfo.version=g.version)}})}function nt(m,w){var g=this;m=D(m);var T=new E(function(x,S){g.ready().then(function(){he(g._dbInfo,Ee,function(L,Y){if(L)return S(L);try{var z=Y.objectStore(g._dbInfo.storeName),K=z.get(m);K.onsuccess=function(){var Q=K.result;Q===void 0&&(Q=null),k(Q)&&(Q=W(Q)),x(Q)},K.onerror=function(){S(K.error)}}catch(Q){S(Q)}})}).catch(S)});return y(T,w),T}function bt(m,w){var g=this,T=new E(function(x,S){g.ready().then(function(){he(g._dbInfo,Ee,function(L,Y){if(L)return S(L);try{var z=Y.objectStore(g._dbInfo.storeName),K=z.openCursor(),Q=1;K.onsuccess=function(){var te=K.result;if(te){var ve=te.value;k(ve)&&(ve=W(ve));var De=m(ve,te.key,Q++);De!==void 0?x(De):te.continue()}else x()},K.onerror=function(){S(K.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function wt(m,w,g){var T=this;m=D(m);var x=new E(function(S,L){var Y;T.ready().then(function(){return Y=T._dbInfo,q.call(w)==="[object Blob]"?me(Y.db).then(function(z){return z?w:R(w)}):w}).then(function(z){he(T._dbInfo,J,function(K,Q){if(K)return L(K);try{var te=Q.objectStore(T._dbInfo.storeName);z===null&&(z=void 0);var ve=te.put(z,m);Q.oncomplete=function(){z===void 0&&(z=null),S(z)},Q.onabort=Q.onerror=function(){var De=ve.error?ve.error:ve.transaction.error;L(De)}}catch(De){L(De)}})}).catch(L)});return y(x,g),x}function ct(m,w){var g=this;m=D(m);var T=new E(function(x,S){g.ready().then(function(){he(g._dbInfo,J,function(L,Y){if(L)return S(L);try{var z=Y.objectStore(g._dbInfo.storeName),K=z.delete(m);Y.oncomplete=function(){x()},Y.onerror=function(){S(K.error)},Y.onabort=function(){var Q=K.error?K.error:K.transaction.error;S(Q)}}catch(Q){S(Q)}})}).catch(S)});return y(T,w),T}function we(m){var w=this,g=new E(function(T,x){w.ready().then(function(){he(w._dbInfo,J,function(S,L){if(S)return x(S);try{var Y=L.objectStore(w._dbInfo.storeName),z=Y.clear();L.oncomplete=function(){T()},L.onabort=L.onerror=function(){var K=z.error?z.error:z.transaction.error;x(K)}}catch(K){x(K)}})}).catch(x)});return y(g,m),g}function $e(m){var w=this,g=new E(function(T,x){w.ready().then(function(){he(w._dbInfo,Ee,function(S,L){if(S)return x(S);try{var Y=L.objectStore(w._dbInfo.storeName),z=Y.count();z.onsuccess=function(){T(z.result)},z.onerror=function(){x(z.error)}}catch(K){x(K)}})}).catch(x)});return y(g,m),g}function Re(m,w){var g=this,T=new E(function(x,S){if(m<0){x(null);return}g.ready().then(function(){he(g._dbInfo,Ee,function(L,Y){if(L)return S(L);try{var z=Y.objectStore(g._dbInfo.storeName),K=!1,Q=z.openKeyCursor();Q.onsuccess=function(){var te=Q.result;if(!te){x(null);return}m===0||K?x(te.key):(K=!0,te.advance(m))},Q.onerror=function(){S(Q.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function Ve(m){var w=this,g=new E(function(T,x){w.ready().then(function(){he(w._dbInfo,Ee,function(S,L){if(S)return x(S);try{var Y=L.objectStore(w._dbInfo.storeName),z=Y.openKeyCursor(),K=[];z.onsuccess=function(){var Q=z.result;if(!Q){T(K);return}K.push(Q.key),Q.continue()},z.onerror=function(){x(z.error)}}catch(Q){x(Q)}})}).catch(x)});return y(g,m),g}function Ae(m,w){w=U.apply(this,arguments);var g=this.config();m=typeof m!="function"&&m||{},m.name||(m.name=m.name||g.name,m.storeName=m.storeName||g.storeName);var T=this,x;if(!m.name)x=E.reject("Invalid arguments");else{var S=m.name===g.name&&T._dbInfo.db,L=S?E.resolve(T._dbInfo.db):Ze(m).then(function(Y){var z=M[m.name],K=z.forages;z.db=Y;for(var Q=0;Q<K.length;Q++)K[Q]._dbInfo.db=Y;return Y});m.storeName?x=L.then(function(Y){if(Y.objectStoreNames.contains(m.storeName)){var z=Y.version+1;Le(m);var K=M[m.name],Q=K.forages;Y.close();for(var te=0;te<Q.length;te++){var ve=Q[te];ve._dbInfo.db=null,ve._dbInfo.version=z}var De=new E(function(Oe,ot){var et=p.open(m.name,z);et.onerror=function(Qt){var No=et.result;No.close(),ot(Qt)},et.onupgradeneeded=function(){var Qt=et.result;Qt.deleteObjectStore(m.storeName)},et.onsuccess=function(){var Qt=et.result;Qt.close(),Oe(Qt)}});return De.then(function(Oe){K.db=Oe;for(var ot=0;ot<Q.length;ot++){var et=Q[ot];et._dbInfo.db=Oe,Ie(et._dbInfo)}}).catch(function(Oe){throw(Ce(m,Oe)||E.resolve()).catch(function(){}),Oe})}}):x=L.then(function(Y){Le(m);var z=M[m.name],K=z.forages;Y.close();for(var Q=0;Q<K.length;Q++){var te=K[Q];te._dbInfo.db=null}var ve=new E(function(De,Oe){var ot=p.deleteDatabase(m.name);ot.onerror=function(){var et=ot.result;et&&et.close(),Oe(ot.error)},ot.onblocked=function(){console.warn('dropInstance blocked for database "'+m.name+'" until all open connections are closed')},ot.onsuccess=function(){var et=ot.result;et&&et.close(),De(et)}});return ve.then(function(De){z.db=De;for(var Oe=0;Oe<K.length;Oe++){var ot=K[Oe];Ie(ot._dbInfo)}}).catch(function(De){throw(Ce(m,De)||E.resolve()).catch(function(){}),De})})}return y(x,w),x}var jt={_driver:"asyncStorage",_initStorage:rt,_support:d(),iterate:bt,getItem:nt,setItem:wt,removeItem:ct,clear:we,length:$e,key:Re,keys:Ve,dropInstance:Ae};function h(){return typeof openDatabase=="function"}var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,C="__lfsc__:",O=C.length,j="arbf",ue="blob",_e="si08",ge="ui08",Me="uic8",Fe="si16",it="si32",dr="ur16",zr="ui32",Ei="fl32",hr="fl64",gr=O+j.length,im=Object.prototype.toString;function om(m){var w=m.length*.75,g=m.length,T,x=0,S,L,Y,z;m[m.length-1]==="="&&(w--,m[m.length-2]==="="&&w--);var K=new ArrayBuffer(w),Q=new Uint8Array(K);for(T=0;T<g;T+=4)S=l.indexOf(m[T]),L=l.indexOf(m[T+1]),Y=l.indexOf(m[T+2]),z=l.indexOf(m[T+3]),Q[x++]=S<<2|L>>4,Q[x++]=(L&15)<<4|Y>>2,Q[x++]=(Y&3)<<6|z&63;return K}function Zl(m){var w=new Uint8Array(m),g="",T;for(T=0;T<w.length;T+=3)g+=l[w[T]>>2],g+=l[(w[T]&3)<<4|w[T+1]>>4],g+=l[(w[T+1]&15)<<2|w[T+2]>>6],g+=l[w[T+2]&63];return w.length%3===2?g=g.substring(0,g.length-1)+"=":w.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function zy(m,w){var g="";if(m&&(g=im.call(m)),m&&(g==="[object ArrayBuffer]"||m.buffer&&im.call(m.buffer)==="[object ArrayBuffer]")){var T,x=C;m instanceof ArrayBuffer?(T=m,x+=j):(T=m.buffer,g==="[object Int8Array]"?x+=_e:g==="[object Uint8Array]"?x+=ge:g==="[object Uint8ClampedArray]"?x+=Me:g==="[object Int16Array]"?x+=Fe:g==="[object Uint16Array]"?x+=dr:g==="[object Int32Array]"?x+=it:g==="[object Uint32Array]"?x+=zr:g==="[object Float32Array]"?x+=Ei:g==="[object Float64Array]"?x+=hr:w(new Error("Failed to get type for BinaryArray"))),w(x+Zl(T))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var L=u+m.type+"~"+Zl(this.result);w(C+ue+L)},S.readAsArrayBuffer(m)}else try{w(JSON.stringify(m))}catch(L){console.error("Couldn't convert value into a JSON string: ",m),w(null,L)}}function Ky(m){if(m.substring(0,O)!==C)return JSON.parse(m);var w=m.substring(gr),g=m.substring(O,gr),T;if(g===ue&&v.test(w)){var x=w.match(v);T=x[1],w=w.substring(x[0].length)}var S=om(w);switch(g){case j:return S;case ue:return f([S],{type:T});case _e:return new Int8Array(S);case ge:return new Uint8Array(S);case Me:return new Uint8ClampedArray(S);case Fe:return new Int16Array(S);case dr:return new Uint16Array(S);case it:return new Int32Array(S);case zr:return new Uint32Array(S);case Ei:return new Float32Array(S);case hr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var eu={serialize:zy,deserialize:Ky,stringToBuffer:om,bufferToString:Zl};function sm(m,w,g,T){m.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,T)}function Xy(m){var w=this,g={db:null};if(m)for(var T in m)g[T]=typeof m[T]!="string"?m[T].toString():m[T];var x=new E(function(S,L){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(Y){return L(Y)}g.db.transaction(function(Y){sm(Y,g,function(){w._dbInfo=g,S()},function(z,K){L(K)})},L)});return g.serializer=eu,x}function hn(m,w,g,T,x,S){m.executeSql(g,T,x,function(L,Y){Y.code===Y.SYNTAX_ERR?L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(z,K){K.rows.length?S(z,Y):sm(z,w,function(){z.executeSql(g,T,x,S)},S)},S):S(L,Y)},S)}function Jy(m,w){var g=this;m=D(m);var T=new E(function(x,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(Y){hn(Y,L,"SELECT * FROM "+L.storeName+" WHERE key = ? LIMIT 1",[m],function(z,K){var Q=K.rows.length?K.rows.item(0).value:null;Q&&(Q=L.serializer.deserialize(Q)),x(Q)},function(z,K){S(K)})})}).catch(S)});return y(T,w),T}function Qy(m,w){var g=this,T=new E(function(x,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(Y){hn(Y,L,"SELECT * FROM "+L.storeName,[],function(z,K){for(var Q=K.rows,te=Q.length,ve=0;ve<te;ve++){var De=Q.item(ve),Oe=De.value;if(Oe&&(Oe=L.serializer.deserialize(Oe)),Oe=m(Oe,De.key,ve+1),Oe!==void 0){x(Oe);return}}x()},function(z,K){S(K)})})}).catch(S)});return y(T,w),T}function am(m,w,g,T){var x=this;m=D(m);var S=new E(function(L,Y){x.ready().then(function(){w===void 0&&(w=null);var z=w,K=x._dbInfo;K.serializer.serialize(w,function(Q,te){te?Y(te):K.db.transaction(function(ve){hn(ve,K,"INSERT OR REPLACE INTO "+K.storeName+" (key, value) VALUES (?, ?)",[m,Q],function(){L(z)},function(De,Oe){Y(Oe)})},function(ve){if(ve.code===ve.QUOTA_ERR){if(T>0){L(am.apply(x,[m,z,g,T-1]));return}Y(ve)}})})}).catch(Y)});return y(S,g),S}function Zy(m,w,g){return am.apply(this,[m,w,g,1])}function ev(m,w){var g=this;m=D(m);var T=new E(function(x,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(Y){hn(Y,L,"DELETE FROM "+L.storeName+" WHERE key = ?",[m],function(){x()},function(z,K){S(K)})})}).catch(S)});return y(T,w),T}function tv(m){var w=this,g=new E(function(T,x){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(L){hn(L,S,"DELETE FROM "+S.storeName,[],function(){T()},function(Y,z){x(z)})})}).catch(x)});return y(g,m),g}function rv(m){var w=this,g=new E(function(T,x){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(L){hn(L,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(Y,z){var K=z.rows.item(0).c;T(K)},function(Y,z){x(z)})})}).catch(x)});return y(g,m),g}function nv(m,w){var g=this,T=new E(function(x,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(Y){hn(Y,L,"SELECT key FROM "+L.storeName+" WHERE id = ? LIMIT 1",[m+1],function(z,K){var Q=K.rows.length?K.rows.item(0).key:null;x(Q)},function(z,K){S(K)})})}).catch(S)});return y(T,w),T}function iv(m){var w=this,g=new E(function(T,x){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(L){hn(L,S,"SELECT key FROM "+S.storeName,[],function(Y,z){for(var K=[],Q=0;Q<z.rows.length;Q++)K.push(z.rows.item(Q).key);T(K)},function(Y,z){x(z)})})}).catch(x)});return y(g,m),g}function ov(m){return new E(function(w,g){m.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(x,S){for(var L=[],Y=0;Y<S.rows.length;Y++)L.push(S.rows.item(Y).name);w({db:m,storeNames:L})},function(x,S){g(S)})},function(T){g(T)})})}function sv(m,w){w=U.apply(this,arguments);var g=this.config();m=typeof m!="function"&&m||{},m.name||(m.name=m.name||g.name,m.storeName=m.storeName||g.storeName);var T=this,x;return m.name?x=new E(function(S){var L;m.name===g.name?L=T._dbInfo.db:L=openDatabase(m.name,"","",0),m.storeName?S({db:L,storeNames:[m.storeName]}):S(ov(L))}).then(function(S){return new E(function(L,Y){S.db.transaction(function(z){function K(De){return new E(function(Oe,ot){z.executeSql("DROP TABLE IF EXISTS "+De,[],function(){Oe()},function(et,Qt){ot(Qt)})})}for(var Q=[],te=0,ve=S.storeNames.length;te<ve;te++)Q.push(K(S.storeNames[te]));E.all(Q).then(function(){L()}).catch(function(De){Y(De)})},function(z){Y(z)})})}):x=E.reject("Invalid arguments"),y(x,w),x}var av={_driver:"webSQLStorage",_initStorage:Xy,_support:h(),iterate:Qy,getItem:Jy,setItem:Zy,removeItem:ev,clear:tv,length:rv,key:nv,keys:iv,dropInstance:sv};function cv(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function cm(m,w){var g=m.name+"/";return m.storeName!==w.storeName&&(g+=m.storeName+"/"),g}function lv(){var m="_localforage_support_test";try{return localStorage.setItem(m,!0),localStorage.removeItem(m),!1}catch{return!0}}function uv(){return!lv()||localStorage.length>0}function pv(m){var w=this,g={};if(m)for(var T in m)g[T]=m[T];return g.keyPrefix=cm(m,w._defaultConfig),uv()?(w._dbInfo=g,g.serializer=eu,E.resolve()):E.reject()}function fv(m){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo.keyPrefix,x=localStorage.length-1;x>=0;x--){var S=localStorage.key(x);S.indexOf(T)===0&&localStorage.removeItem(S)}});return y(g,m),g}function mv(m,w){var g=this;m=D(m);var T=g.ready().then(function(){var x=g._dbInfo,S=localStorage.getItem(x.keyPrefix+m);return S&&(S=x.serializer.deserialize(S)),S});return y(T,w),T}function dv(m,w){var g=this,T=g.ready().then(function(){for(var x=g._dbInfo,S=x.keyPrefix,L=S.length,Y=localStorage.length,z=1,K=0;K<Y;K++){var Q=localStorage.key(K);if(Q.indexOf(S)===0){var te=localStorage.getItem(Q);if(te&&(te=x.serializer.deserialize(te)),te=m(te,Q.substring(L),z++),te!==void 0)return te}}});return y(T,w),T}function hv(m,w){var g=this,T=g.ready().then(function(){var x=g._dbInfo,S;try{S=localStorage.key(m)}catch{S=null}return S&&(S=S.substring(x.keyPrefix.length)),S});return y(T,w),T}function gv(m){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo,x=localStorage.length,S=[],L=0;L<x;L++){var Y=localStorage.key(L);Y.indexOf(T.keyPrefix)===0&&S.push(Y.substring(T.keyPrefix.length))}return S});return y(g,m),g}function yv(m){var w=this,g=w.keys().then(function(T){return T.length});return y(g,m),g}function vv(m,w){var g=this;m=D(m);var T=g.ready().then(function(){var x=g._dbInfo;localStorage.removeItem(x.keyPrefix+m)});return y(T,w),T}function Ev(m,w,g){var T=this;m=D(m);var x=T.ready().then(function(){w===void 0&&(w=null);var S=w;return new E(function(L,Y){var z=T._dbInfo;z.serializer.serialize(w,function(K,Q){if(Q)Y(Q);else try{localStorage.setItem(z.keyPrefix+m,K),L(S)}catch(te){(te.name==="QuotaExceededError"||te.name==="NS_ERROR_DOM_QUOTA_REACHED")&&Y(te),Y(te)}})})});return y(x,g),x}function _v(m,w){if(w=U.apply(this,arguments),m=typeof m!="function"&&m||{},!m.name){var g=this.config();m.name=m.name||g.name,m.storeName=m.storeName||g.storeName}var T=this,x;return m.name?x=new E(function(S){m.storeName?S(cm(m,T._defaultConfig)):S(m.name+"/")}).then(function(S){for(var L=localStorage.length-1;L>=0;L--){var Y=localStorage.key(L);Y.indexOf(S)===0&&localStorage.removeItem(Y)}}):x=E.reject("Invalid arguments"),y(x,w),x}var bv={_driver:"localStorageWrapper",_initStorage:pv,_support:cv(),iterate:dv,getItem:mv,setItem:Ev,removeItem:vv,clear:fv,length:yv,key:hv,keys:gv,dropInstance:_v},wv=function(w,g){return w===g||typeof w=="number"&&typeof g=="number"&&isNaN(w)&&isNaN(g)},Sv=function(w,g){for(var T=w.length,x=0;x<T;){if(wv(w[x],g))return!0;x++}return!1},lm=Array.isArray||function(m){return Object.prototype.toString.call(m)==="[object Array]"},Oo={},um={},_i={INDEXEDDB:jt,WEBSQL:av,LOCALSTORAGE:bv},Iv=[_i.INDEXEDDB._driver,_i.WEBSQL._driver,_i.LOCALSTORAGE._driver],Zs=["dropInstance"],tu=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Zs),Tv={description:"",driver:Iv.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function xv(m,w){m[w]=function(){var g=arguments;return m.ready().then(function(){return m[w].apply(m,g)})}}function ru(){for(var m=1;m<arguments.length;m++){var w=arguments[m];if(w)for(var g in w)w.hasOwnProperty(g)&&(lm(w[g])?arguments[0][g]=w[g].slice():arguments[0][g]=w[g])}return arguments[0]}var Cv=(function(){function m(w){a(this,m);for(var g in _i)if(_i.hasOwnProperty(g)){var T=_i[g],x=T._driver;this[g]=x,Oo[x]||this.defineDriver(T)}this._defaultConfig=ru({},Tv),this._config=ru({},this._defaultConfig,w),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return m.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in g){if(T==="storeName"&&(g[T]=g[T].replace(/\W/g,"_")),T==="version"&&typeof g[T]!="number")return new Error("Database version must be a number.");this._config[T]=g[T]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},m.prototype.defineDriver=function(g,T,x){var S=new E(function(L,Y){try{var z=g._driver,K=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){Y(K);return}for(var Q=tu.concat("_initStorage"),te=0,ve=Q.length;te<ve;te++){var De=Q[te],Oe=!Sv(Zs,De);if((Oe||g[De])&&typeof g[De]!="function"){Y(K);return}}var ot=function(){for(var No=function(Dv){return function(){var Ov=new Error("Method "+Dv+" is not implemented by the current driver"),pm=E.reject(Ov);return y(pm,arguments[arguments.length-1]),pm}},nu=0,Av=Zs.length;nu<Av;nu++){var iu=Zs[nu];g[iu]||(g[iu]=No(iu))}};ot();var et=function(No){Oo[z]&&console.info("Redefining LocalForage driver: "+z),Oo[z]=g,um[z]=No,L()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(et,Y):et(!!g._support):et(!0)}catch(Qt){Y(Qt)}});return I(S,T,x),S},m.prototype.driver=function(){return this._driver||null},m.prototype.getDriver=function(g,T,x){var S=Oo[g]?E.resolve(Oo[g]):E.reject(new Error("Driver not found."));return I(S,T,x),S},m.prototype.getSerializer=function(g){var T=E.resolve(eu);return I(T,g),T},m.prototype.ready=function(g){var T=this,x=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return I(x,g,g),x},m.prototype.setDriver=function(g,T,x){var S=this;lm(g)||(g=[g]);var L=this._getSupportedDrivers(g);function Y(){S._config.driver=S.driver()}function z(te){return S._extend(te),Y(),S._ready=S._initStorage(S._config),S._ready}function K(te){return function(){var ve=0;function De(){for(;ve<te.length;){var Oe=te[ve];return ve++,S._dbInfo=null,S._ready=null,S.getDriver(Oe).then(z).catch(De)}Y();var ot=new Error("No available storage method found.");return S._driverSet=E.reject(ot),S._driverSet}return De()}}var Q=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=Q.then(function(){var te=L[0];return S._dbInfo=null,S._ready=null,S.getDriver(te).then(function(ve){S._driver=ve._driver,Y(),S._wrapLibraryMethodsWithReady(),S._initDriver=K(L)})}).catch(function(){Y();var te=new Error("No available storage method found.");return S._driverSet=E.reject(te),S._driverSet}),I(this._driverSet,T,x),this._driverSet},m.prototype.supports=function(g){return!!um[g]},m.prototype._extend=function(g){ru(this,g)},m.prototype._getSupportedDrivers=function(g){for(var T=[],x=0,S=g.length;x<S;x++){var L=g[x];this.supports(L)&&T.push(L)}return T},m.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,T=tu.length;g<T;g++)xv(this,tu[g])},m.prototype.createInstance=function(g){return new m(g)},m})(),Rv=new Cv;i.exports=Rv},{3:3}]},{},[4])(4)})});var Cm=Lo((vu,Eu)=>{"use strict";(function(t,e){typeof vu=="object"&&typeof Eu<"u"?Eu.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.fetchRetry=e())})(vu,function(){"use strict";var t=function(n,i){if(i=i||{},typeof n!="function")throw new r("fetch must be a function");if(typeof i!="object")throw new r("defaults must be an object");if(i.retries!==void 0&&!e(i.retries))throw new r("retries must be a positive integer");if(i.retryDelay!==void 0&&!e(i.retryDelay)&&typeof i.retryDelay!="function")throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(i.retryOn!==void 0&&!Array.isArray(i.retryOn)&&typeof i.retryOn!="function")throw new r("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return i=Object.assign(o,i),function(a,c){var p=i.retries,d=i.retryDelay,f=i.retryOn;if(c&&c.retries!==void 0)if(e(c.retries))p=c.retries;else throw new r("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(e(c.retryDelay)||typeof c.retryDelay=="function")d=c.retryDelay;else throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")f=c.retryOn;else throw new r("retryOn property expects an array or function");return new Promise(function(E,y){var I=function(U){var N=typeof Request<"u"&&a instanceof Request?a.clone():a;n(N,c).then(function(H){if(Array.isArray(f)&&f.indexOf(H.status)===-1)E(H);else if(typeof f=="function")try{return Promise.resolve(f(U,null,H)).then(function(M){M?D(U,null,H):E(H)}).catch(y)}catch(M){y(M)}else U<p?D(U,null,H):E(H)}).catch(function(H){if(typeof f=="function")try{Promise.resolve(f(U,H,null)).then(function(M){M?D(U,H,null):y(H)}).catch(function(M){y(M)})}catch(M){y(M)}else U<p?D(U,H,null):y(H)})};function D(U,N,H){var M=typeof d=="function"?d(U,N,H):d;setTimeout(function(){I(++U)},M)}I(0)})}};function e(n){return Number.isInteger(n)&&n>=0}function r(n){this.name="ArgumentError",this.message=n}return t})});var og=Lo((mc,ig)=>{"use strict";(function(t,e){typeof mc=="object"&&typeof ig<"u"?e(mc):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(mc,function(t){"use strict";function e(A){var R,W,k=new Error(A);return R=k,W=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,W):R.__proto__=W,k}function r(A,R,W){var k=R.slice(0,W).split(/\n/),$=k.length,ne=k[$-1].length+1;throw e(A+=" at line "+$+" col "+ne+`:
2
2
 
3
- `+R.split(/\n/)[V-1]+`
4
- `+Array(se).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,i=!1;try{i=new Function("return (async function(){}).constructor")()}catch(A){if(!(A instanceof SyntaxError))throw A}function o(A,R){return Object.prototype.hasOwnProperty.call(A,R)}function s(A,R,j){for(var F in R)o(R,F)&&(R[F]==null||typeof R[F]!="object"||F!=="storage"&&F!=="prefixes"||j?A[F]=R[F]:A[F]=s({},R[F]));return A}var a=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,p=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,d=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,f=/[.*+\-?^${}()|[\]\\]/g;function E(A){return f.test(A)?A.replace(f,"\\$&"):A}function y(A,R){R.rmWhitespace&&(A=A.replace(/[\r\n]+/g,`
5
- `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,p.lastIndex=0,d.lastIndex=0;var j=R.prefixes,F=[j.h,j.b,j.i,j.r,j.c,j.e].reduce(function(ut,xe){return ut&&xe?ut+"|"+E(xe):xe?E(xe):ut},""),V=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+E(R.tags[1])+")","g"),se=new RegExp("([^]*?)"+E(R.tags[0])+"(-|_)?\\s*("+F+")?\\s*","g"),ye=0,Je=!1;function it(ut,xe){var je,Oe={f:[]},Ge=0,Pe="c";function jt(me){var Ie=A.slice(ye,me),ve=Ie.trim();if(Pe==="f")ve==="safe"?Oe.raw=!0:R.async&&a.test(ve)?(ve=ve.replace(a,""),Oe.f.push([ve,"",!0])):Oe.f.push([ve,""]);else if(Pe==="fp")Oe.f[Oe.f.length-1][1]+=ve;else if(Pe==="err"){if(ve){var Fe=Ie.search(/\S/);r("invalid syntax",A,ye+Fe)}}else Oe[Pe]=ve;ye=me+1}for(xe==="h"||xe==="b"||xe==="c"?Pe="n":xe==="r"&&(Oe.raw=!0,xe="i"),V.lastIndex=ye;(je=V.exec(A))!==null;){var h=je[1],l=je[2],u=je[3],v=je[4],C=je[5],N=je.index;if(h)h==="("?(Ge===0&&(Pe==="n"?(jt(N),Pe="p"):Pe==="f"&&(jt(N),Pe="fp")),Ge++):h===")"?--Ge===0&&Pe!=="c"&&(jt(N),Pe="err"):Ge===0&&h==="|"?(jt(N),Pe="f"):h==="=>"&&(jt(N),ye+=1,Pe="res");else if(l)if(l==="/*"){var G=A.indexOf("*/",V.lastIndex);G===-1&&r("unclosed comment",A,je.index),V.lastIndex=G+2}else l==="'"?(p.lastIndex=je.index,p.exec(A)?V.lastIndex=p.lastIndex:r("unclosed string",A,je.index)):l==='"'?(d.lastIndex=je.index,d.exec(A)?V.lastIndex=d.lastIndex:r("unclosed string",A,je.index)):l==="`"&&(c.lastIndex=je.index,c.exec(A)?V.lastIndex=c.lastIndex:r("unclosed string",A,je.index));else if(u)return jt(N),ye=N+je[0].length,se.lastIndex=ye,Je=C,v&&xe==="h"&&(xe="s"),Oe.t=xe,Oe}return r("unclosed tag",A,ut),Oe}var ot=function ut(xe,je){xe.b=[],xe.d=[];var Oe,Ge=!1,Pe=[];function jt(Fe,Ve){Fe&&(Fe=function(st,dr,Kr,_i){var hr,gr;return typeof dr.autoTrim=="string"?hr=gr=dr.autoTrim:Array.isArray(dr.autoTrim)&&(hr=dr.autoTrim[1],gr=dr.autoTrim[0]),(Kr||Kr===!1)&&(hr=Kr),(_i||_i===!1)&&(gr=_i),hr==="slurp"&&gr==="slurp"?st.trim():(hr==="_"||hr==="slurp"?st=String.prototype.trimLeft?st.trimLeft():st.replace(/^[\s\uFEFF\xA0]+/,""):hr!=="-"&&hr!=="nl"||(st=st.replace(/^(?:\n|\r|\r\n)/,"")),gr==="_"||gr==="slurp"?st=String.prototype.trimRight?st.trimRight():st.replace(/[\s\uFEFF\xA0]+$/,""):gr!=="-"&&gr!=="nl"||(st=st.replace(/(?:\n|\r|\r\n)$/,"")),st)}(Fe,R,Je,Ve))&&(Fe=Fe.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Pe.push(Fe))}for(;(Oe=se.exec(A))!==null;){var h,l=Oe[1],u=Oe[2],v=Oe[3]||"";for(var C in j)if(j[C]===v){h=C;break}jt(l,u),ye=Oe.index+Oe[0].length,h||r("unrecognized tag type: "+v,A,ye);var N=it(Oe.index,h),G=N.t;if(G==="h"){var me=N.n||"";R.async&&a.test(me)&&(N.a=!0,N.n=me.replace(a,"")),N=ut(N),Pe.push(N)}else if(G==="c"){if(xe.n===N.n)return Ge?(Ge.d=Pe,xe.b.push(Ge)):xe.d=Pe,xe;r("Helper start and end don't match",A,Oe.index+Oe[0].length)}else if(G==="b"){Ge?(Ge.d=Pe,xe.b.push(Ge)):xe.d=Pe;var Ie=N.n||"";R.async&&a.test(Ie)&&(N.a=!0,N.n=Ie.replace(a,"")),Ge=N,Pe=[]}else if(G==="s"){var ve=N.n||"";R.async&&a.test(ve)&&(N.a=!0,N.n=ve.replace(a,"")),Pe.push(N)}else Pe.push(N)}if(!je)throw e('unclosed helper "'+xe.n+'"');return jt(A.slice(ye,A.length),!1),xe.d=Pe,xe}({f:[]},!0);if(R.plugins)for(var St=0;St<R.plugins.length;St++){var It=R.plugins[St];It.processAST&&(ot.d=It.processAST(ot.d,R))}return ot.d}function I(A,R){var j=y(A,R),F="var tR='';"+(R.useWith?"with("+R.varName+"||{}){":"")+B(j,R)+"if(cb){cb(null,tR)} return tR"+(R.useWith?"}":"");if(R.plugins)for(var V=0;V<R.plugins.length;V++){var se=R.plugins[V];se.processFnString&&(F=se.processFnString(F,R))}return F}function D(A,R){for(var j=0;j<R.length;j++){var F=R[j][0],V=R[j][1];A=(R[j][2]?"await ":"")+"c.l('F','"+F+"')("+A,V&&(A+=","+V),A+=")"}return A}function k(A,R,j,F,V,se){var ye="{exec:"+(V?"async ":"")+$(j,R,A)+",params:["+F+"]";return se&&(ye+=",name:'"+se+"'"),V&&(ye+=",async:true"),ye+="}"}function O(A,R){for(var j="[",F=0;F<A.length;F++){var V=A[F];j+=k(R,V.res||"",V.d,V.p||"",V.a,V.n),F<A.length&&(j+=",")}return j+="]"}function $(A,R,j){return"function("+R+"){var tR='';"+B(A,j)+"return tR}"}function B(A,R){for(var j=0,F=A.length,V="";j<F;j++){var se=A[j];if(typeof se=="string")V+="tR+='"+se+"';";else{var ye=se.t,Je=se.c||"",it=se.f,ot=se.n||"",St=se.p||"",It=se.res||"",ut=se.b,xe=!!se.a;if(ye==="i"){R.defaultFilter&&(Je="c.l('F','"+R.defaultFilter+"')("+Je+")");var je=D(Je,it);!se.raw&&R.autoEscape&&(je="c.l('F','e')("+je+")"),V+="tR+="+je+";"}else if(ye==="h")if(R.storage.nativeHelpers.get(ot))V+=R.storage.nativeHelpers.get(ot)(se,R);else{var Oe=(xe?"await ":"")+"c.l('H','"+ot+"')("+k(R,It,se.d,St,xe);Oe+=ut?","+O(ut,R):",[]",V+="tR+="+D(Oe+=",c)",it)+";"}else ye==="s"?V+="tR+="+D((xe?"await ":"")+"c.l('H','"+ot+"')({params:["+St+"]},[],c)",it)+";":ye==="e"&&(V+=Je+`
6
- `)}}return V}var q=function(){function A(R){this.cache=R}return A.prototype.define=function(R,j){this.cache[R]=j},A.prototype.get=function(R){return this.cache[R]},A.prototype.remove=function(R){delete this.cache[R]},A.prototype.reset=function(){this.cache={}},A.prototype.load=function(R){s(this.cache,R,!0)},A}();function Se(A,R,j,F){if(R&&R.length>0)throw e((F?"Native":"")+"Helper '"+A+"' doesn't accept blocks");if(j&&j.length>0)throw e((F?"Native":"")+"Helper '"+A+"' doesn't accept filters")}var Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function ue(A){return Q[A]}var le=new q({}),ge=new q({each:function(A,R){var j="",F=A.params[0];if(Se("each",R,!1),A.async)return new Promise(function(se){(function ye(Je,it,ot,St,It){ot(Je[it],it).then(function(ut){St+=ut,it===Je.length-1?It(St):ye(Je,it+1,ot,St,It)})})(F,0,A.exec,j,se)});for(var V=0;V<F.length;V++)j+=A.exec(F[V],V);return j},foreach:function(A,R){var j=A.params[0];if(Se("foreach",R,!1),A.async)return new Promise(function(se){(function ye(Je,it,ot,St,It,ut){St(it[ot],Je[it[ot]]).then(function(xe){It+=xe,ot===it.length-1?ut(It):ye(Je,it,ot+1,St,It,ut)})})(j,Object.keys(j),0,A.exec,"",se)});var F="";for(var V in j)o(j,V)&&(F+=A.exec(V,j[V]));return F},include:function(A,R,j){Se("include",R,!1);var F=j.storage.templates.get(A.params[0]);if(!F)throw e('Could not fetch template "'+A.params[0]+'"');return F(A.params[1],j)},extends:function(A,R,j){var F=A.params[1]||{};F.content=A.exec();for(var V=0;V<R.length;V++){var se=R[V];F[se.name]=se.exec()}var ye=j.storage.templates.get(A.params[0]);if(!ye)throw e('Could not fetch template "'+A.params[0]+'"');return ye(F,j)},useScope:function(A,R){return Se("useScope",R,!1),A.exec(A.params[0])}}),ke=new q({if:function(A,R){Se("if",!1,A.f,!0);var j="if("+A.p+"){"+B(A.d,R)+"}";if(A.b)for(var F=0;F<A.b.length;F++){var V=A.b[F];V.n==="else"?j+="else{"+B(V.d,R)+"}":V.n==="elif"&&(j+="else if("+V.p+"){"+B(V.d,R)+"}")}return j},try:function(A,R){if(Se("try",!1,A.f,!0),!A.b||A.b.length!==1||A.b[0].n!=="catch")throw e("native helper 'try' only accepts 1 block, 'catch'");var j="try{"+B(A.d,R)+"}",F=A.b[0];return j+="catch"+(F.res?"("+F.res+")":"")+"{"+B(F.d,R)+"}"},block:function(A,R){return Se("block",A.b,A.f,!0),"if(!"+R.varName+"["+A.p+"]){tR+=("+$(A.d,"",R)+")()}else{tR+="+R.varName+"["+A.p+"]}"}}),Re=new q({e:function(A){var R=String(A);return/[&<>"']/.test(R)?R.replace(/[&<>"']/g,ue):R}}),Ne={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(A,R){if(A==="H"){var j=this.storage.helpers.get(R);if(j)return j;throw e("Can't find helper '"+R+"'")}if(A==="F"){var F=this.storage.filters.get(R);if(F)return F;throw e("Can't find filter '"+R+"'")}},async:!1,storage:{helpers:ge,nativeHelpers:ke,filters:Re,templates:le},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function Xe(A,R){var j={};return s(j,Ne),R&&s(j,R),A&&s(j,A),j.l.bind(j),j}function tt(A,R){var j,F=Xe(R||{}),V=Function;if(F.async){if(!i)throw e("This environment doesn't support async/await");V=i}if(F.varName&&(j=F.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(j)===!1))throw e("options.varName must be a valid JS identifier");try{return new V(F.varName,"c","cb",I(A,F))}catch(se){throw se instanceof SyntaxError?e(`Bad template syntax
3
+ `+R.split(/\n/)[$-1]+`
4
+ `+Array(ne).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,i=!1;try{i=new Function("return (async function(){}).constructor")()}catch(A){if(!(A instanceof SyntaxError))throw A}function o(A,R){return Object.prototype.hasOwnProperty.call(A,R)}function s(A,R,W){for(var k in R)o(R,k)&&(R[k]==null||typeof R[k]!="object"||k!=="storage"&&k!=="prefixes"||W?A[k]=R[k]:A[k]=s({},R[k]));return A}var a=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,p=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,d=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,f=/[.*+\-?^${}()|[\]\\]/g;function E(A){return f.test(A)?A.replace(f,"\\$&"):A}function y(A,R){R.rmWhitespace&&(A=A.replace(/[\r\n]+/g,`
5
+ `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,p.lastIndex=0,d.lastIndex=0;var W=R.prefixes,k=[W.h,W.b,W.i,W.r,W.c,W.e].reduce(function(ct,we){return ct&&we?ct+"|"+E(we):we?E(we):ct},""),$=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+E(R.tags[1])+")","g"),ne=new RegExp("([^]*?)"+E(R.tags[0])+"(-|_)?\\s*("+k+")?\\s*","g"),he=0,Ke=!1;function rt(ct,we){var $e,Re={f:[]},Ve=0,Ae="c";function jt(ue){var _e=A.slice(he,ue),ge=_e.trim();if(Ae==="f")ge==="safe"?Re.raw=!0:R.async&&a.test(ge)?(ge=ge.replace(a,""),Re.f.push([ge,"",!0])):Re.f.push([ge,""]);else if(Ae==="fp")Re.f[Re.f.length-1][1]+=ge;else if(Ae==="err"){if(ge){var Me=_e.search(/\S/);r("invalid syntax",A,he+Me)}}else Re[Ae]=ge;he=ue+1}for(we==="h"||we==="b"||we==="c"?Ae="n":we==="r"&&(Re.raw=!0,we="i"),$.lastIndex=he;($e=$.exec(A))!==null;){var h=$e[1],l=$e[2],u=$e[3],v=$e[4],C=$e[5],O=$e.index;if(h)h==="("?(Ve===0&&(Ae==="n"?(jt(O),Ae="p"):Ae==="f"&&(jt(O),Ae="fp")),Ve++):h===")"?--Ve===0&&Ae!=="c"&&(jt(O),Ae="err"):Ve===0&&h==="|"?(jt(O),Ae="f"):h==="=>"&&(jt(O),he+=1,Ae="res");else if(l)if(l==="/*"){var j=A.indexOf("*/",$.lastIndex);j===-1&&r("unclosed comment",A,$e.index),$.lastIndex=j+2}else l==="'"?(p.lastIndex=$e.index,p.exec(A)?$.lastIndex=p.lastIndex:r("unclosed string",A,$e.index)):l==='"'?(d.lastIndex=$e.index,d.exec(A)?$.lastIndex=d.lastIndex:r("unclosed string",A,$e.index)):l==="`"&&(c.lastIndex=$e.index,c.exec(A)?$.lastIndex=c.lastIndex:r("unclosed string",A,$e.index));else if(u)return jt(O),he=O+$e[0].length,ne.lastIndex=he,Ke=C,v&&we==="h"&&(we="s"),Re.t=we,Re}return r("unclosed tag",A,ct),Re}var nt=(function ct(we,$e){we.b=[],we.d=[];var Re,Ve=!1,Ae=[];function jt(Me,Fe){Me&&(Me=(function(it,dr,zr,Ei){var hr,gr;return typeof dr.autoTrim=="string"?hr=gr=dr.autoTrim:Array.isArray(dr.autoTrim)&&(hr=dr.autoTrim[1],gr=dr.autoTrim[0]),(zr||zr===!1)&&(hr=zr),(Ei||Ei===!1)&&(gr=Ei),hr==="slurp"&&gr==="slurp"?it.trim():(hr==="_"||hr==="slurp"?it=String.prototype.trimLeft?it.trimLeft():it.replace(/^[\s\uFEFF\xA0]+/,""):hr!=="-"&&hr!=="nl"||(it=it.replace(/^(?:\n|\r|\r\n)/,"")),gr==="_"||gr==="slurp"?it=String.prototype.trimRight?it.trimRight():it.replace(/[\s\uFEFF\xA0]+$/,""):gr!=="-"&&gr!=="nl"||(it=it.replace(/(?:\n|\r|\r\n)$/,"")),it)})(Me,R,Ke,Fe))&&(Me=Me.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Ae.push(Me))}for(;(Re=ne.exec(A))!==null;){var h,l=Re[1],u=Re[2],v=Re[3]||"";for(var C in W)if(W[C]===v){h=C;break}jt(l,u),he=Re.index+Re[0].length,h||r("unrecognized tag type: "+v,A,he);var O=rt(Re.index,h),j=O.t;if(j==="h"){var ue=O.n||"";R.async&&a.test(ue)&&(O.a=!0,O.n=ue.replace(a,"")),O=ct(O),Ae.push(O)}else if(j==="c"){if(we.n===O.n)return Ve?(Ve.d=Ae,we.b.push(Ve)):we.d=Ae,we;r("Helper start and end don't match",A,Re.index+Re[0].length)}else if(j==="b"){Ve?(Ve.d=Ae,we.b.push(Ve)):we.d=Ae;var _e=O.n||"";R.async&&a.test(_e)&&(O.a=!0,O.n=_e.replace(a,"")),Ve=O,Ae=[]}else if(j==="s"){var ge=O.n||"";R.async&&a.test(ge)&&(O.a=!0,O.n=ge.replace(a,"")),Ae.push(O)}else Ae.push(O)}if(!$e)throw e('unclosed helper "'+we.n+'"');return jt(A.slice(he,A.length),!1),we.d=Ae,we})({f:[]},!0);if(R.plugins)for(var bt=0;bt<R.plugins.length;bt++){var wt=R.plugins[bt];wt.processAST&&(nt.d=wt.processAST(nt.d,R))}return nt.d}function I(A,R){var W=y(A,R),k="var tR='';"+(R.useWith?"with("+R.varName+"||{}){":"")+M(W,R)+"if(cb){cb(null,tR)} return tR"+(R.useWith?"}":"");if(R.plugins)for(var $=0;$<R.plugins.length;$++){var ne=R.plugins[$];ne.processFnString&&(k=ne.processFnString(k,R))}return k}function D(A,R){for(var W=0;W<R.length;W++){var k=R[W][0],$=R[W][1];A=(R[W][2]?"await ":"")+"c.l('F','"+k+"')("+A,$&&(A+=","+$),A+=")"}return A}function U(A,R,W,k,$,ne){var he="{exec:"+($?"async ":"")+H(W,R,A)+",params:["+k+"]";return ne&&(he+=",name:'"+ne+"'"),$&&(he+=",async:true"),he+="}"}function N(A,R){for(var W="[",k=0;k<A.length;k++){var $=A[k];W+=U(R,$.res||"",$.d,$.p||"",$.a,$.n),k<A.length&&(W+=",")}return W+="]"}function H(A,R,W){return"function("+R+"){var tR='';"+M(A,W)+"return tR}"}function M(A,R){for(var W=0,k=A.length,$="";W<k;W++){var ne=A[W];if(typeof ne=="string")$+="tR+='"+ne+"';";else{var he=ne.t,Ke=ne.c||"",rt=ne.f,nt=ne.n||"",bt=ne.p||"",wt=ne.res||"",ct=ne.b,we=!!ne.a;if(he==="i"){R.defaultFilter&&(Ke="c.l('F','"+R.defaultFilter+"')("+Ke+")");var $e=D(Ke,rt);!ne.raw&&R.autoEscape&&($e="c.l('F','e')("+$e+")"),$+="tR+="+$e+";"}else if(he==="h")if(R.storage.nativeHelpers.get(nt))$+=R.storage.nativeHelpers.get(nt)(ne,R);else{var Re=(we?"await ":"")+"c.l('H','"+nt+"')("+U(R,wt,ne.d,bt,we);Re+=ct?","+N(ct,R):",[]",$+="tR+="+D(Re+=",c)",rt)+";"}else he==="s"?$+="tR+="+D((we?"await ":"")+"c.l('H','"+nt+"')({params:["+bt+"]},[],c)",rt)+";":he==="e"&&($+=Ke+`
6
+ `)}}return $}var q=(function(){function A(R){this.cache=R}return A.prototype.define=function(R,W){this.cache[R]=W},A.prototype.get=function(R){return this.cache[R]},A.prototype.remove=function(R){delete this.cache[R]},A.prototype.reset=function(){this.cache={}},A.prototype.load=function(R){s(this.cache,R,!0)},A})();function Ee(A,R,W,k){if(R&&R.length>0)throw e((k?"Native":"")+"Helper '"+A+"' doesn't accept blocks");if(W&&W.length>0)throw e((k?"Native":"")+"Helper '"+A+"' doesn't accept filters")}var J={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function ae(A){return J[A]}var se=new q({}),me=new q({each:function(A,R){var W="",k=A.params[0];if(Ee("each",R,!1),A.async)return new Promise(function(ne){(function he(Ke,rt,nt,bt,wt){nt(Ke[rt],rt).then(function(ct){bt+=ct,rt===Ke.length-1?wt(bt):he(Ke,rt+1,nt,bt,wt)})})(k,0,A.exec,W,ne)});for(var $=0;$<k.length;$++)W+=A.exec(k[$],$);return W},foreach:function(A,R){var W=A.params[0];if(Ee("foreach",R,!1),A.async)return new Promise(function(ne){(function he(Ke,rt,nt,bt,wt,ct){bt(rt[nt],Ke[rt[nt]]).then(function(we){wt+=we,nt===rt.length-1?ct(wt):he(Ke,rt,nt+1,bt,wt,ct)})})(W,Object.keys(W),0,A.exec,"",ne)});var k="";for(var $ in W)o(W,$)&&(k+=A.exec($,W[$]));return k},include:function(A,R,W){Ee("include",R,!1);var k=W.storage.templates.get(A.params[0]);if(!k)throw e('Could not fetch template "'+A.params[0]+'"');return k(A.params[1],W)},extends:function(A,R,W){var k=A.params[1]||{};k.content=A.exec();for(var $=0;$<R.length;$++){var ne=R[$];k[ne.name]=ne.exec()}var he=W.storage.templates.get(A.params[0]);if(!he)throw e('Could not fetch template "'+A.params[0]+'"');return he(k,W)},useScope:function(A,R){return Ee("useScope",R,!1),A.exec(A.params[0])}}),Le=new q({if:function(A,R){Ee("if",!1,A.f,!0);var W="if("+A.p+"){"+M(A.d,R)+"}";if(A.b)for(var k=0;k<A.b.length;k++){var $=A.b[k];$.n==="else"?W+="else{"+M($.d,R)+"}":$.n==="elif"&&(W+="else if("+$.p+"){"+M($.d,R)+"}")}return W},try:function(A,R){if(Ee("try",!1,A.f,!0),!A.b||A.b.length!==1||A.b[0].n!=="catch")throw e("native helper 'try' only accepts 1 block, 'catch'");var W="try{"+M(A.d,R)+"}",k=A.b[0];return W+="catch"+(k.res?"("+k.res+")":"")+"{"+M(k.d,R)+"}"},block:function(A,R){return Ee("block",A.b,A.f,!0),"if(!"+R.varName+"["+A.p+"]){tR+=("+H(A.d,"",R)+")()}else{tR+="+R.varName+"["+A.p+"]}"}}),Ie=new q({e:function(A){var R=String(A);return/[&<>"']/.test(R)?R.replace(/[&<>"']/g,ae):R}}),Ce={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(A,R){if(A==="H"){var W=this.storage.helpers.get(R);if(W)return W;throw e("Can't find helper '"+R+"'")}if(A==="F"){var k=this.storage.filters.get(R);if(k)return k;throw e("Can't find filter '"+R+"'")}},async:!1,storage:{helpers:me,nativeHelpers:Le,filters:Ie,templates:se},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function qe(A,R){var W={};return s(W,Ce),R&&s(W,R),A&&s(W,A),W.l.bind(W),W}function Ze(A,R){var W,k=qe(R||{}),$=Function;if(k.async){if(!i)throw e("This environment doesn't support async/await");$=i}if(k.varName&&(W=k.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(W)===!1))throw e("options.varName must be a valid JS identifier");try{return new $(k.varName,"c","cb",I(A,k))}catch(ne){throw ne instanceof SyntaxError?e(`Bad template syntax
7
7
 
8
- `+se.message+`
9
- `+Array(se.message.length+1).join("=")+`
10
- `+I(A,F)):se}}function kt(A,R){var j;return R.cache&&R.name&&R.storage.templates.get(R.name)?R.storage.templates.get(R.name):(j=typeof A=="function"?A:tt(A,R),R.cache&&R.name&&R.storage.templates.define(R.name,j),j)}Ne.l.bind(Ne),t.compile=tt,t.compileScope=B,t.compileScopeIntoFunction=$,t.compileToString=I,t.defaultConfig=Ne,t.filters=Re,t.getConfig=Xe,t.helpers=ge,t.nativeHelpers=ke,t.parse=y,t.render=function(A,R,j,F){var V=Xe(j||{});if(!V.async)return kt(A,V)(R,V);if(!F){if(typeof n=="function")return new n(function(se,ye){try{se(kt(A,V)(R,V))}catch(Je){ye(Je)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{kt(A,V)(R,V,F)}catch(se){return F(se)}},t.templates=le,Object.defineProperty(t,"__esModule",{value:!0})})});var tm="11.0.0-rc.1";var te=class te{};ee(te,"SDK_VERSION",tm),ee(te,"SDK_VERSION_CODE"),ee(te,"SDK","WEB"),ee(te,"LOG_PREFIX","CooeeSDK"),ee(te,"COOEE","cooee"),ee(te,"SESSION_STORAGE_SCROLL_ID","sleid"),ee(te,"IDLE_TIME_IN_SECONDS",30*60),ee(te,"IN_APP_WRAPPER_NAME","cooee-wrapper"),ee(te,"IN_APP_CONTAINER_NAME","cooee-container"),ee(te,"IN_APP_DEFAULT_PADDING",15),ee(te,"EVENT_SCREEN_VIEW","CE Screen View"),ee(te,"EVENT_APP_BACKGROUND","CE App Background"),ee(te,"EVENT_TRIGGER_DISPLAYED","CE Trigger Displayed"),ee(te,"EVENT_CAMPAIGN_HOLDOUT","CE Campaign Holdout"),ee(te,"EVENT_CAMPAIGN_REJECTED","CE Campaign Rejected"),ee(te,"EVENT_CAMPAIGN_FAILED","CE Campaign Failed"),ee(te,"EVENT_TRIGGER_CLOSED","CE Trigger Closed"),ee(te,"EVENT_SCROLL","CE Scroll"),ee(te,"EVENT_TRIGGER_CLICKED","CE Trigger Clicked"),ee(te,"EVENT_FORM_SUBMITTED","CE Form Submitted"),ee(te,"EVENT_EXPERIMENT_START","CE Experiment Start"),ee(te,"EVENT_VIDEO_DIALOG_CLOSED","CE Video Dialog Closed"),ee(te,"EVENT_VIDEO_DIALOG_OPENED","CE Video Dialog Opened"),ee(te,"EVENT_VIDEO_CHANGE","CE Video Changed"),ee(te,"EVENT_LAST_VIDEO_ENDED","CE Last Video Ended"),ee(te,"EVENT_VIDEO_MUTED","CE Video Muted"),ee(te,"EVENT_VIDEO_UNMUTED","CE Video Unmuted"),ee(te,"EVENT_ADD_TO_CART_CLICKED","CE Add To Cart Clicked"),ee(te,"EVENT_VIEW_ITEM_CLICKED","CE View Item Clicked"),ee(te,"EVENT_MORE_ITEM_INFO_CLICKED","CE More Item Info Clicked"),ee(te,"EVENT_OPEN_CART_CLICKED","CE Open Cart Clicked"),ee(te,"EVENT_ADD_TO_CART","Add To Cart"),ee(te,"EVENT_REMOVE_FROM_CART","Remove From Cart"),ee(te,"EVENT_VIEW_ITEM","View Item"),ee(te,"EVENT_VIEW_CART","View Cart"),ee(te,"EVENT_OPEN_CART","Open Cart"),ee(te,"EVENT_VIEW_COLLECTION","View Collection"),ee(te,"EVENT_BUY_NOW_CLICKED","Buy Now Clicked"),ee(te,"EVENT_CHECKOUT_STARTED","Checkout Started"),ee(te,"EVENT_REVIEW_CLICKED","Review Clicked"),ee(te,"EVENT_ITEM_THUMBNAIL_CLICKED","Item Thumbnail Clicked"),ee(te,"JS_LOAD_WHITELIST_EVENTS",[te.EVENT_VIEW_ITEM,te.EVENT_VIEW_CART,te.EVENT_VIEW_COLLECTION]),ee(te,"HASH_INITIATE_CHECKOUT","initiate-checkout"),ee(te,"HASH_OPEN_CART_DRAWER","open-cart-drawer"),ee(te,"ADD_BUNDLE_CTA_INBOUND_EVENT","letscooee:inbound:cta:add-bundle"),ee(te,"CTA_OPEN_CART_EVENT","letscooee:outbound:open-cart"),ee(te,"CTA_AFTER_REFRESH_UI","letscooee:outbound:refresh-ui"),ee(te,"POPUP_ACTIVITY_EVENT","letscooee:outbound:popup-activities"),ee(te,"THIRD_PARTY_CHECKOUT_EVENT","letscooee:outbound:third-party-initiate-checkout"),ee(te,"CAMPAIGN_DISPLAYED_ACTIVITY","DISPLAYED"),ee(te,"CAMPAIGN_CLICKED_ACTIVITY","CLICKED"),ee(te,"CAMPAIGN_CLOSED_ACTIVITY","CLOSED"),ee(te,"BLACKLISTED_PAGE_NAMES",["collection","product","cart"]),ee(te,"PLACEHOLDER_IMAGE","https://cdn.global.letscooee.com/images/placeholders/product.png"),ee(te,"SHADOW_SPLITTER",":shadow"),ee(te,"CAMPAIGN_ATTRIBUTE","_letscooee_campaign"),ee(te,"CONTENT_ATTRIBUTE","_letscooee_content"),ee(te,"VIA","_via"),ee(te,"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"}]),(()=>{let e=te.SDK_VERSION.split("-")[0].split(".").slice(0,3).map(r=>r.padStart(2,"0")).join("");te.SDK_VERSION_CODE=parseInt(e,10)})();var P=te;var Gt={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${P.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${P.SDK_VERSION}/dist/widget.min.js`};var Yt=xr(wi());var w=class{static debuggerEl;static infoLogs=[];static log(...e){Yt.default.info(...e)}static verbose(...e){Yt.default.debug(...e)}static error(...e){Yt.default.error(...e)}static warn(...e){Yt.default.warn(...e)}static info(...e){Yt.default.info(...e),this.infoLogs.unshift({time:new Date,message:e.join(" ")}),this.addToDebugger()}static trace(...e){Yt.default.trace(...e)}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector("cooee-debugger"),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]))}};function nm(t=P.LOG_PREFIX){Yt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${P.SDK_VERSION}):`)}});let e=zl();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Yt.default.setLevel(Yt.default[localStorage.cooeeLogLevel]):Yt.default.setLevel(Gt.debug?Yt.default.TRACE:Yt.default.OFF)}function zl(){return new URL(location.href).searchParams?.get("cooee-debug")}function im(){let t=`
8
+ `+ne.message+`
9
+ `+Array(ne.message.length+1).join("=")+`
10
+ `+I(A,k)):ne}}function Bt(A,R){var W;return R.cache&&R.name&&R.storage.templates.get(R.name)?R.storage.templates.get(R.name):(W=typeof A=="function"?A:Ze(A,R),R.cache&&R.name&&R.storage.templates.define(R.name,W),W)}Ce.l.bind(Ce),t.compile=Ze,t.compileScope=M,t.compileScopeIntoFunction=H,t.compileToString=I,t.defaultConfig=Ce,t.filters=Ie,t.getConfig=qe,t.helpers=me,t.nativeHelpers=Le,t.parse=y,t.render=function(A,R,W,k){var $=qe(W||{});if(!$.async)return Bt(A,$)(R,$);if(!k){if(typeof n=="function")return new n(function(ne,he){try{ne(Bt(A,$)(R,$))}catch(Ke){he(Ke)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{Bt(A,$)(R,$,k)}catch(ne){return k(ne)}},t.templates=se,Object.defineProperty(t,"__esModule",{value:!0})})});var ou="11.0.0-rc.11";var Pv=ou.split("-")[0].split(".").slice(0,3).map(t=>t.padStart(2,"0")).join(""),ea="WEB",mm="CooeeSDK",Kr=ou,dm=parseInt(Pv,10);var hm=["collection","product","cart"],gm=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}],ym=["View Item","View Cart","View Collection"];var ta=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Kr}/dist`,Gt={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",baseURL:ta,styleURL:`${ta}/widget.min.css`,widgetURL:`${ta}/widget.min.js`,swiperStyleURL:`${ta}/swiper-bundle.min.css`};var Yt=Cr(wi());var b=class{static debuggerEl;static infoLogs=[];static log(...e){Yt.default.info(...e)}static verbose(...e){Yt.default.debug(...e)}static error(...e){Yt.default.error(...e)}static warn(...e){Yt.default.warn(...e)}static info(...e){Yt.default.info(...e),this.infoLogs.unshift({time:new Date,message:e.join(" ")}),this.addToDebugger()}static trace(...e){Yt.default.trace(...e)}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector("cooee-debugger"),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]))}};function Em(t=mm){Yt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${Kr}):`)}});let e=su();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Yt.default.setLevel(Yt.default[localStorage.cooeeLogLevel]):Yt.default.setLevel(Gt.debug?Yt.default.TRACE:Yt.default.OFF)}function su(){return new URL(location.href).searchParams?.get("cooee-debug")}function _m(){let t=`
11
11
  display: inline-block;
12
12
  font-size: 14px;
13
13
  background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
@@ -22,32 +22,32 @@ var dv=Object.create;var Gl=Object.defineProperty,hv=Object.defineProperties,gv=
22
22
  `,e+=`
23
23
 
24
24
  `,e+=`Learn more: https://www.letscooee.com
25
- Cooee SDK: v${P.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 Qe=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(e){return e??={},this.gaEnabled=e.gaEnabled,this.gaMeasurementID=e.gaMeasurementID,this.pixelPush=e.pixelPush,this.website=e.website??{},this.currencyCount=e.currencyCount??0,this.money=e.money,this.currency=e.currency,this.storefrontToken=e.storefrontToken,this.skipItemAttribute=e.skipItemAttribute,this}};var om=xr(ql());var Oo=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let e;try{e=new om.URLBuilder(location.href)}catch{return{}}let r={};this.UTM_PARAMS.forEach(i=>{let o=e.getQueryParam(i);o&&(r[i]=o)});let n={};return Object.keys(this.TW_PARAMS).forEach(i=>{let o=e.getQueryParam(this.TW_PARAMS[i]);o&&(n[i]=o)}),_(_({},n),r)}};function sm(t,e){return t||""}var At=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(e){this.id=e.id,this.mID=e.mID,this.vID=e.vID,this.vName=e.vName,this.imageURL=e.imageURL,this.name=e.name,this.link=e.link,this.quantity=e.quantity,this.price=e.price,this.finalPrice=e.finalPrice??e.price}};function Xr(t){let e=new Date(Date.UTC(0,0,0,0,0,0,t)),r=[];return e.getUTCMinutes()&&r.push(e.getUTCMinutes()+"m"),e.getUTCSeconds()&&r.push(e.getUTCSeconds()+"s"),e.getUTCMilliseconds()&&r.push(e.getUTCMilliseconds()+"ms"),r.length||r.push("0ms"),r.join(" ")}var de=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;customContext={};activeExperiments;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(e){this._currencyCode=e}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(e){this.currentItem=new At(e)}getJSLoadTimeDiff(){return Xr(Date.now()-this.jsLoadTime.getTime())}};var Kl=class{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}};function Zs(){let t=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new Kl(_({origin:location.origin,path:t,qs:location.search,referrer:Oo.getReferrer(),name:de.get().pageName},Oo.getUTMParams()))}function am(){let t=de.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");if(r){let i=r.split(",").map(o=>o.trim()).filter(o=>Number.isInteger(+o));i.length&&(t.previewIDs=i)}let n=e.get("cooee-variant")?.trim();n&&(t.previewVariant=n)}var Zt=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}(Zt||{});var Po=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(Po||{});var Xl=function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t}(Xl||{});var Si=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}(Si||{}),er=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}(er||{});var Jl=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}(Jl||{}),Lo=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(Lo||{}),yr=function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t.BUY_NOW="BUY_NOW",t.STICKY_ATC="STICKY_ATC",t.EXPERIMENT="EXPERIMENT",t.SAVINGS_BAR="SAVINGS_BAR",t}(yr||{}),Mo=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(Mo||{}),Ql=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Ql||{}),Zl=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}(Zl||{});var Jr=class t{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,t.swap(e,r,n)}}};var cm=(()=>{class t{static toTitle(r){return r?this.titleCase(r.toLowerCase().split(/[_-]+/).join(" ")):""}static toSlug(r){return r?r.toLowerCase().replace(/[_-]+/," ").replace(/[^\w ]+/g,"").replace(/ +/g,"-"):""}static toCamelCase(r){return r.toLowerCase().split(" ").map((n,i)=>i===0?n:n.charAt(0).toUpperCase()+n.slice(1)).join("")}static format(r,...n){return r?.replace(/{(\d+)}/g,(i,o)=>{let s=n[o];return s!==void 0?s:i})}static chop(r,n){if(!(!r||!n))return r.length<=n?r:r.substring(0,n)}static titleCase=r=>r.replace(/(^|\s)\S/g,n=>n.toUpperCase())}return t})();var ea=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}};var Hn=class{s;g;i;constructor(e){e.s&&(this.s=new Ye(e.s)),e.g&&(this.g=new Bo(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var Uo="a-f\\d",Sv=`#?[${Uo}]{3}[${Uo}]?`,Iv=`#?[${Uo}]{6}([${Uo}]{2})?`,Tv=new RegExp(`[^#${Uo}]`,"gi"),xv=new RegExp(`^${Sv}$|^${Iv}$`,"i");function eu(t,e={}){if(typeof t!="string"||Tv.test(t)||!xv.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,o=n>>8&255,s=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,o,s,a];if(e.format==="css"){let c=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${c})`}return{red:i,green:o,blue:s,alpha:a}}var Ye=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return eu(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var Qr=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new Ye(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return ta[this.s??1]}},ta=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(ta||{});var Bo=class t{static DEFAULT_FALLBACK=new Ye({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new Ye(e.c)),e.fb&&(this.fb=new Ye(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??t.DEFAULT_FALLBACK}};var ko=class{blur;spr;clr;x;y;constructor(e){e=e??{},this.blur=e.blur??0,this.spr=e.spr??0,this.x=e.x??0,this.y=e.y??0,this.clr=new Ye(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}};var Zr=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(e){e=e??{},this.pl=e.pl??0,this.pr=e.pr??0,this.pt=e.pt??0,this.pb=e.pb??0,this.ml=e.ml??0,this.mr=e.mr??0,this.mt=e.mt??0,this.mb=e.mb??0,this.cent=e.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}};var $n=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}};var Ii=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(Ii||{});var ra=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!=="Arial"?e.name:""),this.name=e.name,this.fonts=e.fonts?.map(r=>new tu(r))}},tu=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}};var pt=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return Ii[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new Ye(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new Ye(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new ra(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}};var na=class{modifications;constructor(e={}){e.modifications?.length?this.modifications=e.modifications.map(r=>new ia(r)):e.experiments?.length&&(this.modifications=e.experiments.map(r=>new ia(r)))}};var ia=class{cssSelector;type;display;bg;typo;br;text;image;constructor(e={}){this.cssSelector=e.cssSelector??"",this.type=e.type??"OTHER",this.display=e.display,e.bg&&(this.bg=new Ye(e.bg)),e.typo&&(this.typo=new pt(e.typo)),e.br&&(this.br=new Qr(e.br)),this.text=e.text,this.image=e.image}get style(){let e={};return this.display==="HIDE"?e.display="none":this.display==="BLOCK"?e.display="block":this.display==="INLINE"&&(e.display="inline"),this.br?.r&&(e.borderRadius=this.br.r+"px"),this.br?.w&&(e.borderWidth=this.br.w+"px"),this.br?.s&&(e.borderStyle=ta[this.br.s]?.toLowerCase()),this.br?.c?.h&&(e.borderColor=this.br.color?.rgba),this.bg?.h&&(e.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(e.fontSize=this.typo.fs+"px"),this.typo.lh&&(e.lineHeight=this.typo.lh),this.typo.fw&&(e.fontWeight=this.typo.fw),this.typo.ta&&(e.textAlign=this.typo.alignment),this.typo.tc.h&&(e.color=this.typo.tc.rgba),this.typo.ls&&(e.letterSpacing=this.typo.letterSpacing),this.typo.td&&(e.textDecoration=this.typo.td??"none")),e}toString(){return`Experiment(cssSelector=${this.cssSelector})`}};var ru=class{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;constructor(e){this.reached=e.reached??!1,this.calculatedAlignment=e.calculatedAlignment,this.minValue=e.minValue,this.rewardType=e.rewardType,this.label=e.label,this.reachingText=e.reachingText,this.reachedText=e.reachedText,this.discount=e.discount,this.items=e.items?.map(r=>new At(r)),this.isUIOnly=e.isUIOnly,this.allowATC=e.allowATC}};var oa=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(e){this.layout=e.layout??Ql.ICONS,this.onlyLatestGift=e.onlyLatestGift,this.noConfetti=e.noConfetti,this.removeIneligibleItem=e.removeIneligibleItem??!0,this.restrictToLatestFreebie=e.restrictToLatestFreebie,this.rewardBasis=e.rewardBasis??"CART_AMOUNT",this.update(e)}update(e){e=e??{},this.milestones=e.milestones?.map(r=>new ru(r))??[],this.totalProgress=e.totalProgress??0,this.coupons=e.coupons,this.reachedAmountOrCount=e.reachedAmountOrCount}};var sa=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(e={}){this.animateNumber=e.animateNumber??!0,this.animation=e.animation??"SLOT_MACHINE",this.animationDuration=e.animationDuration??1e3,this.text=e.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=e.iconURL,this.totalSavings=e.totalSavings??0}};var Cr=class{constructor(e,r){this._startTime=e;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e==="test"&&(e="test-"+this.startTime.getTime().toString()),P.IN_APP_WRAPPER_NAME+"-"+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e}closeInApp(e,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=_({eventName:e,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(e,r){this.inputFields.push({id:e,type:r,isValid:!1})}updateValidation(e,r){this.inputFields.forEach(n=>{if(n.id===e){n.isValid=r;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return w.error("Invalid range: min should be less than or equal to max."),e;if(e>=r&&e<=n)return e;let i=e%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}};var tr=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}static parseToAny(e){try{return JSON.parse(e.toString())}catch{}return e.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(e.toString()):e}static async sleep(e){return new Promise(r=>setTimeout(r,e))}static hasKeys(e){return e?Object.keys(e).length>=1:!1}static convertObjectToArray(e,r){return r.reduce((n,i)=>(e.hasOwnProperty(i)&&e[i]!=null&&n.push({[i]:e[i]}),n),[])}static removeNullUndefinedKeys(e){return Object.keys(e).reduce((r,n)=>(e[n]!==null&&e[n]!==void 0&&(r[n]=e[n]),r),{})}static stringify(e){return JSON.stringify(e,function(r,n){return n===void 0?null:n})}};var Ee=class{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart";static MUTED="muted"};var iu=xr(um());function Ti(t){return iu.default.createInstance({name:"lc",storeName:t,driver:iu.default.LOCALSTORAGE})}var yn=class{static storage;static async get(e,r){return await this.storage?.getItem(e)??r}static set(e,r){return this.storage?.setItem(e,r)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var Fo=class Fo extends yn{};ee(Fo,"storeName","ses"),Fo.storage=Ti(Fo.storeName);var vt=Fo;var Ho=class Ho extends yn{};ee(Ho,"storeName","usr"),Ho.storage=Ti(Ho.storeName);var ze=Ho;var fm=xr(pm());var Cv=5,Rv=500,Av=(0,fm.default)(fetch),Dv={retryDelay:t=>Math.pow(2,t)*Rv,retryOn:(t,e,r)=>t>=Cv?!1:!!(e!==null||r?.status&&r?.status>=500)},Vn=class extends Error{request;response;status;requestBody;responseText;constructor(e="Failed to fetch"){super(e),this.name="FetchError",Object.setPrototypeOf(this,new.target.prototype)}is40x(){return!!this.response&&this.response.status>=400&&this.response.status<500}};async function en(t,e,r){let n=Date.now(),i=new Request(t,e),o;try{o=await Av(i,_(_({},Dv),r))}catch{}if(!o||!o.ok){let s=new Vn;throw s.request=i.clone(),s.response=o?.clone(),s.status=o?.status,s.requestBody=e?.body,s.responseText=await Nv(o),s}return{data:await o.json(),status:o.status,statusText:o.statusText,headers:o.headers,timeTakenMs:Date.now()-n,options:e,request:i}}async function Nv(t){if(t){try{return t=t.clone(),await t.json()}catch{}try{return await t.text()}catch{}}}var ce=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var he=globalThis;var Rr="9.42.0";function Wn(){return jn(he),he}function jn(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Rr,e[Rr]=e[Rr]||{}}function tn(t,e,r=he){let n=r.__SENTRY__=r.__SENTRY__||{},i=n[Rr]=n[Rr]||{};return i[t]||(i[t]=e())}var au=["debug","info","warn","error","log","assert","trace"],Ov="Sentry Logger ",xi={};function vn(t){if(!("console"in he))return t();let e=he.console,r={},n=Object.keys(xi);n.forEach(i=>{let o=xi[i];r[i]=e[i],e[i]=o});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function Pv(){lu().enabled=!0}function Lv(){lu().enabled=!1}function mm(){return lu().enabled}function Mv(...t){cu("log",...t)}function Bv(...t){cu("warn",...t)}function Uv(...t){cu("error",...t)}function cu(t,...e){ce&&mm()&&vn(()=>{he.console[t](`${Ov}[${t}]:`,...e)})}function lu(){return ce?tn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var ne={enable:Pv,disable:Lv,isEnabled:mm,log:Mv,warn:Bv,error:Uv};var Ar="?",dm=/\(error: (.*)\)/,hm=/captureMessage|captureException/;function pu(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let o=[],s=r.split(`
26
- `);for(let a=n;a<s.length;a++){let c=s[a];if(c.length>1024)continue;let p=dm.test(c)?c.replace(dm,"$1"):c;if(!p.match(/\S*Error: /)){for(let d of e){let f=d(p);if(f){o.push(f);break}}if(o.length>=50+i)break}}return gm(o.slice(i))}}function gm(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(aa(e).function||"")&&e.pop(),e.reverse(),hm.test(aa(e).function||"")&&(e.pop(),hm.test(aa(e).function||"")&&e.pop()),e.slice(0,50).map(r=>re(_({},r),{filename:r.filename||aa(e).filename,function:r.function||Ar}))}function aa(t){return t[t.length-1]||{}}var uu="<anonymous>";function rr(t){try{return!t||typeof t!="function"?uu:t.name||uu}catch{return uu}}function ca(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 la={},ym={};function Pt(t,e){la[t]=la[t]||[],la[t].push(e)}function Lt(t,e){if(!ym[t]){ym[t]=!0;try{e()}catch(r){ce&&ne.error(`Error while instrumenting ${t}`,r)}}}function ft(t,e){let r=t&&la[t];if(r)for(let n of r)try{n(e)}catch(i){ce&&ne.error(`Error while triggering instrumentation handler.
25
+ Cooee SDK: v${Kr}`,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 Xe=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(e){return e??={},this.gaEnabled=e.gaEnabled,this.gaMeasurementID=e.gaMeasurementID,this.pixelPush=e.pixelPush,this.website=e.website??{},this.currencyCount=e.currencyCount??0,this.money=e.money,this.currency=e.currency,this.storefrontToken=e.storefrontToken,this.skipItemAttribute=e.skipItemAttribute,this}};var bm=Cr(au());var Mo=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let e;try{e=new bm.URLBuilder(location.href)}catch{return{}}let r={};this.UTM_PARAMS.forEach(i=>{let o=e.getQueryParam(i);o&&(r[i]=o)});let n={};return Object.keys(this.TW_PARAMS).forEach(i=>{let o=e.getQueryParam(this.TW_PARAMS[i]);o&&(n[i]=o)}),_(_({},n),r)}};function wm(t,e){return t||""}var Ct=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(e){this.id=e.id,this.mID=e.mID,this.vID=e.vID,this.vName=e.vName,this.imageURL=e.imageURL,this.name=e.name,this.link=e.link,this.quantity=e.quantity,this.price=e.price,this.finalPrice=e.finalPrice??e.price}};function yr(t){let e=new Date(Date.UTC(0,0,0,0,0,0,t)),r=[];return e.getUTCMinutes()&&r.push(e.getUTCMinutes()+"m"),e.getUTCSeconds()&&r.push(e.getUTCSeconds()+"s"),e.getUTCMilliseconds()&&r.push(e.getUTCMilliseconds()+"ms"),r.length||r.push("0ms"),r.join(" ")}var pe=class{constructor(e){this.sdkLoadTime=e}isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;customContext={};activeExperiments;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(e){this._currencyCode=e}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(e){this.currentItem=new Ct(e)}getSDKLoadTimeDiff(){return yr(Date.now()-this.sdkLoadTime.getTime())}};var cu=class{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}};function ia(){let t=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new cu(_({origin:location.origin,path:t,qs:location.search,referrer:Mo.getReferrer(),name:pe.get().pageName},Mo.getUTMParams()))}function Sm(){let t=pe.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");if(r){let i=r.split(",").map(o=>o.trim()).filter(o=>Number.isInteger(+o));i.length&&(t.previewIDs=i)}let n=e.get("cooee-variant")?.trim();n&&(t.previewVariant=n)}var Zt=(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})(Zt||{});var Bo=(function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t})(Bo||{});var lu=(function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t})(lu||{});var Si=(function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t})(Si||{}),er=(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})(er||{});var uu=(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})(uu||{}),Uo=(function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t})(Uo||{}),vr=(function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t.BUY_NOW="BUY_NOW",t.STICKY_ATC="STICKY_ATC",t.EXPERIMENT="EXPERIMENT",t.SAVINGS_BAR="SAVINGS_BAR",t})(vr||{}),ko=(function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t})(ko||{}),pu=(function(t){return t.ICONS="ICONS",t.TILES="TILES",t})(pu||{}),fu=(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})(fu||{});var Xr=class t{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,t.swap(e,r,n)}}};var Im=(()=>{class t{static toTitle(r){return r?this.titleCase(r.toLowerCase().split(/[_-]+/).join(" ")):""}static toSlug(r){return r?r.toLowerCase().replace(/[_-]+/," ").replace(/[^\w ]+/g,"").replace(/ +/g,"-"):""}static toCamelCase(r){return r.toLowerCase().split(" ").map((n,i)=>i===0?n:n.charAt(0).toUpperCase()+n.slice(1)).join("")}static format(r,...n){return r?.replace(/{(\d+)}/g,(i,o)=>{let s=n[o];return s!==void 0?s:i})}static chop(r,n){if(!(!r||!n))return r.length<=n?r:r.substring(0,n)}static titleCase=r=>r.replace(/(^|\s)\S/g,n=>n.toUpperCase())}return t})();var oa=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}};var Fn=class{s;g;i;constructor(e){e.s&&(this.s=new We(e.s)),e.g&&(this.g=new Fo(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var Ho="a-f\\d",Mv=`#?[${Ho}]{3}[${Ho}]?`,Bv=`#?[${Ho}]{6}([${Ho}]{2})?`,Uv=new RegExp(`[^#${Ho}]`,"gi"),kv=new RegExp(`^${Mv}$|^${Bv}$`,"i");function mu(t,e={}){if(typeof t!="string"||Uv.test(t)||!kv.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,o=n>>8&255,s=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,o,s,a];if(e.format==="css"){let c=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${c})`}return{red:i,green:o,blue:s,alpha:a}}var We=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return mu(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var Jr=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new We(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return sa[this.s??1]}},sa=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(sa||{});var Fo=class t{static DEFAULT_FALLBACK=new We({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new We(e.c)),e.fb&&(this.fb=new We(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??t.DEFAULT_FALLBACK}};var $o=class{blur;spr;clr;x;y;constructor(e){e=e??{},this.blur=e.blur??0,this.spr=e.spr??0,this.x=e.x??0,this.y=e.y??0,this.clr=new We(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}};var Qr=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(e){e=e??{},this.pl=e.pl??0,this.pr=e.pr??0,this.pt=e.pt??0,this.pb=e.pb??0,this.ml=e.ml??0,this.mr=e.mr??0,this.mt=e.mt??0,this.mb=e.mb??0,this.cent=e.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}};var Hn=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}};var Ii=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(Ii||{});var aa=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!=="Arial"?e.name:""),this.name=e.name,this.fonts=e.fonts?.map(r=>new du(r))}},du=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}};var lt=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return Ii[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new We(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new We(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new aa(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}};var ca=class{modifications;constructor(e={}){e.modifications?.length?this.modifications=e.modifications.map(r=>new la(r)):e.experiments?.length&&(this.modifications=e.experiments.map(r=>new la(r)))}};var la=class{cssSelector;type;display;bg;typo;br;text;image;constructor(e={}){this.cssSelector=e.cssSelector??"",this.type=e.type??"OTHER",this.display=e.display,e.bg&&(this.bg=new We(e.bg)),e.typo&&(this.typo=new lt(e.typo)),e.br&&(this.br=new Jr(e.br)),this.text=e.text,this.image=e.image}get style(){let e={};return this.display==="HIDE"?e.display="none":this.display==="BLOCK"?e.display="block":this.display==="INLINE"&&(e.display="inline"),this.br?.r&&(e.borderRadius=this.br.r+"px"),this.br?.w&&(e.borderWidth=this.br.w+"px"),this.br?.s&&(e.borderStyle=sa[this.br.s]?.toLowerCase()),this.br?.c?.h&&(e.borderColor=this.br.color?.rgba),this.bg?.h&&(e.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(e.fontSize=this.typo.fs+"px"),this.typo.lh&&(e.lineHeight=this.typo.lh),this.typo.fw&&(e.fontWeight=this.typo.fw),this.typo.ta&&(e.textAlign=this.typo.alignment),this.typo.tc.h&&(e.color=this.typo.tc.rgba),this.typo.ls&&(e.letterSpacing=this.typo.letterSpacing),this.typo.td&&(e.textDecoration=this.typo.td??"none")),e}toString(){return`Experiment(cssSelector=${this.cssSelector})`}};var hu=class{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;constructor(e){this.reached=e.reached??!1,this.calculatedAlignment=e.calculatedAlignment,this.minValue=e.minValue,this.rewardType=e.rewardType,this.label=e.label,this.reachingText=e.reachingText,this.reachedText=e.reachedText,this.discount=e.discount,this.items=e.items?.map(r=>new Ct(r)),this.isUIOnly=e.isUIOnly,this.allowATC=e.allowATC}};var ua=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(e){this.layout=e.layout??pu.ICONS,this.onlyLatestGift=e.onlyLatestGift,this.noConfetti=e.noConfetti,this.removeIneligibleItem=e.removeIneligibleItem??!0,this.restrictToLatestFreebie=e.restrictToLatestFreebie,this.rewardBasis=e.rewardBasis??"CART_AMOUNT",this.update(e)}update(e){e=e??{},this.milestones=e.milestones?.map(r=>new hu(r))??[],this.totalProgress=e.totalProgress??0,this.coupons=e.coupons,this.reachedAmountOrCount=e.reachedAmountOrCount}};var pa=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(e={}){this.animateNumber=e.animateNumber??!0,this.animation=e.animation??"SLOT_MACHINE",this.animationDuration=e.animationDuration??1e3,this.text=e.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=e.iconURL,this.totalSavings=e.totalSavings??0}};var Rr=class{constructor(e,r){this._startTime=e;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e==="test"&&(e="test-"+this.startTime.getTime().toString()),"cooee-wrapper-"+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e}closeInApp(e,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=_({eventName:e,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(e,r){this.inputFields.push({id:e,type:r,isValid:!1})}updateValidation(e,r){this.inputFields.forEach(n=>{if(n.id===e){n.isValid=r;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return b.error("Invalid range: min should be less than or equal to max."),e;if(e>=r&&e<=n)return e;let i=e%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}};var tr=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}static parseToAny(e){try{return JSON.parse(e.toString())}catch{}return e.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(e.toString()):e}static async sleep(e){return new Promise(r=>setTimeout(r,e))}static hasKeys(e){return e?Object.keys(e).length>=1:!1}static convertObjectToArray(e,r){return r.reduce((n,i)=>(e.hasOwnProperty(i)&&e[i]!=null&&n.push({[i]:e[i]}),n),[])}static removeNullUndefinedKeys(e){return Object.keys(e).reduce((r,n)=>(e[n]!==null&&e[n]!==void 0&&(r[n]=e[n]),r),{})}static stringify(e){return JSON.stringify(e,function(r,n){return n===void 0?null:n})}};var yu=Cr(xm());function Ti(t){return yu.default.createInstance({name:"lc",storeName:t,driver:yu.default.LOCALSTORAGE})}var gn=class{static storage;static async get(e,r){return await this.storage?.getItem(e)??r}static set(e,r){return this.storage?.setItem(e,r)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var Vo=class Vo extends gn{};bi(Vo,"storeName","ses"),Vo.storage=Ti(Vo.storeName);var gt=Vo;var Wo=class Wo extends gn{};bi(Wo,"storeName","usr"),Wo.storage=Ti(Wo.storeName);var ze=Wo;var Rm=Cr(Cm());var Fv=5,Hv=500,$v=(0,Rm.default)(fetch),Vv={retryDelay:t=>Math.pow(2,t)*Hv,retryOn:(t,e,r)=>t>=Fv?!1:!!(e!==null||r?.status&&r?.status>=500)},$n=class extends Error{request;response;status;requestBody;responseText;constructor(e="Failed to fetch"){super(e),this.name="FetchError",Object.setPrototypeOf(this,new.target.prototype)}is40x(){return!!this.response&&this.response.status>=400&&this.response.status<500}};async function Zr(t,e,r){let n=Date.now(),i=new Request(t,e),o;try{o=await $v(i,_(_({},Vv),r))}catch{}if(!o||!o.ok){let d=new $n;throw d.request=i.clone(),d.response=o?.clone(),d.status=o?.status,d.requestBody=e?.body,d.responseText=await Wv(o),d}let s,a=(o.headers.get("content-type")||"").toLowerCase(),c=o.headers.get("content-length"),p=i.method?.toUpperCase()||"GET";return o.status===204||o.status===205||p==="HEAD"||c==="0"?s=void 0:a.includes("application/json")||a.includes("application/problem+json")||a.includes("text/javascript")?s=await o.json():a.includes("text/")||a.includes("image/svg+xml")?s=await o.text():s=await o.arrayBuffer(),{data:s,status:o.status,statusText:o.statusText,headers:o.headers,timeTakenMs:Date.now()-n,options:e,request:i}}async function Wv(t){if(t){try{return t=t.clone(),await t.json()}catch{}try{return await t.text()}catch{}}}var oe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var fe=globalThis;var Ar="9.42.0";function Vn(){return Wn(fe),fe}function Wn(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Ar,e[Ar]=e[Ar]||{}}function en(t,e,r=fe){let n=r.__SENTRY__=r.__SENTRY__||{},i=n[Ar]=n[Ar]||{};return i[t]||(i[t]=e())}var _u=["debug","info","warn","error","log","assert","trace"],jv="Sentry Logger ",xi={};function yn(t){if(!("console"in fe))return t();let e=fe.console,r={},n=Object.keys(xi);n.forEach(i=>{let o=xi[i];r[i]=e[i],e[i]=o});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function Gv(){wu().enabled=!0}function Yv(){wu().enabled=!1}function Am(){return wu().enabled}function qv(...t){bu("log",...t)}function zv(...t){bu("warn",...t)}function Kv(...t){bu("error",...t)}function bu(t,...e){oe&&Am()&&yn(()=>{fe.console[t](`${jv}[${t}]:`,...e)})}function wu(){return oe?en("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var ee={enable:Gv,disable:Yv,isEnabled:Am,log:qv,warn:zv,error:Kv};var Dm=/\(error: (.*)\)/,Om=/captureMessage|captureException/;function Iu(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let o=[],s=r.split(`
26
+ `);for(let a=n;a<s.length;a++){let c=s[a];if(c.length>1024)continue;let p=Dm.test(c)?c.replace(Dm,"$1"):c;if(!p.match(/\S*Error: /)){for(let d of e){let f=d(p);if(f){o.push(f);break}}if(o.length>=50+i)break}}return Nm(o.slice(i))}}function Nm(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(fa(e).function||"")&&e.pop(),e.reverse(),Om.test(fa(e).function||"")&&(e.pop(),Om.test(fa(e).function||"")&&e.pop()),e.slice(0,50).map(r=>Z(_({},r),{filename:r.filename||fa(e).filename,function:r.function||"?"}))}function fa(t){return t[t.length-1]||{}}var Su="<anonymous>";function rr(t){try{return!t||typeof t!="function"?Su:t.name||Su}catch{return Su}}function ma(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 da={},Pm={};function Ot(t,e){da[t]=da[t]||[],da[t].push(e)}function Nt(t,e){if(!Pm[t]){Pm[t]=!0;try{e()}catch(r){oe&&ee.error(`Error while instrumenting ${t}`,r)}}}function ut(t,e){let r=t&&da[t];if(r)for(let n of r)try{n(e)}catch(i){oe&&ee.error(`Error while triggering instrumentation handler.
27
27
  Type: ${t}
28
28
  Name: ${rr(n)}
29
- Error:`,i)}}var fu=null;function mu(t){let e="error";Pt(e,t),Lt(e,kv)}function kv(){fu=he.onerror,he.onerror=function(t,e,r,n,i){return ft("error",{column:n,error:i,line:r,msg:t,url:e}),fu?fu.apply(this,arguments):!1},he.onerror.__SENTRY_INSTRUMENTED__=!0}var du=null;function hu(t){let e="unhandledrejection";Pt(e,t),Lt(e,Fv)}function Fv(){du=he.onunhandledrejection,he.onunhandledrejection=function(t){return ft("unhandledrejection",t),du?du.apply(this,arguments):!0},he.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var vm=Object.prototype.toString;function Gn(t){switch(vm.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return vr(t,Error)}}function Ci(t,e){return vm.call(t)===`[object ${e}]`}function ua(t){return Ci(t,"ErrorEvent")}function pa(t){return Ci(t,"DOMError")}function gu(t){return Ci(t,"DOMException")}function Mt(t){return Ci(t,"String")}function Ri(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Yn(t){return t===null||Ri(t)||typeof t!="object"&&typeof t!="function"}function rn(t){return Ci(t,"Object")}function zn(t){return typeof Event<"u"&&vr(t,Event)}function yu(t){return typeof Element<"u"&&vr(t,Element)}function vu(t){return Ci(t,"RegExp")}function nn(t){return!!(t?.then&&typeof t.then=="function")}function Eu(t){return rn(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function vr(t,e){try{return t instanceof e}catch{return!1}}function $o(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Em(t){return typeof Request<"u"&&vr(t,Request)}var _u=he,Hv=80;function Vo(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],o=0,s=0,a=" > ",c=a.length,p,d=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||Hv;for(;r&&o++<n&&(p=$v(r,d),!(p==="html"||o>1&&s+i.length*c+p.length>=f));)i.push(p),s+=p.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function $v(t,e){let r=t,n=[];if(!r?.tagName)return"";if(_u.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e?.length?e.filter(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(i?.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let s=r.className;if(s&&Mt(s)){let a=s.split(/\s+/);for(let c of a)n.push(`.${c}`)}}let o=["aria-label","type","name","title","alt"];for(let s of o){let a=r.getAttribute(s);a&&n.push(`[${s}="${a}"]`)}return n.join("")}function Wo(){try{return _u.document.location.href}catch{return""}}function bu(t){if(!_u.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function En(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function fa(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{$o(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function _m(t,e,r=!1){return Mt(t)?vu(e)?e.test(t):Mt(e)?r?t===e:t.includes(e):!1:!1}function Ai(t,e=[],r=!1){return e.some(n=>_m(t,n,r))}function mt(t,e,r){if(!(e in t))return;let n=t[e];if(typeof n!="function")return;let i=r(n);typeof i=="function"&&ma(i,n);try{t[e]=i}catch{ce&&ne.log(`Failed to replace method "${e}" in object`,t)}}function zt(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{ce&&ne.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ma(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,zt(t,"__sentry_original__",e)}catch{}}function qn(t){return t.__sentry_original__}function da(t){if(Gn(t))return _({message:t.message,name:t.name,stack:t.stack},wm(t));if(zn(t)){let e=_({type:t.type,target:bm(t.target),currentTarget:bm(t.currentTarget)},wm(t));return typeof CustomEvent<"u"&&vr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function bm(t){try{return yu(t)?Vo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function wm(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 wu(t,e=40){let r=Object.keys(da(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return En(n,e);for(let i=r.length;i>0;i--){let o=r.slice(0,i).join(", ");if(!(o.length>e))return i===r.length?o:En(o,e)}return""}function Vv(){let t=he;return t.crypto||t.msCrypto}function dt(t=Vv()){let e=()=>Math.random()*16;try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{let r=new Uint8Array(1);return t.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(e()&15)>>r/4).toString(16))}function Sm(t){return t.exception?.values?.[0]}function Dr(t){let{message:e,event_id:r}=t;if(e)return e;let n=Sm(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function Di(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=r||"Error")}function Nr(t,e){let r=Sm(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=_(_(_({},n),i),e),e&&"data"in e){let o=_(_({},i?.data),e.data);r.mechanism.data=o}}function ha(t){if(Wv(t))return!0;try{zt(t,"__sentry_captured__",!0)}catch{}return!1}function Wv(t){try{return t.__sentry_captured__}catch{}}var Tm=1e3;function Or(){return Date.now()/Tm}function jv(){let{performance:t}=he;if(!t?.now||!t.timeOrigin)return Or;let e=t.timeOrigin;return()=>(e+t.now())/Tm}var Im;function Ft(){return(Im??(Im=jv()))()}function xm(t){let e=Ft(),r={sid:dt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Gv(r)};return t&&on(r,t),r}function on(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||Ft(),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:dt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Cm(t,e){let r={};e?r={status:e}:t.status==="ok"&&(r={status:"exited"}),on(t,r)}function Gv(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function _n(t,e,r=2){if(!e||typeof e!="object"||r<=0)return e;if(t&&Object.keys(e).length===0)return t;let n=_({},t);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=_n(n[i],e[i],r-1));return n}function Su(){return dt()}function ga(){return dt().substring(16)}var Iu="_sentrySpan";function Tu(t,e){e?zt(t,Iu,e):delete t[Iu]}function xu(t){return t[Iu]}var Yv=100,Tt=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Su(),sampleRand:Math.random()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags=_({},this._tags),e._extra=_({},this._extra),e._contexts=_({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata=_({},this._sdkProcessingMetadata),e._propagationContext=_({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,Tu(e,xu(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&&on(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags=_(_({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=re(_({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=_(_({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=re(_({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,n=r instanceof t?r.getScopeData():rn(r)?e:void 0,{tags:i,extra:o,user:s,contexts:a,level:c,fingerprint:p=[],propagationContext:d}=n||{};return this._tags=_(_({},this._tags),i),this._extra=_(_({},this._extra),o),this._contexts=_(_({},this._contexts),a),s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,Tu(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Su(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:Yv;if(n<=0)return this;let i=re(_({timestamp:Or()},e),{message:e.message?En(e.message,2048):e.message});return this._breadcrumbs.push(i),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:xu(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=_n(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r?.event_id||dt();if(!this._client)return ce&&ne.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,re(_({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n?.event_id||dt();if(!this._client)return ce&&ne.warn("No client configured on scope - will not capture message!"),i;let o=new Error(e);return this._client.captureMessage(e,r,re(_({originalException:e,syntheticException:o},n),{event_id:i}),this),i}captureEvent(e,r){let n=r?.event_id||dt();return this._client?(this._client.captureEvent(e,re(_({},r),{event_id:n}),this),n):(ce&&ne.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function Rm(){return tn("defaultCurrentScope",()=>new Tt)}function Am(){return tn("defaultIsolationScope",()=>new Tt)}var Cu=class{constructor(e,r){let n;e?n=e:n=new Tt;let i;r?i=r:i=new Tt,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){let r=this._pushScope(),n;try{n=e(r)}catch(i){throw this._popScope(),i}return nn(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Ni(){let t=Wn(),e=jn(t);return e.stack=e.stack||new Cu(Rm(),Am())}function zv(t){return Ni().withScope(t)}function qv(t,e){let r=Ni();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function Dm(t){return Ni().withScope(()=>t(Ni().getIsolationScope()))}function Nm(){return{withIsolationScope:Dm,withScope:zv,withSetScope:qv,withSetIsolationScope:(t,e)=>Dm(e),getCurrentScope:()=>Ni().getScope(),getIsolationScope:()=>Ni().getIsolationScope()}}function ya(t){let e=jn(t);return e.acs?e.acs:Nm()}function Er(){let t=Wn();return ya(t).getCurrentScope()}function Pr(){let t=Wn();return ya(t).getIsolationScope()}function va(){return tn("globalScope",()=>new Tt)}function jo(...t){let e=Wn(),r=ya(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function qe(){return Er().getClient()}function Ru(t){let e=t.getPropagationContext(),{traceId:r,parentSpanId:n,propagationSpanId:i}=e,o={trace_id:r,span_id:i||ga()};return n&&(o.parent_span_id=n),o}var Ea="sentry.source",Au="sentry.sample_rate",Om="sentry.previous_trace_sample_rate",Du="sentry.op",Nu="sentry.origin";var Ou="sentry.profile_id",Pu="sentry.exclusive_time";var Kv="_sentryScope",Xv="_sentryIsolationScope";function _a(t){return{scope:t[Kv],isolationScope:t[Xv]}}var Jv="sentry-",Qv=/^sentry-/;function Lm(t){let e=Zv(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,o])=>{if(i.match(Qv)){let s=i.slice(Jv.length);n[s]=o}return n},{});if(Object.keys(r).length>0)return r}function Zv(t){if(!(!t||!Mt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=Pm(r);return Object.entries(n).forEach(([i,o])=>{e[i]=o}),e},{}):Pm(t)}function Pm(t){return t.split(",").map(e=>e.split("=").map(r=>{try{return decodeURIComponent(r.trim())}catch{return}})).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function Mm(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var Fm=1,Bm=!1;function Lu(t){let{spanId:e,traceId:r,isRemote:n}=t.spanContext(),i=n?e:Oi(t).parent_span_id,o=_a(t).scope,s=n?o?.getPropagationContext().propagationSpanId||ga():e;return{parent_span_id:i,span_id:s,trace_id:r}}function eE(t){if(t&&t.length>0)return t.map(s=>{var a=s,{context:c}=a,p=c,{spanId:e,traceId:r,traceFlags:n}=p,i=em(p,["spanId","traceId","traceFlags"]),{attributes:o}=a;return _({span_id:e,trace_id:r,sampled:n===Fm,attributes:o},i)})}function Um(t){return typeof t=="number"?km(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?km(t.getTime()):Ft()}function km(t){return t>9999999999?t/1e3:t}function Oi(t){if(rE(t))return t.getSpanJSON();let{spanId:e,traceId:r}=t.spanContext();if(tE(t)){let{attributes:n,startTime:i,name:o,endTime:s,status:a,links:c}=t,p="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:r,data:n,description:o,parent_span_id:p,start_timestamp:Um(i),timestamp:Um(s)||void 0,status:nE(a),op:n[Du],origin:n[Nu],links:eE(c)}}return{span_id:e,trace_id:r,start_timestamp:0,data:{}}}function tE(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function rE(t){return typeof t.getSpanJSON=="function"}function Hm(t){let{traceFlags:e}=t.spanContext();return e===Fm}function nE(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var iE="_sentryRootSpan";function Go(t){return t[iE]||t}function Mu(){Bm||(vn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),Bm=!0)}function $m(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||qe()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}var Pi="production";var oE=/^o(\d+)\./,sE=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function aE(t){return t==="http"||t==="https"}function bn(t,e=!1){let{host:r,path:n,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${s}`}function cE(t){let e=sE.exec(t);if(!e){vn(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",o="",s="",a=""]=e.slice(1),c="",p=a,d=p.split("/");if(d.length>1&&(c=d.slice(0,-1).join("/"),p=d.pop()),p){let f=p.match(/^\d+/);f&&(p=f[0])}return Vm({host:o,pass:i,path:c,projectId:p,port:s,protocol:r,publicKey:n})}function Vm(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function lE(t){if(!ce)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(ne.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?aE(n)?e&&isNaN(parseInt(e,10))?(ne.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(ne.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(ne.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function Wm(t){return t.match(oE)?.[1]}function jm(t){let e=typeof t=="string"?cE(t):Vm(t);if(!(!e||!lE(e)))return e}var uE="_frozenDsc";function Gm(t,e){let r=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{},o;r.orgId?o=String(r.orgId):i&&(o=Wm(i));let s={environment:r.environment||Pi,release:r.release,public_key:n,trace_id:t,org_id:o};return e.emit("createDsc",s),s}function Ym(t,e){let r=e.getPropagationContext();return r.dsc||Gm(r.traceId,t)}function Bu(t){let e=qe();if(!e)return{};let r=Go(t),n=Oi(r),i=n.data,o=r.spanContext().traceState,s=o?.get("sentry.sample_rate")??i[Au]??i[Om];function a(I){return(typeof s=="number"||typeof s=="string")&&(I.sample_rate=`${s}`),I}let c=r[uE];if(c)return a(c);let p=o?.get("sentry.dsc"),d=p&&Lm(p);if(d)return a(d);let f=Gm(t.spanContext().traceId,e),E=i[Ea],y=n.description;return E!=="url"&&y&&(f.transaction=y),$m()&&(f.sampled=String(Hm(r)),f.sample_rand=o?.get("sentry.sample_rand")??_a(r).scope?.getPropagationContext().sampleRand.toString()),a(f),e.emit("createDsc",f,r),f}function nr(t,e=100,r=1/0){try{return Uu("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function ba(t,e=3,r=100*1024){let n=nr(t,e);return dE(n)>r?ba(t,e-1,r):n}function Uu(t,e,r=1/0,n=1/0,i=hE()){let[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=pE(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(c===0)return a.replace("object ","");if(o(e))return"[Circular ~]";let p=e;if(p&&typeof p.toJSON=="function")try{let y=p.toJSON();return Uu("",y,c-1,n,i)}catch{}let d=Array.isArray(e)?[]:{},f=0,E=da(e);for(let y in E){if(!Object.prototype.hasOwnProperty.call(E,y))continue;if(f>=n){d[y]="[MaxProperties ~]";break}let I=E[y];d[y]=Uu(y,I,c-1,n,i),f++}return s(e),d}function pE(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($o(e))return"[VueViewModel]";if(Eu(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${rr(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=fE(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function fE(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function mE(t){return~-encodeURI(t).split(/%..|./).length}function dE(t){return mE(JSON.stringify(t))}function hE(){let t=new WeakSet;function e(n){return t.has(n)?!0:(t.add(n),!1)}function r(n){t.delete(n)}return[e,r]}function sn(t,e=[]){return[t,e]}function zm(t,e){let[r,n]=t;return[r,[...n,e]]}function Fu(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 ku(t){let e=jn(he);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function qm(t){let[e,r]=t,n=JSON.stringify(e);function i(o){typeof n=="string"?n=typeof o=="string"?n+o:[ku(n),o]:n.push(typeof o=="string"?ku(o):o)}for(let o of r){let[s,a]=o;if(i(`
29
+ Error:`,i)}}var Tu=null;function xu(t){let e="error";Ot(e,t),Nt(e,Xv)}function Xv(){Tu=fe.onerror,fe.onerror=function(t,e,r,n,i){return ut("error",{column:n,error:i,line:r,msg:t,url:e}),Tu?Tu.apply(this,arguments):!1},fe.onerror.__SENTRY_INSTRUMENTED__=!0}var Cu=null;function Ru(t){let e="unhandledrejection";Ot(e,t),Nt(e,Jv)}function Jv(){Cu=fe.onunhandledrejection,fe.onunhandledrejection=function(t){return ut("unhandledrejection",t),Cu?Cu.apply(this,arguments):!0},fe.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var Lm=Object.prototype.toString;function jn(t){switch(Lm.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Er(t,Error)}}function Ci(t,e){return Lm.call(t)===`[object ${e}]`}function ha(t){return Ci(t,"ErrorEvent")}function ga(t){return Ci(t,"DOMError")}function Au(t){return Ci(t,"DOMException")}function Pt(t){return Ci(t,"String")}function Ri(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Gn(t){return t===null||Ri(t)||typeof t!="object"&&typeof t!="function"}function tn(t){return Ci(t,"Object")}function Yn(t){return typeof Event<"u"&&Er(t,Event)}function Du(t){return typeof Element<"u"&&Er(t,Element)}function Ou(t){return Ci(t,"RegExp")}function rn(t){return!!(t?.then&&typeof t.then=="function")}function Nu(t){return tn(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Er(t,e){try{return t instanceof e}catch{return!1}}function jo(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Mm(t){return typeof Request<"u"&&Er(t,Request)}var Pu=fe,Qv=80;function Go(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],o=0,s=0,a=" > ",c=a.length,p,d=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||Qv;for(;r&&o++<n&&(p=Zv(r,d),!(p==="html"||o>1&&s+i.length*c+p.length>=f));)i.push(p),s+=p.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Zv(t,e){let r=t,n=[];if(!r?.tagName)return"";if(Pu.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e?.length?e.filter(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(i?.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let s=r.className;if(s&&Pt(s)){let a=s.split(/\s+/);for(let c of a)n.push(`.${c}`)}}let o=["aria-label","type","name","title","alt"];for(let s of o){let a=r.getAttribute(s);a&&n.push(`[${s}="${a}"]`)}return n.join("")}function Yo(){try{return Pu.document.location.href}catch{return""}}function Lu(t){if(!Pu.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function vn(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function ya(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{jo(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function Bm(t,e,r=!1){return Pt(t)?Ou(e)?e.test(t):Pt(e)?r?t===e:t.includes(e):!1:!1}function Ai(t,e=[],r=!1){return e.some(n=>Bm(t,n,r))}function pt(t,e,r){if(!(e in t))return;let n=t[e];if(typeof n!="function")return;let i=r(n);typeof i=="function"&&va(i,n);try{t[e]=i}catch{oe&&ee.log(`Failed to replace method "${e}" in object`,t)}}function qt(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{oe&&ee.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function va(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,qt(t,"__sentry_original__",e)}catch{}}function qn(t){return t.__sentry_original__}function Ea(t){if(jn(t))return _({message:t.message,name:t.name,stack:t.stack},km(t));if(Yn(t)){let e=_({type:t.type,target:Um(t.target),currentTarget:Um(t.currentTarget)},km(t));return typeof CustomEvent<"u"&&Er(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Um(t){try{return Du(t)?Go(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function km(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 Mu(t,e=40){let r=Object.keys(Ea(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return vn(n,e);for(let i=r.length;i>0;i--){let o=r.slice(0,i).join(", ");if(!(o.length>e))return i===r.length?o:vn(o,e)}return""}function eE(){let t=fe;return t.crypto||t.msCrypto}function ft(t=eE()){let e=()=>Math.random()*16;try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{let r=new Uint8Array(1);return t.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(e()&15)>>r/4).toString(16))}function Fm(t){return t.exception?.values?.[0]}function Dr(t){let{message:e,event_id:r}=t;if(e)return e;let n=Fm(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function Di(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=r||"Error")}function Or(t,e){let r=Fm(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=_(_(_({},n),i),e),e&&"data"in e){let o=_(_({},i?.data),e.data);r.mechanism.data=o}}function _a(t){if(tE(t))return!0;try{qt(t,"__sentry_captured__",!0)}catch{}return!1}function tE(t){try{return t.__sentry_captured__}catch{}}var $m=1e3;function Nr(){return Date.now()/$m}function rE(){let{performance:t}=fe;if(!t?.now||!t.timeOrigin)return Nr;let e=t.timeOrigin;return()=>(e+t.now())/$m}var Hm;function Ut(){return(Hm??(Hm=rE()))()}function Vm(t){let e=Ut(),r={sid:ft(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>nE(r)};return t&&nn(r,t),r}function nn(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||Ut(),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:ft()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Wm(t,e){let r={};e?r={status:e}:t.status==="ok"&&(r={status:"exited"}),nn(t,r)}function nE(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function En(t,e,r=2){if(!e||typeof e!="object"||r<=0)return e;if(t&&Object.keys(e).length===0)return t;let n=_({},t);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=En(n[i],e[i],r-1));return n}function Bu(){return ft()}function ba(){return ft().substring(16)}var Uu="_sentrySpan";function ku(t,e){e?qt(t,Uu,e):delete t[Uu]}function Fu(t){return t[Uu]}var iE=100,St=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Bu(),sampleRand:Math.random()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags=_({},this._tags),e._extra=_({},this._extra),e._contexts=_({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata=_({},this._sdkProcessingMetadata),e._propagationContext=_({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,ku(e,Fu(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&&nn(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags=_(_({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=Z(_({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=_(_({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=Z(_({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,n=r instanceof t?r.getScopeData():tn(r)?e:void 0,{tags:i,extra:o,user:s,contexts:a,level:c,fingerprint:p=[],propagationContext:d}=n||{};return this._tags=_(_({},this._tags),i),this._extra=_(_({},this._extra),o),this._contexts=_(_({},this._contexts),a),s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,ku(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Bu(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:iE;if(n<=0)return this;let i=Z(_({timestamp:Nr()},e),{message:e.message?vn(e.message,2048):e.message});return this._breadcrumbs.push(i),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Fu(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=En(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r?.event_id||ft();if(!this._client)return oe&&ee.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,Z(_({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n?.event_id||ft();if(!this._client)return oe&&ee.warn("No client configured on scope - will not capture message!"),i;let o=new Error(e);return this._client.captureMessage(e,r,Z(_({originalException:e,syntheticException:o},n),{event_id:i}),this),i}captureEvent(e,r){let n=r?.event_id||ft();return this._client?(this._client.captureEvent(e,Z(_({},r),{event_id:n}),this),n):(oe&&ee.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function jm(){return en("defaultCurrentScope",()=>new St)}function Gm(){return en("defaultIsolationScope",()=>new St)}var Hu=class{constructor(e,r){let n;e?n=e:n=new St;let i;r?i=r:i=new St,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){let r=this._pushScope(),n;try{n=e(r)}catch(i){throw this._popScope(),i}return rn(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Oi(){let t=Vn(),e=Wn(t);return e.stack=e.stack||new Hu(jm(),Gm())}function oE(t){return Oi().withScope(t)}function sE(t,e){let r=Oi();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function Ym(t){return Oi().withScope(()=>t(Oi().getIsolationScope()))}function qm(){return{withIsolationScope:Ym,withScope:oE,withSetScope:sE,withSetIsolationScope:(t,e)=>Ym(e),getCurrentScope:()=>Oi().getScope(),getIsolationScope:()=>Oi().getIsolationScope()}}function wa(t){let e=Wn(t);return e.acs?e.acs:qm()}function _r(){let t=Vn();return wa(t).getCurrentScope()}function Pr(){let t=Vn();return wa(t).getIsolationScope()}function Sa(){return en("globalScope",()=>new St)}function qo(...t){let e=Vn(),r=wa(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function je(){return _r().getClient()}function $u(t){let e=t.getPropagationContext(),{traceId:r,parentSpanId:n,propagationSpanId:i}=e,o={trace_id:r,span_id:i||ba()};return n&&(o.parent_span_id=n),o}var Ia="sentry.source",Vu="sentry.sample_rate",zm="sentry.previous_trace_sample_rate",Wu="sentry.op",ju="sentry.origin";var Gu="sentry.profile_id",Yu="sentry.exclusive_time";var aE="_sentryScope",cE="_sentryIsolationScope";function Ta(t){return{scope:t[aE],isolationScope:t[cE]}}var lE="sentry-",uE=/^sentry-/;function Xm(t){let e=pE(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,o])=>{if(i.match(uE)){let s=i.slice(lE.length);n[s]=o}return n},{});if(Object.keys(r).length>0)return r}function pE(t){if(!(!t||!Pt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=Km(r);return Object.entries(n).forEach(([i,o])=>{e[i]=o}),e},{}):Km(t)}function Km(t){return t.split(",").map(e=>e.split("=").map(r=>{try{return decodeURIComponent(r.trim())}catch{return}})).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function Jm(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var td=1,Qm=!1;function qu(t){let{spanId:e,traceId:r,isRemote:n}=t.spanContext(),i=n?e:Ni(t).parent_span_id,o=Ta(t).scope,s=n?o?.getPropagationContext().propagationSpanId||ba():e;return{parent_span_id:i,span_id:s,trace_id:r}}function fE(t){if(t&&t.length>0)return t.map(s=>{var a=s,{context:c}=a,p=c,{spanId:e,traceId:r,traceFlags:n}=p,i=fm(p,["spanId","traceId","traceFlags"]),{attributes:o}=a;return _({span_id:e,trace_id:r,sampled:n===td,attributes:o},i)})}function Zm(t){return typeof t=="number"?ed(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?ed(t.getTime()):Ut()}function ed(t){return t>9999999999?t/1e3:t}function Ni(t){if(dE(t))return t.getSpanJSON();let{spanId:e,traceId:r}=t.spanContext();if(mE(t)){let{attributes:n,startTime:i,name:o,endTime:s,status:a,links:c}=t,p="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:r,data:n,description:o,parent_span_id:p,start_timestamp:Zm(i),timestamp:Zm(s)||void 0,status:hE(a),op:n[Wu],origin:n[ju],links:fE(c)}}return{span_id:e,trace_id:r,start_timestamp:0,data:{}}}function mE(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function dE(t){return typeof t.getSpanJSON=="function"}function rd(t){let{traceFlags:e}=t.spanContext();return e===td}function hE(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var gE="_sentryRootSpan";function zo(t){return t[gE]||t}function zu(){Qm||(yn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),Qm=!0)}function nd(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||je()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}var Pi="production";var yE=/^o(\d+)\./,vE=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function EE(t){return t==="http"||t==="https"}function _n(t,e=!1){let{host:r,path:n,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${s}`}function _E(t){let e=vE.exec(t);if(!e){yn(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",o="",s="",a=""]=e.slice(1),c="",p=a,d=p.split("/");if(d.length>1&&(c=d.slice(0,-1).join("/"),p=d.pop()),p){let f=p.match(/^\d+/);f&&(p=f[0])}return id({host:o,pass:i,path:c,projectId:p,port:s,protocol:r,publicKey:n})}function id(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function bE(t){if(!oe)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(ee.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?EE(n)?e&&isNaN(parseInt(e,10))?(ee.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(ee.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(ee.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function od(t){return t.match(yE)?.[1]}function sd(t){let e=typeof t=="string"?_E(t):id(t);if(!(!e||!bE(e)))return e}var wE="_frozenDsc";function ad(t,e){let r=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{},o;r.orgId?o=String(r.orgId):i&&(o=od(i));let s={environment:r.environment||Pi,release:r.release,public_key:n,trace_id:t,org_id:o};return e.emit("createDsc",s),s}function cd(t,e){let r=e.getPropagationContext();return r.dsc||ad(r.traceId,t)}function Ku(t){let e=je();if(!e)return{};let r=zo(t),n=Ni(r),i=n.data,o=r.spanContext().traceState,s=o?.get("sentry.sample_rate")??i[Vu]??i[zm];function a(I){return(typeof s=="number"||typeof s=="string")&&(I.sample_rate=`${s}`),I}let c=r[wE];if(c)return a(c);let p=o?.get("sentry.dsc"),d=p&&Xm(p);if(d)return a(d);let f=ad(t.spanContext().traceId,e),E=i[Ia],y=n.description;return E!=="url"&&y&&(f.transaction=y),nd()&&(f.sampled=String(rd(r)),f.sample_rand=o?.get("sentry.sample_rand")??Ta(r).scope?.getPropagationContext().sampleRand.toString()),a(f),e.emit("createDsc",f,r),f}function nr(t,e=100,r=1/0){try{return Xu("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function xa(t,e=3,r=100*1024){let n=nr(t,e);return xE(n)>r?xa(t,e-1,r):n}function Xu(t,e,r=1/0,n=1/0,i=CE()){let[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=SE(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(c===0)return a.replace("object ","");if(o(e))return"[Circular ~]";let p=e;if(p&&typeof p.toJSON=="function")try{let y=p.toJSON();return Xu("",y,c-1,n,i)}catch{}let d=Array.isArray(e)?[]:{},f=0,E=Ea(e);for(let y in E){if(!Object.prototype.hasOwnProperty.call(E,y))continue;if(f>=n){d[y]="[MaxProperties ~]";break}let I=E[y];d[y]=Xu(y,I,c-1,n,i),f++}return s(e),d}function SE(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(jo(e))return"[VueViewModel]";if(Nu(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${rr(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=IE(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function IE(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function TE(t){return~-encodeURI(t).split(/%..|./).length}function xE(t){return TE(JSON.stringify(t))}function CE(){let t=new WeakSet;function e(n){return t.has(n)?!0:(t.add(n),!1)}function r(n){t.delete(n)}return[e,r]}function on(t,e=[]){return[t,e]}function ld(t,e){let[r,n]=t;return[r,[...n,e]]}function Qu(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 Ju(t){let e=Wn(fe);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function ud(t){let[e,r]=t,n=JSON.stringify(e);function i(o){typeof n=="string"?n=typeof o=="string"?n+o:[Ju(n),o]:n.push(typeof o=="string"?Ju(o):o)}for(let o of r){let[s,a]=o;if(i(`
30
30
  ${JSON.stringify(s)}
31
- `),typeof a=="string"||a instanceof Uint8Array)i(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(nr(a))}i(c)}}return typeof n=="string"?n:gE(n)}function gE(t){let e=t.reduce((i,o)=>i+o.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function Km(t){let e=typeof t.data=="string"?ku(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var yE={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Hu(t){return yE[t]}function $u(t){if(!t?.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function Xm(t,e,r,n){let i=t.sdkProcessingMetadata?.dynamicSamplingContext;return _(_(_({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:bn(n)}),i&&{trace:i})}function vE(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 Jm(t,e,r,n){let i=$u(r),o=_(_({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:bn(e)}),s="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return sn(o,[s])}function Qm(t,e,r,n){let i=$u(r),o=t.type&&t.type!=="replay_event"?t.type:"event";vE(t,r?.sdk);let s=Xm(t,i,n,e);return delete t.sdkProcessingMetadata,sn(s,[[{type:o},t]])}var Vu=0,Zm=1,ed=2;function ir(t){return new _r(e=>{e(t)})}function wn(t){return new _r((e,r)=>{r(t)})}var _r=class t{constructor(e){this._state=Vu,this._handlers=[],this._runExecutor(e)}then(e,r){return new t((n,i)=>{this._handlers.push([!1,o=>{if(!e)n(o);else try{n(e(o))}catch(s){i(s)}},o=>{if(!r)i(o);else try{n(r(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new t((r,n)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{if(o){n(i);return}r(i)})})}_executeHandlers(){if(this._state===Vu)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Zm&&r[1](this._value),this._state===ed&&r[2](this._value),r[0]=!0)})}_runExecutor(e){let r=(o,s)=>{if(this._state===Vu){if(nn(s)){s.then(n,i);return}this._state=o,this._value=s,this._executeHandlers()}},n=o=>{r(Zm,o)},i=o=>{r(ed,o)};try{e(n,i)}catch(o){i(o)}}};function wa(t,e,r,n=0){return new _r((i,o)=>{let s=t[n];if(e===null||typeof s!="function")i(e);else{let a=s(_({},e),r);ce&&s.id&&a===null&&ne.log(`Event processor "${s.id}" dropped event`),nn(a)?a.then(c=>wa(t,c,r,n+1).then(i)).then(null,o):wa(t,a,r,n+1).then(i).then(null,o)}})}function td(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=e;EE(t,e),n&&wE(t,n),SE(t,r),_E(t,i),bE(t,o)}function Wu(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:p,eventProcessors:d,attachments:f,propagationContext:E,transactionName:y,span:I}=e;Sa(t,"extra",r),Sa(t,"tags",n),Sa(t,"user",i),Sa(t,"contexts",o),t.sdkProcessingMetadata=_n(t.sdkProcessingMetadata,a,2),s&&(t.level=s),y&&(t.transactionName=y),I&&(t.span=I),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext=_(_({},t.propagationContext),E)}function Sa(t,e,r){t[e]=_n(t[e],r,1)}function EE(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(r).length&&(t.extra=_(_({},r),t.extra)),Object.keys(n).length&&(t.tags=_(_({},n),t.tags)),Object.keys(i).length&&(t.user=_(_({},i),t.user)),Object.keys(o).length&&(t.contexts=_(_({},o),t.contexts)),s&&(t.level=s),a&&t.type!=="transaction"&&(t.transaction=a)}function _E(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function bE(t,e){t.sdkProcessingMetadata=_(_({},t.sdkProcessingMetadata),e)}function wE(t,e){t.contexts=_({trace:Lu(e)},t.contexts),t.sdkProcessingMetadata=_({dynamicSamplingContext:Bu(e)},t.sdkProcessingMetadata);let r=Go(e),n=Oi(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function SE(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}var Ia,rd,Ta;function nd(t){let e=he._sentryDebugIds;if(!e)return{};let r=Object.keys(e);return Ta&&r.length===rd||(rd=r.length,Ta=r.reduce((n,i)=>{Ia||(Ia={});let o=Ia[i];if(o)n[o[0]]=o[1];else{let s=t(i);for(let a=s.length-1;a>=0;a--){let p=s[a]?.filename,d=e[i];if(p&&d){n[p]=d,Ia[i]=[p,d];break}}}return n},{})),Ta}function id(t,e,r,n,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c=re(_({},e),{event_id:e.event_id||r.event_id||dt(),timestamp:e.timestamp||Or()}),p=r.integrations||t.integrations.map(k=>k.name);IE(c,t),CE(c,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&TE(c,t.stackParser);let d=AE(n,r.captureContext);r.mechanism&&Nr(c,r.mechanism);let f=i?i.getEventProcessors():[],E=va().getScopeData();if(o){let k=o.getScopeData();Wu(E,k)}if(d){let k=d.getScopeData();Wu(E,k)}let y=[...r.attachments||[],...E.attachments];y.length&&(r.attachments=y),td(c,E);let I=[...f,...E.eventProcessors];return wa(I,c,r).then(k=>(k&&xE(k),typeof s=="number"&&s>0?RE(k,s,a):k))}function IE(t,e){let{environment:r,release:n,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||r||Pi,!t.release&&n&&(t.release=n),!t.dist&&i&&(t.dist=i);let s=t.request;s?.url&&(s.url=En(s.url,o))}function TE(t,e){let r=nd(e);t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=r[i.filename])})})}function xE(t){let e={};if(t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function CE(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function RE(t,e,r){if(!t)return null;let n=_(_(_(_(_({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>_(_({},i),i.data&&{data:nr(i.data,e,r)}))}),t.user&&{user:nr(t.user,e,r)}),t.contexts&&{contexts:nr(t.contexts,e,r)}),t.extra&&{extra:nr(t.extra,e,r)});return t.contexts?.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=nr(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>_(_({},i),i.data&&{data:nr(i.data,e,r)}))),t.contexts?.flags&&n.contexts&&(n.contexts.flags=nr(t.contexts.flags,3,r)),n}function AE(t,e){if(!e)return t;let r=t?t.clone():new Tt;return r.update(e),r}function od(t){if(t)return DE(t)?{captureContext:t}:OE(t)?{captureContext:t}:t}function DE(t){return t instanceof Tt||typeof t=="function"}var NE=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function OE(t){return Object.keys(t).some(e=>NE.includes(e))}function xa(t,e){return Er().captureException(t,od(e))}function Ca(t,e){let r=typeof e=="string"?e:void 0,n=typeof e!="string"?{captureContext:e}:void 0;return Er().captureMessage(t,r,n)}function Yo(t,e){return Er().captureEvent(t,e)}function zo(t){let e=Pr(),r=Er(),{userAgent:n}=he.navigator||{},i=xm(_(_({user:r.getUser()||e.getUser()},n&&{userAgent:n}),t)),o=e.getSession();return o?.status==="ok"&&on(o,{status:"exited"}),Ra(),e.setSession(i),i}function Ra(){let t=Pr(),r=Er().getSession()||t.getSession();r&&Cm(r),ad(),t.setSession()}function ad(){let t=Pr(),e=qe(),r=t.getSession();r&&e&&e.captureSession(r)}function qo(t=!1){if(t){Ra();return}ad()}var PE="7";function LE(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function ME(t){return`${LE(t)}${t.projectId}/envelope/`}function BE(t,e){let r={sentry_version:PE};return t.publicKey&&(r.sentry_key=t.publicKey),e&&(r.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(r).toString()}function cd(t,e,r){return e||`${ME(t)}?${BE(t,r)}`}var ld=[];function ud(t,e){let r={};return e.forEach(n=>{n&&Gu(t,n,r)}),r}function ju(t,e){for(let r of e)r?.afterAllSetup&&r.afterAllSetup(t)}function Gu(t,e,r){if(r[e.name]){ce&&ne.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,ld.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),ld.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>n(i,o,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((o,s)=>n(o,s,t),{id:e.name});t.addEventProcessor(i)}ce&&ne.log(`Integration installed: ${e.name}`)}function pd(t,e,r){let n=[{type:"client_report"},{timestamp:r||Or(),discarded_events:t}];return sn(e?{dsn:e}:{},[n])}function Aa(t){let e=[];t.message&&e.push(t.message);try{let r=t.exception.values[t.exception.values.length-1];r?.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`))}catch{}return e}function fd(t){let{trace_id:e,parent_span_id:r,span_id:n,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:r,span_id:n??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[Ou],exclusive_time:s?.[Pu],measurements:t.measurements,is_segment:!0}}function md(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:_(_(_({},t.data),t.profile_id&&{[Ou]:t.profile_id}),t.exclusive_time&&{[Pu]:t.exclusive_time})}},measurements:t.measurements}}var dd="Not capturing exception because it's already been captured.",hd="Discarded session because of missing or non-string release",vd=Symbol.for("SentryInternalError"),Ed=Symbol.for("SentryDoNotSendEventError");function Da(t){return{message:t,[vd]:!0}}function Yu(t){return{message:t,[Ed]:!0}}function gd(t){return!!t&&typeof t=="object"&&vd in t}function yd(t){return!!t&&typeof t=="object"&&Ed in t}var Ko=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=jm(e.dsn):ce&&ne.warn("No DSN provided, client will not send events."),this._dsn){let r=cd(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(re(_({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:r}))}}captureException(e,r,n){let i=dt();if(ha(e))return ce&&ne.log(dd),i;let o=_({event_id:i},r);return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,n))),o.event_id}captureMessage(e,r,n,i){let o=_({event_id:dt()},n),s=Ri(e)?e:String(e),a=Yn(e)?this.eventFromMessage(s,r,o):this.eventFromException(e,o);return this._process(a.then(c=>this._captureEvent(c,o,i))),o.event_id}captureEvent(e,r,n){let i=dt();if(r?.originalException&&ha(r.originalException))return ce&&ne.log(dd),i;let o=_({event_id:i},r),s=e.sdkProcessingMetadata||{},a=s.capturedSpanScope,c=s.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,a||n,c)),o.event_id}captureSession(e){this.sendSession(e),on(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let r=this._transport;return r?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>r.flush(e).then(i=>n&&i))):ir(!0)}close(e){return this.flush(e).then(r=>(this.getOptions().enabled=!1,this.emit("close"),r))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let r=this._integrations[e.name];Gu(this,e,this._integrations),r||ju(this,[e])}sendEvent(e,r={}){this.emit("beforeSendEvent",e,r);let n=Qm(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=zm(n,Km(o));let i=this.sendEnvelope(n);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){let{release:r,environment:n=Pi}=this._options;if("aggregates"in e){let o=e.attrs||{};if(!o.release&&!r){ce&&ne.warn(hd);return}o.release=o.release||r,o.environment=o.environment||n,e.attrs=o}else{if(!e.release&&!r){ce&&ne.warn(hd);return}e.release=e.release||r,e.environment=e.environment||n}this.emit("beforeSendSession",e);let i=Jm(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,r,n=1){if(this._options.sendClientReports){let i=`${e}:${r}`;ce&&ne.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}on(e,r){let n=this._hooks[e]=this._hooks[e]||[];return n.push(r),()=>{let i=n.indexOf(r);i>-1&&n.splice(i,1)}}emit(e,...r){let n=this._hooks[e];n&&n.forEach(i=>i(...r))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,r=>(ce&&ne.error("Error while sending envelope:",r),r)):(ce&&ne.error("Transport disabled"),ir({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=ud(this,e),ju(this,e)}_updateSessionFromEvent(e,r){let n=r.level==="fatal",i=!1,o=r.exception?.values;if(o){i=!0;for(let c of o)if(c.mechanism?.handled===!1){n=!0;break}}let s=e.status==="ok";(s&&e.errors===0||s&&n)&&(on(e,re(_({},n&&{status:"crashed"}),{errors:e.errors||Number(i||n)})),this.captureSession(e))}_isClientDoneProcessing(e){return new _r(r=>{let n=0,i=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),r(!0)):(n+=i,e&&n>=e&&(clearInterval(o),r(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,r,n,i){let o=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s?.length&&(r.integrations=s),this.emit("preprocessEvent",e,r),e.type||i.setLastEventId(e.event_id||r.event_id),id(o,e,r,n,this,i).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,r),a.contexts=_({trace:Ru(n)},a.contexts);let c=Ym(this,n);return a.sdkProcessingMetadata=_({dynamicSamplingContext:c},a.sdkProcessingMetadata),a})}_captureEvent(e,r={},n=Er(),i=Pr()){return ce&&zu(e)&&ne.log(`Captured error event \`${Aa(e)[0]||"<unknown>"}\``),this._processEvent(e,r,n,i).then(o=>o.event_id,o=>{ce&&(yd(o)?ne.log(o.message):gd(o)?ne.warn(o.message):ne.warn(o))})}_processEvent(e,r,n,i){let o=this.getOptions(),{sampleRate:s}=o,a=_d(e),c=zu(e),p=e.type||"error",d=`before send for type \`${p}\``,f=typeof s>"u"?void 0:Mm(s);if(c&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error"),wn(Yu(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let E=p==="replay_event"?"replay":p;return this._prepareEvent(e,r,n,i).then(y=>{if(y===null)throw this.recordDroppedEvent("event_processor",E),Yu("An event processor returned `null`, will not send event.");if(r.data&&r.data.__sentry__===!0)return y;let D=FE(this,o,y,r);return kE(D,d)}).then(y=>{if(y===null){if(this.recordDroppedEvent("before_send",E),a){let O=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",O)}throw Yu(`${d} returned \`null\`, will not send event.`)}let I=n.getSession()||i.getSession();if(c&&I&&this._updateSessionFromEvent(I,y),a){let k=y.sdkProcessingMetadata?.spanCountBeforeProcessing||0,O=y.spans?y.spans.length:0,$=k-O;$>0&&this.recordDroppedEvent("before_send","span",$)}let D=y.transaction_info;if(a&&D&&y.transaction!==e.transaction){let k="custom";y.transaction_info=re(_({},D),{source:k})}return this.sendEvent(y,r),y}).then(null,y=>{throw yd(y)||gd(y)?y:(this.captureException(y,{data:{__sentry__:!0},originalException:y}),Da(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
32
- Reason: ${y}`))})}_process(e){this._numProcessing++,e.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([r,n])=>{let[i,o]=r.split(":");return{reason:i,category:o,quantity:n}})}_flushOutcomes(){ce&&ne.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){ce&&ne.log("No outcomes to send");return}if(!this._dsn){ce&&ne.log("No dsn provided, will not send outcomes");return}ce&&ne.log("Sending outcomes:",e);let r=pd(e,this._options.tunnel&&bn(this._dsn));this.sendEnvelope(r)}};function kE(t,e){let r=`${e} must return \`null\` or a valid event.`;if(nn(t))return t.then(n=>{if(!rn(n)&&n!==null)throw Da(r);return n},n=>{throw Da(`${e} rejected with ${n}`)});if(!rn(t)&&t!==null)throw Da(r);return t}function FE(t,e,r,n){let{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s}=e,a=r;if(zu(a)&&i)return i(a,n);if(_d(a)){if(s){let c=s(fd(a));if(c?a=_n(r,md(c)):Mu(),a.spans){let p=[];for(let d of a.spans){let f=s(d);f?p.push(f):(Mu(),p.push(d))}a.spans=p}}if(o){if(a.spans){let c=a.spans.length;a.sdkProcessingMetadata=re(_({},r.sdkProcessingMetadata),{spanCountBeforeProcessing:c})}return o(a,n)}}return a}function zu(t){return t.type===void 0}function _d(t){return t.type==="transaction"}function HE(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function bd(t,e,r,n){let i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),r&&n&&(i.dsn=bn(n)),sn(i,[HE(t)])}function Xo(t,e){let r=e??$E(t)??[];if(r.length===0)return;let n=t.getOptions(),i=bd(r,n._metadata,n.tunnel,t.getDsn());wd().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(i)}function $E(t){return wd().get(t)}function wd(){return tn("clientToLogBufferMap",()=>new WeakMap)}var qu=Symbol.for("SentryBufferFullError");function Sd(t){let e=[];function r(){return t===void 0||e.length<t}function n(s){return e.splice(e.indexOf(s),1)[0]||Promise.resolve(void 0)}function i(s){if(!r())return wn(qu);let a=s();return e.indexOf(a)===-1&&e.push(a),a.then(()=>n(a)).then(null,()=>n(a).then(null,()=>{})),a}function o(s){return new _r((a,c)=>{let p=e.length;if(!p)return a(!0);let d=setTimeout(()=>{s&&s>0&&a(!1)},s);e.forEach(f=>{ir(f).then(()=>{--p||(clearTimeout(d),a(!0))},c)})})}return{$:e,add:i,drain:o}}function VE(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 WE(t,e){return t[e]||t.all||0}function Id(t,e,r=Date.now()){return WE(t,e)>r}function Td(t,{statusCode:e,headers:r},n=Date.now()){let i=_({},t),o=r?.["x-sentry-rate-limits"],s=r?.["retry-after"];if(o)for(let a of o.trim().split(",")){let[c,p,,,d]=a.split(":",5),f=parseInt(c,10),E=(isNaN(f)?60:f)*1e3;if(!p)i.all=n+E;else for(let y of p.split(";"))y==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(i[y]=n+E):i[y]=n+E}else s?i.all=n+VE(s,n):e===429&&(i.all=n+60*1e3);return i}var jE=64;function Na(t,e,r=Sd(t.bufferSize||jE)){let n={},i=s=>r.drain(s);function o(s){let a=[];if(Fu(s,(f,E)=>{let y=Hu(E);Id(n,y)?t.recordDroppedEvent("ratelimit_backoff",y):a.push(f)}),a.length===0)return ir({});let c=sn(s[0],a),p=f=>{Fu(c,(E,y)=>{t.recordDroppedEvent(f,Hu(y))})},d=()=>e({body:qm(c)}).then(f=>(f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&ce&&ne.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),n=Td(n,f),f),f=>{throw p("network_error"),ce&&ne.error("Encountered error running transport request:",f),f});return r.add(d).then(f=>f,f=>{if(f===qu)return ce&&ne.error("Skipped sending event because buffer is full."),p("queue_overflow"),ir({});throw f})}return{send:o,flush:i}}function Ku(t){t.user?.ip_address===void 0&&(t.user=re(_({},t.user),{ip_address:"{{auto}}"}))}function Xu(t){"aggregates"in t?t.attrs?.ip_address===void 0&&(t.attrs=re(_({},t.attrs),{ip_address:"{{auto}}"})):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function Ju(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(o=>({name:`${n}:@sentry/${o}`,version:Rr})),version:Rr}),t._metadata=i}var GE=100;function Lr(t,e){let r=qe(),n=Pr();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:o=GE}=r.getOptions();if(o<=0)return;let s=Or(),a=_({timestamp:s},t),c=i?vn(()=>i(a,e)):a;c!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",c,e),n.addBreadcrumb(c,o))}var xd,YE="FunctionToString",Cd=new WeakMap,zE=()=>({name:YE,setupOnce(){xd=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=qn(this),r=Cd.has(qe())&&e!==void 0?e:this;return xd.apply(r,t)}}catch{}},setup(t){Cd.set(t,!0)}}),Oa=zE;var qE=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],KE="EventFilters",Qu=(t={})=>{let e;return{name:KE,setup(r){let n=r.getOptions();e=Rd(t,n)},processEvent(r,n,i){if(!e){let o=i.getOptions();e=Rd(t,o)}return XE(r,e)?null:r}}},La=(t={})=>re(_({},Qu(t)),{name:"InboundFilters"});function Rd(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:qE],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function XE(t,e){if(t.type){if(t.type==="transaction"&&QE(t,e.ignoreTransactions))return ce&&ne.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
33
- Event: ${Dr(t)}`),!0}else{if(JE(t,e.ignoreErrors))return ce&&ne.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
34
- Event: ${Dr(t)}`),!0;if(r_(t))return ce&&ne.warn(`Event dropped due to not having an error message, error type or stacktrace.
35
- Event: ${Dr(t)}`),!0;if(ZE(t,e.denyUrls))return ce&&ne.warn(`Event dropped due to being matched by \`denyUrls\` option.
31
+ `),typeof a=="string"||a instanceof Uint8Array)i(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(nr(a))}i(c)}}return typeof n=="string"?n:RE(n)}function RE(t){let e=t.reduce((i,o)=>i+o.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function pd(t){let e=typeof t.data=="string"?Ju(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var AE={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Zu(t){return AE[t]}function ep(t){if(!t?.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function fd(t,e,r,n){let i=t.sdkProcessingMetadata?.dynamicSamplingContext;return _(_(_({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:_n(n)}),i&&{trace:i})}function DE(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 md(t,e,r,n){let i=ep(r),o=_(_({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:_n(e)}),s="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return on(o,[s])}function dd(t,e,r,n){let i=ep(r),o=t.type&&t.type!=="replay_event"?t.type:"event";DE(t,r?.sdk);let s=fd(t,i,n,e);return delete t.sdkProcessingMetadata,on(s,[[{type:o},t]])}var tp=0,hd=1,gd=2;function ir(t){return new br(e=>{e(t)})}function bn(t){return new br((e,r)=>{r(t)})}var br=class t{constructor(e){this._state=tp,this._handlers=[],this._runExecutor(e)}then(e,r){return new t((n,i)=>{this._handlers.push([!1,o=>{if(!e)n(o);else try{n(e(o))}catch(s){i(s)}},o=>{if(!r)i(o);else try{n(r(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new t((r,n)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{if(o){n(i);return}r(i)})})}_executeHandlers(){if(this._state===tp)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===hd&&r[1](this._value),this._state===gd&&r[2](this._value),r[0]=!0)})}_runExecutor(e){let r=(o,s)=>{if(this._state===tp){if(rn(s)){s.then(n,i);return}this._state=o,this._value=s,this._executeHandlers()}},n=o=>{r(hd,o)},i=o=>{r(gd,o)};try{e(n,i)}catch(o){i(o)}}};function Ca(t,e,r,n=0){return new br((i,o)=>{let s=t[n];if(e===null||typeof s!="function")i(e);else{let a=s(_({},e),r);oe&&s.id&&a===null&&ee.log(`Event processor "${s.id}" dropped event`),rn(a)?a.then(c=>Ca(t,c,r,n+1).then(i)).then(null,o):Ca(t,a,r,n+1).then(i).then(null,o)}})}function yd(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=e;OE(t,e),n&&LE(t,n),ME(t,r),NE(t,i),PE(t,o)}function rp(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:p,eventProcessors:d,attachments:f,propagationContext:E,transactionName:y,span:I}=e;Ra(t,"extra",r),Ra(t,"tags",n),Ra(t,"user",i),Ra(t,"contexts",o),t.sdkProcessingMetadata=En(t.sdkProcessingMetadata,a,2),s&&(t.level=s),y&&(t.transactionName=y),I&&(t.span=I),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext=_(_({},t.propagationContext),E)}function Ra(t,e,r){t[e]=En(t[e],r,1)}function OE(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(r).length&&(t.extra=_(_({},r),t.extra)),Object.keys(n).length&&(t.tags=_(_({},n),t.tags)),Object.keys(i).length&&(t.user=_(_({},i),t.user)),Object.keys(o).length&&(t.contexts=_(_({},o),t.contexts)),s&&(t.level=s),a&&t.type!=="transaction"&&(t.transaction=a)}function NE(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function PE(t,e){t.sdkProcessingMetadata=_(_({},t.sdkProcessingMetadata),e)}function LE(t,e){t.contexts=_({trace:qu(e)},t.contexts),t.sdkProcessingMetadata=_({dynamicSamplingContext:Ku(e)},t.sdkProcessingMetadata);let r=zo(e),n=Ni(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function ME(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}var Aa,vd,Da;function Ed(t){let e=fe._sentryDebugIds;if(!e)return{};let r=Object.keys(e);return Da&&r.length===vd||(vd=r.length,Da=r.reduce((n,i)=>{Aa||(Aa={});let o=Aa[i];if(o)n[o[0]]=o[1];else{let s=t(i);for(let a=s.length-1;a>=0;a--){let p=s[a]?.filename,d=e[i];if(p&&d){n[p]=d,Aa[i]=[p,d];break}}}return n},{})),Da}function _d(t,e,r,n,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c=Z(_({},e),{event_id:e.event_id||r.event_id||ft(),timestamp:e.timestamp||Nr()}),p=r.integrations||t.integrations.map(U=>U.name);BE(c,t),FE(c,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&UE(c,t.stackParser);let d=$E(n,r.captureContext);r.mechanism&&Or(c,r.mechanism);let f=i?i.getEventProcessors():[],E=Sa().getScopeData();if(o){let U=o.getScopeData();rp(E,U)}if(d){let U=d.getScopeData();rp(E,U)}let y=[...r.attachments||[],...E.attachments];y.length&&(r.attachments=y),yd(c,E);let I=[...f,...E.eventProcessors];return Ca(I,c,r).then(U=>(U&&kE(U),typeof s=="number"&&s>0?HE(U,s,a):U))}function BE(t,e){let{environment:r,release:n,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||r||Pi,!t.release&&n&&(t.release=n),!t.dist&&i&&(t.dist=i);let s=t.request;s?.url&&(s.url=vn(s.url,o))}function UE(t,e){let r=Ed(e);t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=r[i.filename])})})}function kE(t){let e={};if(t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function FE(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function HE(t,e,r){if(!t)return null;let n=_(_(_(_(_({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>_(_({},i),i.data&&{data:nr(i.data,e,r)}))}),t.user&&{user:nr(t.user,e,r)}),t.contexts&&{contexts:nr(t.contexts,e,r)}),t.extra&&{extra:nr(t.extra,e,r)});return t.contexts?.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=nr(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>_(_({},i),i.data&&{data:nr(i.data,e,r)}))),t.contexts?.flags&&n.contexts&&(n.contexts.flags=nr(t.contexts.flags,3,r)),n}function $E(t,e){if(!e)return t;let r=t?t.clone():new St;return r.update(e),r}function bd(t){if(t)return VE(t)?{captureContext:t}:jE(t)?{captureContext:t}:t}function VE(t){return t instanceof St||typeof t=="function"}var WE=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function jE(t){return Object.keys(t).some(e=>WE.includes(e))}function Oa(t,e){return _r().captureException(t,bd(e))}function Na(t,e){let r=typeof e=="string"?e:void 0,n=typeof e!="string"?{captureContext:e}:void 0;return _r().captureMessage(t,r,n)}function Ko(t,e){return _r().captureEvent(t,e)}function Xo(t){let e=Pr(),r=_r(),{userAgent:n}=fe.navigator||{},i=Vm(_(_({user:r.getUser()||e.getUser()},n&&{userAgent:n}),t)),o=e.getSession();return o?.status==="ok"&&nn(o,{status:"exited"}),Pa(),e.setSession(i),i}function Pa(){let t=Pr(),r=_r().getSession()||t.getSession();r&&Wm(r),Sd(),t.setSession()}function Sd(){let t=Pr(),e=je(),r=t.getSession();r&&e&&e.captureSession(r)}function Jo(t=!1){if(t){Pa();return}Sd()}var GE="7";function YE(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function qE(t){return`${YE(t)}${t.projectId}/envelope/`}function zE(t,e){let r={sentry_version:GE};return t.publicKey&&(r.sentry_key=t.publicKey),e&&(r.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(r).toString()}function Id(t,e,r){return e||`${qE(t)}?${zE(t,r)}`}var Td=[];function xd(t,e){let r={};return e.forEach(n=>{n&&ip(t,n,r)}),r}function np(t,e){for(let r of e)r?.afterAllSetup&&r.afterAllSetup(t)}function ip(t,e,r){if(r[e.name]){oe&&ee.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Td.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Td.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>n(i,o,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((o,s)=>n(o,s,t),{id:e.name});t.addEventProcessor(i)}oe&&ee.log(`Integration installed: ${e.name}`)}function Cd(t,e,r){let n=[{type:"client_report"},{timestamp:r||Nr(),discarded_events:t}];return on(e?{dsn:e}:{},[n])}function La(t){let e=[];t.message&&e.push(t.message);try{let r=t.exception.values[t.exception.values.length-1];r?.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`))}catch{}return e}function Rd(t){let{trace_id:e,parent_span_id:r,span_id:n,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:r,span_id:n??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[Gu],exclusive_time:s?.[Yu],measurements:t.measurements,is_segment:!0}}function Ad(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:_(_(_({},t.data),t.profile_id&&{[Gu]:t.profile_id}),t.exclusive_time&&{[Yu]:t.exclusive_time})}},measurements:t.measurements}}var Dd="Not capturing exception because it's already been captured.",Od="Discarded session because of missing or non-string release",Ld=Symbol.for("SentryInternalError"),Md=Symbol.for("SentryDoNotSendEventError");function Ma(t){return{message:t,[Ld]:!0}}function op(t){return{message:t,[Md]:!0}}function Nd(t){return!!t&&typeof t=="object"&&Ld in t}function Pd(t){return!!t&&typeof t=="object"&&Md in t}var Qo=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=sd(e.dsn):oe&&ee.warn("No DSN provided, client will not send events."),this._dsn){let r=Id(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(Z(_({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:r}))}}captureException(e,r,n){let i=ft();if(_a(e))return oe&&ee.log(Dd),i;let o=_({event_id:i},r);return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,n))),o.event_id}captureMessage(e,r,n,i){let o=_({event_id:ft()},n),s=Ri(e)?e:String(e),a=Gn(e)?this.eventFromMessage(s,r,o):this.eventFromException(e,o);return this._process(a.then(c=>this._captureEvent(c,o,i))),o.event_id}captureEvent(e,r,n){let i=ft();if(r?.originalException&&_a(r.originalException))return oe&&ee.log(Dd),i;let o=_({event_id:i},r),s=e.sdkProcessingMetadata||{},a=s.capturedSpanScope,c=s.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,a||n,c)),o.event_id}captureSession(e){this.sendSession(e),nn(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let r=this._transport;return r?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>r.flush(e).then(i=>n&&i))):ir(!0)}close(e){return this.flush(e).then(r=>(this.getOptions().enabled=!1,this.emit("close"),r))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let r=this._integrations[e.name];ip(this,e,this._integrations),r||np(this,[e])}sendEvent(e,r={}){this.emit("beforeSendEvent",e,r);let n=dd(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=ld(n,pd(o));let i=this.sendEnvelope(n);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){let{release:r,environment:n=Pi}=this._options;if("aggregates"in e){let o=e.attrs||{};if(!o.release&&!r){oe&&ee.warn(Od);return}o.release=o.release||r,o.environment=o.environment||n,e.attrs=o}else{if(!e.release&&!r){oe&&ee.warn(Od);return}e.release=e.release||r,e.environment=e.environment||n}this.emit("beforeSendSession",e);let i=md(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,r,n=1){if(this._options.sendClientReports){let i=`${e}:${r}`;oe&&ee.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}on(e,r){let n=this._hooks[e]=this._hooks[e]||[];return n.push(r),()=>{let i=n.indexOf(r);i>-1&&n.splice(i,1)}}emit(e,...r){let n=this._hooks[e];n&&n.forEach(i=>i(...r))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,r=>(oe&&ee.error("Error while sending envelope:",r),r)):(oe&&ee.error("Transport disabled"),ir({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=xd(this,e),np(this,e)}_updateSessionFromEvent(e,r){let n=r.level==="fatal",i=!1,o=r.exception?.values;if(o){i=!0;for(let c of o)if(c.mechanism?.handled===!1){n=!0;break}}let s=e.status==="ok";(s&&e.errors===0||s&&n)&&(nn(e,Z(_({},n&&{status:"crashed"}),{errors:e.errors||Number(i||n)})),this.captureSession(e))}_isClientDoneProcessing(e){return new br(r=>{let n=0,i=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),r(!0)):(n+=i,e&&n>=e&&(clearInterval(o),r(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,r,n,i){let o=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s?.length&&(r.integrations=s),this.emit("preprocessEvent",e,r),e.type||i.setLastEventId(e.event_id||r.event_id),_d(o,e,r,n,this,i).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,r),a.contexts=_({trace:$u(n)},a.contexts);let c=cd(this,n);return a.sdkProcessingMetadata=_({dynamicSamplingContext:c},a.sdkProcessingMetadata),a})}_captureEvent(e,r={},n=_r(),i=Pr()){return oe&&sp(e)&&ee.log(`Captured error event \`${La(e)[0]||"<unknown>"}\``),this._processEvent(e,r,n,i).then(o=>o.event_id,o=>{oe&&(Pd(o)?ee.log(o.message):Nd(o)?ee.warn(o.message):ee.warn(o))})}_processEvent(e,r,n,i){let o=this.getOptions(),{sampleRate:s}=o,a=Bd(e),c=sp(e),p=e.type||"error",d=`before send for type \`${p}\``,f=typeof s>"u"?void 0:Jm(s);if(c&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error"),bn(op(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let E=p==="replay_event"?"replay":p;return this._prepareEvent(e,r,n,i).then(y=>{if(y===null)throw this.recordDroppedEvent("event_processor",E),op("An event processor returned `null`, will not send event.");if(r.data&&r.data.__sentry__===!0)return y;let D=JE(this,o,y,r);return XE(D,d)}).then(y=>{if(y===null){if(this.recordDroppedEvent("before_send",E),a){let N=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",N)}throw op(`${d} returned \`null\`, will not send event.`)}let I=n.getSession()||i.getSession();if(c&&I&&this._updateSessionFromEvent(I,y),a){let U=y.sdkProcessingMetadata?.spanCountBeforeProcessing||0,N=y.spans?y.spans.length:0,H=U-N;H>0&&this.recordDroppedEvent("before_send","span",H)}let D=y.transaction_info;if(a&&D&&y.transaction!==e.transaction){let U="custom";y.transaction_info=Z(_({},D),{source:U})}return this.sendEvent(y,r),y}).then(null,y=>{throw Pd(y)||Nd(y)?y:(this.captureException(y,{data:{__sentry__:!0},originalException:y}),Ma(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
32
+ Reason: ${y}`))})}_process(e){this._numProcessing++,e.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([r,n])=>{let[i,o]=r.split(":");return{reason:i,category:o,quantity:n}})}_flushOutcomes(){oe&&ee.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){oe&&ee.log("No outcomes to send");return}if(!this._dsn){oe&&ee.log("No dsn provided, will not send outcomes");return}oe&&ee.log("Sending outcomes:",e);let r=Cd(e,this._options.tunnel&&_n(this._dsn));this.sendEnvelope(r)}};function XE(t,e){let r=`${e} must return \`null\` or a valid event.`;if(rn(t))return t.then(n=>{if(!tn(n)&&n!==null)throw Ma(r);return n},n=>{throw Ma(`${e} rejected with ${n}`)});if(!tn(t)&&t!==null)throw Ma(r);return t}function JE(t,e,r,n){let{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s}=e,a=r;if(sp(a)&&i)return i(a,n);if(Bd(a)){if(s){let c=s(Rd(a));if(c?a=En(r,Ad(c)):zu(),a.spans){let p=[];for(let d of a.spans){let f=s(d);f?p.push(f):(zu(),p.push(d))}a.spans=p}}if(o){if(a.spans){let c=a.spans.length;a.sdkProcessingMetadata=Z(_({},r.sdkProcessingMetadata),{spanCountBeforeProcessing:c})}return o(a,n)}}return a}function sp(t){return t.type===void 0}function Bd(t){return t.type==="transaction"}function QE(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function Ud(t,e,r,n){let i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),r&&n&&(i.dsn=_n(n)),on(i,[QE(t)])}function Zo(t,e){let r=e??ZE(t)??[];if(r.length===0)return;let n=t.getOptions(),i=Ud(r,n._metadata,n.tunnel,t.getDsn());kd().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(i)}function ZE(t){return kd().get(t)}function kd(){return en("clientToLogBufferMap",()=>new WeakMap)}var ap=Symbol.for("SentryBufferFullError");function Fd(t){let e=[];function r(){return t===void 0||e.length<t}function n(s){return e.splice(e.indexOf(s),1)[0]||Promise.resolve(void 0)}function i(s){if(!r())return bn(ap);let a=s();return e.indexOf(a)===-1&&e.push(a),a.then(()=>n(a)).then(null,()=>n(a).then(null,()=>{})),a}function o(s){return new br((a,c)=>{let p=e.length;if(!p)return a(!0);let d=setTimeout(()=>{s&&s>0&&a(!1)},s);e.forEach(f=>{ir(f).then(()=>{--p||(clearTimeout(d),a(!0))},c)})})}return{$:e,add:i,drain:o}}function e_(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 t_(t,e){return t[e]||t.all||0}function Hd(t,e,r=Date.now()){return t_(t,e)>r}function $d(t,{statusCode:e,headers:r},n=Date.now()){let i=_({},t),o=r?.["x-sentry-rate-limits"],s=r?.["retry-after"];if(o)for(let a of o.trim().split(",")){let[c,p,,,d]=a.split(":",5),f=parseInt(c,10),E=(isNaN(f)?60:f)*1e3;if(!p)i.all=n+E;else for(let y of p.split(";"))y==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(i[y]=n+E):i[y]=n+E}else s?i.all=n+e_(s,n):e===429&&(i.all=n+60*1e3);return i}var r_=64;function Ba(t,e,r=Fd(t.bufferSize||r_)){let n={},i=s=>r.drain(s);function o(s){let a=[];if(Qu(s,(f,E)=>{let y=Zu(E);Hd(n,y)?t.recordDroppedEvent("ratelimit_backoff",y):a.push(f)}),a.length===0)return ir({});let c=on(s[0],a),p=f=>{Qu(c,(E,y)=>{t.recordDroppedEvent(f,Zu(y))})},d=()=>e({body:ud(c)}).then(f=>(f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&oe&&ee.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),n=$d(n,f),f),f=>{throw p("network_error"),oe&&ee.error("Encountered error running transport request:",f),f});return r.add(d).then(f=>f,f=>{if(f===ap)return oe&&ee.error("Skipped sending event because buffer is full."),p("queue_overflow"),ir({});throw f})}return{send:o,flush:i}}function cp(t){t.user?.ip_address===void 0&&(t.user=Z(_({},t.user),{ip_address:"{{auto}}"}))}function lp(t){"aggregates"in t?t.attrs?.ip_address===void 0&&(t.attrs=Z(_({},t.attrs),{ip_address:"{{auto}}"})):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function up(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(o=>({name:`${n}:@sentry/${o}`,version:Ar})),version:Ar}),t._metadata=i}var n_=100;function Lr(t,e){let r=je(),n=Pr();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:o=n_}=r.getOptions();if(o<=0)return;let s=Nr(),a=_({timestamp:s},t),c=i?yn(()=>i(a,e)):a;c!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",c,e),n.addBreadcrumb(c,o))}var Vd,i_="FunctionToString",Wd=new WeakMap,o_=()=>({name:i_,setupOnce(){Vd=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=qn(this),r=Wd.has(je())&&e!==void 0?e:this;return Vd.apply(r,t)}}catch{}},setup(t){Wd.set(t,!0)}}),Ua=o_;var s_=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],a_="EventFilters",pp=(t={})=>{let e;return{name:a_,setup(r){let n=r.getOptions();e=jd(t,n)},processEvent(r,n,i){if(!e){let o=i.getOptions();e=jd(t,o)}return c_(r,e)?null:r}}},Fa=(t={})=>Z(_({},pp(t)),{name:"InboundFilters"});function jd(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:s_],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function c_(t,e){if(t.type){if(t.type==="transaction"&&u_(t,e.ignoreTransactions))return oe&&ee.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
33
+ Event: ${Dr(t)}`),!0}else{if(l_(t,e.ignoreErrors))return oe&&ee.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
34
+ Event: ${Dr(t)}`),!0;if(d_(t))return oe&&ee.warn(`Event dropped due to not having an error message, error type or stacktrace.
35
+ Event: ${Dr(t)}`),!0;if(p_(t,e.denyUrls))return oe&&ee.warn(`Event dropped due to being matched by \`denyUrls\` option.
36
36
  Event: ${Dr(t)}.
37
- Url: ${Pa(t)}`),!0;if(!e_(t,e.allowUrls))return ce&&ne.warn(`Event dropped due to not being matched by \`allowUrls\` option.
37
+ Url: ${ka(t)}`),!0;if(!f_(t,e.allowUrls))return oe&&ee.warn(`Event dropped due to not being matched by \`allowUrls\` option.
38
38
  Event: ${Dr(t)}.
39
- Url: ${Pa(t)}`),!0}return!1}function JE(t,e){return e?.length?Aa(t).some(r=>Ai(r,e)):!1}function QE(t,e){if(!e?.length)return!1;let r=t.transaction;return r?Ai(r,e):!1}function ZE(t,e){if(!e?.length)return!1;let r=Pa(t);return r?Ai(r,e):!1}function e_(t,e){if(!e?.length)return!0;let r=Pa(t);return r?Ai(r,e):!0}function t_(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 Pa(t){try{let r=[...t.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?t_(r):null}catch{return ce&&ne.error(`Cannot extract url for event ${Dr(t)}`),null}}function r_(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function ep(t,e,r,n,i,o){if(!i.exception?.values||!o||!vr(o.originalException,Error))return;let s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=Zu(t,e,n,o.originalException,r,i.exception.values,s,0))}function Zu(t,e,r,n,i,o,s,a){if(o.length>=r+1)return o;let c=[...o];if(vr(n[i],Error)){Ad(s,a);let p=t(e,n[i]),d=c.length;Dd(p,i,d,a),c=Zu(t,e,r,n[i],i,[p,...c],p,d)}return Array.isArray(n.errors)&&n.errors.forEach((p,d)=>{if(vr(p,Error)){Ad(s,a);let f=t(e,p),E=c.length;Dd(f,`errors[${d}]`,E,a),c=Zu(t,e,r,p,i,[f,...c],f,E)}}),c}function Ad(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=re(_(_({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Dd(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=re(_({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function tp(t){let e="console";Pt(e,t),Lt(e,n_)}function n_(){"console"in he&&au.forEach(function(t){t in he.console&&mt(he.console,t,function(e){return xi[t]=e,function(...r){ft("console",{args:r,level:t}),xi[t]?.apply(he.console,r)}})})}function rp(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var i_="Dedupe",o_=()=>{let t;return{name:i_,processEvent(e){if(e.type)return e;try{if(s_(e,t))return ce&&ne.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Ma=o_;function s_(t,e){return e?!!(a_(t,e)||c_(t,e)):!1}function a_(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Pd(t,e)||!Od(t,e))}function c_(t,e){let r=Nd(e),n=Nd(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Pd(t,e)||!Od(t,e))}function Od(t,e){let r=ca(t),n=ca(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let o=n[i],s=r[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function Pd(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 Nd(t){return t.exception?.values?.[0]}function Jo(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let r=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:r,hash:n,relative:e[5]+r+n}}function Ba(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var Qo=he;function np(){return"history"in Qo&&!!Qo.history}function l_(){if(!("fetch"in Qo))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Zo(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function ip(){if(typeof EdgeRuntime=="string")return!0;if(!l_())return!1;if(Zo(Qo.fetch))return!0;let t=!1,e=Qo.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=Zo(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){ce&&ne.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function sp(t,e){let r="fetch";Pt(r,t),Lt(r,()=>u_(void 0,e))}function u_(t,e=!1){e&&!ip()||mt(he,"fetch",function(r){return function(...n){let i=new Error,{method:o,url:s}=p_(n),a={args:n,fetchData:{method:o,url:s},startTimestamp:Ft()*1e3,virtualError:i,headers:f_(n)};return t||ft("fetch",_({},a)),r.apply(he,n).then(async c=>(t?t(c):ft("fetch",re(_({},a),{endTimestamp:Ft()*1e3,response:c})),c),c=>{if(ft("fetch",re(_({},a),{endTimestamp:Ft()*1e3,error:c})),Gn(c)&&c.stack===void 0&&(c.stack=i.stack,zt(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{let p=new URL(a.fetchData.url);c.message=`${c.message} (${p.host})`}catch{}throw c})}})}function op(t,e){return!!t&&typeof t=="object"&&!!t[e]}function Ld(t){return typeof t=="string"?t:t?op(t,"url")?t.url:t.toString?t.toString():"":""}function p_(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:Ld(r),method:op(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:Ld(e),method:op(e,"method")?String(e.method).toUpperCase():"GET"}}function f_(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(Em(e))return new Headers(e.headers)}catch{}}function ap(){return"npm"}var Ze=he,cp=0;function lp(){return cp>0}function x_(){cp++,setTimeout(()=>{cp--})}function Kn(t,e={}){function r(i){return typeof i=="function"}if(!r(t))return t;try{let i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(qn(t))return t}catch{return t}let n=function(...i){try{let o=i.map(s=>Kn(s,e));return t.apply(this,o)}catch(o){throw x_(),jo(s=>{s.addEventProcessor(a=>(e.mechanism&&(Di(a,void 0,void 0),Nr(a,e.mechanism)),a.extra=re(_({},a.extra),{arguments:i}),a)),xa(o)}),o}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}ma(n,t),zt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function Md(){let t=Wo(),{referrer:e}=Ze.document||{},{userAgent:r}=Ze.navigator||{},n=_(_({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function Ua(t,e){let r=fp(t,e),n={type:N_(e),value:O_(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function C_(t,e,r,n){let o=qe()?.getOptions().normalizeDepth,s=M_(e),a={__serialized__:ba(e,o)};if(s)return{exception:{values:[Ua(t,s)]},extra:a};let c={exception:{values:[{type:zn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:P_(e,{isUnhandledRejection:n})}]},extra:a};if(r){let p=fp(t,r);p.length&&(c.exception.values[0].stacktrace={frames:p})}return c}function up(t,e){return{exception:{values:[Ua(t,e)]}}}function fp(t,e){let r=e.stacktrace||e.stack||"",n=A_(e),i=D_(e);try{return t(r,n,i)}catch{}return[]}var R_=/Minified React error #\d+;/i;function A_(t){return t&&R_.test(t.message)?1:0}function D_(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Bd(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function N_(t){let e=t?.name;return!e&&Bd(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function O_(t){let e=t?.message;return Bd(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Ud(t,e,r,n){let i=r?.syntheticException||void 0,o=ka(t,e,i,n);return Nr(o),o.level="error",r?.event_id&&(o.event_id=r.event_id),ir(o)}function kd(t,e,r="info",n,i){let o=n?.syntheticException||void 0,s=pp(t,e,o,i);return s.level=r,n?.event_id&&(s.event_id=n.event_id),ir(s)}function ka(t,e,r,n,i){let o;if(ua(e)&&e.error)return up(t,e.error);if(pa(e)||gu(e)){let s=e;if("stack"in e)o=up(t,e);else{let a=s.name||(pa(s)?"DOMError":"DOMException"),c=s.message?`${a}: ${s.message}`:a;o=pp(t,c,r,n),Di(o,c)}return"code"in s&&(o.tags=re(_({},o.tags),{"DOMException.code":`${s.code}`})),o}return Gn(e)?up(t,e):rn(e)||zn(e)?(o=C_(t,e,r,i),Nr(o,{synthetic:!0}),o):(o=pp(t,e,r,n),Di(o,`${e}`,void 0),Nr(o,{synthetic:!0}),o)}function pp(t,e,r,n){let i={};if(n&&r){let o=fp(t,r);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Nr(i,{synthetic:!0})}if(Ri(e)){let{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function P_(t,{isUnhandledRejection:e}){let r=wu(t),n=e?"promise rejection":"exception";return ua(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:zn(t)?`Event \`${L_(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function L_(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function M_(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var B_=5e3,es=class extends Ko{constructor(e){let r=U_(e),n=Ze.SENTRY_SDK_SOURCE||ap();Ju(r,"browser",["browser"],n),super(r);let{sendDefaultPii:i,sendClientReports:o,enableLogs:s,_experiments:a}=this._options,c=s??a?.enableLogs;Ze.document&&(o||c)&&Ze.document.addEventListener("visibilitychange",()=>{Ze.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),c&&Xo(this))}),c&&(this.on("flush",()=>{Xo(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{Xo(this)},B_)})),i&&(this.on("postprocessEvent",Ku),this.on("beforeSendSession",Xu))}eventFromException(e,r){return Ud(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return kd(this._options.stackParser,e,r,n,this._options.attachStacktrace)}_prepareEvent(e,r,n,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n,i)}};function U_(t){return _({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Ze.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var Fd=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var ht=he;var k_=1e3,Hd,mp,dp;function hp(t){let e="dom";Pt(e,t),Lt(e,F_)}function F_(){if(!ht.document)return;let t=ft.bind(null,"dom"),e=$d(t,!0);ht.document.addEventListener("click",e,!1),ht.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let i=ht[r]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(mt(i,"addEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=p[s]=p[s]||{refCount:0};if(!d.handler){let f=$d(t);d.handler=f,o.call(this,s,f,c)}d.refCount++}catch{}return o.call(this,s,a,c)}}),mt(i,"removeEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__||{},d=p[s];d&&(d.refCount--,d.refCount<=0&&(o.call(this,s,d.handler,c),d.handler=void 0,delete p[s]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,c)}}))})}function H_(t){if(t.type!==mp)return!1;try{if(!t.target||t.target._sentryId!==dp)return!1}catch{}return!0}function $_(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function $d(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=V_(r);if($_(r.type,n))return;zt(r,"_sentryCaptured",!0),n&&!n._sentryId&&zt(n,"_sentryId",dt());let i=r.type==="keypress"?"input":r.type;H_(r)||(t({event:r,name:i,global:e}),mp=r.type,dp=n?n._sentryId:void 0),clearTimeout(Hd),Hd=ht.setTimeout(()=>{dp=void 0,mp=void 0},k_)}}function V_(t){try{return t.target}catch{return null}}var Fa;function ts(t){let e="history";Pt(e,t),Lt(e,W_)}function W_(){if(ht.addEventListener("popstate",()=>{let e=ht.location.href,r=Fa;if(Fa=e,r===e)return;ft("history",{from:r,to:e})}),!np())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let i=Fa,o=j_(String(n));if(Fa=o,i===o)return e.apply(this,r);ft("history",{from:i,to:o})}return e.apply(this,r)}}mt(ht.history,"pushState",t),mt(ht.history,"replaceState",t)}function j_(t){try{return new URL(t,ht.location.origin).toString()}catch{return t}}var Ha={};function gp(t){let e=Ha[t];if(e)return e;let r=ht[t];if(Zo(r))return Ha[t]=r.bind(ht);let n=ht.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let o=i.contentWindow;o?.[t]&&(r=o[t]),n.head.removeChild(i)}catch(i){Fd&&ne.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Ha[t]=r.bind(ht))}function $a(t){Ha[t]=void 0}var Xn="__sentry_xhr_v3__";function yp(t){let e="xhr";Pt(e,t),Lt(e,G_)}function G_(){if(!ht.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let i=new Error,o=Ft()*1e3,s=Mt(n[0])?n[0].toUpperCase():void 0,a=Y_(n[1]);if(!s||!a)return e.apply(r,n);r[Xn]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let c=()=>{let p=r[Xn];if(p&&r.readyState===4){try{p.status_code=r.status}catch{}let d={endTimestamp:Ft()*1e3,startTimestamp:o,xhr:r,virtualError:i};ft("xhr",d)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(p,d,f){return c(),p.apply(d,f)}}):r.addEventListener("readystatechange",c),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(p,d,f){let[E,y]=f,I=d[Xn];return I&&Mt(E)&&Mt(y)&&(I.request_headers[E.toLowerCase()]=y),p.apply(d,f)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let i=r[Xn];if(!i)return e.apply(r,n);n[0]!==void 0&&(i.body=n[0]);let o={startTimestamp:Ft()*1e3,xhr:r};return ft("xhr",o),e.apply(r,n)}})}function Y_(t){if(Mt(t))return t;try{return t.toString()}catch{}}function vp(t,e=gp("fetch")){let r=0,n=0;function i(o){let s=o.body.length;r+=s,n++;let a=_({body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return $a("fetch"),wn("No fetch implementation available");try{return e(t.url,a).then(c=>(r-=s,n--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return $a("fetch"),r-=s,n--,wn(c)}}return Na(t,i)}var z_=30;var q_=50;function Ep(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?Ar:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var K_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,X_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,J_=/\((\S*)(?::(\d+))(?::(\d+))\)/,Q_=t=>{let e=K_.exec(t);if(e){let[,n,i,o]=e;return Ep(n,Ar,+i,+o)}let r=X_.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=J_.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[i,o]=Gd(r[1]||Ar,r[2]);return Ep(o,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Vd=[z_,Q_],Z_=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,eb=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tb=t=>{let e=Z_.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let o=eb.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let n=e[3],i=e[1]||Ar;return[i,n]=Gd(i,n),Ep(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Wd=[q_,tb];var jd=[Vd,Wd],_p=pu(...jd),Gd=(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]:Ar,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var Li=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Va=1024,rb="Breadcrumbs",nb=(t={})=>{let e=_({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:rb,setup(r){e.console&&tp(sb(r)),e.dom&&hp(ob(r,e.dom)),e.xhr&&yp(ab(r)),e.fetch&&sp(cb(r)),e.history&&ts(lb(r)),e.sentry&&r.on("beforeSendEvent",ib(r))}}},Yd=nb;function ib(t){return function(r){qe()===t&&Lr({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:Dr(r)},{event:r})}}function ob(t,e){return function(n){if(qe()!==t)return;let i,o,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>Va&&(Li&&ne.warn(`\`dom.maxStringLength\` cannot exceed ${Va}, but a value of ${a} was configured. Sentry will use ${Va} instead.`),a=Va),typeof s=="string"&&(s=[s]);try{let p=n.event,d=ub(p)?p.target:p;i=Vo(d,{keyAttrs:s,maxStringLength:a}),o=bu(d)}catch{i="<unknown>"}if(i.length===0)return;let c={category:`ui.${n.name}`,message:i};o&&(c.data={"ui.component_name":o}),Lr(c,{event:n.event,name:n.name,global:n.global})}}function sb(t){return function(r){if(qe()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:rp(r.level),message:fa(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${fa(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;Lr(n,{input:r.args,level:r.level})}}function ab(t){return function(r){if(qe()!==t)return;let{startTimestamp:n,endTimestamp:i}=r,o=r.xhr[Xn];if(!n||!i||!o)return;let{method:s,url:a,status_code:c,body:p}=o,d={method:s,url:a,status_code:c},f={xhr:r.xhr,input:p,startTimestamp:n,endTimestamp:i},E={category:"xhr",data:d,type:"http",level:Ba(c)};t.emit("beforeOutgoingRequestBreadcrumb",E,f),Lr(E,f)}}function cb(t){return function(r){if(qe()!==t)return;let{startTimestamp:n,endTimestamp:i}=r;if(i&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.fetchData.method,r.fetchData.url,r.error){let o=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:i},a={category:"fetch",data:o,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Lr(a,s)}else{let o=r.response,s=re(_({},r.fetchData),{status_code:o?.status});r.fetchData.request_body_size,r.fetchData.response_body_size,o?.status;let a={input:r.args,response:o,startTimestamp:n,endTimestamp:i},c={category:"fetch",data:s,type:"http",level:Ba(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,a),Lr(c,a)}}}function lb(t){return function(r){if(qe()!==t)return;let n=r.from,i=r.to,o=Jo(Ze.location.href),s=n?Jo(n):void 0,a=Jo(i);s?.path||(s=o),o.protocol===a.protocol&&o.host===a.host&&(i=a.relative),o.protocol===s.protocol&&o.host===s.host&&(n=s.relative),Lr({category:"navigation",data:{from:n,to:i}})}}function ub(t){return!!t&&!!t.target}var pb=["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"],fb="BrowserApiErrors",mb=(t={})=>{let e=_({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:fb,setupOnce(){e.setTimeout&&mt(Ze,"setTimeout",zd),e.setInterval&&mt(Ze,"setInterval",zd),e.requestAnimationFrame&&mt(Ze,"requestAnimationFrame",db),e.XMLHttpRequest&&"XMLHttpRequest"in Ze&&mt(XMLHttpRequest.prototype,"send",hb);let r=e.eventTarget;r&&(Array.isArray(r)?r:pb).forEach(i=>gb(i,e))}}},qd=mb;function zd(t){return function(...e){let r=e[0];return e[0]=Kn(r,{mechanism:{data:{function:rr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function db(t){return function(e){return t.apply(this,[Kn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:rr(t)},handled:!1,type:"instrument"}})])}}function hb(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in r&&typeof r[i]=="function"&&mt(r,i,function(o){let s={mechanism:{data:{function:i,handler:rr(o)},handled:!1,type:"instrument"}},a=qn(o);return a&&(s.mechanism.data.handler=rr(a)),Kn(o,s)})}),t.apply(this,e)}}function gb(t,e){let n=Ze[t]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(mt(n,"addEventListener",function(i){return function(o,s,a){try{yb(s)&&(s.handleEvent=Kn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:rr(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&vb(this,o,s),i.apply(this,[o,Kn(s,{mechanism:{data:{function:"addEventListener",handler:rr(s),target:t},handled:!1,type:"instrument"}}),a])}}),mt(n,"removeEventListener",function(i){return function(o,s,a){try{let c=s.__sentry_wrapped__;c&&i.call(this,o,c,a)}catch{}return i.call(this,o,s,a)}}))}function yb(t){return typeof t.handleEvent=="function"}function vb(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var Kd=()=>({name:"BrowserSession",setupOnce(){if(typeof Ze.document>"u"){Li&&ne.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}zo({ignoreDuration:!0}),qo(),ts(({from:t,to:e})=>{t!==void 0&&t!==e&&(zo({ignoreDuration:!0}),qo())})}});var Eb="GlobalHandlers",_b=(t={})=>{let e=_({onerror:!0,onunhandledrejection:!0},t);return{name:Eb,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(bb(r),Xd("onerror")),e.onunhandledrejection&&(wb(r),Xd("onunhandledrejection"))}}},Jd=_b;function bb(t){mu(e=>{let{stackParser:r,attachStacktrace:n}=Qd();if(qe()!==t||lp())return;let{msg:i,url:o,line:s,column:a,error:c}=e,p=Tb(ka(r,c||i,void 0,n,!1),o,s,a);p.level="error",Yo(p,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function wb(t){hu(e=>{let{stackParser:r,attachStacktrace:n}=Qd();if(qe()!==t||lp())return;let i=Sb(e),o=Yn(i)?Ib(i):ka(r,i,void 0,n,!0);o.level="error",Yo(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Sb(t){if(Yn(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 Ib(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function Tb(t,e,r,n){let i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],p=n,d=r,f=Mt(e)&&e.length>0?e:Wo();return c.length===0&&c.push({colno:p,filename:f,function:Ar,in_app:!0,lineno:d}),t}function Xd(t){Li&&ne.log(`Global Handler attached: ${t}`)}function Qd(){return qe()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var Zd=()=>({name:"HttpContext",preprocessEvent(t){if(!Ze.navigator&&!Ze.location&&!Ze.document)return;let e=Md(),r=_(_({},e.headers),t.request?.headers);t.request=re(_(_({},e),t.request),{headers:r})}});var xb="cause",Cb=5,Rb="LinkedErrors",Ab=(t={})=>{let e=t.limit||Cb,r=t.key||xb;return{name:Rb,preprocessEvent(n,i,o){let s=o.getOptions();ep(Ua,s.stackParser,r,e,n,i)}}},eh=Ab;function bp(t){return[La(),Oa(),qd(),Yd(),Jd(),eh(),Ma(),Zd(),Kd()]}var ja={},Ga,wp,th;(()=>{let t=bp({}).filter(e=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(e.name));wp=new es({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:vp,stackParser:_p,integrations:t,environment:Gt.mode,release:`web-sdk@${P.SDK_VERSION}`,debug:Gt.debug}),wp.init()})();function Te(t,e,r){w.error(`${e}:`,t);let n=ih(r);if(n.setTag("operation",e),t instanceof Vn){Db(n,t,e);return}n.captureException(t)}function rh(t,e,r){ih(r).captureMessage(t,e??"error")}function Db(t,e,r){if(Nb(t,e),e.response){let n=e.response;t.setTag("http.status_code",n.status),t.setExtras({responseText:e.responseText,statusText:n.statusText,responseType:n.type,redirected:n.redirected,responseUrl:n.url}),t.captureMessage(`${r} failed with ${n.status}`,"error");return}if(e.request){t.captureMessage(`No response was received for ${r}`,"error");return}}function Nb(t,e){let r=e.request;r&&t.setExtras({body:e.requestBody,headers:r.headers,method:r.method,url:r.url})}function nh(t){th=t}function Ya(t,e){ja[t]=_(_({},ja[t]),e)}function Mi(t){Ga=_(_({},Ga),t)}function ih(t){t??={};let{extra:e,tags:r}=t,n=new Tt;if(n.setClient(wp),n.setUser(th),t.triggerContext&&!t.engagementTrigger&&(t.engagementTrigger=t.triggerContext.triggerData),t.engagementTrigger){let i=t.engagementTrigger;n.setTags({"engagement.id":i.engagementID,"engagement.short_id":i.shortID,"engagement.objective":i.objective,"engagement.delivery_type":i.onsiteDeliveryType,"engagement.content_id":i.contentID,"engagement.variation":i.variation,"engagement.currency":i.currency})}return e&&n.setExtras(e),r&&n.setTags(r),Ga&&n.setTags(Ga),Object.keys(ja).forEach(i=>{n.setContext(i,ja[i])}),n.setTag("language",navigator.language),n.setTag("timezone",oh()),Ob(n),n}function Ob(t){window.Shopify&&(t.setTag("shopify.shop",window.Shopify.shop),t.setTag("shopify.currency",window.Shopify.currency?.active),t.setTag("shopify.locale",window.Shopify.locale),t.setTag("theme.schema_name",window.Shopify.theme?.schema_name),t.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}var za=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(e,2);case"amount_no_decimals":return this.formatWithDelimiters(e,0);case"amount_with_comma_separator":return this.formatWithDelimiters(e,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(e,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(e,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(e,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(e,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(e,2," ",".");default:return i}})}static formatWithDelimiters(e,r=2,n=",",i="."){if(isNaN(e)||e==null)return"0";let s=(e/100).toFixed(r).split("."),a=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),c=s[1]?i+s[1]:"";return a+c}};function Ka(t){try{return new URL(t)}catch{return}}function Sp(t){return!t||t==="null"||t==="undefined"}function sh(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function Bt(t,e,r){return{[t]:Ip(e,r),[t+"_wo_currency"]:e}}function Ip(t,e){if(t==0&&e)return"Free";let r=de.get(),n=Qe.get(),i=r.shopCurrencyCode||n.currency,o=r.currencyCode;o||w.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,a;if(s&&i===o)a=za.format(t*100,s);else{let c;try{c=new Intl.NumberFormat(ch(),{style:"currency",currency:o||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return Te(p,"format-currency",{extra:{currentCurrency:o,shopCurrency:i}}),""}a=c.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&o!=="INR"&&(a=a.concat(` ${o}`))}return a}function ah(t){return new Intl.NumberFormat(ch(),{notation:"compact"}).format(t)}function ch(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var qa;function oh(){if(qa)return qa;try{return qa=Intl.DateTimeFormat().resolvedOptions().timeZone,qa}catch{return""}}function Bi(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function br(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)},5e3)}async function Tp(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let o=Math.min(100*2**n,5e3);if(await tr.sleep(o),i=r.querySelectorAll(t),i.length)return w.verbose(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;w.verbose(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${o}ms.`),n++}return w.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${t}.`),i}async function Ui(t,e=10,r=document){return(await Tp(t,e,r)).item(0)}async function Xa(){let t=await ze.get(Ee.DEVICE_ID),e=await vt.get(Ee.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 an(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}function lh(t){if(t%100>=11&&t%100<=13)return t+"th";switch(t%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd";default:return t+"th"}}var ec,Ae,dh,Rp,Jn,uh,hh,gh,yh,Ap,xp,Cp,Pb,rs={},vh=[],Lb=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,tc=Array.isArray;function cn(t,e){for(var r in e)t[r]=e[r];return t}function Dp(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Np(t,e,r){var n,i,o,s={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?ec.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return Qa(t,s,n,i,null)}function Qa(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++dh,__i:-1,__u:0};return i==null&&Ae.vnode!=null&&Ae.vnode(o),o}function Br(t){return t.children}function Mr(t,e){this.props=t,this.context=e}function ki(t,e){if(e==null)return t.__?ki(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"?ki(t):null}function Eh(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return Eh(t)}}function ph(t){(!t.__d&&(t.__d=!0)&&Jn.push(t)&&!Za.__r++||uh!=Ae.debounceRendering)&&((uh=Ae.debounceRendering)||hh)(Za)}function Za(){for(var t,e,r,n,i,o,s,a=1;Jn.length;)Jn.length>a&&Jn.sort(gh),t=Jn.shift(),a=Jn.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,o=[],s=[],e.__P&&((r=cn({},n)).__v=n.__v+1,Ae.vnode&&Ae.vnode(r),Op(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??ki(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,wh(o,r,s),r.__e!=i&&Eh(r)));Za.__r=0}function _h(t,e,r,n,i,o,s,a,c,p,d){var f,E,y,I,D,k,O=n&&n.__k||vh,$=e.length;for(c=Mb(r,e,O,c,$),f=0;f<$;f++)(y=r.__k[f])!=null&&(E=y.__i==-1?rs:O[y.__i]||rs,y.__i=f,k=Op(t,y,E,i,o,s,a,c,p,d),I=y.__e,y.ref&&E.ref!=y.ref&&(E.ref&&Pp(E.ref,null,y),d.push(y.ref,y.__c||I,y)),D==null&&I!=null&&(D=I),4&y.__u||E.__k===y.__k?c=bh(y,c,t):typeof y.type=="function"&&k!==void 0?c=k:I&&(c=I.nextSibling),y.__u&=-7);return r.__e=D,c}function Mb(t,e,r,n,i){var o,s,a,c,p,d=r.length,f=d,E=0;for(t.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(c=o+E,(s=t.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?Qa(null,s,null,null,null):tc(s)?Qa(Br,{children:s},null,null,null):s.constructor==null&&s.__b>0?Qa(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(p=s.__i=Bb(s,r,c,f))!=-1&&(f--,(a=r[p])&&(a.__u|=2)),a==null||a.__v==null?(p==-1&&(i>d?E--:i<d&&E++),typeof s.type!="function"&&(s.__u|=4)):p!=c&&(p==c-1?E--:p==c+1?E++:(p>c?E--:E++,s.__u|=4))):t.__k[o]=null;if(f)for(o=0;o<d;o++)(a=r[o])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=ki(a)),Ih(a,a));return n}function bh(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=bh(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=ki(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Bb(t,e,r,n){var i,o,s=t.key,a=t.type,c=e[r];if(c===null&&t.key==null||c&&s==c.key&&a==c.type&&(2&c.__u)==0)return r;if(n>(c!=null&&(2&c.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<e.length;){if(i>=0){if((c=e[i])&&(2&c.__u)==0&&s==c.key&&a==c.type)return i;i--}if(o<e.length){if((c=e[o])&&(2&c.__u)==0&&s==c.key&&a==c.type)return o;o++}}return-1}function fh(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||Lb.test(e)?r:r+"px"}function Ja(t,e,r,n,i){var o,s;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||fh(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||fh(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(yh,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=Ap,t.addEventListener(e,o?Cp:xp,o)):t.removeEventListener(e,o?Cp:xp,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function mh(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Ap++;else if(e.t<r.u)return;return r(Ae.event?Ae.event(e):e)}}}function Op(t,e,r,n,i,o,s,a,c,p){var d,f,E,y,I,D,k,O,$,B,q,Se,Q,ue,le,ge,ke,Re=e.type;if(e.constructor!=null)return null;128&r.__u&&(c=!!(32&r.__u),o=[a=e.__e=r.__e]),(d=Ae.__b)&&d(e);e:if(typeof Re=="function")try{if(O=e.props,$="prototype"in Re&&Re.prototype.render,B=(d=Re.contextType)&&n[d.__c],q=d?B?B.props.value:d.__:n,r.__c?k=(f=e.__c=r.__c).__=f.__E:($?e.__c=f=new Re(O,q):(e.__c=f=new Mr(O,q),f.constructor=Re,f.render=kb),B&&B.sub(f),f.props=O,f.state||(f.state={}),f.context=q,f.__n=n,E=f.__d=!0,f.__h=[],f._sb=[]),$&&f.__s==null&&(f.__s=f.state),$&&Re.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=cn({},f.__s)),cn(f.__s,Re.getDerivedStateFromProps(O,f.__s))),y=f.props,I=f.state,f.__v=e,E)$&&Re.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),$&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if($&&Re.getDerivedStateFromProps==null&&O!==y&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(O,q),!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(O,f.__s,q)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(f.props=O,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Ne){Ne&&(Ne.__=e)}),Se=0;Se<f._sb.length;Se++)f.__h.push(f._sb[Se]);f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(O,f.__s,q),$&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(y,I,D)})}if(f.context=q,f.props=O,f.__P=t,f.__e=!1,Q=Ae.__r,ue=0,$){for(f.state=f.__s,f.__d=!1,Q&&Q(e),d=f.render(f.props,f.state,f.context),le=0;le<f._sb.length;le++)f.__h.push(f._sb[le]);f._sb=[]}else do f.__d=!1,Q&&Q(e),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++ue<25);f.state=f.__s,f.getChildContext!=null&&(n=cn(cn({},n),f.getChildContext())),$&&!E&&f.getSnapshotBeforeUpdate!=null&&(D=f.getSnapshotBeforeUpdate(y,I)),ge=d,d!=null&&d.type===Br&&d.key==null&&(ge=Sh(d.props.children)),a=_h(t,tc(ge)?ge:[ge],e,r,n,i,o,s,a,c,p),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),k&&(f.__E=f.__=null)}catch(Ne){if(e.__v=null,c||o!=null)if(Ne.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(ke=o.length;ke--;)Dp(o[ke]);else e.__e=r.__e,e.__k=r.__k;Ae.__e(Ne,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=Ub(r.__e,e,r,n,i,o,s,c,p);return(d=Ae.diffed)&&d(e),128&e.__u?void 0:a}function wh(t,e,r){for(var n=0;n<r.length;n++)Pp(r[n],r[++n],r[++n]);Ae.__c&&Ae.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){Ae.__e(o,i.__v)}})}function Sh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:tc(t)?t.map(Sh):cn({},t)}function Ub(t,e,r,n,i,o,s,a,c){var p,d,f,E,y,I,D,k=r.props,O=e.props,$=e.type;if($=="svg"?i="http://www.w3.org/2000/svg":$=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(p=0;p<o.length;p++)if((y=o[p])&&"setAttribute"in y==!!$&&($?y.localName==$:y.nodeType==3)){t=y,o[p]=null;break}}if(t==null){if($==null)return document.createTextNode(O);t=document.createElementNS(i,$,O.is&&O),a&&(Ae.__m&&Ae.__m(e,o),a=!1),o=null}if($==null)k===O||a&&t.data==O||(t.data=O);else{if(o=o&&ec.call(t.childNodes),k=r.props||rs,!a&&o!=null)for(k={},p=0;p<t.attributes.length;p++)k[(y=t.attributes[p]).name]=y.value;for(p in k)if(y=k[p],p!="children"){if(p=="dangerouslySetInnerHTML")f=y;else if(!(p in O)){if(p=="value"&&"defaultValue"in O||p=="checked"&&"defaultChecked"in O)continue;Ja(t,p,null,y,i)}}for(p in O)y=O[p],p=="children"?E=y:p=="dangerouslySetInnerHTML"?d=y:p=="value"?I=y:p=="checked"?D=y:a&&typeof y!="function"||k[p]===y||Ja(t,p,y,k[p],i);if(d)a||f&&(d.__html==f.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(f&&(t.innerHTML=""),_h(e.type=="template"?t.content:t,tc(E)?E:[E],e,r,n,$=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&ki(r,0),a,c),o!=null)for(p=o.length;p--;)Dp(o[p]);a||(p="value",$=="progress"&&I==null?t.removeAttribute("value"):I!=null&&(I!==t[p]||$=="progress"&&!I||$=="option"&&I!=k[p])&&Ja(t,p,I,k[p],i),p="checked",D!=null&&D!=t[p]&&Ja(t,p,D,k[p],i))}return t}function Pp(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){Ae.__e(i,r)}}function Ih(t,e,r){var n,i;if(Ae.unmount&&Ae.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Pp(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){Ae.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&Ih(n[i],e,r||typeof t.type!="function");r||Dp(t.__e),t.__c=t.__=t.__e=void 0}function kb(t,e,r){return this.constructor(t,r)}function Th(t,e,r){var n,i,o,s;e==document&&(e=document.documentElement),Ae.__&&Ae.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],s=[],Op(e,t=(!n&&r||e).__k=Np(Br,null,[t]),i||rs,rs,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?ec.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,s),wh(o,t,s)}ec=vh.slice,Ae={__e:function(t,e,r,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},dh=0,Rp=function(t){return t!=null&&t.constructor==null},Mr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=cn({},this.state),typeof t=="function"&&(t=t(cn({},r),this.props)),t&&cn(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),ph(this))},Mr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ph(this))},Mr.prototype.render=Br,Jn=[],hh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,gh=function(t,e){return t.__v.__b-e.__v.__b},Za.__r=0,yh=/(PointerCapture)$|Capture$/i,Ap=0,xp=mh(!1),Cp=mh(!0),Pb=0;var Mp,qt,Lp,xh,Ch=0,Mh=[],gt=Ae,Rh=gt.__b,Ah=gt.__r,Dh=gt.diffed,Nh=gt.__c,Oh=gt.unmount,Ph=gt.__;function Fb(t,e){gt.__h&&gt.__h(qt,t,Ch||e),Ch=0;var r=qt.__H||(qt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Up(t,e){var r=Fb(Mp++,7);return Vb(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Hb(){for(var t;t=Mh.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(rc),t.__H.__h.forEach(Bp),t.__H.__h=[]}catch(e){t.__H.__h=[],gt.__e(e,t.__v)}}gt.__b=function(t){qt=null,Rh&&Rh(t)},gt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ph&&Ph(t,e)},gt.__r=function(t){Ah&&Ah(t),Mp=0;var e=(qt=t.__c).__H;e&&(Lp===qt?(e.__h=[],qt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(rc),e.__h.forEach(Bp),e.__h=[],Mp=0)),Lp=qt},gt.diffed=function(t){Dh&&Dh(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Mh.push(e)!==1&&xh===gt.requestAnimationFrame||((xh=gt.requestAnimationFrame)||$b)(Hb)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Lp=qt=null},gt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(rc),r.__h=r.__h.filter(function(n){return!n.__||Bp(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],gt.__e(n,r.__v)}}),Nh&&Nh(t,e)},gt.unmount=function(t){Oh&&Oh(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{rc(n)}catch(i){e=i}}),r.__H=void 0,e&&gt.__e(e,r.__v))};var Lh=typeof requestAnimationFrame=="function";function $b(t){var e,r=function(){clearTimeout(n),Lh&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);Lh&&(e=requestAnimationFrame(r))}function rc(t){var e=qt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),qt=e}function Bp(t){var e=qt;t.__c=t.__(),qt=e}function Vb(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Wb=Symbol.for("preact-signals");function Fp(){if(Fi>1)Fi--;else{for(var t,e=!1;ns!==void 0;){var r=ns;for(ns=void 0,kp++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Uh(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(kp=0,Fi--,e)throw t}}var We=void 0;var ns=void 0,Fi=0,kp=0,nc=0;function Bh(t){if(We!==void 0){var e=t.n;if(e===void 0||e.t!==We)return e={i:0,S:t,p:We.s,n:void 0,t:We,e:void 0,x:void 0,r:e},We.s!==void 0&&(We.s.n=e),We.s=e,t.n=e,32&We.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=We.s,e.n=void 0,We.s.n=e,We.s=e),e}}function yt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}yt.prototype.brand=Wb;yt.prototype.h=function(){return!0};yt.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)};yt.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)}};yt.prototype.subscribe=function(t){var e=this;return xt(function(){var r=e.value,n=We;We=void 0;try{t(r)}finally{We=n}})};yt.prototype.valueOf=function(){return this.value};yt.prototype.toString=function(){return this.value+""};yt.prototype.toJSON=function(){return this.value};yt.prototype.peek=function(){var t=We;We=void 0;try{return this.value}finally{We=t}};Object.defineProperty(yt.prototype,"value",{get:function(){var t=Bh(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(kp>100)throw new Error("Cycle detected");this.v=t,this.i++,nc++,Fi++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Fp()}}}});function or(t){return new yt(t)}function Uh(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 kh(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 Fh(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 Hi(t){yt.call(this,void 0),this.x=t,this.s=void 0,this.g=nc-1,this.f=4}(Hi.prototype=new yt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===nc))return!0;if(this.g=nc,this.f|=1,this.i>0&&!Uh(this))return this.f&=-2,!0;var t=We;try{kh(this),We=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 We=t,Fh(this),this.f&=-2,!0};Hi.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)}yt.prototype.S.call(this,t)};Hi.prototype.U=function(t){if(this.t!==void 0&&(yt.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)}};Hi.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(Hi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Bh(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Hp(t){return new Hi(t)}function Hh(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Fi++;var r=We;We=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,$p(t),n}finally{We=r,Fp()}}}function $p(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Hh(t)}function jb(t){if(We!==this)throw new Error("Out-of-order effect");Fh(this),We=t,this.f&=-2,8&this.f&&$p(this),Fp()}function is(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}is.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()}};is.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Hh(this),kh(this),Fi++;var t=We;return We=this,jb.bind(this,t)};is.prototype.N=function(){2&this.f||(this.f|=2,this.o=ns,ns=this)};is.prototype.d=function(){this.f|=8,1&this.f||$p(this)};function xt(t){var e=new is(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Wp,Vp;function $i(t,e){Ae[t]=e.bind(null,Ae[t]||function(){})}function ic(t){Vp&&Vp(),Vp=t&&t.S()}function $h(t){var e=this,r=t.data,n=Yb(r);n.value=r;var i=Up(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),c=i.value;a(),Rp(c)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=c},Hp(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}$h.displayName="_st";Object.defineProperties(yt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:$h},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});$i("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof yt&&(r||(e.__np=r={}),r[i]=o,n[i]=o.peek())}}t(e)});$i("__r",function(t,e){ic();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return xt(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Wp=n,ic(r),t(e)});$i("__e",function(t,e,r,n){ic(),Wp=void 0,t(e,r,n)});$i("diffed",function(t,e){ic(),Wp=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var o=r.U;if(o)for(var s in o){var a=o[s];a!==void 0&&!(s in n)&&(a.d(),o[s]=void 0)}else r.U=o={};for(var c in n){var p=o[c],d=n[c];p===void 0?(p=Gb(r,c,d,i),o[c]=p):p.o(d,i)}}}t(e)});function Gb(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,o=or(r);return{o:function(s,a){o.value=s,n=a},d:xt(function(){var s=o.value.value;n[e]!==s&&(n[e]=s,i?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}$i("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});$i("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});Mr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function Yb(t){return Up(function(){return or(t)},[])}var oc=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var sc=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var jp=class{id;mID;name;groupID;groupName;isSelected;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.name=e.name,this.groupID=e.groupID,this.groupName=e.groupName,this.isSelected=e.isSelected??!1}},Ur=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new oc(r))??[],this.link=e.link,this.price=new sc(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.selectedOptions=e.selectedOptions??[],this.effectivePrice=or(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=or(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new jp(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};var Dt=class{id;mID;name;status;ctg;options;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=or(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=or(this.selectedVariant)}get firstImageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(e=>e.isAvailable)??this.vars[0]}hasVariants(){return this.vars[0]!=null&&this.vars[0].name!=="Default Title"}setSelectedVariant(e){this.selectedOrFirstVariant.value=e}update(e){return this.id=e.id,this.mID=e.mID,this.name=e.name,this.status=e.status,this.ctg=e.ctg,this.imgs=e.imgs,this.desc=e.desc,this.sDesc=e.sDesc,this.link=e.link,this.slug=e.slug,this.quantity=e.quantity,this.meta=e.meta,this.category=e.category,this.videos=e.videos,this.reviews=e.reviews,this.options=e.options,this.portraitVideos=e.videos?.filter(r=>r.orientation==="PORTRAIT"),this.tags=e.tags,e.vars&&(this.vars=e.vars.map(r=>new Ur(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new At({id:this.id,mID:this.mID,vID:e.mID,vName:e.name,name:this.name,link:this.link,slug:this.slug,price:e.price.d,imageURL:e.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let e=this.selectedOrFirstVariant.value,r=e.price,n=this.name,i=this.category,o=this.variantImage??this.firstImageURL,s=this.meta,a=this.tags?.join(",")??"",c=this.reviews?.rating,p=this.reviews?.totalReviews,d=r.cmp&&r.cmp>r.d,f=re(_({name:n},Bt("price",r.d,!0)),{image_url:o,meta:s,category:i,rating:c,reviews:p,tags:a});if(e.hasEffectivePrice()){let y=Bt("effective_price",e.effectivePrice.value,!0);Object.assign(f,y)}if(d){let y=r.cmp-r.d,I={discount_percent:(y/r.cmp*100).toFixed(0)};Object.assign(f,I),Object.assign(f,Bt("compare_price",r.cmp)),Object.assign(f,Bt("discount_price",y))}let E={name:e.name,quantity:e.quantity};return{product:f,variant:E}}};var ac=class{id;alt;sources;items;durationMS;thumbnail;card;constructor(e={}){this.id=e.id,this.alt=e.alt,this.sources=e.sources?.sort((r,n)=>n.height-r.height),this.durationMS=e.durationMS,this.thumbnail=e.thumbnail,this.items=e.items?e.items.map(r=>new Dt(r)):[],this.card=e.card}};var cc=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(e={}){this.videos=e.videos?.map(r=>new ac(r))??[],this.source=e.source,this.template=e.template,this.detailPopup=e.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=e.heading,this.showMuteButton=e.showMuteButton,this.slidePerViewCount=e.slidePerViewCount??4,this.autoPlay=e.autoPlay??"ON",this.footerContent=e.footerContent??"FIRST_ITEM"}};var Ut=xr(Wh());Ut.filters.define("default",function(t){return typeof t>"u"||t==null?"":qb(t)});+Ut.filters.define("max",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r>n?e:t});Ut.filters.define("min",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r<n?e:t});Ut.filters.define("fallback",(t,e)=>t==null||t===""?e:t);Ut.filters.define("manipulate_quantity",(t,e,r)=>{if(e??=1,r??=100,e>r)return w.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%r;return n<e?e:n});Ut.filters.define("apply_discount_perc",(t,e,r=1/0)=>{if(t=+t,isNaN(t))return w.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return w.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let n=t*e/100;return t-Math.min(r,n)});Ut.filters.define("apply_discount_fixed",(t,e)=>(t=+t,isNaN(t)?(w.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,t-e)));Ut.filters.define("currency",t=>(t=+t,isNaN(t)?(w.error("Need value as a number for `currency` filter"),NaN):Ip(t)));Ut.defaultConfig.defaultFilter="default";Ut.defaultConfig.useWith=!0;Ut.defaultConfig.autoEscape=!1;var zb={'"':"&quot;","\\":"&bsol;","\n":"\\n"};function qb(t){return String(t).replace(/["\\\n]/g,e=>zb[e])}function Kb(t){if(!t)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return t.replace(e,(r,n,i,o)=>`{{ ${(i||o||"").trim()} }}`)}var Vi=(t,e,r)=>{e=_({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return Ut.render(Kb(t),e)}catch(n){throw Te(n,"squirrelly-render",{extra:{template:t,values:e},triggerContext:r}),n}},Qn=(t,e,r)=>{let n=JSON.stringify(t),i=Vi(n,e,r);try{return JSON.parse(i)}catch(o){throw Te(o,"variable-replacement",{extra:{before:t,after:i},triggerContext:r}),o}};function os(){return!!window.Shopify}function jh(){if(os())return window.Shopify.shop?.split(".")?.[0]}function Gh(t){let n=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function Wi(t){return(window.Shopify?.routes?.root??"/")+t.substring(1)}function uc(t){return Wi(t+"?from=cooee")}var Xb="2024-10",Jb=`/api/${Xb}/graphql.json`,Yh={"Content-Type":"application/json"};async function pc(t,e,r,n){let i=Qe.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");let o=new Headers(Yh);o.append("X-Shopify-Storefront-Access-Token",i);let s=JSON.stringify({query:t,variables:e});try{return await en(Jb,{method:"POST",headers:o,body:s})}catch(a){throw Te(a,r,{engagementTrigger:n}),a}}async function ji(t,e,r,n){return Qb(uc(t),e,r,n)}async function Qb(t,e,r,n){let i={body:JSON.stringify(e),method:"POST",headers:Yh};try{return await en(t,i)}catch(o){throw Te(o,r,{engagementTrigger:n}),o}}var fc=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e()}else this.isLocked=!1}},ss=class t{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){e=`__cooee_${e}_lock__`;let n=!1,i=0,o=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(w.verbose(`Lock retry ${i} for ${e}`),n=await this.acquire(e,o,i),!n);)await this.sleep(t.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,o)}}static async acquire(e,r,n){let i=Date.now(),o=localStorage.getItem(e),s=o?JSON.parse(o):null;if(s&&i<=s.expiry)return!1;let a={owner:r,expiry:i+t.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(a)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(w.verbose(`${r}: Lock acquired for ${e} after ${n} attempts!`),!0):(w.verbose(`${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),w.verbose(`${r}: Lock released`)):w.verbose(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}};var we=class t{static CURRENT;token;items=[];total_price=0;original_total_price=0;items_subtotal_price=0;currency;item_count=0;attributes;cart_level_discount_applications;total_discount=0;lock=new fc;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCartSilently(){try{return await this.getNormalisedCart()}catch(e){w.error("Failed to get the normalised cart",e)}}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await ze.set(Ee.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await vt.get(Ee.ID),r=await ze.get(Ee.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){w.verbose("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()};w.verbose("Updating Shopify cart with attributes:",n);let i=await ji("/cart/update.js",{attributes:n},"cart-add-attributes");w.verbose("Updated cart attributes",JSON.stringify(i.data)),this.update(i.data),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.total_discount=e.total_discount,de.get().currencyCode=this.currency,w.verbose("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 w.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){w.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},o=n.selling_plan_allocation?.selling_plan;if(!o){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){w.verbose("Not fetching cart");return}w.verbose("Fetching cart");let r=uc("/cart.js");try{let n=(await en(r,{},{retries:2})).data;this.update(n)}catch(n){w.error("Unable to fetch the cart",n)}}};var mc=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL}};var Gp=class{enabled;constructor(e){this.enabled=e.enabled}},Yp=class extends Gp{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},dc=class{productQuantity;constructor(e){e??={},this.productQuantity=new Yp(e.productQuantity)}};var Kt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new Hn(e.bg)),e.br&&(this.br=new Qr(e.br)),e.shd&&(this.shd=new ko(e.shd)),e.spc&&(this.spc=new Zr(e.spc)),this.trf=new $n(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Ke[this.t]}get click(){return this.clc}},Ke=(B=>(B[B.IMAGE=1]="IMAGE",B[B.TEXT=2]="TEXT",B[B.BUTTON=3]="BUTTON",B[B.FLEXBOX=4]="FLEXBOX",B[B.MULTI_COLUMN=5]="MULTI_COLUMN",B[B.CHECKBOX=6]="CHECKBOX",B[B.PRODUCTS=11]="PRODUCTS",B[B.PRODUCT=12]="PRODUCT",B[B.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",B[B.PRODUCT_TITLE=14]="PRODUCT_TITLE",B[B.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",B[B.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",B[B.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",B[B.PRODUCT_RATING=19]="PRODUCT_RATING",B[B.EMAIL_INPUT=51]="EMAIL_INPUT",B[B.PHONE_INPUT=52]="PHONE_INPUT",B[B.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",B[B.CAROUSEL=62]="CAROUSEL",B[B.SHAPE=100]="SHAPE",B))(Ke||{});var Zn=class extends Kt{constructor(e){super(e)}};var ln=class extends Kt{src;constructor(e){super(e),this.src=e.src}};var kr=class extends Kt{typo;constructor(e){super(e);let r=_(_({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new pt(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var Sn=class extends kr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var hc=class extends Kt{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var Gi=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0}start(e,r){let n=new Date;e===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let a=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),p=Math.floor(s%(1e3*60*60)/(1e3*60)),d=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:c,minutes:p,seconds:d})},1e3);return i}};var Yi=class extends kr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new Gi(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var gc=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new Ye(e.c??{})}get text(){return this.txt}get color(){return this.c}};var In=class extends kr{ph;constructor(e){super(e),this.ph=new gc(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var zi=class extends In{constructor(e){e??={},super(e)}};var qi=class extends In{};var Ki=class extends In{};var Xi=class extends ln{};var yc=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}};var as=class extends Kt{gvt;max;cover;anim;embedded;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new yc(e.anim),this.spc||(this.spc=new Zr({pl:P.IN_APP_DEFAULT_PADDING,pr:P.IN_APP_DEFAULT_PADDING,pt:P.IN_APP_DEFAULT_PADDING,pb:P.IN_APP_DEFAULT_PADDING}))}};var vc=class extends as{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new hc(e.cont),this.mob=new as(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new ln(r)):r.t===2?this.elems.push(new Sn(r)):r.t===3?this.elems.push(new Sn(r)):r.t===100?this.elems.push(new Zn(r)):r.t===51?this.elems.push(new qi(r)):r.t===52?this.elems.push(new Ki(r)):r.t===61?this.elems.push(new Yi(r)):r.t===15||r.t===16?this.elems.push(new zi(r)):r.t===13&&this.elems.push(new Xi(r))})}getStylesForWrapper(){if(this.cover)return{};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:"50%",left:0,transform:"translateY(-50%)"}:e={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},e.overflow="visible",e}getFlexStylesForContainer(){let e={display:"flex",flexDirection:"row"},r,n;return this.gvt===1?(r="flex-start",n="flex-start"):this.gvt===2?(r="center",n="flex-start"):this.gvt===3?(r="flex-end",n="flex-start"):this.gvt===4?(r="flex-start",n="center"):this.gvt===6?(r="flex-end",n="center"):this.gvt===7?(r="flex-start",n="flex-end"):this.gvt===8?(r="center",n="flex-end"):this.gvt===9?(r="flex-end",n="flex-end"):(r="center",n="center"),e.alignItems=n,e.justifyContent=r,e.overflow="visible",e}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim}};var Ji=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??"row",this.wrap=e.wrap??"nowrap",this.jc=e.jc??"flex-start",this.ai=e.ai??"flex-start",this.scroll=e.scroll}};var Ec=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex}};var _c=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??"100%",this.h=e.h??"auto",this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH}};var bc=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Zr(e.spc),e.size&&(this.size=new _c(e.size)),e.bg&&(this.bg=new Hn(e.bg)),e.br&&(this.br=new Qr(e.br)),e.typo&&(this.typo=new pt(e.typo)),e.lout&&(this.lout=new Ec(e.lout)),e.flex&&(this.flex=new Ji(e.flex))}},Qi=class{sm;lg;constructor(e){e??={},this.sm=new bc(e.sm),this.lg=new bc(e.lg)}};var Et=class{t;style;hide;when;clc;l;constructor(e,r){r??={},this.t=e,this.style=new Qi(r.style),this.hide=r.hide,this.l=r.l,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return Ke[this.t]}};var _t=class extends Et{text;constructor(e,r){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(r??2,e),e??={},this.text=e.text}};var ei=class extends _t{constructor(e,r){super(e,r??3)}};var Zi=class extends Et{value;constructor(e){super(6,e),e??={},this.value=e.value}};var eo=class extends _t{showChips;optionsConfig;constructor(e=15,r){super(r,e),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var wc=class extends Et{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new Ye(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var zh=xr(wi());var zp=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new Ye(e.color)}},qp=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new Ye(e.color)}},cs=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(e){e??={},this.navigation=new qp(e.navigation),this.pagination=new zp(e.pagination),this.autoplay=e.autoplay,this.slidesPerView=e.slidesPerView??1,this.maxInRow=e.maxInRow??e.slidesPerView??4,this.gap=e.gap??0}},Sc=class extends Et{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=Xt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new cs(e.conf),this.allowedTypes=e.allowedTypes}};var Ic=class extends _t{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new Gi(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var Tn=class extends Et{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=Xt.getParsedElement(r);n&&this.elems.push(n)})}};var ti=class extends Et{src;sm;lg;constructor(e,r){super(r??1,e),e&&this.update(e)}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg}};var Xt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=t.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new _t(e);case 3:return new ei(e);case 6:return new Zi(e);case 11:return new Tc(e);case 12:return new xn(e);case 61:return new Ic(e);case 4:return new Tn(e);case 1:return new ti(e);case 13:return new ti(e,13);case 14:return new _t(e,14);case 15:case 16:return new eo(e.t,e);case 18:return new ei(e,18);case 62:return new Sc(e);case 19:return new wc(e);default:zh.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}};var xn=class extends Et{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=Xt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new Zi(e.cBox)),this.elems.push(new ti(e.img,13));let r=new _t(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new _t(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let i=new _t(e.compareAt);i.text="{{ product.compare_price }}",i.hide=!e.show?.price,e.compareAt||(i.style=new Qi(n.style),i.style.lg.typo=new pt(re(_({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new pt(re(_({},i.style.sm.typo),{td:"line-through"})));let o=new Tn({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Xt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new eo(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new ei(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new _t(e.symbol))}};var Tc=class extends Et{conf;prod;constructor(e){super(11,e),e??={},this.conf=new Kp(e.conf),this.prod=new xn(e.prod)}};var xc=class extends cs{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},Kp=class{lg;sm;constructor(e){e??={},this.lg=new xc(e.lg),this.sm=new xc(e.sm)}};var Cc=class extends Tn{constructor(e){super(e)}};var to=class{cont;elems=[];constructor(e){e=e??{},this.cont=new Cc(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=Xt.getParsedElement(e);return r&&this.elems.push(r),r}};function Rc(t,e){return Zb(t,e,0,5)}function Zb(t,e,r=0,n=50){if(e){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let i of e){if(i.t===t)return i;let o="elems"in i?i.elems:[];if(o?.length>0){let s=Rc(t,o);if(s)return s}}}}var Xp=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Po.EXCLUSION}isABTesting(){return this.contentType===Po.ABTESTING}isSingleContent(){return this.contentType===Po.SINGLE}},ls=class{videoConfig;savingsBarConfig;constructor(e){this.update(e)}update(e){e??={},e.videoConfig&&(this.videoConfig=new cc(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new sa(e.savingsBarConfig))}},Ct=class extends Xp{contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;entryAnimation;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=or({});constructor(e){super(e),this.id=e.id,this.currency=de.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new to(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??"NONE",this.embeddedItems=e.embeddedItems?.map(r=>new At(r)),this.items=e.items?.map(r=>new Dt(r))??[],this.nonMutableItems=e.items?.map(r=>new Dt(r))??[],this.collections=e.collections?.map(r=>new mc(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 dc(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 na(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new oa(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new ea(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Dt(e.bundleFrom)),e.content&&(this.content=new ls(e.content))}shouldDelay(){return this.delay>0}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===yr.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Lo.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Lo.PAGE_EMBED}isProgressBar(){return this.objective===yr.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===yr.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===yr.CART_RECOVERY}isProductPromotion(){return this.objective===yr.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===Xl.COLLECTION}isBYOB(){return this.objective===yr.BYOB}isStickyATC(){return this.objective===yr.STICKY_ATC}isShoppableVideo(){return this.objective===yr.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===yr.SAVINGS_BAR}processPopup(e){let r=this.items[0],n={},i={};if(r){let a=r.selectedOrFirstVariant.value;n=re(_(_({name:r.name,id:r.mID,link:r.link,vID:a.mID,image:r.variantImage},Bt("price",a.price.d)),Bt("comparePrice",a.price.cmp)),{quantity:r.quantity}),i={quantity:a.quantity}}let o={productCount:we.getCurrent().item_count},s=Vi(JSON.stringify(e),{product:n,variant:i,cart:o,discount:this.discount,customer:this.customerData},new Cr(new Date,this));return r&&(s=s.replace(new RegExp(P.PLACEHOLDER_IMAGE,"gi"),r.variantImage??r.firstImageURL)),new vc(JSON.parse(s))}calculateDiscountData(e,r){let n=Jr.sum(e,s=>s.selectedOrFirstVariant.value.price.d),i=Jr.sum(e,s=>{let a=s.selectedOrFirstVariant.value.price;return a.cmp??a.d}),o={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(o);return}if(Zt.BXGY===this.discount.type&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,o.discountPercentage,!0),o.discountAmount=o.actualPrice-Jr.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([Zt.UNIQUE_FLAT_ITEMS,Zt.STATIC,Zt.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===Zt.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)o.discountAmount=o.actualPrice-this.discount.values[0],o.discountPercentage=o.discountAmount/o.actualPrice*100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===Zt.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,c)=>c.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,o.discountAmount=s.selectedOrFirstVariant.value.price.d,o.discountPercentage=o.discountAmount/o.actualPrice*100}o.discountedPrice=o.actualPrice-o.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(o)}getPrivateAttributesForLineItem(){return Qe.get().skipItemAttribute?{}:{[P.VIA]:"Cooee",[P.CAMPAIGN_ATTRIBUTE]:this.shortID,[P.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Qe.get().skipItemAttribute?[]:[{key:P.VIA,value:"Cooee"},{key:P.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:P.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){if(Rc(62,this.widget?.elems))return!0;let r=Rc(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){let e;return this.onsiteDeliveryType===Lo.POPUP?e="Popup":e=cm.toTitle(this.objective),`${e}(id=${this.shortID})`}getCartMagicVariables(){let e=we.getCurrent(),r=Jr.sum(e.items??[],n=>n.discounts?.reduce((i,o)=>i+(o.amount??0),0)??0);return _(_(_(_({productCount:e.item_count,product_count:e.item_count},Bt("amount",e.total_price/100)),Bt("originalAmount",e.original_total_price/100)),Bt("total_line_items_discount",r/100)),Bt("total_discount",e.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.isProgressBar()&&!this.isSavingsBar()}shouldSkipVariation(){return this.isSingleContent()||this.isProgressBar()||this.isSavingsBar()||!!this.widget}updateEffectivePrice(e,r,n=!1){let i=de.get().getCurrentItem();e.forEach(o=>{let s=o.selectedOrFirstVariant.value,a=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=a.d;else{let c=a.d*r/100;s.effectivePrice.value=a.d-c}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:ah(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,Bt(n,e[n]))}),r}};function tw(t,e){return e={exports:{}},t(e,e.exports),e.exports}var rw=sw,nw=cw,iw=pw,Hr=[],ar=[],ow=typeof Uint8Array<"u"?Uint8Array:Array,Jp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ri=0,qh=Jp.length;ri<qh;++ri)Hr[ri]=Jp[ri],ar[Jp.charCodeAt(ri)]=ri;var ri,qh;ar[45]=62;ar[95]=63;function ug(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 sw(t){var e=ug(t),r=e[0],n=e[1];return(r+n)*3/4-n}function aw(t,e,r){return(e+r)*3/4-r}function cw(t){var e,r=ug(t),n=r[0],i=r[1],o=new ow(aw(t,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=ar[t.charCodeAt(c)]<<18|ar[t.charCodeAt(c+1)]<<12|ar[t.charCodeAt(c+2)]<<6|ar[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=ar[t.charCodeAt(c)]<<2|ar[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=ar[t.charCodeAt(c)]<<10|ar[t.charCodeAt(c+1)]<<4|ar[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function lw(t){return Hr[t>>18&63]+Hr[t>>12&63]+Hr[t>>6&63]+Hr[t&63]}function uw(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(lw(n));return i.join("")}function pw(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(uw(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(Hr[e>>2]+Hr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Hr[e>>10]+Hr[e>>4&63]+Hr[e<<2&63]+"=")),i.join("")}var Qp={byteLength:rw,toByteArray:nw,fromByteArray:iw};var fw=function(e,r,n,i,o){var s,a,c=o*8-i-1,p=(1<<c)-1,d=p>>1,f=-7,E=n?o-1:0,y=n?-1:1,I=e[r+E];for(E+=y,s=I&(1<<-f)-1,I>>=-f,f+=c;f>0;s=s*256+e[r+E],E+=y,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=i;f>0;a=a*256+e[r+E],E+=y,f-=8);if(s===0)s=1-d;else{if(s===p)return a?NaN:(I?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-d}return(I?-1:1)*a*Math.pow(2,s-i)},mw=function(e,r,n,i,o,s){var a,c,p,d=s*8-o-1,f=(1<<d)-1,E=f>>1,y=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=i?0:s-1,D=i?1:-1,k=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+E>=1?r+=y/p:r+=y*Math.pow(2,1-E),r*p>=2&&(a++,p/=2),a+E>=f?(c=0,a=f):a+E>=1?(c=(r*p-1)*Math.pow(2,o),a=a+E):(c=r*Math.pow(2,E-1)*Math.pow(2,o),a=0));o>=8;e[n+I]=c&255,I+=D,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;e[n+I]=a&255,I+=D,a/=256,d-=8);e[n+I-D]|=k*128},ro={read:fw,write:mw},Nc=tw(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var h=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(h,l),h.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(h){if(h>n)throw new RangeError('The value "'+h+'" is invalid for option "size"');var l=new Uint8Array(h);return Object.setPrototypeOf(l,s.prototype),l}function s(h,l,u){if(typeof h=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(h)}return a(h,l,u)}s.poolSize=8192;function a(h,l,u){if(typeof h=="string")return f(h,l);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h));if(Ge(h,ArrayBuffer)||h&&Ge(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ge(h,SharedArrayBuffer)||h&&Ge(h.buffer,SharedArrayBuffer)))return I(h,l,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var v=h.valueOf&&h.valueOf();if(v!=null&&v!==h)return s.from(v,l,u);var C=D(h);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return s.from(h[Symbol.toPrimitive]("string"),l,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h))}s.from=function(h,l,u){return a(h,l,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function p(h,l,u){return c(h),h<=0?o(h):l!==void 0?typeof u=="string"?o(h).fill(l,u):o(h).fill(l):o(h)}s.alloc=function(h,l,u){return p(h,l,u)};function d(h){return c(h),o(h<0?0:k(h)|0)}s.allocUnsafe=function(h){return d(h)},s.allocUnsafeSlow=function(h){return d(h)};function f(h,l){if((typeof l!="string"||l==="")&&(l="utf8"),!s.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var u=$(h,l)|0,v=o(u),C=v.write(h,l);return C!==u&&(v=v.slice(0,C)),v}function E(h){for(var l=h.length<0?0:k(h.length)|0,u=o(l),v=0;v<l;v+=1)u[v]=h[v]&255;return u}function y(h){if(Ge(h,Uint8Array)){var l=new Uint8Array(h);return I(l.buffer,l.byteOffset,l.byteLength)}return E(h)}function I(h,l,u){if(l<0||h.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<l+(u||0))throw new RangeError('"length" is outside of buffer bounds');var v;return l===void 0&&u===void 0?v=new Uint8Array(h):u===void 0?v=new Uint8Array(h,l):v=new Uint8Array(h,l,u),Object.setPrototypeOf(v,s.prototype),v}function D(h){if(s.isBuffer(h)){var l=k(h.length)|0,u=o(l);return u.length===0||h.copy(u,0,0,l),u}if(h.length!==void 0)return typeof h.length!="number"||Pe(h.length)?o(0):E(h);if(h.type==="Buffer"&&Array.isArray(h.data))return E(h.data)}function k(h){if(h>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return h|0}function O(h){return+h!=h&&(h=0),s.alloc(+h)}s.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==s.prototype},s.compare=function(l,u){if(Ge(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),Ge(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(l)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===u)return 0;for(var v=l.length,C=u.length,N=0,G=Math.min(v,C);N<G;++N)if(l[N]!==u[N]){v=l[N],C=u[N];break}return v<C?-1:C<v?1:0},s.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(l,u){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return s.alloc(0);var v;if(u===void 0)for(u=0,v=0;v<l.length;++v)u+=l[v].length;var C=s.allocUnsafe(u),N=0;for(v=0;v<l.length;++v){var G=l[v];if(Ge(G,Uint8Array))N+G.length>C.length?s.from(G).copy(C,N):Uint8Array.prototype.set.call(C,G,N);else if(s.isBuffer(G))G.copy(C,N);else throw new TypeError('"list" argument must be an Array of Buffers');N+=G.length}return C};function $(h,l){if(s.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||Ge(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(h));var u=h.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&u===0)return 0;for(var C=!1;;)switch(l){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return It(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return je(h).length;default:if(C)return v?-1:It(h).length;l=(""+l).toLowerCase(),C=!0}}s.byteLength=$;function B(h,l,u){var v=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,l>>>=0,u<=l))return"";for(h||(h="utf8");;)switch(h){case"hex":return j(this,l,u);case"utf8":case"utf-8":return Xe(this,l,u);case"ascii":return A(this,l,u);case"latin1":case"binary":return R(this,l,u);case"base64":return Ne(this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,l,u);default:if(v)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),v=!0}}s.prototype._isBuffer=!0;function q(h,l,u){var v=h[l];h[l]=h[u],h[u]=v}s.prototype.swap16=function(){var l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<l;u+=2)q(this,u,u+1);return this},s.prototype.swap32=function(){var l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<l;u+=4)q(this,u,u+3),q(this,u+1,u+2);return this},s.prototype.swap64=function(){var l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<l;u+=8)q(this,u,u+7),q(this,u+1,u+6),q(this,u+2,u+5),q(this,u+3,u+4);return this},s.prototype.toString=function(){var l=this.length;return l===0?"":arguments.length===0?Xe(this,0,l):B.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(l){if(!s.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:s.compare(this,l)===0},s.prototype.inspect=function(){var l="",u=e.INSPECT_MAX_BYTES;return l=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(l+=" ... "),"<Buffer "+l+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(l,u,v,C,N){if(Ge(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),!s.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(l));if(u===void 0&&(u=0),v===void 0&&(v=l?l.length:0),C===void 0&&(C=0),N===void 0&&(N=this.length),u<0||v>l.length||C<0||N>this.length)throw new RangeError("out of range index");if(C>=N&&u>=v)return 0;if(C>=N)return-1;if(u>=v)return 1;if(u>>>=0,v>>>=0,C>>>=0,N>>>=0,this===l)return 0;for(var G=N-C,me=v-u,Ie=Math.min(G,me),ve=this.slice(C,N),Fe=l.slice(u,v),Ve=0;Ve<Ie;++Ve)if(ve[Ve]!==Fe[Ve]){G=ve[Ve],me=Fe[Ve];break}return G<me?-1:me<G?1:0};function Se(h,l,u,v,C){if(h.length===0)return-1;if(typeof u=="string"?(v=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Pe(u)&&(u=C?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(C)return-1;u=h.length-1}else if(u<0)if(C)u=0;else return-1;if(typeof l=="string"&&(l=s.from(l,v)),s.isBuffer(l))return l.length===0?-1:Q(h,l,u,v,C);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?C?Uint8Array.prototype.indexOf.call(h,l,u):Uint8Array.prototype.lastIndexOf.call(h,l,u):Q(h,[l],u,v,C);throw new TypeError("val must be string, number or Buffer")}function Q(h,l,u,v,C){var N=1,G=h.length,me=l.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(h.length<2||l.length<2)return-1;N=2,G/=2,me/=2,u/=2}function Ie(dr,Kr){return N===1?dr[Kr]:dr.readUInt16BE(Kr*N)}var ve;if(C){var Fe=-1;for(ve=u;ve<G;ve++)if(Ie(h,ve)===Ie(l,Fe===-1?0:ve-Fe)){if(Fe===-1&&(Fe=ve),ve-Fe+1===me)return Fe*N}else Fe!==-1&&(ve-=ve-Fe),Fe=-1}else for(u+me>G&&(u=G-me),ve=u;ve>=0;ve--){for(var Ve=!0,st=0;st<me;st++)if(Ie(h,ve+st)!==Ie(l,st)){Ve=!1;break}if(Ve)return ve}return-1}s.prototype.includes=function(l,u,v){return this.indexOf(l,u,v)!==-1},s.prototype.indexOf=function(l,u,v){return Se(this,l,u,v,!0)},s.prototype.lastIndexOf=function(l,u,v){return Se(this,l,u,v,!1)};function ue(h,l,u,v){u=Number(u)||0;var C=h.length-u;v?(v=Number(v),v>C&&(v=C)):v=C;var N=l.length;v>N/2&&(v=N/2);for(var G=0;G<v;++G){var me=parseInt(l.substr(G*2,2),16);if(Pe(me))return G;h[u+G]=me}return G}function le(h,l,u,v){return Oe(It(l,h.length-u),h,u,v)}function ge(h,l,u,v){return Oe(ut(l),h,u,v)}function ke(h,l,u,v){return Oe(je(l),h,u,v)}function Re(h,l,u,v){return Oe(xe(l,h.length-u),h,u,v)}s.prototype.write=function(l,u,v,C){if(u===void 0)C="utf8",v=this.length,u=0;else if(v===void 0&&typeof u=="string")C=u,v=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(v)?(v=v>>>0,C===void 0&&(C="utf8")):(C=v,v=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var N=this.length-u;if((v===void 0||v>N)&&(v=N),l.length>0&&(v<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");C||(C="utf8");for(var G=!1;;)switch(C){case"hex":return ue(this,l,u,v);case"utf8":case"utf-8":return le(this,l,u,v);case"ascii":case"latin1":case"binary":return ge(this,l,u,v);case"base64":return ke(this,l,u,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Re(this,l,u,v);default:if(G)throw new TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),G=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ne(h,l,u){return l===0&&u===h.length?Qp.fromByteArray(h):Qp.fromByteArray(h.slice(l,u))}function Xe(h,l,u){u=Math.min(h.length,u);for(var v=[],C=l;C<u;){var N=h[C],G=null,me=N>239?4:N>223?3:N>191?2:1;if(C+me<=u){var Ie,ve,Fe,Ve;switch(me){case 1:N<128&&(G=N);break;case 2:Ie=h[C+1],(Ie&192)===128&&(Ve=(N&31)<<6|Ie&63,Ve>127&&(G=Ve));break;case 3:Ie=h[C+1],ve=h[C+2],(Ie&192)===128&&(ve&192)===128&&(Ve=(N&15)<<12|(Ie&63)<<6|ve&63,Ve>2047&&(Ve<55296||Ve>57343)&&(G=Ve));break;case 4:Ie=h[C+1],ve=h[C+2],Fe=h[C+3],(Ie&192)===128&&(ve&192)===128&&(Fe&192)===128&&(Ve=(N&15)<<18|(Ie&63)<<12|(ve&63)<<6|Fe&63,Ve>65535&&Ve<1114112&&(G=Ve))}}G===null?(G=65533,me=1):G>65535&&(G-=65536,v.push(G>>>10&1023|55296),G=56320|G&1023),v.push(G),C+=me}return kt(v)}var tt=4096;function kt(h){var l=h.length;if(l<=tt)return String.fromCharCode.apply(String,h);for(var u="",v=0;v<l;)u+=String.fromCharCode.apply(String,h.slice(v,v+=tt));return u}function A(h,l,u){var v="";u=Math.min(h.length,u);for(var C=l;C<u;++C)v+=String.fromCharCode(h[C]&127);return v}function R(h,l,u){var v="";u=Math.min(h.length,u);for(var C=l;C<u;++C)v+=String.fromCharCode(h[C]);return v}function j(h,l,u){var v=h.length;(!l||l<0)&&(l=0),(!u||u<0||u>v)&&(u=v);for(var C="",N=l;N<u;++N)C+=jt[h[N]];return C}function F(h,l,u){for(var v=h.slice(l,u),C="",N=0;N<v.length-1;N+=2)C+=String.fromCharCode(v[N]+v[N+1]*256);return C}s.prototype.slice=function(l,u){var v=this.length;l=~~l,u=u===void 0?v:~~u,l<0?(l+=v,l<0&&(l=0)):l>v&&(l=v),u<0?(u+=v,u<0&&(u=0)):u>v&&(u=v),u<l&&(u=l);var C=this.subarray(l,u);return Object.setPrototypeOf(C,s.prototype),C};function V(h,l,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+l>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||V(l,u,this.length);for(var C=this[l],N=1,G=0;++G<u&&(N*=256);)C+=this[l+G]*N;return C},s.prototype.readUintBE=s.prototype.readUIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||V(l,u,this.length);for(var C=this[l+--u],N=1;u>0&&(N*=256);)C+=this[l+--u]*N;return C},s.prototype.readUint8=s.prototype.readUInt8=function(l,u){return l=l>>>0,u||V(l,1,this.length),this[l]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(l,u){return l=l>>>0,u||V(l,2,this.length),this[l]|this[l+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(l,u){return l=l>>>0,u||V(l,2,this.length),this[l]<<8|this[l+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(l,u){return l=l>>>0,u||V(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(l,u){return l=l>>>0,u||V(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},s.prototype.readIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||V(l,u,this.length);for(var C=this[l],N=1,G=0;++G<u&&(N*=256);)C+=this[l+G]*N;return N*=128,C>=N&&(C-=Math.pow(2,8*u)),C},s.prototype.readIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||V(l,u,this.length);for(var C=u,N=1,G=this[l+--C];C>0&&(N*=256);)G+=this[l+--C]*N;return N*=128,G>=N&&(G-=Math.pow(2,8*u)),G},s.prototype.readInt8=function(l,u){return l=l>>>0,u||V(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},s.prototype.readInt16LE=function(l,u){l=l>>>0,u||V(l,2,this.length);var v=this[l]|this[l+1]<<8;return v&32768?v|4294901760:v},s.prototype.readInt16BE=function(l,u){l=l>>>0,u||V(l,2,this.length);var v=this[l+1]|this[l]<<8;return v&32768?v|4294901760:v},s.prototype.readInt32LE=function(l,u){return l=l>>>0,u||V(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},s.prototype.readInt32BE=function(l,u){return l=l>>>0,u||V(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},s.prototype.readFloatLE=function(l,u){return l=l>>>0,u||V(l,4,this.length),ro.read(this,l,!0,23,4)},s.prototype.readFloatBE=function(l,u){return l=l>>>0,u||V(l,4,this.length),ro.read(this,l,!1,23,4)},s.prototype.readDoubleLE=function(l,u){return l=l>>>0,u||V(l,8,this.length),ro.read(this,l,!0,52,8)},s.prototype.readDoubleBE=function(l,u){return l=l>>>0,u||V(l,8,this.length),ro.read(this,l,!1,52,8)};function se(h,l,u,v,C,N){if(!s.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>C||l<N)throw new RangeError('"value" argument is out of bounds');if(u+v>h.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(l,u,v,C){if(l=+l,u=u>>>0,v=v>>>0,!C){var N=Math.pow(2,8*v)-1;se(this,l,u,v,N,0)}var G=1,me=0;for(this[u]=l&255;++me<v&&(G*=256);)this[u+me]=l/G&255;return u+v},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(l,u,v,C){if(l=+l,u=u>>>0,v=v>>>0,!C){var N=Math.pow(2,8*v)-1;se(this,l,u,v,N,0)}var G=v-1,me=1;for(this[u+G]=l&255;--G>=0&&(me*=256);)this[u+G]=l/me&255;return u+v},s.prototype.writeUint8=s.prototype.writeUInt8=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,1,255,0),this[u]=l&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,2,65535,0),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,2,65535,0),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,4,4294967295,0),this[u+3]=l>>>24,this[u+2]=l>>>16,this[u+1]=l>>>8,this[u]=l&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,4,4294967295,0),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4},s.prototype.writeIntLE=function(l,u,v,C){if(l=+l,u=u>>>0,!C){var N=Math.pow(2,8*v-1);se(this,l,u,v,N-1,-N)}var G=0,me=1,Ie=0;for(this[u]=l&255;++G<v&&(me*=256);)l<0&&Ie===0&&this[u+G-1]!==0&&(Ie=1),this[u+G]=(l/me>>0)-Ie&255;return u+v},s.prototype.writeIntBE=function(l,u,v,C){if(l=+l,u=u>>>0,!C){var N=Math.pow(2,8*v-1);se(this,l,u,v,N-1,-N)}var G=v-1,me=1,Ie=0;for(this[u+G]=l&255;--G>=0&&(me*=256);)l<0&&Ie===0&&this[u+G+1]!==0&&(Ie=1),this[u+G]=(l/me>>0)-Ie&255;return u+v},s.prototype.writeInt8=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,1,127,-128),l<0&&(l=255+l+1),this[u]=l&255,u+1},s.prototype.writeInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,2,32767,-32768),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,2,32767,-32768),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,4,2147483647,-2147483648),this[u]=l&255,this[u+1]=l>>>8,this[u+2]=l>>>16,this[u+3]=l>>>24,u+4},s.prototype.writeInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||se(this,l,u,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4};function ye(h,l,u,v,C,N){if(u+v>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function Je(h,l,u,v,C){return l=+l,u=u>>>0,C||ye(h,l,u,4),ro.write(h,l,u,v,23,4),u+4}s.prototype.writeFloatLE=function(l,u,v){return Je(this,l,u,!0,v)},s.prototype.writeFloatBE=function(l,u,v){return Je(this,l,u,!1,v)};function it(h,l,u,v,C){return l=+l,u=u>>>0,C||ye(h,l,u,8),ro.write(h,l,u,v,52,8),u+8}s.prototype.writeDoubleLE=function(l,u,v){return it(this,l,u,!0,v)},s.prototype.writeDoubleBE=function(l,u,v){return it(this,l,u,!1,v)},s.prototype.copy=function(l,u,v,C){if(!s.isBuffer(l))throw new TypeError("argument should be a Buffer");if(v||(v=0),!C&&C!==0&&(C=this.length),u>=l.length&&(u=l.length),u||(u=0),C>0&&C<v&&(C=v),C===v||l.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(v<0||v>=this.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("sourceEnd out of bounds");C>this.length&&(C=this.length),l.length-u<C-v&&(C=l.length-u+v);var N=C-v;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,v,C):Uint8Array.prototype.set.call(l,this.subarray(v,C),u),N},s.prototype.fill=function(l,u,v,C){if(typeof l=="string"){if(typeof u=="string"?(C=u,u=0,v=this.length):typeof v=="string"&&(C=v,v=this.length),C!==void 0&&typeof C!="string")throw new TypeError("encoding must be a string");if(typeof C=="string"&&!s.isEncoding(C))throw new TypeError("Unknown encoding: "+C);if(l.length===1){var N=l.charCodeAt(0);(C==="utf8"&&N<128||C==="latin1")&&(l=N)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(u<0||this.length<u||this.length<v)throw new RangeError("Out of range index");if(v<=u)return this;u=u>>>0,v=v===void 0?this.length:v>>>0,l||(l=0);var G;if(typeof l=="number")for(G=u;G<v;++G)this[G]=l;else{var me=s.isBuffer(l)?l:s.from(l,C),Ie=me.length;if(Ie===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(G=0;G<v-u;++G)this[G+u]=me[G%Ie]}return this};var ot=/[^+/0-9A-Za-z-_]/g;function St(h){if(h=h.split("=")[0],h=h.trim().replace(ot,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function It(h,l){l=l||1/0;for(var u,v=h.length,C=null,N=[],G=0;G<v;++G){if(u=h.charCodeAt(G),u>55295&&u<57344){if(!C){if(u>56319){(l-=3)>-1&&N.push(239,191,189);continue}else if(G+1===v){(l-=3)>-1&&N.push(239,191,189);continue}C=u;continue}if(u<56320){(l-=3)>-1&&N.push(239,191,189),C=u;continue}u=(C-55296<<10|u-56320)+65536}else C&&(l-=3)>-1&&N.push(239,191,189);if(C=null,u<128){if((l-=1)<0)break;N.push(u)}else if(u<2048){if((l-=2)<0)break;N.push(u>>6|192,u&63|128)}else if(u<65536){if((l-=3)<0)break;N.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((l-=4)<0)break;N.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return N}function ut(h){for(var l=[],u=0;u<h.length;++u)l.push(h.charCodeAt(u)&255);return l}function xe(h,l){for(var u,v,C,N=[],G=0;G<h.length&&!((l-=2)<0);++G)u=h.charCodeAt(G),v=u>>8,C=u%256,N.push(C),N.push(v);return N}function je(h){return Qp.toByteArray(St(h))}function Oe(h,l,u,v){for(var C=0;C<v&&!(C+u>=l.length||C>=h.length);++C)l[C+u]=h[C];return C}function Ge(h,l){return h instanceof l||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===l.name}function Pe(h){return h!==h}var jt=function(){for(var h="0123456789abcdef",l=new Array(256),u=0;u<16;++u)for(var v=u*16,C=0;C<16;++C)l[v+C]=h[u]+h[C];return l}()}),De=Nc.Buffer;Nc.SlowBuffer;Nc.INSPECT_MAX_BYTES;Nc.kMaxLength;var nf=function(e,r){return nf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},nf(e,r)};function Oc(t,e){nf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var ii=function(t){Oc(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),et=function(t){Oc(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 Ac(t){return t&&t.Math==Math&&t}function pg(){return Ac(typeof globalThis=="object"&&globalThis)||Ac(typeof window=="object"&&window)||Ac(typeof self=="object"&&self)||Ac(typeof global=="object"&&global)||Function("return this")()}function dw(){var t=pg();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var hw=function(e){var r=dw()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(r);for(var n=De.alloc(e),i=0;i<e;++i)n[i]=Math.floor(Math.random()*256);return n},gw=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(De.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(De.alloc(e))}:hw}},fg=gw();function yw(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function sf(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function vw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ew(t){return ms(t)&&Object.prototype.toString.call(t)==="[object Date]"}function ms(t){return typeof t=="object"&&t!==null}function Pc(t,e){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function Dc(t){if(ArrayBuffer.isView(t))return De.from(t.buffer,t.byteOffset,t.byteLength);if(yw(t))return De.from(t);throw new et("Must use either Buffer or TypedArray")}var _w=/^(?:[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,mg=function(t){return typeof t=="string"&&_w.test(t)},of=function(t){if(!mg(t))throw new et('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 De.from(e,"hex")},Kh=function(t,e){return e===void 0&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")};var oB=Math.pow(2,63)-1,sB=-Math.pow(2,63),bw=Math.pow(2,53),ww=-Math.pow(2,53);var dg=4;var oi=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 et("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=De.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=De.from(e,"binary"):Array.isArray(e)?this.buffer=De.from(e):this.buffer=Dc(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new et("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new et("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 et("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=De.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=De.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Dc(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 Xh(this.buffer.slice(0,this.position));throw new ii('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=De.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=De.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=of(e.$uuid)),!n)throw new et("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===dg?new Xh(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(oi.prototype,"_bsontype",{value:"Binary"});var Zp=16,Xh=function(t){Oc(e,t);function e(r){var n=this,i,o;if(r==null)i=e.generate();else if(r instanceof e)i=De.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===Zp)i=Dc(r);else if(typeof r=="string")i=of(r);else throw new et("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,dg)||this,n.__id=o,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Kh(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=Kh(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 oi(this.id,oi.SUBTYPE_UUID)},e.generate=function(){var r=fg(Zp);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,De.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?mg(r):sf(r)?r.length!==Zp?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=of(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}(oi),Lc=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(Lc.prototype,"_bsontype",{value:"Code"});function Sw(t){return ms(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var ps=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");o.length===2&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(ps.prototype,"_bsontype",{value:"DBRef"});var sr=void 0;try{sr=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 Jh=65536,Iw=1<<24,io=Jh*Jh,hg=io*io,Qh=hg/2,Zh={},eg={},ae=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(e>>>=0,(o=0<=e&&e<256)&&(i=eg[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),o&&(eg[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(i=Zh[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(Zh[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>=hg)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Qh)return t.MIN_VALUE;if(e+1>=Qh)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%io|0,e/io|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),p=parseInt(e.substring(a,a+c),n);if(c<8){var d=t.fromNumber(Math.pow(n,c));s=s.mul(d).add(t.fromNumber(p))}else s=s.mul(o),s=s.add(t.fromNumber(p))}return s.unsigned=r,s},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return ms(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,p=e.low&65535,d=0,f=0,E=0,y=0;return y+=o+p,E+=y>>>16,y&=65535,E+=i+c,f+=E>>>16,E&=65535,f+=n+a,d+=f>>>16,f&=65535,d+=r+s,d&=65535,t.fromBits(E<<16|y,d<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(sr){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?sr.div_u:sr.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Math.pow(2,a-48),p=t.fromNumber(n),d=p.mul(e);d.isNegative()||d.gt(i);)n-=c,p=t.fromNumber(n,this.unsigned),d=p.mul(e);p.isZero()&&(p=t.ONE),o=o.add(p),i=i.sub(d)}return o},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),sr){var r=(this.unsigned?sr.rem_u:sr.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.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)),sr){var r=sr.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,p=e.low>>>16,d=e.low&65535,f=0,E=0,y=0,I=0;return I+=s*d,y+=I>>>16,I&=65535,y+=o*d,E+=y>>>16,y&=65535,y+=s*p,E+=y>>>16,y&=65535,E+=i*d,f+=E>>>16,E&=65535,E+=o*p,f+=E>>>16,E&=65535,E+=s*c,f+=E>>>16,E&=65535,f+=n*d+i*p+o*c+s*a,f&=65535,t.fromBits(y<<16|I,f<<16|E,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*io+(this.low>>>0):this.high*io+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),p=s.sub(c.mul(o)).toInt()>>>0,d=p.toString(e);if(s=c,s.isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(Iw),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(ae.prototype,"__isLong__",{value:!0});Object.defineProperty(ae.prototype,"_bsontype",{value:"Long"});var Tw=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,xw=/^(\+|-)?(Infinity|inf)$/i,Cw=/^(\+|-)?NaN$/i,us=6111,ef=-6176,tg=6176,Rw=34,tf=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),rg=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),ng=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Aw=/^([-+])?(\d+)?$/,Dw=31,ig=16383,Nw=30,Ow=31;function og(t){return!isNaN(parseInt(t,10))}function Pw(t){var e=ae.fromNumber(1e9),r=ae.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 ae(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Lw(t,e){if(!t&&!e)return{high:ae.fromNumber(0),low:ae.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new ae(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new ae(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),c=n.multiply(i),p=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new ae(a.getLowBits(),0).add(c).add(p.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),p=a.shiftLeft(32).add(new ae(p.getLowBits(),0)),{high:s,low:p}}function Mw(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,o=e.low>>>0;if(i<o)return!0}return!1}function no(t,e){throw new et('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var af=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(sf(e)){if(e.byteLength!==16)throw new et("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new et("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,o=0,s=0,a=0,c=0,p=0,d=[0],f=0,E=0,y=0,I=0,D=0,k=0,O=new ae(0,0),$=new ae(0,0),B=0,q=0;if(e.length>=7e3)throw new et(""+e+" not a valid Decimal128 string");var Se=e.match(Tw),Q=e.match(xw),ue=e.match(Cw);if(!Se&&!Q&&!ue||e.length===0)throw new et(""+e+" not a valid Decimal128 string");if(Se){var le=Se[2],ge=Se[4],ke=Se[5],Re=Se[6];ge&&Re===void 0&&no(e,"missing exponent power"),ge&&le===void 0&&no(e,"missing exponent base"),ge===void 0&&(ke||Re)&&no(e,"missing e before exponent")}if((e[q]==="+"||e[q]==="-")&&(r=e[q++]==="-"),!og(e[q])&&e[q]!=="."){if(e[q]==="i"||e[q]==="I")return new t(De.from(r?rg:ng));if(e[q]==="N")return new t(De.from(tf))}for(;og(e[q])||e[q]===".";){if(e[q]==="."){n&&no(e,"contains multiple periods"),n=!0,q=q+1;continue}f<34&&(e[q]!=="0"||i)&&(i||(p=s),i=!0,d[E++]=parseInt(e[q],10),f=f+1),i&&(a=a+1),n&&(c=c+1),s=s+1,q=q+1}if(n&&!s)throw new et(""+e+" not a valid Decimal128 string");if(e[q]==="e"||e[q]==="E"){var Ne=e.substr(++q).match(Aw);if(!Ne||!Ne[2])return new t(De.from(tf));D=parseInt(Ne[0],10),q=q+Ne[0].length}if(e[q])return new t(De.from(tf));if(y=0,!f)y=0,I=0,d[0]=0,a=1,f=1,o=0;else if(I=f-1,o=a,o!==1)for(;d[p+o-1]===0;)o=o-1;for(D<=c&&c-D>16384?D=ef:D=D-c;D>us;){if(I=I+1,I-y>Rw){var Xe=d.join("");if(Xe.match(/^0+$/)){D=us;break}no(e,"overflow")}D=D-1}for(;D<ef||f<a;){if(I===0&&o<f){D=ef,o=0;break}if(f<a?a=a-1:I=I-1,D<us)D=D+1;else{var Xe=d.join("");if(Xe.match(/^0+$/)){D=us;break}no(e,"overflow")}}if(I-y+1<o){var tt=s;n&&(p=p+1,tt=tt+1),r&&(p=p+1,tt=tt+1);var kt=parseInt(e[p+I+1],10),A=0;if(kt>=5&&(A=1,kt===5)){for(A=d[I]%2===1?1:0,k=p+I+2;k<tt;k++)if(parseInt(e[k],10)){A=1;break}}if(A){for(var R=I;R>=0;R--)if(++d[R]>9&&(d[R]=0,R===0))if(D<us)D=D+1,d[R]=1;else return new t(De.from(r?rg:ng))}}if(O=ae.fromNumber(0),$=ae.fromNumber(0),o===0)O=ae.fromNumber(0),$=ae.fromNumber(0);else if(I-y<17){var R=y;for($=ae.fromNumber(d[R++]),O=new ae(0,0);R<=I;R++)$=$.multiply(ae.fromNumber(10)),$=$.add(ae.fromNumber(d[R]))}else{var R=y;for(O=ae.fromNumber(d[R++]);R<=I-17;R++)O=O.multiply(ae.fromNumber(10)),O=O.add(ae.fromNumber(d[R]));for($=ae.fromNumber(d[R++]);R<=I;R++)$=$.multiply(ae.fromNumber(10)),$=$.add(ae.fromNumber(d[R]))}var j=Lw(O,ae.fromString("100000000000000000"));j.low=j.low.add($),Mw(j.low,$)&&(j.high=j.high.add(ae.fromNumber(1))),B=D+tg;var F={low:ae.fromNumber(0),high:ae.fromNumber(0)};j.high.shiftRightUnsigned(49).and(ae.fromNumber(1)).equals(ae.fromNumber(1))?(F.high=F.high.or(ae.fromNumber(3).shiftLeft(61)),F.high=F.high.or(ae.fromNumber(B).and(ae.fromNumber(16383).shiftLeft(47))),F.high=F.high.or(j.high.and(ae.fromNumber(0x7fffffffffff)))):(F.high=F.high.or(ae.fromNumber(B&16383).shiftLeft(49)),F.high=F.high.or(j.high.and(ae.fromNumber(562949953421311)))),F.low=j.low,r&&(F.high=F.high.or(ae.fromString("9223372036854775808")));var V=De.alloc(16);return q=0,V[q++]=F.low.low&255,V[q++]=F.low.low>>8&255,V[q++]=F.low.low>>16&255,V[q++]=F.low.low>>24&255,V[q++]=F.low.high&255,V[q++]=F.low.high>>8&255,V[q++]=F.low.high>>16&255,V[q++]=F.low.high>>24&255,V[q++]=F.high.low&255,V[q++]=F.high.low>>8&255,V[q++]=F.high.low>>16&255,V[q++]=F.high.low>>24&255,V[q++]=F.high.high&255,V[q++]=F.high.high>>8&255,V[q++]=F.high.high>>16&255,V[q++]=F.high.high>>24&255,new t(V)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,a,c={parts:[0,0,0,0]},p,d,f=[];o=0;var E=this.bytes,y=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,I=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,D=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,k=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24;o=0;var O={low:new ae(y,I),high:new ae(D,k)};O.high.lessThan(ae.ZERO)&&f.push("-");var $=k>>26&Dw;if($>>3===3){if($===Nw)return f.join("")+"Infinity";if($===Ow)return"NaN";e=k>>15&ig,a=8+(k>>14&1)}else a=k>>14&7,e=k>>17&ig;var B=e-tg;if(c.parts[0]=(k&16383)+((a&15)<<14),c.parts[1]=D,c.parts[2]=I,c.parts[3]=y,c.parts[0]===0&&c.parts[1]===0&&c.parts[2]===0&&c.parts[3]===0)s=!0;else for(d=3;d>=0;d--){var q=0,Se=Pw(c);if(c=Se.quotient,q=Se.rem.low,!!q)for(p=8;p>=0;p--)n[d*9+p]=q%10,q=Math.floor(q/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var Q=r-1+B;if(Q>=34||Q<=-7||B>0){if(r>34)return f.push("".concat(0)),B>0?f.push("E+".concat(B)):B<0&&f.push("E".concat(B)),f.join("");f.push("".concat(n[o++])),r=r-1,r&&f.push(".");for(var i=0;i<r;i++)f.push("".concat(n[o++]));f.push("E"),Q>0?f.push("+".concat(Q)):f.push("".concat(Q))}else if(B>=0)for(var i=0;i<r;i++)f.push("".concat(n[o++]));else{var ue=r+B;if(ue>0)for(var i=0;i<ue;i++)f.push("".concat(n[o++]));else f.push("0");for(f.push(".");ue++<0;)f.push("0");for(var i=0;i<r-Math.max(ue-1,0);i++)f.push("".concat(n[o++]))}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(af.prototype,"_bsontype",{value:"Decimal128"});var Mc=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(Mc.prototype,"_bsontype",{value:"Double"});var Bc=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(Bc.prototype,"_bsontype",{value:"Int32"});var cf=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(cf.prototype,"_bsontype",{value:"MaxKey"});var lf=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(lf.prototype,"_bsontype",{value:"MinKey"});var Bw=new RegExp("^[0-9a-fA-F]{24}$"),ni=null,Fr=Symbol("id"),bt=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 et("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=De.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Fr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Fr]=r instanceof De?r:Dc(r);else if(typeof r=="string")if(r.length===12){var n=De.from(r);if(n.byteLength===12)this[Fr]=n;else throw new et("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Bw.test(r))this[Fr]=De.from(r,"hex");else throw new et("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new et("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[Fr]},set:function(e){this[Fr]=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=De.alloc(12);return n.writeUInt32BE(e,0),ni===null&&(ni=fg(5)),n[4]=ni[0],n[5]=ni[1],n[6]=ni[2],n[7]=ni[3],n[8]=ni[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[Fr][11]===e[Fr][11]&&this[Fr].equals(e[Fr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&sf(this.id))return e===De.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 De.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=De.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 et("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(De.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(bt.prototype,"generate",{value:Pc(function(t){return bt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(bt.prototype,"getInc",{value:Pc(function(){return bt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(bt.prototype,"get_inc",{value:Pc(function(){return bt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(bt,"get_inc",{value:Pc(function(){return bt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(bt.prototype,"_bsontype",{value:"ObjectID"});function Uw(t){return t.split("").sort().join("")}var fs=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Uw(r??""),this.pattern.indexOf("\0")!==-1)throw new ii("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new ii("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 ii("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 et("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(fs.prototype,"_bsontype",{value:"BSONRegExp"});var uf=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(uf.prototype,"_bsontype",{value:"Symbol"});var kw=ae,gg=function(t){Oc(e,t);function e(r,n){var i=this;return i instanceof e?(ae.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:ms(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(ae.fromInt(r,!0))},e.fromNumber=function(r){return new e(ae.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(ae.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=ae.MAX_UNSIGNED_VALUE,e}(kw);function Fw(t){return ms(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var yg=2147483647,vg=-2147483648,Eg=9223372036854776e3,_g=-9223372036854776e3,Hw={$oid:bt,$binary:oi,$uuid:oi,$symbol:uf,$numberInt:Bc,$numberDecimal:af,$numberDouble:Mc,$numberLong:ae,$minKey:lf,$maxKey:cf,$regex:fs,$regularExpression:fs,$timestamp:gg};function bg(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=vg&&t<=yg)return new Bc(t);if(t>=_g&&t<=Eg)return ae.fromNumber(t)}return new Mc(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(f){return f.startsWith("$")&&t[f]!=null}),n=0;n<r.length;n++){var i=Hw[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var o=t.$date,s=new Date;return e.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):ae.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&e.relaxed&&s.setTime(o),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=bg(t.$scope)),Lc.fromExtendedJSON(t)}if(Sw(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof ps)return c;var p=Object.keys(c).filter(function(f){return f.startsWith("$")}),d=!0;if(p.forEach(function(f){["$ref","$id","$db"].indexOf(f)===-1&&(d=!1)}),d)return ps.fromExtendedJSON(c)}return t}function $w(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Cn(r,e)}finally{e.seenObjects.pop()}})}function sg(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Cn(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(O){return O.obj===t});if(r!==-1){var n=e.seenObjects.map(function(O){return O.propertyName}),i=n.slice(0,r).map(function(O){return"".concat(O," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(O){return"".concat(O," -> ")}).join(""),a=n[n.length-1],c=" ".repeat(i.length+o.length/2),p="-".repeat(s.length+(o.length+a.length)/2-1);throw new et(`Converting circular structure to EJSON:
39
+ Url: ${ka(t)}`),!0}return!1}function l_(t,e){return e?.length?La(t).some(r=>Ai(r,e)):!1}function u_(t,e){if(!e?.length)return!1;let r=t.transaction;return r?Ai(r,e):!1}function p_(t,e){if(!e?.length)return!1;let r=ka(t);return r?Ai(r,e):!1}function f_(t,e){if(!e?.length)return!0;let r=ka(t);return r?Ai(r,e):!0}function m_(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 ka(t){try{let r=[...t.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?m_(r):null}catch{return oe&&ee.error(`Cannot extract url for event ${Dr(t)}`),null}}function d_(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function mp(t,e,r,n,i,o){if(!i.exception?.values||!o||!Er(o.originalException,Error))return;let s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=fp(t,e,n,o.originalException,r,i.exception.values,s,0))}function fp(t,e,r,n,i,o,s,a){if(o.length>=r+1)return o;let c=[...o];if(Er(n[i],Error)){Gd(s,a);let p=t(e,n[i]),d=c.length;Yd(p,i,d,a),c=fp(t,e,r,n[i],i,[p,...c],p,d)}return Array.isArray(n.errors)&&n.errors.forEach((p,d)=>{if(Er(p,Error)){Gd(s,a);let f=t(e,p),E=c.length;Yd(f,`errors[${d}]`,E,a),c=fp(t,e,r,p,i,[f,...c],f,E)}}),c}function Gd(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_(_({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Yd(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function dp(t){let e="console";Ot(e,t),Nt(e,h_)}function h_(){"console"in fe&&_u.forEach(function(t){t in fe.console&&pt(fe.console,t,function(e){return xi[t]=e,function(...r){ut("console",{args:r,level:t}),xi[t]?.apply(fe.console,r)}})})}function hp(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var g_="Dedupe",y_=()=>{let t;return{name:g_,processEvent(e){if(e.type)return e;try{if(v_(e,t))return oe&&ee.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Ha=y_;function v_(t,e){return e?!!(E_(t,e)||__(t,e)):!1}function E_(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Kd(t,e)||!zd(t,e))}function __(t,e){let r=qd(e),n=qd(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Kd(t,e)||!zd(t,e))}function zd(t,e){let r=ma(t),n=ma(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let o=n[i],s=r[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function Kd(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 qd(t){return t.exception?.values?.[0]}function es(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let r=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:r,hash:n,relative:e[5]+r+n}}function $a(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var ts=fe;function gp(){return"history"in ts&&!!ts.history}function b_(){if(!("fetch"in ts))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function rs(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function yp(){if(typeof EdgeRuntime=="string")return!0;if(!b_())return!1;if(rs(ts.fetch))return!0;let t=!1,e=ts.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=rs(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){oe&&ee.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function Ep(t,e){let r="fetch";Ot(r,t),Nt(r,()=>w_(void 0,e))}function w_(t,e=!1){e&&!yp()||pt(fe,"fetch",function(r){return function(...n){let i=new Error,{method:o,url:s}=S_(n),a={args:n,fetchData:{method:o,url:s},startTimestamp:Ut()*1e3,virtualError:i,headers:I_(n)};return t||ut("fetch",_({},a)),r.apply(fe,n).then(async c=>(t?t(c):ut("fetch",Z(_({},a),{endTimestamp:Ut()*1e3,response:c})),c),c=>{if(ut("fetch",Z(_({},a),{endTimestamp:Ut()*1e3,error:c})),jn(c)&&c.stack===void 0&&(c.stack=i.stack,qt(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{let p=new URL(a.fetchData.url);c.message=`${c.message} (${p.host})`}catch{}throw c})}})}function vp(t,e){return!!t&&typeof t=="object"&&!!t[e]}function Xd(t){return typeof t=="string"?t:t?vp(t,"url")?t.url:t.toString?t.toString():"":""}function S_(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:Xd(r),method:vp(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:Xd(e),method:vp(e,"method")?String(e.method).toUpperCase():"GET"}}function I_(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(Mm(e))return new Headers(e.headers)}catch{}}function _p(){return"npm"}var Je=fe,bp=0;function wp(){return bp>0}function k_(){bp++,setTimeout(()=>{bp--})}function zn(t,e={}){function r(i){return typeof i=="function"}if(!r(t))return t;try{let i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(qn(t))return t}catch{return t}let n=function(...i){try{let o=i.map(s=>zn(s,e));return t.apply(this,o)}catch(o){throw k_(),qo(s=>{s.addEventProcessor(a=>(e.mechanism&&(Di(a,void 0,void 0),Or(a,e.mechanism)),a.extra=Z(_({},a.extra),{arguments:i}),a)),Oa(o)}),o}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}va(n,t),qt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function Jd(){let t=Yo(),{referrer:e}=Je.document||{},{userAgent:r}=Je.navigator||{},n=_(_({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function Va(t,e){let r=Tp(t,e),n={type:W_(e),value:j_(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function F_(t,e,r,n){let o=je()?.getOptions().normalizeDepth,s=q_(e),a={__serialized__:xa(e,o)};if(s)return{exception:{values:[Va(t,s)]},extra:a};let c={exception:{values:[{type:Yn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:G_(e,{isUnhandledRejection:n})}]},extra:a};if(r){let p=Tp(t,r);p.length&&(c.exception.values[0].stacktrace={frames:p})}return c}function Sp(t,e){return{exception:{values:[Va(t,e)]}}}function Tp(t,e){let r=e.stacktrace||e.stack||"",n=$_(e),i=V_(e);try{return t(r,n,i)}catch{}return[]}var H_=/Minified React error #\d+;/i;function $_(t){return t&&H_.test(t.message)?1:0}function V_(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Qd(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function W_(t){let e=t?.name;return!e&&Qd(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function j_(t){let e=t?.message;return Qd(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Zd(t,e,r,n){let i=r?.syntheticException||void 0,o=Wa(t,e,i,n);return Or(o),o.level="error",r?.event_id&&(o.event_id=r.event_id),ir(o)}function eh(t,e,r="info",n,i){let o=n?.syntheticException||void 0,s=Ip(t,e,o,i);return s.level=r,n?.event_id&&(s.event_id=n.event_id),ir(s)}function Wa(t,e,r,n,i){let o;if(ha(e)&&e.error)return Sp(t,e.error);if(ga(e)||Au(e)){let s=e;if("stack"in e)o=Sp(t,e);else{let a=s.name||(ga(s)?"DOMError":"DOMException"),c=s.message?`${a}: ${s.message}`:a;o=Ip(t,c,r,n),Di(o,c)}return"code"in s&&(o.tags=Z(_({},o.tags),{"DOMException.code":`${s.code}`})),o}return jn(e)?Sp(t,e):tn(e)||Yn(e)?(o=F_(t,e,r,i),Or(o,{synthetic:!0}),o):(o=Ip(t,e,r,n),Di(o,`${e}`,void 0),Or(o,{synthetic:!0}),o)}function Ip(t,e,r,n){let i={};if(n&&r){let o=Tp(t,r);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Or(i,{synthetic:!0})}if(Ri(e)){let{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function G_(t,{isUnhandledRejection:e}){let r=Mu(t),n=e?"promise rejection":"exception";return ha(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:Yn(t)?`Event \`${Y_(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Y_(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function q_(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var z_=5e3,ns=class extends Qo{constructor(e){let r=K_(e),n=Je.SENTRY_SDK_SOURCE||_p();up(r,"browser",["browser"],n),super(r);let{sendDefaultPii:i,sendClientReports:o,enableLogs:s,_experiments:a}=this._options,c=s??a?.enableLogs;Je.document&&(o||c)&&Je.document.addEventListener("visibilitychange",()=>{Je.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),c&&Zo(this))}),c&&(this.on("flush",()=>{Zo(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{Zo(this)},z_)})),i&&(this.on("postprocessEvent",cp),this.on("beforeSendSession",lp))}eventFromException(e,r){return Zd(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return eh(this._options.stackParser,e,r,n,this._options.attachStacktrace)}_prepareEvent(e,r,n,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n,i)}};function K_(t){return _({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Je.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var th=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var mt=fe;var X_=1e3,rh,xp,Cp;function Rp(t){Ot("dom",t),Nt("dom",J_)}function J_(){if(!mt.document)return;let t=ut.bind(null,"dom"),e=nh(t,!0);mt.document.addEventListener("click",e,!1),mt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let i=mt[r]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(pt(i,"addEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=p[s]=p[s]||{refCount:0};if(!d.handler){let f=nh(t);d.handler=f,o.call(this,s,f,c)}d.refCount++}catch{}return o.call(this,s,a,c)}}),pt(i,"removeEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__||{},d=p[s];d&&(d.refCount--,d.refCount<=0&&(o.call(this,s,d.handler,c),d.handler=void 0,delete p[s]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,c)}}))})}function Q_(t){if(t.type!==xp)return!1;try{if(!t.target||t.target._sentryId!==Cp)return!1}catch{}return!0}function Z_(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function nh(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=eb(r);if(Z_(r.type,n))return;qt(r,"_sentryCaptured",!0),n&&!n._sentryId&&qt(n,"_sentryId",ft());let i=r.type==="keypress"?"input":r.type;Q_(r)||(t({event:r,name:i,global:e}),xp=r.type,Cp=n?n._sentryId:void 0),clearTimeout(rh),rh=mt.setTimeout(()=>{Cp=void 0,xp=void 0},X_)}}function eb(t){try{return t.target}catch{return null}}var ja;function is(t){let e="history";Ot(e,t),Nt(e,tb)}function tb(){if(mt.addEventListener("popstate",()=>{let e=mt.location.href,r=ja;if(ja=e,r===e)return;ut("history",{from:r,to:e})}),!gp())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let i=ja,o=rb(String(n));if(ja=o,i===o)return e.apply(this,r);ut("history",{from:i,to:o})}return e.apply(this,r)}}pt(mt.history,"pushState",t),pt(mt.history,"replaceState",t)}function rb(t){try{return new URL(t,mt.location.origin).toString()}catch{return t}}var Ga={};function Ap(t){let e=Ga[t];if(e)return e;let r=mt[t];if(rs(r))return Ga[t]=r.bind(mt);let n=mt.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let o=i.contentWindow;o?.[t]&&(r=o[t]),n.head.removeChild(i)}catch(i){th&&ee.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Ga[t]=r.bind(mt))}function Ya(t){Ga[t]=void 0}var Kn="__sentry_xhr_v3__";function Dp(t){Ot("xhr",t),Nt("xhr",nb)}function nb(){if(!mt.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let i=new Error,o=Ut()*1e3,s=Pt(n[0])?n[0].toUpperCase():void 0,a=ib(n[1]);if(!s||!a)return e.apply(r,n);r[Kn]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let c=()=>{let p=r[Kn];if(p&&r.readyState===4){try{p.status_code=r.status}catch{}let d={endTimestamp:Ut()*1e3,startTimestamp:o,xhr:r,virtualError:i};ut("xhr",d)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(p,d,f){return c(),p.apply(d,f)}}):r.addEventListener("readystatechange",c),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(p,d,f){let[E,y]=f,I=d[Kn];return I&&Pt(E)&&Pt(y)&&(I.request_headers[E.toLowerCase()]=y),p.apply(d,f)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let i=r[Kn];if(!i)return e.apply(r,n);n[0]!==void 0&&(i.body=n[0]);let o={startTimestamp:Ut()*1e3,xhr:r};return ut("xhr",o),e.apply(r,n)}})}function ib(t){if(Pt(t))return t;try{return t.toString()}catch{}}function Op(t,e=Ap("fetch")){let r=0,n=0;function i(o){let s=o.body.length;r+=s,n++;let a=_({body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return Ya("fetch"),bn("No fetch implementation available");try{return e(t.url,a).then(c=>(r-=s,n--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return Ya("fetch"),r-=s,n--,bn(c)}}return Ba(t,i)}var ob=30;var sb=50;function Np(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?"?":e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var ab=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cb=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,lb=/\((\S*)(?::(\d+))(?::(\d+))\)/,ub=t=>{let e=ab.exec(t);if(e){let[,n,i,o]=e;return Np(n,"?",+i,+o)}let r=cb.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=lb.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[i,o]=ah(r[1]||"?",r[2]);return Np(o,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},ih=[ob,ub],pb=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fb=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,mb=t=>{let e=pb.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let o=fb.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let n=e[3],i=e[1]||"?";return[i,n]=ah(i,n),Np(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},oh=[sb,mb];var sh=[ih,oh],Pp=Iu(...sh),ah=(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]:"?",r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var Li=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var qa=1024,db="Breadcrumbs",hb=(t={})=>{let e=_({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:db,setup(r){e.console&&dp(vb(r)),e.dom&&Rp(yb(r,e.dom)),e.xhr&&Dp(Eb(r)),e.fetch&&Ep(_b(r)),e.history&&is(bb(r)),e.sentry&&r.on("beforeSendEvent",gb(r))}}},ch=hb;function gb(t){return function(r){je()===t&&Lr({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:Dr(r)},{event:r})}}function yb(t,e){return function(n){if(je()!==t)return;let i,o,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>qa&&(Li&&ee.warn(`\`dom.maxStringLength\` cannot exceed ${qa}, but a value of ${a} was configured. Sentry will use ${qa} instead.`),a=qa),typeof s=="string"&&(s=[s]);try{let p=n.event,d=wb(p)?p.target:p;i=Go(d,{keyAttrs:s,maxStringLength:a}),o=Lu(d)}catch{i="<unknown>"}if(i.length===0)return;let c={category:`ui.${n.name}`,message:i};o&&(c.data={"ui.component_name":o}),Lr(c,{event:n.event,name:n.name,global:n.global})}}function vb(t){return function(r){if(je()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:hp(r.level),message:ya(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${ya(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;Lr(n,{input:r.args,level:r.level})}}function Eb(t){return function(r){if(je()!==t)return;let{startTimestamp:n,endTimestamp:i}=r,o=r.xhr[Kn];if(!n||!i||!o)return;let{method:s,url:a,status_code:c,body:p}=o,d={method:s,url:a,status_code:c},f={xhr:r.xhr,input:p,startTimestamp:n,endTimestamp:i},E={category:"xhr",data:d,type:"http",level:$a(c)};t.emit("beforeOutgoingRequestBreadcrumb",E,f),Lr(E,f)}}function _b(t){return function(r){if(je()!==t)return;let{startTimestamp:n,endTimestamp:i}=r;if(i&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.fetchData.method,r.fetchData.url,r.error){let o=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:i},a={category:"fetch",data:o,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Lr(a,s)}else{let o=r.response,s=Z(_({},r.fetchData),{status_code:o?.status});r.fetchData.request_body_size,r.fetchData.response_body_size,o?.status;let a={input:r.args,response:o,startTimestamp:n,endTimestamp:i},c={category:"fetch",data:s,type:"http",level:$a(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,a),Lr(c,a)}}}function bb(t){return function(r){if(je()!==t)return;let n=r.from,i=r.to,o=es(Je.location.href),s=n?es(n):void 0,a=es(i);s?.path||(s=o),o.protocol===a.protocol&&o.host===a.host&&(i=a.relative),o.protocol===s.protocol&&o.host===s.host&&(n=s.relative),Lr({category:"navigation",data:{from:n,to:i}})}}function wb(t){return!!t&&!!t.target}var Sb=["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"],Ib="BrowserApiErrors",Tb=(t={})=>{let e=_({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:Ib,setupOnce(){e.setTimeout&&pt(Je,"setTimeout",lh),e.setInterval&&pt(Je,"setInterval",lh),e.requestAnimationFrame&&pt(Je,"requestAnimationFrame",xb),e.XMLHttpRequest&&"XMLHttpRequest"in Je&&pt(XMLHttpRequest.prototype,"send",Cb);let r=e.eventTarget;r&&(Array.isArray(r)?r:Sb).forEach(i=>Rb(i,e))}}},uh=Tb;function lh(t){return function(...e){let r=e[0];return e[0]=zn(r,{mechanism:{data:{function:rr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function xb(t){return function(e){return t.apply(this,[zn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:rr(t)},handled:!1,type:"instrument"}})])}}function Cb(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in r&&typeof r[i]=="function"&&pt(r,i,function(o){let s={mechanism:{data:{function:i,handler:rr(o)},handled:!1,type:"instrument"}},a=qn(o);return a&&(s.mechanism.data.handler=rr(a)),zn(o,s)})}),t.apply(this,e)}}function Rb(t,e){let n=Je[t]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(pt(n,"addEventListener",function(i){return function(o,s,a){try{Ab(s)&&(s.handleEvent=zn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:rr(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&Db(this,o,s),i.apply(this,[o,zn(s,{mechanism:{data:{function:"addEventListener",handler:rr(s),target:t},handled:!1,type:"instrument"}}),a])}}),pt(n,"removeEventListener",function(i){return function(o,s,a){try{let c=s.__sentry_wrapped__;c&&i.call(this,o,c,a)}catch{}return i.call(this,o,s,a)}}))}function Ab(t){return typeof t.handleEvent=="function"}function Db(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var ph=()=>({name:"BrowserSession",setupOnce(){if(typeof Je.document>"u"){Li&&ee.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Xo({ignoreDuration:!0}),Jo(),is(({from:t,to:e})=>{t!==void 0&&t!==e&&(Xo({ignoreDuration:!0}),Jo())})}});var Ob="GlobalHandlers",Nb=(t={})=>{let e=_({onerror:!0,onunhandledrejection:!0},t);return{name:Ob,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(Pb(r),fh("onerror")),e.onunhandledrejection&&(Lb(r),fh("onunhandledrejection"))}}},mh=Nb;function Pb(t){xu(e=>{let{stackParser:r,attachStacktrace:n}=dh();if(je()!==t||wp())return;let{msg:i,url:o,line:s,column:a,error:c}=e,p=Ub(Wa(r,c||i,void 0,n,!1),o,s,a);p.level="error",Ko(p,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function Lb(t){Ru(e=>{let{stackParser:r,attachStacktrace:n}=dh();if(je()!==t||wp())return;let i=Mb(e),o=Gn(i)?Bb(i):Wa(r,i,void 0,n,!0);o.level="error",Ko(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Mb(t){if(Gn(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 Bb(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function Ub(t,e,r,n){let i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],p=n,d=r,f=Pt(e)&&e.length>0?e:Yo();return c.length===0&&c.push({colno:p,filename:f,function:"?",in_app:!0,lineno:d}),t}function fh(t){Li&&ee.log(`Global Handler attached: ${t}`)}function dh(){return je()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var hh=()=>({name:"HttpContext",preprocessEvent(t){if(!Je.navigator&&!Je.location&&!Je.document)return;let e=Jd(),r=_(_({},e.headers),t.request?.headers);t.request=Z(_(_({},e),t.request),{headers:r})}});var kb="cause",Fb=5,Hb="LinkedErrors",$b=(t={})=>{let e=t.limit||Fb,r=t.key||kb;return{name:Hb,preprocessEvent(n,i,o){let s=o.getOptions();mp(Va,s.stackParser,r,e,n,i)}}},gh=$b;function Lp(t){return[Fa(),Ua(),uh(),ch(),mh(),gh(),Ha(),hh(),ph()]}var Ka={},Xa,Mp,yh;(()=>{let t=Lp({}).filter(e=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(e.name));Mp=new ns({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:Op,stackParser:Pp,integrations:t,environment:Gt.mode,release:`web-sdk@${Kr}`,debug:Gt.debug}),Mp.init()})();function be(t,e,r){b.error(`${e}:`,t);let n=_h(r);if(n.setTag("operation",e),t instanceof $n){Vb(n,t,e);return}n.captureException(t)}function vh(t,e,r){_h(r).captureMessage(t,e??"error")}function Vb(t,e,r){if(Wb(t,e),e.response){let n=e.response;t.setTag("http.status_code",n.status),t.setExtras({responseText:e.responseText,statusText:n.statusText,responseType:n.type,redirected:n.redirected,responseUrl:n.url}),t.captureMessage(`${r} failed with ${n.status}`,"error");return}if(e.request){t.captureMessage(`No response was received for ${r}`,"error");return}}function Wb(t,e){let r=e.request;r&&t.setExtras({body:e.requestBody,headers:r.headers,method:r.method,url:r.url})}function Eh(t){yh=t}function Ja(t,e){Ka[t]=_(_({},Ka[t]),e)}function Mi(t){Xa=_(_({},Xa),t)}function _h(t){t??={};let{extra:e,tags:r}=t,n=new St;if(n.setClient(Mp),n.setUser(yh),t.triggerContext&&!t.engagementTrigger&&(t.engagementTrigger=t.triggerContext.triggerData),t.engagementTrigger){let i=t.engagementTrigger;n.setTags({"engagement.id":i.engagementID,"engagement.short_id":i.shortID,"engagement.objective":i.objective,"engagement.delivery_type":i.onsiteDeliveryType,"engagement.content_id":i.contentID,"engagement.variation":i.variation,"engagement.currency":i.currency})}return e&&n.setExtras(e),r&&n.setTags(r),Xa&&n.setTags(Xa),Object.keys(Ka).forEach(i=>{n.setContext(i,Ka[i])}),n.setTag("language",navigator.language),n.setTag("timezone",bh()),jb(n),n}function jb(t){window.Shopify&&(t.setTag("shopify.shop",window.Shopify.shop),t.setTag("shopify.currency",window.Shopify.currency?.active),t.setTag("shopify.locale",window.Shopify.locale),t.setTag("theme.schema_name",window.Shopify.theme?.schema_name),t.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}var Qa=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(e,2);case"amount_no_decimals":return this.formatWithDelimiters(e,0);case"amount_with_comma_separator":return this.formatWithDelimiters(e,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(e,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(e,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(e,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(e,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(e,2," ",".");default:return i}})}static formatWithDelimiters(e,r=2,n=",",i="."){if(isNaN(e)||e==null)return"0";let s=(e/100).toFixed(r).split("."),a=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),c=s[1]?i+s[1]:"";return a+c}};function Bi(t){try{return new URL(t)}catch{return}}function Bp(t){return!t||t==="null"||t==="undefined"}function wh(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function Lt(t,e,r){return{[t]:Up(e,r),[t+"_wo_currency"]:e}}function Up(t,e){if(t==0&&e)return"Free";let r=pe.get(),n=Xe.get(),i=r.shopCurrencyCode||n.currency,o=r.currencyCode;o||b.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,a;if(s&&i===o)a=Qa.format(t*100,s);else{let c;try{c=new Intl.NumberFormat(Ih(),{style:"currency",currency:o||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return be(p,"format-currency",{extra:{currentCurrency:o,shopCurrency:i}}),""}a=c.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&o!=="INR"&&(a=a.concat(` ${o}`))}return a}function Sh(t){return new Intl.NumberFormat(Ih(),{notation:"compact"}).format(t)}function Ih(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var Za;function bh(){if(Za)return Za;try{return Za=Intl.DateTimeFormat().resolvedOptions().timeZone,Za}catch{return""}}function Ui(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function wr(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)},5e3)}async function kp(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let o=Math.min(100*2**n,5e3);if(await tr.sleep(o),i=r.querySelectorAll(t),i.length)return b.verbose(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;b.verbose(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${o}ms.`),n++}return b.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${t}.`),i}async function ki(t,e=10,r=document){return(await kp(t,e,r)).item(0)}async function ec(){let t=await ze.get("did"),e=await gt.get("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 sn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}function Th(t){if(t%100>=11&&t%100<=13)return t+"th";switch(t%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd";default:return t+"th"}}var ic,Te,Dh,$p,Xn,xh,Oh,Nh,Ph,Vp,Fp,Hp,Gb,ss={},Lh=[],Yb=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,oc=Array.isArray;function an(t,e){for(var r in e)t[r]=e[r];return t}function Wp(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function jp(t,e,r){var n,i,o,s={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?ic.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return rc(t,s,n,i,null)}function rc(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Dh,__i:-1,__u:0};return i==null&&Te.vnode!=null&&Te.vnode(o),o}function Br(t){return t.children}function Mr(t,e){this.props=t,this.context=e}function Fi(t,e){if(e==null)return t.__?Fi(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"?Fi(t):null}function Mh(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 Mh(t)}}function Ch(t){(!t.__d&&(t.__d=!0)&&Xn.push(t)&&!nc.__r++||xh!=Te.debounceRendering)&&((xh=Te.debounceRendering)||Oh)(nc)}function nc(){for(var t,e,r,n,i,o,s,a=1;Xn.length;)Xn.length>a&&Xn.sort(Nh),t=Xn.shift(),a=Xn.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,o=[],s=[],e.__P&&((r=an({},n)).__v=n.__v+1,Te.vnode&&Te.vnode(r),Gp(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??Fi(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,kh(o,r,s),r.__e!=i&&Mh(r)));nc.__r=0}function Bh(t,e,r,n,i,o,s,a,c,p,d){var f,E,y,I,D,U,N=n&&n.__k||Lh,H=e.length;for(c=qb(r,e,N,c,H),f=0;f<H;f++)(y=r.__k[f])!=null&&(E=y.__i==-1?ss:N[y.__i]||ss,y.__i=f,U=Gp(t,y,E,i,o,s,a,c,p,d),I=y.__e,y.ref&&E.ref!=y.ref&&(E.ref&&Yp(E.ref,null,y),d.push(y.ref,y.__c||I,y)),D==null&&I!=null&&(D=I),4&y.__u||E.__k===y.__k?c=Uh(y,c,t):typeof y.type=="function"&&U!==void 0?c=U:I&&(c=I.nextSibling),y.__u&=-7);return r.__e=D,c}function qb(t,e,r,n,i){var o,s,a,c,p,d=r.length,f=d,E=0;for(t.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(c=o+E,(s=t.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?rc(null,s,null,null,null):oc(s)?rc(Br,{children:s},null,null,null):s.constructor==null&&s.__b>0?rc(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(p=s.__i=zb(s,r,c,f))!=-1&&(f--,(a=r[p])&&(a.__u|=2)),a==null||a.__v==null?(p==-1&&(i>d?E--:i<d&&E++),typeof s.type!="function"&&(s.__u|=4)):p!=c&&(p==c-1?E--:p==c+1?E++:(p>c?E--:E++,s.__u|=4))):t.__k[o]=null;if(f)for(o=0;o<d;o++)(a=r[o])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=Fi(a)),Hh(a,a));return n}function Uh(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=Uh(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Fi(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function zb(t,e,r,n){var i,o,s=t.key,a=t.type,c=e[r];if(c===null&&t.key==null||c&&s==c.key&&a==c.type&&(2&c.__u)==0)return r;if(n>(c!=null&&(2&c.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<e.length;){if(i>=0){if((c=e[i])&&(2&c.__u)==0&&s==c.key&&a==c.type)return i;i--}if(o<e.length){if((c=e[o])&&(2&c.__u)==0&&s==c.key&&a==c.type)return o;o++}}return-1}function Rh(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||Yb.test(e)?r:r+"px"}function tc(t,e,r,n,i){var o,s;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Rh(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||Rh(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Ph,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=Vp,t.addEventListener(e,o?Hp:Fp,o)):t.removeEventListener(e,o?Hp:Fp,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Ah(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Vp++;else if(e.t<r.u)return;return r(Te.event?Te.event(e):e)}}}function Gp(t,e,r,n,i,o,s,a,c,p){var d,f,E,y,I,D,U,N,H,M,q,Ee,J,ae,se,me,Le,Ie=e.type;if(e.constructor!=null)return null;128&r.__u&&(c=!!(32&r.__u),o=[a=e.__e=r.__e]),(d=Te.__b)&&d(e);e:if(typeof Ie=="function")try{if(N=e.props,H="prototype"in Ie&&Ie.prototype.render,M=(d=Ie.contextType)&&n[d.__c],q=d?M?M.props.value:d.__:n,r.__c?U=(f=e.__c=r.__c).__=f.__E:(H?e.__c=f=new Ie(N,q):(e.__c=f=new Mr(N,q),f.constructor=Ie,f.render=Xb),M&&M.sub(f),f.props=N,f.state||(f.state={}),f.context=q,f.__n=n,E=f.__d=!0,f.__h=[],f._sb=[]),H&&f.__s==null&&(f.__s=f.state),H&&Ie.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=an({},f.__s)),an(f.__s,Ie.getDerivedStateFromProps(N,f.__s))),y=f.props,I=f.state,f.__v=e,E)H&&Ie.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),H&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(H&&Ie.getDerivedStateFromProps==null&&N!==y&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(N,q),!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(N,f.__s,q)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(f.props=N,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Ce){Ce&&(Ce.__=e)}),Ee=0;Ee<f._sb.length;Ee++)f.__h.push(f._sb[Ee]);f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(N,f.__s,q),H&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(y,I,D)})}if(f.context=q,f.props=N,f.__P=t,f.__e=!1,J=Te.__r,ae=0,H){for(f.state=f.__s,f.__d=!1,J&&J(e),d=f.render(f.props,f.state,f.context),se=0;se<f._sb.length;se++)f.__h.push(f._sb[se]);f._sb=[]}else do f.__d=!1,J&&J(e),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++ae<25);f.state=f.__s,f.getChildContext!=null&&(n=an(an({},n),f.getChildContext())),H&&!E&&f.getSnapshotBeforeUpdate!=null&&(D=f.getSnapshotBeforeUpdate(y,I)),me=d,d!=null&&d.type===Br&&d.key==null&&(me=Fh(d.props.children)),a=Bh(t,oc(me)?me:[me],e,r,n,i,o,s,a,c,p),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),U&&(f.__E=f.__=null)}catch(Ce){if(e.__v=null,c||o!=null)if(Ce.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(Le=o.length;Le--;)Wp(o[Le]);else e.__e=r.__e,e.__k=r.__k;Te.__e(Ce,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=Kb(r.__e,e,r,n,i,o,s,c,p);return(d=Te.diffed)&&d(e),128&e.__u?void 0:a}function kh(t,e,r){for(var n=0;n<r.length;n++)Yp(r[n],r[++n],r[++n]);Te.__c&&Te.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){Te.__e(o,i.__v)}})}function Fh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:oc(t)?t.map(Fh):an({},t)}function Kb(t,e,r,n,i,o,s,a,c){var p,d,f,E,y,I,D,U=r.props,N=e.props,H=e.type;if(H=="svg"?i="http://www.w3.org/2000/svg":H=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(p=0;p<o.length;p++)if((y=o[p])&&"setAttribute"in y==!!H&&(H?y.localName==H:y.nodeType==3)){t=y,o[p]=null;break}}if(t==null){if(H==null)return document.createTextNode(N);t=document.createElementNS(i,H,N.is&&N),a&&(Te.__m&&Te.__m(e,o),a=!1),o=null}if(H==null)U===N||a&&t.data==N||(t.data=N);else{if(o=o&&ic.call(t.childNodes),U=r.props||ss,!a&&o!=null)for(U={},p=0;p<t.attributes.length;p++)U[(y=t.attributes[p]).name]=y.value;for(p in U)if(y=U[p],p!="children"){if(p=="dangerouslySetInnerHTML")f=y;else if(!(p in N)){if(p=="value"&&"defaultValue"in N||p=="checked"&&"defaultChecked"in N)continue;tc(t,p,null,y,i)}}for(p in N)y=N[p],p=="children"?E=y:p=="dangerouslySetInnerHTML"?d=y:p=="value"?I=y:p=="checked"?D=y:a&&typeof y!="function"||U[p]===y||tc(t,p,y,U[p],i);if(d)a||f&&(d.__html==f.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(f&&(t.innerHTML=""),Bh(e.type=="template"?t.content:t,oc(E)?E:[E],e,r,n,H=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&Fi(r,0),a,c),o!=null)for(p=o.length;p--;)Wp(o[p]);a||(p="value",H=="progress"&&I==null?t.removeAttribute("value"):I!=null&&(I!==t[p]||H=="progress"&&!I||H=="option"&&I!=U[p])&&tc(t,p,I,U[p],i),p="checked",D!=null&&D!=t[p]&&tc(t,p,D,U[p],i))}return t}function Yp(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){Te.__e(i,r)}}function Hh(t,e,r){var n,i;if(Te.unmount&&Te.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Yp(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){Te.__e(o,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||Wp(t.__e),t.__c=t.__=t.__e=void 0}function Xb(t,e,r){return this.constructor(t,r)}function $h(t,e,r){var n,i,o,s;e==document&&(e=document.documentElement),Te.__&&Te.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],s=[],Gp(e,t=(!n&&r||e).__k=jp(Br,null,[t]),i||ss,ss,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?ic.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,s),kh(o,t,s)}ic=Lh.slice,Te={__e:function(t,e,r,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},Dh=0,$p=function(t){return t!=null&&t.constructor==null},Mr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=an({},this.state),typeof t=="function"&&(t=t(an({},r),this.props)),t&&an(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Ch(this))},Mr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Ch(this))},Mr.prototype.render=Br,Xn=[],Oh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Nh=function(t,e){return t.__v.__b-e.__v.__b},nc.__r=0,Ph=/(PointerCapture)$|Capture$/i,Vp=0,Fp=Ah(!1),Hp=Ah(!0),Gb=0;var zp,zt,qp,Vh,Wh=0,Jh=[],dt=Te,jh=dt.__b,Gh=dt.__r,Yh=dt.diffed,qh=dt.__c,zh=dt.unmount,Kh=dt.__;function Jb(t,e){dt.__h&&dt.__h(zt,t,Wh||e),Wh=0;var r=zt.__H||(zt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Xp(t,e){var r=Jb(zp++,7);return ew(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Qb(){for(var t;t=Jh.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(sc),t.__H.__h.forEach(Kp),t.__H.__h=[]}catch(e){t.__H.__h=[],dt.__e(e,t.__v)}}dt.__b=function(t){zt=null,jh&&jh(t)},dt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Kh&&Kh(t,e)},dt.__r=function(t){Gh&&Gh(t),zp=0;var e=(zt=t.__c).__H;e&&(qp===zt?(e.__h=[],zt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(sc),e.__h.forEach(Kp),e.__h=[],zp=0)),qp=zt},dt.diffed=function(t){Yh&&Yh(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Jh.push(e)!==1&&Vh===dt.requestAnimationFrame||((Vh=dt.requestAnimationFrame)||Zb)(Qb)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),qp=zt=null},dt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(sc),r.__h=r.__h.filter(function(n){return!n.__||Kp(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],dt.__e(n,r.__v)}}),qh&&qh(t,e)},dt.unmount=function(t){zh&&zh(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{sc(n)}catch(i){e=i}}),r.__H=void 0,e&&dt.__e(e,r.__v))};var Xh=typeof requestAnimationFrame=="function";function Zb(t){var e,r=function(){clearTimeout(n),Xh&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);Xh&&(e=requestAnimationFrame(r))}function sc(t){var e=zt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),zt=e}function Kp(t){var e=zt;t.__c=t.__(),zt=e}function ew(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var tw=Symbol.for("preact-signals");function Qp(){if(Hi>1)Hi--;else{for(var t,e=!1;as!==void 0;){var r=as;for(as=void 0,Jp++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Zh(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Jp=0,Hi--,e)throw t}}var He=void 0;var as=void 0,Hi=0,Jp=0,ac=0;function Qh(t){if(He!==void 0){var e=t.n;if(e===void 0||e.t!==He)return e={i:0,S:t,p:He.s,n:void 0,t:He,e:void 0,x:void 0,r:e},He.s!==void 0&&(He.s.n=e),He.s=e,t.n=e,32&He.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=He.s,e.n=void 0,He.s.n=e,He.s=e),e}}function ht(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}ht.prototype.brand=tw;ht.prototype.h=function(){return!0};ht.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)};ht.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)}};ht.prototype.subscribe=function(t){var e=this;return It(function(){var r=e.value,n=He;He=void 0;try{t(r)}finally{He=n}})};ht.prototype.valueOf=function(){return this.value};ht.prototype.toString=function(){return this.value+""};ht.prototype.toJSON=function(){return this.value};ht.prototype.peek=function(){var t=He;He=void 0;try{return this.value}finally{He=t}};Object.defineProperty(ht.prototype,"value",{get:function(){var t=Qh(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Jp>100)throw new Error("Cycle detected");this.v=t,this.i++,ac++,Hi++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Qp()}}}});function or(t){return new ht(t)}function Zh(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 eg(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 tg(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 $i(t){ht.call(this,void 0),this.x=t,this.s=void 0,this.g=ac-1,this.f=4}($i.prototype=new ht).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ac))return!0;if(this.g=ac,this.f|=1,this.i>0&&!Zh(this))return this.f&=-2,!0;var t=He;try{eg(this),He=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 He=t,tg(this),this.f&=-2,!0};$i.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)}ht.prototype.S.call(this,t)};$i.prototype.U=function(t){if(this.t!==void 0&&(ht.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)}};$i.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($i.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Qh(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Zp(t){return new $i(t)}function rg(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Hi++;var r=He;He=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,ef(t),n}finally{He=r,Qp()}}}function ef(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,rg(t)}function rw(t){if(He!==this)throw new Error("Out-of-order effect");tg(this),He=t,this.f&=-2,8&this.f&&ef(this),Qp()}function cs(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}cs.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()}};cs.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,rg(this),eg(this),Hi++;var t=He;return He=this,rw.bind(this,t)};cs.prototype.N=function(){2&this.f||(this.f|=2,this.o=as,as=this)};cs.prototype.d=function(){this.f|=8,1&this.f||ef(this)};function It(t){var e=new cs(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var rf,tf;function Vi(t,e){Te[t]=e.bind(null,Te[t]||function(){})}function cc(t){tf&&tf(),tf=t&&t.S()}function ng(t){var e=this,r=t.data,n=iw(r);n.value=r;var i=Xp(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),c=i.value;a(),$p(c)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=c},Zp(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}ng.displayName="_st";Object.defineProperties(ht.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ng},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Vi("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof ht&&(r||(e.__np=r={}),r[i]=o,n[i]=o.peek())}}t(e)});Vi("__r",function(t,e){cc();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=(function(i){var o;return It(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o})())),rf=n,cc(r),t(e)});Vi("__e",function(t,e,r,n){cc(),rf=void 0,t(e,r,n)});Vi("diffed",function(t,e){cc(),rf=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var o=r.U;if(o)for(var s in o){var a=o[s];a!==void 0&&!(s in n)&&(a.d(),o[s]=void 0)}else r.U=o={};for(var c in n){var p=o[c],d=n[c];p===void 0?(p=nw(r,c,d,i),o[c]=p):p.o(d,i)}}}t(e)});function nw(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,o=or(r);return{o:function(s,a){o.value=s,n=a},d:It(function(){var s=o.value.value;n[e]!==s&&(n[e]=s,i?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}Vi("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});Vi("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});Mr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function iw(t){return Xp(function(){return or(t)},[])}var lc=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var uc=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var nf=class{id;mID;name;groupID;groupName;isSelected;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.name=e.name,this.groupID=e.groupID,this.groupName=e.groupName,this.isSelected=e.isSelected??!1}},Ur=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new lc(r))??[],this.link=e.link,this.price=new uc(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.selectedOptions=e.selectedOptions??[],this.effectivePrice=or(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=or(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new nf(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};var Rt=class{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=or(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=or(this.selectedVariant)}get firstImageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(e=>e.isAvailable)??this.vars[0]}hasVariants(){return this.vars?.length>1}setSelectedVariant(e){this.selectedOrFirstVariant.value=e}update(e){return this.id=e.id,this.mID=e.mID,this.name=e.name,this.imgs=e.imgs,this.desc=e.desc,this.link=e.link,this.slug=e.slug,this.quantity=e.quantity,this.meta=e.meta,this.category=e.category,this.reviews=e.reviews,this.options=e.options,this.tags=e.tags,e.vars&&(this.vars=e.vars.map(r=>new Ur(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new Ct({id:this.id,mID:this.mID,vID:e.mID,vName:e.name,name:this.name,link:this.link,slug:this.slug,price:e.price.d,imageURL:e.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let e=this.selectedOrFirstVariant.value,r=e.price,n=this.name,i=this.category,o=this.variantImage??this.firstImageURL,s=this.meta,a=this.tags?.join(",")??"",c=this.reviews?.rating,p=this.reviews?.totalReviews,d=r.cmp&&r.cmp>r.d,f=Z(_({name:n},Lt("price",r.d,!0)),{image_url:o,meta:s,category:i,rating:c,reviews:p,tags:a});if(e.hasEffectivePrice()){let y=Lt("effective_price",e.effectivePrice.value,!0);Object.assign(f,y)}if(d){let y=r.cmp-r.d,I={discount_percent:(y/r.cmp*100).toFixed(0)};Object.assign(f,I),Object.assign(f,Lt("compare_price",r.cmp)),Object.assign(f,Lt("discount_price",y))}let E={name:e.name,quantity:e.quantity};return{product:f,variant:E}}};var pc=class{id;alt;sources;items;durationMS;thumbnail;card;constructor(e={}){this.id=e.id,this.alt=e.alt,this.sources=e.sources?.sort((r,n)=>n.height-r.height),this.durationMS=e.durationMS,this.thumbnail=e.thumbnail,this.items=e.items?e.items.map(r=>new Rt(r)):[],this.card=e.card}};var fc=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(e={}){this.videos=e.videos?.map(r=>new pc(r))??[],this.source=e.source,this.template=e.template,this.detailPopup=e.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=e.heading,this.showMuteButton=e.showMuteButton,this.slidePerViewCount=e.slidePerViewCount??4,this.autoPlay=e.autoPlay??"ON",this.footerContent=e.footerContent??"FIRST_ITEM"}};var Mt=Cr(og());Mt.filters.define("default",function(t){return typeof t>"u"||t==null?"":sw(t)});+Mt.filters.define("max",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r>n?e:t});Mt.filters.define("min",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r<n?e:t});Mt.filters.define("fallback",(t,e)=>t==null||t===""?e:t);Mt.filters.define("manipulate_quantity",(t,e,r)=>{if(e??=1,r??=100,e>r)return b.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%r;return n<e?e:n});Mt.filters.define("apply_discount_perc",(t,e,r=1/0)=>{if(t=+t,isNaN(t))return b.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return b.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let n=t*e/100;return t-Math.min(r,n)});Mt.filters.define("apply_discount_fixed",(t,e)=>(t=+t,isNaN(t)?(b.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,t-e)));Mt.filters.define("currency",t=>(t=+t,isNaN(t)?(b.error("Need value as a number for `currency` filter"),NaN):Up(t)));Mt.defaultConfig.defaultFilter="default";Mt.defaultConfig.useWith=!0;Mt.defaultConfig.autoEscape=!1;var ow={'"':"&quot;","\\":"&bsol;","\n":"\\n"};function sw(t){return String(t).replace(/["\\\n]/g,e=>ow[e])}function aw(t){if(!t)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return t.replace(e,(r,n,i,o)=>`{{ ${(i||o||"").trim()} }}`)}var Wi=(t,e,r)=>{e=_({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return Mt.render(aw(t),e)}catch(n){throw be(n,"squirrelly-render",{extra:{template:t,values:e},triggerContext:r}),n}},Jn=(t,e,r)=>{let n=JSON.stringify(t),i=Wi(n,e,r);try{return JSON.parse(i)}catch(o){throw be(o,"variable-replacement",{extra:{before:t,after:i},triggerContext:r}),o}};function ls(){return!!window.Shopify}function sg(){if(ls())return window.Shopify.shop?.split(".")?.[0]}function ag(t){let n=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function ji(t){return(window.Shopify?.routes?.root??"/")+t.substring(1)}function dc(t){return ji(t+"?from=cooee")}var cw="2024-10",lw=`/api/${cw}/graphql.json`,cg={"Content-Type":"application/json"};async function hc(t,e,r,n){let i=Xe.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");let o=new Headers(cg);o.append("X-Shopify-Storefront-Access-Token",i);let s=JSON.stringify({query:t,variables:e});try{return await Zr(lw,{method:"POST",headers:o,body:s})}catch(a){throw be(a,r,{engagementTrigger:n}),a}}async function Gi(t,e,r,n){return uw(dc(t),e,r,n)}async function uw(t,e,r,n){let i={body:JSON.stringify(e),method:"POST",headers:cg};try{return await Zr(t,i)}catch(o){throw be(o,r,{engagementTrigger:n}),o}}var gc=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e()}else this.isLocked=!1}},yc=class t{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){if(e=`__cooee_${e}_lock__`,"locks"in navigator&&!fw())try{return await pw(e,r,this.LOCK_TIMEOUT)}catch(s){b.verbose(`Web Locks API failed, falling back to localStorage: ${s}`)}let n=!1,i=0,o=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(b.verbose(`Lock retry ${i} for ${e}`),n=await this.acquire(e,o,i),!n);)await this.sleep(t.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,o)}}static async acquire(e,r,n){let i=Date.now(),o=localStorage.getItem(e),s=o?JSON.parse(o):null;if(s&&i<=s.expiry)return!1;let a={owner:r,expiry:i+t.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(a)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(b.verbose(`${r}: Lock acquired for ${e} after ${n} attempts!`),!0):(b.verbose(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(e,r){let n=localStorage.getItem(e);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(e),b.verbose(`${r}: Lock released`)):b.verbose(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}};async function pw(t,e,r){return new Promise((n,i)=>{let o=setTimeout(()=>{i(new Error(`Web Locks API timeout after ${r}ms`))},r);navigator.locks.request(t,async()=>{try{let s=await e();return clearTimeout(o),n(s),s}catch(s){throw clearTimeout(o),i(s),s}}).catch(s=>{clearTimeout(o),i(s)})})}function fw(){let t=navigator.userAgent||"";return/Safari/.test(t)&&!/Chrome/.test(t)&&!/Chromium/.test(t)||/iPhone|iPad|iPod/i.test(t)&&(/(FBAV|FBAN|Instagram|Twitter|Line|WhatsApp)/i.test(t)||!window.safari?.pushNotificaTion)||/Macintosh/.test(t)&&/Safari/.test(t)&&!/Chrome/.test(t)&&!/Chromium/.test(t)&&!window.safari?.pushNotification?!0:mw()}function mw(){try{return window.safari?.pushNotification?window.safari.pushNotification.toString()==="[object SafariRemoteNotification]":!window.indexedDB||!window.localStorage}catch{return!0}}var ye=class t{static CURRENT;token;items=[];total_price=0;original_total_price=0;items_subtotal_price=0;currency;item_count=0;attributes;cart_level_discount_applications;total_discount=0;lock=new gc;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCartSilently(){try{return await this.getNormalisedCart()}catch(e){b.error("Failed to get the normalised cart",e)}}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await ze.set("cart",r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await gt.get("id"),r=await ze.get("did");if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){b.verbose("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};b.verbose("Updating Shopify cart with attributes:",n);let i=await Gi("/cart/update.js",{attributes:n},"cart-add-attributes");b.verbose("Updated cart attributes",JSON.stringify(i.data)),this.update(i.data),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.total_discount=e.total_discount,pe.get().currencyCode=this.currency,b.verbose("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,itemsSubtotalPrice:this.items_subtotal_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return b.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){b.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},o=n.selling_plan_allocation?.selling_plan;if(!o){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){b.verbose("Not fetching cart");return}b.verbose("Fetching cart");let r=dc("/cart.js");try{let n=(await Zr(r,{},{retries:2})).data;this.update(n)}catch(n){b.error("Unable to fetch the cart",n)}}};var vc=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL}};var of=class{enabled;constructor(e){this.enabled=e.enabled}},sf=class extends of{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},Ec=class{productQuantity;constructor(e){e??={},this.productQuantity=new sf(e.productQuantity)}};var Kt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new Fn(e.bg)),e.br&&(this.br=new Jr(e.br)),e.shd&&(this.shd=new $o(e.shd)),e.spc&&(this.spc=new Qr(e.spc)),this.trf=new Hn(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Ge[this.t]}get click(){return this.clc}},Ge=(M=>(M[M.IMAGE=1]="IMAGE",M[M.TEXT=2]="TEXT",M[M.BUTTON=3]="BUTTON",M[M.FLEXBOX=4]="FLEXBOX",M[M.MULTI_COLUMN=5]="MULTI_COLUMN",M[M.CHECKBOX=6]="CHECKBOX",M[M.PRODUCTS=11]="PRODUCTS",M[M.PRODUCT=12]="PRODUCT",M[M.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",M[M.PRODUCT_TITLE=14]="PRODUCT_TITLE",M[M.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",M[M.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",M[M.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",M[M.PRODUCT_RATING=19]="PRODUCT_RATING",M[M.EMAIL_INPUT=51]="EMAIL_INPUT",M[M.PHONE_INPUT=52]="PHONE_INPUT",M[M.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",M[M.CAROUSEL=62]="CAROUSEL",M[M.SHAPE=100]="SHAPE",M))(Ge||{});var Qn=class extends Kt{constructor(e){super(e)}};var cn=class extends Kt{src;constructor(e){super(e),this.src=e.src}};var kr=class extends Kt{typo;constructor(e){super(e);let r=_(_({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new lt(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var Sn=class extends kr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var _c=class extends Kt{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var Yi=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0}start(e,r){let n=new Date;e===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let a=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),p=Math.floor(s%(1e3*60*60)/(1e3*60)),d=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:c,minutes:p,seconds:d})},1e3);return i}};var qi=class extends kr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new Yi(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var bc=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new We(e.c??{})}get text(){return this.txt}get color(){return this.c}};var In=class extends kr{ph;constructor(e){super(e),this.ph=new bc(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var zi=class extends In{constructor(e){e??={},super(e)}};var Ki=class extends In{};var Xi=class extends In{};var Ji=class extends cn{};var wc=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}};var Sc=15,us=class extends Kt{gvt;max;cover;anim;embedded;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new wc(e.anim),this.spc||(this.spc=new Qr({pl:Sc,pr:Sc,pt:Sc,pb:Sc}))}};var Ic=class extends us{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new _c(e.cont),this.mob=new us(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new cn(r)):r.t===2?this.elems.push(new Sn(r)):r.t===3?this.elems.push(new Sn(r)):r.t===100?this.elems.push(new Qn(r)):r.t===51?this.elems.push(new Ki(r)):r.t===52?this.elems.push(new Xi(r)):r.t===61?this.elems.push(new qi(r)):r.t===15||r.t===16?this.elems.push(new zi(r)):r.t===13&&this.elems.push(new Ji(r))})}getStylesForWrapper(){if(this.cover)return{};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:"50%",left:0,transform:"translateY(-50%)"}:e={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},e.overflow="visible",e}getFlexStylesForContainer(){let e={display:"flex",flexDirection:"row"},r,n;return this.gvt===1?(r="flex-start",n="flex-start"):this.gvt===2?(r="center",n="flex-start"):this.gvt===3?(r="flex-end",n="flex-start"):this.gvt===4?(r="flex-start",n="center"):this.gvt===6?(r="flex-end",n="center"):this.gvt===7?(r="flex-start",n="flex-end"):this.gvt===8?(r="center",n="flex-end"):this.gvt===9?(r="flex-end",n="flex-end"):(r="center",n="center"),e.alignItems=n,e.justifyContent=r,e.overflow="visible",e}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim}};var Qi=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??"row",this.wrap=e.wrap??"nowrap",this.jc=e.jc??"flex-start",this.ai=e.ai??"flex-start",this.scroll=e.scroll}};var Tc=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex}};var xc=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??"100%",this.h=e.h??"auto",this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH}};var Cc=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Qr(e.spc),e.size&&(this.size=new xc(e.size)),e.bg&&(this.bg=new Fn(e.bg)),e.br&&(this.br=new Jr(e.br)),e.typo&&(this.typo=new lt(e.typo)),e.lout&&(this.lout=new Tc(e.lout)),e.flex&&(this.flex=new Qi(e.flex))}},Zi=class{sm;lg;constructor(e){e??={},this.sm=new Cc(e.sm),this.lg=new Cc(e.lg)}};var yt=class{t;style;hide;when;clc;l;constructor(e,r){r??={},this.t=e,this.style=new Zi(r.style),this.hide=r.hide,this.l=r.l,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return Ge[this.t]}};var vt=class extends yt{text;constructor(e,r){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(r??2,e),e??={},this.text=e.text}};var Zn=class extends vt{constructor(e,r){super(e,r??3)}};var eo=class extends yt{value;constructor(e){super(6,e),e??={},this.value=e.value}};var to=class extends vt{showChips;optionsConfig;constructor(e=15,r){super(r,e),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var Rc=class extends yt{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new We(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var lg=Cr(wi());var af=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new We(e.color)}},cf=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new We(e.color)}},ps=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(e){e??={},this.navigation=new cf(e.navigation),this.pagination=new af(e.pagination),this.autoplay=e.autoplay,this.slidesPerView=e.slidesPerView??1,this.maxInRow=e.maxInRow??e.slidesPerView??4,this.gap=e.gap??0}},Ac=class extends yt{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=Xt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new ps(e.conf),this.allowedTypes=e.allowedTypes}};var Dc=class extends vt{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new Yi(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var Tn=class extends yt{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=Xt.getParsedElement(r);n&&this.elems.push(n)})}};var ei=class extends yt{src;sm;lg;constructor(e,r){super(r??1,e),e&&this.update(e)}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg}};var Xt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=t.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new vt(e);case 3:return new Zn(e);case 6:return new eo(e);case 11:return new Oc(e);case 12:return new xn(e);case 61:return new Dc(e);case 4:return new Tn(e);case 1:return new ei(e);case 13:return new ei(e,13);case 14:return new vt(e,14);case 15:case 16:return new to(e.t,e);case 18:return new Zn(e,18);case 62:return new Ac(e);case 19:return new Rc(e);default:lg.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}};var xn=class extends yt{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=Xt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new eo(e.cBox)),this.elems.push(new ei(e.img,13));let r=new vt(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new vt(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let i=new vt(e.compareAt);i.text="{{ product.compare_price }}",i.hide=!e.show?.price,e.compareAt||(i.style=new Zi(n.style),i.style.lg.typo=new lt(Z(_({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new lt(Z(_({},i.style.sm.typo),{td:"line-through"})));let o=new Tn({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Xt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new to(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new Zn(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new vt(e.symbol))}};var Oc=class extends yt{conf;prod;constructor(e){super(11,e),e??={},this.conf=new lf(e.conf),this.prod=new xn(e.prod)}};var Nc=class extends ps{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},lf=class{lg;sm;constructor(e){e??={},this.lg=new Nc(e.lg),this.sm=new Nc(e.sm)}};var Pc=class extends Tn{constructor(e){super(e)}};var ro=class{cont;elems=[];constructor(e){e=e??{},this.cont=new Pc(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=Xt.getParsedElement(e);return r&&this.elems.push(r),r}};function Lc(t,e){return dw(t,e,0,5)}function dw(t,e,r=0,n=50){if(e){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let i of e){if(i.t===t)return i;let o="elems"in i?i.elems:[];if(o?.length>0){let s=Lc(t,o);if(s)return s}}}}var uf=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Bo.EXCLUSION}isABTesting(){return this.contentType===Bo.ABTESTING}isSingleContent(){return this.contentType===Bo.SINGLE}},fs=class{videoConfig;savingsBarConfig;constructor(e){this.update(e)}update(e){e??={},e.videoConfig&&(this.videoConfig=new fc(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new pa(e.savingsBarConfig))}},Tt=class extends uf{contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;entryAnimation;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=or({});constructor(e){super(e),this.id=e.id,this.currency=pe.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new ro(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??"NONE",this.embeddedItems=e.embeddedItems?.map(r=>new Ct(r)),this.items=e.items?.map(r=>new Rt(r))??[],this.nonMutableItems=e.items?.map(r=>new Rt(r))??[],this.collections=e.collections?.map(r=>new vc(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 Ec(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 ca(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new ua(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new oa(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Rt(e.bundleFrom)),e.content&&(this.content=new fs(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===vr.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Uo.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Uo.PAGE_EMBED}isProgressBar(){return this.objective===vr.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===vr.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===vr.CART_RECOVERY}isProductPromotion(){return this.objective===vr.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===lu.COLLECTION}isBYOB(){return this.objective===vr.BYOB}isStickyATC(){return this.objective===vr.STICKY_ATC}isShoppableVideo(){return this.objective===vr.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===vr.SAVINGS_BAR}processPopup(e){let r=this.items[0],n={},i={};if(r){let a=r.selectedOrFirstVariant.value;n=Z(_(_({name:r.name,id:r.mID,link:r.link,vID:a.mID,image:r.variantImage},Lt("price",a.price.d)),Lt("comparePrice",a.price.cmp)),{quantity:r.quantity}),i={quantity:a.quantity}}let o={productCount:ye.getCurrent().item_count},s=Wi(JSON.stringify(e),{product:n,variant:i,cart:o,discount:this.discount,customer:this.customerData},new Rr(new Date,this));return r&&(s=s.replace(new RegExp("https://cdn.global.letscooee.com/images/placeholders/product.png","gi"),r.variantImage??r.firstImageURL)),new Ic(JSON.parse(s))}calculateDiscountData(e,r){let n=Xr.sum(e,s=>s.selectedOrFirstVariant.value.price.d),i=Xr.sum(e,s=>{let a=s.selectedOrFirstVariant.value.price;return a.cmp??a.d}),o={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(o);return}if(Zt.BXGY===this.discount.type&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,o.discountPercentage,!0),o.discountAmount=o.actualPrice-Xr.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([Zt.UNIQUE_FLAT_ITEMS,Zt.STATIC,Zt.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===Zt.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)o.discountAmount=o.actualPrice-this.discount.values[0],o.discountPercentage=o.discountAmount/o.actualPrice*100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===Zt.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,c)=>c.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,o.discountAmount=s.selectedOrFirstVariant.value.price.d,o.discountPercentage=o.discountAmount/o.actualPrice*100}o.discountedPrice=o.actualPrice-o.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(o)}getPrivateAttributesForLineItem(){return Xe.get().skipItemAttribute?{}:{_via:"Cooee",_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Xe.get().skipItemAttribute?[]:[{key:"_via",value:"Cooee"},{key:"_letscooee_campaign",value:this.shortID},{key:"_letscooee_content",value:this.contentID}]}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){if(Lc(62,this.widget?.elems))return!0;let r=Lc(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){let e;return this.onsiteDeliveryType===Uo.POPUP?e="Popup":e=Im.toTitle(this.objective),`${e}(id=${this.shortID})`}getCartMagicVariables(){let e=ye.getCurrent(),r=Xr.sum(e.items??[],n=>n.discounts?.reduce((i,o)=>i+(o.amount??0),0)??0);return _(_(_(_({productCount:e.item_count,product_count:e.item_count},Lt("amount",e.total_price/100)),Lt("originalAmount",e.original_total_price/100)),Lt("total_line_items_discount",r/100)),Lt("total_discount",e.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.isProgressBar()&&!this.isSavingsBar()}shouldSkipVariation(){return this.isSingleContent()||this.isProgressBar()||this.isSavingsBar()||!!this.widget}updateEffectivePrice(e,r,n=!1){let i=pe.get().getCurrentItem();e.forEach(o=>{let s=o.selectedOrFirstVariant.value,a=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=a.d;else{let c=a.d*r/100;s.effectivePrice.value=a.d-c}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:Sh(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,Lt(n,e[n]))}),r}};function gw(t,e){return e={exports:{}},t(e,e.exports),e.exports}var yw=bw,vw=Sw,Ew=xw,Hr=[],ar=[],_w=typeof Uint8Array<"u"?Uint8Array:Array,pf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ti=0,ug=pf.length;ti<ug;++ti)Hr[ti]=pf[ti],ar[pf.charCodeAt(ti)]=ti;var ti,ug;ar[45]=62;ar[95]=63;function xg(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 bw(t){var e=xg(t),r=e[0],n=e[1];return(r+n)*3/4-n}function ww(t,e,r){return(e+r)*3/4-r}function Sw(t){var e,r=xg(t),n=r[0],i=r[1],o=new _w(ww(t,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=ar[t.charCodeAt(c)]<<18|ar[t.charCodeAt(c+1)]<<12|ar[t.charCodeAt(c+2)]<<6|ar[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=ar[t.charCodeAt(c)]<<2|ar[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=ar[t.charCodeAt(c)]<<10|ar[t.charCodeAt(c+1)]<<4|ar[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Iw(t){return Hr[t>>18&63]+Hr[t>>12&63]+Hr[t>>6&63]+Hr[t&63]}function Tw(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Iw(n));return i.join("")}function xw(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Tw(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(Hr[e>>2]+Hr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Hr[e>>10]+Hr[e>>4&63]+Hr[e<<2&63]+"=")),i.join("")}var ff={byteLength:yw,toByteArray:vw,fromByteArray:Ew};var Cw=function(e,r,n,i,o){var s,a,c=o*8-i-1,p=(1<<c)-1,d=p>>1,f=-7,E=n?o-1:0,y=n?-1:1,I=e[r+E];for(E+=y,s=I&(1<<-f)-1,I>>=-f,f+=c;f>0;s=s*256+e[r+E],E+=y,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=i;f>0;a=a*256+e[r+E],E+=y,f-=8);if(s===0)s=1-d;else{if(s===p)return a?NaN:(I?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-d}return(I?-1:1)*a*Math.pow(2,s-i)},Rw=function(e,r,n,i,o,s){var a,c,p,d=s*8-o-1,f=(1<<d)-1,E=f>>1,y=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=i?0:s-1,D=i?1:-1,U=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+E>=1?r+=y/p:r+=y*Math.pow(2,1-E),r*p>=2&&(a++,p/=2),a+E>=f?(c=0,a=f):a+E>=1?(c=(r*p-1)*Math.pow(2,o),a=a+E):(c=r*Math.pow(2,E-1)*Math.pow(2,o),a=0));o>=8;e[n+I]=c&255,I+=D,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;e[n+I]=a&255,I+=D,a/=256,d-=8);e[n+I-D]|=U*128},no={read:Cw,write:Rw},Uc=gw(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=N,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var h=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(h,l),h.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(h){if(h>n)throw new RangeError('The value "'+h+'" is invalid for option "size"');var l=new Uint8Array(h);return Object.setPrototypeOf(l,s.prototype),l}function s(h,l,u){if(typeof h=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(h)}return a(h,l,u)}s.poolSize=8192;function a(h,l,u){if(typeof h=="string")return f(h,l);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h));if(Ve(h,ArrayBuffer)||h&&Ve(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ve(h,SharedArrayBuffer)||h&&Ve(h.buffer,SharedArrayBuffer)))return I(h,l,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var v=h.valueOf&&h.valueOf();if(v!=null&&v!==h)return s.from(v,l,u);var C=D(h);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return s.from(h[Symbol.toPrimitive]("string"),l,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h))}s.from=function(h,l,u){return a(h,l,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function p(h,l,u){return c(h),h<=0?o(h):l!==void 0?typeof u=="string"?o(h).fill(l,u):o(h).fill(l):o(h)}s.alloc=function(h,l,u){return p(h,l,u)};function d(h){return c(h),o(h<0?0:U(h)|0)}s.allocUnsafe=function(h){return d(h)},s.allocUnsafeSlow=function(h){return d(h)};function f(h,l){if((typeof l!="string"||l==="")&&(l="utf8"),!s.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var u=H(h,l)|0,v=o(u),C=v.write(h,l);return C!==u&&(v=v.slice(0,C)),v}function E(h){for(var l=h.length<0?0:U(h.length)|0,u=o(l),v=0;v<l;v+=1)u[v]=h[v]&255;return u}function y(h){if(Ve(h,Uint8Array)){var l=new Uint8Array(h);return I(l.buffer,l.byteOffset,l.byteLength)}return E(h)}function I(h,l,u){if(l<0||h.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<l+(u||0))throw new RangeError('"length" is outside of buffer bounds');var v;return l===void 0&&u===void 0?v=new Uint8Array(h):u===void 0?v=new Uint8Array(h,l):v=new Uint8Array(h,l,u),Object.setPrototypeOf(v,s.prototype),v}function D(h){if(s.isBuffer(h)){var l=U(h.length)|0,u=o(l);return u.length===0||h.copy(u,0,0,l),u}if(h.length!==void 0)return typeof h.length!="number"||Ae(h.length)?o(0):E(h);if(h.type==="Buffer"&&Array.isArray(h.data))return E(h.data)}function U(h){if(h>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return h|0}function N(h){return+h!=h&&(h=0),s.alloc(+h)}s.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==s.prototype},s.compare=function(l,u){if(Ve(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),Ve(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(l)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===u)return 0;for(var v=l.length,C=u.length,O=0,j=Math.min(v,C);O<j;++O)if(l[O]!==u[O]){v=l[O],C=u[O];break}return v<C?-1:C<v?1:0},s.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(l,u){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return s.alloc(0);var v;if(u===void 0)for(u=0,v=0;v<l.length;++v)u+=l[v].length;var C=s.allocUnsafe(u),O=0;for(v=0;v<l.length;++v){var j=l[v];if(Ve(j,Uint8Array))O+j.length>C.length?s.from(j).copy(C,O):Uint8Array.prototype.set.call(C,j,O);else if(s.isBuffer(j))j.copy(C,O);else throw new TypeError('"list" argument must be an Array of Buffers');O+=j.length}return C};function H(h,l){if(s.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||Ve(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(h));var u=h.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&u===0)return 0;for(var C=!1;;)switch(l){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return wt(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return $e(h).length;default:if(C)return v?-1:wt(h).length;l=(""+l).toLowerCase(),C=!0}}s.byteLength=H;function M(h,l,u){var v=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,l>>>=0,u<=l))return"";for(h||(h="utf8");;)switch(h){case"hex":return W(this,l,u);case"utf8":case"utf-8":return qe(this,l,u);case"ascii":return A(this,l,u);case"latin1":case"binary":return R(this,l,u);case"base64":return Ce(this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,l,u);default:if(v)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),v=!0}}s.prototype._isBuffer=!0;function q(h,l,u){var v=h[l];h[l]=h[u],h[u]=v}s.prototype.swap16=function(){var l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<l;u+=2)q(this,u,u+1);return this},s.prototype.swap32=function(){var l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<l;u+=4)q(this,u,u+3),q(this,u+1,u+2);return this},s.prototype.swap64=function(){var l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<l;u+=8)q(this,u,u+7),q(this,u+1,u+6),q(this,u+2,u+5),q(this,u+3,u+4);return this},s.prototype.toString=function(){var l=this.length;return l===0?"":arguments.length===0?qe(this,0,l):M.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(l){if(!s.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:s.compare(this,l)===0},s.prototype.inspect=function(){var l="",u=e.INSPECT_MAX_BYTES;return l=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(l+=" ... "),"<Buffer "+l+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(l,u,v,C,O){if(Ve(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),!s.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(l));if(u===void 0&&(u=0),v===void 0&&(v=l?l.length:0),C===void 0&&(C=0),O===void 0&&(O=this.length),u<0||v>l.length||C<0||O>this.length)throw new RangeError("out of range index");if(C>=O&&u>=v)return 0;if(C>=O)return-1;if(u>=v)return 1;if(u>>>=0,v>>>=0,C>>>=0,O>>>=0,this===l)return 0;for(var j=O-C,ue=v-u,_e=Math.min(j,ue),ge=this.slice(C,O),Me=l.slice(u,v),Fe=0;Fe<_e;++Fe)if(ge[Fe]!==Me[Fe]){j=ge[Fe],ue=Me[Fe];break}return j<ue?-1:ue<j?1:0};function Ee(h,l,u,v,C){if(h.length===0)return-1;if(typeof u=="string"?(v=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Ae(u)&&(u=C?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(C)return-1;u=h.length-1}else if(u<0)if(C)u=0;else return-1;if(typeof l=="string"&&(l=s.from(l,v)),s.isBuffer(l))return l.length===0?-1:J(h,l,u,v,C);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?C?Uint8Array.prototype.indexOf.call(h,l,u):Uint8Array.prototype.lastIndexOf.call(h,l,u):J(h,[l],u,v,C);throw new TypeError("val must be string, number or Buffer")}function J(h,l,u,v,C){var O=1,j=h.length,ue=l.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(h.length<2||l.length<2)return-1;O=2,j/=2,ue/=2,u/=2}function _e(dr,zr){return O===1?dr[zr]:dr.readUInt16BE(zr*O)}var ge;if(C){var Me=-1;for(ge=u;ge<j;ge++)if(_e(h,ge)===_e(l,Me===-1?0:ge-Me)){if(Me===-1&&(Me=ge),ge-Me+1===ue)return Me*O}else Me!==-1&&(ge-=ge-Me),Me=-1}else for(u+ue>j&&(u=j-ue),ge=u;ge>=0;ge--){for(var Fe=!0,it=0;it<ue;it++)if(_e(h,ge+it)!==_e(l,it)){Fe=!1;break}if(Fe)return ge}return-1}s.prototype.includes=function(l,u,v){return this.indexOf(l,u,v)!==-1},s.prototype.indexOf=function(l,u,v){return Ee(this,l,u,v,!0)},s.prototype.lastIndexOf=function(l,u,v){return Ee(this,l,u,v,!1)};function ae(h,l,u,v){u=Number(u)||0;var C=h.length-u;v?(v=Number(v),v>C&&(v=C)):v=C;var O=l.length;v>O/2&&(v=O/2);for(var j=0;j<v;++j){var ue=parseInt(l.substr(j*2,2),16);if(Ae(ue))return j;h[u+j]=ue}return j}function se(h,l,u,v){return Re(wt(l,h.length-u),h,u,v)}function me(h,l,u,v){return Re(ct(l),h,u,v)}function Le(h,l,u,v){return Re($e(l),h,u,v)}function Ie(h,l,u,v){return Re(we(l,h.length-u),h,u,v)}s.prototype.write=function(l,u,v,C){if(u===void 0)C="utf8",v=this.length,u=0;else if(v===void 0&&typeof u=="string")C=u,v=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(v)?(v=v>>>0,C===void 0&&(C="utf8")):(C=v,v=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var O=this.length-u;if((v===void 0||v>O)&&(v=O),l.length>0&&(v<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");C||(C="utf8");for(var j=!1;;)switch(C){case"hex":return ae(this,l,u,v);case"utf8":case"utf-8":return se(this,l,u,v);case"ascii":case"latin1":case"binary":return me(this,l,u,v);case"base64":return Le(this,l,u,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ie(this,l,u,v);default:if(j)throw new TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),j=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ce(h,l,u){return l===0&&u===h.length?ff.fromByteArray(h):ff.fromByteArray(h.slice(l,u))}function qe(h,l,u){u=Math.min(h.length,u);for(var v=[],C=l;C<u;){var O=h[C],j=null,ue=O>239?4:O>223?3:O>191?2:1;if(C+ue<=u){var _e,ge,Me,Fe;switch(ue){case 1:O<128&&(j=O);break;case 2:_e=h[C+1],(_e&192)===128&&(Fe=(O&31)<<6|_e&63,Fe>127&&(j=Fe));break;case 3:_e=h[C+1],ge=h[C+2],(_e&192)===128&&(ge&192)===128&&(Fe=(O&15)<<12|(_e&63)<<6|ge&63,Fe>2047&&(Fe<55296||Fe>57343)&&(j=Fe));break;case 4:_e=h[C+1],ge=h[C+2],Me=h[C+3],(_e&192)===128&&(ge&192)===128&&(Me&192)===128&&(Fe=(O&15)<<18|(_e&63)<<12|(ge&63)<<6|Me&63,Fe>65535&&Fe<1114112&&(j=Fe))}}j===null?(j=65533,ue=1):j>65535&&(j-=65536,v.push(j>>>10&1023|55296),j=56320|j&1023),v.push(j),C+=ue}return Bt(v)}var Ze=4096;function Bt(h){var l=h.length;if(l<=Ze)return String.fromCharCode.apply(String,h);for(var u="",v=0;v<l;)u+=String.fromCharCode.apply(String,h.slice(v,v+=Ze));return u}function A(h,l,u){var v="";u=Math.min(h.length,u);for(var C=l;C<u;++C)v+=String.fromCharCode(h[C]&127);return v}function R(h,l,u){var v="";u=Math.min(h.length,u);for(var C=l;C<u;++C)v+=String.fromCharCode(h[C]);return v}function W(h,l,u){var v=h.length;(!l||l<0)&&(l=0),(!u||u<0||u>v)&&(u=v);for(var C="",O=l;O<u;++O)C+=jt[h[O]];return C}function k(h,l,u){for(var v=h.slice(l,u),C="",O=0;O<v.length-1;O+=2)C+=String.fromCharCode(v[O]+v[O+1]*256);return C}s.prototype.slice=function(l,u){var v=this.length;l=~~l,u=u===void 0?v:~~u,l<0?(l+=v,l<0&&(l=0)):l>v&&(l=v),u<0?(u+=v,u<0&&(u=0)):u>v&&(u=v),u<l&&(u=l);var C=this.subarray(l,u);return Object.setPrototypeOf(C,s.prototype),C};function $(h,l,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+l>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||$(l,u,this.length);for(var C=this[l],O=1,j=0;++j<u&&(O*=256);)C+=this[l+j]*O;return C},s.prototype.readUintBE=s.prototype.readUIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||$(l,u,this.length);for(var C=this[l+--u],O=1;u>0&&(O*=256);)C+=this[l+--u]*O;return C},s.prototype.readUint8=s.prototype.readUInt8=function(l,u){return l=l>>>0,u||$(l,1,this.length),this[l]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(l,u){return l=l>>>0,u||$(l,2,this.length),this[l]|this[l+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(l,u){return l=l>>>0,u||$(l,2,this.length),this[l]<<8|this[l+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(l,u){return l=l>>>0,u||$(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(l,u){return l=l>>>0,u||$(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},s.prototype.readIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||$(l,u,this.length);for(var C=this[l],O=1,j=0;++j<u&&(O*=256);)C+=this[l+j]*O;return O*=128,C>=O&&(C-=Math.pow(2,8*u)),C},s.prototype.readIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||$(l,u,this.length);for(var C=u,O=1,j=this[l+--C];C>0&&(O*=256);)j+=this[l+--C]*O;return O*=128,j>=O&&(j-=Math.pow(2,8*u)),j},s.prototype.readInt8=function(l,u){return l=l>>>0,u||$(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},s.prototype.readInt16LE=function(l,u){l=l>>>0,u||$(l,2,this.length);var v=this[l]|this[l+1]<<8;return v&32768?v|4294901760:v},s.prototype.readInt16BE=function(l,u){l=l>>>0,u||$(l,2,this.length);var v=this[l+1]|this[l]<<8;return v&32768?v|4294901760:v},s.prototype.readInt32LE=function(l,u){return l=l>>>0,u||$(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},s.prototype.readInt32BE=function(l,u){return l=l>>>0,u||$(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},s.prototype.readFloatLE=function(l,u){return l=l>>>0,u||$(l,4,this.length),no.read(this,l,!0,23,4)},s.prototype.readFloatBE=function(l,u){return l=l>>>0,u||$(l,4,this.length),no.read(this,l,!1,23,4)},s.prototype.readDoubleLE=function(l,u){return l=l>>>0,u||$(l,8,this.length),no.read(this,l,!0,52,8)},s.prototype.readDoubleBE=function(l,u){return l=l>>>0,u||$(l,8,this.length),no.read(this,l,!1,52,8)};function ne(h,l,u,v,C,O){if(!s.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>C||l<O)throw new RangeError('"value" argument is out of bounds');if(u+v>h.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(l,u,v,C){if(l=+l,u=u>>>0,v=v>>>0,!C){var O=Math.pow(2,8*v)-1;ne(this,l,u,v,O,0)}var j=1,ue=0;for(this[u]=l&255;++ue<v&&(j*=256);)this[u+ue]=l/j&255;return u+v},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(l,u,v,C){if(l=+l,u=u>>>0,v=v>>>0,!C){var O=Math.pow(2,8*v)-1;ne(this,l,u,v,O,0)}var j=v-1,ue=1;for(this[u+j]=l&255;--j>=0&&(ue*=256);)this[u+j]=l/ue&255;return u+v},s.prototype.writeUint8=s.prototype.writeUInt8=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,1,255,0),this[u]=l&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,65535,0),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,65535,0),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,4294967295,0),this[u+3]=l>>>24,this[u+2]=l>>>16,this[u+1]=l>>>8,this[u]=l&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,4294967295,0),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4},s.prototype.writeIntLE=function(l,u,v,C){if(l=+l,u=u>>>0,!C){var O=Math.pow(2,8*v-1);ne(this,l,u,v,O-1,-O)}var j=0,ue=1,_e=0;for(this[u]=l&255;++j<v&&(ue*=256);)l<0&&_e===0&&this[u+j-1]!==0&&(_e=1),this[u+j]=(l/ue>>0)-_e&255;return u+v},s.prototype.writeIntBE=function(l,u,v,C){if(l=+l,u=u>>>0,!C){var O=Math.pow(2,8*v-1);ne(this,l,u,v,O-1,-O)}var j=v-1,ue=1,_e=0;for(this[u+j]=l&255;--j>=0&&(ue*=256);)l<0&&_e===0&&this[u+j+1]!==0&&(_e=1),this[u+j]=(l/ue>>0)-_e&255;return u+v},s.prototype.writeInt8=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,1,127,-128),l<0&&(l=255+l+1),this[u]=l&255,u+1},s.prototype.writeInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,32767,-32768),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,32767,-32768),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,2147483647,-2147483648),this[u]=l&255,this[u+1]=l>>>8,this[u+2]=l>>>16,this[u+3]=l>>>24,u+4},s.prototype.writeInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4};function he(h,l,u,v,C,O){if(u+v>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function Ke(h,l,u,v,C){return l=+l,u=u>>>0,C||he(h,l,u,4),no.write(h,l,u,v,23,4),u+4}s.prototype.writeFloatLE=function(l,u,v){return Ke(this,l,u,!0,v)},s.prototype.writeFloatBE=function(l,u,v){return Ke(this,l,u,!1,v)};function rt(h,l,u,v,C){return l=+l,u=u>>>0,C||he(h,l,u,8),no.write(h,l,u,v,52,8),u+8}s.prototype.writeDoubleLE=function(l,u,v){return rt(this,l,u,!0,v)},s.prototype.writeDoubleBE=function(l,u,v){return rt(this,l,u,!1,v)},s.prototype.copy=function(l,u,v,C){if(!s.isBuffer(l))throw new TypeError("argument should be a Buffer");if(v||(v=0),!C&&C!==0&&(C=this.length),u>=l.length&&(u=l.length),u||(u=0),C>0&&C<v&&(C=v),C===v||l.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(v<0||v>=this.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("sourceEnd out of bounds");C>this.length&&(C=this.length),l.length-u<C-v&&(C=l.length-u+v);var O=C-v;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,v,C):Uint8Array.prototype.set.call(l,this.subarray(v,C),u),O},s.prototype.fill=function(l,u,v,C){if(typeof l=="string"){if(typeof u=="string"?(C=u,u=0,v=this.length):typeof v=="string"&&(C=v,v=this.length),C!==void 0&&typeof C!="string")throw new TypeError("encoding must be a string");if(typeof C=="string"&&!s.isEncoding(C))throw new TypeError("Unknown encoding: "+C);if(l.length===1){var O=l.charCodeAt(0);(C==="utf8"&&O<128||C==="latin1")&&(l=O)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(u<0||this.length<u||this.length<v)throw new RangeError("Out of range index");if(v<=u)return this;u=u>>>0,v=v===void 0?this.length:v>>>0,l||(l=0);var j;if(typeof l=="number")for(j=u;j<v;++j)this[j]=l;else{var ue=s.isBuffer(l)?l:s.from(l,C),_e=ue.length;if(_e===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(j=0;j<v-u;++j)this[j+u]=ue[j%_e]}return this};var nt=/[^+/0-9A-Za-z-_]/g;function bt(h){if(h=h.split("=")[0],h=h.trim().replace(nt,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function wt(h,l){l=l||1/0;for(var u,v=h.length,C=null,O=[],j=0;j<v;++j){if(u=h.charCodeAt(j),u>55295&&u<57344){if(!C){if(u>56319){(l-=3)>-1&&O.push(239,191,189);continue}else if(j+1===v){(l-=3)>-1&&O.push(239,191,189);continue}C=u;continue}if(u<56320){(l-=3)>-1&&O.push(239,191,189),C=u;continue}u=(C-55296<<10|u-56320)+65536}else C&&(l-=3)>-1&&O.push(239,191,189);if(C=null,u<128){if((l-=1)<0)break;O.push(u)}else if(u<2048){if((l-=2)<0)break;O.push(u>>6|192,u&63|128)}else if(u<65536){if((l-=3)<0)break;O.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((l-=4)<0)break;O.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return O}function ct(h){for(var l=[],u=0;u<h.length;++u)l.push(h.charCodeAt(u)&255);return l}function we(h,l){for(var u,v,C,O=[],j=0;j<h.length&&!((l-=2)<0);++j)u=h.charCodeAt(j),v=u>>8,C=u%256,O.push(C),O.push(v);return O}function $e(h){return ff.toByteArray(bt(h))}function Re(h,l,u,v){for(var C=0;C<v&&!(C+u>=l.length||C>=h.length);++C)l[C+u]=h[C];return C}function Ve(h,l){return h instanceof l||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===l.name}function Ae(h){return h!==h}var jt=(function(){for(var h="0123456789abcdef",l=new Array(256),u=0;u<16;++u)for(var v=u*16,C=0;C<16;++C)l[v+C]=h[u]+h[C];return l})()}),xe=Uc.Buffer;Uc.SlowBuffer;Uc.INSPECT_MAX_BYTES;Uc.kMaxLength;var yf=function(e,r){return yf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},yf(e,r)};function kc(t,e){yf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var ni=(function(t){kc(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e})(Error),Qe=(function(t){kc(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 Mc(t){return t&&t.Math==Math&&t}function Cg(){return Mc(typeof globalThis=="object"&&globalThis)||Mc(typeof window=="object"&&window)||Mc(typeof self=="object"&&self)||Mc(typeof global=="object"&&global)||Function("return this")()}function Aw(){var t=Cg();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Dw=function(e){var r=Aw()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(r);for(var n=xe.alloc(e),i=0;i<e;++i)n[i]=Math.floor(Math.random()*256);return n},Ow=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(xe.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(xe.alloc(e))}:Dw}},Rg=Ow();function Nw(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Ef(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Pw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Lw(t){return gs(t)&&Object.prototype.toString.call(t)==="[object Date]"}function gs(t){return typeof t=="object"&&t!==null}function Fc(t,e){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function Bc(t){if(ArrayBuffer.isView(t))return xe.from(t.buffer,t.byteOffset,t.byteLength);if(Nw(t))return xe.from(t);throw new Qe("Must use either Buffer or TypedArray")}var Mw=/^(?:[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,Ag=function(t){return typeof t=="string"&&Mw.test(t)},vf=function(t){if(!Ag(t))throw new Qe('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return xe.from(e,"hex")},pg=function(t,e){return e===void 0&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")};var RB=Math.pow(2,63)-1,AB=-Math.pow(2,63),Bw=Math.pow(2,53),Uw=-Math.pow(2,53);var Dg=4;var ii=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new Qe("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=xe.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=xe.from(e,"binary"):Array.isArray(e)?this.buffer=xe.from(e):this.buffer=Bc(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Qe("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Qe("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new Qe("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=xe.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=xe.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Bc(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 fg(this.buffer.slice(0,this.position));throw new ni('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=xe.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=xe.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=vf(e.$uuid)),!n)throw new Qe("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===Dg?new fg(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t})();Object.defineProperty(ii.prototype,"_bsontype",{value:"Binary"});var mf=16,fg=(function(t){kc(e,t);function e(r){var n=this,i,o;if(r==null)i=e.generate();else if(r instanceof e)i=xe.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===mf)i=Bc(r);else if(typeof r=="string")i=vf(r);else throw new Qe("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return n=t.call(this,i,Dg)||this,n.__id=o,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=pg(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=pg(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new ii(this.id,ii.SUBTYPE_UUID)},e.generate=function(){var r=Rg(mf);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,xe.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?Ag(r):Ef(r)?r.length!==mf?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=vf(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e})(ii),Hc=(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(Hc.prototype,"_bsontype",{value:"Code"});function kw(t){return gs(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var ds=(function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");o.length===2&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t})();Object.defineProperty(ds.prototype,"_bsontype",{value:"DBRef"});var sr=void 0;try{sr=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 mg=65536,Fw=1<<24,oo=mg*mg,Og=oo*oo,dg=Og/2,hg={},gg={},ie=(function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(e>>>=0,(o=0<=e&&e<256)&&(i=gg[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),o&&(gg[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(i=hg[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(hg[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>=Og)return t.MAX_UNSIGNED_VALUE}else{if(e<=-dg)return t.MIN_VALUE;if(e+1>=dg)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%oo|0,e/oo|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),p=parseInt(e.substring(a,a+c),n);if(c<8){var d=t.fromNumber(Math.pow(n,c));s=s.mul(d).add(t.fromNumber(p))}else s=s.mul(o),s=s.add(t.fromNumber(p))}return s.unsigned=r,s},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return gs(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,p=e.low&65535,d=0,f=0,E=0,y=0;return y+=o+p,E+=y>>>16,y&=65535,E+=i+c,f+=E>>>16,E&=65535,f+=n+a,d+=f>>>16,f&=65535,d+=r+s,d&=65535,t.fromBits(E<<16|y,d<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(sr){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?sr.div_u:sr.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Math.pow(2,a-48),p=t.fromNumber(n),d=p.mul(e);d.isNegative()||d.gt(i);)n-=c,p=t.fromNumber(n,this.unsigned),d=p.mul(e);p.isZero()&&(p=t.ONE),o=o.add(p),i=i.sub(d)}return o},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),sr){var r=(this.unsigned?sr.rem_u:sr.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.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)),sr){var r=sr.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,p=e.low>>>16,d=e.low&65535,f=0,E=0,y=0,I=0;return I+=s*d,y+=I>>>16,I&=65535,y+=o*d,E+=y>>>16,y&=65535,y+=s*p,E+=y>>>16,y&=65535,E+=i*d,f+=E>>>16,E&=65535,E+=o*p,f+=E>>>16,E&=65535,E+=s*c,f+=E>>>16,E&=65535,f+=n*d+i*p+o*c+s*a,f&=65535,t.fromBits(y<<16|I,f<<16|E,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*oo+(this.low>>>0):this.high*oo+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),p=s.sub(c.mul(o)).toInt()>>>0,d=p.toString(e);if(s=c,s.isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(Fw),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(ie.prototype,"__isLong__",{value:!0});Object.defineProperty(ie.prototype,"_bsontype",{value:"Long"});var Hw=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,$w=/^(\+|-)?(Infinity|inf)$/i,Vw=/^(\+|-)?NaN$/i,ms=6111,df=-6176,yg=6176,Ww=34,hf=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),vg=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Eg=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),jw=/^([-+])?(\d+)?$/,Gw=31,_g=16383,Yw=30,qw=31;function bg(t){return!isNaN(parseInt(t,10))}function zw(t){var e=ie.fromNumber(1e9),r=ie.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 ie(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Kw(t,e){if(!t&&!e)return{high:ie.fromNumber(0),low:ie.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new ie(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new ie(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),c=n.multiply(i),p=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new ie(a.getLowBits(),0).add(c).add(p.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),p=a.shiftLeft(32).add(new ie(p.getLowBits(),0)),{high:s,low:p}}function Xw(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,o=e.low>>>0;if(i<o)return!0}return!1}function io(t,e){throw new Qe('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var _f=(function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Ef(e)){if(e.byteLength!==16)throw new Qe("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Qe("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,o=0,s=0,a=0,c=0,p=0,d=[0],f=0,E=0,y=0,I=0,D=0,U=0,N=new ie(0,0),H=new ie(0,0),M=0,q=0;if(e.length>=7e3)throw new Qe(""+e+" not a valid Decimal128 string");var Ee=e.match(Hw),J=e.match($w),ae=e.match(Vw);if(!Ee&&!J&&!ae||e.length===0)throw new Qe(""+e+" not a valid Decimal128 string");if(Ee){var se=Ee[2],me=Ee[4],Le=Ee[5],Ie=Ee[6];me&&Ie===void 0&&io(e,"missing exponent power"),me&&se===void 0&&io(e,"missing exponent base"),me===void 0&&(Le||Ie)&&io(e,"missing e before exponent")}if((e[q]==="+"||e[q]==="-")&&(r=e[q++]==="-"),!bg(e[q])&&e[q]!=="."){if(e[q]==="i"||e[q]==="I")return new t(xe.from(r?vg:Eg));if(e[q]==="N")return new t(xe.from(hf))}for(;bg(e[q])||e[q]===".";){if(e[q]==="."){n&&io(e,"contains multiple periods"),n=!0,q=q+1;continue}f<34&&(e[q]!=="0"||i)&&(i||(p=s),i=!0,d[E++]=parseInt(e[q],10),f=f+1),i&&(a=a+1),n&&(c=c+1),s=s+1,q=q+1}if(n&&!s)throw new Qe(""+e+" not a valid Decimal128 string");if(e[q]==="e"||e[q]==="E"){var Ce=e.substr(++q).match(jw);if(!Ce||!Ce[2])return new t(xe.from(hf));D=parseInt(Ce[0],10),q=q+Ce[0].length}if(e[q])return new t(xe.from(hf));if(y=0,!f)y=0,I=0,d[0]=0,a=1,f=1,o=0;else if(I=f-1,o=a,o!==1)for(;d[p+o-1]===0;)o=o-1;for(D<=c&&c-D>16384?D=df:D=D-c;D>ms;){if(I=I+1,I-y>Ww){var qe=d.join("");if(qe.match(/^0+$/)){D=ms;break}io(e,"overflow")}D=D-1}for(;D<df||f<a;){if(I===0&&o<f){D=df,o=0;break}if(f<a?a=a-1:I=I-1,D<ms)D=D+1;else{var qe=d.join("");if(qe.match(/^0+$/)){D=ms;break}io(e,"overflow")}}if(I-y+1<o){var Ze=s;n&&(p=p+1,Ze=Ze+1),r&&(p=p+1,Ze=Ze+1);var Bt=parseInt(e[p+I+1],10),A=0;if(Bt>=5&&(A=1,Bt===5)){for(A=d[I]%2===1?1:0,U=p+I+2;U<Ze;U++)if(parseInt(e[U],10)){A=1;break}}if(A){for(var R=I;R>=0;R--)if(++d[R]>9&&(d[R]=0,R===0))if(D<ms)D=D+1,d[R]=1;else return new t(xe.from(r?vg:Eg))}}if(N=ie.fromNumber(0),H=ie.fromNumber(0),o===0)N=ie.fromNumber(0),H=ie.fromNumber(0);else if(I-y<17){var R=y;for(H=ie.fromNumber(d[R++]),N=new ie(0,0);R<=I;R++)H=H.multiply(ie.fromNumber(10)),H=H.add(ie.fromNumber(d[R]))}else{var R=y;for(N=ie.fromNumber(d[R++]);R<=I-17;R++)N=N.multiply(ie.fromNumber(10)),N=N.add(ie.fromNumber(d[R]));for(H=ie.fromNumber(d[R++]);R<=I;R++)H=H.multiply(ie.fromNumber(10)),H=H.add(ie.fromNumber(d[R]))}var W=Kw(N,ie.fromString("100000000000000000"));W.low=W.low.add(H),Xw(W.low,H)&&(W.high=W.high.add(ie.fromNumber(1))),M=D+yg;var k={low:ie.fromNumber(0),high:ie.fromNumber(0)};W.high.shiftRightUnsigned(49).and(ie.fromNumber(1)).equals(ie.fromNumber(1))?(k.high=k.high.or(ie.fromNumber(3).shiftLeft(61)),k.high=k.high.or(ie.fromNumber(M).and(ie.fromNumber(16383).shiftLeft(47))),k.high=k.high.or(W.high.and(ie.fromNumber(0x7fffffffffff)))):(k.high=k.high.or(ie.fromNumber(M&16383).shiftLeft(49)),k.high=k.high.or(W.high.and(ie.fromNumber(562949953421311)))),k.low=W.low,r&&(k.high=k.high.or(ie.fromString("9223372036854775808")));var $=xe.alloc(16);return q=0,$[q++]=k.low.low&255,$[q++]=k.low.low>>8&255,$[q++]=k.low.low>>16&255,$[q++]=k.low.low>>24&255,$[q++]=k.low.high&255,$[q++]=k.low.high>>8&255,$[q++]=k.low.high>>16&255,$[q++]=k.low.high>>24&255,$[q++]=k.high.low&255,$[q++]=k.high.low>>8&255,$[q++]=k.high.low>>16&255,$[q++]=k.high.low>>24&255,$[q++]=k.high.high&255,$[q++]=k.high.high>>8&255,$[q++]=k.high.high>>16&255,$[q++]=k.high.high>>24&255,new t($)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,a,c={parts:[0,0,0,0]},p,d,f=[];o=0;var E=this.bytes,y=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,I=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,D=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,U=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24;o=0;var N={low:new ie(y,I),high:new ie(D,U)};N.high.lessThan(ie.ZERO)&&f.push("-");var H=U>>26&Gw;if(H>>3===3){if(H===Yw)return f.join("")+"Infinity";if(H===qw)return"NaN";e=U>>15&_g,a=8+(U>>14&1)}else a=U>>14&7,e=U>>17&_g;var M=e-yg;if(c.parts[0]=(U&16383)+((a&15)<<14),c.parts[1]=D,c.parts[2]=I,c.parts[3]=y,c.parts[0]===0&&c.parts[1]===0&&c.parts[2]===0&&c.parts[3]===0)s=!0;else for(d=3;d>=0;d--){var q=0,Ee=zw(c);if(c=Ee.quotient,q=Ee.rem.low,!!q)for(p=8;p>=0;p--)n[d*9+p]=q%10,q=Math.floor(q/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var J=r-1+M;if(J>=34||J<=-7||M>0){if(r>34)return f.push("".concat(0)),M>0?f.push("E+".concat(M)):M<0&&f.push("E".concat(M)),f.join("");f.push("".concat(n[o++])),r=r-1,r&&f.push(".");for(var i=0;i<r;i++)f.push("".concat(n[o++]));f.push("E"),J>0?f.push("+".concat(J)):f.push("".concat(J))}else if(M>=0)for(var i=0;i<r;i++)f.push("".concat(n[o++]));else{var ae=r+M;if(ae>0)for(var i=0;i<ae;i++)f.push("".concat(n[o++]));else f.push("0");for(f.push(".");ae++<0;)f.push("0");for(var i=0;i<r-Math.max(ae-1,0);i++)f.push("".concat(n[o++]))}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t})();Object.defineProperty(_f.prototype,"_bsontype",{value:"Decimal128"});var $c=(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($c.prototype,"_bsontype",{value:"Double"});var Vc=(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(Vc.prototype,"_bsontype",{value:"Int32"});var bf=(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(bf.prototype,"_bsontype",{value:"MaxKey"});var wf=(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(wf.prototype,"_bsontype",{value:"MinKey"});var Jw=new RegExp("^[0-9a-fA-F]{24}$"),ri=null,Fr=Symbol("id"),Et=(function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new Qe("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=xe.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Fr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Fr]=r instanceof xe?r:Bc(r);else if(typeof r=="string")if(r.length===12){var n=xe.from(r);if(n.byteLength===12)this[Fr]=n;else throw new Qe("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Jw.test(r))this[Fr]=xe.from(r,"hex");else throw new Qe("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Qe("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Fr]},set:function(e){this[Fr]=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=xe.alloc(12);return n.writeUInt32BE(e,0),ri===null&&(ri=Rg(5)),n[4]=ri[0],n[5]=ri[1],n[6]=ri[2],n[7]=ri[3],n[8]=ri[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[Fr][11]===e[Fr][11]&&this[Fr].equals(e[Fr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Ef(this.id))return e===xe.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 xe.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=xe.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new Qe("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(xe.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(Math.random()*16777215),t})();Object.defineProperty(Et.prototype,"generate",{value:Fc(function(t){return Et.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Et.prototype,"getInc",{value:Fc(function(){return Et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Et.prototype,"get_inc",{value:Fc(function(){return Et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Et,"get_inc",{value:Fc(function(){return Et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Et.prototype,"_bsontype",{value:"ObjectID"});function Qw(t){return t.split("").sort().join("")}var hs=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Qw(r??""),this.pattern.indexOf("\0")!==-1)throw new ni("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new ni("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new ni("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new Qe("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t})();Object.defineProperty(hs.prototype,"_bsontype",{value:"BSONRegExp"});var Sf=(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(Sf.prototype,"_bsontype",{value:"Symbol"});var Zw=ie,Ng=(function(t){kc(e,t);function e(r,n){var i=this;return i instanceof e?(ie.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:gs(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(ie.fromInt(r,!0))},e.fromNumber=function(r){return new e(ie.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(ie.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=ie.MAX_UNSIGNED_VALUE,e})(Zw);function eS(t){return gs(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var Pg=2147483647,Lg=-2147483648,Mg=9223372036854776e3,Bg=-9223372036854776e3,tS={$oid:Et,$binary:ii,$uuid:ii,$symbol:Sf,$numberInt:Vc,$numberDecimal:_f,$numberDouble:$c,$numberLong:ie,$minKey:wf,$maxKey:bf,$regex:hs,$regularExpression:hs,$timestamp:Ng};function Ug(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Lg&&t<=Pg)return new Vc(t);if(t>=Bg&&t<=Mg)return ie.fromNumber(t)}return new $c(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(f){return f.startsWith("$")&&t[f]!=null}),n=0;n<r.length;n++){var i=tS[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var o=t.$date,s=new Date;return e.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):ie.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&e.relaxed&&s.setTime(o),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=Ug(t.$scope)),Hc.fromExtendedJSON(t)}if(kw(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof ds)return c;var p=Object.keys(c).filter(function(f){return f.startsWith("$")}),d=!0;if(p.forEach(function(f){["$ref","$id","$db"].indexOf(f)===-1&&(d=!1)}),d)return ds.fromExtendedJSON(c)}return t}function rS(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Cn(r,e)}finally{e.seenObjects.pop()}})}function wg(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Cn(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(N){return N.obj===t});if(r!==-1){var n=e.seenObjects.map(function(N){return N.propertyName}),i=n.slice(0,r).map(function(N){return"".concat(N," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(N){return"".concat(N," -> ")}).join(""),a=n[n.length-1],c=" ".repeat(i.length+o.length/2),p="-".repeat(s.length+(o.length+a.length)/2-1);throw new Qe(`Converting circular structure to EJSON:
40
40
  `+" ".concat(i).concat(o).concat(s).concat(a,`
41
- `)+" ".concat(c,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return $w(t,e);if(t===void 0)return null;if(t instanceof Date||Ew(t)){var d=t.getTime(),f=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:sg(t)}:e.relaxed&&f?{$date:sg(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var E=t>=vg&&t<=yg,y=t>=_g&&t<=Eg;if(E)return{$numberInt:t.toString()};if(y)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||vw(t)){var I=t.flags;if(I===void 0){var D=t.toString().match(/[gimuy]*$/);D&&(I=D[0])}var k=new fs(t.source,I);return k.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Ww(t,e):t}var Vw={Binary:function(t){return new oi(t.value(),t.sub_type)},Code:function(t){return new Lc(t.code,t.scope)},DBRef:function(t){return new ps(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new af(t.bytes)},Double:function(t){return new Mc(t.value)},Int32:function(t){return new Bc(t.value)},Long:function(t){return ae.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 cf},MinKey:function(){return new lf},ObjectID:function(t){return new bt(t)},ObjectId:function(t){return new bt(t)},BSONRegExp:function(t){return new fs(t.pattern,t.options)},Symbol:function(t){return new uf(t.value)},Timestamp:function(t){return gg.fromBits(t.low,t.high)}};function Ww(t,e){if(t==null||typeof t!="object")throw new ii("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=Cn(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{e.seenObjects.pop()}}return n}else if(Fw(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var a=Vw[t._bsontype];if(!a)throw new et("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return r==="Code"&&s.scope?s=new Lc(s.code,Cn(s.scope,e)):r==="DBRef"&&s.oid&&(s=new ps(Cn(s.collection,e),Cn(s.oid,e),Cn(s.db,e),Cn(s.fields,e))),s.toExtendedJSON(e)}else throw new ii("_bsontype must be a string, but was: "+typeof r)}var ag;(function(t){function e(o,s){var a=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(o,function(c,p){if(c.indexOf("\0")!==-1)throw new ii("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(c)));return bg(p,a)})}t.parse=e;function r(o,s,a,c){a!=null&&typeof a=="object"&&(c=a,a=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(c=s,s=void 0,a=0);var p=Object.assign({relaxed:!0,legacy:!1},c,{seenObjects:[{propertyName:"(root)",obj:null}]}),d=Cn(o,p);return JSON.stringify(d,s,a)}t.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}t.serialize=n;function i(o,s){return s=s||{},e(JSON.stringify(o),s)}t.deserialize=i})(ag||(ag={}));var cg,lg=pg();lg.Map?cg=lg.Map:cg=function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var aB=ae.fromNumber(bw),cB=ae.fromNumber(ww);var rf=new Uint8Array(8),lB=new DataView(rf.buffer,rf.byteOffset,rf.byteLength);var jw=1024*1024*17,uB=De.alloc(jw);var Rn=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(e){e=e||{},this.triggerID=e.id||e.triggerID,this.nudgeID=e.nudgeID,this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.contentID=e.contentID,this.variation=e.variation,this.props=e.props,this.objective=e.objective,this.onsiteDeliveryType=e.onsiteDeliveryType,this.holdout=e.holdout}};var Ce=class{constructor(e,r={},n,i){this.name=e;this.properties=r;this.id=i?new bt(i):new bt,this.occurred=new Date,n&&(this.trigger=new Rn(n)),this.newEvent=!i}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale};var wg=0,Sg="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";function Ig(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}function Gw(t=document.head){Uc(Sg,t)}function Uc(t,e=document.head){if(!t)return;let r=document.createElement("link");r.rel="stylesheet",r.href=t,t===Sg&&(r.crossOrigin="anonymous",r.onload=n=>{let o=n.currentTarget?.sheet?.cssRules;if(o){for(let s of o)if(s.type==CSSRule.FONT_FACE_RULE){let a=t.split("/"),c=a.slice(0,a.length-1).join("/"),p=s.cssText;p=p.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${c}/$4")`);let d=document.createElement("style");d.appendChild(document.createTextNode(p)),document.head.appendChild(d)}}}),e.appendChild(r)}function pf(t,e=document.head){if(!t)return;wg++;let r=document.createElement("style");r.id=`cooee-app-css-${wg}`,r.textContent=t,e.appendChild(r)}function Tg(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}async function kc(){window.CooeeSDK.Swiper||(window.CooeeSDK.Swiper=(await import("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs")).Swiper)}function ff(t,e=!0){if(!t)return;e&&Gw(t),Uc(Gt.styleURL,t);let r=Qe.get().website.commonCSS;pf(r,t)}var Yw="2.0.4",If=500,xg="user-agent",lo="",Cg="?",jc="function",Nn="undefined",uo="object",Tf="string",Ht="browser",un="cpu",Wr="device",wr="engine",cr="os",ao="result",W="name",L="type",H="vendor",Y="version",$t="architecture",Ss="major",U="model",bs="console",pe="mobile",He="tablet",ct="smarttv",$r="wearable",Fc="xr",ws="embedded",ds="inapp",Rf="brands",ai="formFactors",Af="fullVersionList",co="platform",Df="platformVersion",zc="bitness",On="sec-ch-ua",zw=On+"-full-version-list",qw=On+"-arch",Kw=On+"-"+zc,Xw=On+"-form-factors",Jw=On+"-"+pe,Qw=On+"-"+U,$g=On+"-"+co,Zw=$g+"-version",Vg=[Rf,Af,pe,U,co,Df,$t,ai,zc],Hc="Amazon",oo="Apple",Rg="ASUS",Ag="BlackBerry",si="Google",Dg="Huawei",mf="Lenovo",Ng="Honor",$c="LG",df="Microsoft",hf="Motorola",gf="Nvidia",Og="OnePlus",yf="OPPO",hs="Samsung",Pg="Sharp",gs="Sony",vf="Xiaomi",Ef="Zebra",Lg="Chrome",Mg="Chromium",An="Chromecast",Wc="Edge",ys="Firefox",vs="Opera",_f="Facebook",Bg="Sogou",so="Mobile ",Es=" Browser",xf="Windows",eS=typeof window!==Nn,Vt=eS&&window.navigator?window.navigator:void 0,Dn=Vt&&Vt.userAgentData?Vt.userAgentData:void 0,tS=function(t,e){var r={},n=e;if(!Gc(e)){n={};for(var i in e)for(var o in e[i])n[o]=e[i][o].concat(n[o]?n[o]:[])}for(var s in t)r[s]=n[s]&&n[s].length%2===0?n[s].concat(t[s]):t[s];return r},qc=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},Cf=function(t,e){if(typeof t===uo&&t.length>0){for(var r in t)if(pn(e)==pn(t[r]))return!0;return!1}return fo(t)?pn(e)==pn(t):!1},Gc=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Gc(t[r]):!1)},fo=function(t){return typeof t===Tf},bf=function(t){if(t){for(var e=[],r=po(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Yc(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Yc(r[n]);return e}},pn=function(t){return fo(t)?t.toLowerCase():t},wf=function(t){return fo(t)?po(/[^\d\.]/g,t).split(".")[0]:void 0},fn=function(t){for(var e in t){var r=t[e];typeof r==uo&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},po=function(t,e){return fo(e)?e.replace(t,lo):e},_s=function(t){return po(/\\?\"/g,t)},Yc=function(t,e){if(fo(t))return t=po(/^\s\s*/,t),typeof e===Nn?t:t.substring(0,If)},Sf=function(t,e){if(!(!t||!e))for(var r=0,n,i,o,s,a,c;r<e.length&&!a;){var p=e[r],d=e[r+1];for(n=i=0;n<p.length&&!a&&p[n];)if(a=p[n++].exec(t),a)for(o=0;o<d.length;o++)c=a[++i],s=d[o],typeof s===uo&&s.length>0?s.length===2?typeof s[1]==jc?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===jc&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=c?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=c?s[1].call(this,c,s[2]):void 0:s.length==3?this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=c?s[3].apply(this,[c.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=c||void 0;r+=2}},Vr=function(t,e){for(var r in e)if(typeof e[r]===uo&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(Cf(e[r][n],t))return r===Cg?void 0:r}else if(Cf(e[r],t))return r===Cg?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},Ug={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:""},kg={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},rS={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"},Fg={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Y,[W,so+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[Y,[W,Wc+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Y,[W,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[W,Y],[/opios[\/ ]+([\w\.]+)/i],[Y,[W,vs+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Y,[W,vs+" GX"]],[/\bopr\/([\w\.]+)/i],[Y,[W,vs]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Y,[W,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Y,[W,"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],[W,Y],[/quark(?:pc)?\/([-\w\.]+)/i],[Y,[W,"Quark"]],[/\bddg\/([\w\.]+)/i],[Y,[W,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Y,[W,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Y,[W,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Y,[W,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Y,[W,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Y,[W,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Y,[W,"Smart "+mf+Es]],[/(avast|avg)\/([\w\.]+)/i],[[W,/(.+)/,"$1 Secure"+Es],Y],[/\bfocus\/([\w\.]+)/i],[Y,[W,ys+" Focus"]],[/\bopt\/([\w\.]+)/i],[Y,[W,vs+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Y,[W,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Y,[W,"Dolphin"]],[/coast\/([\w\.]+)/i],[Y,[W,vs+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Y,[W,"MIUI"+Es]],[/fxios\/([\w\.-]+)/i],[Y,[W,so+ys]],[/\bqihoobrowser\/?([\w\.]*)/i],[Y,[W,"360"]],[/\b(qq)\/([\w\.]+)/i],[[W,/(.+)/,"$1Browser"],Y],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[W,/(.+)/,"$1"+Es],Y],[/samsungbrowser\/([\w\.]+)/i],[Y,[W,hs+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Y,[W,Bg+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[W,Bg+" Mobile"],Y],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[W,Y],[/(lbbrowser|rekonq)/i],[W],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Y,W],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[W,_f],Y,[L,ds]],[/(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],[W,Y,[L,ds]],[/\bgsa\/([\w\.]+) .*safari\//i],[Y,[W,"GSA"],[L,ds]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Y,[W,"TikTok"],[L,ds]],[/\[(linkedin)app\]/i],[W,[L,ds]],[/(chromium)[\/ ]([-\w\.]+)/i],[W,Y],[/headlesschrome(?:\/([\w\.]+)| )/i],[Y,[W,Lg+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[Y,[W,Wc+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[W,Lg+" WebView"],Y],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Y,[W,"Android"+Es]],[/chrome\/([\w\.]+) mobile/i],[Y,[W,so+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[W,Y],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Y,[W,so+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[W,so+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Y,W],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[W,[Y,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[W,Y],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[W,so+ys],Y],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[W,"Netscape"],Y],[/(wolvic|librewolf)\/([\w\.]+)/i],[W,Y],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Y,[W,ys+" 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],[W,[Y,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[W,[Y,/[^\d\.]+./,lo]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[$t,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[$t,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[$t,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[$t,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[$t,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[$t,/ower/,lo,pn]],[/ sun4\w[;\)]/i],[[$t,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[$t,pn]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[U,[H,hs],[L,He]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[U,[H,hs],[L,pe]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[U,[H,oo],[L,pe]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[U,[H,oo],[L,He]],[/(macintosh);/i],[U,[H,oo]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[U,[H,Pg],[L,pe]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[U,[H,Ng],[L,He]],[/honor([-\w ]+)[;\)]/i],[U,[H,Ng],[L,pe]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[U,[H,Dg],[L,He]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[U,[H,Dg],[L,pe]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[U,/_/g," "],[H,vf],[L,He]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[U,/_/g," "],[H,vf],[L,pe]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[U,[H,Og],[L,pe]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[U,[H,yf],[L,pe]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[U,[H,Vr,{OnePlus:["203","304","403","404","413","415"],"*":yf}],[L,He]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[U,[H,"BLU"],[L,pe]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[U,[H,"Vivo"],[L,pe]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[U,[H,"Realme"],[L,pe]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[U,[H,mf],[L,He]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[U,[H,mf],[L,pe]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[U,[H,hf],[L,pe]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[U,[H,hf],[L,He]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[U,[H,$c],[L,He]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[U,[H,$c],[L,pe]],[/(nokia) (t[12][01])/i],[H,U,[L,He]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[U,/_/g," "],[L,pe],[H,"Nokia"]],[/(pixel (c|tablet))\b/i],[U,[H,si],[L,He]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[U,[H,si],[L,pe]],[/(google) (pixelbook( go)?)/i],[H,U],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[U,[H,gs],[L,pe]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[U,"Xperia Tablet"],[H,gs],[L,He]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[U,[H,Hc],[L,He]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[U,/(.+)/g,"Fire Phone $1"],[H,Hc],[L,pe]],[/(playbook);[-\w\),; ]+(rim)/i],[U,H,[L,He]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[U,[H,Ag],[L,pe]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[U,[H,Rg],[L,He]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[U,[H,Rg],[L,pe]],[/(nexus 9)/i],[U,[H,"HTC"],[L,He]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[H,[U,/_/g," "],[L,pe]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[U,[H,"TCL"],[L,He]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[U,[H,"TCL"],[L,pe]],[/(itel) ((\w+))/i],[[H,pn],U,[L,Vr,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[U,[H,"Acer"],[L,He]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[U,[H,"Meizu"],[L,pe]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[U,[H,"Ulefone"],[L,pe]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[U,[H,"Energizer"],[L,pe]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[U,[H,"Cat"],[L,pe]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[U,[H,"Smartfren"],[L,pe]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[U,[H,"Nothing"],[L,pe]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[U,[H,"Archos"],[L,He]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[U,[H,"Archos"],[L,pe]],[/; (n159v)/i],[U,[H,"HMD"],[L,pe]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[H,U,[L,He]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[H,U,[L,pe]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[H,U,[L,He]],[/(surface duo)/i],[U,[H,df],[L,He]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[U,[H,"Fairphone"],[L,pe]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[U,[H,gf],[L,He]],[/(sprint) (\w+)/i],[H,U,[L,pe]],[/(kin\.[onetw]{3})/i],[[U,/\./g," "],[H,df],[L,pe]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[U,[H,Ef],[L,He]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[U,[H,Ef],[L,pe]],[/smart-tv.+(samsung)/i],[H,[L,ct]],[/hbbtv.+maple;(\d+)/i],[[U,/^/,"SmartTV"],[H,hs],[L,ct]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[H,U,[L,ct]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[H,$c],[L,ct]],[/(apple) ?tv/i],[H,[U,oo+" TV"],[L,ct]],[/crkey.*devicetype\/chromecast/i],[[U,An+" Third Generation"],[H,si],[L,ct]],[/crkey.*devicetype\/([^/]*)/i],[[U,/^/,"Chromecast "],[H,si],[L,ct]],[/fuchsia.*crkey/i],[[U,An+" Nest Hub"],[H,si],[L,ct]],[/crkey/i],[[U,An],[H,si],[L,ct]],[/(portaltv)/i],[U,[H,_f],[L,ct]],[/droid.+aft(\w+)( bui|\))/i],[U,[H,Hc],[L,ct]],[/(shield \w+ tv)/i],[U,[H,gf],[L,ct]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[U,[H,Pg],[L,ct]],[/(bravia[\w ]+)( bui|\))/i],[U,[H,gs],[L,ct]],[/(mi(tv|box)-?\w+) bui/i],[U,[H,vf],[L,ct]],[/Hbbtv.*(technisat) (.*);/i],[H,U,[L,ct]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[H,/.+\/(\w+)/,"$1",Vr,{LG:"lge"}],[U,Yc],[L,ct]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[U,[L,ct]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[L,ct]],[/(playstation \w+)/i],[U,[H,gs],[L,bs]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[U,[H,df],[L,bs]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[H,U,[L,bs]],[/droid.+; (shield)( bui|\))/i],[U,[H,gf],[L,bs]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[U,[H,hs],[L,$r]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[H,U,[L,$r]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[U,[H,yf],[L,$r]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[U,[H,oo],[L,$r]],[/(opwwe\d{3})/i],[U,[H,Og],[L,$r]],[/(moto 360)/i],[U,[H,hf],[L,$r]],[/(smartwatch 3)/i],[U,[H,gs],[L,$r]],[/(g watch r)/i],[U,[H,$c],[L,$r]],[/droid.+; (wt63?0{2,3})\)/i],[U,[H,Ef],[L,$r]],[/droid.+; (glass) \d/i],[U,[H,si],[L,Fc]],[/(pico) (4|neo3(?: link|pro)?)/i],[H,U,[L,Fc]],[/(quest( \d| pro)?s?).+vr/i],[U,[H,_f],[L,Fc]],[/mobile vr; rv.+firefox/i],[[L,Fc]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[H,[L,ws]],[/(aeobc)\b/i],[U,[H,Hc],[L,ws]],[/(homepod).+mac os/i],[U,[H,oo],[L,ws]],[/windows iot/i],[[L,ws]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[U,[L,Vr,{mobile:"Mobile",xr:"VR","*":He}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[L,He]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[L,pe]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[U,[H,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Y,[W,Wc+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[W,Y],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Y,[W,"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],[W,Y],[/ladybird\//i],[[W,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Y,W]],os:[[/(windows nt) (6\.[23]); arm/i],[[W,/N/,"R"],[Y,Vr,Ug]],[/(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],[W,Y],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[Y,/(;|\))/g,"",Vr,Ug],[W,xf]],[/(windows ce)\/?([\d\.]*)/i],[W,Y],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Y,/_/g,"."],[W,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[W,"macOS"],[Y,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Y,[W,An+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Y,[W,An+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Y,[W,An+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Y,[W,An+" Linux"]],[/crkey\/([\d\.]+)/i],[Y,[W,An]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[Y,W],[/(ubuntu) ([\w\.]+) like android/i],[[W,/(.+)/,"$1 Touch"],Y],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[W,Y],[/\(bb(10);/i],[Y,[W,Ag]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[Y,[W,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Y,[W,ys+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[Y,[W,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[Y,Vr,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[W,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Y,[W,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[W,"Chrome OS"],Y],[/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],[W,Y],[/(sunos) ?([\d\.]*)/i],[[W,"Solaris"],Y],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[W,Y]]},Vc=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return fn.call(t.init,[[Ht,[W,Y,Ss,L]],[un,[$t]],[Wr,[L,U,H]],[wr,[W,Y]],[cr,[W,Y]]]),fn.call(t.isIgnore,[[Ht,[Y,Ss]],[wr,[Y]],[cr,[Y]]]),fn.call(t.isIgnoreRgx,[[Ht,/ ?browser$/i],[cr,/ ?os$/i]]),fn.call(t.toString,[[Ht,[W,Y]],[un,[$t]],[Wr,[H,U]],[wr,[W,Y]],[cr,[W,Y]]]),t}(),nS=function(t,e){var r=Vc.init[e],n=Vc.isIgnore[e]||0,i=Vc.isIgnoreRgx[e]||0,o=Vc.toString[e]||0;function s(){fn.call(this,r)}return s.prototype.getItem=function(){return t},s.prototype.withClientHints=function(){return Dn?Dn.getHighEntropyValues(Vg).then(function(a){return t.setCH(new Wg(a,!1)).parseCH().get()}):t.parseCH().get()},s.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=ao&&(s.prototype.is=function(a){var c=!1;for(var p in this)if(this.hasOwnProperty(p)&&!Cf(n,p)&&pn(i?po(i,this[p]):this[p])==pn(i?po(i,a):a)){if(c=!0,a!=Nn)break}else if(a==Nn&&c){c=!c;break}return c},s.prototype.toString=function(){var a=lo;for(var c in o)typeof this[o[c]]!==Nn&&(a+=(a?" ":lo)+this[o[c]]);return a||Nn}),Dn||(s.prototype.then=function(a){var c=this,p=function(){for(var f in c)c.hasOwnProperty(f)&&(this[f]=c[f])};p.prototype={is:s.prototype.is,toString:s.prototype.toString};var d=new p;return a(d),d}),new s};function Wg(t,e){if(t=t||{},fn.call(this,Vg),e)fn.call(this,[[Rf,bf(t[On])],[Af,bf(t[zw])],[pe,/\?1/.test(t[Jw])],[U,_s(t[Qw])],[co,_s(t[$g])],[Df,_s(t[Zw])],[$t,_s(t[qw])],[ai,bf(t[Xw])],[zc,_s(t[Kw])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==Nn&&(this[r]=t[r])}function Hg(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Vt&&Vt.userAgent==this.ua)switch(this.itemType){case Ht:Vt.brave&&typeof Vt.brave.isBrave==jc&&this.set(W,"Brave");break;case Wr:!this.get(L)&&Dn&&Dn[pe]&&this.set(L,pe),this.get(U)=="Macintosh"&&Vt&&typeof Vt.standalone!==Nn&&Vt.maxTouchPoints&&Vt.maxTouchPoints>2&&this.set(U,"iPad").set(L,He);break;case cr:!this.get(W)&&Dn&&Dn[co]&&this.set(W,Dn[co]);break;case ao:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(Ht,o(Ht)).set(un,o(un)).set(Wr,o(Wr)).set(wr,o(wr)).set(cr,o(cr))}return this},this.parseUA=function(){return this.itemType!=ao&&Sf.call(this.data,this.ua,this.rgxMap),this.itemType==Ht&&this.set(Ss,wf(this.get(Y))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Ht:case wr:var s=i[Af]||i[Rf],a;if(s)for(var c in s){var p=s[c].brand||s[c],d=s[c].version;this.itemType==Ht&&!/not.a.brand/i.test(p)&&(!a||/Chrom/.test(a)&&p!=Mg||a==Wc&&/WebView2/.test(p))&&(p=Vr(p,rS),a=this.get(W),a&&!/Chrom/.test(a)&&/Chrom/.test(p)||this.set(W,p).set(Y,d).set(Ss,wf(d)),a=p),this.itemType==wr&&p==Mg&&this.set(Y,d)}break;case un:var f=i[$t];f&&(f&&i[zc]=="64"&&(f+="64"),Sf.call(this.data,f+";",o));break;case Wr:if(i[pe]&&this.set(L,pe),i[U]&&(this.set(U,i[U]),!this.get(L)||!this.get(H))){var E={};Sf.call(E,"droid 9; "+i[U]+")",o),!this.get(L)&&E.type&&this.set(L,E.type),!this.get(H)&&E.vendor&&this.set(H,E.vendor)}if(i[ai]){var y;if(typeof i[ai]!="string")for(var I=0;!y&&I<i[ai].length;)y=Vr(i[ai][I++],kg);else y=Vr(i[ai],kg);this.set(L,y)}break;case cr:var D=i[co];if(D){var k=i[Df];D==xf&&(k=parseInt(wf(k),10)>=13?"11":"10"),this.set(W,D).set(Y,k)}this.get(W)==xf&&i[U]=="Xbox"&&this.set(W,"Xbox").set(Y,void 0);break;case ao:var O=this.data,$=function(B){return O[B].getItem().setCH(i).parseCH().get()};this.set(Ht,$(Ht)).set(un,$(un)).set(Wr,$(Wr)).set(wr,$(wr)).set(cr,$(cr))}return this},fn.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",nS(this,t)]]),this}function jr(t,e,r){if(typeof t===uo?(Gc(t,!0)?(typeof e===uo&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===Tf&&!Gc(e,!0)&&(r=e,e=void 0),r&&typeof r.append===jc){var n={};r.forEach(function(c,p){n[p]=c}),r=n}if(!(this instanceof jr))return new jr(t,e,r).getResult();var i=typeof t===Tf?t:r&&r[xg]?r[xg]:Vt&&Vt.userAgent?Vt.userAgent:lo,o=new Wg(r,!0),s=e?tS(Fg,e):Fg,a=function(c){return c==ao?function(){return new Hg(c,i,s,o).set("ua",i).set(Ht,this.getBrowser()).set(un,this.getCPU()).set(Wr,this.getDevice()).set(wr,this.getEngine()).set(cr,this.getOS()).get()}:function(){return new Hg(c,i,s[c],o).parseUA().get()}};return fn.call(this,[["getBrowser",a(Ht)],["getCPU",a(un)],["getDevice",a(Wr)],["getEngine",a(wr)],["getOS",a(cr)],["getResult",a(ao)],["getUA",function(){return i}],["setUA",function(c){return fo(c)&&(i=c.length>If?Yc(c,If):c),this}]]).setUA(i),this}jr.VERSION=Yw;jr.BROWSER=qc([W,Y,Ss,L]);jr.CPU=qc([$t]);jr.DEVICE=qc([U,H,L,bs,pe,ct,He,$r,ws]);jr.ENGINE=jr.OS=qc([W,Y]);var fe=class{static storage=new Map;static get(e){return this.storage.has(e)||this.storage.set(e,e.getInstance()),this.storage.get(e)}};var Ay=xr(wi());var ci=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(ci||{});function _e(t){return typeof t=="function"}function mo(t){let r=t(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Kc=mo(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
41
+ `)+" ".concat(c,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return rS(t,e);if(t===void 0)return null;if(t instanceof Date||Lw(t)){var d=t.getTime(),f=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:wg(t)}:e.relaxed&&f?{$date:wg(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var E=t>=Lg&&t<=Pg,y=t>=Bg&&t<=Mg;if(E)return{$numberInt:t.toString()};if(y)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Pw(t)){var I=t.flags;if(I===void 0){var D=t.toString().match(/[gimuy]*$/);D&&(I=D[0])}var U=new hs(t.source,I);return U.toExtendedJSON(e)}return t!=null&&typeof t=="object"?iS(t,e):t}var nS={Binary:function(t){return new ii(t.value(),t.sub_type)},Code:function(t){return new Hc(t.code,t.scope)},DBRef:function(t){return new ds(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new _f(t.bytes)},Double:function(t){return new $c(t.value)},Int32:function(t){return new Vc(t.value)},Long:function(t){return ie.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 bf},MinKey:function(){return new wf},ObjectID:function(t){return new Et(t)},ObjectId:function(t){return new Et(t)},BSONRegExp:function(t){return new hs(t.pattern,t.options)},Symbol:function(t){return new Sf(t.value)},Timestamp:function(t){return Ng.fromBits(t.low,t.high)}};function iS(t,e){if(t==null||typeof t!="object")throw new ni("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=Cn(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{e.seenObjects.pop()}}return n}else if(eS(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var a=nS[t._bsontype];if(!a)throw new Qe("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return r==="Code"&&s.scope?s=new Hc(s.code,Cn(s.scope,e)):r==="DBRef"&&s.oid&&(s=new ds(Cn(s.collection,e),Cn(s.oid,e),Cn(s.db,e),Cn(s.fields,e))),s.toExtendedJSON(e)}else throw new ni("_bsontype must be a string, but was: "+typeof r)}var Sg;(function(t){function e(o,s){var a=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(o,function(c,p){if(c.indexOf("\0")!==-1)throw new ni("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(c)));return Ug(p,a)})}t.parse=e;function r(o,s,a,c){a!=null&&typeof a=="object"&&(c=a,a=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(c=s,s=void 0,a=0);var p=Object.assign({relaxed:!0,legacy:!1},c,{seenObjects:[{propertyName:"(root)",obj:null}]}),d=Cn(o,p);return JSON.stringify(d,s,a)}t.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}t.serialize=n;function i(o,s){return s=s||{},e(JSON.stringify(o),s)}t.deserialize=i})(Sg||(Sg={}));var Ig,Tg=Cg();Tg.Map?Ig=Tg.Map:Ig=(function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t})();var DB=ie.fromNumber(Bw),OB=ie.fromNumber(Uw);var gf=new Uint8Array(8),NB=new DataView(gf.buffer,gf.byteOffset,gf.byteLength);var oS=1024*1024*17,PB=xe.alloc(oS);var Rn=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(e){e=e||{},this.triggerID=e.id||e.triggerID,this.nudgeID=e.nudgeID,this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.contentID=e.contentID,this.variation=e.variation,this.props=e.props,this.objective=e.objective,this.onsiteDeliveryType=e.onsiteDeliveryType,this.holdout=e.holdout}};var Se=class{constructor(e,r={},n,i){this.name=e;this.properties=r;this.id=i?new Et(i):new Et,this.occurred=new Date,n&&(this.trigger=new Rn(n)),this.newEvent=!i}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale};var kg=0;function Fg(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}function If(t=document.head){return Hg(Gt.styleURL,t,"cooee-global-styles")}function sS(t=document.head){return Hg(Gt.swiperStyleURL,t,"cooee-swiper-styles")}function Hg(t,e=document.head,r){return new Promise(n=>{if(e.querySelector(`#${r}`)){n();return}let o=document.createElement("link");o.rel="stylesheet",o.href=t,o.id=r,o.onload=()=>{n()},o.onerror=()=>{console.error("Failed to load stylesheet:",t),n()},e.appendChild(o)})}function Tf(t,e=document.head){if(!t)return;kg++;let r=document.createElement("style");r.id=`cooee-app-css-${kg}`,r.textContent=t,e.appendChild(r)}function $g(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}async function Wc(){let t=(await import("./swiper-bundle-WHJS64TU.js")).default;return window.CooeeSDK.Swiper=t}async function xf(t,e=!0){if(!t)return;let r=[];e&&r.push(sS(t)),r.push(If(t)),await Promise.all(r);let n=Xe.get().website.commonCSS;Tf(n,t)}var aS="2.0.4",kf=500,Vg="user-agent",uo="",Wg="?",Kc="function",On="undefined",po="object",Ff="string",kt="browser",ln="cpu",Wr="device",Sr="engine",cr="os",co="result",V="name",P="type",F="vendor",G="version",Ft="architecture",xs="major",B="model",Is="console",ce="mobile",Ue="tablet",st="smarttv",$r="wearable",jc="xr",Ts="embedded",ys="inapp",Vf="brands",si="formFactors",Wf="fullVersionList",lo="platform",jf="platformVersion",Qc="bitness",Nn="sec-ch-ua",cS=Nn+"-full-version-list",lS=Nn+"-arch",uS=Nn+"-"+Qc,pS=Nn+"-form-factors",fS=Nn+"-"+ce,mS=Nn+"-"+B,ny=Nn+"-"+lo,dS=ny+"-version",iy=[Vf,Wf,ce,B,lo,jf,Ft,si,Qc],Gc="Amazon",so="Apple",jg="ASUS",Gg="BlackBerry",oi="Google",Yg="Huawei",Cf="Lenovo",qg="Honor",Yc="LG",Rf="Microsoft",Af="Motorola",Df="Nvidia",zg="OnePlus",Of="OPPO",vs="Samsung",Kg="Sharp",Es="Sony",Nf="Xiaomi",Pf="Zebra",Xg="Chrome",Jg="Chromium",An="Chromecast",zc="Edge",_s="Firefox",bs="Opera",Lf="Facebook",Qg="Sogou",ao="Mobile ",ws=" Browser",Hf="Windows",hS=typeof window!==On,Ht=hS&&window.navigator?window.navigator:void 0,Dn=Ht&&Ht.userAgentData?Ht.userAgentData:void 0,gS=function(t,e){var r={},n=e;if(!Xc(e)){n={};for(var i in e)for(var o in e[i])n[o]=e[i][o].concat(n[o]?n[o]:[])}for(var s in t)r[s]=n[s]&&n[s].length%2===0?n[s].concat(t[s]):t[s];return r},Zc=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},$f=function(t,e){if(typeof t===po&&t.length>0){for(var r in t)if(un(e)==un(t[r]))return!0;return!1}return mo(t)?un(e)==un(t):!1},Xc=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Xc(t[r]):!1)},mo=function(t){return typeof t===Ff},Mf=function(t){if(t){for(var e=[],r=fo(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Jc(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Jc(r[n]);return e}},un=function(t){return mo(t)?t.toLowerCase():t},Bf=function(t){return mo(t)?fo(/[^\d\.]/g,t).split(".")[0]:void 0},pn=function(t){for(var e in t){var r=t[e];typeof r==po&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},fo=function(t,e){return mo(e)?e.replace(t,uo):e},Ss=function(t){return fo(/\\?\"/g,t)},Jc=function(t,e){if(mo(t))return t=fo(/^\s\s*/,t),typeof e===On?t:t.substring(0,kf)},Uf=function(t,e){if(!(!t||!e))for(var r=0,n,i,o,s,a,c;r<e.length&&!a;){var p=e[r],d=e[r+1];for(n=i=0;n<p.length&&!a&&p[n];)if(a=p[n++].exec(t),a)for(o=0;o<d.length;o++)c=a[++i],s=d[o],typeof s===po&&s.length>0?s.length===2?typeof s[1]==Kc?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===Kc&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=c?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=c?s[1].call(this,c,s[2]):void 0:s.length==3?this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=c?s[3].apply(this,[c.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=c||void 0;r+=2}},Vr=function(t,e){for(var r in e)if(typeof e[r]===po&&e[r].length>0){for(var n=0;n<e[r].length;n++)if($f(e[r][n],t))return r===Wg?void 0:r}else if($f(e[r],t))return r===Wg?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},Zg={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:""},ey={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},yS={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},ty={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[G,[V,ao+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[G,[V,zc+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[G,[V,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[V,G],[/opios[\/ ]+([\w\.]+)/i],[G,[V,bs+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[G,[V,bs+" GX"]],[/\bopr\/([\w\.]+)/i],[G,[V,bs]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[G,[V,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[G,[V,"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],[V,G],[/quark(?:pc)?\/([-\w\.]+)/i],[G,[V,"Quark"]],[/\bddg\/([\w\.]+)/i],[G,[V,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[G,[V,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[G,[V,"WeChat"]],[/konqueror\/([\w\.]+)/i],[G,[V,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[G,[V,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[G,[V,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[G,[V,"Smart "+Cf+ws]],[/(avast|avg)\/([\w\.]+)/i],[[V,/(.+)/,"$1 Secure"+ws],G],[/\bfocus\/([\w\.]+)/i],[G,[V,_s+" Focus"]],[/\bopt\/([\w\.]+)/i],[G,[V,bs+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[G,[V,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[G,[V,"Dolphin"]],[/coast\/([\w\.]+)/i],[G,[V,bs+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[G,[V,"MIUI"+ws]],[/fxios\/([\w\.-]+)/i],[G,[V,ao+_s]],[/\bqihoobrowser\/?([\w\.]*)/i],[G,[V,"360"]],[/\b(qq)\/([\w\.]+)/i],[[V,/(.+)/,"$1Browser"],G],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[V,/(.+)/,"$1"+ws],G],[/samsungbrowser\/([\w\.]+)/i],[G,[V,vs+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[G,[V,Qg+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[V,Qg+" Mobile"],G],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[V,G],[/(lbbrowser|rekonq)/i],[V],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[G,V],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[V,Lf],G,[P,ys]],[/(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],[V,G,[P,ys]],[/\bgsa\/([\w\.]+) .*safari\//i],[G,[V,"GSA"],[P,ys]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[G,[V,"TikTok"],[P,ys]],[/\[(linkedin)app\]/i],[V,[P,ys]],[/(chromium)[\/ ]([-\w\.]+)/i],[V,G],[/headlesschrome(?:\/([\w\.]+)| )/i],[G,[V,Xg+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[G,[V,zc+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[V,Xg+" WebView"],G],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[G,[V,"Android"+ws]],[/chrome\/([\w\.]+) mobile/i],[G,[V,ao+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[V,G],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[G,[V,ao+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[V,ao+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[G,V],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[V,[G,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[V,G],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[V,ao+_s],G],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[V,"Netscape"],G],[/(wolvic|librewolf)\/([\w\.]+)/i],[V,G],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[G,[V,_s+" 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],[V,[G,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[V,[G,/[^\d\.]+./,uo]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Ft,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Ft,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Ft,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Ft,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Ft,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Ft,/ower/,uo,un]],[/ sun4\w[;\)]/i],[[Ft,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Ft,un]]],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],[B,[F,vs],[P,Ue]],[/\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],[B,[F,vs],[P,ce]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[B,[F,so],[P,ce]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[B,[F,so],[P,Ue]],[/(macintosh);/i],[B,[F,so]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[B,[F,Kg],[P,ce]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[B,[F,qg],[P,Ue]],[/honor([-\w ]+)[;\)]/i],[B,[F,qg],[P,ce]],[/\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],[B,[F,Yg],[P,Ue]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[B,[F,Yg],[P,ce]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[B,/_/g," "],[F,Nf],[P,Ue]],[/\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],[[B,/_/g," "],[F,Nf],[P,ce]],[/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],[B,[F,zg],[P,ce]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[B,[F,Of],[P,ce]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[B,[F,Vr,{OnePlus:["203","304","403","404","413","415"],"*":Of}],[P,Ue]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[B,[F,"BLU"],[P,ce]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[B,[F,"Vivo"],[P,ce]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[B,[F,"Realme"],[P,ce]],[/(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],[B,[F,Cf],[P,Ue]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[B,[F,Cf],[P,ce]],[/\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],[B,[F,Af],[P,ce]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[B,[F,Af],[P,Ue]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[B,[F,Yc],[P,Ue]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[B,[F,Yc],[P,ce]],[/(nokia) (t[12][01])/i],[F,B,[P,Ue]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[B,/_/g," "],[P,ce],[F,"Nokia"]],[/(pixel (c|tablet))\b/i],[B,[F,oi],[P,Ue]],[/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],[B,[F,oi],[P,ce]],[/(google) (pixelbook( go)?)/i],[F,B],[/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],[B,[F,Es],[P,ce]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[B,"Xperia Tablet"],[F,Es],[P,Ue]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[B,[F,Gc],[P,Ue]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[B,/(.+)/g,"Fire Phone $1"],[F,Gc],[P,ce]],[/(playbook);[-\w\),; ]+(rim)/i],[B,F,[P,Ue]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[B,[F,Gg],[P,ce]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[B,[F,jg],[P,Ue]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[B,[F,jg],[P,ce]],[/(nexus 9)/i],[B,[F,"HTC"],[P,Ue]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[F,[B,/_/g," "],[P,ce]],[/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],[B,[F,"TCL"],[P,Ue]],[/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],[B,[F,"TCL"],[P,ce]],[/(itel) ((\w+))/i],[[F,un],B,[P,Vr,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[B,[F,"Acer"],[P,Ue]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[B,[F,"Meizu"],[P,ce]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[B,[F,"Ulefone"],[P,ce]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[B,[F,"Energizer"],[P,ce]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[B,[F,"Cat"],[P,ce]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[B,[F,"Smartfren"],[P,ce]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[B,[F,"Nothing"],[P,ce]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[B,[F,"Archos"],[P,Ue]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[B,[F,"Archos"],[P,ce]],[/; (n159v)/i],[B,[F,"HMD"],[P,ce]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[F,B,[P,Ue]],[/(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],[F,B,[P,ce]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[F,B,[P,Ue]],[/(surface duo)/i],[B,[F,Rf],[P,Ue]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[B,[F,"Fairphone"],[P,ce]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[B,[F,Df],[P,Ue]],[/(sprint) (\w+)/i],[F,B,[P,ce]],[/(kin\.[onetw]{3})/i],[[B,/\./g," "],[F,Rf],[P,ce]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[B,[F,Pf],[P,Ue]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[B,[F,Pf],[P,ce]],[/smart-tv.+(samsung)/i],[F,[P,st]],[/hbbtv.+maple;(\d+)/i],[[B,/^/,"SmartTV"],[F,vs],[P,st]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[F,B,[P,st]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[F,Yc],[P,st]],[/(apple) ?tv/i],[F,[B,so+" TV"],[P,st]],[/crkey.*devicetype\/chromecast/i],[[B,An+" Third Generation"],[F,oi],[P,st]],[/crkey.*devicetype\/([^/]*)/i],[[B,/^/,"Chromecast "],[F,oi],[P,st]],[/fuchsia.*crkey/i],[[B,An+" Nest Hub"],[F,oi],[P,st]],[/crkey/i],[[B,An],[F,oi],[P,st]],[/(portaltv)/i],[B,[F,Lf],[P,st]],[/droid.+aft(\w+)( bui|\))/i],[B,[F,Gc],[P,st]],[/(shield \w+ tv)/i],[B,[F,Df],[P,st]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[B,[F,Kg],[P,st]],[/(bravia[\w ]+)( bui|\))/i],[B,[F,Es],[P,st]],[/(mi(tv|box)-?\w+) bui/i],[B,[F,Nf],[P,st]],[/Hbbtv.*(technisat) (.*);/i],[F,B,[P,st]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[F,/.+\/(\w+)/,"$1",Vr,{LG:"lge"}],[B,Jc],[P,st]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[B,[P,st]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[P,st]],[/(playstation \w+)/i],[B,[F,Es],[P,Is]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[B,[F,Rf],[P,Is]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[F,B,[P,Is]],[/droid.+; (shield)( bui|\))/i],[B,[F,Df],[P,Is]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[B,[F,vs],[P,$r]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[F,B,[P,$r]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[B,[F,Of],[P,$r]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[B,[F,so],[P,$r]],[/(opwwe\d{3})/i],[B,[F,zg],[P,$r]],[/(moto 360)/i],[B,[F,Af],[P,$r]],[/(smartwatch 3)/i],[B,[F,Es],[P,$r]],[/(g watch r)/i],[B,[F,Yc],[P,$r]],[/droid.+; (wt63?0{2,3})\)/i],[B,[F,Pf],[P,$r]],[/droid.+; (glass) \d/i],[B,[F,oi],[P,jc]],[/(pico) (4|neo3(?: link|pro)?)/i],[F,B,[P,jc]],[/(quest( \d| pro)?s?).+vr/i],[B,[F,Lf],[P,jc]],[/mobile vr; rv.+firefox/i],[[P,jc]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[F,[P,Ts]],[/(aeobc)\b/i],[B,[F,Gc],[P,Ts]],[/(homepod).+mac os/i],[B,[F,so],[P,Ts]],[/windows iot/i],[[P,Ts]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[B,[P,Vr,{mobile:"Mobile",xr:"VR","*":Ue}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[P,Ue]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[P,ce]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[B,[F,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[G,[V,zc+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[V,G],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[G,[V,"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],[V,G],[/ladybird\//i],[[V,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[G,V]],os:[[/(windows nt) (6\.[23]); arm/i],[[V,/N/,"R"],[G,Vr,Zg]],[/(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],[V,G],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[G,/(;|\))/g,"",Vr,Zg],[V,Hf]],[/(windows ce)\/?([\d\.]*)/i],[V,G],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[G,/_/g,"."],[V,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[V,"macOS"],[G,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[G,[V,An+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[G,[V,An+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[G,[V,An+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[G,[V,An+" Linux"]],[/crkey\/([\d\.]+)/i],[G,[V,An]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[G,V],[/(ubuntu) ([\w\.]+) like android/i],[[V,/(.+)/,"$1 Touch"],G],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[V,G],[/\(bb(10);/i],[G,[V,Gg]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[G,[V,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[G,[V,_s+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[G,[V,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[G,Vr,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[V,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[G,[V,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[V,"Chrome OS"],G],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[V,G],[/(sunos) ?([\d\.]*)/i],[[V,"Solaris"],G],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[V,G]]},qc=(function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return pn.call(t.init,[[kt,[V,G,xs,P]],[ln,[Ft]],[Wr,[P,B,F]],[Sr,[V,G]],[cr,[V,G]]]),pn.call(t.isIgnore,[[kt,[G,xs]],[Sr,[G]],[cr,[G]]]),pn.call(t.isIgnoreRgx,[[kt,/ ?browser$/i],[cr,/ ?os$/i]]),pn.call(t.toString,[[kt,[V,G]],[ln,[Ft]],[Wr,[F,B]],[Sr,[V,G]],[cr,[V,G]]]),t})(),vS=function(t,e){var r=qc.init[e],n=qc.isIgnore[e]||0,i=qc.isIgnoreRgx[e]||0,o=qc.toString[e]||0;function s(){pn.call(this,r)}return s.prototype.getItem=function(){return t},s.prototype.withClientHints=function(){return Dn?Dn.getHighEntropyValues(iy).then(function(a){return t.setCH(new oy(a,!1)).parseCH().get()}):t.parseCH().get()},s.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=co&&(s.prototype.is=function(a){var c=!1;for(var p in this)if(this.hasOwnProperty(p)&&!$f(n,p)&&un(i?fo(i,this[p]):this[p])==un(i?fo(i,a):a)){if(c=!0,a!=On)break}else if(a==On&&c){c=!c;break}return c},s.prototype.toString=function(){var a=uo;for(var c in o)typeof this[o[c]]!==On&&(a+=(a?" ":uo)+this[o[c]]);return a||On}),Dn||(s.prototype.then=function(a){var c=this,p=function(){for(var f in c)c.hasOwnProperty(f)&&(this[f]=c[f])};p.prototype={is:s.prototype.is,toString:s.prototype.toString};var d=new p;return a(d),d}),new s};function oy(t,e){if(t=t||{},pn.call(this,iy),e)pn.call(this,[[Vf,Mf(t[Nn])],[Wf,Mf(t[cS])],[ce,/\?1/.test(t[fS])],[B,Ss(t[mS])],[lo,Ss(t[ny])],[jf,Ss(t[dS])],[Ft,Ss(t[lS])],[si,Mf(t[pS])],[Qc,Ss(t[uS])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==On&&(this[r]=t[r])}function ry(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Ht&&Ht.userAgent==this.ua)switch(this.itemType){case kt:Ht.brave&&typeof Ht.brave.isBrave==Kc&&this.set(V,"Brave");break;case Wr:!this.get(P)&&Dn&&Dn[ce]&&this.set(P,ce),this.get(B)=="Macintosh"&&Ht&&typeof Ht.standalone!==On&&Ht.maxTouchPoints&&Ht.maxTouchPoints>2&&this.set(B,"iPad").set(P,Ue);break;case cr:!this.get(V)&&Dn&&Dn[lo]&&this.set(V,Dn[lo]);break;case co:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(kt,o(kt)).set(ln,o(ln)).set(Wr,o(Wr)).set(Sr,o(Sr)).set(cr,o(cr))}return this},this.parseUA=function(){return this.itemType!=co&&Uf.call(this.data,this.ua,this.rgxMap),this.itemType==kt&&this.set(xs,Bf(this.get(G))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case kt:case Sr:var s=i[Wf]||i[Vf],a;if(s)for(var c in s){var p=s[c].brand||s[c],d=s[c].version;this.itemType==kt&&!/not.a.brand/i.test(p)&&(!a||/Chrom/.test(a)&&p!=Jg||a==zc&&/WebView2/.test(p))&&(p=Vr(p,yS),a=this.get(V),a&&!/Chrom/.test(a)&&/Chrom/.test(p)||this.set(V,p).set(G,d).set(xs,Bf(d)),a=p),this.itemType==Sr&&p==Jg&&this.set(G,d)}break;case ln:var f=i[Ft];f&&(f&&i[Qc]=="64"&&(f+="64"),Uf.call(this.data,f+";",o));break;case Wr:if(i[ce]&&this.set(P,ce),i[B]&&(this.set(B,i[B]),!this.get(P)||!this.get(F))){var E={};Uf.call(E,"droid 9; "+i[B]+")",o),!this.get(P)&&E.type&&this.set(P,E.type),!this.get(F)&&E.vendor&&this.set(F,E.vendor)}if(i[si]){var y;if(typeof i[si]!="string")for(var I=0;!y&&I<i[si].length;)y=Vr(i[si][I++],ey);else y=Vr(i[si],ey);this.set(P,y)}break;case cr:var D=i[lo];if(D){var U=i[jf];D==Hf&&(U=parseInt(Bf(U),10)>=13?"11":"10"),this.set(V,D).set(G,U)}this.get(V)==Hf&&i[B]=="Xbox"&&this.set(V,"Xbox").set(G,void 0);break;case co:var N=this.data,H=function(M){return N[M].getItem().setCH(i).parseCH().get()};this.set(kt,H(kt)).set(ln,H(ln)).set(Wr,H(Wr)).set(Sr,H(Sr)).set(cr,H(cr))}return this},pn.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",vS(this,t)]]),this}function jr(t,e,r){if(typeof t===po?(Xc(t,!0)?(typeof e===po&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===Ff&&!Xc(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Kc){var n={};r.forEach(function(c,p){n[p]=c}),r=n}if(!(this instanceof jr))return new jr(t,e,r).getResult();var i=typeof t===Ff?t:r&&r[Vg]?r[Vg]:Ht&&Ht.userAgent?Ht.userAgent:uo,o=new oy(r,!0),s=e?gS(ty,e):ty,a=function(c){return c==co?function(){return new ry(c,i,s,o).set("ua",i).set(kt,this.getBrowser()).set(ln,this.getCPU()).set(Wr,this.getDevice()).set(Sr,this.getEngine()).set(cr,this.getOS()).get()}:function(){return new ry(c,i,s[c],o).parseUA().get()}};return pn.call(this,[["getBrowser",a(kt)],["getCPU",a(ln)],["getDevice",a(Wr)],["getEngine",a(Sr)],["getOS",a(cr)],["getResult",a(co)],["getUA",function(){return i}],["setUA",function(c){return mo(c)&&(i=c.length>kf?Jc(c,kf):c),this}]]).setUA(i),this}jr.VERSION=aS;jr.BROWSER=Zc([V,G,xs,P]);jr.CPU=Zc([Ft]);jr.DEVICE=Zc([B,F,P,Is,ce,st,Ue,$r,Ts]);jr.ENGINE=jr.OS=Zc([V,G]);var le=class{static storage=new Map;static get(e){return this.storage.has(e)||this.storage.set(e,e.getInstance()),this.storage.get(e)}};var qy=Cr(wi());var ai=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(ai||{});function de(t){return typeof t=="function"}function ho(t){let r=t(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var el=ho(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
42
42
  ${r.map((n,i)=>`${i+1}) ${n.toString()}`).join(`
43
- `)}`:"",this.name="UnsubscriptionError",this.errors=r});function li(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var lr=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(_e(n))try{n()}catch(o){e=o instanceof Kc?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{jg(o)}catch(s){e=e??[],s instanceof Kc?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Kc(e)}}add(e){var r;if(e&&e!==this)if(this.closed)jg(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&li(r,e)}remove(e){let{_finalizers:r}=this;r&&li(r,e),e instanceof t&&e._removeParent(this)}};lr.EMPTY=(()=>{let t=new lr;return t.closed=!0,t})();var Nf=lr.EMPTY;function Xc(t){return t instanceof lr||t&&"closed"in t&&_e(t.remove)&&_e(t.add)&&_e(t.unsubscribe)}function jg(t){_e(t)?t():t.unsubscribe()}var Sr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var ho={setTimeout(t,e,...r){let{delegate:n}=ho;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=ho;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Jc(t){ho.setTimeout(()=>{let{onUnhandledError:e}=Sr;if(e)e(t);else throw t})}function Of(){}var Gg=Pf("C",void 0,void 0);function Yg(t){return Pf("E",void 0,t)}function zg(t){return Pf("N",t,void 0)}function Pf(t,e,r){return{kind:t,value:e,error:r}}var ui=null;function go(t){if(Sr.useDeprecatedSynchronousErrorHandling){let e=!ui;if(e&&(ui={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=ui;if(ui=null,r)throw n}}else t()}function qg(t){Sr.useDeprecatedSynchronousErrorHandling&&ui&&(ui.errorThrown=!0,ui.error=t)}var pi=class extends lr{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Xc(e)&&e.add(this)):this.destination=sS}static create(e,r,n){return new Pn(e,r,n)}next(e){this.isStopped?Mf(zg(e),this):this._next(e)}error(e){this.isStopped?Mf(Yg(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?Mf(Gg,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},iS=Function.prototype.bind;function Lf(t,e){return iS.call(t,e)}var Bf=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(n){Qc(n)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(n){Qc(n)}else Qc(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){Qc(r)}}},Pn=class extends pi{constructor(e,r,n){super();let i;if(_e(e)||!e)i={next:e??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&Sr.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&Lf(e.next,o),error:e.error&&Lf(e.error,o),complete:e.complete&&Lf(e.complete,o)}):i=e}this.destination=new Bf(i)}};function Qc(t){Sr.useDeprecatedSynchronousErrorHandling?qg(t):Jc(t)}function oS(t){throw t}function Mf(t,e){let{onStoppedNotification:r}=Sr;r&&ho.setTimeout(()=>r(t,e))}var sS={closed:!0,next:Of,error:oS,complete:Of};var yo=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Kg(t){return t}function Xg(t){return t.length===0?Kg:t.length===1?t[0]:function(r){return t.reduce((n,i)=>i(n),r)}}var Nt=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let o=cS(r)?r:new Pn(r,n,i);return go(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Jg(n),new n((i,o)=>{let s=new Pn({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[yo](){return this}pipe(...r){return Xg(r)(this)}toPromise(r){return r=Jg(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function Jg(t){var e;return(e=t??Sr.Promise)!==null&&e!==void 0?e:Promise}function aS(t){return t&&_e(t.next)&&_e(t.error)&&_e(t.complete)}function cS(t){return t&&t instanceof pi||aS(t)&&Xc(t)}function lS(t){return _e(t?.lift)}function Gr(t){return e=>{if(lS(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 ur(t,e,r,n,i){return new Uf(t,e,r,n,i)}var Uf=class extends pi{constructor(e,r,n,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var Qg=mo(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Wt=(()=>{class t extends Nt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new Zc(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new Qg}next(r){go(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){go(()=>{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(){go(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:o}=this;return n||i?Nf:(this.currentObservers=null,o.push(r),new lr(()=>{this.currentObservers=null,li(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new Nt;return r.source=this,r}}return t.create=(e,r)=>new Zc(e,r),t})(),Zc=class extends Wt{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)}error(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:Nf}};var Is=class extends Wt{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:n}=this;if(e)throw r;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var Ts={now(){return(Ts.delegate||Date).now()},delegate:void 0};var xs=class extends Wt{constructor(e=1/0,r=1/0,n=Ts){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(e),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=n?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),a=0;for(let c=1;c<n.length&&n[c]<=s;c+=2)a=c;a&&n.splice(0,a+1)}}};var el=class extends lr{constructor(e,r){super()}schedule(e,r=0){return this}};var Cs={setInterval(t,e,...r){let{delegate:n}=Cs;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=Cs;return(e?.clearInterval||clearInterval)(t)},delegate:void 0};var tl=class extends el{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var n;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,n=0){return Cs.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&Cs.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(e,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let n=!1,i;try{this.work(e)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,li(n,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var vo=class t{constructor(e,r=t.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};vo.now=Ts.now;var rl=class extends vo{constructor(e,r=vo.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,n){for(;e=r.shift();)e.unsubscribe();throw n}}};var Rs=new rl(tl),Zg=Rs;function ey(t){return t&&_e(t.schedule)}function ry(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(d){try{p(n.next(d))}catch(f){s(f)}}function c(d){try{p(n.throw(d))}catch(f){s(f)}}function p(d){d.done?o(d.value):i(d.value).then(a,c)}p((n=n.apply(t,e||[])).next())})}function ty(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 fi(t){return this instanceof fi?(this.v=t,this):new fi(t)}function ny(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(y){return function(I){return Promise.resolve(I).then(y,f)}}function a(y,I){n[y]&&(i[y]=function(D){return new Promise(function(k,O){o.push([y,D,k,O])>1||c(y,D)})},I&&(i[y]=I(i[y])))}function c(y,I){try{p(n[y](I))}catch(D){E(o[0][3],D)}}function p(y){y.value instanceof fi?Promise.resolve(y.value.v).then(d,f):E(o[0][2],y)}function d(y){c("next",y)}function f(y){c("throw",y)}function E(y,I){y(I),o.shift(),o.length&&c(o[0][0],o[0][1])}}function iy(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 ty=="function"?ty(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(p){o({value:p,done:a})},s)}}var nl=t=>t&&typeof t.length=="number"&&typeof t!="function";function oy(t){return _e(t?.then)}function sy(t){return _e(t[yo])}function ay(t){return Symbol.asyncIterator&&_e(t?.[Symbol.asyncIterator])}function cy(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 uS(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ly=uS();function uy(t){return _e(t?.[ly])}function py(t){return ny(this,arguments,function*(){let r=t.getReader();try{for(;;){let{value:n,done:i}=yield fi(r.read());if(i)return yield fi(void 0);yield yield fi(n)}}finally{r.releaseLock()}})}function fy(t){return _e(t?.getReader)}function Ln(t){if(t instanceof Nt)return t;if(t!=null){if(sy(t))return pS(t);if(nl(t))return fS(t);if(oy(t))return mS(t);if(ay(t))return my(t);if(uy(t))return dS(t);if(fy(t))return hS(t)}throw cy(t)}function pS(t){return new Nt(e=>{let r=t[yo]();if(_e(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function fS(t){return new Nt(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function mS(t){return new Nt(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Jc)})}function dS(t){return new Nt(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function my(t){return new Nt(e=>{gS(t,e).catch(r=>e.error(r))})}function hS(t){return my(py(t))}function gS(t,e){var r,n,i,o;return ry(this,void 0,void 0,function*(){try{for(r=iy(t);n=yield r.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function dy(t,e,r,n=0,i=!1){let o=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!i)return o}var hy=mo(t=>function(){t(this),this.name="EmptyError",this.message="no elements in sequence"});function pr(t,e){let r=typeof e=="object";return new Promise((n,i)=>{let o=new Pn({next:s=>{n(s),o.unsubscribe()},error:i,complete:()=>{r?n(e.defaultValue):i(new hy)}});t.subscribe(o)})}function gy(t){return t instanceof Date&&!isNaN(t)}function mn(t,e){return Gr((r,n)=>{let i=0;r.subscribe(ur(n,o=>{n.next(t.call(e,o,i++))}))})}var{isArray:yS}=Array;function vS(t,e){return yS(e)?t(...e):t(e)}function il(t){return mn(e=>vS(t,e))}function yy(t,e,r,n,i,o,s,a){let c=[],p=0,d=0,f=!1,E=()=>{f&&!c.length&&!p&&e.complete()},y=D=>p<n?I(D):c.push(D),I=D=>{o&&e.next(D),p++;let k=!1;Ln(r(D,d++)).subscribe(ur(e,O=>{i?.(O),o?y(O):e.next(O)},()=>{k=!0},void 0,()=>{if(k)try{for(p--;c.length&&p<n;){let O=c.shift();s?dy(e,s,()=>I(O)):I(O)}E()}catch(O){e.error(O)}}))};return t.subscribe(ur(e,y,()=>{f=!0,E()})),()=>{a?.()}}function kf(t,e,r=1/0){return _e(e)?kf((n,i)=>mn((o,s)=>e(n,o,i,s))(Ln(t(n,i))),r):(typeof e=="number"&&(r=e),Gr((n,i)=>yy(n,i,t,r)))}var ES=["addListener","removeListener"],_S=["addEventListener","removeEventListener"],bS=["on","off"];function mi(t,e,r,n){if(_e(r)&&(n=r,r=void 0),n)return mi(t,e,r).pipe(il(n));let[i,o]=IS(t)?_S.map(s=>a=>t[s](e,a,r)):wS(t)?ES.map(vy(t,e)):SS(t)?bS.map(vy(t,e)):[];if(!i&&nl(t))return kf(s=>mi(s,e,r))(Ln(t));if(!i)throw new TypeError("Invalid event target");return new Nt(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function vy(t,e){return r=>n=>t[r](e,n)}function wS(t){return _e(t.addListener)&&_e(t.removeListener)}function SS(t){return _e(t.on)&&_e(t.off)}function IS(t){return _e(t.addEventListener)&&_e(t.removeEventListener)}function ol(t,e,r){return r?ol(t,e).pipe(il(r)):new Nt(n=>{let i=(...s)=>n.next(s.length===1?s[0]:s),o=t(i);return _e(e)?()=>e(i,o):void 0})}function Ey(t=0,e,r=Zg){let n=-1;return e!=null&&(ey(e)?r=e:n=e),new Nt(i=>{let o=gy(t)?+t-r.now():t;o<0&&(o=0);let s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=n?this.schedule(void 0,n):i.complete())},o)})}function Ff(t,e){return Gr((r,n)=>{let i=0;r.subscribe(ur(n,o=>t.call(e,o,i++)&&n.next(o)))})}function fr(t,e=Rs){return Gr((r,n)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let p=o;o=null,n.next(p)}};function c(){let p=s+t,d=e.now();if(d<p){i=this.schedule(void 0,p-d),n.add(i);return}a()}r.subscribe(ur(n,p=>{o=p,s=e.now(),i||(i=e.schedule(c,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{o=i=null}))})}function _y(t,e){return Gr((r,n)=>{let{leading:i=!0,trailing:o=!1}=e??{},s=!1,a=null,c=null,p=!1,d=()=>{c?.unsubscribe(),c=null,o&&(y(),p&&n.complete())},f=()=>{c=null,p&&n.complete()},E=I=>c=Ln(t(I)).subscribe(ur(n,d,f)),y=()=>{if(s){s=!1;let I=a;a=null,n.next(I),!p&&E(I)}};r.subscribe(ur(n,I=>{s=!0,a=I,!(c&&!c.closed)&&(i?y():E(I))},()=>{p=!0,!(o&&s&&c&&!c.closed)&&n.complete()}))})}function Hf(t,e=Rs,r){let n=Ey(t,e);return _y(()=>n,r)}var by=xr(ql()),sl=class t{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new by.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new t(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new t(r)}};async function al(){let t=de.get(),e=re(_({},t.customContext),{page:Zs(),locale:t.locale,currentItem:t.getCurrentItem(),previewIDs:t.previewIDs,previewVariant:t.previewVariant,engagementIDs:xS()});return await Promise.all([TS(e)]),e}async function TS(t){t.cart=await we.getCurrent().getNormalisedCartSilently()}function xS(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}var CS=" daum[ /]| deusu/|(?:^|[^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/|^azure|^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/|agent|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|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|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/",RS=/bot|crawl|http|lighthouse|scan|search|spider/i,As;function AS(){if(As instanceof RegExp)return As;try{As=new RegExp(CS,"i")}catch{As=RS}return As}function wy(t){return!!t&&AS().test(t)}var $f={d:(t,e)=>{for(var r in e)$f.o(e,r)&&!$f.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Vf={};$f.d(Vf,{A:()=>DS,k:()=>Wf});var Ds=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(p){try{c(n.next(p))}catch(d){o(d)}}function a(p){try{c(n.throw(p))}catch(d){o(d)}}function c(p){var d;p.done?i(p.value):(d=p.value,d instanceof r?d:new r(function(f){f(d)})).then(s,a)}c((n=n.apply(t,e||[])).next())})},Ns=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(p){return function(d){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(s=0)),s;)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 s.label++,{value:d[1],done:!1};case 5:s.label++,n=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){s.label=d[1];break}if(d[0]===6&&s.label<i[1]){s.label=i[1],i=d;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(d);break}i[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(t,s)}catch(f){d=[6,f],n=0}finally{r=i=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([c,p])}}};function Wf(){return Ds(this,void 0,Promise,function(){return Ns(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function o(y){i||(i=!0,e({isPrivate:y,browserName:n}))}function s(){var y=0,I=parseInt("-1");try{I.toFixed(I)}catch(D){y=D.message.length}return y}function a(){return navigator.msSaveBlob!==void 0&&function(y){try{return y===eval.toString().length}catch{return!1}}(39)}function c(){var y;return Ds(this,void 0,void 0,function(){var I,D;return Ns(this,function(k){switch(k.label){case 0:return k.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return k.sent(),o(!1),[3,3];case 2:return I=k.sent(),D=I,I instanceof Error&&(D=(y=I.message)!==null&&y!==void 0?y:I),typeof D!="string"?(o(!1),[2]):(o(!!D.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var y;return Ds(this,void 0,Promise,function(){return Ns(this,function(I){switch(I.label){case 0:return((y=navigator.storage)===null||y===void 0?void 0:y.getDirectory)===void 0?[3,2]:[4,c()];case 1:return I.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?function(){var D=String(Math.random());try{var k=indexedDB.open(D,1);k.onupgradeneeded=function(O){var $=O.target.result,B=function(q){o(q)};try{$.createObjectStore("t",{autoIncrement:!0}).put(new Blob),B(!1)}catch(q){(q.message||"").includes("are not yet supported")?B(!0):B(!1)}finally{$.close(),indexedDB.deleteDatabase(D)}},k.onerror=function(){return o(!1)}}catch{o(!1)}}():function(){var D=window.openDatabase,k=window.localStorage;try{D(null,null,null,null)}catch{return void o(!0)}try{k.setItem("test","1"),k.removeItem("test")}catch{return void o(!0)}o(!1)}(),I.label=3;case 3:return[2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(y,I){var D;o(Math.round(I/1048576)<2*Math.round(((D=window).performance!==void 0&&D.performance.memory!==void 0&&D.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(y){r(new Error("detectIncognito somehow failed to query storage quota: "+y.message))})}function f(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0,window.webkitRequestFileSystem)(0,1,function(){o(!1)},function(){o(!0)})}function E(){return Ds(this,void 0,Promise,function(){var y,I;return Ns(this,function(D){switch(D.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];D.label=1;case 1:return D.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return D.sent(),o(!1),[3,4];case 3:return y=D.sent(),typeof(I=y instanceof Error&&typeof y.message=="string"?y.message:String(y))!="string"?(o(!1),[2]):(o(I.includes("Security error")),[2]);case 4:return o(navigator.serviceWorker===void 0),[2]}})})}(function(){return Ds(this,void 0,Promise,function(){return Ns(this,function(y){switch(y.label){case 0:return s()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return y.sent(),[3,6];case 2:return s()!==51?[3,3]:(I=navigator.userAgent,n=I.match(/Chrome/)?navigator.brave!==void 0?"Brave":I.match(/Edg/)?"Edge":I.match(/OPR/)?"Opera":"Chrome":"Chromium",f(),[3,6]);case 3:return s()!==25?[3,5]:(n="Firefox",[4,E()]);case 4:return y.sent(),[3,6];case 5:a()?(n="Internet Explorer",o(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),y.label=6;case 6:return[2]}var I})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Wf);var DS=Wf,Sy=Vf.A,UF=Vf.k;var Iy=xr(wi()),cl=class{result={};async safeGet(){try{return await this.get()}catch(e){return Te(e,"device-properties"),this.result}}async get(){let e=this.result,r=window.CooeeSDK.uaParser;this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),e.referrer=document.referrer,e.host=location.origin,e.path=location.pathname,e.qs=location.search,e.locale=navigator.language,e.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},e.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(e.headless=!0,Mi({headless:!0}));let n=r.getResult();return e.browser=n.browser,e.device=n.device,e.engine=n.engine,e.cpu=n.cpu,e.os=n.os,e.navigatorUA=navigator.userAgent,await Promise.all([this.getBatteryInfo(),this.getLocationSilently(),this.checkIncognito()]),e}getDeviceMemory(){let e=navigator;if(!e.deviceMemory)return;let r=e.deviceMemory;this.result.mem={tot:r*1024}}getNetworkType(){let e=navigator,r=e.connection||e.mozConnection||e.webkitConnection;r?.effectiveType&&(this.result.net={type:r.effectiveType})}getOrientation(){let e=screen.orientation?.type;e&&(this.result.orientation=e)}getDPI(){if(!document.body)return;let e=document.createElement("div");e.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(e);let r=window.devicePixelRatio||1,n=e.offsetWidth*r;return document.body.removeChild(e),n}async getLocationSilently(){try{await this.getLocation()}catch(e){w.error("Unable to get location",e)}}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{this.result.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})}async getBatteryInfo(){if("getBattery"in navigator)try{let r=await navigator.getBattery();this.result.bat={l:r.level*100,c:r.charging},Mi({"battery.level":this.result.bat.l,"battery.charging":this.result.bat.c})}catch{}}async checkIncognito(){try{(await Sy())?.isPrivate&&(this.result.incognito=!0,Mi({incognito:!0}))}catch(e){Iy.default.error("Unable to detect private/incognito window",e)}}};var di=class{static _flags={};static getFlags(){return this._flags}static setFlags(e){this._flags=e??{}}static isECommerceApp(){return os()}};var Ot=class t{static INSTANCE;apiToken="";deviceID="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateProfileSafe(e){pr(lt.replaySubject).then(()=>this.updateProfile(e??{}))}updateProfile(e){this.put("/v1/user/update",e).then(async r=>{w.verbose("Updated user profile"),await lt.getInstance().storeAndPopulateAuthData(r.data)}).catch(r=>{w.error("Error saving user profile",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDevicePropsSafe(e){pr(lt.replaySubject).then(()=>this.updateDeviceProps({props:e}))}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{w.verbose("Updated device properties")}).catch(async r=>{w.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(!di.isECommerceApp()&&!di.getFlags().allowEvents)return w.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Gt.apiURL+r);let i=this.getDefaultHeaders(),o="keepalive"in new Request(""),s=n?JSON.stringify(n):void 0;if(n&&!o&&s?.includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){throw Te(c,"http-request",{extra:{body:s}}),c}let a={method:e,headers:i,keepalive:!0};return n&&(a.body=s),en(r,a)}performXMLHttpRequest(e,r,n){return new Promise((i,o)=>{let s=new XMLHttpRequest;s.open("POST",e,!0),r.forEach((a,c)=>{s.setRequestHeader(c,a)}),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(s.status>=200&&s.status<300)try{if(s.getResponseHeader("Content-Type")?.includes("application/json")){let c=JSON.parse(s.responseText);i({data:c,headers:r,request:s,status:s.status,statusText:s.statusText})}else o(new Error("Content-Type of response header is not json"))}catch(a){o(a)}else o(new Error(`Received status - ${s.status}(${s.statusText})`))},s.onerror=()=>{o(new Error("Network error occurred during the request."))},s.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",P.SDK),e.set("cooee-sdk-code",P.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",P.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),Gt.debug&&e.set("cooee-sdk-debug",String(1)),e}};var Os=class Os extends yn{};ee(Os,"storeName","app"),Os.storage=Ti(Os.storeName);var Ps=Os;function Ir(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function hi(t,e){Object.assign(t.style,e)}function oe(t,e,r){if(e){if(!r){t.style.removeProperty(e);return}t.style.setProperty(e,r,"important")}}function Ty(t){if(!t)return!1;if(t.tagName.toLowerCase()==="cart-drawer"&&t.hasAttribute("open"))return!0;let r=t.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,i=(window.innerWidth||document.documentElement.clientWidth)+.5,o=getComputedStyle(t);if(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0||t.hidden||!(t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0))return!1;let p=Math.max(0,Math.min(r.right,i)-Math.max(r.left,0)),d=Math.max(0,Math.min(r.bottom,n)-Math.max(r.top,0)),f=p*d,E=r.width*r.height;if(!(E>0&&f/E>=.1))return!1;let I=r.top<=n&&r.bottom>=0,D=r.left<=i&&r.right>=0,k=I&&D,O=o.transform.match(/matrix\(([^)]+)\)/),$=0,B=0;if(O){let Se=O[1].split(", ").map(parseFloat);$=Se[4],B=Se[5]}let q=$+r.left>i||$+r.right<0||B+r.top>n||B+r.bottom<0;return k||!q}var xy=xr(wi());var gi=class t{static cartChange$=new Wt;compareCartItemSubject=new Wt;constructor(){this.compareCartItemSubject.pipe(fr(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let e=this,r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){e.performEvent(this._url).catch(n=>w.error("Unable to process cart change in XMLHttpRequest",n))}),r.apply(this,arguments)},w.verbose("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=function(n){return r.apply(window,arguments).then(i=>(e.performEvent(n.toString()).catch(o=>w.error("Unable to process cart change in fetch",o)),i))},w.verbose("Securely overwritten window.fetch method")}async performEvent(e){this.isCartManipulationURL(e)&&(de.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(e){return/\/cart\/(add|change|update|clear)/.test(e)}sendChangesAsEvents(e,r){let n=e?.items,i=r.items,o=[],s=[];if(w.verbose(`Comparing cart change with old count ${n?.length} to new count ${i.length}`),i?.forEach(a=>{let c=n?.find(p=>p.vID===a.vID);if(c){if(c.quantity!==a.quantity){let p=c.quantity<a.quantity,d=Math.abs(c.quantity-a.quantity),f=re(_({},a),{quantity:d});p?o.push(f):s.push(f)}n&&sh(n,c)}else o.push(a)}),n)for(let a of n)s.push(a);w.verbose(`Cart delta: added: ${o.length}, removed: ${s.length}`),o.length&&this.sendEvent(P.EVENT_ADD_TO_CART,{items:o}),s.length&&e.token===r.token&&this.sendEvent(P.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||o.length)&&t.cartChange$.next({itemsAdded:o,itemsRemoved:s})}sendEvent(e,r){let n=new Ce(e,r);fe.get(Be).sendSafe(n)}async compareCartItems(){let e=await ze.get(Ee.CURRENT_CART,{}),r=await we.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,r)}};var nt=class t{static cartDrawerToggle$=new Is({open:!1,firstOpen:!1});static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Qe.get().website??{};currentState=!1;mutationSubscription;mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[t.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener(P.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return t._instance||(t._instance=new t),t._instance}static forceUpdate(){t._instance?.destroy(),t._instance=new t}isOpen(){let e=this.inShadow?this.isPresent():Ty(this.cartDrawerElement);return w.info(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){w.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(P.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){w.verbose("No clickable cart icon found with selector",this.iconSelector);return}e.click()}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===t.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e)}catch(n){Te(n,"execute-cooeeUpdateCartDrawer")}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,o=e.items[0].price;window.cartGiftUpdate(n,o,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer&&typeof window.theme?.CartDrawer=="function")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?we.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(we.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():window.updateCartItemJS?window.updateCartItemJS(1,e?.items?.[0]?.id+""):(w.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(P.CTA_AFTER_REFRESH_UI,{detail:{responseJSON:e,currentCart:we.getCurrent()}})),r&&gi.cartChange$.next({})}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(P.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(!os())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Ui(e),!this.cartDrawerElement){xy.default.warn("Max attempts exhausted to find cart drawer");return}w.verbose("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let r=(await Ui(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle()}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new Wt;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),this.mutationSubscription=r.pipe(Hf(800,void 0,{leading:!1,trailing:!0})).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,t.cartDrawerToggle$.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 we.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([P.EVENT_OPEN_CART])}destroy(){document.removeEventListener(P.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationSubscription?.unsubscribe(),this.mutationObserver?.disconnect()}};var ll=class{static processConfiguration(){let e=Qe.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&Ot.getInstance().updateDevicePropsSafe({gaClientID:e})}static async getClientID(){let e=await ze.get(Ee.GA_CLIENT_ID),r=await this.getClientIDViaGTag();if(e!==r)return await ze.set(Ee.GA_CLIENT_ID,r),r}static async getClientIDViaGTag(){let r=Qe.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",i=>{n(i)})})}};var NS=t=>t,Cy=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function Ry(t,e={childList:!0,subtree:!0},r=500,n=NS){return ol(i=>{let o=new MutationObserver(s=>i(s));return o.observe(t,e),o},(i,o)=>o.disconnect()).pipe(mn(i=>n(i)),Ff(i=>i.length>0),fr(r))}var Eo=class{static itemMap=new Map;static async refreshItems(e){for(let s of e.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(s,e)}catch(a){w.error(a)}if(e.isCartEmbed()&&!e.isSubscriptionUpsell()){let a=(await we.getCurrent().getNormalisedCart()).items.map(c=>c.mID);e.items=e.items.filter(c=>!a.includes(c.mID))}if(Qe.get().currencyCount<=1)return e.items;if(e.isShoppableVideo())return await this.refreshVideoItems(e.content.videoConfig,e),e.items;let r=e.items.length,n=e.items.map(s=>this.updatedItem(s,e)),o=(await Promise.all(n)).filter(s=>s!=null);if(r&&!o.length){let s="Failed to fetch any product from Ajax API",a=new Ce(P.EVENT_CAMPAIGN_FAILED,{reason:s,currency:e.currency},e);throw fe.get(Be).sendSilently(a),new Error(s)}if(e.isCartRecovery()){let s=we.getCurrent().items,a=[];for(let c of o)for(let p of c.vars){if(!p.isAvailable)continue;let d=s.find(y=>y.variant_id.toString()===p.mID);if(!d)continue;let f=new Dt(c);f.name=d.title;let E=new Ur(p);E.name=d.variant_title,E.price.d=d.discounted_price/100,f.variants=[E],a.push(f)}return a}return o}static async refreshVideoItems(e,r){await Promise.all(e.videos.map(async n=>{n.items=await Promise.all(n.items.map(async i=>{let o=await this.updatedItem(i,r);return o||i}))}))}static async updatedItem(e,r){if(this.itemMap.has(e.mID))return this.itemMap.get(e.mID);let n=e,i,o=`/products/${n.slug}.js`;try{i=(await en(o)).data}catch(a){return Te(a,"fetch-shopify-product",{extra:{item:n,path:o},engagementTrigger:r}),null}if(!i)return w.error("Item not found after AJAX call for:",n),null;n.name=i.title,n.tags=i.tags;let s=n.selectedOrFirstVariant.value;return n.vars.map(a=>{let c=i.variants.find(p=>p.id===+a.mID);a.name=c.title,a.isAvailable=c.available,a.price.d=c.price?c.price/100:c.price,a.price.effective=a.price.d,a.price.cmp=c.compare_at_price?c.compare_at_price/100:c.compare_at_price,+s.mID===c.id&&(s.effectivePrice.value=a.price.d)}),this.itemMap.set(n.mID,n),n}};var _o=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let r={display:e.disp};return e.of&&(r.objectFit=e.of),e.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=e.right+"px",r.left=e.left+"px",r.top=e.top+"px",r.bottom=e.bottom+"px"),r}getSizeStyles(e){let r={};return e?.w&&(r.width=e.w),e?.h&&(r.height=e.h),e?.maxW&&(r.maxWidth=e.maxW),e?.maxH&&(r.maxHeight=e.maxH),e?.minW&&(r.minWidth=e.minW),e?.minH&&(r.minHeight=e.minH),r}getBorderStyles(e){if(!e)return{};let r={};return e.radius&&e.radius>0&&(r.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(r.borderWidth=this.getSizePx(e.width),r.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(e){return e?{gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:"100%"}:{}}getSpaceStyles(e){let r={};return e?(r.paddingTop=this.getSizePx(e.pt),r.paddingBottom=this.getSizePx(e.pb),r.paddingLeft=this.getSizePx(e.pl),r.paddingRight=this.getSizePx(e.pr),r.marginTop=this.getSizePx(e.mt),r.marginBottom=this.getSizePx(e.mb),r.marginLeft=e.cent?"auto":this.getSizePx(e.ml),r.marginRight=e.cent?"auto":this.getSizePx(e.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(e){if(!e)return{};let r={};if(e.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${e.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:e.glossy.fallback.rgba};if(r[i]=o,r[n]=o,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",r)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",r);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let n=(e.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${e.img.src}") no-repeat center`,r.backgroundSize="cover",e.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,r.backdropFilter=`opacity(${e.img.a})`)}return r}getGradientStyles(e,r,n){if(n??={},e.type==="LINEAR"){let i=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(i+=`, ${e.c3}`),i+=")",n[r]=i}return n}getColourStyles(e,r="color",n){return n??={},e?e.grad?this.getGradientStyles(e.grad,r,n):(e.hex&&(n[r]=e.rgba),n):n}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}};var $e=class extends Mr{stylesConverter=new _o(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=Ir()?"sm":"lg",this.clickExecutor=new Yr(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),_(_(re(_(_(_(_(_(_({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return!0;let{lhs:r,rhs:n}=e;switch(e.op){case"eq":return r===n;case"gt":return+r>+n;case"gte":return+r>=+n;case"lt":return+r<+n;case"lte":return+r<=+n;case"ne":return r!==n;case"null":return r==null;case"empty":return r.trim()==="";case"in":return new RegExp(`\\b${n}\\b`).test(r);case"nin":return!new RegExp(`\\b${n}\\b`).test(r);default:return w.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,Ir()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=_(_({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e,r){e.stopPropagation(),!r.clickAction&&(r.clickAction=this.props.element.clc),await this.clickExecutor.execute(r)}};var OS=0,oH=Array.isArray;function J(t,e,r,n,i,o){e||(e={});var s,a,c=e;if("ref"in c)for(a in c={},e)a=="ref"?s=e[a]:c[a]=e[a];var p={type:t,props:c,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--OS,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return Ae.vnode&&Ae.vnode(p),p}var Jt=class extends $e{componentDidMount(){this.setState(()=>({text:this.props.element.text})),xt(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),r=this.state.text;return r||(e.display="none",r=""),J("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:J("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:r}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,r={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},n=Qn(this.props.element,r,this.props.triggerContext),i=new _t(n);if(!this.matchWhenCondition(i.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:i.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new pt;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily=r.fam.name||"inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,e.textDecoration=r.td??"none",this.stylesConverter.getColourStyles(r.tc,"color",e),e}getComponentStyles(){return _({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var yi=class extends Jt{render(){return J("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:J("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return re(_({},super.getComponentStyles()),{cursor:"pointer"})}};var jf=class extends Mr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?J("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[J("span",{children:this.props.time}),J("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):J("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[J("span",{style:this.getTimeLabelStyle(),children:this.props.label}),J("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},Ls=class extends Jt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>_({},this.labels)),this.processAndStartTimer()}render(){return J("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>J(jf,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return _(_({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,"0"),this.labels.Hours=String(e.hours).padStart(2,"0"),this.labels.Minutes=String(e.minutes).padStart(2,"0"),this.labels.Seconds=String(e.seconds).padStart(2,"0"),this.setState(()=>_({},this.labels))})}};function ul(t,e){if(!t)return;let r=new window.CooeeSDK.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
43
+ `)}`:"",this.name="UnsubscriptionError",this.errors=r});function ci(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var lr=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(de(n))try{n()}catch(o){e=o instanceof el?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{sy(o)}catch(s){e=e??[],s instanceof el?e=[...e,...s.errors]:e.push(s)}}if(e)throw new el(e)}}add(e){var r;if(e&&e!==this)if(this.closed)sy(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&ci(r,e)}remove(e){let{_finalizers:r}=this;r&&ci(r,e),e instanceof t&&e._removeParent(this)}};lr.EMPTY=(()=>{let t=new lr;return t.closed=!0,t})();var Gf=lr.EMPTY;function tl(t){return t instanceof lr||t&&"closed"in t&&de(t.remove)&&de(t.add)&&de(t.unsubscribe)}function sy(t){de(t)?t():t.unsubscribe()}var Ir={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var go={setTimeout(t,e,...r){let{delegate:n}=go;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=go;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function rl(t){go.setTimeout(()=>{let{onUnhandledError:e}=Ir;if(e)e(t);else throw t})}function Yf(){}var ay=qf("C",void 0,void 0);function cy(t){return qf("E",void 0,t)}function ly(t){return qf("N",t,void 0)}function qf(t,e,r){return{kind:t,value:e,error:r}}var li=null;function yo(t){if(Ir.useDeprecatedSynchronousErrorHandling){let e=!li;if(e&&(li={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=li;if(li=null,r)throw n}}else t()}function uy(t){Ir.useDeprecatedSynchronousErrorHandling&&li&&(li.errorThrown=!0,li.error=t)}var ui=class extends lr{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,tl(e)&&e.add(this)):this.destination=bS}static create(e,r,n){return new Pn(e,r,n)}next(e){this.isStopped?Kf(ly(e),this):this._next(e)}error(e){this.isStopped?Kf(cy(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?Kf(ay,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},ES=Function.prototype.bind;function zf(t,e){return ES.call(t,e)}var Xf=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(n){nl(n)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(n){nl(n)}else nl(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){nl(r)}}},Pn=class extends ui{constructor(e,r,n){super();let i;if(de(e)||!e)i={next:e??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&Ir.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&zf(e.next,o),error:e.error&&zf(e.error,o),complete:e.complete&&zf(e.complete,o)}):i=e}this.destination=new Xf(i)}};function nl(t){Ir.useDeprecatedSynchronousErrorHandling?uy(t):rl(t)}function _S(t){throw t}function Kf(t,e){let{onStoppedNotification:r}=Ir;r&&go.setTimeout(()=>r(t,e))}var bS={closed:!0,next:Yf,error:_S,complete:Yf};var vo=typeof Symbol=="function"&&Symbol.observable||"@@observable";function il(t){return t}function py(t){return t.length===0?il:t.length===1?t[0]:function(r){return t.reduce((n,i)=>i(n),r)}}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 o=SS(r)?r:new Pn(r,n,i);return yo(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=fy(n),new n((i,o)=>{let s=new Pn({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[vo](){return this}pipe(...r){return py(r)(this)}toPromise(r){return r=fy(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function fy(t){var e;return(e=t??Ir.Promise)!==null&&e!==void 0?e:Promise}function wS(t){return t&&de(t.next)&&de(t.error)&&de(t.complete)}function SS(t){return t&&t instanceof ui||wS(t)&&tl(t)}function IS(t){return de(t?.lift)}function $t(t){return e=>{if(IS(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 Vt(t,e,r,n,i){return new Jf(t,e,r,n,i)}var Jf=class extends ui{constructor(e,r,n,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var my=ho(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Wt=(()=>{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 ol(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new my}next(r){yo(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){yo(()=>{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(){yo(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:o}=this;return n||i?Gf:(this.currentObservers=null,o.push(r),new lr(()=>{this.currentObservers=null,ci(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new Ye;return r.source=this,r}}return t.create=(e,r)=>new ol(e,r),t})(),ol=class extends Wt{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)}error(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:Gf}};var Cs=class extends Wt{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:n}=this;if(e)throw r;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var Rs={now(){return(Rs.delegate||Date).now()},delegate:void 0};var As=class extends Wt{constructor(e=1/0,r=1/0,n=Rs){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(e),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=n?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),a=0;for(let c=1;c<n.length&&n[c]<=s;c+=2)a=c;a&&n.splice(0,a+1)}}};var sl=class extends lr{constructor(e,r){super()}schedule(e,r=0){return this}};var Ds={setInterval(t,e,...r){let{delegate:n}=Ds;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=Ds;return(e?.clearInterval||clearInterval)(t)},delegate:void 0};var al=class extends sl{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var n;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,n=0){return Ds.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&Ds.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(e,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let n=!1,i;try{this.work(e)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,ci(n,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var Eo=class t{constructor(e,r=t.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};Eo.now=Rs.now;var cl=class extends Eo{constructor(e,r=Eo.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,n){for(;e=r.shift();)e.unsubscribe();throw n}}};var Os=new cl(al),dy=Os;var hy=new Ye(t=>t.complete());function ll(t){return t&&de(t.schedule)}function gy(t){return t[t.length-1]}function yy(t){return ll(gy(t))?t.pop():void 0}function vy(t,e){return typeof gy(t)=="number"?t.pop():e}function _y(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(d){try{p(n.next(d))}catch(f){s(f)}}function c(d){try{p(n.throw(d))}catch(f){s(f)}}function p(d){d.done?o(d.value):i(d.value).then(a,c)}p((n=n.apply(t,e||[])).next())})}function Ey(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 pi(t){return this instanceof pi?(this.v=t,this):new pi(t)}function by(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(y){return function(I){return Promise.resolve(I).then(y,f)}}function a(y,I){n[y]&&(i[y]=function(D){return new Promise(function(U,N){o.push([y,D,U,N])>1||c(y,D)})},I&&(i[y]=I(i[y])))}function c(y,I){try{p(n[y](I))}catch(D){E(o[0][3],D)}}function p(y){y.value instanceof pi?Promise.resolve(y.value.v).then(d,f):E(o[0][2],y)}function d(y){c("next",y)}function f(y){c("throw",y)}function E(y,I){y(I),o.shift(),o.length&&c(o[0][0],o[0][1])}}function wy(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 Ey=="function"?Ey(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(p){o({value:p,done:a})},s)}}var _o=t=>t&&typeof t.length=="number"&&typeof t!="function";function ul(t){return de(t?.then)}function pl(t){return de(t[vo])}function fl(t){return Symbol.asyncIterator&&de(t?.[Symbol.asyncIterator])}function ml(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 TS(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var dl=TS();function hl(t){return de(t?.[dl])}function gl(t){return by(this,arguments,function*(){let r=t.getReader();try{for(;;){let{value:n,done:i}=yield pi(r.read());if(i)return yield pi(void 0);yield yield pi(n)}}finally{r.releaseLock()}})}function yl(t){return de(t?.getReader)}function At(t){if(t instanceof Ye)return t;if(t!=null){if(pl(t))return xS(t);if(_o(t))return CS(t);if(ul(t))return RS(t);if(fl(t))return Sy(t);if(hl(t))return AS(t);if(yl(t))return DS(t)}throw ml(t)}function xS(t){return new Ye(e=>{let r=t[vo]();if(de(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function CS(t){return new Ye(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function RS(t){return new Ye(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,rl)})}function AS(t){return new Ye(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Sy(t){return new Ye(e=>{OS(t,e).catch(r=>e.error(r))})}function DS(t){return Sy(gl(t))}function OS(t,e){var r,n,i,o;return _y(this,void 0,void 0,function*(){try{for(r=wy(t);n=yield r.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function ur(t,e,r,n=0,i=!1){let o=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!i)return o}function vl(t,e=0){return $t((r,n)=>{r.subscribe(Vt(n,i=>ur(n,t,()=>n.next(i),e),()=>ur(n,t,()=>n.complete(),e),i=>ur(n,t,()=>n.error(i),e)))})}function El(t,e=0){return $t((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function Iy(t,e){return At(t).pipe(El(e),vl(e))}function Ty(t,e){return At(t).pipe(El(e),vl(e))}function xy(t,e){return new Ye(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function Cy(t,e){return new Ye(r=>{let n;return ur(r,e,()=>{n=t[dl](),ur(r,e,()=>{let i,o;try{({value:i,done:o}=n.next())}catch(s){r.error(s);return}o?r.complete():r.next(i)},0,!0)}),()=>de(n?.return)&&n.return()})}function _l(t,e){if(!t)throw new Error("Iterable cannot be null");return new Ye(r=>{ur(r,e,()=>{let n=t[Symbol.asyncIterator]();ur(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function Ry(t,e){return _l(gl(t),e)}function Ay(t,e){if(t!=null){if(pl(t))return Iy(t,e);if(_o(t))return xy(t,e);if(ul(t))return Ty(t,e);if(fl(t))return _l(t,e);if(hl(t))return Cy(t,e);if(yl(t))return Ry(t,e)}throw ml(t)}function Dy(t,e){return e?Ay(t,e):At(t)}var Oy=ho(t=>function(){t(this),this.name="EmptyError",this.message="no elements in sequence"});function pr(t,e){let r=typeof e=="object";return new Promise((n,i)=>{let o=new Pn({next:s=>{n(s),o.unsubscribe()},error:i,complete:()=>{r?n(e.defaultValue):i(new Oy)}});t.subscribe(o)})}function Ny(t){return t instanceof Date&&!isNaN(t)}function fn(t,e){return $t((r,n)=>{let i=0;r.subscribe(Vt(n,o=>{n.next(t.call(e,o,i++))}))})}var{isArray:NS}=Array;function PS(t,e){return NS(e)?t(...e):t(e)}function bl(t){return fn(e=>PS(t,e))}function Py(t,e,r,n,i,o,s,a){let c=[],p=0,d=0,f=!1,E=()=>{f&&!c.length&&!p&&e.complete()},y=D=>p<n?I(D):c.push(D),I=D=>{o&&e.next(D),p++;let U=!1;At(r(D,d++)).subscribe(Vt(e,N=>{i?.(N),o?y(N):e.next(N)},()=>{U=!0},void 0,()=>{if(U)try{for(p--;c.length&&p<n;){let N=c.shift();s?ur(e,s,()=>I(N)):I(N)}E()}catch(N){e.error(N)}}))};return t.subscribe(Vt(e,y,()=>{f=!0,E()})),()=>{a?.()}}function Ns(t,e,r=1/0){return de(e)?Ns((n,i)=>fn((o,s)=>e(n,o,i,s))(At(t(n,i))),r):(typeof e=="number"&&(r=e),$t((n,i)=>Py(n,i,t,r)))}function Ly(t=1/0){return Ns(il,t)}var LS=["addListener","removeListener"],MS=["addEventListener","removeEventListener"],BS=["on","off"];function fi(t,e,r,n){if(de(r)&&(n=r,r=void 0),n)return fi(t,e,r).pipe(bl(n));let[i,o]=FS(t)?MS.map(s=>a=>t[s](e,a,r)):US(t)?LS.map(My(t,e)):kS(t)?BS.map(My(t,e)):[];if(!i&&_o(t))return Ns(s=>fi(s,e,r))(At(t));if(!i)throw new TypeError("Invalid event target");return new Ye(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function My(t,e){return r=>n=>t[r](e,n)}function US(t){return de(t.addListener)&&de(t.removeListener)}function kS(t){return de(t.on)&&de(t.off)}function FS(t){return de(t.addEventListener)&&de(t.removeEventListener)}function wl(t,e,r){return r?wl(t,e).pipe(bl(r)):new Ye(n=>{let i=(...s)=>n.next(s.length===1?s[0]:s),o=t(i);return de(e)?()=>e(i,o):void 0})}function By(t=0,e,r=dy){let n=-1;return e!=null&&(ll(e)?r=e:n=e),new Ye(i=>{let o=Ny(t)?+t-r.now():t;o<0&&(o=0);let s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=n?this.schedule(void 0,n):i.complete())},o)})}function Qf(...t){let e=yy(t),r=vy(t,1/0),n=t;return n.length?n.length===1?At(n[0]):Ly(r)(Dy(n,e)):hy}function bo(t,e){return $t((r,n)=>{let i=0;r.subscribe(Vt(n,o=>t.call(e,o,i++)&&n.next(o)))})}function fr(t,e=Os){return $t((r,n)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let p=o;o=null,n.next(p)}};function c(){let p=s+t,d=e.now();if(d<p){i=this.schedule(void 0,p-d),n.add(i);return}a()}r.subscribe(Vt(n,p=>{o=p,s=e.now(),i||(i=e.schedule(c,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{o=i=null}))})}function Uy(t,e){return $t((r,n)=>{let{leading:i=!0,trailing:o=!1}=e??{},s=!1,a=null,c=null,p=!1,d=()=>{c?.unsubscribe(),c=null,o&&(y(),p&&n.complete())},f=()=>{c=null,p&&n.complete()},E=I=>c=At(t(I)).subscribe(Vt(n,d,f)),y=()=>{if(s){s=!1;let I=a;a=null,n.next(I),!p&&E(I)}};r.subscribe(Vt(n,I=>{s=!0,a=I,!(c&&!c.closed)&&(i?y():E(I))},()=>{p=!0,!(o&&s&&c&&!c.closed)&&n.complete()}))})}function Zf(t,e=Os,r){let n=By(t,e);return Uy(()=>n,r)}var ky=Cr(au()),Sl=class t{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new ky.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new t(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new t(r)}};function Il(){let t=pe.get();return Z(_({},t.customContext),{page:ia(),locale:t.locale,currentItem:t.getCurrentItem(),previewIDs:t.previewIDs,previewVariant:t.previewVariant,engagementIDs:HS(),cart:ye.getCurrent().convertToCooeeCart()})}function HS(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}var $S=" daum[ /]| deusu/|(?:^|[^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/|^azure|^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/|agent|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|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|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/",VS=/bot|crawl|http|lighthouse|scan|search|spider/i,Ps;function WS(){if(Ps instanceof RegExp)return Ps;try{Ps=new RegExp($S,"i")}catch{Ps=VS}return Ps}function Fy(t){return!!t&&WS().test(t)}var em={d:(t,e)=>{for(var r in e)em.o(e,r)&&!em.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},tm={};em.d(tm,{A:()=>jS,k:()=>rm});var Ls=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(p){try{c(n.next(p))}catch(d){o(d)}}function a(p){try{c(n.throw(p))}catch(d){o(d)}}function c(p){var d;p.done?i(p.value):(d=p.value,d instanceof r?d:new r(function(f){f(d)})).then(s,a)}c((n=n.apply(t,e||[])).next())})},Ms=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(p){return(function(d){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(s=0)),s;)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 s.label++,{value:d[1],done:!1};case 5:s.label++,n=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){s.label=d[1];break}if(d[0]===6&&s.label<i[1]){s.label=i[1],i=d;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(d);break}i[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(t,s)}catch(f){d=[6,f],n=0}finally{r=i=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}})([c,p])}}};function rm(){return Ls(this,void 0,Promise,function(){return Ms(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function o(y){i||(i=!0,e({isPrivate:y,browserName:n}))}function s(){var y=0,I=parseInt("-1");try{I.toFixed(I)}catch(D){y=D.message.length}return y}function a(){return navigator.msSaveBlob!==void 0&&(function(y){try{return y===eval.toString().length}catch{return!1}})(39)}function c(){var y;return Ls(this,void 0,void 0,function(){var I,D;return Ms(this,function(U){switch(U.label){case 0:return U.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return U.sent(),o(!1),[3,3];case 2:return I=U.sent(),D=I,I instanceof Error&&(D=(y=I.message)!==null&&y!==void 0?y:I),typeof D!="string"?(o(!1),[2]):(o(!!D.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var y;return Ls(this,void 0,Promise,function(){return Ms(this,function(I){switch(I.label){case 0:return((y=navigator.storage)===null||y===void 0?void 0:y.getDirectory)===void 0?[3,2]:[4,c()];case 1:return I.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var D=String(Math.random());try{var U=indexedDB.open(D,1);U.onupgradeneeded=function(N){var H=N.target.result,M=function(q){o(q)};try{H.createObjectStore("t",{autoIncrement:!0}).put(new Blob),M(!1)}catch(q){(q.message||"").includes("are not yet supported")?M(!0):M(!1)}finally{H.close(),indexedDB.deleteDatabase(D)}},U.onerror=function(){return o(!1)}}catch{o(!1)}})():(function(){var D=window.openDatabase,U=window.localStorage;try{D(null,null,null,null)}catch{return void o(!0)}try{U.setItem("test","1"),U.removeItem("test")}catch{return void o(!0)}o(!1)})(),I.label=3;case 3:return[2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(y,I){var D;o(Math.round(I/1048576)<2*Math.round(((D=window).performance!==void 0&&D.performance.memory!==void 0&&D.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(y){r(new Error("detectIncognito somehow failed to query storage quota: "+y.message))})}function f(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0,window.webkitRequestFileSystem)(0,1,function(){o(!1)},function(){o(!0)})}function E(){return Ls(this,void 0,Promise,function(){var y,I;return Ms(this,function(D){switch(D.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];D.label=1;case 1:return D.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return D.sent(),o(!1),[3,4];case 3:return y=D.sent(),typeof(I=y instanceof Error&&typeof y.message=="string"?y.message:String(y))!="string"?(o(!1),[2]):(o(I.includes("Security error")),[2]);case 4:return o(navigator.serviceWorker===void 0),[2]}})})}(function(){return Ls(this,void 0,Promise,function(){return Ms(this,function(y){switch(y.label){case 0:return s()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return y.sent(),[3,6];case 2:return s()!==51?[3,3]:(I=navigator.userAgent,n=I.match(/Chrome/)?navigator.brave!==void 0?"Brave":I.match(/Edg/)?"Edge":I.match(/OPR/)?"Opera":"Chrome":"Chromium",f(),[3,6]);case 3:return s()!==25?[3,5]:(n="Firefox",[4,E()]);case 4:return y.sent(),[3,6];case 5:a()?(n="Internet Explorer",o(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),y.label=6;case 6:return[2]}var I})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=rm);var jS=rm,Hy=tm.A,uH=tm.k;var $y=Cr(wi()),Vy=async()=>{let t={};try{return await GS(t)}catch(e){return be(e,"device-properties"),t}},GS=async t=>{let e=window.CooeeSDK.uaParser;YS(t),qS(t),zS(t),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:KS()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0,Mi({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([QS(t),XS(t),ZS(t)]),t},YS=t=>{let e=navigator;if(!e.deviceMemory)return;let r=e.deviceMemory;t.mem={tot:r*1024}},qS=t=>{let e=navigator,r=e.connection||e.mozConnection||e.webkitConnection;r?.effectiveType&&(t.net={type:r.effectiveType})},zS=t=>{let e=screen.orientation?.type;e&&(t.orientation=e)},KS=()=>{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},XS=async t=>{try{await JS(t)}catch(e){b.error("Unable to get location",e)}},JS=async t=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{t.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})},QS=async t=>{if("getBattery"in navigator)try{let r=await navigator.getBattery();t.bat={l:r.level*100,c:r.charging},Mi({"battery.level":t.bat.l,"battery.charging":t.bat.c})}catch{}},ZS=async t=>{try{(await Hy())?.isPrivate&&(t.incognito=!0,Mi({incognito:!0}))}catch(e){$y.default.error("Unable to detect private/incognito window",e)}};var mi=class{static _flags={};static getFlags(){return this._flags}static setFlags(e){this._flags=e??{}}static isECommerceApp(){return ls()}};var Dt=class t{static INSTANCE;deviceID="";shopName="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateProfileSafe(e){pr(at.replaySubject).then(()=>this.updateProfile(e??{}))}updateProfile(e){this.put("/v1/user/update",e).then(async r=>{b.verbose("Updated user profile"),await at.getInstance().storeAndPopulateAuthData(r.data)}).catch(r=>{b.error("Error saving user profile",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDevicePropsSafe(e){pr(at.replaySubject).then(()=>this.updateDeviceProps({props:e}))}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{b.verbose("Updated device properties")}).catch(async r=>{b.error("Error saving device property",r)})}setDeviceId(e){this.deviceID=e??""}setShopName(e){this.shopName=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(!mi.isECommerceApp()&&!mi.getFlags().allowEvents)return b.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Gt.apiURL+r);let i=this.getDefaultHeaders(),o="keepalive"in new Request(""),s=n?JSON.stringify(n):void 0;if(n&&!o&&s?.includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){throw be(c,"http-request",{extra:{body:s}}),c}let a={method:e,headers:i,keepalive:!0};return n&&(a.body=s),Zr(r,a)}performXMLHttpRequest(e,r,n){return new Promise((i,o)=>{let s=new XMLHttpRequest;s.open("POST",e,!0),r.forEach((a,c)=>{s.setRequestHeader(c,a)}),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(s.status>=200&&s.status<300)try{if(s.getResponseHeader("Content-Type")?.includes("application/json")){let c=JSON.parse(s.responseText);i({data:c,headers:r,request:s,status:s.status,statusText:s.statusText})}else o(new Error("Content-Type of response header is not json"))}catch(a){o(a)}else o(new Error(`Received status - ${s.status}(${s.statusText})`))},s.onerror=()=>{o(new Error("Network error occurred during the request."))},s.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",ea),e.set("cooee-sdk-code",dm.toString()),e.set("cooee-sdk-version",Kr),e.set("cooee-first-seen",this.firstSeen),this.deviceID&&e.append("cooee-device-id",this.deviceID),this.shopName&&e.append("cooee-shop-name",this.shopName),Gt.debug&&e.set("cooee-sdk-debug",String(1)),e}};var Bs=class Bs extends gn{};bi(Bs,"storeName","app"),Bs.storage=Ti(Bs.storeName);var Us=Bs;function Tr(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function di(t,e){Object.assign(t.style,e)}function re(t,e,r){if(e){if(!r){t.style.removeProperty(e);return}t.style.setProperty(e,r,"important")}}function Wy(t){if(!t)return!1;if(t.tagName.toLowerCase()==="cart-drawer"&&t.hasAttribute("open"))return!0;let r=t.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,i=(window.innerWidth||document.documentElement.clientWidth)+.5,o=getComputedStyle(t);if(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0||t.hidden||!(t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0))return!1;let p=Math.max(0,Math.min(r.right,i)-Math.max(r.left,0)),d=Math.max(0,Math.min(r.bottom,n)-Math.max(r.top,0)),f=p*d,E=r.width*r.height;if(!(E>0&&f/E>=.1))return!1;let I=r.top<=n&&r.bottom>=0,D=r.left<=i&&r.right>=0,U=I&&D,N=o.transform.match(/matrix\(([^)]+)\)/),H=0,M=0;if(N){let Ee=N[1].split(", ").map(parseFloat);H=Ee[4],M=Ee[5]}let q=H+r.left>i||H+r.right<0||M+r.top>n||M+r.bottom<0;return U||!q}var jy=Cr(wi());var hi=class t{static cartChange$=new Wt;compareCartItemSubject=new Wt;constructor(){this.compareCartItemSubject.pipe(fr(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let e=this,r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){e.performEvent(this._url).catch(n=>b.error("Unable to process cart change in XMLHttpRequest",n))}),r.apply(this,arguments)},b.verbose("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=function(n){return r.apply(window,arguments).then(i=>(e.performEvent(n.toString()).catch(o=>b.error("Unable to process cart change in fetch",o)),i))},b.verbose("Securely overwritten window.fetch method")}async performEvent(e){this.isCartManipulationURL(e)&&(pe.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(e){return/\/cart\/(add|change|update|clear)/.test(e)}sendChangesAsEvents(e,r){let n=e?.items,i=r.items,o=[],s=[];if(b.verbose(`Comparing cart change with old count ${n?.length} to new count ${i.length}`),i?.forEach(a=>{let c=n?.find(p=>p.vID===a.vID);if(c){if(c.quantity!==a.quantity){let p=c.quantity<a.quantity,d=Math.abs(c.quantity-a.quantity),f=Z(_({},a),{quantity:d});p?o.push(f):s.push(f)}n&&wh(n,c)}else o.push(a)}),n)for(let a of n)s.push(a);b.verbose(`Cart delta: added: ${o.length}, removed: ${s.length}`),o.length&&this.sendEvent("Add To Cart",{items:o}),s.length&&e.token===r.token&&this.sendEvent("Remove From Cart",{items:s}),(s.length||o.length)&&t.cartChange$.next({itemsAdded:o,itemsRemoved:s})}sendEvent(e,r){let n=new Se(e,r);le.get(Ne).sendSafe(n)}async compareCartItems(){let e=await ze.get("cart",{}),r=await ye.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,r)}};var tt=class t{static cartDrawerToggle$=new Cs({open:!1,firstOpen:!1});static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Xe.get().website??{};currentState=!1;mutationSubscription;mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[t.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener("letscooee:outbound:refresh-ui",this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return t._instance||(t._instance=new t),t._instance}static forceUpdate(){t._instance?.destroy(),t._instance=new t}isOpen(){let e=this.inShadow?this.isPresent():Wy(this.cartDrawerElement);return b.info(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){b.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent("letscooee:outbound:open-cart"));let e=document.querySelector(this.iconSelector);if(!e){b.verbose("No clickable cart icon found with selector",this.iconSelector);return}e.click()}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===t.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e)}catch(n){be(n,"execute-cooeeUpdateCartDrawer")}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,o=e.items[0].price;window.cartGiftUpdate(n,o,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer&&typeof window.theme?.CartDrawer=="function")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?ye.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(ye.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():window.updateCartItemJS?window.updateCartItemJS(1,e?.items?.[0]?.id+""):(b.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent("letscooee:outbound:refresh-ui",{detail:{responseJSON:e,currentCart:ye.getCurrent()}})),r&&hi.cartChange$.next({})}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(":shadow");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(!ls())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await ki(e),!this.cartDrawerElement){jy.default.warn("Max attempts exhausted to find cart drawer");return}b.verbose("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let r=(await ki(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle()}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new Wt;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),this.mutationSubscription=r.pipe(Zf(800,void 0,{leading:!1,trailing:!0})).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,t.cartDrawerToggle$.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 ye.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(["Open Cart"])}destroy(){document.removeEventListener("letscooee:outbound:refresh-ui",this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationSubscription?.unsubscribe(),this.mutationObserver?.disconnect()}};var Tl=class{static processConfiguration(){let e=Xe.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&Dt.getInstance().updateDevicePropsSafe({gaClientID:e})}static async getClientID(){let e=await ze.get("gacid"),r=await this.getClientIDViaGTag();if(e!==r)return await ze.set("gacid",r),r}static async getClientIDViaGTag(){let r=Xe.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",i=>{n(i)})})}};var e0=t=>t,Gy=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function Yy(t,e={childList:!0,subtree:!0},r=500,n=e0){return wl(i=>{let o=new MutationObserver(s=>i(s));return o.observe(t,e),o},(i,o)=>o.disconnect()).pipe(fn(i=>n(i)),bo(i=>i.length>0),fr(r))}var wo=class{static itemMap=new Map;static async refreshItems(e){for(let s of e.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(s,e)}catch(a){b.error(a)}if(e.isCartEmbed()&&!e.isSubscriptionUpsell()){let a=(await ye.getCurrent().getNormalisedCart()).items.map(c=>c.mID);e.items=e.items.filter(c=>!a.includes(c.mID))}if(Xe.get().currencyCount<=1)return e.items;if(e.isShoppableVideo())return await this.refreshVideoItems(e.content.videoConfig,e),e.items;let r=e.items.length,n=e.items.map(s=>this.updatedItem(s,e)),o=(await Promise.all(n)).filter(s=>s!=null);if(r&&!o.length){let s="Failed to fetch any product from Ajax API",a=new Se("CE Campaign Failed",{reason:s,currency:e.currency},e);throw le.get(Ne).sendSilently(a),new Error(s)}if(e.isCartRecovery()){let s=ye.getCurrent().items,a=[];for(let c of o)for(let p of c.vars){if(!p.isAvailable)continue;let d=s.find(y=>y.variant_id.toString()===p.mID);if(!d)continue;let f=new Rt(c);f.name=d.title;let E=new Ur(p);E.name=d.variant_title,E.price.d=d.discounted_price/100,f.variants=[E],a.push(f)}return a}return o}static async refreshVideoItems(e,r){await Promise.all(e.videos.map(async n=>{n.items=await Promise.all(n.items.map(async i=>{let o=await this.updatedItem(i,r);return o||i}))}))}static async updatedItem(e,r){if(this.itemMap.has(e.mID))return this.itemMap.get(e.mID);let n=e,i,o=`/products/${n.slug}.js`;try{i=(await Zr(o)).data}catch(a){return be(a,"fetch-shopify-product",{extra:{item:n,path:o},engagementTrigger:r}),null}if(!i)return b.error("Item not found after AJAX call for:",n),null;n.name=i.title,n.tags=i.tags;let s=n.selectedOrFirstVariant.value;return n.vars.map(a=>{let c=i.variants.find(p=>p.id===+a.mID);a.name=c.title,a.isAvailable=c.available,a.price.d=c.price?c.price/100:c.price,a.price.effective=a.price.d,a.price.cmp=c.compare_at_price?c.compare_at_price/100:c.compare_at_price,+s.mID===c.id&&(s.effectivePrice.value=a.price.d)}),this.itemMap.set(n.mID,n),n}};var So=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let r={display:e.disp};return e.of&&(r.objectFit=e.of),e.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=e.right+"px",r.left=e.left+"px",r.top=e.top+"px",r.bottom=e.bottom+"px"),r}getSizeStyles(e){let r={};return e?.w&&(r.width=e.w),e?.h&&(r.height=e.h),e?.maxW&&(r.maxWidth=e.maxW),e?.maxH&&(r.maxHeight=e.maxH),e?.minW&&(r.minWidth=e.minW),e?.minH&&(r.minHeight=e.minH),r}getBorderStyles(e){if(!e)return{};let r={};return e.radius&&e.radius>0&&(r.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(r.borderWidth=this.getSizePx(e.width),r.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(e){return e?{gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:"100%"}:{}}getSpaceStyles(e){let r={};return e?(r.paddingTop=this.getSizePx(e.pt),r.paddingBottom=this.getSizePx(e.pb),r.paddingLeft=this.getSizePx(e.pl),r.paddingRight=this.getSizePx(e.pr),r.marginTop=this.getSizePx(e.mt),r.marginBottom=this.getSizePx(e.mb),r.marginLeft=e.cent?"auto":this.getSizePx(e.ml),r.marginRight=e.cent?"auto":this.getSizePx(e.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(e){if(!e)return{};let r={};if(e.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${e.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:e.glossy.fallback.rgba};if(r[i]=o,r[n]=o,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",r)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",r);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let n=(e.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${e.img.src}") no-repeat center`,r.backgroundSize="cover",e.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,r.backdropFilter=`opacity(${e.img.a})`)}return r}getGradientStyles(e,r,n){if(n??={},e.type==="LINEAR"){let i=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(i+=`, ${e.c3}`),i+=")",n[r]=i}return n}getColourStyles(e,r="color",n){return n??={},e?e.grad?this.getGradientStyles(e.grad,r,n):(e.hex&&(n[r]=e.rgba),n):n}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}};var ke=class extends Mr{stylesConverter=new So(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=Tr()?"sm":"lg",this.clickExecutor=new Gr(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),_(_(Z(_(_(_(_(_(_({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return!0;let{lhs:r,rhs:n}=e;switch(e.op){case"eq":return r===n;case"gt":return+r>+n;case"gte":return+r>=+n;case"lt":return+r<+n;case"lte":return+r<=+n;case"ne":return r!==n;case"null":return r==null;case"empty":return r.trim()==="";case"in":return new RegExp(`\\b${n}\\b`).test(r);case"nin":return!new RegExp(`\\b${n}\\b`).test(r);default:return b.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,Tr()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=_(_({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e,r){e.stopPropagation(),!r.clickAction&&(r.clickAction=this.props.element.clc),await this.clickExecutor.execute(r)}};var t0=0,N$=Array.isArray;function X(t,e,r,n,i,o){e||(e={});var s,a,c=e;if("ref"in c)for(a in c={},e)a=="ref"?s=e[a]:c[a]=e[a];var p={type:t,props:c,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--t0,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return Te.vnode&&Te.vnode(p),p}var Jt=class extends ke{componentDidMount(){this.setState(()=>({text:this.props.element.text})),It(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),r=this.state.text;return r||(e.display="none",r=""),X("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:X("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:r}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,r={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},n=Jn(this.props.element,r,this.props.triggerContext),i=new vt(n);if(!this.matchWhenCondition(i.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:i.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new lt;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily=r.fam.name||"inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,e.textDecoration=r.td??"none",this.stylesConverter.getColourStyles(r.tc,"color",e),e}getComponentStyles(){return _({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var gi=class extends Jt{render(){return X("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:X("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return Z(_({},super.getComponentStyles()),{cursor:"pointer"})}};var nm=class extends Mr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?X("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[X("span",{children:this.props.time}),X("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):X("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[X("span",{style:this.getTimeLabelStyle(),children:this.props.label}),X("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},ks=class extends Jt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>_({},this.labels)),this.processAndStartTimer()}render(){return X("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>X(nm,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return _(_({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,"0"),this.labels.Hours=String(e.hours).padStart(2,"0"),this.labels.Minutes=String(e.minutes).padStart(2,"0"),this.labels.Seconds=String(e.seconds).padStart(2,"0"),this.setState(()=>_({},this.labels))})}};function xl(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)=>`
44
44
  <span class="${i}"
45
45
  style="background-color: ${e.pagination.color?.rgba};"></span>
46
46
  `,renderProgressbar:n=>`
47
47
  <span class="${n}"
48
48
  style="background-color: ${e.pagination.color?.rgba};">
49
49
  </span>
50
- `},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function pl(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),J("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[J("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&J("div",{class:"swiper-button-next",style:n,children:J("span",{})}),t.navigation.enabled&&J("div",{class:"swiper-button-prev",style:n,children:J("span",{})}),t.pagination.enabled&&J("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var Ms=class extends $e{componentDidMount(){xt(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return J("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:J("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new pt;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return re(_({},this.getTypoStyles()),{display:"flex"})}};var dn=class extends $e{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return J("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===Jl.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var hn=class extends $e{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return J("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:J(Mn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Ji,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var Bs=class extends hn{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return J("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:J(bo,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var Us=class extends $e{render(){return J("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(){xt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new pt;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push(J("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(J("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var PS=new RegExp('fill="#[a-zA-Z0-9]+"'),ks=class extends $e{constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),J("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=Vi(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Vi(this.props.element.halfStart,{svg:e},this.props.triggerContext),i=this.props.review;if(!i?.rating)return"";let o="";if(this.props.element.showSingleStar)o=r;else{let s=5,a=`${i.rating}`.split(".");for(let c=0;c<+a[0];c++)o+=r,s--;a[1]&&(o+=n,s--);for(let c=0;c<s;c++)o+=r.replace(PS,'fill="#f1f1f1"')}return o}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var Fs=class extends $e{render(){return J("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(){xt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new pt;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(J("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(i=>i.mID===r);this.props.item.setSelectedVariant(n)}};var bo=class extends $e{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:J(Bs,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?J(Ms,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,i=n.variantImage??n.firstImageURL,o=n.variantSecondaryImage??n.secondaryImageURL;r.lg=r.sm={src:i,name:n.name,secondarySrc:o};let s=J(dn,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:J("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:r.showChips?J("cooee-product-options-picker",{item:this.props.item,element:r}):J(Fs,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?J(Us,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?J(ks,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?J(yi,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):J(Mn,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=J(Jt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:J("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}};var vi=class extends $e{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=Qn(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new xn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return J("div",{style:_({},this.getCompiledStyles()),class:"lc-single-product",children:J(bo,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let e=this.props.item,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let i=this.props.triggerContext.triggerData.discount?.type===Zt.BXGY;return!r.hasEffectivePrice()&&i&&(n.product=re(_(_({},n.product),Bt("effective_price",r.effectivePrice.value)),{price:""})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:"{{ svg.color }}",size:"{{ svg.size }}"}}}};var Hs=class extends $e{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=Ir()?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&&kc().then(()=>{this.swiperInstance=ul(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=o=>{this.swiperRef=o},i=()=>e?.map(o=>J("div",{class:"swiper-slide",children:this.getProductFragment(o)}));r=J("div",{style:re(_({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:pl(this.configuration,n,i)})}else r=J("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,i)=>this.getProductFragment(n,i!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,i=n.items.length,o;n.isBundle()?o=this.props.element.prod.symbol?.hide!==!0?i*2-1:i:o=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${o}, auto)`}}return r}getProductFragment(e,r=!1){return J(Br,{children:[J(vi,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&J("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:J(Jt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var $s=class extends $e{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){kc().then(()=>{this.swiperInstance=ul(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=i=>{this.swiperRef=i},n=()=>e.values?.map(i=>J("div",{class:"swiper-slide",onClick:o=>this.onClick(o,{clickAction:this.getClickAction(i)}),children:this.renderElement(i)}));return pl(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return J(dn,{element:r,triggerContext:this.props.triggerContext});case 4:return J(hn,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:w.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=Qn(e,{form:r},this.props.triggerContext);return Xt.getParsedElement(n)}getClickAction(e){return Qn(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Mn=class extends $e{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),xt(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return J(hn,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return J(Ls,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?J(yi,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return J(Jt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return J(dn,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return J(Hs,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return J(vi,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return J($s,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var Vs=class extends $e{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=(this.clickAction?.at===4||this.clickAction?.at===105)&&this.clickAction.gu?.u}componentDidMount(){xt(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return J(Br,{children:[J("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:J(Mn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&J("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}async onClick(e,r){if(this.isClickable)return super.onClick(e,r)}};var Rt=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Cr(new Date,this.engagementTrigger)}static renderedEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=de.get();widgetAPIService=fe.get(Tr);eventAPIService=fe.get(Be);renderedCount=0;scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>{Te(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){w.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){w.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}async updateAndReRender(e){w.info(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}async update(e){}rerender(){this.rootContainer?.isConnected||(w.info(`${this.engagementTrigger} deleted. Will be re-rendered`),this.preDestroy(),this.renderSilently())}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}afterRootContainerCreated(){}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){w.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(w.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Dt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Dt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Dt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&tr.hasKeys(e.props)&&(this.engagementTrigger.props=_(_({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new ls(e.content)),this.triggerContext.triggerData.widget=this.widget=new to(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.triggerContext.triggerData.manipulation=e.manipulation,this.triggerContext.triggerData.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){this instanceof wt?wt.renderedEngagements.add(this):t.renderedEngagements.add(this),this.renderedCount++,w.info(`${this.engagementTrigger} rendered \u2705 ${lh(this.renderedCount)} time`)}removeFromRendered(){this instanceof wt?wt.renderedEngagements.delete(this):t.renderedEngagements.delete(this)}async getVariation(){w.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await this.widgetAPIService.getVariation(e)).data}catch(r){w.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){w.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((o,s)=>{o.forEach(async a=>{if(a.isIntersecting){w.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let c=await this.getVariation();n(c),s.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=mi(window,"scroll").pipe(fr(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=this.isExclusionWithBVariation?P.EVENT_CAMPAIGN_HOLDOUT:P.EVENT_TRIGGER_DISPLAYED,o=new Ce(i,n,this.engagementTrigger);o.name===P.EVENT_CAMPAIGN_HOLDOUT&&(o.trigger.holdout=!0),this.eventAPIService.sendSilently(o),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=we.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 Yr(this.triggerContext).execute(n.detail)}),this.rootContainer.appendChild(r),this.addToRendered(),r}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),o=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${o} lc-${i}`,n.dataset.engagementId=o,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;this.triggerContext.triggerData.hasSwiperElement()&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),ff(e)),Th(Np(Vs,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,i=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,o=e.width*e.height,s=i/o*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return w.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(P.SHADOW_SPLITTER)){let c=n.split(P.SHADOW_SPLITTER);i=(await Ui(c[0].trim()))?.shadowRoot,n=c[1].trim(),i&&ff(i,!1)}w.verbose(`${this.engagementTrigger} attempt to render ${r.position} "${n}"`);let o=await Ui(n,10,i??document);if(!o)return w.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case Si.BEFORE:{o.parentElement?.insertBefore(a,o);break}case Si.INSIDE_FIRST:{o.insertBefore(a,o.firstChild);break}case Si.INSIDE_LAST:{o.appendChild(a);break}case Si.AFTER:default:o.parentElement?.insertBefore(a,o.nextSibling)}return a}async startRendering(){w.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await Eo.refreshItems(this.engagementTrigger)}catch(r){w.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){w.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,this.renderContainer()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let o of i)Jr.remove(r,o)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var wt=class extends Rt{static renderedEngagements=new Set;constructor(e){super(e)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!nt.get().isOpen()&&this.runtimeData.pageName!=="cart"){w.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var fl=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=we.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){w.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){w.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new t(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(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 Ur(n),o=e.selling_plan_allocation?.selling_plan;if(o)for(let d of i.sellingPlans??[])d.mID===o.id.toString()&&(d.isSelected=!0,i.changeSellingPlan(d));let s=new Dt(r);s.vars=[i],s.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let c=new Ct(this.engagementTrigger);c.placement.selector=`.${a}`,c.items=[s];let p=new wt(c);p.renderSilently(),this.watchForCartItemDeletion(p,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{s===this.element&&(w.verbose(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var LS=`
50
+ `},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function Cl(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),X("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[X("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&X("div",{class:"swiper-button-next",style:n,children:X("span",{})}),t.navigation.enabled&&X("div",{class:"swiper-button-prev",style:n,children:X("span",{})}),t.pagination.enabled&&X("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var Fs=class extends ke{componentDidMount(){It(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return X("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:X("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new lt;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Z(_({},this.getTypoStyles()),{display:"flex"})}};var mn=class extends ke{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return X("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===uu.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var dn=class extends ke{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return X("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:X(Ln,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Qi,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var Hs=class extends dn{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return X("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:X(Io,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var $s=class extends ke{render(){return X("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){It(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new lt;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push(X("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(X("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var r0=new RegExp('fill="#[a-zA-Z0-9]+"'),Vs=class extends ke{constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),X("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=Wi(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Wi(this.props.element.halfStart,{svg:e},this.props.triggerContext),i=this.props.review;if(!i?.rating)return"";let o="";if(this.props.element.showSingleStar)o=r;else{let s=5,a=`${i.rating}`.split(".");for(let c=0;c<+a[0];c++)o+=r,s--;a[1]&&(o+=n,s--);for(let c=0;c<s;c++)o+=r.replace(r0,'fill="#f1f1f1"')}return o}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var Ws=class extends ke{render(){return X("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){It(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new lt;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(X("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(i=>i.mID===r);this.props.item.setSelectedVariant(n)}};var Io=class extends ke{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:X(Hs,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?X(Fs,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,i=n.variantImage??n.firstImageURL,o=n.variantSecondaryImage??n.secondaryImageURL;r.lg=r.sm={src:i,name:n.name,secondarySrc:o};let s=X(mn,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:X("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:r.showChips?X("cooee-product-options-picker",{item:this.props.item,element:r}):X(Ws,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?X($s,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?X(Vs,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?X(gi,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):X(Ln,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=X(Jt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:X("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}};var yi=class extends ke{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=Jn(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new xn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return X("div",{style:_({},this.getCompiledStyles()),class:"lc-single-product",children:X(Io,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let e=this.props.item,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let i=this.props.triggerContext.triggerData.discount?.type===Zt.BXGY;return!r.hasEffectivePrice()&&i&&(n.product=Z(_(_({},n.product),Lt("effective_price",r.effectivePrice.value)),{price:""})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:"{{ svg.color }}",size:"{{ svg.size }}"}}}};var js=class extends ke{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=Tr()?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&&Wc().then(()=>{this.swiperInstance=xl(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=o=>{this.swiperRef=o},i=()=>e?.map(o=>X("div",{class:"swiper-slide",children:this.getProductFragment(o)}));r=X("div",{style:Z(_({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Cl(this.configuration,n,i)})}else r=X("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,i)=>this.getProductFragment(n,i!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,i=n.items.length,o;n.isBundle()?o=this.props.element.prod.symbol?.hide!==!0?i*2-1:i:o=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${o}, auto)`}}return r}getProductFragment(e,r=!1){return X(Br,{children:[X(yi,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&X("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:X(Jt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var Gs=class extends ke{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){Wc().then(()=>{this.swiperInstance=xl(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=i=>{this.swiperRef=i},n=()=>e.values?.map(i=>X("div",{class:"swiper-slide",onClick:o=>this.onClick(o,{clickAction:this.getClickAction(i)}),children:this.renderElement(i)}));return Cl(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return X(mn,{element:r,triggerContext:this.props.triggerContext});case 4:return X(dn,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:b.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=Jn(e,{form:r},this.props.triggerContext);return Xt.getParsedElement(n)}getClickAction(e){return Jn(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Ln=class extends ke{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),It(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return X(dn,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return X(ks,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?X(gi,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return X(Jt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return X(mn,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return X(js,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return X(yi,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return X(Gs,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var Ys=class extends ke{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&!!Bi(this.clickAction.gu?.u)||this.clickAction?.at===105||this.clickAction?.at===107}componentDidMount(){It(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return X(Br,{children:[X("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:X(Ln,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&X("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}};var xt=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Rr(new Date,this.engagementTrigger)}static renderedEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=pe.get();widgetAPIService=le.get(xr);eventAPIService=le.get(Ne);renderedCount=0;scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>{be(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){b.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){b.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}async updateAndReRender(e){b.info(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}async update(e){}rerender(){this.rootContainer?.isConnected||(b.info(`${this.engagementTrigger} deleted. Will be re-rendered`),this.preDestroy(),this.renderSilently())}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}afterRootContainerCreated(){}isAllOkToRender(){return!!this.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){b.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(b.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Rt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Rt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Rt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&tr.hasKeys(e.props)&&(this.engagementTrigger.props=_(_({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new fs(e.content)),this.triggerContext.triggerData.widget=this.widget=new ro(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.triggerContext.triggerData.manipulation=e.manipulation,this.triggerContext.triggerData.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){this instanceof _t?_t.renderedEngagements.add(this):t.renderedEngagements.add(this),this.renderedCount++,b.info(`${this.engagementTrigger} rendered \u2705 ${Th(this.renderedCount)} time`)}removeFromRendered(){this instanceof _t?_t.renderedEngagements.delete(this):t.renderedEngagements.delete(this)}async getVariation(){b.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await this.widgetAPIService.getVariation(e)).data}catch(r){b.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){b.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((o,s)=>{o.forEach(async a=>{if(a.isIntersecting){b.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let c=await this.getVariation();n(c),s.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=fi(window,"scroll").pipe(fr(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=this.isExclusionWithBVariation?"CE Campaign Holdout":"CE Trigger Displayed",o=new Se(i,n,this.engagementTrigger);o.name==="CE Campaign Holdout"&&(o.trigger.holdout=!0),this.eventAPIService.sendSilently(o),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=ye.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 Gr(this.triggerContext).execute(n.detail)}),this.rootContainer.appendChild(r),this.addToRendered(),r}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),o=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${o} lc-${i}`,n.dataset.engagementId=o,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}startRendering(){let e=this.rootContainer;this.triggerContext.triggerData.hasSwiperElement()&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),xf(e)),$h(jp(Ys,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,i=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,o=e.width*e.height,s=i/o*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return b.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(":shadow")){let c=n.split(":shadow");i=(await ki(c[0].trim()))?.shadowRoot,n=c[1].trim(),i&&xf(i,!1)}b.verbose(`${this.engagementTrigger} attempt to render ${r.position} "${n}"`);let o=await ki(n,10,i??document);if(!o)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case Si.BEFORE:{o.parentElement?.insertBefore(a,o);break}case Si.INSIDE_FIRST:{o.insertBefore(a,o.firstChild);break}case Si.INSIDE_LAST:{o.appendChild(a);break}case Si.AFTER:default:o.parentElement?.insertBefore(a,o.nextSibling)}return a}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){b.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}b.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await wo.refreshItems(this.engagementTrigger)}catch(r){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let o of i)Xr.remove(r,o)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var _t=class extends xt{static renderedEngagements=new Set;constructor(e){super(e)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!tt.get().isOpen()&&this.runtimeData.pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var Rl=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=ye.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){b.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new t(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(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 Ur(n),o=e.selling_plan_allocation?.selling_plan;if(o)for(let d of i.sellingPlans??[])d.mID===o.id.toString()&&(d.isSelected=!0,i.changeSellingPlan(d));let s=new Rt(r);s.vars=[i],s.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let c=new Tt(this.engagementTrigger);c.placement.selector=`.${a}`,c.items=[s];let p=new _t(c);p.renderSilently(),this.watchForCartItemDeletion(p,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{s===this.element&&(b.verbose(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var n0=`
51
51
  mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
52
52
  cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
53
53
  cart {
@@ -59,7 +59,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
59
59
  }
60
60
  }
61
61
  }
62
- `,zr=class{static navigate(e,r,n){let i=`${location.origin}/discount/${e}`;switch(w.log(`Applying discount code ${e}`,r,n),r){case er.CART_PAGE:location.href=`${i}?redirect=/cart`;break;case er.CART_DRAWER:location.href=`${i}?redirect=${location.pathname}#${P.HASH_OPEN_CART_DRAWER}=1`;break;case er.SHOPIFY_CHECKOUT:location.href=`${i}?redirect=/checkout`;break;case er.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${i}?redirect=/cart#${P.HASH_INITIATE_CHECKOUT}=1`);break;default:location.href=`${i}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(e,r){let n=nt.get();switch(e){case er.CART_PAGE:location.href="/cart";break;case er.SHOPIFY_CHECKOUT:location.href="/checkout";break;case er.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#${P.HASH_INITIATE_CHECKOUT}=1`);break;case er.CART_DRAWER:{n.open();break}}r&&n.refreshUI(r)}static async applyWithStorefront(e){let r={cartId:`gid://shopify/Cart/${we.getCurrent().token}`,discountCodes:e};w.verbose(`Applying ${e.length} coupons on cart`),await pc(LS,r,"storefront-apply-discount")}static checkThirdPartyMethods(e){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=e}};var MS=`
62
+ `,Yr=class{static navigate(e,r,n){let i=`${location.origin}/discount/${e}`;switch(b.log(`Applying discount code ${e}`,r,n),r){case er.CART_PAGE:location.href=`${i}?redirect=/cart`;break;case er.CART_DRAWER:location.href=`${i}?redirect=${location.pathname}#open-cart-drawer=1`;break;case er.SHOPIFY_CHECKOUT:location.href=`${i}?redirect=/checkout`;break;case er.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${i}?redirect=/cart#initiate-checkout=1`);break;default:location.href=`${i}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(e,r){let n=tt.get();switch(e){case er.CART_PAGE:location.href="/cart";break;case er.SHOPIFY_CHECKOUT:location.href="/checkout";break;case er.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods("/cart#initiate-checkout=1");break;case er.CART_DRAWER:{n.open();break}}r&&n.refreshUI(r)}static async applyWithStorefront(e){let r={cartId:`gid://shopify/Cart/${ye.getCurrent().token}`,discountCodes:e};b.verbose(`Applying ${e.length} coupons on cart`),await hc(n0,r,"storefront-apply-discount")}static checkThirdPartyMethods(e){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=e}};var i0=`
63
63
  mutation cartCreate($input: CartInput) {
64
64
  cartCreate(input: $input) {
65
65
  cart {
@@ -72,4 +72,4 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
72
72
  }
73
73
  }
74
74
  }
75
- `,Bn=class{async addToCart(e,r){if(!e.length)return;let i={items:e.map(s=>{let{vID:a,quantity:c}=this.getVIDAndQuantity(s);return{id:a?+a:+s.mID,quantity:c,properties:r.getPrivateAttributesForLineItem()}})},o=nt.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{i.sections_url=window.location.pathname,i.sections=window.cooeeGetCartSections()}catch(s){Te(s,"execute-cooeeGetCartSections",{engagementTrigger:r})}else o.isMiniCart()?i.sections=["mini-cart"]:o.isShopifyDefaultDrawer()&&(i.sections=o.element.getSectionsToRender?.().map(s=>s.section??s.id));try{let s=await ji("/cart/add.js",i,"cart-item-add",r);return w.log(`Added ${e.length} items to Cart`),br("Product added to your cart"),s.data}catch(s){let a=["Failed to add product in cart."];if(s instanceof Vn&&s.is40x()&&s.responseText){let c=s.responseText;c.description&&a.push(`Reason: ${c.description}`)}a.push("Please try again later."),br(a.join(" "))}}async updateLineItem(e,r){if(!tr.hasKeys(r)){w.warn("No update fields provided");return}let n=_({id:e.key},r);try{let i=await ji("/cart/change.js",n,"cart-item-update");w.log(`Updated ${e}`),we.getCurrent().update(i.data)}catch{br("Failed to update item in cart")}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),w.log(`Code-${e} copied`),br("Discount code copied")}catch(r){w.error("Failed to copy code",r)}}getProductURL(e){if(!e?.link)return;let r=Gh(e.link);if(r)return Wi("/products/"+r)}async upgradeToSubscription(e,r){if(!e){w.warn("Trying to upgrade to subscription with no item");return}let n=await we.getCurrent().getNormalisedCart(),i=e.selectedOrFirstVariant.value,o=n.items.findIndex(c=>c.vID===i.mID),s=i.selectedSellingPlan.value,a={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()};try{let c=await ji("/cart/change.js",a,"cart-switch-subscription",r);return w.log(`Upgraded ${e} selling plan`),br("Line item updated"),we.getCurrent().update(c.data),c.data}catch{br("Failed to update subscription")}}async createNewCart(e,r,n){if(!e?.vID){w.error("No variant ID found to perform Buy now",e);return}let i=r?[r]:[],o=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],s=await Xa();return(await pc(MS,{input:{lines:o,discountCodes:i,attributes:s}},"storefront-create-cart")).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let r=e.clickAction,n=e.items,i=e.triggerData,o;if(r.at){let s=r;if(w.log(`Performing ${JSON.stringify(s)} action`),s.at===101)o=this.getProductURL(n[0]);else if(s.at===102)n?.length&&await this.addToCart(n,i);else if(s.at===103)await this.copyDiscountCode(i.discount?.code);else if(s.at===105)nt.get().open();else if(s.at===104){let a=e.collections;if(!a?.length)return;o=Wi("/collections/"+a[0].handle)}}r.applyDiscount&&i.discount?.code?zr.navigate(i.discount.code,i.redirectBehaviour,o):o&&(location.pathname=o)}getVIDAndQuantity(e){let r,n;if(e instanceof At)r=e.vID,n=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=1}return{vID:r,quantity:n}}};var ml=class extends wt{ctaExecutor=new Bn;constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.widgetElement.update(),this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){Te(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await we.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n,i=[],o=[],s=[],a,c,p=[...r.milestones];for(let f of p){if(f.rewardType!==Zl.FREE_AUTO_GIFT)continue;if(f.isUIOnly&&!f.allowATC){w.verbose(`Skipping milestone ${f.label} as it is UI only and does not allow ATC`);continue}let E=f.items[0],y=f.reached,I=e.items.find(D=>(D.vID===E.vID||D.mID===E.mID)&&D.properties[P.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);y&&(a=f,c=I),I&&i.push(I),!y&&I&&r.removeIneligibleItem?(w.verbose(`Removing free gift ${I.vID} from cart`),s.push(I)):y&&!I&&(w.verbose(`Adding free gift ${E.vID} to cart`),o.push(E))}r.restrictToLatestFreebie&&a&&(c?(i=i.filter(f=>f.vID!==c.vID),o=[]):o=[a.items[0]],s.push(...i)),s.length&&await this.removeFreeGifts(s),o.length&&(n=await this.ctaExecutor.addToCart(o,this.engagementTrigger));let d=r.coupons;if(d?.length)try{await zr.applyWithStorefront(d.map(f=>f.couponCode)),nt.get().refreshUI(n,!1)}catch(f){Te(f,"cart-apply-discount",{extra:{coupons:d},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(e){await Promise.all(e.map(r=>this.ctaExecutor.updateLineItem(r,{quantity:0})))}};var js=class extends wt{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var dl=class extends Rt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var hl=class extends Rt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var gl=class extends Rt{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(P.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,i=e.detail;if(!tr.hasKeys(i)){w.error(`No detail received for ${n}`);return}w.log("Detail received for BYOB",i);let o=i.campaignID??i.campaignId??i.campaign_id;if(o!==r.shortID&&o!==r.engagementID){w.warn(`Current ${n} is not BYOB. Received: ${o}`);return}let s=i.items;if(!s?.length)return;let a=s.map(c=>new At({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new Yr(this.triggerContext).execute({embeddedItems:a,clickAction:{at:108,applyDiscount:!0}})}};var wo=class{runtimeData=de.get();processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let r=[...wt.renderedEngagements];wt.renderedEngagements.clear();for(let n of e){w.info(`${n} received as cart embed`);let i=this.isAlreadyRendered(n,r);if(i>-1){this.rerender(i,n,r);continue}w.verbose(`${n} is new`),n.isProgressBar()?new ml(n).renderSilently():n.isSubscriptionUpsell()?fl.renderCartUpsell(n):n.isSavingsBar()?new js(n).renderSilently():new wt(n).renderSilently()}this.removeOldWidgets(r)}processPageWidgetResponse(e){let r=[...Rt.renderedEngagements];Rt.renderedEngagements.clear();for(let n of e){w.info(`${n} received as page embed`);let i=this.isAlreadyRendered(n,r);if(i>-1){this.rerender(i,n,r);continue}w.verbose(`${n} is new`),n.isShoppableVideo()?new dl(n).renderSilently():n.isBYOB()?new gl(n).renderSilently():n.isStickyATC()?new hl(n).renderSilently():n.isSavingsBar()?new js(n).renderSilently():new Rt(n).renderSilently()}this.removeOldWidgets(r)}isAlreadyRendered(e,r){let n=r.findIndex(i=>i.isSameTrigger(e));return n<0||e.isSubscriptionUpsell()?-1:n}async rerender(e,r,n){let[i]=n.splice(e,1);if(i)try{await i.updateAndReRender(r)}catch(o){Te(o,"update-and-re-render",{engagementTrigger:r})}}removeOldWidgets(e){for(let r of e)r.destroy()}};Ry(document.body,{childList:!0,subtree:!0},500,Cy).subscribe(()=>{Rt.renderedEngagements.forEach(e=>e.rerender()),wt.renderedEngagements.forEach(e=>e.rerender())});var Un=class{runtimeData=de.get();backendAPIService=fe.get(Ot);sessionManager=fe.get(lt);constructor(){}async getAllContext(){let[e,r]=await Promise.all([al(),this.sessionManager.checkSessionAndGetContext()]);return _(_({},e),r)}};var Tr=class t extends Un{static INSTANCE;loadPageWidgetsSubject=new Wt;loadCartWidgetsSubject=new Wt;pageWidgetLoadCount=0;constructor(){super(),this.loadPageWidgetsSubject.pipe(fr(500)).subscribe(()=>{this.loadPageWidgetsFromServer().catch(e=>w.error("Unable to initiate load page widgets",e))}),this.loadCartWidgetsSubject.pipe(fr(500)).subscribe(()=>{this.loadCartWidgetsFromServer().catch(e=>w.error("Unable to initiate load cart widgets",e))}),window.CooeeSDK.cartChange$.subscribe(()=>{this.loadWidgetsSilently()})}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSafe(){pr(lt.replaySubject).then(()=>{this.loadPageWidgetsSubject.next()})}loadCartWidgetsSafe(){pr(lt.replaySubject).then(()=>{this.loadCartWidgetsSubject.next()})}loadWidgetsSilently(){pr(lt.replaySubject).then(()=>{this.loadCartWidgetsSafe(),this.loadPageWidgetsSafe()})}async getVariation(e){let r=await this.getAllContext();return Object.assign(e,r),this.backendAPIService.post("/v1/engagement/get-variant",e)}async loadPageWidgetsFromServer(){this.pageWidgetLoadCount++,this.pageWidgetLoadCount===1?w.info("Fetch page widgets (after \u23F0",de.get().getJSLoadTimeDiff()+" of DOM load)"):w.info("Fetch page widgets");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/page-widgets",r).then(n=>{w.info(`Page widgets loaded in \u23F0 ${Xr(n.timeTakenMs)}`);let i=n.data.widgets.map(o=>new Ct(o));new wo().processPageWidgetResponse(i)}).catch(n=>{w.error("Error sending widget getter",n)})}async loadCartWidgetsFromServer(){w.info("Fetch cart widgets");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/cart-widgets",r).then(n=>{w.info(`Cart widgets loaded in \u23F0 ${Xr(n.timeTakenMs)}`);let i=n.data.widgets.map(o=>new Ct(o));new wo().processCartWidgetResponse(i)}).catch(n=>{w.error("Error sending widget getter",n)})}renderCachedCartWidgets(){new wo().processCartWidgetResponse(this.runtimeData.cartEngagements)}};var yl=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){Ps.get(Ee.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){w.verbose("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Ps.set(Ee.APP_CONFIG,r).catch(n=>w.error(n)),ll.processConfiguration(),r.website&&(Tg(r.website.commonJS),pf(r.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.subscribe(async({open:n})=>{w.info("Cart drawer is now",n?"open":"closed"),n&&(fe.get(Tr).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Ue.globalRef.config.update(e);return nt.forceUpdate(),w.verbose("App configurations",r),r}async trackViewCartEvent(){let e=await we.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};fe.get(Be).sendSafe(new Ce(P.EVENT_VIEW_CART,n))}};var So=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=ci[e]?.toLowerCase();r&&(w.verbose(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var lt=class t{static replaySubject=new xs(1);static INSTANCE;backendAPIService=Ot.getInstance();coreService=yl.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async populateAuthDataFromStorage(){await this.getOrSetDeviceIDSafe(),this.sdkToken=await ze.get(Ee.SDK_TOKEN),this.userID=await ze.get(Ee.ID),this.sdkToken||w.info("No SDK auth token found"),this.updateAPIClient()}isAuthenticated(){return!!this.deviceID&&!!this.sdkToken}authenticate(e){if(w.verbose("Initialising SDK",e),wy(navigator.userAgent)){w.info("This seems to be a bot. Disabling SDK");return}this.appID=e.appID,this.shopifyShop=e.shopifyShop,this.checkForNewSessionOnPageLoad().then(async()=>{t.replaySubject.next(!0),t.replaySubject.complete()}).catch(r=>{w.error("Unable to initiate session",r)})}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await ze.set(Ee.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await ze.set(Ee.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await ze.set(Ee.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async checkSessionAndGetContext(){return await this.checkForNewSessionUnsafe(!1),this.getContext()}async checkForNewSessionOnPageLoad(){await this.checkForNewSessionSafe(!0)}async getOrSetDeviceIDSafe(){await ss.request("gen_did",async()=>{let e=await ze.get(Ee.DEVICE_ID);e||(e=new bt().toHexString(),await ze.set(Ee.DEVICE_ID,e)),this.deviceID=e,w.info("Device ID:",this.deviceID)})}async getContext(){vt.set(Ee.SESSION_LAST_USED_TIME,new Date().getTime());let[e,r,n]=await Promise.all([vt.get(Ee.ID,""),ze.get(Ee.SESSION_NUMBER,1),vt.get(Ee.SESSION_LANDING_PAGE,{})]);return Mi({"cooee_session.number":r}),Ya("Visitor Session",{id:e,number:r,landing_page:n}),{sessionID:e,sessionNumber:r,landingPage:n}}async checkForNewSessionSafe(e){await ss.request("validate_session",async()=>{await this.checkForNewSessionUnsafe(e)})}async checkForNewSessionUnsafe(e){let r=!1;if(await this.isNewSessionRequired()?(w.info("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();w.info(`Session ID: ${n.sessionID} & number: ${n.sessionNumber}`),await this.validateSessionFromServer(re(_({},n),{newSession:r})),await vt.set(Ee.SESSION_SYNCED,!0)}}async startNewSession(){w.verbose("Starting new session"),await vt.clear(),w.verbose("Cleared SessionStorage before starting new session");let e=new Date,r=new bt().toHexString();w.verbose("New session ID to be used",r);let n=await ze.get(Ee.SESSION_NUMBER,0)+1;await Promise.all([ze.set(Ee.SESSION_NUMBER,n),vt.set(Ee.ID,r),vt.set(Ee.SESSION_LAST_USED_TIME,e.getTime()),vt.set(Ee.SESSION_LANDING_PAGE,Zs())])}async isNewSessionRequired(){if(!await vt.get(Ee.ID))return!0;let e=await vt.get(Ee.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>P.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await vt.get(Ee.SESSION_SYNCED,!1)}async getSessionValidateData(e){let r=await new cl().safeGet(),n=await al();return re(_(_({deviceID:this.deviceID,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),n),{sdk:P.SDK,ad:sl.getAdParams(),occurred:this.getSessionStartTime(de.get().jsLoadTime),properties:{}})}async validateSessionFromServer(e){w.verbose("Validating session with server"),await this.populateFirstSeen();let r=await this.getSessionValidateData(e);try{let n=await this.backendAPIService.validateSession(r),i=n.data;w.info(`Auth finished in \u23F0 ${Xr(n.timeTakenMs)}`),w.verbose("Validate session Response",i),await this.coreService.processAppConfigurations(i.appSettings),await this.storeAndPopulateAuthData(i)}catch(n){throw w.error(n),n}}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>P.IDLE_TIME_IN_SECONDS?new Date:e}async populateFirstSeen(){let e=await ze.get(Ee.FIRST_SEEN),r=e?new Date(e):new Date;e||await ze.set(Ee.FIRST_SEEN,r.toISOString()),this.backendAPIService.setFirstSeen(r),Ya("Visitor Info",{first_seen:r.toISOString()})}updateAPIClient(){w.verbose("SDK Token:",this.sdkToken),this.userID&&w.info("User ID:",this.userID),So.trackDeviceID(this.deviceID),this.backendAPIService.setAPIToken(this.sdkToken),this.backendAPIService.setDeviceId(this.deviceID),Ya("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),nh({id:this.deviceID})}};var vl=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(r=>{r instanceof kr&&this.loadFamily(r.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let r=[];e.fonts.forEach(i=>{if(i.url){let o=new FontFace(P.COOEE+e.name,i.getURL(),i.getFontDescriptor());r.push(o.load())}}),this.loadedFonts.push(e.name),(await Promise.all(r)).forEach(i=>{document.fonts.add(i)})}};var El=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),w.verbose("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var _l=class{action;triggerContext;constructor(e,r){this.action=e,this.triggerContext=r}async execute(){let e=this.containsCTA()?P.EVENT_TRIGGER_CLICKED:P.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(e),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:await this.collectFormData();break;case void 0:case 105:break;default:w.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;Ka(e)||(e=`//${e}`),window.open(e,"_self")}}async closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),await this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){w.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(r=>console.log(r)).catch(r=>console.error(r))}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}async collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let i=document.getElementById(r.id).value;r.type===51?e.email=i:r.type===52&&(e.mobile=i)}await this.closeTriggerAndSendEvent(P.EVENT_FORM_SUBMITTED,{form:e}),this.action.applyDiscount&&br("Coupon applied on cart"),El.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new Bn().process(r);let n={action:this.containsCTA()?P.CAMPAIGN_CLICKED_ACTIVITY:P.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(P.POPUP_ACTIVITY_EVENT,{detail:n}))}};var mr=class{renderer=kn.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new _o(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=re(_(_(_(_({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});hi(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&oe(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&oe(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let e={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};hi(this.inappHTMLEl,e)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let r=(e/100).toFixed(2);oe(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?oe(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):oe(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new $n(this.inappElement.trf);e&&e.rotate&&oe(this.inappHTMLEl,"transform",`rotate(${e.rotate}deg)`)}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation(),new _l(e,this.triggerContext).execute()}),oe(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var qr=class extends mr{constructor(e,r,n){super(e,r,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let e={},r=this.inappElement.typography;return r&&(e.fontSize=this.stylesConverter.getSizePx(r.fs),e.fontFamily=P.COOEE+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),hi(this.inappHTMLEl,e),e}processPart(e,r){let n=[];r.u&&n.push("underline"),r.st&&n.push("line-through"),n.length||n.push("normal"),oe(e,"font-weight",r.b?"bold":"normal"),oe(e,"font-style",r.i?"italic":"normal"),oe(e,"text-decoration",n.join(" ")),oe(e,"color",r.c??"inherit"),oe(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?Ii[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),oe(this.inappHTMLEl,"text-align",r)}};var Gs=class extends qr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=document.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.inappHTMLEl.appendChild(r)}),this.processCommonBlocks()}};var Ys=class extends mr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var Ei=class extends mr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),oe(this.inappHTMLEl,"max-width","none"),oe(this.inappHTMLEl,"max-height","none"),oe(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var zs=class t extends mr{constructor(r,n,i){super(r,n,i);this.parent=r;this.inappHTMLEl=document.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(P.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),oe(this.inappHTMLEl,"z-index",t.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let r=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(oe(this.inappHTMLEl,"width","100%"),oe(this.inappHTMLEl,"height","100%")):(oe(this.inappHTMLEl,"width","100vw"),oe(this.inappHTMLEl,"height","100vh")),oe(this.inappHTMLEl,"top","0"),oe(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,i=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),o=this.stylesConverter.getScaledSize(r.h)+n.getVertical();oe(this.inappHTMLEl,"width",i+"px"),oe(this.inappHTMLEl,"height",o+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return _(_({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?oe(this.inappHTMLEl,"position","absolute"):oe(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var bl=class extends mr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),oe(this.inappHTMLEl,"position","relative"),oe(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(P.IN_APP_CONTAINER_NAME),this}};var wl=class t extends qr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=re(_(_(_({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=>hi(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(t.DAYS)),e.hour&&this.elements.push(this.getChild(t.HOURS)),e.minute&&this.elements.push(this.getChild(t.MINUTES)),e.second&&this.elements.push(this.getChild(t.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=document.createElement("div"),n=document.createElement("span"),i=document.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,oe(i,"font-size","0.5em"),oe(i,"text-align","center"),oe(i,"font-family","inherit"),oe(n,"text-align","center"),oe(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),oe(r,"display","flex"),oe(r,"flex-direction",this.inappElement.horizontal?"":"column"),oe(r,"justify-content","center"),oe(r,"align-items","center"),oe(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${t.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${t.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${t.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${t.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}};var Sl=class extends qr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){oe(this.inappHTMLEl,"background","#ffffff00"),oe(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener("click",r=>{r.stopPropagation()}),e.addEventListener("change",()=>{let r=new Ur(JSON.parse(e.value));this.updateItems(r)})}updateItems(e){let r=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[r.toEmbed(e)];let n=this.parentHTMLEl.querySelector("#coo-13");if(!n)return;let i=e.imgs[0]??r.imgs?.at(0);i?.url&&n.setAttribute("src",i.url)}addOptions(){let e=this.triggerContext.triggerData.items,r=this.inappHTMLEl;if(!e?.length){r.add(this.createOption(this.inappElement.placeholderText));return}let n=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(i=>{r.add(this.createOption(i.name??"Default",i,i.mID===n?.vID))})}createOption(e,r,n){let i=document.createElement("option");return i.text=e,i.value=JSON.stringify(r),n&&(i.selected=!0),r||(i.disabled=!0),i}};var Io=class extends qr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("input"),this.insertElement()}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute("placeholder",this.inappElement.placeholderText),oe(this.inappHTMLEl,"background","#ffffff00"),oe(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t)}};var Il=class t extends Io{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","email"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.EMAIL_REGEX)?(oe(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(oe(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Tl=class t extends Io{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","tel"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.MOBILE_REGEX)?(oe(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(oe(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var xl=class extends Ei{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var kn=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static ACTIVE_TRIGGER_DATA;static _instance;eventAPIService;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.eventAPIService=Be.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}static get(){return t._instance}render(e){this.renderEngagement(new Ct(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,o=e.spc,s=this.getWidth(),a=this.getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=o.getHorizontal(),a-=o.getVertical(),s/a<n/i?this.scalingFactor=s/n:this.scalingFactor=a/i,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&oe(this.parent,"position","relative")}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Cr(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(Ir()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!nt.get().isOpen()||!Ir()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){t.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,t._instance=this;try{this.startRendering()}catch(e){Te(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),Ir()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&t.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Rn(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(de.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=P.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new zs(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw w.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new Ce(P.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.eventAPIService.sendSilently(r);let n={action:P.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(P.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new Ce(r,e,this.triggerContext.triggerData);n.name===P.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.eventAPIService.sendSilently(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof qi?new Il(e,r,n).render():r instanceof Ki?new Tl(e,r,n).render():r instanceof Sn?new Gs(e,r,n).render():r instanceof Xi?new xl(e,r,n).render():r instanceof ln?new Ei(e,r,n).render():r instanceof Zn?new Ys(e,r,n).render():r instanceof Yi?new wl(e,r,n).render():r instanceof zi?new Sl(e,r,n).render():w.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new bl(this.rootContainer,r,e).render().getHTMLElement(),new vl().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),t.ACTIVE_TRIGGER_DATA=void 0;let n=this.containerHTMLElement.animate(r,{duration:500,easing:"ease-in-out"});n.onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e)}skipTrigger(e,r){let n=new Ce(P.EVENT_CAMPAIGN_REJECTED,r,e);this.eventAPIService.sendSilently(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let o=i.bg?.img?.src;if(o&&n.push(this.getPromise(o)),i.t===1){let s=i.src;if(!s)return;n.push(this.getPromise(s))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}};var Cl=class{triggerData;eventAPIService=Be.getInstance();backendAPIService=Ot.getInstance();render(e){e.contentSource===Mo.KLAVIYO&&(this.triggerData=e,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",e.klaviyoFormID]))}handleKlaviyoEvents(e){if(e.type!=="klaviyoForms")return;let r=e.detail;if(r.formId!==this.triggerData.klaviyoFormID){w.warn("Received invalid trigger callback");return}switch(r.type){case"open":this.eventAPIService.sendSilently(new Ce(P.EVENT_TRIGGER_DISPLAYED,{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);this.eventAPIService.sendSilently(new Ce(P.EVENT_FORM_SUBMITTED,{form:n},this.triggerData)),this.backendAPIService.updateProfileSafe(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.eventAPIService.sendSilently(new Ce(P.EVENT_TRIGGER_CLOSED,{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(tr.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{i.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};var Rl=class{static trackIntent(e){if(!this.isInstalled()){w.verbose("Facebook pixel not installed");return}if(!Qe.get().pixelPush){w.verbose("Facebook pixel push not enabled");return}let n=ci[e.intent]?.toLowerCase(),i=e.segmentName;!n&&!i||(w.verbose(`Sending ${n} intent and ${i} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:n,segment_value:e.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}};var Be=class t extends Un{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendSafe(e){w.verbose(`Waiting for auth to send event ${e.name}`),pr(lt.replaySubject).then(()=>this.sendSilently(e))}sendSilently(e){this.send(e).catch(r=>w.error(`Failed to send ${e.name}`,r))}async send(e){if(w.verbose(`Sending event: ${e.name}`,e),this.shouldReject(e)){w.warn(`Rejecting event ${e.name}`);return}this.addShopifyAttributes();let r=await this.getAllContext();Object.assign(e,r),e.name!==P.EVENT_APP_BACKGROUND&&this.runtimeData.setActive(),this.backendAPIService.post("/v1/event/track",e).then(async n=>{w.info("\u2705 Event tracked:",this.userFriendlyName(e.name)),this.processEventResponse(e,n.data)}).catch(n=>{w.error(`Error sending event ${e.name} to server`,n)})}userFriendlyName(e){return e.replace("CE ","").replace("Trigger","Engagement").replace("Screen","Page").replace("App ","")}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(w.warn("Not sending event as this is a test trigger"),!0):!1}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{Te(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData)return;let n=new Ct(r.triggerData);n.occurred=e.occurred,w.log(`${n} will be shown`);let i;try{i=await Eo.refreshItems(n)}catch(o){w.error("Failed to refresh the products",o);return}if(n.items=i,n.contentSource===Mo.KLAVIYO){new Cl().render(n);return}new kn().renderEngagement(n).catch(o=>{Te(o,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(So.trackIntent(e.intent),Rl.trackIntent(e),w.info(`Intent is ${ci[e.intent]}`))}addShopifyAttributes(){we.getCurrent().addCooeeAttributes().catch(e=>{w.error("Fail to add attributes in cart",e)})}};var Yr=class{constructor(e){this.triggerContext=e}backendAPIService=Ot.getInstance();eventAPIService=Be.getInstance();async execute(e){let r=de.get().getCurrentItem(),n=e.clickAction;if(!n)return;let i=e.item,o=this.triggerContext,s=o.triggerData,a=new Bn,c=o.triggerData.redirectBehaviour,p=!!o.triggerData.discount?.type&&!!n?.applyDiscount,d={selectedVariants:o.triggerData.nonMutableItems.map(O=>({itemMID:O.mID,mID:O.selectedOrFirstVariant.value.mID,variantID:O.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},f="",E=[],y=[];if(i?y=[i.toEmbed()]:e.embeddedItem&&(y=[e.embeddedItem]),n.at===108){let O=o.selectedItems;if(y=e.embeddedItems??O.map($=>$.toEmbed()),o.shouldGiveFBTDiscount||e.embeddedItems?.length){let $;e.embeddedItems?$=e.embeddedItems.map(q=>({itemMID:q.mID,mID:q.vID,variantID:q.vID,quantity:q.quantity})):$=O.map(q=>({itemMID:q.mID,mID:q.selectedOrFirstVariant.value.mID,variantID:q.selectedOrFirstVariant.value.mID}));let B=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&B&&($.push({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID,isPrimary:!0}),y.unshift(B.toEmbed())),d.selectedVariants=$,o.triggerData.isBundleOnPDP()&&d.selectedVariants.forEach(q=>{q.mID===r.vID&&(q.isPrimary=!0)})}else d=void 0;E=e.embeddedItems??O}else if(n.at===107){let O=await we.getCurrent().getNormalisedCart();y=O.items,d.selectedVariants=O.items.map($=>({itemMID:$.mID,mID:$.vID}))}else if(n.at===102)E=i?[i]:[e.embeddedItem];else if(n.at===101)f=i?Wi("/products/"+i.slug):e.embeddedItem?.link;else if(n.at===4){let O=Ka(n.gu?.u);O&&(f=O.href)}else if(n.at===109){let O=await a.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),nt.get().refreshUI(O)}else if(n.at===104){let O=this.triggerContext.triggerData.collections?.[0];O&&(f="collections/"+O.handle)}if(this.sendTriggerClicked(y,{from:"button"},e.video),f=sm(f,s),w.verbose({redirectPath:f,redirectBehaviour:c,hasDiscount:p}),!p&&f){location.href=f;return}let I,D=!1;try{I=await this.getOrGenerateDiscountCode(d),w.verbose("Discount code (if any) to apply",I)}catch(O){if(!this.triggerContext.triggerData.isBYOB()){Ay.default.error("Unable to get a discount code",O);return}}if(I&&n.at===103)await a.copyDiscountCode(I);else if(n.at===110){let O=await a.createNewCart(r,I,o.triggerData);O&&(location.href=O);return}try{I&&await zr.applyWithStorefront([I])}catch(O){w.error(O),D=!0}let k;if(E?.length&&(k=await a.addToCart(E,o.triggerData)),D&&I){zr.navigate(I,c,f);return}if(f){location.href=f;return}zr.navigateWithoutDiscount(c,k)}sendTriggerClicked(e,r,n){let i=new Ce(P.EVENT_TRIGGER_CLICKED,r,this.triggerContext.triggerData);i.items=e,n?.id&&(i.videos=[n.id]),this.eventAPIService.sendSilently(i)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===Zt.STATIC){if(!r.code)throw rh("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await this.generateDiscount(e),!n)throw w.error("No discount code found",e),new Error("Discount code not found or generated");return n}}async generateDiscount(e){try{return(await this.backendAPIService.generateDiscount(e)).data.code}catch(r){throw br("Failed to generate a discount code"),Te(r,"backend-generate-discount",{triggerContext:this.triggerContext}),r}}};var Al=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=fe.get(Fn)}execute(e){for(let r of e){if(!r.experimentConfig)continue;this.executeExperiment(r)&&this.trackExperimentRan(r)}if(document.querySelector("#lc-hide-body")?.remove(),!document.body){Ca("No body element found","error");return}this.setupMutationObserver()}executeExperiment(e){let r=e.experimentConfig?.modifications;return r?.length?r.some(n=>{if(!n.cssSelector)return w.verbose("No CSS Selector available",e?.toString()),!1;this.modifications.push(n);let i=Array.from(document.querySelectorAll(n.cssSelector));return i?.length?(this.executeSingleModification(n,i),!0):!1}):(w.log("Nothing to experiment",e.toString()),!0)}executeSingleModification(e,r){if(r?.length)for(let n of r)Object.assign(n.style,e.style),e.type==="TEXT"&&e.text?n.innerHTML=e.text:e.type==="IMAGE"&&this.updateImage(e,n)}trackExperimentRan(e){if(e.id==="preview"){w.warn("Skipping experiment attribution as its preview",e.toString());return}this.eventAPIService.trackExperiment({name:P.EVENT_EXPERIMENT_START,experiment:new Rn(e)}).catch(r=>{w.error("Fail to track experiment",r)})}setupMutationObserver(){new MutationObserver(r=>{r.forEach(n=>{n.addedNodes.forEach(i=>{i instanceof HTMLElement&&this.modifications.forEach(o=>{i.matches&&i.matches(o.cssSelector)?(w.verbose("Re-applying experiment",o.toString()),this.executeSingleModification(o,[i])):i.querySelectorAll&&(w.verbose("Re-applying experiment",o.toString()),this.executeSingleModification(o,Array.from(i.querySelectorAll(o.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}updateImage(e,r){let n=e.image?.lg?.src,i=e.image?.sm?.src;!n&&!i||(r instanceof HTMLPictureElement?this.updatePictureElement({desktop:n,mobile:i},r):this.updateImageElement({desktop:n,mobile:i},r))}updateImageElement(e,r){Ir()&&e.mobile?(r.setAttribute("src",e.mobile),r.removeAttribute("srcset")):e.desktop&&(r.setAttribute("src",e.desktop),r.removeAttribute("srcset"))}updatePictureElement(e,r){if(r.innerHTML="",e.mobile){let i=document.createElement("source");i.srcset=e.mobile,i.media="(max-width: 767px)",r.append(i)}if(e.desktop){let i=document.createElement("source");i.srcset=e.desktop,i.media="(min-width: 768px)",r.append(i)}let n=document.createElement("img");n.src=e.desktop??e.mobile??"",r.append(n)}};var Fn=class t extends Un{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}fetchExperimentsSilently(){this.fetchExperimentsSafe().catch(e=>Te(e,"fetch-experiments"))}async trackExperiment(e){let r=await this.getAllContext(),n=_(_({},e),r);await this.backendAPIService.post("/v1/event/experiment",n)}async fetchExperimentsSafe(){if(!this.runtimeData.activeExperiments)return;lt.getInstance().isAuthenticated()?await this.fetchExperiments():(await pr(lt.replaySubject),await this.fetchExperiments())}async fetchExperiments(){w.info("Fetch experiments after \u23F0",de.get().getJSLoadTimeDiff()+" of DOM load");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/experiments",r).then(async n=>{w.info(`Experiments fetched in \u23F0 ${Xr(n.timeTakenMs)}`);let i=n.data.experiments.map(o=>new Ct(o));new Al().execute(i)}).catch(n=>{w.error("Error sending experiment getter",n)})}};var Dl=class{runtimeData=de.get();widgetAPIService=fe.get(Tr);experimentAPIService=fe.get(Fn);meddle(){let e=Ue.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Ue.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSafe()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSafe()},e.loadExperiments=()=>{this.experimentAPIService.fetchExperimentsSilently()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Ue.previewWidget.bind(Ue),e.previewPopup=Ue.previewPopup.bind(Ue)}overwritePush(e,r){an(e,"push",r)}meddleAccount(){this.overwritePush(Ue.globalRef.account,(...e)=>{this.processAccount(e[0])}),Ue.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Ue.globalRef.events,(...e)=>{this.processEvent(e[0])}),Ue.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Ue.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Ue.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Ue.authenticate(e),e.flags&&di.setFlags(e.flags))}processEvent(e){e&&(P.JS_LOAD_WHITELIST_EVENTS.includes(e[0])?Ue.sendEvent(e[0],e[1],_({occurred:this.runtimeData.jsLoadTime},e[2])):Ue.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Ue.updateProfile(e)}processPageName(e){e&&Ue.setPageName(e)}meddlePage(){this.overwritePush(Ue.globalRef.page,(...e)=>{this.processPage(e[0])}),Ue.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&this.runtimeData.setCurrentItem(e.currentItem),e.currency&&(this.runtimeData.currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&Ue.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.customContext&&(this.runtimeData.customContext=_(_({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(this.runtimeData.pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=window.ShopifyAnalytics?.meta??{},r=e.selectedVariantId;if(r||(e.product?.variants?.length>0&&(r=e.product.variants[0].id),r||(r=this.runtimeData.getCurrentItem()?.vID)),!r){window.alert("Could not find a variant to test. Please try a different product page");return}let n=new Ct({id:"preview",shortID:"1",redirectBehaviour:er.CART_DRAWER});await new Yr(new Cr(new Date,n)).execute({clickAction:{at:102},embeddedItem:new At({vID:r})})}};var To=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=P.COOEE.concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var xo=class t{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}resetScrollID(e){To.remove(P.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}Bi(()=>{this.observeWindowScroll()})}observeWindowScroll(){mi(window,"scroll").pipe(fr(t.DEBOUNCE_TIME),mn(()=>{let e=this.getPercentScrolledY();if(e>100){w.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=t.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=To.getString(P.SESSION_STORAGE_SCROLL_ID,""),i=new Ce(P.EVENT_SCROLL,r,null,n);fe.get(Be).sendSafe(i),To.setString(P.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}};var Nl=class t{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";runtimeData=de.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){w.info("Not sending background event as user was inactive on website");return}w.info(`Sending background event with ${e} seconds`);let r={};r[t.ACTIVE_DURATION]=e,fe.get(Be).sendSafe(new Ce(P.EVENT_APP_BACKGROUND,r))}};var Ol=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=async function(n,i){try{await e.modifyRequest(n,i)}catch(o){Te(o,"modify-graphql-request",{extra:{body:JSON.stringify(i?.body)}})}return r(n,i)},w.verbose("Securely overwritten window.fetch method for graphql query")}async modifyRequest(e,r){let n=typeof e=="string"?e:e instanceof Request?e.url:"";if(!(n.includes("graphql.json")&&r?.method==="POST")||!r.body)return;let i;if(typeof r.body=="string")try{i=JSON.parse(r.body)}catch{return}else i=r.body;i?.variables?.input&&(w.verbose("Intercepted fetch request of:",n),i?.query.includes("cartCreate")&&(r.body=await this.updatedBody(i),this.sendBuyNowEvent()))}async updatedBody(e){let r=e.variables.input.attributes??[],n=await Xa();return e.variables.input.attributes=[...r,...n],JSON.stringify(e)}sendBuyNowEvent(){let e=de.get().getCurrentItem();if(!e)return;let r=new Ce(P.EVENT_BUY_NOW_CLICKED,{items:[e]});fe.get(Be).sendSafe(r)}};var Co=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new Ce(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});fe.get(Be).sendSafe(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>w.error(e))}async listen(){this.elements=await Tp(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Pl=class t extends Co{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(t.selectors,P.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Ll=class t extends Co{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(t.selectors,P.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Ml=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(){Bi(()=>{w.verbose("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let e=window.location.hash?.substring(1);if(e)if(e.includes(P.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(P.THIRD_PARTY_CHECKOUT_EVENT));let r=document.querySelector(this.selector);if(!r){w.verbose("No clickable cart checkout button found");return}w.verbose("Clickable cart checkout button found",r),r.click()}else e.includes(P.HASH_OPEN_CART_DRAWER)&&nt.get().open()}};var qs=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let e=await we.getCurrent().getNormalisedCart(),r={via:"GoKwik",items:e.items,cartToken:e.token,amount:{value:e.amount,currency:e.currency}},n=new Ce(P.EVENT_CHECKOUT_STARTED,r);fe.get(Be).sendSafe(n)})}};var Bl=class{static watch(){let e=zl();(e==="1"||e==="on")&&Ot.getInstance().updateDevicePropsSafe({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar()}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,Bi(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}};var Ul=class{async migrate(){}};var Ue=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new Ul().migrate(),await fe.get(lt).populateAuthDataFromStorage(),this.autoAuthenticate(),new Dl().meddle(),am(),fe.get(Fn).fetchExperimentsSilently(),new Nl().listen(),new gi().listen(),new Ol().listen(),new Ml().listen(),fe.get(xo).listen(),fe.get(Ll).listenSilently(),fe.get(Pl).listenSilently(),fe.get(Tr).loadPageWidgetsSafe(),this.attachGoKwikListeners(),this.setupPreviewListeners(),Bl.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||an(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,an(this.globalRef,"config",new Qe),an(this.globalRef,"runtimeData",new de),an(this.globalRef,"uaParser",new jr),an(this.globalRef,"cartChange$",gi.cartChange$.asObservable()),an(this.globalRef,"cartDrawerToggle$",nt.cartDrawerToggle$.asObservable()),w.verbose("Global reference initialised")}static injectWidgetAssets(){Ig(Gt.widgetURL,"cooee-widget-sdk"),Uc(Gt.styleURL)}static autoAuthenticate(){let e=jh();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;w.info("Begin auth after \u23F0",de.get().getJSLoadTimeDiff(),"of DOM load");let r=e.appID?.trim(),n=e.shopifyShop;if((Sp(r)||r.length!==24)&&Sp(n)){w.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,fe.get(lt).authenticate(e)}static sendEvent(e,r,n){let i=new Ce(e,r,n?.triggerData);n?.occurred&&(i.occurred=n.occurred),fe.get(Be).sendSafe(i)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");fe.get(Ot).updateProfileSafe(e)}static setPageName(e){if(!e)return;let r=de.get(),n=r.pageName;if(e===n)return;if(r.pageName=e,e==="cart"&&fe.get(Tr).loadOrRenderWidgetsAfterCartChange(),P.BLACKLISTED_PAGE_NAMES.some(s=>e.includes(s))){fe.get(xo).resetScrollID();return}let i={};n&&(i.ps=n);let o=new Ce(P.EVENT_SCREEN_VIEW,i);o.occurred=r.jsLoadTime,fe.get(Be).sendSafe(o),fe.get(xo).resetScrollID(o.occurred)}static previewPopup(e,r){new kn(r).render(e)}static previewWidget(e){new Rt(new Ct(e)).renderSilently()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(e){w.error(e)}window.addEventListener("message",e=>{if(w.verbose("Received event",e),!e.origin.includes("letscooee.com")&&!e.origin.includes("localhost"))return;let r=e.data;typeof r=="object"&&(r.action==="POPUP_PREVIEW"?(this.previewPopup(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)):r.action==="WIDGET_PREVIEW"&&(this.previewWidget(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)))})}}static attachGoKwikListeners(){let e=de.get();window.addEventListener("kp-modal:opened",()=>{e.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",r=>{let{token:n}=r.detail;n&&this.updateProfile({goKwikToken:n})}),window.gokwikSdk?qs.attachCheckoutListener():window.addEventListener("gokwikLoaded",qs.attachCheckoutListener)}};nm();im();w.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(w.verbose("Execution order:","IIFE start"),await Ue.initForMerchantWebsiteOnly(),await Ue.initForAll(),w.verbose("Execution order:","IIFE end")))());w.verbose("Execution order:","bottom");
75
+ `,Mn=class{async addToCart(e,r){if(!e.length)return;let i={items:e.map(s=>{let{vID:a,quantity:c}=this.getVIDAndQuantity(s);return{id:a?+a:+s.mID,quantity:c,properties:r.getPrivateAttributesForLineItem()}})},o=tt.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{i.sections_url=window.location.pathname,i.sections=window.cooeeGetCartSections()}catch(s){be(s,"execute-cooeeGetCartSections",{engagementTrigger:r})}else o.isMiniCart()?i.sections=["mini-cart"]:o.isShopifyDefaultDrawer()&&(i.sections=o.element.getSectionsToRender?.().map((s=>s.section??s.id)));try{let s=await Gi("/cart/add.js",i,"cart-item-add",r);return b.log(`Added ${e.length} items to Cart`),wr("Product added to your cart"),s.data}catch(s){let a=["Failed to add product in cart."];if(s instanceof $n&&s.is40x()&&s.responseText){let c=s.responseText;c.description&&a.push(`Reason: ${c.description}`)}a.push("Please try again later."),wr(a.join(" "))}}async updateLineItem(e,r){if(!tr.hasKeys(r)){b.warn("No update fields provided");return}let n=_({id:e.key},r);try{let i=await Gi("/cart/change.js",n,"cart-item-update");b.log(`Updated ${e}`),ye.getCurrent().update(i.data)}catch{wr("Failed to update item in cart")}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),b.log(`Code-${e} copied`),wr("Discount code copied")}catch(r){b.error("Failed to copy code",r)}}getProductURL(e){if(!e?.link)return;let r=ag(e.link);if(r)return ji("/products/"+r)}async upgradeToSubscription(e,r){if(!e){b.warn("Trying to upgrade to subscription with no item");return}let n=await ye.getCurrent().getNormalisedCart(),i=e.selectedOrFirstVariant.value,o=n.items.findIndex(c=>c.vID===i.mID),s=i.selectedSellingPlan.value,a={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()};try{let c=await Gi("/cart/change.js",a,"cart-switch-subscription",r);return b.log(`Upgraded ${e} selling plan`),wr("Line item updated"),ye.getCurrent().update(c.data),c.data}catch{wr("Failed to update subscription")}}async createNewCart(e,r,n){if(!e?.vID){b.error("No variant ID found to perform Buy now",e);return}let i=r?[r]:[],o=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],s=await ec();return(await hc(i0,{input:{lines:o,discountCodes:i,attributes:s}},"storefront-create-cart")).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let r=e.clickAction,n=e.items,i=e.triggerData,o;if(r.at){let s=r;if(b.log(`Performing ${JSON.stringify(s)} action`),s.at===101)o=this.getProductURL(n[0]);else if(s.at===102)n?.length&&await this.addToCart(n,i);else if(s.at===103)await this.copyDiscountCode(i.discount?.code);else if(s.at===105)tt.get().open();else if(s.at===104){let a=e.collections;if(!a?.length)return;o=ji("/collections/"+a[0].handle)}}r.applyDiscount&&i.discount?.code?Yr.navigate(i.discount.code,i.redirectBehaviour,o):o&&(location.pathname=o)}getVIDAndQuantity(e){let r,n;if(e instanceof Ct)r=e.vID,n=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=1}return{vID:r,quantity:n}}};var Al=class extends _t{ctaExecutor=new Mn;constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.widgetElement.update()}isAllOkToRender(){return!!this.engagementTrigger.progressBarConfig}startRendering(){if(this.widgetElement?.isConnected){this.widgetElement.update(),this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){be(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await ye.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n,i=[],o=[],s=[],a,c,p=[...r.milestones];for(let f of p){if(f.rewardType!==fu.FREE_AUTO_GIFT)continue;if(f.isUIOnly&&!f.allowATC){b.verbose(`Skipping milestone ${f.label} as it is UI only and does not allow ATC`);continue}let E=f.items[0],y=f.reached,I=e.items.find(D=>(D.vID===E.vID||D.mID===E.mID)&&D.properties._letscooee_campaign===this.engagementTrigger.shortID);y&&(a=f,c=I),I&&i.push(I),!y&&I&&r.removeIneligibleItem?(b.verbose(`Removing free gift ${I.vID} from cart`),s.push(I)):y&&!I&&(b.verbose(`Adding free gift ${E.vID} to cart`),o.push(E))}r.restrictToLatestFreebie&&a&&(c?(i=i.filter(f=>f.vID!==c.vID),o=[]):o=[a.items[0]],s.push(...i)),s.length&&await this.removeFreeGifts(s),o.length&&(n=await this.ctaExecutor.addToCart(o,this.engagementTrigger));let d=r.coupons;if(d?.length)try{await Yr.applyWithStorefront(d.map(f=>f.couponCode)),tt.get().refreshUI(n,!1)}catch(f){be(f,"cart-apply-discount",{extra:{coupons:d},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(e){await Promise.all(e.map(r=>this.ctaExecutor.updateLineItem(r,{quantity:0})))}};var zs=class extends _t{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.widgetElement.update()}isAllOkToRender(){return!!this.engagementTrigger.content}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var Dl=class extends xt{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var Ol=class extends xt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var Nl=class extends xt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener("letscooee:inbound:cta:add-bundle",this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,i=e.detail;if(!tr.hasKeys(i)){b.error(`No detail received for ${n}`);return}b.log("Detail received for BYOB",i);let o=i.campaignID??i.campaignId??i.campaign_id;if(o!==r.shortID&&o!==r.engagementID){b.warn(`Current ${n} is not BYOB. Received: ${o}`);return}let s=i.items;if(!s?.length)return;let a=s.map(c=>new Ct({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new Gr(this.triggerContext).execute({embeddedItems:a,clickAction:{at:108,applyDiscount:!0}})}};var To=class{runtimeData=pe.get();processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let r=[..._t.renderedEngagements];_t.renderedEngagements.clear();for(let n of e){b.info(`${n} received as cart embed`);let i=this.isAlreadyRendered(n,r);if(i>-1){this.rerender(i,n,r);continue}b.verbose(`${n} is new`),n.isProgressBar()?new Al(n).renderSilently():n.isSubscriptionUpsell()?Rl.renderCartUpsell(n):n.isSavingsBar()?new zs(n).renderSilently():new _t(n).renderSilently()}this.removeOldWidgets(r)}processPageWidgetResponse(e){let r=[...xt.renderedEngagements];xt.renderedEngagements.clear();for(let n of e){b.info(`${n} received as page embed`);let i=this.isAlreadyRendered(n,r);if(i>-1){this.rerender(i,n,r);continue}b.verbose(`${n} is new`),n.isShoppableVideo()?new Dl(n).renderSilently():n.isBYOB()?new Nl(n).renderSilently():n.isStickyATC()?new Ol(n).renderSilently():n.isSavingsBar()?new zs(n).renderSilently():new xt(n).renderSilently()}this.removeOldWidgets(r)}isAlreadyRendered(e,r){let n=r.findIndex(i=>i.isSameTrigger(e));return n<0||e.isSubscriptionUpsell()?-1:n}async rerender(e,r,n){let[i]=n.splice(e,1);if(i)try{await i.updateAndReRender(r)}catch(o){be(o,"update-and-re-render",{engagementTrigger:r})}}removeOldWidgets(e){for(let r of e)r.destroy()}};Yy(document.body,{childList:!0,subtree:!0},500,Gy).subscribe(()=>{xt.renderedEngagements.forEach(e=>e.rerender()),_t.renderedEngagements.forEach(e=>e.rerender())});var Bn=class{runtimeData=pe.get();backendAPIService=le.get(Dt);sessionManager=le.get(at);constructor(){}async getAllContext(){let[e,r]=await Promise.all([Il(),this.sessionManager.checkSessionAndGetContext()]);return _(_({},e),r)}};var xr=class t extends Bn{static INSTANCE;loadPageWidgetsSubject=new Wt;loadCartWidgetsSubject=new Wt;pageWidgetLoadCount=0;constructor(){super();let e=this.loadPageWidgetsSubject.pipe(bo(n=>n)),r=this.loadPageWidgetsSubject.pipe(bo(n=>!n),fr(500));Qf(e,r).subscribe(()=>{this.loadPageWidgetsFromServer().catch(n=>b.error("Unable to initiate load page widgets",n))}),this.loadCartWidgetsSubject.pipe(fr(500)).subscribe(()=>{this.loadCartWidgetsFromServer().catch(n=>b.error("Unable to initiate load cart widgets",n))}),window.CooeeSDK.cartChange$.subscribe(()=>{this.loadWidgetsSilently()})}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSafe(e=!1){pr(at.replaySubject).then(()=>{this.loadPageWidgetsSubject.next(e)})}loadCartWidgetsSafe(){pr(at.replaySubject).then(()=>{this.loadCartWidgetsSubject.next()})}loadWidgetsSilently(){pr(at.replaySubject).then(()=>{this.loadCartWidgetsSafe(),this.loadPageWidgetsSafe()})}async getVariation(e){let r=await this.getAllContext();return Object.assign(e,r),this.backendAPIService.post("/v1/engagement/get-variant",e)}async loadPageWidgetsFromServer(){this.pageWidgetLoadCount++,this.pageWidgetLoadCount===1?b.info("Fetch page widgets (after \u23F0",pe.get().getSDKLoadTimeDiff()+" of SDK load)"):b.info("Fetch page widgets");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/page-widgets",r).then(n=>{b.info(`Page widgets loaded in \u23F0 ${yr(n.timeTakenMs)}`);let i=n.data.widgets.map(o=>new Tt(o));new To().processPageWidgetResponse(i)}).catch(n=>{b.error("Error sending widget getter",n)})}async loadCartWidgetsFromServer(){b.info("Fetch cart widgets");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/cart-widgets",r).then(n=>{b.info(`Cart widgets loaded in \u23F0 ${yr(n.timeTakenMs)}`);let i=n.data.widgets.map(o=>new Tt(o));new To().processCartWidgetResponse(i)}).catch(n=>{b.error("Error sending widget getter",n)})}renderCachedCartWidgets(){new To().processCartWidgetResponse(this.runtimeData.cartEngagements)}};var Pl=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){Us.get("conf",{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){b.verbose("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Us.set("conf",r).catch(n=>b.error(n)),Tl.processConfiguration(),r.website&&($g(r.website.commonJS),Tf(r.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.subscribe(async({open:n})=>{b.info("Cart drawer is now",n?"open":"closed"),n&&(le.get(xr).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Pe.globalRef.config.update(e);return tt.forceUpdate(),b.verbose("App configurations",r),r}async trackViewCartEvent(){let e=await ye.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};le.get(Ne).sendSafe(new Se("View Cart",n))}};var xo=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=ai[e]?.toLowerCase();r&&(b.verbose(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var at=class t{static replaySubject=new As(1);static INSTANCE;backendAPIService=Dt.getInstance();coreService=Pl.getInstance();userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async populateAuthDataFromStorage(){await this.getOrSetDeviceIDSafe(),this.userID=await ze.get("id"),this.updateAPIClient()}isAuthenticated(){return!!this.deviceID}authenticate(e){if(b.verbose("Initialising SDK",e),Fy(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}this.appID=e.appID,this.shopifyShop=e.shopifyShop,this.checkForNewSessionOnPageLoad().then(async()=>{t.replaySubject.next(!0),t.replaySubject.complete()}).catch(r=>{b.error("Unable to initiate session",r)})}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await ze.set("id",e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await ze.set("did",e.deviceID)),this.updateAPIClient())}async checkSessionAndGetContext(){return await this.checkForNewSessionUnsafe(!1),this.getContext()}async checkForNewSessionOnPageLoad(){await this.checkForNewSessionSafe(!0)}async getOrSetDeviceIDSafe(){await yc.request("gen_did",async()=>{let e=await ze.get("did");e||(e=new Et().toHexString(),await ze.set("did",e)),this.deviceID=e,b.info("Device ID:",this.deviceID)})}async getContext(){gt.set("lastUsedTime",new Date().getTime());let[e,r,n]=await Promise.all([gt.get("id",""),ze.get("sessionNumber",1),gt.get("landing",{})]);return Mi({"cooee_session.number":r}),Ja("Visitor Session",{id:e,number:r,landing_page:n}),{sessionID:e,sessionNumber:r,landingPage:n}}async checkForNewSessionSafe(e){await this.checkForNewSessionUnsafe(e)}async checkForNewSessionUnsafe(e){let r=!1;if(await this.isNewSessionRequired()?(b.info("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();b.info(`Session ID: ${n.sessionID} & number: ${n.sessionNumber}`),await this.validateSessionFromServer(Z(_({},n),{newSession:r})),await gt.set("synced",!0)}}async startNewSession(){b.verbose("Starting new session"),await gt.clear(),b.verbose("Cleared SessionStorage before starting new session");let e=new Date,r=new Et().toHexString();b.verbose("New session ID to be used",r);let n=await ze.get("sessionNumber",0)+1;await Promise.all([ze.set("sessionNumber",n),gt.set("id",r),gt.set("lastUsedTime",e.getTime()),gt.set("landing",ia())])}async isNewSessionRequired(){if(!await gt.get("id"))return!0;let e=await gt.get("lastUsedTime",0);return e?(new Date().getTime()-e)/1e3>1800:!0}async notSynced(){return!await gt.get("synced",!1)}async getSessionValidateData(e){let r=await Vy(),n=Il();return Z(_(_({deviceID:this.deviceID,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),n),{sdk:ea,ad:Sl.getAdParams(),occurred:o0(pe.get().jsLoadTime),properties:{}})}async validateSessionFromServer(e){b.verbose("Validating session with server"),await this.populateFirstSeen(),this.backendAPIService.setShopName(this.shopifyShop);let r=await this.getSessionValidateData(e);try{let n=await this.backendAPIService.validateSession(r),i=n.data;b.info(`Auth finished in \u23F0 ${yr(n.timeTakenMs)}`),b.verbose("Validate session Response",i),await this.coreService.processAppConfigurations(i.appSettings),await this.storeAndPopulateAuthData(i)}catch(n){throw b.error(n),n}}async populateFirstSeen(){let e=await ze.get("firstSeen"),r=e?new Date(e):new Date;e||await ze.set("firstSeen",r.toISOString()),this.backendAPIService.setFirstSeen(r),Ja("Visitor Info",{first_seen:r.toISOString()})}updateAPIClient(){this.userID&&b.info("User ID:",this.userID),xo.trackDeviceID(this.deviceID),this.backendAPIService.setDeviceId(this.deviceID),Ja("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),Eh({id:this.deviceID})}};function o0(t){return(new Date().getTime()-t.getTime())/1e3>1800?new Date:t}var Ll=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(r=>{r instanceof kr&&this.loadFamily(r.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let r=[];e.fonts.forEach(i=>{if(i.url){let o=new FontFace("cooee"+e.name,i.getURL(),i.getFontDescriptor());r.push(o.load())}}),this.loadedFonts.push(e.name),(await Promise.all(r)).forEach(i=>{document.fonts.add(i)})}};var Ml=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),b.verbose("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var Bl=class{action;triggerContext;constructor(e,r){this.action=e,this.triggerContext=r}async execute(){let e=this.containsCTA()?"CE Trigger Clicked":"CE Trigger Closed";switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(e),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:await this.collectFormData();break;case void 0:case 105:break;default:b.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;Bi(e)||(e=`//${e}`),window.open(e,"_self")}}async closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),await this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){b.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(r=>console.log(r)).catch(r=>console.error(r))}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}async collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let i=document.getElementById(r.id).value;r.type===51?e.email=i:r.type===52&&(e.mobile=i)}await this.closeTriggerAndSendEvent("CE Form Submitted",{form:e}),this.action.applyDiscount&&wr("Coupon applied on cart"),Ml.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new Mn().process(r);let n={action:this.containsCTA()?"CLICKED":"CLOSED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}};var mr=class{renderer=Un.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new So(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=Z(_(_(_(_({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});di(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&re(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&re(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let e={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};di(this.inappHTMLEl,e)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let r=(e/100).toFixed(2);re(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?re(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):re(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new Hn(this.inappElement.trf);e&&e.rotate&&re(this.inappHTMLEl,"transform",`rotate(${e.rotate}deg)`)}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation(),new Bl(e,this.triggerContext).execute()}),re(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var qr=class extends mr{constructor(e,r,n){super(e,r,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let e={},r=this.inappElement.typography;return r&&(e.fontSize=this.stylesConverter.getSizePx(r.fs),e.fontFamily="cooee"+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),di(this.inappHTMLEl,e),e}processPart(e,r){let n=[];r.u&&n.push("underline"),r.st&&n.push("line-through"),n.length||n.push("normal"),re(e,"font-weight",r.b?"bold":"normal"),re(e,"font-style",r.i?"italic":"normal"),re(e,"text-decoration",n.join(" ")),re(e,"color",r.c??"inherit"),re(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?Ii[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),re(this.inappHTMLEl,"text-align",r)}};var Ks=class extends qr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=document.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.inappHTMLEl.appendChild(r)}),this.processCommonBlocks()}};var Xs=class extends mr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var vi=class extends mr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),re(this.inappHTMLEl,"max-width","none"),re(this.inappHTMLEl,"max-height","none"),re(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var Js=class t extends mr{constructor(r,n,i){super(r,n,i);this.parent=r;this.inappHTMLEl=document.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add("cooee-wrapper"),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),re(this.inappHTMLEl,"z-index",t.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let r=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(re(this.inappHTMLEl,"width","100%"),re(this.inappHTMLEl,"height","100%")):(re(this.inappHTMLEl,"width","100vw"),re(this.inappHTMLEl,"height","100vh")),re(this.inappHTMLEl,"top","0"),re(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,i=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),o=this.stylesConverter.getScaledSize(r.h)+n.getVertical();re(this.inappHTMLEl,"width",i+"px"),re(this.inappHTMLEl,"height",o+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return _(_({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?re(this.inappHTMLEl,"position","absolute"):re(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var s0="cooee-container",Ul=class extends mr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),re(this.inappHTMLEl,"position","relative"),re(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(s0),this}};var kl=class t extends qr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=Z(_(_(_({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>di(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(t.DAYS)),e.hour&&this.elements.push(this.getChild(t.HOURS)),e.minute&&this.elements.push(this.getChild(t.MINUTES)),e.second&&this.elements.push(this.getChild(t.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=document.createElement("div"),n=document.createElement("span"),i=document.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,re(i,"font-size","0.5em"),re(i,"text-align","center"),re(i,"font-family","inherit"),re(n,"text-align","center"),re(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),re(r,"display","flex"),re(r,"flex-direction",this.inappElement.horizontal?"":"column"),re(r,"justify-content","center"),re(r,"align-items","center"),re(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${t.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${t.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${t.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${t.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}};var Fl=class extends qr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){re(this.inappHTMLEl,"background","#ffffff00"),re(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener("click",r=>{r.stopPropagation()}),e.addEventListener("change",()=>{let r=new Ur(JSON.parse(e.value));this.updateItems(r)})}updateItems(e){let r=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[r.toEmbed(e)];let n=this.parentHTMLEl.querySelector("#coo-13");if(!n)return;let i=e.imgs[0]??r.imgs?.at(0);i?.url&&n.setAttribute("src",i.url)}addOptions(){let e=this.triggerContext.triggerData.items,r=this.inappHTMLEl;if(!e?.length){r.add(this.createOption(this.inappElement.placeholderText));return}let n=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(i=>{r.add(this.createOption(i.name??"Default",i,i.mID===n?.vID))})}createOption(e,r,n){let i=document.createElement("option");return i.text=e,i.value=JSON.stringify(r),n&&(i.selected=!0),r||(i.disabled=!0),i}};var Co=class extends qr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("input"),this.insertElement()}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute("placeholder",this.inappElement.placeholderText),re(this.inappHTMLEl,"background","#ffffff00"),re(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t)}};var Hl=class t extends Co{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","email"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.EMAIL_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var $l=class t extends Co{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","tel"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.MOBILE_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Vl=class extends vi{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var Un=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static ACTIVE_TRIGGER_DATA;static _instance;eventAPIService;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.eventAPIService=Ne.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}static get(){return t._instance}render(e){this.renderEngagement(new Tt(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,o=e.spc,s=this.getWidth(),a=this.getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=o.getHorizontal(),a-=o.getVertical(),s/a<n/i?this.scalingFactor=s/n:this.scalingFactor=a/i,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&re(this.parent,"position","relative")}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Rr(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(Tr()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!tt.get().isOpen()||!Tr()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){t.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,t._instance=this;try{this.startRendering()}catch(e){be(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),Tr()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&t.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Rn(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(pe.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=gm.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new Js(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw b.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new Se("CE Trigger Displayed",e,this.triggerContext.triggerData);this.eventAPIService.sendSilently(r);let n={action:"DISPLAYED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new Se(r,e,this.triggerContext.triggerData);n.name==="CE Trigger Clicked"&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.eventAPIService.sendSilently(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof Ki?new Hl(e,r,n).render():r instanceof Xi?new $l(e,r,n).render():r instanceof Sn?new Ks(e,r,n).render():r instanceof Ji?new Vl(e,r,n).render():r instanceof cn?new vi(e,r,n).render():r instanceof Qn?new Xs(e,r,n).render():r instanceof qi?new kl(e,r,n).render():r instanceof zi?new Fl(e,r,n).render():b.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new Ul(this.rootContainer,r,e).render().getHTMLElement(),new Ll().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),t.ACTIVE_TRIGGER_DATA=void 0;let n=this.containerHTMLElement.animate(r,{duration:500,easing:"ease-in-out"});n.onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e)}skipTrigger(e,r){let n=new Se("CE Campaign Rejected",r,e);this.eventAPIService.sendSilently(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let o=i.bg?.img?.src;if(o&&n.push(this.getPromise(o)),i.t===1){let s=i.src;if(!s)return;n.push(this.getPromise(s))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}};var Wl=class{triggerData;eventAPIService=Ne.getInstance();backendAPIService=Dt.getInstance();render(e){e.contentSource===ko.KLAVIYO&&(this.triggerData=e,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",e.klaviyoFormID]))}handleKlaviyoEvents(e){if(e.type!=="klaviyoForms")return;let r=e.detail;if(r.formId!==this.triggerData.klaviyoFormID){b.warn("Received invalid trigger callback");return}switch(r.type){case"open":this.eventAPIService.sendSilently(new Se("CE Trigger Displayed",{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);this.eventAPIService.sendSilently(new Se("CE Form Submitted",{form:n},this.triggerData)),this.backendAPIService.updateProfileSafe(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.eventAPIService.sendSilently(new Se("CE Trigger Closed",{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(tr.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{i.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};var jl=class{static trackIntent(e){if(!this.isInstalled()){b.verbose("Facebook pixel not installed");return}if(!Xe.get().pixelPush){b.verbose("Facebook pixel push not enabled");return}let n=ai[e.intent]?.toLowerCase(),i=e.segmentName;!n&&!i||(b.verbose(`Sending ${n} intent and ${i} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:n,segment_value:e.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}};var Ne=class t extends Bn{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendSafe(e){b.verbose(`Waiting for auth to send event ${e.name}`),pr(at.replaySubject).then(()=>this.sendSilently(e))}sendSilently(e){this.send(e).catch(r=>b.error(`Failed to send ${e.name}`,r))}async send(e){if(b.verbose(`Sending event: ${e.name}`,e),this.shouldReject(e)){b.warn(`Rejecting event ${e.name}`);return}this.addShopifyAttributes();let r=await this.getAllContext();Object.assign(e,r),e.name!=="CE App Background"&&this.runtimeData.setActive(),this.backendAPIService.post("/v1/event/track",e).then(async n=>{b.info("\u2705 Event tracked:",this.userFriendlyName(e.name)),this.processEventResponse(e,n.data)}).catch(n=>{b.error(`Error sending event ${e.name} to server`,n)})}userFriendlyName(e){return e.replace("CE ","").replace("Trigger","Engagement").replace("Screen","Page").replace("App ","")}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(b.warn("Not sending event as this is a test trigger"),!0):!1}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{be(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData)return;let n=new Tt(r.triggerData);n.occurred=e.occurred,b.log(`${n} will be shown`);let i;try{i=await wo.refreshItems(n)}catch(o){b.error("Failed to refresh the products",o);return}if(n.items=i,n.contentSource===ko.KLAVIYO){new Wl().render(n);return}new Un().renderEngagement(n).catch(o=>{be(o,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(xo.trackIntent(e.intent),jl.trackIntent(e),b.info(`Intent is ${ai[e.intent]}`))}addShopifyAttributes(){ye.getCurrent().addCooeeAttributes().catch(e=>{b.error("Fail to add attributes in cart",e)})}};var Gr=class{constructor(e){this.triggerContext=e}backendAPIService=Dt.getInstance();eventAPIService=Ne.getInstance();async execute(e){let r=pe.get().getCurrentItem(),n=e.clickAction;if(!n)return;let i=e.item,o=this.triggerContext,s=o.triggerData,a=new Mn,c=o.triggerData.redirectBehaviour,p=!!o.triggerData.discount?.type&&!!n?.applyDiscount,d={selectedVariants:o.triggerData.nonMutableItems.map(N=>({itemMID:N.mID,mID:N.selectedOrFirstVariant.value.mID,variantID:N.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},f="",E=[],y=[];if(i?y=[i.toEmbed()]:e.embeddedItem&&(y=[e.embeddedItem]),n.at===108){let N=o.selectedItems;if(y=e.embeddedItems??N.map(H=>H.toEmbed()),o.shouldGiveFBTDiscount||e.embeddedItems?.length){let H;e.embeddedItems?H=e.embeddedItems.map(q=>({itemMID:q.mID,mID:q.vID,variantID:q.vID,quantity:q.quantity})):H=N.map(q=>({itemMID:q.mID,mID:q.selectedOrFirstVariant.value.mID,variantID:q.selectedOrFirstVariant.value.mID}));let M=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&M&&(H.push({itemMID:M.mID,mID:M.selectedOrFirstVariant.value.mID,isPrimary:!0}),y.unshift(M.toEmbed())),d.selectedVariants=H,o.triggerData.isBundleOnPDP()&&d.selectedVariants.forEach(q=>{q.mID===r.vID&&(q.isPrimary=!0)})}else d=void 0;E=e.embeddedItems??N}else if(n.at===107){let N=await ye.getCurrent().getNormalisedCart();y=N.items,d.selectedVariants=N.items.map(H=>({itemMID:H.mID,mID:H.vID}))}else if(n.at===102)E=i?[i]:[e.embeddedItem];else if(n.at===101)f=i?ji("/products/"+i.slug):e.embeddedItem?.link;else if(n.at===4){let N=Bi(n.gu?.u);N&&(f=N.href)}else if(n.at===109){let N=await a.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),tt.get().refreshUI(N)}else if(n.at===104){let N=this.triggerContext.triggerData.collections?.[0];N&&(f="collections/"+N.handle)}if(this.sendTriggerClicked(y,{from:"button"},e.video),f=wm(f,s),b.verbose({redirectPath:f,redirectBehaviour:c,hasDiscount:p}),!p&&f){location.href=f;return}let I,D=!1;try{I=await this.getOrGenerateDiscountCode(d),b.verbose("Discount code (if any) to apply",I)}catch(N){if(!this.triggerContext.triggerData.isBYOB()){qy.default.error("Unable to get a discount code",N);return}}if(I&&n.at===103)await a.copyDiscountCode(I);else if(n.at===110){let N=await a.createNewCart(r,I,o.triggerData);N&&(location.href=N);return}try{I&&await Yr.applyWithStorefront([I])}catch(N){b.error(N),D=!0}let U;if(E?.length&&(U=await a.addToCart(E,o.triggerData)),D&&I){Yr.navigate(I,c,f);return}if(f){location.href=f;return}Yr.navigateWithoutDiscount(c,U)}sendTriggerClicked(e,r,n){let i=new Se("CE Trigger Clicked",r,this.triggerContext.triggerData);i.items=e,n?.id&&(i.videos=[n.id]),this.eventAPIService.sendSilently(i)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===Zt.STATIC){if(!r.code)throw vh("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await this.generateDiscount(e),!n)throw b.error("No discount code found",e),new Error("Discount code not found or generated");return n}}async generateDiscount(e){try{return(await this.backendAPIService.generateDiscount(e)).data.code}catch(r){throw wr("Failed to generate a discount code"),be(r,"backend-generate-discount",{triggerContext:this.triggerContext}),r}}};var Gl=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=le.get(kn)}execute(e){for(let r of e){if(!r.experimentConfig)continue;this.executeExperiment(r)&&this.trackExperimentRan(r)}if(document.querySelector("#lc-hide-body")?.remove(),!document.body){Na("No body element found","error");return}this.setupMutationObserver()}executeExperiment(e){let r=e.experimentConfig?.modifications;return r?.length?r.some(n=>{if(!n.cssSelector)return b.verbose("No CSS Selector available",e?.toString()),!1;this.modifications.push(n);let i=Array.from(document.querySelectorAll(n.cssSelector));return i?.length?(this.executeSingleModification(n,i),!0):!1}):(b.log("Nothing to experiment",e.toString()),!0)}executeSingleModification(e,r){if(r?.length)for(let n of r)Object.assign(n.style,e.style),e.type==="TEXT"&&e.text?n.innerHTML=e.text:e.type==="IMAGE"&&this.updateImage(e,n)}trackExperimentRan(e){if(e.id==="preview"){b.warn("Skipping experiment attribution as its preview",e.toString());return}this.eventAPIService.trackExperiment({name:"CE Experiment Start",experiment:new Rn(e)}).catch(r=>{b.error("Fail to track experiment",r)})}setupMutationObserver(){new MutationObserver(r=>{r.forEach(n=>{n.addedNodes.forEach(i=>{i instanceof HTMLElement&&this.modifications.forEach(o=>{i.matches&&i.matches(o.cssSelector)?(b.verbose("Re-applying experiment",o.toString()),this.executeSingleModification(o,[i])):i.querySelectorAll&&(b.verbose("Re-applying experiment",o.toString()),this.executeSingleModification(o,Array.from(i.querySelectorAll(o.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}updateImage(e,r){let n=e.image?.lg?.src,i=e.image?.sm?.src;!n&&!i||(r instanceof HTMLPictureElement?this.updatePictureElement({desktop:n,mobile:i},r):this.updateImageElement({desktop:n,mobile:i},r))}updateImageElement(e,r){Tr()&&e.mobile?(r.setAttribute("src",e.mobile),r.removeAttribute("srcset")):e.desktop&&(r.setAttribute("src",e.desktop),r.removeAttribute("srcset"))}updatePictureElement(e,r){if(r.innerHTML="",e.mobile){let i=document.createElement("source");i.srcset=e.mobile,i.media="(max-width: 767px)",r.append(i)}if(e.desktop){let i=document.createElement("source");i.srcset=e.desktop,i.media="(min-width: 768px)",r.append(i)}let n=document.createElement("img");n.src=e.desktop??e.mobile??"",r.append(n)}};var kn=class t extends Bn{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}fetchExperimentsSilently(){this.fetchExperimentsSafe().catch(e=>be(e,"fetch-experiments"))}async trackExperiment(e){let r=await this.getAllContext(),n=_(_({},e),r);await this.backendAPIService.post("/v1/event/experiment",n)}async fetchExperimentsSafe(){if(!this.runtimeData.activeExperiments)return;at.getInstance().isAuthenticated()?await this.fetchExperiments():(await pr(at.replaySubject),await this.fetchExperiments())}async fetchExperiments(){b.info("Fetch experiments after \u23F0",pe.get().getSDKLoadTimeDiff()+" of SDK load");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/experiments",r).then(async n=>{b.info(`Experiments fetched in \u23F0 ${yr(n.timeTakenMs)}`);let i=n.data.experiments.map(o=>new Tt(o));new Gl().execute(i)}).catch(n=>{b.error("Error sending experiment getter",n)})}};var Yl=class{runtimeData=pe.get();widgetAPIService=le.get(xr);experimentAPIService=le.get(kn);meddle(){let e=Pe.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Pe.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSafe()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSafe()},e.loadExperiments=()=>{this.experimentAPIService.fetchExperimentsSilently()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Pe.previewWidget.bind(Pe),e.previewPopup=Pe.previewPopup.bind(Pe)}overwritePush(e,r){sn(e,"push",r)}meddleAccount(){this.overwritePush(Pe.globalRef.account,(...e)=>{this.processAccount(e[0])}),Pe.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Pe.globalRef.events,(...e)=>{this.processEvent(e[0])}),Pe.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Pe.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Pe.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Pe.authenticate(e),e.flags&&mi.setFlags(e.flags))}processEvent(e){e&&(ym.includes(e[0])?Pe.sendEvent(e[0],e[1],_({occurred:this.runtimeData.jsLoadTime},e[2])):Pe.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Pe.updateProfile(e)}processPageName(e){e&&Pe.setPageName(e)}meddlePage(){this.overwritePush(Pe.globalRef.page,(...e)=>{this.processPage(e[0])}),Pe.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&this.runtimeData.setCurrentItem(e.currentItem),e.currency&&(this.runtimeData.currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&Pe.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&ye.getCurrent().update(e.cart),e.customContext&&(this.runtimeData.customContext=_(_({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(this.runtimeData.pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=window.ShopifyAnalytics?.meta??{},r=e.selectedVariantId;if(r||(e.product?.variants?.length>0&&(r=e.product.variants[0].id),r||(r=this.runtimeData.getCurrentItem()?.vID)),!r){window.alert("Could not find a variant to test. Please try a different product page");return}let n=new Tt({id:"preview",shortID:"1",redirectBehaviour:er.CART_DRAWER});await new Gr(new Rr(new Date,n)).execute({clickAction:{at:102},embeddedItem:new Ct({vID:r})})}};var Ro=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="cooee".concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var Ao=class t{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}resetScrollID(e){Ro.remove("sleid"),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}Ui(()=>{this.observeWindowScroll()})}observeWindowScroll(){fi(window,"scroll").pipe(fr(t.DEBOUNCE_TIME),fn(()=>{let e=this.getPercentScrolledY();if(e>100){b.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=t.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=Ro.getString("sleid",""),i=new Se("CE Scroll",r,null,n);le.get(Ne).sendSafe(i),Ro.setString("sleid",i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}};var ql=class t{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";runtimeData=pe.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){b.info("Not sending background event as user was inactive on website");return}b.info(`Sending background event with ${e} seconds`);let r={};r[t.ACTIVE_DURATION]=e,le.get(Ne).sendSafe(new Se("CE App Background",r))}};var zl=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=async function(n,i){try{await e.modifyRequest(n,i)}catch(o){be(o,"modify-graphql-request",{extra:{body:JSON.stringify(i?.body)}})}return r(n,i)},b.verbose("Securely overwritten window.fetch method for graphql query")}async modifyRequest(e,r){let n=typeof e=="string"?e:e instanceof Request?e.url:"";if(!(n.includes("graphql.json")&&r?.method==="POST")||!r.body)return;let i;if(typeof r.body=="string")try{i=JSON.parse(r.body)}catch{return}else i=r.body;i?.variables?.input&&(b.verbose("Intercepted fetch request of:",n),i?.query.includes("cartCreate")&&(r.body=await this.updatedBody(i),this.sendBuyNowEvent()))}async updatedBody(e){let r=e.variables.input.attributes??[],n=await ec();return e.variables.input.attributes=[...r,...n],JSON.stringify(e)}sendBuyNowEvent(){let e=pe.get().getCurrentItem();if(!e)return;let r=new Se("Buy Now Clicked",{items:[e]});le.get(Ne).sendSafe(r)}};var Do=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new Se(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});le.get(Ne).sendSafe(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>b.error(e))}async listen(){this.elements=await kp(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Kl=class t extends Do{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(t.selectors,"Item Thumbnail Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Xl=class t extends Do{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(t.selectors,"Review Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Jl=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(){Ui(()=>{b.verbose("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let e=window.location.hash?.substring(1);if(e)if(e.includes("initiate-checkout")){document.dispatchEvent(new Event("letscooee:outbound:third-party-initiate-checkout"));let r=document.querySelector(this.selector);if(!r){b.verbose("No clickable cart checkout button found");return}b.verbose("Clickable cart checkout button found",r),r.click()}else e.includes("open-cart-drawer")&&tt.get().open()}};var Qs=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let e=await ye.getCurrent().getNormalisedCart(),r={via:"GoKwik",items:e.items,cartToken:e.token,amount:{value:e.amount,currency:e.currency}},n=new Se("Checkout Started",r);le.get(Ne).sendSafe(n)})}};var Ql=class{static watch(){let e=su();(e==="1"||e==="on")&&Dt.getInstance().updateDevicePropsSafe({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar()}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,Ui(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var Pe=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(window.cooeeSDKPreview)return;let r=(window.CooeeSDK?.pageLoadTime??e).getTime()-e.getTime();b.info(`Initialising SDK after ${yr(r)} of page load`),this.initGlobalReference(e),await le.get(at).populateAuthDataFromStorage(),this.autoAuthenticate(),new Yl().meddle(),Sm(),le.get(xr).loadPageWidgetsSafe(!0),le.get(kn).fetchExperimentsSilently(),new ql().listen(),new hi().listen(),new zl().listen(),new Jl().listen(),le.get(Ao).listen(),le.get(Xl).listenSilently(),le.get(Kl).listenSilently(),this.attachGoKwikListeners(),this.setupPreviewListeners(),Ql.watch()}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||sn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,sn(this.globalRef,"config",new Xe),sn(this.globalRef,"runtimeData",new pe(e)),sn(this.globalRef,"uaParser",new jr),sn(this.globalRef,"cartChange$",hi.cartChange$.asObservable()),sn(this.globalRef,"cartDrawerToggle$",tt.cartDrawerToggle$.asObservable()),b.verbose("Global reference initialised")}static injectWidgetAssets(){Fg(Gt.widgetURL,"cooee-widget-sdk"),If()}static autoAuthenticate(){let e=sg();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;b.info("Begin auth after \u23F0",pe.get().getSDKLoadTimeDiff(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((Bp(r)||r.length!==24)&&Bp(n)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,le.get(at).authenticate(e)}static sendEvent(e,r,n){let i=new Se(e,r,n?.triggerData);n?.occurred&&(i.occurred=n.occurred),le.get(Ne).sendSafe(i)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");le.get(Dt).updateProfileSafe(e)}static setPageName(e){if(!e)return;let r=pe.get(),n=r.pageName;if(e===n)return;if(r.pageName=e,e==="cart"&&le.get(xr).loadOrRenderWidgetsAfterCartChange(),hm.some(s=>e.includes(s))){le.get(Ao).resetScrollID();return}let i={};n&&(i.ps=n);let o=new Se("CE Screen View",i);o.occurred=r.jsLoadTime,le.get(Ne).sendSafe(o),le.get(Ao).resetScrollID(o.occurred)}static previewPopup(e,r){new Un(r).render(e)}static previewWidget(e){new xt(new Tt(e)).renderSilently()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(e){b.error(e)}window.addEventListener("message",e=>{if(b.verbose("Received event",e),!e.origin.includes("letscooee.com")&&!e.origin.includes("localhost"))return;let r=e.data;typeof r=="object"&&(r.action==="POPUP_PREVIEW"?(this.previewPopup(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)):r.action==="WIDGET_PREVIEW"&&(this.previewWidget(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)))})}}static attachGoKwikListeners(){let e=pe.get();window.addEventListener("kp-modal:opened",()=>{e.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",r=>{let{token:n}=r.detail;n&&this.updateProfile({goKwikToken:n})}),window.gokwikSdk?Qs.attachCheckoutListener():window.addEventListener("gokwikLoaded",Qs.attachCheckoutListener)}};var a0=new Date;Em();_m();b.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.verbose("Execution order:","IIFE start"),await Pe.initForMerchantWebsiteOnly(a0),await Pe.initForAll(),b.verbose("Execution order:","IIFE end")))());b.verbose("Execution order:","bottom");