@letscooee/web-sdk 9.12.14 → 9.12.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.min.js +21 -21
- package/dist/widget.min.css +1 -1
- package/dist/widget.min.js +1 -1
- package/package.json +1 -1
package/dist/main.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var Kd=Object.create;var xc=Object.defineProperty;var Yd=Object.getOwnPropertyDescriptor;var Jd=Object.getOwnPropertyNames;var Xd=Object.getPrototypeOf,Qd=Object.prototype.hasOwnProperty;var Zd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Jd(e))!Qd.call(t,i)&&i!==r&&xc(t,i,{get:()=>e[i],enumerable:!(n=Yd(e,i))||n.enumerable});return t};var tf=(t,e,r)=>(r=t!=null?Kd(Xd(t)):{},Zd(e||!t||!t.__esModule?xc(r,"default",{value:t,enumerable:!0}):r,t));var ef=Object.create,ia=Object.defineProperty,rf=Object.defineProperties,nf=Object.getOwnPropertyDescriptor,sf=Object.getOwnPropertyDescriptors,of=Object.getOwnPropertyNames,Ri=Object.getOwnPropertySymbols,af=Object.getPrototypeOf,sa=Object.prototype.hasOwnProperty,Du=Object.prototype.propertyIsEnumerable,Dc=(t,e,r)=>e in t?ia(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,T=(t,e)=>{for(var r in e||={})sa.call(e,r)&&Dc(t,r,e[r]);if(Ri)for(var r of Ri(e))Du.call(e,r)&&Dc(t,r,e[r]);return t},ct=(t,e)=>rf(t,sf(e)),hi=(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')}),cf=(t,e)=>{var r={};for(var n in t)sa.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Ri)for(var n of Ri(t))e.indexOf(n)<0&&Du.call(t,n)&&(r[n]=t[n]);return r},ts=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of of(e))!sa.call(t,i)&&i!==r&&ia(t,i,{get:()=>e[i],enumerable:!(n=nf(e,i))||n.enumerable});return t},Oe=(t,e,r)=>(r=t!=null?ef(af(t)):{},lf(e||!t||!t.__esModule?ia(r,"default",{value:t,enumerable:!0}):r,t)),tn=ts((t,e)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(h,w){return function(){return w.apply(h,arguments)}},c=function(){var h=arguments,w=h[0],v,b;for(b=1;b<h.length;b++)for(v in h[b])!(v in w)&&h[b].hasOwnProperty(v)&&(w[v]=h[b][v]);return w},l=function(h,w){return{value:h,name:w}};n.TRACE=l(1,"TRACE"),n.DEBUG=l(2,"DEBUG"),n.INFO=l(3,"INFO"),n.TIME=l(4,"TIME"),n.WARN=l(5,"WARN"),n.ERROR=l(8,"ERROR"),n.OFF=l(99,"OFF");var p=function(h){this.context=h,this.setLevel(h.filterLevel),this.log=this.info};p.prototype={setLevel:function(h){h&&"value"in h&&(this.context.filterLevel=h)},getLevel:function(){return this.context.filterLevel},enabledFor:function(h){var w=this.context.filterLevel;return h.value>=w.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"start"])},timeEnd:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"end"])},invoke:function(h,w){i&&this.enabledFor(h)&&i(w,c({level:h},this.context))}};var g=new p({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(g,g.enabledFor),h.trace=o(g,g.trace),h.debug=o(g,g.debug),h.time=o(g,g.time),h.timeEnd=o(g,g.timeEnd),h.info=o(g,g.info),h.warn=o(g,g.warn),h.error=o(g,g.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){g.setLevel(h);for(var w in s)s.hasOwnProperty(w)&&s[w].setLevel(h)},n.getLevel=function(){return g.getLevel()},n.get=function(h){return s[h]||(s[h]=new p(c({name:h},g.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(b,_){_.name&&b.unshift("["+_.name+"]")};var w={},v=function(b,_){Function.prototype.apply.call(b,console,_)};return typeof console>"u"?function(){}:function(b,_){b=Array.prototype.slice.call(b);var k=console.log,A;_.level===n.TIME?(A=(_.name?"["+_.name+"] ":"")+b[0],b[1]==="start"?console.time?console.time(A):w[A]=new Date().getTime():console.timeEnd?console.timeEnd(A):v(k,[A+": "+(new Date().getTime()-w[A])+"ms"])):(_.level===n.WARN&&console.warn?k=console.warn:_.level===n.ERROR&&console.error?k=console.error:_.level===n.INFO&&console.info?k=console.info:_.level===n.DEBUG&&console.debug?k=console.debug:_.level===n.TRACE&&console.trace&&(k=console.trace),h.formatter(b,_),v(k,b))}},n.useDefaults=function(h){n.setLevel(h&&h.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(h))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof e<"u"&&e.exports?e.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(t)}),uf=ts((t,e)=>{"use strict";(function(r){if(typeof t=="object"&&typeof e<"u")e.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,c,l){function p(w,v){if(!c[w]){if(!o[w]){var b=typeof hi=="function"&&hi;if(!v&&b)return b(w,!0);if(g)return g(w,!0);var _=new Error("Cannot find module '"+w+"'");throw _.code="MODULE_NOT_FOUND",_}var k=c[w]={exports:{}};o[w][0].call(k.exports,function(A){var B=o[w][1][A];return p(B||A)},k,k.exports,s,o,c,l)}return c[w].exports}for(var g=typeof hi=="function"&&hi,h=0;h<l.length;h++)p(l[h]);return p}({1:[function(s,o,c){(function(l){"use strict";var p=l.MutationObserver||l.WebKitMutationObserver,g;if(p){var h=0,w=new p(A),v=l.document.createTextNode("");w.observe(v,{characterData:!0}),g=function(){v.data=h=++h%2}}else if(!l.setImmediate&&typeof l.MessageChannel<"u"){var b=new l.MessageChannel;b.port1.onmessage=A,g=function(){b.port2.postMessage(0)}}else"document"in l&&"onreadystatechange"in l.document.createElement("script")?g=function(){var G=l.document.createElement("script");G.onreadystatechange=function(){A(),G.onreadystatechange=null,G.parentNode.removeChild(G),G=null},l.document.documentElement.appendChild(G)}:g=function(){setTimeout(A,0)};var _,k=[];function A(){_=!0;for(var G,j,Q=k.length;Q;){for(j=k,k=[],G=-1;++G<Q;)j[G]();Q=k.length}_=!1}o.exports=B;function B(G){k.push(G)===1&&!_&&g()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,c){"use strict";var l=s(1);function p(){}var g={},h=["REJECTED"],w=["FULFILLED"],v=["PENDING"];o.exports=b;function b(q){if(typeof q!="function")throw new TypeError("resolver must be a function");this.state=v,this.queue=[],this.outcome=void 0,q!==p&&B(this,q)}b.prototype.catch=function(q){return this.then(null,q)},b.prototype.then=function(q,nt){if(typeof q!="function"&&this.state===w||typeof nt!="function"&&this.state===h)return this;var Z=new this.constructor(p);if(this.state!==v){var et=this.state===w?q:nt;k(Z,et,this.outcome)}else this.queue.push(new _(Z,q,nt));return Z};function _(q,nt,Z){this.promise=q,typeof nt=="function"&&(this.onFulfilled=nt,this.callFulfilled=this.otherCallFulfilled),typeof Z=="function"&&(this.onRejected=Z,this.callRejected=this.otherCallRejected)}_.prototype.callFulfilled=function(q){g.resolve(this.promise,q)},_.prototype.otherCallFulfilled=function(q){k(this.promise,this.onFulfilled,q)},_.prototype.callRejected=function(q){g.reject(this.promise,q)},_.prototype.otherCallRejected=function(q){k(this.promise,this.onRejected,q)};function k(q,nt,Z){l(function(){var et;try{et=nt(Z)}catch(ht){return g.reject(q,ht)}et===q?g.reject(q,new TypeError("Cannot resolve promise with itself")):g.resolve(q,et)})}g.resolve=function(q,nt){var Z=G(A,nt);if(Z.status==="error")return g.reject(q,Z.value);var et=Z.value;if(et)B(q,et);else{q.state=w,q.outcome=nt;for(var ht=-1,kt=q.queue.length;++ht<kt;)q.queue[ht].callFulfilled(nt)}return q},g.reject=function(q,nt){q.state=h,q.outcome=nt;for(var Z=-1,et=q.queue.length;++Z<et;)q.queue[Z].callRejected(nt);return q};function A(q){var nt=q&&q.then;if(q&&(typeof q=="object"||typeof q=="function")&&typeof nt=="function")return function(){nt.apply(q,arguments)}}function B(q,nt){var Z=!1;function et(jt){Z||(Z=!0,g.reject(q,jt))}function ht(jt){Z||(Z=!0,g.resolve(q,jt))}function kt(){nt(ht,et)}var At=G(kt);At.status==="error"&&et(At.value)}function G(q,nt){var Z={};try{Z.value=q(nt),Z.status="success"}catch(et){Z.status="error",Z.value=et}return Z}b.resolve=j;function j(q){return q instanceof this?q:g.resolve(new this(p),q)}b.reject=Q;function Q(q){var nt=new this(p);return g.reject(nt,q)}b.all=Et;function Et(q){var nt=this;if(Object.prototype.toString.call(q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Z=q.length,et=!1;if(!Z)return this.resolve([]);for(var ht=new Array(Z),kt=0,At=-1,jt=new this(p);++At<Z;)qt(q[At],At);return jt;function qt(gt,Wt){nt.resolve(gt).then(ot,function(rt){et||(et=!0,g.reject(jt,rt))});function ot(rt){ht[Wt]=rt,++kt===Z&&!et&&(et=!0,g.resolve(jt,ht))}}}b.race=Dt;function Dt(q){var nt=this;if(Object.prototype.toString.call(q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Z=q.length,et=!1;if(!Z)return this.resolve([]);for(var ht=-1,kt=new this(p);++ht<Z;)At(q[ht]);return kt;function At(jt){nt.resolve(jt).then(function(qt){et||(et=!0,g.resolve(kt,qt))},function(qt){et||(et=!0,g.reject(kt,qt))})}}},{1:1}],3:[function(s,o,c){(function(l){"use strict";typeof l.Promise!="function"&&(l.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,c){"use strict";var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f};function p(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function g(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var h=g();function w(){try{if(!h||!h.open)return!1;var f=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),m=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!f||m)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function v(f,m){f=f||[],m=m||{};try{return new Blob(f,m)}catch(C){if(C.name!=="TypeError")throw C;for(var y=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,I=new y,S=0;S<f.length;S+=1)I.append(f[S]);return I.getBlob(m.type)}}typeof Promise>"u"&&s(3);var b=Promise;function _(f,m){m&&f.then(function(y){m(null,y)},function(y){m(y)})}function k(f,m,y){typeof m=="function"&&f.then(m),typeof y=="function"&&f.catch(y)}function A(f){return typeof f!="string"&&(console.warn(f+" used as a key, but it is not a string."),f=String(f)),f}function B(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var G="local-forage-detect-blob-support",j=void 0,Q={},Et=Object.prototype.toString,Dt="readonly",q="readwrite";function nt(f){for(var m=f.length,y=new ArrayBuffer(m),I=new Uint8Array(y),S=0;S<m;S++)I[S]=f.charCodeAt(S);return y}function Z(f){return new b(function(m){var y=f.transaction(G,q),I=v([""]);y.objectStore(G).put(I,"key"),y.onabort=function(S){S.preventDefault(),S.stopPropagation(),m(!1)},y.oncomplete=function(){var S=navigator.userAgent.match(/Chrome\/(\d+)/),C=navigator.userAgent.match(/Edge\//);m(C||!S||parseInt(S[1],10)>=43)}}).catch(function(){return!1})}function et(f){return typeof j=="boolean"?b.resolve(j):Z(f).then(function(m){return j=m,j})}function ht(f){var m=Q[f.name],y={};y.promise=new b(function(I,S){y.resolve=I,y.reject=S}),m.deferredOperations.push(y),m.dbReady?m.dbReady=m.dbReady.then(function(){return y.promise}):m.dbReady=y.promise}function kt(f){var m=Q[f.name],y=m.deferredOperations.pop();if(y)return y.resolve(),y.promise}function At(f,m){var y=Q[f.name],I=y.deferredOperations.pop();if(I)return I.reject(m),I.promise}function jt(f,m){return new b(function(y,I){if(Q[f.name]=Q[f.name]||ci(),f.db)if(m)ht(f),f.db.close();else return y(f.db);var S=[f.name];m&&S.push(f.version);var C=h.open.apply(h,S);m&&(C.onupgradeneeded=function(O){var $=C.result;try{$.createObjectStore(f.storeName),O.oldVersion<=1&&$.createObjectStore(G)}catch(W){if(W.name==="ConstraintError")console.warn('The database "'+f.name+'" has been upgraded from version '+O.oldVersion+" to version "+O.newVersion+', but the storage "'+f.storeName+'" already exists.');else throw W}}),C.onerror=function(O){O.preventDefault(),I(C.error)},C.onsuccess=function(){var O=C.result;O.onversionchange=function($){$.target.close()},y(O),kt(f)}})}function qt(f){return jt(f,!1)}function gt(f){return jt(f,!0)}function Wt(f,m){if(!f.db)return!0;var y=!f.db.objectStoreNames.contains(f.storeName),I=f.version<f.db.version,S=f.version>f.db.version;if(I&&(f.version!==m&&console.warn('The database "'+f.name+`" can't be downgraded from version `+f.db.version+" to version "+f.version+"."),f.version=f.db.version),S||y){if(y){var C=f.db.version+1;C>f.version&&(f.version=C)}return!0}return!1}function ot(f){return new b(function(m,y){var I=new FileReader;I.onerror=y,I.onloadend=function(S){var C=btoa(S.target.result||"");m({__local_forage_encoded_blob:!0,data:C,type:f.type})},I.readAsBinaryString(f)})}function rt(f){var m=nt(atob(f.data));return v([m],{type:f.type})}function $t(f){return f&&f.__local_forage_encoded_blob}function oi(f){var m=this,y=m._initReady().then(function(){var I=Q[m._dbInfo.name];if(I&&I.dbReady)return I.dbReady});return k(y,f,f),y}function ai(f){ht(f);for(var m=Q[f.name],y=m.forages,I=0;I<y.length;I++){var S=y[I];S._dbInfo.db&&(S._dbInfo.db.close(),S._dbInfo.db=null)}return f.db=null,qt(f).then(function(C){return f.db=C,Wt(f)?gt(f):C}).then(function(C){f.db=m.db=C;for(var O=0;O<y.length;O++)y[O]._dbInfo.db=C}).catch(function(C){throw At(f,C),C})}function oe(f,m,y,I){I===void 0&&(I=1);try{var S=f.db.transaction(f.storeName,m);y(null,S)}catch(C){if(I>0&&(!f.db||C.name==="InvalidStateError"||C.name==="NotFoundError"))return b.resolve().then(function(){if(!f.db||C.name==="NotFoundError"&&!f.db.objectStoreNames.contains(f.storeName)&&f.version<=f.db.version)return f.db&&(f.version=f.db.version+1),gt(f)}).then(function(){return ai(f).then(function(){oe(f,m,y,I-1)})}).catch(y);y(C)}}function ci(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ss(f){var m=this,y={db:null};if(f)for(var I in f)y[I]=f[I];var S=Q[y.name];S||(S=ci(),Q[y.name]=S),S.forages.push(m),m._initReady||(m._initReady=m.ready,m.ready=oi);var C=[];function O(){return b.resolve()}for(var $=0;$<S.forages.length;$++){var W=S.forages[$];W!==m&&C.push(W._initReady().catch(O))}var V=S.forages.slice(0);return b.all(C).then(function(){return y.db=S.db,qt(y)}).then(function(F){return y.db=F,Wt(y,m._defaultConfig.version)?gt(y):F}).then(function(F){y.db=S.db=F,m._dbInfo=y;for(var J=0;J<V.length;J++){var st=V[J];st!==m&&(st._dbInfo.db=y.db,st._dbInfo.version=y.version)}})}function un(f,m){var y=this;f=A(f);var I=new b(function(S,C){y.ready().then(function(){oe(y._dbInfo,Dt,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.get(f);V.onsuccess=function(){var F=V.result;F===void 0&&(F=null),$t(F)&&(F=rt(F)),S(F)},V.onerror=function(){C(V.error)}}catch(F){C(F)}})}).catch(C)});return _(I,m),I}function Is(f,m){var y=this,I=new b(function(S,C){y.ready().then(function(){oe(y._dbInfo,Dt,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.openCursor(),F=1;V.onsuccess=function(){var J=V.result;if(J){var st=J.value;$t(st)&&(st=rt(st));var vt=f(st,J.key,F++);vt!==void 0?S(vt):J.continue()}else S()},V.onerror=function(){C(V.error)}}catch(J){C(J)}})}).catch(C)});return _(I,m),I}function Cs(f,m,y){var I=this;f=A(f);var S=new b(function(C,O){var $;I.ready().then(function(){return $=I._dbInfo,Et.call(m)==="[object Blob]"?et($.db).then(function(W){return W?m:ot(m)}):m}).then(function(W){oe(I._dbInfo,q,function(V,F){if(V)return O(V);try{var J=F.objectStore(I._dbInfo.storeName);W===null&&(W=void 0);var st=J.put(W,f);F.oncomplete=function(){W===void 0&&(W=null),C(W)},F.onabort=F.onerror=function(){var vt=st.error?st.error:st.transaction.error;O(vt)}}catch(vt){O(vt)}})}).catch(O)});return _(S,y),S}function li(f,m){var y=this;f=A(f);var I=new b(function(S,C){y.ready().then(function(){oe(y._dbInfo,q,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.delete(f);$.oncomplete=function(){S()},$.onerror=function(){C(V.error)},$.onabort=function(){var F=V.error?V.error:V.transaction.error;C(F)}}catch(F){C(F)}})}).catch(C)});return _(I,m),I}function kr(f){var m=this,y=new b(function(I,S){m.ready().then(function(){oe(m._dbInfo,q,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.clear();O.oncomplete=function(){I()},O.onabort=O.onerror=function(){var V=W.error?W.error:W.transaction.error;S(V)}}catch(V){S(V)}})}).catch(S)});return _(y,f),y}function ae(f){var m=this,y=new b(function(I,S){m.ready().then(function(){oe(m._dbInfo,Dt,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.count();W.onsuccess=function(){I(W.result)},W.onerror=function(){S(W.error)}}catch(V){S(V)}})}).catch(S)});return _(y,f),y}function hn(f,m){var y=this,I=new b(function(S,C){if(f<0){S(null);return}y.ready().then(function(){oe(y._dbInfo,Dt,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=!1,F=W.openKeyCursor();F.onsuccess=function(){var J=F.result;if(!J){S(null);return}f===0||V?S(J.key):(V=!0,J.advance(f))},F.onerror=function(){C(F.error)}}catch(J){C(J)}})}).catch(C)});return _(I,m),I}function Ts(f){var m=this,y=new b(function(I,S){m.ready().then(function(){oe(m._dbInfo,Dt,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.openKeyCursor(),V=[];W.onsuccess=function(){var F=W.result;if(!F){I(V);return}V.push(F.key),F.continue()},W.onerror=function(){S(W.error)}}catch(F){S(F)}})}).catch(S)});return _(y,f),y}function a(f,m){m=B.apply(this,arguments);var y=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||y.name,f.storeName=f.storeName||y.storeName);var I=this,S;if(!f.name)S=b.reject("Invalid arguments");else{var C=f.name===y.name&&I._dbInfo.db,O=C?b.resolve(I._dbInfo.db):qt(f).then(function($){var W=Q[f.name],V=W.forages;W.db=$;for(var F=0;F<V.length;F++)V[F]._dbInfo.db=$;return $});f.storeName?S=O.then(function($){if($.objectStoreNames.contains(f.storeName)){var W=$.version+1;ht(f);var V=Q[f.name],F=V.forages;$.close();for(var J=0;J<F.length;J++){var st=F[J];st._dbInfo.db=null,st._dbInfo.version=W}var vt=new b(function(dt,Pt){var Ct=h.open(f.name,W);Ct.onerror=function(ce){var Os=Ct.result;Os.close(),Pt(ce)},Ct.onupgradeneeded=function(){var ce=Ct.result;ce.deleteObjectStore(f.storeName)},Ct.onsuccess=function(){var ce=Ct.result;ce.close(),dt(ce)}});return vt.then(function(dt){V.db=dt;for(var Pt=0;Pt<F.length;Pt++){var Ct=F[Pt];Ct._dbInfo.db=dt,kt(Ct._dbInfo)}}).catch(function(dt){throw(At(f,dt)||b.resolve()).catch(function(){}),dt})}}):S=O.then(function($){ht(f);var W=Q[f.name],V=W.forages;$.close();for(var F=0;F<V.length;F++){var J=V[F];J._dbInfo.db=null}var st=new b(function(vt,dt){var Pt=h.deleteDatabase(f.name);Pt.onerror=function(){var Ct=Pt.result;Ct&&Ct.close(),dt(Pt.error)},Pt.onblocked=function(){console.warn('dropInstance blocked for database "'+f.name+'" until all open connections are closed')},Pt.onsuccess=function(){var Ct=Pt.result;Ct&&Ct.close(),vt(Ct)}});return st.then(function(vt){W.db=vt;for(var dt=0;dt<V.length;dt++){var Pt=V[dt];kt(Pt._dbInfo)}}).catch(function(vt){throw(At(f,vt)||b.resolve()).catch(function(){}),vt})})}return _(S,m),S}var u={_driver:"asyncStorage",_initStorage:Ss,_support:w(),iterate:Is,getItem:un,setItem:Cs,removeItem:li,clear:kr,length:ae,key:hn,keys:Ts,dropInstance:a};function d(){return typeof openDatabase=="function"}var E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D="~~local_forage_type~",M=/^~~local_forage_type~([^~]+)~/,K="__lfsc__:",pt=K.length,Nt="arbf",mt="blob",It="si08",Ut="ui08",cr="uic8",pn="si16",dn="si32",fc="ur16",gc="ui32",mc="fl32",yc="fl64",vc=pt+Nt.length,bc=Object.prototype.toString;function wc(f){var m=f.length*.75,y=f.length,I,S=0,C,O,$,W;f[f.length-1]==="="&&(m--,f[f.length-2]==="="&&m--);var V=new ArrayBuffer(m),F=new Uint8Array(V);for(I=0;I<y;I+=4)C=E.indexOf(f[I]),O=E.indexOf(f[I+1]),$=E.indexOf(f[I+2]),W=E.indexOf(f[I+3]),F[S++]=C<<2|O>>4,F[S++]=(O&15)<<4|$>>2,F[S++]=($&3)<<6|W&63;return V}function xs(f){var m=new Uint8Array(f),y="",I;for(I=0;I<m.length;I+=3)y+=E[m[I]>>2],y+=E[(m[I]&3)<<4|m[I+1]>>4],y+=E[(m[I+1]&15)<<2|m[I+2]>>6],y+=E[m[I+2]&63];return m.length%3===2?y=y.substring(0,y.length-1)+"=":m.length%3===1&&(y=y.substring(0,y.length-2)+"=="),y}function hd(f,m){var y="";if(f&&(y=bc.call(f)),f&&(y==="[object ArrayBuffer]"||f.buffer&&bc.call(f.buffer)==="[object ArrayBuffer]")){var I,S=K;f instanceof ArrayBuffer?(I=f,S+=Nt):(I=f.buffer,y==="[object Int8Array]"?S+=It:y==="[object Uint8Array]"?S+=Ut:y==="[object Uint8ClampedArray]"?S+=cr:y==="[object Int16Array]"?S+=pn:y==="[object Uint16Array]"?S+=fc:y==="[object Int32Array]"?S+=dn:y==="[object Uint32Array]"?S+=gc:y==="[object Float32Array]"?S+=mc:y==="[object Float64Array]"?S+=yc:m(new Error("Failed to get type for BinaryArray"))),m(S+xs(I))}else if(y==="[object Blob]"){var C=new FileReader;C.onload=function(){var O=D+f.type+"~"+xs(this.result);m(K+mt+O)},C.readAsArrayBuffer(f)}else try{m(JSON.stringify(f))}catch(O){console.error("Couldn't convert value into a JSON string: ",f),m(null,O)}}function pd(f){if(f.substring(0,pt)!==K)return JSON.parse(f);var m=f.substring(vc),y=f.substring(pt,vc),I;if(y===mt&&M.test(m)){var S=m.match(M);I=S[1],m=m.substring(S[0].length)}var C=wc(m);switch(y){case Nt:return C;case mt:return v([C],{type:I});case It:return new Int8Array(C);case Ut:return new Uint8Array(C);case cr:return new Uint8ClampedArray(C);case pn:return new Int16Array(C);case fc:return new Uint16Array(C);case dn:return new Int32Array(C);case gc:return new Uint32Array(C);case mc:return new Float32Array(C);case yc:return new Float64Array(C);default:throw new Error("Unkown type: "+y)}}var Ds={serialize:hd,deserialize:pd,stringToBuffer:wc,bufferToString:xs};function _c(f,m,y,I){f.executeSql("CREATE TABLE IF NOT EXISTS "+m.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],y,I)}function dd(f){var m=this,y={db:null};if(f)for(var I in f)y[I]=typeof f[I]!="string"?f[I].toString():f[I];var S=new b(function(C,O){try{y.db=openDatabase(y.name,String(y.version),y.description,y.size)}catch($){return O($)}y.db.transaction(function($){_c($,y,function(){m._dbInfo=y,C()},function(W,V){O(V)})},O)});return y.serializer=Ds,S}function Je(f,m,y,I,S,C){f.executeSql(y,I,S,function(O,$){$.code===$.SYNTAX_ERR?O.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[m.storeName],function(W,V){V.rows.length?C(W,$):_c(W,m,function(){W.executeSql(y,I,S,C)},C)},C):C(O,$)},C)}function fd(f,m){var y=this;f=A(f);var I=new b(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Je($,O,"SELECT * FROM "+O.storeName+" WHERE key = ? LIMIT 1",[f],function(W,V){var F=V.rows.length?V.rows.item(0).value:null;F&&(F=O.serializer.deserialize(F)),S(F)},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function gd(f,m){var y=this,I=new b(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Je($,O,"SELECT * FROM "+O.storeName,[],function(W,V){for(var F=V.rows,J=F.length,st=0;st<J;st++){var vt=F.item(st),dt=vt.value;if(dt&&(dt=O.serializer.deserialize(dt)),dt=f(dt,vt.key,st+1),dt!==void 0){S(dt);return}}S()},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function Ec(f,m,y,I){var S=this;f=A(f);var C=new b(function(O,$){S.ready().then(function(){m===void 0&&(m=null);var W=m,V=S._dbInfo;V.serializer.serialize(m,function(F,J){J?$(J):V.db.transaction(function(st){Je(st,V,"INSERT OR REPLACE INTO "+V.storeName+" (key, value) VALUES (?, ?)",[f,F],function(){O(W)},function(vt,dt){$(dt)})},function(st){if(st.code===st.QUOTA_ERR){if(I>0){O(Ec.apply(S,[f,W,y,I-1]));return}$(st)}})})}).catch($)});return _(C,y),C}function md(f,m,y){return Ec.apply(this,[f,m,y,1])}function yd(f,m){var y=this;f=A(f);var I=new b(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Je($,O,"DELETE FROM "+O.storeName+" WHERE key = ?",[f],function(){S()},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function vd(f){var m=this,y=new b(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Je(O,C,"DELETE FROM "+C.storeName,[],function(){I()},function($,W){S(W)})})}).catch(S)});return _(y,f),y}function bd(f){var m=this,y=new b(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Je(O,C,"SELECT COUNT(key) as c FROM "+C.storeName,[],function($,W){var V=W.rows.item(0).c;I(V)},function($,W){S(W)})})}).catch(S)});return _(y,f),y}function wd(f,m){var y=this,I=new b(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Je($,O,"SELECT key FROM "+O.storeName+" WHERE id = ? LIMIT 1",[f+1],function(W,V){var F=V.rows.length?V.rows.item(0).key:null;S(F)},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function _d(f){var m=this,y=new b(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Je(O,C,"SELECT key FROM "+C.storeName,[],function($,W){for(var V=[],F=0;F<W.rows.length;F++)V.push(W.rows.item(F).key);I(V)},function($,W){S(W)})})}).catch(S)});return _(y,f),y}function Ed(f){return new b(function(m,y){f.transaction(function(I){I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(S,C){for(var O=[],$=0;$<C.rows.length;$++)O.push(C.rows.item($).name);m({db:f,storeNames:O})},function(S,C){y(C)})},function(I){y(I)})})}function Sd(f,m){m=B.apply(this,arguments);var y=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||y.name,f.storeName=f.storeName||y.storeName);var I=this,S;return f.name?S=new b(function(C){var O;f.name===y.name?O=I._dbInfo.db:O=openDatabase(f.name,"","",0),f.storeName?C({db:O,storeNames:[f.storeName]}):C(Ed(O))}).then(function(C){return new b(function(O,$){C.db.transaction(function(W){function V(vt){return new b(function(dt,Pt){W.executeSql("DROP TABLE IF EXISTS "+vt,[],function(){dt()},function(Ct,ce){Pt(ce)})})}for(var F=[],J=0,st=C.storeNames.length;J<st;J++)F.push(V(C.storeNames[J]));b.all(F).then(function(){O()}).catch(function(vt){$(vt)})},function(W){$(W)})})}):S=b.reject("Invalid arguments"),_(S,m),S}var Id={_driver:"webSQLStorage",_initStorage:dd,_support:d(),iterate:gd,getItem:fd,setItem:md,removeItem:yd,clear:vd,length:bd,key:wd,keys:_d,dropInstance:Sd};function Cd(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Sc(f,m){var y=f.name+"/";return f.storeName!==m.storeName&&(y+=f.storeName+"/"),y}function Td(){var f="_localforage_support_test";try{return localStorage.setItem(f,!0),localStorage.removeItem(f),!1}catch{return!0}}function xd(){return!Td()||localStorage.length>0}function Dd(f){var m=this,y={};if(f)for(var I in f)y[I]=f[I];return y.keyPrefix=Sc(f,m._defaultConfig),xd()?(m._dbInfo=y,y.serializer=Ds,b.resolve()):b.reject()}function Ad(f){var m=this,y=m.ready().then(function(){for(var I=m._dbInfo.keyPrefix,S=localStorage.length-1;S>=0;S--){var C=localStorage.key(S);C.indexOf(I)===0&&localStorage.removeItem(C)}});return _(y,f),y}function Nd(f,m){var y=this;f=A(f);var I=y.ready().then(function(){var S=y._dbInfo,C=localStorage.getItem(S.keyPrefix+f);return C&&(C=S.serializer.deserialize(C)),C});return _(I,m),I}function Od(f,m){var y=this,I=y.ready().then(function(){for(var S=y._dbInfo,C=S.keyPrefix,O=C.length,$=localStorage.length,W=1,V=0;V<$;V++){var F=localStorage.key(V);if(F.indexOf(C)===0){var J=localStorage.getItem(F);if(J&&(J=S.serializer.deserialize(J)),J=f(J,F.substring(O),W++),J!==void 0)return J}}});return _(I,m),I}function kd(f,m){var y=this,I=y.ready().then(function(){var S=y._dbInfo,C;try{C=localStorage.key(f)}catch{C=null}return C&&(C=C.substring(S.keyPrefix.length)),C});return _(I,m),I}function Pd(f){var m=this,y=m.ready().then(function(){for(var I=m._dbInfo,S=localStorage.length,C=[],O=0;O<S;O++){var $=localStorage.key(O);$.indexOf(I.keyPrefix)===0&&C.push($.substring(I.keyPrefix.length))}return C});return _(y,f),y}function Rd(f){var m=this,y=m.keys().then(function(I){return I.length});return _(y,f),y}function Ld(f,m){var y=this;f=A(f);var I=y.ready().then(function(){var S=y._dbInfo;localStorage.removeItem(S.keyPrefix+f)});return _(I,m),I}function Md(f,m,y){var I=this;f=A(f);var S=I.ready().then(function(){m===void 0&&(m=null);var C=m;return new b(function(O,$){var W=I._dbInfo;W.serializer.serialize(m,function(V,F){if(F)$(F);else try{localStorage.setItem(W.keyPrefix+f,V),O(C)}catch(J){(J.name==="QuotaExceededError"||J.name==="NS_ERROR_DOM_QUOTA_REACHED")&&$(J),$(J)}})})});return _(S,y),S}function Ud(f,m){if(m=B.apply(this,arguments),f=typeof f!="function"&&f||{},!f.name){var y=this.config();f.name=f.name||y.name,f.storeName=f.storeName||y.storeName}var I=this,S;return f.name?S=new b(function(C){f.storeName?C(Sc(f,I._defaultConfig)):C(f.name+"/")}).then(function(C){for(var O=localStorage.length-1;O>=0;O--){var $=localStorage.key(O);$.indexOf(C)===0&&localStorage.removeItem($)}}):S=b.reject("Invalid arguments"),_(S,m),S}var Bd={_driver:"localStorageWrapper",_initStorage:Dd,_support:Cd(),iterate:Od,getItem:Nd,setItem:Md,removeItem:Ld,clear:Ad,length:Rd,key:kd,keys:Pd,dropInstance:Ud},jd=function(f,m){return f===m||typeof f=="number"&&typeof m=="number"&&isNaN(f)&&isNaN(m)},$d=function(f,m){for(var y=f.length,I=0;I<y;){if(jd(f[I],m))return!0;I++}return!1},Ic=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"},fn={},Cc={},Pr={INDEXEDDB:u,WEBSQL:Id,LOCALSTORAGE:Bd},Fd=[Pr.INDEXEDDB._driver,Pr.WEBSQL._driver,Pr.LOCALSTORAGE._driver],ui=["dropInstance"],As=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ui),Hd={description:"",driver:Fd.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Vd(f,m){f[m]=function(){var y=arguments;return f.ready().then(function(){return f[m].apply(f,y)})}}function Ns(){for(var f=1;f<arguments.length;f++){var m=arguments[f];if(m)for(var y in m)m.hasOwnProperty(y)&&(Ic(m[y])?arguments[0][y]=m[y].slice():arguments[0][y]=m[y])}return arguments[0]}var qd=function(){function f(m){p(this,f);for(var y in Pr)if(Pr.hasOwnProperty(y)){var I=Pr[y],S=I._driver;this[y]=S,fn[S]||this.defineDriver(I)}this._defaultConfig=Ns({},Hd),this._config=Ns({},this._defaultConfig,m),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return f.prototype.config=function(m){if((typeof m>"u"?"undefined":l(m))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var y in m){if(y==="storeName"&&(m[y]=m[y].replace(/\W/g,"_")),y==="version"&&typeof m[y]!="number")return new Error("Database version must be a number.");this._config[y]=m[y]}return"driver"in m&&m.driver?this.setDriver(this._config.driver):!0}else return typeof m=="string"?this._config[m]:this._config},f.prototype.defineDriver=function(m,y,I){var S=new b(function(C,O){try{var $=m._driver,W=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){O(W);return}for(var V=As.concat("_initStorage"),F=0,J=V.length;F<J;F++){var st=V[F],vt=!$d(ui,st);if((vt||m[st])&&typeof m[st]!="function"){O(W);return}}var dt=function(){for(var Ct=function(Gd){return function(){var zd=new Error("Method "+Gd+" is not implemented by the current driver"),Tc=b.reject(zd);return _(Tc,arguments[arguments.length-1]),Tc}},ce=0,Os=ui.length;ce<Os;ce++){var ks=ui[ce];m[ks]||(m[ks]=Ct(ks))}};dt();var Pt=function(Ct){fn[$]&&console.info("Redefining LocalForage driver: "+$),fn[$]=m,Cc[$]=Ct,C()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Pt,O):Pt(!!m._support):Pt(!0)}catch(Ct){O(Ct)}});return k(S,y,I),S},f.prototype.driver=function(){return this._driver||null},f.prototype.getDriver=function(m,y,I){var S=fn[m]?b.resolve(fn[m]):b.reject(new Error("Driver not found."));return k(S,y,I),S},f.prototype.getSerializer=function(m){var y=b.resolve(Ds);return k(y,m),y},f.prototype.ready=function(m){var y=this,I=y._driverSet.then(function(){return y._ready===null&&(y._ready=y._initDriver()),y._ready});return k(I,m,m),I},f.prototype.setDriver=function(m,y,I){var S=this;Ic(m)||(m=[m]);var C=this._getSupportedDrivers(m);function O(){S._config.driver=S.driver()}function $(F){return S._extend(F),O(),S._ready=S._initStorage(S._config),S._ready}function W(F){return function(){var J=0;function st(){for(;J<F.length;){var vt=F[J];return J++,S._dbInfo=null,S._ready=null,S.getDriver(vt).then($).catch(st)}O();var dt=new Error("No available storage method found.");return S._driverSet=b.reject(dt),S._driverSet}return st()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return b.resolve()}):b.resolve();return this._driverSet=V.then(function(){var F=C[0];return S._dbInfo=null,S._ready=null,S.getDriver(F).then(function(J){S._driver=J._driver,O(),S._wrapLibraryMethodsWithReady(),S._initDriver=W(C)})}).catch(function(){O();var F=new Error("No available storage method found.");return S._driverSet=b.reject(F),S._driverSet}),k(this._driverSet,y,I),this._driverSet},f.prototype.supports=function(m){return!!Cc[m]},f.prototype._extend=function(m){Ns(this,m)},f.prototype._getSupportedDrivers=function(m){for(var y=[],I=0,S=m.length;I<S;I++){var C=m[I];this.supports(C)&&y.push(C)}return y},f.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,y=As.length;m<y;m++)Vd(this,As[m])},f.prototype.createInstance=function(m){return new f(m)},f}(),Wd=new qd;o.exports=Wd},{3:3}]},{},[4])(4)})}),Au=ts(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLBuilder=void 0;var e=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();t.URLBuilder=e}),hf=ts((t,e)=>{"use strict";(function(r,n){typeof t=="object"&&typeof e<"u"?e.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(t,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var c={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(c,o),function(l,p){var g=o.retries,h=o.retryDelay,w=o.retryOn;if(p&&p.retries!==void 0)if(n(p.retries))g=p.retries;else throw new i("retries must be a positive integer");if(p&&p.retryDelay!==void 0)if(n(p.retryDelay)||typeof p.retryDelay=="function")h=p.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(p&&p.retryOn)if(Array.isArray(p.retryOn)||typeof p.retryOn=="function")w=p.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(v,b){var _=function(A){var B=typeof Request<"u"&&l instanceof Request?l.clone():l;s(B,p).then(function(G){if(Array.isArray(w)&&w.indexOf(G.status)===-1)v(G);else if(typeof w=="function")try{return Promise.resolve(w(A,null,G)).then(function(j){j?k(A,null,G):v(G)}).catch(b)}catch(j){b(j)}else A<g?k(A,null,G):v(G)}).catch(function(G){if(typeof w=="function")try{Promise.resolve(w(A,G,null)).then(function(j){j?k(A,G,null):b(G)}).catch(function(j){b(j)})}catch(j){b(j)}else A<g?k(A,G,null):b(G)})};function k(A,B,G){var j=typeof h=="function"?h(A,B,G):h;setTimeout(function(){_(++A)},j)}_(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),pf="9.12.14",H=class mo{static SDK_VERSION=pf;static SDK_VERSION_CODE;static SDK="WEB";static LOG_PREFIX="CooeeSDK";static COOEE="cooee";static SESSION_STORAGE_SCROLL_ID="sleid";static IDLE_TIME_IN_SECONDS=30*60;static IN_APP_WRAPPER_NAME="cooee-wrapper";static IN_APP_CONTAINER_NAME="cooee-container";static IN_APP_DEFAULT_PADDING=15;static EVENT_SCREEN_VIEW="CE Screen View";static EVENT_APP_BACKGROUND="CE App Background";static EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed";static EVENT_CAMPAIGN_HOLDOUT="CE Campaign Holdout";static EVENT_CAMPAIGN_REJECTED="CE Campaign Rejected";static EVENT_CAMPAIGN_FAILED="CE Campaign Failed";static EVENT_TRIGGER_CLOSED="CE Trigger Closed";static EVENT_SCROLL="CE Scroll";static EVENT_TRIGGER_CLICKED="CE Trigger Clicked";static EVENT_FORM_SUBMITTED="CE Form Submitted";static EVENT_EXPERIMENT_START="CE Experiment Start";static EVENT_VIDEO_DIALOG_CLOSED="CE Video Dialog Closed";static EVENT_VIDEO_DIALOG_OPENED="CE Video Dialog Opened";static EVENT_VIDEO_CHANGE="CE Video Changed";static EVENT_LAST_VIDEO_ENDED="CE Last Video Ended";static EVENT_VIDEO_MUTED="CE Video Muted";static EVENT_VIDEO_UNMUTED="CE Video Unmuted";static EVENT_ADD_TO_CART_CLICKED="CE Add To Cart Clicked";static EVENT_VIEW_ITEM_CLICKED="CE View Item Clicked";static EVENT_MORE_ITEM_INFO_CLICKED="CE More Item Info Clicked";static EVENT_OPEN_CART_CLICKED="CE Open Cart Clicked";static EVENT_ADD_TO_CART="Add To Cart";static EVENT_REMOVE_FROM_CART="Remove From Cart";static EVENT_VIEW_ITEM="View Item";static EVENT_VIEW_CART="View Cart";static EVENT_OPEN_CART="Open Cart";static EVENT_VIEW_COLLECTION="View Collection";static EVENT_BUY_NOW_CLICKED="Buy Now Clicked";static EVENT_CHECKOUT_STARTED="Checkout Started";static EVENT_REVIEW_CLICKED="Review Clicked";static EVENT_ITEM_THUMBNAIL_CLICKED="Item Thumbnail Clicked";static JS_LOAD_WHITELIST_EVENTS=[this.EVENT_VIEW_ITEM,this.EVENT_VIEW_CART,this.EVENT_VIEW_COLLECTION];static HASH_INITIATE_CHECKOUT="initiate-checkout";static HASH_OPEN_CART_DRAWER="open-cart-drawer";static ADD_BUNDLE_CTA_INBOUND_EVENT="letscooee:inbound:cta:add-bundle";static CTA_OPEN_CART_EVENT="letscooee:outbound:open-cart";static CTA_AFTER_REFRESH_UI="letscooee:outbound:refresh-ui";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static SHADOW_SPLITTER=":shadow";static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static CONTENT_ATTRIBUTE="_letscooee_content";static VIA="_via";static PAYMENT_MODAL_DETAILS=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}];static{let e=mo.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");mo.SDK_VERSION_CODE=parseInt(e,10)}},We={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${H.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${H.SDK_VERSION}/dist/widget.min.js`},pe=Oe(tn()),x=class{static log(...t){pe.default.info(...t)}static debug(...t){pe.default.debug(...t)}static error(...t){pe.default.error(...t)}static warn(...t){pe.default.warn(...t)}static info(...t){pe.default.info(...t)}static trace(...t){pe.default.trace(...t)}};function df(t=H.LOG_PREFIX){pe.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${H.SDK_VERSION}):`)}});let e=Nu();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?pe.default.setLevel(pe.default[localStorage.cooeeLogLevel]):pe.default.setLevel(We.debug?pe.default.TRACE:pe.default.OFF)}function Nu(){return new URL(location.href).searchParams?.get("cooee-debug")}function ff(){let t=`
|
|
1
|
+
"use strict";(()=>{var Yd=Object.create;var Ac=Object.defineProperty;var Jd=Object.getOwnPropertyDescriptor;var Xd=Object.getOwnPropertyNames;var Qd=Object.getPrototypeOf,Zd=Object.prototype.hasOwnProperty;var tf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Xd(e))!Zd.call(t,i)&&i!==r&&Ac(t,i,{get:()=>e[i],enumerable:!(n=Jd(e,i))||n.enumerable});return t};var ef=(t,e,r)=>(r=t!=null?Yd(Qd(t)):{},tf(e||!t||!t.__esModule?Ac(r,"default",{value:t,enumerable:!0}):r,t));var rf=Object.create,sa=Object.defineProperty,nf=Object.defineProperties,sf=Object.getOwnPropertyDescriptor,of=Object.getOwnPropertyDescriptors,af=Object.getOwnPropertyNames,Li=Object.getOwnPropertySymbols,cf=Object.getPrototypeOf,oa=Object.prototype.hasOwnProperty,Nu=Object.prototype.propertyIsEnumerable,Nc=(t,e,r)=>e in t?sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,T=(t,e)=>{for(var r in e||={})oa.call(e,r)&&Nc(t,r,e[r]);if(Li)for(var r of Li(e))Nu.call(e,r)&&Nc(t,r,e[r]);return t},lt=(t,e)=>nf(t,of(e)),pi=(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')}),lf=(t,e)=>{var r={};for(var n in t)oa.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Li)for(var n of Li(t))e.indexOf(n)<0&&Nu.call(t,n)&&(r[n]=t[n]);return r},es=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),uf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of af(e))!oa.call(t,i)&&i!==r&&sa(t,i,{get:()=>e[i],enumerable:!(n=sf(e,i))||n.enumerable});return t},ke=(t,e,r)=>(r=t!=null?rf(cf(t)):{},uf(e||!t||!t.__esModule?sa(r,"default",{value:t,enumerable:!0}):r,t)),rn=es((t,e)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(h,w){return function(){return w.apply(h,arguments)}},c=function(){var h=arguments,w=h[0],v,b;for(b=1;b<h.length;b++)for(v in h[b])!(v in w)&&h[b].hasOwnProperty(v)&&(w[v]=h[b][v]);return w},l=function(h,w){return{value:h,name:w}};n.TRACE=l(1,"TRACE"),n.DEBUG=l(2,"DEBUG"),n.INFO=l(3,"INFO"),n.TIME=l(4,"TIME"),n.WARN=l(5,"WARN"),n.ERROR=l(8,"ERROR"),n.OFF=l(99,"OFF");var p=function(h){this.context=h,this.setLevel(h.filterLevel),this.log=this.info};p.prototype={setLevel:function(h){h&&"value"in h&&(this.context.filterLevel=h)},getLevel:function(){return this.context.filterLevel},enabledFor:function(h){var w=this.context.filterLevel;return h.value>=w.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"start"])},timeEnd:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"end"])},invoke:function(h,w){i&&this.enabledFor(h)&&i(w,c({level:h},this.context))}};var g=new p({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(g,g.enabledFor),h.trace=o(g,g.trace),h.debug=o(g,g.debug),h.time=o(g,g.time),h.timeEnd=o(g,g.timeEnd),h.info=o(g,g.info),h.warn=o(g,g.warn),h.error=o(g,g.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){g.setLevel(h);for(var w in s)s.hasOwnProperty(w)&&s[w].setLevel(h)},n.getLevel=function(){return g.getLevel()},n.get=function(h){return s[h]||(s[h]=new p(c({name:h},g.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(b,_){_.name&&b.unshift("["+_.name+"]")};var w={},v=function(b,_){Function.prototype.apply.call(b,console,_)};return typeof console>"u"?function(){}:function(b,_){b=Array.prototype.slice.call(b);var k=console.log,A;_.level===n.TIME?(A=(_.name?"["+_.name+"] ":"")+b[0],b[1]==="start"?console.time?console.time(A):w[A]=new Date().getTime():console.timeEnd?console.timeEnd(A):v(k,[A+": "+(new Date().getTime()-w[A])+"ms"])):(_.level===n.WARN&&console.warn?k=console.warn:_.level===n.ERROR&&console.error?k=console.error:_.level===n.INFO&&console.info?k=console.info:_.level===n.DEBUG&&console.debug?k=console.debug:_.level===n.TRACE&&console.trace&&(k=console.trace),h.formatter(b,_),v(k,b))}},n.useDefaults=function(h){n.setLevel(h&&h.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(h))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof e<"u"&&e.exports?e.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(t)}),hf=es((t,e)=>{"use strict";(function(r){if(typeof t=="object"&&typeof e<"u")e.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,c,l){function p(w,v){if(!c[w]){if(!o[w]){var b=typeof pi=="function"&πif(!v&&b)return b(w,!0);if(g)return g(w,!0);var _=new Error("Cannot find module '"+w+"'");throw _.code="MODULE_NOT_FOUND",_}var k=c[w]={exports:{}};o[w][0].call(k.exports,function(A){var B=o[w][1][A];return p(B||A)},k,k.exports,s,o,c,l)}return c[w].exports}for(var g=typeof pi=="function"&&pi,h=0;h<l.length;h++)p(l[h]);return p}({1:[function(s,o,c){(function(l){"use strict";var p=l.MutationObserver||l.WebKitMutationObserver,g;if(p){var h=0,w=new p(A),v=l.document.createTextNode("");w.observe(v,{characterData:!0}),g=function(){v.data=h=++h%2}}else if(!l.setImmediate&&typeof l.MessageChannel<"u"){var b=new l.MessageChannel;b.port1.onmessage=A,g=function(){b.port2.postMessage(0)}}else"document"in l&&"onreadystatechange"in l.document.createElement("script")?g=function(){var G=l.document.createElement("script");G.onreadystatechange=function(){A(),G.onreadystatechange=null,G.parentNode.removeChild(G),G=null},l.document.documentElement.appendChild(G)}:g=function(){setTimeout(A,0)};var _,k=[];function A(){_=!0;for(var G,j,Z=k.length;Z;){for(j=k,k=[],G=-1;++G<Z;)j[G]();Z=k.length}_=!1}o.exports=B;function B(G){k.push(G)===1&&!_&&g()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,c){"use strict";var l=s(1);function p(){}var g={},h=["REJECTED"],w=["FULFILLED"],v=["PENDING"];o.exports=b;function b(q){if(typeof q!="function")throw new TypeError("resolver must be a function");this.state=v,this.queue=[],this.outcome=void 0,q!==p&&B(this,q)}b.prototype.catch=function(q){return this.then(null,q)},b.prototype.then=function(q,it){if(typeof q!="function"&&this.state===w||typeof it!="function"&&this.state===h)return this;var tt=new this.constructor(p);if(this.state!==v){var rt=this.state===w?q:it;k(tt,rt,this.outcome)}else this.queue.push(new _(tt,q,it));return tt};function _(q,it,tt){this.promise=q,typeof it=="function"&&(this.onFulfilled=it,this.callFulfilled=this.otherCallFulfilled),typeof tt=="function"&&(this.onRejected=tt,this.callRejected=this.otherCallRejected)}_.prototype.callFulfilled=function(q){g.resolve(this.promise,q)},_.prototype.otherCallFulfilled=function(q){k(this.promise,this.onFulfilled,q)},_.prototype.callRejected=function(q){g.reject(this.promise,q)},_.prototype.otherCallRejected=function(q){k(this.promise,this.onRejected,q)};function k(q,it,tt){l(function(){var rt;try{rt=it(tt)}catch(pt){return g.reject(q,pt)}rt===q?g.reject(q,new TypeError("Cannot resolve promise with itself")):g.resolve(q,rt)})}g.resolve=function(q,it){var tt=G(A,it);if(tt.status==="error")return g.reject(q,tt.value);var rt=tt.value;if(rt)B(q,rt);else{q.state=w,q.outcome=it;for(var pt=-1,Pt=q.queue.length;++pt<Pt;)q.queue[pt].callFulfilled(it)}return q},g.reject=function(q,it){q.state=h,q.outcome=it;for(var tt=-1,rt=q.queue.length;++tt<rt;)q.queue[tt].callRejected(it);return q};function A(q){var it=q&&q.then;if(q&&(typeof q=="object"||typeof q=="function")&&typeof it=="function")return function(){it.apply(q,arguments)}}function B(q,it){var tt=!1;function rt($t){tt||(tt=!0,g.reject(q,$t))}function pt($t){tt||(tt=!0,g.resolve(q,$t))}function Pt(){it(pt,rt)}var Nt=G(Pt);Nt.status==="error"&&rt(Nt.value)}function G(q,it){var tt={};try{tt.value=q(it),tt.status="success"}catch(rt){tt.status="error",tt.value=rt}return tt}b.resolve=j;function j(q){return q instanceof this?q:g.resolve(new this(p),q)}b.reject=Z;function Z(q){var it=new this(p);return g.reject(it,q)}b.all=St;function St(q){var it=this;if(Object.prototype.toString.call(q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var tt=q.length,rt=!1;if(!tt)return this.resolve([]);for(var pt=new Array(tt),Pt=0,Nt=-1,$t=new this(p);++Nt<tt;)Wt(q[Nt],Nt);return $t;function Wt(mt,Gt){it.resolve(mt).then(at,function(nt){rt||(rt=!0,g.reject($t,nt))});function at(nt){pt[Gt]=nt,++Pt===tt&&!rt&&(rt=!0,g.resolve($t,pt))}}}b.race=At;function At(q){var it=this;if(Object.prototype.toString.call(q)!=="[object Array]")return this.reject(new TypeError("must be an array"));var tt=q.length,rt=!1;if(!tt)return this.resolve([]);for(var pt=-1,Pt=new this(p);++pt<tt;)Nt(q[pt]);return Pt;function Nt($t){it.resolve($t).then(function(Wt){rt||(rt=!0,g.resolve(Pt,Wt))},function(Wt){rt||(rt=!0,g.reject(Pt,Wt))})}}},{1:1}],3:[function(s,o,c){(function(l){"use strict";typeof l.Promise!="function"&&(l.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,c){"use strict";var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f};function p(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function g(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var h=g();function w(){try{if(!h||!h.open)return!1;var f=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),m=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!f||m)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function v(f,m){f=f||[],m=m||{};try{return new Blob(f,m)}catch(C){if(C.name!=="TypeError")throw C;for(var y=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,I=new y,S=0;S<f.length;S+=1)I.append(f[S]);return I.getBlob(m.type)}}typeof Promise>"u"&&s(3);var b=Promise;function _(f,m){m&&f.then(function(y){m(null,y)},function(y){m(y)})}function k(f,m,y){typeof m=="function"&&f.then(m),typeof y=="function"&&f.catch(y)}function A(f){return typeof f!="string"&&(console.warn(f+" used as a key, but it is not a string."),f=String(f)),f}function B(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var G="local-forage-detect-blob-support",j=void 0,Z={},St=Object.prototype.toString,At="readonly",q="readwrite";function it(f){for(var m=f.length,y=new ArrayBuffer(m),I=new Uint8Array(y),S=0;S<m;S++)I[S]=f.charCodeAt(S);return y}function tt(f){return new b(function(m){var y=f.transaction(G,q),I=v([""]);y.objectStore(G).put(I,"key"),y.onabort=function(S){S.preventDefault(),S.stopPropagation(),m(!1)},y.oncomplete=function(){var S=navigator.userAgent.match(/Chrome\/(\d+)/),C=navigator.userAgent.match(/Edge\//);m(C||!S||parseInt(S[1],10)>=43)}}).catch(function(){return!1})}function rt(f){return typeof j=="boolean"?b.resolve(j):tt(f).then(function(m){return j=m,j})}function pt(f){var m=Z[f.name],y={};y.promise=new b(function(I,S){y.resolve=I,y.reject=S}),m.deferredOperations.push(y),m.dbReady?m.dbReady=m.dbReady.then(function(){return y.promise}):m.dbReady=y.promise}function Pt(f){var m=Z[f.name],y=m.deferredOperations.pop();if(y)return y.resolve(),y.promise}function Nt(f,m){var y=Z[f.name],I=y.deferredOperations.pop();if(I)return I.reject(m),I.promise}function $t(f,m){return new b(function(y,I){if(Z[f.name]=Z[f.name]||li(),f.db)if(m)pt(f),f.db.close();else return y(f.db);var S=[f.name];m&&S.push(f.version);var C=h.open.apply(h,S);m&&(C.onupgradeneeded=function(O){var $=C.result;try{$.createObjectStore(f.storeName),O.oldVersion<=1&&$.createObjectStore(G)}catch(W){if(W.name==="ConstraintError")console.warn('The database "'+f.name+'" has been upgraded from version '+O.oldVersion+" to version "+O.newVersion+', but the storage "'+f.storeName+'" already exists.');else throw W}}),C.onerror=function(O){O.preventDefault(),I(C.error)},C.onsuccess=function(){var O=C.result;O.onversionchange=function($){$.target.close()},y(O),Pt(f)}})}function Wt(f){return $t(f,!1)}function mt(f){return $t(f,!0)}function Gt(f,m){if(!f.db)return!0;var y=!f.db.objectStoreNames.contains(f.storeName),I=f.version<f.db.version,S=f.version>f.db.version;if(I&&(f.version!==m&&console.warn('The database "'+f.name+`" can't be downgraded from version `+f.db.version+" to version "+f.version+"."),f.version=f.db.version),S||y){if(y){var C=f.db.version+1;C>f.version&&(f.version=C)}return!0}return!1}function at(f){return new b(function(m,y){var I=new FileReader;I.onerror=y,I.onloadend=function(S){var C=btoa(S.target.result||"");m({__local_forage_encoded_blob:!0,data:C,type:f.type})},I.readAsBinaryString(f)})}function nt(f){var m=it(atob(f.data));return v([m],{type:f.type})}function Ft(f){return f&&f.__local_forage_encoded_blob}function ai(f){var m=this,y=m._initReady().then(function(){var I=Z[m._dbInfo.name];if(I&&I.dbReady)return I.dbReady});return k(y,f,f),y}function ci(f){pt(f);for(var m=Z[f.name],y=m.forages,I=0;I<y.length;I++){var S=y[I];S._dbInfo.db&&(S._dbInfo.db.close(),S._dbInfo.db=null)}return f.db=null,Wt(f).then(function(C){return f.db=C,Gt(f)?mt(f):C}).then(function(C){f.db=m.db=C;for(var O=0;O<y.length;O++)y[O]._dbInfo.db=C}).catch(function(C){throw Nt(f,C),C})}function ae(f,m,y,I){I===void 0&&(I=1);try{var S=f.db.transaction(f.storeName,m);y(null,S)}catch(C){if(I>0&&(!f.db||C.name==="InvalidStateError"||C.name==="NotFoundError"))return b.resolve().then(function(){if(!f.db||C.name==="NotFoundError"&&!f.db.objectStoreNames.contains(f.storeName)&&f.version<=f.db.version)return f.db&&(f.version=f.db.version+1),mt(f)}).then(function(){return ci(f).then(function(){ae(f,m,y,I-1)})}).catch(y);y(C)}}function li(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Is(f){var m=this,y={db:null};if(f)for(var I in f)y[I]=f[I];var S=Z[y.name];S||(S=li(),Z[y.name]=S),S.forages.push(m),m._initReady||(m._initReady=m.ready,m.ready=ai);var C=[];function O(){return b.resolve()}for(var $=0;$<S.forages.length;$++){var W=S.forages[$];W!==m&&C.push(W._initReady().catch(O))}var V=S.forages.slice(0);return b.all(C).then(function(){return y.db=S.db,Wt(y)}).then(function(F){return y.db=F,Gt(y,m._defaultConfig.version)?mt(y):F}).then(function(F){y.db=S.db=F,m._dbInfo=y;for(var J=0;J<V.length;J++){var ot=V[J];ot!==m&&(ot._dbInfo.db=y.db,ot._dbInfo.version=y.version)}})}function pn(f,m){var y=this;f=A(f);var I=new b(function(S,C){y.ready().then(function(){ae(y._dbInfo,At,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.get(f);V.onsuccess=function(){var F=V.result;F===void 0&&(F=null),Ft(F)&&(F=nt(F)),S(F)},V.onerror=function(){C(V.error)}}catch(F){C(F)}})}).catch(C)});return _(I,m),I}function Cs(f,m){var y=this,I=new b(function(S,C){y.ready().then(function(){ae(y._dbInfo,At,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.openCursor(),F=1;V.onsuccess=function(){var J=V.result;if(J){var ot=J.value;Ft(ot)&&(ot=nt(ot));var bt=f(ot,J.key,F++);bt!==void 0?S(bt):J.continue()}else S()},V.onerror=function(){C(V.error)}}catch(J){C(J)}})}).catch(C)});return _(I,m),I}function Ts(f,m,y){var I=this;f=A(f);var S=new b(function(C,O){var $;I.ready().then(function(){return $=I._dbInfo,St.call(m)==="[object Blob]"?rt($.db).then(function(W){return W?m:at(m)}):m}).then(function(W){ae(I._dbInfo,q,function(V,F){if(V)return O(V);try{var J=F.objectStore(I._dbInfo.storeName);W===null&&(W=void 0);var ot=J.put(W,f);F.oncomplete=function(){W===void 0&&(W=null),C(W)},F.onabort=F.onerror=function(){var bt=ot.error?ot.error:ot.transaction.error;O(bt)}}catch(bt){O(bt)}})}).catch(O)});return _(S,y),S}function ui(f,m){var y=this;f=A(f);var I=new b(function(S,C){y.ready().then(function(){ae(y._dbInfo,q,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=W.delete(f);$.oncomplete=function(){S()},$.onerror=function(){C(V.error)},$.onabort=function(){var F=V.error?V.error:V.transaction.error;C(F)}}catch(F){C(F)}})}).catch(C)});return _(I,m),I}function Pr(f){var m=this,y=new b(function(I,S){m.ready().then(function(){ae(m._dbInfo,q,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.clear();O.oncomplete=function(){I()},O.onabort=O.onerror=function(){var V=W.error?W.error:W.transaction.error;S(V)}}catch(V){S(V)}})}).catch(S)});return _(y,f),y}function ce(f){var m=this,y=new b(function(I,S){m.ready().then(function(){ae(m._dbInfo,At,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.count();W.onsuccess=function(){I(W.result)},W.onerror=function(){S(W.error)}}catch(V){S(V)}})}).catch(S)});return _(y,f),y}function dn(f,m){var y=this,I=new b(function(S,C){if(f<0){S(null);return}y.ready().then(function(){ae(y._dbInfo,At,function(O,$){if(O)return C(O);try{var W=$.objectStore(y._dbInfo.storeName),V=!1,F=W.openKeyCursor();F.onsuccess=function(){var J=F.result;if(!J){S(null);return}f===0||V?S(J.key):(V=!0,J.advance(f))},F.onerror=function(){C(F.error)}}catch(J){C(J)}})}).catch(C)});return _(I,m),I}function xs(f){var m=this,y=new b(function(I,S){m.ready().then(function(){ae(m._dbInfo,At,function(C,O){if(C)return S(C);try{var $=O.objectStore(m._dbInfo.storeName),W=$.openKeyCursor(),V=[];W.onsuccess=function(){var F=W.result;if(!F){I(V);return}V.push(F.key),F.continue()},W.onerror=function(){S(W.error)}}catch(F){S(F)}})}).catch(S)});return _(y,f),y}function a(f,m){m=B.apply(this,arguments);var y=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||y.name,f.storeName=f.storeName||y.storeName);var I=this,S;if(!f.name)S=b.reject("Invalid arguments");else{var C=f.name===y.name&&I._dbInfo.db,O=C?b.resolve(I._dbInfo.db):Wt(f).then(function($){var W=Z[f.name],V=W.forages;W.db=$;for(var F=0;F<V.length;F++)V[F]._dbInfo.db=$;return $});f.storeName?S=O.then(function($){if($.objectStoreNames.contains(f.storeName)){var W=$.version+1;pt(f);var V=Z[f.name],F=V.forages;$.close();for(var J=0;J<F.length;J++){var ot=F[J];ot._dbInfo.db=null,ot._dbInfo.version=W}var bt=new b(function(ft,Rt){var Tt=h.open(f.name,W);Tt.onerror=function(le){var ks=Tt.result;ks.close(),Rt(le)},Tt.onupgradeneeded=function(){var le=Tt.result;le.deleteObjectStore(f.storeName)},Tt.onsuccess=function(){var le=Tt.result;le.close(),ft(le)}});return bt.then(function(ft){V.db=ft;for(var Rt=0;Rt<F.length;Rt++){var Tt=F[Rt];Tt._dbInfo.db=ft,Pt(Tt._dbInfo)}}).catch(function(ft){throw(Nt(f,ft)||b.resolve()).catch(function(){}),ft})}}):S=O.then(function($){pt(f);var W=Z[f.name],V=W.forages;$.close();for(var F=0;F<V.length;F++){var J=V[F];J._dbInfo.db=null}var ot=new b(function(bt,ft){var Rt=h.deleteDatabase(f.name);Rt.onerror=function(){var Tt=Rt.result;Tt&&Tt.close(),ft(Rt.error)},Rt.onblocked=function(){console.warn('dropInstance blocked for database "'+f.name+'" until all open connections are closed')},Rt.onsuccess=function(){var Tt=Rt.result;Tt&&Tt.close(),bt(Tt)}});return ot.then(function(bt){W.db=bt;for(var ft=0;ft<V.length;ft++){var Rt=V[ft];Pt(Rt._dbInfo)}}).catch(function(bt){throw(Nt(f,bt)||b.resolve()).catch(function(){}),bt})})}return _(S,m),S}var u={_driver:"asyncStorage",_initStorage:Is,_support:w(),iterate:Cs,getItem:pn,setItem:Ts,removeItem:ui,clear:Pr,length:ce,key:dn,keys:xs,dropInstance:a};function d(){return typeof openDatabase=="function"}var E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D="~~local_forage_type~",M=/^~~local_forage_type~([^~]+)~/,K="__lfsc__:",dt=K.length,Ot="arbf",yt="blob",Ct="si08",Bt="ui08",lr="uic8",fn="si16",gn="si32",mc="ur16",yc="ui32",vc="fl32",bc="fl64",wc=dt+Ot.length,_c=Object.prototype.toString;function Ec(f){var m=f.length*.75,y=f.length,I,S=0,C,O,$,W;f[f.length-1]==="="&&(m--,f[f.length-2]==="="&&m--);var V=new ArrayBuffer(m),F=new Uint8Array(V);for(I=0;I<y;I+=4)C=E.indexOf(f[I]),O=E.indexOf(f[I+1]),$=E.indexOf(f[I+2]),W=E.indexOf(f[I+3]),F[S++]=C<<2|O>>4,F[S++]=(O&15)<<4|$>>2,F[S++]=($&3)<<6|W&63;return V}function Ds(f){var m=new Uint8Array(f),y="",I;for(I=0;I<m.length;I+=3)y+=E[m[I]>>2],y+=E[(m[I]&3)<<4|m[I+1]>>4],y+=E[(m[I+1]&15)<<2|m[I+2]>>6],y+=E[m[I+2]&63];return m.length%3===2?y=y.substring(0,y.length-1)+"=":m.length%3===1&&(y=y.substring(0,y.length-2)+"=="),y}function pd(f,m){var y="";if(f&&(y=_c.call(f)),f&&(y==="[object ArrayBuffer]"||f.buffer&&_c.call(f.buffer)==="[object ArrayBuffer]")){var I,S=K;f instanceof ArrayBuffer?(I=f,S+=Ot):(I=f.buffer,y==="[object Int8Array]"?S+=Ct:y==="[object Uint8Array]"?S+=Bt:y==="[object Uint8ClampedArray]"?S+=lr:y==="[object Int16Array]"?S+=fn:y==="[object Uint16Array]"?S+=mc:y==="[object Int32Array]"?S+=gn:y==="[object Uint32Array]"?S+=yc:y==="[object Float32Array]"?S+=vc:y==="[object Float64Array]"?S+=bc:m(new Error("Failed to get type for BinaryArray"))),m(S+Ds(I))}else if(y==="[object Blob]"){var C=new FileReader;C.onload=function(){var O=D+f.type+"~"+Ds(this.result);m(K+yt+O)},C.readAsArrayBuffer(f)}else try{m(JSON.stringify(f))}catch(O){console.error("Couldn't convert value into a JSON string: ",f),m(null,O)}}function dd(f){if(f.substring(0,dt)!==K)return JSON.parse(f);var m=f.substring(wc),y=f.substring(dt,wc),I;if(y===yt&&M.test(m)){var S=m.match(M);I=S[1],m=m.substring(S[0].length)}var C=Ec(m);switch(y){case Ot:return C;case yt:return v([C],{type:I});case Ct:return new Int8Array(C);case Bt:return new Uint8Array(C);case lr:return new Uint8ClampedArray(C);case fn:return new Int16Array(C);case mc:return new Uint16Array(C);case gn:return new Int32Array(C);case yc:return new Uint32Array(C);case vc:return new Float32Array(C);case bc:return new Float64Array(C);default:throw new Error("Unkown type: "+y)}}var As={serialize:pd,deserialize:dd,stringToBuffer:Ec,bufferToString:Ds};function Sc(f,m,y,I){f.executeSql("CREATE TABLE IF NOT EXISTS "+m.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],y,I)}function fd(f){var m=this,y={db:null};if(f)for(var I in f)y[I]=typeof f[I]!="string"?f[I].toString():f[I];var S=new b(function(C,O){try{y.db=openDatabase(y.name,String(y.version),y.description,y.size)}catch($){return O($)}y.db.transaction(function($){Sc($,y,function(){m._dbInfo=y,C()},function(W,V){O(V)})},O)});return y.serializer=As,S}function Xe(f,m,y,I,S,C){f.executeSql(y,I,S,function(O,$){$.code===$.SYNTAX_ERR?O.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[m.storeName],function(W,V){V.rows.length?C(W,$):Sc(W,m,function(){W.executeSql(y,I,S,C)},C)},C):C(O,$)},C)}function gd(f,m){var y=this;f=A(f);var I=new b(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Xe($,O,"SELECT * FROM "+O.storeName+" WHERE key = ? LIMIT 1",[f],function(W,V){var F=V.rows.length?V.rows.item(0).value:null;F&&(F=O.serializer.deserialize(F)),S(F)},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function md(f,m){var y=this,I=new b(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Xe($,O,"SELECT * FROM "+O.storeName,[],function(W,V){for(var F=V.rows,J=F.length,ot=0;ot<J;ot++){var bt=F.item(ot),ft=bt.value;if(ft&&(ft=O.serializer.deserialize(ft)),ft=f(ft,bt.key,ot+1),ft!==void 0){S(ft);return}}S()},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function Ic(f,m,y,I){var S=this;f=A(f);var C=new b(function(O,$){S.ready().then(function(){m===void 0&&(m=null);var W=m,V=S._dbInfo;V.serializer.serialize(m,function(F,J){J?$(J):V.db.transaction(function(ot){Xe(ot,V,"INSERT OR REPLACE INTO "+V.storeName+" (key, value) VALUES (?, ?)",[f,F],function(){O(W)},function(bt,ft){$(ft)})},function(ot){if(ot.code===ot.QUOTA_ERR){if(I>0){O(Ic.apply(S,[f,W,y,I-1]));return}$(ot)}})})}).catch($)});return _(C,y),C}function yd(f,m,y){return Ic.apply(this,[f,m,y,1])}function vd(f,m){var y=this;f=A(f);var I=new b(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Xe($,O,"DELETE FROM "+O.storeName+" WHERE key = ?",[f],function(){S()},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function bd(f){var m=this,y=new b(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Xe(O,C,"DELETE FROM "+C.storeName,[],function(){I()},function($,W){S(W)})})}).catch(S)});return _(y,f),y}function wd(f){var m=this,y=new b(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Xe(O,C,"SELECT COUNT(key) as c FROM "+C.storeName,[],function($,W){var V=W.rows.item(0).c;I(V)},function($,W){S(W)})})}).catch(S)});return _(y,f),y}function _d(f,m){var y=this,I=new b(function(S,C){y.ready().then(function(){var O=y._dbInfo;O.db.transaction(function($){Xe($,O,"SELECT key FROM "+O.storeName+" WHERE id = ? LIMIT 1",[f+1],function(W,V){var F=V.rows.length?V.rows.item(0).key:null;S(F)},function(W,V){C(V)})})}).catch(C)});return _(I,m),I}function Ed(f){var m=this,y=new b(function(I,S){m.ready().then(function(){var C=m._dbInfo;C.db.transaction(function(O){Xe(O,C,"SELECT key FROM "+C.storeName,[],function($,W){for(var V=[],F=0;F<W.rows.length;F++)V.push(W.rows.item(F).key);I(V)},function($,W){S(W)})})}).catch(S)});return _(y,f),y}function Sd(f){return new b(function(m,y){f.transaction(function(I){I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(S,C){for(var O=[],$=0;$<C.rows.length;$++)O.push(C.rows.item($).name);m({db:f,storeNames:O})},function(S,C){y(C)})},function(I){y(I)})})}function Id(f,m){m=B.apply(this,arguments);var y=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||y.name,f.storeName=f.storeName||y.storeName);var I=this,S;return f.name?S=new b(function(C){var O;f.name===y.name?O=I._dbInfo.db:O=openDatabase(f.name,"","",0),f.storeName?C({db:O,storeNames:[f.storeName]}):C(Sd(O))}).then(function(C){return new b(function(O,$){C.db.transaction(function(W){function V(bt){return new b(function(ft,Rt){W.executeSql("DROP TABLE IF EXISTS "+bt,[],function(){ft()},function(Tt,le){Rt(le)})})}for(var F=[],J=0,ot=C.storeNames.length;J<ot;J++)F.push(V(C.storeNames[J]));b.all(F).then(function(){O()}).catch(function(bt){$(bt)})},function(W){$(W)})})}):S=b.reject("Invalid arguments"),_(S,m),S}var Cd={_driver:"webSQLStorage",_initStorage:fd,_support:d(),iterate:md,getItem:gd,setItem:yd,removeItem:vd,clear:bd,length:wd,key:_d,keys:Ed,dropInstance:Id};function Td(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Cc(f,m){var y=f.name+"/";return f.storeName!==m.storeName&&(y+=f.storeName+"/"),y}function xd(){var f="_localforage_support_test";try{return localStorage.setItem(f,!0),localStorage.removeItem(f),!1}catch{return!0}}function Dd(){return!xd()||localStorage.length>0}function Ad(f){var m=this,y={};if(f)for(var I in f)y[I]=f[I];return y.keyPrefix=Cc(f,m._defaultConfig),Dd()?(m._dbInfo=y,y.serializer=As,b.resolve()):b.reject()}function Nd(f){var m=this,y=m.ready().then(function(){for(var I=m._dbInfo.keyPrefix,S=localStorage.length-1;S>=0;S--){var C=localStorage.key(S);C.indexOf(I)===0&&localStorage.removeItem(C)}});return _(y,f),y}function Od(f,m){var y=this;f=A(f);var I=y.ready().then(function(){var S=y._dbInfo,C=localStorage.getItem(S.keyPrefix+f);return C&&(C=S.serializer.deserialize(C)),C});return _(I,m),I}function kd(f,m){var y=this,I=y.ready().then(function(){for(var S=y._dbInfo,C=S.keyPrefix,O=C.length,$=localStorage.length,W=1,V=0;V<$;V++){var F=localStorage.key(V);if(F.indexOf(C)===0){var J=localStorage.getItem(F);if(J&&(J=S.serializer.deserialize(J)),J=f(J,F.substring(O),W++),J!==void 0)return J}}});return _(I,m),I}function Pd(f,m){var y=this,I=y.ready().then(function(){var S=y._dbInfo,C;try{C=localStorage.key(f)}catch{C=null}return C&&(C=C.substring(S.keyPrefix.length)),C});return _(I,m),I}function Rd(f){var m=this,y=m.ready().then(function(){for(var I=m._dbInfo,S=localStorage.length,C=[],O=0;O<S;O++){var $=localStorage.key(O);$.indexOf(I.keyPrefix)===0&&C.push($.substring(I.keyPrefix.length))}return C});return _(y,f),y}function Ld(f){var m=this,y=m.keys().then(function(I){return I.length});return _(y,f),y}function Md(f,m){var y=this;f=A(f);var I=y.ready().then(function(){var S=y._dbInfo;localStorage.removeItem(S.keyPrefix+f)});return _(I,m),I}function Ud(f,m,y){var I=this;f=A(f);var S=I.ready().then(function(){m===void 0&&(m=null);var C=m;return new b(function(O,$){var W=I._dbInfo;W.serializer.serialize(m,function(V,F){if(F)$(F);else try{localStorage.setItem(W.keyPrefix+f,V),O(C)}catch(J){(J.name==="QuotaExceededError"||J.name==="NS_ERROR_DOM_QUOTA_REACHED")&&$(J),$(J)}})})});return _(S,y),S}function Bd(f,m){if(m=B.apply(this,arguments),f=typeof f!="function"&&f||{},!f.name){var y=this.config();f.name=f.name||y.name,f.storeName=f.storeName||y.storeName}var I=this,S;return f.name?S=new b(function(C){f.storeName?C(Cc(f,I._defaultConfig)):C(f.name+"/")}).then(function(C){for(var O=localStorage.length-1;O>=0;O--){var $=localStorage.key(O);$.indexOf(C)===0&&localStorage.removeItem($)}}):S=b.reject("Invalid arguments"),_(S,m),S}var jd={_driver:"localStorageWrapper",_initStorage:Ad,_support:Td(),iterate:kd,getItem:Od,setItem:Ud,removeItem:Md,clear:Nd,length:Ld,key:Pd,keys:Rd,dropInstance:Bd},$d=function(f,m){return f===m||typeof f=="number"&&typeof m=="number"&&isNaN(f)&&isNaN(m)},Fd=function(f,m){for(var y=f.length,I=0;I<y;){if($d(f[I],m))return!0;I++}return!1},Tc=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"},mn={},xc={},Rr={INDEXEDDB:u,WEBSQL:Cd,LOCALSTORAGE:jd},Hd=[Rr.INDEXEDDB._driver,Rr.WEBSQL._driver,Rr.LOCALSTORAGE._driver],hi=["dropInstance"],Ns=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(hi),Vd={description:"",driver:Hd.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function qd(f,m){f[m]=function(){var y=arguments;return f.ready().then(function(){return f[m].apply(f,y)})}}function Os(){for(var f=1;f<arguments.length;f++){var m=arguments[f];if(m)for(var y in m)m.hasOwnProperty(y)&&(Tc(m[y])?arguments[0][y]=m[y].slice():arguments[0][y]=m[y])}return arguments[0]}var Wd=function(){function f(m){p(this,f);for(var y in Rr)if(Rr.hasOwnProperty(y)){var I=Rr[y],S=I._driver;this[y]=S,mn[S]||this.defineDriver(I)}this._defaultConfig=Os({},Vd),this._config=Os({},this._defaultConfig,m),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return f.prototype.config=function(m){if((typeof m>"u"?"undefined":l(m))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var y in m){if(y==="storeName"&&(m[y]=m[y].replace(/\W/g,"_")),y==="version"&&typeof m[y]!="number")return new Error("Database version must be a number.");this._config[y]=m[y]}return"driver"in m&&m.driver?this.setDriver(this._config.driver):!0}else return typeof m=="string"?this._config[m]:this._config},f.prototype.defineDriver=function(m,y,I){var S=new b(function(C,O){try{var $=m._driver,W=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){O(W);return}for(var V=Ns.concat("_initStorage"),F=0,J=V.length;F<J;F++){var ot=V[F],bt=!Fd(hi,ot);if((bt||m[ot])&&typeof m[ot]!="function"){O(W);return}}var ft=function(){for(var Tt=function(zd){return function(){var Kd=new Error("Method "+zd+" is not implemented by the current driver"),Dc=b.reject(Kd);return _(Dc,arguments[arguments.length-1]),Dc}},le=0,ks=hi.length;le<ks;le++){var Ps=hi[le];m[Ps]||(m[Ps]=Tt(Ps))}};ft();var Rt=function(Tt){mn[$]&&console.info("Redefining LocalForage driver: "+$),mn[$]=m,xc[$]=Tt,C()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Rt,O):Rt(!!m._support):Rt(!0)}catch(Tt){O(Tt)}});return k(S,y,I),S},f.prototype.driver=function(){return this._driver||null},f.prototype.getDriver=function(m,y,I){var S=mn[m]?b.resolve(mn[m]):b.reject(new Error("Driver not found."));return k(S,y,I),S},f.prototype.getSerializer=function(m){var y=b.resolve(As);return k(y,m),y},f.prototype.ready=function(m){var y=this,I=y._driverSet.then(function(){return y._ready===null&&(y._ready=y._initDriver()),y._ready});return k(I,m,m),I},f.prototype.setDriver=function(m,y,I){var S=this;Tc(m)||(m=[m]);var C=this._getSupportedDrivers(m);function O(){S._config.driver=S.driver()}function $(F){return S._extend(F),O(),S._ready=S._initStorage(S._config),S._ready}function W(F){return function(){var J=0;function ot(){for(;J<F.length;){var bt=F[J];return J++,S._dbInfo=null,S._ready=null,S.getDriver(bt).then($).catch(ot)}O();var ft=new Error("No available storage method found.");return S._driverSet=b.reject(ft),S._driverSet}return ot()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return b.resolve()}):b.resolve();return this._driverSet=V.then(function(){var F=C[0];return S._dbInfo=null,S._ready=null,S.getDriver(F).then(function(J){S._driver=J._driver,O(),S._wrapLibraryMethodsWithReady(),S._initDriver=W(C)})}).catch(function(){O();var F=new Error("No available storage method found.");return S._driverSet=b.reject(F),S._driverSet}),k(this._driverSet,y,I),this._driverSet},f.prototype.supports=function(m){return!!xc[m]},f.prototype._extend=function(m){Os(this,m)},f.prototype._getSupportedDrivers=function(m){for(var y=[],I=0,S=m.length;I<S;I++){var C=m[I];this.supports(C)&&y.push(C)}return y},f.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,y=Ns.length;m<y;m++)qd(this,Ns[m])},f.prototype.createInstance=function(m){return new f(m)},f}(),Gd=new Wd;o.exports=Gd},{3:3}]},{},[4])(4)})}),Ou=es(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLBuilder=void 0;var e=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();t.URLBuilder=e}),pf=es((t,e)=>{"use strict";(function(r,n){typeof t=="object"&&typeof e<"u"?e.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(t,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var c={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(c,o),function(l,p){var g=o.retries,h=o.retryDelay,w=o.retryOn;if(p&&p.retries!==void 0)if(n(p.retries))g=p.retries;else throw new i("retries must be a positive integer");if(p&&p.retryDelay!==void 0)if(n(p.retryDelay)||typeof p.retryDelay=="function")h=p.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(p&&p.retryOn)if(Array.isArray(p.retryOn)||typeof p.retryOn=="function")w=p.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(v,b){var _=function(A){var B=typeof Request<"u"&&l instanceof Request?l.clone():l;s(B,p).then(function(G){if(Array.isArray(w)&&w.indexOf(G.status)===-1)v(G);else if(typeof w=="function")try{return Promise.resolve(w(A,null,G)).then(function(j){j?k(A,null,G):v(G)}).catch(b)}catch(j){b(j)}else A<g?k(A,null,G):v(G)}).catch(function(G){if(typeof w=="function")try{Promise.resolve(w(A,G,null)).then(function(j){j?k(A,G,null):b(G)}).catch(function(j){b(j)})}catch(j){b(j)}else A<g?k(A,G,null):b(G)})};function k(A,B,G){var j=typeof h=="function"?h(A,B,G):h;setTimeout(function(){_(++A)},j)}_(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),df="9.12.15",H=class yo{static SDK_VERSION=df;static SDK_VERSION_CODE;static SDK="WEB";static LOG_PREFIX="CooeeSDK";static COOEE="cooee";static SESSION_STORAGE_SCROLL_ID="sleid";static IDLE_TIME_IN_SECONDS=30*60;static IN_APP_WRAPPER_NAME="cooee-wrapper";static IN_APP_CONTAINER_NAME="cooee-container";static IN_APP_DEFAULT_PADDING=15;static EVENT_SCREEN_VIEW="CE Screen View";static EVENT_APP_BACKGROUND="CE App Background";static EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed";static EVENT_CAMPAIGN_HOLDOUT="CE Campaign Holdout";static EVENT_CAMPAIGN_REJECTED="CE Campaign Rejected";static EVENT_CAMPAIGN_FAILED="CE Campaign Failed";static EVENT_TRIGGER_CLOSED="CE Trigger Closed";static EVENT_SCROLL="CE Scroll";static EVENT_TRIGGER_CLICKED="CE Trigger Clicked";static EVENT_FORM_SUBMITTED="CE Form Submitted";static EVENT_EXPERIMENT_START="CE Experiment Start";static EVENT_VIDEO_DIALOG_CLOSED="CE Video Dialog Closed";static EVENT_VIDEO_DIALOG_OPENED="CE Video Dialog Opened";static EVENT_VIDEO_CHANGE="CE Video Changed";static EVENT_LAST_VIDEO_ENDED="CE Last Video Ended";static EVENT_VIDEO_MUTED="CE Video Muted";static EVENT_VIDEO_UNMUTED="CE Video Unmuted";static EVENT_ADD_TO_CART_CLICKED="CE Add To Cart Clicked";static EVENT_VIEW_ITEM_CLICKED="CE View Item Clicked";static EVENT_MORE_ITEM_INFO_CLICKED="CE More Item Info Clicked";static EVENT_OPEN_CART_CLICKED="CE Open Cart Clicked";static EVENT_ADD_TO_CART="Add To Cart";static EVENT_REMOVE_FROM_CART="Remove From Cart";static EVENT_VIEW_ITEM="View Item";static EVENT_VIEW_CART="View Cart";static EVENT_OPEN_CART="Open Cart";static EVENT_VIEW_COLLECTION="View Collection";static EVENT_BUY_NOW_CLICKED="Buy Now Clicked";static EVENT_CHECKOUT_STARTED="Checkout Started";static EVENT_REVIEW_CLICKED="Review Clicked";static EVENT_ITEM_THUMBNAIL_CLICKED="Item Thumbnail Clicked";static JS_LOAD_WHITELIST_EVENTS=[this.EVENT_VIEW_ITEM,this.EVENT_VIEW_CART,this.EVENT_VIEW_COLLECTION];static HASH_INITIATE_CHECKOUT="initiate-checkout";static HASH_OPEN_CART_DRAWER="open-cart-drawer";static ADD_BUNDLE_CTA_INBOUND_EVENT="letscooee:inbound:cta:add-bundle";static CTA_OPEN_CART_EVENT="letscooee:outbound:open-cart";static CTA_AFTER_REFRESH_UI="letscooee:outbound:refresh-ui";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static SHADOW_SPLITTER=":shadow";static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static CONTENT_ATTRIBUTE="_letscooee_content";static VIA="_via";static PAYMENT_MODAL_DETAILS=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}];static{let e=yo.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");yo.SDK_VERSION_CODE=parseInt(e,10)}},Ge={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${H.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${H.SDK_VERSION}/dist/widget.min.js`},de=ke(rn()),x=class{static log(...t){de.default.info(...t)}static debug(...t){de.default.debug(...t)}static error(...t){de.default.error(...t)}static warn(...t){de.default.warn(...t)}static info(...t){de.default.info(...t)}static trace(...t){de.default.trace(...t)}};function ff(t=H.LOG_PREFIX){de.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${H.SDK_VERSION}):`)}});let e=ku();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?de.default.setLevel(de.default[localStorage.cooeeLogLevel]):de.default.setLevel(Ge.debug?de.default.TRACE:de.default.OFF)}function ku(){return new URL(location.href).searchParams?.get("cooee-debug")}function gf(){let t=`
|
|
2
2
|
display: inline-block;
|
|
3
3
|
font-size: 14px;
|
|
4
4
|
background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
|
|
@@ -13,28 +13,28 @@
|
|
|
13
13
|
`,e+=`
|
|
14
14
|
|
|
15
15
|
`,e+=`Learn more: https://www.letscooee.com
|
|
16
|
-
Cooee SDK: v${H.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}var Ou=(()=>{class t{static entityMap={'"':"""};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})(),ie=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}},ye=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}(ye||{}),Ci=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(Ci||{}),ku=function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t}(ku||{}),Tn=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}(Tn||{}),ke=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}(ke||{}),Pu=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}(Pu||{}),yo=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(yo||{}),Ie=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}(Ie||{}),oa=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(oa||{}),Ru=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Ru||{}),Lu=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}(Lu||{}),xn=class Mu{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,s)=>s.findIndex(o=>o[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,Mu.swap(e,r,n)}}},gf=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},Uu=class{s;g;i;constructor(t){t.s&&(this.s=new ne(t.s)),t.g&&(this.g=new _f(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},Un="a-f\\d",mf=`#?[${Un}]{3}[${Un}]?`,yf=`#?[${Un}]{6}([${Un}]{2})?`,vf=new RegExp(`[^#${Un}]`,"gi"),bf=new RegExp(`^${mf}$|^${yf}$`,"i");function wf(t,e={}){if(typeof t!="string"||vf.test(t)||!bf.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,s=n>>8&255,o=n&255,c=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,s,o,c];if(e.format==="css"){let l=c===1?"":` / ${Number((c*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${l})`}return{red:i,green:s,blue:o,alpha:c}}var ne=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return wf(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}},aa=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new ne(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return ca[this.s??1]}},ca=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))(ca||{}),_f=class Bu{static DEFAULT_FALLBACK=new ne({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new ne(e.c)),e.fb&&(this.fb=new ne(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??Bu.DEFAULT_FALLBACK}},Ef=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new ne(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},la=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}},ju=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}},ua=(t=>(t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY",t))(ua||{}),Sf=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(e=>new If(e))}},If=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}},Ge=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return ua[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new ne(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new ne(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new Sf(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},Cf=class{modifications;constructor(t={}){t.modifications?.length?this.modifications=t.modifications.map(e=>new Ac(e)):t.experiments?.length&&(this.modifications=t.experiments.map(e=>new Ac(e)))}},Ac=class{cssSelector;type;display;bg;typo;br;text;constructor(t={}){this.cssSelector=t.cssSelector??"",this.type=t.type??"OTHER",this.display=t.display,t.bg&&(this.bg=new ne(t.bg)),t.typo&&(this.typo=new Ge(t.typo)),t.br&&(this.br=new aa(t.br)),this.text=t.text}get style(){let t={};return this.display==="HIDE"?t.display="none":this.display==="BLOCK"?t.display="block":this.display==="INLINE"&&(t.display="inline"),this.br?.r&&(t.borderRadius=this.br.r+"px"),this.br?.w&&(t.borderWidth=this.br.w+"px"),this.br?.s&&(t.borderStyle=ca[this.br.s]?.toLowerCase()),this.br?.c?.h&&(t.borderColor=this.br.color?.rgba),this.bg?.h&&(t.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(t.fontSize=this.typo.fs+"px"),this.typo.lh&&(t.lineHeight=this.typo.lh),this.typo.fw&&(t.fontWeight=this.typo.fw),this.typo.ta&&(t.textAlign=this.typo.alignment),this.typo.tc.h&&(t.color=this.typo.tc.rgba),this.typo.ls&&(t.letterSpacing=this.typo.letterSpacing),this.typo.td&&(t.textDecoration=this.typo.td??"none")),t}toString(){return`Experiment(cssSelector=${this.cssSelector})`}},en=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price,this.finalPrice=t.finalPrice??t.price}},Tf=class{minValue;rewardType;label;reachingText;reachedText;discount;items;reached;calculatedAlignment;constructor(t){this.reached=t.reached??!1,this.calculatedAlignment=t.calculatedAlignment,this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(e=>new en(e))}},xf=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(t){this.layout=t.layout??Ru.ICONS,this.onlyLatestGift=t.onlyLatestGift,this.noConfetti=t.noConfetti,this.removeIneligibleItem=t.removeIneligibleItem??!0,this.restrictToLatestFreebie=t.restrictToLatestFreebie,this.rewardBasis=t.rewardBasis??"CART_AMOUNT",this.update(t)}update(t){t=t??{},this.milestones=t.milestones?.map(e=>new Tf(e))??[],this.totalProgress=t.totalProgress??0,this.coupons=t.coupons,this.reachedAmountOrCount=t.reachedAmountOrCount}},Df=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(t={}){this.animateNumber=t.animateNumber??!0,this.animation=t.animation??"SLOT_MACHINE",this.animationDuration=t.animationDuration??1e3,this.text=t.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=t.iconURL,this.totalSavings=t.totalSavings??0}},Gn=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}static parseToAny(t){try{return JSON.parse(t.toString())}catch{}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise(e=>setTimeout(e,t))}static hasKeys(t){return t?Object.keys(t).length>=1:!1}static convertObjectToArray(t,e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&t[n]!=null&&r.push({[n]:t[n]}),r),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce((e,r)=>(t[r]!==null&&t[r]!==void 0&&(e[r]=t[r]),e),{})}static stringify(t){return JSON.stringify(t,function(e,r){return r===void 0?null:r})}},it=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,wt=globalThis,mr="9.42.0";function es(){return rs(wt),wt}function rs(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||mr,e[mr]=e[mr]||{}}function zn(t,e,r=wt){let n=r.__SENTRY__=r.__SENTRY__||{},i=n[mr]=n[mr]||{};return i[t]||(i[t]=e())}var Af=["debug","info","warn","error","log","assert","trace"],Nf="Sentry Logger ",Li={};function ns(t){if(!("console"in wt))return t();let e=wt.console,r={},n=Object.keys(Li);n.forEach(i=>{let s=Li[i];r[i]=e[i],e[i]=s});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function Of(){pa().enabled=!0}function kf(){pa().enabled=!1}function $u(){return pa().enabled}function Pf(...t){ha("log",...t)}function Rf(...t){ha("warn",...t)}function Lf(...t){ha("error",...t)}function ha(t,...e){it&&$u()&&ns(()=>{wt.console[t](`${Nf}[${t}]:`,...e)})}function pa(){return it?zn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var X={enable:Of,disable:kf,isEnabled:$u,log:Pf,warn:Rf,error:Lf},_r="?",Nc=/\(error: (.*)\)/,Oc=/captureMessage|captureException/;function Mf(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
17
|
-
`);for(let c=n;c<o.length;c++){let l=o[c];if(l.length>1024)continue;let p=
|
|
16
|
+
Cooee SDK: v${H.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}var Pu=(()=>{class t{static entityMap={'"':"""};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})(),se=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}},ve=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}(ve||{}),Ti=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(Ti||{}),Ru=function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t}(Ru||{}),Dn=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}(Dn||{}),Pe=function(t){return t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer",t}(Pe||{}),Lu=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}(Lu||{}),vo=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(vo||{}),Ce=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}(Ce||{}),aa=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(aa||{}),Mu=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Mu||{}),Uu=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}(Uu||{}),An=class Bu{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,s)=>s.findIndex(o=>o[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,Bu.swap(e,r,n)}}},mf=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},ju=class{s;g;i;constructor(t){t.s&&(this.s=new ie(t.s)),t.g&&(this.g=new Ef(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},Bn="a-f\\d",yf=`#?[${Bn}]{3}[${Bn}]?`,vf=`#?[${Bn}]{6}([${Bn}]{2})?`,bf=new RegExp(`[^#${Bn}]`,"gi"),wf=new RegExp(`^${yf}$|^${vf}$`,"i");function _f(t,e={}){if(typeof t!="string"||bf.test(t)||!wf.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,s=n>>8&255,o=n&255,c=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,s,o,c];if(e.format==="css"){let l=c===1?"":` / ${Number((c*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${l})`}return{red:i,green:s,blue:o,alpha:c}}var ie=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return _f(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}},ca=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new ie(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return la[this.s??1]}},la=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))(la||{}),Ef=class $u{static DEFAULT_FALLBACK=new ie({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new ie(e.c)),e.fb&&(this.fb=new ie(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??$u.DEFAULT_FALLBACK}},Sf=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new ie(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},ua=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}},Fu=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}},ha=(t=>(t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY",t))(ha||{}),If=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(e=>new Cf(e))}},Cf=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}},ze=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return ha[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new ie(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new ie(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new If(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},Tf=class{modifications;constructor(t={}){t.modifications?.length?this.modifications=t.modifications.map(e=>new Oc(e)):t.experiments?.length&&(this.modifications=t.experiments.map(e=>new Oc(e)))}},Oc=class{cssSelector;type;display;bg;typo;br;text;constructor(t={}){this.cssSelector=t.cssSelector??"",this.type=t.type??"OTHER",this.display=t.display,t.bg&&(this.bg=new ie(t.bg)),t.typo&&(this.typo=new ze(t.typo)),t.br&&(this.br=new ca(t.br)),this.text=t.text}get style(){let t={};return this.display==="HIDE"?t.display="none":this.display==="BLOCK"?t.display="block":this.display==="INLINE"&&(t.display="inline"),this.br?.r&&(t.borderRadius=this.br.r+"px"),this.br?.w&&(t.borderWidth=this.br.w+"px"),this.br?.s&&(t.borderStyle=la[this.br.s]?.toLowerCase()),this.br?.c?.h&&(t.borderColor=this.br.color?.rgba),this.bg?.h&&(t.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(t.fontSize=this.typo.fs+"px"),this.typo.lh&&(t.lineHeight=this.typo.lh),this.typo.fw&&(t.fontWeight=this.typo.fw),this.typo.ta&&(t.textAlign=this.typo.alignment),this.typo.tc.h&&(t.color=this.typo.tc.rgba),this.typo.ls&&(t.letterSpacing=this.typo.letterSpacing),this.typo.td&&(t.textDecoration=this.typo.td??"none")),t}toString(){return`Experiment(cssSelector=${this.cssSelector})`}},nn=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price,this.finalPrice=t.finalPrice??t.price}},xf=class{minValue;rewardType;label;reachingText;reachedText;discount;items;reached;calculatedAlignment;constructor(t){this.reached=t.reached??!1,this.calculatedAlignment=t.calculatedAlignment,this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(e=>new nn(e))}},Df=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(t){this.layout=t.layout??Mu.ICONS,this.onlyLatestGift=t.onlyLatestGift,this.noConfetti=t.noConfetti,this.removeIneligibleItem=t.removeIneligibleItem??!0,this.restrictToLatestFreebie=t.restrictToLatestFreebie,this.rewardBasis=t.rewardBasis??"CART_AMOUNT",this.update(t)}update(t){t=t??{},this.milestones=t.milestones?.map(e=>new xf(e))??[],this.totalProgress=t.totalProgress??0,this.coupons=t.coupons,this.reachedAmountOrCount=t.reachedAmountOrCount}},Af=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(t={}){this.animateNumber=t.animateNumber??!0,this.animation=t.animation??"SLOT_MACHINE",this.animationDuration=t.animationDuration??1e3,this.text=t.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=t.iconURL,this.totalSavings=t.totalSavings??0}},zn=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}static parseToAny(t){try{return JSON.parse(t.toString())}catch{}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise(e=>setTimeout(e,t))}static hasKeys(t){return t?Object.keys(t).length>=1:!1}static convertObjectToArray(t,e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&t[n]!=null&&r.push({[n]:t[n]}),r),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce((e,r)=>(t[r]!==null&&t[r]!==void 0&&(e[r]=t[r]),e),{})}static stringify(t){return JSON.stringify(t,function(e,r){return r===void 0?null:r})}},st=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,_t=globalThis,yr="9.42.0";function rs(){return ns(_t),_t}function ns(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||yr,e[yr]=e[yr]||{}}function Kn(t,e,r=_t){let n=r.__SENTRY__=r.__SENTRY__||{},i=n[yr]=n[yr]||{};return i[t]||(i[t]=e())}var Nf=["debug","info","warn","error","log","assert","trace"],Of="Sentry Logger ",Mi={};function is(t){if(!("console"in _t))return t();let e=_t.console,r={},n=Object.keys(Mi);n.forEach(i=>{let s=Mi[i];r[i]=e[i],e[i]=s});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function kf(){da().enabled=!0}function Pf(){da().enabled=!1}function Hu(){return da().enabled}function Rf(...t){pa("log",...t)}function Lf(...t){pa("warn",...t)}function Mf(...t){pa("error",...t)}function pa(t,...e){st&&Hu()&&is(()=>{_t.console[t](`${Of}[${t}]:`,...e)})}function da(){return st?Kn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var Q={enable:kf,disable:Pf,isEnabled:Hu,log:Rf,warn:Lf,error:Mf},Er="?",kc=/\(error: (.*)\)/,Pc=/captureMessage|captureException/;function Uf(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
17
|
+
`);for(let c=n;c<o.length;c++){let l=o[c];if(l.length>1024)continue;let p=kc.test(l)?l.replace(kc,"$1"):l;if(!p.match(/\S*Error: /)){for(let g of e){let h=g(p);if(h){s.push(h);break}}if(s.length>=50+i)break}}return Bf(s.slice(i))}}function Bf(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(di(e).function||"")&&e.pop(),e.reverse(),Pc.test(di(e).function||"")&&(e.pop(),Pc.test(di(e).function||"")&&e.pop()),e.slice(0,50).map(r=>lt(T({},r),{filename:r.filename||di(e).filename,function:r.function||Er}))}function di(t){return t[t.length-1]||{}}var Rs="<anonymous>";function nr(t){try{return!t||typeof t!="function"?Rs:t.name||Rs}catch{return Rs}}function Rc(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 xi={},Lc={};function Ar(t,e){xi[t]=xi[t]||[],xi[t].push(e)}function Nr(t,e){if(!Lc[t]){Lc[t]=!0;try{e()}catch(r){st&&Q.error(`Error while instrumenting ${t}`,r)}}}function Ee(t,e){let r=t&&xi[t];if(r)for(let n of r)try{n(e)}catch(i){st&&Q.error(`Error while triggering instrumentation handler.
|
|
18
18
|
Type: ${t}
|
|
19
|
-
Name: ${
|
|
20
|
-
Error:`,i)}}var Rs=null;function Bf(t){let e="error";Dr(e,t),Ar(e,jf)}function jf(){Rs=wt.onerror,wt.onerror=function(t,e,r,n,i){return _e("error",{column:n,error:i,line:r,msg:t,url:e}),Rs?Rs.apply(this,arguments):!1},wt.onerror.__SENTRY_INSTRUMENTED__=!0}var Ls=null;function $f(t){let e="unhandledrejection";Dr(e,t),Ar(e,Ff)}function Ff(){Ls=wt.onunhandledrejection,wt.onunhandledrejection=function(t){return _e("unhandledrejection",t),Ls?Ls.apply(this,arguments):!0},wt.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var Fu=Object.prototype.toString;function da(t){switch(Fu.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return nr(t,Error)}}function rn(t,e){return Fu.call(t)===`[object ${e}]`}function Hu(t){return rn(t,"ErrorEvent")}function Rc(t){return rn(t,"DOMError")}function Hf(t){return rn(t,"DOMException")}function $e(t){return rn(t,"String")}function fa(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function ga(t){return t===null||fa(t)||typeof t!="object"&&typeof t!="function"}function Bn(t){return rn(t,"Object")}function is(t){return typeof Event<"u"&&nr(t,Event)}function Vf(t){return typeof Element<"u"&&nr(t,Element)}function qf(t){return rn(t,"RegExp")}function ss(t){return!!(t?.then&&typeof t.then=="function")}function Wf(t){return Bn(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function nr(t,e){try{return t instanceof e}catch{return!1}}function Vu(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Gf(t){return typeof Request<"u"&&nr(t,Request)}var ma=wt,zf=80;function qu(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],s=0,o=0,c=" > ",l=c.length,p,g=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||zf;for(;r&&s++<n&&(p=Kf(r,g),!(p==="html"||s>1&&o+i.length*l+p.length>=h));)i.push(p),o+=p.length,r=r.parentNode;return i.reverse().join(c)}catch{return"<unknown>"}}function Kf(t,e){let r=t,n=[];if(!r?.tagName)return"";if(ma.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(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i?.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&$e(o)){let c=o.split(/\s+/);for(let l of c)n.push(`.${l}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let c=r.getAttribute(o);c&&n.push(`[${o}="${c}"]`)}return n.join("")}function Wu(){try{return ma.document.location.href}catch{return""}}function Yf(t){if(!ma.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 Mi(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Lc(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{Vu(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function Jf(t,e,r=!1){return $e(t)?qf(e)?e.test(t):$e(e)?r?t===e:t.includes(e):!1:!1}function os(t,e=[],r=!1){return e.some(n=>Jf(t,n,r))}function re(t,e,r){if(!(e in t))return;let n=t[e];if(typeof n!="function")return;let i=r(n);typeof i=="function"&&Gu(i,n);try{t[e]=i}catch{it&&X.log(`Failed to replace method "${e}" in object`,t)}}function Er(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{it&&X.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Gu(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,Er(t,"__sentry_original__",e)}catch{}}function ya(t){return t.__sentry_original__}function zu(t){if(da(t))return T({message:t.message,name:t.name,stack:t.stack},Uc(t));if(is(t)){let e=T({type:t.type,target:Mc(t.target),currentTarget:Mc(t.currentTarget)},Uc(t));return typeof CustomEvent<"u"&&nr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Mc(t){try{return Vf(t)?qu(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Uc(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 Xf(t,e=40){let r=Object.keys(zu(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return Mi(n,e);for(let i=r.length;i>0;i--){let s=r.slice(0,i).join(", ");if(!(s.length>e))return i===r.length?s:Mi(s,e)}return""}function Qf(){let t=wt;return t.crypto||t.msCrypto}function fe(t=Qf()){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 Ku(t){return t.exception?.values?.[0]}function pr(t){let{message:e,event_id:r}=t;if(e)return e;let n=Ku(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function vo(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type=r||"Error")}function qr(t,e){let r=Ku(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=T(T(T({},n),i),e),e&&"data"in e){let s=T(T({},i?.data),e.data);r.mechanism.data=s}}function Bc(t){if(Zf(t))return!0;try{Er(t,"__sentry_captured__",!0)}catch{}return!1}function Zf(t){try{return t.__sentry_captured__}catch{}}var Yu=1e3;function Kn(){return Date.now()/Yu}function tg(){let{performance:t}=wt;if(!t?.now||!t.timeOrigin)return Kn;let e=t.timeOrigin;return()=>(e+t.now())/Yu}var jc;function Fe(){return(jc??(jc=tg()))()}function eg(t){let e=Fe(),r={sid:fe(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>ng(r)};return t&&Wr(r,t),r}function Wr(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||Fe(),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:fe()),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 rg(t,e){let r={};e?r={status:e}:t.status==="ok"&&(r={status:"exited"}),Wr(t,r)}function ng(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 Yn(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({},t);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Yn(n[i],e[i],r-1));return n}function $c(){return fe()}function Ju(){return fe().substring(16)}var bo="_sentrySpan";function Fc(t,e){e?Er(t,bo,e):delete t[bo]}function Hc(t){return t[bo]}var ig=100,ir=class wo{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:$c(),sampleRand:Math.random()}}clone(){let e=new wo;return e._breadcrumbs=[...this._breadcrumbs],e._tags=T({},this._tags),e._extra=T({},this._extra),e._contexts=T({},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=T({},this._sdkProcessingMetadata),e._propagationContext=T({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,Fc(e,Hc(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Wr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags=T(T({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=ct(T({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=T(T({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=ct(T({},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 wo?r.getScopeData():Bn(r)?e:void 0,{tags:i,extra:s,user:o,contexts:c,level:l,fingerprint:p=[],propagationContext:g}=n||{};return this._tags=T(T({},this._tags),i),this._extra=T(T({},this._extra),s),this._contexts=T(T({},this._contexts),c),o&&Object.keys(o).length&&(this._user=o),l&&(this._level=l),p.length&&(this._fingerprint=p),g&&(this._propagationContext=g),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,Fc(this,void 0),this._attachments=[],this.setPropagationContext({traceId:$c(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:ig;if(n<=0)return this;let i=ct(T({timestamp:Kn()},e),{message:e.message?Mi(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:Hc(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Yn(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r?.event_id||fe();if(!this._client)return it&&X.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,ct(T({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n?.event_id||fe();if(!this._client)return it&&X.warn("No client configured on scope - will not capture message!"),i;let s=new Error(e);return this._client.captureMessage(e,r,ct(T({originalException:e,syntheticException:s},n),{event_id:i}),this),i}captureEvent(e,r){let n=r?.event_id||fe();return this._client?(this._client.captureEvent(e,ct(T({},r),{event_id:n}),this),n):(it&&X.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 sg(){return zn("defaultCurrentScope",()=>new ir)}function og(){return zn("defaultIsolationScope",()=>new ir)}var ag=class{constructor(t,e){let r;t?r=t:r=new ir;let n;e?n=e:n=new ir,this._stack=[{scope:r}],this._isolationScope=n}withScope(t){let e=this._pushScope(),r;try{r=t(e)}catch(n){throw this._popScope(),n}return ss(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Gr(){let t=es(),e=rs(t);return e.stack=e.stack||new ag(sg(),og())}function cg(t){return Gr().withScope(t)}function lg(t,e){let r=Gr();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function Vc(t){return Gr().withScope(()=>t(Gr().getIsolationScope()))}function ug(){return{withIsolationScope:Vc,withScope:cg,withSetScope:lg,withSetIsolationScope:(t,e)=>Vc(e),getCurrentScope:()=>Gr().getScope(),getIsolationScope:()=>Gr().getIsolationScope()}}function va(t){let e=rs(t);return e.acs?e.acs:ug()}function nn(){let t=es();return va(t).getCurrentScope()}function Jn(){let t=es();return va(t).getIsolationScope()}function hg(){return zn("globalScope",()=>new ir)}function pg(...t){let e=es(),r=va(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Yt(){return nn().getClient()}function dg(t){let e=t.getPropagationContext(),{traceId:r,parentSpanId:n,propagationSpanId:i}=e,s={trace_id:r,span_id:i||Ju()};return n&&(s.parent_span_id=n),s}var fg="sentry.source",gg="sentry.sample_rate",mg="sentry.previous_trace_sample_rate",yg="sentry.op",vg="sentry.origin",Xu="sentry.profile_id",Qu="sentry.exclusive_time",bg="_sentryScope",wg="_sentryIsolationScope";function Zu(t){return{scope:t[bg],isolationScope:t[wg]}}var _g="sentry-",Eg=/^sentry-/;function Sg(t){let e=Ig(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,s])=>{if(i.match(Eg)){let o=i.slice(_g.length);n[o]=s}return n},{});if(Object.keys(r).length>0)return r}function Ig(t){if(!(!t||!$e(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=qc(r);return Object.entries(n).forEach(([i,s])=>{e[i]=s}),e},{}):qc(t)}function qc(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 Cg(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 th=1,Wc=!1;function Tg(t){let{spanId:e,traceId:r,isRemote:n}=t.spanContext(),i=n?e:ba(t).parent_span_id,s=Zu(t).scope,o=n?s?.getPropagationContext().propagationSpanId||Ju():e;return{parent_span_id:i,span_id:o,trace_id:r}}function xg(t){if(t&&t.length>0)return t.map(e=>{var r=e,{context:n}=r,i=n,{spanId:s,traceId:o,traceFlags:c}=i,l=cf(i,["spanId","traceId","traceFlags"]),{attributes:p}=r;return T({span_id:s,trace_id:o,sampled:c===th,attributes:p},l)})}function Gc(t){return typeof t=="number"?zc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?zc(t.getTime()):Fe()}function zc(t){return t>9999999999?t/1e3:t}function ba(t){if(Ag(t))return t.getSpanJSON();let{spanId:e,traceId:r}=t.spanContext();if(Dg(t)){let{attributes:n,startTime:i,name:s,endTime:o,status:c,links:l}=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:s,parent_span_id:p,start_timestamp:Gc(i),timestamp:Gc(o)||void 0,status:Og(c),op:n[yg],origin:n[vg],links:xg(l)}}return{span_id:e,trace_id:r,start_timestamp:0,data:{}}}function Dg(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Ag(t){return typeof t.getSpanJSON=="function"}function Ng(t){let{traceFlags:e}=t.spanContext();return e===th}function Og(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var kg="_sentryRootSpan";function eh(t){return t[kg]||t}function Kc(){Wc||(ns(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),Wc=!0)}function Pg(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||Yt()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}var wa="production",Rg=/^o(\d+)\./,Lg=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Mg(t){return t==="http"||t==="https"}function as(t,e=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:c,publicKey:l}=t;return`${c}://${l}${e&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function Ug(t){let e=Lg.exec(t);if(!e){ns(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",s="",o="",c=""]=e.slice(1),l="",p=c,g=p.split("/");if(g.length>1&&(l=g.slice(0,-1).join("/"),p=g.pop()),p){let h=p.match(/^\d+/);h&&(p=h[0])}return rh({host:s,pass:i,path:l,projectId:p,port:o,protocol:r,publicKey:n})}function rh(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Bg(t){if(!it)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(X.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?Mg(n)?e&&isNaN(parseInt(e,10))?(X.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(X.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(X.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function jg(t){return t.match(Rg)?.[1]}function $g(t){let e=typeof t=="string"?Ug(t):rh(t);if(!(!e||!Bg(e)))return e}var Fg="_frozenDsc";function nh(t,e){let r=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{},s;r.orgId?s=String(r.orgId):i&&(s=jg(i));let o={environment:r.environment||wa,release:r.release,public_key:n,trace_id:t,org_id:s};return e.emit("createDsc",o),o}function Hg(t,e){let r=e.getPropagationContext();return r.dsc||nh(r.traceId,t)}function Vg(t){let e=Yt();if(!e)return{};let r=eh(t),n=ba(r),i=n.data,s=r.spanContext().traceState,o=s?.get("sentry.sample_rate")??i[gg]??i[mg];function c(b){return(typeof o=="number"||typeof o=="string")&&(b.sample_rate=`${o}`),b}let l=r[Fg];if(l)return c(l);let p=s?.get("sentry.dsc"),g=p&&Sg(p);if(g)return c(g);let h=nh(t.spanContext().traceId,e),w=i[fg],v=n.description;return w!=="url"&&v&&(h.transaction=v),Pg()&&(h.sampled=String(Ng(r)),h.sample_rand=s?.get("sentry.sample_rand")??Zu(r).scope?.getPropagationContext().sampleRand.toString()),c(h),e.emit("createDsc",h,r),h}function Le(t,e=100,r=1/0){try{return _o("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function ih(t,e=3,r=100*1024){let n=Le(t,e);return zg(n)>r?ih(t,e-1,r):n}function _o(t,e,r=1/0,n=1/0,i=Kg()){let[s,o]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let c=qg(t,e);if(!c.startsWith("[object "))return c;if(e.__sentry_skip_normalization__)return e;let l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(l===0)return c.replace("object ","");if(s(e))return"[Circular ~]";let p=e;if(p&&typeof p.toJSON=="function")try{let v=p.toJSON();return _o("",v,l-1,n,i)}catch{}let g=Array.isArray(e)?[]:{},h=0,w=zu(e);for(let v in w){if(!Object.prototype.hasOwnProperty.call(w,v))continue;if(h>=n){g[v]="[MaxProperties ~]";break}let b=w[v];g[v]=_o(v,b,l-1,n,i),h++}return o(e),g}function qg(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(Vu(e))return"[VueViewModel]";if(Wf(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=Wg(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Wg(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function Gg(t){return~-encodeURI(t).split(/%..|./).length}function zg(t){return Gg(JSON.stringify(t))}function Kg(){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 Xn(t,e=[]){return[t,e]}function Yg(t,e){let[r,n]=t;return[r,[...n,e]]}function Yc(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 Eo(t){let e=rs(wt);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Jg(t){let[e,r]=t,n=JSON.stringify(e);function i(s){typeof n=="string"?n=typeof s=="string"?n+s:[Eo(n),s]:n.push(typeof s=="string"?Eo(s):s)}for(let s of r){let[o,c]=s;if(i(`
|
|
19
|
+
Name: ${nr(n)}
|
|
20
|
+
Error:`,i)}}var Ls=null;function jf(t){let e="error";Ar(e,t),Nr(e,$f)}function $f(){Ls=_t.onerror,_t.onerror=function(t,e,r,n,i){return Ee("error",{column:n,error:i,line:r,msg:t,url:e}),Ls?Ls.apply(this,arguments):!1},_t.onerror.__SENTRY_INSTRUMENTED__=!0}var Ms=null;function Ff(t){let e="unhandledrejection";Ar(e,t),Nr(e,Hf)}function Hf(){Ms=_t.onunhandledrejection,_t.onunhandledrejection=function(t){return Ee("unhandledrejection",t),Ms?Ms.apply(this,arguments):!0},_t.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var Vu=Object.prototype.toString;function fa(t){switch(Vu.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ir(t,Error)}}function sn(t,e){return Vu.call(t)===`[object ${e}]`}function qu(t){return sn(t,"ErrorEvent")}function Mc(t){return sn(t,"DOMError")}function Vf(t){return sn(t,"DOMException")}function Fe(t){return sn(t,"String")}function ga(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function ma(t){return t===null||ga(t)||typeof t!="object"&&typeof t!="function"}function jn(t){return sn(t,"Object")}function ss(t){return typeof Event<"u"&&ir(t,Event)}function qf(t){return typeof Element<"u"&&ir(t,Element)}function Wf(t){return sn(t,"RegExp")}function os(t){return!!(t?.then&&typeof t.then=="function")}function Gf(t){return jn(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function ir(t,e){try{return t instanceof e}catch{return!1}}function Wu(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function zf(t){return typeof Request<"u"&&ir(t,Request)}var ya=_t,Kf=80;function Gu(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],s=0,o=0,c=" > ",l=c.length,p,g=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||Kf;for(;r&&s++<n&&(p=Yf(r,g),!(p==="html"||s>1&&o+i.length*l+p.length>=h));)i.push(p),o+=p.length,r=r.parentNode;return i.reverse().join(c)}catch{return"<unknown>"}}function Yf(t,e){let r=t,n=[];if(!r?.tagName)return"";if(ya.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(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i?.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&Fe(o)){let c=o.split(/\s+/);for(let l of c)n.push(`.${l}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let c=r.getAttribute(o);c&&n.push(`[${o}="${c}"]`)}return n.join("")}function zu(){try{return ya.document.location.href}catch{return""}}function Jf(t){if(!ya.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 Ui(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Uc(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{Wu(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function Xf(t,e,r=!1){return Fe(t)?Wf(e)?e.test(t):Fe(e)?r?t===e:t.includes(e):!1:!1}function as(t,e=[],r=!1){return e.some(n=>Xf(t,n,r))}function ne(t,e,r){if(!(e in t))return;let n=t[e];if(typeof n!="function")return;let i=r(n);typeof i=="function"&&Ku(i,n);try{t[e]=i}catch{st&&Q.log(`Failed to replace method "${e}" in object`,t)}}function Sr(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{st&&Q.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Ku(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,Sr(t,"__sentry_original__",e)}catch{}}function va(t){return t.__sentry_original__}function Yu(t){if(fa(t))return T({message:t.message,name:t.name,stack:t.stack},jc(t));if(ss(t)){let e=T({type:t.type,target:Bc(t.target),currentTarget:Bc(t.currentTarget)},jc(t));return typeof CustomEvent<"u"&&ir(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Bc(t){try{return qf(t)?Gu(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function jc(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 Qf(t,e=40){let r=Object.keys(Yu(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return Ui(n,e);for(let i=r.length;i>0;i--){let s=r.slice(0,i).join(", ");if(!(s.length>e))return i===r.length?s:Ui(s,e)}return""}function Zf(){let t=_t;return t.crypto||t.msCrypto}function ge(t=Zf()){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 Ju(t){return t.exception?.values?.[0]}function dr(t){let{message:e,event_id:r}=t;if(e)return e;let n=Ju(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function bo(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type=r||"Error")}function Gr(t,e){let r=Ju(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=T(T(T({},n),i),e),e&&"data"in e){let s=T(T({},i?.data),e.data);r.mechanism.data=s}}function $c(t){if(tg(t))return!0;try{Sr(t,"__sentry_captured__",!0)}catch{}return!1}function tg(t){try{return t.__sentry_captured__}catch{}}var Xu=1e3;function Yn(){return Date.now()/Xu}function eg(){let{performance:t}=_t;if(!t?.now||!t.timeOrigin)return Yn;let e=t.timeOrigin;return()=>(e+t.now())/Xu}var Fc;function He(){return(Fc??(Fc=eg()))()}function rg(t){let e=He(),r={sid:ge(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>ig(r)};return t&&zr(r,t),r}function zr(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||He(),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:ge()),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 ng(t,e){let r={};e?r={status:e}:t.status==="ok"&&(r={status:"exited"}),zr(t,r)}function ig(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 Jn(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({},t);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Jn(n[i],e[i],r-1));return n}function Hc(){return ge()}function Qu(){return ge().substring(16)}var wo="_sentrySpan";function Vc(t,e){e?Sr(t,wo,e):delete t[wo]}function qc(t){return t[wo]}var sg=100,sr=class _o{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:Hc(),sampleRand:Math.random()}}clone(){let e=new _o;return e._breadcrumbs=[...this._breadcrumbs],e._tags=T({},this._tags),e._extra=T({},this._extra),e._contexts=T({},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=T({},this._sdkProcessingMetadata),e._propagationContext=T({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,Vc(e,qc(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&&zr(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags=T(T({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=lt(T({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=T(T({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=lt(T({},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 _o?r.getScopeData():jn(r)?e:void 0,{tags:i,extra:s,user:o,contexts:c,level:l,fingerprint:p=[],propagationContext:g}=n||{};return this._tags=T(T({},this._tags),i),this._extra=T(T({},this._extra),s),this._contexts=T(T({},this._contexts),c),o&&Object.keys(o).length&&(this._user=o),l&&(this._level=l),p.length&&(this._fingerprint=p),g&&(this._propagationContext=g),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,Vc(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Hc(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:sg;if(n<=0)return this;let i=lt(T({timestamp:Yn()},e),{message:e.message?Ui(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:qc(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Jn(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r?.event_id||ge();if(!this._client)return st&&Q.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,lt(T({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n?.event_id||ge();if(!this._client)return st&&Q.warn("No client configured on scope - will not capture message!"),i;let s=new Error(e);return this._client.captureMessage(e,r,lt(T({originalException:e,syntheticException:s},n),{event_id:i}),this),i}captureEvent(e,r){let n=r?.event_id||ge();return this._client?(this._client.captureEvent(e,lt(T({},r),{event_id:n}),this),n):(st&&Q.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 og(){return Kn("defaultCurrentScope",()=>new sr)}function ag(){return Kn("defaultIsolationScope",()=>new sr)}var cg=class{constructor(t,e){let r;t?r=t:r=new sr;let n;e?n=e:n=new sr,this._stack=[{scope:r}],this._isolationScope=n}withScope(t){let e=this._pushScope(),r;try{r=t(e)}catch(n){throw this._popScope(),n}return os(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Kr(){let t=rs(),e=ns(t);return e.stack=e.stack||new cg(og(),ag())}function lg(t){return Kr().withScope(t)}function ug(t,e){let r=Kr();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function Wc(t){return Kr().withScope(()=>t(Kr().getIsolationScope()))}function hg(){return{withIsolationScope:Wc,withScope:lg,withSetScope:ug,withSetIsolationScope:(t,e)=>Wc(e),getCurrentScope:()=>Kr().getScope(),getIsolationScope:()=>Kr().getIsolationScope()}}function ba(t){let e=ns(t);return e.acs?e.acs:hg()}function on(){let t=rs();return ba(t).getCurrentScope()}function Xn(){let t=rs();return ba(t).getIsolationScope()}function pg(){return Kn("globalScope",()=>new sr)}function dg(...t){let e=rs(),r=ba(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Jt(){return on().getClient()}function fg(t){let e=t.getPropagationContext(),{traceId:r,parentSpanId:n,propagationSpanId:i}=e,s={trace_id:r,span_id:i||Qu()};return n&&(s.parent_span_id=n),s}var gg="sentry.source",mg="sentry.sample_rate",yg="sentry.previous_trace_sample_rate",vg="sentry.op",bg="sentry.origin",Zu="sentry.profile_id",th="sentry.exclusive_time",wg="_sentryScope",_g="_sentryIsolationScope";function eh(t){return{scope:t[wg],isolationScope:t[_g]}}var Eg="sentry-",Sg=/^sentry-/;function Ig(t){let e=Cg(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,s])=>{if(i.match(Sg)){let o=i.slice(Eg.length);n[o]=s}return n},{});if(Object.keys(r).length>0)return r}function Cg(t){if(!(!t||!Fe(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=Gc(r);return Object.entries(n).forEach(([i,s])=>{e[i]=s}),e},{}):Gc(t)}function Gc(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 Tg(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 rh=1,zc=!1;function xg(t){let{spanId:e,traceId:r,isRemote:n}=t.spanContext(),i=n?e:wa(t).parent_span_id,s=eh(t).scope,o=n?s?.getPropagationContext().propagationSpanId||Qu():e;return{parent_span_id:i,span_id:o,trace_id:r}}function Dg(t){if(t&&t.length>0)return t.map(e=>{var r=e,{context:n}=r,i=n,{spanId:s,traceId:o,traceFlags:c}=i,l=lf(i,["spanId","traceId","traceFlags"]),{attributes:p}=r;return T({span_id:s,trace_id:o,sampled:c===rh,attributes:p},l)})}function Kc(t){return typeof t=="number"?Yc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Yc(t.getTime()):He()}function Yc(t){return t>9999999999?t/1e3:t}function wa(t){if(Ng(t))return t.getSpanJSON();let{spanId:e,traceId:r}=t.spanContext();if(Ag(t)){let{attributes:n,startTime:i,name:s,endTime:o,status:c,links:l}=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:s,parent_span_id:p,start_timestamp:Kc(i),timestamp:Kc(o)||void 0,status:kg(c),op:n[vg],origin:n[bg],links:Dg(l)}}return{span_id:e,trace_id:r,start_timestamp:0,data:{}}}function Ag(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Ng(t){return typeof t.getSpanJSON=="function"}function Og(t){let{traceFlags:e}=t.spanContext();return e===rh}function kg(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var Pg="_sentryRootSpan";function nh(t){return t[Pg]||t}function Jc(){zc||(is(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),zc=!0)}function Rg(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||Jt()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}var _a="production",Lg=/^o(\d+)\./,Mg=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Ug(t){return t==="http"||t==="https"}function cs(t,e=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:c,publicKey:l}=t;return`${c}://${l}${e&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function Bg(t){let e=Mg.exec(t);if(!e){is(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",s="",o="",c=""]=e.slice(1),l="",p=c,g=p.split("/");if(g.length>1&&(l=g.slice(0,-1).join("/"),p=g.pop()),p){let h=p.match(/^\d+/);h&&(p=h[0])}return ih({host:s,pass:i,path:l,projectId:p,port:o,protocol:r,publicKey:n})}function ih(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function jg(t){if(!st)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(Q.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?Ug(n)?e&&isNaN(parseInt(e,10))?(Q.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(Q.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(Q.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function $g(t){return t.match(Lg)?.[1]}function Fg(t){let e=typeof t=="string"?Bg(t):ih(t);if(!(!e||!jg(e)))return e}var Hg="_frozenDsc";function sh(t,e){let r=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{},s;r.orgId?s=String(r.orgId):i&&(s=$g(i));let o={environment:r.environment||_a,release:r.release,public_key:n,trace_id:t,org_id:s};return e.emit("createDsc",o),o}function Vg(t,e){let r=e.getPropagationContext();return r.dsc||sh(r.traceId,t)}function qg(t){let e=Jt();if(!e)return{};let r=nh(t),n=wa(r),i=n.data,s=r.spanContext().traceState,o=s?.get("sentry.sample_rate")??i[mg]??i[yg];function c(b){return(typeof o=="number"||typeof o=="string")&&(b.sample_rate=`${o}`),b}let l=r[Hg];if(l)return c(l);let p=s?.get("sentry.dsc"),g=p&&Ig(p);if(g)return c(g);let h=sh(t.spanContext().traceId,e),w=i[gg],v=n.description;return w!=="url"&&v&&(h.transaction=v),Rg()&&(h.sampled=String(Og(r)),h.sample_rand=s?.get("sentry.sample_rand")??eh(r).scope?.getPropagationContext().sampleRand.toString()),c(h),e.emit("createDsc",h,r),h}function Me(t,e=100,r=1/0){try{return Eo("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function oh(t,e=3,r=100*1024){let n=Me(t,e);return Kg(n)>r?oh(t,e-1,r):n}function Eo(t,e,r=1/0,n=1/0,i=Yg()){let[s,o]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let c=Wg(t,e);if(!c.startsWith("[object "))return c;if(e.__sentry_skip_normalization__)return e;let l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(l===0)return c.replace("object ","");if(s(e))return"[Circular ~]";let p=e;if(p&&typeof p.toJSON=="function")try{let v=p.toJSON();return Eo("",v,l-1,n,i)}catch{}let g=Array.isArray(e)?[]:{},h=0,w=Yu(e);for(let v in w){if(!Object.prototype.hasOwnProperty.call(w,v))continue;if(h>=n){g[v]="[MaxProperties ~]";break}let b=w[v];g[v]=Eo(v,b,l-1,n,i),h++}return o(e),g}function Wg(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(Wu(e))return"[VueViewModel]";if(Gf(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${nr(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=Gg(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Gg(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function zg(t){return~-encodeURI(t).split(/%..|./).length}function Kg(t){return zg(JSON.stringify(t))}function Yg(){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 Qn(t,e=[]){return[t,e]}function Jg(t,e){let[r,n]=t;return[r,[...n,e]]}function Xc(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 So(t){let e=ns(_t);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Xg(t){let[e,r]=t,n=JSON.stringify(e);function i(s){typeof n=="string"?n=typeof s=="string"?n+s:[So(n),s]:n.push(typeof s=="string"?So(s):s)}for(let s of r){let[o,c]=s;if(i(`
|
|
21
21
|
${JSON.stringify(o)}
|
|
22
|
-
`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let l;try{l=JSON.stringify(c)}catch{l=JSON.stringify(Le(c))}i(l)}}return typeof n=="string"?n:Xg(n)}function Xg(t){let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function Qg(t){let e=typeof t.data=="string"?Eo(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var Zg={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 Jc(t){return Zg[t]}function sh(t){if(!t?.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function tm(t,e,r,n){let i=t.sdkProcessingMetadata?.dynamicSamplingContext;return T(T(T({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:as(n)}),i&&{trace:i})}function em(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 rm(t,e,r,n){let i=sh(r),s=T(T({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:as(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Xn(s,[o])}function nm(t,e,r,n){let i=sh(r),s=t.type&&t.type!=="replay_event"?t.type:"event";em(t,r?.sdk);let o=tm(t,i,n,e);return delete t.sdkProcessingMetadata,Xn(o,[[{type:s},t]])}var Ms=0,Xc=1,Qc=2;function Sr(t){return new Qn(e=>{e(t)})}function Ui(t){return new Qn((e,r)=>{r(t)})}var Qn=class So{constructor(e){this._state=Ms,this._handlers=[],this._runExecutor(e)}then(e,r){return new So((n,i)=>{this._handlers.push([!1,s=>{if(!e)n(s);else try{n(e(s))}catch(o){i(o)}},s=>{if(!r)i(s);else try{n(r(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new So((r,n)=>{let i,s;return this.then(o=>{s=!1,i=o,e&&e()},o=>{s=!0,i=o,e&&e()}).then(()=>{if(s){n(i);return}r(i)})})}_executeHandlers(){if(this._state===Ms)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Xc&&r[1](this._value),this._state===Qc&&r[2](this._value),r[0]=!0)})}_runExecutor(e){let r=(s,o)=>{if(this._state===Ms){if(ss(o)){o.then(n,i);return}this._state=s,this._value=o,this._executeHandlers()}},n=s=>{r(Xc,s)},i=s=>{r(Qc,s)};try{e(n,i)}catch(s){i(s)}}};function Io(t,e,r,n=0){return new Qn((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let c=o(T({},e),r);it&&o.id&&c===null&&X.log(`Event processor "${o.id}" dropped event`),ss(c)?c.then(l=>Io(t,l,r,n+1).then(i)).then(null,s):Io(t,c,r,n+1).then(i).then(null,s)}})}function im(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;sm(t,e),n&&cm(t,n),lm(t,r),om(t,i),am(t,s)}function Zc(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:g,attachments:h,propagationContext:w,transactionName:v,span:b}=e;di(t,"extra",r),di(t,"tags",n),di(t,"user",i),di(t,"contexts",s),t.sdkProcessingMetadata=Yn(t.sdkProcessingMetadata,c,2),o&&(t.level=o),v&&(t.transactionName=v),b&&(t.span=b),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),g.length&&(t.eventProcessors=[...t.eventProcessors,...g]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext=T(T({},t.propagationContext),w)}function di(t,e,r){t[e]=Yn(t[e],r,1)}function sm(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:c}=e;Object.keys(r).length&&(t.extra=T(T({},r),t.extra)),Object.keys(n).length&&(t.tags=T(T({},n),t.tags)),Object.keys(i).length&&(t.user=T(T({},i),t.user)),Object.keys(s).length&&(t.contexts=T(T({},s),t.contexts)),o&&(t.level=o),c&&t.type!=="transaction"&&(t.transaction=c)}function om(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function am(t,e){t.sdkProcessingMetadata=T(T({},t.sdkProcessingMetadata),e)}function cm(t,e){t.contexts=T({trace:Tg(e)},t.contexts),t.sdkProcessingMetadata=T({dynamicSamplingContext:Vg(e)},t.sdkProcessingMetadata);let r=eh(e),n=ba(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function lm(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 fi,tl,Us;function um(t){let e=wt._sentryDebugIds;if(!e)return{};let r=Object.keys(e);return Us&&r.length===tl||(tl=r.length,Us=r.reduce((n,i)=>{fi||(fi={});let s=fi[i];if(s)n[s[0]]=s[1];else{let o=t(i);for(let c=o.length-1;c>=0;c--){let l=o[c]?.filename,p=e[i];if(l&&p){n[l]=p,fi[i]=[l,p];break}}}return n},{})),Us}function hm(t,e,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:c=1e3}=t,l=ct(T({},e),{event_id:e.event_id||r.event_id||fe(),timestamp:e.timestamp||Kn()}),p=r.integrations||t.integrations.map(_=>_.name);pm(l,t),gm(l,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&dm(l,t.stackParser);let g=ym(n,r.captureContext);r.mechanism&&qr(l,r.mechanism);let h=i?i.getEventProcessors():[],w=hg().getScopeData();if(s){let _=s.getScopeData();Zc(w,_)}if(g){let _=g.getScopeData();Zc(w,_)}let v=[...r.attachments||[],...w.attachments];v.length&&(r.attachments=v),im(l,w);let b=[...h,...w.eventProcessors];return Io(b,l,r).then(_=>(_&&fm(_),typeof o=="number"&&o>0?mm(_,o,c):_))}function pm(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;t.environment=t.environment||r||wa,!t.release&&n&&(t.release=n),!t.dist&&i&&(t.dist=i);let o=t.request;o?.url&&(o.url=Mi(o.url,s))}function dm(t,e){let r=um(e);t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=r[i.filename])})})}function fm(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 gm(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function mm(t,e,r){if(!t)return null;let n=T(T(T(T(T({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>T(T({},i),i.data&&{data:Le(i.data,e,r)}))}),t.user&&{user:Le(t.user,e,r)}),t.contexts&&{contexts:Le(t.contexts,e,r)}),t.extra&&{extra:Le(t.extra,e,r)});return t.contexts?.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=Le(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>T(T({},i),i.data&&{data:Le(i.data,e,r)}))),t.contexts?.flags&&n.contexts&&(n.contexts.flags=Le(t.contexts.flags,3,r)),n}function ym(t,e){if(!e)return t;let r=t?t.clone():new ir;return r.update(e),r}function vm(t){if(t)return bm(t)?{captureContext:t}:_m(t)?{captureContext:t}:t}function bm(t){return t instanceof ir||typeof t=="function"}var wm=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function _m(t){return Object.keys(t).some(e=>wm.includes(e))}function Em(t,e){return nn().captureException(t,vm(e))}function oh(t,e){return nn().captureEvent(t,e)}function el(t){let e=Jn(),r=nn(),{userAgent:n}=wt.navigator||{},i=eg(T(T({user:r.getUser()||e.getUser()},n&&{userAgent:n}),t)),s=e.getSession();return s?.status==="ok"&&Wr(s,{status:"exited"}),ah(),e.setSession(i),i}function ah(){let t=Jn(),e=nn().getSession()||t.getSession();e&&rg(e),ch(),t.setSession()}function ch(){let t=Jn(),e=Yt(),r=t.getSession();r&&e&&e.captureSession(r)}function rl(t=!1){if(t){ah();return}ch()}var Sm="7";function Im(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function Cm(t){return`${Im(t)}${t.projectId}/envelope/`}function Tm(t,e){let r={sentry_version:Sm};return t.publicKey&&(r.sentry_key=t.publicKey),e&&(r.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(r).toString()}function xm(t,e,r){return e||`${Cm(t)}?${Tm(t,r)}`}var nl=[];function Dm(t,e){let r={};return e.forEach(n=>{n&&lh(t,n,r)}),r}function il(t,e){for(let r of e)r?.afterAllSetup&&r.afterAllSetup(t)}function lh(t,e,r){if(r[e.name]){it&&X.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,nl.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),nl.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>n(i,s,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((s,o)=>n(s,o,t),{id:e.name});t.addEventProcessor(i)}it&&X.log(`Integration installed: ${e.name}`)}function Am(t,e,r){let n=[{type:"client_report"},{timestamp:r||Kn(),discarded_events:t}];return Xn(e?{dsn:e}:{},[n])}function uh(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 Nm(t){let{trace_id:e,parent_span_id:r,span_id:n,status:i,origin:s,data:o,op:c}=t.contexts?.trace??{};return{data:o??{},description:t.transaction,op:c,parent_span_id:r,span_id:n??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:o?.[Xu],exclusive_time:o?.[Qu],measurements:t.measurements,is_segment:!0}}function Om(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(T(T({},t.data),t.profile_id&&{[Xu]:t.profile_id}),t.exclusive_time&&{[Qu]:t.exclusive_time})}},measurements:t.measurements}}var sl="Not capturing exception because it's already been captured.",ol="Discarded session because of missing or non-string release",hh=Symbol.for("SentryInternalError"),ph=Symbol.for("SentryDoNotSendEventError");function xi(t){return{message:t,[hh]:!0}}function Bs(t){return{message:t,[ph]:!0}}function al(t){return!!t&&typeof t=="object"&&hh in t}function cl(t){return!!t&&typeof t=="object"&&ph in t}var km=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=$g(t.dsn):it&&X.warn("No DSN provided, client will not send events."),this._dsn){let e=xm(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport(ct(T({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},t.transportOptions),{url:e}))}}captureException(t,e,r){let n=fe();if(Bc(t))return it&&X.log(sl),n;let i=T({event_id:n},e);return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(t,e,r,n){let i=T({event_id:fe()},r),s=fa(t)?t:String(t),o=ga(t)?this.eventFromMessage(s,e,i):this.eventFromException(t,i);return this._process(o.then(c=>this._captureEvent(c,i,n))),i.event_id}captureEvent(t,e,r){let n=fe();if(e?.originalException&&Bc(e.originalException))return it&&X.log(sl),n;let i=T({event_id:n},e),s=t.sdkProcessingMetadata||{},o=s.capturedSpanScope,c=s.capturedSpanIsolationScope;return this._process(this._captureEvent(t,i,o||r,c)),i.event_id}captureSession(t){this.sendSession(t),Wr(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){let e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then(r=>e.flush(t).then(n=>r&&n))):Sr(!0)}close(t){return this.flush(t).then(e=>(this.getOptions().enabled=!1,this.emit("close"),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let e=this._integrations[t.name];lh(this,t,this._integrations),e||il(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=nm(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=Yg(r,Qg(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let{release:e,environment:r=wa}=this._options;if("aggregates"in t){let i=t.attrs||{};if(!i.release&&!e){it&&X.warn(ol);return}i.release=i.release||e,i.environment=i.environment||r,t.attrs=i}else{if(!t.release&&!e){it&&X.warn(ol);return}t.release=t.release||e,t.environment=t.environment||r}this.emit("beforeSendSession",t);let n=rm(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(t,e,r=1){if(this._options.sendClientReports){let n=`${t}:${e}`;it&&X.log(`Recording outcome: "${n}"${r>1?` (${r} times)`:""}`),this._outcomes[n]=(this._outcomes[n]||0)+r}}on(t,e){let r=this._hooks[t]=this._hooks[t]||[];return r.push(e),()=>{let n=r.indexOf(e);n>-1&&r.splice(n,1)}}emit(t,...e){let r=this._hooks[t];r&&r.forEach(n=>n(...e))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,e=>(it&&X.error("Error while sending envelope:",e),e)):(it&&X.error("Transport disabled"),Sr({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Dm(this,t),il(this,t)}_updateSessionFromEvent(t,e){let r=e.level==="fatal",n=!1,i=e.exception?.values;if(i){n=!0;for(let o of i)if(o.mechanism?.handled===!1){r=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(Wr(t,ct(T({},r&&{status:"crashed"}),{errors:t.errors||Number(n||r)})),this.captureSession(t))}_isClientDoneProcessing(t){return new Qn(e=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),e(!0)):(r+=n,t&&r>=t&&(clearInterval(i),e(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,e,r,n){let i=this.getOptions(),s=Object.keys(this._integrations);return!e.integrations&&s?.length&&(e.integrations=s),this.emit("preprocessEvent",t,e),t.type||n.setLastEventId(t.event_id||e.event_id),hm(i,t,e,r,this,n).then(o=>{if(o===null)return o;this.emit("postprocessEvent",o,e),o.contexts=T({trace:dg(r)},o.contexts);let c=Hg(this,r);return o.sdkProcessingMetadata=T({dynamicSamplingContext:c},o.sdkProcessingMetadata),o})}_captureEvent(t,e={},r=nn(),n=Jn()){return it&&Co(t)&&X.log(`Captured error event \`${uh(t)[0]||"<unknown>"}\``),this._processEvent(t,e,r,n).then(i=>i.event_id,i=>{it&&(cl(i)?X.log(i.message):al(i)?X.warn(i.message):X.warn(i))})}_processEvent(t,e,r,n){let i=this.getOptions(),{sampleRate:s}=i,o=dh(t),c=Co(t),l=t.type||"error",p=`before send for type \`${l}\``,g=typeof s>"u"?void 0:Cg(s);if(c&&typeof g=="number"&&Math.random()>g)return this.recordDroppedEvent("sample_rate","error"),Ui(Bs(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let h=l==="replay_event"?"replay":l;return this._prepareEvent(t,e,r,n).then(w=>{if(w===null)throw this.recordDroppedEvent("event_processor",h),Bs("An event processor returned `null`, will not send event.");if(e.data&&e.data.__sentry__===!0)return w;let v=Rm(this,i,w,e);return Pm(v,p)}).then(w=>{if(w===null){if(this.recordDroppedEvent("before_send",h),o){let _=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",_)}throw Bs(`${p} returned \`null\`, will not send event.`)}let v=r.getSession()||n.getSession();if(c&&v&&this._updateSessionFromEvent(v,w),o){let _=w.sdkProcessingMetadata?.spanCountBeforeProcessing||0,k=w.spans?w.spans.length:0,A=_-k;A>0&&this.recordDroppedEvent("before_send","span",A)}let b=w.transaction_info;if(o&&b&&w.transaction!==t.transaction){let _="custom";w.transaction_info=ct(T({},b),{source:_})}return this.sendEvent(w,e),w}).then(null,w=>{throw cl(w)||al(w)?w:(this.captureException(w,{data:{__sentry__:!0},originalException:w}),xi(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
23
|
-
Reason: ${w}`))})}_process(t){this._numProcessing++,t.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([e,r])=>{let[n,i]=e.split(":");return{reason:n,category:i,quantity:r}})}_flushOutcomes(){
|
|
24
|
-
Event: ${
|
|
25
|
-
Event: ${
|
|
26
|
-
Event: ${
|
|
27
|
-
Event: ${
|
|
28
|
-
Url: ${
|
|
29
|
-
Event: ${
|
|
30
|
-
Url: ${Bi(t)}`),!0}return!1}function ny(t,e){return e?.length?uh(t).some(r=>os(r,e)):!1}function iy(t,e){if(!e?.length)return!1;let r=t.transaction;return r?os(r,e):!1}function sy(t,e){if(!e?.length)return!1;let r=Bi(t);return r?os(r,e):!1}function oy(t,e){if(!e?.length)return!0;let r=Bi(t);return r?os(r,e):!0}function ay(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 Bi(t){try{let e=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return e?ay(e):null}catch{return it&&X.error(`Cannot extract url for event ${pr(t)}`),null}}function cy(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function ly(t,e,r,n,i,s){if(!i.exception?.values||!s||!nr(s.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=To(t,e,n,s.originalException,r,i.exception.values,o,0))}function To(t,e,r,n,i,s,o,c){if(s.length>=r+1)return s;let l=[...s];if(nr(n[i],Error)){pl(o,c);let p=t(e,n[i]),g=l.length;dl(p,i,g,c),l=To(t,e,r,n[i],i,[p,...l],p,g)}return Array.isArray(n.errors)&&n.errors.forEach((p,g)=>{if(nr(p,Error)){pl(o,c);let h=t(e,p),w=l.length;dl(h,`errors[${g}]`,w,c),l=To(t,e,r,p,i,[h,...l],h,w)}}),l}function pl(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=ct(T(T({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function dl(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=ct(T({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function uy(t){let e="console";Dr(e,t),Ar(e,hy)}function hy(){"console"in wt&&Af.forEach(function(t){t in wt.console&&re(wt.console,t,function(e){return Li[t]=e,function(...r){_e("console",{args:r,level:t}),Li[t]?.apply(wt.console,r)}})})}function py(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var dy="Dedupe",fy=()=>{let t;return{name:dy,processEvent(e){if(e.type)return e;try{if(my(e,t))return it&&X.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},gy=fy;function my(t,e){return e?!!(yy(t,e)||vy(t,e)):!1}function yy(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!yh(t,e)||!mh(t,e))}function vy(t,e){let r=fl(e),n=fl(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!yh(t,e)||!mh(t,e))}function mh(t,e){let r=kc(t),n=kc(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function yh(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 fl(t){return t.exception?.values?.[0]}function $s(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 vh(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var jn=wt;function by(){return"history"in jn&&!!jn.history}function wy(){if(!("fetch"in jn))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function xo(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function _y(){if(typeof EdgeRuntime=="string")return!0;if(!wy())return!1;if(xo(jn.fetch))return!0;let t=!1,e=jn.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=xo(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){it&&X.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function Ey(t,e){let r="fetch";Dr(r,t),Ar(r,()=>Sy(void 0,e))}function Sy(t,e=!1){e&&!_y()||re(wt,"fetch",function(r){return function(...n){let i=new Error,{method:s,url:o}=Iy(n),c={args:n,fetchData:{method:s,url:o},startTimestamp:Fe()*1e3,virtualError:i,headers:Cy(n)};return t||_e("fetch",T({},c)),r.apply(wt,n).then(async l=>(t?t(l):_e("fetch",ct(T({},c),{endTimestamp:Fe()*1e3,response:l})),l),l=>{if(_e("fetch",ct(T({},c),{endTimestamp:Fe()*1e3,error:l})),da(l)&&l.stack===void 0&&(l.stack=i.stack,Er(l,"framesToPop",1)),l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{let p=new URL(c.fetchData.url);l.message=`${l.message} (${p.host})`}catch{}throw l})}})}function Do(t,e){return!!t&&typeof t=="object"&&!!t[e]}function gl(t){return typeof t=="string"?t:t?Do(t,"url")?t.url:t.toString?t.toString():"":""}function Iy(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:gl(r),method:Do(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:gl(e),method:Do(e,"method")?String(e.method).toUpperCase():"GET"}}function Cy(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(Gf(e))return new Headers(e.headers)}catch{}}function Ty(){return"npm"}var Ft=wt,Ao=0;function bh(){return Ao>0}function xy(){Ao++,setTimeout(()=>{Ao--})}function zr(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(ya(t))return t}catch{return t}let n=function(...i){try{let s=i.map(o=>zr(o,e));return t.apply(this,s)}catch(s){throw xy(),pg(o=>{o.addEventProcessor(c=>(e.mechanism&&(vo(c,void 0,void 0),qr(c,e.mechanism)),c.extra=ct(T({},c.extra),{arguments:i}),c)),Em(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}Gu(n,t),Er(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function Dy(){let t=Wu(),{referrer:e}=Ft.document||{},{userAgent:r}=Ft.navigator||{},n=T(T({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function _a(t,e){let r=Ea(t,e),n={type:Py(e),value:Ry(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Ay(t,e,r,n){let i=Yt()?.getOptions().normalizeDepth,s=jy(e),o={__serialized__:ih(e,i)};if(s)return{exception:{values:[_a(t,s)]},extra:o};let c={exception:{values:[{type:is(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Uy(e,{isUnhandledRejection:n})}]},extra:o};if(r){let l=Ea(t,r);l.length&&(c.exception.values[0].stacktrace={frames:l})}return c}function Fs(t,e){return{exception:{values:[_a(t,e)]}}}function Ea(t,e){let r=e.stacktrace||e.stack||"",n=Oy(e),i=ky(e);try{return t(r,n,i)}catch{}return[]}var Ny=/Minified React error #\d+;/i;function Oy(t){return t&&Ny.test(t.message)?1:0}function ky(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function wh(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function Py(t){let e=t?.name;return!e&&wh(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Ry(t){let e=t?.message;return wh(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 Ly(t,e,r,n){let i=r?.syntheticException||void 0,s=Sa(t,e,i,n);return qr(s),s.level="error",r?.event_id&&(s.event_id=r.event_id),Sr(s)}function My(t,e,r="info",n,i){let s=n?.syntheticException||void 0,o=No(t,e,s,i);return o.level=r,n?.event_id&&(o.event_id=n.event_id),Sr(o)}function Sa(t,e,r,n,i){let s;if(Hu(e)&&e.error)return Fs(t,e.error);if(Rc(e)||Hf(e)){let o=e;if("stack"in e)s=Fs(t,e);else{let c=o.name||(Rc(o)?"DOMError":"DOMException"),l=o.message?`${c}: ${o.message}`:c;s=No(t,l,r,n),vo(s,l)}return"code"in o&&(s.tags=ct(T({},s.tags),{"DOMException.code":`${o.code}`})),s}return da(e)?Fs(t,e):Bn(e)||is(e)?(s=Ay(t,e,r,i),qr(s,{synthetic:!0}),s):(s=No(t,e,r,n),vo(s,`${e}`,void 0),qr(s,{synthetic:!0}),s)}function No(t,e,r,n){let i={};if(n&&r){let s=Ea(t,r);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]}),qr(i,{synthetic:!0})}if(fa(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function Uy(t,{isUnhandledRejection:e}){let r=Xf(t),n=e?"promise rejection":"exception";return Hu(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:is(t)?`Event \`${By(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function By(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function jy(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var $y=5e3,Fy=class extends km{constructor(t){let e=Hy(t),r=Ft.SENTRY_SDK_SOURCE||Ty();zm(e,"browser",["browser"],r),super(e);let{sendDefaultPii:n,sendClientReports:i,enableLogs:s,_experiments:o}=this._options,c=s??o?.enableLogs;Ft.document&&(i||c)&&Ft.document.addEventListener("visibilitychange",()=>{Ft.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),c&&js(this))}),c&&(this.on("flush",()=>{js(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{js(this)},$y)})),n&&(this.on("postprocessEvent",Wm),this.on("beforeSendSession",Gm))}eventFromException(t,e){return Ly(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return My(this._options.stackParser,t,e,r,this._options.attachStacktrace)}_prepareEvent(t,e,r,n){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,r,n)}};function Hy(t){return T({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Ft.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var Vy=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Kt=wt,qy=1e3,ml,Oo,ko;function Wy(t){let e="dom";Dr(e,t),Ar(e,Gy)}function Gy(){if(!Kt.document)return;let t=_e.bind(null,"dom"),e=yl(t,!0);Kt.document.addEventListener("click",e,!1),Kt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=Kt[r]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(re(n,"addEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let l=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},p=l[s]=l[s]||{refCount:0};if(!p.handler){let g=yl(t);p.handler=g,i.call(this,s,g,c)}p.refCount++}catch{}return i.call(this,s,o,c)}}),re(n,"removeEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let l=this.__sentry_instrumentation_handlers__||{},p=l[s];p&&(p.refCount--,p.refCount<=0&&(i.call(this,s,p.handler,c),p.handler=void 0,delete l[s]),Object.keys(l).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,c)}}))})}function zy(t){if(t.type!==Oo)return!1;try{if(!t.target||t.target._sentryId!==ko)return!1}catch{}return!0}function Ky(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function yl(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=Yy(r);if(Ky(r.type,n))return;Er(r,"_sentryCaptured",!0),n&&!n._sentryId&&Er(n,"_sentryId",fe());let i=r.type==="keypress"?"input":r.type;zy(r)||(t({event:r,name:i,global:e}),Oo=r.type,ko=n?n._sentryId:void 0),clearTimeout(ml),ml=Kt.setTimeout(()=>{ko=void 0,Oo=void 0},qy)}}function Yy(t){try{return t.target}catch{return null}}var gi;function _h(t){let e="history";Dr(e,t),Ar(e,Jy)}function Jy(){if(Kt.addEventListener("popstate",()=>{let e=Kt.location.href,r=gi;gi=e,r!==e&&_e("history",{from:r,to:e})}),!by())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let i=gi,s=Xy(String(n));if(gi=s,i===s)return e.apply(this,r);_e("history",{from:i,to:s})}return e.apply(this,r)}}re(Kt.history,"pushState",t),re(Kt.history,"replaceState",t)}function Xy(t){try{return new URL(t,Kt.location.origin).toString()}catch{return t}}var Di={};function Qy(t){let e=Di[t];if(e)return e;let r=Kt[t];if(xo(r))return Di[t]=r.bind(Kt);let n=Kt.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s?.[t]&&(r=s[t]),n.head.removeChild(i)}catch(i){Vy&&X.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Di[t]=r.bind(Kt))}function vl(t){Di[t]=void 0}var Dn="__sentry_xhr_v3__";function Zy(t){let e="xhr";Dr(e,t),Ar(e,tv)}function tv(){if(!Kt.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let i=new Error,s=Fe()*1e3,o=$e(n[0])?n[0].toUpperCase():void 0,c=ev(n[1]);if(!o||!c)return e.apply(r,n);r[Dn]={method:o,url:c,request_headers:{}},o==="POST"&&c.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let l=()=>{let p=r[Dn];if(p&&r.readyState===4){try{p.status_code=r.status}catch{}let g={endTimestamp:Fe()*1e3,startTimestamp:s,xhr:r,virtualError:i};_e("xhr",g)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(p,g,h){return l(),p.apply(g,h)}}):r.addEventListener("readystatechange",l),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(p,g,h){let[w,v]=h,b=g[Dn];return b&&$e(w)&&$e(v)&&(b.request_headers[w.toLowerCase()]=v),p.apply(g,h)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let i=r[Dn];if(!i)return e.apply(r,n);n[0]!==void 0&&(i.body=n[0]);let s={startTimestamp:Fe()*1e3,xhr:r};return _e("xhr",s),e.apply(r,n)}})}function ev(t){if($e(t))return t;try{return t.toString()}catch{}}function rv(t,e=Qy("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let c=T({body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return vl("fetch"),Ui("No fetch implementation available");try{return e(t.url,c).then(l=>(r-=o,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return vl("fetch"),r-=o,n--,Ui(l)}}return qm(t,i)}var nv=30,iv=50;function Po(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?_r:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var sv=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ov=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,av=/\((\S*)(?::(\d+))(?::(\d+))\)/,cv=t=>{let e=sv.exec(t);if(e){let[,n,i,s]=e;return Po(n,_r,+i,+s)}let r=ov.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=av.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=Eh(r[1]||_r,r[2]);return Po(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},lv=[nv,cv],uv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,hv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,pv=t=>{let e=uv.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=hv.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],n=e[1]||_r;return[n,r]=Eh(n,r),Po(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},dv=[iv,pv],fv=[lv,dv],gv=Mf(...fv),Eh=(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,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Ia=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,mi=1024,mv="Breadcrumbs",yv=(t={})=>{let e=T({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:mv,setup(r){e.console&&uy(_v(r)),e.dom&&Wy(wv(r,e.dom)),e.xhr&&Zy(Ev(r)),e.fetch&&Ey(Sv(r)),e.history&&_h(Iv(r)),e.sentry&&r.on("beforeSendEvent",bv(r))}}},vv=yv;function bv(t){return function(e){Yt()===t&&Ir({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:pr(e)},{event:e})}}function wv(t,e){return function(r){if(Yt()!==t)return;let n,i,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>mi&&(Ia&&X.warn(`\`dom.maxStringLength\` cannot exceed ${mi}, but a value of ${o} was configured. Sentry will use ${mi} instead.`),o=mi),typeof s=="string"&&(s=[s]);try{let l=r.event,p=Cv(l)?l.target:l;n=qu(p,{keyAttrs:s,maxStringLength:o}),i=Yf(p)}catch{n="<unknown>"}if(n.length===0)return;let c={category:`ui.${r.name}`,message:n};i&&(c.data={"ui.component_name":i}),Ir(c,{event:r.event,name:r.name,global:r.global})}}function _v(t){return function(e){if(Yt()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:py(e.level),message:Lc(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${Lc(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;Ir(r,{input:e.args,level:e.level})}}function Ev(t){return function(e){if(Yt()!==t)return;let{startTimestamp:r,endTimestamp:n}=e,i=e.xhr[Dn];if(!r||!n||!i)return;let{method:s,url:o,status_code:c,body:l}=i,p={method:s,url:o,status_code:c},g={xhr:e.xhr,input:l,startTimestamp:r,endTimestamp:n},h={category:"xhr",data:p,type:"http",level:vh(c)};t.emit("beforeOutgoingRequestBreadcrumb",h,g),Ir(h,g)}}function Sv(t){return function(e){if(Yt()!==t)return;let{startTimestamp:r,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.fetchData.method,e.fetchData.url,e.error){let i=e.fetchData,s={data:e.error,input:e.args,startTimestamp:r,endTimestamp:n},o={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",o,s),Ir(o,s)}else{let i=e.response,s=ct(T({},e.fetchData),{status_code:i?.status});e.fetchData.request_body_size,e.fetchData.response_body_size,i?.status;let o={input:e.args,response:i,startTimestamp:r,endTimestamp:n},c={category:"fetch",data:s,type:"http",level:vh(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,o),Ir(c,o)}}}function Iv(t){return function(e){if(Yt()!==t)return;let r=e.from,n=e.to,i=$s(Ft.location.href),s=r?$s(r):void 0,o=$s(n);s?.path||(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),Ir({category:"navigation",data:{from:r,to:n}})}}function Cv(t){return!!t&&!!t.target}var Tv=["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"],xv="BrowserApiErrors",Dv=(t={})=>{let e=T({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:xv,setupOnce(){e.setTimeout&&re(Ft,"setTimeout",bl),e.setInterval&&re(Ft,"setInterval",bl),e.requestAnimationFrame&&re(Ft,"requestAnimationFrame",Nv),e.XMLHttpRequest&&"XMLHttpRequest"in Ft&&re(XMLHttpRequest.prototype,"send",Ov);let r=e.eventTarget;r&&(Array.isArray(r)?r:Tv).forEach(n=>kv(n,e))}}},Av=Dv;function bl(t){return function(...e){let r=e[0];return e[0]=zr(r,{mechanism:{data:{function:rr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function Nv(t){return function(e){return t.apply(this,[zr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:rr(t)},handled:!1,type:"instrument"}})])}}function Ov(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&re(r,n,function(i){let s={mechanism:{data:{function:n,handler:rr(i)},handled:!1,type:"instrument"}},o=ya(i);return o&&(s.mechanism.data.handler=rr(o)),zr(i,s)})}),t.apply(this,e)}}function kv(t,e){let r=Ft[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(re(r,"addEventListener",function(n){return function(i,s,o){try{Pv(s)&&(s.handleEvent=zr(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:rr(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&Rv(this,i,s),n.apply(this,[i,zr(s,{mechanism:{data:{function:"addEventListener",handler:rr(s),target:t},handled:!1,type:"instrument"}}),o])}}),re(r,"removeEventListener",function(n){return function(i,s,o){try{let c=s.__sentry_wrapped__;c&&n.call(this,i,c,o)}catch{}return n.call(this,i,s,o)}}))}function Pv(t){return typeof t.handleEvent=="function"}function Rv(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var Lv=()=>({name:"BrowserSession",setupOnce(){if(typeof Ft.document>"u"){Ia&&X.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}el({ignoreDuration:!0}),rl(),_h(({from:t,to:e})=>{t!==void 0&&t!==e&&(el({ignoreDuration:!0}),rl())})}}),Mv="GlobalHandlers",Uv=(t={})=>{let e=T({onerror:!0,onunhandledrejection:!0},t);return{name:Mv,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(jv(r),wl("onerror")),e.onunhandledrejection&&($v(r),wl("onunhandledrejection"))}}},Bv=Uv;function jv(t){Bf(e=>{let{stackParser:r,attachStacktrace:n}=Sh();if(Yt()!==t||bh())return;let{msg:i,url:s,line:o,column:c,error:l}=e,p=Vv(Sa(r,l||i,void 0,n,!1),s,o,c);p.level="error",oh(p,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function $v(t){$f(e=>{let{stackParser:r,attachStacktrace:n}=Sh();if(Yt()!==t||bh())return;let i=Fv(e),s=ga(i)?Hv(i):Sa(r,i,void 0,n,!0);s.level="error",oh(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Fv(t){if(ga(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 Hv(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function Vv(t,e,r,n){let i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},c=o.stacktrace=o.stacktrace||{},l=c.frames=c.frames||[],p=n,g=r,h=$e(e)&&e.length>0?e:Wu();return l.length===0&&l.push({colno:p,filename:h,function:_r,in_app:!0,lineno:g}),t}function wl(t){Ia&&X.log(`Global Handler attached: ${t}`)}function Sh(){return Yt()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var qv=()=>({name:"HttpContext",preprocessEvent(t){if(!Ft.navigator&&!Ft.location&&!Ft.document)return;let e=Dy(),r=T(T({},e.headers),t.request?.headers);t.request=ct(T(T({},e),t.request),{headers:r})}}),Wv="cause",Gv=5,zv="LinkedErrors",Kv=(t={})=>{let e=t.limit||Gv,r=t.key||Wv;return{name:zv,preprocessEvent(n,i,s){let o=s.getOptions();ly(_a,o.stackParser,r,e,n,i)}}},Yv=Kv;function Jv(t){return[ey(),Xm(),Av(),vv(),Bv(),Yv(),gy(),qv(),Lv()]}var Gt=class Ih{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ih),this.INSTANCE}captureError(e,r,n){x.error(`${r}:`,e);let i=this.getNewScope(n);i.setTag("operation",r),i.captureException(e)}captureMessage(e,r,n){this.getNewScope(n).captureMessage(e,r??"error")}setGlobalContext(e,r){this.contexts[e]=T({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e){e??={};let{extra:r,tags:n}=e,i=new ir;if(i.setClient(this.client),i.setUser(this.user),e.triggerContext&&!e.engagementTrigger&&(e.engagementTrigger=e.triggerContext.triggerData),e.engagementTrigger){let s=e.engagementTrigger;i.setTags({"engagement.id":s.engagementID,"engagement.short_id":s.shortID,"engagement.objective":s.objective,"engagement.delivery_type":s.onsiteDeliveryType,"engagement.content_id":s.contentID,"engagement.variation":s.variation,"engagement.currency":s.currency})}return r&&i.setExtras(r),this.tags&&i.setTags(this.tags),n&&i.setTags(n),Object.keys(this.contexts).forEach(s=>{i.setContext(s,this.contexts[s])}),i.setTag("language",navigator.language),i.setTag("timezone",tb()),this.addShopifyTags(i),i}addShopifyTags(e){window.Shopify&&(e.setTag("shopify.shop",window.Shopify.shop),e.setTag("shopify.currency",window.Shopify.currency?.active),e.setTag("shopify.locale",window.Shopify.locale),e.setTag("theme.schema_name",window.Shopify.theme?.schema_name),e.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}init(){let e=Jv({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new Fy({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:rv,stackParser:gv,integrations:e,environment:We.mode,release:`web-sdk@${H.SDK_VERSION}`,debug:We.debug}),this.client.init()}},at=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"},_l=Oe(uf());function Ca(t){return _l.default.createInstance({name:"lc",storeName:t,driver:_l.default.LOCALSTORAGE})}var Ta=class{static storage;static async get(t,e){return await this.storage?.getItem(t)??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},te=class extends Ta{static storeName="ses";static{this.storage=Ca(this.storeName)}},Lt=class extends Ta{static storeName="usr";static{this.storage=Ca(this.storeName)}},Xv=class{static format(t,e){let r=/{{\s*(\w+)\s*}}/;return e.replace(r,(n,i)=>{switch(i){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return n}})}static formatWithDelimiters(t,e=2,r=",",n="."){if(isNaN(t)||t==null)return"0";let i=(t/100).toFixed(e).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}},Ot=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;activeExperiment;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(t){this._currencyCode=t}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(t){this.currentItem=new en(t)}};function Ch(t){try{return new URL(t)}catch{return}}function El(t){return!t||t==="null"||t==="undefined"}function Qv(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function he(t,e){if(t==0&&e)return"Free";let r=Ot.get(),n=ie.get(),i=r.shopCurrencyCode||n.currency,s=r.currencyCode;s||x.warn("Currency code is not set in RuntimeData");let o=n.money?.format??r.moneyFormat,c;if(o&&i===s)c=Xv.format(t*100,o);else{let l;try{l=new Intl.NumberFormat(Th(),{style:"currency",currency:s||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return Gt.getInstance().captureError(p,"format-currency",{extra:{currentCurrency:s,shopCurrency:i}}),""}c=l.format(t),c=c.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(c=c.concat(` ${s}`))}return c}function Zv(t){return new Intl.NumberFormat(Th(),{notation:"compact"}).format(t)}function Th(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var yi;function tb(){if(yi)return yi;try{return yi=Intl.DateTimeFormat().resolvedOptions().timeZone,yi}catch{return""}}function xa(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function Qe(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},3e3)}async function xh(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let s=Math.min(100*2**n,5e3);if(await Gn.sleep(s),i=r.querySelectorAll(t),i.length)return x.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;x.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${s}ms.`),n++}return x.warn(`Max attempts reached. Element not found with ${t}.`),i}async function ji(t,e=10,r=document){return(await xh(t,e,r)).item(0)}function eb(t,e,r=document.body){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{(o===t||o.contains(t))&&(e(),n.disconnect())})})});n.observe(r,{childList:!0})}async function Dh(){let t=await Lt.get(at.DEVICE_ID),e=await te.get(at.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})}var cs,ft,Ah,Nh,dr,Sl,Oh,kh,Ph,Da,Ro,Lo,rb,$n={},Rh=[],nb=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ls=Array.isArray;function Ue(t,e){for(var r in e)t[r]=e[r];return t}function Aa(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Lh(t,e,r){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?cs.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Ai(t,o,n,i,null)}function Ai(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Ah,__i:-1,__u:0};return i==null&&ft.vnode!=null&&ft.vnode(s),s}function sn(t){return t.children}function yr(t,e){this.props=t,this.context=e}function Kr(t,e){if(e==null)return t.__?Kr(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"?Kr(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 Il(t){(!t.__d&&(t.__d=!0)&&dr.push(t)&&!$i.__r++||Sl!=ft.debounceRendering)&&((Sl=ft.debounceRendering)||Oh)($i)}function $i(){for(var t,e,r,n,i,s,o,c=1;dr.length;)dr.length>c&&dr.sort(kh),t=dr.shift(),c=dr.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,s=[],o=[],e.__P&&((r=Ue({},n)).__v=n.__v+1,ft.vnode&&ft.vnode(r),Na(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,s,i??Kr(n),!!(32&n.__u),o),r.__v=n.__v,r.__.__k[r.__i]=r,jh(s,r,o),r.__e!=i&&Mh(r)));$i.__r=0}function Uh(t,e,r,n,i,s,o,c,l,p,g){var h,w,v,b,_,k,A=n&&n.__k||Rh,B=e.length;for(l=ib(r,e,A,l,B),h=0;h<B;h++)(v=r.__k[h])!=null&&(w=v.__i==-1?$n:A[v.__i]||$n,v.__i=h,k=Na(t,v,w,i,s,o,c,l,p,g),b=v.__e,v.ref&&w.ref!=v.ref&&(w.ref&&Oa(w.ref,null,v),g.push(v.ref,v.__c||b,v)),_==null&&b!=null&&(_=b),4&v.__u||w.__k===v.__k?l=Bh(v,l,t):typeof v.type=="function"&&k!==void 0?l=k:b&&(l=b.nextSibling),v.__u&=-7);return r.__e=_,l}function ib(t,e,r,n,i){var s,o,c,l,p,g=r.length,h=g,w=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=s+w,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Ai(null,o,null,null,null):ls(o)?Ai(sn,{children:o},null,null,null):o.constructor==null&&o.__b>0?Ai(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,c=null,(p=o.__i=sb(o,r,l,h))!=-1&&(h--,(c=r[p])&&(c.__u|=2)),c==null||c.__v==null?(p==-1&&(i>g?w--:i<g&&w++),typeof o.type!="function"&&(o.__u|=4)):p!=l&&(p==l-1?w--:p==l+1?w++:(p>l?w--:w++,o.__u|=4))):t.__k[s]=null;if(h)for(s=0;s<g;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=Kr(c)),Fh(c,c));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=Kr(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function sb(t,e,r,n){var i,s,o=t.key,c=t.type,l=e[r];if(l===null&&t.key==null||l&&o==l.key&&c==l.type&&(2&l.__u)==0)return r;if(n>(l!=null&&(2&l.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<e.length;){if(i>=0){if((l=e[i])&&(2&l.__u)==0&&o==l.key&&c==l.type)return i;i--}if(s<e.length){if((l=e[s])&&(2&l.__u)==0&&o==l.key&&c==l.type)return s;s++}}return-1}function Cl(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||nb.test(e)?r:r+"px"}function vi(t,e,r,n,i){var s,o;t:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Cl(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||Cl(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Ph,"$1")),o=e.toLowerCase(),e=o in t||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?n?r.u=n.u:(r.u=Da,t.addEventListener(e,s?Lo:Ro,s)):t.removeEventListener(e,s?Lo:Ro,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Tl(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Da++;else if(e.t<r.u)return;return r(ft.event?ft.event(e):e)}}}function Na(t,e,r,n,i,s,o,c,l,p){var g,h,w,v,b,_,k,A,B,G,j,Q,Et,Dt,q,nt,Z,et=e.type;if(e.constructor!=null)return null;128&r.__u&&(l=!!(32&r.__u),s=[c=e.__e=r.__e]),(g=ft.__b)&&g(e);t:if(typeof et=="function")try{if(A=e.props,B="prototype"in et&&et.prototype.render,G=(g=et.contextType)&&n[g.__c],j=g?G?G.props.value:g.__:n,r.__c?k=(h=e.__c=r.__c).__=h.__E:(B?e.__c=h=new et(A,j):(e.__c=h=new yr(A,j),h.constructor=et,h.render=ab),G&&G.sub(h),h.props=A,h.state||(h.state={}),h.context=j,h.__n=n,w=h.__d=!0,h.__h=[],h._sb=[]),B&&h.__s==null&&(h.__s=h.state),B&&et.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Ue({},h.__s)),Ue(h.__s,et.getDerivedStateFromProps(A,h.__s))),v=h.props,b=h.state,h.__v=e,w)B&&et.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),B&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(B&&et.getDerivedStateFromProps==null&&A!==v&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(A,j),!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(A,h.__s,j)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(h.props=A,h.state=h.__s,h.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(ht){ht&&(ht.__=e)}),Q=0;Q<h._sb.length;Q++)h.__h.push(h._sb[Q]);h._sb=[],h.__h.length&&o.push(h);break t}h.componentWillUpdate!=null&&h.componentWillUpdate(A,h.__s,j),B&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(v,b,_)})}if(h.context=j,h.props=A,h.__P=t,h.__e=!1,Et=ft.__r,Dt=0,B){for(h.state=h.__s,h.__d=!1,Et&&Et(e),g=h.render(h.props,h.state,h.context),q=0;q<h._sb.length;q++)h.__h.push(h._sb[q]);h._sb=[]}else do h.__d=!1,Et&&Et(e),g=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++Dt<25);h.state=h.__s,h.getChildContext!=null&&(n=Ue(Ue({},n),h.getChildContext())),B&&!w&&h.getSnapshotBeforeUpdate!=null&&(_=h.getSnapshotBeforeUpdate(v,b)),nt=g,g!=null&&g.type===sn&&g.key==null&&(nt=$h(g.props.children)),c=Uh(t,ls(nt)?nt:[nt],e,r,n,i,s,o,c,l,p),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),k&&(h.__E=h.__=null)}catch(ht){if(e.__v=null,l||s!=null)if(ht.then){for(e.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.__e=c}else for(Z=s.length;Z--;)Aa(s[Z]);else e.__e=r.__e,e.__k=r.__k;ft.__e(ht,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):c=e.__e=ob(r.__e,e,r,n,i,s,o,l,p);return(g=ft.diffed)&&g(e),128&e.__u?void 0:c}function jh(t,e,r){for(var n=0;n<r.length;n++)Oa(r[n],r[++n],r[++n]);ft.__c&&ft.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){ft.__e(s,i.__v)}})}function $h(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:ls(t)?t.map($h):Ue({},t)}function ob(t,e,r,n,i,s,o,c,l){var p,g,h,w,v,b,_,k=r.props,A=e.props,B=e.type;if(B=="svg"?i="http://www.w3.org/2000/svg":B=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(p=0;p<s.length;p++)if((v=s[p])&&"setAttribute"in v==!!B&&(B?v.localName==B:v.nodeType==3)){t=v,s[p]=null;break}}if(t==null){if(B==null)return document.createTextNode(A);t=document.createElementNS(i,B,A.is&&A),c&&(ft.__m&&ft.__m(e,s),c=!1),s=null}if(B==null)k===A||c&&t.data==A||(t.data=A);else{if(s=s&&cs.call(t.childNodes),k=r.props||$n,!c&&s!=null)for(k={},p=0;p<t.attributes.length;p++)k[(v=t.attributes[p]).name]=v.value;for(p in k)if(v=k[p],p!="children"){if(p=="dangerouslySetInnerHTML")h=v;else if(!(p in A)){if(p=="value"&&"defaultValue"in A||p=="checked"&&"defaultChecked"in A)continue;vi(t,p,null,v,i)}}for(p in A)v=A[p],p=="children"?w=v:p=="dangerouslySetInnerHTML"?g=v:p=="value"?b=v:p=="checked"?_=v:c&&typeof v!="function"||k[p]===v||vi(t,p,v,k[p],i);if(g)c||h&&(g.__html==h.__html||g.__html==t.innerHTML)||(t.innerHTML=g.__html),e.__k=[];else if(h&&(t.innerHTML=""),Uh(e.type=="template"?t.content:t,ls(w)?w:[w],e,r,n,B=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Kr(r,0),c,l),s!=null)for(p=s.length;p--;)Aa(s[p]);c||(p="value",B=="progress"&&b==null?t.removeAttribute("value"):b!=null&&(b!==t[p]||B=="progress"&&!b||B=="option"&&b!=k[p])&&vi(t,p,b,k[p],i),p="checked",_!=null&&_!=t[p]&&vi(t,p,_,k[p],i))}return t}function Oa(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){ft.__e(i,r)}}function Fh(t,e,r){var n,i;if(ft.unmount&&ft.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Oa(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){ft.__e(s,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&Fh(n[i],e,r||typeof t.type!="function");r||Aa(t.__e),t.__c=t.__=t.__e=void 0}function ab(t,e,r){return this.constructor(t,r)}function cb(t,e,r){var n,i,s,o;e==document&&(e=document.documentElement),ft.__&&ft.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,s=[],o=[],Na(e,t=(!n&&r||e).__k=Lh(sn,null,[t]),i||$n,$n,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?cs.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),jh(s,t,o)}cs=Rh.slice,ft={__e:function(t,e,r,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),o=i.__d),o)return i.__E=i}catch(c){t=c}throw t}},Ah=0,Nh=function(t){return t!=null&&t.constructor==null},yr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ue({},this.state),typeof t=="function"&&(t=t(Ue({},r),this.props)),t&&Ue(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Il(this))},yr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Il(this))},yr.prototype.render=sn,dr=[],Oh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,kh=function(t,e){return t.__v.__b-e.__v.__b},$i.__r=0,Ph=/(PointerCapture)$|Capture$/i,Da=0,Ro=Tl(!1),Lo=Tl(!0),rb=0;var Mo,ee,Hs,xl,Dl=0,Hh=[],Mt=ft,Al=Mt.__b,Nl=Mt.__r,Ol=Mt.diffed,kl=Mt.__c,Pl=Mt.unmount,Rl=Mt.__;function lb(t,e){Mt.__h&&Mt.__h(ee,t,Dl||e),Dl=0;var r=ee.__H||(ee.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Vh(t,e){var r=lb(Mo++,7);return pb(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function ub(){for(var t;t=Hh.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Ni),t.__H.__h.forEach(Uo),t.__H.__h=[]}catch(e){t.__H.__h=[],Mt.__e(e,t.__v)}}Mt.__b=function(t){ee=null,Al&&Al(t)},Mt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Rl&&Rl(t,e)},Mt.__r=function(t){Nl&&Nl(t),Mo=0;var e=(ee=t.__c).__H;e&&(Hs===ee?(e.__h=[],ee.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(Ni),e.__h.forEach(Uo),e.__h=[],Mo=0)),Hs=ee},Mt.diffed=function(t){Ol&&Ol(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Hh.push(e)!==1&&xl===Mt.requestAnimationFrame||((xl=Mt.requestAnimationFrame)||hb)(ub)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Hs=ee=null},Mt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Ni),r.__h=r.__h.filter(function(n){return!n.__||Uo(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Mt.__e(n,r.__v)}}),kl&&kl(t,e)},Mt.unmount=function(t){Pl&&Pl(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Ni(n)}catch(i){e=i}}),r.__H=void 0,e&&Mt.__e(e,r.__v))};var Ll=typeof requestAnimationFrame=="function";function hb(t){var e,r=function(){clearTimeout(n),Ll&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);Ll&&(e=requestAnimationFrame(r))}function Ni(t){var e=ee,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),ee=e}function Uo(t){var e=ee;t.__c=t.__(),ee=e}function pb(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var db=Symbol.for("preact-signals");function ka(){if($r>1)$r--;else{for(var t,e=!1;Rn!==void 0;){var r=Rn;for(Rn=void 0,Bo++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Wh(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Bo=0,$r--,e)throw t}}var bt=void 0,Rn=void 0,$r=0,Bo=0,Fi=0;function qh(t){if(bt!==void 0){var e=t.n;if(e===void 0||e.t!==bt)return e={i:0,S:t,p:bt.s,n:void 0,t:bt,e:void 0,x:void 0,r:e},bt.s!==void 0&&(bt.s.n=e),bt.s=e,t.n=e,32&bt.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=bt.s,e.n=void 0,bt.s.n=e,bt.s=e),e}}function Vt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Vt.prototype.brand=db;Vt.prototype.h=function(){return!0};Vt.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)};Vt.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)}};Vt.prototype.subscribe=function(t){var e=this;return Ye(function(){var r=e.value,n=bt;bt=void 0;try{t(r)}finally{bt=n}})};Vt.prototype.valueOf=function(){return this.value};Vt.prototype.toString=function(){return this.value+""};Vt.prototype.toJSON=function(){return this.value};Vt.prototype.peek=function(){var t=bt;bt=void 0;try{return this.value}finally{bt=t}};Object.defineProperty(Vt.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(Bo>100)throw new Error("Cycle detected");this.v=t,this.i++,Fi++,$r++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{ka()}}}});function Cr(t){return new Vt(t)}function Wh(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Gh(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function zh(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 on(t){Vt.call(this,void 0),this.x=t,this.s=void 0,this.g=Fi-1,this.f=4}(on.prototype=new Vt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Fi))return!0;if(this.g=Fi,this.f|=1,this.i>0&&!Wh(this))return this.f&=-2,!0;var t=bt;try{Gh(this),bt=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 bt=t,zh(this),this.f&=-2,!0};on.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)}Vt.prototype.S.call(this,t)};on.prototype.U=function(t){if(this.t!==void 0&&(Vt.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)}};on.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(on.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 fb(t){return new on(t)}function Kh(t){var e=t.u;if(t.u=void 0,typeof e=="function"){$r++;var r=bt;bt=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Pa(t),n}finally{bt=r,ka()}}}function Pa(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Kh(t)}function gb(t){if(bt!==this)throw new Error("Out-of-order effect");zh(this),bt=t,this.f&=-2,8&this.f&&Pa(this),ka()}function Zn(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Zn.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()}};Zn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Kh(this),Gh(this),$r++;var t=bt;return bt=this,gb.bind(this,t)};Zn.prototype.N=function(){2&this.f||(this.f|=2,this.o=Rn,Rn=this)};Zn.prototype.d=function(){this.f|=8,1&this.f||Pa(this)};function Ye(t){var e=new Zn(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Ra,Vs;function an(t,e){ft[t]=e.bind(null,ft[t]||function(){})}function Hi(t){Vs&&Vs(),Vs=t&&t.S()}function Yh(t){var e=this,r=t.data,n=yb(r);n.value=r;var i=Vh(function(){for(var s=e.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return e.__$u.c=function(){var o,c=e.__$u.S(),l=i.value;c(),Nh(l)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=l},fb(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}Yh.displayName="_st";Object.defineProperties(Vt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Yh},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});an("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var s=n[i];s instanceof Vt&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});an("__r",function(t,e){Hi();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return Ye(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Ra=n,Hi(r),t(e)});an("__e",function(t,e,r,n){Hi(),Ra=void 0,t(e,r,n)});an("diffed",function(t,e){Hi(),Ra=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var s=r.U;if(s)for(var o in s){var c=s[o];c!==void 0&&!(o in n)&&(c.d(),s[o]=void 0)}else r.U=s={};for(var l in n){var p=s[l],g=n[l];p===void 0?(p=mb(r,l,g,i),s[l]=p):p.o(g,i)}}}t(e)});function mb(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=Cr(r);return{o:function(o,c){s.value=o,n=c},d:Ye(function(){var o=s.value.value;n[e]!==o&&(n[e]=o,i?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}an("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var s=n[i];s&&s.d()}}}}else{var o=e.__c;if(o){var c=o.__$u;c&&(o.__$u=void 0,c.d())}}t(e)});an("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});yr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function yb(t){return Vh(function(){return Cr(t)},[])}var vb=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},bb=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d}},wb=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},us=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new vb(e))??[],this.link=t.link,this.price=new bb(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=Cr(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=Cr(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new wb(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}},He=class{id;mID;name;status;ctg;options;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=Cr(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=Cr(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}setSelectedVariant(t){this.selectedOrFirstVariant.value=t}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.reviews=t.reviews,this.options=t.options,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),this.tags=t.tags,t.vars&&(this.vars=t.vars.map(e=>new us(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new en({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,e=t.price,r=this.name,n=this.category,i=he(e.d,!0),s=this.variantImage??this.imageURL,o=this.meta,c=this.tags?.join(",")??"",l=this.reviews?.rating,p=this.reviews?.totalReviews,g=e.cmp&&e.cmp>e.d,h={name:r,price:i,image_url:s,meta:o,category:n,rating:l,reviews:p,tags:c};if(t.hasEffectivePrice()&&(h.effective_price=he(t.effectivePrice.value)),g){h.compare_price=he(e.cmp);let v=e.cmp-e.d;h.discount_percent=(v/e.cmp*100).toFixed(0),h.discount_price=he(v)}let w={name:t.name,quantity:t.quantity};return{product:h,variant:w}}},_b=class{id;alt;sources;items;durationMS;thumbnail;card;constructor(t={}){this.id=t.id,this.alt=t.alt,this.sources=t.sources?.sort((e,r)=>r.height-e.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(e=>new He(e)):[],this.card=t.card}},Eb=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(t={}){this.videos=t.videos?.map(e=>new _b(e))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.slidePerViewCount=t.slidePerViewCount??4,this.autoPlay=t.autoPlay??"ON",this.footerContent=t.footerContent??"FIRST_ITEM"}},Sb=Object.prototype.toString,cn=Array.isArray||function(t){return Sb.call(t)==="[object Array]"};function La(t){return typeof t=="function"}function Ib(t){return cn(t)?"array":typeof t}function qs(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ml(t,e){return t!=null&&typeof t=="object"&&e in t}function Cb(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Tb=RegExp.prototype.test;function xb(t,e){return Tb.call(t,e)}var Db=/\S/;function Ab(t){return!xb(Db,t)}var Nb={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Ob(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return Nb[e]})}var kb=/\s*/,Pb=/\s+/,Ul=/\s*=/,Rb=/\s*\}/,Lb=/#|\^|\/|>|\{|&|=|!/;function Mb(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,c=!1,l="",p=0;function g(){if(o&&!c)for(;s.length;)delete i[s.pop()];else s=[];o=!1,c=!1}var h,w,v;function b(q){if(typeof q=="string"&&(q=q.split(Pb,2)),!cn(q)||q.length!==2)throw new Error("Invalid tags: "+q);h=new RegExp(qs(q[0])+"\\s*"),w=new RegExp("\\s*"+qs(q[1])),v=new RegExp("\\s*"+qs("}"+q[1]))}b(e||ge.tags);for(var _=new ti(t),k,A,B,G,j,Q;!_.eos();){if(k=_.pos,B=_.scanUntil(h),B)for(var Et=0,Dt=B.length;Et<Dt;++Et)G=B.charAt(Et),Ab(G)?(s.push(i.length),l+=G):(c=!0,r=!0,l+=" "),i.push(["text",G,k,k+1]),k+=1,G===`
|
|
31
|
-
`&&(g(),l="",p=0,r=!1);if(!_.scan(h))break;if(o=!0,A=_.scan(
|
|
22
|
+
`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let l;try{l=JSON.stringify(c)}catch{l=JSON.stringify(Me(c))}i(l)}}return typeof n=="string"?n:Qg(n)}function Qg(t){let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function Zg(t){let e=typeof t.data=="string"?So(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var tm={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 Qc(t){return tm[t]}function ah(t){if(!t?.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function em(t,e,r,n){let i=t.sdkProcessingMetadata?.dynamicSamplingContext;return T(T(T({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:cs(n)}),i&&{trace:i})}function rm(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 nm(t,e,r,n){let i=ah(r),s=T(T({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:cs(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Qn(s,[o])}function im(t,e,r,n){let i=ah(r),s=t.type&&t.type!=="replay_event"?t.type:"event";rm(t,r?.sdk);let o=em(t,i,n,e);return delete t.sdkProcessingMetadata,Qn(o,[[{type:s},t]])}var Us=0,Zc=1,tl=2;function Ir(t){return new Zn(e=>{e(t)})}function Bi(t){return new Zn((e,r)=>{r(t)})}var Zn=class Io{constructor(e){this._state=Us,this._handlers=[],this._runExecutor(e)}then(e,r){return new Io((n,i)=>{this._handlers.push([!1,s=>{if(!e)n(s);else try{n(e(s))}catch(o){i(o)}},s=>{if(!r)i(s);else try{n(r(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new Io((r,n)=>{let i,s;return this.then(o=>{s=!1,i=o,e&&e()},o=>{s=!0,i=o,e&&e()}).then(()=>{if(s){n(i);return}r(i)})})}_executeHandlers(){if(this._state===Us)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Zc&&r[1](this._value),this._state===tl&&r[2](this._value),r[0]=!0)})}_runExecutor(e){let r=(s,o)=>{if(this._state===Us){if(os(o)){o.then(n,i);return}this._state=s,this._value=o,this._executeHandlers()}},n=s=>{r(Zc,s)},i=s=>{r(tl,s)};try{e(n,i)}catch(s){i(s)}}};function Co(t,e,r,n=0){return new Zn((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let c=o(T({},e),r);st&&o.id&&c===null&&Q.log(`Event processor "${o.id}" dropped event`),os(c)?c.then(l=>Co(t,l,r,n+1).then(i)).then(null,s):Co(t,c,r,n+1).then(i).then(null,s)}})}function sm(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;om(t,e),n&&lm(t,n),um(t,r),am(t,i),cm(t,s)}function el(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:g,attachments:h,propagationContext:w,transactionName:v,span:b}=e;fi(t,"extra",r),fi(t,"tags",n),fi(t,"user",i),fi(t,"contexts",s),t.sdkProcessingMetadata=Jn(t.sdkProcessingMetadata,c,2),o&&(t.level=o),v&&(t.transactionName=v),b&&(t.span=b),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),g.length&&(t.eventProcessors=[...t.eventProcessors,...g]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext=T(T({},t.propagationContext),w)}function fi(t,e,r){t[e]=Jn(t[e],r,1)}function om(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:c}=e;Object.keys(r).length&&(t.extra=T(T({},r),t.extra)),Object.keys(n).length&&(t.tags=T(T({},n),t.tags)),Object.keys(i).length&&(t.user=T(T({},i),t.user)),Object.keys(s).length&&(t.contexts=T(T({},s),t.contexts)),o&&(t.level=o),c&&t.type!=="transaction"&&(t.transaction=c)}function am(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function cm(t,e){t.sdkProcessingMetadata=T(T({},t.sdkProcessingMetadata),e)}function lm(t,e){t.contexts=T({trace:xg(e)},t.contexts),t.sdkProcessingMetadata=T({dynamicSamplingContext:qg(e)},t.sdkProcessingMetadata);let r=nh(e),n=wa(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function um(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 gi,rl,Bs;function hm(t){let e=_t._sentryDebugIds;if(!e)return{};let r=Object.keys(e);return Bs&&r.length===rl||(rl=r.length,Bs=r.reduce((n,i)=>{gi||(gi={});let s=gi[i];if(s)n[s[0]]=s[1];else{let o=t(i);for(let c=o.length-1;c>=0;c--){let l=o[c]?.filename,p=e[i];if(l&&p){n[l]=p,gi[i]=[l,p];break}}}return n},{})),Bs}function pm(t,e,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:c=1e3}=t,l=lt(T({},e),{event_id:e.event_id||r.event_id||ge(),timestamp:e.timestamp||Yn()}),p=r.integrations||t.integrations.map(_=>_.name);dm(l,t),mm(l,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&fm(l,t.stackParser);let g=vm(n,r.captureContext);r.mechanism&&Gr(l,r.mechanism);let h=i?i.getEventProcessors():[],w=pg().getScopeData();if(s){let _=s.getScopeData();el(w,_)}if(g){let _=g.getScopeData();el(w,_)}let v=[...r.attachments||[],...w.attachments];v.length&&(r.attachments=v),sm(l,w);let b=[...h,...w.eventProcessors];return Co(b,l,r).then(_=>(_&&gm(_),typeof o=="number"&&o>0?ym(_,o,c):_))}function dm(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;t.environment=t.environment||r||_a,!t.release&&n&&(t.release=n),!t.dist&&i&&(t.dist=i);let o=t.request;o?.url&&(o.url=Ui(o.url,s))}function fm(t,e){let r=hm(e);t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=r[i.filename])})})}function gm(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 mm(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function ym(t,e,r){if(!t)return null;let n=T(T(T(T(T({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>T(T({},i),i.data&&{data:Me(i.data,e,r)}))}),t.user&&{user:Me(t.user,e,r)}),t.contexts&&{contexts:Me(t.contexts,e,r)}),t.extra&&{extra:Me(t.extra,e,r)});return t.contexts?.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=Me(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>T(T({},i),i.data&&{data:Me(i.data,e,r)}))),t.contexts?.flags&&n.contexts&&(n.contexts.flags=Me(t.contexts.flags,3,r)),n}function vm(t,e){if(!e)return t;let r=t?t.clone():new sr;return r.update(e),r}function bm(t){if(t)return wm(t)?{captureContext:t}:Em(t)?{captureContext:t}:t}function wm(t){return t instanceof sr||typeof t=="function"}var _m=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function Em(t){return Object.keys(t).some(e=>_m.includes(e))}function Sm(t,e){return on().captureException(t,bm(e))}function ch(t,e){return on().captureEvent(t,e)}function nl(t){let e=Xn(),r=on(),{userAgent:n}=_t.navigator||{},i=rg(T(T({user:r.getUser()||e.getUser()},n&&{userAgent:n}),t)),s=e.getSession();return s?.status==="ok"&&zr(s,{status:"exited"}),lh(),e.setSession(i),i}function lh(){let t=Xn(),e=on().getSession()||t.getSession();e&&ng(e),uh(),t.setSession()}function uh(){let t=Xn(),e=Jt(),r=t.getSession();r&&e&&e.captureSession(r)}function il(t=!1){if(t){lh();return}uh()}var Im="7";function Cm(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function Tm(t){return`${Cm(t)}${t.projectId}/envelope/`}function xm(t,e){let r={sentry_version:Im};return t.publicKey&&(r.sentry_key=t.publicKey),e&&(r.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(r).toString()}function Dm(t,e,r){return e||`${Tm(t)}?${xm(t,r)}`}var sl=[];function Am(t,e){let r={};return e.forEach(n=>{n&&hh(t,n,r)}),r}function ol(t,e){for(let r of e)r?.afterAllSetup&&r.afterAllSetup(t)}function hh(t,e,r){if(r[e.name]){st&&Q.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,sl.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),sl.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>n(i,s,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((s,o)=>n(s,o,t),{id:e.name});t.addEventProcessor(i)}st&&Q.log(`Integration installed: ${e.name}`)}function Nm(t,e,r){let n=[{type:"client_report"},{timestamp:r||Yn(),discarded_events:t}];return Qn(e?{dsn:e}:{},[n])}function ph(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 Om(t){let{trace_id:e,parent_span_id:r,span_id:n,status:i,origin:s,data:o,op:c}=t.contexts?.trace??{};return{data:o??{},description:t.transaction,op:c,parent_span_id:r,span_id:n??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:o?.[Zu],exclusive_time:o?.[th],measurements:t.measurements,is_segment:!0}}function km(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:T(T(T({},t.data),t.profile_id&&{[Zu]:t.profile_id}),t.exclusive_time&&{[th]:t.exclusive_time})}},measurements:t.measurements}}var al="Not capturing exception because it's already been captured.",cl="Discarded session because of missing or non-string release",dh=Symbol.for("SentryInternalError"),fh=Symbol.for("SentryDoNotSendEventError");function Di(t){return{message:t,[dh]:!0}}function js(t){return{message:t,[fh]:!0}}function ll(t){return!!t&&typeof t=="object"&&dh in t}function ul(t){return!!t&&typeof t=="object"&&fh in t}var Pm=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=Fg(t.dsn):st&&Q.warn("No DSN provided, client will not send events."),this._dsn){let e=Dm(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport(lt(T({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},t.transportOptions),{url:e}))}}captureException(t,e,r){let n=ge();if($c(t))return st&&Q.log(al),n;let i=T({event_id:n},e);return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(t,e,r,n){let i=T({event_id:ge()},r),s=ga(t)?t:String(t),o=ma(t)?this.eventFromMessage(s,e,i):this.eventFromException(t,i);return this._process(o.then(c=>this._captureEvent(c,i,n))),i.event_id}captureEvent(t,e,r){let n=ge();if(e?.originalException&&$c(e.originalException))return st&&Q.log(al),n;let i=T({event_id:n},e),s=t.sdkProcessingMetadata||{},o=s.capturedSpanScope,c=s.capturedSpanIsolationScope;return this._process(this._captureEvent(t,i,o||r,c)),i.event_id}captureSession(t){this.sendSession(t),zr(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){let e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then(r=>e.flush(t).then(n=>r&&n))):Ir(!0)}close(t){return this.flush(t).then(e=>(this.getOptions().enabled=!1,this.emit("close"),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let e=this._integrations[t.name];hh(this,t,this._integrations),e||ol(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=im(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=Jg(r,Zg(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let{release:e,environment:r=_a}=this._options;if("aggregates"in t){let i=t.attrs||{};if(!i.release&&!e){st&&Q.warn(cl);return}i.release=i.release||e,i.environment=i.environment||r,t.attrs=i}else{if(!t.release&&!e){st&&Q.warn(cl);return}t.release=t.release||e,t.environment=t.environment||r}this.emit("beforeSendSession",t);let n=nm(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(t,e,r=1){if(this._options.sendClientReports){let n=`${t}:${e}`;st&&Q.log(`Recording outcome: "${n}"${r>1?` (${r} times)`:""}`),this._outcomes[n]=(this._outcomes[n]||0)+r}}on(t,e){let r=this._hooks[t]=this._hooks[t]||[];return r.push(e),()=>{let n=r.indexOf(e);n>-1&&r.splice(n,1)}}emit(t,...e){let r=this._hooks[t];r&&r.forEach(n=>n(...e))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,e=>(st&&Q.error("Error while sending envelope:",e),e)):(st&&Q.error("Transport disabled"),Ir({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Am(this,t),ol(this,t)}_updateSessionFromEvent(t,e){let r=e.level==="fatal",n=!1,i=e.exception?.values;if(i){n=!0;for(let o of i)if(o.mechanism?.handled===!1){r=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(zr(t,lt(T({},r&&{status:"crashed"}),{errors:t.errors||Number(n||r)})),this.captureSession(t))}_isClientDoneProcessing(t){return new Zn(e=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),e(!0)):(r+=n,t&&r>=t&&(clearInterval(i),e(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,e,r,n){let i=this.getOptions(),s=Object.keys(this._integrations);return!e.integrations&&s?.length&&(e.integrations=s),this.emit("preprocessEvent",t,e),t.type||n.setLastEventId(t.event_id||e.event_id),pm(i,t,e,r,this,n).then(o=>{if(o===null)return o;this.emit("postprocessEvent",o,e),o.contexts=T({trace:fg(r)},o.contexts);let c=Vg(this,r);return o.sdkProcessingMetadata=T({dynamicSamplingContext:c},o.sdkProcessingMetadata),o})}_captureEvent(t,e={},r=on(),n=Xn()){return st&&To(t)&&Q.log(`Captured error event \`${ph(t)[0]||"<unknown>"}\``),this._processEvent(t,e,r,n).then(i=>i.event_id,i=>{st&&(ul(i)?Q.log(i.message):ll(i)?Q.warn(i.message):Q.warn(i))})}_processEvent(t,e,r,n){let i=this.getOptions(),{sampleRate:s}=i,o=gh(t),c=To(t),l=t.type||"error",p=`before send for type \`${l}\``,g=typeof s>"u"?void 0:Tg(s);if(c&&typeof g=="number"&&Math.random()>g)return this.recordDroppedEvent("sample_rate","error"),Bi(js(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let h=l==="replay_event"?"replay":l;return this._prepareEvent(t,e,r,n).then(w=>{if(w===null)throw this.recordDroppedEvent("event_processor",h),js("An event processor returned `null`, will not send event.");if(e.data&&e.data.__sentry__===!0)return w;let v=Lm(this,i,w,e);return Rm(v,p)}).then(w=>{if(w===null){if(this.recordDroppedEvent("before_send",h),o){let _=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",_)}throw js(`${p} returned \`null\`, will not send event.`)}let v=r.getSession()||n.getSession();if(c&&v&&this._updateSessionFromEvent(v,w),o){let _=w.sdkProcessingMetadata?.spanCountBeforeProcessing||0,k=w.spans?w.spans.length:0,A=_-k;A>0&&this.recordDroppedEvent("before_send","span",A)}let b=w.transaction_info;if(o&&b&&w.transaction!==t.transaction){let _="custom";w.transaction_info=lt(T({},b),{source:_})}return this.sendEvent(w,e),w}).then(null,w=>{throw ul(w)||ll(w)?w:(this.captureException(w,{data:{__sentry__:!0},originalException:w}),Di(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
23
|
+
Reason: ${w}`))})}_process(t){this._numProcessing++,t.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([e,r])=>{let[n,i]=e.split(":");return{reason:n,category:i,quantity:r}})}_flushOutcomes(){st&&Q.log("Flushing outcomes...");let t=this._clearOutcomes();if(t.length===0){st&&Q.log("No outcomes to send");return}if(!this._dsn){st&&Q.log("No dsn provided, will not send outcomes");return}st&&Q.log("Sending outcomes:",t);let e=Nm(t,this._options.tunnel&&cs(this._dsn));this.sendEnvelope(e)}};function Rm(t,e){let r=`${e} must return \`null\` or a valid event.`;if(os(t))return t.then(n=>{if(!jn(n)&&n!==null)throw Di(r);return n},n=>{throw Di(`${e} rejected with ${n}`)});if(!jn(t)&&t!==null)throw Di(r);return t}function Lm(t,e,r,n){let{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:o}=e,c=r;if(To(c)&&i)return i(c,n);if(gh(c)){if(o){let l=o(Om(c));if(l?c=Jn(r,km(l)):Jc(),c.spans){let p=[];for(let g of c.spans){let h=o(g);h?p.push(h):(Jc(),p.push(g))}c.spans=p}}if(s){if(c.spans){let l=c.spans.length;c.sdkProcessingMetadata=lt(T({},r.sdkProcessingMetadata),{spanCountBeforeProcessing:l})}return s(c,n)}}return c}function To(t){return t.type===void 0}function gh(t){return t.type==="transaction"}function Mm(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function Um(t,e,r,n){let i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),r&&n&&(i.dsn=cs(n)),Qn(i,[Mm(t)])}function $s(t,e){let r=e??Bm(t)??[];if(r.length===0)return;let n=t.getOptions(),i=Um(r,n._metadata,n.tunnel,t.getDsn());mh().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(i)}function Bm(t){return mh().get(t)}function mh(){return Kn("clientToLogBufferMap",()=>new WeakMap)}var yh=Symbol.for("SentryBufferFullError");function jm(t){let e=[];function r(){return t===void 0||e.length<t}function n(o){return e.splice(e.indexOf(o),1)[0]||Promise.resolve(void 0)}function i(o){if(!r())return Bi(yh);let c=o();return e.indexOf(c)===-1&&e.push(c),c.then(()=>n(c)).then(null,()=>n(c).then(null,()=>{})),c}function s(o){return new Zn((c,l)=>{let p=e.length;if(!p)return c(!0);let g=setTimeout(()=>{o&&o>0&&c(!1)},o);e.forEach(h=>{Ir(h).then(()=>{--p||(clearTimeout(g),c(!0))},l)})})}return{$:e,add:i,drain:s}}function $m(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 Fm(t,e){return t[e]||t.all||0}function Hm(t,e,r=Date.now()){return Fm(t,e)>r}function Vm(t,{statusCode:e,headers:r},n=Date.now()){let i=T({},t),s=r?.["x-sentry-rate-limits"],o=r?.["retry-after"];if(s)for(let c of s.trim().split(",")){let[l,p,,,g]=c.split(":",5),h=parseInt(l,10),w=(isNaN(h)?60:h)*1e3;if(!p)i.all=n+w;else for(let v of p.split(";"))v==="metric_bucket"?(!g||g.split(";").includes("custom"))&&(i[v]=n+w):i[v]=n+w}else o?i.all=n+$m(o,n):e===429&&(i.all=n+60*1e3);return i}var qm=64;function Wm(t,e,r=jm(t.bufferSize||qm)){let n={},i=o=>r.drain(o);function s(o){let c=[];if(Xc(o,(h,w)=>{let v=Qc(w);Hm(n,v)?t.recordDroppedEvent("ratelimit_backoff",v):c.push(h)}),c.length===0)return Ir({});let l=Qn(o[0],c),p=h=>{Xc(l,(w,v)=>{t.recordDroppedEvent(h,Qc(v))})},g=()=>e({body:Xg(l)}).then(h=>(h.statusCode!==void 0&&(h.statusCode<200||h.statusCode>=300)&&st&&Q.warn(`Sentry responded with status code ${h.statusCode} to sent event.`),n=Vm(n,h),h),h=>{throw p("network_error"),st&&Q.error("Encountered error running transport request:",h),h});return r.add(g).then(h=>h,h=>{if(h===yh)return st&&Q.error("Skipped sending event because buffer is full."),p("queue_overflow"),Ir({});throw h})}return{send:s,flush:i}}function Gm(t){t.user?.ip_address===void 0&&(t.user=lt(T({},t.user),{ip_address:"{{auto}}"}))}function zm(t){"aggregates"in t?t.attrs?.ip_address===void 0&&(t.attrs=lt(T({},t.attrs),{ip_address:"{{auto}}"})):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function Km(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(s=>({name:`${n}:@sentry/${s}`,version:yr})),version:yr}),t._metadata=i}var Ym=100;function Cr(t,e){let r=Jt(),n=Xn();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:s=Ym}=r.getOptions();if(s<=0)return;let o=Yn(),c=T({timestamp:o},t),l=i?is(()=>i(c,e)):c;l!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",l,e),n.addBreadcrumb(l,s))}var hl,Jm="FunctionToString",pl=new WeakMap,Xm=()=>({name:Jm,setupOnce(){hl=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=va(this),r=pl.has(Jt())&&e!==void 0?e:this;return hl.apply(r,t)}}catch{}},setup(t){pl.set(t,!0)}}),Qm=Xm,Zm=[/^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$/],ty="EventFilters",ey=(t={})=>{let e;return{name:ty,setup(r){let n=r.getOptions();e=dl(t,n)},processEvent(r,n,i){if(!e){let s=i.getOptions();e=dl(t,s)}return ny(r,e)?null:r}}},ry=(t={})=>lt(T({},ey(t)),{name:"InboundFilters"});function dl(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Zm],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function ny(t,e){if(t.type){if(t.type==="transaction"&&sy(t,e.ignoreTransactions))return st&&Q.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
24
|
+
Event: ${dr(t)}`),!0}else{if(iy(t,e.ignoreErrors))return st&&Q.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
25
|
+
Event: ${dr(t)}`),!0;if(ly(t))return st&&Q.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
26
|
+
Event: ${dr(t)}`),!0;if(oy(t,e.denyUrls))return st&&Q.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
27
|
+
Event: ${dr(t)}.
|
|
28
|
+
Url: ${ji(t)}`),!0;if(!ay(t,e.allowUrls))return st&&Q.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
29
|
+
Event: ${dr(t)}.
|
|
30
|
+
Url: ${ji(t)}`),!0}return!1}function iy(t,e){return e?.length?ph(t).some(r=>as(r,e)):!1}function sy(t,e){if(!e?.length)return!1;let r=t.transaction;return r?as(r,e):!1}function oy(t,e){if(!e?.length)return!1;let r=ji(t);return r?as(r,e):!1}function ay(t,e){if(!e?.length)return!0;let r=ji(t);return r?as(r,e):!0}function cy(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 ji(t){try{let e=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return e?cy(e):null}catch{return st&&Q.error(`Cannot extract url for event ${dr(t)}`),null}}function ly(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function uy(t,e,r,n,i,s){if(!i.exception?.values||!s||!ir(s.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=xo(t,e,n,s.originalException,r,i.exception.values,o,0))}function xo(t,e,r,n,i,s,o,c){if(s.length>=r+1)return s;let l=[...s];if(ir(n[i],Error)){fl(o,c);let p=t(e,n[i]),g=l.length;gl(p,i,g,c),l=xo(t,e,r,n[i],i,[p,...l],p,g)}return Array.isArray(n.errors)&&n.errors.forEach((p,g)=>{if(ir(p,Error)){fl(o,c);let h=t(e,p),w=l.length;gl(h,`errors[${g}]`,w,c),l=xo(t,e,r,p,i,[h,...l],h,w)}}),l}function fl(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=lt(T(T({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function gl(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=lt(T({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function hy(t){let e="console";Ar(e,t),Nr(e,py)}function py(){"console"in _t&&Nf.forEach(function(t){t in _t.console&&ne(_t.console,t,function(e){return Mi[t]=e,function(...r){Ee("console",{args:r,level:t}),Mi[t]?.apply(_t.console,r)}})})}function dy(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var fy="Dedupe",gy=()=>{let t;return{name:fy,processEvent(e){if(e.type)return e;try{if(yy(e,t))return st&&Q.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},my=gy;function yy(t,e){return e?!!(vy(t,e)||by(t,e)):!1}function vy(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!bh(t,e)||!vh(t,e))}function by(t,e){let r=ml(e),n=ml(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!bh(t,e)||!vh(t,e))}function vh(t,e){let r=Rc(t),n=Rc(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function bh(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 ml(t){return t.exception?.values?.[0]}function Fs(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 wh(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var $n=_t;function wy(){return"history"in $n&&!!$n.history}function _y(){if(!("fetch"in $n))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Do(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Ey(){if(typeof EdgeRuntime=="string")return!0;if(!_y())return!1;if(Do($n.fetch))return!0;let t=!1,e=$n.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=Do(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){st&&Q.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function Sy(t,e){let r="fetch";Ar(r,t),Nr(r,()=>Iy(void 0,e))}function Iy(t,e=!1){e&&!Ey()||ne(_t,"fetch",function(r){return function(...n){let i=new Error,{method:s,url:o}=Cy(n),c={args:n,fetchData:{method:s,url:o},startTimestamp:He()*1e3,virtualError:i,headers:Ty(n)};return t||Ee("fetch",T({},c)),r.apply(_t,n).then(async l=>(t?t(l):Ee("fetch",lt(T({},c),{endTimestamp:He()*1e3,response:l})),l),l=>{if(Ee("fetch",lt(T({},c),{endTimestamp:He()*1e3,error:l})),fa(l)&&l.stack===void 0&&(l.stack=i.stack,Sr(l,"framesToPop",1)),l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{let p=new URL(c.fetchData.url);l.message=`${l.message} (${p.host})`}catch{}throw l})}})}function Ao(t,e){return!!t&&typeof t=="object"&&!!t[e]}function yl(t){return typeof t=="string"?t:t?Ao(t,"url")?t.url:t.toString?t.toString():"":""}function Cy(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:yl(r),method:Ao(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:yl(e),method:Ao(e,"method")?String(e.method).toUpperCase():"GET"}}function Ty(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(zf(e))return new Headers(e.headers)}catch{}}function xy(){return"npm"}var Ht=_t,No=0;function _h(){return No>0}function Dy(){No++,setTimeout(()=>{No--})}function Yr(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(va(t))return t}catch{return t}let n=function(...i){try{let s=i.map(o=>Yr(o,e));return t.apply(this,s)}catch(s){throw Dy(),dg(o=>{o.addEventProcessor(c=>(e.mechanism&&(bo(c,void 0,void 0),Gr(c,e.mechanism)),c.extra=lt(T({},c.extra),{arguments:i}),c)),Sm(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}Ku(n,t),Sr(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function Ay(){let t=zu(),{referrer:e}=Ht.document||{},{userAgent:r}=Ht.navigator||{},n=T(T({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function Ea(t,e){let r=Sa(t,e),n={type:Ry(e),value:Ly(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Ny(t,e,r,n){let i=Jt()?.getOptions().normalizeDepth,s=$y(e),o={__serialized__:oh(e,i)};if(s)return{exception:{values:[Ea(t,s)]},extra:o};let c={exception:{values:[{type:ss(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:By(e,{isUnhandledRejection:n})}]},extra:o};if(r){let l=Sa(t,r);l.length&&(c.exception.values[0].stacktrace={frames:l})}return c}function Hs(t,e){return{exception:{values:[Ea(t,e)]}}}function Sa(t,e){let r=e.stacktrace||e.stack||"",n=ky(e),i=Py(e);try{return t(r,n,i)}catch{}return[]}var Oy=/Minified React error #\d+;/i;function ky(t){return t&&Oy.test(t.message)?1:0}function Py(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Eh(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function Ry(t){let e=t?.name;return!e&&Eh(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Ly(t){let e=t?.message;return Eh(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 My(t,e,r,n){let i=r?.syntheticException||void 0,s=Ia(t,e,i,n);return Gr(s),s.level="error",r?.event_id&&(s.event_id=r.event_id),Ir(s)}function Uy(t,e,r="info",n,i){let s=n?.syntheticException||void 0,o=Oo(t,e,s,i);return o.level=r,n?.event_id&&(o.event_id=n.event_id),Ir(o)}function Ia(t,e,r,n,i){let s;if(qu(e)&&e.error)return Hs(t,e.error);if(Mc(e)||Vf(e)){let o=e;if("stack"in e)s=Hs(t,e);else{let c=o.name||(Mc(o)?"DOMError":"DOMException"),l=o.message?`${c}: ${o.message}`:c;s=Oo(t,l,r,n),bo(s,l)}return"code"in o&&(s.tags=lt(T({},s.tags),{"DOMException.code":`${o.code}`})),s}return fa(e)?Hs(t,e):jn(e)||ss(e)?(s=Ny(t,e,r,i),Gr(s,{synthetic:!0}),s):(s=Oo(t,e,r,n),bo(s,`${e}`,void 0),Gr(s,{synthetic:!0}),s)}function Oo(t,e,r,n){let i={};if(n&&r){let s=Sa(t,r);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]}),Gr(i,{synthetic:!0})}if(ga(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function By(t,{isUnhandledRejection:e}){let r=Qf(t),n=e?"promise rejection":"exception";return qu(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:ss(t)?`Event \`${jy(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function jy(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function $y(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var Fy=5e3,Hy=class extends Pm{constructor(t){let e=Vy(t),r=Ht.SENTRY_SDK_SOURCE||xy();Km(e,"browser",["browser"],r),super(e);let{sendDefaultPii:n,sendClientReports:i,enableLogs:s,_experiments:o}=this._options,c=s??o?.enableLogs;Ht.document&&(i||c)&&Ht.document.addEventListener("visibilitychange",()=>{Ht.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),c&&$s(this))}),c&&(this.on("flush",()=>{$s(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{$s(this)},Fy)})),n&&(this.on("postprocessEvent",Gm),this.on("beforeSendSession",zm))}eventFromException(t,e){return My(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return Uy(this._options.stackParser,t,e,r,this._options.attachStacktrace)}_prepareEvent(t,e,r,n){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,r,n)}};function Vy(t){return T({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Ht.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var qy=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Yt=_t,Wy=1e3,vl,ko,Po;function Gy(t){let e="dom";Ar(e,t),Nr(e,zy)}function zy(){if(!Yt.document)return;let t=Ee.bind(null,"dom"),e=bl(t,!0);Yt.document.addEventListener("click",e,!1),Yt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=Yt[r]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(ne(n,"addEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let l=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},p=l[s]=l[s]||{refCount:0};if(!p.handler){let g=bl(t);p.handler=g,i.call(this,s,g,c)}p.refCount++}catch{}return i.call(this,s,o,c)}}),ne(n,"removeEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let l=this.__sentry_instrumentation_handlers__||{},p=l[s];p&&(p.refCount--,p.refCount<=0&&(i.call(this,s,p.handler,c),p.handler=void 0,delete l[s]),Object.keys(l).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,c)}}))})}function Ky(t){if(t.type!==ko)return!1;try{if(!t.target||t.target._sentryId!==Po)return!1}catch{}return!0}function Yy(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function bl(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=Jy(r);if(Yy(r.type,n))return;Sr(r,"_sentryCaptured",!0),n&&!n._sentryId&&Sr(n,"_sentryId",ge());let i=r.type==="keypress"?"input":r.type;Ky(r)||(t({event:r,name:i,global:e}),ko=r.type,Po=n?n._sentryId:void 0),clearTimeout(vl),vl=Yt.setTimeout(()=>{Po=void 0,ko=void 0},Wy)}}function Jy(t){try{return t.target}catch{return null}}var mi;function Sh(t){let e="history";Ar(e,t),Nr(e,Xy)}function Xy(){if(Yt.addEventListener("popstate",()=>{let e=Yt.location.href,r=mi;mi=e,r!==e&&Ee("history",{from:r,to:e})}),!wy())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let i=mi,s=Qy(String(n));if(mi=s,i===s)return e.apply(this,r);Ee("history",{from:i,to:s})}return e.apply(this,r)}}ne(Yt.history,"pushState",t),ne(Yt.history,"replaceState",t)}function Qy(t){try{return new URL(t,Yt.location.origin).toString()}catch{return t}}var Ai={};function Zy(t){let e=Ai[t];if(e)return e;let r=Yt[t];if(Do(r))return Ai[t]=r.bind(Yt);let n=Yt.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s?.[t]&&(r=s[t]),n.head.removeChild(i)}catch(i){qy&&Q.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Ai[t]=r.bind(Yt))}function wl(t){Ai[t]=void 0}var Nn="__sentry_xhr_v3__";function tv(t){let e="xhr";Ar(e,t),Nr(e,ev)}function ev(){if(!Yt.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let i=new Error,s=He()*1e3,o=Fe(n[0])?n[0].toUpperCase():void 0,c=rv(n[1]);if(!o||!c)return e.apply(r,n);r[Nn]={method:o,url:c,request_headers:{}},o==="POST"&&c.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let l=()=>{let p=r[Nn];if(p&&r.readyState===4){try{p.status_code=r.status}catch{}let g={endTimestamp:He()*1e3,startTimestamp:s,xhr:r,virtualError:i};Ee("xhr",g)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(p,g,h){return l(),p.apply(g,h)}}):r.addEventListener("readystatechange",l),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(p,g,h){let[w,v]=h,b=g[Nn];return b&&Fe(w)&&Fe(v)&&(b.request_headers[w.toLowerCase()]=v),p.apply(g,h)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let i=r[Nn];if(!i)return e.apply(r,n);n[0]!==void 0&&(i.body=n[0]);let s={startTimestamp:He()*1e3,xhr:r};return Ee("xhr",s),e.apply(r,n)}})}function rv(t){if(Fe(t))return t;try{return t.toString()}catch{}}function nv(t,e=Zy("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let c=T({body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return wl("fetch"),Bi("No fetch implementation available");try{return e(t.url,c).then(l=>(r-=o,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return wl("fetch"),r-=o,n--,Bi(l)}}return Wm(t,i)}var iv=30,sv=50;function Ro(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?Er:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var ov=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,av=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,cv=/\((\S*)(?::(\d+))(?::(\d+))\)/,lv=t=>{let e=ov.exec(t);if(e){let[,n,i,s]=e;return Ro(n,Er,+i,+s)}let r=av.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=cv.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=Ih(r[1]||Er,r[2]);return Ro(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},uv=[iv,lv],hv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,pv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,dv=t=>{let e=hv.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=pv.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],n=e[1]||Er;return[n,r]=Ih(n,r),Ro(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},fv=[sv,dv],gv=[uv,fv],mv=Uf(...gv),Ih=(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]:Er,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Ca=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,yi=1024,yv="Breadcrumbs",vv=(t={})=>{let e=T({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:yv,setup(r){e.console&&hy(Ev(r)),e.dom&&Gy(_v(r,e.dom)),e.xhr&&tv(Sv(r)),e.fetch&&Sy(Iv(r)),e.history&&Sh(Cv(r)),e.sentry&&r.on("beforeSendEvent",wv(r))}}},bv=vv;function wv(t){return function(e){Jt()===t&&Cr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:dr(e)},{event:e})}}function _v(t,e){return function(r){if(Jt()!==t)return;let n,i,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>yi&&(Ca&&Q.warn(`\`dom.maxStringLength\` cannot exceed ${yi}, but a value of ${o} was configured. Sentry will use ${yi} instead.`),o=yi),typeof s=="string"&&(s=[s]);try{let l=r.event,p=Tv(l)?l.target:l;n=Gu(p,{keyAttrs:s,maxStringLength:o}),i=Jf(p)}catch{n="<unknown>"}if(n.length===0)return;let c={category:`ui.${r.name}`,message:n};i&&(c.data={"ui.component_name":i}),Cr(c,{event:r.event,name:r.name,global:r.global})}}function Ev(t){return function(e){if(Jt()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:dy(e.level),message:Uc(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${Uc(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;Cr(r,{input:e.args,level:e.level})}}function Sv(t){return function(e){if(Jt()!==t)return;let{startTimestamp:r,endTimestamp:n}=e,i=e.xhr[Nn];if(!r||!n||!i)return;let{method:s,url:o,status_code:c,body:l}=i,p={method:s,url:o,status_code:c},g={xhr:e.xhr,input:l,startTimestamp:r,endTimestamp:n},h={category:"xhr",data:p,type:"http",level:wh(c)};t.emit("beforeOutgoingRequestBreadcrumb",h,g),Cr(h,g)}}function Iv(t){return function(e){if(Jt()!==t)return;let{startTimestamp:r,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.fetchData.method,e.fetchData.url,e.error){let i=e.fetchData,s={data:e.error,input:e.args,startTimestamp:r,endTimestamp:n},o={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",o,s),Cr(o,s)}else{let i=e.response,s=lt(T({},e.fetchData),{status_code:i?.status});e.fetchData.request_body_size,e.fetchData.response_body_size,i?.status;let o={input:e.args,response:i,startTimestamp:r,endTimestamp:n},c={category:"fetch",data:s,type:"http",level:wh(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,o),Cr(c,o)}}}function Cv(t){return function(e){if(Jt()!==t)return;let r=e.from,n=e.to,i=Fs(Ht.location.href),s=r?Fs(r):void 0,o=Fs(n);s?.path||(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),Cr({category:"navigation",data:{from:r,to:n}})}}function Tv(t){return!!t&&!!t.target}var xv=["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"],Dv="BrowserApiErrors",Av=(t={})=>{let e=T({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:Dv,setupOnce(){e.setTimeout&&ne(Ht,"setTimeout",_l),e.setInterval&&ne(Ht,"setInterval",_l),e.requestAnimationFrame&&ne(Ht,"requestAnimationFrame",Ov),e.XMLHttpRequest&&"XMLHttpRequest"in Ht&&ne(XMLHttpRequest.prototype,"send",kv);let r=e.eventTarget;r&&(Array.isArray(r)?r:xv).forEach(n=>Pv(n,e))}}},Nv=Av;function _l(t){return function(...e){let r=e[0];return e[0]=Yr(r,{mechanism:{data:{function:nr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function Ov(t){return function(e){return t.apply(this,[Yr(e,{mechanism:{data:{function:"requestAnimationFrame",handler:nr(t)},handled:!1,type:"instrument"}})])}}function kv(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&ne(r,n,function(i){let s={mechanism:{data:{function:n,handler:nr(i)},handled:!1,type:"instrument"}},o=va(i);return o&&(s.mechanism.data.handler=nr(o)),Yr(i,s)})}),t.apply(this,e)}}function Pv(t,e){let r=Ht[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(ne(r,"addEventListener",function(n){return function(i,s,o){try{Rv(s)&&(s.handleEvent=Yr(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:nr(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&Lv(this,i,s),n.apply(this,[i,Yr(s,{mechanism:{data:{function:"addEventListener",handler:nr(s),target:t},handled:!1,type:"instrument"}}),o])}}),ne(r,"removeEventListener",function(n){return function(i,s,o){try{let c=s.__sentry_wrapped__;c&&n.call(this,i,c,o)}catch{}return n.call(this,i,s,o)}}))}function Rv(t){return typeof t.handleEvent=="function"}function Lv(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var Mv=()=>({name:"BrowserSession",setupOnce(){if(typeof Ht.document>"u"){Ca&&Q.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}nl({ignoreDuration:!0}),il(),Sh(({from:t,to:e})=>{t!==void 0&&t!==e&&(nl({ignoreDuration:!0}),il())})}}),Uv="GlobalHandlers",Bv=(t={})=>{let e=T({onerror:!0,onunhandledrejection:!0},t);return{name:Uv,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&($v(r),El("onerror")),e.onunhandledrejection&&(Fv(r),El("onunhandledrejection"))}}},jv=Bv;function $v(t){jf(e=>{let{stackParser:r,attachStacktrace:n}=Ch();if(Jt()!==t||_h())return;let{msg:i,url:s,line:o,column:c,error:l}=e,p=qv(Ia(r,l||i,void 0,n,!1),s,o,c);p.level="error",ch(p,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function Fv(t){Ff(e=>{let{stackParser:r,attachStacktrace:n}=Ch();if(Jt()!==t||_h())return;let i=Hv(e),s=ma(i)?Vv(i):Ia(r,i,void 0,n,!0);s.level="error",ch(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Hv(t){if(ma(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 Vv(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function qv(t,e,r,n){let i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},c=o.stacktrace=o.stacktrace||{},l=c.frames=c.frames||[],p=n,g=r,h=Fe(e)&&e.length>0?e:zu();return l.length===0&&l.push({colno:p,filename:h,function:Er,in_app:!0,lineno:g}),t}function El(t){Ca&&Q.log(`Global Handler attached: ${t}`)}function Ch(){return Jt()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var Wv=()=>({name:"HttpContext",preprocessEvent(t){if(!Ht.navigator&&!Ht.location&&!Ht.document)return;let e=Ay(),r=T(T({},e.headers),t.request?.headers);t.request=lt(T(T({},e),t.request),{headers:r})}}),Gv="cause",zv=5,Kv="LinkedErrors",Yv=(t={})=>{let e=t.limit||zv,r=t.key||Gv;return{name:Kv,preprocessEvent(n,i,s){let o=s.getOptions();uy(Ea,o.stackParser,r,e,n,i)}}},Jv=Yv;function Xv(t){return[ry(),Qm(),Nv(),bv(),jv(),Jv(),my(),Wv(),Mv()]}var zt=class Th{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Th),this.INSTANCE}captureError(e,r,n){x.error(`${r}:`,e);let i=this.getNewScope(n);i.setTag("operation",r),i.captureException(e)}captureMessage(e,r,n){this.getNewScope(n).captureMessage(e,r??"error")}setGlobalContext(e,r){this.contexts[e]=T({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e){e??={};let{extra:r,tags:n}=e,i=new sr;if(i.setClient(this.client),i.setUser(this.user),e.triggerContext&&!e.engagementTrigger&&(e.engagementTrigger=e.triggerContext.triggerData),e.engagementTrigger){let s=e.engagementTrigger;i.setTags({"engagement.id":s.engagementID,"engagement.short_id":s.shortID,"engagement.objective":s.objective,"engagement.delivery_type":s.onsiteDeliveryType,"engagement.content_id":s.contentID,"engagement.variation":s.variation,"engagement.currency":s.currency})}return r&&i.setExtras(r),this.tags&&i.setTags(this.tags),n&&i.setTags(n),Object.keys(this.contexts).forEach(s=>{i.setContext(s,this.contexts[s])}),i.setTag("language",navigator.language),i.setTag("timezone",eb()),this.addShopifyTags(i),i}addShopifyTags(e){window.Shopify&&(e.setTag("shopify.shop",window.Shopify.shop),e.setTag("shopify.currency",window.Shopify.currency?.active),e.setTag("shopify.locale",window.Shopify.locale),e.setTag("theme.schema_name",window.Shopify.theme?.schema_name),e.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}init(){let e=Xv({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new Hy({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:nv,stackParser:mv,integrations:e,environment:Ge.mode,release:`web-sdk@${H.SDK_VERSION}`,debug:Ge.debug}),this.client.init()}},ct=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"},Sl=ke(hf());function Ta(t){return Sl.default.createInstance({name:"lc",storeName:t,driver:Sl.default.LOCALSTORAGE})}var xa=class{static storage;static async get(t,e){return await this.storage?.getItem(t)??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},ee=class extends xa{static storeName="ses";static{this.storage=Ta(this.storeName)}},Mt=class extends xa{static storeName="usr";static{this.storage=Ta(this.storeName)}},Qv=class{static format(t,e){let r=/{{\s*(\w+)\s*}}/;return e.replace(r,(n,i)=>{switch(i){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return n}})}static formatWithDelimiters(t,e=2,r=",",n="."){if(isNaN(t)||t==null)return"0";let i=(t/100).toFixed(e).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}},kt=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;activeExperiment;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(t){this._currencyCode=t}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(t){this.currentItem=new nn(t)}};function xh(t){try{return new URL(t)}catch{return}}function Il(t){return!t||t==="null"||t==="undefined"}function Zv(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function pe(t,e){if(t==0&&e)return"Free";let r=kt.get(),n=se.get(),i=r.shopCurrencyCode||n.currency,s=r.currencyCode;s||x.warn("Currency code is not set in RuntimeData");let o=n.money?.format??r.moneyFormat,c;if(o&&i===s)c=Qv.format(t*100,o);else{let l;try{l=new Intl.NumberFormat(Dh(),{style:"currency",currency:s||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return zt.getInstance().captureError(p,"format-currency",{extra:{currentCurrency:s,shopCurrency:i}}),""}c=l.format(t),c=c.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(c=c.concat(` ${s}`))}return c}function tb(t){return new Intl.NumberFormat(Dh(),{notation:"compact"}).format(t)}function Dh(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}var vi;function eb(){if(vi)return vi;try{return vi=Intl.DateTimeFormat().resolvedOptions().timeZone,vi}catch{return""}}function Da(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function Ze(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},3e3)}async function Ah(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let s=Math.min(100*2**n,5e3);if(await zn.sleep(s),i=r.querySelectorAll(t),i.length)return x.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;x.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${s}ms.`),n++}return x.warn(`Max attempts reached. Element not found with ${t}.`),i}async function $i(t,e=10,r=document){return(await Ah(t,e,r)).item(0)}function rb(t,e,r=document.body){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{(o===t||o.contains(t))&&(e(),n.disconnect())})})});n.observe(r,{childList:!0})}async function Nh(){let t=await Mt.get(ct.DEVICE_ID),e=await ee.get(ct.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 On(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var ls,gt,Oh,kh,fr,Cl,Ph,Rh,Lh,Aa,Lo,Mo,nb,Fn={},Mh=[],ib=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,us=Array.isArray;function Be(t,e){for(var r in e)t[r]=e[r];return t}function Na(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Uh(t,e,r){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?ls.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Ni(t,o,n,i,null)}function Ni(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Oh,__i:-1,__u:0};return i==null&>.vnode!=null&>.vnode(s),s}function an(t){return t.children}function vr(t,e){this.props=t,this.context=e}function Jr(t,e){if(e==null)return t.__?Jr(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"?Jr(t):null}function Bh(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 Bh(t)}}function Tl(t){(!t.__d&&(t.__d=!0)&&fr.push(t)&&!Fi.__r++||Cl!=gt.debounceRendering)&&((Cl=gt.debounceRendering)||Ph)(Fi)}function Fi(){for(var t,e,r,n,i,s,o,c=1;fr.length;)fr.length>c&&fr.sort(Rh),t=fr.shift(),c=fr.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,s=[],o=[],e.__P&&((r=Be({},n)).__v=n.__v+1,gt.vnode&>.vnode(r),Oa(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,s,i??Jr(n),!!(32&n.__u),o),r.__v=n.__v,r.__.__k[r.__i]=r,Fh(s,r,o),r.__e!=i&&Bh(r)));Fi.__r=0}function jh(t,e,r,n,i,s,o,c,l,p,g){var h,w,v,b,_,k,A=n&&n.__k||Mh,B=e.length;for(l=sb(r,e,A,l,B),h=0;h<B;h++)(v=r.__k[h])!=null&&(w=v.__i==-1?Fn:A[v.__i]||Fn,v.__i=h,k=Oa(t,v,w,i,s,o,c,l,p,g),b=v.__e,v.ref&&w.ref!=v.ref&&(w.ref&&ka(w.ref,null,v),g.push(v.ref,v.__c||b,v)),_==null&&b!=null&&(_=b),4&v.__u||w.__k===v.__k?l=$h(v,l,t):typeof v.type=="function"&&k!==void 0?l=k:b&&(l=b.nextSibling),v.__u&=-7);return r.__e=_,l}function sb(t,e,r,n,i){var s,o,c,l,p,g=r.length,h=g,w=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=s+w,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Ni(null,o,null,null,null):us(o)?Ni(an,{children:o},null,null,null):o.constructor==null&&o.__b>0?Ni(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,c=null,(p=o.__i=ob(o,r,l,h))!=-1&&(h--,(c=r[p])&&(c.__u|=2)),c==null||c.__v==null?(p==-1&&(i>g?w--:i<g&&w++),typeof o.type!="function"&&(o.__u|=4)):p!=l&&(p==l-1?w--:p==l+1?w++:(p>l?w--:w++,o.__u|=4))):t.__k[s]=null;if(h)for(s=0;s<g;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=Jr(c)),Vh(c,c));return n}function $h(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=$h(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Jr(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ob(t,e,r,n){var i,s,o=t.key,c=t.type,l=e[r];if(l===null&&t.key==null||l&&o==l.key&&c==l.type&&(2&l.__u)==0)return r;if(n>(l!=null&&(2&l.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<e.length;){if(i>=0){if((l=e[i])&&(2&l.__u)==0&&o==l.key&&c==l.type)return i;i--}if(s<e.length){if((l=e[s])&&(2&l.__u)==0&&o==l.key&&c==l.type)return s;s++}}return-1}function xl(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||ib.test(e)?r:r+"px"}function bi(t,e,r,n,i){var s,o;t:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||xl(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||xl(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Lh,"$1")),o=e.toLowerCase(),e=o in t||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?n?r.u=n.u:(r.u=Aa,t.addEventListener(e,s?Mo:Lo,s)):t.removeEventListener(e,s?Mo:Lo,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Dl(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Aa++;else if(e.t<r.u)return;return r(gt.event?gt.event(e):e)}}}function Oa(t,e,r,n,i,s,o,c,l,p){var g,h,w,v,b,_,k,A,B,G,j,Z,St,At,q,it,tt,rt=e.type;if(e.constructor!=null)return null;128&r.__u&&(l=!!(32&r.__u),s=[c=e.__e=r.__e]),(g=gt.__b)&&g(e);t:if(typeof rt=="function")try{if(A=e.props,B="prototype"in rt&&rt.prototype.render,G=(g=rt.contextType)&&n[g.__c],j=g?G?G.props.value:g.__:n,r.__c?k=(h=e.__c=r.__c).__=h.__E:(B?e.__c=h=new rt(A,j):(e.__c=h=new vr(A,j),h.constructor=rt,h.render=cb),G&&G.sub(h),h.props=A,h.state||(h.state={}),h.context=j,h.__n=n,w=h.__d=!0,h.__h=[],h._sb=[]),B&&h.__s==null&&(h.__s=h.state),B&&rt.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Be({},h.__s)),Be(h.__s,rt.getDerivedStateFromProps(A,h.__s))),v=h.props,b=h.state,h.__v=e,w)B&&rt.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),B&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(B&&rt.getDerivedStateFromProps==null&&A!==v&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(A,j),!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(A,h.__s,j)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(h.props=A,h.state=h.__s,h.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(pt){pt&&(pt.__=e)}),Z=0;Z<h._sb.length;Z++)h.__h.push(h._sb[Z]);h._sb=[],h.__h.length&&o.push(h);break t}h.componentWillUpdate!=null&&h.componentWillUpdate(A,h.__s,j),B&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(v,b,_)})}if(h.context=j,h.props=A,h.__P=t,h.__e=!1,St=gt.__r,At=0,B){for(h.state=h.__s,h.__d=!1,St&&St(e),g=h.render(h.props,h.state,h.context),q=0;q<h._sb.length;q++)h.__h.push(h._sb[q]);h._sb=[]}else do h.__d=!1,St&&St(e),g=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++At<25);h.state=h.__s,h.getChildContext!=null&&(n=Be(Be({},n),h.getChildContext())),B&&!w&&h.getSnapshotBeforeUpdate!=null&&(_=h.getSnapshotBeforeUpdate(v,b)),it=g,g!=null&&g.type===an&&g.key==null&&(it=Hh(g.props.children)),c=jh(t,us(it)?it:[it],e,r,n,i,s,o,c,l,p),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),k&&(h.__E=h.__=null)}catch(pt){if(e.__v=null,l||s!=null)if(pt.then){for(e.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.__e=c}else for(tt=s.length;tt--;)Na(s[tt]);else e.__e=r.__e,e.__k=r.__k;gt.__e(pt,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):c=e.__e=ab(r.__e,e,r,n,i,s,o,l,p);return(g=gt.diffed)&&g(e),128&e.__u?void 0:c}function Fh(t,e,r){for(var n=0;n<r.length;n++)ka(r[n],r[++n],r[++n]);gt.__c&>.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){gt.__e(s,i.__v)}})}function Hh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:us(t)?t.map(Hh):Be({},t)}function ab(t,e,r,n,i,s,o,c,l){var p,g,h,w,v,b,_,k=r.props,A=e.props,B=e.type;if(B=="svg"?i="http://www.w3.org/2000/svg":B=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(p=0;p<s.length;p++)if((v=s[p])&&"setAttribute"in v==!!B&&(B?v.localName==B:v.nodeType==3)){t=v,s[p]=null;break}}if(t==null){if(B==null)return document.createTextNode(A);t=document.createElementNS(i,B,A.is&&A),c&&(gt.__m&>.__m(e,s),c=!1),s=null}if(B==null)k===A||c&&t.data==A||(t.data=A);else{if(s=s&&ls.call(t.childNodes),k=r.props||Fn,!c&&s!=null)for(k={},p=0;p<t.attributes.length;p++)k[(v=t.attributes[p]).name]=v.value;for(p in k)if(v=k[p],p!="children"){if(p=="dangerouslySetInnerHTML")h=v;else if(!(p in A)){if(p=="value"&&"defaultValue"in A||p=="checked"&&"defaultChecked"in A)continue;bi(t,p,null,v,i)}}for(p in A)v=A[p],p=="children"?w=v:p=="dangerouslySetInnerHTML"?g=v:p=="value"?b=v:p=="checked"?_=v:c&&typeof v!="function"||k[p]===v||bi(t,p,v,k[p],i);if(g)c||h&&(g.__html==h.__html||g.__html==t.innerHTML)||(t.innerHTML=g.__html),e.__k=[];else if(h&&(t.innerHTML=""),jh(e.type=="template"?t.content:t,us(w)?w:[w],e,r,n,B=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Jr(r,0),c,l),s!=null)for(p=s.length;p--;)Na(s[p]);c||(p="value",B=="progress"&&b==null?t.removeAttribute("value"):b!=null&&(b!==t[p]||B=="progress"&&!b||B=="option"&&b!=k[p])&&bi(t,p,b,k[p],i),p="checked",_!=null&&_!=t[p]&&bi(t,p,_,k[p],i))}return t}function ka(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){gt.__e(i,r)}}function Vh(t,e,r){var n,i;if(gt.unmount&>.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||ka(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){gt.__e(s,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&Vh(n[i],e,r||typeof t.type!="function");r||Na(t.__e),t.__c=t.__=t.__e=void 0}function cb(t,e,r){return this.constructor(t,r)}function lb(t,e,r){var n,i,s,o;e==document&&(e=document.documentElement),gt.__&>.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,s=[],o=[],Oa(e,t=(!n&&r||e).__k=Uh(an,null,[t]),i||Fn,Fn,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?ls.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),Fh(s,t,o)}ls=Mh.slice,gt={__e:function(t,e,r,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),o=i.__d),o)return i.__E=i}catch(c){t=c}throw t}},Oh=0,kh=function(t){return t!=null&&t.constructor==null},vr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Be({},this.state),typeof t=="function"&&(t=t(Be({},r),this.props)),t&&Be(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Tl(this))},vr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Tl(this))},vr.prototype.render=an,fr=[],Ph=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Rh=function(t,e){return t.__v.__b-e.__v.__b},Fi.__r=0,Lh=/(PointerCapture)$|Capture$/i,Aa=0,Lo=Dl(!1),Mo=Dl(!0),nb=0;var Uo,re,Vs,Al,Nl=0,qh=[],Ut=gt,Ol=Ut.__b,kl=Ut.__r,Pl=Ut.diffed,Rl=Ut.__c,Ll=Ut.unmount,Ml=Ut.__;function ub(t,e){Ut.__h&&Ut.__h(re,t,Nl||e),Nl=0;var r=re.__H||(re.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Wh(t,e){var r=ub(Uo++,7);return db(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function hb(){for(var t;t=qh.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Oi),t.__H.__h.forEach(Bo),t.__H.__h=[]}catch(e){t.__H.__h=[],Ut.__e(e,t.__v)}}Ut.__b=function(t){re=null,Ol&&Ol(t)},Ut.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ml&&Ml(t,e)},Ut.__r=function(t){kl&&kl(t),Uo=0;var e=(re=t.__c).__H;e&&(Vs===re?(e.__h=[],re.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(Oi),e.__h.forEach(Bo),e.__h=[],Uo=0)),Vs=re},Ut.diffed=function(t){Pl&&Pl(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(qh.push(e)!==1&&Al===Ut.requestAnimationFrame||((Al=Ut.requestAnimationFrame)||pb)(hb)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Vs=re=null},Ut.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Oi),r.__h=r.__h.filter(function(n){return!n.__||Bo(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Ut.__e(n,r.__v)}}),Rl&&Rl(t,e)},Ut.unmount=function(t){Ll&&Ll(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Oi(n)}catch(i){e=i}}),r.__H=void 0,e&&Ut.__e(e,r.__v))};var Ul=typeof requestAnimationFrame=="function";function pb(t){var e,r=function(){clearTimeout(n),Ul&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);Ul&&(e=requestAnimationFrame(r))}function Oi(t){var e=re,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),re=e}function Bo(t){var e=re;t.__c=t.__(),re=e}function db(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var fb=Symbol.for("preact-signals");function Pa(){if(Fr>1)Fr--;else{for(var t,e=!1;Ln!==void 0;){var r=Ln;for(Ln=void 0,jo++;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(jo=0,Fr--,e)throw t}}var wt=void 0,Ln=void 0,Fr=0,jo=0,Hi=0;function Gh(t){if(wt!==void 0){var e=t.n;if(e===void 0||e.t!==wt)return e={i:0,S:t,p:wt.s,n:void 0,t:wt,e:void 0,x:void 0,r:e},wt.s!==void 0&&(wt.s.n=e),wt.s=e,t.n=e,32&wt.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=wt.s,e.n=void 0,wt.s.n=e,wt.s=e),e}}function qt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}qt.prototype.brand=fb;qt.prototype.h=function(){return!0};qt.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};qt.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};qt.prototype.subscribe=function(t){var e=this;return Je(function(){var r=e.value,n=wt;wt=void 0;try{t(r)}finally{wt=n}})};qt.prototype.valueOf=function(){return this.value};qt.prototype.toString=function(){return this.value+""};qt.prototype.toJSON=function(){return this.value};qt.prototype.peek=function(){var t=wt;wt=void 0;try{return this.value}finally{wt=t}};Object.defineProperty(qt.prototype,"value",{get:function(){var t=Gh(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(jo>100)throw new Error("Cycle detected");this.v=t,this.i++,Hi++,Fr++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Pa()}}}});function Tr(t){return new qt(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 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 Yh(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function cn(t){qt.call(this,void 0),this.x=t,this.s=void 0,this.g=Hi-1,this.f=4}(cn.prototype=new qt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Hi))return!0;if(this.g=Hi,this.f|=1,this.i>0&&!zh(this))return this.f&=-2,!0;var t=wt;try{Kh(this),wt=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return wt=t,Yh(this),this.f&=-2,!0};cn.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}qt.prototype.S.call(this,t)};cn.prototype.U=function(t){if(this.t!==void 0&&(qt.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};cn.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(cn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Gh(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function gb(t){return new cn(t)}function Jh(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Fr++;var r=wt;wt=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Ra(t),n}finally{wt=r,Pa()}}}function Ra(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Jh(t)}function mb(t){if(wt!==this)throw new Error("Out-of-order effect");Yh(this),wt=t,this.f&=-2,8&this.f&&Ra(this),Pa()}function ti(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}ti.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()}};ti.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Jh(this),Kh(this),Fr++;var t=wt;return wt=this,mb.bind(this,t)};ti.prototype.N=function(){2&this.f||(this.f|=2,this.o=Ln,Ln=this)};ti.prototype.d=function(){this.f|=8,1&this.f||Ra(this)};function Je(t){var e=new ti(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var La,qs;function ln(t,e){gt[t]=e.bind(null,gt[t]||function(){})}function Vi(t){qs&&qs(),qs=t&&t.S()}function Xh(t){var e=this,r=t.data,n=vb(r);n.value=r;var i=Wh(function(){for(var s=e.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return e.__$u.c=function(){var o,c=e.__$u.S(),l=i.value;c(),kh(l)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=l},gb(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}Xh.displayName="_st";Object.defineProperties(qt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Xh},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});ln("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var s=n[i];s instanceof qt&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});ln("__r",function(t,e){Vi();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return Je(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),La=n,Vi(r),t(e)});ln("__e",function(t,e,r,n){Vi(),La=void 0,t(e,r,n)});ln("diffed",function(t,e){Vi(),La=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var s=r.U;if(s)for(var o in s){var c=s[o];c!==void 0&&!(o in n)&&(c.d(),s[o]=void 0)}else r.U=s={};for(var l in n){var p=s[l],g=n[l];p===void 0?(p=yb(r,l,g,i),s[l]=p):p.o(g,i)}}}t(e)});function yb(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=Tr(r);return{o:function(o,c){s.value=o,n=c},d:Je(function(){var o=s.value.value;n[e]!==o&&(n[e]=o,i?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}ln("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var s=n[i];s&&s.d()}}}}else{var o=e.__c;if(o){var c=o.__$u;c&&(o.__$u=void 0,c.d())}}t(e)});ln("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});vr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function vb(t){return Wh(function(){return Tr(t)},[])}var bb=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},wb=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d}},_b=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},hs=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new bb(e))??[],this.link=t.link,this.price=new wb(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=Tr(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=Tr(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new _b(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}},Ve=class{id;mID;name;status;ctg;options;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=Tr(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=Tr(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}setSelectedVariant(t){this.selectedOrFirstVariant.value=t}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.reviews=t.reviews,this.options=t.options,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),this.tags=t.tags,t.vars&&(this.vars=t.vars.map(e=>new hs(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new nn({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,e=t.price,r=this.name,n=this.category,i=pe(e.d,!0),s=this.variantImage??this.imageURL,o=this.meta,c=this.tags?.join(",")??"",l=this.reviews?.rating,p=this.reviews?.totalReviews,g=e.cmp&&e.cmp>e.d,h={name:r,price:i,image_url:s,meta:o,category:n,rating:l,reviews:p,tags:c};if(t.hasEffectivePrice()&&(h.effective_price=pe(t.effectivePrice.value)),g){h.compare_price=pe(e.cmp);let v=e.cmp-e.d;h.discount_percent=(v/e.cmp*100).toFixed(0),h.discount_price=pe(v)}let w={name:t.name,quantity:t.quantity};return{product:h,variant:w}}},Eb=class{id;alt;sources;items;durationMS;thumbnail;card;constructor(t={}){this.id=t.id,this.alt=t.alt,this.sources=t.sources?.sort((e,r)=>r.height-e.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(e=>new Ve(e)):[],this.card=t.card}},Sb=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;constructor(t={}){this.videos=t.videos?.map(e=>new Eb(e))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.slidePerViewCount=t.slidePerViewCount??4,this.autoPlay=t.autoPlay??"ON",this.footerContent=t.footerContent??"FIRST_ITEM"}},Ib=Object.prototype.toString,un=Array.isArray||function(t){return Ib.call(t)==="[object Array]"};function Ma(t){return typeof t=="function"}function Cb(t){return un(t)?"array":typeof t}function Ws(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Bl(t,e){return t!=null&&typeof t=="object"&&e in t}function Tb(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var xb=RegExp.prototype.test;function Db(t,e){return xb.call(t,e)}var Ab=/\S/;function Nb(t){return!Db(Ab,t)}var Ob={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function kb(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return Ob[e]})}var Pb=/\s*/,Rb=/\s+/,jl=/\s*=/,Lb=/\s*\}/,Mb=/#|\^|\/|>|\{|&|=|!/;function Ub(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,c=!1,l="",p=0;function g(){if(o&&!c)for(;s.length;)delete i[s.pop()];else s=[];o=!1,c=!1}var h,w,v;function b(q){if(typeof q=="string"&&(q=q.split(Rb,2)),!un(q)||q.length!==2)throw new Error("Invalid tags: "+q);h=new RegExp(Ws(q[0])+"\\s*"),w=new RegExp("\\s*"+Ws(q[1])),v=new RegExp("\\s*"+Ws("}"+q[1]))}b(e||me.tags);for(var _=new ei(t),k,A,B,G,j,Z;!_.eos();){if(k=_.pos,B=_.scanUntil(h),B)for(var St=0,At=B.length;St<At;++St)G=B.charAt(St),Nb(G)?(s.push(i.length),l+=G):(c=!0,r=!0,l+=" "),i.push(["text",G,k,k+1]),k+=1,G===`
|
|
31
|
+
`&&(g(),l="",p=0,r=!1);if(!_.scan(h))break;if(o=!0,A=_.scan(Mb)||"name",_.scan(Pb),A==="="?(B=_.scanUntil(jl),_.scan(jl),_.scanUntil(w)):A==="{"?(B=_.scanUntil(v),_.scan(Lb),_.scanUntil(w),A="&"):B=_.scanUntil(w),!_.scan(w))throw new Error("Unclosed tag at "+_.pos);if(A==">"?j=[A,B,k,_.pos,l,p,r]:j=[A,B,k,_.pos],p++,i.push(j),A==="#"||A==="^")n.push(j);else if(A==="/"){if(Z=n.pop(),!Z)throw new Error('Unopened section "'+B+'" at '+k);if(Z[1]!==B)throw new Error('Unclosed section "'+Z[1]+'" at '+k)}else A==="name"||A==="{"||A==="&"?c=!0:A==="="&&b(B)}if(g(),Z=n.pop(),Z)throw new Error('Unclosed section "'+Z[1]+'" at '+_.pos);return jb(Bb(i))}function Bb(t){for(var e=[],r,n,i=0,s=t.length;i<s;++i)r=t[i],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(e.push(r),n=r));return e}function jb(t){for(var e=[],r=e,n=[],i,s,o=0,c=t.length;o<c;++o)switch(i=t[o],i[0]){case"#":case"^":r.push(i),n.push(i),r=i[4]=[];break;case"/":s=n.pop(),s[5]=i[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(i)}return e}function ei(t){this.string=t,this.tail=t,this.pos=0}ei.prototype.eos=function(){return this.tail===""};ei.prototype.scan=function(t){var e=this.tail.match(t);if(!e||e.index!==0)return"";var r=e[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};ei.prototype.scanUntil=function(t){var e=this.tail.search(t),r;switch(e){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=r.length,r};function Xr(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Xr.prototype.push=function(t){return new Xr(t,this)};Xr.prototype.lookup=function(t){var e=this.cache,r;if(e.hasOwnProperty(t))r=e[t];else{for(var n=this,i,s,o,c=!1;n;){if(t.indexOf(".")>0)for(i=n.view,s=t.split("."),o=0;i!=null&&o<s.length;)o===s.length-1&&(c=Bl(i,s[o])||Tb(i,s[o])),i=i[s[o++]];else i=n.view[t],c=Bl(n.view,t);if(c){r=i;break}n=n.parent}e[t]=r}return Ma(r)&&(r=r.call(this.view)),r};function Xt(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Xt.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Xt.prototype.parse=function(t,e){var r=this.templateCache,n=t+":"+(e||me.tags).join(":"),i=typeof r<"u",s=i?r.get(n):void 0;return s==null&&(s=Ub(t,e),i&&r.set(n,s)),s};Xt.prototype.render=function(t,e,r,n){var i=this.getConfigTags(n),s=this.parse(t,i),o=e instanceof Xr?e:new Xr(e,void 0);return this.renderTokens(s,o,r,t,n)};Xt.prototype.renderTokens=function(t,e,r,n,i){for(var s="",o,c,l,p=0,g=t.length;p<g;++p)l=void 0,o=t[p],c=o[0],c==="#"?l=this.renderSection(o,e,r,n,i):c==="^"?l=this.renderInverted(o,e,r,n,i):c===">"?l=this.renderPartial(o,e,r,i):c==="&"?l=this.unescapedValue(o,e):c==="name"?l=this.escapedValue(o,e,i):c==="text"&&(l=this.rawValue(o)),l!==void 0&&(s+=l);return s};Xt.prototype.renderSection=function(t,e,r,n,i){var s=this,o="",c=e.lookup(t[1]);function l(h){return s.render(h,e,r,i)}if(c){if(un(c))for(var p=0,g=c.length;p<g;++p)o+=this.renderTokens(t[4],e.push(c[p]),r,n,i);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")o+=this.renderTokens(t[4],e.push(c),r,n,i);else if(Ma(c)){if(typeof n!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,n.slice(t[3],t[5]),l),c!=null&&(o+=c)}else o+=this.renderTokens(t[4],e,r,n,i);return o}};Xt.prototype.renderInverted=function(t,e,r,n,i){var s=e.lookup(t[1]);if(!s||un(s)&&s.length===0)return this.renderTokens(t[4],e,r,n,i)};Xt.prototype.indentPartial=function(t,e,r){for(var n=e.replace(/[^ \t]/g,""),i=t.split(`
|
|
32
32
|
`),s=0;s<i.length;s++)i[s].length&&(s>0||!r)&&(i[s]=n+i[s]);return i.join(`
|
|
33
|
-
`)};Jt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=La(r)?r(t[1]):r[t[1]];if(s!=null){var o=t[6],c=t[5],l=t[4],p=s;c==0&&l&&(p=this.indentPartial(s,l,o));var g=this.parse(p,i);return this.renderTokens(g,e,r,p,n)}}};Jt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};Jt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||ge.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===ge.escape?String(i):n(i)};Jt.prototype.rawValue=function(t){return t[1]};Jt.prototype.getConfigTags=function(t){return cn(t)?t:t&&typeof t=="object"?t.tags:void 0};Jt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!cn(t))return t.escape};var ge={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Fn.templateCache=t},get templateCache(){return Fn.templateCache}},Fn=new Jt;ge.clearCache=function(){return Fn.clearCache()};ge.parse=function(t,e){return Fn.parse(t,e)};ge.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Ib(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Fn.render(t,e,r,n)};ge.escape=Ob;ge.Scanner=ti;ge.Context=Yr;ge.Writer=Jt;var Ve=ge,jb="?from=cooee";function Ma(){return!!window.Shopify}function $b(){if(Ma())return window.Shopify.shop?.split(".")?.[0]}function Fb(t){let e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}function Vi(){return window.Shopify?.routes?.root??"/"}function Ln(t){return Vi()+t+jb}var Hb=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},Vb=class jo{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){if(e=`__cooee_${e}_lock__`,"locks"in navigator&&!this.isInAppBrowser())return navigator.locks.request(e,r);let n=!1,i=0,s=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(x.debug(`Lock retry ${i}`),n=await this.acquire(e,s),!n);)await this.sleep(jo.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,s)}}static isInAppBrowser(){let e=navigator.userAgent||"",r=/iPhone|iPad|iPod/i.test(e),n=/(FBAV|FBAN|Instagram)/i.test(e);return r&&n}static async acquire(e,r){let n=Date.now(),i=localStorage.getItem(e),s=i?JSON.parse(i):null;if(s&&n<=s.expiry)return!1;let o={owner:r,expiry:n+jo.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(o)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(x.debug(`${r}: Lock acquired!`),!0):(x.debug(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(e,r){let n=localStorage.getItem(e);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(e),x.debug(`${r}: Lock released`)):x.debug(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}},Tt=class Jh{static CURRENT;token;items;total_price;original_total_price;items_subtotal_price;currency;item_count;attributes;cart_level_discount_applications;total_discount;lock=new Hb;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new Jh),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Lt.set(at.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await te.get(at.ID),r=await Lt.get(at.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){x.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};x.debug("Updating Shopify cart with attributes:",n);let i=Ln("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();x.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.total_discount=e.total_discount,Ot.get().currencyCode=this.currency,x.log("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,itemsSubtotalPrice:this.items_subtotal_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return x.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){x.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){x.debug("Not fetching cart");return}x.debug("Fetching cart");let r=Ln("cart.js"),n=await(await fetch(r)).json();this.update(n)}},qb=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}},Wb=class{enabled;constructor(t){this.enabled=t.enabled}},Gb=class extends Wb{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},zb=class{productQuantity;constructor(t){t??={},this.productQuantity=new Gb(t.productQuantity)}},ei=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new Uu(t.bg)),t.br&&(this.br=new aa(t.br)),t.shd&&(this.shd=new Ef(t.shd)),t.spc&&(this.spc=new la(t.spc)),this.trf=new ju(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Ua[this.t]}get click(){return this.clc}},Ua=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.PRODUCT_RATING=19]="PRODUCT_RATING",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Ua||{}),Xh=class extends ei{constructor(t){super(t)}},Ba=class extends ei{src;constructor(t){super(t),this.src=t.src}},hs=class extends ei{typo;constructor(t){super(t);let e=T(T({},t.f),t.typo);t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new Ge(e)}get color(){return this.typography.tc}get typography(){return this.typo}},$o=class extends hs{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},Kb=class extends ei{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},Qh=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let r=new Date;t===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),l=Math.floor(s%(1e3*60*60)/(1e3*60)),p=Math.floor(s%(1e3*60)/1e3);e({days:o,hours:c,minutes:l,seconds:p})},1e3);return n}},Zh=class extends hs{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new Qh(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Yb=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new ne(t.c??{})}get text(){return this.txt}get color(){return this.c}},ja=class extends hs{ph;constructor(t){super(t),this.ph=new Yb(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},tp=class extends ja{constructor(t){t??={},super(t)}},ep=class extends ja{},rp=class extends ja{},np=class extends Ba{},ps=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(ps||{}),Jb=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}},Bl=class extends ei{gvt;max;cover;anim;embedded;position;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new Jb(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new la({pl:H.IN_APP_DEFAULT_PADDING,pr:H.IN_APP_DEFAULT_PADDING,pt:H.IN_APP_DEFAULT_PADDING,pb:H.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},Xb=class extends Bl{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new Kb(t.cont),this.mob=new Bl(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(e=>{e.t===1?this.elems.push(new Ba(e)):e.t===2?this.elems.push(new $o(e)):e.t===3?this.elems.push(new $o(e)):e.t===100?this.elems.push(new Xh(e)):e.t===51?this.elems.push(new ep(e)):e.t===52?this.elems.push(new rp(e)):e.t===61?this.elems.push(new Zh(e)):e.t===15||e.t===16?this.elems.push(new tp(e)):e.t===13&&this.elems.push(new np(e))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},e,r;return this.gvt===1?(e="flex-start",r="flex-start"):this.gvt===2?(e="center",r="flex-start"):this.gvt===3?(e="flex-end",r="flex-start"):this.gvt===4?(e="flex-start",r="center"):this.gvt===6?(e="flex-end",r="center"):this.gvt===7?(e="flex-start",r="flex-end"):this.gvt===8?(e="center",r="flex-end"):this.gvt===9?(e="flex-end",r="flex-end"):(e="center",r="center"),t.alignItems=r,t.justifyContent=e,t.overflow="visible",t}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}},ip=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}},Qb=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}},Zb=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}},jl=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new la(t.spc),t.size&&(this.size=new Zb(t.size)),t.bg&&(this.bg=new Uu(t.bg)),t.br&&(this.br=new aa(t.br)),t.typo&&(this.typo=new Ge(t.typo)),t.lout&&(this.lout=new Qb(t.lout)),t.flex&&(this.flex=new ip(t.flex))}},sp=class{sm;lg;constructor(t){t??={},this.sm=new jl(t.sm),this.lg=new jl(t.lg)}},or=class{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new sp(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return Ua[this.t]}},Ae=class extends or{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text}},Fo=class extends Ae{constructor(t,e){super(t,e??3)}},op=class extends or{value;constructor(t){super(6,t),t??={},this.value=t.value}},ap=class extends Ae{showChips;optionsConfig;constructor(t=15,e){super(e,t),e??={},this.showChips=e.showChips??!1,this.optionsConfig=e.optionsConfig??{}}},tw=class extends or{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new ne(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}},ew=Oe(tn()),rw=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new ne(t.color)}},nw=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new ne(t.color)}},cp=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new nw(t.navigation),this.pagination=new rw(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},iw=class extends or{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=Jr.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new cp(t.conf),this.allowedTypes=t.allowedTypes}},sw=class extends Ae{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new Qh(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},$a=class extends or{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=Jr.getParsedElement(e);r&&this.elems.push(r)})}},Ho=class extends or{src;sm;lg;constructor(t,e){super(e??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}},Jr=class lp{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=lp.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new Ae(e);case 3:return new Fo(e);case 6:return new op(e);case 11:return new ow(e);case 12:return new Fa(e);case 61:return new sw(e);case 4:return new $a(e);case 1:return new Ho(e);case 13:return new Ho(e,13);case 14:return new Ae(e,14);case 15:case 16:return new ap(e.t,e);case 18:return new Fo(e,18);case 62:return new iw(e);case 19:return new tw(e);default:ew.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"}}},Fa=class extends or{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=Jr.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new op(t.cBox)),this.elems.push(new Ho(t.img,13));let e=new Ae(t.title,14);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);let r=new Ae(t.price);r.text="{{ product.price }}",r.hide=!t.show?.price;let n=new Ae(t.compareAt);n.text="{{ product.compare_price }}",n.hide=!t.show?.price,t.compareAt||(n.style=new sp(r.style),n.style.lg.typo=new Ge(ct(T({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new Ge(ct(T({},n.style.sm.typo),{td:"line-through"})));let i=new $a({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Jr.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new ap(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let o=new Fo(t.btn,18);o.hide=!t.show?.btn,this.elems.push(o)}}t.symbol&&(this.symbol=new Ae(t.symbol))}},ow=class extends or{conf;prod;constructor(t){super(11,t),t??={},this.conf=new aw(t.conf),this.prod=new Fa(t.prod)}},$l=class extends cp{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},aw=class{lg;sm;constructor(t){t??={},this.lg=new $l(t.lg),this.sm=new $l(t.sm)}},cw=class extends $a{constructor(t){super(t)}},up=class{cont;elems=[];constructor(t){t=t??{},this.cont=new cw(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=Jr.getParsedElement(t);return e&&this.elems.push(e),e}},lw=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Ci.EXCLUSION}isABTesting(){return this.contentType===Ci.ABTESTING}isSingleContent(){return this.contentType===Ci.SINGLE}},hp=class{videoConfig;savingsBarConfig;constructor(t){this.update(t)}update(t){t??={},t.videoConfig&&(this.videoConfig=new Eb(t.videoConfig)),t.savingsBarConfig&&(this.savingsBarConfig=new Df(t.savingsBarConfig))}},Tr=class pp extends lw{static SWIPER_ELEMENTS=new Set([11,62]);nudgeID;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=Cr({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=Ot.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new up(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 en(r)),this.items=e.items?.map(r=>new He(r))??[],this.nonMutableItems=e.items?.map(r=>new He(r))??[],this.collections=e.collections?.map(r=>new qb(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 zb(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 Cf(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new xf(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new gf(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new He(e.bundleFrom)),e.content&&(this.content=new hp(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===Ie.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===yo.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===yo.PAGE_EMBED}isProgressBar(){return this.objective===Ie.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Ie.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Ie.CART_RECOVERY}isProductPromotion(){return this.objective===Ie.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===ku.COLLECTION}isBYOB(){return this.objective===Ie.BYOB}isStickyATC(){return this.objective===Ie.STICKY_ATC}isShoppableVideo(){return this.objective===Ie.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===Ie.SAVINGS_BAR}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},s={};if(n){let l=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:l.mID,image:n.variantImage,price:he(l.price.d),comparePrice:he(l.price.cmp),quantity:n.quantity},s={quantity:l.quantity}}let o={productCount:Tt.getCurrent().item_count},c=Ve.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(c=c.replace(new RegExp(H.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new Xb(JSON.parse(c))}calculateDiscountData(e,r){let n=xn.sum(e,o=>o.selectedOrFirstVariant.value.price.d),i=xn.sum(e,o=>{let c=o.selectedOrFirstVariant.value.price;return c.cmp??c.d}),s={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(s);return}if(ye.BXGY===this.discount.type&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,s.discountPercentage,!0),s.discountAmount=s.actualPrice-xn.sum(e,o=>o.selectedOrFirstVariant.value.effectivePrice.value);else if([ye.UNIQUE_FLAT_ITEMS,ye.STATIC,ye.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],s.discountAmount=s.actualPrice*s.discountPercentage/100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===ye.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)s.discountAmount=s.actualPrice-this.discount.values[0],s.discountPercentage=s.discountAmount/s.actualPrice*100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===ye.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((c,l)=>l.selectedOrFirstVariant.value.price.d-c.selectedOrFirstVariant.value.price.d);let o=e[e.length-1];o.selectedOrFirstVariant.value.effectivePrice.value=0,s.discountAmount=o.selectedOrFirstVariant.value.price.d,s.discountPercentage=s.discountAmount/s.actualPrice*100}s.discountedPrice=s.actualPrice-s.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(s)}getPrivateAttributesForLineItem(){return ie.get().skipItemAttribute?{}:{[H.VIA]:"Cooee",[H.CAMPAIGN_ATTRIBUTE]:this.shortID,[H.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return ie.get().skipItemAttribute?[]:[{key:H.VIA,value:"Cooee"},{key:H.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:H.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[ye.UNIQUE_FIXED_ITEMS,ye.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){let e=this.widget?.elems.find(n=>pp.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=window.CooeeSDK.uaParser.getDevice().type==="mobile"?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}getCartMagicVariables(){let e=Tt.getCurrent(),r=xn.sum(e.items,n=>n.discounts?.reduce((i,s)=>i+(s.amount??0),0)??0);return{productCount:e.item_count,product_count:e.item_count,amount:he(e.total_price/100),originalAmount:he(e.original_total_price/100),total_line_items_discount:he(r/100),total_discount:he(e.total_discount/100)}}updateEffectivePrice(e,r,n=!1){let i=Ot.get().getCurrentItem();e.forEach(s=>{let o=s.selectedOrFirstVariant.value,c=o.price;if(n&&s.mID===i.mID)o.effectivePrice.value=c.d;else{let l=c.d*r/100;o.effectivePrice.value=c.d-l}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:Zv(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{r[n]=he(e[n])}),r}};function uw(t,e){return e={exports:{}},t(e,e.exports),e.exports}var hw=gw,pw=yw,dw=ww,De=[],ue=[],fw=typeof Uint8Array<"u"?Uint8Array:Array,Ws="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(lr=0,Fl=Ws.length;lr<Fl;++lr)De[lr]=Ws[lr],ue[Ws.charCodeAt(lr)]=lr;var lr,Fl;ue[45]=62;ue[95]=63;function dp(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 gw(t){var e=dp(t),r=e[0],n=e[1];return(r+n)*3/4-n}function mw(t,e,r){return(e+r)*3/4-r}function yw(t){var e,r=dp(t),n=r[0],i=r[1],s=new fw(mw(t,n,i)),o=0,c=i>0?n-4:n,l;for(l=0;l<c;l+=4)e=ue[t.charCodeAt(l)]<<18|ue[t.charCodeAt(l+1)]<<12|ue[t.charCodeAt(l+2)]<<6|ue[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ue[t.charCodeAt(l)]<<2|ue[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=ue[t.charCodeAt(l)]<<10|ue[t.charCodeAt(l+1)]<<4|ue[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function vw(t){return De[t>>18&63]+De[t>>12&63]+De[t>>6&63]+De[t&63]}function bw(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(vw(n));return i.join("")}function ww(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(bw(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],i.push(De[e>>2]+De[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(De[e>>10]+De[e>>4&63]+De[e<<2&63]+"=")),i.join("")}var Gs={byteLength:hw,toByteArray:pw,fromByteArray:dw},_w=function(t,e,r,n,i){var s,o,c=i*8-n-1,l=(1<<c)-1,p=l>>1,g=-7,h=r?i-1:0,w=r?-1:1,v=t[e+h];for(h+=w,s=v&(1<<-g)-1,v>>=-g,g+=c;g>0;s=s*256+t[e+h],h+=w,g-=8);for(o=s&(1<<-g)-1,s>>=-g,g+=n;g>0;o=o*256+t[e+h],h+=w,g-=8);if(s===0)s=1-p;else{if(s===l)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-p}return(v?-1:1)*o*Math.pow(2,s-n)},Ew=function(t,e,r,n,i,s){var o,c,l,p=s*8-i-1,g=(1<<p)-1,h=g>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,b=n?1:-1,_=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=g):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+h>=1?e+=w/l:e+=w*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=g?(c=0,o=g):o+h>=1?(c=(e*l-1)*Math.pow(2,i),o=o+h):(c=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+v]=c&255,v+=b,c/=256,i-=8);for(o=o<<i|c,p+=i;p>0;t[r+v]=o&255,v+=b,o/=256,p-=8);t[r+v-b]|=_*128},Rr={read:_w,write:Ew},ds=uw(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=A,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var a=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(a,u),a.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(a){if(a>n)throw new RangeError('The value "'+a+'" is invalid for option "size"');var u=new Uint8Array(a);return Object.setPrototypeOf(u,o.prototype),u}function o(a,u,d){if(typeof a=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(a)}return c(a,u,d)}o.poolSize=8192;function c(a,u,d){if(typeof a=="string")return h(a,u);if(ArrayBuffer.isView(a))return v(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(ae(a,ArrayBuffer)||a&&ae(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ae(a,SharedArrayBuffer)||a&&ae(a.buffer,SharedArrayBuffer)))return b(a,u,d);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var E=a.valueOf&&a.valueOf();if(E!=null&&E!==a)return o.from(E,u,d);var D=_(a);if(D)return D;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return o.from(a[Symbol.toPrimitive]("string"),u,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}o.from=function(a,u,d){return c(a,u,d)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function p(a,u,d){return l(a),a<=0?s(a):u!==void 0?typeof d=="string"?s(a).fill(u,d):s(a).fill(u):s(a)}o.alloc=function(a,u,d){return p(a,u,d)};function g(a){return l(a),s(a<0?0:k(a)|0)}o.allocUnsafe=function(a){return g(a)},o.allocUnsafeSlow=function(a){return g(a)};function h(a,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var d=B(a,u)|0,E=s(d),D=E.write(a,u);return D!==d&&(E=E.slice(0,D)),E}function w(a){for(var u=a.length<0?0:k(a.length)|0,d=s(u),E=0;E<u;E+=1)d[E]=a[E]&255;return d}function v(a){if(ae(a,Uint8Array)){var u=new Uint8Array(a);return b(u.buffer,u.byteOffset,u.byteLength)}return w(a)}function b(a,u,d){if(u<0||a.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<u+(d||0))throw new RangeError('"length" is outside of buffer bounds');var E;return u===void 0&&d===void 0?E=new Uint8Array(a):d===void 0?E=new Uint8Array(a,u):E=new Uint8Array(a,u,d),Object.setPrototypeOf(E,o.prototype),E}function _(a){if(o.isBuffer(a)){var u=k(a.length)|0,d=s(u);return d.length===0||a.copy(d,0,0,u),d}if(a.length!==void 0)return typeof a.length!="number"||hn(a.length)?s(0):w(a);if(a.type==="Buffer"&&Array.isArray(a.data))return w(a.data)}function k(a){if(a>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return a|0}function A(a){return+a!=a&&(a=0),o.alloc(+a)}o.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==o.prototype},o.compare=function(a,u){if(ae(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),ae(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(a)||!o.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===u)return 0;for(var d=a.length,E=u.length,D=0,M=Math.min(d,E);D<M;++D)if(a[D]!==u[D]){d=a[D],E=u[D];break}return d<E?-1:E<d?1:0},o.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(a,u){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return o.alloc(0);var d;if(u===void 0)for(u=0,d=0;d<a.length;++d)u+=a[d].length;var E=o.allocUnsafe(u),D=0;for(d=0;d<a.length;++d){var M=a[d];if(ae(M,Uint8Array))D+M.length>E.length?o.from(M).copy(E,D):Uint8Array.prototype.set.call(E,M,D);else if(o.isBuffer(M))M.copy(E,D);else throw new TypeError('"list" argument must be an Array of Buffers');D+=M.length}return E};function B(a,u){if(o.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||ae(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var d=a.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&d===0)return 0;for(var D=!1;;)switch(u){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return un(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return li(a).length;default:if(D)return E?-1:un(a).length;u=(""+u).toLowerCase(),D=!0}}o.byteLength=B;function G(a,u,d){var E=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,u>>>=0,d<=u))return"";for(a||(a="utf8");;)switch(a){case"hex":return Wt(this,u,d);case"utf8":case"utf-8":return kt(this,u,d);case"ascii":return qt(this,u,d);case"latin1":case"binary":return gt(this,u,d);case"base64":return ht(this,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ot(this,u,d);default:if(E)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),E=!0}}o.prototype._isBuffer=!0;function j(a,u,d){var E=a[u];a[u]=a[d],a[d]=E}o.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<a;u+=2)j(this,u,u+1);return this},o.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<a;u+=4)j(this,u,u+3),j(this,u+1,u+2);return this},o.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<a;u+=8)j(this,u,u+7),j(this,u+1,u+6),j(this,u+2,u+5),j(this,u+3,u+4);return this},o.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?kt(this,0,a):G.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(a){if(!o.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:o.compare(this,a)===0},o.prototype.inspect=function(){var a="",u=e.INSPECT_MAX_BYTES;return a=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(a+=" ... "),"<Buffer "+a+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(a,u,d,E,D){if(ae(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),!o.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(u===void 0&&(u=0),d===void 0&&(d=a?a.length:0),E===void 0&&(E=0),D===void 0&&(D=this.length),u<0||d>a.length||E<0||D>this.length)throw new RangeError("out of range index");if(E>=D&&u>=d)return 0;if(E>=D)return-1;if(u>=d)return 1;if(u>>>=0,d>>>=0,E>>>=0,D>>>=0,this===a)return 0;for(var M=D-E,K=d-u,pt=Math.min(M,K),Nt=this.slice(E,D),mt=a.slice(u,d),It=0;It<pt;++It)if(Nt[It]!==mt[It]){M=Nt[It],K=mt[It];break}return M<K?-1:K<M?1:0};function Q(a,u,d,E,D){if(a.length===0)return-1;if(typeof d=="string"?(E=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,hn(d)&&(d=D?0:a.length-1),d<0&&(d=a.length+d),d>=a.length){if(D)return-1;d=a.length-1}else if(d<0)if(D)d=0;else return-1;if(typeof u=="string"&&(u=o.from(u,E)),o.isBuffer(u))return u.length===0?-1:Et(a,u,d,E,D);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(a,u,d):Uint8Array.prototype.lastIndexOf.call(a,u,d):Et(a,[u],d,E,D);throw new TypeError("val must be string, number or Buffer")}function Et(a,u,d,E,D){var M=1,K=a.length,pt=u.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(a.length<2||u.length<2)return-1;M=2,K/=2,pt/=2,d/=2}function Nt(pn,dn){return M===1?pn[dn]:pn.readUInt16BE(dn*M)}var mt;if(D){var It=-1;for(mt=d;mt<K;mt++)if(Nt(a,mt)===Nt(u,It===-1?0:mt-It)){if(It===-1&&(It=mt),mt-It+1===pt)return It*M}else It!==-1&&(mt-=mt-It),It=-1}else for(d+pt>K&&(d=K-pt),mt=d;mt>=0;mt--){for(var Ut=!0,cr=0;cr<pt;cr++)if(Nt(a,mt+cr)!==Nt(u,cr)){Ut=!1;break}if(Ut)return mt}return-1}o.prototype.includes=function(a,u,d){return this.indexOf(a,u,d)!==-1},o.prototype.indexOf=function(a,u,d){return Q(this,a,u,d,!0)},o.prototype.lastIndexOf=function(a,u,d){return Q(this,a,u,d,!1)};function Dt(a,u,d,E){d=Number(d)||0;var D=a.length-d;E?(E=Number(E),E>D&&(E=D)):E=D;var M=u.length;E>M/2&&(E=M/2);for(var K=0;K<E;++K){var pt=parseInt(u.substr(K*2,2),16);if(hn(pt))return K;a[d+K]=pt}return K}function q(a,u,d,E){return kr(un(u,a.length-d),a,d,E)}function nt(a,u,d,E){return kr(Is(u),a,d,E)}function Z(a,u,d,E){return kr(li(u),a,d,E)}function et(a,u,d,E){return kr(Cs(u,a.length-d),a,d,E)}o.prototype.write=function(a,u,d,E){if(u===void 0)E="utf8",d=this.length,u=0;else if(d===void 0&&typeof u=="string")E=u,d=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(d)?(d=d>>>0,E===void 0&&(E="utf8")):(E=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var D=this.length-u;if((d===void 0||d>D)&&(d=D),a.length>0&&(d<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");E||(E="utf8");for(var M=!1;;)switch(E){case"hex":return Dt(this,a,u,d);case"utf8":case"utf-8":return q(this,a,u,d);case"ascii":case"latin1":case"binary":return nt(this,a,u,d);case"base64":return Z(this,a,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return et(this,a,u,d);default:if(M)throw new TypeError("Unknown encoding: "+E);E=(""+E).toLowerCase(),M=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ht(a,u,d){return u===0&&d===a.length?Gs.fromByteArray(a):Gs.fromByteArray(a.slice(u,d))}function kt(a,u,d){d=Math.min(a.length,d);for(var E=[],D=u;D<d;){var M=a[D],K=null,pt=M>239?4:M>223?3:M>191?2:1;if(D+pt<=d){var Nt,mt,It,Ut;switch(pt){case 1:M<128&&(K=M);break;case 2:Nt=a[D+1],(Nt&192)===128&&(Ut=(M&31)<<6|Nt&63,Ut>127&&(K=Ut));break;case 3:Nt=a[D+1],mt=a[D+2],(Nt&192)===128&&(mt&192)===128&&(Ut=(M&15)<<12|(Nt&63)<<6|mt&63,Ut>2047&&(Ut<55296||Ut>57343)&&(K=Ut));break;case 4:Nt=a[D+1],mt=a[D+2],It=a[D+3],(Nt&192)===128&&(mt&192)===128&&(It&192)===128&&(Ut=(M&15)<<18|(Nt&63)<<12|(mt&63)<<6|It&63,Ut>65535&&Ut<1114112&&(K=Ut))}}K===null?(K=65533,pt=1):K>65535&&(K-=65536,E.push(K>>>10&1023|55296),K=56320|K&1023),E.push(K),D+=pt}return jt(E)}var At=4096;function jt(a){var u=a.length;if(u<=At)return String.fromCharCode.apply(String,a);for(var d="",E=0;E<u;)d+=String.fromCharCode.apply(String,a.slice(E,E+=At));return d}function qt(a,u,d){var E="";d=Math.min(a.length,d);for(var D=u;D<d;++D)E+=String.fromCharCode(a[D]&127);return E}function gt(a,u,d){var E="";d=Math.min(a.length,d);for(var D=u;D<d;++D)E+=String.fromCharCode(a[D]);return E}function Wt(a,u,d){var E=a.length;(!u||u<0)&&(u=0),(!d||d<0||d>E)&&(d=E);for(var D="",M=u;M<d;++M)D+=Ts[a[M]];return D}function ot(a,u,d){for(var E=a.slice(u,d),D="",M=0;M<E.length-1;M+=2)D+=String.fromCharCode(E[M]+E[M+1]*256);return D}o.prototype.slice=function(a,u){var d=this.length;a=~~a,u=u===void 0?d:~~u,a<0?(a+=d,a<0&&(a=0)):a>d&&(a=d),u<0?(u+=d,u<0&&(u=0)):u>d&&(u=d),u<a&&(u=a);var E=this.subarray(a,u);return Object.setPrototypeOf(E,o.prototype),E};function rt(a,u,d){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+u>d)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(a,u,d){a=a>>>0,u=u>>>0,d||rt(a,u,this.length);for(var E=this[a],D=1,M=0;++M<u&&(D*=256);)E+=this[a+M]*D;return E},o.prototype.readUintBE=o.prototype.readUIntBE=function(a,u,d){a=a>>>0,u=u>>>0,d||rt(a,u,this.length);for(var E=this[a+--u],D=1;u>0&&(D*=256);)E+=this[a+--u]*D;return E},o.prototype.readUint8=o.prototype.readUInt8=function(a,u){return a=a>>>0,u||rt(a,1,this.length),this[a]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(a,u){return a=a>>>0,u||rt(a,2,this.length),this[a]|this[a+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(a,u){return a=a>>>0,u||rt(a,2,this.length),this[a]<<8|this[a+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(a,u){return a=a>>>0,u||rt(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(a,u){return a=a>>>0,u||rt(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},o.prototype.readIntLE=function(a,u,d){a=a>>>0,u=u>>>0,d||rt(a,u,this.length);for(var E=this[a],D=1,M=0;++M<u&&(D*=256);)E+=this[a+M]*D;return D*=128,E>=D&&(E-=Math.pow(2,8*u)),E},o.prototype.readIntBE=function(a,u,d){a=a>>>0,u=u>>>0,d||rt(a,u,this.length);for(var E=u,D=1,M=this[a+--E];E>0&&(D*=256);)M+=this[a+--E]*D;return D*=128,M>=D&&(M-=Math.pow(2,8*u)),M},o.prototype.readInt8=function(a,u){return a=a>>>0,u||rt(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},o.prototype.readInt16LE=function(a,u){a=a>>>0,u||rt(a,2,this.length);var d=this[a]|this[a+1]<<8;return d&32768?d|4294901760:d},o.prototype.readInt16BE=function(a,u){a=a>>>0,u||rt(a,2,this.length);var d=this[a+1]|this[a]<<8;return d&32768?d|4294901760:d},o.prototype.readInt32LE=function(a,u){return a=a>>>0,u||rt(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},o.prototype.readInt32BE=function(a,u){return a=a>>>0,u||rt(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},o.prototype.readFloatLE=function(a,u){return a=a>>>0,u||rt(a,4,this.length),Rr.read(this,a,!0,23,4)},o.prototype.readFloatBE=function(a,u){return a=a>>>0,u||rt(a,4,this.length),Rr.read(this,a,!1,23,4)},o.prototype.readDoubleLE=function(a,u){return a=a>>>0,u||rt(a,8,this.length),Rr.read(this,a,!0,52,8)},o.prototype.readDoubleBE=function(a,u){return a=a>>>0,u||rt(a,8,this.length),Rr.read(this,a,!1,52,8)};function $t(a,u,d,E,D,M){if(!o.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>D||u<M)throw new RangeError('"value" argument is out of bounds');if(d+E>a.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(a,u,d,E){if(a=+a,u=u>>>0,d=d>>>0,!E){var D=Math.pow(2,8*d)-1;$t(this,a,u,d,D,0)}var M=1,K=0;for(this[u]=a&255;++K<d&&(M*=256);)this[u+K]=a/M&255;return u+d},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(a,u,d,E){if(a=+a,u=u>>>0,d=d>>>0,!E){var D=Math.pow(2,8*d)-1;$t(this,a,u,d,D,0)}var M=d-1,K=1;for(this[u+M]=a&255;--M>=0&&(K*=256);)this[u+M]=a/K&255;return u+d},o.prototype.writeUint8=o.prototype.writeUInt8=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,1,255,0),this[u]=a&255,u+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,2,65535,0),this[u]=a&255,this[u+1]=a>>>8,u+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,2,65535,0),this[u]=a>>>8,this[u+1]=a&255,u+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,4,4294967295,0),this[u+3]=a>>>24,this[u+2]=a>>>16,this[u+1]=a>>>8,this[u]=a&255,u+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,4,4294967295,0),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4},o.prototype.writeIntLE=function(a,u,d,E){if(a=+a,u=u>>>0,!E){var D=Math.pow(2,8*d-1);$t(this,a,u,d,D-1,-D)}var M=0,K=1,pt=0;for(this[u]=a&255;++M<d&&(K*=256);)a<0&&pt===0&&this[u+M-1]!==0&&(pt=1),this[u+M]=(a/K>>0)-pt&255;return u+d},o.prototype.writeIntBE=function(a,u,d,E){if(a=+a,u=u>>>0,!E){var D=Math.pow(2,8*d-1);$t(this,a,u,d,D-1,-D)}var M=d-1,K=1,pt=0;for(this[u+M]=a&255;--M>=0&&(K*=256);)a<0&&pt===0&&this[u+M+1]!==0&&(pt=1),this[u+M]=(a/K>>0)-pt&255;return u+d},o.prototype.writeInt8=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,1,127,-128),a<0&&(a=255+a+1),this[u]=a&255,u+1},o.prototype.writeInt16LE=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,2,32767,-32768),this[u]=a&255,this[u+1]=a>>>8,u+2},o.prototype.writeInt16BE=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,2,32767,-32768),this[u]=a>>>8,this[u+1]=a&255,u+2},o.prototype.writeInt32LE=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,4,2147483647,-2147483648),this[u]=a&255,this[u+1]=a>>>8,this[u+2]=a>>>16,this[u+3]=a>>>24,u+4},o.prototype.writeInt32BE=function(a,u,d){return a=+a,u=u>>>0,d||$t(this,a,u,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4};function oi(a,u,d,E,D,M){if(d+E>a.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function ai(a,u,d,E,D){return u=+u,d=d>>>0,D||oi(a,u,d,4),Rr.write(a,u,d,E,23,4),d+4}o.prototype.writeFloatLE=function(a,u,d){return ai(this,a,u,!0,d)},o.prototype.writeFloatBE=function(a,u,d){return ai(this,a,u,!1,d)};function oe(a,u,d,E,D){return u=+u,d=d>>>0,D||oi(a,u,d,8),Rr.write(a,u,d,E,52,8),d+8}o.prototype.writeDoubleLE=function(a,u,d){return oe(this,a,u,!0,d)},o.prototype.writeDoubleBE=function(a,u,d){return oe(this,a,u,!1,d)},o.prototype.copy=function(a,u,d,E){if(!o.isBuffer(a))throw new TypeError("argument should be a Buffer");if(d||(d=0),!E&&E!==0&&(E=this.length),u>=a.length&&(u=a.length),u||(u=0),E>0&&E<d&&(E=d),E===d||a.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(d<0||d>=this.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("sourceEnd out of bounds");E>this.length&&(E=this.length),a.length-u<E-d&&(E=a.length-u+d);var D=E-d;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,d,E):Uint8Array.prototype.set.call(a,this.subarray(d,E),u),D},o.prototype.fill=function(a,u,d,E){if(typeof a=="string"){if(typeof u=="string"?(E=u,u=0,d=this.length):typeof d=="string"&&(E=d,d=this.length),E!==void 0&&typeof E!="string")throw new TypeError("encoding must be a string");if(typeof E=="string"&&!o.isEncoding(E))throw new TypeError("Unknown encoding: "+E);if(a.length===1){var D=a.charCodeAt(0);(E==="utf8"&&D<128||E==="latin1")&&(a=D)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(u<0||this.length<u||this.length<d)throw new RangeError("Out of range index");if(d<=u)return this;u=u>>>0,d=d===void 0?this.length:d>>>0,a||(a=0);var M;if(typeof a=="number")for(M=u;M<d;++M)this[M]=a;else{var K=o.isBuffer(a)?a:o.from(a,E),pt=K.length;if(pt===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(M=0;M<d-u;++M)this[M+u]=K[M%pt]}return this};var ci=/[^+/0-9A-Za-z-_]/g;function Ss(a){if(a=a.split("=")[0],a=a.trim().replace(ci,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function un(a,u){u=u||1/0;for(var d,E=a.length,D=null,M=[],K=0;K<E;++K){if(d=a.charCodeAt(K),d>55295&&d<57344){if(!D){if(d>56319){(u-=3)>-1&&M.push(239,191,189);continue}else if(K+1===E){(u-=3)>-1&&M.push(239,191,189);continue}D=d;continue}if(d<56320){(u-=3)>-1&&M.push(239,191,189),D=d;continue}d=(D-55296<<10|d-56320)+65536}else D&&(u-=3)>-1&&M.push(239,191,189);if(D=null,d<128){if((u-=1)<0)break;M.push(d)}else if(d<2048){if((u-=2)<0)break;M.push(d>>6|192,d&63|128)}else if(d<65536){if((u-=3)<0)break;M.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((u-=4)<0)break;M.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return M}function Is(a){for(var u=[],d=0;d<a.length;++d)u.push(a.charCodeAt(d)&255);return u}function Cs(a,u){for(var d,E,D,M=[],K=0;K<a.length&&!((u-=2)<0);++K)d=a.charCodeAt(K),E=d>>8,D=d%256,M.push(D),M.push(E);return M}function li(a){return Gs.toByteArray(Ss(a))}function kr(a,u,d,E){for(var D=0;D<E&&!(D+d>=u.length||D>=a.length);++D)u[D+d]=a[D];return D}function ae(a,u){return a instanceof u||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===u.name}function hn(a){return a!==a}var Ts=function(){for(var a="0123456789abcdef",u=new Array(256),d=0;d<16;++d)for(var E=d*16,D=0;D<16;++D)u[E+D]=a[d]+a[D];return u}()}),ut=ds.Buffer;ds.SlowBuffer;ds.INSPECT_MAX_BYTES;ds.kMaxLength;var Vo=function(t,e){return Vo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Vo(t,e)};function fs(t,e){Vo(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var vr=function(t){fs(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),xt=function(t){fs(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function bi(t){return t&&t.Math==Math&&t}function fp(){return bi(typeof globalThis=="object"&&globalThis)||bi(typeof window=="object"&&window)||bi(typeof self=="object"&&self)||bi(typeof global=="object"&&global)||Function("return this")()}function Sw(){var t=fp();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Iw=function(t){var e=Sw()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(e);for(var r=ut.alloc(t),n=0;n<t;++n)r[n]=Math.floor(Math.random()*256);return r},Cw=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(ut.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(ut.alloc(e))}:Iw}},gp=Cw();function Tw(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Ha(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function xw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Dw(t){return ri(t)&&Object.prototype.toString.call(t)==="[object Date]"}function ri(t){return typeof t=="object"&&t!==null}function gs(t,e){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function qi(t){if(ArrayBuffer.isView(t))return ut.from(t.buffer,t.byteOffset,t.byteLength);if(Tw(t))return ut.from(t);throw new xt("Must use either Buffer or TypedArray")}var Aw=/^(?:[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,mp=function(t){return typeof t=="string"&&Aw.test(t)},qo=function(t){if(!mp(t))throw new xt('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 ut.from(e,"hex")},Hl=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")},fE=Math.pow(2,63)-1,gE=-Math.pow(2,63),Nw=Math.pow(2,53),Ow=-Math.pow(2,53),yp=4,br=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 xt("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=ut.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=ut.from(e,"binary"):Array.isArray(e)?this.buffer=ut.from(e):this.buffer=qi(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new xt("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new xt("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 xt("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=ut.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=ut.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(qi(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 Vl(this.buffer.slice(0,this.position));throw new vr('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=ut.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=ut.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=qo(e.$uuid)),!n)throw new xt("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===yp?new Vl(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(br.prototype,"_bsontype",{value:"Binary"});var zs=16,Vl=function(t){fs(e,t);function e(r){var n=this,i,s;if(r==null)i=e.generate();else if(r instanceof e)i=ut.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===zs)i=qi(r);else if(typeof r=="string")i=qo(r);else throw new xt("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,yp)||this,n.__id=s,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Hl(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=Hl(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 br(this.id,br.SUBTYPE_UUID)},e.generate=function(){var r=gp(zs);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ut.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?mp(r):Ha(r)?r.length!==zs?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=qo(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}(br),ms=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t}();Object.defineProperty(ms.prototype,"_bsontype",{value:"Code"});function kw(t){return ri(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var Hn=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var s=e.split(".");s.length===2&&(n=s.shift(),e=s.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(Hn.prototype,"_bsontype",{value:"DBRef"});var le=void 0;try{le=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}var ql=65536,Pw=1<<24,jr=ql*ql,vp=jr*jr,Wl=vp/2,Gl={},zl={},Y=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,s;return r?(e>>>=0,(s=0<=e&&e<256)&&(i=zl[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(zl[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=Gl[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(Gl[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>=vp)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Wl)return t.MIN_VALUE;if(e+1>=Wl)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%jr|0,e/jr|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var s=t.fromNumber(Math.pow(n,8)),o=t.ZERO,c=0;c<e.length;c+=8){var l=Math.min(8,e.length-c),p=parseInt(e.substring(c,c+l),n);if(l<8){var g=t.fromNumber(Math.pow(n,l));o=o.mul(g).add(t.fromNumber(p))}else o=o.mul(s),o=o.add(t.fromNumber(p))}return o.unsigned=r,o},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return ri(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,s=this.low&65535,o=e.high>>>16,c=e.high&65535,l=e.low>>>16,p=e.low&65535,g=0,h=0,w=0,v=0;return v+=s+p,w+=v>>>16,v&=65535,w+=i+l,h+=w>>>16,w&=65535,h+=n+c,g+=h>>>16,h&=65535,g+=r+o,g&=65535,t.fromBits(w<<16|v,g<<16|h,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(le){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?le.div_u:le.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,le.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;s=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(n)/Math.LN2),l=c<=48?1:Math.pow(2,c-48),p=t.fromNumber(n),g=p.mul(e);g.isNegative()||g.gt(i);)n-=l,p=t.fromNumber(n,this.unsigned),g=p.mul(e);p.isZero()&&(p=t.ONE),s=s.add(p),i=i.sub(g)}return s},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),le){var r=(this.unsigned?le.rem_u:le.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,le.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),le){var r=le.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,le.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,s=this.low>>>16,o=this.low&65535,c=e.high>>>16,l=e.high&65535,p=e.low>>>16,g=e.low&65535,h=0,w=0,v=0,b=0;return b+=o*g,v+=b>>>16,b&=65535,v+=s*g,w+=v>>>16,v&=65535,v+=o*p,w+=v>>>16,v&=65535,w+=i*g,h+=w>>>16,w&=65535,w+=s*p,h+=w>>>16,w&=65535,w+=o*l,h+=w>>>16,w&=65535,h+=n*g+i*p+s*l+o*c,h&=65535,t.fromBits(v<<16|b,h<<16|w,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)*jr+(this.low>>>0):this.high*jr+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=t.fromNumber(Math.pow(e,6),this.unsigned),o=this,c="";;){var l=o.div(s),p=o.sub(l.mul(s)).toInt()>>>0,g=p.toString(e);if(o=l,o.isZero())return g+c;for(;g.length<6;)g="0"+g;c=""+g+c}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(Pw),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(Y.prototype,"__isLong__",{value:!0});Object.defineProperty(Y.prototype,"_bsontype",{value:"Long"});var Rw=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Lw=/^(\+|-)?(Infinity|inf)$/i,Mw=/^(\+|-)?NaN$/i,gn=6111,Ks=-6176,Kl=6176,Uw=34,Ys=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Yl=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Jl=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Bw=/^([-+])?(\d+)?$/,jw=31,Xl=16383,$w=30,Fw=31;function Ql(t){return!isNaN(parseInt(t,10))}function Hw(t){var e=Y.fromNumber(1e9),r=Y.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 Y(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Vw(t,e){if(!t&&!e)return{high:Y.fromNumber(0),low:Y.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new Y(t.getLowBits(),0),i=e.shiftRightUnsigned(32),s=new Y(e.getLowBits(),0),o=r.multiply(i),c=r.multiply(s),l=n.multiply(i),p=n.multiply(s);return o=o.add(c.shiftRightUnsigned(32)),c=new Y(c.getLowBits(),0).add(l).add(p.shiftRightUnsigned(32)),o=o.add(c.shiftRightUnsigned(32)),p=c.shiftLeft(32).add(new Y(p.getLowBits(),0)),{high:o,low:p}}function qw(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,s=e.low>>>0;if(i<s)return!0}return!1}function Lr(t,e){throw new xt('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Va=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Ha(e)){if(e.byteLength!==16)throw new xt("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new xt("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,s=0,o=0,c=0,l=0,p=0,g=[0],h=0,w=0,v=0,b=0,_=0,k=0,A=new Y(0,0),B=new Y(0,0),G=0,j=0;if(e.length>=7e3)throw new xt(""+e+" not a valid Decimal128 string");var Q=e.match(Rw),Et=e.match(Lw),Dt=e.match(Mw);if(!Q&&!Et&&!Dt||e.length===0)throw new xt(""+e+" not a valid Decimal128 string");if(Q){var q=Q[2],nt=Q[4],Z=Q[5],et=Q[6];nt&&et===void 0&&Lr(e,"missing exponent power"),nt&&q===void 0&&Lr(e,"missing exponent base"),nt===void 0&&(Z||et)&&Lr(e,"missing e before exponent")}if((e[j]==="+"||e[j]==="-")&&(r=e[j++]==="-"),!Ql(e[j])&&e[j]!=="."){if(e[j]==="i"||e[j]==="I")return new t(ut.from(r?Yl:Jl));if(e[j]==="N")return new t(ut.from(Ys))}for(;Ql(e[j])||e[j]===".";){if(e[j]==="."){n&&Lr(e,"contains multiple periods"),n=!0,j=j+1;continue}h<34&&(e[j]!=="0"||i)&&(i||(p=o),i=!0,g[w++]=parseInt(e[j],10),h=h+1),i&&(c=c+1),n&&(l=l+1),o=o+1,j=j+1}if(n&&!o)throw new xt(""+e+" not a valid Decimal128 string");if(e[j]==="e"||e[j]==="E"){var ht=e.substr(++j).match(Bw);if(!ht||!ht[2])return new t(ut.from(Ys));_=parseInt(ht[0],10),j=j+ht[0].length}if(e[j])return new t(ut.from(Ys));if(v=0,!h)v=0,b=0,g[0]=0,c=1,h=1,s=0;else if(b=h-1,s=c,s!==1)for(;g[p+s-1]===0;)s=s-1;for(_<=l&&l-_>16384?_=Ks:_=_-l;_>gn;){if(b=b+1,b-v>Uw){var kt=g.join("");if(kt.match(/^0+$/)){_=gn;break}Lr(e,"overflow")}_=_-1}for(;_<Ks||h<c;){if(b===0&&s<h){_=Ks,s=0;break}if(h<c?c=c-1:b=b-1,_<gn)_=_+1;else{var kt=g.join("");if(kt.match(/^0+$/)){_=gn;break}Lr(e,"overflow")}}if(b-v+1<s){var At=o;n&&(p=p+1,At=At+1),r&&(p=p+1,At=At+1);var jt=parseInt(e[p+b+1],10),qt=0;if(jt>=5&&(qt=1,jt===5)){for(qt=g[b]%2===1?1:0,k=p+b+2;k<At;k++)if(parseInt(e[k],10)){qt=1;break}}if(qt){for(var gt=b;gt>=0;gt--)if(++g[gt]>9&&(g[gt]=0,gt===0))if(_<gn)_=_+1,g[gt]=1;else return new t(ut.from(r?Yl:Jl))}}if(A=Y.fromNumber(0),B=Y.fromNumber(0),s===0)A=Y.fromNumber(0),B=Y.fromNumber(0);else if(b-v<17){var gt=v;for(B=Y.fromNumber(g[gt++]),A=new Y(0,0);gt<=b;gt++)B=B.multiply(Y.fromNumber(10)),B=B.add(Y.fromNumber(g[gt]))}else{var gt=v;for(A=Y.fromNumber(g[gt++]);gt<=b-17;gt++)A=A.multiply(Y.fromNumber(10)),A=A.add(Y.fromNumber(g[gt]));for(B=Y.fromNumber(g[gt++]);gt<=b;gt++)B=B.multiply(Y.fromNumber(10)),B=B.add(Y.fromNumber(g[gt]))}var Wt=Vw(A,Y.fromString("100000000000000000"));Wt.low=Wt.low.add(B),qw(Wt.low,B)&&(Wt.high=Wt.high.add(Y.fromNumber(1))),G=_+Kl;var ot={low:Y.fromNumber(0),high:Y.fromNumber(0)};Wt.high.shiftRightUnsigned(49).and(Y.fromNumber(1)).equals(Y.fromNumber(1))?(ot.high=ot.high.or(Y.fromNumber(3).shiftLeft(61)),ot.high=ot.high.or(Y.fromNumber(G).and(Y.fromNumber(16383).shiftLeft(47))),ot.high=ot.high.or(Wt.high.and(Y.fromNumber(0x7fffffffffff)))):(ot.high=ot.high.or(Y.fromNumber(G&16383).shiftLeft(49)),ot.high=ot.high.or(Wt.high.and(Y.fromNumber(562949953421311)))),ot.low=Wt.low,r&&(ot.high=ot.high.or(Y.fromString("9223372036854775808")));var rt=ut.alloc(16);return j=0,rt[j++]=ot.low.low&255,rt[j++]=ot.low.low>>8&255,rt[j++]=ot.low.low>>16&255,rt[j++]=ot.low.low>>24&255,rt[j++]=ot.low.high&255,rt[j++]=ot.low.high>>8&255,rt[j++]=ot.low.high>>16&255,rt[j++]=ot.low.high>>24&255,rt[j++]=ot.high.low&255,rt[j++]=ot.high.low>>8&255,rt[j++]=ot.high.low>>16&255,rt[j++]=ot.high.low>>24&255,rt[j++]=ot.high.high&255,rt[j++]=ot.high.high>>8&255,rt[j++]=ot.high.high>>16&255,rt[j++]=ot.high.high>>24&255,new t(rt)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,c,l={parts:[0,0,0,0]},p,g,h=[];s=0;var w=this.bytes,v=w[s++]|w[s++]<<8|w[s++]<<16|w[s++]<<24,b=w[s++]|w[s++]<<8|w[s++]<<16|w[s++]<<24,_=w[s++]|w[s++]<<8|w[s++]<<16|w[s++]<<24,k=w[s++]|w[s++]<<8|w[s++]<<16|w[s++]<<24;s=0;var A={low:new Y(v,b),high:new Y(_,k)};A.high.lessThan(Y.ZERO)&&h.push("-");var B=k>>26&jw;if(B>>3===3){if(B===$w)return h.join("")+"Infinity";if(B===Fw)return"NaN";e=k>>15&Xl,c=8+(k>>14&1)}else c=k>>14&7,e=k>>17&Xl;var G=e-Kl;if(l.parts[0]=(k&16383)+((c&15)<<14),l.parts[1]=_,l.parts[2]=b,l.parts[3]=v,l.parts[0]===0&&l.parts[1]===0&&l.parts[2]===0&&l.parts[3]===0)o=!0;else for(g=3;g>=0;g--){var j=0,Q=Hw(l);if(l=Q.quotient,j=Q.rem.low,!!j)for(p=8;p>=0;p--)n[g*9+p]=j%10,j=Math.floor(j/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var Et=r-1+G;if(Et>=34||Et<=-7||G>0){if(r>34)return h.push("".concat(0)),G>0?h.push("E+".concat(G)):G<0&&h.push("E".concat(G)),h.join("");h.push("".concat(n[s++])),r=r-1,r&&h.push(".");for(var i=0;i<r;i++)h.push("".concat(n[s++]));h.push("E"),Et>0?h.push("+".concat(Et)):h.push("".concat(Et))}else if(G>=0)for(var i=0;i<r;i++)h.push("".concat(n[s++]));else{var Dt=r+G;if(Dt>0)for(var i=0;i<Dt;i++)h.push("".concat(n[s++]));else h.push("0");for(h.push(".");Dt++<0;)h.push("0");for(var i=0;i<r-Math.max(Dt-1,0);i++)h.push("".concat(n[s++]))}return h.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Va.prototype,"_bsontype",{value:"Decimal128"});var ys=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t}();Object.defineProperty(ys.prototype,"_bsontype",{value:"Double"});var vs=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(vs.prototype,"_bsontype",{value:"Int32"});var qa=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(qa.prototype,"_bsontype",{value:"MaxKey"});var Wa=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(Wa.prototype,"_bsontype",{value:"MinKey"});var Ww=new RegExp("^[0-9a-fA-F]{24}$"),ur=null,Se=Symbol("id"),zt=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 xt("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=ut.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Se]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Se]=r instanceof ut?r:qi(r);else if(typeof r=="string")if(r.length===12){var n=ut.from(r);if(n.byteLength===12)this[Se]=n;else throw new xt("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Ww.test(r))this[Se]=ut.from(r,"hex");else throw new xt("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new xt("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Se]},set:function(e){this[Se]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=ut.alloc(12);return n.writeUInt32BE(e,0),ur===null&&(ur=gp(5)),n[4]=ur[0],n[5]=ur[1],n[6]=ur[2],n[7]=ur[3],n[8]=ur[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[Se][11]===e[Se][11]&&this[Se].equals(e[Se]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Ha(this.id))return e===ut.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 ut.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=ut.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 xt("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(ut.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(zt.prototype,"generate",{value:gs(function(t){return zt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(zt.prototype,"getInc",{value:gs(function(){return zt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(zt.prototype,"get_inc",{value:gs(function(){return zt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(zt,"get_inc",{value:gs(function(){return zt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(zt.prototype,"_bsontype",{value:"ObjectID"});function Gw(t){return t.split("").sort().join("")}var Vn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Gw(r??""),this.pattern.indexOf("\0")!==-1)throw new vr("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new vr("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 vr("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 xt("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(Vn.prototype,"_bsontype",{value:"BSONRegExp"});var Ga=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(Ga.prototype,"_bsontype",{value:"Symbol"});var zw=Y,bp=function(t){fs(e,t);function e(r,n){var i=this;return i instanceof e?(Y.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:ri(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(Y.fromInt(r,!0))},e.fromNumber=function(r){return new e(Y.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(Y.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=Y.MAX_UNSIGNED_VALUE,e}(zw);function Kw(t){return ri(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var wp=2147483647,_p=-2147483648,Ep=9223372036854776e3,Sp=-9223372036854776e3,Yw={$oid:zt,$binary:br,$uuid:br,$symbol:Ga,$numberInt:vs,$numberDecimal:Va,$numberDouble:ys,$numberLong:Y,$minKey:Wa,$maxKey:qa,$regex:Vn,$regularExpression:Vn,$timestamp:bp};function Ip(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=_p&&t<=wp)return new vs(t);if(t>=Sp&&t<=Ep)return Y.fromNumber(t)}return new ys(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(h){return h.startsWith("$")&&t[h]!=null}),n=0;n<r.length;n++){var i=Yw[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var s=t.$date,o=new Date;return e.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):Y.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&e.relaxed&&o.setTime(s),o}if(t.$code!=null){var c=Object.assign({},t);return t.$scope&&(c.$scope=Ip(t.$scope)),ms.fromExtendedJSON(t)}if(kw(t)||t.$dbPointer){var l=t.$ref?t:t.$dbPointer;if(l instanceof Hn)return l;var p=Object.keys(l).filter(function(h){return h.startsWith("$")}),g=!0;if(p.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(g=!1)}),g)return Hn.fromExtendedJSON(l)}return t}function Jw(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Ze(r,e)}finally{e.seenObjects.pop()}})}function Zl(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Ze(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(A){return A.obj===t});if(r!==-1){var n=e.seenObjects.map(function(A){return A.propertyName}),i=n.slice(0,r).map(function(A){return"".concat(A," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(A){return"".concat(A," -> ")}).join(""),c=n[n.length-1],l=" ".repeat(i.length+s.length/2),p="-".repeat(o.length+(s.length+c.length)/2-1);throw new xt(`Converting circular structure to EJSON:
|
|
33
|
+
`)};Xt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=Ma(r)?r(t[1]):r[t[1]];if(s!=null){var o=t[6],c=t[5],l=t[4],p=s;c==0&&l&&(p=this.indentPartial(s,l,o));var g=this.parse(p,i);return this.renderTokens(g,e,r,p,n)}}};Xt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};Xt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||me.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===me.escape?String(i):n(i)};Xt.prototype.rawValue=function(t){return t[1]};Xt.prototype.getConfigTags=function(t){return un(t)?t:t&&typeof t=="object"?t.tags:void 0};Xt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!un(t))return t.escape};var me={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Hn.templateCache=t},get templateCache(){return Hn.templateCache}},Hn=new Xt;me.clearCache=function(){return Hn.clearCache()};me.parse=function(t,e){return Hn.parse(t,e)};me.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Cb(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Hn.render(t,e,r,n)};me.escape=kb;me.Scanner=ei;me.Context=Xr;me.Writer=Xt;var qe=me,$b="?from=cooee";function Ua(){return!!window.Shopify}function Fb(){if(Ua())return window.Shopify.shop?.split(".")?.[0]}function Hb(t){let e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}function qi(){return window.Shopify?.routes?.root??"/"}function Mn(t){return qi()+t+$b}var Vb=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},qb=class $o{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){if(e=`__cooee_${e}_lock__`,"locks"in navigator&&!this.isInAppBrowser())return navigator.locks.request(e,r);let n=!1,i=0,s=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(x.debug(`Lock retry ${i}`),n=await this.acquire(e,s),!n);)await this.sleep($o.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,s)}}static isInAppBrowser(){let e=navigator.userAgent||"",r=/iPhone|iPad|iPod/i.test(e),n=/(FBAV|FBAN|Instagram)/i.test(e);return r&&n}static async acquire(e,r){let n=Date.now(),i=localStorage.getItem(e),s=i?JSON.parse(i):null;if(s&&n<=s.expiry)return!1;let o={owner:r,expiry:n+$o.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(o)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(x.debug(`${r}: Lock acquired!`),!0):(x.debug(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(e,r){let n=localStorage.getItem(e);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(e),x.debug(`${r}: Lock released`)):x.debug(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}},xt=class Qh{static CURRENT;token;items;total_price;original_total_price;items_subtotal_price;currency;item_count;attributes;cart_level_discount_applications;total_discount;lock=new Vb;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new Qh),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Mt.set(ct.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await ee.get(ct.ID),r=await Mt.get(ct.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){x.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};x.debug("Updating Shopify cart with attributes:",n);let i=Mn("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();x.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.total_discount=e.total_discount,kt.get().currencyCode=this.currency,x.log("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,itemsSubtotalPrice:this.items_subtotal_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return x.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){x.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){x.debug("Not fetching cart");return}x.debug("Fetching cart");let r=Mn("cart.js"),n=await(await fetch(r)).json();this.update(n)}},Wb=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}},Gb=class{enabled;constructor(t){this.enabled=t.enabled}},zb=class extends Gb{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},Kb=class{productQuantity;constructor(t){t??={},this.productQuantity=new zb(t.productQuantity)}},ri=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new ju(t.bg)),t.br&&(this.br=new ca(t.br)),t.shd&&(this.shd=new Sf(t.shd)),t.spc&&(this.spc=new ua(t.spc)),this.trf=new Fu(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Ba[this.t]}get click(){return this.clc}},Ba=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.PRODUCT_RATING=19]="PRODUCT_RATING",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Ba||{}),Zh=class extends ri{constructor(t){super(t)}},ja=class extends ri{src;constructor(t){super(t),this.src=t.src}},ps=class extends ri{typo;constructor(t){super(t);let e=T(T({},t.f),t.typo);t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new ze(e)}get color(){return this.typography.tc}get typography(){return this.typo}},Fo=class extends ps{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},Yb=class extends ri{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},tp=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let r=new Date;t===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),l=Math.floor(s%(1e3*60*60)/(1e3*60)),p=Math.floor(s%(1e3*60)/1e3);e({days:o,hours:c,minutes:l,seconds:p})},1e3);return n}},ep=class extends ps{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new tp(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Jb=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new ie(t.c??{})}get text(){return this.txt}get color(){return this.c}},$a=class extends ps{ph;constructor(t){super(t),this.ph=new Jb(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},rp=class extends $a{constructor(t){t??={},super(t)}},np=class extends $a{},ip=class extends $a{},sp=class extends ja{},ds=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(ds||{}),Xb=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}},$l=class extends ri{gvt;max;cover;anim;embedded;position;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new Xb(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new ua({pl:H.IN_APP_DEFAULT_PADDING,pr:H.IN_APP_DEFAULT_PADDING,pt:H.IN_APP_DEFAULT_PADDING,pb:H.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},Qb=class extends $l{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new Yb(t.cont),this.mob=new $l(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(e=>{e.t===1?this.elems.push(new ja(e)):e.t===2?this.elems.push(new Fo(e)):e.t===3?this.elems.push(new Fo(e)):e.t===100?this.elems.push(new Zh(e)):e.t===51?this.elems.push(new np(e)):e.t===52?this.elems.push(new ip(e)):e.t===61?this.elems.push(new ep(e)):e.t===15||e.t===16?this.elems.push(new rp(e)):e.t===13&&this.elems.push(new sp(e))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},e,r;return this.gvt===1?(e="flex-start",r="flex-start"):this.gvt===2?(e="center",r="flex-start"):this.gvt===3?(e="flex-end",r="flex-start"):this.gvt===4?(e="flex-start",r="center"):this.gvt===6?(e="flex-end",r="center"):this.gvt===7?(e="flex-start",r="flex-end"):this.gvt===8?(e="center",r="flex-end"):this.gvt===9?(e="flex-end",r="flex-end"):(e="center",r="center"),t.alignItems=r,t.justifyContent=e,t.overflow="visible",t}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}},op=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}},Zb=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}},tw=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}},Fl=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new ua(t.spc),t.size&&(this.size=new tw(t.size)),t.bg&&(this.bg=new ju(t.bg)),t.br&&(this.br=new ca(t.br)),t.typo&&(this.typo=new ze(t.typo)),t.lout&&(this.lout=new Zb(t.lout)),t.flex&&(this.flex=new op(t.flex))}},ap=class{sm;lg;constructor(t){t??={},this.sm=new Fl(t.sm),this.lg=new Fl(t.lg)}},ar=class{t;style;hide;when;clc;l;constructor(t,e){e??={},this.t=t,this.style=new ap(e.style),this.hide=e.hide,this.l=e.l,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return Ba[this.t]}},Ne=class extends ar{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text}},Ho=class extends Ne{constructor(t,e){super(t,e??3)}},cp=class extends ar{value;constructor(t){super(6,t),t??={},this.value=t.value}},lp=class extends Ne{showChips;optionsConfig;constructor(t=15,e){super(e,t),e??={},this.showChips=e.showChips??!1,this.optionsConfig=e.optionsConfig??{}}},ew=class extends ar{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new ie(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}},rw=ke(rn()),nw=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new ie(t.color)}},iw=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new ie(t.color)}},up=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new iw(t.navigation),this.pagination=new nw(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},sw=class extends ar{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=Qr.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new up(t.conf),this.allowedTypes=t.allowedTypes}},ow=class extends Ne{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new tp(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Fa=class extends ar{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=Qr.getParsedElement(e);r&&this.elems.push(r)})}},Vo=class extends ar{src;sm;lg;constructor(t,e){super(e??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}},Qr=class hp{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=hp.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new Ne(e);case 3:return new Ho(e);case 6:return new cp(e);case 11:return new aw(e);case 12:return new Ha(e);case 61:return new ow(e);case 4:return new Fa(e);case 1:return new Vo(e);case 13:return new Vo(e,13);case 14:return new Ne(e,14);case 15:case 16:return new lp(e.t,e);case 18:return new Ho(e,18);case 62:return new sw(e);case 19:return new ew(e);default:rw.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}},Ha=class extends ar{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=Qr.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new cp(t.cBox)),this.elems.push(new Vo(t.img,13));let e=new Ne(t.title,14);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);let r=new Ne(t.price);r.text="{{ product.price }}",r.hide=!t.show?.price;let n=new Ne(t.compareAt);n.text="{{ product.compare_price }}",n.hide=!t.show?.price,t.compareAt||(n.style=new ap(r.style),n.style.lg.typo=new ze(lt(T({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new ze(lt(T({},n.style.sm.typo),{td:"line-through"})));let i=new Fa({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Qr.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new lp(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let o=new Ho(t.btn,18);o.hide=!t.show?.btn,this.elems.push(o)}}t.symbol&&(this.symbol=new Ne(t.symbol))}},aw=class extends ar{conf;prod;constructor(t){super(11,t),t??={},this.conf=new cw(t.conf),this.prod=new Ha(t.prod)}},Hl=class extends up{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},cw=class{lg;sm;constructor(t){t??={},this.lg=new Hl(t.lg),this.sm=new Hl(t.sm)}},lw=class extends Fa{constructor(t){super(t)}},pp=class{cont;elems=[];constructor(t){t=t??{},this.cont=new lw(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=Qr.getParsedElement(t);return e&&this.elems.push(e),e}},uw=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Ti.EXCLUSION}isABTesting(){return this.contentType===Ti.ABTESTING}isSingleContent(){return this.contentType===Ti.SINGLE}},dp=class{videoConfig;savingsBarConfig;constructor(t){this.update(t)}update(t){t??={},t.videoConfig&&(this.videoConfig=new Sb(t.videoConfig)),t.savingsBarConfig&&(this.savingsBarConfig=new Af(t.savingsBarConfig))}},xr=class fp extends uw{static SWIPER_ELEMENTS=new Set([11,62]);nudgeID;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=Tr({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=kt.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new pp(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 nn(r)),this.items=e.items?.map(r=>new Ve(r))??[],this.nonMutableItems=e.items?.map(r=>new Ve(r))??[],this.collections=e.collections?.map(r=>new Wb(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 Kb(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 Tf(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new Df(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new mf(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Ve(e.bundleFrom)),e.content&&(this.content=new dp(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===Ce.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===vo.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===vo.PAGE_EMBED}isProgressBar(){return this.objective===Ce.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Ce.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Ce.CART_RECOVERY}isProductPromotion(){return this.objective===Ce.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===Ru.COLLECTION}isBYOB(){return this.objective===Ce.BYOB}isStickyATC(){return this.objective===Ce.STICKY_ATC}isShoppableVideo(){return this.objective===Ce.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===Ce.SAVINGS_BAR}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},s={};if(n){let l=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:l.mID,image:n.variantImage,price:pe(l.price.d),comparePrice:pe(l.price.cmp),quantity:n.quantity},s={quantity:l.quantity}}let o={productCount:xt.getCurrent().item_count},c=qe.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(c=c.replace(new RegExp(H.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new Qb(JSON.parse(c))}calculateDiscountData(e,r){let n=An.sum(e,o=>o.selectedOrFirstVariant.value.price.d),i=An.sum(e,o=>{let c=o.selectedOrFirstVariant.value.price;return c.cmp??c.d}),s={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(s);return}if(ve.BXGY===this.discount.type&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,s.discountPercentage,!0),s.discountAmount=s.actualPrice-An.sum(e,o=>o.selectedOrFirstVariant.value.effectivePrice.value);else if([ve.UNIQUE_FLAT_ITEMS,ve.STATIC,ve.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)s.discountPercentage=this.discount.values[0],s.discountAmount=s.actualPrice*s.discountPercentage/100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===ve.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)s.discountAmount=s.actualPrice-this.discount.values[0],s.discountPercentage=s.discountAmount/s.actualPrice*100,this.updateEffectivePrice(e,s.discountPercentage);else if(this.discount.type===ve.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((c,l)=>l.selectedOrFirstVariant.value.price.d-c.selectedOrFirstVariant.value.price.d);let o=e[e.length-1];o.selectedOrFirstVariant.value.effectivePrice.value=0,s.discountAmount=o.selectedOrFirstVariant.value.price.d,s.discountPercentage=s.discountAmount/s.actualPrice*100}s.discountedPrice=s.actualPrice-s.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(s)}getPrivateAttributesForLineItem(){return se.get().skipItemAttribute?{}:{[H.VIA]:"Cooee",[H.CAMPAIGN_ATTRIBUTE]:this.shortID,[H.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return se.get().skipItemAttribute?[]:[{key:H.VIA,value:"Cooee"},{key:H.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:H.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[ve.UNIQUE_FIXED_ITEMS,ve.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){let e=this.widget?.elems.find(n=>fp.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=window.CooeeSDK.uaParser.getDevice().type==="mobile"?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}getCartMagicVariables(){let e=xt.getCurrent(),r=An.sum(e.items,n=>n.discounts?.reduce((i,s)=>i+(s.amount??0),0)??0);return{productCount:e.item_count,product_count:e.item_count,amount:pe(e.total_price/100),originalAmount:pe(e.original_total_price/100),total_line_items_discount:pe(r/100),total_discount:pe(e.total_discount/100)}}updateEffectivePrice(e,r,n=!1){let i=kt.get().getCurrentItem();e.forEach(s=>{let o=s.selectedOrFirstVariant.value,c=o.price;if(n&&s.mID===i.mID)o.effectivePrice.value=c.d;else{let l=c.d*r/100;o.effectivePrice.value=c.d-l}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:tb(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{r[n]=pe(e[n])}),r}};function hw(t,e){return e={exports:{}},t(e,e.exports),e.exports}var pw=mw,dw=vw,fw=_w,Ae=[],he=[],gw=typeof Uint8Array<"u"?Uint8Array:Array,Gs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ur=0,Vl=Gs.length;ur<Vl;++ur)Ae[ur]=Gs[ur],he[Gs.charCodeAt(ur)]=ur;var ur,Vl;he[45]=62;he[95]=63;function gp(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function mw(t){var e=gp(t),r=e[0],n=e[1];return(r+n)*3/4-n}function yw(t,e,r){return(e+r)*3/4-r}function vw(t){var e,r=gp(t),n=r[0],i=r[1],s=new gw(yw(t,n,i)),o=0,c=i>0?n-4:n,l;for(l=0;l<c;l+=4)e=he[t.charCodeAt(l)]<<18|he[t.charCodeAt(l+1)]<<12|he[t.charCodeAt(l+2)]<<6|he[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=he[t.charCodeAt(l)]<<2|he[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=he[t.charCodeAt(l)]<<10|he[t.charCodeAt(l+1)]<<4|he[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function bw(t){return Ae[t>>18&63]+Ae[t>>12&63]+Ae[t>>6&63]+Ae[t&63]}function ww(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(bw(n));return i.join("")}function _w(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(ww(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],i.push(Ae[e>>2]+Ae[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ae[e>>10]+Ae[e>>4&63]+Ae[e<<2&63]+"=")),i.join("")}var zs={byteLength:pw,toByteArray:dw,fromByteArray:fw},Ew=function(t,e,r,n,i){var s,o,c=i*8-n-1,l=(1<<c)-1,p=l>>1,g=-7,h=r?i-1:0,w=r?-1:1,v=t[e+h];for(h+=w,s=v&(1<<-g)-1,v>>=-g,g+=c;g>0;s=s*256+t[e+h],h+=w,g-=8);for(o=s&(1<<-g)-1,s>>=-g,g+=n;g>0;o=o*256+t[e+h],h+=w,g-=8);if(s===0)s=1-p;else{if(s===l)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-p}return(v?-1:1)*o*Math.pow(2,s-n)},Sw=function(t,e,r,n,i,s){var o,c,l,p=s*8-i-1,g=(1<<p)-1,h=g>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,b=n?1:-1,_=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=g):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+h>=1?e+=w/l:e+=w*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=g?(c=0,o=g):o+h>=1?(c=(e*l-1)*Math.pow(2,i),o=o+h):(c=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+v]=c&255,v+=b,c/=256,i-=8);for(o=o<<i|c,p+=i;p>0;t[r+v]=o&255,v+=b,o/=256,p-=8);t[r+v-b]|=_*128},Lr={read:Ew,write:Sw},fs=hw(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=A,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var a=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(a,u),a.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s(a){if(a>n)throw new RangeError('The value "'+a+'" is invalid for option "size"');var u=new Uint8Array(a);return Object.setPrototypeOf(u,o.prototype),u}function o(a,u,d){if(typeof a=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(a)}return c(a,u,d)}o.poolSize=8192;function c(a,u,d){if(typeof a=="string")return h(a,u);if(ArrayBuffer.isView(a))return v(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(ce(a,ArrayBuffer)||a&&ce(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ce(a,SharedArrayBuffer)||a&&ce(a.buffer,SharedArrayBuffer)))return b(a,u,d);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var E=a.valueOf&&a.valueOf();if(E!=null&&E!==a)return o.from(E,u,d);var D=_(a);if(D)return D;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return o.from(a[Symbol.toPrimitive]("string"),u,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}o.from=function(a,u,d){return c(a,u,d)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function p(a,u,d){return l(a),a<=0?s(a):u!==void 0?typeof d=="string"?s(a).fill(u,d):s(a).fill(u):s(a)}o.alloc=function(a,u,d){return p(a,u,d)};function g(a){return l(a),s(a<0?0:k(a)|0)}o.allocUnsafe=function(a){return g(a)},o.allocUnsafeSlow=function(a){return g(a)};function h(a,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var d=B(a,u)|0,E=s(d),D=E.write(a,u);return D!==d&&(E=E.slice(0,D)),E}function w(a){for(var u=a.length<0?0:k(a.length)|0,d=s(u),E=0;E<u;E+=1)d[E]=a[E]&255;return d}function v(a){if(ce(a,Uint8Array)){var u=new Uint8Array(a);return b(u.buffer,u.byteOffset,u.byteLength)}return w(a)}function b(a,u,d){if(u<0||a.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<u+(d||0))throw new RangeError('"length" is outside of buffer bounds');var E;return u===void 0&&d===void 0?E=new Uint8Array(a):d===void 0?E=new Uint8Array(a,u):E=new Uint8Array(a,u,d),Object.setPrototypeOf(E,o.prototype),E}function _(a){if(o.isBuffer(a)){var u=k(a.length)|0,d=s(u);return d.length===0||a.copy(d,0,0,u),d}if(a.length!==void 0)return typeof a.length!="number"||dn(a.length)?s(0):w(a);if(a.type==="Buffer"&&Array.isArray(a.data))return w(a.data)}function k(a){if(a>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return a|0}function A(a){return+a!=a&&(a=0),o.alloc(+a)}o.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==o.prototype},o.compare=function(a,u){if(ce(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),ce(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(a)||!o.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===u)return 0;for(var d=a.length,E=u.length,D=0,M=Math.min(d,E);D<M;++D)if(a[D]!==u[D]){d=a[D],E=u[D];break}return d<E?-1:E<d?1:0},o.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(a,u){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return o.alloc(0);var d;if(u===void 0)for(u=0,d=0;d<a.length;++d)u+=a[d].length;var E=o.allocUnsafe(u),D=0;for(d=0;d<a.length;++d){var M=a[d];if(ce(M,Uint8Array))D+M.length>E.length?o.from(M).copy(E,D):Uint8Array.prototype.set.call(E,M,D);else if(o.isBuffer(M))M.copy(E,D);else throw new TypeError('"list" argument must be an Array of Buffers');D+=M.length}return E};function B(a,u){if(o.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||ce(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var d=a.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&d===0)return 0;for(var D=!1;;)switch(u){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return pn(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return ui(a).length;default:if(D)return E?-1:pn(a).length;u=(""+u).toLowerCase(),D=!0}}o.byteLength=B;function G(a,u,d){var E=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,u>>>=0,d<=u))return"";for(a||(a="utf8");;)switch(a){case"hex":return Gt(this,u,d);case"utf8":case"utf-8":return Pt(this,u,d);case"ascii":return Wt(this,u,d);case"latin1":case"binary":return mt(this,u,d);case"base64":return pt(this,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return at(this,u,d);default:if(E)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),E=!0}}o.prototype._isBuffer=!0;function j(a,u,d){var E=a[u];a[u]=a[d],a[d]=E}o.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<a;u+=2)j(this,u,u+1);return this},o.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<a;u+=4)j(this,u,u+3),j(this,u+1,u+2);return this},o.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<a;u+=8)j(this,u,u+7),j(this,u+1,u+6),j(this,u+2,u+5),j(this,u+3,u+4);return this},o.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?Pt(this,0,a):G.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(a){if(!o.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:o.compare(this,a)===0},o.prototype.inspect=function(){var a="",u=e.INSPECT_MAX_BYTES;return a=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(a+=" ... "),"<Buffer "+a+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(a,u,d,E,D){if(ce(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),!o.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(u===void 0&&(u=0),d===void 0&&(d=a?a.length:0),E===void 0&&(E=0),D===void 0&&(D=this.length),u<0||d>a.length||E<0||D>this.length)throw new RangeError("out of range index");if(E>=D&&u>=d)return 0;if(E>=D)return-1;if(u>=d)return 1;if(u>>>=0,d>>>=0,E>>>=0,D>>>=0,this===a)return 0;for(var M=D-E,K=d-u,dt=Math.min(M,K),Ot=this.slice(E,D),yt=a.slice(u,d),Ct=0;Ct<dt;++Ct)if(Ot[Ct]!==yt[Ct]){M=Ot[Ct],K=yt[Ct];break}return M<K?-1:K<M?1:0};function Z(a,u,d,E,D){if(a.length===0)return-1;if(typeof d=="string"?(E=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,dn(d)&&(d=D?0:a.length-1),d<0&&(d=a.length+d),d>=a.length){if(D)return-1;d=a.length-1}else if(d<0)if(D)d=0;else return-1;if(typeof u=="string"&&(u=o.from(u,E)),o.isBuffer(u))return u.length===0?-1:St(a,u,d,E,D);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(a,u,d):Uint8Array.prototype.lastIndexOf.call(a,u,d):St(a,[u],d,E,D);throw new TypeError("val must be string, number or Buffer")}function St(a,u,d,E,D){var M=1,K=a.length,dt=u.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(a.length<2||u.length<2)return-1;M=2,K/=2,dt/=2,d/=2}function Ot(fn,gn){return M===1?fn[gn]:fn.readUInt16BE(gn*M)}var yt;if(D){var Ct=-1;for(yt=d;yt<K;yt++)if(Ot(a,yt)===Ot(u,Ct===-1?0:yt-Ct)){if(Ct===-1&&(Ct=yt),yt-Ct+1===dt)return Ct*M}else Ct!==-1&&(yt-=yt-Ct),Ct=-1}else for(d+dt>K&&(d=K-dt),yt=d;yt>=0;yt--){for(var Bt=!0,lr=0;lr<dt;lr++)if(Ot(a,yt+lr)!==Ot(u,lr)){Bt=!1;break}if(Bt)return yt}return-1}o.prototype.includes=function(a,u,d){return this.indexOf(a,u,d)!==-1},o.prototype.indexOf=function(a,u,d){return Z(this,a,u,d,!0)},o.prototype.lastIndexOf=function(a,u,d){return Z(this,a,u,d,!1)};function At(a,u,d,E){d=Number(d)||0;var D=a.length-d;E?(E=Number(E),E>D&&(E=D)):E=D;var M=u.length;E>M/2&&(E=M/2);for(var K=0;K<E;++K){var dt=parseInt(u.substr(K*2,2),16);if(dn(dt))return K;a[d+K]=dt}return K}function q(a,u,d,E){return Pr(pn(u,a.length-d),a,d,E)}function it(a,u,d,E){return Pr(Cs(u),a,d,E)}function tt(a,u,d,E){return Pr(ui(u),a,d,E)}function rt(a,u,d,E){return Pr(Ts(u,a.length-d),a,d,E)}o.prototype.write=function(a,u,d,E){if(u===void 0)E="utf8",d=this.length,u=0;else if(d===void 0&&typeof u=="string")E=u,d=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(d)?(d=d>>>0,E===void 0&&(E="utf8")):(E=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var D=this.length-u;if((d===void 0||d>D)&&(d=D),a.length>0&&(d<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");E||(E="utf8");for(var M=!1;;)switch(E){case"hex":return At(this,a,u,d);case"utf8":case"utf-8":return q(this,a,u,d);case"ascii":case"latin1":case"binary":return it(this,a,u,d);case"base64":return tt(this,a,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rt(this,a,u,d);default:if(M)throw new TypeError("Unknown encoding: "+E);E=(""+E).toLowerCase(),M=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function pt(a,u,d){return u===0&&d===a.length?zs.fromByteArray(a):zs.fromByteArray(a.slice(u,d))}function Pt(a,u,d){d=Math.min(a.length,d);for(var E=[],D=u;D<d;){var M=a[D],K=null,dt=M>239?4:M>223?3:M>191?2:1;if(D+dt<=d){var Ot,yt,Ct,Bt;switch(dt){case 1:M<128&&(K=M);break;case 2:Ot=a[D+1],(Ot&192)===128&&(Bt=(M&31)<<6|Ot&63,Bt>127&&(K=Bt));break;case 3:Ot=a[D+1],yt=a[D+2],(Ot&192)===128&&(yt&192)===128&&(Bt=(M&15)<<12|(Ot&63)<<6|yt&63,Bt>2047&&(Bt<55296||Bt>57343)&&(K=Bt));break;case 4:Ot=a[D+1],yt=a[D+2],Ct=a[D+3],(Ot&192)===128&&(yt&192)===128&&(Ct&192)===128&&(Bt=(M&15)<<18|(Ot&63)<<12|(yt&63)<<6|Ct&63,Bt>65535&&Bt<1114112&&(K=Bt))}}K===null?(K=65533,dt=1):K>65535&&(K-=65536,E.push(K>>>10&1023|55296),K=56320|K&1023),E.push(K),D+=dt}return $t(E)}var Nt=4096;function $t(a){var u=a.length;if(u<=Nt)return String.fromCharCode.apply(String,a);for(var d="",E=0;E<u;)d+=String.fromCharCode.apply(String,a.slice(E,E+=Nt));return d}function Wt(a,u,d){var E="";d=Math.min(a.length,d);for(var D=u;D<d;++D)E+=String.fromCharCode(a[D]&127);return E}function mt(a,u,d){var E="";d=Math.min(a.length,d);for(var D=u;D<d;++D)E+=String.fromCharCode(a[D]);return E}function Gt(a,u,d){var E=a.length;(!u||u<0)&&(u=0),(!d||d<0||d>E)&&(d=E);for(var D="",M=u;M<d;++M)D+=xs[a[M]];return D}function at(a,u,d){for(var E=a.slice(u,d),D="",M=0;M<E.length-1;M+=2)D+=String.fromCharCode(E[M]+E[M+1]*256);return D}o.prototype.slice=function(a,u){var d=this.length;a=~~a,u=u===void 0?d:~~u,a<0?(a+=d,a<0&&(a=0)):a>d&&(a=d),u<0?(u+=d,u<0&&(u=0)):u>d&&(u=d),u<a&&(u=a);var E=this.subarray(a,u);return Object.setPrototypeOf(E,o.prototype),E};function nt(a,u,d){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+u>d)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(a,u,d){a=a>>>0,u=u>>>0,d||nt(a,u,this.length);for(var E=this[a],D=1,M=0;++M<u&&(D*=256);)E+=this[a+M]*D;return E},o.prototype.readUintBE=o.prototype.readUIntBE=function(a,u,d){a=a>>>0,u=u>>>0,d||nt(a,u,this.length);for(var E=this[a+--u],D=1;u>0&&(D*=256);)E+=this[a+--u]*D;return E},o.prototype.readUint8=o.prototype.readUInt8=function(a,u){return a=a>>>0,u||nt(a,1,this.length),this[a]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(a,u){return a=a>>>0,u||nt(a,2,this.length),this[a]|this[a+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(a,u){return a=a>>>0,u||nt(a,2,this.length),this[a]<<8|this[a+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(a,u){return a=a>>>0,u||nt(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(a,u){return a=a>>>0,u||nt(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},o.prototype.readIntLE=function(a,u,d){a=a>>>0,u=u>>>0,d||nt(a,u,this.length);for(var E=this[a],D=1,M=0;++M<u&&(D*=256);)E+=this[a+M]*D;return D*=128,E>=D&&(E-=Math.pow(2,8*u)),E},o.prototype.readIntBE=function(a,u,d){a=a>>>0,u=u>>>0,d||nt(a,u,this.length);for(var E=u,D=1,M=this[a+--E];E>0&&(D*=256);)M+=this[a+--E]*D;return D*=128,M>=D&&(M-=Math.pow(2,8*u)),M},o.prototype.readInt8=function(a,u){return a=a>>>0,u||nt(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},o.prototype.readInt16LE=function(a,u){a=a>>>0,u||nt(a,2,this.length);var d=this[a]|this[a+1]<<8;return d&32768?d|4294901760:d},o.prototype.readInt16BE=function(a,u){a=a>>>0,u||nt(a,2,this.length);var d=this[a+1]|this[a]<<8;return d&32768?d|4294901760:d},o.prototype.readInt32LE=function(a,u){return a=a>>>0,u||nt(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},o.prototype.readInt32BE=function(a,u){return a=a>>>0,u||nt(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},o.prototype.readFloatLE=function(a,u){return a=a>>>0,u||nt(a,4,this.length),Lr.read(this,a,!0,23,4)},o.prototype.readFloatBE=function(a,u){return a=a>>>0,u||nt(a,4,this.length),Lr.read(this,a,!1,23,4)},o.prototype.readDoubleLE=function(a,u){return a=a>>>0,u||nt(a,8,this.length),Lr.read(this,a,!0,52,8)},o.prototype.readDoubleBE=function(a,u){return a=a>>>0,u||nt(a,8,this.length),Lr.read(this,a,!1,52,8)};function Ft(a,u,d,E,D,M){if(!o.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>D||u<M)throw new RangeError('"value" argument is out of bounds');if(d+E>a.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(a,u,d,E){if(a=+a,u=u>>>0,d=d>>>0,!E){var D=Math.pow(2,8*d)-1;Ft(this,a,u,d,D,0)}var M=1,K=0;for(this[u]=a&255;++K<d&&(M*=256);)this[u+K]=a/M&255;return u+d},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(a,u,d,E){if(a=+a,u=u>>>0,d=d>>>0,!E){var D=Math.pow(2,8*d)-1;Ft(this,a,u,d,D,0)}var M=d-1,K=1;for(this[u+M]=a&255;--M>=0&&(K*=256);)this[u+M]=a/K&255;return u+d},o.prototype.writeUint8=o.prototype.writeUInt8=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,1,255,0),this[u]=a&255,u+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,2,65535,0),this[u]=a&255,this[u+1]=a>>>8,u+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,2,65535,0),this[u]=a>>>8,this[u+1]=a&255,u+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,4,4294967295,0),this[u+3]=a>>>24,this[u+2]=a>>>16,this[u+1]=a>>>8,this[u]=a&255,u+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,4,4294967295,0),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4},o.prototype.writeIntLE=function(a,u,d,E){if(a=+a,u=u>>>0,!E){var D=Math.pow(2,8*d-1);Ft(this,a,u,d,D-1,-D)}var M=0,K=1,dt=0;for(this[u]=a&255;++M<d&&(K*=256);)a<0&&dt===0&&this[u+M-1]!==0&&(dt=1),this[u+M]=(a/K>>0)-dt&255;return u+d},o.prototype.writeIntBE=function(a,u,d,E){if(a=+a,u=u>>>0,!E){var D=Math.pow(2,8*d-1);Ft(this,a,u,d,D-1,-D)}var M=d-1,K=1,dt=0;for(this[u+M]=a&255;--M>=0&&(K*=256);)a<0&&dt===0&&this[u+M+1]!==0&&(dt=1),this[u+M]=(a/K>>0)-dt&255;return u+d},o.prototype.writeInt8=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,1,127,-128),a<0&&(a=255+a+1),this[u]=a&255,u+1},o.prototype.writeInt16LE=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,2,32767,-32768),this[u]=a&255,this[u+1]=a>>>8,u+2},o.prototype.writeInt16BE=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,2,32767,-32768),this[u]=a>>>8,this[u+1]=a&255,u+2},o.prototype.writeInt32LE=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,4,2147483647,-2147483648),this[u]=a&255,this[u+1]=a>>>8,this[u+2]=a>>>16,this[u+3]=a>>>24,u+4},o.prototype.writeInt32BE=function(a,u,d){return a=+a,u=u>>>0,d||Ft(this,a,u,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4};function ai(a,u,d,E,D,M){if(d+E>a.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function ci(a,u,d,E,D){return u=+u,d=d>>>0,D||ai(a,u,d,4),Lr.write(a,u,d,E,23,4),d+4}o.prototype.writeFloatLE=function(a,u,d){return ci(this,a,u,!0,d)},o.prototype.writeFloatBE=function(a,u,d){return ci(this,a,u,!1,d)};function ae(a,u,d,E,D){return u=+u,d=d>>>0,D||ai(a,u,d,8),Lr.write(a,u,d,E,52,8),d+8}o.prototype.writeDoubleLE=function(a,u,d){return ae(this,a,u,!0,d)},o.prototype.writeDoubleBE=function(a,u,d){return ae(this,a,u,!1,d)},o.prototype.copy=function(a,u,d,E){if(!o.isBuffer(a))throw new TypeError("argument should be a Buffer");if(d||(d=0),!E&&E!==0&&(E=this.length),u>=a.length&&(u=a.length),u||(u=0),E>0&&E<d&&(E=d),E===d||a.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(d<0||d>=this.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("sourceEnd out of bounds");E>this.length&&(E=this.length),a.length-u<E-d&&(E=a.length-u+d);var D=E-d;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,d,E):Uint8Array.prototype.set.call(a,this.subarray(d,E),u),D},o.prototype.fill=function(a,u,d,E){if(typeof a=="string"){if(typeof u=="string"?(E=u,u=0,d=this.length):typeof d=="string"&&(E=d,d=this.length),E!==void 0&&typeof E!="string")throw new TypeError("encoding must be a string");if(typeof E=="string"&&!o.isEncoding(E))throw new TypeError("Unknown encoding: "+E);if(a.length===1){var D=a.charCodeAt(0);(E==="utf8"&&D<128||E==="latin1")&&(a=D)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(u<0||this.length<u||this.length<d)throw new RangeError("Out of range index");if(d<=u)return this;u=u>>>0,d=d===void 0?this.length:d>>>0,a||(a=0);var M;if(typeof a=="number")for(M=u;M<d;++M)this[M]=a;else{var K=o.isBuffer(a)?a:o.from(a,E),dt=K.length;if(dt===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(M=0;M<d-u;++M)this[M+u]=K[M%dt]}return this};var li=/[^+/0-9A-Za-z-_]/g;function Is(a){if(a=a.split("=")[0],a=a.trim().replace(li,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function pn(a,u){u=u||1/0;for(var d,E=a.length,D=null,M=[],K=0;K<E;++K){if(d=a.charCodeAt(K),d>55295&&d<57344){if(!D){if(d>56319){(u-=3)>-1&&M.push(239,191,189);continue}else if(K+1===E){(u-=3)>-1&&M.push(239,191,189);continue}D=d;continue}if(d<56320){(u-=3)>-1&&M.push(239,191,189),D=d;continue}d=(D-55296<<10|d-56320)+65536}else D&&(u-=3)>-1&&M.push(239,191,189);if(D=null,d<128){if((u-=1)<0)break;M.push(d)}else if(d<2048){if((u-=2)<0)break;M.push(d>>6|192,d&63|128)}else if(d<65536){if((u-=3)<0)break;M.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((u-=4)<0)break;M.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return M}function Cs(a){for(var u=[],d=0;d<a.length;++d)u.push(a.charCodeAt(d)&255);return u}function Ts(a,u){for(var d,E,D,M=[],K=0;K<a.length&&!((u-=2)<0);++K)d=a.charCodeAt(K),E=d>>8,D=d%256,M.push(D),M.push(E);return M}function ui(a){return zs.toByteArray(Is(a))}function Pr(a,u,d,E){for(var D=0;D<E&&!(D+d>=u.length||D>=a.length);++D)u[D+d]=a[D];return D}function ce(a,u){return a instanceof u||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===u.name}function dn(a){return a!==a}var xs=function(){for(var a="0123456789abcdef",u=new Array(256),d=0;d<16;++d)for(var E=d*16,D=0;D<16;++D)u[E+D]=a[d]+a[D];return u}()}),ht=fs.Buffer;fs.SlowBuffer;fs.INSPECT_MAX_BYTES;fs.kMaxLength;var qo=function(t,e){return qo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},qo(t,e)};function gs(t,e){qo(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var br=function(t){gs(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),Dt=function(t){gs(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 wi(t){return t&&t.Math==Math&&t}function mp(){return wi(typeof globalThis=="object"&&globalThis)||wi(typeof window=="object"&&window)||wi(typeof self=="object"&&self)||wi(typeof global=="object"&&global)||Function("return this")()}function Iw(){var t=mp();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Cw=function(t){var e=Iw()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(e);for(var r=ht.alloc(t),n=0;n<t;++n)r[n]=Math.floor(Math.random()*256);return r},Tw=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(ht.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(ht.alloc(e))}:Cw}},yp=Tw();function xw(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Va(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Dw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Aw(t){return ni(t)&&Object.prototype.toString.call(t)==="[object Date]"}function ni(t){return typeof t=="object"&&t!==null}function ms(t,e){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function Wi(t){if(ArrayBuffer.isView(t))return ht.from(t.buffer,t.byteOffset,t.byteLength);if(xw(t))return ht.from(t);throw new Dt("Must use either Buffer or TypedArray")}var Nw=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,vp=function(t){return typeof t=="string"&&Nw.test(t)},Wo=function(t){if(!vp(t))throw new Dt('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 ht.from(e,"hex")},ql=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")},gE=Math.pow(2,63)-1,mE=-Math.pow(2,63),Ow=Math.pow(2,53),kw=-Math.pow(2,53),bp=4,wr=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 Dt("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=ht.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=ht.from(e,"binary"):Array.isArray(e)?this.buffer=ht.from(e):this.buffer=Wi(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Dt("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Dt("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 Dt("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=ht.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=ht.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Wi(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 Wl(this.buffer.slice(0,this.position));throw new br('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=ht.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=ht.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=Wo(e.$uuid)),!n)throw new Dt("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===bp?new Wl(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(wr.prototype,"_bsontype",{value:"Binary"});var Ks=16,Wl=function(t){gs(e,t);function e(r){var n=this,i,s;if(r==null)i=e.generate();else if(r instanceof e)i=ht.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===Ks)i=Wi(r);else if(typeof r=="string")i=Wo(r);else throw new Dt("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,bp)||this,n.__id=s,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=ql(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=ql(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 wr(this.id,wr.SUBTYPE_UUID)},e.generate=function(){var r=yp(Ks);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ht.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?vp(r):Va(r)?r.length!==Ks?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=Wo(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}(wr),ys=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(ys.prototype,"_bsontype",{value:"Code"});function Pw(t){return ni(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var Vn=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var s=e.split(".");s.length===2&&(n=s.shift(),e=s.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(Vn.prototype,"_bsontype",{value:"DBRef"});var ue=void 0;try{ue=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 Gl=65536,Rw=1<<24,$r=Gl*Gl,wp=$r*$r,zl=wp/2,Kl={},Yl={},Y=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,s;return r?(e>>>=0,(s=0<=e&&e<256)&&(i=Yl[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(Yl[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=Kl[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(Kl[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=wp)return t.MAX_UNSIGNED_VALUE}else{if(e<=-zl)return t.MIN_VALUE;if(e+1>=zl)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%$r|0,e/$r|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var s=t.fromNumber(Math.pow(n,8)),o=t.ZERO,c=0;c<e.length;c+=8){var l=Math.min(8,e.length-c),p=parseInt(e.substring(c,c+l),n);if(l<8){var g=t.fromNumber(Math.pow(n,l));o=o.mul(g).add(t.fromNumber(p))}else o=o.mul(s),o=o.add(t.fromNumber(p))}return o.unsigned=r,o},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return ni(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,s=this.low&65535,o=e.high>>>16,c=e.high&65535,l=e.low>>>16,p=e.low&65535,g=0,h=0,w=0,v=0;return v+=s+p,w+=v>>>16,v&=65535,w+=i+l,h+=w>>>16,w&=65535,h+=n+c,g+=h>>>16,h&=65535,g+=r+o,g&=65535,t.fromBits(w<<16|v,g<<16|h,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(ue){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?ue.div_u:ue.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,ue.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;s=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(n)/Math.LN2),l=c<=48?1:Math.pow(2,c-48),p=t.fromNumber(n),g=p.mul(e);g.isNegative()||g.gt(i);)n-=l,p=t.fromNumber(n,this.unsigned),g=p.mul(e);p.isZero()&&(p=t.ONE),s=s.add(p),i=i.sub(g)}return s},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),ue){var r=(this.unsigned?ue.rem_u:ue.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,ue.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)),ue){var r=ue.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,ue.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,s=this.low>>>16,o=this.low&65535,c=e.high>>>16,l=e.high&65535,p=e.low>>>16,g=e.low&65535,h=0,w=0,v=0,b=0;return b+=o*g,v+=b>>>16,b&=65535,v+=s*g,w+=v>>>16,v&=65535,v+=o*p,w+=v>>>16,v&=65535,w+=i*g,h+=w>>>16,w&=65535,w+=s*p,h+=w>>>16,w&=65535,w+=o*l,h+=w>>>16,w&=65535,h+=n*g+i*p+s*l+o*c,h&=65535,t.fromBits(v<<16|b,h<<16|w,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)*$r+(this.low>>>0):this.high*$r+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=t.fromNumber(Math.pow(e,6),this.unsigned),o=this,c="";;){var l=o.div(s),p=o.sub(l.mul(s)).toInt()>>>0,g=p.toString(e);if(o=l,o.isZero())return g+c;for(;g.length<6;)g="0"+g;c=""+g+c}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(Rw),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(Y.prototype,"__isLong__",{value:!0});Object.defineProperty(Y.prototype,"_bsontype",{value:"Long"});var Lw=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Mw=/^(\+|-)?(Infinity|inf)$/i,Uw=/^(\+|-)?NaN$/i,yn=6111,Ys=-6176,Jl=6176,Bw=34,Js=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Xl=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ql=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),jw=/^([-+])?(\d+)?$/,$w=31,Zl=16383,Fw=30,Hw=31;function tu(t){return!isNaN(parseInt(t,10))}function Vw(t){var e=Y.fromNumber(1e9),r=Y.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 Y(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function qw(t,e){if(!t&&!e)return{high:Y.fromNumber(0),low:Y.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new Y(t.getLowBits(),0),i=e.shiftRightUnsigned(32),s=new Y(e.getLowBits(),0),o=r.multiply(i),c=r.multiply(s),l=n.multiply(i),p=n.multiply(s);return o=o.add(c.shiftRightUnsigned(32)),c=new Y(c.getLowBits(),0).add(l).add(p.shiftRightUnsigned(32)),o=o.add(c.shiftRightUnsigned(32)),p=c.shiftLeft(32).add(new Y(p.getLowBits(),0)),{high:o,low:p}}function Ww(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,s=e.low>>>0;if(i<s)return!0}return!1}function Mr(t,e){throw new Dt('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var qa=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Va(e)){if(e.byteLength!==16)throw new Dt("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Dt("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,s=0,o=0,c=0,l=0,p=0,g=[0],h=0,w=0,v=0,b=0,_=0,k=0,A=new Y(0,0),B=new Y(0,0),G=0,j=0;if(e.length>=7e3)throw new Dt(""+e+" not a valid Decimal128 string");var Z=e.match(Lw),St=e.match(Mw),At=e.match(Uw);if(!Z&&!St&&!At||e.length===0)throw new Dt(""+e+" not a valid Decimal128 string");if(Z){var q=Z[2],it=Z[4],tt=Z[5],rt=Z[6];it&&rt===void 0&&Mr(e,"missing exponent power"),it&&q===void 0&&Mr(e,"missing exponent base"),it===void 0&&(tt||rt)&&Mr(e,"missing e before exponent")}if((e[j]==="+"||e[j]==="-")&&(r=e[j++]==="-"),!tu(e[j])&&e[j]!=="."){if(e[j]==="i"||e[j]==="I")return new t(ht.from(r?Xl:Ql));if(e[j]==="N")return new t(ht.from(Js))}for(;tu(e[j])||e[j]===".";){if(e[j]==="."){n&&Mr(e,"contains multiple periods"),n=!0,j=j+1;continue}h<34&&(e[j]!=="0"||i)&&(i||(p=o),i=!0,g[w++]=parseInt(e[j],10),h=h+1),i&&(c=c+1),n&&(l=l+1),o=o+1,j=j+1}if(n&&!o)throw new Dt(""+e+" not a valid Decimal128 string");if(e[j]==="e"||e[j]==="E"){var pt=e.substr(++j).match(jw);if(!pt||!pt[2])return new t(ht.from(Js));_=parseInt(pt[0],10),j=j+pt[0].length}if(e[j])return new t(ht.from(Js));if(v=0,!h)v=0,b=0,g[0]=0,c=1,h=1,s=0;else if(b=h-1,s=c,s!==1)for(;g[p+s-1]===0;)s=s-1;for(_<=l&&l-_>16384?_=Ys:_=_-l;_>yn;){if(b=b+1,b-v>Bw){var Pt=g.join("");if(Pt.match(/^0+$/)){_=yn;break}Mr(e,"overflow")}_=_-1}for(;_<Ys||h<c;){if(b===0&&s<h){_=Ys,s=0;break}if(h<c?c=c-1:b=b-1,_<yn)_=_+1;else{var Pt=g.join("");if(Pt.match(/^0+$/)){_=yn;break}Mr(e,"overflow")}}if(b-v+1<s){var Nt=o;n&&(p=p+1,Nt=Nt+1),r&&(p=p+1,Nt=Nt+1);var $t=parseInt(e[p+b+1],10),Wt=0;if($t>=5&&(Wt=1,$t===5)){for(Wt=g[b]%2===1?1:0,k=p+b+2;k<Nt;k++)if(parseInt(e[k],10)){Wt=1;break}}if(Wt){for(var mt=b;mt>=0;mt--)if(++g[mt]>9&&(g[mt]=0,mt===0))if(_<yn)_=_+1,g[mt]=1;else return new t(ht.from(r?Xl:Ql))}}if(A=Y.fromNumber(0),B=Y.fromNumber(0),s===0)A=Y.fromNumber(0),B=Y.fromNumber(0);else if(b-v<17){var mt=v;for(B=Y.fromNumber(g[mt++]),A=new Y(0,0);mt<=b;mt++)B=B.multiply(Y.fromNumber(10)),B=B.add(Y.fromNumber(g[mt]))}else{var mt=v;for(A=Y.fromNumber(g[mt++]);mt<=b-17;mt++)A=A.multiply(Y.fromNumber(10)),A=A.add(Y.fromNumber(g[mt]));for(B=Y.fromNumber(g[mt++]);mt<=b;mt++)B=B.multiply(Y.fromNumber(10)),B=B.add(Y.fromNumber(g[mt]))}var Gt=qw(A,Y.fromString("100000000000000000"));Gt.low=Gt.low.add(B),Ww(Gt.low,B)&&(Gt.high=Gt.high.add(Y.fromNumber(1))),G=_+Jl;var at={low:Y.fromNumber(0),high:Y.fromNumber(0)};Gt.high.shiftRightUnsigned(49).and(Y.fromNumber(1)).equals(Y.fromNumber(1))?(at.high=at.high.or(Y.fromNumber(3).shiftLeft(61)),at.high=at.high.or(Y.fromNumber(G).and(Y.fromNumber(16383).shiftLeft(47))),at.high=at.high.or(Gt.high.and(Y.fromNumber(0x7fffffffffff)))):(at.high=at.high.or(Y.fromNumber(G&16383).shiftLeft(49)),at.high=at.high.or(Gt.high.and(Y.fromNumber(562949953421311)))),at.low=Gt.low,r&&(at.high=at.high.or(Y.fromString("9223372036854775808")));var nt=ht.alloc(16);return j=0,nt[j++]=at.low.low&255,nt[j++]=at.low.low>>8&255,nt[j++]=at.low.low>>16&255,nt[j++]=at.low.low>>24&255,nt[j++]=at.low.high&255,nt[j++]=at.low.high>>8&255,nt[j++]=at.low.high>>16&255,nt[j++]=at.low.high>>24&255,nt[j++]=at.high.low&255,nt[j++]=at.high.low>>8&255,nt[j++]=at.high.low>>16&255,nt[j++]=at.high.low>>24&255,nt[j++]=at.high.high&255,nt[j++]=at.high.high>>8&255,nt[j++]=at.high.high>>16&255,nt[j++]=at.high.high>>24&255,new t(nt)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,c,l={parts:[0,0,0,0]},p,g,h=[];s=0;var w=this.bytes,v=w[s++]|w[s++]<<8|w[s++]<<16|w[s++]<<24,b=w[s++]|w[s++]<<8|w[s++]<<16|w[s++]<<24,_=w[s++]|w[s++]<<8|w[s++]<<16|w[s++]<<24,k=w[s++]|w[s++]<<8|w[s++]<<16|w[s++]<<24;s=0;var A={low:new Y(v,b),high:new Y(_,k)};A.high.lessThan(Y.ZERO)&&h.push("-");var B=k>>26&$w;if(B>>3===3){if(B===Fw)return h.join("")+"Infinity";if(B===Hw)return"NaN";e=k>>15&Zl,c=8+(k>>14&1)}else c=k>>14&7,e=k>>17&Zl;var G=e-Jl;if(l.parts[0]=(k&16383)+((c&15)<<14),l.parts[1]=_,l.parts[2]=b,l.parts[3]=v,l.parts[0]===0&&l.parts[1]===0&&l.parts[2]===0&&l.parts[3]===0)o=!0;else for(g=3;g>=0;g--){var j=0,Z=Vw(l);if(l=Z.quotient,j=Z.rem.low,!!j)for(p=8;p>=0;p--)n[g*9+p]=j%10,j=Math.floor(j/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var St=r-1+G;if(St>=34||St<=-7||G>0){if(r>34)return h.push("".concat(0)),G>0?h.push("E+".concat(G)):G<0&&h.push("E".concat(G)),h.join("");h.push("".concat(n[s++])),r=r-1,r&&h.push(".");for(var i=0;i<r;i++)h.push("".concat(n[s++]));h.push("E"),St>0?h.push("+".concat(St)):h.push("".concat(St))}else if(G>=0)for(var i=0;i<r;i++)h.push("".concat(n[s++]));else{var At=r+G;if(At>0)for(var i=0;i<At;i++)h.push("".concat(n[s++]));else h.push("0");for(h.push(".");At++<0;)h.push("0");for(var i=0;i<r-Math.max(At-1,0);i++)h.push("".concat(n[s++]))}return h.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(qa.prototype,"_bsontype",{value:"Decimal128"});var vs=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(vs.prototype,"_bsontype",{value:"Double"});var bs=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(bs.prototype,"_bsontype",{value:"Int32"});var Wa=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(Wa.prototype,"_bsontype",{value:"MaxKey"});var Ga=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(Ga.prototype,"_bsontype",{value:"MinKey"});var Gw=new RegExp("^[0-9a-fA-F]{24}$"),hr=null,Ie=Symbol("id"),Kt=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 Dt("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=ht.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Ie]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Ie]=r instanceof ht?r:Wi(r);else if(typeof r=="string")if(r.length===12){var n=ht.from(r);if(n.byteLength===12)this[Ie]=n;else throw new Dt("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Gw.test(r))this[Ie]=ht.from(r,"hex");else throw new Dt("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Dt("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[Ie]},set:function(e){this[Ie]=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=ht.alloc(12);return n.writeUInt32BE(e,0),hr===null&&(hr=yp(5)),n[4]=hr[0],n[5]=hr[1],n[6]=hr[2],n[7]=hr[3],n[8]=hr[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[Ie][11]===e[Ie][11]&&this[Ie].equals(e[Ie]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Va(this.id))return e===ht.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 ht.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=ht.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 Dt("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(ht.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(Kt.prototype,"generate",{value:ms(function(t){return Kt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Kt.prototype,"getInc",{value:ms(function(){return Kt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Kt.prototype,"get_inc",{value:ms(function(){return Kt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Kt,"get_inc",{value:ms(function(){return Kt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Kt.prototype,"_bsontype",{value:"ObjectID"});function zw(t){return t.split("").sort().join("")}var qn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=zw(r??""),this.pattern.indexOf("\0")!==-1)throw new br("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new br("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 br("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 Dt("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(qn.prototype,"_bsontype",{value:"BSONRegExp"});var za=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(za.prototype,"_bsontype",{value:"Symbol"});var Kw=Y,_p=function(t){gs(e,t);function e(r,n){var i=this;return i instanceof e?(Y.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:ni(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(Y.fromInt(r,!0))},e.fromNumber=function(r){return new e(Y.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(Y.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=Y.MAX_UNSIGNED_VALUE,e}(Kw);function Yw(t){return ni(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var Ep=2147483647,Sp=-2147483648,Ip=9223372036854776e3,Cp=-9223372036854776e3,Jw={$oid:Kt,$binary:wr,$uuid:wr,$symbol:za,$numberInt:bs,$numberDecimal:qa,$numberDouble:vs,$numberLong:Y,$minKey:Ga,$maxKey:Wa,$regex:qn,$regularExpression:qn,$timestamp:_p};function Tp(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Sp&&t<=Ep)return new bs(t);if(t>=Cp&&t<=Ip)return Y.fromNumber(t)}return new vs(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(h){return h.startsWith("$")&&t[h]!=null}),n=0;n<r.length;n++){var i=Jw[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var s=t.$date,o=new Date;return e.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):Y.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&e.relaxed&&o.setTime(s),o}if(t.$code!=null){var c=Object.assign({},t);return t.$scope&&(c.$scope=Tp(t.$scope)),ys.fromExtendedJSON(t)}if(Pw(t)||t.$dbPointer){var l=t.$ref?t:t.$dbPointer;if(l instanceof Vn)return l;var p=Object.keys(l).filter(function(h){return h.startsWith("$")}),g=!0;if(p.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(g=!1)}),g)return Vn.fromExtendedJSON(l)}return t}function Xw(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return tr(r,e)}finally{e.seenObjects.pop()}})}function eu(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function tr(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(A){return A.obj===t});if(r!==-1){var n=e.seenObjects.map(function(A){return A.propertyName}),i=n.slice(0,r).map(function(A){return"".concat(A," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(A){return"".concat(A," -> ")}).join(""),c=n[n.length-1],l=" ".repeat(i.length+s.length/2),p="-".repeat(o.length+(s.length+c.length)/2-1);throw new Dt(`Converting circular structure to EJSON:
|
|
34
34
|
`+" ".concat(i).concat(s).concat(o).concat(c,`
|
|
35
|
-
`)+" ".concat(l,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Jw(t,e);if(t===void 0)return null;if(t instanceof Date||Dw(t)){var g=t.getTime(),h=g>-1&&g<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:Zl(t)}:e.relaxed&&h?{$date:Zl(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var w=t>=_p&&t<=wp,v=t>=Sp&&t<=Ep;if(w)return{$numberInt:t.toString()};if(v)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||xw(t)){var b=t.flags;if(b===void 0){var _=t.toString().match(/[gimuy]*$/);_&&(b=_[0])}var k=new Vn(t.source,b);return k.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Qw(t,e):t}var Xw={Binary:function(t){return new br(t.value(),t.sub_type)},Code:function(t){return new ms(t.code,t.scope)},DBRef:function(t){return new Hn(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Va(t.bytes)},Double:function(t){return new ys(t.value)},Int32:function(t){return new vs(t.value)},Long:function(t){return Y.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 qa},MinKey:function(){return new Wa},ObjectID:function(t){return new zt(t)},ObjectId:function(t){return new zt(t)},BSONRegExp:function(t){return new Vn(t.pattern,t.options)},Symbol:function(t){return new Ga(t.value)},Timestamp:function(t){return bp.fromBits(t.low,t.high)}};function Qw(t,e){if(t==null||typeof t!="object")throw new vr("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var s=Ze(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):n[i]=s}finally{e.seenObjects.pop()}}return n}else if(Kw(t)){var o=t;if(typeof o.toExtendedJSON!="function"){var c=Xw[t._bsontype];if(!c)throw new xt("Unrecognized or invalid _bsontype: "+t._bsontype);o=c(o)}return r==="Code"&&o.scope?o=new ms(o.code,Ze(o.scope,e)):r==="DBRef"&&o.oid&&(o=new Hn(Ze(o.collection,e),Ze(o.oid,e),Ze(o.db,e),Ze(o.fields,e))),o.toExtendedJSON(e)}else throw new vr("_bsontype must be a string, but was: "+typeof r)}var tu;(function(t){function e(s,o){var c=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof c.relaxed=="boolean"&&(c.strict=!c.relaxed),typeof c.strict=="boolean"&&(c.relaxed=!c.strict),JSON.parse(s,function(l,p){if(l.indexOf("\0")!==-1)throw new vr("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(l)));return Ip(p,c)})}t.parse=e;function r(s,o,c,l){c!=null&&typeof c=="object"&&(l=c,c=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(l=o,o=void 0,c=0);var p=Object.assign({relaxed:!0,legacy:!1},l,{seenObjects:[{propertyName:"(root)",obj:null}]}),g=Ze(s,p);return JSON.stringify(g,o,c)}t.stringify=r;function n(s,o){return o=o||{},JSON.parse(r(s,o))}t.serialize=n;function i(s,o){return o=o||{},e(JSON.stringify(s),o)}t.deserialize=i})(tu||(tu={}));var eu,ru=fp();ru.Map?eu=ru.Map:eu=function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],s=n[1];this._keys.push(i),this._values[i]={v:s,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var mE=Y.fromNumber(Nw),yE=Y.fromNumber(Ow),Js=new Uint8Array(8),vE=new DataView(Js.buffer,Js.byteOffset,Js.byteLength),Zw=1024*1024*17,bE=ut.alloc(Zw),za=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}},Bt=class{constructor(t,e={},r,n){this.name=t,this.properties=e,this.id=n?new zt(n):new zt,this.occurred=new Date,r&&(this.trigger=new za(r)),this.newEvent=!n}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale},be=class{static SWIPER_CSS="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";static injectScriptURL(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}static injectRawScript(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}static injectRawCSS(t,e=document.head){if(!t)return;let r=document.createElement("style");r.textContent=t,e.appendChild(r)}static injectSwiperCSS(t=document.head){this.injectStylesheet(this.SWIPER_CSS,t)}static injectStylesheet(t,e=document.head){if(!t)return;let r=document.createElement("link");r.rel="stylesheet",r.href=t,t===this.SWIPER_CSS&&(r.crossOrigin="anonymous",r.onload=n=>{let i=n.currentTarget?.sheet?.cssRules;if(i){for(let s of i)if(s.type==CSSRule.FONT_FACE_RULE){let o=t.split("/"),c=o.slice(0,o.length-1).join("/"),l=s.cssText;l=l.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${c}/$4")`);let p=document.createElement("style");p.appendChild(document.createTextNode(l)),document.head.appendChild(p)}}}),e.appendChild(r)}static async loadSwiperScript(){window.CooeeSDK.Swiper||(window.CooeeSDK.Swiper=(await import("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs")).Swiper)}},t_="2.0.4",Wo=500,nu="user-agent",Xr="",iu="?",Wi="function",er="undefined",Qr="object",Go="string",Xt="browser",Me="cpu",xe="device",ve="engine",de="os",Fr="result",L="name",N="type",R="vendor",U="version",Qt="architecture",qn="major",P="model",Nn="console",tt="mobile",yt="tablet",Rt="smarttv",Ce="wearable",wi="xr",On="embedded",mn="inapp",Ka="brands",fr="formFactors",Ya="fullVersionList",Hr="platform",Ja="platformVersion",bs="bitness",ar="sec-ch-ua",e_=ar+"-full-version-list",r_=ar+"-arch",n_=ar+"-"+bs,i_=ar+"-form-factors",s_=ar+"-"+tt,o_=ar+"-"+P,Cp=ar+"-"+Hr,a_=Cp+"-version",Tp=[Ka,Ya,tt,P,Hr,Ja,Qt,fr,bs],_i="Amazon",Mr="Apple",su="ASUS",ou="BlackBerry",hr="Google",au="Huawei",Xs="Lenovo",cu="Honor",Ei="LG",Qs="Microsoft",Zs="Motorola",to="Nvidia",lu="OnePlus",eo="OPPO",yn="Samsung",uu="Sharp",vn="Sony",ro="Xiaomi",no="Zebra",hu="Chrome",pu="Chromium",Xe="Chromecast",Oi="Edge",bn="Firefox",wn="Opera",io="Facebook",du="Sogou",Ur="Mobile ",_n=" Browser",zo="Windows",c_=typeof window!==er,Zt=c_&&window.navigator?window.navigator:void 0,tr=Zt&&Zt.userAgentData?Zt.userAgentData:void 0,l_=function(t,e){var r={},n=e;if(!Gi(e)){n={};for(var i in e)for(var s in e[i])n[s]=e[i][s].concat(n[s]?n[s]:[])}for(var o in t)r[o]=n[o]&&n[o].length%2===0?n[o].concat(t[o]):t[o];return r},ws=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},Ko=function(t,e){if(typeof t===Qr&&t.length>0){for(var r in t)if(Be(e)==Be(t[r]))return!0;return!1}return ln(t)?Be(e)==Be(t):!1},Gi=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Gi(t[r]):!1)},ln=function(t){return typeof t===Go},so=function(t){if(t){for(var e=[],r=Zr(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=zi(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=zi(r[n]);return e}},Be=function(t){return ln(t)?t.toLowerCase():t},oo=function(t){return ln(t)?Zr(/[^\d\.]/g,t).split(".")[0]:void 0},je=function(t){for(var e in t){var r=t[e];typeof r==Qr&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},Zr=function(t,e){return ln(e)?e.replace(t,Xr):e},En=function(t){return Zr(/\\?\"/g,t)},zi=function(t,e){if(ln(t))return t=Zr(/^\s\s*/,t),typeof e===er?t:t.substring(0,Wo)},ao=function(t,e){if(!(!t||!e))for(var r=0,n,i,s,o,c,l;r<e.length&&!c;){var p=e[r],g=e[r+1];for(n=i=0;n<p.length&&!c&&p[n];)if(c=p[n++].exec(t),c)for(s=0;s<g.length;s++)l=c[++i],o=g[s],typeof o===Qr&&o.length>0?o.length===2?typeof o[1]==Wi?this[o[0]]=o[1].call(this,l):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===Wi&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=l?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=l?o[1].call(this,l,o[2]):void 0:o.length==3?this[o[0]]=l?l.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=l?o[3].call(this,l.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=l?o[3].apply(this,[l.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=l||void 0;r+=2}},Te=function(t,e){for(var r in e)if(typeof e[r]===Qr&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(Ko(e[r][n],t))return r===iu?void 0:r}else if(Ko(e[r],t))return r===iu?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},fu={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:""},gu={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},u_={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"},mu={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[U,[L,Ur+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[U,[L,Oi+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[U,[L,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[L,U],[/opios[\/ ]+([\w\.]+)/i],[U,[L,wn+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[U,[L,wn+" GX"]],[/\bopr\/([\w\.]+)/i],[U,[L,wn]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[U,[L,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[U,[L,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[L,U],[/quark(?:pc)?\/([-\w\.]+)/i],[U,[L,"Quark"]],[/\bddg\/([\w\.]+)/i],[U,[L,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[U,[L,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[U,[L,"WeChat"]],[/konqueror\/([\w\.]+)/i],[U,[L,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[U,[L,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[U,[L,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[U,[L,"Smart "+Xs+_n]],[/(avast|avg)\/([\w\.]+)/i],[[L,/(.+)/,"$1 Secure"+_n],U],[/\bfocus\/([\w\.]+)/i],[U,[L,bn+" Focus"]],[/\bopt\/([\w\.]+)/i],[U,[L,wn+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[U,[L,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[U,[L,"Dolphin"]],[/coast\/([\w\.]+)/i],[U,[L,wn+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[U,[L,"MIUI"+_n]],[/fxios\/([\w\.-]+)/i],[U,[L,Ur+bn]],[/\bqihoobrowser\/?([\w\.]*)/i],[U,[L,"360"]],[/\b(qq)\/([\w\.]+)/i],[[L,/(.+)/,"$1Browser"],U],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[L,/(.+)/,"$1"+_n],U],[/samsungbrowser\/([\w\.]+)/i],[U,[L,yn+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[U,[L,du+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[L,du+" Mobile"],U],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[L,U],[/(lbbrowser|rekonq)/i],[L],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[U,L],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[L,io],U,[N,mn]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[L,U,[N,mn]],[/\bgsa\/([\w\.]+) .*safari\//i],[U,[L,"GSA"],[N,mn]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[U,[L,"TikTok"],[N,mn]],[/\[(linkedin)app\]/i],[L,[N,mn]],[/(chromium)[\/ ]([-\w\.]+)/i],[L,U],[/headlesschrome(?:\/([\w\.]+)| )/i],[U,[L,hu+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[U,[L,Oi+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[L,hu+" WebView"],U],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[U,[L,"Android"+_n]],[/chrome\/([\w\.]+) mobile/i],[U,[L,Ur+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[L,U],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[U,[L,Ur+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[L,Ur+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[U,L],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[L,[U,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[L,U],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[L,Ur+bn],U],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[L,"Netscape"],U],[/(wolvic|librewolf)\/([\w\.]+)/i],[L,U],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[U,[L,bn+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[L,[U,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[L,[U,/[^\d\.]+./,Xr]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Qt,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Qt,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Qt,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Qt,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Qt,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Qt,/ower/,Xr,Be]],[/ sun4\w[;\)]/i],[[Qt,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Qt,Be]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[P,[R,yn],[N,yt]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[P,[R,yn],[N,tt]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[P,[R,Mr],[N,tt]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[P,[R,Mr],[N,yt]],[/(macintosh);/i],[P,[R,Mr]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[P,[R,uu],[N,tt]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[P,[R,cu],[N,yt]],[/honor([-\w ]+)[;\)]/i],[P,[R,cu],[N,tt]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[P,[R,au],[N,yt]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[P,[R,au],[N,tt]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[P,/_/g," "],[R,ro],[N,yt]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[P,/_/g," "],[R,ro],[N,tt]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[P,[R,lu],[N,tt]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[P,[R,eo],[N,tt]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[P,[R,Te,{OnePlus:["203","304","403","404","413","415"],"*":eo}],[N,yt]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[P,[R,"BLU"],[N,tt]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[P,[R,"Vivo"],[N,tt]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[P,[R,"Realme"],[N,tt]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[P,[R,Xs],[N,yt]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[P,[R,Xs],[N,tt]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[P,[R,Zs],[N,tt]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[P,[R,Zs],[N,yt]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[P,[R,Ei],[N,yt]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[P,[R,Ei],[N,tt]],[/(nokia) (t[12][01])/i],[R,P,[N,yt]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[P,/_/g," "],[N,tt],[R,"Nokia"]],[/(pixel (c|tablet))\b/i],[P,[R,hr],[N,yt]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[P,[R,hr],[N,tt]],[/(google) (pixelbook( go)?)/i],[R,P],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[P,[R,vn],[N,tt]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[P,"Xperia Tablet"],[R,vn],[N,yt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[P,[R,_i],[N,yt]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[P,/(.+)/g,"Fire Phone $1"],[R,_i],[N,tt]],[/(playbook);[-\w\),; ]+(rim)/i],[P,R,[N,yt]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[P,[R,ou],[N,tt]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[P,[R,su],[N,yt]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[P,[R,su],[N,tt]],[/(nexus 9)/i],[P,[R,"HTC"],[N,yt]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[R,[P,/_/g," "],[N,tt]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[P,[R,"TCL"],[N,yt]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[P,[R,"TCL"],[N,tt]],[/(itel) ((\w+))/i],[[R,Be],P,[N,Te,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[P,[R,"Acer"],[N,yt]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[P,[R,"Meizu"],[N,tt]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[P,[R,"Ulefone"],[N,tt]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[P,[R,"Energizer"],[N,tt]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[P,[R,"Cat"],[N,tt]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[P,[R,"Smartfren"],[N,tt]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[P,[R,"Nothing"],[N,tt]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[P,[R,"Archos"],[N,yt]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[P,[R,"Archos"],[N,tt]],[/; (n159v)/i],[P,[R,"HMD"],[N,tt]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[R,P,[N,yt]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[R,P,[N,tt]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[R,P,[N,yt]],[/(surface duo)/i],[P,[R,Qs],[N,yt]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[P,[R,"Fairphone"],[N,tt]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[P,[R,to],[N,yt]],[/(sprint) (\w+)/i],[R,P,[N,tt]],[/(kin\.[onetw]{3})/i],[[P,/\./g," "],[R,Qs],[N,tt]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[P,[R,no],[N,yt]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[P,[R,no],[N,tt]],[/smart-tv.+(samsung)/i],[R,[N,Rt]],[/hbbtv.+maple;(\d+)/i],[[P,/^/,"SmartTV"],[R,yn],[N,Rt]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[R,P,[N,Rt]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[R,Ei],[N,Rt]],[/(apple) ?tv/i],[R,[P,Mr+" TV"],[N,Rt]],[/crkey.*devicetype\/chromecast/i],[[P,Xe+" Third Generation"],[R,hr],[N,Rt]],[/crkey.*devicetype\/([^/]*)/i],[[P,/^/,"Chromecast "],[R,hr],[N,Rt]],[/fuchsia.*crkey/i],[[P,Xe+" Nest Hub"],[R,hr],[N,Rt]],[/crkey/i],[[P,Xe],[R,hr],[N,Rt]],[/(portaltv)/i],[P,[R,io],[N,Rt]],[/droid.+aft(\w+)( bui|\))/i],[P,[R,_i],[N,Rt]],[/(shield \w+ tv)/i],[P,[R,to],[N,Rt]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[P,[R,uu],[N,Rt]],[/(bravia[\w ]+)( bui|\))/i],[P,[R,vn],[N,Rt]],[/(mi(tv|box)-?\w+) bui/i],[P,[R,ro],[N,Rt]],[/Hbbtv.*(technisat) (.*);/i],[R,P,[N,Rt]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[R,/.+\/(\w+)/,"$1",Te,{LG:"lge"}],[P,zi],[N,Rt]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[P,[N,Rt]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[N,Rt]],[/(playstation \w+)/i],[P,[R,vn],[N,Nn]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[P,[R,Qs],[N,Nn]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[R,P,[N,Nn]],[/droid.+; (shield)( bui|\))/i],[P,[R,to],[N,Nn]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[P,[R,yn],[N,Ce]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[R,P,[N,Ce]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[P,[R,eo],[N,Ce]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[P,[R,Mr],[N,Ce]],[/(opwwe\d{3})/i],[P,[R,lu],[N,Ce]],[/(moto 360)/i],[P,[R,Zs],[N,Ce]],[/(smartwatch 3)/i],[P,[R,vn],[N,Ce]],[/(g watch r)/i],[P,[R,Ei],[N,Ce]],[/droid.+; (wt63?0{2,3})\)/i],[P,[R,no],[N,Ce]],[/droid.+; (glass) \d/i],[P,[R,hr],[N,wi]],[/(pico) (4|neo3(?: link|pro)?)/i],[R,P,[N,wi]],[/(quest( \d| pro)?s?).+vr/i],[P,[R,io],[N,wi]],[/mobile vr; rv.+firefox/i],[[N,wi]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[R,[N,On]],[/(aeobc)\b/i],[P,[R,_i],[N,On]],[/(homepod).+mac os/i],[P,[R,Mr],[N,On]],[/windows iot/i],[[N,On]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[P,[N,Te,{mobile:"Mobile",xr:"VR","*":yt}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[N,yt]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[N,tt]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[P,[R,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[U,[L,Oi+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[L,U],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[U,[L,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[L,U],[/ladybird\//i],[[L,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[U,L]],os:[[/(windows nt) (6\.[23]); arm/i],[[L,/N/,"R"],[U,Te,fu]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[L,U],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[U,/(;|\))/g,"",Te,fu],[L,zo]],[/(windows ce)\/?([\d\.]*)/i],[L,U],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[U,/_/g,"."],[L,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[L,"macOS"],[U,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[U,[L,Xe+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[U,[L,Xe+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[U,[L,Xe+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[U,[L,Xe+" Linux"]],[/crkey\/([\d\.]+)/i],[U,[L,Xe]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[U,L],[/(ubuntu) ([\w\.]+) like android/i],[[L,/(.+)/,"$1 Touch"],U],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[L,U],[/\(bb(10);/i],[U,[L,ou]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[U,[L,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[U,[L,bn+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[U,[L,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[U,Te,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[L,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[U,[L,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[L,"Chrome OS"],U],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[L,U],[/(sunos) ?([\d\.]*)/i],[[L,"Solaris"],U],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[L,U]]},Si=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return je.call(t.init,[[Xt,[L,U,qn,N]],[Me,[Qt]],[xe,[N,P,R]],[ve,[L,U]],[de,[L,U]]]),je.call(t.isIgnore,[[Xt,[U,qn]],[ve,[U]],[de,[U]]]),je.call(t.isIgnoreRgx,[[Xt,/ ?browser$/i],[de,/ ?os$/i]]),je.call(t.toString,[[Xt,[L,U]],[Me,[Qt]],[xe,[R,P]],[ve,[L,U]],[de,[L,U]]]),t}(),h_=function(t,e){var r=Si.init[e],n=Si.isIgnore[e]||0,i=Si.isIgnoreRgx[e]||0,s=Si.toString[e]||0;function o(){je.call(this,r)}return o.prototype.getItem=function(){return t},o.prototype.withClientHints=function(){return tr?tr.getHighEntropyValues(Tp).then(function(c){return t.setCH(new xp(c,!1)).parseCH().get()}):t.parseCH().get()},o.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=Fr&&(o.prototype.is=function(c){var l=!1;for(var p in this)if(this.hasOwnProperty(p)&&!Ko(n,p)&&Be(i?Zr(i,this[p]):this[p])==Be(i?Zr(i,c):c)){if(l=!0,c!=er)break}else if(c==er&&l){l=!l;break}return l},o.prototype.toString=function(){var c=Xr;for(var l in s)typeof this[s[l]]!==er&&(c+=(c?" ":Xr)+this[s[l]]);return c||er}),tr||(o.prototype.then=function(c){var l=this,p=function(){for(var h in l)l.hasOwnProperty(h)&&(this[h]=l[h])};p.prototype={is:o.prototype.is,toString:o.prototype.toString};var g=new p;return c(g),g}),new o};function xp(t,e){if(t=t||{},je.call(this,Tp),e)je.call(this,[[Ka,so(t[ar])],[Ya,so(t[e_])],[tt,/\?1/.test(t[s_])],[P,En(t[o_])],[Hr,En(t[Cp])],[Ja,En(t[a_])],[Qt,En(t[r_])],[fr,so(t[i_])],[bs,En(t[n_])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==er&&(this[r]=t[r])}function yu(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,s){return this.data[i]=s,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Zt&&Zt.userAgent==this.ua)switch(this.itemType){case Xt:Zt.brave&&typeof Zt.brave.isBrave==Wi&&this.set(L,"Brave");break;case xe:!this.get(N)&&tr&&tr[tt]&&this.set(N,tt),this.get(P)=="Macintosh"&&Zt&&typeof Zt.standalone!==er&&Zt.maxTouchPoints&&Zt.maxTouchPoints>2&&this.set(P,"iPad").set(N,yt);break;case de:!this.get(L)&&tr&&tr[Hr]&&this.set(L,tr[Hr]);break;case Fr:var i=this.data,s=function(o){return i[o].getItem().detectFeature().get()};this.set(Xt,s(Xt)).set(Me,s(Me)).set(xe,s(xe)).set(ve,s(ve)).set(de,s(de))}return this},this.parseUA=function(){return this.itemType!=Fr&&ao.call(this.data,this.ua,this.rgxMap),this.itemType==Xt&&this.set(qn,oo(this.get(U))),this},this.parseCH=function(){var i=this.uaCH,s=this.rgxMap;switch(this.itemType){case Xt:case ve:var o=i[Ya]||i[Ka],c;if(o)for(var l in o){var p=o[l].brand||o[l],g=o[l].version;this.itemType==Xt&&!/not.a.brand/i.test(p)&&(!c||/Chrom/.test(c)&&p!=pu||c==Oi&&/WebView2/.test(p))&&(p=Te(p,u_),c=this.get(L),c&&!/Chrom/.test(c)&&/Chrom/.test(p)||this.set(L,p).set(U,g).set(qn,oo(g)),c=p),this.itemType==ve&&p==pu&&this.set(U,g)}break;case Me:var h=i[Qt];h&&(h&&i[bs]=="64"&&(h+="64"),ao.call(this.data,h+";",s));break;case xe:if(i[tt]&&this.set(N,tt),i[P]&&(this.set(P,i[P]),!this.get(N)||!this.get(R))){var w={};ao.call(w,"droid 9; "+i[P]+")",s),!this.get(N)&&w.type&&this.set(N,w.type),!this.get(R)&&w.vendor&&this.set(R,w.vendor)}if(i[fr]){var v;if(typeof i[fr]!="string")for(var b=0;!v&&b<i[fr].length;)v=Te(i[fr][b++],gu);else v=Te(i[fr],gu);this.set(N,v)}break;case de:var _=i[Hr];if(_){var k=i[Ja];_==zo&&(k=parseInt(oo(k),10)>=13?"11":"10"),this.set(L,_).set(U,k)}this.get(L)==zo&&i[P]=="Xbox"&&this.set(L,"Xbox").set(U,void 0);break;case Fr:var A=this.data,B=function(G){return A[G].getItem().setCH(i).parseCH().get()};this.set(Xt,B(Xt)).set(Me,B(Me)).set(xe,B(xe)).set(ve,B(ve)).set(de,B(de))}return this},je.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",h_(this,t)]]),this}function ze(t,e,r){if(typeof t===Qr?(Gi(t,!0)?(typeof e===Qr&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===Go&&!Gi(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Wi){var n={};r.forEach(function(l,p){n[p]=l}),r=n}if(!(this instanceof ze))return new ze(t,e,r).getResult();var i=typeof t===Go?t:r&&r[nu]?r[nu]:Zt&&Zt.userAgent?Zt.userAgent:Xr,s=new xp(r,!0),o=e?l_(mu,e):mu,c=function(l){return l==Fr?function(){return new yu(l,i,o,s).set("ua",i).set(Xt,this.getBrowser()).set(Me,this.getCPU()).set(xe,this.getDevice()).set(ve,this.getEngine()).set(de,this.getOS()).get()}:function(){return new yu(l,i,o[l],s).parseUA().get()}};return je.call(this,[["getBrowser",c(Xt)],["getCPU",c(Me)],["getDevice",c(xe)],["getEngine",c(ve)],["getOS",c(de)],["getResult",c(Fr)],["getUA",function(){return i}],["setUA",function(l){return ln(l)&&(i=l.length>Wo?zi(l,Wo):l),this}]]).setUA(i),this}ze.VERSION=t_;ze.BROWSER=ws([L,U,qn,N]);ze.CPU=ws([Qt]);ze.DEVICE=ws([P,R,N,Nn,tt,Rt,yt,Ce,On]);ze.ENGINE=ze.OS=ws([L,U]);var lt=class{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}};function St(t){return typeof t=="function"}function Dp(t){let e=t(r=>{Error.call(r),r.stack=new Error().stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var co=Dp(t=>function(e){t(this),this.message=e?`${e.length} errors occurred during unsubscription:
|
|
35
|
+
`)+" ".concat(l,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Xw(t,e);if(t===void 0)return null;if(t instanceof Date||Aw(t)){var g=t.getTime(),h=g>-1&&g<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:eu(t)}:e.relaxed&&h?{$date:eu(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var w=t>=Sp&&t<=Ep,v=t>=Cp&&t<=Ip;if(w)return{$numberInt:t.toString()};if(v)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Dw(t)){var b=t.flags;if(b===void 0){var _=t.toString().match(/[gimuy]*$/);_&&(b=_[0])}var k=new qn(t.source,b);return k.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Zw(t,e):t}var Qw={Binary:function(t){return new wr(t.value(),t.sub_type)},Code:function(t){return new ys(t.code,t.scope)},DBRef:function(t){return new Vn(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new qa(t.bytes)},Double:function(t){return new vs(t.value)},Int32:function(t){return new bs(t.value)},Long:function(t){return Y.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 Wa},MinKey:function(){return new Ga},ObjectID:function(t){return new Kt(t)},ObjectId:function(t){return new Kt(t)},BSONRegExp:function(t){return new qn(t.pattern,t.options)},Symbol:function(t){return new za(t.value)},Timestamp:function(t){return _p.fromBits(t.low,t.high)}};function Zw(t,e){if(t==null||typeof t!="object")throw new br("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var s=tr(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):n[i]=s}finally{e.seenObjects.pop()}}return n}else if(Yw(t)){var o=t;if(typeof o.toExtendedJSON!="function"){var c=Qw[t._bsontype];if(!c)throw new Dt("Unrecognized or invalid _bsontype: "+t._bsontype);o=c(o)}return r==="Code"&&o.scope?o=new ys(o.code,tr(o.scope,e)):r==="DBRef"&&o.oid&&(o=new Vn(tr(o.collection,e),tr(o.oid,e),tr(o.db,e),tr(o.fields,e))),o.toExtendedJSON(e)}else throw new br("_bsontype must be a string, but was: "+typeof r)}var ru;(function(t){function e(s,o){var c=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof c.relaxed=="boolean"&&(c.strict=!c.relaxed),typeof c.strict=="boolean"&&(c.relaxed=!c.strict),JSON.parse(s,function(l,p){if(l.indexOf("\0")!==-1)throw new br("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(l)));return Tp(p,c)})}t.parse=e;function r(s,o,c,l){c!=null&&typeof c=="object"&&(l=c,c=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(l=o,o=void 0,c=0);var p=Object.assign({relaxed:!0,legacy:!1},l,{seenObjects:[{propertyName:"(root)",obj:null}]}),g=tr(s,p);return JSON.stringify(g,o,c)}t.stringify=r;function n(s,o){return o=o||{},JSON.parse(r(s,o))}t.serialize=n;function i(s,o){return o=o||{},e(JSON.stringify(s),o)}t.deserialize=i})(ru||(ru={}));var nu,iu=mp();iu.Map?nu=iu.Map:nu=function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],s=n[1];this._keys.push(i),this._values[i]={v:s,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var yE=Y.fromNumber(Ow),vE=Y.fromNumber(kw),Xs=new Uint8Array(8),bE=new DataView(Xs.buffer,Xs.byteOffset,Xs.byteLength),t_=1024*1024*17,wE=ht.alloc(t_),Ka=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}},jt=class{constructor(t,e={},r,n){this.name=t,this.properties=e,this.id=n?new Kt(n):new Kt,this.occurred=new Date,r&&(this.trigger=new Ka(r)),this.newEvent=!n}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale},we=class{static SWIPER_CSS="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css";static injectScriptURL(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}static injectRawScript(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}static injectRawCSS(t,e=document.head){if(!t)return;let r=document.createElement("style");r.textContent=t,e.appendChild(r)}static injectSwiperCSS(t=document.head){this.injectStylesheet(this.SWIPER_CSS,t)}static injectStylesheet(t,e=document.head){if(!t)return;let r=document.createElement("link");r.rel="stylesheet",r.href=t,t===this.SWIPER_CSS&&(r.crossOrigin="anonymous",r.onload=n=>{let i=n.currentTarget?.sheet?.cssRules;if(i){for(let s of i)if(s.type==CSSRule.FONT_FACE_RULE){let o=t.split("/"),c=o.slice(0,o.length-1).join("/"),l=s.cssText;l=l.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${c}/$4")`);let p=document.createElement("style");p.appendChild(document.createTextNode(l)),document.head.appendChild(p)}}}),e.appendChild(r)}static async loadSwiperScript(){window.CooeeSDK.Swiper||(window.CooeeSDK.Swiper=(await import("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs")).Swiper)}},e_="2.0.4",Go=500,su="user-agent",Zr="",ou="?",Gi="function",rr="undefined",tn="object",zo="string",Qt="browser",Ue="cpu",De="device",be="engine",fe="os",Hr="result",L="name",N="type",R="vendor",U="version",Zt="architecture",Wn="major",P="model",kn="console",et="mobile",vt="tablet",Lt="smarttv",Te="wearable",_i="xr",Pn="embedded",vn="inapp",Ya="brands",gr="formFactors",Ja="fullVersionList",Vr="platform",Xa="platformVersion",ws="bitness",cr="sec-ch-ua",r_=cr+"-full-version-list",n_=cr+"-arch",i_=cr+"-"+ws,s_=cr+"-form-factors",o_=cr+"-"+et,a_=cr+"-"+P,xp=cr+"-"+Vr,c_=xp+"-version",Dp=[Ya,Ja,et,P,Vr,Xa,Zt,gr,ws],Ei="Amazon",Ur="Apple",au="ASUS",cu="BlackBerry",pr="Google",lu="Huawei",Qs="Lenovo",uu="Honor",Si="LG",Zs="Microsoft",to="Motorola",eo="Nvidia",hu="OnePlus",ro="OPPO",bn="Samsung",pu="Sharp",wn="Sony",no="Xiaomi",io="Zebra",du="Chrome",fu="Chromium",Qe="Chromecast",ki="Edge",_n="Firefox",En="Opera",so="Facebook",gu="Sogou",Br="Mobile ",Sn=" Browser",Ko="Windows",l_=typeof window!==rr,te=l_&&window.navigator?window.navigator:void 0,er=te&&te.userAgentData?te.userAgentData:void 0,u_=function(t,e){var r={},n=e;if(!zi(e)){n={};for(var i in e)for(var s in e[i])n[s]=e[i][s].concat(n[s]?n[s]:[])}for(var o in t)r[o]=n[o]&&n[o].length%2===0?n[o].concat(t[o]):t[o];return r},_s=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},Yo=function(t,e){if(typeof t===tn&&t.length>0){for(var r in t)if(je(e)==je(t[r]))return!0;return!1}return hn(t)?je(e)==je(t):!1},zi=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?zi(t[r]):!1)},hn=function(t){return typeof t===zo},oo=function(t){if(t){for(var e=[],r=en(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Ki(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Ki(r[n]);return e}},je=function(t){return hn(t)?t.toLowerCase():t},ao=function(t){return hn(t)?en(/[^\d\.]/g,t).split(".")[0]:void 0},$e=function(t){for(var e in t){var r=t[e];typeof r==tn&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},en=function(t,e){return hn(e)?e.replace(t,Zr):e},In=function(t){return en(/\\?\"/g,t)},Ki=function(t,e){if(hn(t))return t=en(/^\s\s*/,t),typeof e===rr?t:t.substring(0,Go)},co=function(t,e){if(!(!t||!e))for(var r=0,n,i,s,o,c,l;r<e.length&&!c;){var p=e[r],g=e[r+1];for(n=i=0;n<p.length&&!c&&p[n];)if(c=p[n++].exec(t),c)for(s=0;s<g.length;s++)l=c[++i],o=g[s],typeof o===tn&&o.length>0?o.length===2?typeof o[1]==Gi?this[o[0]]=o[1].call(this,l):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===Gi&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=l?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=l?o[1].call(this,l,o[2]):void 0:o.length==3?this[o[0]]=l?l.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=l?o[3].call(this,l.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=l?o[3].apply(this,[l.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=l||void 0;r+=2}},xe=function(t,e){for(var r in e)if(typeof e[r]===tn&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(Yo(e[r][n],t))return r===ou?void 0:r}else if(Yo(e[r],t))return r===ou?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},mu={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:""},yu={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},h_={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"},vu={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[U,[L,Br+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[U,[L,ki+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[U,[L,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[L,U],[/opios[\/ ]+([\w\.]+)/i],[U,[L,En+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[U,[L,En+" GX"]],[/\bopr\/([\w\.]+)/i],[U,[L,En]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[U,[L,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[U,[L,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[L,U],[/quark(?:pc)?\/([-\w\.]+)/i],[U,[L,"Quark"]],[/\bddg\/([\w\.]+)/i],[U,[L,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[U,[L,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[U,[L,"WeChat"]],[/konqueror\/([\w\.]+)/i],[U,[L,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[U,[L,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[U,[L,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[U,[L,"Smart "+Qs+Sn]],[/(avast|avg)\/([\w\.]+)/i],[[L,/(.+)/,"$1 Secure"+Sn],U],[/\bfocus\/([\w\.]+)/i],[U,[L,_n+" Focus"]],[/\bopt\/([\w\.]+)/i],[U,[L,En+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[U,[L,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[U,[L,"Dolphin"]],[/coast\/([\w\.]+)/i],[U,[L,En+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[U,[L,"MIUI"+Sn]],[/fxios\/([\w\.-]+)/i],[U,[L,Br+_n]],[/\bqihoobrowser\/?([\w\.]*)/i],[U,[L,"360"]],[/\b(qq)\/([\w\.]+)/i],[[L,/(.+)/,"$1Browser"],U],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[L,/(.+)/,"$1"+Sn],U],[/samsungbrowser\/([\w\.]+)/i],[U,[L,bn+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[U,[L,gu+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[L,gu+" Mobile"],U],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[L,U],[/(lbbrowser|rekonq)/i],[L],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[U,L],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[L,so],U,[N,vn]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[L,U,[N,vn]],[/\bgsa\/([\w\.]+) .*safari\//i],[U,[L,"GSA"],[N,vn]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[U,[L,"TikTok"],[N,vn]],[/\[(linkedin)app\]/i],[L,[N,vn]],[/(chromium)[\/ ]([-\w\.]+)/i],[L,U],[/headlesschrome(?:\/([\w\.]+)| )/i],[U,[L,du+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[U,[L,ki+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[L,du+" WebView"],U],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[U,[L,"Android"+Sn]],[/chrome\/([\w\.]+) mobile/i],[U,[L,Br+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[L,U],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[U,[L,Br+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[L,Br+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[U,L],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[L,[U,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[L,U],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[L,Br+_n],U],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[L,"Netscape"],U],[/(wolvic|librewolf)\/([\w\.]+)/i],[L,U],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[U,[L,_n+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[L,[U,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[L,[U,/[^\d\.]+./,Zr]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Zt,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Zt,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Zt,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Zt,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Zt,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Zt,/ower/,Zr,je]],[/ sun4\w[;\)]/i],[[Zt,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Zt,je]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[P,[R,bn],[N,vt]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[P,[R,bn],[N,et]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[P,[R,Ur],[N,et]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[P,[R,Ur],[N,vt]],[/(macintosh);/i],[P,[R,Ur]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[P,[R,pu],[N,et]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[P,[R,uu],[N,vt]],[/honor([-\w ]+)[;\)]/i],[P,[R,uu],[N,et]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[P,[R,lu],[N,vt]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[P,[R,lu],[N,et]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[P,/_/g," "],[R,no],[N,vt]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[P,/_/g," "],[R,no],[N,et]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[P,[R,hu],[N,et]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[P,[R,ro],[N,et]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[P,[R,xe,{OnePlus:["203","304","403","404","413","415"],"*":ro}],[N,vt]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[P,[R,"BLU"],[N,et]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[P,[R,"Vivo"],[N,et]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[P,[R,"Realme"],[N,et]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[P,[R,Qs],[N,vt]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[P,[R,Qs],[N,et]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[P,[R,to],[N,et]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[P,[R,to],[N,vt]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[P,[R,Si],[N,vt]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[P,[R,Si],[N,et]],[/(nokia) (t[12][01])/i],[R,P,[N,vt]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[P,/_/g," "],[N,et],[R,"Nokia"]],[/(pixel (c|tablet))\b/i],[P,[R,pr],[N,vt]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[P,[R,pr],[N,et]],[/(google) (pixelbook( go)?)/i],[R,P],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[P,[R,wn],[N,et]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[P,"Xperia Tablet"],[R,wn],[N,vt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[P,[R,Ei],[N,vt]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[P,/(.+)/g,"Fire Phone $1"],[R,Ei],[N,et]],[/(playbook);[-\w\),; ]+(rim)/i],[P,R,[N,vt]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[P,[R,cu],[N,et]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[P,[R,au],[N,vt]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[P,[R,au],[N,et]],[/(nexus 9)/i],[P,[R,"HTC"],[N,vt]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[R,[P,/_/g," "],[N,et]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[P,[R,"TCL"],[N,vt]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[P,[R,"TCL"],[N,et]],[/(itel) ((\w+))/i],[[R,je],P,[N,xe,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[P,[R,"Acer"],[N,vt]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[P,[R,"Meizu"],[N,et]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[P,[R,"Ulefone"],[N,et]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[P,[R,"Energizer"],[N,et]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[P,[R,"Cat"],[N,et]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[P,[R,"Smartfren"],[N,et]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[P,[R,"Nothing"],[N,et]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[P,[R,"Archos"],[N,vt]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[P,[R,"Archos"],[N,et]],[/; (n159v)/i],[P,[R,"HMD"],[N,et]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[R,P,[N,vt]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[R,P,[N,et]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[R,P,[N,vt]],[/(surface duo)/i],[P,[R,Zs],[N,vt]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[P,[R,"Fairphone"],[N,et]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[P,[R,eo],[N,vt]],[/(sprint) (\w+)/i],[R,P,[N,et]],[/(kin\.[onetw]{3})/i],[[P,/\./g," "],[R,Zs],[N,et]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[P,[R,io],[N,vt]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[P,[R,io],[N,et]],[/smart-tv.+(samsung)/i],[R,[N,Lt]],[/hbbtv.+maple;(\d+)/i],[[P,/^/,"SmartTV"],[R,bn],[N,Lt]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[R,P,[N,Lt]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[R,Si],[N,Lt]],[/(apple) ?tv/i],[R,[P,Ur+" TV"],[N,Lt]],[/crkey.*devicetype\/chromecast/i],[[P,Qe+" Third Generation"],[R,pr],[N,Lt]],[/crkey.*devicetype\/([^/]*)/i],[[P,/^/,"Chromecast "],[R,pr],[N,Lt]],[/fuchsia.*crkey/i],[[P,Qe+" Nest Hub"],[R,pr],[N,Lt]],[/crkey/i],[[P,Qe],[R,pr],[N,Lt]],[/(portaltv)/i],[P,[R,so],[N,Lt]],[/droid.+aft(\w+)( bui|\))/i],[P,[R,Ei],[N,Lt]],[/(shield \w+ tv)/i],[P,[R,eo],[N,Lt]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[P,[R,pu],[N,Lt]],[/(bravia[\w ]+)( bui|\))/i],[P,[R,wn],[N,Lt]],[/(mi(tv|box)-?\w+) bui/i],[P,[R,no],[N,Lt]],[/Hbbtv.*(technisat) (.*);/i],[R,P,[N,Lt]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[R,/.+\/(\w+)/,"$1",xe,{LG:"lge"}],[P,Ki],[N,Lt]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[P,[N,Lt]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[N,Lt]],[/(playstation \w+)/i],[P,[R,wn],[N,kn]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[P,[R,Zs],[N,kn]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[R,P,[N,kn]],[/droid.+; (shield)( bui|\))/i],[P,[R,eo],[N,kn]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[P,[R,bn],[N,Te]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[R,P,[N,Te]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[P,[R,ro],[N,Te]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[P,[R,Ur],[N,Te]],[/(opwwe\d{3})/i],[P,[R,hu],[N,Te]],[/(moto 360)/i],[P,[R,to],[N,Te]],[/(smartwatch 3)/i],[P,[R,wn],[N,Te]],[/(g watch r)/i],[P,[R,Si],[N,Te]],[/droid.+; (wt63?0{2,3})\)/i],[P,[R,io],[N,Te]],[/droid.+; (glass) \d/i],[P,[R,pr],[N,_i]],[/(pico) (4|neo3(?: link|pro)?)/i],[R,P,[N,_i]],[/(quest( \d| pro)?s?).+vr/i],[P,[R,so],[N,_i]],[/mobile vr; rv.+firefox/i],[[N,_i]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[R,[N,Pn]],[/(aeobc)\b/i],[P,[R,Ei],[N,Pn]],[/(homepod).+mac os/i],[P,[R,Ur],[N,Pn]],[/windows iot/i],[[N,Pn]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[P,[N,xe,{mobile:"Mobile",xr:"VR","*":vt}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[N,vt]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[N,et]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[P,[R,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[U,[L,ki+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[L,U],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[U,[L,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[L,U],[/ladybird\//i],[[L,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[U,L]],os:[[/(windows nt) (6\.[23]); arm/i],[[L,/N/,"R"],[U,xe,mu]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[L,U],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[U,/(;|\))/g,"",xe,mu],[L,Ko]],[/(windows ce)\/?([\d\.]*)/i],[L,U],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[U,/_/g,"."],[L,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[L,"macOS"],[U,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[U,[L,Qe+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[U,[L,Qe+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[U,[L,Qe+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[U,[L,Qe+" Linux"]],[/crkey\/([\d\.]+)/i],[U,[L,Qe]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[U,L],[/(ubuntu) ([\w\.]+) like android/i],[[L,/(.+)/,"$1 Touch"],U],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[L,U],[/\(bb(10);/i],[U,[L,cu]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[U,[L,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[U,[L,_n+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[U,[L,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[U,xe,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[L,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[U,[L,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[L,"Chrome OS"],U],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[L,U],[/(sunos) ?([\d\.]*)/i],[[L,"Solaris"],U],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[L,U]]},Ii=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return $e.call(t.init,[[Qt,[L,U,Wn,N]],[Ue,[Zt]],[De,[N,P,R]],[be,[L,U]],[fe,[L,U]]]),$e.call(t.isIgnore,[[Qt,[U,Wn]],[be,[U]],[fe,[U]]]),$e.call(t.isIgnoreRgx,[[Qt,/ ?browser$/i],[fe,/ ?os$/i]]),$e.call(t.toString,[[Qt,[L,U]],[Ue,[Zt]],[De,[R,P]],[be,[L,U]],[fe,[L,U]]]),t}(),p_=function(t,e){var r=Ii.init[e],n=Ii.isIgnore[e]||0,i=Ii.isIgnoreRgx[e]||0,s=Ii.toString[e]||0;function o(){$e.call(this,r)}return o.prototype.getItem=function(){return t},o.prototype.withClientHints=function(){return er?er.getHighEntropyValues(Dp).then(function(c){return t.setCH(new Ap(c,!1)).parseCH().get()}):t.parseCH().get()},o.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=Hr&&(o.prototype.is=function(c){var l=!1;for(var p in this)if(this.hasOwnProperty(p)&&!Yo(n,p)&&je(i?en(i,this[p]):this[p])==je(i?en(i,c):c)){if(l=!0,c!=rr)break}else if(c==rr&&l){l=!l;break}return l},o.prototype.toString=function(){var c=Zr;for(var l in s)typeof this[s[l]]!==rr&&(c+=(c?" ":Zr)+this[s[l]]);return c||rr}),er||(o.prototype.then=function(c){var l=this,p=function(){for(var h in l)l.hasOwnProperty(h)&&(this[h]=l[h])};p.prototype={is:o.prototype.is,toString:o.prototype.toString};var g=new p;return c(g),g}),new o};function Ap(t,e){if(t=t||{},$e.call(this,Dp),e)$e.call(this,[[Ya,oo(t[cr])],[Ja,oo(t[r_])],[et,/\?1/.test(t[o_])],[P,In(t[a_])],[Vr,In(t[xp])],[Xa,In(t[c_])],[Zt,In(t[n_])],[gr,oo(t[s_])],[ws,In(t[i_])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==rr&&(this[r]=t[r])}function bu(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,s){return this.data[i]=s,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(te&&te.userAgent==this.ua)switch(this.itemType){case Qt:te.brave&&typeof te.brave.isBrave==Gi&&this.set(L,"Brave");break;case De:!this.get(N)&&er&&er[et]&&this.set(N,et),this.get(P)=="Macintosh"&&te&&typeof te.standalone!==rr&&te.maxTouchPoints&&te.maxTouchPoints>2&&this.set(P,"iPad").set(N,vt);break;case fe:!this.get(L)&&er&&er[Vr]&&this.set(L,er[Vr]);break;case Hr:var i=this.data,s=function(o){return i[o].getItem().detectFeature().get()};this.set(Qt,s(Qt)).set(Ue,s(Ue)).set(De,s(De)).set(be,s(be)).set(fe,s(fe))}return this},this.parseUA=function(){return this.itemType!=Hr&&co.call(this.data,this.ua,this.rgxMap),this.itemType==Qt&&this.set(Wn,ao(this.get(U))),this},this.parseCH=function(){var i=this.uaCH,s=this.rgxMap;switch(this.itemType){case Qt:case be:var o=i[Ja]||i[Ya],c;if(o)for(var l in o){var p=o[l].brand||o[l],g=o[l].version;this.itemType==Qt&&!/not.a.brand/i.test(p)&&(!c||/Chrom/.test(c)&&p!=fu||c==ki&&/WebView2/.test(p))&&(p=xe(p,h_),c=this.get(L),c&&!/Chrom/.test(c)&&/Chrom/.test(p)||this.set(L,p).set(U,g).set(Wn,ao(g)),c=p),this.itemType==be&&p==fu&&this.set(U,g)}break;case Ue:var h=i[Zt];h&&(h&&i[ws]=="64"&&(h+="64"),co.call(this.data,h+";",s));break;case De:if(i[et]&&this.set(N,et),i[P]&&(this.set(P,i[P]),!this.get(N)||!this.get(R))){var w={};co.call(w,"droid 9; "+i[P]+")",s),!this.get(N)&&w.type&&this.set(N,w.type),!this.get(R)&&w.vendor&&this.set(R,w.vendor)}if(i[gr]){var v;if(typeof i[gr]!="string")for(var b=0;!v&&b<i[gr].length;)v=xe(i[gr][b++],yu);else v=xe(i[gr],yu);this.set(N,v)}break;case fe:var _=i[Vr];if(_){var k=i[Xa];_==Ko&&(k=parseInt(ao(k),10)>=13?"11":"10"),this.set(L,_).set(U,k)}this.get(L)==Ko&&i[P]=="Xbox"&&this.set(L,"Xbox").set(U,void 0);break;case Hr:var A=this.data,B=function(G){return A[G].getItem().setCH(i).parseCH().get()};this.set(Qt,B(Qt)).set(Ue,B(Ue)).set(De,B(De)).set(be,B(be)).set(fe,B(fe))}return this},$e.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",p_(this,t)]]),this}function Ke(t,e,r){if(typeof t===tn?(zi(t,!0)?(typeof e===tn&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===zo&&!zi(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Gi){var n={};r.forEach(function(l,p){n[p]=l}),r=n}if(!(this instanceof Ke))return new Ke(t,e,r).getResult();var i=typeof t===zo?t:r&&r[su]?r[su]:te&&te.userAgent?te.userAgent:Zr,s=new Ap(r,!0),o=e?u_(vu,e):vu,c=function(l){return l==Hr?function(){return new bu(l,i,o,s).set("ua",i).set(Qt,this.getBrowser()).set(Ue,this.getCPU()).set(De,this.getDevice()).set(be,this.getEngine()).set(fe,this.getOS()).get()}:function(){return new bu(l,i,o[l],s).parseUA().get()}};return $e.call(this,[["getBrowser",c(Qt)],["getCPU",c(Ue)],["getDevice",c(De)],["getEngine",c(be)],["getOS",c(fe)],["getResult",c(Hr)],["getUA",function(){return i}],["setUA",function(l){return hn(l)&&(i=l.length>Go?Ki(l,Go):l),this}]]).setUA(i),this}Ke.VERSION=e_;Ke.BROWSER=_s([L,U,Wn,N]);Ke.CPU=_s([Zt]);Ke.DEVICE=_s([P,R,N,kn,et,Lt,vt,Te,Pn]);Ke.ENGINE=Ke.OS=_s([L,U]);var ut=class{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}};function It(t){return typeof t=="function"}function Np(t){let e=t(r=>{Error.call(r),r.stack=new Error().stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var lo=Np(t=>function(e){t(this),this.message=e?`${e.length} errors occurred during unsubscription:
|
|
36
36
|
${e.map((r,n)=>`${n+1}) ${r.toString()}`).join(`
|
|
37
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=e});function Ki(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var xr=class Yo{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(St(n))try{n()}catch(s){e=s instanceof co?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{vu(s)}catch(o){e=e??[],o instanceof co?e=[...e,...o.errors]:e.push(o)}}if(e)throw new co(e)}}add(e){var r;if(e&&e!==this)if(this.closed)vu(e);else{if(e instanceof Yo){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)&&Ki(r,e)}remove(e){let{_finalizers:r}=this;r&&Ki(r,e),e instanceof Yo&&e._removeParent(this)}};xr.EMPTY=(()=>{let t=new xr;return t.closed=!0,t})();var Ap=xr.EMPTY;function Np(t){return t instanceof xr||t&&"closed"in t&&St(t.remove)&&St(t.add)&&St(t.unsubscribe)}function vu(t){St(t)?t():t.unsubscribe()}var Nr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Yi={setTimeout(t,e,...r){let{delegate:n}=Yi;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=Yi;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Op(t){Yi.setTimeout(()=>{let{onUnhandledError:e}=Nr;if(e)e(t);else throw t})}function bu(){}var p_=Xa("C",void 0,void 0);function d_(t){return Xa("E",void 0,t)}function f_(t){return Xa("N",t,void 0)}function Xa(t,e,r){return{kind:t,value:e,error:r}}var gr=null;function ki(t){if(Nr.useDeprecatedSynchronousErrorHandling){let e=!gr;if(e&&(gr={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=gr;if(gr=null,r)throw n}}else t()}function g_(t){Nr.useDeprecatedSynchronousErrorHandling&&gr&&(gr.errorThrown=!0,gr.error=t)}var Qa=class extends xr{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Np(t)&&t.add(this)):this.destination=b_}static create(t,e,r){return new Jo(t,e,r)}next(t){this.isStopped?uo(f_(t),this):this._next(t)}error(t){this.isStopped?uo(d_(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?uo(p_,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},m_=Function.prototype.bind;function lo(t,e){return m_.call(t,e)}var y_=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Ii(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Ii(r)}else Ii(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Ii(e)}}},Jo=class extends Qa{constructor(t,e,r){super();let n;if(St(t)||!t)n={next:t??void 0,error:e??void 0,complete:r??void 0};else{let i;this&&Nr.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&lo(t.next,i),error:t.error&&lo(t.error,i),complete:t.complete&&lo(t.complete,i)}):n=t}this.destination=new y_(n)}};function Ii(t){Nr.useDeprecatedSynchronousErrorHandling?g_(t):Op(t)}function v_(t){throw t}function uo(t,e){let{onStoppedNotification:r}=Nr;r&&Yi.setTimeout(()=>r(t,e))}var b_={closed:!0,next:bu,error:v_,complete:bu},Za=typeof Symbol=="function"&&Symbol.observable||"@@observable";function w_(t){return t}function __(t){return t.length===0?w_:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var Ke=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let s=S_(r)?r:new Jo(r,n,i);return ki(()=>{let{operator:o,source:c}=this;s.add(o?o.call(s,c):c?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=wu(n),new n((i,s)=>{let o=new Jo({next:c=>{try{r(c)}catch(l){s(l),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[Za](){return this}pipe(...r){return __(r)(this)}toPromise(r){return r=wu(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return t.create=e=>new t(e),t})();function wu(t){var e;return(e=t??Nr.Promise)!==null&&e!==void 0?e:Promise}function E_(t){return t&&St(t.next)&&St(t.error)&&St(t.complete)}function S_(t){return t&&t instanceof Qa||E_(t)&&Np(t)}function I_(t){return St(t?.lift)}function tc(t){return e=>{if(I_(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 Ji(t,e,r,n,i){return new C_(t,e,r,n,i)}var C_=class extends Qa{constructor(t,e,r,n,i,s){super(t),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=e?function(o){try{e(o)}catch(c){t.error(c)}}:super._next,this._error=n?function(o){try{n(o)}catch(c){t.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){t.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}},T_=Dp(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),sr=(()=>{class t extends Ke{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new _u(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new T_}next(r){ki(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){ki(()=>{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(){ki(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:s}=this;return n||i?Ap:(this.currentObservers=null,s.push(r),new xr(()=>{this.currentObservers=null,Ki(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new Ke;return r.source=this,r}}return t.create=(e,r)=>new _u(e,r),t})(),_u=class extends sr{constructor(t,e){super(),this.destination=t,this.source=e}next(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,t)}error(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,t)}complete(){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||e===void 0||e.call(t)}_subscribe(t){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(t))!==null&&r!==void 0?r:Ap}},x_=class extends sr{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let e=super._subscribe(t);return!e.closed&&t.next(this._value),e}getValue(){let{hasError:t,thrownError:e,_value:r}=this;if(t)throw e;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}},ec={now(){return(ec.delegate||Date).now()},delegate:void 0},D_=class extends sr{constructor(t=1/0,e=1/0,r=ec){super(),this._bufferSize=t,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,e)}next(t){let{isStopped:e,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;e||(r.push(t),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!t.closed;s+=r?1:2)t.next(i[s]);return this._checkFinalizedStatuses(t),e}_trimBuffer(){let{_bufferSize:t,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*t;if(t<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=e.now(),o=0;for(let c=1;c<r.length&&r[c]<=s;c+=2)o=c;o&&r.splice(0,o+1)}}},A_=class extends xr{constructor(t,e){super()}schedule(t,e=0){return this}},Xi={setInterval(t,e,...r){let{delegate:n}=Xi;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=Xi;return(e?.clearInterval||clearInterval)(t)},delegate:void 0},N_=class extends A_{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){var r;if(this.closed)return this;this.state=t;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,e),this}requestAsyncId(t,e,r=0){return Xi.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&Xi.clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(t,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let r=!1,n;try{this.work(t)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:t,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,Ki(r,this),t!=null&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null,super.unsubscribe()}}},Xo=class kp{constructor(e,r=kp.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};Xo.now=ec.now;var O_=class extends Xo{constructor(t,e=Xo.now){super(t,e),this.actions=[],this._active=!1}flush(t){let{actions:e}=this;if(this._active){e.push(t);return}let r;this._active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},k_=new O_(N_);function P_(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(g){try{p(n.next(g))}catch(h){o(h)}}function l(g){try{p(n.throw(g))}catch(h){o(h)}}function p(g){g.done?s(g.value):i(g.value).then(c,l)}p((n=n.apply(t,e||[])).next())})}function Eu(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 Vr(t){return this instanceof Vr?(this.v=t,this):new Vr(t)}function R_(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(v){return function(b){return Promise.resolve(b).then(v,h)}}function c(v,b){n[v]&&(i[v]=function(_){return new Promise(function(k,A){s.push([v,_,k,A])>1||l(v,_)})},b&&(i[v]=b(i[v])))}function l(v,b){try{p(n[v](b))}catch(_){w(s[0][3],_)}}function p(v){v.value instanceof Vr?Promise.resolve(v.value.v).then(g,h):w(s[0][2],v)}function g(v){l("next",v)}function h(v){l("throw",v)}function w(v,b){v(b),s.shift(),s.length&&l(s[0][0],s[0][1])}}function L_(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 Eu=="function"?Eu(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(c,l){o=t[s](o),i(c,l,o.done,o.value)})}}function i(s,o,c,l){Promise.resolve(l).then(function(p){s({value:p,done:c})},o)}}var Pp=t=>t&&typeof t.length=="number"&&typeof t!="function";function M_(t){return St(t?.then)}function U_(t){return St(t[Za])}function B_(t){return Symbol.asyncIterator&&St(t?.[Symbol.asyncIterator])}function j_(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 $_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var F_=$_();function H_(t){return St(t?.[F_])}function V_(t){return R_(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:n}=yield Vr(e.read());if(n)return yield Vr(void 0);yield yield Vr(r)}}finally{e.releaseLock()}})}function q_(t){return St(t?.getReader)}function rc(t){if(t instanceof Ke)return t;if(t!=null){if(U_(t))return W_(t);if(Pp(t))return G_(t);if(M_(t))return z_(t);if(B_(t))return Rp(t);if(H_(t))return K_(t);if(q_(t))return Y_(t)}throw j_(t)}function W_(t){return new Ke(e=>{let r=t[Za]();if(St(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function G_(t){return new Ke(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function z_(t){return new Ke(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Op)})}function K_(t){return new Ke(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Rp(t){return new Ke(e=>{J_(t,e).catch(r=>e.error(r))})}function Y_(t){return Rp(V_(t))}function J_(t,e){var r,n,i,s;return P_(this,void 0,void 0,function*(){try{for(r=L_(t);n=yield r.next(),!n.done;){let o=n.value;if(e.next(o),e.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}e.complete()})}function X_(t,e,r,n=0,i=!1){let s=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!i)return s}function nc(t,e){return tc((r,n)=>{let i=0;r.subscribe(Ji(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:Q_}=Array;function Z_(t,e){return Q_(e)?t(...e):t(e)}function t0(t){return nc(e=>Z_(t,e))}function e0(t,e,r,n,i,s,o,c){let l=[],p=0,g=0,h=!1,w=()=>{h&&!l.length&&!p&&e.complete()},v=_=>p<n?b(_):l.push(_),b=_=>{s&&e.next(_),p++;let k=!1;rc(r(_,g++)).subscribe(Ji(e,A=>{i?.(A),s?v(A):e.next(A)},()=>{k=!0},void 0,()=>{if(k)try{for(p--;l.length&&p<n;){let A=l.shift();o?X_(e,o,()=>b(A)):b(A)}w()}catch(A){e.error(A)}}))};return t.subscribe(Ji(e,v,()=>{h=!0,w()})),()=>{c?.()}}function Lp(t,e,r=1/0){return St(e)?Lp((n,i)=>nc((s,o)=>e(n,s,i,o))(rc(t(n,i))),r):(typeof e=="number"&&(r=e),tc((n,i)=>e0(n,i,t,r)))}var r0=["addListener","removeListener"],n0=["addEventListener","removeEventListener"],i0=["on","off"];function Qi(t,e,r,n){if(St(r)&&(n=r,r=void 0),n)return Qi(t,e,r).pipe(t0(n));let[i,s]=a0(t)?n0.map(o=>c=>t[o](e,c,r)):s0(t)?r0.map(Su(t,e)):o0(t)?i0.map(Su(t,e)):[];if(!i&&Pp(t))return Lp(o=>Qi(o,e,r))(rc(t));if(!i)throw new TypeError("Invalid event target");return new Ke(o=>{let c=(...l)=>o.next(1<l.length?l:l[0]);return i(c),()=>s(c)})}function Su(t,e){return r=>n=>t[r](e,n)}function s0(t){return St(t.addListener)&&St(t.removeListener)}function o0(t){return St(t.on)&&St(t.off)}function a0(t){return St(t.addEventListener)&&St(t.removeEventListener)}function ni(t,e=k_){return tc((r,n)=>{let i=null,s=null,o=null,c=()=>{if(i){i.unsubscribe(),i=null;let p=s;s=null,n.next(p)}};function l(){let p=o+t,g=e.now();if(g<p){i=this.schedule(void 0,p-g),n.add(i);return}c()}r.subscribe(Ji(n,p=>{s=p,o=e.now(),i||(i=e.schedule(l,t),n.add(i))},()=>{c(),n.complete()},void 0,()=>{s=i=null}))})}var c0=Oe(Au()),Iu=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let t;try{t=new c0.URLBuilder(location.href)}catch{return{}}let e={};this.UTM_PARAMS.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(this.TW_PARAMS).forEach(n=>{let i=t.getQueryParam(this.TW_PARAMS[n]);i&&(r[n]=i)}),T(T({},r),e)}},_s=class Mp{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}static parseFromCurrent(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new Mp(T({origin:location.origin,path:e,qs:location.search,referrer:Iu.getReferrer(),name:Ot.get().pageName},Iu.getUTMParams()))}},l0=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",u0=/bot|crawl|http|lighthouse|scan|search|spider/i,Sn;function h0(){if(Sn instanceof RegExp)return Sn;try{Sn=new RegExp(l0,"i")}catch{Sn=u0}return Sn}function p0(t){return!!t&&h0().test(t)}var d0=Oe(Au()),f0=class Qo{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 d0.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new Qo(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Qo(r)}},Zo={d:(t,e)=>{for(var r in e)Zo.o(e,r)&&!Zo.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},ic={};Zo.d(ic,{A:()=>g0,k:()=>sc});var In=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(p){try{l(n.next(p))}catch(g){s(g)}}function c(p){try{l(n.throw(p))}catch(g){s(g)}}function l(p){var g;p.done?i(p.value):(g=p.value,g instanceof r?g:new r(function(h){h(g)})).then(o,c)}l((n=n.apply(t,e||[])).next())})},Cn=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(l){return function(p){return function(g){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,g[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&g[0]?n.return:g[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,g[1])).done)return i;switch(n=0,i&&(g=[2&g[0],i.value]),g[0]){case 0:case 1:i=g;break;case 4:return o.label++,{value:g[1],done:!1};case 5:o.label++,n=g[1],g=[0];continue;case 7:g=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||g[0]!==6&&g[0]!==2)){o=0;continue}if(g[0]===3&&(!i||g[1]>i[0]&&g[1]<i[3])){o.label=g[1];break}if(g[0]===6&&o.label<i[1]){o.label=i[1],i=g;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(g);break}i[2]&&o.ops.pop(),o.trys.pop();continue}g=e.call(t,o)}catch(h){g=[6,h],n=0}finally{r=i=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}([l,p])}}};function sc(){return In(this,void 0,Promise,function(){return Cn(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function s(v){i||(i=!0,e({isPrivate:v,browserName:n}))}function o(){var v=0,b=parseInt("-1");try{b.toFixed(b)}catch(_){v=_.message.length}return v}function c(){return navigator.msSaveBlob!==void 0&&function(v){try{return v===eval.toString().length}catch{return!1}}(39)}function l(){var v;return In(this,void 0,void 0,function(){var b,_;return Cn(this,function(k){switch(k.label){case 0:return k.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return k.sent(),s(!1),[3,3];case 2:return b=k.sent(),_=b,b instanceof Error&&(_=(v=b.message)!==null&&v!==void 0?v:b),typeof _!="string"?(s(!1),[2]):(s(!!_.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var v;return In(this,void 0,Promise,function(){return Cn(this,function(b){switch(b.label){case 0:return((v=navigator.storage)===null||v===void 0?void 0:v.getDirectory)===void 0?[3,2]:[4,l()];case 1:return b.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?function(){var _=String(Math.random());try{var k=indexedDB.open(_,1);k.onupgradeneeded=function(A){var B=A.target.result,G=function(j){s(j)};try{B.createObjectStore("t",{autoIncrement:!0}).put(new Blob),G(!1)}catch(j){(j.message||"").includes("are not yet supported")?G(!0):G(!1)}finally{B.close(),indexedDB.deleteDatabase(_)}},k.onerror=function(){return s(!1)}}catch{s(!1)}}():function(){var _=window.openDatabase,k=window.localStorage;try{_(null,null,null,null)}catch{return void s(!0)}try{k.setItem("test","1"),k.removeItem("test")}catch{return void s(!0)}s(!1)}(),b.label=3;case 3:return[2]}})})}function g(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(v,b){var _;s(Math.round(b/1048576)<2*Math.round(((_=window).performance!==void 0&&_.performance.memory!==void 0&&_.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(v){r(new Error("detectIncognito somehow failed to query storage quota: "+v.message))})}function h(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?g():(0,window.webkitRequestFileSystem)(0,1,function(){s(!1)},function(){s(!0)})}function w(){return In(this,void 0,Promise,function(){var v,b;return Cn(this,function(_){switch(_.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];_.label=1;case 1:return _.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return _.sent(),s(!1),[3,4];case 3:return v=_.sent(),typeof(b=v instanceof Error&&typeof v.message=="string"?v.message:String(v))!="string"?(s(!1),[2]):(s(b.includes("Security error")),[2]);case 4:return s(navigator.serviceWorker===void 0),[2]}})})}(function(){return In(this,void 0,Promise,function(){return Cn(this,function(v){switch(v.label){case 0:return o()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return v.sent(),[3,6];case 2:return o()!==51?[3,3]:(b=navigator.userAgent,n=b.match(/Chrome/)?navigator.brave!==void 0?"Brave":b.match(/Edg/)?"Edge":b.match(/OPR/)?"Opera":"Chrome":"Chromium",h(),[3,6]);case 3:return o()!==25?[3,5]:(n="Firefox",[4,w()]);case 4:return v.sent(),[3,6];case 5:c()?(n="Internet Explorer",s(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),v.label=6;case 6:return[2]}var b})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=sc);var g0=sc,m0=ic.A,wE=ic.k,y0=Oe(tn()),v0=class{result={};async safeGet(){try{return await this.get()}catch(t){return Gt.getInstance().captureError(t,"device-properties"),this.result}}async get(){let t=this.result,e=window.CooeeSDK.uaParser;this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),t.referrer=document.referrer,t.host=location.origin,t.path=location.pathname,t.qs=location.search,t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0);let r=e.getResult();return t.browser=r.browser,t.device=r.device,t.engine=r.engine,t.cpu=r.cpu,t.os=r.os,t.navigatorUA=navigator.userAgent,await Promise.all([this.getBatteryInfo(),this.getLocationSilently(),this.checkIncognito()]),t}getDeviceMemory(){let t=navigator;if(!t.deviceMemory)return;let e=t.deviceMemory;this.result.mem={tot:e*1024}}getNetworkType(){let t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){let t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){if(!document.body)return;let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r}async getLocationSilently(){try{await this.getLocation()}catch(t){x.error("Unable to get location",t)}}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()},()=>t())})}async getBatteryInfo(){if("getBattery"in navigator)try{let t=await navigator.getBattery();this.result.bat={l:t.level*100,c:t.charging}}catch{}}async checkIncognito(){try{(await m0())?.isPrivate&&(this.result.incognito=!0)}catch(t){y0.default.error("Unable to detect private/incognito window",t)}}},Up=class{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;let e=ps[t]?.toLowerCase();e&&(x.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},Bp=class{constructor(t,e){this._startTime=t,this._triggerData=e}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),H.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=T({eventName:t,duration:r},e);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach(r=>{if(r.id===t){r.isValid=e;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t?.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:e=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(e>r)return x.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%100;return n<e?e:n>r?r:n}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}},b0=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof hs&&this.loadFamily(e.typography?.fam)})}async loadFamily(t){if(!t?.fonts||this.loadedFonts.indexOf(t.name)>-1)return;let e=[];t.fonts.forEach(r=>{if(r.url){let n=new FontFace(H.COOEE+t.name,r.getURL(),r.getFontDescriptor());e.push(n.load())}}),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach(r=>{document.fonts.add(r)})}},ho=Oe(tn()),oc=class jp{static INSTANCE=new jp;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new sr),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new sr),this.topics[e].asObservable()}},Ee=class me{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=ie.get().website??{};currentState=!1;drawerSubject=new x_({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[me.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener(H.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return me._instance||(me._instance=new me),me._instance}static forceUpdate(){me._instance?.destroy(),me._instance=new me}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return ho.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){x.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(H.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){x.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===me.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,s=e.items[0].price;window.cartGiftUpdate(n,s,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer)window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?Tt.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(Tt.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():(x.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent(H.CTA_AFTER_REFRESH_UI,{detail:{responseJSON:e,currentCart:Tt.getCurrent()}})),r&&oc.get().broadcast(H.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(H.SHADOW_SPLITTER);r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!Ma())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await ji(e),!this.cartDrawerElement){ho.default.warn("Max attempts exhausted to find cart drawer");return}ho.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let e=(await ji(this.shadowParentElementSelector))?.shadowRoot;e?.mode==="open"&&(this.cartDrawerShadowElement=e,this.createMutationObservers())}isVisible(){if(!this.cartDrawerElement)return!1;if(this.cartDrawerElement.tagName.toLowerCase()===me.DEFAULT_SELECTOR&&this.cartDrawerElement.open)return!0;if(this.cartDrawerElement.id==="cart-drawer__container")return this.cartDrawerElement.classList.contains("cart-drawer-open");let e=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=e.top<=r&&e.bottom>=0,s=e.left<=n&&e.right>=0,o=i&&s,c=getComputedStyle(this.cartDrawerElement),l=c.display!=="none"&&c.visibility!=="hidden"&&parseFloat(c.opacity)>0,p=!this.cartDrawerElement.hidden,g=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,h=c.transform.match(/matrix\(([^)]+)\)/),w=0,v=0;if(h){let j=h[1].split(", ").map(parseFloat);w=j[4],v=j[5]}let b=w+e.left>n||w+e.right<0||v+e.top>r||v+e.bottom<0,_=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),k=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),A=_*k,B=e.width*e.height,G=B>0&&A/B>=.1;return(o||!b)&&l&&p&&g&&G}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||(eb(this.cartDrawerElement,()=>{this.initialize()}),this.watchForCartToggle())}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new sr;this.mutationObserver?.disconnect(),this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(ni(500)).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,this.drawerSubject.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){return!this.selector||!this.cartDrawerShadowElement?!1:!!this.cartDrawerShadowElement.querySelector(this.selector)}async updateBubble(){let e=(await Tt.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push([H.EVENT_OPEN_CART])}destroy(){document.removeEventListener(H.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationObserver?.disconnect(),this.drawerSubject?.complete()}},w0=Oe(hf()),ta=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return Ma()}},_0=(0,w0.default)(fetch),E0={retryDelay:H.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=H.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},Or=class $p{static INSTANCE;apiToken="";deviceID="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new $p),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{x.log("Updated user profile"),await ea.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{x.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{x.log("Sent Order")}).catch(r=>{x.error("Error sending track order",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{x.log("Updated device property")}).catch(async r=>{x.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(!ta.isECommerceApp()&&!ta.getFlags().allowEvents)return x.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=We.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){return Gt.getInstance().captureError(c,"http-request",{extra:{body:JSON.stringify(n)}}),{}}let o={method:e,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(e,r){let n=T(T({},E0),r),i=await _0(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),r.forEach((c,l)=>{o.setRequestHeader(l,c)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(c){s(c)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",H.SDK),e.set("cooee-sdk-code",H.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",H.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),this.deviceID&&e.append("cooee-device-id",this.deviceID),We.debug&&e.set("cooee-sdk-debug",String(1)),e}},S0=`
|
|
37
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=e});function Yi(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Dr=class Jo{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(It(n))try{n()}catch(s){e=s instanceof lo?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{wu(s)}catch(o){e=e??[],o instanceof lo?e=[...e,...o.errors]:e.push(o)}}if(e)throw new lo(e)}}add(e){var r;if(e&&e!==this)if(this.closed)wu(e);else{if(e instanceof Jo){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)&&Yi(r,e)}remove(e){let{_finalizers:r}=this;r&&Yi(r,e),e instanceof Jo&&e._removeParent(this)}};Dr.EMPTY=(()=>{let t=new Dr;return t.closed=!0,t})();var Op=Dr.EMPTY;function kp(t){return t instanceof Dr||t&&"closed"in t&&It(t.remove)&&It(t.add)&&It(t.unsubscribe)}function wu(t){It(t)?t():t.unsubscribe()}var Or={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Ji={setTimeout(t,e,...r){let{delegate:n}=Ji;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=Ji;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Pp(t){Ji.setTimeout(()=>{let{onUnhandledError:e}=Or;if(e)e(t);else throw t})}function _u(){}var d_=Qa("C",void 0,void 0);function f_(t){return Qa("E",void 0,t)}function g_(t){return Qa("N",t,void 0)}function Qa(t,e,r){return{kind:t,value:e,error:r}}var mr=null;function Pi(t){if(Or.useDeprecatedSynchronousErrorHandling){let e=!mr;if(e&&(mr={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=mr;if(mr=null,r)throw n}}else t()}function m_(t){Or.useDeprecatedSynchronousErrorHandling&&mr&&(mr.errorThrown=!0,mr.error=t)}var Za=class extends Dr{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,kp(t)&&t.add(this)):this.destination=w_}static create(t,e,r){return new Xo(t,e,r)}next(t){this.isStopped?ho(g_(t),this):this._next(t)}error(t){this.isStopped?ho(f_(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?ho(d_,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},y_=Function.prototype.bind;function uo(t,e){return y_.call(t,e)}var v_=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Ci(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Ci(r)}else Ci(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Ci(e)}}},Xo=class extends Za{constructor(t,e,r){super();let n;if(It(t)||!t)n={next:t??void 0,error:e??void 0,complete:r??void 0};else{let i;this&&Or.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&uo(t.next,i),error:t.error&&uo(t.error,i),complete:t.complete&&uo(t.complete,i)}):n=t}this.destination=new v_(n)}};function Ci(t){Or.useDeprecatedSynchronousErrorHandling?m_(t):Pp(t)}function b_(t){throw t}function ho(t,e){let{onStoppedNotification:r}=Or;r&&Ji.setTimeout(()=>r(t,e))}var w_={closed:!0,next:_u,error:b_,complete:_u},tc=typeof Symbol=="function"&&Symbol.observable||"@@observable";function __(t){return t}function E_(t){return t.length===0?__:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var Ye=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let s=I_(r)?r:new Xo(r,n,i);return Pi(()=>{let{operator:o,source:c}=this;s.add(o?o.call(s,c):c?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Eu(n),new n((i,s)=>{let o=new Xo({next:c=>{try{r(c)}catch(l){s(l),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[tc](){return this}pipe(...r){return E_(r)(this)}toPromise(r){return r=Eu(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return t.create=e=>new t(e),t})();function Eu(t){var e;return(e=t??Or.Promise)!==null&&e!==void 0?e:Promise}function S_(t){return t&&It(t.next)&&It(t.error)&&It(t.complete)}function I_(t){return t&&t instanceof Za||S_(t)&&kp(t)}function C_(t){return It(t?.lift)}function ec(t){return e=>{if(C_(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 Xi(t,e,r,n,i){return new T_(t,e,r,n,i)}var T_=class extends Za{constructor(t,e,r,n,i,s){super(t),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=e?function(o){try{e(o)}catch(c){t.error(c)}}:super._next,this._error=n?function(o){try{n(o)}catch(c){t.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){t.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}},x_=Np(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),or=(()=>{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 Su(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new x_}next(r){Pi(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){Pi(()=>{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(){Pi(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:s}=this;return n||i?Op:(this.currentObservers=null,s.push(r),new Dr(()=>{this.currentObservers=null,Yi(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new Ye;return r.source=this,r}}return t.create=(e,r)=>new Su(e,r),t})(),Su=class extends or{constructor(t,e){super(),this.destination=t,this.source=e}next(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,t)}error(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,t)}complete(){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||e===void 0||e.call(t)}_subscribe(t){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(t))!==null&&r!==void 0?r:Op}},D_=class extends or{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let e=super._subscribe(t);return!e.closed&&t.next(this._value),e}getValue(){let{hasError:t,thrownError:e,_value:r}=this;if(t)throw e;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}},rc={now(){return(rc.delegate||Date).now()},delegate:void 0},A_=class extends or{constructor(t=1/0,e=1/0,r=rc){super(),this._bufferSize=t,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,e)}next(t){let{isStopped:e,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;e||(r.push(t),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!t.closed;s+=r?1:2)t.next(i[s]);return this._checkFinalizedStatuses(t),e}_trimBuffer(){let{_bufferSize:t,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*t;if(t<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=e.now(),o=0;for(let c=1;c<r.length&&r[c]<=s;c+=2)o=c;o&&r.splice(0,o+1)}}},N_=class extends Dr{constructor(t,e){super()}schedule(t,e=0){return this}},Qi={setInterval(t,e,...r){let{delegate:n}=Qi;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=Qi;return(e?.clearInterval||clearInterval)(t)},delegate:void 0},O_=class extends N_{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){var r;if(this.closed)return this;this.state=t;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,e),this}requestAsyncId(t,e,r=0){return Qi.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&Qi.clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(t,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let r=!1,n;try{this.work(t)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:t,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,Yi(r,this),t!=null&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null,super.unsubscribe()}}},Qo=class Rp{constructor(e,r=Rp.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};Qo.now=rc.now;var k_=class extends Qo{constructor(t,e=Qo.now){super(t,e),this.actions=[],this._active=!1}flush(t){let{actions:e}=this;if(this._active){e.push(t);return}let r;this._active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},P_=new k_(O_);function R_(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(g){try{p(n.next(g))}catch(h){o(h)}}function l(g){try{p(n.throw(g))}catch(h){o(h)}}function p(g){g.done?s(g.value):i(g.value).then(c,l)}p((n=n.apply(t,e||[])).next())})}function Iu(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 qr(t){return this instanceof qr?(this.v=t,this):new qr(t)}function L_(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(v){return function(b){return Promise.resolve(b).then(v,h)}}function c(v,b){n[v]&&(i[v]=function(_){return new Promise(function(k,A){s.push([v,_,k,A])>1||l(v,_)})},b&&(i[v]=b(i[v])))}function l(v,b){try{p(n[v](b))}catch(_){w(s[0][3],_)}}function p(v){v.value instanceof qr?Promise.resolve(v.value.v).then(g,h):w(s[0][2],v)}function g(v){l("next",v)}function h(v){l("throw",v)}function w(v,b){v(b),s.shift(),s.length&&l(s[0][0],s[0][1])}}function M_(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 Iu=="function"?Iu(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(c,l){o=t[s](o),i(c,l,o.done,o.value)})}}function i(s,o,c,l){Promise.resolve(l).then(function(p){s({value:p,done:c})},o)}}var Lp=t=>t&&typeof t.length=="number"&&typeof t!="function";function U_(t){return It(t?.then)}function B_(t){return It(t[tc])}function j_(t){return Symbol.asyncIterator&&It(t?.[Symbol.asyncIterator])}function $_(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 F_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var H_=F_();function V_(t){return It(t?.[H_])}function q_(t){return L_(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:n}=yield qr(e.read());if(n)return yield qr(void 0);yield yield qr(r)}}finally{e.releaseLock()}})}function W_(t){return It(t?.getReader)}function nc(t){if(t instanceof Ye)return t;if(t!=null){if(B_(t))return G_(t);if(Lp(t))return z_(t);if(U_(t))return K_(t);if(j_(t))return Mp(t);if(V_(t))return Y_(t);if(W_(t))return J_(t)}throw $_(t)}function G_(t){return new Ye(e=>{let r=t[tc]();if(It(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function z_(t){return new Ye(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function K_(t){return new Ye(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Pp)})}function Y_(t){return new Ye(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Mp(t){return new Ye(e=>{X_(t,e).catch(r=>e.error(r))})}function J_(t){return Mp(q_(t))}function X_(t,e){var r,n,i,s;return R_(this,void 0,void 0,function*(){try{for(r=M_(t);n=yield r.next(),!n.done;){let o=n.value;if(e.next(o),e.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}e.complete()})}function Q_(t,e,r,n=0,i=!1){let s=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!i)return s}function ic(t,e){return ec((r,n)=>{let i=0;r.subscribe(Xi(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:Z_}=Array;function t0(t,e){return Z_(e)?t(...e):t(e)}function e0(t){return ic(e=>t0(t,e))}function r0(t,e,r,n,i,s,o,c){let l=[],p=0,g=0,h=!1,w=()=>{h&&!l.length&&!p&&e.complete()},v=_=>p<n?b(_):l.push(_),b=_=>{s&&e.next(_),p++;let k=!1;nc(r(_,g++)).subscribe(Xi(e,A=>{i?.(A),s?v(A):e.next(A)},()=>{k=!0},void 0,()=>{if(k)try{for(p--;l.length&&p<n;){let A=l.shift();o?Q_(e,o,()=>b(A)):b(A)}w()}catch(A){e.error(A)}}))};return t.subscribe(Xi(e,v,()=>{h=!0,w()})),()=>{c?.()}}function Up(t,e,r=1/0){return It(e)?Up((n,i)=>ic((s,o)=>e(n,s,i,o))(nc(t(n,i))),r):(typeof e=="number"&&(r=e),ec((n,i)=>r0(n,i,t,r)))}var n0=["addListener","removeListener"],i0=["addEventListener","removeEventListener"],s0=["on","off"];function Zi(t,e,r,n){if(It(r)&&(n=r,r=void 0),n)return Zi(t,e,r).pipe(e0(n));let[i,s]=c0(t)?i0.map(o=>c=>t[o](e,c,r)):o0(t)?n0.map(Cu(t,e)):a0(t)?s0.map(Cu(t,e)):[];if(!i&&Lp(t))return Up(o=>Zi(o,e,r))(nc(t));if(!i)throw new TypeError("Invalid event target");return new Ye(o=>{let c=(...l)=>o.next(1<l.length?l:l[0]);return i(c),()=>s(c)})}function Cu(t,e){return r=>n=>t[r](e,n)}function o0(t){return It(t.addListener)&&It(t.removeListener)}function a0(t){return It(t.on)&&It(t.off)}function c0(t){return It(t.addEventListener)&&It(t.removeEventListener)}function ii(t,e=P_){return ec((r,n)=>{let i=null,s=null,o=null,c=()=>{if(i){i.unsubscribe(),i=null;let p=s;s=null,n.next(p)}};function l(){let p=o+t,g=e.now();if(g<p){i=this.schedule(void 0,p-g),n.add(i);return}c()}r.subscribe(Xi(n,p=>{s=p,o=e.now(),i||(i=e.schedule(l,t),n.add(i))},()=>{c(),n.complete()},void 0,()=>{s=i=null}))})}var l0=ke(Ou()),Tu=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let t;try{t=new l0.URLBuilder(location.href)}catch{return{}}let e={};this.UTM_PARAMS.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(this.TW_PARAMS).forEach(n=>{let i=t.getQueryParam(this.TW_PARAMS[n]);i&&(r[n]=i)}),T(T({},r),e)}},Es=class Bp{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}static parseFromCurrent(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new Bp(T({origin:location.origin,path:e,qs:location.search,referrer:Tu.getReferrer(),name:kt.get().pageName},Tu.getUTMParams()))}},u0=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",h0=/bot|crawl|http|lighthouse|scan|search|spider/i,Cn;function p0(){if(Cn instanceof RegExp)return Cn;try{Cn=new RegExp(u0,"i")}catch{Cn=h0}return Cn}function d0(t){return!!t&&p0().test(t)}var f0=ke(Ou()),g0=class Zo{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 f0.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new Zo(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Zo(r)}},ta={d:(t,e)=>{for(var r in e)ta.o(e,r)&&!ta.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},sc={};ta.d(sc,{A:()=>m0,k:()=>oc});var Tn=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(p){try{l(n.next(p))}catch(g){s(g)}}function c(p){try{l(n.throw(p))}catch(g){s(g)}}function l(p){var g;p.done?i(p.value):(g=p.value,g instanceof r?g:new r(function(h){h(g)})).then(o,c)}l((n=n.apply(t,e||[])).next())})},xn=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(l){return function(p){return function(g){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,g[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&g[0]?n.return:g[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,g[1])).done)return i;switch(n=0,i&&(g=[2&g[0],i.value]),g[0]){case 0:case 1:i=g;break;case 4:return o.label++,{value:g[1],done:!1};case 5:o.label++,n=g[1],g=[0];continue;case 7:g=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||g[0]!==6&&g[0]!==2)){o=0;continue}if(g[0]===3&&(!i||g[1]>i[0]&&g[1]<i[3])){o.label=g[1];break}if(g[0]===6&&o.label<i[1]){o.label=i[1],i=g;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(g);break}i[2]&&o.ops.pop(),o.trys.pop();continue}g=e.call(t,o)}catch(h){g=[6,h],n=0}finally{r=i=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}([l,p])}}};function oc(){return Tn(this,void 0,Promise,function(){return xn(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function s(v){i||(i=!0,e({isPrivate:v,browserName:n}))}function o(){var v=0,b=parseInt("-1");try{b.toFixed(b)}catch(_){v=_.message.length}return v}function c(){return navigator.msSaveBlob!==void 0&&function(v){try{return v===eval.toString().length}catch{return!1}}(39)}function l(){var v;return Tn(this,void 0,void 0,function(){var b,_;return xn(this,function(k){switch(k.label){case 0:return k.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return k.sent(),s(!1),[3,3];case 2:return b=k.sent(),_=b,b instanceof Error&&(_=(v=b.message)!==null&&v!==void 0?v:b),typeof _!="string"?(s(!1),[2]):(s(!!_.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var v;return Tn(this,void 0,Promise,function(){return xn(this,function(b){switch(b.label){case 0:return((v=navigator.storage)===null||v===void 0?void 0:v.getDirectory)===void 0?[3,2]:[4,l()];case 1:return b.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?function(){var _=String(Math.random());try{var k=indexedDB.open(_,1);k.onupgradeneeded=function(A){var B=A.target.result,G=function(j){s(j)};try{B.createObjectStore("t",{autoIncrement:!0}).put(new Blob),G(!1)}catch(j){(j.message||"").includes("are not yet supported")?G(!0):G(!1)}finally{B.close(),indexedDB.deleteDatabase(_)}},k.onerror=function(){return s(!1)}}catch{s(!1)}}():function(){var _=window.openDatabase,k=window.localStorage;try{_(null,null,null,null)}catch{return void s(!0)}try{k.setItem("test","1"),k.removeItem("test")}catch{return void s(!0)}s(!1)}(),b.label=3;case 3:return[2]}})})}function g(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(v,b){var _;s(Math.round(b/1048576)<2*Math.round(((_=window).performance!==void 0&&_.performance.memory!==void 0&&_.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(v){r(new Error("detectIncognito somehow failed to query storage quota: "+v.message))})}function h(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?g():(0,window.webkitRequestFileSystem)(0,1,function(){s(!1)},function(){s(!0)})}function w(){return Tn(this,void 0,Promise,function(){var v,b;return xn(this,function(_){switch(_.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];_.label=1;case 1:return _.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return _.sent(),s(!1),[3,4];case 3:return v=_.sent(),typeof(b=v instanceof Error&&typeof v.message=="string"?v.message:String(v))!="string"?(s(!1),[2]):(s(b.includes("Security error")),[2]);case 4:return s(navigator.serviceWorker===void 0),[2]}})})}(function(){return Tn(this,void 0,Promise,function(){return xn(this,function(v){switch(v.label){case 0:return o()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return v.sent(),[3,6];case 2:return o()!==51?[3,3]:(b=navigator.userAgent,n=b.match(/Chrome/)?navigator.brave!==void 0?"Brave":b.match(/Edg/)?"Edge":b.match(/OPR/)?"Opera":"Chrome":"Chromium",h(),[3,6]);case 3:return o()!==25?[3,5]:(n="Firefox",[4,w()]);case 4:return v.sent(),[3,6];case 5:c()?(n="Internet Explorer",s(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),v.label=6;case 6:return[2]}var b})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=oc);var m0=oc,y0=sc.A,_E=sc.k,v0=ke(rn()),b0=class{result={};async safeGet(){try{return await this.get()}catch(t){return zt.getInstance().captureError(t,"device-properties"),this.result}}async get(){let t=this.result,e=window.CooeeSDK.uaParser;this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),t.referrer=document.referrer,t.host=location.origin,t.path=location.pathname,t.qs=location.search,t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0);let r=e.getResult();return t.browser=r.browser,t.device=r.device,t.engine=r.engine,t.cpu=r.cpu,t.os=r.os,t.navigatorUA=navigator.userAgent,await Promise.all([this.getBatteryInfo(),this.getLocationSilently(),this.checkIncognito()]),t}getDeviceMemory(){let t=navigator;if(!t.deviceMemory)return;let e=t.deviceMemory;this.result.mem={tot:e*1024}}getNetworkType(){let t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){let t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){if(!document.body)return;let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r}async getLocationSilently(){try{await this.getLocation()}catch(t){x.error("Unable to get location",t)}}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()},()=>t())})}async getBatteryInfo(){if("getBattery"in navigator)try{let t=await navigator.getBattery();this.result.bat={l:t.level*100,c:t.charging}}catch{}}async checkIncognito(){try{(await y0())?.isPrivate&&(this.result.incognito=!0)}catch(t){v0.default.error("Unable to detect private/incognito window",t)}}},jp=class{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;let e=ds[t]?.toLowerCase();e&&(x.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},$p=class{constructor(t,e){this._startTime=t,this._triggerData=e}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),H.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=T({eventName:t,duration:r},e);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach(r=>{if(r.id===t){r.isValid=e;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t?.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:e=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(e>r)return x.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%100;return n<e?e:n>r?r:n}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}};function Wr(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function ts(t,e){Object.assign(t.style,e)}function X(t,e,r){if(e){if(!r){t.style.removeProperty(e);return}t.style.setProperty(e,r,"important")}}var w0=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof ps&&this.loadFamily(e.typography?.fam)})}async loadFamily(t){if(!t?.fonts||this.loadedFonts.indexOf(t.name)>-1)return;let e=[];t.fonts.forEach(r=>{if(r.url){let n=new FontFace(H.COOEE+t.name,r.getURL(),r.getFontDescriptor());e.push(n.load())}}),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach(r=>{document.fonts.add(r)})}},po=ke(rn()),ac=class Fp{static INSTANCE=new Fp;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new or),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new or),this.topics[e].asObservable()}},Se=class ye{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=se.get().website??{};currentState=!1;drawerSubject=new D_({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[ye.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener(H.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return ye._instance||(ye._instance=new ye),ye._instance}static forceUpdate(){ye._instance?.destroy(),ye._instance=new ye}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return po.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){x.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(H.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){x.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===ye.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,s=e.items[0].price;window.cartGiftUpdate(n,s,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer)window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?xt.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(xt.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():(x.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent(H.CTA_AFTER_REFRESH_UI,{detail:{responseJSON:e,currentCart:xt.getCurrent()}})),r&&ac.get().broadcast(H.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(H.SHADOW_SPLITTER);r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!Ua())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await $i(e),!this.cartDrawerElement){po.default.warn("Max attempts exhausted to find cart drawer");return}po.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let e=(await $i(this.shadowParentElementSelector))?.shadowRoot;e?.mode==="open"&&(this.cartDrawerShadowElement=e,this.createMutationObservers())}isVisible(){if(!this.cartDrawerElement)return!1;if(this.cartDrawerElement.tagName.toLowerCase()===ye.DEFAULT_SELECTOR&&this.cartDrawerElement.open)return!0;if(this.cartDrawerElement.id==="cart-drawer__container")return this.cartDrawerElement.classList.contains("cart-drawer-open");let e=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=e.top<=r&&e.bottom>=0,s=e.left<=n&&e.right>=0,o=i&&s,c=getComputedStyle(this.cartDrawerElement),l=c.display!=="none"&&c.visibility!=="hidden"&&parseFloat(c.opacity)>0,p=!this.cartDrawerElement.hidden,g=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,h=c.transform.match(/matrix\(([^)]+)\)/),w=0,v=0;if(h){let j=h[1].split(", ").map(parseFloat);w=j[4],v=j[5]}let b=w+e.left>n||w+e.right<0||v+e.top>r||v+e.bottom<0,_=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),k=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),A=_*k,B=e.width*e.height,G=B>0&&A/B>=.1;return(o||!b)&&l&&p&&g&&G}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||(rb(this.cartDrawerElement,()=>{this.initialize()}),this.watchForCartToggle())}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new or;this.mutationObserver?.disconnect(),this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(ii(500)).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,this.drawerSubject.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){return!this.selector||!this.cartDrawerShadowElement?!1:!!this.cartDrawerShadowElement.querySelector(this.selector)}async updateBubble(){let e=(await xt.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push([H.EVENT_OPEN_CART])}destroy(){document.removeEventListener(H.CTA_AFTER_REFRESH_UI,this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationObserver?.disconnect(),this.drawerSubject?.complete()}},Hp=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let e={display:t.disp};return t.of&&(e.objectFit=t.of),t.pos==="absolute"&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){let e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};let e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};let e={};if(t.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:t.glossy.fallback.rgba};if(e[n]=i,e[r]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let r=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,r){if(r??={},t.type==="LINEAR"){let n=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(n+=`, ${t.c3}`),n+=")",r[e]=n}return r}getColourStyles(t,e="color",r){return r??={},t?t.grad?this.getGradientStyles(t.grad,e,r):(t.hex&&(r[e]=t.rgba),r):r}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}},_0=ke(pf()),ea=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return Ua()}},E0=(0,_0.default)(fetch),S0={retryDelay:H.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=H.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},kr=class Vp{static INSTANCE;apiToken="";deviceID="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Vp),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{x.log("Updated user profile"),await ra.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{x.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{x.log("Sent Order")}).catch(r=>{x.error("Error sending track order",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{x.log("Updated device property")}).catch(async r=>{x.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(!ea.isECommerceApp()&&!ea.getFlags().allowEvents)return x.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Ge.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){return zt.getInstance().captureError(c,"http-request",{extra:{body:JSON.stringify(n)}}),{}}let o={method:e,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(e,r){let n=T(T({},S0),r),i=await E0(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),r.forEach((c,l)=>{o.setRequestHeader(l,c)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(c){s(c)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",H.SDK),e.set("cooee-sdk-code",H.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",H.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),this.deviceID&&e.append("cooee-device-id",this.deviceID),Ge.debug&&e.set("cooee-sdk-debug",String(1)),e}},I0=`
|
|
38
38
|
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
39
39
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
40
40
|
cart {
|
|
@@ -46,7 +46,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
`,
|
|
49
|
+
`,Un=class{static navigate(t,e,r){let n=`${location.origin}/discount/${t}`;switch(x.log(`Applying discount code ${t}`,e,r),e){case Pe.CART_PAGE:location.href=`${n}?redirect=/cart`;break;case Pe.CART_DRAWER:location.href=`${n}?redirect=${location.pathname}#${H.HASH_OPEN_CART_DRAWER}=1`;break;case Pe.SHOPIFY_CHECKOUT:location.href=`${n}?redirect=/checkout`;break;case Pe.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${n}?redirect=/cart#${H.HASH_INITIATE_CHECKOUT}=1`);break;default:location.href=`${n}?redirect=${r||location.pathname}`}}static navigateWithoutDiscount(t,e){let r=Se.get();switch(t){case Pe.CART_PAGE:location.href="/cart";break;case Pe.SHOPIFY_CHECKOUT:location.href="/checkout";break;case Pe.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#${H.HASH_INITIATE_CHECKOUT}=1`);break;case Pe.CART_DRAWER:{r.open();break}}e&&r.refreshUI(e)}static async applyWithStorefront(t){let e=se.get().storefrontToken;if(!e)throw new Error("Storefront token not set for the store");let r=new Headers;r.append("Content-Type","application/json"),r.append("X-Shopify-Storefront-Access-Token",e);let n=JSON.stringify({query:I0,variables:{cartId:`gid://shopify/Cart/${xt.getCurrent().token}`,discountCodes:t}}),i={method:"POST",headers:r,body:n};x.debug(`Applying ${t.length} coupons on cart`),await kr.getInstance().request(H.GRAPHQL_API_PATH,i)}static checkThirdPartyMethods(t){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.openRzpCheckout?window.openRzpCheckout():location.href=t}},C0=`
|
|
50
50
|
mutation cartCreate($input: CartInput) {
|
|
51
51
|
cartCreate(input: $input) {
|
|
52
52
|
cart {
|
|
@@ -59,11 +59,11 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
`,ac=class{sentryService=lt.get(Gt);async addToCart(t,e){if(!t.length)return;let r=t.map(c=>{let{vID:l,quantity:p}=this.getVIDAndQuantity(c);return{id:l?+l:+c.mID,quantity:p,properties:e.getPrivateAttributesForLineItem()}}),n=Ln("cart/add.js"),i={items:r},s=Ee.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let o=JSON.stringify(i);try{let c=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(c.status===200||c.status===302)return x.log(`Added ${t.length} items to Cart`),Qe("Product added to your cart"),c.json()}catch(c){Qe("Failed to add product in cart. Please try again"),this.sentryService.captureError(c,"cart-item-add",{extra:{body:o},engagementTrigger:e})}}async updateLineItem(t,e){if(!Gn.hasKeys(e)){x.warn("No update fields provided");return}let r=Ln("cart/change.js"),n=T({id:t.key},e),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});if(s.status===200||s.status===302){let o=await s.json();x.log(`Updated ${t}`),Tt.getCurrent().update(o)}}catch(s){Qe("Failed to update item in cart"),this.sentryService.captureError(s,"cart-item-update",{extra:{body:i}})}}async copyDiscountCode(t){if(t)try{await navigator.clipboard.writeText(t),x.log(`Code-${t} copied`),Qe("Discount code copied")}catch(e){x.error("Failed to copy code",e)}}goToItem(t){if(!t?.link)return;let e=Fb(t.link);e&&(location.pathname=Vi()+"products/"+e)}async upgradeToSubscription(t,e){if(!t){x.warn("Trying to upgrade to subscription with no item");return}let r=await Tt.getCurrent().getNormalisedCart(),n=t.selectedOrFirstVariant.value,i=r.items.findIndex(p=>p.vID===n.mID),s=n.selectedSellingPlan.value,o=Ln("cart/change.js"),c={line:i+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},l=JSON.stringify(c);try{let p=await fetch(o,{body:l,method:"post",headers:{"Content-Type":"application/json"}});if(p.status===200||p.status===302){x.log(`Upgraded ${t} selling plan`),Qe("Line item updated");let g=await p.json();return Tt.getCurrent().update(g),g}}catch(p){Qe("Failed to update subscription"),this.sentryService.captureError(p,"cart-switch-subscription",{extra:{body:l},engagementTrigger:e})}}async createNewCart(t,e,r){let n=ie.get().storefrontToken;if(!n)throw new Error("Storefront token not set for the store");if(!t?.vID){x.error("No variant ID found to perform Buy now",t);return}let i=e?[e]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:r.getKVFormatPrivateAttributesForLineItem()}],o=await Dh(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",n);let l=JSON.stringify({query:I0,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await Or.getInstance().request(H.GRAPHQL_API_PATH,{method:"POST",headers:c,body:l})).data?.cartCreate?.cart?.checkoutUrl}async process(t){let e=t.clickAction,r=t.items,n=t.triggerData;if(e.at){let i=e;if(x.log(`Performing ${JSON.stringify(i)} action`),i.at===101)r?.length&&this.goToItem(r[0]);else if(i.at===102)r?.length&&await this.addToCart(r,n);else if(i.at===103)await this.copyDiscountCode(n.discount.code);else if(i.at===105)Ee.get().open();else if(i.at===104){let s=t.collections;if(!s?.length)return;location.pathname=Vi()+"collections/"+s[0].handle}}e.applyDiscount&&n.discount?.code&&Mn.navigate(n.discount.code,n.redirectBehaviour)}getVIDAndQuantity(t){let e,r;if(t instanceof en)e=t.vID,r=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,r=1}return{vID:e,quantity:r}}},C0=class{static updateIdentity(t){if(!this.isInstalled())return;let e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),x.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},T0=class{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=Ht.getInstance(),this.triggerContext=e}async execute(){let t=this.containsCTA()?H.EVENT_TRIGGER_CLICKED:H.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(t),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:await this.collectFormData();break;case void 0:case 105:break;default:x.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let t=this.action.gu.u;Ch(t)||(t=`//${t}`),window.open(t,"_self")}}async closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),await this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){x.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(t=>console.log(t)).catch(t=>console.error(t))}}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return t?Object.keys(t).length===0:!0}async collectFormData(){let t={};for(let e of this.triggerContext.inputs){if(!e.isValid)return;let r=document.getElementById(e.id).value;e.type===51?t.email=r:e.type===52&&(t.mobile=r)}await this.closeTriggerAndSendEvent(H.EVENT_FORM_SUBMITTED,{form:t}),Qe("Coupon applied on cart"),C0.updateIdentity(t)}async dispatchEvent(){let t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};await new ac().process(e);let r={action:this.containsCTA()?H.CAMPAIGN_CLICKED_ACTIVITY:H.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(H.POPUP_ACTIVITY_EVENT,{detail:r}))}},Zi=class Pe{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;constructor(){}static get(){return Pe._instance||(Pe._instance=new Pe),Pe._instance}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Pe.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Pe.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return window.CooeeSDK.uaParser.getDevice().type==="mobile"}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,s=e.spc,o=Pe.get().getWidth(),c=Pe.get().getHeight();r&&(o=o?Math.min(o,r):r,c=c?Math.min(c,r):r),c&&(o-=s.getHorizontal(),c-=s.getVertical(),o/c<n/i?this.scalingFactor=o/n:this.scalingFactor=c/i,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(e){return this.doc.createElement(e)}appendChild(e,r){e.appendChild(r)}setStyles(e,r){Object.assign(e.style,r)}setStyle(e,r,n){if(r){if(!n){e.style.removeProperty(r);return}e.style.setProperty(r,n,"important")}}setAttribute(e,r,n){e.setAttribute(r,n)}removeInApp(e){let r=document.querySelector(`.${e.rootClassName}`);r&&r.parentElement.removeChild(r)}setParentContainer(e){this.parentContainer=e,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}},Fp=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let e={display:t.disp};return t.of&&(e.objectFit=t.of),t.pos==="absolute"&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){let e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};let e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};let e={};if(t.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:t.glossy.fallback.rgba};if(e[n]=i,e[r]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let r=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,r){if(r??={},t.type==="LINEAR"){let n=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(n+=`, ${t.c3}`),n+=")",r[e]=n}return r}getColourStyles(t,e="color",r){return r??={},t?t.grad?this.getGradientStyles(t.grad,e,r):(t.hex&&(r[e]=t.rgba),r):r}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}},ii=class{renderer=Zi.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,r){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=r,this.stylesConverter=new Fp(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let t=ct(T(T(T(T({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let t=this.inappElement.alpha;if(!isNaN(t)){let e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){let t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let t=new ju(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){let t=this.inappElement.clc;!t||Object.keys(t).length===0||(this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation(),new T0(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},Es=class extends ii{constructor(t,e,r){super(t,e,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=H.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){let r=[];e.u&&r.push("underline"),e.st&&r.push("line-through"),r.length||r.push("normal"),this.renderer.setStyle(t,"font-weight",e.b?"bold":"normal"),this.renderer.setStyle(t,"font-style",e.i?"italic":"normal"),this.renderer.setStyle(t,"text-decoration",r.join(" ")),this.renderer.setStyle(t,"color",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){let t=this.inappElement.typography.ta,e=t?ua[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}},x0=class extends Es{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(t=>{let e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)}),this.processCommonBlocks()}},D0=class extends ii{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},Hp=class extends ii{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}},A0=class Vp extends ii{constructor(e,r,n){super(e,r,n),this.parent=e,this.inappHTMLEl=this.renderer.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(H.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",Vp.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let e=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(this.renderer.setStyle(this.inappHTMLEl,"width","100%"),this.renderer.setStyle(this.inappHTMLEl,"height","100%")):(this.renderer.setStyle(this.inappHTMLEl,"width","100vw"),this.renderer.setStyle(this.inappHTMLEl,"height","100vh")),this.renderer.setStyle(this.inappHTMLEl,"top","0"),this.renderer.setStyle(this.inappHTMLEl,"left","0");else{let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(e.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(e.h)+r.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return T(T({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded()){this.renderer.setStyle(this.inappHTMLEl,"position","block");return}this.renderer.setStyle(this.inappHTMLEl,"position","absolute")}else this.renderer.setStyle(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}},N0=class extends ii{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(H.IN_APP_CONTAINER_NAME),this}},O0=class Re extends Es{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=ct(T(T(T({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>this.renderer.setStyles(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(Re.DAYS)),e.hour&&this.elements.push(this.getChild(Re.HOURS)),e.minute&&this.elements.push(this.getChild(Re.MINUTES)),e.second&&this.elements.push(this.getChild(Re.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=this.renderer.createElement("div"),n=this.renderer.createElement("span"),i=this.renderer.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,this.renderer.setStyle(i,"font-size","0.5em"),this.renderer.setStyle(i,"text-align","center"),this.renderer.setStyle(i,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),this.renderer.setStyle(r,"display","flex"),this.renderer.setStyle(r,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(r,"justify-content","center"),this.renderer.setStyle(r,"align-items","center"),this.renderer.setStyle(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${Re.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Re.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Re.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Re.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}},k0=class extends Es{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",e=>{e.stopPropagation()}),t.addEventListener("change",()=>{let e=new us(JSON.parse(t.value));this.updateItems(e)})}updateItems(t){let e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=t.imgs[0]??e.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length){e.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach(n=>{e.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(t,e,r){let n=this.renderer.createElement("option");return n.text=t,n.value=JSON.stringify(e),r&&(n.selected=!0),e||(n.disabled=!0),n}},qp=class extends Es{borderColor="";constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let t=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}},P0=class Wp extends qp{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(Wp.EMAIL_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},R0=class Gp extends qp{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(Gp.MOBILE_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},L0=class extends Hp{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},zp=class kn{static ACTIVE_TRIGGER_DATA;renderer=Zi.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=Ht.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}setParentContainer(e){this.parent=e??document.body,this.renderer.setParentContainer(this.parent)}render(e){this.renderEngagement(new Tr(e))}async renderEngagement(e){if(this.triggerContext=new Bp(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(this.renderer.isMobile()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!Ee.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=Ee.get().onToggle().subscribe(({open:e})=>{!e&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){kn.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){Gt.getInstance().captureError(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&kn.ACTIVE_TRIGGER_DATA){let n={triggerShown:new za(kn.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(Ot.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=H.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new A0(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw x.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new Bt(H.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:H.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(H.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new Bt(r,e,this.triggerContext.triggerData);n.name===H.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof ep?new P0(e,r,n).render():r instanceof rp?new R0(e,r,n).render():r instanceof $o?new x0(e,r,n).render():r instanceof np?new L0(e,r,n).render():r instanceof Ba?new Hp(e,r,n).render():r instanceof Xh?new D0(e,r,n).render():r instanceof Zh?new O0(e,r,n).render():r instanceof tp?new k0(e,r,n).render():x.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new N0(this.rootContainer,r,e).render().getHTMLElement(),new b0().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),kn.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(){Zi.get().removeInApp(this.triggerContext)}skipTrigger(e,r){let n=new Bt(H.EVENT_CAMPAIGN_REJECTED,r,e);this.safeHTTP.sendEvent(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}},M0=class{triggerData;safeHttpService=Ht.getInstance();render(t){t.contentSource===oa.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let e=t.detail;if(e.formId!==this.triggerData.klaviyoFormID){x.warn("Received invalid trigger callback");return}switch(e.type){case"open":this.safeHttpService.sendEvent(new Bt(H.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(e);this.safeHttpService.sendEvent(new Bt(H.EVENT_FORM_SUBMITTED,{form:r},this.triggerData)),this.safeHttpService.updateProfile(r);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new Bt(H.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData));break}}getFormDetails(t){let e={id:t.formId},r=t.metaData;if(Gn.hasKeys(r)){let n=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(r).forEach(o=>{n.includes(o)||(e[o]=r[o])}),e.email=r.$email??r.email,e.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(e.name=i+" "+s)}return e}},U0=class{static trackIntent(t){if(!this.isInstalled()){x.log("Facebook pixel not installed");return}if(!ie.get().pixelPush){x.log("Facebook pixel push not enabled");return}let e=ps[t.intent]?.toLowerCase(),r=t.segmentName;!e&&!r||(x.debug(`Sending ${e} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},Kp=class{static itemMap=new Map;static async refreshItems(t){for(let i of t.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(i,t)}catch(s){x.error(s)}if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let i=(await Tt.getCurrent().getNormalisedCart()).items.map(s=>s.mID);t.items=t.items.filter(s=>!i.includes(s.mID))}if(ie.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await this.refreshVideoItems(t.content.videoConfig,t),t.items;let e=t.items.length,r=t.items.map(i=>this.updatedItem(i,t)),n=(await Promise.all(r)).filter(i=>i!=null);if(e&&!n.length){let i="Failed to fetch any product from Ajax API",s=new Bt(H.EVENT_CAMPAIGN_FAILED,{reason:i,currency:t.currency},t);throw Ht.getInstance().sendEvent(s),new Error(i)}if(t.isCartRecovery()){let i=Tt.getCurrent().items,s=[];for(let o of n)for(let c of o.vars){if(!c.isAvailable)continue;let l=i.find(h=>h.variant_id.toString()===c.mID);if(!l)continue;let p=new He(o);p.name=l.title;let g=new us(c);g.name=l.variant_title,g.price.d=l.discounted_price/100,p.variants=[g],s.push(p)}return s}return n}static async refreshVideoItems(t,e){await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>await this.updatedItem(n,e)||n))}))}static async updatedItem(t,e){if(this.itemMap.has(t.mID))return this.itemMap.get(t.mID);let r=t,n=Gt.getInstance(),i=lt.get(Or),s,o=`/products/${r.slug}.js`;try{s=await i.request(o)}catch(l){return n.captureError(l,"fetch-shopify-product",{extra:{item:r,path:o},engagementTrigger:e}),null}if(!s)return x.error("Item not found after AJAX call for:",r),null;r.name=s.title,r.tags=s.tags;let c=r.selectedOrFirstVariant.value;return r.vars.map(l=>{let p=s.variants.find(g=>g.id===+l.mID);l.name=p.title,l.isAvailable=p.available,l.price.d=p.price?p.price/100:p.price,l.price.effective=l.price.d,l.price.cmp=p.compare_at_price?p.compare_at_price/100:p.compare_at_price,+c.mID===p.id&&(c.effectivePrice.value=l.price.d)}),this.itemMap.set(r.mID,r),r}},cc=class Yp{static INSTANCE;httpService=lt.get(Or);sentryService=lt.get(Gt);sessionManager=lt.get(we);runtime=Ot.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Yp),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>x.error(`Failed to send ${e.name}`,r))}async send(e){if(x.debug(`Sending event ${e.name}`),Ne.log(`Sending event ${e.name} with id ${e.id}`),this.shouldReject(e)){x.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==H.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),e.locale=this.runtime.locale,this.httpService.post("/v1/event/track",e).then(async r=>{x.log("\u2705 Event tracked:",e.name),Ne.log(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{x.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(x.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=_s.parseFromCurrent()}async addShopifyContext(e){try{e.cart=await Tt.getCurrent().getNormalisedCart()}catch(r){x.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{this.sentryService.captureError(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){x.log(`Nothing to engage after ${e.name}`);return}x.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData),Ne.log(`\u{1F4E3} Campaign #${r.triggerData.shortID}) will be shown`);let n=new Tr(r.triggerData);n.occurred=e.occurred;let i;try{i=await Kp.refreshItems(n)}catch(s){x.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===oa.KLAVIYO){new M0().render(n);return}new zp().renderEngagement(n).catch(s=>{this.sentryService.captureError(s,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(Up.trackIntent(e.intent),U0.trackIntent(e),Ne.log(`Intent is <strong>${ps[e.intent]}</strong>`))}addShopifyAttributes(){Tt.getCurrent().addCooeeAttributes().catch(e=>{x.error("Fail to add attributes in cart",e)})}},Ht=class Jp{static INSTANCE;httpApiService=Or.getInstance();eventAPIService=cc.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Jp),this.INSTANCE}sendEvent(e){x.debug(`Waiting for auth to send event ${e.name}`),we.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){we.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){we.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){we.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}},Ne=class{static isOn=!1;static element;static logs=[];static watch(){let t=Nu();(t==="1"||t==="on")&&Ht.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),t==="on"?sessionStorage.cooeeDebug="1":t==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar(),this.log(`Cooee SDK v${H.SDK_VERSION} loaded`))}static log(t){this.isOn&&(this.logs.unshift({time:new Date,message:t}),this.element&&(this.element.logs=[...this.logs]))}static renderDebugBar(){this.element=document.createElement("cooee-debugger"),this.element.logs=this.logs,xa(()=>{document.body.appendChild(this.element)})}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},Cu=class extends Ta{static storeName="app";static{this.storage=Ca(this.storeName)}},B0=class{static processConfiguration(){let t=ie.get();!t.gaMeasurementID||!t.gaEnabled||this.sendClientID()}static async sendClientID(){let t=await this.getClientID();t&&Ht.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){let t=await Lt.get(at.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Lt.set(at.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){let t=ie.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},j0=class Xp{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Xp),this.INSTANCE}init(){Cu.get(at.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){x.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Cu.set(at.APP_CONFIG,r).catch(n=>x.error(n)),B0.processConfiguration(),r.website&&(be.injectRawScript(r.website.commonJS),be.injectRawCSS(r.website.commonCSS)),Ee.get().onToggle().subscribe(async({open:n})=>{x.info("Cart drawer is now",n?"open":"closed"),n&&(lt.get(Wn).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=_t.globalRef.config.update(e);return Ee.forceUpdate(),x.debug("App configurations",r),r}async trackViewCartEvent(){let e=await Tt.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};Ht.getInstance().sendEvent(new Bt(H.EVENT_VIEW_CART,n))}},ea=class Qp{static INSTANCE;httpAPIService=Or.getInstance();coreService=j0.getInstance();sentryService=Gt.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Qp),this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Lt.set(at.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Lt.set(at.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Lt.set(at.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),x.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);x.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw x.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Lt.get(at.SDK_TOKEN),!this.sdkToken){x.warn("No SDK token found in local storage");return}this.userID=await Lt.get(at.ID),this.deviceID=await Lt.get(at.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){x.debug("SDK Token:",this.sdkToken),x.log("Device ID:",this.deviceID),x.log("User ID:",this.userID),Up.trackDeviceID(this.deviceID),Ne.log(`Device ID: ${this.deviceID}`),this.userID&&Ne.log(`User ID: ${this.userID}`),this.httpAPIService.setAPIToken(this.sdkToken),this.httpAPIService.setDeviceId(this.deviceID),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(e){let r=await new v0().safeGet(),n=await Lt.get(at.DEVICE_ID);return n||(n=new zt().toHexString(),await Lt.set(at.DEVICE_ID,n)),ct(T({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:H.SDK,page:_s.parseFromCurrent(),ad:f0.getAdParams(),occurred:this.getSessionStartTime(Ot.get().jsLoadTime),currentItem:Ot.get().getCurrentItem(),cart:await Tt.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Lt.get(at.FIRST_SEEN),r=e?new Date(e):new Date;e||await Lt.set(at.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>H.IDLE_TIME_IN_SECONDS?new Date:e}},we=class Pn{static replaySubject=new D_(1);static INSTANCE;sentryService=lt.get(Gt);constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Pn),this.INSTANCE}init(e){if(x.debug("Initialising SDK",e),p0(navigator.userAgent)){x.info("This seems to be a bot. Disabling SDK");return}ea.getInstance().init(e),Pn.INSTANCE.checkSessionOnPageLoad().then(async()=>{Pn.replaySubject.next(!0),Pn.replaySubject.complete()}).catch(r=>{x.error("Unable to initiate session",r)})}getCurrentSessionID(){return te.set(at.SESSION_LAST_USED_TIME,new Date().getTime()),te.get(at.ID,"")}async checkSessionOnPageLoad(){await Vb.request("validate_session",async()=>{await this.checkForNewSession(!0)})}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let e=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setTags({"cooee_session.number":e[1]}),this.sentryService.setGlobalContext("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){let r=!1;if(await this.isNewSessionRequired()?(Ne.log("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();Ne.log(`Session ID: ${n[0]} & number: ${n[1]}`),await ea.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await te.set(at.SESSION_SYNCED,!0)}}async startNewSession(){x.debug("Starting new session"),await te.clear(),x.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new zt().toHexString();x.debug("New session ID to be used",r);let n=await Lt.get(at.SESSION_NUMBER,0)+1;await Promise.all([Lt.set(at.SESSION_NUMBER,n),te.set(at.ID,r),te.set(at.SESSION_LAST_USED_TIME,e.getTime()),te.set(at.SESSION_LANDING_PAGE,_s.parseFromCurrent())])}getLandingPage(){return te.get(at.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Lt.get(at.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await te.get(at.ID))return!0;let e=await te.get(at.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>H.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await te.get(at.SESSION_SYNCED,!1)}},$0=Oe(tn()),F0=Oe(tn()),lc=class{constructor(t){this.triggerContext=t}safeHTTP=Ht.getInstance();eventAPIService=cc.getInstance();async execute(t){let e=Ot.get().getCurrentItem(),r=t.clickAction;if(!r)return;let n=t.item,i=this.triggerContext,s=new ac,o=i.triggerData.redirectBehaviour,c=!!i.triggerData.discount.type&&!!r?.applyDiscount,l={selectedVariants:i.triggerData.nonMutableItems.map(_=>({itemMID:_.mID,mID:_.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},p="",g=[],h=[];if(n?h=[n.toEmbed()]:t.embeddedItem&&(h=[t.embeddedItem]),r.at===108){let _=i.selectedItems;if(h=t.embeddedItems??_.map(k=>k.toEmbed()),i.shouldGiveFBTDiscount||t.embeddedItems?.length){let k;t.embeddedItems?k=t.embeddedItems.map(B=>({itemMID:B.mID,mID:B.vID,quantity:B.quantity})):k=_.map(B=>({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID}));let A=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&A&&(k.push({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,isPrimary:!0}),h.unshift(A.toEmbed())),l.selectedVariants=k,i.triggerData.isBundleOnPDP()&&l.selectedVariants.forEach(B=>{B.mID===e.vID&&(B.isPrimary=!0)})}else l=void 0;g=t.embeddedItems??_}else if(r.at===107){let _=await Tt.getCurrent().getNormalisedCart();h=_.items,l.selectedVariants=_.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(r.at===102)g=n?[n]:[t.embeddedItem];else if(r.at===101)p=n?Vi()+"products/"+n.slug:t.embeddedItem?.link;else if(r.at===4){let _=Ch(r.gu?.u);_&&(p=_.href)}else if(r.at===109){let _=await s.upgradeToSubscription(n,i.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Ee.get().refreshUI(_)}else if(r.at===104){let _=this.triggerContext.triggerData.collections?.[0];_&&(p="collections/"+_.handle)}if(this.sendTriggerClicked(h,{from:"button"},t.video),x.debug({redirectPath:p,redirectBehaviour:o,hasDiscount:c}),!c&&p){location.href=p;return}let w,v=!1;try{w=await this.getOrGenerateDiscountCode(l),x.debug("Discount code (if any) to apply",w)}catch(_){if(!this.triggerContext.triggerData.isBYOB()){F0.default.error("Unable to get a discount code",_);return}}if(w&&r.at===103)await s.copyDiscountCode(w);else if(r.at===110){let _=await s.createNewCart(e,w,i.triggerData);_&&(location.href=_);return}try{w&&await Mn.applyWithStorefront([w])}catch(_){x.error(_),v=!0}let b;if(g?.length&&(b=await s.addToCart(g,i.triggerData)),v&&w){Mn.navigate(w,o,p);return}if(p){location.href=p;return}Mn.navigateWithoutDiscount(o,b)}sendTriggerClicked(t,e,r){let n=new Bt(H.EVENT_TRIGGER_CLICKED,e,this.triggerContext.triggerData);n.items=t,r?.id&&(n.videos=[r.id]),this.eventAPIService.sendSilently(n)}async getOrGenerateDiscountCode(t){let e=this.triggerContext.triggerData.discount;if(!e?.type)return;let r="";if(e.type===ye.STATIC){if(!e.code)throw Gt.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(t){if(r=await this.generateDiscount(t),!r)throw x.error("No discount code found",t),new Error("Discount code not found or generated");return r}}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw Qe("Failed to generate a discount code"),Gt.getInstance().captureError(e,"backend-generate-discount",{extra:{discountData:JSON.stringify(t)},triggerContext:this.triggerContext}),e}}},se=class extends yr{stylesConverter=new Fp(1);renderer=Zi.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new lc(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),T(T(ct(T(T(T(T(T(T({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(t){if(!t?.op)return!0;let{lhs:e,rhs:r}=t;switch(t.op){case"eq":return e===r;case"gt":return+e>+r;case"gte":return+e>=+r;case"lt":return+e<+r;case"lte":return+e<=+r;case"ne":return e!==r;case"null":return e==null;case"empty":return e.trim()==="";case"in":return new RegExp(`\\b${r}\\b`).test(e);case"nin":return!new RegExp(`\\b${r}\\b`).test(e);default:return x.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){let t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle=T(T({},this.mediaStyle),t.style.sm))}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t,e){t.stopPropagation(),!e.clickAction&&(e.clickAction=this.props.element.clc),await this.clickExecutor.execute(e)}},H0=0,_E=Array.isArray;function z(t,e,r,n,i,s){e||(e={});var o,c,l=e;if("ref"in l)for(c in l={},e)c=="ref"?o=e[c]:l[c]=e[c];var p={type:t,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--H0,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(c in o)l[c]===void 0&&(l[c]=o[c]);return ft.vnode&&ft.vnode(p),p}var si=class extends se{componentDidMount(){this.setState(()=>({text:this.props.element.text})),Ye(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){let t=this.getCompiledStyles(),e=this.state.text;return e||(t.display="none",e=""),z("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:z("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData,cart:t.getCartMagicVariables()},r=Ve.render(JSON.stringify(this.props.element),e),n=new Ae(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ge;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return T({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},Zp=class extends si{render(){return z("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:t=>this.onClick(t,{item:this.props.item}),children:z("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return ct(T({},super.getComponentStyles()),{cursor:"pointer"})}},V0=class extends yr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?z("div",{style:T(T({},this.getElementStyle()),this.props.styles),children:[z("span",{children:this.props.time}),z("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):z("div",{style:T(T({},this.getElementStyle()),this.props.styles),children:[z("span",{style:this.getTimeLabelStyle(),children:this.props.label}),z("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}},q0=class extends si{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>T({},this.labels)),this.processAndStartTimer()}render(){return z("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(t=>z(V0,{styles:this.getCompiledStyles(),label:t,time:this.state[t],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return T(T({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState(()=>T({},this.labels))})}},W0=class extends se{componentDidMount(){Ye(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return z("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:z("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){let{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ge;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return ct(T({},this.getTypoStyles()),{display:"flex"})}},uc=class extends se{constructor(t,e){super(t,e)}render(){let t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return z("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(t){this.props.element.clc?.at===Pu.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(t,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let t=this.mediaStyle.lout;if(!t||t.pos!=="absolute")return{};let e={zIndex:t.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){let e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},hc=class extends se{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return z("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:z(pc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let t=this.mediaStyle.flex??new ip,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return t.wrap==="nowrap"&&t.scroll&&(t.dir==="column"?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}},G0=class extends hc{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return z("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:z(td,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},z0=class extends se{render(){return z("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){Ye(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ge;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),T(T({},t),this.getTypoStyles())}createSelectItems(){let t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(z("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(let r of e.sellingPlans??[])t.push(z("option",{value:r.mID,selected:r.isSelected,children:r.name}));return t}onChange(t){let e=t.target.value;e?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===e):this.props.selectedVariant.selectedSellingPlan.value=void 0}},K0=class extends se{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),Ve.escape=Ou.escapeHtml}render(){let t=this.getCompiledStyles(),e=this.getRating();return e||(t.display="none",e=""),z("div",{style:t,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:e}})}getRating(){let t=this.props.element.fullStar,e=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};t=Ve.render(t,{svg:r}),e=Ve.render(e,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=t;else{let s=5,o=`${n.rating}`.split(".");for(let c=0;c<+o[0];c++)i+=t,s--;o[1]&&(i+=e,s--);for(let c=0;c<s;c++)i+=t.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},Y0=class extends se{render(){return z("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){Ye(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new Ge;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(t.visibility="hidden"),T(T({},t),this.getTypoStyles())}createSelectItems(){let t=[];for(let e of this.props.item.vars)t.push(z("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){let e=t.target.value,r=this.props.item.vars.find(n=>n.mID===e);this.props.item.setSelectedVariant(r)}},td=class extends se{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}renderElement(t){if(!(t.hide||!this.matchWhenCondition(t.when))){if(t.t===4){let e=t;return z(G0,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===6)return this.props.triggerContext.triggerData.isBundle()?z(W0,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(t.t===13){let e=t,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;e.lg=e.sm={src:n,name:r.name,secondarySrc:i};let s=z(uc,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:z("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(t.t===14)return this.renderProductTitle(t);if(t.t===15){let e=t;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:e.showChips?z("cooee-product-options-picker",{item:this.props.item,element:e}):z(Y0,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===16?z(z0,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===19?z(K0,{element:t,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):t.t===18||t.t===3?z(Zp,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):z(pc,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}renderProductTitle(t){let e=z(si,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:z("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},ed=class extends se{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=Ve.render(t,this.getProductData());try{this.productElement=new Fa(JSON.parse(e))}catch(r){throw Gt.getInstance().captureError(r,"variable-replacement",{extra:{before:t,after:e},triggerContext:this.props.triggerContext}),r}if(!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return z("div",{style:T({},this.getCompiledStyles()),class:"lc-single-product",children:z(td,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let t=this.props.item,e=t.selectedOrFirstVariant.value,r=t.getTemplateVariables();r.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let n=this.props.triggerContext.triggerData.discount.type===ye.BXGY;return!e.hasEffectivePrice()&&n&&(r.product.effective_price=he(e.effectivePrice.value),r.product.price=""),r.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity,{product:r.product,variant:r.variant,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function rd(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)=>`
|
|
62
|
+
`,cc=class{sentryService=ut.get(zt);async addToCart(t,e){if(!t.length)return;let r=t.map(c=>{let{vID:l,quantity:p}=this.getVIDAndQuantity(c);return{id:l?+l:+c.mID,quantity:p,properties:e.getPrivateAttributesForLineItem()}}),n=Mn("cart/add.js"),i={items:r},s=Se.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let o=JSON.stringify(i);try{let c=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(c.status===200||c.status===302)return x.log(`Added ${t.length} items to Cart`),Ze("Product added to your cart"),c.json()}catch(c){Ze("Failed to add product in cart. Please try again"),this.sentryService.captureError(c,"cart-item-add",{extra:{body:o},engagementTrigger:e})}}async updateLineItem(t,e){if(!zn.hasKeys(e)){x.warn("No update fields provided");return}let r=Mn("cart/change.js"),n=T({id:t.key},e),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});if(s.status===200||s.status===302){let o=await s.json();x.log(`Updated ${t}`),xt.getCurrent().update(o)}}catch(s){Ze("Failed to update item in cart"),this.sentryService.captureError(s,"cart-item-update",{extra:{body:i}})}}async copyDiscountCode(t){if(t)try{await navigator.clipboard.writeText(t),x.log(`Code-${t} copied`),Ze("Discount code copied")}catch(e){x.error("Failed to copy code",e)}}goToItem(t){if(!t?.link)return;let e=Hb(t.link);e&&(location.pathname=qi()+"products/"+e)}async upgradeToSubscription(t,e){if(!t){x.warn("Trying to upgrade to subscription with no item");return}let r=await xt.getCurrent().getNormalisedCart(),n=t.selectedOrFirstVariant.value,i=r.items.findIndex(p=>p.vID===n.mID),s=n.selectedSellingPlan.value,o=Mn("cart/change.js"),c={line:i+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},l=JSON.stringify(c);try{let p=await fetch(o,{body:l,method:"post",headers:{"Content-Type":"application/json"}});if(p.status===200||p.status===302){x.log(`Upgraded ${t} selling plan`),Ze("Line item updated");let g=await p.json();return xt.getCurrent().update(g),g}}catch(p){Ze("Failed to update subscription"),this.sentryService.captureError(p,"cart-switch-subscription",{extra:{body:l},engagementTrigger:e})}}async createNewCart(t,e,r){let n=se.get().storefrontToken;if(!n)throw new Error("Storefront token not set for the store");if(!t?.vID){x.error("No variant ID found to perform Buy now",t);return}let i=e?[e]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:r.getKVFormatPrivateAttributesForLineItem()}],o=await Nh(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",n);let l=JSON.stringify({query:C0,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await kr.getInstance().request(H.GRAPHQL_API_PATH,{method:"POST",headers:c,body:l})).data?.cartCreate?.cart?.checkoutUrl}async process(t){let e=t.clickAction,r=t.items,n=t.triggerData;if(e.at){let i=e;if(x.log(`Performing ${JSON.stringify(i)} action`),i.at===101)r?.length&&this.goToItem(r[0]);else if(i.at===102)r?.length&&await this.addToCart(r,n);else if(i.at===103)await this.copyDiscountCode(n.discount.code);else if(i.at===105)Se.get().open();else if(i.at===104){let s=t.collections;if(!s?.length)return;location.pathname=qi()+"collections/"+s[0].handle}}e.applyDiscount&&n.discount?.code&&Un.navigate(n.discount.code,n.redirectBehaviour)}getVIDAndQuantity(t){let e,r;if(t instanceof nn)e=t.vID,r=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,r=1}return{vID:e,quantity:r}}},T0=class{static updateIdentity(t){if(!this.isInstalled())return;let e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),x.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},x0=class{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=Vt.getInstance(),this.triggerContext=e}async execute(){let t=this.containsCTA()?H.EVENT_TRIGGER_CLICKED:H.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&await this.closeTriggerAndSendEvent(t),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:await this.collectFormData();break;case void 0:case 105:break;default:x.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let t=this.action.gu.u;xh(t)||(t=`//${t}`),window.open(t,"_self")}}async closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),await this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){x.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(t=>console.log(t)).catch(t=>console.error(t))}}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return t?Object.keys(t).length===0:!0}async collectFormData(){let t={};for(let e of this.triggerContext.inputs){if(!e.isValid)return;let r=document.getElementById(e.id).value;e.type===51?t.email=r:e.type===52&&(t.mobile=r)}await this.closeTriggerAndSendEvent(H.EVENT_FORM_SUBMITTED,{form:t}),Ze("Coupon applied on cart"),T0.updateIdentity(t)}async dispatchEvent(){let t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};await new cc().process(e);let r={action:this.containsCTA()?H.CAMPAIGN_CLICKED_ACTIVITY:H.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(H.POPUP_ACTIVITY_EVENT,{detail:r}))}},si=class{renderer=lc.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,r){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=r,this.stylesConverter=new Hp(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let t=lt(T(T(T(T({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});ts(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&X(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&X(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};ts(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let t=this.inappElement.alpha;if(!isNaN(t)){let e=(t/100).toFixed(2);X(this.inappHTMLEl,"opacity",e)}}processShadow(){let t=this.inappElement.shd;t?X(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):X(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let t=new Fu(this.inappElement.trf);t&&t.rotate&&X(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){let t=this.inappElement.clc;!t||Object.keys(t).length===0||(this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation(),new x0(t,this.triggerContext).execute()}),X(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},Ss=class extends si{constructor(t,e,r){super(t,e,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=H.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),ts(this.inappHTMLEl,t),t}processPart(t,e){let r=[];e.u&&r.push("underline"),e.st&&r.push("line-through"),r.length||r.push("normal"),X(t,"font-weight",e.b?"bold":"normal"),X(t,"font-style",e.i?"italic":"normal"),X(t,"text-decoration",r.join(" ")),X(t,"color",e.c??"inherit"),X(t,"font-family","inherit")}processAlignment(){let t=this.inappElement.typography.ta,e=t?ha[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),X(this.inappHTMLEl,"text-align",e)}},D0=class extends Ss{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(t=>{let e=document.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.inappHTMLEl.appendChild(e)}),this.processCommonBlocks()}},A0=class extends si{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},qp=class extends si{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),X(this.inappHTMLEl,"max-width","none"),X(this.inappHTMLEl,"max-height","none"),X(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}},N0=class Wp extends si{constructor(e,r,n){super(e,r,n),this.parent=e,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(H.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),X(this.inappHTMLEl,"z-index",Wp.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let e=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(X(this.inappHTMLEl,"width","100%"),X(this.inappHTMLEl,"height","100%")):(X(this.inappHTMLEl,"width","100vw"),X(this.inappHTMLEl,"height","100vh")),X(this.inappHTMLEl,"top","0"),X(this.inappHTMLEl,"left","0");else{let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(e.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(e.h)+r.getVertical();X(this.inappHTMLEl,"width",n+"px"),X(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return T(T({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded()){X(this.inappHTMLEl,"position","block");return}X(this.inappHTMLEl,"position","absolute")}else X(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}},O0=class extends si{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),X(this.inappHTMLEl,"position","relative"),X(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(H.IN_APP_CONTAINER_NAME),this}},k0=class Re extends Ss{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=lt(T(T(T({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=>ts(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(Re.DAYS)),e.hour&&this.elements.push(this.getChild(Re.HOURS)),e.minute&&this.elements.push(this.getChild(Re.MINUTES)),e.second&&this.elements.push(this.getChild(Re.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}`,X(i,"font-size","0.5em"),X(i,"text-align","center"),X(i,"font-family","inherit"),X(n,"text-align","center"),X(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),X(r,"display","flex"),X(r,"flex-direction",this.inappElement.horizontal?"":"column"),X(r,"justify-content","center"),X(r,"align-items","center"),X(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-${Re.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Re.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Re.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Re.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}},P0=class extends Ss{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){X(this.inappHTMLEl,"background","#ffffff00"),X(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",e=>{e.stopPropagation()}),t.addEventListener("change",()=>{let e=new hs(JSON.parse(t.value));this.updateItems(e)})}updateItems(t){let e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=t.imgs[0]??e.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length){e.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach(n=>{e.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(t,e,r){let n=document.createElement("option");return n.text=t,n.value=JSON.stringify(e),r&&(n.selected=!0),e||(n.disabled=!0),n}},Gp=class extends Ss{borderColor="";constructor(t,e,r){super(t,e,r),this.inappHTMLEl=document.createElement("input"),this.insertElement()}render(){let t=this.setInputType();this.inappHTMLEl.setAttribute("placeholder",this.inappElement.placeholderText),X(this.inappHTMLEl,"background","#ffffff00"),X(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}},R0=class zp extends Gp{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(zp.EMAIL_REGEX)?(X(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(X(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},L0=class Kp extends Gp{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(Kp.MOBILE_REGEX)?(X(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(X(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},M0=class extends qp{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},lc=class Le{static DOCUMENT_STANDARD_MODE="CSS1Compat";static ACTIVE_TRIGGER_DATA;static _instance;safeHTTP;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){Le._instance=this,this.safeHTTP=Vt.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}static get(){return Le._instance}render(e){this.renderEngagement(new xr(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,s=e.spc,o=this.getWidth(),c=this.getHeight();r&&(o=o?Math.min(o,r):r,c=c?Math.min(c,r):r),c&&(o-=s.getHorizontal(),c-=s.getVertical(),o/c<n/i?this.scalingFactor=o/n:this.scalingFactor=c/i,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.parent&&this.isParentNotBody()&&X(this.parent,"position","relative")}isParentNotBody(){return this.parent!==document.body}getWidth(){return this.parent&&this.parent!==document.body?this.parent.clientWidth:document.compatMode===Le.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===Le.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){if(this.triggerContext=new $p(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(Wr()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!Se.get().isOpen()||!Wr()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=Se.get().onToggle().subscribe(({open:e})=>{!e&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){Le.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){zt.getInstance().captureError(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),Wr()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&Le.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Ka(Le.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(kt.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=H.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new N0(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw x.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new jt(H.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:H.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(H.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new jt(r,e,this.triggerContext.triggerData);n.name===H.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof np?new R0(e,r,n).render():r instanceof ip?new L0(e,r,n).render():r instanceof Fo?new D0(e,r,n).render():r instanceof sp?new M0(e,r,n).render():r instanceof ja?new qp(e,r,n).render():r instanceof Zh?new A0(e,r,n).render():r instanceof ep?new k0(e,r,n).render():r instanceof rp?new P0(e,r,n).render():x.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new O0(this.rootContainer,r,e).render().getHTMLElement(),new w0().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),Le.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 jt(H.EVENT_CAMPAIGN_REJECTED,r,e);this.safeHTTP.sendEvent(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}},U0=class{triggerData;safeHttpService=Vt.getInstance();render(t){t.contentSource===aa.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let e=t.detail;if(e.formId!==this.triggerData.klaviyoFormID){x.warn("Received invalid trigger callback");return}switch(e.type){case"open":this.safeHttpService.sendEvent(new jt(H.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(e);this.safeHttpService.sendEvent(new jt(H.EVENT_FORM_SUBMITTED,{form:r},this.triggerData)),this.safeHttpService.updateProfile(r);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new jt(H.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData));break}}getFormDetails(t){let e={id:t.formId},r=t.metaData;if(zn.hasKeys(r)){let n=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(r).forEach(o=>{n.includes(o)||(e[o]=r[o])}),e.email=r.$email??r.email,e.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(e.name=i+" "+s)}return e}},B0=class{static trackIntent(t){if(!this.isInstalled()){x.log("Facebook pixel not installed");return}if(!se.get().pixelPush){x.log("Facebook pixel push not enabled");return}let e=ds[t.intent]?.toLowerCase(),r=t.segmentName;!e&&!r||(x.debug(`Sending ${e} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},Yp=class{static itemMap=new Map;static async refreshItems(t){for(let i of t.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(i,t)}catch(s){x.error(s)}if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let i=(await xt.getCurrent().getNormalisedCart()).items.map(s=>s.mID);t.items=t.items.filter(s=>!i.includes(s.mID))}if(se.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await this.refreshVideoItems(t.content.videoConfig,t),t.items;let e=t.items.length,r=t.items.map(i=>this.updatedItem(i,t)),n=(await Promise.all(r)).filter(i=>i!=null);if(e&&!n.length){let i="Failed to fetch any product from Ajax API",s=new jt(H.EVENT_CAMPAIGN_FAILED,{reason:i,currency:t.currency},t);throw Vt.getInstance().sendEvent(s),new Error(i)}if(t.isCartRecovery()){let i=xt.getCurrent().items,s=[];for(let o of n)for(let c of o.vars){if(!c.isAvailable)continue;let l=i.find(h=>h.variant_id.toString()===c.mID);if(!l)continue;let p=new Ve(o);p.name=l.title;let g=new hs(c);g.name=l.variant_title,g.price.d=l.discounted_price/100,p.variants=[g],s.push(p)}return s}return n}static async refreshVideoItems(t,e){await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>await this.updatedItem(n,e)||n))}))}static async updatedItem(t,e){if(this.itemMap.has(t.mID))return this.itemMap.get(t.mID);let r=t,n=zt.getInstance(),i=ut.get(kr),s,o=`/products/${r.slug}.js`;try{s=await i.request(o)}catch(l){return n.captureError(l,"fetch-shopify-product",{extra:{item:r,path:o},engagementTrigger:e}),null}if(!s)return x.error("Item not found after AJAX call for:",r),null;r.name=s.title,r.tags=s.tags;let c=r.selectedOrFirstVariant.value;return r.vars.map(l=>{let p=s.variants.find(g=>g.id===+l.mID);l.name=p.title,l.isAvailable=p.available,l.price.d=p.price?p.price/100:p.price,l.price.effective=l.price.d,l.price.cmp=p.compare_at_price?p.compare_at_price/100:p.compare_at_price,+c.mID===p.id&&(c.effectivePrice.value=l.price.d)}),this.itemMap.set(r.mID,r),r}},uc=class Jp{static INSTANCE;httpService=ut.get(kr);sentryService=ut.get(zt);sessionManager=ut.get(_e);runtime=kt.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Jp),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>x.error(`Failed to send ${e.name}`,r))}async send(e){if(x.debug(`Sending event ${e.name}`),Oe.log(`Sending event ${e.name} with id ${e.id}`),this.shouldReject(e)){x.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==H.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),e.locale=this.runtime.locale,this.httpService.post("/v1/event/track",e).then(async r=>{x.log("\u2705 Event tracked:",e.name),Oe.log(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{x.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(x.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=Es.parseFromCurrent()}async addShopifyContext(e){try{e.cart=await xt.getCurrent().getNormalisedCart()}catch(r){x.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{this.sentryService.captureError(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){x.log(`Nothing to engage after ${e.name}`);return}x.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData),Oe.log(`\u{1F4E3} Campaign #${r.triggerData.shortID}) will be shown`);let n=new xr(r.triggerData);n.occurred=e.occurred;let i;try{i=await Yp.refreshItems(n)}catch(s){x.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===aa.KLAVIYO){new U0().render(n);return}new lc().renderEngagement(n).catch(s=>{this.sentryService.captureError(s,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(jp.trackIntent(e.intent),B0.trackIntent(e),Oe.log(`Intent is <strong>${ds[e.intent]}</strong>`))}addShopifyAttributes(){xt.getCurrent().addCooeeAttributes().catch(e=>{x.error("Fail to add attributes in cart",e)})}},Vt=class Xp{static INSTANCE;httpApiService=kr.getInstance();eventAPIService=uc.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Xp),this.INSTANCE}sendEvent(e){x.debug(`Waiting for auth to send event ${e.name}`),_e.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){_e.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){_e.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){_e.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}},Oe=class{static isOn=!1;static element;static logs=[];static watch(){let t=ku();(t==="1"||t==="on")&&Vt.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),t==="on"?sessionStorage.cooeeDebug="1":t==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar(),this.log(`Cooee SDK v${H.SDK_VERSION} loaded`))}static log(t){this.isOn&&(this.logs.unshift({time:new Date,message:t}),this.element&&(this.element.logs=[...this.logs]))}static renderDebugBar(){this.element=document.createElement("cooee-debugger"),this.element.logs=this.logs,Da(()=>{document.body.appendChild(this.element)})}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},xu=class extends xa{static storeName="app";static{this.storage=Ta(this.storeName)}},j0=class{static processConfiguration(){let t=se.get();!t.gaMeasurementID||!t.gaEnabled||this.sendClientID()}static async sendClientID(){let t=await this.getClientID();t&&Vt.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){let t=await Mt.get(ct.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Mt.set(ct.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){let t=se.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},$0=class Qp{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Qp),this.INSTANCE}init(){xu.get(ct.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){x.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);xu.set(ct.APP_CONFIG,r).catch(n=>x.error(n)),j0.processConfiguration(),r.website&&(we.injectRawScript(r.website.commonJS),we.injectRawCSS(r.website.commonCSS)),Se.get().onToggle().subscribe(async({open:n})=>{x.info("Cart drawer is now",n?"open":"closed"),n&&(ut.get(Gn).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Et.globalRef.config.update(e);return Se.forceUpdate(),x.debug("App configurations",r),r}async trackViewCartEvent(){let e=await xt.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};Vt.getInstance().sendEvent(new jt(H.EVENT_VIEW_CART,n))}},ra=class Zp{static INSTANCE;httpAPIService=kr.getInstance();coreService=$0.getInstance();sentryService=zt.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Zp),this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Mt.set(ct.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Mt.set(ct.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Mt.set(ct.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),x.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);x.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw x.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Mt.get(ct.SDK_TOKEN),!this.sdkToken){x.warn("No SDK token found in local storage");return}this.userID=await Mt.get(ct.ID),this.deviceID=await Mt.get(ct.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){x.debug("SDK Token:",this.sdkToken),x.log("Device ID:",this.deviceID),x.log("User ID:",this.userID),jp.trackDeviceID(this.deviceID),Oe.log(`Device ID: ${this.deviceID}`),this.userID&&Oe.log(`User ID: ${this.userID}`),this.httpAPIService.setAPIToken(this.sdkToken),this.httpAPIService.setDeviceId(this.deviceID),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(e){let r=await new b0().safeGet(),n=await Mt.get(ct.DEVICE_ID);return n||(n=new Kt().toHexString(),await Mt.set(ct.DEVICE_ID,n)),lt(T({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:H.SDK,page:Es.parseFromCurrent(),ad:g0.getAdParams(),occurred:this.getSessionStartTime(kt.get().jsLoadTime),currentItem:kt.get().getCurrentItem(),cart:await xt.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Mt.get(ct.FIRST_SEEN),r=e?new Date(e):new Date;e||await Mt.set(ct.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>H.IDLE_TIME_IN_SECONDS?new Date:e}},_e=class Rn{static replaySubject=new A_(1);static INSTANCE;sentryService=ut.get(zt);constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Rn),this.INSTANCE}init(e){if(x.debug("Initialising SDK",e),d0(navigator.userAgent)){x.info("This seems to be a bot. Disabling SDK");return}ra.getInstance().init(e),Rn.INSTANCE.checkSessionOnPageLoad().then(async()=>{Rn.replaySubject.next(!0),Rn.replaySubject.complete()}).catch(r=>{x.error("Unable to initiate session",r)})}getCurrentSessionID(){return ee.set(ct.SESSION_LAST_USED_TIME,new Date().getTime()),ee.get(ct.ID,"")}async checkSessionOnPageLoad(){await qb.request("validate_session",async()=>{await this.checkForNewSession(!0)})}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let e=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setTags({"cooee_session.number":e[1]}),this.sentryService.setGlobalContext("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){let r=!1;if(await this.isNewSessionRequired()?(Oe.log("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();Oe.log(`Session ID: ${n[0]} & number: ${n[1]}`),await ra.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await ee.set(ct.SESSION_SYNCED,!0)}}async startNewSession(){x.debug("Starting new session"),await ee.clear(),x.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Kt().toHexString();x.debug("New session ID to be used",r);let n=await Mt.get(ct.SESSION_NUMBER,0)+1;await Promise.all([Mt.set(ct.SESSION_NUMBER,n),ee.set(ct.ID,r),ee.set(ct.SESSION_LAST_USED_TIME,e.getTime()),ee.set(ct.SESSION_LANDING_PAGE,Es.parseFromCurrent())])}getLandingPage(){return ee.get(ct.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Mt.get(ct.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await ee.get(ct.ID))return!0;let e=await ee.get(ct.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>H.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await ee.get(ct.SESSION_SYNCED,!1)}},F0=ke(rn()),H0=ke(rn()),hc=class{constructor(t){this.triggerContext=t}safeHTTP=Vt.getInstance();eventAPIService=uc.getInstance();async execute(t){let e=kt.get().getCurrentItem(),r=t.clickAction;if(!r)return;let n=t.item,i=this.triggerContext,s=new cc,o=i.triggerData.redirectBehaviour,c=!!i.triggerData.discount.type&&!!r?.applyDiscount,l={selectedVariants:i.triggerData.nonMutableItems.map(_=>({itemMID:_.mID,mID:_.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},p="",g=[],h=[];if(n?h=[n.toEmbed()]:t.embeddedItem&&(h=[t.embeddedItem]),r.at===108){let _=i.selectedItems;if(h=t.embeddedItems??_.map(k=>k.toEmbed()),i.shouldGiveFBTDiscount||t.embeddedItems?.length){let k;t.embeddedItems?k=t.embeddedItems.map(B=>({itemMID:B.mID,mID:B.vID,quantity:B.quantity})):k=_.map(B=>({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID}));let A=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&A&&(k.push({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,isPrimary:!0}),h.unshift(A.toEmbed())),l.selectedVariants=k,i.triggerData.isBundleOnPDP()&&l.selectedVariants.forEach(B=>{B.mID===e.vID&&(B.isPrimary=!0)})}else l=void 0;g=t.embeddedItems??_}else if(r.at===107){let _=await xt.getCurrent().getNormalisedCart();h=_.items,l.selectedVariants=_.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(r.at===102)g=n?[n]:[t.embeddedItem];else if(r.at===101)p=n?qi()+"products/"+n.slug:t.embeddedItem?.link;else if(r.at===4){let _=xh(r.gu?.u);_&&(p=_.href)}else if(r.at===109){let _=await s.upgradeToSubscription(n,i.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Se.get().refreshUI(_)}else if(r.at===104){let _=this.triggerContext.triggerData.collections?.[0];_&&(p="collections/"+_.handle)}if(this.sendTriggerClicked(h,{from:"button"},t.video),x.debug({redirectPath:p,redirectBehaviour:o,hasDiscount:c}),!c&&p){location.href=p;return}let w,v=!1;try{w=await this.getOrGenerateDiscountCode(l),x.debug("Discount code (if any) to apply",w)}catch(_){if(!this.triggerContext.triggerData.isBYOB()){H0.default.error("Unable to get a discount code",_);return}}if(w&&r.at===103)await s.copyDiscountCode(w);else if(r.at===110){let _=await s.createNewCart(e,w,i.triggerData);_&&(location.href=_);return}try{w&&await Un.applyWithStorefront([w])}catch(_){x.error(_),v=!0}let b;if(g?.length&&(b=await s.addToCart(g,i.triggerData)),v&&w){Un.navigate(w,o,p);return}if(p){location.href=p;return}Un.navigateWithoutDiscount(o,b)}sendTriggerClicked(t,e,r){let n=new jt(H.EVENT_TRIGGER_CLICKED,e,this.triggerContext.triggerData);n.items=t,r?.id&&(n.videos=[r.id]),this.eventAPIService.sendSilently(n)}async getOrGenerateDiscountCode(t){let e=this.triggerContext.triggerData.discount;if(!e?.type)return;let r="";if(e.type===ve.STATIC){if(!e.code)throw zt.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(t){if(r=await this.generateDiscount(t),!r)throw x.error("No discount code found",t),new Error("Discount code not found or generated");return r}}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw Ze("Failed to generate a discount code"),zt.getInstance().captureError(e,"backend-generate-discount",{extra:{discountData:JSON.stringify(t)},triggerContext:this.triggerContext}),e}}},oe=class extends vr{stylesConverter=new Hp(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=Wr()?"sm":"lg",this.clickExecutor=new hc(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),T(T(lt(T(T(T(T(T(T({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(t){if(!t?.op)return!0;let{lhs:e,rhs:r}=t;switch(t.op){case"eq":return e===r;case"gt":return+e>+r;case"gte":return+e>=+r;case"lt":return+e<+r;case"lte":return+e<=+r;case"ne":return e!==r;case"null":return e==null;case"empty":return e.trim()==="";case"in":return new RegExp(`\\b${r}\\b`).test(e);case"nin":return!new RegExp(`\\b${r}\\b`).test(e);default:return x.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){let t=this.props.element;this.mediaStyle=t.style.lg,Wr()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle=T(T({},this.mediaStyle),t.style.sm))}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t,e){t.stopPropagation(),!e.clickAction&&(e.clickAction=this.props.element.clc),await this.clickExecutor.execute(e)}},V0=0,EE=Array.isArray;function z(t,e,r,n,i,s){e||(e={});var o,c,l=e;if("ref"in l)for(c in l={},e)c=="ref"?o=e[c]:l[c]=e[c];var p={type:t,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--V0,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(c in o)l[c]===void 0&&(l[c]=o[c]);return gt.vnode&>.vnode(p),p}var oi=class extends oe{componentDidMount(){this.setState(()=>({text:this.props.element.text})),Je(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){let t=this.getCompiledStyles(),e=this.state.text;return e||(t.display="none",e=""),z("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:z("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData,cart:t.getCartMagicVariables()},r=qe.render(JSON.stringify(this.props.element),e),n=new Ne(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let t={},e=this.mediaStyle.typo??new ze;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return T({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},td=class extends oi{render(){return z("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:t=>this.onClick(t,{item:this.props.item}),children:z("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return lt(T({},super.getComponentStyles()),{cursor:"pointer"})}},q0=class extends vr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?z("div",{style:T(T({},this.getElementStyle()),this.props.styles),children:[z("span",{children:this.props.time}),z("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):z("div",{style:T(T({},this.getElementStyle()),this.props.styles),children:[z("span",{style:this.getTimeLabelStyle(),children:this.props.label}),z("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}},W0=class extends oi{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>T({},this.labels)),this.processAndStartTimer()}render(){return z("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(t=>z(q0,{styles:this.getCompiledStyles(),label:t,time:this.state[t],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return T(T({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState(()=>T({},this.labels))})}};function ed(t,e){if(!t)return;let r=new window.CooeeSDK.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
|
|
63
63
|
<span class="${i}"
|
|
64
64
|
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
65
65
|
`,renderProgressbar:n=>`
|
|
66
66
|
<span class="${n}"
|
|
67
67
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
68
68
|
</span>
|
|
69
|
-
`},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 nd(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),z("div",{class:"swiper-container",ref:e,children:[z("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&z("div",{class:"swiper-button-next",style:n,children:z("span",{})}),t.navigation.enabled&&z("div",{class:"swiper-button-prev",style:n,children:z("span",{})}),t.pagination.enabled&&z("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var J0=class extends se{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=this.renderer.isMobile()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&be.loadSwiperScript().then(()=>{this.swiperInstance=rd(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.triggerContext.triggerData.items;t.splice(this.configuration.maxItems??10);let e;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>t?.map(i=>z("div",{class:"swiper-slide",children:this.getProductFragment(i)}));e=z("div",{style:ct(T({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:nd(this.configuration,r,n)})}else e=z("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map((r,n)=>this.getProductFragment(r,n!==t.length-1))});return e}getComponentStyles(){let t=[0,2].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(e.flexDirection==="row"){if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${i}, auto)`}}return e}getProductFragment(t,e=!1){return z(sn,{children:[z(ed,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&z("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:z(si,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},X0=class extends se{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){be.loadSwiperScript().then(()=>{this.swiperInstance=rd(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.element,e=n=>{this.swiperRef=n},r=()=>t.values?.map(n=>z("div",{class:"swiper-slide",onClick:i=>this.onClick(i,{clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return nd(t.conf,e,r)}getComponentStyles(){return{}}renderElement(t){let e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case 1:return z(uc,{element:e,triggerContext:this.props.triggerContext});case 4:return z(hc,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:x.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){let r=JSON.stringify(t),n=Ve.render(r,{form:e});return Jr.getParsedElement(JSON.parse(n))}getClickAction(t){let e=T({},this.props.element.clc),r=JSON.stringify(e),n=Ve.render(r,{form:t});return JSON.parse(n)}},pc=class extends se{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),Ye(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(t){if(!t.hide){if(t.t===4){let e=t;return z(hc,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===61)return z(q0,{element:t,triggerContext:this.props.triggerContext});if(t.t===3)return this.state.showButton?z(Zp,{element:t,triggerContext:this.props.triggerContext}):void 0;if(t.t===2)return z(si,{element:t,triggerContext:this.props.triggerContext});if(t.t===1)return z(uc,{element:t,triggerContext:this.props.triggerContext});if(t.t===11)return z(J0,{element:t,triggerContext:this.props.triggerContext});if(t.t===12)return z(ed,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(t.t===62)return z(X0,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},Q0=class extends se{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){Ye(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return z(sn,{children:[z("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:t=>{this.onClick(t,{clickAction:this.clickAction})},children:z(pc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&z("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t,e){if(this.isClickable)return super.onClick(t,e)}},qe=class Br{constructor(e){this.engagementTrigger=e,this.triggerContext=new Bp(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=Ot.get();widgetAPIService=lt.get(Wn);eventAPIService=lt.get(cc);sentryService=lt.get(Gt);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>{this.sentryService.captureError(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){x.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),Br.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){x.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),!this.shouldStopRendering()&&(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}update(e){$0.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}afterRootContainerCreated(){}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){x.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(x.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new He(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new He(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new He(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&Gn.hasKeys(e.props)&&(this.engagementTrigger.props=T(T({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new hp(e.content)),this.triggerContext.triggerData.widget=this.widget=new up(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(){Br.renderedEngagements.push(this)}async getVariation(){x.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(e)}catch(r){x.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){x.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((s,o)=>{s.forEach(async c=>{if(c.isIntersecting){x.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=Qi(window,"scroll").pipe(ni(Br.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(Br.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?H.EVENT_CAMPAIGN_HOLDOUT:H.EVENT_TRIGGER_DISPLAYED,i=new Bt(n,r,this.engagementTrigger);i.name===H.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.eventAPIService.sendSilently(i),Br.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=Tt.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 lc(this.triggerContext).execute(n.detail)}),this.rootContainer.appendChild(r),this.addToRendered(),r}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,n=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=n/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return x.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(H.SHADOW_SPLITTER)){let l=n.split(H.SHADOW_SPLITTER),p=ie.get().website.commonCSS;i=(await ji(l[0].trim()))?.shadowRoot,n=l[1].trim(),i&&(be.injectRawCSS(p,i),be.injectStylesheet(We.styleURL,i))}x.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await ji(n,10,i??document);if(!s)return x.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),c=this.getParentElement(o);if(!e)return c;switch(r.position){case Tn.BEFORE:{s.parentElement?.insertBefore(c,s);break}case Tn.INSIDE_FIRST:{s.insertBefore(c,s.firstChild);break}case Tn.INSIDE_LAST:{s.appendChild(c);break}case Tn.AFTER:default:s.parentElement?.insertBefore(c,s.nextSibling)}return c}async startRendering(){Ne.log(`Campaign #${this.engagementTrigger.shortID} will be rendered`);let e;try{e=await Kp.refreshItems(this.engagementTrigger)}catch(r){x.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){x.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),s=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${s} lc-${i}`,n.dataset.engagementId=s,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=ie.get().website.commonCSS;be.injectRawCSS(n,r),be.injectStylesheet(We.styleURL,r),be.injectSwiperCSS(r),e=r}cb(Lh(Q0,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let s of i)xn.remove(r,s)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},wr=class id extends qe{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){id.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!Ee.get().isOpen()&&this.runtimeData.pageName!=="cart"){x.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},Z0=class sd{constructor(e,r){this.engagementTrigger=e,this.element=r,this.cartItems=Tt.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){x.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){x.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new sd(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(g=>g.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(g=>g.mID===e.id.toString());if(!n)return;let i=new us(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let g of i.sellingPlans??[])g.mID===s.id.toString()&&(g.isSelected=!0,i.changeSellingPlan(g));let o=new He(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(c);let l=new Tr(this.engagementTrigger);l.placement.selector=`.${c}`,l.items=[o];let p=new wr(l);p.renderSilently(),this.watchForCartItemDeletion(p,c)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(x.debug(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}},tE=class extends wr{ctaExecutor=new ac;constructor(t){super(t)}update(t){super.update(t),this.engagementTrigger.progressBarConfig.update(t.progressBarConfig),this.checkMilestoneSilently(),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneSilently()}checkMilestoneSilently(){this.checkMilestone().catch(t=>{Gt.getInstance().captureError(t,"apply-milestones",{engagementTrigger:this.engagementTrigger})})}async checkMilestone(){let t=await Tt.getCurrent().getNormalisedCart(),e=this.engagementTrigger.progressBarConfig,r,n=[],i=[],s=[],o,c,l=[...e.milestones];for(let g of l){if(g.rewardType!==Lu.FREE_AUTO_GIFT)continue;let h=g.items[0],w=g.reached,v=t.items.find(b=>(b.vID===h.vID||b.mID===h.mID)&&b.properties[H.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);w&&(o=g,c=v),v&&n.push(v),!w&&v&&e.removeIneligibleItem?(x.debug(`Removing free gift ${v.vID} from cart`),s.push(v)):w&&!v&&(x.debug(`Adding free gift ${h.vID} to cart`),i.push(h))}e.restrictToLatestFreebie&&o&&(c?(n=n.filter(g=>g.vID!==c.vID),i=[]):i=[o.items[0]],s.push(...n)),s.length&&await this.removeFreeGifts(s),i.length&&(r=await this.ctaExecutor.addToCart(i,this.engagementTrigger));let p=e.coupons;if(p?.length)try{await Mn.applyWithStorefront(p.map(g=>g.couponCode)),Ee.get().refreshUI(r,!1)}catch(g){this.sentryService.captureError(g,"cart-apply-discount",{extra:{coupons:p},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(t){await Promise.all(t.map(e=>this.ctaExecutor.updateLineItem(e,{quantity:0})))}},Tu=class extends wr{constructor(t){super(t)}update(t){super.update(t),this.engagementTrigger.content.update(t.content),this.widgetElement.update()}addToRendered(){this.engagementTrigger.isPageEmbed()?qe.renderedEngagements.push(this):wr.renderedEngagements.push(this)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}},eE=class extends qe{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-shoppable-videos")}},rE=class extends qe{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}},nE=class extends qe{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){let t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(H.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){let e=this.engagementTrigger,r=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,n=t.detail;if(!Gn.hasKeys(n)){x.error(`No detail received for ${r}`);return}x.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==e.shortID&&i!==e.engagementID){x.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(c=>new en({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new lc(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},po=class{runtimeData=Ot.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;let e=[...wr.renderedEngagements];wr.renderedEngagements.length=0;for(let r of t)x.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,e)&&(x.log(`${r} is new`),r.isProgressBar()?new tE(r).renderSilently():r.isSubscriptionUpsell()?Z0.renderCartUpsell(r):r.isSavingsBar()?new Tu(r).renderSilently():new wr(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...qe.renderedEngagements];qe.renderedEngagements.length=0;for(let r of t)x.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,e)&&(x.log(`${r} is new`),r.isShoppableVideo()?new eE(r).renderSilently():r.isBYOB()?new nE(r).renderSilently():r.isStickyATC()?new rE(r).renderSilently():r.isSavingsBar()?new Tu(r).renderSilently():new qe(r).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){let r=e.findIndex(n=>n.isSameTrigger(t));return r<0||t.isSubscriptionUpsell()?!1:(e[r].update(t),e[r].renderSilently(),e.splice(r,1),!0)}removeOldWidgets(t){for(let e of t)e.destroy()}},od=class{runtimeData=Ot.get();httpService=lt.get(Or);sessionManager=lt.get(we);constructor(){}async getWidgetProps(){let t={};t.engagementIDs=this.addAvailableEngagementShortIDs(),t.locale=this.runtimeData.locale,await this.addSessionContext(t),t.currentItem=this.runtimeData.getCurrentItem();try{t.cart=await Tt.getCurrent().getNormalisedCart()}catch(i){x.error("Error fetching Shopify cart before sending widget call",i)}let e=new URLSearchParams(location.search),r=e.get("cooee-preview");r?t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)):this.runtimeData.previewIDs?.length&&(t.previewIDs=this.runtimeData.previewIDs);let n=e.get("cooee-variant");return n?t.previewVariant=n:this.runtimeData.previewVariant&&(t.previewVariant=this.runtimeData.previewVariant),t}async addSessionContext(t){let e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=_s.parseFromCurrent()}addAvailableEngagementShortIDs(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}},Wn=class ad extends od{static INSTANCE;loadWidgetsSubject=new sr;constructor(){super(),this.loadWidgetsSubject.pipe(ni(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>x.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>x.error("Unable to initiate page widgets",e))}),oc.get().subscriber(H.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new ad),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>x.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>x.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){we.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();x.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Tr(i));new po().processPageWidgetResponse(n)}).catch(r=>{x.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();x.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Tr(i));new po().processCartWidgetResponse(n)}).catch(r=>{x.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",T(T({},e),r))}renderCachedCartWidgets(){new po().processCartWidgetResponse(this.runtimeData.cartEngagements)}},iE=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=lt.get(dc)}execute(t){for(let e of t)e.experimentConfig&&(this.executeExperiment(e),this.trackExperimentRan(e));if(document.querySelector("#lc-hide-body")?.remove(),!document.body){lt.get(Gt).captureMessage("No body element found","error");return}this.setupMutationObserver()}async executeExperiment(t){let e=t.experimentConfig?.modifications;if(!e?.length){x.log("Nothing to experiment",t.toString());return}for(let r of e){if(!r.cssSelector){x.debug("No CSS Selector available",t?.toString());continue}this.modifications.push(r);let n=Array.from(document.querySelectorAll(r.cssSelector));this.executeSingleModification(r,n)}}executeSingleModification(t,e){if(e?.length)for(let r of e)Object.assign(r.style,t.style),t.type==="TEXT"&&t.text&&(r.innerHTML=t.text)}trackExperimentRan(t){if(t.id==="preview"){x.warn("Skipping experiment attribution as its preview",t.toString());return}this.eventAPIService.trackExperiment({name:H.EVENT_EXPERIMENT_START,experiment:new za(t)}).catch(e=>{x.error("Fail to track experiment",e)})}setupMutationObserver(){new MutationObserver(t=>{t.forEach(e=>{e.addedNodes.forEach(r=>{r instanceof HTMLElement&&this.modifications.forEach(n=>{r.matches&&r.matches(n.cssSelector)?(x.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,[r])):r.querySelectorAll&&(x.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,Array.from(r.querySelectorAll(n.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}},dc=class cd extends od{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new cd),this.INSTANCE}loadExperimentSilently(){Lt.get(at.SDK_TOKEN).then(e=>{e?this.loadExperiments().catch(r=>x.error("Unable to initiate experiment",r)):we.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>x.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let e=await this.getWidgetProps();x.log("Load experiments",e),this.httpService.post("/v1/engagement/experiments",e).then(async r=>{let n=r.experiments.map(i=>new Tr(i));new iE().execute(n)}).catch(r=>{x.error("Error sending experiment getter",r)})}async trackExperiment(e){await this.addSessionContext(e),await this.httpService.post("/v1/event/experiment",e)}},sE=class{runtimeData=Ot.get();widgetAPIService=lt.get(Wn);experimentAPIService=lt.get(dc);meddle(){let t=_t.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let t=_t.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},t.previewWidget=_t.previewWidget.bind(_t),t.previewPopup=_t.previewPopup.bind(_t)}overwritePush(t,e){An(t,"push",e)}meddleAccount(){this.overwritePush(_t.globalRef.account,(...t)=>{this.processAccount(t[0])}),_t.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(_t.globalRef.events,(...t)=>{this.processEvent(t[0])}),_t.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(_t.globalRef.profile,(...t)=>{this.processProfile(t[0])}),_t.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(_t.globalRef.screen,(...t)=>{this.processPageName(t[0])}),_t.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&_t.authenticate(t),t.flags&&ta.setFlags(t.flags))}processEvent(t){t&&(H.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?_t.sendEvent(t[0],t[1],T({occurred:this.runtimeData.jsLoadTime},t[2])):_t.sendEvent(t[0],t[1],t[2]))}processProfile(t){t&&_t.updateProfile(t)}processPageName(t){t&&_t.setPageName(t)}meddlePage(){this.overwritePush(_t.globalRef.page,(...t)=>{this.processPage(t[0])}),_t.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.locale&&(this.runtimeData.locale=t.locale),t.pageName&&_t.setPageName(t.pageName),t.activeExperiment&&(this.runtimeData.activeExperiment=t.activeExperiment)}},fo=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=H.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}},go=class Pi{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=lt.get(Ht);lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Pi),this.INSTANCE}resetScrollID(e){fo.remove(H.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}xa(()=>{this.observeWindowScroll()})}observeWindowScroll(){Qi(window,"scroll").pipe(ni(Pi.DEBOUNCE_TIME),nc(()=>{let e=this.getPercentScrolledY();if(e>100){x.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)>=Pi.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=fo.getString(H.SESSION_STORAGE_SCROLL_ID,""),i=new Bt(H.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),fo.setString(H.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}},oE=class ld{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=lt.get(Ht);runtimeData=Ot.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){x.info("Not sending background event as user was inactive on website");return}x.info(`Sending background event with ${e} seconds`);let r={};r[ld.ACTIVE_DURATION]=e,this.apiService.sendEvent(new Bt(H.EVENT_APP_BACKGROUND,r))}},aE=class{compareCartItemSubject=new sr;constructor(){this.compareCartItemSubject.pipe(ni(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){t.performEvent(this._url).catch(r=>x.error("Unable to process cart change in XMLHttpRequest",r))}),e.apply(this,arguments)},x.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=function(r){return e.apply(window,arguments).then(n=>(t.performEvent(r.toString()).catch(i=>x.error("Unable to process cart change in fetch",i)),n))},x.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(Ot.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){let r=t?.items,n=e.items,i=[],s=[];if(x.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let c=r?.find(l=>l.vID===o.vID);if(c){if(c.quantity!==o.quantity){let l=c.quantity<o.quantity,p=Math.abs(c.quantity-o.quantity),g=ct(T({},o),{quantity:p});l?i.push(g):s.push(g)}r&&Qv(r,c)}else i.push(o)}),r)for(let o of r)s.push(o);x.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(H.EVENT_ADD_TO_CART,{items:i}),s.length&&t.token===e.token&&this.sendEvent(H.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&oc.get().broadcast(H.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(t,e){let r=new Bt(t,e);lt.get(Ht).sendEvent(r)}async compareCartItems(){let t=await Lt.get(at.CURRENT_CART,{}),e=await Tt.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}},cE=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=async function(r,n){try{await t.modifyRequest(r,n)}catch(i){Gt.getInstance().captureError(i,"modify-graphql-request",{extra:{body:JSON.stringify(n?.body)}})}return e(r,n)},x.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;x.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(t){let e=t.variables.input.attributes??[],r=await Dh();return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}sendBuyNowEvent(){let t=Ot.get().getCurrentItem();if(!t)return;let e=new Bt(H.EVENT_BUY_NOW_CLICKED,{items:[t]});Ht.getInstance().sendEvent(e)}},ud=class{constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=t=>{let e=t.currentTarget,r=new Bt(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});Ht.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(t=>x.error(t))}async listen(){this.elements=await xh(this.selectorString),this.elements.forEach(t=>{t.addEventListener("click",this.clickListenerCallback)})}removeClickListener(t){this.elements?.forEach(e=>{e.removeEventListener("click",t)})}},lE=class ra extends ud{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(ra.selectors,H.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new ra),this.INSTANCE}},uE=class na extends ud{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(na.selectors,H.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new na),this.INSTANCE}},hE=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(){xa(()=>{x.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let t=window.location.hash?.substring(1);if(t)if(t.includes(H.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(H.THIRD_PARTY_CHECKOUT_EVENT));let e=document.querySelector(this.selector);if(!e){x.debug("No clickable cart checkout button found");return}x.debug("Clickable cart checkout button found",e),e.click()}else t.includes(H.HASH_OPEN_CART_DRAWER)&&Ee.get().open()}},xu=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await Tt.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new Bt(H.EVENT_CHECKOUT_STARTED,e);Ht.getInstance().sendEvent(r)})}},pE=class{async migrate(){}};Ve.escape=Ou.escapeHtml;var _t=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new pE().migrate(),this.autoAuthenticate(),new sE().meddle(),lt.get(dc).loadExperimentSilently(),new oE().listen(),new aE().listen(),new cE().listen(),new hE().listen(),lt.get(go).listen(),lt.get(uE).listenSilently(),lt.get(lE).listenSilently(),lt.get(Wn).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Ne.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||An(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,An(this.globalRef,"config",new ie),An(this.globalRef,"runtimeData",new Ot),An(this.globalRef,"uaParser",new ze),x.debug("Global reference initialised")}static injectWidgetAssets(){be.injectScriptURL(We.widgetURL,"cooee-widget-sdk"),be.injectStylesheet(We.styleURL)}static autoAuthenticate(){let t=$b();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;let e=t.appID?.trim(),r=t.shopifyShop;if((El(e)||e.length!==24)&&El(r)){x.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,lt.get(we).init(t)}static sendEvent(t,e,r){let n=new Bt(t,e,r?.triggerData);r?.occurred&&(n.occurred=r.occurred),lt.get(Ht).sendEvent(n)}static updateProfile(t){for(let e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");lt.get(Ht).updateProfile(t)}static setPageName(t){if(!t)return;let e=Ot.get(),r=e.pageName;if(t===r)return;if(e.pageName=t,t==="cart"&<.get(Wn).loadOrRenderWidgetsAfterCartChange(),H.BLACKLISTED_PAGE_NAMES.some(s=>t.includes(s))){lt.get(go).resetScrollID();return}let n={};r&&(n.ps=r);let i=new Bt(H.EVENT_SCREEN_VIEW,n);i.occurred=e.jsLoadTime,lt.get(Ht).sendEvent(i),lt.get(go).resetScrollID(i.occurred)}static previewPopup(t,e){new zp(e).render(t)}static previewWidget(t){new qe(new Tr(t)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){x.error(t)}window.addEventListener("message",t=>{if(x.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}static attachGoKwikListeners(){let t=Ot.get();window.addEventListener("kp-modal:opened",()=>{t.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",e=>{let{token:r}=e.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?xu.attachCheckoutListener():window.addEventListener("gokwikLoaded",xu.attachCheckoutListener)}static storePreviewParams(){let t=Ot.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");r&&(t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=e.get("cooee-variant");n&&(t.previewVariant=n)}};df();ff();x.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(x.debug("Execution order:","IIFE start"),await _t.initForMerchantWebsiteOnly(),await _t.initForAll(),x.debug("Execution order:","IIFE end")))());x.debug("Execution order:","bottom");})();
|
|
69
|
+
`},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 rd(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),z("div",{class:"swiper-container",ref:e,children:[z("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&z("div",{class:"swiper-button-next",style:n,children:z("span",{})}),t.navigation.enabled&&z("div",{class:"swiper-button-prev",style:n,children:z("span",{})}),t.pagination.enabled&&z("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var G0=class extends oe{componentDidMount(){Je(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return z("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:z("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){let{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){let t={},e=this.mediaStyle.typo??new ze;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return lt(T({},this.getTypoStyles()),{display:"flex"})}},pc=class extends oe{constructor(t,e){super(t,e)}render(){let t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return z("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(t){this.props.element.clc?.at===Lu.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(t,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let t=this.mediaStyle.lout;if(!t||t.pos!=="absolute")return{};let e={zIndex:t.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){let e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},dc=class extends oe{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return z("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:z(fc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let t=this.mediaStyle.flex??new op,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return t.wrap==="nowrap"&&t.scroll&&(t.dir==="column"?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}},z0=class extends dc{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return z("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:z(nd,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},K0=class extends oe{render(){return z("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){Je(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new ze;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),T(T({},t),this.getTypoStyles())}createSelectItems(){let t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(z("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(let r of e.sellingPlans??[])t.push(z("option",{value:r.mID,selected:r.isSelected,children:r.name}));return t}onChange(t){let e=t.target.value;e?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===e):this.props.selectedVariant.selectedSellingPlan.value=void 0}},Y0=class extends oe{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),qe.escape=Pu.escapeHtml}render(){let t=this.getCompiledStyles(),e=this.getRating();return e||(t.display="none",e=""),z("div",{style:t,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:e}})}getRating(){let t=this.props.element.fullStar,e=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};t=qe.render(t,{svg:r}),e=qe.render(e,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=t;else{let s=5,o=`${n.rating}`.split(".");for(let c=0;c<+o[0];c++)i+=t,s--;o[1]&&(i+=e,s--);for(let c=0;c<s;c++)i+=t.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},J0=class extends oe{render(){return z("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){Je(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new ze;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(t.visibility="hidden"),T(T({},t),this.getTypoStyles())}createSelectItems(){let t=[];for(let e of this.props.item.vars)t.push(z("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){let e=t.target.value,r=this.props.item.vars.find(n=>n.mID===e);this.props.item.setSelectedVariant(r)}},nd=class extends oe{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}renderElement(t){if(!(t.hide||!this.matchWhenCondition(t.when))){if(t.t===4){let e=t;return e.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:z(z0,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===6)return this.props.triggerContext.triggerData.isBundle()?z(G0,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(t.t===13){let e=t,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;e.lg=e.sm={src:n,name:r.name,secondarySrc:i};let s=z(pc,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:z("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(t.t===14)return this.renderProductTitle(t);if(t.t===15){let e=t;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:e.showChips?z("cooee-product-options-picker",{item:this.props.item,element:e}):z(J0,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===16?z(K0,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===19?z(Y0,{element:t,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):t.t===18||t.t===3?z(td,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):z(fc,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}renderProductTitle(t){let e=z(oi,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:z("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},id=class extends oe{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=qe.render(t,this.getProductData());try{this.productElement=new Ha(JSON.parse(e))}catch(r){throw zt.getInstance().captureError(r,"variable-replacement",{extra:{before:t,after:e},triggerContext:this.props.triggerContext}),r}if(!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return z("div",{style:T({},this.getCompiledStyles()),class:"lc-single-product",children:z(nd,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let t=this.props.item,e=t.selectedOrFirstVariant.value,r=t.getTemplateVariables();r.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let n=this.props.triggerContext.triggerData.discount.type===ve.BXGY;return!e.hasEffectivePrice()&&n&&(r.product.effective_price=pe(e.effectivePrice.value),r.product.price=""),r.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity,{product:r.product,variant:r.variant,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}},X0=class extends oe{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=Wr()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&we.loadSwiperScript().then(()=>{this.swiperInstance=ed(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.triggerContext.triggerData.items;t.splice(this.configuration.maxItems??10);let e;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>t?.map(i=>z("div",{class:"swiper-slide",children:this.getProductFragment(i)}));e=z("div",{style:lt(T({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:rd(this.configuration,r,n)})}else e=z("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map((r,n)=>this.getProductFragment(r,n!==t.length-1))});return e}getComponentStyles(){let t=[0,2].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(e.flexDirection==="row"){if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${i}, auto)`}}return e}getProductFragment(t,e=!1){return z(an,{children:[z(id,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&z("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:z(oi,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},Q0=class extends oe{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){we.loadSwiperScript().then(()=>{this.swiperInstance=ed(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.element,e=n=>{this.swiperRef=n},r=()=>t.values?.map(n=>z("div",{class:"swiper-slide",onClick:i=>this.onClick(i,{clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return rd(t.conf,e,r)}getComponentStyles(){return{}}renderElement(t){let e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case 1:return z(pc,{element:e,triggerContext:this.props.triggerContext});case 4:return z(dc,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:x.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){let r=JSON.stringify(t),n=qe.render(r,{form:e});return Qr.getParsedElement(JSON.parse(n))}getClickAction(t){let e=T({},this.props.element.clc),r=JSON.stringify(e),n=qe.render(r,{form:t});return JSON.parse(n)}},fc=class extends oe{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),Je(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(t){if(!t.hide){if(t.t===4){let e=t;return z(dc,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===61)return z(W0,{element:t,triggerContext:this.props.triggerContext});if(t.t===3)return this.state.showButton?z(td,{element:t,triggerContext:this.props.triggerContext}):void 0;if(t.t===2)return z(oi,{element:t,triggerContext:this.props.triggerContext});if(t.t===1)return z(pc,{element:t,triggerContext:this.props.triggerContext});if(t.t===11)return z(X0,{element:t,triggerContext:this.props.triggerContext});if(t.t===12)return z(id,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(t.t===62)return z(Q0,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},Z0=class extends oe{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){Je(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return z(an,{children:[z("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:t=>{this.onClick(t,{clickAction:this.clickAction})},children:z(fc,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&z("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t,e){if(this.isClickable)return super.onClick(t,e)}},We=class jr{constructor(e){this.engagementTrigger=e,this.triggerContext=new $p(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=kt.get();widgetAPIService=ut.get(Gn);eventAPIService=ut.get(uc);sentryService=ut.get(zt);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>{this.sentryService.captureError(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){x.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),jr.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){x.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),!this.shouldStopRendering()&&(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}update(e){F0.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}afterRootContainerCreated(){}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){x.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(x.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Ve(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Ve(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Ve(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&zn.hasKeys(e.props)&&(this.engagementTrigger.props=T(T({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new dp(e.content)),this.triggerContext.triggerData.widget=this.widget=new pp(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(){jr.renderedEngagements.push(this)}async getVariation(){x.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(e)}catch(r){x.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){x.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((s,o)=>{s.forEach(async c=>{if(c.isIntersecting){x.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=Zi(window,"scroll").pipe(ii(jr.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(jr.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?H.EVENT_CAMPAIGN_HOLDOUT:H.EVENT_TRIGGER_DISPLAYED,i=new jt(n,r,this.engagementTrigger);i.name===H.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.eventAPIService.sendSilently(i),jr.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=xt.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),r.addEventListener("cooeeEvent",n=>{let i=n.detail;this.eventAPIService.sendSilently(i)}),r.addEventListener("cooeeCTA",n=>{new hc(this.triggerContext).execute(n.detail)}),this.rootContainer.appendChild(r),this.addToRendered(),r}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,n=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=n/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return x.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(H.SHADOW_SPLITTER)){let l=n.split(H.SHADOW_SPLITTER),p=se.get().website.commonCSS;i=(await $i(l[0].trim()))?.shadowRoot,n=l[1].trim(),i&&(we.injectRawCSS(p,i),we.injectStylesheet(Ge.styleURL,i))}x.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await $i(n,10,i??document);if(!s)return x.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),c=this.getParentElement(o);if(!e)return c;switch(r.position){case Dn.BEFORE:{s.parentElement?.insertBefore(c,s);break}case Dn.INSIDE_FIRST:{s.insertBefore(c,s.firstChild);break}case Dn.INSIDE_LAST:{s.appendChild(c);break}case Dn.AFTER:default:s.parentElement?.insertBefore(c,s.nextSibling)}return c}async startRendering(){Oe.log(`Campaign #${this.engagementTrigger.shortID} will be rendered`);let e;try{e=await Yp.refreshItems(this.engagementTrigger)}catch(r){x.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){x.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),s=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${s} lc-${i}`,n.dataset.engagementId=s,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=se.get().website.commonCSS;we.injectRawCSS(n,r),we.injectStylesheet(Ge.styleURL,r),we.injectSwiperCSS(r),e=r}lb(Uh(Z0,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let s of i)An.remove(r,s)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},_r=class sd extends We{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){sd.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!Se.get().isOpen()&&this.runtimeData.pageName!=="cart"){x.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},tE=class od{constructor(e,r){this.engagementTrigger=e,this.element=r,this.cartItems=xt.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){x.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){x.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new od(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(g=>g.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(g=>g.mID===e.id.toString());if(!n)return;let i=new hs(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let g of i.sellingPlans??[])g.mID===s.id.toString()&&(g.isSelected=!0,i.changeSellingPlan(g));let o=new Ve(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(c);let l=new xr(this.engagementTrigger);l.placement.selector=`.${c}`,l.items=[o];let p=new _r(l);p.renderSilently(),this.watchForCartItemDeletion(p,c)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(x.debug(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}},eE=class extends _r{ctaExecutor=new cc;constructor(t){super(t)}update(t){super.update(t),this.engagementTrigger.progressBarConfig.update(t.progressBarConfig),this.checkMilestoneSilently(),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneSilently()}checkMilestoneSilently(){this.checkMilestone().catch(t=>{zt.getInstance().captureError(t,"apply-milestones",{engagementTrigger:this.engagementTrigger})})}async checkMilestone(){let t=await xt.getCurrent().getNormalisedCart(),e=this.engagementTrigger.progressBarConfig,r,n=[],i=[],s=[],o,c,l=[...e.milestones];for(let g of l){if(g.rewardType!==Uu.FREE_AUTO_GIFT)continue;let h=g.items[0],w=g.reached,v=t.items.find(b=>(b.vID===h.vID||b.mID===h.mID)&&b.properties[H.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);w&&(o=g,c=v),v&&n.push(v),!w&&v&&e.removeIneligibleItem?(x.debug(`Removing free gift ${v.vID} from cart`),s.push(v)):w&&!v&&(x.debug(`Adding free gift ${h.vID} to cart`),i.push(h))}e.restrictToLatestFreebie&&o&&(c?(n=n.filter(g=>g.vID!==c.vID),i=[]):i=[o.items[0]],s.push(...n)),s.length&&await this.removeFreeGifts(s),i.length&&(r=await this.ctaExecutor.addToCart(i,this.engagementTrigger));let p=e.coupons;if(p?.length)try{await Un.applyWithStorefront(p.map(g=>g.couponCode)),Se.get().refreshUI(r,!1)}catch(g){this.sentryService.captureError(g,"cart-apply-discount",{extra:{coupons:p},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(t){await Promise.all(t.map(e=>this.ctaExecutor.updateLineItem(e,{quantity:0})))}},Du=class extends _r{constructor(t){super(t)}update(t){super.update(t),this.engagementTrigger.content.update(t.content),this.widgetElement.update()}addToRendered(){this.engagementTrigger.isPageEmbed()?We.renderedEngagements.push(this):_r.renderedEngagements.push(this)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}},rE=class extends We{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-shoppable-videos")}},nE=class extends We{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}},iE=class extends We{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){let t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(H.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){let e=this.engagementTrigger,r=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,n=t.detail;if(!zn.hasKeys(n)){x.error(`No detail received for ${r}`);return}x.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==e.shortID&&i!==e.engagementID){x.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(c=>new nn({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new hc(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},fo=class{runtimeData=kt.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;let e=[..._r.renderedEngagements];_r.renderedEngagements.length=0;for(let r of t)x.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,e)&&(x.log(`${r} is new`),r.isProgressBar()?new eE(r).renderSilently():r.isSubscriptionUpsell()?tE.renderCartUpsell(r):r.isSavingsBar()?new Du(r).renderSilently():new _r(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...We.renderedEngagements];We.renderedEngagements.length=0;for(let r of t)x.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,e)&&(x.log(`${r} is new`),r.isShoppableVideo()?new rE(r).renderSilently():r.isBYOB()?new iE(r).renderSilently():r.isStickyATC()?new nE(r).renderSilently():r.isSavingsBar()?new Du(r).renderSilently():new We(r).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){let r=e.findIndex(n=>n.isSameTrigger(t));return r<0||t.isSubscriptionUpsell()?!1:(e[r].update(t),e[r].renderSilently(),e.splice(r,1),!0)}removeOldWidgets(t){for(let e of t)e.destroy()}},ad=class{runtimeData=kt.get();httpService=ut.get(kr);sessionManager=ut.get(_e);constructor(){}async getWidgetProps(){let t={};t.engagementIDs=this.addAvailableEngagementShortIDs(),t.locale=this.runtimeData.locale,await this.addSessionContext(t),t.currentItem=this.runtimeData.getCurrentItem();try{t.cart=await xt.getCurrent().getNormalisedCart()}catch(i){x.error("Error fetching Shopify cart before sending widget call",i)}let e=new URLSearchParams(location.search),r=e.get("cooee-preview");r?t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)):this.runtimeData.previewIDs?.length&&(t.previewIDs=this.runtimeData.previewIDs);let n=e.get("cooee-variant");return n?t.previewVariant=n:this.runtimeData.previewVariant&&(t.previewVariant=this.runtimeData.previewVariant),t}async addSessionContext(t){let e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=Es.parseFromCurrent()}addAvailableEngagementShortIDs(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}},Gn=class cd extends ad{static INSTANCE;loadWidgetsSubject=new or;constructor(){super(),this.loadWidgetsSubject.pipe(ii(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>x.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>x.error("Unable to initiate page widgets",e))}),ac.get().subscriber(H.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new cd),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){_e.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>x.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){_e.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>x.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){_e.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();x.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new xr(i));new fo().processPageWidgetResponse(n)}).catch(r=>{x.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();x.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new xr(i));new fo().processCartWidgetResponse(n)}).catch(r=>{x.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",T(T({},e),r))}renderCachedCartWidgets(){new fo().processCartWidgetResponse(this.runtimeData.cartEngagements)}},sE=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=ut.get(gc)}execute(t){for(let e of t)e.experimentConfig&&(this.executeExperiment(e),this.trackExperimentRan(e));if(document.querySelector("#lc-hide-body")?.remove(),!document.body){ut.get(zt).captureMessage("No body element found","error");return}this.setupMutationObserver()}async executeExperiment(t){let e=t.experimentConfig?.modifications;if(!e?.length){x.log("Nothing to experiment",t.toString());return}for(let r of e){if(!r.cssSelector){x.debug("No CSS Selector available",t?.toString());continue}this.modifications.push(r);let n=Array.from(document.querySelectorAll(r.cssSelector));this.executeSingleModification(r,n)}}executeSingleModification(t,e){if(e?.length)for(let r of e)Object.assign(r.style,t.style),t.type==="TEXT"&&t.text&&(r.innerHTML=t.text)}trackExperimentRan(t){if(t.id==="preview"){x.warn("Skipping experiment attribution as its preview",t.toString());return}this.eventAPIService.trackExperiment({name:H.EVENT_EXPERIMENT_START,experiment:new Ka(t)}).catch(e=>{x.error("Fail to track experiment",e)})}setupMutationObserver(){new MutationObserver(t=>{t.forEach(e=>{e.addedNodes.forEach(r=>{r instanceof HTMLElement&&this.modifications.forEach(n=>{r.matches&&r.matches(n.cssSelector)?(x.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,[r])):r.querySelectorAll&&(x.debug("Re-applying experiment",n.toString()),this.executeSingleModification(n,Array.from(r.querySelectorAll(n.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}},gc=class ld extends ad{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new ld),this.INSTANCE}loadExperimentSilently(){Mt.get(ct.SDK_TOKEN).then(e=>{e?this.loadExperiments().catch(r=>x.error("Unable to initiate experiment",r)):_e.replaySubject.subscribe(async()=>{this.loadExperiments().catch(r=>x.error("Unable to initiate experiment",r))})})}async loadExperiments(){if(!this.runtimeData.activeExperiment)return;let e=await this.getWidgetProps();x.log("Load experiments",e),this.httpService.post("/v1/engagement/experiments",e).then(async r=>{let n=r.experiments.map(i=>new xr(i));new sE().execute(n)}).catch(r=>{x.error("Error sending experiment getter",r)})}async trackExperiment(e){await this.addSessionContext(e),await this.httpService.post("/v1/event/experiment",e)}},oE=class{runtimeData=kt.get();widgetAPIService=ut.get(Gn);experimentAPIService=ut.get(gc);meddle(){let t=Et.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let t=Et.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.loadExperiments=()=>{this.experimentAPIService.loadExperimentSilently()},t.previewWidget=Et.previewWidget.bind(Et),t.previewPopup=Et.previewPopup.bind(Et)}overwritePush(t,e){On(t,"push",e)}meddleAccount(){this.overwritePush(Et.globalRef.account,(...t)=>{this.processAccount(t[0])}),Et.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Et.globalRef.events,(...t)=>{this.processEvent(t[0])}),Et.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Et.globalRef.profile,(...t)=>{this.processProfile(t[0])}),Et.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(Et.globalRef.screen,(...t)=>{this.processPageName(t[0])}),Et.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&Et.authenticate(t),t.flags&&ea.setFlags(t.flags))}processEvent(t){t&&(H.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?Et.sendEvent(t[0],t[1],T({occurred:this.runtimeData.jsLoadTime},t[2])):Et.sendEvent(t[0],t[1],t[2]))}processProfile(t){t&&Et.updateProfile(t)}processPageName(t){t&&Et.setPageName(t)}meddlePage(){this.overwritePush(Et.globalRef.page,(...t)=>{this.processPage(t[0])}),Et.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.locale&&(this.runtimeData.locale=t.locale),t.pageName&&Et.setPageName(t.pageName),t.activeExperiment&&(this.runtimeData.activeExperiment=t.activeExperiment)}},go=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=H.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}},mo=class Ri{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=ut.get(Vt);lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ri),this.INSTANCE}resetScrollID(e){go.remove(H.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}Da(()=>{this.observeWindowScroll()})}observeWindowScroll(){Zi(window,"scroll").pipe(ii(Ri.DEBOUNCE_TIME),ic(()=>{let e=this.getPercentScrolledY();if(e>100){x.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)>=Ri.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=go.getString(H.SESSION_STORAGE_SCROLL_ID,""),i=new jt(H.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),go.setString(H.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}},aE=class ud{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=ut.get(Vt);runtimeData=kt.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){x.info("Not sending background event as user was inactive on website");return}x.info(`Sending background event with ${e} seconds`);let r={};r[ud.ACTIVE_DURATION]=e,this.apiService.sendEvent(new jt(H.EVENT_APP_BACKGROUND,r))}},cE=class{compareCartItemSubject=new or;constructor(){this.compareCartItemSubject.pipe(ii(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){t.performEvent(this._url).catch(r=>x.error("Unable to process cart change in XMLHttpRequest",r))}),e.apply(this,arguments)},x.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=function(r){return e.apply(window,arguments).then(n=>(t.performEvent(r.toString()).catch(i=>x.error("Unable to process cart change in fetch",i)),n))},x.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(kt.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){let r=t?.items,n=e.items,i=[],s=[];if(x.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let c=r?.find(l=>l.vID===o.vID);if(c){if(c.quantity!==o.quantity){let l=c.quantity<o.quantity,p=Math.abs(c.quantity-o.quantity),g=lt(T({},o),{quantity:p});l?i.push(g):s.push(g)}r&&Zv(r,c)}else i.push(o)}),r)for(let o of r)s.push(o);x.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(H.EVENT_ADD_TO_CART,{items:i}),s.length&&t.token===e.token&&this.sendEvent(H.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&ac.get().broadcast(H.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(t,e){let r=new jt(t,e);ut.get(Vt).sendEvent(r)}async compareCartItems(){let t=await Mt.get(ct.CURRENT_CART,{}),e=await xt.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}},lE=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=async function(r,n){try{await t.modifyRequest(r,n)}catch(i){zt.getInstance().captureError(i,"modify-graphql-request",{extra:{body:JSON.stringify(n?.body)}})}return e(r,n)},x.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;x.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(t){let e=t.variables.input.attributes??[],r=await Nh();return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}sendBuyNowEvent(){let t=kt.get().getCurrentItem();if(!t)return;let e=new jt(H.EVENT_BUY_NOW_CLICKED,{items:[t]});Vt.getInstance().sendEvent(e)}},hd=class{constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=t=>{let e=t.currentTarget,r=new jt(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});Vt.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(t=>x.error(t))}async listen(){this.elements=await Ah(this.selectorString),this.elements.forEach(t=>{t.addEventListener("click",this.clickListenerCallback)})}removeClickListener(t){this.elements?.forEach(e=>{e.removeEventListener("click",t)})}},uE=class na extends hd{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(na.selectors,H.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new na),this.INSTANCE}},hE=class ia extends hd{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(ia.selectors,H.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new ia),this.INSTANCE}},pE=class{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){Da(()=>{x.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let t=window.location.hash?.substring(1);if(t)if(t.includes(H.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(H.THIRD_PARTY_CHECKOUT_EVENT));let e=document.querySelector(this.selector);if(!e){x.debug("No clickable cart checkout button found");return}x.debug("Clickable cart checkout button found",e),e.click()}else t.includes(H.HASH_OPEN_CART_DRAWER)&&Se.get().open()}},Au=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await xt.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new jt(H.EVENT_CHECKOUT_STARTED,e);Vt.getInstance().sendEvent(r)})}},dE=class{async migrate(){}};qe.escape=Pu.escapeHtml;var Et=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new dE().migrate(),this.autoAuthenticate(),new oE().meddle(),ut.get(gc).loadExperimentSilently(),new aE().listen(),new cE().listen(),new lE().listen(),new pE().listen(),ut.get(mo).listen(),ut.get(hE).listenSilently(),ut.get(uE).listenSilently(),ut.get(Gn).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Oe.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||On(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,On(this.globalRef,"config",new se),On(this.globalRef,"runtimeData",new kt),On(this.globalRef,"uaParser",new Ke),x.debug("Global reference initialised")}static injectWidgetAssets(){we.injectScriptURL(Ge.widgetURL,"cooee-widget-sdk"),we.injectStylesheet(Ge.styleURL)}static autoAuthenticate(){let t=Fb();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;let e=t.appID?.trim(),r=t.shopifyShop;if((Il(e)||e.length!==24)&&Il(r)){x.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,ut.get(_e).init(t)}static sendEvent(t,e,r){let n=new jt(t,e,r?.triggerData);r?.occurred&&(n.occurred=r.occurred),ut.get(Vt).sendEvent(n)}static updateProfile(t){for(let e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");ut.get(Vt).updateProfile(t)}static setPageName(t){if(!t)return;let e=kt.get(),r=e.pageName;if(t===r)return;if(e.pageName=t,t==="cart"&&ut.get(Gn).loadOrRenderWidgetsAfterCartChange(),H.BLACKLISTED_PAGE_NAMES.some(s=>t.includes(s))){ut.get(mo).resetScrollID();return}let n={};r&&(n.ps=r);let i=new jt(H.EVENT_SCREEN_VIEW,n);i.occurred=e.jsLoadTime,ut.get(Vt).sendEvent(i),ut.get(mo).resetScrollID(i.occurred)}static previewPopup(t,e){new lc(e).render(t)}static previewWidget(t){new We(new xr(t)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){x.error(t)}window.addEventListener("message",t=>{if(x.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}static attachGoKwikListeners(){let t=kt.get();window.addEventListener("kp-modal:opened",()=>{t.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",e=>{let{token:r}=e.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?Au.attachCheckoutListener():window.addEventListener("gokwikLoaded",Au.attachCheckoutListener)}static storePreviewParams(){let t=kt.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");r&&(t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=e.get("cooee-variant");n&&(t.previewVariant=n)}};ff();gf();x.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(x.debug("Execution order:","IIFE start"),await Et.initForMerchantWebsiteOnly(),await Et.initForAll(),x.debug("Execution order:","IIFE end")))());x.debug("Execution order:","bottom");})();
|