cap-hydra-web-sdk 1.0.9 → 1.1.0
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/README.md +0 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).WebSDK=n()}(this,function(){"use strict";var t="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{},n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),e="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function c(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var n={next:function(){var n=t.shift();return{done:void 0===n,value:n}}};return r&&(n[Symbol.iterator]=function(){return n}),n}function h(t){this.map={},t instanceof h?t.forEach(function(t,n){this.append(n,t)},this):Array.isArray(t)?t.forEach(function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(n){this.append(n,t[n])},this)}function d(t){if(!t.t)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function v(t){return new Promise(function(n,r){t.onload=function(){n(t.result)},t.onerror=function(){r(t.error)}})}function l(t){var n=new FileReader,r=v(n);return n.readAsArrayBuffer(t),r}function g(t){if(t.slice)return t.slice(0);var n=new Uint8Array(t.byteLength);return n.set(new Uint8Array(t)),n.buffer}function w(){return this.bodyUsed=!1,this.i=function(t){var r;this.bodyUsed=this.bodyUsed,this.u=t,t?"string"==typeof t?this.o=t:i&&Blob.prototype.isPrototypeOf(t)?this.h=t:e&&FormData.prototype.isPrototypeOf(t)?this.v=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this.o=t.toString():s&&i&&((r=t)&&DataView.prototype.isPrototypeOf(r))?(this.l=g(t.buffer),this.u=new Blob([this.l])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||o(t))?this.l=g(t):this.o=t=Object.prototype.toString.call(t):(this.t=!0,this.o=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this.h&&this.h.type?this.headers.set("content-type",this.h.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this.h)return Promise.resolve(this.h);if(this.l)return Promise.resolve(new Blob([this.l]));if(this.v)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this.o]))}),this.arrayBuffer=function(){if(this.l){var t=d(this);return t||(ArrayBuffer.isView(this.l)?Promise.resolve(this.l.buffer.slice(this.l.byteOffset,this.l.byteOffset+this.l.byteLength)):Promise.resolve(this.l))}if(i)return this.blob().then(l);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,n,r,i,e,s=d(this);if(s)return s;if(this.h)return t=this.h,n=new FileReader,r=v(n),i=/charset=([A-Za-z0-9_-]+)/.exec(t.type),e=i?i[1]:"utf-8",n.readAsText(t,e),r;if(this.l)return Promise.resolve(function(t){for(var n=new Uint8Array(t),r=new Array(n.length),i=0;i<n.length;i++)r[i]=String.fromCharCode(n[i]);return r.join("")}(this.l));if(this.v)throw new Error("could not read FormData body as text");return Promise.resolve(this.o)},e&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,n){t=a(t),n=c(n);var r=this.map[t];this.map[t]=r?r+", "+n:n},h.prototype.delete=function(t){delete this.map[a(t)]},h.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},h.prototype.set=function(t,n){this.map[a(t)]=c(n)},h.prototype.forEach=function(t,n){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(n,this.map[r],r,this)},h.prototype.keys=function(){var t=[];return this.forEach(function(n,r){t.push(r)}),f(t)},h.prototype.values=function(){var t=[];return this.forEach(function(n){t.push(n)}),f(t)},h.prototype.entries=function(){var t=[];return this.forEach(function(n,r){t.push([r,n])}),f(t)},r&&(h.prototype[Symbol.iterator]=h.prototype.entries);var m=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function p(n,r){if(!(this instanceof p))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var i,e,s=(r=r||{}).body;if(n instanceof p){if(n.bodyUsed)throw new TypeError("Already read");this.url=n.url,this.credentials=n.credentials,r.headers||(this.headers=new h(n.headers)),this.method=n.method,this.mode=n.mode,this.signal=n.signal,s||null==n.u||(s=n.u,n.bodyUsed=!0)}else this.url=String(n);if(this.credentials=r.credentials||this.credentials||"same-origin",!r.headers&&this.headers||(this.headers=new h(r.headers)),this.method=(i=r.method||this.method||"GET",e=i.toUpperCase(),m.indexOf(e)>-1?e:i),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal||function(){if("AbortController"in t)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this.i(s),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==r.cache&&"no-cache"!==r.cache)){var u=/([?&])_=[^&]*/;if(u.test(this.url))this.url=this.url.replace(u,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function y(t){var n=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),e=r.join("=").replace(/\+/g," ");n.append(decodeURIComponent(i),decodeURIComponent(e))}}),n}function b(t,n){if(!(this instanceof b))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(n||(n={}),this.type="default",this.status=void 0===n.status?200:n.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===n.statusText?"":""+n.statusText,this.headers=new h(n.headers),this.url=n.url||"",this.i(t)}p.prototype.clone=function(){return new p(this,{body:this.u})},w.call(p.prototype),w.call(b.prototype),b.prototype.clone=function(){return new b(this.u,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var E=[301,302,303,307,308];b.redirect=function(t,n){if(-1===E.indexOf(n))throw new RangeError("Invalid status code");return new b(null,{status:n,headers:{location:t}})};var I=t.DOMException;try{new I}catch(t){(I=function(t,n){this.message=t,this.name=n;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),I.prototype.constructor=I}function S(n,r){return new Promise(function(e,u){var o=new p(n,r);if(o.signal&&o.signal.aborted)return u(new I("Aborted","AbortError"));var f=new XMLHttpRequest;function d(){f.abort()}if(f.onload=function(){var t,n,r={statusText:f.statusText,headers:(t=f.getAllResponseHeaders()||"",n=new h,t.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t}).forEach(function(t){var r=t.split(":"),i=r.shift().trim();if(i){var e=r.join(":").trim();try{n.append(i,e)}catch(t){console.warn("Response "+t.message)}}}),n)};0===o.url.indexOf("file://")&&(f.status<200||f.status>599)?r.status=200:r.status=f.status,r.url="responseURL"in f?f.responseURL:r.headers.get("X-Request-URL");var i="response"in f?f.response:f.responseText;setTimeout(function(){e(new b(i,r))},0)},f.onerror=function(){setTimeout(function(){u(new TypeError("Network request failed"))},0)},f.ontimeout=function(){setTimeout(function(){u(new TypeError("Network request timed out"))},0)},f.onabort=function(){setTimeout(function(){u(new I("Aborted","AbortError"))},0)},f.open(o.method,function(n){try{return""===n&&t.location.href?t.location.href:n}catch(t){return n}}(o.url),!0),"include"===o.credentials?f.withCredentials=!0:"omit"===o.credentials&&(f.withCredentials=!1),"responseType"in f&&(i?f.responseType="blob":s&&(f.responseType="arraybuffer")),r&&"object"==typeof r.headers&&!(r.headers instanceof h||t.Headers&&r.headers instanceof t.Headers)){var v=[];Object.getOwnPropertyNames(r.headers).forEach(function(t){v.push(a(t)),f.setRequestHeader(t,c(r.headers[t]))}),o.headers.forEach(function(t,n){-1===v.indexOf(n)&&f.setRequestHeader(n,t)})}else o.headers.forEach(function(t,n){f.setRequestHeader(n,t)});o.signal&&(o.signal.addEventListener("abort",d),f.onreadystatechange=function(){4===f.readyState&&o.signal.removeEventListener("abort",d)}),f.send(void 0===o.u?null:o.u)})}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=h,t.Request=p,t.Response=b);var T,k,R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},A={};function _(){if(k)return T;k=1;var t=function(t){return t&&t.Math===Math&&t};return T=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof R&&R)||t("object"==typeof T&&T)||function(){return this}()||Function("return this")()}var O,C,D,N,F,P,M,x,U={};function V(){return C?O:(C=1,O=function(t){try{return!!t()}catch(t){return!0}})}function j(){if(N)return D;N=1;var t=V();return D=!t(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function L(){if(P)return F;P=1;var t=V();return F=!t(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})}function z(){if(x)return M;x=1;var t=L(),n=Function.prototype.call;return M=t?n.bind(n):function(){return n.apply(n,arguments)},M}var B,G,W,q,H,K,X,$,Q,J,Y,Z,tt,nt,rt,it,et,st,ut,ot,at,ct,ft,ht,dt,vt,lt,gt,wt,mt,pt,yt,bt,Et,It,St,Tt,kt,Rt,At,_t,Ot={};function Ct(){if(B)return Ot;B=1;var t={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!t.call({1:2},1);return Ot.f=r?function(t){var r=n(this,t);return!!r&&r.enumerable}:t,Ot}function Dt(){return W?G:(W=1,G=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}})}function Nt(){if(H)return q;H=1;var t=L(),n=Function.prototype,r=n.call,i=t&&n.bind.bind(r,r);return q=t?i:function(t){return function(){return r.apply(t,arguments)}},q}function Ft(){if(X)return K;X=1;var t=Nt(),n=t({}.toString),r=t("".slice);return K=function(t){return r(n(t),8,-1)}}function Pt(){if(Q)return $;Q=1;var t=Nt(),n=V(),r=Ft(),i=Object,e=t("".split);return $=n(function(){return!i("z").propertyIsEnumerable(0)})?function(t){return"String"===r(t)?e(t,""):i(t)}:i}function Mt(){return Y?J:(Y=1,J=function(t){return null==t})}function xt(){if(tt)return Z;tt=1;var t=Mt(),n=TypeError;return Z=function(r){if(t(r))throw new n("Can't call method on "+r);return r}}function Ut(){if(rt)return nt;rt=1;var t=Pt(),n=xt();return nt=function(r){return t(n(r))}}function Vt(){if(et)return it;et=1;var t="object"==typeof document&&document.all;return it=void 0===t&&void 0!==t?function(n){return"function"==typeof n||n===t}:function(t){return"function"==typeof t}}function jt(){if(ut)return st;ut=1;var t=Vt();return st=function(n){return"object"==typeof n?null!==n:t(n)}}function Lt(){if(at)return ot;at=1;var t=_(),n=Vt();return ot=function(r,i){return arguments.length<2?(e=t[r],n(e)?e:void 0):t[r]&&t[r][i];var e},ot}function zt(){if(ft)return ct;ft=1;var t=Nt();return ct=t({}.isPrototypeOf)}function Bt(){if(dt)return ht;dt=1;var t=_().navigator,n=t&&t.userAgent;return ht=n?String(n):""}function Gt(){if(lt)return vt;lt=1;var t,n,r=_(),i=Bt(),e=r.process,s=r.Deno,u=e&&e.versions||s&&s.version,o=u&&u.v8;return o&&(n=(t=o.split("."))[0]>0&&t[0]<4?1:+(t[0]+t[1])),!n&&i&&(!(t=i.match(/Edge\/(\d+)/))||t[1]>=74)&&(t=i.match(/Chrome\/(\d+)/))&&(n=+t[1]),vt=n}function Wt(){if(wt)return gt;wt=1;var t=Gt(),n=V(),r=_().String;return gt=!!Object.getOwnPropertySymbols&&!n(function(){var n=Symbol("symbol detection");return!r(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&t&&t<41})}function qt(){if(pt)return mt;pt=1;var t=Wt();return mt=t&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function Ht(){if(bt)return yt;bt=1;var t=Lt(),n=Vt(),r=zt(),i=qt(),e=Object;return yt=i?function(t){return"symbol"==typeof t}:function(i){var s=t("Symbol");return n(s)&&r(s.prototype,e(i))}}function Kt(){if(It)return Et;It=1;var t=String;return Et=function(n){try{return t(n)}catch(t){return"Object"}}}function Xt(){if(Tt)return St;Tt=1;var t=Vt(),n=Kt(),r=TypeError;return St=function(i){if(t(i))return i;throw new r(n(i)+" is not a function")}}function $t(){if(Rt)return kt;Rt=1;var t=Xt(),n=Mt();return kt=function(r,i){var e=r[i];return n(e)?void 0:t(e)}}function Qt(){if(_t)return At;_t=1;var t=z(),n=Vt(),r=jt(),i=TypeError;return At=function(e,s){var u,o;if("string"===s&&n(u=e.toString)&&!r(o=t(u,e)))return o;if(n(u=e.valueOf)&&!r(o=t(u,e)))return o;if("string"!==s&&n(u=e.toString)&&!r(o=t(u,e)))return o;throw new i("Can't convert object to primitive value")}}var Jt,Yt,Zt,tn,nn,rn,en,sn,un,on,an,cn,fn,hn,dn,vn,ln,gn,wn,mn,pn,yn,bn,En,In={exports:{}};function Sn(){return Yt?Jt:(Yt=1,Jt=!1)}function Tn(){if(tn)return Zt;tn=1;var t=_(),n=Object.defineProperty;return Zt=function(r,i){try{n(t,r,{value:i,configurable:!0,writable:!0})}catch(n){t[r]=i}return i}}function kn(){if(nn)return In.exports;nn=1;var t=Sn(),n=_(),r=Tn(),i="__core-js_shared__",e=In.exports=n[i]||r(i,{});return(e.versions||(e.versions=[])).push({version:"3.49.0",mode:t?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"}),In.exports}function Rn(){if(en)return rn;en=1;var t=kn();return rn=function(n,r){return t[n]||(t[n]=r||{})}}function An(){if(un)return sn;un=1;var t=xt(),n=Object;return sn=function(r){return n(t(r))}}function _n(){if(an)return on;an=1;var t=Nt(),n=An(),r=t({}.hasOwnProperty);return on=Object.hasOwn||function(t,i){return r(n(t),i)}}function On(){if(fn)return cn;fn=1;var t=Nt(),n=0,r=Math.random(),i=t(1.1.toString);return cn=function(t){return"Symbol("+(void 0===t?"":t)+")_"+i(++n+r,36)}}function Cn(){if(dn)return hn;dn=1;var t=_(),n=Rn(),r=_n(),i=On(),e=Wt(),s=qt(),u=t.Symbol,o=n("wks"),a=s?u.for||u:u&&u.withoutSetter||i;return hn=function(t){return r(o,t)||(o[t]=e&&r(u,t)?u[t]:a("Symbol."+t)),o[t]}}function Dn(){if(ln)return vn;ln=1;var t=z(),n=jt(),r=Ht(),i=$t(),e=Qt(),s=Cn(),u=TypeError,o=s("toPrimitive");return vn=function(s,a){if(!n(s)||r(s))return s;var c,f=i(s,o);if(f){if(void 0===a&&(a="default"),c=t(f,s,a),!n(c)||r(c))return c;throw new u("Can't convert object to primitive value")}return void 0===a&&(a="number"),e(s,a)}}function Nn(){if(wn)return gn;wn=1;var t=Dn(),n=Ht();return gn=function(r){var i=t(r,"string");return n(i)?i:i+""}}function Fn(){if(pn)return mn;pn=1;var t=_(),n=jt(),r=t.document,i=n(r)&&n(r.createElement);return mn=function(t){return i?r.createElement(t):{}}}function Pn(){if(bn)return yn;bn=1;var t=j(),n=V(),r=Fn();return yn=!t&&!n(function(){return 7!==Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a})}function Mn(){if(En)return U;En=1;var t=j(),n=z(),r=Ct(),i=Dt(),e=Ut(),s=Nn(),u=_n(),o=Pn(),a=Object.getOwnPropertyDescriptor;return U.f=t?a:function(t,c){if(t=e(t),c=s(c),o)try{return a(t,c)}catch(t){}if(u(t,c))return i(!n(r.f,t,c),t[c])},U}var xn,Un,Vn,jn,Ln,zn,Bn,Gn={};function Wn(){if(Un)return xn;Un=1;var t=j(),n=V();return xn=t&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}function qn(){if(jn)return Vn;jn=1;var t=jt(),n=String,r=TypeError;return Vn=function(i){if(t(i))return i;throw new r(n(i)+" is not an object")}}function Hn(){if(Ln)return Gn;Ln=1;var t=j(),n=Pn(),r=Wn(),i=qn(),e=Nn(),s=TypeError,u=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a="enumerable",c="configurable",f="writable";return Gn.f=t?r?function(t,n,r){if(i(t),n=e(n),i(r),"function"==typeof t&&"prototype"===n&&"value"in r&&f in r&&!r[f]){var s=o(t,n);s&&s[f]&&(t[n]=r.value,r={configurable:c in r?r[c]:s[c],enumerable:a in r?r[a]:s[a],writable:!1})}return u(t,n,r)}:u:function(t,r,o){if(i(t),r=e(r),i(o),n)try{return u(t,r,o)}catch(t){}if("get"in o||"set"in o)throw new s("Accessors not supported");return"value"in o&&(t[r]=o.value),t},Gn}function Kn(){if(Bn)return zn;Bn=1;var t=j(),n=Hn(),r=Dt();return zn=t?function(t,i,e){return n.f(t,i,r(1,e))}:function(t,n,r){return t[n]=r,t}}var Xn,$n,Qn,Jn,Yn,Zn,tr,nr,rr,ir,er,sr,ur,or,ar,cr={exports:{}};function fr(){if($n)return Xn;$n=1;var t=j(),n=_n(),r=Function.prototype,i=t&&Object.getOwnPropertyDescriptor,e=n(r,"name"),s=e&&"something"===function(){}.name,u=e&&(!t||t&&i(r,"name").configurable);return Xn={EXISTS:e,PROPER:s,CONFIGURABLE:u}}function hr(){if(Jn)return Qn;Jn=1;var t=Nt(),n=Vt(),r=kn(),i=t(Function.toString);return n(r.inspectSource)||(r.inspectSource=function(t){return i(t)}),Qn=r.inspectSource}function dr(){if(nr)return tr;nr=1;var t=Rn(),n=On(),r=t("keys");return tr=function(t){return r[t]||(r[t]=n(t))}}function vr(){return ir?rr:(ir=1,rr={})}function lr(){if(sr)return er;sr=1;var t,n,r,i=function(){if(Zn)return Yn;Zn=1;var t=_(),n=Vt(),r=t.WeakMap;return Yn=n(r)&&/native code/.test(String(r))}(),e=_(),s=jt(),u=Kn(),o=_n(),a=kn(),c=dr(),f=vr(),h="Object already initialized",d=e.TypeError,v=e.WeakMap;if(i||a.state){var l=a.state||(a.state=new v);l.get=l.get,l.has=l.has,l.set=l.set,t=function(t,n){if(l.has(t))throw new d(h);return n.facade=t,l.set(t,n),n},n=function(t){return l.get(t)||{}},r=function(t){return l.has(t)}}else{var g=c("state");f[g]=!0,t=function(t,n){if(o(t,g))throw new d(h);return n.facade=t,u(t,g,n),n},n=function(t){return o(t,g)?t[g]:{}},r=function(t){return o(t,g)}}return er={set:t,get:n,has:r,enforce:function(i){return r(i)?n(i):t(i,{})},getterFor:function(t){return function(r){var i;if(!s(r)||(i=n(r)).type!==t)throw new d("Incompatible receiver, "+t+" required");return i}}}}function gr(){if(ur)return cr.exports;ur=1;var t=Nt(),n=V(),r=Vt(),i=_n(),e=j(),s=fr().CONFIGURABLE,u=hr(),o=lr(),a=o.enforce,c=o.get,f=String,h=Object.defineProperty,d=t("".slice),v=t("".replace),l=t([].join),g=e&&!n(function(){return 8!==h(function(){},"length",{value:8}).length}),w=String(String).split("String"),m=cr.exports=function(t,n,r){"Symbol("===d(f(n),0,7)&&(n="["+v(f(n),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(n="get "+n),r&&r.setter&&(n="set "+n),(!i(t,"name")||s&&t.name!==n)&&(e?h(t,"name",{value:n,configurable:!0}):t.name=n),g&&r&&i(r,"arity")&&t.length!==r.arity&&h(t,"length",{value:r.arity});try{r&&i(r,"constructor")&&r.constructor?e&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var u=a(t);return i(u,"source")||(u.source=l(w,"string"==typeof n?n:"")),t};return Function.prototype.toString=m(function(){return r(this)&&c(this).source||u(this)},"toString"),cr.exports}function wr(){if(ar)return or;ar=1;var t=Vt(),n=Hn(),r=gr(),i=Tn();return or=function(e,s,u,o){o||(o={});var a=o.enumerable,c=void 0!==o.name?o.name:s;if(t(u)&&r(u,c,o),o.global)a?e[s]=u:i(s,u);else{try{o.unsafe?e[s]&&(a=!0):delete e[s]}catch(t){}a?e[s]=u:n.f(e,s,{value:u,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e}}var mr,pr,yr,br,Er,Ir,Sr,Tr,kr,Rr,Ar,_r,Or,Cr,Dr,Nr,Fr,Pr={};function Mr(){if(br)return yr;br=1;var t=function(){if(pr)return mr;pr=1;var t=Math.ceil,n=Math.floor;return mr=Math.trunc||function(r){var i=+r;return(i>0?n:t)(i)}}();return yr=function(n){var r=+n;return r!=r||0===r?0:t(r)}}function xr(){if(Ir)return Er;Ir=1;var t=Mr(),n=Math.max,r=Math.min;return Er=function(i,e){var s=t(i);return s<0?n(s+e,0):r(s,e)}}function Ur(){if(Tr)return Sr;Tr=1;var t=Mr(),n=Math.min;return Sr=function(r){var i=t(r);return i>0?n(i,9007199254740991):0}}function Vr(){if(Rr)return kr;Rr=1;var t=Ur();return kr=function(n){return t(n.length)}}function jr(){if(_r)return Ar;_r=1;var t=Ut(),n=xr(),r=Vr(),i=function(i){return function(e,s,u){var o=t(e),a=r(o);if(0===a)return!i&&-1;var c,f=n(u,a);if(i&&s!=s){for(;a>f;)if((c=o[f++])!=c)return!0}else for(;a>f;f++)if((i||f in o)&&o[f]===s)return i||f||0;return!i&&-1}};return Ar={includes:i(!0),indexOf:i(!1)}}function Lr(){if(Cr)return Or;Cr=1;var t=Nt(),n=_n(),r=Ut(),i=jr().indexOf,e=vr(),s=t([].push);return Or=function(t,u){var o,a=r(t),c=0,f=[];for(o in a)!n(e,o)&&n(a,o)&&s(f,o);for(;u.length>c;)n(a,o=u[c++])&&(~i(f,o)||s(f,o));return f}}function zr(){return Nr?Dr:(Nr=1,Dr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function Br(){if(Fr)return Pr;Fr=1;var t=Lr(),n=zr().concat("length","prototype");return Pr.f=Object.getOwnPropertyNames||function(r){return t(r,n)},Pr}var Gr,Wr,qr,Hr,Kr,Xr,$r,Qr,Jr,Yr,Zr,ti,ni,ri,ii,ei,si,ui,oi,ai,ci,fi,hi,di,vi,li,gi,wi,mi,pi,yi={};function bi(){return Gr||(Gr=1,yi.f=Object.getOwnPropertySymbols),yi}function Ei(){if(qr)return Wr;qr=1;var t=Lt(),n=Nt(),r=Br(),i=bi(),e=qn(),s=n([].concat);return Wr=t("Reflect","ownKeys")||function(t){var n=r.f(e(t)),u=i.f;return u?s(n,u(t)):n}}function Ii(){if(Kr)return Hr;Kr=1;var t=_n(),n=Ei(),r=Mn(),i=Hn();return Hr=function(e,s,u){for(var o=n(s),a=i.f,c=r.f,f=0;f<o.length;f++){var h=o[f];t(e,h)||u&&t(u,h)||a(e,h,c(s,h))}}}function Si(){if($r)return Xr;$r=1;var t=V(),n=Vt(),r=/#|\.prototype\./,i=function(r,i){var a=s[e(r)];return a===o||a!==u&&(n(i)?t(i):!!i)},e=i.normalize=function(t){return String(t).replace(r,".").toLowerCase()},s=i.data={},u=i.NATIVE="N",o=i.POLYFILL="P";return Xr=i}function Ti(){if(Jr)return Qr;Jr=1;var t=_(),n=Mn().f,r=Kn(),i=wr(),e=Tn(),s=Ii(),u=Si();return Qr=function(o,a){var c,f,h,d,v,l=o.target,g=o.global,w=o.stat;if(c=g?t:w?t[l]||e(l,{}):t[l]&&t[l].prototype)for(f in a){if(d=a[f],h=o.dontCallGetSet?(v=n(c,f))&&v.value:c[f],!u(g?f:l+(w?".":"#")+f,o.forced)&&void 0!==h){if(typeof d==typeof h)continue;s(d,h)}(o.sham||h&&h.sham)&&r(d,"sham",!0),i(c,f,d,o)}}}function ki(){if(Zr)return Yr;Zr=1;var t=Ft();return Yr=Array.isArray||function(n){return"Array"===t(n)}}function Ri(){if(ni)return ti;ni=1;var t=TypeError;return ti=function(n){if(n>9007199254740991)throw new t("Maximum allowed index exceeded");return n}}function Ai(){if(ii)return ri;ii=1;var t=j(),n=Hn(),r=Dt();return ri=function(i,e,s){t?n.f(i,e,r(0,s)):i[e]=s}}function _i(){if(si)return ei;si=1;var t=j(),n=ki(),r=TypeError,i=Object.getOwnPropertyDescriptor,e=t&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();return ei=e?function(t,e){if(n(t)&&!i(t,"length").writable)throw new r("Cannot set read only .length");return t.length=e}:function(t,n){return t.length=n}}function Oi(){if(oi)return ui;oi=1;var t={};return t[Cn()("toStringTag")]="z",ui="[object z]"===String(t)}function Ci(){if(ci)return ai;ci=1;var t=Oi(),n=Vt(),r=Ft(),i=Cn()("toStringTag"),e=Object,s="Arguments"===r(function(){return arguments}());return ai=t?r:function(t){var u,o,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(o=function(t,n){try{return t[n]}catch(t){}}(u=e(t),i))?o:s?r(u):"Object"===(a=r(u))&&n(u.callee)?"Arguments":a}}function Di(){if(hi)return fi;hi=1;var t=Nt(),n=V(),r=Vt(),i=Ci(),e=Lt(),s=hr(),u=function(){},o=e("Reflect","construct"),a=/^\s*(?:class|function)\b/,c=t(a.exec),f=!a.test(u),h=function(t){if(!r(t))return!1;try{return o(u,[],t),!0}catch(t){return!1}},d=function(t){if(!r(t))return!1;switch(i(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return f||!!c(a,s(t))}catch(t){return!0}};return d.sham=!0,fi=!o||n(function(){var t;return h(h.call)||!h(Object)||!h(function(){t=!0})||t})?d:h}function Ni(){if(vi)return di;vi=1;var t=ki(),n=Di(),r=jt(),i=Cn()("species"),e=Array;return di=function(s){var u;return t(s)&&(u=s.constructor,(n(u)&&(u===e||t(u.prototype))||r(u)&&null===(u=u[i]))&&(u=void 0)),void 0===u?e:u}}function Fi(){if(gi)return li;gi=1;var t=Ni();return li=function(n,r){return new(t(n))(0===r?0:r)}}function Pi(){if(mi)return wi;mi=1;var t=V(),n=Cn(),r=Gt(),i=n("species");return wi=function(n){return r>=51||!t(function(){var t=[];return(t.constructor={})[i]=function(){return{foo:1}},1!==t[n](Boolean).foo})}}!function(){if(pi)return A;pi=1;var t=Ti(),n=V(),r=ki(),i=jt(),e=An(),s=Vr(),u=Ri(),o=Ai(),a=_i(),c=Fi(),f=Pi(),h=Cn(),d=Gt(),v=h("isConcatSpreadable"),l=d>=51||!n(function(){var t=[];return t[v]=!1,t.concat()[0]!==t}),g=function(t){if(!i(t))return!1;var n=t[v];return void 0!==n?!!n:r(t)};t({target:"Array",proto:!0,arity:1,forced:!l||!f("concat")},{concat:function(t){var n,r,i,f,h,d=e(this),v=c(d,0),l=0;for(n=-1,i=arguments.length;n<i;n++)if(g(h=-1===n?d:arguments[n]))for(f=s(h),u(l+f),r=0;r<f;r++,l++)r in h&&o(v,l,h[r]);else u(l+1),o(v,l++,h);return a(v,l),v}})}();var Mi,xi,Ui,Vi,ji,Li,zi,Bi,Gi,Wi,qi={},Hi={};function Ki(){if(xi)return Mi;xi=1;var t=Lr(),n=zr();return Mi=Object.keys||function(r){return t(r,n)}}function Xi(){if(ji)return Vi;ji=1;var t=Lt();return Vi=t("document","documentElement")}function $i(){if(zi)return Li;zi=1;var t,n=qn(),r=function(){if(Ui)return Hi;Ui=1;var t=j(),n=Wn(),r=Hn(),i=qn(),e=Ut(),s=Ki();return Hi.f=t&&!n?Object.defineProperties:function(t,n){i(t);for(var u,o=e(n),a=s(n),c=a.length,f=0;c>f;)r.f(t,u=a[f++],o[u]);return t},Hi}(),i=zr(),e=vr(),s=Xi(),u=Fn(),o=dr(),a="prototype",c="script",f=o("IE_PROTO"),h=function(){},d=function(t){return"<"+c+">"+t+"</"+c+">"},v=function(t){t.write(d("")),t.close();var n=t.parentWindow.Object;return t=null,n},l=function(){try{t=new ActiveXObject("htmlfile")}catch(t){}var n,r,e;l="undefined"!=typeof document?document.domain&&t?v(t):(r=u("iframe"),e="java"+c+":",r.style.display="none",s.appendChild(r),r.src=String(e),(n=r.contentWindow.document).open(),n.write(d("document.F=Object")),n.close(),n.F):v(t);for(var o=i.length;o--;)delete l[a][i[o]];return l()};return e[f]=!0,Li=Object.create||function(t,i){var e;return null!==t?(h[a]=n(t),e=new h,h[a]=null,e[f]=t):e=l(),void 0===i?e:r.f(e,i)}}function Qi(){if(Gi)return Bi;Gi=1;var t=Cn(),n=$i(),r=Hn().f,i=t("unscopables"),e=Array.prototype;return void 0===e[i]&&r(e,i,{configurable:!0,value:n(null)}),Bi=function(t){e[i][t]=!0}}!function(){if(Wi)return qi;Wi=1;var t=Ti(),n=jr().includes,r=V(),i=Qi(),e=r(function(){return!Array(1).includes()}),s=r(function(){return[,1].includes(void 0,1)});t({target:"Array",proto:!0,forced:e||s},{includes:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),i("includes")}();var Ji,Yi,Zi,te={};function ne(){if(Yi)return Ji;Yi=1;var t=V();return Ji=function(n,r){var i=[][n];return!!i&&t(function(){i.call(null,r||function(){return 1},1)})}}!function(){if(Zi)return te;Zi=1;var t=Ti(),n=Nt(),r=Pt(),i=Ut(),e=ne(),s=n([].join);t({target:"Array",proto:!0,forced:r!==Object||!e("join",",")},{join:function(t){return s(i(this),void 0===t?",":t)}})}();var re,ie={};!function(){if(re)return ie;re=1;var t=Ti(),n=An(),r=Ki();t({target:"Object",stat:!0,forced:V()(function(){r(1)})},{keys:function(t){return r(n(t))}})}();var ee,se,ue,oe={};!function(){if(ue)return oe;ue=1;var t=Oi(),n=wr(),r=function(){if(se)return ee;se=1;var t=Oi(),n=Ci();return ee=t?{}.toString:function(){return"[object "+n(this)+"]"}}();t||n(Object.prototype,"toString",r,{unsafe:!0})}();var ae,ce,fe,he,de,ve,le,ge,we,me,pe,ye,be,Ee,Ie,Se,Te,ke,Re,Ae,_e,Oe,Ce,De,Ne,Fe,Pe,Me,xe,Ue,Ve,je,Le,ze,Be,Ge,We,qe,He,Ke,Xe,$e,Qe,Je,Ye,Ze,ts,ns,rs,is,es,ss,us,os,as,cs,fs,hs,ds={};function vs(){if(ce)return ae;ce=1;var t=_(),n=Bt(),r=Ft(),i=function(t){return n.slice(0,t.length)===t};return ae=i("Bun/")?"BUN":i("Cloudflare-Workers")?"CLOUDFLARE":i("Deno/")?"DENO":i("Node.js/")?"NODE":t.Bun&&"string"==typeof Bun.version?"BUN":t.Deno&&"object"==typeof Deno.version?"DENO":"process"===r(t.process)?"NODE":t.window&&t.document?"BROWSER":"REST"}function ls(){if(he)return fe;he=1;var t=vs();return fe="NODE"===t}function gs(){if(ve)return de;ve=1;var t=_();return de=t}function ws(){if(me)return we;me=1;var t=jt();return we=function(n){return t(n)||null===n}}function ms(){if(ye)return pe;ye=1;var t=ws(),n=String,r=TypeError;return pe=function(i){if(t(i))return i;throw new r("Can't set "+n(i)+" as a prototype")}}function ps(){if(Ee)return be;Ee=1;var t=function(){if(ge)return le;ge=1;var t=Nt(),n=Xt();return le=function(r,i,e){try{return t(n(Object.getOwnPropertyDescriptor(r,i)[e]))}catch(t){}}}(),n=jt(),r=xt(),i=ms();return be=Object.setPrototypeOf||("__proto__"in{}?function(){var e,s=!1,u={};try{(e=t(Object.prototype,"__proto__","set"))(u,[]),s=u instanceof Array}catch(t){}return function(t,u){return r(t),i(u),n(t)?(s?e(t,u):t.__proto__=u,t):t}}():void 0)}function ys(){if(Se)return Ie;Se=1;var t=Hn().f,n=_n(),r=Cn()("toStringTag");return Ie=function(i,e,s){i&&!s&&(i=i.prototype),i&&!n(i,r)&&t(i,r,{configurable:!0,value:e})}}function bs(){if(ke)return Te;ke=1;var t=gr(),n=Hn();return Te=function(r,i,e){return e.get&&t(e.get,i,{getter:!0}),e.set&&t(e.set,i,{setter:!0}),n.f(r,i,e)}}function Es(){if(Ae)return Re;Ae=1;var t=Lt(),n=bs(),r=Cn(),i=j(),e=r("species");return Re=function(r){var s=t(r);i&&s&&!s[e]&&n(s,e,{configurable:!0,get:function(){return this}})}}function Is(){if(Oe)return _e;Oe=1;var t=zt(),n=TypeError;return _e=function(r,i){if(t(i,r))return r;throw new n("Incorrect invocation")}}function Ss(){if(De)return Ce;De=1;var t=Di(),n=Kt(),r=TypeError;return Ce=function(i){if(t(i))return i;throw new r(n(i)+" is not a constructor")}}function Ts(){if(Fe)return Ne;Fe=1;var t=qn(),n=Ss(),r=Mt(),i=Cn()("species");return Ne=function(e,s){var u,o=t(e).constructor;return void 0===o||r(u=t(o)[i])?s:n(u)}}function ks(){if(Me)return Pe;Me=1;var t=L(),n=Function.prototype,r=n.apply,i=n.call;return Pe="object"==typeof Reflect&&Reflect.apply||(t?i.bind(r):function(){return i.apply(r,arguments)}),Pe}function Rs(){if(Ue)return xe;Ue=1;var t=Ft(),n=Nt();return xe=function(r){if("Function"===t(r))return n(r)}}function As(){if(je)return Ve;je=1;var t=Rs(),n=Xt(),r=L(),i=t(t.bind);return Ve=function(t,e){return n(t),void 0===e?t:r?i(t,e):function(){return t.apply(e,arguments)}},Ve}function _s(){if(ze)return Le;ze=1;var t=Nt();return Le=t([].slice)}function Os(){if(Ge)return Be;Ge=1;var t=TypeError;return Be=function(n,r){if(n<r)throw new t("Not enough arguments");return n}}function Cs(){if(qe)return We;qe=1;var t=Bt();return We=/ipad|iphone|ipod/i.test(t)&&/applewebkit/i.test(t)}function Ds(){if(Ke)return He;Ke=1;var t,n,r,i,e=_(),s=ks(),u=As(),o=Vt(),a=_n(),c=V(),f=Xi(),h=_s(),d=Fn(),v=Os(),l=Cs(),g=ls(),w=e.setImmediate,m=e.clearImmediate,p=e.process,y=e.Dispatch,b=e.Function,E=e.MessageChannel,I=e.String,S=0,T={},k="onreadystatechange";c(function(){t=e.location});var R=function(t){if(a(T,t)){var n=T[t];delete T[t],n()}},A=function(t){return function(){R(t)}},O=function(t){R(t.data)},C=function(n){e.postMessage(I(n),t.protocol+"//"+t.host)};return w&&m||(w=function(t){v(arguments.length,1);var r=o(t)?t:b(t),i=h(arguments,1);return T[++S]=function(){s(r,void 0,i)},n(S),S},m=function(t){delete T[t]},g?n=function(t){p.nextTick(A(t))}:y&&y.now?n=function(t){y.now(A(t))}:E&&!l?(i=(r=new E).port2,r.port1.onmessage=O,n=u(i.postMessage,i)):e.addEventListener&&o(e.postMessage)&&!e.importScripts&&t&&"file:"!==t.protocol&&!c(C)?(n=C,e.addEventListener("message",O,!1)):n=k in d("script")?function(t){f.appendChild(d("script"))[k]=function(){f.removeChild(this),R(t)}}:function(t){setTimeout(A(t),0)}),He={set:w,clear:m}}function Ns(){if($e)return Xe;$e=1;var t=_(),n=j(),r=Object.getOwnPropertyDescriptor;return Xe=function(i){if(!n)return t[i];var e=r(t,i);return e&&e.value}}function Fs(){if(Je)return Qe;Je=1;var t=function(){this.head=null,this.tail=null};return t.prototype={add:function(t){var n={item:t,next:null},r=this.tail;r?r.next=n:this.head=n,this.tail=n},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},Qe=t}function Ps(){if(is)return rs;is=1;var t,n,r,i,e,s=_(),u=Ns(),o=As(),a=Ds().set,c=Fs(),f=Cs(),h=function(){if(Ze)return Ye;Ze=1;var t=Bt();return Ye=/ipad|iphone|ipod/i.test(t)&&"undefined"!=typeof Pebble}(),d=function(){if(ns)return ts;ns=1;var t=Bt();return ts=/web0s(?!.*chrome)/i.test(t)}(),v=ls(),l=s.MutationObserver||s.WebKitMutationObserver,g=s.document,w=s.process,m=s.Promise,p=u("queueMicrotask");if(!p){var y=new c,b=function(){var n,r;for(v&&(n=w.domain)&&n.exit();r=y.get();)try{r()}catch(n){throw y.head&&t(),n}n&&n.enter()};f||v||d||!l||!g?!h&&m&&m.resolve?((i=m.resolve(void 0)).constructor=m,e=o(i.then,i),t=function(){e(b)}):v?t=function(){w.nextTick(b)}:(a=o(a,s),t=function(){a(b)}):(n=!0,r=g.createTextNode(""),new l(b).observe(r,{characterData:!0}),t=function(){r.data=n=!n}),p=function(n){y.head||t(),y.add(n)}}return rs=p}function Ms(){return ss||(ss=1,es=function(t,n){try{1===arguments.length?console.error(t):console.error(t,n)}catch(t){}}),es}function xs(){return os?us:(os=1,us=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}})}function Us(){if(cs)return as;cs=1;var t=_();return as=t.Promise}function Vs(){if(hs)return fs;hs=1;var t=_(),n=Us(),r=Vt(),i=Si(),e=hr(),s=Cn(),u=vs(),o=Sn(),a=Gt(),c=n&&n.prototype,f=s("species"),h=!1,d=r(t.PromiseRejectionEvent),v=i("Promise",function(){var t=e(n),r=t!==String(n);if(!r&&66===a)return!0;if(o&&(!c.catch||!c.finally))return!0;if(!a||a<51||!/native code/.test(t)){var i=new n(function(t){t(1)}),s=function(t){t(function(){},function(){})};if((i.constructor={})[f]=s,!(h=i.then(function(){})instanceof s))return!0}return!(r||"BROWSER"!==u&&"DENO"!==u||d)});return fs={CONSTRUCTOR:v,REJECTION_EVENT:d,SUBCLASSING:h}}var js,Ls,zs={};function Bs(){if(js)return zs;js=1;var t=Xt(),n=TypeError,r=function(r){var i,e;this.promise=new r(function(t,r){if(void 0!==i||void 0!==e)throw new n("Bad Promise constructor");i=t,e=r}),this.resolve=t(i),this.reject=t(e)};return zs.f=function(t){return new r(t)},zs}var Gs,Ws,qs,Hs,Ks,Xs,$s,Qs,Js,Ys,Zs,tu,nu,ru,iu,eu,su,uu={};function ou(){return Ws?Gs:(Ws=1,Gs={})}function au(){if(Hs)return qs;Hs=1;var t=Cn(),n=ou(),r=t("iterator"),i=Array.prototype;return qs=function(t){return void 0!==t&&(n.Array===t||i[r]===t)}}function cu(){if(Xs)return Ks;Xs=1;var t=Ci(),n=$t(),r=Mt(),i=ou(),e=Cn()("iterator");return Ks=function(s){if(!r(s))return n(s,e)||n(s,"@@iterator")||i[t(s)]}}function fu(){if(Qs)return $s;Qs=1;var t=z(),n=Xt(),r=qn(),i=Kt(),e=cu(),s=TypeError;return $s=function(u,o){var a=arguments.length<2?e(u):o;if(n(a))return r(t(a,u));throw new s(i(u)+" is not iterable")},$s}function hu(){if(Ys)return Js;Ys=1;var t=z(),n=qn(),r=$t();return Js=function(i,e,s){var u,o;n(i);try{if(!(u=r(i,"return"))){if("throw"===e)throw s;return s}u=t(u,i)}catch(t){o=!0,u=t}if("throw"===e)throw s;if(o)throw u;return n(u),s}}function du(){if(tu)return Zs;tu=1;var t=As(),n=z(),r=qn(),i=Kt(),e=au(),s=Vr(),u=zt(),o=fu(),a=cu(),c=hu(),f=TypeError,h=function(t,n){this.stopped=t,this.result=n},d=h.prototype;return Zs=function(v,l,g){var w,m,p,y,b,E,I,S=g&&g.that,T=!(!g||!g.AS_ENTRIES),k=!(!g||!g.IS_RECORD),R=!(!g||!g.IS_ITERATOR),A=!(!g||!g.INTERRUPTED),_=t(l,S),O=function(t){var n=w;return w=void 0,n&&c(n,"normal"),new h(!0,t)},C=function(t){return T?(r(t),A?_(t[0],t[1],O):_(t[0],t[1])):A?_(t,O):_(t)};if(k)w=v.iterator;else if(R)w=v;else{if(!(m=a(v)))throw new f(i(v)+" is not iterable");if(e(m)){for(p=0,y=s(v);y>p;p++)if((b=C(v[p]))&&u(d,b))return b;return new h(!1)}w=o(v,m)}for(E=k?v.next:w.next;!(I=n(E,w)).done;){var D=I.value;try{b=C(D)}catch(t){if(!w)throw t;c(w,"throw",t)}if("object"==typeof b&&b&&u(d,b))return b}return new h(!1)}}function vu(){if(ru)return nu;ru=1;var t=Cn()("iterator"),n=!1;try{var r=0,i={next:function(){return{done:!!r++}},return:function(){n=!0}};i[t]=function(){return this},Array.from(i,function(){throw 2})}catch(t){}return nu=function(r,i){try{if(!i&&!n)return!1}catch(t){return!1}var e=!1;try{var s={};s[t]=function(){return{next:function(){return{done:e=!0}}}},r(s)}catch(t){}return e}}function lu(){if(eu)return iu;eu=1;var t=Us(),n=vu(),r=Vs().CONSTRUCTOR;return iu=r||!n(function(n){t.all(n).then(void 0,function(){})})}var gu,wu={};var mu,pu={};var yu,bu={};var Eu,Iu,Su,Tu,ku={};function Ru(){if(Iu)return Eu;Iu=1;var t=qn(),n=jt(),r=Bs();return Eu=function(i,e){if(t(i),n(e)&&e.constructor===i)return e;var s=r.f(i);return(0,s.resolve)(e),s.promise}}Tu||(Tu=1,function(){if(Ls)return ds;Ls=1;var t,n,r,i,e=Ti(),s=Sn(),u=ls(),o=_(),a=gs(),c=z(),f=wr(),h=ps(),d=ys(),v=Es(),l=Xt(),g=Vt(),w=jt(),m=Is(),p=Ts(),y=Ds().set,b=Ps(),E=Ms(),I=xs(),S=Fs(),T=lr(),k=Us(),R=Vs(),A=Bs(),O="Promise",C=R.CONSTRUCTOR,D=R.REJECTION_EVENT,N=R.SUBCLASSING,F=T.getterFor(O),P=T.set,M=k&&k.prototype,x=k,U=M,V=o.TypeError,j=o.document,L=o.process,B=A.f,G=B,W=!!(j&&j.createEvent&&o.dispatchEvent),q="unhandledrejection",H=function(t){var n;return!(!w(t)||!g(n=t.then))&&n},K=function(t,n){var r,i,e,s=n.value,u=1===n.state,o=u?t.ok:t.fail,a=t.resolve,f=t.reject,h=t.domain;try{o?(u||(2===n.rejection&&Y(n),n.rejection=1),!0===o?r=s:(h&&h.enter(),r=o(s),h&&(h.exit(),e=!0)),r===t.promise?f(new V("Promise-chain cycle")):(i=H(r))?c(i,r,a,f):a(r)):f(s)}catch(t){h&&!e&&h.exit(),f(t)}},X=function(t,n){t.notified||(t.notified=!0,b(function(){for(var r,i=t.reactions;r=i.get();)K(r,t);t.notified=!1,n&&!t.rejection&&Q(t)}))},$=function(t,n,r){var i,e;W?((i=j.createEvent("Event")).promise=n,i.reason=r,i.initEvent(t,!1,!0),o.dispatchEvent(i)):i={promise:n,reason:r},!D&&(e=o["on"+t])?e(i):t===q&&E("Unhandled promise rejection",r)},Q=function(t){c(y,o,function(){var n,r=t.facade,i=t.value;if(J(t)&&(n=I(function(){u?L.emit("unhandledRejection",i,r):$(q,r,i)}),t.rejection=u||J(t)?2:1,n.error))throw n.value})},J=function(t){return 1!==t.rejection&&!t.parent},Y=function(t){c(y,o,function(){var n=t.facade;u?L.emit("rejectionHandled",n):$("rejectionhandled",n,t.value)})},Z=function(t,n,r){return function(i){t(n,i,r)}},tt=function(t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=2,X(t,!0))},nt=function(t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===n)throw new V("Promise can't be resolved itself");var i=H(n);i?b(function(){var r={done:!1};try{c(i,n,Z(nt,r,t),Z(tt,r,t))}catch(n){tt(r,n,t)}}):(t.value=n,t.state=1,X(t,!1))}catch(n){tt({done:!1},n,t)}}};if(C&&(U=(x=function(n){m(this,U),l(n),c(t,this);var r=F(this);try{n(Z(nt,r),Z(tt,r))}catch(t){tt(r,t)}}).prototype,(t=function(t){P(this,{type:O,done:!1,notified:!1,parent:!1,reactions:new S,rejection:!1,state:0,value:null})}).prototype=f(U,"then",function(t,n){var r=F(this),i=B(p(this,x));return r.parent=!0,i.ok=!g(t)||t,i.fail=g(n)&&n,i.domain=u?L.domain:void 0,0===r.state?r.reactions.add(i):b(function(){K(i,r)}),i.promise}),n=function(){var n=new t,r=F(n);this.promise=n,this.resolve=Z(nt,r),this.reject=Z(tt,r)},A.f=B=function(t){return t===x||t===r?new n(t):G(t)},!s&&g(k)&&M!==Object.prototype)){i=M.then,N||f(M,"then",function(t,n){var r=this;return new x(function(t,n){c(i,r,t,n)}).then(t,n)},{unsafe:!0});try{delete M.constructor}catch(t){}h&&h(M,U)}e({global:!0,constructor:!0,wrap:!0,forced:C},{Promise:x}),r=a.Promise,d(x,O,!1,!0),v(O)}(),function(){if(su)return uu;su=1;var t=Ti(),n=z(),r=Xt(),i=Bs(),e=xs(),s=du();t({target:"Promise",stat:!0,forced:lu()},{all:function(t){var u=this,o=i.f(u),a=o.resolve,c=o.reject,f=e(function(){var i=r(u.resolve),e=[],o=0,f=1;s(t,function(t){var r=o++,s=!1;f++,n(i,u,t).then(function(t){s||(s=!0,e[r]=t,--f||a(e))},c)}),--f||a(e)});return f.error&&c(f.value),o.promise}})}(),function(){if(gu)return wu;gu=1;var t=Ti(),n=Sn(),r=Vs().CONSTRUCTOR,i=Us(),e=Lt(),s=Vt(),u=wr(),o=i&&i.prototype;if(t({target:"Promise",proto:!0,forced:r,real:!0},{catch:function(t){return this.then(void 0,t)}}),!n&&s(i)){var a=e("Promise").prototype.catch;o.catch!==a&&u(o,"catch",a,{unsafe:!0})}}(),function(){if(mu)return pu;mu=1;var t=Ti(),n=z(),r=Xt(),i=Bs(),e=xs(),s=du();t({target:"Promise",stat:!0,forced:lu()},{race:function(t){var u=this,o=i.f(u),a=o.reject,c=e(function(){var i=r(u.resolve);s(t,function(t){n(i,u,t).then(o.resolve,a)})});return c.error&&a(c.value),o.promise}})}(),function(){if(yu)return bu;yu=1;var t=Ti(),n=Bs();t({target:"Promise",stat:!0,forced:Vs().CONSTRUCTOR},{reject:function(t){var r=n.f(this);return(0,r.reject)(t),r.promise}})}(),function(){if(Su)return ku;Su=1;var t=Ti(),n=Lt(),r=Sn(),i=Us(),e=Vs().CONSTRUCTOR,s=Ru(),u=n("Promise"),o=r&&!e;t({target:"Promise",stat:!0,forced:r||e},{resolve:function(t){return s(o&&this===u?i:this,t)}})}());var Au,_u,Ou,Cu,Du,Nu,Fu,Pu,Mu,xu={};function Uu(){return _u?Au:(_u=1,Au={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0})}function Vu(){if(Cu)return Ou;Cu=1;var t=Fn()("span").classList,n=t&&t.constructor&&t.constructor.prototype;return Ou=n===Object.prototype?void 0:n}function ju(){if(Nu)return Du;Nu=1;var t=As(),n=Pt(),r=An(),i=Vr(),e=Fi(),s=Ai(),u=function(u){var o=1===u,a=2===u,c=3===u,f=4===u,h=6===u,d=7===u,v=5===u||h;return function(l,g,w){for(var m,p,y=r(l),b=n(y),E=i(b),I=t(g,w),S=0,T=0,k=o?e(l,E):a||d?e(l,0):void 0;E>S;S++)if((v||S in b)&&(p=I(m=b[S],S,y),u))if(o)s(k,S,p);else if(p)switch(u){case 3:return!0;case 5:return m;case 6:return S;case 2:s(k,T++,m)}else switch(u){case 4:return!1;case 7:s(k,T++,m)}return h?-1:c||f?f:k}};return Du={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}}!function(){if(Mu)return xu;Mu=1;var t=_(),n=Uu(),r=Vu(),i=function(){if(Pu)return Fu;Pu=1;var t=ju().forEach,n=ne()("forEach");return Fu=n?[].forEach:function(n){return t(this,n,arguments.length>1?arguments[1]:void 0)},Fu}(),e=Kn(),s=function(t){if(t&&t.forEach!==i)try{e(t,"forEach",i)}catch(n){t.forEach=i}};for(var u in n)n[u]&&s(t[u]&&t[u].prototype);s(r)}();var Lu=function(t,n){return Lu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},Lu(t,n)};var zu=function(){return zu=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++)for(var e in n=arguments[r])Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t},zu.apply(this,arguments)};function Bu(t,n,r,i){return new(r||(r=Promise))(function(e,s){function u(t){try{a(i.next(t))}catch(t){s(t)}}function o(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r(function(t){t(n)})).then(u,o)}a((i=i.apply(t,n||[])).next())})}function Gu(t,n){var r,i,e,s={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=o(0),u.throw=o(1),u.return=o(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function o(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,o[0]&&(s=0)),s;)try{if(r=1,i&&(e=2&o[0]?i.return:o[0]?i.throw||((e=i.return)&&e.call(i),0):i.next)&&!(e=e.call(i,o[1])).done)return e;switch(i=0,e&&(o=[2&o[0],e.value]),o[0]){case 0:case 1:e=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(e=s.trys,(e=e.length>0&&e[e.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!e||o[1]>e[0]&&o[1]<e[3])){s.label=o[1];break}if(6===o[0]&&s.label<e[1]){s.label=e[1],e=o;break}if(e&&s.label<e[2]){s.label=e[2],s.ops.push(o);break}e[2]&&s.ops.pop(),s.trys.pop();continue}o=n.call(t,s)}catch(t){o=[6,t],i=0}finally{r=e=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function Wu(t){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&t[n],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function qu(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,e,s=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(i=s.next()).done;)u.push(i.value)}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return u}function Hu(t,n,r){if(r||2===arguments.length)for(var i,e=0,s=n.length;e<s;e++)!i&&e in n||(i||(i=Array.prototype.slice.call(n,0,e)),i[e]=n[e]);return t.concat(i||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var Ku="/phantom/web/events",Xu="/phantom/web/userEvents",$u="/phantom/api/v2/sdk/config",Qu="/phantom/api/v2/visitors",Ju="/phantom/api/v2/visitors",Yu="/phantom/api/v2/visitors/merge",Zu="/api/v1/websdk/dlr",to=18e5,no={STATUSES:{PENDING:"pending"},BATCH_SIZE:50,DEFAULT_RETRY_DELAYS:[6e4,12e4,24e4,48e4,9e5],RETRYABLE_HTTP_CODES:[408,429,500,502,503,504,401],GLOBAL_SUCCESS_CODE:200,PARTIAL_SUCCESS_CODE:201},ro="/firebase-messaging-sw.js",io="hydra-websdk-fcm",eo={USER_CONTEXT:"websdk_user_context",VISITOR_ID:"websdk_visitor_id",VISITOR_REF_ID:"websdk_visitor_ref_id",VISITOR_EXPIRED_AT:"websdk_visitor_expired_at",VISITOR_CONFIG:"websdk_visitor_config",FCM_TOKEN:"websdk_fcm_token",FCM_TOKEN_CREATED_AT:"websdk_fcm_token_created_at",NOTIFICATION_STATE:"websdk_notification_state",SESSION_ID:"websdk_session_id",SESSION_START_TIME:"websdk_session_start_time",LAST_EVENT_TIME:"websdk_last_event_time",LAST_AUTHENTICATED_USER:"websdk_last_authenticated_user",MERGED_USER_ID:"websdk_merged_user_id",PENDING_MERGE:"websdk_pending_merge",SESSION_NUMBER:"websdk_session_number"};function so(t,n,r){var i=eo[t],e=[];return n&&e.push(n),r&&e.push(r),e.length>0?"".concat(e.join("_"),"_").concat(i):i}var uo,oo="websdk_storage_test",ao="test_value",co="INIT_ERROR",fo="AUTH_ERROR",ho="NETWORK_ERROR",vo="EVENT_ERROR",lo="VISITOR_CONFIG_ERROR",go="WebSDK initialized successfully",wo="Failed to initialize WebSDK",mo="WebSDK destroyed successfully",po="EventTracker initialized successfully",yo="EventTracker destroyed successfully",bo="Failed to track event",Eo="Events sent successfully",Io="Failed to send events",So="Failed to initialize storage:",To="Storage test failed:",ko="Storage read/write test failed",Ro="StorageManager destroyed successfully",Ao="Error during storage cleanup:",_o="New session started",Oo="Session continued",Co="Session expired due to inactivity",Do="Session ended on user switch (different user login)",No="Session restored from storage",Fo="Failed to track user signin event",Po="Failed to track user signup event",Mo="Failed to track user update event",xo="Failed to track user signout event",Uo="Failed to track behavioral event",Vo="VisitorConfigManager initialized successfully",jo="Visitor config fetched successfully",Lo="Failed to fetch visitor config",zo="Visitor tracking is disabled",Bo="Visitor tracking is enabled",Go="Visitor config retrieved from cache",Wo="AnonymousVisitorManager initialized successfully",qo="Visitor ID generated successfully",Ho="Failed to generate visitor ID",Ko="Visitor ID restored from storage",Xo="Using cached visitor ID",$o="Visitor updated successfully",Qo="Failed to update visitor",Jo="Visitor merged with user successfully",Yo="Failed to merge visitor with user",Zo="Visitor merge skipped",ta="Notification permission denied by user",na="Notification manager initialized successfully",ra="Failed to initialize notification manager",ia="Notification initialization skipped (disabled or not supported)",ea="Firebase initialized successfully",sa="Failed to initialize Firebase",ua="FCM token received successfully",oa="FCM token refreshed",aa="Failed to retrieve FCM token",ca="Service worker registered successfully",fa="Failed to register service worker",ha="DLR events sent successfully",da="Failed to send DLR events",va="web",la="user_signin",ga="user_update",wa="user_signout",ma=30,pa=3e3,ya={WEBPUSH:"WEBPUSH"},ba={WEB:"web"},Ea={ACCOUNT_NOT_EXISTS:2432,ACCOUNT_ID_NOT_PASSED:9999},Ia={ALREADY_MERGED:"1429",VISITOR_NOT_FOUND:"1428"},Sa={NOTIFICATION_RECEIVED:"push_notification_received",NOTIFICATION_CLICKED:"push_notification_click",NOTIFICATION_DISMISSED:"push_notification_close"},Ta="fcm",ka="push",Ra="1.0.9",Aa={};!function(){if(uo)return Aa;uo=1;var t=j(),n=fr().EXISTS,r=Nt(),i=bs(),e=Function.prototype,s=r(e.toString),u=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,o=r(u.exec);t&&!n&&i(e,"name",{configurable:!0,get:function(){try{return o(u,s(this))[1]}catch(t){return""}}})}();var _a,Oa,Ca,Da,Na,Fa,Pa,Ma,xa,Ua={};function Va(){if(Oa)return _a;Oa=1;var t=Ci(),n=String;return _a=function(r){if("Symbol"===t(r))throw new TypeError("Cannot convert a Symbol value to a string");return n(r)}}function ja(){return Da?Ca:(Da=1,Ca="\t\n\v\f\r \u2028\u2029\ufeff")}function La(){if(Fa)return Na;Fa=1;var t=Nt(),n=xt(),r=Va(),i=ja(),e=t("".replace),s=RegExp("^["+i+"]+"),u=RegExp("(^|[^"+i+"])["+i+"]+$"),o=function(t){return function(i){var o=r(n(i));return 1&t&&(o=e(o,s,"")),2&t&&(o=e(o,u,"$1")),o}};return Na={start:o(1),end:o(2),trim:o(3)}}!function(){if(xa)return Ua;xa=1;var t=Ti(),n=La().trim,r=function(){if(Ma)return Pa;Ma=1;var t=fr().PROPER,n=V(),r=ja();return Pa=function(i){return n(function(){return!!r[i]()||"
"!=="
"[i]()||t&&r[i].name!==i})}}();t({target:"String",proto:!0,forced:r("trim")},{trim:function(){return n(this)}})}();var za,Ba,Ga,Wa,qa,Ha,Ka,Xa,$a,Qa,Ja,Ya={};function Za(){if(Ba)return za;Ba=1;var t=qn();return za=function(){var n=t(this),r="";return n.hasIndices&&(r+="d"),n.global&&(r+="g"),n.ignoreCase&&(r+="i"),n.multiline&&(r+="m"),n.dotAll&&(r+="s"),n.unicode&&(r+="u"),n.unicodeSets&&(r+="v"),n.sticky&&(r+="y"),r}}function tc(){if(Wa)return Ga;Wa=1;var t=V(),n=_().RegExp,r=t(function(){var t=n("a","y");return t.lastIndex=2,null!==t.exec("abcd")}),i=r||t(function(){return!n("a","y").sticky}),e=r||t(function(){var t=n("^r","gy");return t.lastIndex=2,null!==t.exec("str")});return Ga={BROKEN_CARET:e,MISSED_STICKY:i,UNSUPPORTED_Y:r}}function nc(){if(Ha)return qa;Ha=1;var t=V(),n=_().RegExp;return qa=t(function(){var t=n(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})}function rc(){if(Xa)return Ka;Xa=1;var t=V(),n=_().RegExp;return Ka=t(function(){var t=n("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})}function ic(){if(Qa)return $a;Qa=1;var t,n,r=z(),i=Nt(),e=Va(),s=Za(),u=tc(),o=Rn(),a=$i(),c=lr().get,f=nc(),h=rc(),d=o("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,l=v,g=i("".charAt),w=i("".indexOf),m=i("".replace),p=i("".slice),y=(n=/b*/g,r(v,t=/a/,"a"),r(v,n,"a"),0!==t.lastIndex||0!==n.lastIndex),b=u.BROKEN_CARET,E=void 0!==/()??/.exec("")[1],I=function(t,n){for(var r=t.groups=a(null),i=0;i<n.length;i++){var e=n[i];r[e[0]]=t[e[1]]}};return(y||E||b||f||h)&&(l=function(t){var n,i,u,o=this,a=c(o),f=e(t),h=a.raw;if(h)return h.lastIndex=o.lastIndex,n=r(l,h,f),o.lastIndex=h.lastIndex,n&&a.groups&&I(n,a.groups),n;var S=a.groups,T=b&&o.sticky,k=r(s,o),R=o.source,A=0,_=f;if(T){k=m(k,"y",""),-1===w(k,"g")&&(k+="g"),_=p(f,o.lastIndex);var O=o.lastIndex>0&&g(f,o.lastIndex-1);o.lastIndex>0&&(!o.multiline||o.multiline&&"\n"!==O&&"\r"!==O&&"\u2028"!==O&&"\u2029"!==O)&&(R="(?: (?:"+R+"))",_=" "+_,A++),i=new RegExp("^(?:"+R+")",k)}E&&(i=new RegExp("^"+R+"$(?!\\s)",k)),y&&(u=o.lastIndex);var C=r(v,T?i:o,_);return T?C?(C.input=f,C[0]=p(C[0],A),C.index=o.lastIndex,o.lastIndex+=C[0].length):o.lastIndex=0:y&&C&&(o.lastIndex=o.global?C.index+C[0].length:u),E&&C&&C.length>1&&r(d,C[0],i,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(C[t]=void 0)}),C&&S&&I(C,S),C}),$a=l}function ec(){if(Ja)return Ya;Ja=1;var t=Ti(),n=ic();return t({target:"RegExp",proto:!0,forced:/./.exec!==n},{exec:n}),Ya}ec();var sc,uc,oc,ac,cc,fc,hc,dc={};function vc(){if(uc)return sc;uc=1;var t=jt(),n=Ft(),r=Cn()("match");return sc=function(i){var e;return t(i)&&(void 0!==(e=i[r])?!!e:"RegExp"===n(i))}}function lc(){if(ac)return oc;ac=1;var t=vc(),n=TypeError;return oc=function(r){if(t(r))throw new n("The method doesn't accept regular expressions");return r}}function gc(){if(fc)return cc;fc=1;var t=Cn()("match");return cc=function(n){var r=/./;try{"/./"[n](r)}catch(i){try{return r[t]=!1,"/./"[n](r)}catch(t){}}return!1}}!function(){if(hc)return dc;hc=1;var t=Ti(),n=Nt(),r=lc(),i=xt(),e=Va(),s=gc(),u=n("".indexOf);t({target:"String",proto:!0,forced:!s("includes")},{includes:function(t){return!!~u(e(i(this)),e(r(t)),arguments.length>1?arguments[1]:void 0)}})}();var wc,mc,pc,yc,bc,Ec,Ic,Sc,Tc,kc,Rc,Ac,_c,Oc,Cc,Dc={};function Nc(){if(mc)return wc;mc=1,ec();var t=z(),n=wr(),r=ic(),i=V(),e=Cn(),s=Kn(),u=e("species"),o=RegExp.prototype;return wc=function(a,c,f,h){var d=e(a),v=!i(function(){var t={};return t[d]=function(){return 7},7!==""[a](t)}),l=v&&!i(function(){var t=!1,n=/a/;if("split"===a){var r={};r[u]=function(){return n},(n={constructor:r,flags:""})[d]=/./[d]}return n.exec=function(){return t=!0,null},n[d](""),!t});if(!v||!l||f){var g=/./[d],w=c(d,""[a],function(n,i,e,s,u){var a=i.exec;return a===r||a===o.exec?v&&!u?{done:!0,value:t(g,i,e,s)}:{done:!0,value:t(n,e,i,s)}:{done:!1}});n(String.prototype,a,w[0]),n(o,d,w[1])}h&&s(o[d],"sham",!0)},wc}function Fc(){if(yc)return pc;yc=1;var t=Nt(),n=Mr(),r=Va(),i=xt(),e=t("".charAt),s=t("".charCodeAt),u=t("".slice),o=function(t){return function(o,a){var c,f,h=r(i(o)),d=n(a),v=h.length;return d<0||d>=v?t?"":void 0:(c=s(h,d))<55296||c>56319||d+1===v||(f=s(h,d+1))<56320||f>57343?t?e(h,d):c:t?u(h,d,d+2):f-56320+(c-55296<<10)+65536}};return pc={codeAt:o(!1),charAt:o(!0)}}function Pc(){if(Ec)return bc;Ec=1;var t=Fc().charAt;return bc=function(n,r,i){return r+(i&&t(n,r).length||1)}}function Mc(){if(Sc)return Ic;Sc=1;var t=Nt(),n=An(),r=Math.floor,i=t("".charAt),e=t("".replace),s=t("".slice),u=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,o=/\$([$&'`]|\d{1,2})/g;return Ic=function(t,a,c,f,h,d){var v=c+t.length,l=f.length,g=o;return void 0!==h&&(h=n(h),g=u),e(d,g,function(n,e){var u;switch(i(e,0)){case"$":return"$";case"&":return t;case"`":return s(a,0,c);case"'":return s(a,v);case"<":u=h[s(e,1,-1)];break;default:var o=+e;if(0===o)return n;if(o>l){var d=r(o/10);return 0===d?n:d<=l?void 0===f[d-1]?i(e,1):f[d-1]+i(e,1):n}u=f[o-1]}return void 0===u?"":u})}}function xc(){if(Ac)return Rc;Ac=1;var t=z(),n=_n(),r=zt(),i=function(){if(kc)return Tc;kc=1;var t=_(),n=V(),r=t.RegExp,i=!n(function(){var t=!0;try{r(".","d")}catch(n){t=!1}var n={},i="",e=t?"dgimsy":"gimsy",s=function(t,r){Object.defineProperty(n,t,{get:function(){return i+=r,!0}})},u={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in t&&(u.hasIndices="d"),u)s(o,u[o]);return Object.getOwnPropertyDescriptor(r.prototype,"flags").get.call(n)!==e||i!==e});return Tc={correct:i}}(),e=Za(),s=RegExp.prototype;return Rc=i.correct?function(t){return t.flags}:function(u){return i.correct||!r(s,u)||n(u,"flags")?u.flags:t(e,u)}}function Uc(){if(Oc)return _c;Oc=1;var t=z(),n=qn(),r=Vt(),i=Ft(),e=ic(),s=TypeError;return _c=function(u,o){var a=u.exec;if(r(a)){var c=t(a,u,o);return null!==c&&n(c),c}if("RegExp"===i(u))return t(e,u,o);throw new s("RegExp#exec called on incompatible receiver")}}!function(){if(Cc)return Dc;Cc=1;var t=ks(),n=z(),r=Nt(),i=Nc(),e=V(),s=qn(),u=Vt(),o=jt(),a=Mr(),c=Ur(),f=Va(),h=xt(),d=Pc(),v=$t(),l=Mc(),g=xc(),w=Uc(),m=Cn()("replace"),p=Math.max,y=Math.min,b=r([].concat),E=r([].push),I=r("".indexOf),S=r("".slice),T=function(t){return void 0===t?t:String(t)},k="$0"==="a".replace(/./,"$0"),R=!!/./[m]&&""===/./[m]("a","$0");i("replace",function(r,i,e){var k=R?"$":"$0";return[function(t,r){var e=h(this),s=o(t)?v(t,m):void 0;return s?n(s,t,e,r):n(i,f(e),t,r)},function(n,r){var o=s(this),h=f(n),v=u(r);v||(r=f(r));var m=f(g(o));if("string"==typeof r&&!~I(r,k)&&!~I(r,"$<")&&!~I(m,"y")){var R=e(i,o,h,r);if(R.done)return R.value}var A,_=!!~I(m,"g");_&&(A=!!~I(m,"u")||!!~I(m,"v"),o.lastIndex=0);for(var O,C=[];null!==(O=w(o,h))&&(E(C,O),_);){""===f(O[0])&&(o.lastIndex=d(h,c(o.lastIndex),A))}for(var D="",N=0,F=0;F<C.length;F++){for(var P,M=f((O=C[F])[0]),x=p(y(a(O.index),h.length),0),U=[],V=1;V<O.length;V++)E(U,T(O[V]));var j=O.groups;if(v){var L=b([M],U,x,h);void 0!==j&&E(L,j),P=f(t(r,void 0,L))}else P=l(M,h,x,U,j,r);x>=N&&(D+=S(h,N,x)+P,N=x+M.length)}return D+S(h,N)}]},!!e(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})||!k||R)}();var Vc,jc={};!function(){if(Vc)return jc;Vc=1;var t,n=Ti(),r=Rs(),i=Mn().f,e=Ur(),s=Va(),u=lc(),o=xt(),a=gc(),c=Sn(),f=r("".slice),h=Math.min,d=a("startsWith");n({target:"String",proto:!0,forced:!!(c||d||(t=i(String.prototype,"startsWith"),!t||t.writable))&&!d},{startsWith:function(t){var n=s(o(this));u(t);var r=s(t),i=e(h(arguments.length>1?arguments[1]:void 0,n.length));return f(n,i,i+r.length)===r}})}();var Lc,zc,Bc,Gc,Wc,qc,Hc,Kc,Xc,$c,Qc,Jc,Yc,Zc,tf,nf,rf,ef=function(){function t(t){this.baseUrl=t.baseUrl.replace(/\/$/,"")}return t.prototype.request=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i,e,s,u,o,a,c,f,h,d;return void 0===n&&(n={}),Gu(this,function(v){switch(v.label){case 0:r=n.method,i=void 0===r?"GET":r,e=n.headers,s=void 0===e?{}:e,u=n.body,o=!t||t.startsWith("/")?t:"/".concat(t),a="".concat(this.baseUrl).concat(o),v.label=1;case 1:return v.trys.push([1,6,,7]),c={method:i,headers:zu({"Content-Type":"application/json"},s),body:u?JSON.stringify(u):null},[4,fetch(a,c)];case 2:return(f=v.sent()).ok?[3,4]:[4,f.text()];case 3:throw h=v.sent(),new Error("HTTP ".concat(f.status,": ").concat(f.statusText," - ").concat(h));case 4:return[4,f.json()];case 5:return[2,v.sent()];case 6:throw d=v.sent(),this.handleError(d);case 7:return[2]}})})},t.prototype.handleError=function(t){return t instanceof Error?"AbortError"===t.name?{code:ho,message:"Request timeout",details:t}:t.message.includes("HTTP 401")||t.message.includes("HTTP 403")?{code:fo,message:"Authentication failed",details:t}:(t.message.includes("HTTP"),{code:ho,message:t.message,details:t}):{code:ho,message:"Unknown error: ".concat(String(t)),details:t}},t.prototype.get=function(t){return Bu(this,arguments,void 0,function(t,n){return void 0===n&&(n={}),Gu(this,function(r){return[2,this.request(t,zu(zu({},n),{method:"GET"}))]})})},t.prototype.post=function(t,n){return Bu(this,arguments,void 0,function(t,n,r){return void 0===r&&(r={}),Gu(this,function(i){return[2,this.request(t,zu(zu({},r),{method:"POST",body:n}))]})})},t.prototype.put=function(t,n){return Bu(this,arguments,void 0,function(t,n,r){return void 0===r&&(r={}),Gu(this,function(i){return[2,this.request(t,zu(zu({},r),{method:"PUT",body:n}))]})})},t.prototype.delete=function(t){return Bu(this,arguments,void 0,function(t,n){return void 0===n&&(n={}),Gu(this,function(r){return[2,this.request(t,zu(zu({},n),{method:"DELETE"}))]})})},t}(),sf={};function uf(){return zc?Lc:(zc=1,Lc=Object.is||function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n})}function of(){if(Hc)return qc;Hc=1;var t=_n(),n=Vt(),r=An(),i=dr(),e=function(){if(Wc)return Gc;Wc=1;var t=V();return Gc=!t(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})}(),s=i("IE_PROTO"),u=Object,o=u.prototype;return qc=e?u.getPrototypeOf:function(i){var e=r(i);if(t(e,s))return e[s];var a=e.constructor;return n(a)&&e instanceof a?a.prototype:e instanceof u?o:null}}function af(){if(Xc)return Kc;Xc=1;var t,n,r,i=V(),e=Vt(),s=jt(),u=$i(),o=of(),a=wr(),c=Cn(),f=Sn(),h=c("iterator"),d=!1;return[].keys&&("next"in(r=[].keys())?(n=o(o(r)))!==Object.prototype&&(t=n):d=!0),!s(t)||i(function(){var n={};return t[h].call(n)!==n})?t={}:f&&(t=u(t)),e(t[h])||a(t,h,function(){return this}),Kc={IteratorPrototype:t,BUGGY_SAFARI_ITERATORS:d}}function cf(){if(Qc)return $c;Qc=1;var t=af().IteratorPrototype,n=$i(),r=Dt(),i=ys(),e=ou(),s=function(){return this};return $c=function(u,o,a,c){var f=o+" Iterator";return u.prototype=n(t,{next:r(+!c,a)}),i(u,f,!1,!0),e[f]=s,u}}function ff(){if(Yc)return Jc;Yc=1;var t=Ti(),n=z(),r=Sn(),i=fr(),e=Vt(),s=cf(),u=of(),o=ps(),a=ys(),c=Kn(),f=wr(),h=Cn(),d=ou(),v=af(),l=i.PROPER,g=i.CONFIGURABLE,w=v.IteratorPrototype,m=v.BUGGY_SAFARI_ITERATORS,p=h("iterator"),y="keys",b="values",E="entries",I=function(){return this};return Jc=function(i,h,v,S,T,k,R){s(v,h,S);var A,_,O,C=function(t){if(t===T&&M)return M;if(!m&&t&&t in F)return F[t];switch(t){case y:case b:case E:return function(){return new v(this,t)}}return function(){return new v(this)}},D=h+" Iterator",N=!1,F=i.prototype,P=F[p]||F["@@iterator"]||T&&F[T],M=!m&&P||C(T),x="Array"===h&&F.entries||P;if(x&&(A=u(x.call(new i)))!==Object.prototype&&A.next&&(r||u(A)===w||(o?o(A,w):e(A[p])||f(A,p,I)),a(A,D,!0,!0),r&&(d[D]=I)),l&&T===b&&P&&P.name!==b&&(!r&&g?c(F,"name",b):(N=!0,M=function(){return n(P,this)})),T)if(_={values:C(b),keys:k?M:C(y),entries:C(E)},R)for(O in _)(m||N||!(O in F))&&f(F,O,_[O]);else t({target:h,proto:!0,forced:m||N},_);return r&&!R||F[p]===M||f(F,p,M,{name:T}),d[h]=M,_},Jc}function hf(){return tf?Zc:(tf=1,Zc=function(t,n){return{value:t,done:n}})}function df(){if(rf)return nf;rf=1;var t=Ut(),n=Qi(),r=ou(),i=lr(),e=Hn().f,s=ff(),u=hf(),o=Sn(),a=j(),c="Array Iterator",f=i.set,h=i.getterFor(c);nf=s(Array,"Array",function(n,r){f(this,{type:c,target:t(n),index:0,kind:r})},function(){var t=h(this),n=t.target,r=t.index++;if(!n||r>=n.length)return t.target=null,u(void 0,!0);switch(t.kind){case"keys":return u(r,!1);case"values":return u(n[r],!1)}return u([r,n[r]],!1)},"values");var d=r.Arguments=r.Array;if(n("keys"),n("values"),n("entries"),!o&&a&&"values"!==d.name)try{e(d,"name",{value:"values"})}catch(t){}return nf}!function(){if(Bc)return sf;Bc=1;var t=z(),n=Nc(),r=qn(),i=jt(),e=xt(),s=uf(),u=Va(),o=$t(),a=Uc();n("search",function(n,c,f){return[function(r){var s=e(this),a=i(r)?o(r,n):void 0;return a?t(a,r,s):new RegExp(r)[n](u(s))},function(t){var n=r(this),i=u(t),e=f(c,n,i);if(e.done)return e.value;var o=n.lastIndex;s(o,0)||(n.lastIndex=0);var h=a(n,i);return s(n.lastIndex,o)||(n.lastIndex=o),null===h?-1:h.index}]})}(),df();var vf,lf,gf,wf,mf,pf={};function yf(){if(lf)return vf;lf=1;var t=Vt(),n=jt(),r=ps();return vf=function(i,e,s){var u,o;return r&&t(u=e.constructor)&&u!==s&&n(o=u.prototype)&&o!==s.prototype&&r(i,o),i}}function bf(){if(wf)return gf;wf=1;var t=Hn().f;return gf=function(n,r,i){i in n||t(n,i,{configurable:!0,get:function(){return r[i]},set:function(t){r[i]=t}})}}!function(){if(mf)return pf;mf=1;var t=j(),n=_(),r=Nt(),i=Si(),e=yf(),s=Kn(),u=$i(),o=Br().f,a=zt(),c=vc(),f=Va(),h=xc(),d=tc(),v=bf(),l=wr(),g=V(),w=_n(),m=lr().enforce,p=Es(),y=Cn(),b=nc(),E=rc(),I=y("match"),S=n.RegExp,T=S.prototype,k=n.SyntaxError,R=r(T.exec),A=r("".charAt),O=r("".replace),C=r("".indexOf),D=r("".slice),N=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,F=/a/g,P=/a/g,M=new S(F)!==F,x=d.MISSED_STICKY,U=d.UNSUPPORTED_Y,L=t&&(!M||x||b||E||g(function(){return P[I]=!1,S(F)!==F||S(P)===P||"/a/i"!==String(S(F,"i"))}));if(i("RegExp",L)){for(var z=function(t,n){var r,i,o,d,v,l,g=a(T,this),p=c(t),y=void 0===n,I=[],_=t;if(!g&&p&&y&&t.constructor===z)return t;if((p||a(T,t))&&(t=t.source,y&&(n=h(_))),t=void 0===t?"":f(t),n=void 0===n?"":f(n),_=t,b&&"dotAll"in F&&(i=!!n&&C(n,"s")>-1)&&(n=O(n,/s/g,"")),r=n,x&&"sticky"in F&&(o=!!n&&C(n,"y")>-1)&&U&&(n=O(n,/y/g,"")),E&&(d=function(t){for(var n,r=t.length,i=0,e="",s=[],o=u(null),a=!1,c=!1,f=0,h="";i<r;i++){if("\\"===(n=A(t,i))){if(n+=A(t,++i),!c&&"\\"===A(n,1)){e+="\\x5c";continue}}else if("]"===n)a=!1;else if(!a)switch(!0){case"["===n:a=!0;break;case"("===n:e+=n,R(N,D(t,i+1))?(i+=2,c=!0,f++):"?"!==A(t,i+1)&&f++;continue;case">"===n&&c:if(""===h||w(o,h))throw new k("Invalid capture group name");o[h]=!0,s[s.length]=[h,f],c=!1,h="";continue}c?h+=n:e+=n}for(var d=0;d<s.length;d++)for(var v="\\k<"+s[d][0]+">",l="\\"+s[d][1];C(e,v)>-1;)e=O(e,v,l);return[e,s]}(t),t=d[0],I=d[1]),v=e(S(t,n),g?this:T,z),(i||o||I.length)&&(l=m(v),i&&(l.dotAll=!0,l.raw=z(function(t){for(var n,r=t.length,i=0,e="",s=!1;i<r;i++)"\\"!==(n=A(t,i))?s||"."!==n?("["===n?s=!0:"]"===n&&(s=!1),e+=n):e+="[\\s\\S]":e+=n+A(t,++i);return e}(t),r)),o&&(l.sticky=!0),I.length&&(l.groups=I)),t!==_)try{s(v,"source",""===_?"(?:)":_)}catch(t){}return v},B=o(S),G=0;B.length>G;)v(z,S,B[G++]);T.constructor=z,z.prototype=T,l(n,"RegExp",z,{constructor:!0})}p("RegExp")}();var Ef,If={};!function(){if(Ef)return If;Ef=1;var t=fr().PROPER,n=wr(),r=qn(),i=Va(),e=V(),s=xc(),u="toString",o=RegExp.prototype,a=o[u],c=e(function(){return"/a/b"!==a.call({source:"a",flags:"b"})}),f=t&&a.name!==u;(c||f)&&n(o,u,function(){var t=r(this);return"/"+i(t.source)+"/"+i(s(t))},{unsafe:!0})}();var Sf,Tf={};function kf(){if(Sf)return Tf;Sf=1;var t=Fc().charAt,n=Va(),r=lr(),i=ff(),e=hf(),s="String Iterator",u=r.set,o=r.getterFor(s);return i(String,"String",function(t){u(this,{type:s,string:n(t),index:0})},function(){var n,r=o(this),i=r.string,s=r.index;return s>=i.length?e(void 0,!0):(n=t(i,s),r.index+=n.length,e(n,!1))}),Tf}kf();var Rf,Af={};!function(){if(Rf)return Af;Rf=1;var t=z(),n=Nt(),r=Nc(),i=qn(),e=jt(),s=Ur(),u=Va(),o=xt(),a=$t(),c=Pc(),f=xc(),h=Uc(),d=n("".indexOf);r("match",function(n,r,v){return[function(r){var i=o(this),s=e(r)?a(r,n):void 0;return s?t(s,r,i):new RegExp(r)[n](u(i))},function(t){var n=i(this),e=u(t),o=v(r,n,e);if(o.done)return o.value;var a=u(f(n));if(!~d(a,"g"))return h(n,e);var l=!!~d(a,"u")||!!~d(a,"v");n.lastIndex=0;for(var g,w=[],m=0;null!==(g=h(n,e));){var p=u(g[0]);w[m]=p,""===p&&(n.lastIndex=c(e,s(n.lastIndex),l)),m++}return 0===m?null:w}]})}();var _f,Of={};!function(){if(_f)return Of;_f=1;var t=_(),n=Uu(),r=Vu(),i=df(),e=Kn(),s=ys(),u=Cn()("iterator"),o=i.values,a=function(t,r){if(t){if(t[u]!==o)try{e(t,u,o)}catch(n){t[u]=o}if(s(t,r,!0),n[r])for(var a in i)if(t[a]!==i[a])try{e(t,a,i[a])}catch(n){t[a]=i[a]}}};for(var c in n)a(t[c]&&t[c].prototype,c);a(r,"DOMTokenList")}();var Cf,Df,Nf,Ff,Pf,Mf,xf,Uf,Vf,jf,Lf={};function zf(){if(Df)return Cf;Df=1;var t=V(),n=Cn(),r=j(),i=Sn(),e=n("iterator");return Cf=!t(function(){var t=new URL("b?a=1&b=2&c=3","https://a"),n=t.searchParams,s=new URLSearchParams("a=1&a=2&b=3"),u="";return t.pathname="c%20d",n.forEach(function(t,r){n.delete("b"),u+=r+t}),s.delete("a",2),s.delete("b",void 0),i&&(!t.toJSON||!s.has("a",1)||s.has("a",2)||!s.has("a",void 0)||s.has("b"))||!n.size&&(i||!r)||!n.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==n.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!n[e]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==u||"x"!==new URL("https://x",void 0).host})}function Bf(){if(Mf)return Pf;Mf=1;var t=qn(),n=hu();return Pf=function(r,i,e,s){try{return s?i(t(e)[0],e[1]):i(e)}catch(t){n(r,"throw",t)}}}function Gf(){if(Uf)return xf;Uf=1;var t=As(),n=z(),r=An(),i=Bf(),e=au(),s=Di(),u=Vr(),o=Ai(),a=_i(),c=fu(),f=cu(),h=hu(),d=Array;return xf=function(v){var l=s(this),g=arguments.length,w=g>1?arguments[1]:void 0,m=void 0!==w;m&&(w=t(w,g>2?arguments[2]:void 0));var p,y,b,E,I,S,T=r(v),k=f(T),R=0;if(!k||this===d&&e(k))for(p=u(T),y=l?new this(p):d(p);p>R;R++)S=m?w(T[R],R):T[R],o(y,R,S);else for(y=l?new this:[],I=(E=c(T,k)).next;!(b=n(I,E)).done;R++){S=m?i(E,w,[b.value,R],!0):b.value;try{o(y,R,S)}catch(t){h(E,"throw",t)}}return a(y,R),y},xf}function Wf(){if(jf)return Vf;jf=1;var t=Nt(),n=2147483647,r=/[^\0-\u007E]/,i=/[.\u3002\uFF0E\uFF61]/g,e="Overflow: input needs wider integers to process",s=RangeError,u=t(i.exec),o=Math.floor,a=String.fromCharCode,c=t("".charCodeAt),f=t([].join),h=t([].push),d=t("".replace),v=t("".split),l=t("".toLowerCase),g=function(t){return t+22+75*(t<26)},w=function(t,n,r){var i=0;for(t=r?o(t/700):t>>1,t+=o(t/n);t>455;)t=o(t/35),i+=36;return o(i+36*t/(t+38))},m=function(t){var r=[];t=function(t){for(var n=[],r=0,i=t.length;r<i;){var e=c(t,r++);if(e>=55296&&e<=56319&&r<i){var s=c(t,r++);56320==(64512&s)?h(n,((1023&e)<<10)+(1023&s)+65536):(h(n,e),r--)}else h(n,e)}return n}(t);var i,u,d=t.length,v=128,l=0,m=72;for(i=0;i<t.length;i++)(u=t[i])<128&&h(r,a(u));var p=r.length,y=p;for(p&&h(r,"-");y<d;){var b=n;for(i=0;i<t.length;i++)(u=t[i])>=v&&u<b&&(b=u);var E=y+1;if(b-v>o((n-l)/E))throw new s(e);for(l+=(b-v)*E,v=b,i=0;i<t.length;i++){if((u=t[i])<v&&++l>n)throw new s(e);if(u===v){for(var I=l,S=36;;){var T=S<=m?1:S>=m+26?26:S-m;if(I<T)break;var k=I-T,R=36-T;h(r,a(g(T+k%R))),I=o(k/R),S+=36}h(r,a(g(I))),m=w(l,E,y===p),l=0,y++}}l++,v++}return f(r,"")};return Vf=function(t){var n,e,s=[],o=v(d(l(t),i,"."),".");for(n=0;n<o.length;n++)e=o[n],h(s,u(r,e)?"xn--"+m(e):e);return f(s,".")}}var qf,Hf,Kf,Xf,$f,Qf,Jf,Yf,Zf,th={};function nh(){if(Kf)return Hf;Kf=1;var t=wr();return Hf=function(n,r,i){for(var e in r)t(n,e,r[e],i);return n}}function rh(){if($f)return Xf;$f=1;var t=_s(),n=Math.floor,r=function(i,e){var s=i.length;if(s<8)for(var u,o,a=1;a<s;){for(o=a,u=i[a];o&&e(i[o-1],u)>0;)i[o]=i[--o];o!==a++&&(i[o]=u)}else for(var c=n(s/2),f=r(t(i,0,c),e),h=r(t(i,c),e),d=f.length,v=h.length,l=0,g=0;l<d||g<v;)i[l+g]=l<d&&g<v?e(f[l],h[g])<=0?f[l++]:h[g++]:l<d?f[l++]:h[g++];return i};return Xf=r}function ih(){if(Jf)return Qf;Jf=1,df(),function(){if(qf)return th;qf=1;var t=Ti(),n=Nt(),r=xr(),i=RangeError,e=String.fromCharCode,s=String.fromCodePoint,u=n([].join);t({target:"String",stat:!0,arity:1,forced:!!s&&1!==s.length},{fromCodePoint:function(t){for(var n,s=[],o=arguments.length,a=0;o>a;){if(r(n=+arguments[a],1114111)!==n)throw new i(n+" is not a valid code point");s[a++]=n<65536?e(n):e(55296+((n-=65536)>>10),n%1024+56320)}return u(s,"")}})}();var t=Ti(),n=_(),r=Ns(),i=Lt(),e=z(),s=Nt(),u=j(),o=zf(),a=wr(),c=bs(),f=nh(),h=ys(),d=cf(),v=lr(),l=Is(),g=Vt(),w=_n(),m=As(),p=Ci(),y=qn(),b=jt(),E=Va(),I=$i(),S=Dt(),T=fu(),k=cu(),R=hf(),A=Os(),O=Cn(),C=rh(),D=O("iterator"),N="URLSearchParams",F=N+"Iterator",P=v.set,M=v.getterFor(N),x=v.getterFor(F),U=r("fetch"),V=r("Request"),L=r("Headers"),B=V&&V.prototype,G=L&&L.prototype,W=n.TypeError,q=n.encodeURIComponent,H=String.fromCharCode,K=i("String","fromCodePoint"),X=parseInt,$=s("".charAt),Q=s([].join),J=s([].push),Y=s("".replace),Z=s([].shift),tt=s([].splice),nt=s("".split),rt=s("".slice),it=s(/./.exec),et=/\+/g,st=/^[0-9a-f]+$/i,ut=function(t,n){var r=rt(t,n,n+2);return it(st,r)?X(r,16):NaN},ot=function(t){for(var n=0,r=128;r>0&&0!==(t&r);r>>=1)n++;return n},at=function(t){var n=null,r=t.length;switch(r){case 1:n=t[0];break;case 2:n=(31&t[0])<<6|63&t[1];break;case 3:n=(15&t[0])<<12|(63&t[1])<<6|63&t[2];break;case 4:n=(7&t[0])<<18|(63&t[1])<<12|(63&t[2])<<6|63&t[3]}return null===n||n>1114111||n>=55296&&n<=57343||n<(r>3?65536:r>2?2048:r>1?128:0)?null:n},ct=function(t){for(var n=(t=Y(t,et," ")).length,r="",i=0;i<n;){var e=$(t,i);if("%"===e){if("%"===$(t,i+1)||i+3>n){r+="%",i++;continue}var s=ut(t,i+1);if(s!=s){r+=e,i++;continue}i+=2;var u=ot(s);if(0===u)e=H(s);else{if(1===u||u>4){r+="�",i++;continue}for(var o=[s],a=1;a<u&&!(++i+3>n||"%"!==$(t,i));){var c=ut(t,i+1);if(c!=c||c>191||c<128)break;if(1===a){if(224===s&&c<160)break;if(237===s&&c>159)break;if(240===s&&c<144)break;if(244===s&&c>143)break}J(o,c),i+=2,a++}if(o.length!==u){r+="�";continue}var f=at(o);if(null===f){for(var h=0;h<u;h++)r+="�";i++;continue}e=K(f)}}r+=e,i++}return r},ft=/[!'()~]|%20/g,ht={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},dt=function(t){return ht[t]},vt=function(t){return Y(q(t),ft,dt)},lt=d(function(t,n){P(this,{type:F,target:M(t).entries,index:0,kind:n})},N,function(){var t=x(this),n=t.target,r=t.index++;if(!n||r>=n.length)return t.target=null,R(void 0,!0);var i=n[r];switch(t.kind){case"keys":return R(i.key,!1);case"values":return R(i.value,!1)}return R([i.key,i.value],!1)},!0),gt=function(t){this.entries=[],this.url=null,void 0!==t&&(b(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===$(t,0)?rt(t,1):t:E(t)))};gt.prototype={type:N,bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var n,r,i,s,u,o,a,c=this.entries,f=k(t);if(f)for(r=(n=T(t,f)).next;!(i=e(r,n)).done;){if(u=(s=T(y(i.value))).next,(o=e(u,s)).done||(a=e(u,s)).done||!e(u,s).done)throw new W("Expected sequence with length 2");J(c,{key:E(o.value),value:E(a.value)})}else for(var h in t)w(t,h)&&J(c,{key:h,value:E(t[h])})},parseQuery:function(t){if(t)for(var n,r,i=this.entries,e=nt(t,"&"),s=0;s<e.length;)(n=e[s++]).length&&(r=nt(n,"="),J(i,{key:ct(Z(r)),value:ct(Q(r,"="))}))},serialize:function(){for(var t,n=this.entries,r=[],i=0;i<n.length;)t=n[i++],J(r,vt(t.key)+"="+vt(t.value));return Q(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var wt=function(){l(this,mt);var t=P(this,new gt(arguments.length>0?arguments[0]:void 0));u||(this.size=t.entries.length)},mt=wt.prototype;if(f(mt,{append:function(t,n){var r=M(this);A(arguments.length,2),J(r.entries,{key:E(t),value:E(n)}),u||this.size++,r.updateURL()},delete:function(t){for(var n=M(this),r=A(arguments.length,1),i=n.entries,e=E(t),s=r<2?void 0:arguments[1],o=void 0===s?s:E(s),a=0;a<i.length;){var c=i[a];c.key!==e||void 0!==o&&c.value!==o?a++:tt(i,a,1)}u||(this.size=i.length),n.updateURL()},get:function(t){var n=M(this).entries;A(arguments.length,1);for(var r=E(t),i=0;i<n.length;i++)if(n[i].key===r)return n[i].value;return null},getAll:function(t){var n=M(this).entries;A(arguments.length,1);for(var r=E(t),i=[],e=0;e<n.length;e++)n[e].key===r&&J(i,n[e].value);return i},has:function(t){for(var n=M(this).entries,r=A(arguments.length,1),i=E(t),e=r<2?void 0:arguments[1],s=void 0===e?e:E(e),u=0;u<n.length;){var o=n[u++];if(o.key===i&&(void 0===s||o.value===s))return!0}return!1},set:function(t,n){var r=M(this);A(arguments.length,2);for(var i,e=r.entries,s=!1,o=E(t),a=E(n),c=0;c<e.length;c++)(i=e[c]).key===o&&(s?tt(e,c--,1):(s=!0,i.value=a));s||J(e,{key:o,value:a}),u||(this.size=e.length),r.updateURL()},sort:function(){var t=M(this);C(t.entries,function(t,n){return t.key>n.key?1:-1}),t.updateURL()},forEach:function(t){for(var n,r=M(this).entries,i=m(t,arguments.length>1?arguments[1]:void 0),e=0;e<r.length;)i((n=r[e++]).value,n.key,this)},keys:function(){return new lt(this,"keys")},values:function(){return new lt(this,"values")},entries:function(){return new lt(this,"entries")}},{enumerable:!0}),a(mt,D,mt.entries,{name:"entries"}),a(mt,"toString",function(){return M(this).serialize()},{enumerable:!0}),u&&c(mt,"size",{get:function(){return M(this).entries.length},configurable:!0,enumerable:!0}),h(wt,N),t({global:!0,constructor:!0,forced:!o},{URLSearchParams:wt}),!o&&g(L)){var pt=s(G.has),yt=s(G.set),bt=function(t){if(b(t)){var n,r=t.body;if(p(r)===N)return n=t.headers?new L(t.headers):new L,pt(n,"content-type")||yt(n,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),I(t,{body:S(0,E(r)),headers:S(0,n)})}return t};if(g(U)&&t({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return U(t,arguments.length>1?bt(arguments[1]):{})}}),g(V)){var Et=function(t){return l(this,B),new V(t,arguments.length>1?bt(arguments[1]):{})};B.constructor=Et,Et.prototype=B,t({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Et})}}return Qf={URLSearchParams:wt,getState:M}}function eh(){if(Yf)return Lf;Yf=1,kf();var t,n=Ti(),r=j(),i=zf(),e=_(),s=As(),u=Nt(),o=wr(),a=bs(),c=Is(),f=_n(),h=function(){if(Ff)return Nf;Ff=1;var t=j(),n=Nt(),r=z(),i=V(),e=Ki(),s=bi(),u=Ct(),o=An(),a=Pt(),c=Object.assign,f=Object.defineProperty,h=n([].concat);return Nf=!c||i(function(){if(t&&1!==c({b:1},c(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var n={},r={},i=Symbol("assign detection"),s="abcdefghijklmnopqrst";return n[i]=7,s.split("").forEach(function(t){r[t]=t}),7!==c({},n)[i]||e(c({},r)).join("")!==s})?function(n,i){for(var c=o(n),f=arguments.length,d=1,v=s.f,l=u.f;f>d;)for(var g,w=a(arguments[d++]),m=v?h(e(w),v(w)):e(w),p=m.length,y=0;p>y;)g=m[y++],t&&!r(l,w,g)||(c[g]=w[g]);return c}:c,Nf}(),d=Gf(),v=_s(),l=Fc().codeAt,g=Wf(),w=Va(),m=ys(),p=Os(),y=ih(),b=lr(),E=b.set,I=b.getterFor("URL"),S=y.URLSearchParams,T=y.getState,k=e.URL,R=e.TypeError,A=e.encodeURIComponent,O=e.parseInt,C=Math.floor,D=Math.pow,N=u("".charAt),F=u(/./.exec),P=u([].join),M=u(1.1.toString),x=u([].pop),U=u([].push),L=u("".replace),B=u([].shift),G=u("".split),W=u("".slice),q=u("".toLowerCase),H=u([].unshift),K="Invalid scheme",X="Invalid host",$="Invalid port",Q=/[a-z]/i,J=/[\d+\-.a-z]/i,Y=/\d/,Z=/^0x/i,tt=/^[0-7]+$/,nt=/^\d+$/,rt=/^[\da-f]+$/i,it=/[\0\t\n\r #%/:<>?@[\\\]^|]/,et=/[\0\t\n\r #/:<>?@[\\\]^|]/,st=/^[\u0000-\u0020]+/,ut=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ot=/[\t\n\r]/g,at=function(t){var n,r,i,e;if("number"==typeof t){for(n=[],r=0;r<4;r++)H(n,t%256),t=C(t/256);return P(n,".")}if("object"==typeof t){for(n="",i=function(t){for(var n=null,r=1,i=null,e=0,s=0;s<8;s++)0!==t[s]?(e>r&&(n=i,r=e),i=null,e=0):(null===i&&(i=s),++e);return e>r?i:n}(t),r=0;r<8;r++)e&&0===t[r]||(e&&(e=!1),i===r?(n+=r?":":"::",e=!0):(n+=M(t[r],16),r<7&&(n+=":")));return"["+n+"]"}return t},ct={},ft=h({},ct,{" ":1,'"':1,"#":1,"<":1,">":1}),ht=h({},ft,{"'":1}),dt=h({},ct,{" ":1,'"':1,"<":1,">":1,"`":1}),vt=h({},dt,{"#":1,"?":1,"{":1,"}":1,"^":1}),lt=h({},vt,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),gt=function(t,n){var r=l(t,0);return r>=32&&r<127&&!f(n,t)?t:"'"===t&&f(n,t)?"%27":A(t)},wt={ftp:21,file:null,http:80,https:443,ws:80,wss:443},mt=function(t,n){var r;return 2===t.length&&F(Q,N(t,0))&&(":"===(r=N(t,1))||!n&&"|"===r)},pt=function(t){var n;return t.length>1&&mt(W(t,0,2))&&(2===t.length||"/"===(n=N(t,2))||"\\"===n||"?"===n||"#"===n)},yt=function(t){return"."===t||"%2e"===q(t)},bt=function(t){return".."===(t=q(t))||"%2e."===t||".%2e"===t||"%2e%2e"===t},Et={},It={},St={},Tt={},kt={},Rt={},At={},_t={},Ot={},Dt={},Ft={},Mt={},xt={},Ut={},Vt={},jt={},Lt={},zt={},Bt={},Gt={},Wt={},qt=function(t,n,r){var i,e,s,u=w(t);if(n){if(e=this.parse(u))throw new R(e);this.searchParams=null}else{if(void 0!==r&&(i=new qt(r,!0)),e=this.parse(u,null,i))throw new R(e);(s=T(new S)).bindURL(this),this.searchParams=s}};qt.prototype={type:"URL",parse:function(n,r,i){var e,s,u,o,a=this,c=r||Et,h=0,l="",g=!1,m=!1,p=!1;for(n=w(n),r||(a.scheme="",a.username="",a.password="",a.host=null,a.port=null,a.path=[],a.query=null,a.fragment=null,a.cannotBeABaseURL=!1,n=L(n,st,""),n=L(n,ut,"$1")),n=L(n,ot,""),e=d(n);h<=e.length;){switch(s=e[h],c){case Et:if(!s||!F(Q,s)){if(r)return K;c=St;continue}l+=q(s),c=It;break;case It:if(s&&F(J,s))l+=q(s);else{if(":"!==s){if(r)return K;l="",c=St,h=0;continue}if(r&&(a.isSpecial()!==f(wt,l)||"file"===l&&(a.includesCredentials()||null!==a.port)||"file"===a.scheme&&""===a.host))return;if(a.scheme=l,r)return void(a.isSpecial()&&wt[a.scheme]===a.port&&(a.port=null));l="","file"===a.scheme?c=Ut:a.isSpecial()&&i&&i.scheme===a.scheme?c=Tt:a.isSpecial()?c=_t:"/"===e[h+1]?(c=kt,h++):(a.cannotBeABaseURL=!0,U(a.path,""),c=Bt)}break;case St:if(!i||i.cannotBeABaseURL&&"#"!==s)return K;if(i.cannotBeABaseURL&&"#"===s){a.scheme=i.scheme,a.path=v(i.path),a.query=i.query,a.fragment="",a.cannotBeABaseURL=!0,c=Wt;break}c="file"===i.scheme?Ut:Rt;continue;case Tt:if("/"!==s||"/"!==e[h+1]){c=Rt;continue}c=Ot,h++;break;case kt:if("/"===s){c=Dt;break}c=zt;continue;case Rt:if(a.scheme=i.scheme,s===t)a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.query=i.query;else if("/"===s||"\\"===s&&a.isSpecial())c=At;else if("?"===s)a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.query="",c=Gt;else{if("#"!==s){a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.path.length&&a.path.length--,c=zt;continue}a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.query=i.query,a.fragment="",c=Wt}break;case At:if(!a.isSpecial()||"/"!==s&&"\\"!==s){if("/"!==s){a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,c=zt;continue}c=Dt}else c=Ot;break;case _t:if(c=Ot,"/"!==s||"/"!==e[h+1])continue;h++;break;case Ot:if("/"!==s&&"\\"!==s){c=Dt;continue}break;case Dt:if("@"===s){g&&(l="%40"+l),g=!0,u=d(l);for(var y=0;y<u.length;y++){var b=u[y];if(":"!==b||p){var E=gt(b,lt);p?a.password+=E:a.username+=E}else p=!0}l=""}else if(s===t||"/"===s||"?"===s||"#"===s||"\\"===s&&a.isSpecial()){if(g&&""===l)return"Invalid authority";h-=d(l).length+1,l="",c=Ft}else l+=s;break;case Ft:case Mt:if(r&&"file"===a.scheme){c=jt;continue}if(":"!==s||m){if(s===t||"/"===s||"?"===s||"#"===s||"\\"===s&&a.isSpecial()){if(a.isSpecial()&&""===l)return X;if(r&&""===l&&(a.includesCredentials()||null!==a.port))return;if(o=a.parseHost(l))return o;if(l="",c=Lt,r)return;continue}"["===s?m=!0:"]"===s&&(m=!1),l+=s}else{if(""===l)return X;if(r===Mt)return;if(o=a.parseHost(l))return o;l="",c=xt}break;case xt:if(!F(Y,s)){if(s===t||"/"===s||"?"===s||"#"===s||"\\"===s&&a.isSpecial()||r){if(""!==l){var I=O(l,10);if(I>65535)return $;a.port=a.isSpecial()&&I===wt[a.scheme]?null:I,l=""}if(r)return;c=Lt;continue}return $}l+=s;break;case Ut:if(a.scheme="file",a.host="","/"===s||"\\"===s)c=Vt;else{if(!i||"file"!==i.scheme){c=zt;continue}switch(s){case t:a.host=i.host,a.path=v(i.path),a.query=i.query;break;case"?":a.host=i.host,a.path=v(i.path),a.query="",c=Gt;break;case"#":a.host=i.host,a.path=v(i.path),a.query=i.query,a.fragment="",c=Wt;break;default:a.host=i.host,pt(P(v(e,h),""))||(a.path=v(i.path),a.shortenPath()),c=zt;continue}}break;case Vt:if("/"===s||"\\"===s){c=jt;break}i&&"file"===i.scheme&&(a.host=i.host,!pt(P(v(e,h),""))&&mt(i.path[0],!0)&&U(a.path,i.path[0])),c=zt;continue;case jt:if(s===t||"/"===s||"\\"===s||"?"===s||"#"===s){if(!r&&mt(l))c=zt;else if(""===l){if(a.host="",r)return;c=Lt}else{if(o=a.parseHost(l))return o;if("localhost"===a.host&&(a.host=""),r)return;l="",c=Lt}continue}l+=s;break;case Lt:if(a.isSpecial()){if(c=zt,"/"!==s&&"\\"!==s)continue}else if(r||"?"!==s)if(r||"#"!==s){if(s!==t&&(c=zt,"/"!==s))continue}else a.fragment="",c=Wt;else a.query="",c=Gt;break;case zt:if(s===t||"/"===s||"\\"===s&&a.isSpecial()||!r&&("?"===s||"#"===s)){if(bt(l)?(a.shortenPath(),"/"===s||"\\"===s&&a.isSpecial()||U(a.path,"")):yt(l)?"/"===s||"\\"===s&&a.isSpecial()||U(a.path,""):("file"===a.scheme&&!a.path.length&&mt(l)&&(null!==a.host&&""!==a.host&&(a.host=""),l=N(l,0)+":"),U(a.path,l)),l="","file"===a.scheme&&(s===t||"?"===s||"#"===s))for(;a.path.length>1&&""===a.path[0];)B(a.path);"?"===s?(a.query="",c=Gt):"#"===s&&(a.fragment="",c=Wt)}else l+=gt(s,vt);break;case Bt:"?"===s?(a.query="",c=Gt):"#"===s?(a.fragment="",c=Wt):s!==t&&(a.path[0]+=gt(s,ct));break;case Gt:r||"#"!==s?s!==t&&(a.query+=gt(s,a.isSpecial()?ht:ft)):(a.fragment="",c=Wt);break;case Wt:s!==t&&(a.fragment+=gt(s,dt))}h++}},parseHost:function(t){var n,r,i;if("["===N(t,0)){if("]"!==N(t,t.length-1))return X;if(n=function(t){var n,r,i,e,s,u,o,a=[0,0,0,0,0,0,0,0],c=0,f=null,h=0,d=function(){return N(t,h)};if(":"===d()){if(":"!==N(t,1))return;h+=2,f=++c}for(;d();){if(8===c)return;if(":"!==d()){for(n=r=0;r<4&&F(rt,d());)n=16*n+O(d(),16),h++,r++;if("."===d()){if(0===r)return;if(h-=r,c>6)return;for(i=0;d();){if(e=null,i>0){if(!("."===d()&&i<4))return;h++}if(!F(Y,d()))return;for(;F(Y,d());){if(s=O(d(),10),null===e)e=s;else{if(0===e)return;e=10*e+s}if(e>255)return;h++}a[c]=256*a[c]+e,2!==++i&&4!==i||c++}if(4!==i)return;break}if(":"===d()){if(h++,!d())return}else if(d())return;a[c++]=n}else{if(null!==f)return;h++,f=++c}}if(null!==f)for(u=c-f,c=7;0!==c&&u>0;)o=a[c],a[c--]=a[f+u-1],a[f+--u]=o;else if(8!==c)return;return a}(W(t,1,-1)),!n)return X;this.host=n}else if(this.isSpecial()){if(t=g(t),F(it,t))return X;if(function(t){var n,r,i=G(t,".");if(""===i[i.length-1]){if(1===i.length)return!1;i.length--}return n=i[i.length-1],!!F(nt,n)||!!F(Z,n)&&(""===(r=W(n,2))||!!F(rt,r))}(t)){if(n=function(t){var n,r,i,e,s,u,o,a=G(t,".");if(a.length&&""===a[a.length-1]&&a.length--,(n=a.length)>4)return null;for(r=[],i=0;i<n;i++){if(""===(e=a[i]))return null;if(s=10,e.length>1&&"0"===N(e,0)&&(s=F(Z,e)?16:8,e=W(e,8===s?1:2)),""===e)u=0;else{if(!F(10===s?nt:8===s?tt:rt,e))return null;u=O(e,s)}U(r,u)}for(i=0;i<n;i++)if(u=r[i],i===n-1){if(u>=D(256,5-n))return null}else if(u>255)return null;for(o=x(r),i=0;i<r.length;i++)o+=r[i]*D(256,3-i);return o}(t),null===n)return X;this.host=n}else this.host=t}else{if(F(et,t))return X;for(n="",r=d(t),i=0;i<r.length;i++)n+=gt(r[i],ct);this.host=n}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return f(wt,this.scheme)},shortenPath:function(){var t=this.path,n=t.length;!n||"file"===this.scheme&&1===n&&mt(t[0],!0)||t.length--},serialize:function(){var t=this,n=t.scheme,r=t.username,i=t.password,e=t.host,s=t.port,u=t.path,o=t.query,a=t.fragment,c=n+":";return null!==e?(c+="//",t.includesCredentials()&&(c+=r+(i?":"+i:"")+"@"),c+=at(e),null!==s&&(c+=":"+s)):"file"===n&&(c+="//"),null===e&&!t.cannotBeABaseURL&&u.length>1&&""===u[0]&&(c+="/."),c+=t.cannotBeABaseURL?u[0]:u.length?"/"+P(u,"/"):"",null!==o&&(c+="?"+o),null!==a&&(c+="#"+a),c},setHref:function(t){var n=this.parse(t);if(n)throw new R(n);this.searchParams.update()},getOrigin:function(){var t=this.scheme,n=this.port;if("blob"===t)try{return new Ht(this.path[0]).origin}catch(t){return"null"}return"file"!==t&&this.isSpecial()?t+"://"+at(this.host)+(null!==n?":"+n:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(t){this.parse(w(t)+":",Et)},getUsername:function(){return this.username},setUsername:function(t){var n=d(w(t));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<n.length;r++)this.username+=gt(n[r],lt)}},getPassword:function(){return this.password},setPassword:function(t){var n=d(w(t));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<n.length;r++)this.password+=gt(n[r],lt)}},getHost:function(){var t=this.host,n=this.port;return null===t?"":null===n?at(t):at(t)+":"+n},setHost:function(t){this.cannotBeABaseURL||this.parse(t,Ft)},getHostname:function(){var t=this.host;return null===t?"":at(t)},setHostname:function(t){this.cannotBeABaseURL||this.parse(t,Mt)},getPort:function(){var t=this.port;return null===t?"":w(t)},setPort:function(t){this.cannotHaveUsernamePasswordPort()||(""===(t=w(t))?this.port=null:this.parse(t,xt))},getPathname:function(){var t=this.path;return this.cannotBeABaseURL?t[0]:t.length?"/"+P(t,"/"):""},setPathname:function(t){this.cannotBeABaseURL||(this.path=[],this.parse(t,Lt))},getSearch:function(){var t=this.query;return t?"?"+t:""},setSearch:function(t){""===(t=w(t))?this.query=null:("?"===N(t,0)&&(t=W(t,1)),this.query="",this.parse(t,Gt)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var t=this.fragment;return t?"#"+t:""},setHash:function(t){""!==(t=w(t))?("#"===N(t,0)&&(t=W(t,1)),this.fragment="",this.parse(t,Wt)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Ht=function(t){var n=c(this,Kt),i=p(arguments.length,1)>1?arguments[1]:void 0,e=E(n,new qt(t,!1,i));r||(n.href=e.serialize(),n.origin=e.getOrigin(),n.protocol=e.getProtocol(),n.username=e.getUsername(),n.password=e.getPassword(),n.host=e.getHost(),n.hostname=e.getHostname(),n.port=e.getPort(),n.pathname=e.getPathname(),n.search=e.getSearch(),n.searchParams=e.getSearchParams(),n.hash=e.getHash())},Kt=Ht.prototype,Xt=function(t,n){return{get:function(){return I(this)[t]()},set:n&&function(t){return I(this)[n](t)},configurable:!0,enumerable:!0}};if(r&&(a(Kt,"href",Xt("serialize","setHref")),a(Kt,"origin",Xt("getOrigin")),a(Kt,"protocol",Xt("getProtocol","setProtocol")),a(Kt,"username",Xt("getUsername","setUsername")),a(Kt,"password",Xt("getPassword","setPassword")),a(Kt,"host",Xt("getHost","setHost")),a(Kt,"hostname",Xt("getHostname","setHostname")),a(Kt,"port",Xt("getPort","setPort")),a(Kt,"pathname",Xt("getPathname","setPathname")),a(Kt,"search",Xt("getSearch","setSearch")),a(Kt,"searchParams",Xt("getSearchParams")),a(Kt,"hash",Xt("getHash","setHash"))),o(Kt,"toJSON",function(){return I(this).serialize()},{enumerable:!0}),o(Kt,"toString",function(){return I(this).serialize()},{enumerable:!0}),k){var $t=k.createObjectURL,Qt=k.revokeObjectURL;$t&&o(Ht,"createObjectURL",s($t,k)),Qt&&o(Ht,"revokeObjectURL",s(Qt,k))}return m(Ht,"URL"),n({global:!0,constructor:!0,forced:!i,sham:!r},{URL:Ht}),Lf}Zf||(Zf=1,eh());var sh,uh={};!function(){if(sh)return uh;sh=1;var t=Ti(),n=z();t({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return n(URL.prototype.toString,this)}})}();var oh;function ah(t,n){var r;if("undefined"!=typeof URLSearchParams)return new URLSearchParams(t).get(n);var i=new RegExp("[?&]"+n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"=([^&#]*)"),e=t.match(i);return e?decodeURIComponent(null!==(r=e[1])&&void 0!==r?r:""):null}function ch(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return"UTC"}}function fh(t){var n,r={campaignName:ah(n=window.location.search,"utm_campaign")||"",campaignSource:ah(n,"utm_source")||"",campaignMedium:ah(n,"utm_medium")||""};return{libraryName:"cap-hydra-web-sdk",libraryVersion:Ra,locale:navigator.language||navigator.languages&&navigator.languages[0]||"en-US",userAgent:navigator.userAgent||"",timezone:ch(),ip:"",campaignName:r.campaignName,campaignSource:r.campaignSource,campaignMedium:r.campaignMedium,pageUrl:window.location.href||"",pagePath:window.location.pathname||"",pageReferrer:document.referrer||"",pageTitle:document.title||"",sessionId:t}}oh||(oh=1,ih());var hh,dh={};!function(){if(hh)return dh;hh=1;var t=Ti(),n=Gf();t({target:"Array",stat:!0,forced:!vu()(function(t){Array.from(t)})},{from:n})}();var vh,lh={};!function(){if(vh)return lh;vh=1;var t=Ti(),n=ju().map;t({target:"Array",proto:!0,forced:!Pi()("map")},{map:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var gh,wh,mh,ph,yh,bh,Eh,Ih,Sh,Th,kh,Rh,Ah,_h,Oh,Ch,Dh,Nh,Fh,Ph={};function Mh(){return wh?gh:(wh=1,gh="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView)}function xh(){if(ph)return mh;ph=1;var t=Mr(),n=Ur(),r=RangeError;return mh=function(i){if(void 0===i)return 0;var e=t(i),s=n(e);if(e!==s)throw new r("Wrong length or index");return s}}function Uh(){if(Th)return Sh;Th=1;var t=bh?yh:(bh=1,yh=Math.sign||function(t){var n=+t;return 0===n||n!=n?n:n<0?-1:1}),n=function(){if(Ih)return Eh;Ih=1;var t=4503599627370496;return Eh=function(n){return n+t-t}}(),r=Math.abs;return Sh=function(i,e,s,u){var o=+i,a=r(o),c=t(o);if(a<u)return c*n(a/u/e)*u*e;var f=(1+e/2220446049250313e-31)*a,h=f-(f-a);return h>s||h!=h?c*(1/0):c*h}}function Vh(){if(_h)return Ah;_h=1;var t=Array,n=Math.abs,r=Math.pow,i=Math.floor,e=Math.log,s=Math.LN2;return Ah={pack:function(u,o,a){var c,f,h,d=t(a),v=8*a-o-1,l=(1<<v)-1,g=l>>1,w=23===o?r(2,-24)-r(2,-77):0,m=u<0||0===u&&1/u<0?1:0,p=0;for((u=n(u))!=u||u===1/0?(f=u!=u?1:0,c=l):(c=i(e(u)/s),u*(h=r(2,-c))<1&&(c--,h*=2),(u+=c+g>=1?w/h:w*r(2,1-g))*h>=2&&(c++,h/=2),c+g>=l?(f=0,c=l):c+g>=1?(f=(u*h-1)*r(2,o),c+=g):(f=u*r(2,g-1)*r(2,o),c=0));o>=8;)d[p++]=255&f,f/=256,o-=8;for(c=c<<o|f,v+=o;v>0;)d[p++]=255&c,c/=256,v-=8;return d[p-1]|=128*m,d},unpack:function(t,n){var i,e=t.length,s=8*e-n-1,u=(1<<s)-1,o=u>>1,a=s-7,c=e-1,f=t[c--],h=127&f;for(f>>=7;a>0;)h=256*h+t[c--],a-=8;for(i=h&(1<<-a)-1,h>>=-a,a+=n;a>0;)i=256*i+t[c--],a-=8;if(0===h)h=1-o;else{if(h===u)return i?NaN:f?-1/0:1/0;i+=r(2,n),h-=o}return(f?-1:1)*i*r(2,h-n)}}}function jh(){if(Ch)return Oh;Ch=1;var t=An(),n=xr(),r=Vr();return Oh=function(i){for(var e=t(this),s=r(e),u=arguments.length,o=n(u>1?arguments[1]:void 0,s),a=u>2?arguments[2]:void 0,c=void 0===a?s:n(a,s);c>o;)e[o++]=i;return e},Oh}function Lh(){if(Nh)return Dh;Nh=1;var t=_(),n=Nt(),r=j(),i=Mh(),e=fr(),s=Kn(),u=bs(),o=nh(),a=V(),c=Is(),f=Mr(),h=xh(),d=function(){if(Rh)return kh;Rh=1;var t=Uh();return kh=Math.fround||function(n){return t(n,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)}}(),v=Vh(),l=of(),g=ps(),w=jh(),m=_s(),p=yf(),y=Ii(),b=ys(),E=lr(),I=e.PROPER,S=e.CONFIGURABLE,T="ArrayBuffer",k="DataView",R="prototype",A="Wrong index",O=E.getterFor(T),C=E.getterFor(k),D=E.set,N=t[T],F=N,P=F&&F[R],M=t[k],x=M&&M[R],U=Object.prototype,L=t.Array,z=t.RangeError,B=n(w),G=n([].reverse),W=v.pack,q=v.unpack,H=function(t){return[255&t]},K=function(t){return[255&t,t>>8&255]},X=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},$=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},Q=function(t){return W(d(t),23,4)},J=function(t){return W(t,52,8)},Y=function(t,n,r){u(t[R],n,{configurable:!0,get:function(){return r(this)[n]}})},Z=function(t,n,r,i){var e=C(t),s=h(r),u=!!i;if(s+n>e.byteLength)throw new z(A);var o=e.bytes,a=s+e.byteOffset,c=m(o,a,a+n);return u?c:G(c)},tt=function(t,n,r,i,e,s){var u=C(t),o=h(r),a=i(+e),c=!!s;if(o+n>u.byteLength)throw new z(A);for(var f=u.bytes,d=o+u.byteOffset,v=0;v<n;v++)f[d+v]=a[c?v:n-v-1]};if(i){var nt=I&&N.name!==T;a(function(){N(1)})&&a(function(){new N(-1)})&&!a(function(){return new N,new N(1.5),new N(NaN),1!==N.length||nt&&!S})?nt&&S&&s(N,"name",T):((F=function(t){return c(this,P),p(new N(h(t)),this,F)})[R]=P,P.constructor=F,y(F,N)),g&&l(x)!==U&&g(x,U);var rt=new M(new F(2)),it=n(x.setInt8);rt.setInt8(0,2147483648),rt.setInt8(1,2147483649),!rt.getInt8(0)&&rt.getInt8(1)||o(x,{setInt8:function(t,n){it(this,t,n<<24>>24)},setUint8:function(t,n){it(this,t,n<<24>>24)}},{unsafe:!0})}else P=(F=function(t){c(this,P);var n=h(t);D(this,{type:T,bytes:B(L(n),0),byteLength:n}),r||(this.byteLength=n,this.detached=!1)})[R],x=(M=function(t,n,i){c(this,x),c(t,P);var e=O(t),s=e.byteLength,u=f(n);if(u<0||u>s)throw new z("Wrong offset");if(u+(i=void 0===i?s-u:h(i))>s)throw new z("Wrong length");D(this,{type:k,buffer:t,byteLength:i,byteOffset:u,bytes:e.bytes}),r||(this.buffer=t,this.byteLength=i,this.byteOffset=u)})[R],r&&(Y(F,"byteLength",O),Y(M,"buffer",C),Y(M,"byteLength",C),Y(M,"byteOffset",C)),o(x,{getInt8:function(t){return Z(this,1,t)[0]<<24>>24},getUint8:function(t){return Z(this,1,t)[0]},getInt16:function(t){var n=Z(this,2,t,arguments.length>1&&arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=Z(this,2,t,arguments.length>1&&arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return $(Z(this,4,t,arguments.length>1&&arguments[1]))},getUint32:function(t){return $(Z(this,4,t,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(t){return q(Z(this,4,t,arguments.length>1&&arguments[1]),23)},getFloat64:function(t){return q(Z(this,8,t,arguments.length>1&&arguments[1]),52)},setInt8:function(t,n){tt(this,1,t,H,n)},setUint8:function(t,n){tt(this,1,t,H,n)},setInt16:function(t,n){tt(this,2,t,K,n,arguments.length>2&&arguments[2])},setUint16:function(t,n){tt(this,2,t,K,n,arguments.length>2&&arguments[2])},setInt32:function(t,n){tt(this,4,t,X,n,arguments.length>2&&arguments[2])},setUint32:function(t,n){tt(this,4,t,X,n,arguments.length>2&&arguments[2])},setFloat32:function(t,n){tt(this,4,t,Q,n,arguments.length>2&&arguments[2])},setFloat64:function(t,n){tt(this,8,t,J,n,arguments.length>2&&arguments[2])}});return b(F,T),b(M,k),Dh={ArrayBuffer:F,DataView:M}}!function(){if(Fh)return Ph;Fh=1;var t=Ti(),n=_(),r=Lh(),i=Es(),e="ArrayBuffer",s=r[e];t({global:!0,constructor:!0,forced:n[e]!==s},{ArrayBuffer:s}),i(e)}();var zh,Bh={};!function(){if(zh)return Bh;zh=1;var t=Ti(),n=Rs(),r=V(),i=Lh(),e=qn(),s=xr(),u=Ur(),o=i.ArrayBuffer,a=i.DataView,c=a.prototype,f=n(o.prototype.slice),h=n(c.getUint8),d=n(c.setUint8);t({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:r(function(){return!new o(2).slice(1,void 0).byteLength})},{slice:function(t,n){if(f&&void 0===n)return f(e(this),t);for(var r=e(this).byteLength,i=s(t,r),c=s(void 0===n?r:n,r),v=new o(u(c-i)),l=new a(this),g=new a(v),w=0;i<c;)d(g,w++,h(l,i++));return v}})}();var Gh,Wh,qh,Hh,Kh,Xh,$h,Qh={};function Jh(){if(Hh)return qh;Hh=1;var t=Nt(),n=Ur(),r=Va(),i=function(){if(Wh)return Gh;Wh=1;var t=Mr(),n=Va(),r=xt(),i=RangeError,e=Math.floor;return Gh=function(s){var u=n(r(this)),o="",a=t(s);if(a<0||a===1/0)throw new i("Wrong number of repetitions");for(;a>0;(a=e(a/2))&&(u+=u))a%2&&(o+=u);return o}}(),e=xt(),s=t(i),u=t("".slice),o=Math.ceil,a=function(t){return function(i,a,c){var f=r(e(i)),h=n(a),d=f.length;if(h<=d)return f;var v,l,g=void 0===c?" ":r(c);return""===g?f:((l=s(g,o((v=h-d)/g.length))).length>v&&(l=u(l,0,v)),t?f+l:l+f)}};return qh={start:a(!1),end:a(!0)}}!function(){if($h)return Qh;$h=1;var t=Ti(),n=Jh().start;t({target:"String",proto:!0,forced:function(){if(Xh)return Kh;Xh=1;var t=Bt();return Kh=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(t)}()},{padStart:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var Yh,Zh,td,nd,rd,id,ed,sd,ud,od,ad,cd,fd,hd,dd,vd,ld,gd,wd,md,pd,yd,bd={exports:{}};function Ed(){if(Zh)return Yh;Zh=1;var t,n,r,i=Mh(),e=j(),s=_(),u=Vt(),o=jt(),a=_n(),c=Ci(),f=Kt(),h=Kn(),d=wr(),v=bs(),l=zt(),g=of(),w=ps(),m=Cn(),p=On(),y=lr(),b=y.enforce,E=y.get,I=s.Int8Array,S=I&&I.prototype,T=s.Uint8ClampedArray,k=T&&T.prototype,R=I&&g(I),A=S&&g(S),O=Object.prototype,C=s.TypeError,D=m("toStringTag"),N=p("TYPED_ARRAY_TAG"),F="TypedArrayConstructor",P=i&&!!w&&"Opera"!==c(s.opera),M=!1,x={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},V=function(t){var n=g(t);if(o(n)){var r=E(n);return r&&a(r,F)?r[F]:V(n)}},L=function(t){if(!o(t))return!1;var n=c(t);return a(x,n)||a(U,n)};for(t in x)(r=(n=s[t])&&n.prototype)?b(r)[F]=n:P=!1;for(t in U)(r=(n=s[t])&&n.prototype)&&(b(r)[F]=n);if((!P||!u(R)||R===Function.prototype)&&(R=function(){throw new C("Incorrect invocation")},P))for(t in x)s[t]&&w(s[t],R);if((!P||!A||A===O)&&(A=R.prototype,P))for(t in x)s[t]&&w(s[t].prototype,A);if(P&&g(k)!==A&&w(k,A),e&&!a(A,D))for(t in M=!0,v(A,D,{configurable:!0,get:function(){return o(this)?this[N]:void 0}}),x)s[t]&&h(s[t].prototype,N,t);return Yh={NATIVE_ARRAY_BUFFER_VIEWS:P,TYPED_ARRAY_TAG:M&&N,aTypedArray:function(t){if(L(t))return t;throw new C("Target is not a typed array")},aTypedArrayConstructor:function(t){if(u(t)&&(!w||l(R,t)))return t;throw new C(f(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,n,r,i){if(e){if(r)for(var u in x){var o=s[u];if(o&&a(o.prototype,t))try{delete o.prototype[t]}catch(r){try{o.prototype[t]=n}catch(t){}}}A[t]&&!r||d(A,t,r?n:P&&S[t]||n,i)}},exportTypedArrayStaticMethod:function(t,n,r){var i,u;if(e){if(w){if(r)for(i in x)if((u=s[i])&&a(u,t))try{delete u[t]}catch(t){}if(R[t]&&!r)return;try{return d(R,t,r?n:P&&R[t]||n)}catch(t){}}for(i in x)!(u=s[i])||u[t]&&!r||d(u,t,n)}},getTypedArrayConstructor:V,isView:function(t){if(!o(t))return!1;var n=c(t);return"DataView"===n||a(x,n)||a(U,n)},isTypedArray:L,TypedArray:R,TypedArrayPrototype:A}}function Id(){if(id)return rd;id=1;var t=jt(),n=Math.floor;return rd=Number.isInteger||function(r){return!t(r)&&isFinite(r)&&n(r)===r}}function Sd(){if(sd)return ed;sd=1;var t=Mr(),n=RangeError;return ed=function(r){var i=t(r);if(i<0)throw new n("The argument can't be less than 0");return i}}function Td(){if(od)return ud;od=1;var t=Sd(),n=RangeError;return ud=function(r,i){var e=t(r);if(e%i)throw new n("Wrong offset");return e}}function kd(){if(cd)return ad;cd=1;var t=Math.floor;return ad=function(n){var r=+n;if(r!=r||r<=0)return 0;if(r>=255)return 255;var i=t(r);return i+.5<r?i+1:r<i+.5||i%2==0?i:i+1}}function Rd(){if(hd)return fd;hd=1;var t=Ci();return fd=function(n){var r=t(n);return"BigInt64Array"===r||"BigUint64Array"===r}}function Ad(){if(vd)return dd;vd=1;var t=Dn(),n=TypeError;return dd=function(r){var i=t(r,"number");if("number"==typeof i)throw new n("Can't convert number to bigint");return BigInt(i)}}function _d(){if(gd)return ld;gd=1;var t=As(),n=z(),r=Xt(),i=Ss(),e=An(),s=Vr(),u=fu(),o=cu(),a=au(),c=Rd(),f=Ed().aTypedArrayConstructor,h=Ad();return ld=function(d){var v=i(this),l=arguments.length,g=l>1?arguments[1]:void 0,w=void 0!==g;w&&r(g);var m,p,y,b,E,I,S,T,k=e(d),R=o(k);if(R&&!a(R))for(T=(S=u(k,R)).next,k=[];!(I=n(T,S)).done;)k.push(I.value);for(w&&l>2&&(g=t(g,arguments[2])),p=s(k),y=new(f(v))(p),b=c(y),m=0;p>m;m++)E=w?g(k[m],m):k[m],y[m]=b?h(E):+E;return y},ld}function Od(){if(md)return wd;md=1;var t=Vr();return wd=function(n,r,i){for(var e=0,s=arguments.length>2?i:t(r),u=new n(s);s>e;)u[e]=r[e++];return u},wd}function Cd(){if(pd)return bd.exports;pd=1;var t=Ti(),n=_(),r=z(),i=j(),e=function(){if(nd)return td;nd=1;var t=_(),n=V(),r=vu(),i=Ed().NATIVE_ARRAY_BUFFER_VIEWS,e=t.ArrayBuffer,s=t.Int8Array;return td=!i||!n(function(){s(1)})||!n(function(){new s(-1)})||!r(function(t){new s,new s(null),new s(1.5),new s(t)},!0)||n(function(){return 1!==new s(new e(2),1,void 0).length})}(),s=Ed(),u=Lh(),o=Is(),a=Dt(),c=Kn(),f=Id(),h=xh(),d=Td(),v=kd(),l=Nn(),g=_n(),w=Ci(),m=jt(),p=Ht(),y=$i(),b=zt(),E=ps(),I=Br().f,S=_d(),T=ju().forEach,k=Es(),R=bs(),A=Hn(),O=Mn(),C=Od(),D=lr(),N=yf(),F=D.get,P=D.set,M=D.enforce,x=A.f,U=O.f,L=n.RangeError,B=u.ArrayBuffer,G=B.prototype,W=u.DataView,q=s.NATIVE_ARRAY_BUFFER_VIEWS,H=s.TYPED_ARRAY_TAG,K=s.TypedArray,X=s.TypedArrayPrototype,$=s.isTypedArray,Q="BYTES_PER_ELEMENT",J="Wrong length",Y=function(t,n){R(t,n,{configurable:!0,get:function(){return F(this)[n]}})},Z=function(t){var n;return b(G,t)||"ArrayBuffer"===(n=w(t))||"SharedArrayBuffer"===n},tt=function(t,n){return $(t)&&!p(n)&&n in t&&f(+n)&&n>=0},nt=function(t,n){return n=l(n),tt(t,n)?a(2,t[n]):U(t,n)},rt=function(t,n,r){return n=l(n),!(tt(t,n)&&m(r)&&g(r,"value"))||g(r,"get")||g(r,"set")||r.configurable||g(r,"writable")&&!r.writable||g(r,"enumerable")&&!r.enumerable?x(t,n,r):(t[n]=r.value,t)};return i?(q||(O.f=nt,A.f=rt,Y(X,"buffer"),Y(X,"byteOffset"),Y(X,"byteLength"),Y(X,"length")),t({target:"Object",stat:!0,forced:!q},{getOwnPropertyDescriptor:nt,defineProperty:rt}),bd.exports=function(i,s,u){var a=i.match(/\d+/)[0]/8,f=i+(u?"Clamped":"")+"Array",l="get"+i,g="set"+i,w=n[f],p=w,b=p&&p.prototype,R={},A=function(t,n){x(t,n,{get:function(){return function(t,n){var r=F(t);return r.view[l](n*a+r.byteOffset,!0)}(this,n)},set:function(t){return function(t,n,r){var i=F(t);i.view[g](n*a+i.byteOffset,u?v(r):r,!0)}(this,n,t)},enumerable:!0})};q?e&&(p=s(function(t,n,i,e){return o(t,b),N(m(n)?Z(n)?void 0!==e?new w(n,d(i,a),e):void 0!==i?new w(n,d(i,a)):new w(n):$(n)?C(p,n):r(S,p,n):new w(h(n)),t,p)}),E&&E(p,K),T(I(w),function(t){t in p||c(p,t,w[t])}),p.prototype=b):(p=s(function(t,n,i,e){o(t,b);var s,u,c,f=0,v=0;if(m(n)){if(!Z(n))return $(n)?C(p,n):r(S,p,n);s=n,v=d(i,a);var l=n.byteLength;if(void 0===e){if(l%a)throw new L(J);if((u=l-v)<0)throw new L(J)}else if((u=h(e)*a)+v>l)throw new L(J);c=u/a}else c=h(n),s=new B(u=c*a);for(P(t,{buffer:s,byteOffset:v,byteLength:u,length:c,view:new W(s)});f<c;)A(t,f++)}),E&&E(p,K),b=p.prototype=y(X)),b.constructor!==p&&c(b,"constructor",p),M(b).TypedArrayConstructor=p,H&&c(b,H,f);var _=p!==w;R[f]=p,t({global:!0,constructor:!0,forced:_,sham:!q},R),Q in p||c(p,Q,a),Q in b||c(b,Q,a),k(f)}):bd.exports=function(){},bd.exports}yd||(yd=1,Cd()("Uint8",function(t){return function(n,r,i){return t(this,n,r,i)}}));var Dd,Nd,Fd,Pd,Md,xd={};function Ud(){if(Nd)return Dd;Nd=1;var t=Kt(),n=TypeError;return Dd=function(r,i){if(!delete r[i])throw new n("Cannot delete property "+t(i)+" of "+t(r))}}!function(){if(Md)return xd;Md=1;var t=Nt(),n=Ed(),r=function(){if(Pd)return Fd;Pd=1;var t=An(),n=xr(),r=Vr(),i=Ud(),e=Math.min;return Fd=[].copyWithin||function(s,u){var o=t(this),a=r(o),c=n(s,a),f=n(u,a),h=arguments.length>2?arguments[2]:void 0,d=e((void 0===h?a:n(h,a))-f,a-c),v=1;for(f<c&&c<f+d&&(v=-1,f+=d-1,c+=d-1);d-- >0;)f in o?o[c]=o[f]:i(o,c),c+=v,f+=v;return o},Fd}(),i=t(r),e=n.aTypedArray;(0,n.exportTypedArrayMethod)("copyWithin",function(t,n){return i(e(this),t,n,arguments.length>2?arguments[2]:void 0)})}();var Vd,jd={};!function(){if(Vd)return jd;Vd=1;var t=Ed(),n=ju().every,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("every",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var Ld,zd={};!function(){if(Ld)return zd;Ld=1;var t=Ed(),n=jh(),r=Ad(),i=Ci(),e=z(),s=Nt(),u=V(),o=t.aTypedArray,a=t.exportTypedArrayMethod,c=s("".slice);a("fill",function(t){var s=arguments.length;o(this);var u="Big"===c(i(this),0,3)?r(t):+t;return e(n,this,u,s>1?arguments[1]:void 0,s>2?arguments[2]:void 0)},u(function(){var t=0;return new Int8Array(2).fill({valueOf:function(){return t++}}),1!==t}))}();var Bd,Gd,Wd,qd={};function Hd(){if(Gd)return Bd;Gd=1;var t=Od(),n=Ed().getTypedArrayConstructor;return Bd=function(r,i){return t(n(r),i)}}!function(){if(Wd)return qd;Wd=1;var t=Ed(),n=ju().filter,r=Hd(),i=t.aTypedArray;(0,t.exportTypedArrayMethod)("filter",function(t){var e=n(i(this),t,arguments.length>1?arguments[1]:void 0);return r(this,e)})}();var Kd,Xd={};!function(){if(Kd)return Xd;Kd=1;var t=Ed(),n=ju().find,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("find",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var $d,Qd={};!function(){if($d)return Qd;$d=1;var t=Ed(),n=ju().findIndex,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("findIndex",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var Jd,Yd={};!function(){if(Jd)return Yd;Jd=1;var t=Ed(),n=ju().forEach,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("forEach",function(t){n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var Zd,tv={};!function(){if(Zd)return tv;Zd=1;var t=Ed(),n=jr().includes,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("includes",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var nv,rv={};!function(){if(nv)return rv;nv=1;var t=Ed(),n=jr().indexOf,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("indexOf",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var iv,ev={};!function(){if(iv)return ev;iv=1;var t=_(),n=V(),r=Nt(),i=Ed(),e=df(),s=Cn()("iterator"),u=t.Uint8Array,o=r(e.values),a=r(e.keys),c=r(e.entries),f=i.aTypedArray,h=i.exportTypedArrayMethod,d=u&&u.prototype,v=!n(function(){d[s].call([1])}),l=!!d&&d.values&&d[s]===d.values&&"values"===d.values.name,g=function(){return o(f(this))};h("entries",function(){return c(f(this))},v),h("keys",function(){return a(f(this))},v),h("values",g,v||!l,{name:"values"}),h(s,g,v||!l,{name:"values"})}();var sv,uv={};!function(){if(sv)return uv;sv=1;var t=Ed(),n=Nt(),r=t.aTypedArray,i=t.exportTypedArrayMethod,e=n([].join);i("join",function(t){return e(r(this),t)})}();var ov,av,cv,fv={};!function(){if(cv)return fv;cv=1;var t=Ed(),n=ks(),r=function(){if(av)return ov;av=1;var t=ks(),n=Ut(),r=Mr(),i=Vr(),e=ne(),s=Math.min,u=[].lastIndexOf,o=!!u&&1/[1].lastIndexOf(1,-0)<0,a=e("lastIndexOf");return ov=o||!a?function(e){if(o)return t(u,this,arguments)||0;var a=n(this),c=i(a);if(0===c)return-1;var f=c-1;for(arguments.length>1&&(f=s(f,r(arguments[1]))),f<0&&(f=c+f);f>=0;f--)if(f in a&&a[f]===e)return f||0;return-1}:u,ov}(),i=t.aTypedArray;(0,t.exportTypedArrayMethod)("lastIndexOf",function(t){var e=arguments.length;return n(r,i(this),e>1?[t,arguments[1]]:[t])})}();var hv,dv={};!function(){if(hv)return dv;hv=1;var t=Ed(),n=ju().map,r=Hd(),i=t.aTypedArray;(0,t.exportTypedArrayMethod)("map",function(t){var e=n(i(this),t,arguments.length>1?arguments[1]:void 0);return r(this,e)})}();var vv,lv,gv,wv={};function mv(){if(lv)return vv;lv=1;var t=Xt(),n=An(),r=Pt(),i=Vr(),e=TypeError,s="Reduce of empty array with no initial value",u=function(u){return function(o,a,c,f){var h=n(o),d=r(h),v=i(h);if(t(a),0===v&&c<2)throw new e(s);var l=u?v-1:0,g=u?-1:1;if(c<2)for(;;){if(l in d){f=d[l],l+=g;break}if(l+=g,u?l<0:v<=l)throw new e(s)}for(;u?l>=0:v>l;l+=g)l in d&&(f=a(f,d[l],l,h));return f}};return vv={left:u(!1),right:u(!0)}}!function(){if(gv)return wv;gv=1;var t=Ed(),n=mv().left,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("reduce",function(t){var i=arguments.length;return n(r(this),t,i,i>1?arguments[1]:void 0)})}();var pv,yv={};!function(){if(pv)return yv;pv=1;var t=Ed(),n=mv().right,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("reduceRight",function(t){var i=arguments.length;return n(r(this),t,i,i>1?arguments[1]:void 0)})}();var bv,Ev={};!function(){if(bv)return Ev;bv=1;var t=Ed(),n=t.aTypedArray,r=t.exportTypedArrayMethod,i=Math.floor;r("reverse",function(){for(var t,r=this,e=n(r).length,s=i(e/2),u=0;u<s;)t=r[u],r[u++]=r[--e],r[e]=t;return r})}();var Iv,Sv={};!function(){if(Iv)return Sv;Iv=1;var t=_(),n=z(),r=Ed(),i=Vr(),e=Td(),s=An(),u=V(),o=t.RangeError,a=t.Int8Array,c=a&&a.prototype,f=c&&c.set,h=r.aTypedArray,d=r.exportTypedArrayMethod,v=!u(function(){var t=new Uint8ClampedArray(2);return n(f,t,{length:1,0:3},1),3!==t[1]}),l=v&&r.NATIVE_ARRAY_BUFFER_VIEWS&&u(function(){var t=new a(2);return t.set(1),t.set("2",1),0!==t[0]||2!==t[1]});d("set",function(t){h(this);var r=e(arguments.length>1?arguments[1]:void 0,1),u=s(t);if(v)return n(f,this,u,r);var a=this.length,c=i(u),d=0;if(c+r>a)throw new o("Wrong length");for(;d<c;)this[r+d]=u[d++]},!v||l)}();var Tv,kv={};!function(){if(Tv)return kv;Tv=1;var t=Ed(),n=V(),r=_s(),i=t.aTypedArray,e=t.getTypedArrayConstructor;(0,t.exportTypedArrayMethod)("slice",function(t,n){for(var s=r(i(this),t,n),u=e(this),o=0,a=s.length,c=new u(a);a>o;)c[o]=s[o++];return c},n(function(){new Int8Array(1).slice()}))}();var Rv,Av={};!function(){if(Rv)return Av;Rv=1;var t=Ed(),n=ju().some,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("some",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var _v,Ov,Cv,Dv,Nv,Fv,Pv,Mv={};!function(){if(Pv)return Mv;Pv=1;var t=_(),n=Rs(),r=V(),i=Xt(),e=rh(),s=Ed(),u=function(){if(Ov)return _v;Ov=1;var t=Bt().match(/firefox\/(\d+)/i);return _v=!!t&&+t[1]}(),o=function(){if(Dv)return Cv;Dv=1;var t=Bt();return Cv=/MSIE|Trident/.test(t)}(),a=Gt(),c=function(){if(Fv)return Nv;Fv=1;var t=Bt().match(/AppleWebKit\/(\d+)\./);return Nv=!!t&&+t[1]}(),f=s.aTypedArray,h=s.exportTypedArrayMethod,d=t.Uint16Array,v=d&&n(d.prototype.sort),l=!(!v||r(function(){v(new d(2),null)})&&r(function(){v(new d(2),{})})),g=!!v&&!r(function(){if(a)return a<74;if(u)return u<67;if(o)return!0;if(c)return c<602;var t,n,r=new d(516),i=Array(516);for(t=0;t<516;t++)n=t%4,r[t]=515-t,i[t]=t-2*n+3;for(v(r,function(t,n){return(t/4|0)-(n/4|0)}),t=0;t<516;t++)if(r[t]!==i[t])return!0});h("sort",function(t){return void 0!==t&&i(t),g?v(this,t):e(f(this),function(t){return function(n,r){return void 0!==t?+t(n,r)||0:r!=r?n!=n?0:-1:n!=n?1:0===n&&0===r?1/n>0?1/r>0?0:1:1/r>0?-1:0:n>r?1:n<r?-1:0}}(t))},!g||l)}();var xv,Uv={};!function(){if(xv)return Uv;xv=1;var t=Ed(),n=Ur(),r=xr(),i=t.aTypedArray,e=t.getTypedArrayConstructor;(0,t.exportTypedArrayMethod)("subarray",function(t,s){var u=i(this),o=u.length,a=r(t,o);return new(e(u))(u.buffer,u.byteOffset+a*u.BYTES_PER_ELEMENT,n((void 0===s?o:r(s,o))-a))})}();var Vv,jv={};!function(){if(Vv)return jv;Vv=1;var t=_(),n=ks(),r=Ed(),i=V(),e=_s(),s=t.Int8Array,u=r.aTypedArray,o=r.exportTypedArrayMethod,a=[].toLocaleString,c=!!s&&i(function(){a.call(new s(1))});o("toLocaleString",function(){return n(a,c?e(u(this)):u(this),e(arguments))},i(function(){return[1,2].toLocaleString()!==new s([1,2]).toLocaleString()})||!i(function(){s.prototype.toLocaleString.call([1,2])}))}();var Lv,zv={};function Bv(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();var t="undefined"!=typeof crypto?crypto:null;if(null==t?void 0:t.getRandomValues){var n=new Uint8Array(16);t.getRandomValues(n);var r=new DataView(n.buffer);return r.setUint8(6,15&r.getUint8(6)|64),r.setUint8(8,63&r.getUint8(8)|128),Array.from(n).map(function(t,n){return[4,6,8,10].includes(n)?"-".concat(t.toString(16).padStart(2,"0")):t.toString(16).padStart(2,"0")}).join("")}throw new Error("No cryptographically secure random number generator available")}function Gv(){try{var t=function(){var t,n;if("undefined"!=typeof navigator&&"userAgentData"in navigator){var r=navigator.userAgentData;if(r&&r.brands)try{for(var i=Wu(r.brands),e=i.next();!e.done;e=i.next()){var s=e.value;if(s.brand&&"Chromium"!==s.brand&&!s.brand.startsWith("Not"))return s.brand}}catch(n){t={error:n}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}return null}();return t||("undefined"!=typeof navigator&&navigator.userAgent?(n=navigator.userAgent).includes("Firefox/")?"Firefox":n.includes("Edg/")?"Edge":n.includes("Chrome/")?"Chrome":n.includes("Safari/")&&!n.includes("Chrome")?"Safari":n.includes("Opera/")||n.includes("OPR/")?"Opera":null:null)}catch(t){return null}var n}function Wv(){try{var t=function(){if("undefined"!=typeof navigator&&"userAgentData"in navigator){var t=navigator.userAgentData;if(t&&t.platform)return t.platform}return null}();return t||("undefined"!=typeof navigator&&navigator.userAgent?(n=navigator.userAgent,null!==(i=null!==(r=function(t){if(!t.includes("Mac OS X"))return null;var n=t.match(/Mac OS X ([\d_]+)/);return(null==n?void 0:n[1])?"macOS ".concat(n[1].replace(/_/g,".")):"macOS"}(n))&&void 0!==r?r:function(t){var n;if(!t.includes("Windows NT"))return null;var r=t.match(/Windows NT ([\d.]+)/);return(null==r?void 0:r[1])?"Windows ".concat(null!==(n={"10.0":"10/11",6.3:"8.1",6.2:"8",6.1:"7"}[r[1]])&&void 0!==n?n:r[1]):"Windows"}(n))&&void 0!==i?i:function(t){var n;return t.includes("iPhone")||t.includes("iPad")?(null==(n=t.match(/OS ([\d_]+)/))?void 0:n[1])?"iOS ".concat(n[1].replace(/_/g,".")):"iOS":t.includes("Android")?(n=t.match(/Android ([\d.]+)/))?"Android ".concat(n[1]):"Android":t.includes("Linux")?"Linux":null}(n)):null)}catch(r){return null}var n,r,i}function qv(){try{if("undefined"!=typeof document&&document.referrer)return function(t){var n;if("undefined"!=typeof URL)try{return new URL(t).hostname}catch(t){return"direct"}var r=t.match(/^https?:\/\/([^/?#]+)/);return r&&null!==(n=r[1])&&void 0!==n?n:"direct"}(document.referrer)}catch(t){}return"direct"}function Hv(t){var n=Gv(),r=Wv(),i=function(){var t;try{if("undefined"!=typeof navigator)return navigator.language||(null===(t=navigator.languages)||void 0===t?void 0:t[0])||"en-US"}catch(t){}return"en-US"}(),e=function(){try{if("undefined"!=typeof Intl)return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch(t){}return"UTC"}(),s=function(){try{if("undefined"!=typeof window&&window.screen)return"".concat(window.screen.width,"x").concat(window.screen.height)}catch(t){}return"0x0"}(),u=function(){try{if("undefined"!=typeof window&&window.location){var t=window.location.search;return{utmSource:ah(t,"utm_source"),utmMedium:ah(t,"utm_medium"),utmCampaign:ah(t,"utm_campaign"),utmTerm:ah(t,"utm_term"),utmContent:ah(t,"utm_content"),adsId:ah(t,"gclid")||ah(t,"fbclid")||ah(t,"msclkid")||ah(t,"ttclid")}}}catch(t){}return{utmSource:null,utmMedium:null,utmCampaign:null,utmTerm:null,utmContent:null,adsId:null}}(),o=qv(),a={sdk_version:Ra,consent:(null==t?void 0:t.notificationPermissionGranted)?"yes":"no"};return function(t,n,r,i,e,s){n&&(t.browser=n),r&&(t.os_version=r),i&&"en-US"!==i&&(t.locale=i),e&&"UTC"!==e&&(t.timezone=e),s&&"0x0"!==s&&(t.screen_resolution=s)}(a,n,r,i,e,s),function(t,n,r,i){(null==n?void 0:n.appVersion)&&(t.app_version=n.appVersion),(null==n?void 0:n.fcmTokenCreatedAt)&&(t.token_creation_date=n.fcmTokenCreatedAt),r.utmSource&&(t.utm_source=r.utmSource),r.utmMedium&&(t.utm_medium=r.utmMedium),r.utmCampaign&&(t.utm_campaign=r.utmCampaign),r.utmTerm&&(t.utm_term=r.utmTerm),r.utmContent&&(t.utm_content=r.utmContent),r.adsId&&(t.ads_id=r.adsId),i&&"direct"!==i&&(t.initial_referrer=i)}(a,t,u,o),a}!function(){if(Lv)return zv;Lv=1;var t=Ed().exportTypedArrayMethod,n=V(),r=_(),i=Nt(),e=r.Uint8Array,s=e&&e.prototype||{},u=[].toString,o=i([].join);n(function(){u.call({})})&&(u=function(){return o(this)});var a=s.toString!==u;t("toString",u,a)}();var Kv=function(){function t(t,n,r,i,e){this.httpClient=new ef(t),this.logger=n,this.accountId=r,this.orgId=i,this.source=e}return t.prototype.sendEvents=function(t,n,r,i,e,s){return Bu(this,void 0,void 0,function(){var u,o,a,c,f,h,d;return Gu(this,function(v){switch(v.label){case 0:if(!n&&!r&&!i)throw new Error("Either visitorId, visitorRefId, or userId must be provided for event tracking");if(!s)throw new Error("Session ID is required for event tracking");o=(u=!!n||!!r)&&i?"identified":u?"anonymous":"user-only",this.logger.info("Sending events",{eventCount:t.length,trackingMode:o,hasVisitor:u,hasUser:!!i,sessionId:s}),a=fh(s),c={request_id:Bv(),system_data:a,events:t},n?c.visitor={identifierName:"id",identifierValue:n}:r&&(c.visitor={identifierName:"refId",identifierValue:r}),i&&e&&(c.user={identifierName:e,identifierValue:i}),v.label=1;case 1:return v.trys.push([1,3,,4]),f={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source,"X-CAP-API-AUTH-ENTITY-ID":this.orgId},[4,this.httpClient.post(Ku,c,{headers:f})];case 2:return h=v.sent(),this.logger.info(Eo,{requestId:c.request_id,eventCount:t.length,trackingMode:o,success:h.status.success}),[2,h];case 3:throw d=v.sent(),this.logger.error(Io,{requestId:c.request_id,eventCount:t.length,trackingMode:o,error:d}),d;case 4:return[2]}})})},t.prototype.getVisitorConfig=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:this.logger.info("Fetching visitor config",{orgId:t}),u.label=1;case 1:return u.trys.push([1,3,,4]),n={"X-CAP-API-AUTH-ORG-ID":t,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":ya.WEBPUSH},[4,this.httpClient.get($u,{headers:n})];case 2:return r=u.sent(),this.logger.info(jo,{isEnabled:null===(e=r.data)||void 0===e?void 0:e.visitorTrackingEnabled,warningCount:(null===(s=r.warnings)||void 0===s?void 0:s.length)||0}),[2,r];case 3:throw i=u.sent(),this.logger.error(Lo,i),i;case 4:return[2]}})})},t.prototype.createVisitor=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:this.logger.info("Creating anonymous visitor",{orgId:t,profileCount:n.profiles.length,hasExtendedFields:!!n.extendedFields}),a.label=1;case 1:if(a.trys.push([1,3,,4]),!n.profiles||0===n.profiles.length)throw new Error("At least one profile is required");return r={"X-CAP-API-AUTH-ORG-ID":t},[4,this.httpClient.post(Qu,n,{headers:r})];case 2:return i=a.sent(),this.logger.info(qo,{visitorId:null===(s=i.data)||void 0===s?void 0:s.id,warningCount:(null===(u=i.warnings)||void 0===u?void 0:u.length)||0}),[2,i];case 3:throw e=a.sent(),this.logger.error(Ho,{error:e,accountId:null===(o=n.profiles[0])||void 0===o?void 0:o.accountId}),e;case 4:return[2]}})})},t.prototype.updateVisitor=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:this.logger.info("Updating visitor",{orgId:t,visitorId:n,profileCount:r.profiles.length,hasExtendedFields:!!r.extendedFields}),f.label=1;case 1:if(f.trys.push([1,3,,4]),!r.profiles||0===r.profiles.length)throw new Error("At least one profile is required");if(!n||""===n.trim())throw new Error("Visitor ID is required for update");return i={"X-CAP-API-AUTH-ORG-ID":t},e="".concat(Ju,"?identifierType=visitorId&identifierValue=").concat(encodeURIComponent(n)),[4,this.httpClient.put(e,r,{headers:i})];case 2:return s=f.sent(),this.logger.info($o,{visitorId:null===(o=s.data)||void 0===o?void 0:o.id,warningCount:(null===(a=s.warnings)||void 0===a?void 0:a.length)||0}),[2,s];case 3:throw u=f.sent(),this.logger.error(Qo,{error:u,visitorId:n,accountId:null===(c=r.profiles[0])||void 0===c?void 0:c.accountId}),u;case 4:return[2]}})})},t.prototype.buildMergeIdentifiers=function(t,n,r){var i=[];return t&&i.push({type:"email",value:t}),n&&i.push({type:"mobile",value:n}),r&&i.push({type:"externalId",value:r}),i},t.prototype.handleMergeResponse=function(t,n){var r,i=this;if(t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor merge warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0){var e=t.errors[0],s=e.code,u=e.message,o=String(s);if(o===Ia.ALREADY_MERGED)return void this.logger.info("Visitor already merged, treating as success",{visitorId:n});if(o===Ia.VISITOR_NOT_FOUND)throw this.logger.warn("Visitor not found, merge cannot proceed",{visitorId:n}),new Xv(o,u);throw new Error("Merge API error: [".concat(o,"] ").concat(u))}if(202!==(null===(r=t.status)||void 0===r?void 0:r.code))throw new Error("Unexpected merge API response");this.logger.info(Jo,{visitorId:n,statusCode:t.status.code,message:t.status.message})},t.prototype.mergeVisitor=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c,f,h,d,v,l,g,w,m,p,y,b;return Gu(this,function(E){switch(E.label){case 0:if(i=r.firstName,e=r.lastName,s=r.email,u=r.mobile,o=r.fcmToken,a=r.channelType,c=r.subscribed,f=void 0===c||c,h=r.fields,d=r.extendedFields,v=r.externalId,!s&&!u&&!v)throw new Error("At least one identifier (email, mobile, or externalId) is required for visitor merge");if(!t&&!n)throw new Error("Either visitorId or visitorRefId is required for visitor merge");this.logger.info("Merging visitor with user",{visitorId:t,visitorRefId:n,hasEmail:!!s,hasMobile:!!u,hasExternalId:!!v,hasFcmToken:!!o}),l=this.buildMergeIdentifiers(s,u,v),g=a||ba.WEB,w=[],o&&w.push({type:g,value:o,primary:!0,verified:!0,subscribed:f}),m={visitor:t?{identifierName:"id",identifierValue:t}:{identifierName:"refId",identifierValue:n},user:{profiles:[{firstName:i,lastName:e,identifiers:l,commChannels:w,fields:h||{},source:ya.WEBPUSH,accountId:this.accountId}],extendedFields:d||{}}},E.label=1;case 1:return E.trys.push([1,3,,4]),p={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source},[4,this.httpClient.post(Yu,m,{headers:p})];case 2:return y=E.sent(),this.handleMergeResponse(y,t),[3,4];case 3:if((b=E.sent())instanceof Xv)throw b;throw this.logger.error(Yo,{visitorId:t,error:b}),b;case 4:return[2]}})})},t.prototype.buildUserEventsRequest=function(t,n,r){var i=fh(r);return{request_id:Bv(),system_data:zu(zu({},i),{os_name:va}),events:[{name:t,eventRefId:Bv(),eventDateTime:(new Date).toISOString(),attributes:n}]}},t.prototype.sendUserEvents=function(t,n,r,i,e){return Bu(this,void 0,void 0,function(){var s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:n?t.visitor={identifierName:"id",identifierValue:n}:r&&(t.visitor={identifierName:"refId",identifierValue:r}),i&&e&&(t.user={identifierName:e,identifierValue:i}),this.logger.info("Sending user event",{eventName:null===(o=t.events[0])||void 0===o?void 0:o.name,requestId:t.request_id,hasVisitor:!!t.visitor,hasUser:!!t.user}),f.label=1;case 1:return f.trys.push([1,3,,4]),s={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source,"X-CAP-API-AUTH-ENTITY-ID":this.orgId},[4,this.httpClient.post(Xu,t,{headers:s})];case 2:return f.sent(),this.logger.info("User event sent successfully",{eventName:null===(a=t.events[0])||void 0===a?void 0:a.name,requestId:t.request_id}),[3,4];case 3:throw u=f.sent(),this.logger.error("Failed to send user event",{eventName:null===(c=t.events[0])||void 0===c?void 0:c.name,requestId:t.request_id,error:u}),u;case 4:return[2]}})})},t.prototype.sendDLR=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:this.logger.info("Sending DLR events",{eventCount:t.events.length,requestId:t.request_id,cuid:null===(e=t.user)||void 0===e?void 0:e.identifierValue,visitorId:null===(s=t.visitor)||void 0===s?void 0:s.identifierValue}),u.label=1;case 1:return u.trys.push([1,3,,4]),n={"x-cap-api-auth-key":"D2hO6eX3MT0RgGJmc0rcFVtiN38scsFJcvEgTD4","x-cap-api-auth-org-id":this.orgId,"x-cap-request-id":t.request_id},[4,this.httpClient.post(Zu,t,{headers:n})];case 2:return r=u.sent(),this.logger.info(ha,{requestId:t.request_id,eventCount:t.events.length,success:r.status.success}),[2,r];case 3:throw i=u.sent(),this.logger.error(da,{requestId:t.request_id,eventCount:t.events.length,error:i}),i;case 4:return[2]}})})},t}(),Xv=function(t){function n(n,r){var i=t.call(this,r)||this;return i.name="MergeNonRetryableError",i.code=n,i}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}Lu(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,t),n}(Error);var $v,Qv={};!function(){if($v)return Qv;$v=1;var t=Ti(),n=ju().filter;t({target:"Array",proto:!0,forced:!Pi()("filter")},{filter:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var Jv,Yv,Zv,tl,nl,rl,il,el,sl,ul,ol,al,cl,fl,hl={exports:{}},dl={};function vl(){if(Jv)return dl;Jv=1;var t=Ft(),n=Ut(),r=Br().f,i=_s(),e="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];return dl.f=function(s){return e&&"Window"===t(s)?function(t){try{return r(t)}catch(t){return i(e)}}(s):r(n(s))},dl}function ll(){if(nl)return tl;nl=1;var t=V(),n=jt(),r=Ft(),i=function(){if(Zv)return Yv;Zv=1;var t=V();return Yv=t(function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})}(),e=Object.isExtensible,s=t(function(){});return tl=s||i?function(t){return!!n(t)&&((!i||"ArrayBuffer"!==r(t))&&(!e||e(t)))}:e}function gl(){if(el)return hl.exports;el=1;var t=Ti(),n=Nt(),r=vr(),i=jt(),e=_n(),s=Hn().f,u=Br(),o=vl(),a=ll(),c=On(),f=function(){if(il)return rl;il=1;var t=V();return rl=!t(function(){return Object.isExtensible(Object.preventExtensions({}))})}(),h=!1,d=c("meta"),v=0,l=function(t){s(t,d,{value:{objectID:"O"+v++,weakData:{}}})},g=hl.exports={enable:function(){g.enable=function(){},h=!0;var r=u.f,i=n([].splice),e={};e[d]=1,r(e).length&&(u.f=function(t){for(var n=r(t),e=0,s=n.length;e<s;e++)if(n[e]===d){i(n,e,1);break}return n},t({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:o.f}))},fastKey:function(t,n){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!e(t,d)){if(!a(t))return"F";if(!n)return"E";l(t)}return t[d].objectID},getWeakData:function(t,n){if(!e(t,d)){if(!a(t))return!0;if(!n)return!1;l(t)}return t[d].weakData},onFreeze:function(t){return f&&h&&a(t)&&!e(t,d)&&l(t),t}};return r[d]=!0,hl.exports}fl||(fl=1,cl||(cl=1,function(){if(ul)return sl;ul=1;var t=Ti(),n=_(),r=Nt(),i=Si(),e=wr(),s=gl(),u=du(),o=Is(),a=Vt(),c=Mt(),f=jt(),h=V(),d=vu(),v=ys(),l=yf();return sl=function(g,w,m){var p=-1!==g.indexOf("Map"),y=-1!==g.indexOf("Weak"),b=p?"set":"add",E=n[g],I=E&&E.prototype,S=E,T={},k=function(t){var n=r(I[t]);e(I,t,"add"===t?function(t){return n(this,0===t?0:t),this}:"delete"===t?function(t){return!(y&&!f(t))&&n(this,0===t?0:t)}:"get"===t?function(t){return y&&!f(t)?void 0:n(this,0===t?0:t)}:"has"===t?function(t){return!(y&&!f(t))&&n(this,0===t?0:t)}:function(t,r){return n(this,0===t?0:t,r),this})};if(i(g,!a(E)||!(y||I.forEach&&!h(function(){(new E).entries().next()}))))S=m.getConstructor(w,g,p,b),s.enable();else if(i(g,!0)){var R=new S,A=R[b](y?{}:-0,1)!==R,_=h(function(){R.has(1)}),O=d(function(t){new E(t)}),C=!y&&h(function(){for(var t=new E,n=5;n--;)t[b](n,n);return!t.has(-0)});O||((S=w(function(t,n){o(t,I);var r=l(new E,t,S);return c(n)||u(n,r[b],{that:r,AS_ENTRIES:p}),r})).prototype=I,I.constructor=S),(_||C)&&(k("delete"),k("has"),p&&k("get")),(C||A)&&k(b),y&&I.clear&&delete I.clear}return T[g]=S,t({global:!0,constructor:!0,forced:S!==E},T),v(S,g),y||m.setStrong(S,g,p),S}}()("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},function(){if(al)return ol;al=1;var t=$i(),n=bs(),r=nh(),i=As(),e=Is(),s=Mt(),u=du(),o=ff(),a=hf(),c=Es(),f=j(),h=gl().fastKey,d=lr(),v=d.set,l=d.getterFor;return ol={getConstructor:function(o,a,c,d){var g=o(function(n,r){e(n,w),v(n,{type:a,index:t(null),first:null,last:null,size:0}),f||(n.size=0),s(r)||u(r,n[d],{that:n,AS_ENTRIES:c})}),w=g.prototype,m=l(a),p=function(t,n,r){var i,e,s=m(t),u=y(t,n);return u?u.value=r:(s.last=u={index:e=h(n,!0),key:n,value:r,previous:i=s.last,next:null,removed:!1},s.first||(s.first=u),i&&(i.next=u),f?s.size++:t.size++,"F"!==e&&(s.index[e]=u)),t},y=function(t,n){var r,i=m(t),e=h(n);if("F"!==e)return i.index[e];for(r=i.first;r;r=r.next)if(r.key===n)return r};return r(w,{clear:function(){for(var n=m(this),r=n.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=null),r=r.next;n.first=n.last=null,n.index=t(null),f?n.size=0:this.size=0},delete:function(t){var n=this,r=m(n),i=y(n,t);if(i){var e=i.next,s=i.previous;delete r.index[i.index],i.removed=!0,s&&(s.next=e),e&&(e.previous=s),r.first===i&&(r.first=e),r.last===i&&(r.last=s),f?r.size--:n.size--}return!!i},forEach:function(t){for(var n,r=m(this),e=i(t,arguments.length>1?arguments[1]:void 0);n=n?n.next:r.first;)for(e(n.value,n.key,this);n&&n.removed;)n=n.previous},has:function(t){return!!y(this,t)}}),r(w,c?{get:function(t){var n=y(this,t);return n&&n.value},set:function(t,n){return p(this,0===t?0:t,n)}}:{add:function(t){return p(this,t=0===t?0:t,t)}}),f&&n(w,"size",{configurable:!0,get:function(){return m(this).size}}),g},setStrong:function(t,n,r){var i=n+" Iterator",e=l(n),s=l(i);o(t,n,function(t,n){v(this,{type:i,target:t,state:e(t),kind:n,last:null})},function(){for(var t=s(this),n=t.kind,r=t.last;r&&r.removed;)r=r.previous;return t.target&&(t.last=r=r?r.next:t.state.first)?a("keys"===n?r.key:"values"===n?r.value:[r.key,r.value],!1):(t.target=null,a(void 0,!0))},r?"entries":"values",!r,!0),c(n)}},ol}())));var wl;wl||(wl=1,Ti()({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991}));var ml,pl,yl,bl={};function El(t){return El="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},El(t)}!function(){if(yl)return bl;yl=1;var t=Ti(),n=function(){if(pl)return ml;pl=1;var t=_(),n=V(),r=Nt(),i=Va(),e=La().trim,s=ja(),u=t.parseInt,o=t.Symbol,a=o&&o.iterator,c=/^[+-]?0x/i,f=r(c.exec),h=8!==u(s+"08")||22!==u(s+"0x16")||a&&!n(function(){u(Object(a))});return ml=h?function(t,n){var r=e(i(t));return u(r,n>>>0||(f(c,r)?16:10))}:u}();t({global:!0,forced:parseInt!==n},{parseInt:n})}();var Il,Sl=function(){function t(t,n,r){void 0===t&&(t="WebSDK"),void 0===n&&(n=2),void 0===r&&(r="data"),this.db=null,this.dbName=t,this.version=n,this.storeName=r,this.eventsStoreName="events"}return t.prototype.openDB=function(){return Bu(this,void 0,void 0,function(){var t=this;return Gu(this,function(n){return this.db?[2,this.db]:[2,new Promise(function(n,r){var i=indexedDB.open(t.dbName,t.version);i.onerror=function(){return r(i.error)},i.onsuccess=function(){t.db=i.result,n(t.db)},i.onupgradeneeded=function(n){var r=n.target.result;if(r.objectStoreNames.contains(t.storeName)||r.createObjectStore(t.storeName),!r.objectStoreNames.contains(t.eventsStoreName)){var i=r.createObjectStore(t.eventsStoreName,{keyPath:"id"});i.createIndex("timestamp","timestamp",{unique:!1}),i.createIndex("status","status",{unique:!1})}}})]})})},t.prototype.getItem=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.storeName],"readonly").objectStore(r.storeName).get(t);s.onerror=function(){return e(s.error)},s.onsuccess=function(){var t=s.result;i(null==t?null:"string"==typeof t?t:"object"===El(t)?JSON.stringify(t):String(t))}})]}})})},t.prototype.setItem=function(t,n){return Bu(this,void 0,void 0,function(){var r,i=this;return Gu(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return r=e.sent(),[2,new Promise(function(e,s){var u=r.transaction([i.storeName],"readwrite").objectStore(i.storeName).put(n,t);u.onerror=function(){return s(u.error)},u.onsuccess=function(){return e()}})]}})})},t.prototype.removeItem=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.storeName],"readwrite").objectStore(r.storeName).delete(t);s.onerror=function(){return e(s.error)},s.onsuccess=function(){return i()}})]}})})},t.prototype.clear=function(){return Bu(this,void 0,void 0,function(){var t,n=this;return Gu(this,function(r){switch(r.label){case 0:return[4,this.openDB()];case 1:return t=r.sent(),[2,new Promise(function(r,i){var e=t.transaction([n.storeName],"readwrite").objectStore(n.storeName).clear();e.onerror=function(){return i(e.error)},e.onsuccess=function(){return r()}})]}})})},t.prototype.close=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.db&&(this.db.close(),this.db=null),[2]})})},t.prototype.addEvent=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readwrite").objectStore(r.eventsStoreName).add(t);s.onerror=function(){return e(s.error)},s.onsuccess=function(){return i()}})]}})})},t.prototype.getOldestPendingEvents=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i=this;return void 0===n&&(n=50),Gu(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return r=e.sent(),[2,new Promise(function(e,s){var u=r.transaction([i.eventsStoreName],"readonly").objectStore(i.eventsStoreName).index("timestamp").openCursor(),o=[],a=0;u.onerror=function(){return s(u.error)},u.onsuccess=function(r){var i=r.target.result;if(i&&a<n){var s=i.value;"pending"===s.status&&s.accountId===t&&(o.push(s),a++),i.continue()}else e(o)}})]}})})},t.prototype.updateEventStatus=function(t,n,r,i){return Bu(this,void 0,void 0,function(){var e,s=this;return Gu(this,function(u){switch(u.label){case 0:return[4,this.openDB()];case 1:return e=u.sent(),[2,new Promise(function(u,o){var a=e.transaction([s.eventsStoreName],"readwrite").objectStore(s.eventsStoreName),c=a.get(t);c.onerror=function(){return o(c.error)},c.onsuccess=function(){var e=c.result;if(e){e.status=n,e.lastAttempt=Date.now(),r&&(e.error=r),void 0!==i&&(e.attempts=i);var s=a.put(e);s.onerror=function(){return o(s.error)},s.onsuccess=function(){return u()}}else o(new Error("Event with id ".concat(t," not found")))}})]}})})},t.prototype.removeEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readwrite").objectStore(r.eventsStoreName),u=0,o=t.length;0!==o?t.forEach(function(t){var n=s.delete(t);n.onerror=function(){return e(n.error)},n.onsuccess=function(){++u===o&&i()}}):i()})]}})})},t.prototype.recoverOrphanedEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readwrite").objectStore(r.eventsStoreName).openCursor(),u=0;s.onerror=function(){return e(s.error)},s.onsuccess=function(n){var r=n.target.result;if(r){var e=r.value;if("processing"===e.status&&e.accountId===t)e.status="failed",e.lastAttempt=Date.now(),e.error="Recovered from orphaned processing state",r.update(e).onsuccess=function(){u++};r.continue()}else i(u)}})]}})})},t.prototype.getPendingEventCount=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readonly").objectStore(r.eventsStoreName).openCursor(),u=0;s.onerror=function(){return e(s.error)},s.onsuccess=function(n){var r=n.target.result;if(r){var e=r.value;"pending"===e.status&&e.accountId===t&&u++,r.continue()}else i(u)}})]}})})},t.prototype.getRetryableEvents=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i=this;return void 0===n&&(n=5),Gu(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return r=e.sent(),[2,new Promise(function(e,s){var u=r.transaction([i.eventsStoreName],"readonly").objectStore(i.eventsStoreName).openCursor(),o=[];u.onerror=function(){return s(u.error)},u.onsuccess=function(r){var i=r.target.result;if(i){var s=i.value;"failed"===s.status&&s.attempts<=n&&s.accountId===t&&o.push(s),i.continue()}else e(o)}})]}})})},t}(),Tl=function(){function t(t,n,r,i,e){if(this.currentAccountId=null,this.currentCuid=null,this.currentUserIdentifierType=null,this.currentVisitorId=null,this.currentVisitorRefId=null,this.getSessionInfo=null,this.isProcessing=!1,this.processingPromise=null,this.paused=!1,this.apiClient=t,this.logger=n,this.BATCH_SIZE=e||no.BATCH_SIZE,this.RETRY_DELAYS=i||no.DEFAULT_RETRY_DELAYS,r&&"getIndexedDBAdapter"in r){var s=r.getIndexedDBAdapter();s?(n.info("EventQueue: Reusing existing IndexedDB adapter from StorageManager"),this.storage=s):(n.warn("EventQueue: StorageManager has no IndexedDB adapter, creating new one"),this.storage=new Sl)}else r?(n.info("EventQueue: Using provided IndexedDBStorage"),this.storage=r):(n.warn("EventQueue: No storage provided, creating new IndexedDBStorage"),this.storage=new Sl)}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Initializing EventQueue"),[4,this.processQueueIfIdle()];case 1:return t.sent(),this.logger.info("EventQueue initialized successfully"),[2]}})})},t.prototype.setUserContext=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return this.currentAccountId=t,this.currentCuid=n||null,this.currentUserIdentifierType=r||null,this.logger.debug("EventQueue user context set",{accountId:t,cuid:n,userIdentifierType:r}),[4,this.storage.recoverOrphanedEvents(t)];case 1:return(i=e.sent())>0&&this.logger.info("Recovered ".concat(i," orphaned processing events for account ").concat(t)),[2]}})})},t.prototype.setVisitorContext=function(t,n){this.currentVisitorId=t,this.currentVisitorRefId=null!=n?n:null,this.logger.debug("EventQueue visitor context set",{visitorId:t,visitorRefId:n})},t.prototype.setSessionInfoCallback=function(t){this.getSessionInfo=t,this.logger.debug("EventQueue session info callback set")},t.prototype.getCurrentAccountId=function(){return this.currentAccountId},t.prototype.getCurrentCuid=function(){return this.currentCuid},t.prototype.getCurrentVisitorId=function(){return this.currentVisitorId},t.prototype.clearUserContext=function(){this.currentCuid=null,this.currentUserIdentifierType=null,this.logger.debug("EventQueue user context cleared (cuid removed)")},t.prototype.enqueue=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i,e,s;return void 0===n&&(n=!1),Gu(this,function(u){switch(u.label){case 0:if(u.trys.push([0,7,,8]),!this.currentAccountId)throw new Error("Cannot enqueue event: No account context set");if(r=null,!this.getSessionInfo)return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.getSessionInfo()];case 2:return r=u.sent(),[3,4];case 3:return i=u.sent(),this.logger.warn("Failed to resolve session ID at enqueue time",i),[3,4];case 4:return e={id:Bv(),event:t,accountId:this.currentAccountId,timestamp:(new Date).toISOString(),attempts:0,status:no.STATUSES.PENDING,visitorId:this.currentVisitorId,visitorRefId:this.currentVisitorRefId,cuid:this.currentCuid,userIdentifierType:this.currentUserIdentifierType,sessionId:r,isDLR:n},[4,this.storage.addEvent(e)];case 5:return u.sent(),this.logger.debug("Event added to queue",{eventId:e.id,eventName:t.name,visitorId:e.visitorId,cuid:e.cuid,sessionId:e.sessionId,isDLR:n}),[4,this.processQueueIfIdle()];case 6:return u.sent(),[3,8];case 7:throw s=u.sent(),this.logger.error("Failed to enqueue event",{event:t,error:s}),s;case 8:return[2]}})})},t.prototype.processQueueIfIdle=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.paused?(this.logger.debug("Queue processing paused, skipping"),[2]):this.isProcessing?(this.logger.debug("Queue processing already in progress, skipping"),[2]):(this.processingPromise||(this.processingPromise=this.processQueue()),[2,this.processingPromise])})})},t.prototype.getIdentityKey=function(t){var n,r,i,e,s,u=null!==(n=t.visitorId)&&void 0!==n?n:"_none_",o=null!==(r=t.visitorRefId)&&void 0!==r?r:"_none_",a=null!==(i=t.cuid)&&void 0!==i?i:"_none_",c=null!==(e=t.userIdentifierType)&&void 0!==e?e:"_none_",f=null!==(s=t.sessionId)&&void 0!==s?s:"_none_";return"".concat(u,"|").concat(o,"|").concat(a,"|").concat(c,"|").concat(f)},t.prototype.groupEventsByIdentity=function(t){var n,r,i=new Map;try{for(var e=Wu(t),s=e.next();!s.done;s=e.next()){var u=s.value,o=this.getIdentityKey(u),a=i.get(o);a?a.push(u):i.set(o,[u])}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return Array.from(i.values())},t.prototype.processQueue=function(){return Bu(this,void 0,void 0,function(){var n=this;return Gu(this,function(r){switch(r.label){case 0:return this.isProcessing?[2]:"undefined"!=typeof navigator&&"locks"in navigator?[4,navigator.locks.request(t.QUEUE_LOCK_NAME,{ifAvailable:!0},function(t){return Bu(n,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return t?[4,this.executeProcessQueue()]:(this.logger.debug("Queue lock held by another tab, skipping"),[2]);case 1:return n.sent(),[2]}})})})]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,this.executeProcessQueue()];case 3:r.sent(),r.label=4;case 4:return[2]}})})},t.prototype.executeProcessQueue=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:this.isProcessing=!0,this.logger.debug("Starting queue processing"),f.label=1;case 1:f.trys.push([1,16,17,18]),f.label=2;case 2:return this.paused?(this.logger.debug("Queue processing paused mid-cycle, stopping"),[3,15]):[4,this.checkAndPromoteRetryEvents()];case 3:return f.sent(),this.currentAccountId?[4,this.storage.getOldestPendingEvents(this.currentAccountId,this.BATCH_SIZE)]:(this.logger.debug("No account context, skipping event processing"),[3,15]);case 4:if(0===(t=f.sent()).length)return this.logger.debug("No pending events to process"),[3,15];n=this.groupEventsByIdentity(t),this.logger.info("Processing events",{totalEvents:t.length,identityGroups:n.length}),f.label=5;case 5:f.trys.push([5,11,12,13]),a=void 0,r=Wu(n),i=r.next(),f.label=6;case 6:return i.done?[3,10]:(e=i.value,s=e[0],this.logger.debug("Processing identity group",{batchSize:e.length,visitorId:null==s?void 0:s.visitorId,cuid:null==s?void 0:s.cuid,sessionId:null==s?void 0:s.sessionId}),[4,this.markEventsAsProcessing(e)]);case 7:return f.sent(),[4,this.sendBatch(e)];case 8:f.sent(),f.label=9;case 9:return i=r.next(),[3,6];case 10:return[3,13];case 11:return u=f.sent(),a={error:u},[3,13];case 12:try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(a)throw a.error}return[7];case 13:return[4,this.storage.getPendingEventCount(this.currentAccountId)];case 14:return 0===f.sent()?(this.logger.debug("No more pending events"),[3,15]):[3,2];case 15:return[3,18];case 16:return o=f.sent(),this.logger.error("Queue processing failed",o),[3,18];case 17:return this.isProcessing=!1,this.processingPromise=null,this.logger.debug("Queue processing completed"),[7];case 18:return[2]}})})},t.prototype.markEventsAsProcessing=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=Wu(t),r=n.next(),a.label=1;case 1:if(r.done)return[3,6];i=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.storage.updateEventStatus(i.id,"processing")];case 3:return a.sent(),[3,5];case 4:return e=a.sent(),this.logger.warn("Failed to mark event as processing",{eventId:i.id,error:e}),[3,5];case 5:return r=n.next(),[3,1];case 6:return[3,9];case 7:return s=a.sent(),u={error:s},[3,9];case 8:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(u)throw u.error}return[7];case 9:return[2]}})})},t.prototype.sendBatch=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:if(f.trys.push([0,5,,10]),!this.currentAccountId)throw new Error("Missing account context for batch sending");return n=t[0],r=!!(null!==(c=n.visitorId)&&void 0!==c?c:n.visitorRefId),i=!!n.cuid,e=void 0,e=r&&i?"identified":r?"anonymous":"user-only",this.logger.debug("Sending event batch",{batchSize:t.length,trackingMode:e,hasVisitor:r,hasUser:i}),s=t.filter(function(t){return!0===t.isDLR}),(u=t.filter(function(t){return!0!==t.isDLR})).length>0?[4,this.sendRegularEvents(u)]:[3,2];case 1:f.sent(),f.label=2;case 2:return s.length>0?[4,this.sendDLREvents(s)]:[3,4];case 3:f.sent(),f.label=4;case 4:return[2,!0];case 5:return o=f.sent(),a=this.isRetryableHttpError(o),this.logger.error("Failed to send batch",{batchSize:t.length,error:o,isRetryable:a}),a?[4,this.handleFailedBatch(t)]:[3,7];case 6:return f.sent(),[3,9];case 7:return[4,this.removeNonRetryableEvents(t)];case 8:f.sent(),f.label=9;case 9:return[2,!1];case 10:return[2]}})})},t.prototype.sendRegularEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o,a,c,f,h,d,v,l;return Gu(this,function(g){switch(g.label){case 0:if(n=t[0],r=null!==(f=n.visitorId)&&void 0!==f?f:null,i=null!==(h=n.visitorRefId)&&void 0!==h?h:null,e=null!==(d=n.cuid)&&void 0!==d?d:null,s=null!==(v=n.userIdentifierType)&&void 0!==v?v:null,u=null!==(l=n.sessionId)&&void 0!==l?l:null,o=this.apiClient,a=t.map(function(t){return t.event}),!u)throw new Error("Session ID is required for event tracking");return[4,o.sendEvents(a,r||void 0,i||void 0,e||void 0,s||void 0,u)];case 1:return c=g.sent(),[4,this.handleBatchResponse(t,c)];case 2:return g.sent(),[2]}})})},t.prototype.sendDLREvents=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:return n=t[0],r=this.apiClient,i=null!==(o=n.sessionId)&&void 0!==o?o:"",e=fh(i),s={events:t.map(function(t){return t.event}),request_id:Bv(),system_data:e},n.cuid?s.user={identifierName:"id",identifierValue:n.cuid}:n.visitorId&&(s.visitor={identifierName:"id",identifierValue:n.visitorId}),[4,r.sendDLR(s)];case 1:return u=a.sent(),[4,this.handleBatchResponse(t,u)];case 2:return a.sent(),[2]}})})},t.prototype.removeSuccessfulEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:n=t.map(function(t){return t.id}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.storage.removeEvents(n)];case 2:return i.sent(),this.logger.debug("Successfully removed events from storage",{count:n.length}),[3,4];case 3:return r=i.sent(),this.logger.error("Failed to remove events from storage",{eventIds:n,error:r}),[3,4];case 4:return[2]}})})},t.prototype.handleBatchResponse=function(t,n){return Bu(this,void 0,void 0,function(){var r;return Gu(this,function(i){switch(i.label){case 0:return(r=parseInt(n.status.code,10))!==no.GLOBAL_SUCCESS_CODE?[3,2]:[4,this.removeSuccessfulEvents(t)];case 1:return i.sent(),this.logger.info("All events processed successfully",{count:t.length}),[3,8];case 2:return r!==no.PARTIAL_SUCCESS_CODE?[3,4]:[4,this.handlePartialSuccess(t,n.events)];case 3:return i.sent(),[3,8];case 4:return no.RETRYABLE_HTTP_CODES.includes(r)?[4,this.handleFailedBatch(t)]:[3,6];case 5:return i.sent(),this.logger.warn("Batch failed with retryable error",{code:r,message:n.status.message}),[3,8];case 6:return[4,this.removeNonRetryableEvents(t)];case 7:i.sent(),this.logger.error("Batch failed with non-retryable error",{code:r,message:n.status.message}),i.label=8;case 8:return[2]}})})},t.prototype.handlePartialSuccess=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u,o,a,c,f;return Gu(this,function(h){switch(h.label){case 0:r=new Map,n.forEach(function(t){r.set(t.eventRefId,t)}),h.label=1;case 1:h.trys.push([1,12,13,14]),i=Wu(t),e=i.next(),h.label=2;case 2:return e.done?[3,11]:(s=e.value,(u=r.get(s.event.eventRefId))?[3,4]:[4,this.markEventForRetry(s,"No response received")]);case 3:return h.sent(),[3,10];case 4:return u.status.success?[4,this.storage.removeEvents([s.id])]:[3,6];case 5:return h.sent(),this.logger.debug("Event processed successfully",{eventId:s.id}),[3,10];case 6:return o=parseInt(u.status.code,10),no.RETRYABLE_HTTP_CODES.includes(o)?[4,this.markEventForRetry(s,u.status.message)]:[3,8];case 7:return h.sent(),this.logger.debug("Event marked for retry",{eventId:s.id,code:o,message:u.status.message}),[3,10];case 8:return[4,this.storage.removeEvents([s.id])];case 9:h.sent(),this.logger.warn("Event permanently failed - removed",{eventId:s.id,code:o,message:u.status.message}),h.label=10;case 10:return e=i.next(),[3,2];case 11:return[3,14];case 12:return a=h.sent(),c={error:a},[3,14];case 13:try{e&&!e.done&&(f=i.return)&&f.call(i)}finally{if(c)throw c.error}return[7];case 14:return[2]}})})},t.prototype.markEventForRetry=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:return r=(t.attempts||0)+1,[4,this.storage.updateEventStatus(t.id,"failed","Attempt ".concat(r," failed: ").concat(n),r)];case 1:return s.sent(),i=Math.min(Math.max(r-1,0),this.RETRY_DELAYS.length-1),e=this.RETRY_DELAYS[i],this.logger.debug("Event marked for retry",{eventId:t.id,attempts:r,delay:e,isInfiniteRetry:r>this.RETRY_DELAYS.length}),[2]}})})},t.prototype.checkAndPromoteRetryEvents=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f,h;return Gu(this,function(d){switch(d.label){case 0:return d.trys.push([0,10,,11]),this.currentAccountId?[4,this.storage.getRetryableEvents(this.currentAccountId,Number.MAX_SAFE_INTEGER)]:(this.logger.debug("No account context, skipping retry check"),[2]);case 1:if(0===(t=d.sent()).length)return[2];n=0,d.label=2;case 2:d.trys.push([2,7,8,9]),r=Wu(t),i=r.next(),d.label=3;case 3:return i.done?[3,6]:(e=i.value,s=Math.min(Math.max(e.attempts-1,0),this.RETRY_DELAYS.length-1),u=this.RETRY_DELAYS[s],(o=Date.now()-(e.lastAttempt||0))>=(u||0)?[4,this.storage.updateEventStatus(e.id,"pending")]:[3,5]);case 4:d.sent(),n++,this.logger.debug("Failed event promoted to pending",{eventId:e.id,attempt:e.attempts+1,delay:u,timeSinceLastAttempt:o}),d.label=5;case 5:return i=r.next(),[3,3];case 6:return[3,9];case 7:return a=d.sent(),f={error:a},[3,9];case 8:try{i&&!i.done&&(h=r.return)&&h.call(r)}finally{if(f)throw f.error}return[7];case 9:return n>0&&this.logger.debug("Promoted ".concat(n," failed events for retry")),[3,11];case 10:return c=d.sent(),this.logger.error("Failed to check retry events",c),[3,11];case 11:return[2]}})})},t.prototype.isRetryableHttpError=function(t){var n,r,i,e,s=t;if(s.code){var u=parseInt(s.code,10);return no.RETRYABLE_HTTP_CODES.includes(u)}return null!==(e=(null===(n=s.message)||void 0===n?void 0:n.includes("network"))||(null===(r=s.message)||void 0===r?void 0:r.includes("timeout"))||(null===(i=s.message)||void 0===i?void 0:i.includes("fetch")))&&void 0!==e&&e},t.prototype.removeNonRetryableEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:n=t.map(function(t){return t.id}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.storage.removeEvents(n)];case 2:return i.sent(),this.logger.warn("Non-retryable events removed permanently",{eventIds:n}),[3,4];case 3:return r=i.sent(),this.logger.error("Failed to remove non-retryable events",{eventIds:n,error:r}),[3,4];case 4:return[2]}})})},t.prototype.handleFailedBatch=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=Wu(t),r=n.next(),a.label=1;case 1:if(r.done)return[3,6];i=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.markEventForRetry(i,"Batch failed")];case 3:return a.sent(),[3,5];case 4:return e=a.sent(),this.logger.error("Failed to mark event for retry",{eventId:i.id,error:e}),[3,5];case 5:return r=n.next(),[3,1];case 6:return[3,9];case 7:return s=a.sent(),u={error:s},[3,9];case 8:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(u)throw u.error}return[7];case 9:return[2]}})})},t.prototype.pause=function(){this.paused=!0,this.logger.info("EventQueue paused")},t.prototype.resume=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.paused=!1,this.logger.info("EventQueue resumed"),[4,this.processQueueIfIdle()];case 1:return t.sent(),[2]}})})},t.prototype.flush=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Manual flush requested"),[4,this.processQueueIfIdle()];case 1:return t.sent(),[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying EventQueue"),this.processingPromise?[4,this.processingPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this.storage.close()];case 3:return t.sent(),this.logger.info("EventQueue destroyed"),[2]}})})},t.QUEUE_LOCK_NAME="websdk-event-queue-lock",t}(),kl=function(){function t(t,n,r,i){this.eventQueue=null,this.initialized=!1,this.visitorId=null,this.visitorTrackingEnabled=null,this.config=t,this.logger=i,this.apiClient=n,this.storageManager=r}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("EventTracker already initialized"),[2]):(this.logger.info("Initializing EventTracker with IndexedDB queue"),this.eventQueue=new Tl(this.apiClient,this.logger,this.storageManager,this.config.retryDelays,this.config.batchSize),[4,this.eventQueue.init()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(po),[2]}})})},t.prototype.setUserContext=function(t,n,r){return Bu(this,void 0,void 0,function(){return Gu(this,function(i){switch(i.label){case 0:if(!this.eventQueue)throw new Error("EventTracker not initialized");return[4,this.eventQueue.setUserContext(t,n,r)];case 1:return i.sent(),this.logger.info("User context set",{accountId:t,cuid:n,userIdentifierType:r}),[2]}})})},t.prototype.setVisitorTrackingState=function(t,n,r){this.visitorId=t,this.visitorTrackingEnabled=n,this.eventQueue&&this.eventQueue.setVisitorContext(t,r),this.logger.debug("Visitor tracking state updated",{visitorId:t,visitorRefId:r,isEnabled:n,trackingMode:t?"anonymous":"not-configured"})},t.prototype.setSessionInfoCallback=function(t){if(!this.eventQueue)throw new Error("EventTracker not initialized");this.eventQueue.setSessionInfoCallback(t),this.logger.debug("Session info callback set in EventTracker")},t.prototype.clearUserContext=function(){this.eventQueue?(this.eventQueue.clearUserContext(),this.logger.info("User context cleared from EventTracker")):this.logger.warn("Cannot clear user context - EventTracker not initialized")},t.prototype.track=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:if(!this.initialized||!this.eventQueue)throw new Error("EventTracker not initialized");if(!1===this.visitorTrackingEnabled)throw this.logger.warn("Event tracking is disabled - visitor tracking is not enabled"),new Error("Event tracking is disabled");this.logger.debug("Tracking event",{event:t}),i.label=1;case 1:return i.trys.push([1,3,,4]),n=this.convertToApiEvent(t),[4,this.eventQueue.enqueue(n)];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.logger.error(bo,{event:t,error:r}),new Error("".concat(vo,": ").concat(r));case 4:return[2]}})})},t.prototype.convertToApiEvent=function(t){if(!t.name||""===t.name.trim())throw new Error("Event name is required");var n=zu({},t.data);if(!this.eventQueue)throw new Error("EventTracker not initialized");var r,i=this.eventQueue.getCurrentCuid();if(!i&&!this.visitorId){var e=null===this.visitorTrackingEnabled?"Cannot track event: User must be identified (cuid) or visitor tracking must be configured":"Cannot track event: Either visitor tracking must be enabled or user must be identified";throw this.logger.error(e,{hasVisitorId:!!this.visitorId,hasCuid:!1,visitorTrackingEnabled:this.visitorTrackingEnabled}),new Error(e)}return r=this.visitorId&&i?"identified":this.visitorId?"anonymous":"user-only",this.logger.debug("Creating event payload",{eventName:t.name,hasCuid:!!i,hasVisitorId:!!this.visitorId,trackingMode:r,visitorTrackingEnabled:this.visitorTrackingEnabled}),function(t,n){if(!t||""===t.trim())throw new Error("Event name is required");return{name:t.trim(),eventRefId:Bv(),eventDateTime:(new Date).toISOString(),attributes:n||{}}}(t.name,n)},t.prototype.pause=function(){this.eventQueue&&this.eventQueue.pause(),this.logger.info("EventTracker paused")},t.prototype.resume=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.eventQueue?[4,this.eventQueue.resume()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.logger.info("EventTracker resumed"),[2]}})})},t.prototype.flush=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized&&this.eventQueue?(this.logger.info("Manual flush requested"),[4,this.eventQueue.flush()]):(this.logger.warn("Cannot flush events - EventTracker not initialized"),[2]);case 1:return t.sent(),[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying EventTracker"),this.eventQueue?[4,this.eventQueue.destroy()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.initialized=!1,this.logger.info(yo),[2]}})})},t.prototype.trackNotificationReceived=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("received",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackNotificationClicked=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("clicked",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackNotificationDismissed=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("dismissed",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackDLREvent=function(t,n){return Bu(this,void 0,void 0,function(){var r,i;return Gu(this,function(e){switch(e.label){case 0:if(!this.initialized||!this.eventQueue)return this.logger.warn("EventTracker not initialized, skipping DLR event",{eventType:t}),[2];e.label=1;case 1:return e.trys.push([1,3,,4]),r=this.createDLREvent(t,n),[4,this.eventQueue.enqueue(r,!0)];case 2:return e.sent(),this.logger.info("DLR event tracked: ".concat(t),{eventType:t,eventName:r.name,messageId:n.messageId}),[3,4];case 3:return i=e.sent(),this.logger.error("Failed to track DLR event",{eventType:t,notificationData:n,error:i}),[3,4];case 4:return[2]}})})},t.prototype.createDLREvent=function(t,n){var r,i={received:Sa.NOTIFICATION_RECEIVED,clicked:Sa.NOTIFICATION_CLICKED,dismissed:Sa.NOTIFICATION_DISMISSED},e=null===(r=this.eventQueue)||void 0===r?void 0:r.getCurrentCuid(),s={messageId:n.messageId,gateway:Ta,result:{received:"SUCCESS",clicked:"CLICKED",dismissed:"DISMISSED"}[t],notification_route:ka,cuid:e||null,visitor_id:e?null:this.visitorId||null,scope:n.scope||null};return n.senderId&&(s.senderId=n.senderId),{attributes:s,name:i[t],eventDateTime:(new Date).toISOString(),eventRefId:Bv()}},t.prototype.dispatchDLREvent=function(t){return Bu(this,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:switch(n=zu(zu(zu(zu(zu(zu({messageId:t.messageId},void 0!==t.scope?{scope:t.scope}:{}),void 0!==t.campaignId?{campaignId:t.campaignId}:{}),void 0!==t.variationId?{variationId:t.variationId}:{}),void 0!==t.senderId?{senderId:t.senderId}:{}),void 0!==t.cuid?{cuid:t.cuid}:{}),void 0!==t.accountId?{accountId:t.accountId}:{}),t.type){case"received":return[3,1];case"clicked":return[3,3];case"dismissed":return[3,5]}return[3,7];case 1:return[4,this.trackNotificationReceived(n)];case 2:case 4:case 6:return r.sent(),[3,7];case 3:return[4,this.trackNotificationClicked(n)];case 5:return[4,this.trackNotificationDismissed(n)];case 7:return[2]}})})},t.prototype.processPendingServiceWorkerDLREvents=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:if(!this.initialized)return[2];a.label=1;case 1:return a.trys.push([1,12,,13]),[4,this.getServiceWorkerPendingDLREvents()];case 2:if(0===(t=a.sent()).length)return[2];this.logger.info("Processing pending service worker DLR events",{count:t.length}),a.label=3;case 3:a.trys.push([3,8,9,10]),n=Wu(t),r=n.next(),a.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this.dispatchDLREvent(i)]);case 5:a.sent(),a.label=6;case 6:return r=n.next(),[3,4];case 7:return[3,10];case 8:return e=a.sent(),u={error:e},[3,10];case 9:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(u)throw u.error}return[7];case 10:return[4,this.clearServiceWorkerPendingDLREvents()];case 11:return a.sent(),this.logger.info("Processed pending service worker DLR events",{count:t.length}),[3,13];case 12:return s=a.sent(),this.logger.error("Failed to process pending service worker DLR events",s),[3,13];case 13:return[2]}})})},t.prototype.getServiceWorkerPendingDLREvents=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return[2,new Promise(function(t){var n=indexedDB.open("WebSDK_DLR_SW",1);n.onerror=function(){return t([])},n.onsuccess=function(){var r=n.result;if(!r.objectStoreNames.contains("pending_dlr_events"))return r.close(),void t([]);var i=r.transaction(["pending_dlr_events"],"readonly").objectStore("pending_dlr_events").getAll();i.onerror=function(){r.close(),t([])},i.onsuccess=function(){r.close(),t(i.result||[])}},n.onupgradeneeded=function(t){var n=t.target.result;n.objectStoreNames.contains("pending_dlr_events")||n.createObjectStore("pending_dlr_events",{keyPath:"id",autoIncrement:!0})}})]})})},t.prototype.clearServiceWorkerPendingDLREvents=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return[2,new Promise(function(t){var n=indexedDB.open("WebSDK_DLR_SW",1);n.onerror=function(){return t()},n.onsuccess=function(){var r=n.result;if(!r.objectStoreNames.contains("pending_dlr_events"))return r.close(),void t();var i=r.transaction(["pending_dlr_events"],"readwrite").objectStore("pending_dlr_events").clear();i.onerror=function(){r.close(),t()},i.onsuccess=function(){r.close(),t()}},n.onupgradeneeded=function(t){var n=t.target.result;n.objectStoreNames.contains("pending_dlr_events")||n.createObjectStore("pending_dlr_events",{keyPath:"id",autoIncrement:!0})}})]})})},t}(),Rl=function(){function t(t,n,r){this.initialized=!1,this.logger=t,this.brandId=n,this.applicationId=r,this.adapter=new Al}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:if(this.initialized)return this.logger.warn("StorageManager already initialized"),[2];this.logger.info("Initializing StorageManager"),e.label=1;case 1:return e.trys.push([1,6,,7]),this.isIndexedDBSupported()?(t=["WebSDK"],this.brandId&&t.push(this.brandId),this.applicationId&&t.push(this.applicationId),n=t.join("_"),r=new Sl(n),[4,this.testStorageAdapter(r)]):[3,3];case 2:return e.sent(),this.adapter=r,this.logger.info("StorageManager initialized with IndexedDB",{dbName:n,brandId:this.brandId,applicationId:this.applicationId}),[3,5];case 3:return[4,this.testStorageAdapter(this.adapter)];case 4:e.sent(),this.logger.info("StorageManager initialized with localStorage"),e.label=5;case 5:return this.initialized=!0,[3,7];case 6:throw i=e.sent(),this.logger.error(So,i),new Error("Storage initialization failed: ".concat(i));case 7:return[2]}})})},t.prototype.isIndexedDBSupported=function(){return"undefined"!=typeof window&&"indexedDB"in window&&null!==indexedDB},t.prototype.testStorageAdapter=function(t){return Bu(this,void 0,void 0,function(){var n,r,i;return Gu(this,function(e){switch(e.label){case 0:n=oo,r=ao,e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.setItem(n,r)];case 2:return e.sent(),[4,t.getItem(n)];case 3:if(e.sent()!==r)throw new Error(ko);return[4,t.removeItem(n)];case 4:return e.sent(),[3,6];case 5:throw i=e.sent(),new Error("".concat(To," ").concat(i));case 6:return[2]}})})},t.prototype.get=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.getItem(t)]})})},t.prototype.set=function(t,n){return Bu(this,void 0,void 0,function(){return Gu(this,function(r){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.setItem(t,n)]})})},t.prototype.remove=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.removeItem(t)]})})},t.prototype.clear=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.clear()]})})},t.prototype.getIndexedDBAdapter=function(){return this.adapter instanceof Sl?this.adapter:null},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:this.logger.info("Destroying StorageManager"),n.label=1;case 1:return n.trys.push([1,4,,5]),this.adapter instanceof Sl?[4,this.adapter.close()]:[3,3];case 2:n.sent(),n.label=3;case 3:return this.initialized=!1,this.logger.info(Ro),[3,5];case 4:return t=n.sent(),this.logger.error(Ao,t),this.initialized=!1,[3,5];case 5:return[2]}})})},t}(),Al=function(){function t(){}return t.prototype.getItem=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){try{return[2,localStorage.getItem(t)]}catch(t){throw new Error("LocalStorage getItem failed: ".concat(t))}return[2]})})},t.prototype.setItem=function(t,n){return Bu(this,void 0,void 0,function(){return Gu(this,function(r){try{localStorage.setItem(t,n)}catch(t){if(t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name))throw new Error("LocalStorage quota exceeded");throw new Error("LocalStorage setItem failed: ".concat(t))}return[2]})})},t.prototype.removeItem=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){try{localStorage.removeItem(t)}catch(t){throw new Error("LocalStorage removeItem failed: ".concat(t))}return[2]})})},t.prototype.clear=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){try{localStorage.clear()}catch(t){throw new Error("LocalStorage clear failed: ".concat(t))}return[2]})})},t}();!function(t){t[t.VERBOSE=0]="VERBOSE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.NONE=5]="NONE"}(Il||(Il={}));var _l,Ol,Cl=function(){function t(t,n){void 0===t&&(t=!1),void 0===n&&(n=Il.INFO),this.logs=[],this.maxLogs=1e3,this.enabled=t,this.level=n}return t.prototype.formatMessage=function(t,n){var r=(new Date).toISOString(),i=Il[t];return"[".concat(r,"] [WebSDK:").concat(i,"] ").concat(n)},t.prototype.log=function(t,n,r){if(this.enabled&&!(t<this.level)){var i={level:t,message:n,timestamp:Date.now(),data:r};this.logs.push(i),this.logs.length>this.maxLogs&&this.logs.shift();var e=this.formatMessage(t,n),s=r?[e,r]:[e];switch(t){case Il.VERBOSE:case Il.DEBUG:console.debug.apply(console,Hu([],qu(s),!1));break;case Il.INFO:console.info.apply(console,Hu([],qu(s),!1));break;case Il.WARN:console.warn.apply(console,Hu([],qu(s),!1));break;case Il.ERROR:console.error.apply(console,Hu([],qu(s),!1))}}},t.prototype.verbose=function(t,n){this.log(Il.VERBOSE,t,n)},t.prototype.debug=function(t,n){this.log(Il.DEBUG,t,n)},t.prototype.info=function(t,n){this.log(Il.INFO,t,n)},t.prototype.warn=function(t,n){this.log(Il.WARN,t,n)},t.prototype.error=function(t,n){this.log(Il.ERROR,t,n)},t.prototype.setLevel=function(t){this.level=t},t.prototype.setEnabled=function(t){this.enabled=t},t.prototype.getLogs=function(){return Hu([],qu(this.logs),!1)},t.prototype.clearLogs=function(){this.logs=[]},t}(),Dl=function(){function t(t,n,r,i,e,s){this.initialized=!1,this.cachedConfig=null,this.orgId=t,this.apiClient=n,this.logger=r,this.storageManager=i,void 0!==e&&(this.brandId=e),void 0!==s&&(this.applicationId=s)}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("VisitorConfigManager already initialized"),[2]):(this.logger.info("Initializing VisitorConfigManager",{orgId:this.orgId}),[4,this.restoreCachedConfig()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(Vo),[2]}})})},t.prototype.fetchConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i=this;return Gu(this,function(e){switch(e.label){case 0:if(!this.initialized)throw new Error("VisitorConfigManager not initialized");if(this.cachedConfig)return this.logger.info(Go),[2,this.cachedConfig];e.label=1;case 1:return e.trys.push([1,4,,5]),this.logger.info("Fetching visitor config from API",{orgId:this.orgId}),[4,this.apiClient.getVisitorConfig(this.orgId)];case 2:return(t=e.sent()).warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor config warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){i.logger.error("Visitor config error from response",{code:t.code,message:t.message})}),this.cachedConfig=t,[4,this.storeCachedConfig(t)];case 3:return e.sent(),this.logger.info(jo,{isEnabled:null===(r=t.data)||void 0===r?void 0:r.visitorTrackingEnabled}),[2,t];case 4:throw n=e.sent(),this.logger.error(Lo,n),new Error("".concat(lo,": ").concat(n));case 5:return[2]}})})},t.prototype.isVisitorTrackingEnabled=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.fetchConfig()];case 1:return t=e.sent(),(n=!0===(null===(i=t.data)||void 0===i?void 0:i.visitorTrackingEnabled))?this.logger.info(Bo):this.logger.info(zo),[2,n];case 2:return r=e.sent(),this.logger.error("Failed to check visitor tracking status",r),[2,!1];case 3:return[2]}})})},t.prototype.refreshConfig=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){if(!this.initialized)throw new Error("VisitorConfigManager not initialized");return this.logger.info("Force refreshing visitor config from API"),this.cachedConfig=null,[2,this.fetchConfig()]})})},t.prototype.getCachedConfig=function(){return this.cachedConfig},t.prototype.storeCachedConfig=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.set(n,JSON.stringify(t))];case 1:return i.sent(),this.logger.debug("Visitor config cached to storage",{key:n}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store visitor config to cache",r),[3,3];case 3:return[2]}})})},t.prototype.restoreCachedConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e;return Gu(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t=so("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=s.sent())&&(r=JSON.parse(n),this.cachedConfig=r,this.logger.info("Visitor config restored from cache",{isEnabled:null===(e=r.data)||void 0===e?void 0:e.visitorTrackingEnabled})),[3,3];case 2:return i=s.sent(),this.logger.warn("Failed to restore visitor config from cache",i),this.cachedConfig=null,[3,3];case 3:return[2]}})})},t.prototype.clearCachedConfig=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:this.cachedConfig=null,r.label=1;case 1:return r.trys.push([1,3,,4]),t=so("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 2:return r.sent(),this.logger.debug("Visitor config cache cleared"),[3,4];case 3:return n=r.sent(),this.logger.warn("Failed to clear visitor config cache",n),[3,4];case 4:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying VisitorConfigManager"),[4,this.clearCachedConfig()];case 1:return t.sent(),this.initialized=!1,this.logger.info("VisitorConfigManager destroyed successfully"),[2]}})})},t}(),Nl={};Ol||(Ol=1,function(){if(_l)return Nl;_l=1;var t=Ti(),n=_();t({global:!0,forced:n.globalThis!==n},{globalThis:n})}());var Fl,Pl=function(){function t(t,n,r,i,e,s,u){this.initialized=!1,this.visitorId=null,this.visitorRefId=null,this.expiredAt=null,this.getFcmToken=null,this.getChannelType=null,this.getExtendedFields=null,this.getPermissionGranted=null,this.mergeRetryTimeoutId=null,this.accountId=t,this.orgId=n,this.source=r,this.apiClient=i,this.logger=e,this.storageManager=s,void 0!==(null==u?void 0:u.brandId)&&(this.brandId=u.brandId),void 0!==(null==u?void 0:u.applicationId)&&(this.applicationId=u.applicationId)}return t.prototype.setMergeDataProviders=function(t,n,r,i){this.getFcmToken=t,this.getChannelType=n,this.getExtendedFields=r,this.getPermissionGranted=i},t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("AnonymousVisitorManager already initialized"),[2]):(this.logger.info("Initializing AnonymousVisitorManager",{accountId:this.accountId,orgId:this.orgId}),[4,this.restoreVisitorId()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(Wo),[2]}})})},t.prototype.getOrCreateVisitorId=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:if(!this.initialized)throw new Error("AnonymousVisitorManager not initialized");if(this.visitorId&&!this.isVisitorExpired())return this.logger.info(Xo,{visitorId:this.visitorId}),[2,this.visitorId];if(this.visitorId&&this.isVisitorExpired()&&this.logger.info("Visitor session expired, creating new visitor via API",{visitorId:this.visitorId,expiredAt:this.expiredAt}),!this.accountId||""===this.accountId.trim())throw r=new Error("AccountId is required for visitor creation"),this.logger.error("Visitor creation validation failed",r),r;o.label=1;case 1:return o.trys.push([1,5,,6]),this.logger.info("Creating new visitor ID",{accountId:this.accountId,hasCommChannels:!!t&&t.length>0,hasExtendedFields:!!n}),[4,this.createVisitor(t,n)];case 2:return i=o.sent(),e=i.visitorId,s=i.expiredAt,this.visitorId=e,[4,this.storeVisitorId(e)];case 3:return o.sent(),[4,this.storeExpiredAt(s)];case 4:return o.sent(),this.logger.info(qo,{visitorId:e}),[2,e];case 5:throw u=o.sent(),this.logger.error(Ho,u),u;case 6:return[2]}})})},t.prototype.createVisitor=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.getOrGenerateVisitorRefId()];case 1:return r=o.sent(),i=t&&t.length>0?t:[],e=zu({visitorRefId:r,profiles:[{source:this.source,accountId:this.accountId,commChannels:i}]},n&&{extendedFields:n}),this.logger.debug("Visitor creation request payload",{request:e}),[4,this.apiClient.createVisitor(this.orgId,e)];case 2:return s=o.sent(),[2,this.handleCreateVisitorResponse(s)];case 3:throw u=o.sent(),this.handleCreateVisitorError(u),u;case 4:return[2]}})})},t.prototype.handleCreateVisitorResponse=function(t){var n,r,i=this;t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor creation warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){i.logger.error("Visitor creation error from response",{code:t.code,message:t.message})});var e=null===(n=t.data)||void 0===n?void 0:n.id;if(!e||""===e.trim())throw new Error("Invalid visitor ID received from API");var s=null===(r=t.data)||void 0===r?void 0:r.expiredAt;if(!s)throw new Error("Missing expiredAt in visitor creation response");return{visitorId:e,expiredAt:s}},t.prototype.handleCreateVisitorError=function(t){var n,r=this;try{var i=(null===(n=t.response)||void 0===n?void 0:n.data)||t;i.warnings&&i.warnings.length>0&&i.warnings.forEach(function(t){t.code===Ea.ACCOUNT_NOT_EXISTS?r.logger.error("Account does not exist",{code:t.code,message:t.message,accountId:r.accountId}):r.logger.warn("Visitor creation warning",{code:t.code,message:t.message})}),i.errors&&i.errors.length>0&&i.errors.forEach(function(t){t.code===Ea.ACCOUNT_ID_NOT_PASSED?r.logger.error("AccountId not passed",{code:t.code,message:t.message}):r.logger.error("Visitor creation error",{code:t.code,message:t.message})})}catch(t){this.logger.warn("Failed to parse visitor creation error",t)}},t.prototype.updateVisitor=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:if(!this.initialized)throw new Error("AnonymousVisitorManager not initialized");if(!this.visitorId)throw new Error("No visitor ID exists. Create a visitor first.");o.label=1;case 1:return o.trys.push([1,3,,4]),this.logger.info("Updating visitor",{visitorId:this.visitorId,hasCommChannels:!!t&&t.length>0,hasExtendedFields:!!n}),r=t&&t.length>0?t:[],i=zu({profiles:[{source:this.source,accountId:this.accountId,commChannels:r}]},n&&{extendedFields:n}),this.logger.debug("Visitor update request payload",{request:i}),[4,this.apiClient.updateVisitor(this.orgId,this.visitorId,i)];case 2:return e=o.sent(),s=this.handleUpdateVisitorResponse(e),this.logger.info($o,{visitorId:s}),[2,s];case 3:throw u=o.sent(),this.handleUpdateVisitorError(u),this.logger.error(Qo,u),u;case 4:return[2]}})})},t.prototype.handleUpdateVisitorResponse=function(t){var n,r=this;t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){r.logger.warn("Visitor update warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){r.logger.error("Visitor update error from response",{code:t.code,message:t.message})});var i=null===(n=t.data)||void 0===n?void 0:n.id;if(!i||""===i.trim())throw new Error("Invalid visitor ID received from update API");return i},t.prototype.handleUpdateVisitorError=function(t){var n,r=this;try{var i=(null===(n=t.response)||void 0===n?void 0:n.data)||t;i.warnings&&i.warnings.length>0&&i.warnings.forEach(function(t){t.code===Ea.ACCOUNT_NOT_EXISTS?r.logger.error("Account does not exist",{code:t.code,message:t.message,accountId:r.accountId}):r.logger.warn("Visitor update warning",{code:t.code,message:t.message})}),i.errors&&i.errors.length>0&&i.errors.forEach(function(t){r.logger.error("Visitor update error",{code:t.code,message:t.message})})}catch(t){this.logger.warn("Failed to parse visitor update error",t)}},t.prototype.mergeVisitorWithUser=function(t,n,r,i,e,s){var u=this;if(this.initialized)if(this.visitorId)if(r||i||e){var o=this.visitorId,a=this.visitorRefId;this.isMerged().then(function(c){if(!c)return u.persistPendingMerge(o,a,zu(zu(zu(zu({firstName:t,lastName:n},void 0!==r&&{email:r}),void 0!==i&&{mobile:i}),void 0!==e&&{externalId:e}),void 0!==s&&{customData:s})).then(function(){return u.attemptPendingMerge()});u.logger.info(Zo,{reason:"Visitor already merged",visitorId:o})}).catch(function(t){u.logger.warn("Merge background task failed unexpectedly",t)})}else this.logger.warn(Zo,{reason:"No email, mobile, or externalId"});else this.logger.warn(Zo,{reason:"No visitor ID"});else this.logger.warn(Zo,{reason:"Not initialized"})},t.prototype.retryPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,this.getPendingMerge()];case 1:return(t=r.sent())?[4,this.isMerged()]:[2];case 2:return r.sent()?[4,this.clearPendingMerge()]:[3,4];case 3:return r.sent(),this.logger.info(Zo,{reason:"Already merged"}),[2];case 4:return t.attempts>=ma?(this.logger.error(Yo,{visitorId:t.visitorId,attempts:t.attempts,message:"Max retries exhausted"}),[4,this.clearPendingMerge()]):[3,6];case 5:return r.sent(),[2];case 6:return this.scheduleMergeRetry(),[3,8];case 7:return n=r.sent(),this.logger.warn("Failed to retry pending merge",n),[3,8];case 8:return[2]}})})},t.prototype.cancelMergeRetryTimer=function(){null!==this.mergeRetryTimeoutId&&(globalThis.clearTimeout(this.mergeRetryTimeoutId),this.mergeRetryTimeoutId=null)},t.prototype.scheduleMergeRetry=function(){var t=this;this.cancelMergeRetryTimer(),this.mergeRetryTimeoutId=globalThis.setTimeout(function(){t.mergeRetryTimeoutId=null,t.attemptPendingMerge().catch(function(n){t.logger.warn("Scheduled merge retry failed unexpectedly",n)})},pa)},t.prototype.attemptPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:return[4,this.getPendingMerge()];case 1:if(!(t=a.sent()))return[2];n=this.getFcmToken?this.getFcmToken():null,r=this.getChannelType?this.getChannelType():void 0,i=!this.getPermissionGranted||this.getPermissionGranted(),a.label=2;case 2:return a.trys.push([2,6,,7]),this.getExtendedFields?[4,this.getExtendedFields()]:[3,4];case 3:return s=a.sent(),[3,5];case 4:s=void 0,a.label=5;case 5:return e=s,[3,7];case 6:return u=a.sent(),this.logger.warn("Failed to collect extended fields for merge, proceeding without them",u),e=void 0,[3,7];case 7:return a.trys.push([7,11,,13]),[4,this.apiClient.mergeVisitor(t.visitorId,t.visitorRefId||null,zu(zu(zu(zu(zu(zu(zu({firstName:t.firstName,lastName:t.lastName},void 0!==t.email&&{email:t.email}),void 0!==t.mobile&&{mobile:t.mobile}),n?{fcmToken:n,subscribed:i}:{}),void 0!==r&&{channelType:r}),{fields:t.customData||{}}),void 0!==e&&{extendedFields:e}),void 0!==t.externalId&&{externalId:t.externalId}))];case 8:return a.sent(),[4,this.markAsMerged(t.visitorId)];case 9:return a.sent(),[4,this.clearPendingMerge()];case 10:return a.sent(),this.logger.info(Jo,{visitorId:t.visitorId,attempts:t.attempts+1}),[3,13];case 11:return o=a.sent(),[4,this.handleMergeRetryOrAbort(o,t)];case 12:return a.sent(),[3,13];case 13:return[2]}})})},t.prototype.handleMergeRetryOrAbort=function(t,n){return Bu(this,void 0,void 0,function(){var r;return Gu(this,function(i){switch(i.label){case 0:return t instanceof Xv?[4,this.clearPendingMerge()]:[3,2];case 1:return i.sent(),this.logger.error("Visitor merge failed permanently, will not retry",{code:t.code,message:t.message,visitorId:n.visitorId}),[2];case 2:return r=zu(zu({},n),{attempts:n.attempts+1}),[4,this.savePendingMerge(r)];case 3:return i.sent(),r.attempts>=ma?(this.logger.error(Yo,{visitorId:n.visitorId,attempts:r.attempts,message:"Max retries exhausted"}),[4,this.clearPendingMerge()]):[3,5];case 4:return i.sent(),[2];case 5:return this.logger.warn("Visitor merge attempt failed, scheduling retry",{attempt:r.attempts,maxRetries:ma,nextRetryMs:pa,visitorId:n.visitorId,error:t}),this.scheduleMergeRetry(),[2]}})})},t.prototype.persistPendingMerge=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:return i=r.firstName,e=r.lastName,s=r.email,u=r.mobile,o=r.externalId,a=r.customData,c=zu(zu(zu(zu(zu(zu(zu({visitorId:t},n&&{visitorRefId:n}),{firstName:i,lastName:e}),void 0!==s&&{email:s}),void 0!==u&&{mobile:u}),void 0!==o&&{externalId:o}),void 0!==a&&{customData:a}),{attempts:0}),[4,this.savePendingMerge(c)];case 1:return f.sent(),this.logger.debug("Pending merge request persisted to storage",{visitorId:t}),[2]}})})},t.prototype.getPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=so("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=i.sent())?[2,JSON.parse(n)]:[2,null];case 2:return r=i.sent(),this.logger.warn("Failed to read pending merge from storage",r),[2,null];case 3:return[2]}})})},t.prototype.savePendingMerge=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.set(n,JSON.stringify(t))];case 1:return i.sent(),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to save pending merge to storage",r),[3,3];case 3:return[2]}})})},t.prototype.clearPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:this.cancelMergeRetryTimer(),r.label=1;case 1:return r.trys.push([1,3,,4]),t=so("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 2:return r.sent(),this.logger.debug("Pending merge cleared from storage"),[3,4];case 3:return n=r.sent(),this.logger.warn("Failed to clear pending merge from storage",n),[3,4];case 4:return[2]}})})},t.prototype.isMerged=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,null!=r.sent()];case 2:return n=r.sent(),this.logger.warn("Failed to check merge status",n),[2,!1];case 3:return[2]}})})},t.prototype.getMergedUserId=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,null!=(n=i.sent())?n:null];case 2:return r=i.sent(),this.logger.warn("Failed to get merge status",r),[2,null];case 3:return[2]}})})},t.prototype.clearMergedUserId=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 1:return r.sent(),this.logger.info("Merge status cleared from storage"),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to clear merge status",n),[3,3];case 3:return[2]}})})},t.prototype.markAsMerged=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),this.logger.debug("Visitor marked as merged",{visitorId:t,key:n}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store merge status",r),[3,3];case 3:return[2]}})})},t.prototype.getVisitorId=function(){return this.visitorId},t.prototype.getVisitorRefId=function(){return this.visitorRefId},t.prototype.hasVisitorId=function(){return null!==this.visitorId},t.prototype.storeVisitorId=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("VISITOR_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),this.logger.debug("Visitor ID stored to storage",{visitorId:t,key:n}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store visitor ID",r),[3,3];case 3:return[2]}})})},t.prototype.storeExpiredAt=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.expiredAt=t,n=so("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),this.logger.debug("Visitor expiredAt stored to storage",{expiredAt:t}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store visitor expiredAt",r),[3,3];case 3:return[2]}})})},t.prototype.isVisitorExpired=function(){if(!this.expiredAt)return!0;try{return new Date(this.expiredAt).getTime()<=Date.now()}catch(t){return this.logger.warn("Invalid expiredAt format, treating as expired",{expiredAt:this.expiredAt}),!0}},t.prototype.getOrGenerateVisitorRefId=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:if(this.visitorRefId)return[2,this.visitorRefId];t=Bv(),this.visitorRefId=t,i.label=1;case 1:return i.trys.push([1,3,,4]),n=so("VISITOR_REF_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 2:return i.sent(),this.logger.debug("visitorRefId generated and stored",{visitorRefId:t}),[3,4];case 3:return r=i.sent(),this.logger.warn("Failed to store visitorRefId",r),[3,4];case 4:return[2,t]}})})},t.prototype.restoreVisitorId=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),t=so("VISITOR_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=o.sent())&&(this.visitorId=n,this.logger.info(Ko,{visitorId:n})),r=so("VISITOR_REF_ID",this.brandId,this.applicationId),[4,this.storageManager.get(r)];case 2:return(i=o.sent())&&(this.visitorRefId=i),e=so("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(e)];case 3:return(s=o.sent())&&(this.expiredAt=s),[3,5];case 4:return u=o.sent(),this.logger.warn("Failed to restore visitor ID from storage",u),this.visitorId=null,[3,5];case 5:return[2]}})})},t.prototype.clearVisitorId=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),t=so("VISITOR_ID",this.brandId,this.applicationId),n=so("VISITOR_REF_ID",this.brandId,this.applicationId),r=so("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 1:return e.sent(),[4,this.storageManager.remove(n)];case 2:return e.sent(),[4,this.storageManager.remove(r)];case 3:return e.sent(),this.visitorId=null,this.visitorRefId=null,this.expiredAt=null,this.logger.info("Visitor ID cleared from storage"),[3,5];case 4:return i=e.sent(),this.logger.warn("Failed to clear visitor ID",i),this.visitorId=null,this.visitorRefId=null,this.expiredAt=null,[3,5];case 5:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.logger.info("Destroying AnonymousVisitorManager"),this.cancelMergeRetryTimer(),this.initialized=!1,this.logger.info("AnonymousVisitorManager destroyed successfully"),[2]})})},t}(),Ml={};function xl(){return"undefined"!=typeof window&&window.firebase?window.firebase:null}function Ul(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){return(t=xl())?[2,t]:[2,import("firebase/app")]})})}function Vl(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){return(t=xl())&&t.messaging?[2,t]:[2,import("firebase/messaging")]})})}function jl(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){return(t=xl())&&t.remoteConfig?[2,t]:[2,import("firebase/remote-config")]})})}!function(){if(Fl)return Ml;Fl=1;var t=Ti(),n=ju().find,r=Qi(),i="find",e=!0;i in[]&&Array(1)[i](function(){e=!1}),t({target:"Array",proto:!0,forced:e},{find:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),r(i)}();var Ll=function(){function t(t,n,r,i,e,s,u){this.isInitialized=!1,this.firebaseApp=null,this.messaging=null,this.remoteConfig=null,this.remoteConfigGetValue=null,this.remoteConfigGetAll=null,this.currentToken=null,this.swRegistration=null,this.config=t,this.logger=n,this.vapidKey=r,this.serviceWorkerPath=i||ro,this.onTokenReceivedCallback=e,this.m=s,this.onMessageReceivedCallback=u}return t.prototype.checkFirebaseAvailability=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Ul()];case 1:return t.sent(),this.logger.info("Firebase available"),[2,!0];case 2:return t.sent(),this.logger.warn("Firebase not available - notifications will not work"),[2,!1];case 3:return[2]}})})},t.prototype.initialize=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:if(this.isInitialized)return this.logger.warn("Firebase already initialized"),[2,!0];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,this.checkFirebaseAvailability()];case 2:return n.sent()?[4,this.initializeFirebaseApp()]:[2,!1];case 3:return n.sent()?this.messaging?(this.isInitialized=!0,this.logger.info(ea),[2,!0]):(this.logger.error("Failed to initialize Firebase Messaging"),[2,!1]):[2,!1];case 4:return t=n.sent(),this.logger.error(sa,t),[2,!1];case 5:return[2]}})})},t.prototype.initializeFirebaseApp=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a;return Gu(this,function(c){switch(c.label){case 0:return(t="undefined"!=typeof window?window.firebase:null)?(this.logger.info("Initializing Firebase in compat mode"),(o=null===(a=t.apps)||void 0===a?void 0:a.find(function(t){return t.name===io}))?(this.logger.info("Using existing Firebase app"),this.firebaseApp=o):(this.logger.info("Creating new Firebase app"),this.firebaseApp=t.initializeApp(this.config,io)),this.messaging=this.firebaseApp.messaging?this.firebaseApp.messaging():null,[3,5]):[3,1];case 1:return this.logger.info("Initializing Firebase in modular mode"),[4,Ul()];case 2:return n=c.sent(),[4,Vl()];case 3:return r=c.sent(),i=n.initializeApp,e=n.getApps,s=r.getMessaging,[4,(0,r.isSupported)()];case 4:if(!c.sent())return this.logger.warn("Firebase Messaging not supported in this browser"),[2,!1];u=e(),(o=u.find(function(t){return t.name===io}))?(this.logger.info("Using existing Firebase app"),this.firebaseApp=o):(this.logger.info("Creating new Firebase app"),this.firebaseApp=i(this.config,io)),this.messaging=s(this.firebaseApp),c.label=5;case 5:return[2,!0]}})})},t.prototype.ensureServiceWorkerRegistered=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:return this.swRegistration?[2,this.swRegistration]:this.isInitialized&&this.messaging?(t=this,[4,this.registerServiceWorker()]):[2,null];case 1:return t.swRegistration=n.sent(),[2,this.swRegistration]}})})},t.prototype.registerServiceWorker=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:if(!("serviceWorker"in navigator))return this.logger.warn("Service Worker not supported"),[2,null];i.label=1;case 1:return i.trys.push([1,7,,8]),[4,navigator.serviceWorker.getRegistration(this.serviceWorkerPath)];case 2:return(t=i.sent())?(this.logger.info("Service worker already registered",{scope:t.scope}),[4,this.ensureServiceWorkerActive(t)]):[3,4];case 3:return i.sent(),[2,t];case 4:return this.logger.info("Registering service worker",{path:this.serviceWorkerPath}),[4,navigator.serviceWorker.register(this.serviceWorkerPath)];case 5:return n=i.sent(),this.logger.info(ca,{scope:n.scope}),[4,this.ensureServiceWorkerActive(n)];case 6:return i.sent(),[2,n];case 7:return r=i.sent(),this.logger.error(fa,r),[2,null];case 8:return[2]}})})},t.prototype.ensureServiceWorkerActive=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){return t.active?(this.logger.debug("Service worker is already active"),[2]):(n=t.installing||t.waiting)?(this.logger.info("Waiting for service worker to activate...",{state:n.state}),[2,new Promise(function(t,i){if("activated"!==n.state){var e=function(){"activated"===n.state?(n.removeEventListener("statechange",e),r.logger.info("Service worker activated"),t()):"redundant"===n.state&&(n.removeEventListener("statechange",e),i(new Error("Service worker became redundant")))};n.addEventListener("statechange",e)}else t()})]):(this.logger.warn("No service worker found in registration"),[2])})})},t.prototype.requestToken=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:if(!this.isInitialized||!this.messaging)return this.logger.error("FirebaseManager not initialized"),[2,null];e.label=1;case 1:return e.trys.push([1,5,,6]),(n=this.swRegistration)?[3,3]:[4,this.registerServiceWorker()];case 2:n=e.sent(),e.label=3;case 3:return(t=n)?(this.swRegistration=t,[4,this.fetchFCMToken(t)]):(this.logger.warn("Service worker registration required for FCM"),[2,null]);case 4:return(r=e.sent())?(this.currentToken=r,this.logger.info(ua,{token:r}),this.onTokenReceivedCallback&&this.onTokenReceivedCallback(r),[2,r]):(this.logger.warn("No FCM token received - permission may be denied"),[2,null]);case 5:return i=e.sent(),this.logger.error(aa,i),[2,null];case 6:return[2]}})})},t.prototype.fetchFCMToken=function(t){return Bu(this,void 0,void 0,function(){var n,r,i;return Gu(this,function(e){switch(e.label){case 0:return("undefined"!=typeof window?window.firebase:null)?(this.logger.info("Getting token using compat mode"),i={serviceWorkerRegistration:t},this.vapidKey&&(i.vapidKey=this.vapidKey),[2,this.messaging.getToken(i)]):[3,1];case 1:return[4,Vl()];case 2:return n=e.sent(),r=n.getToken,i={serviceWorkerRegistration:t},this.vapidKey&&(i.vapidKey=this.vapidKey),[2,r(this.messaging,i)]}})})},t.prototype.setupMessageListener=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i=this;return Gu(this,function(e){switch(e.label){case 0:if(!this.isInitialized||!this.messaging)return this.logger.error("FirebaseManager not initialized"),[2];e.label=1;case 1:return e.trys.push([1,5,,6]),("undefined"!=typeof window?window.firebase:null)?(this.logger.info("Setting up message listener (compat mode)"),this.messaging.onMessage(function(t){i.handleMessage(t)}),[3,4]):[3,2];case 2:return[4,Vl()];case 3:t=e.sent(),n=t.onMessage,this.logger.info("Setting up message listener (modular mode)"),n(this.messaging,function(t){i.handleMessage(t)}),e.label=4;case 4:return this.logger.info("Message listener setup successfully"),[3,6];case 5:return r=e.sent(),this.logger.error("Failed to setup message listener",r),[3,6];case 6:return[2]}})})},t.prototype.handleMessage=function(t){this.logger.info("FCM message received",t),this.onMessageReceivedCallback&&this.onMessageReceivedCallback(t)},t.prototype.handleTokenRefresh=function(t){this.logger.info("FCM token refreshed",{token:t}),this.m&&this.m(t)},t.prototype.getCurrentToken=function(){return this.currentToken},t.prototype.isFirebaseInitialized=function(){return this.isInitialized},t.prototype.initializeRemoteConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:if(!this.isInitialized||!this.firebaseApp)return this.logger.warn("Firebase not initialized, cannot setup Remote Config"),[2];o.label=1;case 1:return o.trys.push([1,6,,7]),(t="undefined"!=typeof window?window.firebase:null)&&t.remoteConfig?(this.remoteConfig=t.remoteConfig(this.firebaseApp),this.remoteConfig.settings.minimumFetchIntervalMillis=36e5,this.logger.info("Remote Config initialized (compat mode)"),[3,5]):[3,2];case 2:return o.trys.push([2,4,,5]),[4,jl()];case 3:return n=o.sent(),r=n.getRemoteConfig,i=n.getValue,e=n.getAll,this.remoteConfig=r(this.firebaseApp),this.remoteConfig.settings.minimumFetchIntervalMillis=36e5,this.remoteConfigGetValue=i,this.remoteConfigGetAll=e,this.logger.info("Remote Config initialized (modular mode)"),[3,5];case 4:return s=o.sent(),this.logger.warn("Remote Config module not available:",s),[2];case 5:return[3,7];case 6:return u=o.sent(),this.logger.error("Failed to initialize Remote Config:",u),[3,7];case 7:return[2]}})})},t.prototype.getRemoteConfigString=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),"";try{var n="undefined"!=typeof window?window.firebase:null;return n&&n.remoteConfig?this.remoteConfig.getString(t):this.remoteConfigGetValue?this.remoteConfigGetValue(this.remoteConfig,t).asString():(this.logger.warn("Remote Config getValue function not available"),"")}catch(n){return this.logger.error('Failed to get Remote Config value for key "'.concat(t,'":'),n),""}},t.prototype.getRemoteConfigBoolean=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),!1;try{var n="undefined"!=typeof window?window.firebase:null;return n&&n.remoteConfig?this.remoteConfig.getBoolean(t):this.remoteConfig.getBoolean(t)||!1}catch(n){return this.logger.error('Failed to get Remote Config boolean for key "'.concat(t,'":'),n),!1}},t.prototype.getRemoteConfigNumber=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),0;try{var n="undefined"!=typeof window?window.firebase:null;return n&&n.remoteConfig?this.remoteConfig.getNumber(t):this.remoteConfig.getNumber(t)||0}catch(n){return this.logger.error('Failed to get Remote Config number for key "'.concat(t,'":'),n),0}},t.prototype.getAllRemoteConfigValues=function(){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),{};try{var t="undefined"!=typeof window?window.firebase:null;if(t&&t.remoteConfig){var n=this.remoteConfig.getAll(),r={};return Object.keys(n).forEach(function(t){r[t]=n[t].asString()}),r}if(this.remoteConfigGetAll){var i=this.remoteConfigGetAll(this.remoteConfig),e={};return Object.keys(i).forEach(function(t){e[t]=i[t].asString()}),e}return this.logger.warn("Remote Config getAll function not available"),{}}catch(t){return this.logger.error("Failed to get all Remote Config values:",t),{}}},t.prototype.getRemoteConfigJSON=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),null;try{var n=this.getRemoteConfigString(t);if(!n)return this.logger.warn('Remote Config key "'.concat(t,'" is empty')),null;var r=JSON.parse(n);return this.logger.info('Remote Config JSON parsed for key "'.concat(t,'"'),r),r}catch(n){return this.logger.error('Failed to parse Remote Config JSON for key "'.concat(t,'":'),n),null}},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),this.firebaseApp?("undefined"!=typeof window?window.firebase:null)?[4,this.firebaseApp.delete()]:[3,2]:[3,5];case 1:return r.sent(),[3,5];case 2:return[4,Ul()];case 3:return t=r.sent(),[4,(0,t.deleteApp)(this.firebaseApp)];case 4:r.sent(),r.label=5;case 5:return this.isInitialized=!1,this.firebaseApp=null,this.messaging=null,this.currentToken=null,this.swRegistration=null,this.logger.info("FirebaseManager destroyed successfully"),[3,7];case 6:return n=r.sent(),this.logger.error("Failed to destroy FirebaseManager",n),[3,7];case 7:return[2]}})})},t}(),zl=function(){function t(t,n,r,i,e){this.firebaseManager=null,this.tokenUpdateCallback=null,this.config=t,this.logger=n,this.storageManager=r,this.brandId=i,this.applicationId=e,this.state={isNotificationEnabled:!1,firebaseInitialized:!1,permissionStatus:"default"}}return t.prototype.isNotificationSupported=function(){return"undefined"!=typeof window&&"undefined"!=typeof Notification&&"undefined"!=typeof navigator&&"serviceWorker"in navigator},t.prototype.getPermissionStatus=function(){return this.isNotificationSupported()?Notification.permission:"denied"},t.prototype.shouldInitializeNotifications=function(){return!1===this.config.enableNotifications?(this.logger.info("Notifications disabled via config"),!1):this.isNotificationSupported()?!!this.config.firebaseConfig||(this.logger.warn("Firebase config not provided - notifications disabled"),!1):(this.logger.warn("Notifications not supported in this browser"),!1)},t.prototype.restoreState=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e;return Gu(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t=so("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=s.sent())&&(r=JSON.parse(n),i=this.getPermissionStatus(),this.state=zu(zu(zu({},this.state),r),{permissionStatus:i}),this.logger.info("Notification state restored from storage",{storedPermission:r.permissionStatus,currentPermission:i,hasToken:!!r.fcmToken})),[3,3];case 2:return e=s.sent(),this.logger.warn("Failed to restore notification state",e),[3,3];case 3:return[2]}})})},t.prototype.saveState=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.set(t,JSON.stringify(this.state))];case 1:return r.sent(),this.logger.debug("Notification state saved to storage",this.state),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to save notification state",n),[3,3];case 3:return[2]}})})},t.prototype.init=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,15,,17]),[4,this.restoreState()];case 1:return r.sent(),this.shouldInitializeNotifications()?[3,3]:(this.logger.info(ia),this.state.isNotificationEnabled=!1,[4,this.saveState()]);case 2:return r.sent(),[2,this.state];case 3:return t=this.getPermissionStatus(),this.state.permissionStatus=t,this.logger.info("Current notification permission",{permission:t,hasStoredToken:!!this.state.fcmToken,isNotificationEnabled:this.state.isNotificationEnabled}),"denied"!==t?[3,5]:(this.logger.warn(ta),this.state.isNotificationEnabled=!1,delete this.state.fcmToken,[4,this.saveState()]);case 4:return r.sent(),[2,this.state];case 5:return"default"!==t?[3,7]:(this.logger.info("Permission not yet granted - notifications will not be shown until user grants permission"),this.state.isNotificationEnabled=!1,[4,this.saveState()]);case 6:return r.sent(),[2,this.state];case 7:return"granted"!==t?[3,14]:this.state.fcmToken?(this.logger.info("Using existing FCM token from storage",{token:this.state.fcmToken.substring(0,20)+"..."}),this.state.isNotificationEnabled=!0,this.firebaseManager?[3,9]:(this.logger.info("Initializing Firebase for message listening"),[4,this.initializeFirebaseForMessaging()])):[3,11];case 8:r.sent(),r.label=9;case 9:return[4,this.saveState()];case 10:return r.sent(),[2,this.state];case 11:return this.logger.info("Permission granted - initializing Firebase to generate FCM token"),[4,this.initializeFirebase()];case 12:return r.sent(),[4,this.saveState()];case 13:r.sent(),r.label=14;case 14:return this.logger.info(na,this.state),[2,this.state];case 15:return n=r.sent(),this.logger.error(ra,n),this.state.isNotificationEnabled=!1,[4,this.saveState()];case 16:return r.sent(),[2,this.state];case 17:return[2]}})})},t.prototype.initializeFirebaseForMessaging=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:if(!this.config.firebaseConfig)throw new Error("Firebase config is required");n.label=1;case 1:return n.trys.push([1,5,,6]),this.firebaseManager=new Ll(this.config.firebaseConfig,this.logger,this.config.vapidKey,this.config.serviceWorkerPath,this.config.onTokenReceived,this.config.onTokenRefresh,this.config.onMessageReceived),[4,this.firebaseManager.initialize()];case 2:if(!n.sent())throw new Error("Firebase initialization failed");return this.state.firebaseInitialized=!0,[4,this.firebaseManager.ensureServiceWorkerRegistered()];case 3:return n.sent(),[4,this.firebaseManager.setupMessageListener()];case 4:return n.sent(),this.initializeRemoteConfigAsync(),this.logger.info("Firebase initialized for message listening"),[3,6];case 5:throw t=n.sent(),this.logger.error("Failed to initialize Firebase for messaging",t),t;case 6:return[2]}})})},t.prototype.initializeFirebase=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:if(!this.config.firebaseConfig)throw new Error("Firebase config is required");r.label=1;case 1:return r.trys.push([1,7,,8]),this.firebaseManager=new Ll(this.config.firebaseConfig,this.logger,this.config.vapidKey,this.config.serviceWorkerPath,this.config.onTokenReceived,this.config.onTokenRefresh,this.config.onMessageReceived),[4,this.firebaseManager.initialize()];case 2:if(!r.sent())throw new Error("Firebase initialization failed");return this.state.firebaseInitialized=!0,this.state.isNotificationEnabled=!0,[4,this.firebaseManager.requestToken()];case 3:return(t=r.sent())?(this.state.fcmToken=t,[4,this.storeFCMToken(t)]):[3,5];case 4:r.sent(),r.label=5;case 5:return[4,this.firebaseManager.setupMessageListener()];case 6:return r.sent(),this.initializeRemoteConfigAsync(),this.logger.info("Firebase initialized and FCM token retrieved",{hasToken:!!t}),[3,8];case 7:throw n=r.sent(),this.logger.error("Failed to initialize Firebase",n),this.state.firebaseInitialized=!1,this.state.isNotificationEnabled=!1,n;case 8:return[2]}})})},t.prototype.initializeRemoteConfigAsync=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),this.firebaseManager?[4,this.firebaseManager.initializeRemoteConfig()]:[3,2];case 1:n.sent(),this.logger.info("✅ Remote Config initialized and fetched successfully"),n.label=2;case 2:return[3,4];case 3:return t=n.sent(),this.logger.warn("Remote Config initialization failed (non-critical):",t),[3,4];case 4:return[2]}})})},t.prototype.storeFCMToken=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),n=so("FCM_TOKEN",this.brandId,this.applicationId),r=so("FCM_TOKEN_CREATED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(n)];case 1:return i=o.sent(),e=!i||i!==t,[4,this.storageManager.set(n,t)];case 2:return o.sent(),e?(s=(new Date).toISOString(),[4,this.storageManager.set(r,s)]):[3,4];case 3:return o.sent(),this.logger.debug("FCM token and creation date stored successfully",{createdAt:s}),[3,5];case 4:this.logger.debug("FCM token stored (creation date unchanged)"),o.label=5;case 5:return this.tokenUpdateCallback&&(this.logger.info("Notifying token update callback",{isNewToken:e,tokenPreview:t.substring(0,20)+"..."}),this.tokenUpdateCallback(t,e)),[3,7];case 6:return u=o.sent(),this.logger.warn("Failed to store FCM token",u),[3,7];case 7:return[2]}})})},t.prototype.setTokenUpdateCallback=function(t){this.tokenUpdateCallback=t,this.logger.debug("Token update callback registered")},t.prototype.clearTokenUpdateCallback=function(){this.tokenUpdateCallback=null,this.logger.debug("Token update callback cleared")},t.prototype.getState=function(){return zu({},this.state)},t.prototype.getFCMToken=function(){return this.state.fcmToken||null},t.prototype.getTokenCreationDate=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("FCM_TOKEN_CREATED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,r.sent()||null];case 2:return n=r.sent(),this.logger.warn("Failed to retrieve FCM token creation date",n),[2,null];case 3:return[2]}})})},t.prototype.isEnabled=function(){return this.state.isNotificationEnabled},t.prototype.getFirebaseManager=function(){return this.firebaseManager},t.prototype.refreshToken=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:if(!this.firebaseManager||!this.state.isNotificationEnabled)return this.logger.warn("Cannot refresh token - notifications not enabled"),[2,null];r.label=1;case 1:return r.trys.push([1,6,,7]),[4,this.firebaseManager.requestToken()];case 2:return(t=r.sent())?(this.state.fcmToken=t,[4,this.storeFCMToken(t)]):[3,5];case 3:return r.sent(),[4,this.saveState()];case 4:r.sent(),this.logger.info(oa,{token:t}),r.label=5;case 5:return[2,t];case 6:return n=r.sent(),this.logger.error("Failed to refresh FCM token",n),[2,null];case 7:return[2]}})})},t.prototype.clearToken=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),this.logger.info("Clearing notification state (permission revoked)"),t=this.state.fcmToken,this.state.isNotificationEnabled=!1,this.state.firebaseInitialized=!1,this.firebaseManager?[4,this.firebaseManager.destroy()]:[3,2];case 1:r.sent(),this.firebaseManager=null,r.label=2;case 2:return[4,this.saveState()];case 3:return r.sent(),this.tokenUpdateCallback&&t&&(this.logger.info("Notifying permission revoked to sync push_opted:false with backend"),this.tokenUpdateCallback(t,!0)),this.logger.info("Notification state cleared"),[3,5];case 4:throw n=r.sent(),this.logger.error("Failed to clear notification state",n),n;case 5:return[2]}})})},t.prototype.hasPermissionChanged=function(){return this.getPermissionStatus()!==this.state.permissionStatus},t.prototype.handlePermissionChange=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return t=this.getPermissionStatus(),n=this.state.permissionStatus,this.logger.info("Permission status changed",{from:n,to:t}),this.state.permissionStatus=t,"denied"!==t&&"default"!==t?[3,5]:"granted"!==n?[3,2]:(this.logger.warn("Permission revoked - clearing FCM token"),[4,this.clearToken()]);case 1:return r.sent(),[3,4];case 2:return this.state.isNotificationEnabled=!1,[4,this.saveState()];case 3:r.sent(),r.label=4;case 4:return[3,8];case 5:return"granted"!==t||"granted"===n?[3,8]:(this.logger.info("Permission granted - initializing Firebase"),[4,this.initializeFirebase()]);case 6:return r.sent(),[4,this.saveState()];case 7:r.sent(),r.label=8;case 8:return[2,this.state]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),this.firebaseManager?[4,this.firebaseManager.destroy()]:[3,2];case 1:r.sent(),this.firebaseManager=null,r.label=2;case 2:return t=so("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 3:return r.sent(),this.logger.info("NotificationManager destroyed successfully"),[3,5];case 4:return n=r.sent(),this.logger.error("Failed to destroy NotificationManager",n),[3,5];case 5:return[2]}})})},t}(),Bl=function(){function t(t,n,r,i,e){this.currentSession=null,this.sessionNumber=0,this.storageManager=t,this.logger=n,this.brandId=r,this.applicationId=i;var s=to/6e4;this.inactivityTimeoutMs=60*(e||s)*1e3,this.logger.info("SessionManager configured with timeout:",{timeoutMinutes:e||s,timeoutMs:this.inactivityTimeoutMs,source:e?"Remote Config":"Default"})}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Initializing SessionManager"),[4,this.restoreSessionNumber()];case 1:return t.sent(),[4,this.restoreSession()];case 2:return t.sent(),this.logger.info("SessionManager initialized successfully"),[2]}})})},t.prototype.getOrCreateSession=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return t=Date.now(),this.currentSession?(n=t-this.currentSession.lastEventTime)<this.inactivityTimeoutMs?(this.currentSession.lastEventTime=t,[4,this.persistSession()]):[3,2]:[3,3];case 1:return r.sent(),this.logger.debug(Oo,{sessionId:this.currentSession.sessionId,inactivityDuration:n}),[2,this.currentSession.sessionId];case 2:this.logger.info(Co,{sessionId:this.currentSession.sessionId,inactivityDuration:n,timeoutMs:this.inactivityTimeoutMs}),r.label=3;case 3:return[2,this.startNewSession()]}})})},t.prototype.getSessionStartTime=function(){var t;return(null===(t=this.currentSession)||void 0===t?void 0:t.sessionStartTime)||null},t.prototype.getCurrentSessionId=function(){var t,n;return null!==(n=null===(t=this.currentSession)||void 0===t?void 0:t.sessionId)&&void 0!==n?n:null},t.prototype.getSessionNumber=function(){return this.sessionNumber},t.prototype.resetSessionNumber=function(){return Bu(this,arguments,void 0,function(t){return void 0===t&&(t=0),Gu(this,function(n){switch(n.label){case 0:return this.sessionNumber=t,[4,this.persistSessionNumber()];case 1:return n.sent(),this.logger.info("Session number reset",{sessionNumber:this.sessionNumber}),[2]}})})},t.prototype.endSession=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return this.currentSession?(this.logger.info(Do,{sessionId:this.currentSession.sessionId,reason:t}),this.currentSession=null,[4,this.clearSessionStorage()]):[3,3];case 1:return n.sent(),[4,this.resetSessionNumber(0)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.logger.info("Destroying SessionManager (session persists in storage)"),this.currentSession=null,[2]})})},t.prototype.startNewSession=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return t=Date.now(),n=Bv(),this.currentSession={sessionId:n,sessionStartTime:t,lastEventTime:t},this.sessionNumber+=1,[4,this.persistSession()];case 1:return r.sent(),[4,this.persistSessionNumber()];case 2:return r.sent(),this.logger.info(_o,{sessionId:n,sessionStartTime:t,sessionNumber:this.sessionNumber}),[2,n]}})})},t.prototype.restoreSession=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a;return Gu(this,function(c){switch(c.label){case 0:return c.trys.push([0,7,,9]),t=so("SESSION_ID",this.brandId,this.applicationId),n=so("SESSION_START_TIME",this.brandId,this.applicationId),r=so("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return i=c.sent(),[4,this.storageManager.get(n)];case 2:return e=c.sent(),[4,this.storageManager.get(r)];case 3:return s=c.sent(),i&&e&&s?(u=Date.now(),(o=u-parseInt(s))<this.inactivityTimeoutMs?(this.currentSession={sessionId:i,sessionStartTime:parseInt(e),lastEventTime:parseInt(s)},this.logger.info(No,{sessionId:i,timeSinceLastEvent:o}),[3,6]):[3,4]):[3,6];case 4:return this.logger.debug("Stored session expired, will create new session",{timeSinceLastEvent:o,timeoutMs:this.inactivityTimeoutMs}),[4,this.clearSessionStorage()];case 5:c.sent(),c.label=6;case 6:return[3,9];case 7:return a=c.sent(),this.logger.warn("Failed to restore session from storage",a),[4,this.clearSessionStorage()];case 8:return c.sent(),[3,9];case 9:return[2]}})})},t.prototype.persistSession=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:if(!this.currentSession)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),t=so("SESSION_ID",this.brandId,this.applicationId),n=so("SESSION_START_TIME",this.brandId,this.applicationId),r=so("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,Promise.all([this.storageManager.set(t,this.currentSession.sessionId),this.storageManager.set(n,this.currentSession.sessionStartTime.toString()),this.storageManager.set(r,this.currentSession.lastEventTime.toString())])];case 2:return e.sent(),[3,4];case 3:return i=e.sent(),this.logger.warn("Failed to persist session to storage",i),[3,4];case 4:return[2]}})})},t.prototype.clearSessionStorage=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=so("SESSION_ID",this.brandId,this.applicationId),n=so("SESSION_START_TIME",this.brandId,this.applicationId),r=so("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,Promise.all([this.storageManager.remove(t),this.storageManager.remove(n),this.storageManager.remove(r)])];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.warn("Failed to clear session storage",i),[3,3];case 3:return[2]}})})},t.prototype.restoreSessionNumber=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=so("SESSION_NUMBER",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=i.sent())&&(this.sessionNumber=parseInt(n,10)||0,this.logger.debug("Session number restored",{sessionNumber:this.sessionNumber})),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to restore session number",r),[3,3];case 3:return[2]}})})},t.prototype.persistSessionNumber=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("SESSION_NUMBER",this.brandId,this.applicationId),[4,this.storageManager.set(t,this.sessionNumber.toString())];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to persist session number",n),[3,3];case 3:return[2]}})})},t}();return function(){function t(t){this.userContextSet=!1,this.initialized=!1,this.initializationPromise=null,this.visitorTrackingEnabled=!1,this.visitorId=null,this.currentUserIdentifierType=null,this.notificationManager=null,this.permissionChangeCleanup=null,this.dlrMessageCleanup=null,this.lastAuthenticatedUser=null,this.lastUserAttributes=null,this.sdkDisabled=!1,this.userIdentified=!1,this.userOperationChain=Promise.resolve(),this.config=t,this.logger=new Cl(!1),this.validateRequiredConfig(t),this.logger.info("🔧 SDK initializing in Remote Config bootstrap mode"),this.logger.info("Will fetch configuration from Remote Config key:",t.remoteConfigKey)}return t.initialize=function(n){return t.p?(new Cl(!0).warn("WebSDK is already initialized. Returning existing instance."),t.p):(t.p=new t(n),t.p.init(),t.p)},t.getInstance=function(){return t.p},t.isInitialized=function(){return null!==t.p},t.requireInstance=function(){if(!t.p)throw new Error("WebSDK is not initialized. Call WebSDK.initialize(config) first.");return t.p},t.track=function(n,r){t.requireInstance().track(n,r)},t.pageView=function(n){t.requireInstance().pageView(n)},t.identify=function(n){t.requireInstance().identify(n)},t.getUser=function(){return t.requireInstance().getUser()},t.reset=function(){t.requireInstance().reset()},t.disableSDK=function(){t.requireInstance().disableSDK()},t.enableSDK=function(){t.requireInstance().enableSDK()},t.destroy=function(){if(!t.p)return Promise.resolve();var n=t.p.destroy();return t.p=null,n},t.prototype.shouldEnableLogging=function(t){return!(!t||"NONE"===t)&&["ERROR","WARN","INFO","DEBUG","VERBOSE"].includes(t)},t.prototype.restoreUserContext=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a;return Gu(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),t=so("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.get(t)];case 1:return(n=c.sent())?(r=JSON.parse(n),i=r.cuid,e=r.userIdentifierType,this.currentUserIdentifierType=null!=e?e:null,s=this.config.accountId||"",[4,this.eventTracker.setUserContext(s,i,e)]):[3,3];case 2:c.sent(),this.userContextSet=!0,this.logger.info("User context restored from storage",{cuid:i,accountId:this.config.accountId}),c.label=3;case 3:return u=so("LAST_AUTHENTICATED_USER",this.config.brandId,this.config.applicationId),[4,this.storageManager.get(u)];case 4:return(o=c.sent())&&(this.lastAuthenticatedUser=o,this.logger.info("Last authenticated user restored from storage",{lastAuthenticatedUser:this.lastAuthenticatedUser})),[3,6];case 5:return a=c.sent(),this.logger.warn("Failed to restore user context from storage",a),[3,6];case 6:return[2]}})})},t.prototype.validateAndClearDifferentUserContext=function(t){return Bu(this,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,7]),this.lastAuthenticatedUser&&this.lastAuthenticatedUser!==t?(this.logger.info("Different user detected, ending session and clearing context",{previousCuid:this.lastAuthenticatedUser,newCuid:t}),[4,this.sessionManager.endSession("user_switch")]):[3,3];case 1:return r.sent(),[4,this.clearUserContext()];case 2:r.sent(),this.userContextSet=!1,r.label=3;case 3:return this.lastAuthenticatedUser=t,[4,this.persistLastAuthenticatedUser(t)];case 4:return r.sent(),[3,7];case 5:return n=r.sent(),this.logger.warn("Error validating different user context",n),[4,this.clearUserContext()];case 6:return r.sent(),this.userContextSet=!1,[3,7];case 7:return[2]}})})},t.prototype.persistLastAuthenticatedUser=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("LAST_AUTHENTICATED_USER",this.config.brandId,this.config.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to persist lastAuthenticatedUser",r),[3,3];case 3:return[2]}})})},t.prototype.storeUserContext=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),r=null!=n?n:this.currentUserIdentifierType,i={cuid:t,timestamp:Date.now()},r&&(i.userIdentifierType=r),e=so("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.set(e,JSON.stringify(i))];case 1:return u.sent(),[3,3];case 2:return s=u.sent(),this.logger.warn("Failed to store user context",s),[3,3];case 3:return[2]}})})},t.prototype.init=function(){var t=this;this.initialized?this.logger.warn("WebSDK already initialized"):this.initializationPromise?this.logger.warn("WebSDK initialization already in progress"):this.initializationPromise=this.initializeAsync().catch(function(n){t.logger.error(wo,n),t.initializationPromise=null})},t.prototype.initializeAsync=function(){return Bu(this,void 0,void 0,function(){var t,n,r=this;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,12,,13]),this.logger.info("Initializing WebSDK",{version:Ra,config:this.config}),[4,this.fetchAndApplyRemoteConfig()];case 1:return i.sent(),[4,this.storageManager.init()];case 2:return i.sent(),[4,this.sessionManager.init()];case 3:return i.sent(),this.config.notifications?(t=zu(zu({},this.config.notifications),{firebaseConfig:this.config.firebaseConfig}),this.notificationManager=new zl(t,this.logger,this.storageManager,this.config.brandId,this.config.applicationId),this.setupTokenUpdateCallback(),[4,this.notificationManager.init()]):[3,5];case 4:i.sent(),this.logger.info("Notifications initialized early for FCM token availability"),i.label=5;case 5:return[4,this.initializeVisitorConfig()];case 6:return i.sent(),[4,this.eventTracker.init()];case 7:return i.sent(),this.eventTracker.setSessionInfoCallback(function(){return Bu(r,void 0,void 0,function(){return Gu(this,function(t){return[2,this.sessionManager.getOrCreateSession()]})})}),[4,this.restoreUserContext()];case 8:return i.sent(),[4,this.syncEventTrackerContext()];case 9:return i.sent(),this.initialized=!0,this.notificationManager&&this.setupPermissionChangeDetection(),this.config.notifications?(this.setupDLRServiceWorkerListener(),[4,this.eventTracker.processPendingServiceWorkerDLREvents()]):[3,11];case 10:i.sent(),i.label=11;case 11:return this.logger.info(go),[3,13];case 12:throw n=i.sent(),new Error("".concat(co,": ").concat(n));case 13:return[2]}})})},t.prototype.handleVisibilityChange=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:if("visible"!==document.visibilityState||!this.notificationManager)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),this.notificationManager.hasPermissionChanged()?(t="Notification"in window?Notification.permission:"denied",this.logger.info("Notification permission changed detected",{currentPermission:t}),[4,this.notificationManager.handlePermissionChange()]):[2];case 2:return(n=i.sent())&&this.logger.info("Notification state updated after permission change",n),[3,4];case 3:return r=i.sent(),this.logger.warn("Error handling permission change",r),[3,4];case 4:return[2]}})})},t.prototype.setupPermissionChangeDetection=function(){var t=this;if("undefined"!=typeof document&&"undefined"!=typeof window){var n=function(){return t.handleVisibilityChange()};document.addEventListener("visibilitychange",n),window.addEventListener("focus",n),this.permissionChangeCleanup=function(){document.removeEventListener("visibilitychange",n),window.removeEventListener("focus",n)},this.logger.debug("Permission change detection setup complete")}},t.prototype.setupDLRServiceWorkerListener=function(){var t=this;if("undefined"!=typeof navigator&&"serviceWorker"in navigator){var n=function(n){return Bu(t,void 0,void 0,function(){var t;return Gu(this,function(r){switch(r.label){case 0:if(!n.data||"HYDRA_DLR_EVENTS_PENDING"!==n.data.type)return[3,4];this.logger.info("Received DLR events pending notification from service worker"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.eventTracker.processPendingServiceWorkerDLREvents()];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this.logger.error("Failed to process pending DLR events",t),[3,4];case 4:return[2]}})})};navigator.serviceWorker.addEventListener("message",n),this.dlrMessageCleanup=function(){navigator.serviceWorker.removeEventListener("message",n)},this.logger.debug("DLR service worker message listener setup complete")}},t.prototype.initializeVisitorConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r=this;return Gu(this,function(i){switch(i.label){case 0:return this.logger.info("Initializing visitor configuration"),[4,this.visitorConfigManager.init()];case 1:return i.sent(),t=this,[4,this.visitorConfigManager.isVisitorTrackingEnabled()];case 2:return t.visitorTrackingEnabled=i.sent(),this.visitorTrackingEnabled?(this.logger.info(Bo),[4,this.anonymousVisitorManager.init()]):[3,5];case 3:return i.sent(),[4,this.getOrCreateVisitorId()];case 4:return i.sent(),this.anonymousVisitorManager.retryPendingMerge().catch(function(t){r.logger.warn("Failed to retry pending merge on init",t)}),[3,6];case 5:this.logger.info(zo),i.label=6;case 6:return(n=this.visitorConfigManager.getCachedConfig())&&n.warnings&&n.warnings.length>0&&n.warnings.forEach(function(t){r.logger.warn("Visitor config warning",{code:t.code,message:t.message})}),[2]}})})},t.prototype.syncEventTrackerContext=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return t=null!==(i=null===(r=this.anonymousVisitorManager)||void 0===r?void 0:r.getVisitorRefId())&&void 0!==i?i:null,this.eventTracker.setVisitorTrackingState(this.visitorId,this.visitorTrackingEnabled,t),this.visitorTrackingEnabled?(n=this.config.accountId||"",this.userContextSet?[3,2]:[4,this.eventTracker.setUserContext(n)]):(this.logger.warn("Event tracking disabled: Visitor tracking is off"),[2]);case 1:return e.sent(),this.logger.info("Account context set for visitor tracking"),[3,3];case 2:this.logger.info("User context restored from storage"),e.label=3;case 3:return[2]}})})},t.prototype.getOrCreateVisitorId=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f;return Gu(this,function(h){switch(h.label){case 0:t=[],(n=null===(a=this.notificationManager)||void 0===a?void 0:a.getFCMToken())?(r="granted"===(null===(c=this.notificationManager)||void 0===c?void 0:c.getState().permissionStatus),t.push({type:this.getChannelType(),value:n,primary:!0,verified:!0,subscribed:r}),this.logger.info("Including FCM token in visitor creation",{tokenPreview:n.substring(0,20)+"...",subscribed:r})):this.logger.info("No FCM token available, creating visitor without commChannels"),h.label=1;case 1:return h.trys.push([1,5,,6]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,3];case 2:return s=h.sent(),[3,4];case 3:s=null,h.label=4;case 4:return e=s,i=Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(f=this.notificationManager)||void 0===f?void 0:f.getState().permissionStatus),fcmTokenCreatedAt:e})),this.logger.debug("Extended fields collected",{extendedFields:i}),[3,6];case 5:return u=h.sent(),this.logger.warn("Failed to collect extended fields, proceeding without them",u),i=void 0,[3,6];case 6:return o=this,[4,this.anonymousVisitorManager.getOrCreateVisitorId(t.length>0?t:void 0,i)];case 7:return o.visitorId=h.sent(),this.logger.info("Visitor ID ready",{visitorId:this.visitorId}),[2,this.visitorId]}})})},t.prototype.setupTokenUpdateCallback=function(){var t=this;this.notificationManager&&(this.notificationManager.setTokenUpdateCallback(function(n,r){return Bu(t,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return[4,this.handleTokenUpdate(n,r)];case 1:return t.sent(),[2]}})})}),this.logger.debug("Token update callback configured for backend sync"))},t.prototype.handleTokenUpdate=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:if(!this.visitorId)return this.logger.debug("Skipping token sync - no visitor ID yet (will be included in create)",{isNewToken:n}),[2];if(!n)return this.logger.debug("Skipping token sync - token unchanged"),[2];r="granted"!==(null===(e=this.notificationManager)||void 0===e?void 0:e.getState().permissionStatus),this.logTokenSyncStart(t,r),s.label=1;case 1:return s.trys.push([1,6,,7]),this.userIdentified&&this.lastAuthenticatedUser?[4,this.syncTokenForIdentifiedUser(r)]:[3,3];case 2:return s.sent(),[3,5];case 3:return[4,this.syncTokenForAnonymousUser(t,r)];case 4:s.sent(),s.label=5;case 5:return[3,7];case 6:return i=s.sent(),this.logger.error("Failed to sync FCM token with backend",i),[3,7];case 7:return[2]}})})},t.prototype.logTokenSyncStart=function(t,n){n?this.logger.info("Permission revoked, syncing push_opted:false with backend",{visitorId:this.visitorId}):this.logger.info("FCM token updated, syncing with backend",{visitorId:this.visitorId,tokenPreview:t.substring(0,20)+"..."})},t.prototype.syncTokenForIdentifiedUser=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return this.lastAuthenticatedUser?[4,this.sendUserEventToApi(ga,this.lastAuthenticatedUser,null)]:[2];case 1:return n.sent(),this.logger.info("Token state synced via User Events API (user_update)",{permissionRevoked:t}),[2]}})})},t.prototype.syncTokenForAnonymousUser=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:r=t?[{type:this.getChannelType(),value:t,primary:!0,verified:!0,subscribed:!n}]:[],o.label=1;case 1:return o.trys.push([1,5,,6]),n||!this.notificationManager?[3,3]:[4,this.notificationManager.getTokenCreationDate()];case 2:return s=o.sent(),[3,4];case 3:s=null,o.label=4;case 4:return e=s,i=Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:!n,fcmTokenCreatedAt:e})),[3,6];case 5:return u=o.sent(),this.logger.warn("Failed to collect extended fields for token update",u),i=void 0,[3,6];case 6:return[4,this.anonymousVisitorManager.updateVisitor(r,i)];case 7:return o.sent(),n?this.logger.info("Token synced with subscribed:false (permission revoked)",{visitorId:this.visitorId}):this.logger.info("FCM token synced with backend successfully",{visitorId:this.visitorId}),[2]}})})},t.prototype.getUser=function(){var t,n,r,i,e;if(this.userIdentified)throw new Error("This data is not exposed");var s=null!==(n=null===(t=this.sessionManager)||void 0===t?void 0:t.getCurrentSessionId())&&void 0!==n?n:"",u=null!==(i=null===(r=this.sessionManager)||void 0===r?void 0:r.getSessionNumber())&&void 0!==i?i:0;return{visitorId:null!==(e=this.visitorId)&&void 0!==e?e:"",userId:null,sessionId:s,isIdentified:!1,isAnonymous:!0,profileTier:"anonymous",attributes:null,sessionNumber:u,isFirstSession:1===u,isReturningVisitor:u>1}},t.prototype.setUserContext=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:if(!this.initialized)throw new Error("WebSDK must be initialized before setting user context");return[4,this.validateAndClearDifferentUserContext(t)];case 1:return s.sent(),r=null!==(e=null!=n?n:this.currentUserIdentifierType)&&void 0!==e?e:void 0,i=this.config.accountId||"",[4,this.eventTracker.setUserContext(i,t,r)];case 2:return s.sent(),this.userContextSet=!0,n&&(this.currentUserIdentifierType=n),this.visitorId&&this.logger.info("User identified - transitioning from anonymous to identified tracking",{visitorId:this.visitorId,cuid:t,trackingMode:"identified"}),[4,this.storeUserContext(t,r)];case 3:return s.sent(),this.logger.info("User context set and persisted",{cuid:t,accountId:this.config.accountId}),[2]}})})},t.prototype.clearUserContext=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.remove(t)];case 1:return r.sent(),this.eventTracker&&this.eventTracker.clearUserContext(),this.currentUserIdentifierType=null,this.userContextSet=!1,this.userIdentified=!1,this.logger.info("User context cleared"),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to clear user context",n),this.currentUserIdentifierType=null,this.userContextSet=!1,this.userIdentified=!1,[3,3];case 3:return[2]}})})},t.prototype.track=function(t,n){this.sdkDisabled?this.logger.debug("SDK disabled, dropping track call",{eventName:t}):this.pushEvent(t,n)},t.prototype.pageView=function(t){var n,r;if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping pageView call");else{var i=null!==(n=null==t?void 0:t.url)&&void 0!==n?n:"undefined"!=typeof window?window.location.href:void 0,e=null!==(r=null==t?void 0:t.title)&&void 0!==r?r:"undefined"!=typeof document?document.title:void 0,s=zu(zu(zu(zu({},i&&{url:i}),e&&{title:e}),(null==t?void 0:t.category)&&{category:t.category}),null==t?void 0:t.properties);this.pushEvent("page_view",s)}},t.prototype.pickTraitFields=function(t){var n={},r=t.gender,i=t.birthday,e=t.city,s=t.country,u=t.timezone;return r&&(n.gender=r),i&&(n.birthday=i),e&&(n.city=e),s&&(n.country=s),u&&(n.timezone=u),n},t.prototype.identify=function(t){var n,r;if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping identify call");else{var i=t.identifier,e=t.actionType,s=t.traits,u=void 0===s?{}:s;if(!i||!i.cuid)throw new Error("identifier with a non-empty cuid is required for identify");if(!["email","mobile","externalId"].includes(i.type))throw new Error("Invalid identifier type: ".concat(i.type,". Must be 'email', 'mobile', or 'externalId'."));var o=i.cuid;this.currentUserIdentifierType=i.type;var a=zu(zu(zu(zu({firstName:null!==(n=u.firstName)&&void 0!==n?n:"",lastName:null!==(r=u.lastName)&&void 0!==r?r:""},"email"===i.type&&{email:o}),"mobile"===i.type&&{mobile:o}),"externalId"===i.type&&{externalId:o}),void 0!==u.custom&&{customData:u.custom}),c=this.pickTraitFields(u);a.customData=zu(zu({},c),a.customData),this.userIdentified=!0;var f=i.type;switch(e){case"USER_REGISTER":this.pushUserSignin(o,a,f);break;case"USER_UPDATE":this.pushUserUpdate(o,a,f);break;default:throw this.logger.error("Invalid identify actionType",{actionType:e,cuid:o}),new Error("Invalid identify actionType: ".concat(e,". Must be 'USER_REGISTER' or 'USER_UPDATE'."))}}},t.prototype.trackEvent=function(t){return Bu(this,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:if(!this.initialized)throw new Error("WebSDK must be initialized before tracking events");r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.eventTracker.track(t)];case 2:return r.sent(),[3,4];case 3:throw n=r.sent(),this.logger.error(bo,{event:t,error:n}),n;case 4:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:this.logger.info("Destroying WebSDK instance"),n.label=1;case 1:return n.trys.push([1,16,,17]),this.eventTracker?[4,this.eventTracker.flush()]:[3,4];case 2:return n.sent(),[4,this.eventTracker.destroy()];case 3:n.sent(),n.label=4;case 4:return this.visitorConfigManager?[4,this.visitorConfigManager.destroy()]:[3,6];case 5:n.sent(),n.label=6;case 6:return this.anonymousVisitorManager?[4,this.anonymousVisitorManager.destroy()]:[3,8];case 7:n.sent(),n.label=8;case 8:return this.permissionChangeCleanup&&(this.permissionChangeCleanup(),this.permissionChangeCleanup=null),this.dlrMessageCleanup&&(this.dlrMessageCleanup(),this.dlrMessageCleanup=null),this.notificationManager?(this.notificationManager.clearTokenUpdateCallback(),[4,this.notificationManager.destroy()]):[3,10];case 9:n.sent(),this.notificationManager=null,n.label=10;case 10:return this.sessionManager?[4,this.sessionManager.destroy()]:[3,12];case 11:n.sent(),n.label=12;case 12:return this.storageManager?[4,this.clearUserContext()]:[3,15];case 13:return n.sent(),[4,this.storageManager.destroy()];case 14:n.sent(),n.label=15;case 15:return this.initialized=!1,this.logger.info(mo),[3,17];case 16:throw t=n.sent(),this.logger.error(mo,t),t;case 17:return[2]}})})},t.prototype.validateUserAttributes=function(t){if(!t.email&&!t.mobile&&!t.externalId)throw new Error("At least one of email, mobile, or externalId is required")},t.prototype.attemptVisitorMerge=function(t){try{if(!this.visitorTrackingEnabled||!this.visitorId)return;if(!t.email&&!t.mobile&&!t.externalId)return void this.logger.debug(Zo,{reason:"No email, mobile, or externalId"});this.anonymousVisitorManager.mergeVisitorWithUser(t.firstName,t.lastName,t.email,t.mobile,t.externalId,t.customData),this.logger.info("Visitor merge triggered in background",{visitorId:this.visitorId})}catch(t){this.logger.warn("Visitor merge attempt failed, proceeding with user flow",t)}},t.prototype.sendUserEventToApi=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c,f,h,d,v,l,g,w,m,p;return Gu(this,function(y){switch(y.label){case 0:return i="granted"===(null===(f=this.notificationManager)||void 0===f?void 0:f.getState().permissionStatus),e=null!==(d=null===(h=this.notificationManager)||void 0===h?void 0:h.getFCMToken())&&void 0!==d?d:null,s=i&&!!e,u=e?[{interface_id:e,gateway:ba.WEB}]:[],o=null!==(l=null===(v=this.sessionManager)||void 0===v?void 0:v.getCurrentSessionId())&&void 0!==l?l:"",a=this.apiClient.buildUserEventsRequest(t,zu(zu(zu(zu({cuid:n,push_opted:s,tokens:u},(null==r?void 0:r.firstName)&&{firstName:r.firstName}),(null==r?void 0:r.lastName)&&{lastName:r.lastName}),(null==r?void 0:r.email)&&{email:r.email}),(null==r?void 0:r.mobile)&&{phone:r.mobile}),o),c=null!==(w=null===(g=this.anonymousVisitorManager)||void 0===g?void 0:g.getVisitorRefId())&&void 0!==w?w:void 0,[4,this.apiClient.sendUserEvents(a,null!==(m=this.visitorId)&&void 0!==m?m:void 0,c,n,null!==(p=this.currentUserIdentifierType)&&void 0!==p?p:void 0)];case 1:return y.sent(),this.logger.info("User event sent to User Events API",{eventName:t,cuid:n}),[2]}})})},t.prototype.pushUserSignin=function(t,n,r){var i=this;this.userIdentified=!0,this.queueUserOperation(function(){return Bu(i,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserSigninAsync(t,n,r)];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.error(Fo,{cuid:t,error:i}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserSigninAsync=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,r)];case 2:e.sent(),this.attemptVisitorMerge(n),this.lastUserAttributes=n,e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.sendUserEventToApi(la,t,n)];case 4:return e.sent(),this.logger.info("User signin event tracked",{cuid:t,firstName:n.firstName,lastName:n.lastName,email:n.email}),[3,6];case 5:throw i=e.sent(),this.logger.error(Fo,{cuid:t,error:i}),i;case 6:return[2]}})})},t.prototype.pushUserSignup=function(t,n,r){var i=this;this.userIdentified=!0,this.queueUserOperation(function(){return Bu(i,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserSignupAsync(t,n,r)];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.error(Po,{cuid:t,error:i}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserSignupAsync=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,r)];case 2:e.sent(),this.attemptVisitorMerge(n),this.lastUserAttributes=n,e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.sendUserEventToApi(la,t,n)];case 4:return e.sent(),this.logger.info("User signup event tracked (routed as user_signin)",{cuid:t,firstName:n.firstName,lastName:n.lastName,email:n.email}),[3,6];case 5:throw i=e.sent(),this.logger.error(Po,{cuid:t,error:i}),i;case 6:return[2]}})})},t.prototype.pushUserUpdate=function(t,n,r){var i=this;this.queueUserOperation(function(){return Bu(i,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserUpdateAsync(t,n,r)];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.error(Mo,{cuid:t,error:i}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserUpdateAsync=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,r)];case 2:e.sent(),this.lastUserAttributes=n,e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.sendUserEventToApi(ga,t,null)];case 4:return e.sent(),this.logger.info("User update event tracked",{cuid:t}),[3,6];case 5:throw i=e.sent(),this.logger.error(Mo,{cuid:t,error:i}),i;case 6:return[2]}})})},t.prototype.reset=function(){if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping reset call");else{var t=this.lastAuthenticatedUser;t?this.pushUserSignOut(t):this.logger.warn("reset() called but no authenticated user to sign out")}},t.prototype.pushUserSignOut=function(t){var n=this;this.queueUserOperation(function(){return Bu(n,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.pushUserSignOutAsync(t)];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.logger.error(xo,{cuid:t,error:n}),[3,3];case 3:return[2]}})})})},t.prototype.resetToAnonymousMode=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f,h,d;return Gu(this,function(v){switch(v.label){case 0:if(!this.visitorTrackingEnabled)return this.logger.info("Visitor tracking disabled per latest config, skipping anonymous mode"),this.visitorId=null,this.eventTracker.setVisitorTrackingState(null,!1),[2];v.label=1;case 1:return v.trys.push([1,11,,12]),[4,this.anonymousVisitorManager.clearVisitorId()];case 2:v.sent(),this.logger.info("Visitor ID cleared on user signout"),t=[],(n=null===(f=this.notificationManager)||void 0===f?void 0:f.getFCMToken())&&(r="granted"===(null===(h=this.notificationManager)||void 0===h?void 0:h.getState().permissionStatus),t.push({type:this.getChannelType(),value:n,primary:!0,verified:!0,subscribed:r})),i=void 0,v.label=3;case 3:return v.trys.push([3,7,,8]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,5];case 4:return s=v.sent(),[3,6];case 5:s=null,v.label=6;case 6:return e=s,i=Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(d=this.notificationManager)||void 0===d?void 0:d.getState().permissionStatus),fcmTokenCreatedAt:e})),[3,8];case 7:return u=v.sent(),this.logger.warn("Failed to collect extended fields on signout, proceeding without them",u),i=void 0,[3,8];case 8:return o=this,[4,this.anonymousVisitorManager.getOrCreateVisitorId(t.length>0?t:void 0,i)];case 9:return o.visitorId=v.sent(),[4,this.sessionManager.resetSessionNumber(1)];case 10:return v.sent(),this.logger.info("New anonymous visitor ID generated after signout",{visitorId:this.visitorId,hasFCMToken:!!n}),a=this.anonymousVisitorManager.getVisitorRefId(),this.eventTracker.setVisitorTrackingState(this.visitorId,!0,a),[3,12];case 11:return c=v.sent(),this.logger.warn("Failed to regenerate visitor ID on signout",c),this.visitorId=null,this.eventTracker.setVisitorTrackingState(null,!0),[3,12];case 12:return[2]}})})},t.prototype.pushUserSignOutAsync=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:return[4,this.ensureInitialized()];case 1:return u.sent(),[4,this.setUserContextIfNeeded(t)];case 2:u.sent(),u.label=3;case 3:return u.trys.push([3,5,,6]),[4,this.sendUserEventToApi(wa,t,this.lastUserAttributes)];case 4:return u.sent(),this.logger.info("User signout event tracked",{cuid:t}),[3,6];case 5:return n=u.sent(),this.logger.warn("Failed to track signout event (tracking may be disabled)",{cuid:t,error:n}),[3,6];case 6:return u.trys.push([6,15,,16]),[4,this.anonymousVisitorManager.clearMergedUserId()];case 7:return u.sent(),[4,this.anonymousVisitorManager.clearPendingMerge()];case 8:return u.sent(),[4,this.clearUserContext()];case 9:u.sent(),this.logger.info("User context cleared, returning to anonymous mode (session continues)"),u.label=10;case 10:return u.trys.push([10,12,,13]),[4,this.visitorConfigManager.refreshConfig()];case 11:return r=u.sent(),this.visitorTrackingEnabled=!0===(null===(s=r.data)||void 0===s?void 0:s.visitorTrackingEnabled),this.logger.info("Visitor config refreshed on signout",{visitorTrackingEnabled:this.visitorTrackingEnabled}),[3,13];case 12:return i=u.sent(),this.logger.warn("Failed to refresh visitor config on signout, using existing value",{visitorTrackingEnabled:this.visitorTrackingEnabled,error:i}),[3,13];case 13:return[4,this.resetToAnonymousMode()];case 14:return u.sent(),this.logger.info("SDK remains active for anonymous tracking"),[3,16];case 15:throw e=u.sent(),this.logger.error("Failed to clear user context on signout",e),e;case 16:return[2]}})})},t.prototype.pushEvent=function(t,n){var r=this;this.pushEventAsync(t,n).catch(function(n){r.logger.error(Uo,{eventName:t,error:n})})},t.prototype.pushEventAsync=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:return[4,this.ensureInitialized()];case 1:if(s.sent(),!this.visitorTrackingEnabled)return this.logger.warn("Event tracking skipped: Visitor tracking is disabled",{eventName:t}),[2];if(!this.userContextSet&&!this.visitorId)return this.logger.warn("Event tracking skipped: No visitor ID available and no user context set",{eventName:t}),[2];r=zu({event_name:t},null!=n?n:{}),i={type:"behavioral",name:t,timestamp:Date.now(),data:r},s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.trackEvent(i)];case 3:return s.sent(),this.logger.info("Behavioral event tracked",{eventName:t,attributes:n}),[3,5];case 4:throw e=s.sent(),this.logger.error(Uo,{eventName:t,error:e}),e;case 5:return[2]}})})},t.prototype.disableSDK=function(){this.sdkDisabled?this.logger.warn("SDK is already disabled"):(this.sdkDisabled=!0,this.eventTracker&&this.eventTracker.pause(),this.logger.info("SDK disabled — event tracking stopped"))},t.prototype.enableSDK=function(){var t=this;this.sdkDisabled?(this.sdkDisabled=!1,this.eventTracker&&this.eventTracker.resume().catch(function(n){t.logger.error("Failed to resume event tracker",n)}),this.logger.info("SDK enabled — event tracking resumed")):this.logger.warn("SDK is already enabled")},t.prototype.getChannelType=function(){return this.config.channelType||ba.WEB},t.prototype.applyRemoteConfigValues=function(t){this.config.accountId=t.accountId,this.config.baseURL=t.baseURL,this.config.orgId=t.orgId,this.config.source=t.source||ya.WEBPUSH,this.config.channelType=t.channelType||ba.WEB,this.config.brandId=this.config.brandId||t.brandId,this.config.applicationId=this.config.applicationId||t.applicationId;var n=to/6e4;this.config.sessionTimeoutMinutes=t.sessionTimeoutMinutes||n,this.config.batchSize=t.batchSize||no.BATCH_SIZE,this.config.debugLevel=t.debugLevel||"NONE",this.logger.setEnabled(this.shouldEnableLogging(this.config.debugLevel)),this.logger.info("Session timeout configured:",{timeoutMinutes:this.config.sessionTimeoutMinutes,source:t.sessionTimeoutMinutes?"Remote Config":"Default"}),this.logger.info("Batch size configured:",{batchSize:this.config.batchSize,source:t.batchSize?"Remote Config":"Default"}),this.logger.info("Debug level configured:",{debugLevel:this.config.debugLevel,source:t.debugLevel?"Remote Config":"Default"})},t.prototype.getExtendedFieldsForMerge=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,2];case 1:return n=i.sent(),[3,3];case 2:n=null,i.label=3;case 3:return t=n,[2,Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(r=this.notificationManager)||void 0===r?void 0:r.getState().permissionStatus),fcmTokenCreatedAt:t}))];case 4:return i.sent(),[2,void 0];case 5:return[2]}})})},t.prototype.initializeManagersFromConfig=function(){var t=this;this.storageManager=new Rl(this.logger,this.config.brandId,this.config.applicationId),this.sessionManager=new Bl(this.storageManager,this.logger,this.config.brandId,this.config.applicationId,this.config.sessionTimeoutMinutes),this.apiClient=new Kv({baseUrl:this.config.baseURL||""},this.logger,this.config.accountId||"",this.config.orgId||"",this.config.source||ya.WEBPUSH);var n=this.apiClient;this.eventTracker=new kl(this.config,n,this.storageManager,this.logger);var r=this.config.orgId||"",i=this.config.accountId||"",e=this.config.source||ya.WEBPUSH;this.visitorConfigManager=new Dl(r,n,this.logger,this.storageManager,this.config.brandId,this.config.applicationId),this.anonymousVisitorManager=new Pl(i,r,e,n,this.logger,this.storageManager,zu(zu({},void 0!==this.config.brandId?{brandId:this.config.brandId}:{}),void 0!==this.config.applicationId?{applicationId:this.config.applicationId}:{})),this.anonymousVisitorManager.setMergeDataProviders(function(){var n;return(null===(n=t.notificationManager)||void 0===n?void 0:n.getFCMToken())||null},function(){return t.getChannelType()},function(){return t.getExtendedFieldsForMerge()},function(){var n;return"granted"===(null===(n=t.notificationManager)||void 0===n?void 0:n.getState().permissionStatus)})},t.prototype.fetchAndApplyRemoteConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f,h;return Gu(this,function(d){switch(d.label){case 0:this.logger.info("📡 Fetching configuration from Firebase Remote Config..."),d.label=1;case 1:return d.trys.push([1,5,,6]),[4,Ul()];case 2:return t=d.sent(),[4,jl()];case 3:return n=d.sent(),r=t.initializeApp||t,i=n.getRemoteConfig||n,e=n.fetchAndActivate,s=n.getValue,u=r(this.config.firebaseConfig),(o=i(u)).settings.minimumFetchIntervalMillis=36e5,this.logger.info("🔄 Fetching Remote Config from Firebase..."),[4,e(o)];case 4:if(d.sent()||this.logger.warn("⚠️ Remote Config fetched but not activated (using cached values)"),a=s(o,this.config.remoteConfigKey),!(c=a.asString()))throw new Error('Remote Config key "'.concat(this.config.remoteConfigKey,'" is empty or not found'));f=void 0;try{f=JSON.parse(c)}catch(t){throw new Error("Failed to parse Remote Config JSON: ".concat(t))}return this.logger.info("✅ Remote Config fetched successfully:",f),this.applyRemoteConfigValues(f),this.initializeManagersFromConfig(),this.logger.info("✅ SDK configuration applied from Remote Config"),this.logger.debug("Final SDK config:",this.config),[3,6];case 5:throw h=d.sent(),this.logger.error("❌ Failed to fetch Remote Config:",h),new Error("Remote Config bootstrap failed: ".concat(h));case 6:return[2]}})})},t.prototype.validateRequiredConfig=function(t){var n=[];if(t.firebaseConfig||n.push("firebaseConfig"),t.remoteConfigKey||n.push("remoteConfigKey"),n.length>0)throw new Error("WebSDK initialization failed: Missing required configuration fields: ".concat(n.join(", ")))},t.prototype.ensureInitialized=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:if(!this.initializationPromise)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.initializationPromise];case 2:return n.sent(),[3,4];case 3:throw t=n.sent(),new Error("SDK initialization failed: ".concat(t));case 4:if(!this.initialized)throw new Error("WebSDK must be initialized before tracking events. Call init() first.");return[2]}})})},t.prototype.setUserContextIfNeeded=function(t,n){return Bu(this,void 0,void 0,function(){return Gu(this,function(r){switch(r.label){case 0:return this.userContextSet?[3,2]:[4,this.setUserContext(t,n)];case 1:r.sent(),this.logger.debug("User context set automatically",{cuid:t}),r.label=2;case 2:return[2]}})})},t.prototype.queueUserOperation=function(t){var n=this;this.userOperationChain=this.userOperationChain.then(t).catch(function(t){n.logger.error("User operation failed",t)})},t.p=null,t}()});
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).WebSDK=n()}(this,function(){"use strict";var t="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{},n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),e="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function c(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var n={next:function(){var n=t.shift();return{done:void 0===n,value:n}}};return r&&(n[Symbol.iterator]=function(){return n}),n}function h(t){this.map={},t instanceof h?t.forEach(function(t,n){this.append(n,t)},this):Array.isArray(t)?t.forEach(function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(n){this.append(n,t[n])},this)}function d(t){if(!t.t)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function v(t){return new Promise(function(n,r){t.onload=function(){n(t.result)},t.onerror=function(){r(t.error)}})}function l(t){var n=new FileReader,r=v(n);return n.readAsArrayBuffer(t),r}function g(t){if(t.slice)return t.slice(0);var n=new Uint8Array(t.byteLength);return n.set(new Uint8Array(t)),n.buffer}function w(){return this.bodyUsed=!1,this.i=function(t){var r;this.bodyUsed=this.bodyUsed,this.u=t,t?"string"==typeof t?this.o=t:i&&Blob.prototype.isPrototypeOf(t)?this.h=t:e&&FormData.prototype.isPrototypeOf(t)?this.v=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this.o=t.toString():s&&i&&((r=t)&&DataView.prototype.isPrototypeOf(r))?(this.l=g(t.buffer),this.u=new Blob([this.l])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||o(t))?this.l=g(t):this.o=t=Object.prototype.toString.call(t):(this.t=!0,this.o=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this.h&&this.h.type?this.headers.set("content-type",this.h.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this.h)return Promise.resolve(this.h);if(this.l)return Promise.resolve(new Blob([this.l]));if(this.v)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this.o]))}),this.arrayBuffer=function(){if(this.l){var t=d(this);return t||(ArrayBuffer.isView(this.l)?Promise.resolve(this.l.buffer.slice(this.l.byteOffset,this.l.byteOffset+this.l.byteLength)):Promise.resolve(this.l))}if(i)return this.blob().then(l);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,n,r,i,e,s=d(this);if(s)return s;if(this.h)return t=this.h,n=new FileReader,r=v(n),i=/charset=([A-Za-z0-9_-]+)/.exec(t.type),e=i?i[1]:"utf-8",n.readAsText(t,e),r;if(this.l)return Promise.resolve(function(t){for(var n=new Uint8Array(t),r=new Array(n.length),i=0;i<n.length;i++)r[i]=String.fromCharCode(n[i]);return r.join("")}(this.l));if(this.v)throw new Error("could not read FormData body as text");return Promise.resolve(this.o)},e&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,n){t=a(t),n=c(n);var r=this.map[t];this.map[t]=r?r+", "+n:n},h.prototype.delete=function(t){delete this.map[a(t)]},h.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},h.prototype.set=function(t,n){this.map[a(t)]=c(n)},h.prototype.forEach=function(t,n){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(n,this.map[r],r,this)},h.prototype.keys=function(){var t=[];return this.forEach(function(n,r){t.push(r)}),f(t)},h.prototype.values=function(){var t=[];return this.forEach(function(n){t.push(n)}),f(t)},h.prototype.entries=function(){var t=[];return this.forEach(function(n,r){t.push([r,n])}),f(t)},r&&(h.prototype[Symbol.iterator]=h.prototype.entries);var m=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function p(n,r){if(!(this instanceof p))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var i,e,s=(r=r||{}).body;if(n instanceof p){if(n.bodyUsed)throw new TypeError("Already read");this.url=n.url,this.credentials=n.credentials,r.headers||(this.headers=new h(n.headers)),this.method=n.method,this.mode=n.mode,this.signal=n.signal,s||null==n.u||(s=n.u,n.bodyUsed=!0)}else this.url=String(n);if(this.credentials=r.credentials||this.credentials||"same-origin",!r.headers&&this.headers||(this.headers=new h(r.headers)),this.method=(i=r.method||this.method||"GET",e=i.toUpperCase(),m.indexOf(e)>-1?e:i),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal||function(){if("AbortController"in t)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this.i(s),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==r.cache&&"no-cache"!==r.cache)){var u=/([?&])_=[^&]*/;if(u.test(this.url))this.url=this.url.replace(u,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function y(t){var n=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),e=r.join("=").replace(/\+/g," ");n.append(decodeURIComponent(i),decodeURIComponent(e))}}),n}function b(t,n){if(!(this instanceof b))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(n||(n={}),this.type="default",this.status=void 0===n.status?200:n.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===n.statusText?"":""+n.statusText,this.headers=new h(n.headers),this.url=n.url||"",this.i(t)}p.prototype.clone=function(){return new p(this,{body:this.u})},w.call(p.prototype),w.call(b.prototype),b.prototype.clone=function(){return new b(this.u,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var E=[301,302,303,307,308];b.redirect=function(t,n){if(-1===E.indexOf(n))throw new RangeError("Invalid status code");return new b(null,{status:n,headers:{location:t}})};var I=t.DOMException;try{new I}catch(t){(I=function(t,n){this.message=t,this.name=n;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),I.prototype.constructor=I}function S(n,r){return new Promise(function(e,u){var o=new p(n,r);if(o.signal&&o.signal.aborted)return u(new I("Aborted","AbortError"));var f=new XMLHttpRequest;function d(){f.abort()}if(f.onload=function(){var t,n,r={statusText:f.statusText,headers:(t=f.getAllResponseHeaders()||"",n=new h,t.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t}).forEach(function(t){var r=t.split(":"),i=r.shift().trim();if(i){var e=r.join(":").trim();try{n.append(i,e)}catch(t){console.warn("Response "+t.message)}}}),n)};0===o.url.indexOf("file://")&&(f.status<200||f.status>599)?r.status=200:r.status=f.status,r.url="responseURL"in f?f.responseURL:r.headers.get("X-Request-URL");var i="response"in f?f.response:f.responseText;setTimeout(function(){e(new b(i,r))},0)},f.onerror=function(){setTimeout(function(){u(new TypeError("Network request failed"))},0)},f.ontimeout=function(){setTimeout(function(){u(new TypeError("Network request timed out"))},0)},f.onabort=function(){setTimeout(function(){u(new I("Aborted","AbortError"))},0)},f.open(o.method,function(n){try{return""===n&&t.location.href?t.location.href:n}catch(t){return n}}(o.url),!0),"include"===o.credentials?f.withCredentials=!0:"omit"===o.credentials&&(f.withCredentials=!1),"responseType"in f&&(i?f.responseType="blob":s&&(f.responseType="arraybuffer")),r&&"object"==typeof r.headers&&!(r.headers instanceof h||t.Headers&&r.headers instanceof t.Headers)){var v=[];Object.getOwnPropertyNames(r.headers).forEach(function(t){v.push(a(t)),f.setRequestHeader(t,c(r.headers[t]))}),o.headers.forEach(function(t,n){-1===v.indexOf(n)&&f.setRequestHeader(n,t)})}else o.headers.forEach(function(t,n){f.setRequestHeader(n,t)});o.signal&&(o.signal.addEventListener("abort",d),f.onreadystatechange=function(){4===f.readyState&&o.signal.removeEventListener("abort",d)}),f.send(void 0===o.u?null:o.u)})}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=h,t.Request=p,t.Response=b);var T,k,R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},A={};function _(){if(k)return T;k=1;var t=function(t){return t&&t.Math===Math&&t};return T=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof R&&R)||t("object"==typeof T&&T)||function(){return this}()||Function("return this")()}var O,C,D,N,F,P,M,x,U={};function j(){return C?O:(C=1,O=function(t){try{return!!t()}catch(t){return!0}})}function V(){if(N)return D;N=1;var t=j();return D=!t(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function L(){if(P)return F;P=1;var t=j();return F=!t(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})}function z(){if(x)return M;x=1;var t=L(),n=Function.prototype.call;return M=t?n.bind(n):function(){return n.apply(n,arguments)},M}var B,G,W,q,H,K,X,$,Q,J,Y,Z,tt,nt,rt,it,et,st,ut,ot,at,ct,ft,ht,dt,vt,lt,gt,wt,mt,pt,yt,bt,Et,It,St,Tt,kt,Rt,At,_t,Ot={};function Ct(){if(B)return Ot;B=1;var t={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!t.call({1:2},1);return Ot.f=r?function(t){var r=n(this,t);return!!r&&r.enumerable}:t,Ot}function Dt(){return W?G:(W=1,G=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}})}function Nt(){if(H)return q;H=1;var t=L(),n=Function.prototype,r=n.call,i=t&&n.bind.bind(r,r);return q=t?i:function(t){return function(){return r.apply(t,arguments)}},q}function Ft(){if(X)return K;X=1;var t=Nt(),n=t({}.toString),r=t("".slice);return K=function(t){return r(n(t),8,-1)}}function Pt(){if(Q)return $;Q=1;var t=Nt(),n=j(),r=Ft(),i=Object,e=t("".split);return $=n(function(){return!i("z").propertyIsEnumerable(0)})?function(t){return"String"===r(t)?e(t,""):i(t)}:i}function Mt(){return Y?J:(Y=1,J=function(t){return null==t})}function xt(){if(tt)return Z;tt=1;var t=Mt(),n=TypeError;return Z=function(r){if(t(r))throw new n("Can't call method on "+r);return r}}function Ut(){if(rt)return nt;rt=1;var t=Pt(),n=xt();return nt=function(r){return t(n(r))}}function jt(){if(et)return it;et=1;var t="object"==typeof document&&document.all;return it=void 0===t&&void 0!==t?function(n){return"function"==typeof n||n===t}:function(t){return"function"==typeof t}}function Vt(){if(ut)return st;ut=1;var t=jt();return st=function(n){return"object"==typeof n?null!==n:t(n)}}function Lt(){if(at)return ot;at=1;var t=_(),n=jt();return ot=function(r,i){return arguments.length<2?(e=t[r],n(e)?e:void 0):t[r]&&t[r][i];var e},ot}function zt(){if(ft)return ct;ft=1;var t=Nt();return ct=t({}.isPrototypeOf)}function Bt(){if(dt)return ht;dt=1;var t=_().navigator,n=t&&t.userAgent;return ht=n?String(n):""}function Gt(){if(lt)return vt;lt=1;var t,n,r=_(),i=Bt(),e=r.process,s=r.Deno,u=e&&e.versions||s&&s.version,o=u&&u.v8;return o&&(n=(t=o.split("."))[0]>0&&t[0]<4?1:+(t[0]+t[1])),!n&&i&&(!(t=i.match(/Edge\/(\d+)/))||t[1]>=74)&&(t=i.match(/Chrome\/(\d+)/))&&(n=+t[1]),vt=n}function Wt(){if(wt)return gt;wt=1;var t=Gt(),n=j(),r=_().String;return gt=!!Object.getOwnPropertySymbols&&!n(function(){var n=Symbol("symbol detection");return!r(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&t&&t<41})}function qt(){if(pt)return mt;pt=1;var t=Wt();return mt=t&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function Ht(){if(bt)return yt;bt=1;var t=Lt(),n=jt(),r=zt(),i=qt(),e=Object;return yt=i?function(t){return"symbol"==typeof t}:function(i){var s=t("Symbol");return n(s)&&r(s.prototype,e(i))}}function Kt(){if(It)return Et;It=1;var t=String;return Et=function(n){try{return t(n)}catch(t){return"Object"}}}function Xt(){if(Tt)return St;Tt=1;var t=jt(),n=Kt(),r=TypeError;return St=function(i){if(t(i))return i;throw new r(n(i)+" is not a function")}}function $t(){if(Rt)return kt;Rt=1;var t=Xt(),n=Mt();return kt=function(r,i){var e=r[i];return n(e)?void 0:t(e)}}function Qt(){if(_t)return At;_t=1;var t=z(),n=jt(),r=Vt(),i=TypeError;return At=function(e,s){var u,o;if("string"===s&&n(u=e.toString)&&!r(o=t(u,e)))return o;if(n(u=e.valueOf)&&!r(o=t(u,e)))return o;if("string"!==s&&n(u=e.toString)&&!r(o=t(u,e)))return o;throw new i("Can't convert object to primitive value")}}var Jt,Yt,Zt,tn,nn,rn,en,sn,un,on,an,cn,fn,hn,dn,vn,ln,gn,wn,mn,pn,yn,bn,En,In={exports:{}};function Sn(){return Yt?Jt:(Yt=1,Jt=!1)}function Tn(){if(tn)return Zt;tn=1;var t=_(),n=Object.defineProperty;return Zt=function(r,i){try{n(t,r,{value:i,configurable:!0,writable:!0})}catch(n){t[r]=i}return i}}function kn(){if(nn)return In.exports;nn=1;var t=Sn(),n=_(),r=Tn(),i="__core-js_shared__",e=In.exports=n[i]||r(i,{});return(e.versions||(e.versions=[])).push({version:"3.49.0",mode:t?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"}),In.exports}function Rn(){if(en)return rn;en=1;var t=kn();return rn=function(n,r){return t[n]||(t[n]=r||{})}}function An(){if(un)return sn;un=1;var t=xt(),n=Object;return sn=function(r){return n(t(r))}}function _n(){if(an)return on;an=1;var t=Nt(),n=An(),r=t({}.hasOwnProperty);return on=Object.hasOwn||function(t,i){return r(n(t),i)}}function On(){if(fn)return cn;fn=1;var t=Nt(),n=0,r=Math.random(),i=t(1.1.toString);return cn=function(t){return"Symbol("+(void 0===t?"":t)+")_"+i(++n+r,36)}}function Cn(){if(dn)return hn;dn=1;var t=_(),n=Rn(),r=_n(),i=On(),e=Wt(),s=qt(),u=t.Symbol,o=n("wks"),a=s?u.for||u:u&&u.withoutSetter||i;return hn=function(t){return r(o,t)||(o[t]=e&&r(u,t)?u[t]:a("Symbol."+t)),o[t]}}function Dn(){if(ln)return vn;ln=1;var t=z(),n=Vt(),r=Ht(),i=$t(),e=Qt(),s=Cn(),u=TypeError,o=s("toPrimitive");return vn=function(s,a){if(!n(s)||r(s))return s;var c,f=i(s,o);if(f){if(void 0===a&&(a="default"),c=t(f,s,a),!n(c)||r(c))return c;throw new u("Can't convert object to primitive value")}return void 0===a&&(a="number"),e(s,a)}}function Nn(){if(wn)return gn;wn=1;var t=Dn(),n=Ht();return gn=function(r){var i=t(r,"string");return n(i)?i:i+""}}function Fn(){if(pn)return mn;pn=1;var t=_(),n=Vt(),r=t.document,i=n(r)&&n(r.createElement);return mn=function(t){return i?r.createElement(t):{}}}function Pn(){if(bn)return yn;bn=1;var t=V(),n=j(),r=Fn();return yn=!t&&!n(function(){return 7!==Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a})}function Mn(){if(En)return U;En=1;var t=V(),n=z(),r=Ct(),i=Dt(),e=Ut(),s=Nn(),u=_n(),o=Pn(),a=Object.getOwnPropertyDescriptor;return U.f=t?a:function(t,c){if(t=e(t),c=s(c),o)try{return a(t,c)}catch(t){}if(u(t,c))return i(!n(r.f,t,c),t[c])},U}var xn,Un,jn,Vn,Ln,zn,Bn,Gn={};function Wn(){if(Un)return xn;Un=1;var t=V(),n=j();return xn=t&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}function qn(){if(Vn)return jn;Vn=1;var t=Vt(),n=String,r=TypeError;return jn=function(i){if(t(i))return i;throw new r(n(i)+" is not an object")}}function Hn(){if(Ln)return Gn;Ln=1;var t=V(),n=Pn(),r=Wn(),i=qn(),e=Nn(),s=TypeError,u=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a="enumerable",c="configurable",f="writable";return Gn.f=t?r?function(t,n,r){if(i(t),n=e(n),i(r),"function"==typeof t&&"prototype"===n&&"value"in r&&f in r&&!r[f]){var s=o(t,n);s&&s[f]&&(t[n]=r.value,r={configurable:c in r?r[c]:s[c],enumerable:a in r?r[a]:s[a],writable:!1})}return u(t,n,r)}:u:function(t,r,o){if(i(t),r=e(r),i(o),n)try{return u(t,r,o)}catch(t){}if("get"in o||"set"in o)throw new s("Accessors not supported");return"value"in o&&(t[r]=o.value),t},Gn}function Kn(){if(Bn)return zn;Bn=1;var t=V(),n=Hn(),r=Dt();return zn=t?function(t,i,e){return n.f(t,i,r(1,e))}:function(t,n,r){return t[n]=r,t}}var Xn,$n,Qn,Jn,Yn,Zn,tr,nr,rr,ir,er,sr,ur,or,ar,cr={exports:{}};function fr(){if($n)return Xn;$n=1;var t=V(),n=_n(),r=Function.prototype,i=t&&Object.getOwnPropertyDescriptor,e=n(r,"name"),s=e&&"something"===function(){}.name,u=e&&(!t||t&&i(r,"name").configurable);return Xn={EXISTS:e,PROPER:s,CONFIGURABLE:u}}function hr(){if(Jn)return Qn;Jn=1;var t=Nt(),n=jt(),r=kn(),i=t(Function.toString);return n(r.inspectSource)||(r.inspectSource=function(t){return i(t)}),Qn=r.inspectSource}function dr(){if(nr)return tr;nr=1;var t=Rn(),n=On(),r=t("keys");return tr=function(t){return r[t]||(r[t]=n(t))}}function vr(){return ir?rr:(ir=1,rr={})}function lr(){if(sr)return er;sr=1;var t,n,r,i=function(){if(Zn)return Yn;Zn=1;var t=_(),n=jt(),r=t.WeakMap;return Yn=n(r)&&/native code/.test(String(r))}(),e=_(),s=Vt(),u=Kn(),o=_n(),a=kn(),c=dr(),f=vr(),h="Object already initialized",d=e.TypeError,v=e.WeakMap;if(i||a.state){var l=a.state||(a.state=new v);l.get=l.get,l.has=l.has,l.set=l.set,t=function(t,n){if(l.has(t))throw new d(h);return n.facade=t,l.set(t,n),n},n=function(t){return l.get(t)||{}},r=function(t){return l.has(t)}}else{var g=c("state");f[g]=!0,t=function(t,n){if(o(t,g))throw new d(h);return n.facade=t,u(t,g,n),n},n=function(t){return o(t,g)?t[g]:{}},r=function(t){return o(t,g)}}return er={set:t,get:n,has:r,enforce:function(i){return r(i)?n(i):t(i,{})},getterFor:function(t){return function(r){var i;if(!s(r)||(i=n(r)).type!==t)throw new d("Incompatible receiver, "+t+" required");return i}}}}function gr(){if(ur)return cr.exports;ur=1;var t=Nt(),n=j(),r=jt(),i=_n(),e=V(),s=fr().CONFIGURABLE,u=hr(),o=lr(),a=o.enforce,c=o.get,f=String,h=Object.defineProperty,d=t("".slice),v=t("".replace),l=t([].join),g=e&&!n(function(){return 8!==h(function(){},"length",{value:8}).length}),w=String(String).split("String"),m=cr.exports=function(t,n,r){"Symbol("===d(f(n),0,7)&&(n="["+v(f(n),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(n="get "+n),r&&r.setter&&(n="set "+n),(!i(t,"name")||s&&t.name!==n)&&(e?h(t,"name",{value:n,configurable:!0}):t.name=n),g&&r&&i(r,"arity")&&t.length!==r.arity&&h(t,"length",{value:r.arity});try{r&&i(r,"constructor")&&r.constructor?e&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var u=a(t);return i(u,"source")||(u.source=l(w,"string"==typeof n?n:"")),t};return Function.prototype.toString=m(function(){return r(this)&&c(this).source||u(this)},"toString"),cr.exports}function wr(){if(ar)return or;ar=1;var t=jt(),n=Hn(),r=gr(),i=Tn();return or=function(e,s,u,o){o||(o={});var a=o.enumerable,c=void 0!==o.name?o.name:s;if(t(u)&&r(u,c,o),o.global)a?e[s]=u:i(s,u);else{try{o.unsafe?e[s]&&(a=!0):delete e[s]}catch(t){}a?e[s]=u:n.f(e,s,{value:u,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e}}var mr,pr,yr,br,Er,Ir,Sr,Tr,kr,Rr,Ar,_r,Or,Cr,Dr,Nr,Fr,Pr={};function Mr(){if(br)return yr;br=1;var t=function(){if(pr)return mr;pr=1;var t=Math.ceil,n=Math.floor;return mr=Math.trunc||function(r){var i=+r;return(i>0?n:t)(i)}}();return yr=function(n){var r=+n;return r!=r||0===r?0:t(r)}}function xr(){if(Ir)return Er;Ir=1;var t=Mr(),n=Math.max,r=Math.min;return Er=function(i,e){var s=t(i);return s<0?n(s+e,0):r(s,e)}}function Ur(){if(Tr)return Sr;Tr=1;var t=Mr(),n=Math.min;return Sr=function(r){var i=t(r);return i>0?n(i,9007199254740991):0}}function jr(){if(Rr)return kr;Rr=1;var t=Ur();return kr=function(n){return t(n.length)}}function Vr(){if(_r)return Ar;_r=1;var t=Ut(),n=xr(),r=jr(),i=function(i){return function(e,s,u){var o=t(e),a=r(o);if(0===a)return!i&&-1;var c,f=n(u,a);if(i&&s!=s){for(;a>f;)if((c=o[f++])!=c)return!0}else for(;a>f;f++)if((i||f in o)&&o[f]===s)return i||f||0;return!i&&-1}};return Ar={includes:i(!0),indexOf:i(!1)}}function Lr(){if(Cr)return Or;Cr=1;var t=Nt(),n=_n(),r=Ut(),i=Vr().indexOf,e=vr(),s=t([].push);return Or=function(t,u){var o,a=r(t),c=0,f=[];for(o in a)!n(e,o)&&n(a,o)&&s(f,o);for(;u.length>c;)n(a,o=u[c++])&&(~i(f,o)||s(f,o));return f}}function zr(){return Nr?Dr:(Nr=1,Dr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function Br(){if(Fr)return Pr;Fr=1;var t=Lr(),n=zr().concat("length","prototype");return Pr.f=Object.getOwnPropertyNames||function(r){return t(r,n)},Pr}var Gr,Wr,qr,Hr,Kr,Xr,$r,Qr,Jr,Yr,Zr,ti,ni,ri,ii,ei,si,ui,oi,ai,ci,fi,hi,di,vi,li,gi,wi,mi,pi,yi={};function bi(){return Gr||(Gr=1,yi.f=Object.getOwnPropertySymbols),yi}function Ei(){if(qr)return Wr;qr=1;var t=Lt(),n=Nt(),r=Br(),i=bi(),e=qn(),s=n([].concat);return Wr=t("Reflect","ownKeys")||function(t){var n=r.f(e(t)),u=i.f;return u?s(n,u(t)):n}}function Ii(){if(Kr)return Hr;Kr=1;var t=_n(),n=Ei(),r=Mn(),i=Hn();return Hr=function(e,s,u){for(var o=n(s),a=i.f,c=r.f,f=0;f<o.length;f++){var h=o[f];t(e,h)||u&&t(u,h)||a(e,h,c(s,h))}}}function Si(){if($r)return Xr;$r=1;var t=j(),n=jt(),r=/#|\.prototype\./,i=function(r,i){var a=s[e(r)];return a===o||a!==u&&(n(i)?t(i):!!i)},e=i.normalize=function(t){return String(t).replace(r,".").toLowerCase()},s=i.data={},u=i.NATIVE="N",o=i.POLYFILL="P";return Xr=i}function Ti(){if(Jr)return Qr;Jr=1;var t=_(),n=Mn().f,r=Kn(),i=wr(),e=Tn(),s=Ii(),u=Si();return Qr=function(o,a){var c,f,h,d,v,l=o.target,g=o.global,w=o.stat;if(c=g?t:w?t[l]||e(l,{}):t[l]&&t[l].prototype)for(f in a){if(d=a[f],h=o.dontCallGetSet?(v=n(c,f))&&v.value:c[f],!u(g?f:l+(w?".":"#")+f,o.forced)&&void 0!==h){if(typeof d==typeof h)continue;s(d,h)}(o.sham||h&&h.sham)&&r(d,"sham",!0),i(c,f,d,o)}}}function ki(){if(Zr)return Yr;Zr=1;var t=Ft();return Yr=Array.isArray||function(n){return"Array"===t(n)}}function Ri(){if(ni)return ti;ni=1;var t=TypeError;return ti=function(n){if(n>9007199254740991)throw new t("Maximum allowed index exceeded");return n}}function Ai(){if(ii)return ri;ii=1;var t=V(),n=Hn(),r=Dt();return ri=function(i,e,s){t?n.f(i,e,r(0,s)):i[e]=s}}function _i(){if(si)return ei;si=1;var t=V(),n=ki(),r=TypeError,i=Object.getOwnPropertyDescriptor,e=t&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();return ei=e?function(t,e){if(n(t)&&!i(t,"length").writable)throw new r("Cannot set read only .length");return t.length=e}:function(t,n){return t.length=n}}function Oi(){if(oi)return ui;oi=1;var t={};return t[Cn()("toStringTag")]="z",ui="[object z]"===String(t)}function Ci(){if(ci)return ai;ci=1;var t=Oi(),n=jt(),r=Ft(),i=Cn()("toStringTag"),e=Object,s="Arguments"===r(function(){return arguments}());return ai=t?r:function(t){var u,o,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(o=function(t,n){try{return t[n]}catch(t){}}(u=e(t),i))?o:s?r(u):"Object"===(a=r(u))&&n(u.callee)?"Arguments":a}}function Di(){if(hi)return fi;hi=1;var t=Nt(),n=j(),r=jt(),i=Ci(),e=Lt(),s=hr(),u=function(){},o=e("Reflect","construct"),a=/^\s*(?:class|function)\b/,c=t(a.exec),f=!a.test(u),h=function(t){if(!r(t))return!1;try{return o(u,[],t),!0}catch(t){return!1}},d=function(t){if(!r(t))return!1;switch(i(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return f||!!c(a,s(t))}catch(t){return!0}};return d.sham=!0,fi=!o||n(function(){var t;return h(h.call)||!h(Object)||!h(function(){t=!0})||t})?d:h}function Ni(){if(vi)return di;vi=1;var t=ki(),n=Di(),r=Vt(),i=Cn()("species"),e=Array;return di=function(s){var u;return t(s)&&(u=s.constructor,(n(u)&&(u===e||t(u.prototype))||r(u)&&null===(u=u[i]))&&(u=void 0)),void 0===u?e:u}}function Fi(){if(gi)return li;gi=1;var t=Ni();return li=function(n,r){return new(t(n))(0===r?0:r)}}function Pi(){if(mi)return wi;mi=1;var t=j(),n=Cn(),r=Gt(),i=n("species");return wi=function(n){return r>=51||!t(function(){var t=[];return(t.constructor={})[i]=function(){return{foo:1}},1!==t[n](Boolean).foo})}}!function(){if(pi)return A;pi=1;var t=Ti(),n=j(),r=ki(),i=Vt(),e=An(),s=jr(),u=Ri(),o=Ai(),a=_i(),c=Fi(),f=Pi(),h=Cn(),d=Gt(),v=h("isConcatSpreadable"),l=d>=51||!n(function(){var t=[];return t[v]=!1,t.concat()[0]!==t}),g=function(t){if(!i(t))return!1;var n=t[v];return void 0!==n?!!n:r(t)};t({target:"Array",proto:!0,arity:1,forced:!l||!f("concat")},{concat:function(t){var n,r,i,f,h,d=e(this),v=c(d,0),l=0;for(n=-1,i=arguments.length;n<i;n++)if(g(h=-1===n?d:arguments[n]))for(f=s(h),u(l+f),r=0;r<f;r++,l++)r in h&&o(v,l,h[r]);else u(l+1),o(v,l++,h);return a(v,l),v}})}();var Mi,xi,Ui,ji,Vi,Li,zi,Bi,Gi,Wi,qi={},Hi={};function Ki(){if(xi)return Mi;xi=1;var t=Lr(),n=zr();return Mi=Object.keys||function(r){return t(r,n)}}function Xi(){if(Vi)return ji;Vi=1;var t=Lt();return ji=t("document","documentElement")}function $i(){if(zi)return Li;zi=1;var t,n=qn(),r=function(){if(Ui)return Hi;Ui=1;var t=V(),n=Wn(),r=Hn(),i=qn(),e=Ut(),s=Ki();return Hi.f=t&&!n?Object.defineProperties:function(t,n){i(t);for(var u,o=e(n),a=s(n),c=a.length,f=0;c>f;)r.f(t,u=a[f++],o[u]);return t},Hi}(),i=zr(),e=vr(),s=Xi(),u=Fn(),o=dr(),a="prototype",c="script",f=o("IE_PROTO"),h=function(){},d=function(t){return"<"+c+">"+t+"</"+c+">"},v=function(t){t.write(d("")),t.close();var n=t.parentWindow.Object;return t=null,n},l=function(){try{t=new ActiveXObject("htmlfile")}catch(t){}var n,r,e;l="undefined"!=typeof document?document.domain&&t?v(t):(r=u("iframe"),e="java"+c+":",r.style.display="none",s.appendChild(r),r.src=String(e),(n=r.contentWindow.document).open(),n.write(d("document.F=Object")),n.close(),n.F):v(t);for(var o=i.length;o--;)delete l[a][i[o]];return l()};return e[f]=!0,Li=Object.create||function(t,i){var e;return null!==t?(h[a]=n(t),e=new h,h[a]=null,e[f]=t):e=l(),void 0===i?e:r.f(e,i)}}function Qi(){if(Gi)return Bi;Gi=1;var t=Cn(),n=$i(),r=Hn().f,i=t("unscopables"),e=Array.prototype;return void 0===e[i]&&r(e,i,{configurable:!0,value:n(null)}),Bi=function(t){e[i][t]=!0}}!function(){if(Wi)return qi;Wi=1;var t=Ti(),n=Vr().includes,r=j(),i=Qi(),e=r(function(){return!Array(1).includes()}),s=r(function(){return[,1].includes(void 0,1)});t({target:"Array",proto:!0,forced:e||s},{includes:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),i("includes")}();var Ji,Yi,Zi,te={};function ne(){if(Yi)return Ji;Yi=1;var t=j();return Ji=function(n,r){var i=[][n];return!!i&&t(function(){i.call(null,r||function(){return 1},1)})}}!function(){if(Zi)return te;Zi=1;var t=Ti(),n=Nt(),r=Pt(),i=Ut(),e=ne(),s=n([].join);t({target:"Array",proto:!0,forced:r!==Object||!e("join",",")},{join:function(t){return s(i(this),void 0===t?",":t)}})}();var re,ie={};!function(){if(re)return ie;re=1;var t=Ti(),n=An(),r=Ki();t({target:"Object",stat:!0,forced:j()(function(){r(1)})},{keys:function(t){return r(n(t))}})}();var ee,se,ue,oe={};!function(){if(ue)return oe;ue=1;var t=Oi(),n=wr(),r=function(){if(se)return ee;se=1;var t=Oi(),n=Ci();return ee=t?{}.toString:function(){return"[object "+n(this)+"]"}}();t||n(Object.prototype,"toString",r,{unsafe:!0})}();var ae,ce,fe,he,de,ve,le,ge,we,me,pe,ye,be,Ee,Ie,Se,Te,ke,Re,Ae,_e,Oe,Ce,De,Ne,Fe,Pe,Me,xe,Ue,je,Ve,Le,ze,Be,Ge,We,qe,He,Ke,Xe,$e,Qe,Je,Ye,Ze,ts,ns,rs,is,es,ss,us,os,as,cs,fs,hs,ds={};function vs(){if(ce)return ae;ce=1;var t=_(),n=Bt(),r=Ft(),i=function(t){return n.slice(0,t.length)===t};return ae=i("Bun/")?"BUN":i("Cloudflare-Workers")?"CLOUDFLARE":i("Deno/")?"DENO":i("Node.js/")?"NODE":t.Bun&&"string"==typeof Bun.version?"BUN":t.Deno&&"object"==typeof Deno.version?"DENO":"process"===r(t.process)?"NODE":t.window&&t.document?"BROWSER":"REST"}function ls(){if(he)return fe;he=1;var t=vs();return fe="NODE"===t}function gs(){if(ve)return de;ve=1;var t=_();return de=t}function ws(){if(me)return we;me=1;var t=Vt();return we=function(n){return t(n)||null===n}}function ms(){if(ye)return pe;ye=1;var t=ws(),n=String,r=TypeError;return pe=function(i){if(t(i))return i;throw new r("Can't set "+n(i)+" as a prototype")}}function ps(){if(Ee)return be;Ee=1;var t=function(){if(ge)return le;ge=1;var t=Nt(),n=Xt();return le=function(r,i,e){try{return t(n(Object.getOwnPropertyDescriptor(r,i)[e]))}catch(t){}}}(),n=Vt(),r=xt(),i=ms();return be=Object.setPrototypeOf||("__proto__"in{}?function(){var e,s=!1,u={};try{(e=t(Object.prototype,"__proto__","set"))(u,[]),s=u instanceof Array}catch(t){}return function(t,u){return r(t),i(u),n(t)?(s?e(t,u):t.__proto__=u,t):t}}():void 0)}function ys(){if(Se)return Ie;Se=1;var t=Hn().f,n=_n(),r=Cn()("toStringTag");return Ie=function(i,e,s){i&&!s&&(i=i.prototype),i&&!n(i,r)&&t(i,r,{configurable:!0,value:e})}}function bs(){if(ke)return Te;ke=1;var t=gr(),n=Hn();return Te=function(r,i,e){return e.get&&t(e.get,i,{getter:!0}),e.set&&t(e.set,i,{setter:!0}),n.f(r,i,e)}}function Es(){if(Ae)return Re;Ae=1;var t=Lt(),n=bs(),r=Cn(),i=V(),e=r("species");return Re=function(r){var s=t(r);i&&s&&!s[e]&&n(s,e,{configurable:!0,get:function(){return this}})}}function Is(){if(Oe)return _e;Oe=1;var t=zt(),n=TypeError;return _e=function(r,i){if(t(i,r))return r;throw new n("Incorrect invocation")}}function Ss(){if(De)return Ce;De=1;var t=Di(),n=Kt(),r=TypeError;return Ce=function(i){if(t(i))return i;throw new r(n(i)+" is not a constructor")}}function Ts(){if(Fe)return Ne;Fe=1;var t=qn(),n=Ss(),r=Mt(),i=Cn()("species");return Ne=function(e,s){var u,o=t(e).constructor;return void 0===o||r(u=t(o)[i])?s:n(u)}}function ks(){if(Me)return Pe;Me=1;var t=L(),n=Function.prototype,r=n.apply,i=n.call;return Pe="object"==typeof Reflect&&Reflect.apply||(t?i.bind(r):function(){return i.apply(r,arguments)}),Pe}function Rs(){if(Ue)return xe;Ue=1;var t=Ft(),n=Nt();return xe=function(r){if("Function"===t(r))return n(r)}}function As(){if(Ve)return je;Ve=1;var t=Rs(),n=Xt(),r=L(),i=t(t.bind);return je=function(t,e){return n(t),void 0===e?t:r?i(t,e):function(){return t.apply(e,arguments)}},je}function _s(){if(ze)return Le;ze=1;var t=Nt();return Le=t([].slice)}function Os(){if(Ge)return Be;Ge=1;var t=TypeError;return Be=function(n,r){if(n<r)throw new t("Not enough arguments");return n}}function Cs(){if(qe)return We;qe=1;var t=Bt();return We=/ipad|iphone|ipod/i.test(t)&&/applewebkit/i.test(t)}function Ds(){if(Ke)return He;Ke=1;var t,n,r,i,e=_(),s=ks(),u=As(),o=jt(),a=_n(),c=j(),f=Xi(),h=_s(),d=Fn(),v=Os(),l=Cs(),g=ls(),w=e.setImmediate,m=e.clearImmediate,p=e.process,y=e.Dispatch,b=e.Function,E=e.MessageChannel,I=e.String,S=0,T={},k="onreadystatechange";c(function(){t=e.location});var R=function(t){if(a(T,t)){var n=T[t];delete T[t],n()}},A=function(t){return function(){R(t)}},O=function(t){R(t.data)},C=function(n){e.postMessage(I(n),t.protocol+"//"+t.host)};return w&&m||(w=function(t){v(arguments.length,1);var r=o(t)?t:b(t),i=h(arguments,1);return T[++S]=function(){s(r,void 0,i)},n(S),S},m=function(t){delete T[t]},g?n=function(t){p.nextTick(A(t))}:y&&y.now?n=function(t){y.now(A(t))}:E&&!l?(i=(r=new E).port2,r.port1.onmessage=O,n=u(i.postMessage,i)):e.addEventListener&&o(e.postMessage)&&!e.importScripts&&t&&"file:"!==t.protocol&&!c(C)?(n=C,e.addEventListener("message",O,!1)):n=k in d("script")?function(t){f.appendChild(d("script"))[k]=function(){f.removeChild(this),R(t)}}:function(t){setTimeout(A(t),0)}),He={set:w,clear:m}}function Ns(){if($e)return Xe;$e=1;var t=_(),n=V(),r=Object.getOwnPropertyDescriptor;return Xe=function(i){if(!n)return t[i];var e=r(t,i);return e&&e.value}}function Fs(){if(Je)return Qe;Je=1;var t=function(){this.head=null,this.tail=null};return t.prototype={add:function(t){var n={item:t,next:null},r=this.tail;r?r.next=n:this.head=n,this.tail=n},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},Qe=t}function Ps(){if(is)return rs;is=1;var t,n,r,i,e,s=_(),u=Ns(),o=As(),a=Ds().set,c=Fs(),f=Cs(),h=function(){if(Ze)return Ye;Ze=1;var t=Bt();return Ye=/ipad|iphone|ipod/i.test(t)&&"undefined"!=typeof Pebble}(),d=function(){if(ns)return ts;ns=1;var t=Bt();return ts=/web0s(?!.*chrome)/i.test(t)}(),v=ls(),l=s.MutationObserver||s.WebKitMutationObserver,g=s.document,w=s.process,m=s.Promise,p=u("queueMicrotask");if(!p){var y=new c,b=function(){var n,r;for(v&&(n=w.domain)&&n.exit();r=y.get();)try{r()}catch(n){throw y.head&&t(),n}n&&n.enter()};f||v||d||!l||!g?!h&&m&&m.resolve?((i=m.resolve(void 0)).constructor=m,e=o(i.then,i),t=function(){e(b)}):v?t=function(){w.nextTick(b)}:(a=o(a,s),t=function(){a(b)}):(n=!0,r=g.createTextNode(""),new l(b).observe(r,{characterData:!0}),t=function(){r.data=n=!n}),p=function(n){y.head||t(),y.add(n)}}return rs=p}function Ms(){return ss||(ss=1,es=function(t,n){try{1===arguments.length?console.error(t):console.error(t,n)}catch(t){}}),es}function xs(){return os?us:(os=1,us=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}})}function Us(){if(cs)return as;cs=1;var t=_();return as=t.Promise}function js(){if(hs)return fs;hs=1;var t=_(),n=Us(),r=jt(),i=Si(),e=hr(),s=Cn(),u=vs(),o=Sn(),a=Gt(),c=n&&n.prototype,f=s("species"),h=!1,d=r(t.PromiseRejectionEvent),v=i("Promise",function(){var t=e(n),r=t!==String(n);if(!r&&66===a)return!0;if(o&&(!c.catch||!c.finally))return!0;if(!a||a<51||!/native code/.test(t)){var i=new n(function(t){t(1)}),s=function(t){t(function(){},function(){})};if((i.constructor={})[f]=s,!(h=i.then(function(){})instanceof s))return!0}return!(r||"BROWSER"!==u&&"DENO"!==u||d)});return fs={CONSTRUCTOR:v,REJECTION_EVENT:d,SUBCLASSING:h}}var Vs,Ls,zs={};function Bs(){if(Vs)return zs;Vs=1;var t=Xt(),n=TypeError,r=function(r){var i,e;this.promise=new r(function(t,r){if(void 0!==i||void 0!==e)throw new n("Bad Promise constructor");i=t,e=r}),this.resolve=t(i),this.reject=t(e)};return zs.f=function(t){return new r(t)},zs}var Gs,Ws,qs,Hs,Ks,Xs,$s,Qs,Js,Ys,Zs,tu,nu,ru,iu,eu,su,uu={};function ou(){return Ws?Gs:(Ws=1,Gs={})}function au(){if(Hs)return qs;Hs=1;var t=Cn(),n=ou(),r=t("iterator"),i=Array.prototype;return qs=function(t){return void 0!==t&&(n.Array===t||i[r]===t)}}function cu(){if(Xs)return Ks;Xs=1;var t=Ci(),n=$t(),r=Mt(),i=ou(),e=Cn()("iterator");return Ks=function(s){if(!r(s))return n(s,e)||n(s,"@@iterator")||i[t(s)]}}function fu(){if(Qs)return $s;Qs=1;var t=z(),n=Xt(),r=qn(),i=Kt(),e=cu(),s=TypeError;return $s=function(u,o){var a=arguments.length<2?e(u):o;if(n(a))return r(t(a,u));throw new s(i(u)+" is not iterable")},$s}function hu(){if(Ys)return Js;Ys=1;var t=z(),n=qn(),r=$t();return Js=function(i,e,s){var u,o;n(i);try{if(!(u=r(i,"return"))){if("throw"===e)throw s;return s}u=t(u,i)}catch(t){o=!0,u=t}if("throw"===e)throw s;if(o)throw u;return n(u),s}}function du(){if(tu)return Zs;tu=1;var t=As(),n=z(),r=qn(),i=Kt(),e=au(),s=jr(),u=zt(),o=fu(),a=cu(),c=hu(),f=TypeError,h=function(t,n){this.stopped=t,this.result=n},d=h.prototype;return Zs=function(v,l,g){var w,m,p,y,b,E,I,S=g&&g.that,T=!(!g||!g.AS_ENTRIES),k=!(!g||!g.IS_RECORD),R=!(!g||!g.IS_ITERATOR),A=!(!g||!g.INTERRUPTED),_=t(l,S),O=function(t){var n=w;return w=void 0,n&&c(n,"normal"),new h(!0,t)},C=function(t){return T?(r(t),A?_(t[0],t[1],O):_(t[0],t[1])):A?_(t,O):_(t)};if(k)w=v.iterator;else if(R)w=v;else{if(!(m=a(v)))throw new f(i(v)+" is not iterable");if(e(m)){for(p=0,y=s(v);y>p;p++)if((b=C(v[p]))&&u(d,b))return b;return new h(!1)}w=o(v,m)}for(E=k?v.next:w.next;!(I=n(E,w)).done;){var D=I.value;try{b=C(D)}catch(t){if(!w)throw t;c(w,"throw",t)}if("object"==typeof b&&b&&u(d,b))return b}return new h(!1)}}function vu(){if(ru)return nu;ru=1;var t=Cn()("iterator"),n=!1;try{var r=0,i={next:function(){return{done:!!r++}},return:function(){n=!0}};i[t]=function(){return this},Array.from(i,function(){throw 2})}catch(t){}return nu=function(r,i){try{if(!i&&!n)return!1}catch(t){return!1}var e=!1;try{var s={};s[t]=function(){return{next:function(){return{done:e=!0}}}},r(s)}catch(t){}return e}}function lu(){if(eu)return iu;eu=1;var t=Us(),n=vu(),r=js().CONSTRUCTOR;return iu=r||!n(function(n){t.all(n).then(void 0,function(){})})}var gu,wu={};var mu,pu={};var yu,bu={};var Eu,Iu,Su,Tu,ku={};function Ru(){if(Iu)return Eu;Iu=1;var t=qn(),n=Vt(),r=Bs();return Eu=function(i,e){if(t(i),n(e)&&e.constructor===i)return e;var s=r.f(i);return(0,s.resolve)(e),s.promise}}Tu||(Tu=1,function(){if(Ls)return ds;Ls=1;var t,n,r,i,e=Ti(),s=Sn(),u=ls(),o=_(),a=gs(),c=z(),f=wr(),h=ps(),d=ys(),v=Es(),l=Xt(),g=jt(),w=Vt(),m=Is(),p=Ts(),y=Ds().set,b=Ps(),E=Ms(),I=xs(),S=Fs(),T=lr(),k=Us(),R=js(),A=Bs(),O="Promise",C=R.CONSTRUCTOR,D=R.REJECTION_EVENT,N=R.SUBCLASSING,F=T.getterFor(O),P=T.set,M=k&&k.prototype,x=k,U=M,j=o.TypeError,V=o.document,L=o.process,B=A.f,G=B,W=!!(V&&V.createEvent&&o.dispatchEvent),q="unhandledrejection",H=function(t){var n;return!(!w(t)||!g(n=t.then))&&n},K=function(t,n){var r,i,e,s=n.value,u=1===n.state,o=u?t.ok:t.fail,a=t.resolve,f=t.reject,h=t.domain;try{o?(u||(2===n.rejection&&Y(n),n.rejection=1),!0===o?r=s:(h&&h.enter(),r=o(s),h&&(h.exit(),e=!0)),r===t.promise?f(new j("Promise-chain cycle")):(i=H(r))?c(i,r,a,f):a(r)):f(s)}catch(t){h&&!e&&h.exit(),f(t)}},X=function(t,n){t.notified||(t.notified=!0,b(function(){for(var r,i=t.reactions;r=i.get();)K(r,t);t.notified=!1,n&&!t.rejection&&Q(t)}))},$=function(t,n,r){var i,e;W?((i=V.createEvent("Event")).promise=n,i.reason=r,i.initEvent(t,!1,!0),o.dispatchEvent(i)):i={promise:n,reason:r},!D&&(e=o["on"+t])?e(i):t===q&&E("Unhandled promise rejection",r)},Q=function(t){c(y,o,function(){var n,r=t.facade,i=t.value;if(J(t)&&(n=I(function(){u?L.emit("unhandledRejection",i,r):$(q,r,i)}),t.rejection=u||J(t)?2:1,n.error))throw n.value})},J=function(t){return 1!==t.rejection&&!t.parent},Y=function(t){c(y,o,function(){var n=t.facade;u?L.emit("rejectionHandled",n):$("rejectionhandled",n,t.value)})},Z=function(t,n,r){return function(i){t(n,i,r)}},tt=function(t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=2,X(t,!0))},nt=function(t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===n)throw new j("Promise can't be resolved itself");var i=H(n);i?b(function(){var r={done:!1};try{c(i,n,Z(nt,r,t),Z(tt,r,t))}catch(n){tt(r,n,t)}}):(t.value=n,t.state=1,X(t,!1))}catch(n){tt({done:!1},n,t)}}};if(C&&(U=(x=function(n){m(this,U),l(n),c(t,this);var r=F(this);try{n(Z(nt,r),Z(tt,r))}catch(t){tt(r,t)}}).prototype,(t=function(t){P(this,{type:O,done:!1,notified:!1,parent:!1,reactions:new S,rejection:!1,state:0,value:null})}).prototype=f(U,"then",function(t,n){var r=F(this),i=B(p(this,x));return r.parent=!0,i.ok=!g(t)||t,i.fail=g(n)&&n,i.domain=u?L.domain:void 0,0===r.state?r.reactions.add(i):b(function(){K(i,r)}),i.promise}),n=function(){var n=new t,r=F(n);this.promise=n,this.resolve=Z(nt,r),this.reject=Z(tt,r)},A.f=B=function(t){return t===x||t===r?new n(t):G(t)},!s&&g(k)&&M!==Object.prototype)){i=M.then,N||f(M,"then",function(t,n){var r=this;return new x(function(t,n){c(i,r,t,n)}).then(t,n)},{unsafe:!0});try{delete M.constructor}catch(t){}h&&h(M,U)}e({global:!0,constructor:!0,wrap:!0,forced:C},{Promise:x}),r=a.Promise,d(x,O,!1,!0),v(O)}(),function(){if(su)return uu;su=1;var t=Ti(),n=z(),r=Xt(),i=Bs(),e=xs(),s=du();t({target:"Promise",stat:!0,forced:lu()},{all:function(t){var u=this,o=i.f(u),a=o.resolve,c=o.reject,f=e(function(){var i=r(u.resolve),e=[],o=0,f=1;s(t,function(t){var r=o++,s=!1;f++,n(i,u,t).then(function(t){s||(s=!0,e[r]=t,--f||a(e))},c)}),--f||a(e)});return f.error&&c(f.value),o.promise}})}(),function(){if(gu)return wu;gu=1;var t=Ti(),n=Sn(),r=js().CONSTRUCTOR,i=Us(),e=Lt(),s=jt(),u=wr(),o=i&&i.prototype;if(t({target:"Promise",proto:!0,forced:r,real:!0},{catch:function(t){return this.then(void 0,t)}}),!n&&s(i)){var a=e("Promise").prototype.catch;o.catch!==a&&u(o,"catch",a,{unsafe:!0})}}(),function(){if(mu)return pu;mu=1;var t=Ti(),n=z(),r=Xt(),i=Bs(),e=xs(),s=du();t({target:"Promise",stat:!0,forced:lu()},{race:function(t){var u=this,o=i.f(u),a=o.reject,c=e(function(){var i=r(u.resolve);s(t,function(t){n(i,u,t).then(o.resolve,a)})});return c.error&&a(c.value),o.promise}})}(),function(){if(yu)return bu;yu=1;var t=Ti(),n=Bs();t({target:"Promise",stat:!0,forced:js().CONSTRUCTOR},{reject:function(t){var r=n.f(this);return(0,r.reject)(t),r.promise}})}(),function(){if(Su)return ku;Su=1;var t=Ti(),n=Lt(),r=Sn(),i=Us(),e=js().CONSTRUCTOR,s=Ru(),u=n("Promise"),o=r&&!e;t({target:"Promise",stat:!0,forced:r||e},{resolve:function(t){return s(o&&this===u?i:this,t)}})}());var Au,_u,Ou,Cu,Du,Nu,Fu,Pu,Mu,xu={};function Uu(){return _u?Au:(_u=1,Au={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0})}function ju(){if(Cu)return Ou;Cu=1;var t=Fn()("span").classList,n=t&&t.constructor&&t.constructor.prototype;return Ou=n===Object.prototype?void 0:n}function Vu(){if(Nu)return Du;Nu=1;var t=As(),n=Pt(),r=An(),i=jr(),e=Fi(),s=Ai(),u=function(u){var o=1===u,a=2===u,c=3===u,f=4===u,h=6===u,d=7===u,v=5===u||h;return function(l,g,w){for(var m,p,y=r(l),b=n(y),E=i(b),I=t(g,w),S=0,T=0,k=o?e(l,E):a||d?e(l,0):void 0;E>S;S++)if((v||S in b)&&(p=I(m=b[S],S,y),u))if(o)s(k,S,p);else if(p)switch(u){case 3:return!0;case 5:return m;case 6:return S;case 2:s(k,T++,m)}else switch(u){case 4:return!1;case 7:s(k,T++,m)}return h?-1:c||f?f:k}};return Du={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}}!function(){if(Mu)return xu;Mu=1;var t=_(),n=Uu(),r=ju(),i=function(){if(Pu)return Fu;Pu=1;var t=Vu().forEach,n=ne()("forEach");return Fu=n?[].forEach:function(n){return t(this,n,arguments.length>1?arguments[1]:void 0)},Fu}(),e=Kn(),s=function(t){if(t&&t.forEach!==i)try{e(t,"forEach",i)}catch(n){t.forEach=i}};for(var u in n)n[u]&&s(t[u]&&t[u].prototype);s(r)}();var Lu=function(t,n){return Lu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},Lu(t,n)};var zu=function(){return zu=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++)for(var e in n=arguments[r])Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t},zu.apply(this,arguments)};function Bu(t,n,r,i){return new(r||(r=Promise))(function(e,s){function u(t){try{a(i.next(t))}catch(t){s(t)}}function o(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r(function(t){t(n)})).then(u,o)}a((i=i.apply(t,n||[])).next())})}function Gu(t,n){var r,i,e,s={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=o(0),u.throw=o(1),u.return=o(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function o(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,o[0]&&(s=0)),s;)try{if(r=1,i&&(e=2&o[0]?i.return:o[0]?i.throw||((e=i.return)&&e.call(i),0):i.next)&&!(e=e.call(i,o[1])).done)return e;switch(i=0,e&&(o=[2&o[0],e.value]),o[0]){case 0:case 1:e=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(e=s.trys,(e=e.length>0&&e[e.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!e||o[1]>e[0]&&o[1]<e[3])){s.label=o[1];break}if(6===o[0]&&s.label<e[1]){s.label=e[1],e=o;break}if(e&&s.label<e[2]){s.label=e[2],s.ops.push(o);break}e[2]&&s.ops.pop(),s.trys.pop();continue}o=n.call(t,s)}catch(t){o=[6,t],i=0}finally{r=e=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function Wu(t){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&t[n],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function qu(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,e,s=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(i=s.next()).done;)u.push(i.value)}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return u}function Hu(t,n,r){if(r||2===arguments.length)for(var i,e=0,s=n.length;e<s;e++)!i&&e in n||(i||(i=Array.prototype.slice.call(n,0,e)),i[e]=n[e]);return t.concat(i||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var Ku="/phantom/web/events",Xu="/phantom/web/userEvents",$u="/phantom/api/v2/sdk/config",Qu="/phantom/api/v2/visitors",Ju="/phantom/api/v2/visitors",Yu="/phantom/api/v2/visitors/merge",Zu="/api/v1/websdk/dlr",to=18e5,no={STATUSES:{PENDING:"pending"},BATCH_SIZE:50,DEFAULT_RETRY_DELAYS:[6e4,12e4,24e4,48e4,9e5],RETRYABLE_HTTP_CODES:[408,429,500,502,503,504,401],GLOBAL_SUCCESS_CODE:200,PARTIAL_SUCCESS_CODE:201},ro="/firebase-messaging-sw.js",io="hydra-websdk-fcm",eo={USER_CONTEXT:"websdk_user_context",VISITOR_ID:"websdk_visitor_id",VISITOR_REF_ID:"websdk_visitor_ref_id",VISITOR_EXPIRED_AT:"websdk_visitor_expired_at",VISITOR_CONFIG:"websdk_visitor_config",FCM_TOKEN:"websdk_fcm_token",FCM_TOKEN_CREATED_AT:"websdk_fcm_token_created_at",NOTIFICATION_STATE:"websdk_notification_state",SESSION_ID:"websdk_session_id",SESSION_START_TIME:"websdk_session_start_time",LAST_EVENT_TIME:"websdk_last_event_time",LAST_AUTHENTICATED_USER:"websdk_last_authenticated_user",MERGED_USER_ID:"websdk_merged_user_id",PENDING_MERGE:"websdk_pending_merge",SESSION_NUMBER:"websdk_session_number"};function so(t,n,r){var i=eo[t],e=[];return n&&e.push(n),r&&e.push(r),e.length>0?"".concat(e.join("_"),"_").concat(i):i}var uo,oo="websdk_storage_test",ao="test_value",co="INIT_ERROR",fo="AUTH_ERROR",ho="NETWORK_ERROR",vo="EVENT_ERROR",lo="VISITOR_CONFIG_ERROR",go="WebSDK initialized successfully",wo="Failed to initialize WebSDK",mo="WebSDK destroyed successfully",po="EventTracker initialized successfully",yo="EventTracker destroyed successfully",bo="Failed to track event",Eo="Events sent successfully",Io="Failed to send events",So="Failed to initialize storage:",To="Storage test failed:",ko="Storage read/write test failed",Ro="StorageManager destroyed successfully",Ao="Error during storage cleanup:",_o="New session started",Oo="Session continued",Co="Session expired due to inactivity",Do="Session ended on user switch (different user login)",No="Session restored from storage",Fo="Failed to track user signin event",Po="Failed to track user signup event",Mo="Failed to track user update event",xo="Failed to track user signout event",Uo="Failed to track behavioral event",jo="VisitorConfigManager initialized successfully",Vo="Visitor config fetched successfully",Lo="Failed to fetch visitor config",zo="Visitor tracking is disabled",Bo="Visitor tracking is enabled",Go="Visitor config retrieved from cache",Wo="AnonymousVisitorManager initialized successfully",qo="Visitor ID generated successfully",Ho="Failed to generate visitor ID",Ko="Visitor ID restored from storage",Xo="Using cached visitor ID",$o="Visitor updated successfully",Qo="Failed to update visitor",Jo="Visitor merged with user successfully",Yo="Failed to merge visitor with user",Zo="Visitor merge skipped",ta="Notification permission denied by user",na="Notification manager initialized successfully",ra="Failed to initialize notification manager",ia="Notification initialization skipped (disabled or not supported)",ea="Firebase initialized successfully",sa="Failed to initialize Firebase",ua="FCM token received successfully",oa="FCM token refreshed",aa="Failed to retrieve FCM token",ca="Service worker registered successfully",fa="Failed to register service worker",ha="DLR events sent successfully",da="Failed to send DLR events",va="web",la="user_signin",ga="user_update",wa="user_signout",ma=30,pa=3e3,ya={WEBPUSH:"WEBPUSH"},ba={WEB:"web"},Ea={ACCOUNT_NOT_EXISTS:2432,ACCOUNT_ID_NOT_PASSED:9999},Ia={ALREADY_MERGED:"1429",VISITOR_NOT_FOUND:"1428"},Sa={NOTIFICATION_RECEIVED:"push_notification_received",NOTIFICATION_CLICKED:"push_notification_click",NOTIFICATION_DISMISSED:"push_notification_close"},Ta="fcm",ka="push",Ra="1.1.0",Aa={};!function(){if(uo)return Aa;uo=1;var t=V(),n=fr().EXISTS,r=Nt(),i=bs(),e=Function.prototype,s=r(e.toString),u=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,o=r(u.exec);t&&!n&&i(e,"name",{configurable:!0,get:function(){try{return o(u,s(this))[1]}catch(t){return""}}})}();var _a,Oa,Ca,Da,Na,Fa,Pa,Ma,xa,Ua={};function ja(){if(Oa)return _a;Oa=1;var t=Ci(),n=String;return _a=function(r){if("Symbol"===t(r))throw new TypeError("Cannot convert a Symbol value to a string");return n(r)}}function Va(){return Da?Ca:(Da=1,Ca="\t\n\v\f\r \u2028\u2029\ufeff")}function La(){if(Fa)return Na;Fa=1;var t=Nt(),n=xt(),r=ja(),i=Va(),e=t("".replace),s=RegExp("^["+i+"]+"),u=RegExp("(^|[^"+i+"])["+i+"]+$"),o=function(t){return function(i){var o=r(n(i));return 1&t&&(o=e(o,s,"")),2&t&&(o=e(o,u,"$1")),o}};return Na={start:o(1),end:o(2),trim:o(3)}}!function(){if(xa)return Ua;xa=1;var t=Ti(),n=La().trim,r=function(){if(Ma)return Pa;Ma=1;var t=fr().PROPER,n=j(),r=Va();return Pa=function(i){return n(function(){return!!r[i]()||"
"!=="
"[i]()||t&&r[i].name!==i})}}();t({target:"String",proto:!0,forced:r("trim")},{trim:function(){return n(this)}})}();var za,Ba,Ga,Wa,qa,Ha,Ka,Xa,$a,Qa,Ja,Ya={};function Za(){if(Ba)return za;Ba=1;var t=qn();return za=function(){var n=t(this),r="";return n.hasIndices&&(r+="d"),n.global&&(r+="g"),n.ignoreCase&&(r+="i"),n.multiline&&(r+="m"),n.dotAll&&(r+="s"),n.unicode&&(r+="u"),n.unicodeSets&&(r+="v"),n.sticky&&(r+="y"),r}}function tc(){if(Wa)return Ga;Wa=1;var t=j(),n=_().RegExp,r=t(function(){var t=n("a","y");return t.lastIndex=2,null!==t.exec("abcd")}),i=r||t(function(){return!n("a","y").sticky}),e=r||t(function(){var t=n("^r","gy");return t.lastIndex=2,null!==t.exec("str")});return Ga={BROKEN_CARET:e,MISSED_STICKY:i,UNSUPPORTED_Y:r}}function nc(){if(Ha)return qa;Ha=1;var t=j(),n=_().RegExp;return qa=t(function(){var t=n(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})}function rc(){if(Xa)return Ka;Xa=1;var t=j(),n=_().RegExp;return Ka=t(function(){var t=n("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})}function ic(){if(Qa)return $a;Qa=1;var t,n,r=z(),i=Nt(),e=ja(),s=Za(),u=tc(),o=Rn(),a=$i(),c=lr().get,f=nc(),h=rc(),d=o("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,l=v,g=i("".charAt),w=i("".indexOf),m=i("".replace),p=i("".slice),y=(n=/b*/g,r(v,t=/a/,"a"),r(v,n,"a"),0!==t.lastIndex||0!==n.lastIndex),b=u.BROKEN_CARET,E=void 0!==/()??/.exec("")[1],I=function(t,n){for(var r=t.groups=a(null),i=0;i<n.length;i++){var e=n[i];r[e[0]]=t[e[1]]}};return(y||E||b||f||h)&&(l=function(t){var n,i,u,o=this,a=c(o),f=e(t),h=a.raw;if(h)return h.lastIndex=o.lastIndex,n=r(l,h,f),o.lastIndex=h.lastIndex,n&&a.groups&&I(n,a.groups),n;var S=a.groups,T=b&&o.sticky,k=r(s,o),R=o.source,A=0,_=f;if(T){k=m(k,"y",""),-1===w(k,"g")&&(k+="g"),_=p(f,o.lastIndex);var O=o.lastIndex>0&&g(f,o.lastIndex-1);o.lastIndex>0&&(!o.multiline||o.multiline&&"\n"!==O&&"\r"!==O&&"\u2028"!==O&&"\u2029"!==O)&&(R="(?: (?:"+R+"))",_=" "+_,A++),i=new RegExp("^(?:"+R+")",k)}E&&(i=new RegExp("^"+R+"$(?!\\s)",k)),y&&(u=o.lastIndex);var C=r(v,T?i:o,_);return T?C?(C.input=f,C[0]=p(C[0],A),C.index=o.lastIndex,o.lastIndex+=C[0].length):o.lastIndex=0:y&&C&&(o.lastIndex=o.global?C.index+C[0].length:u),E&&C&&C.length>1&&r(d,C[0],i,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(C[t]=void 0)}),C&&S&&I(C,S),C}),$a=l}function ec(){if(Ja)return Ya;Ja=1;var t=Ti(),n=ic();return t({target:"RegExp",proto:!0,forced:/./.exec!==n},{exec:n}),Ya}ec();var sc,uc,oc,ac,cc,fc,hc,dc={};function vc(){if(uc)return sc;uc=1;var t=Vt(),n=Ft(),r=Cn()("match");return sc=function(i){var e;return t(i)&&(void 0!==(e=i[r])?!!e:"RegExp"===n(i))}}function lc(){if(ac)return oc;ac=1;var t=vc(),n=TypeError;return oc=function(r){if(t(r))throw new n("The method doesn't accept regular expressions");return r}}function gc(){if(fc)return cc;fc=1;var t=Cn()("match");return cc=function(n){var r=/./;try{"/./"[n](r)}catch(i){try{return r[t]=!1,"/./"[n](r)}catch(t){}}return!1}}!function(){if(hc)return dc;hc=1;var t=Ti(),n=Nt(),r=lc(),i=xt(),e=ja(),s=gc(),u=n("".indexOf);t({target:"String",proto:!0,forced:!s("includes")},{includes:function(t){return!!~u(e(i(this)),e(r(t)),arguments.length>1?arguments[1]:void 0)}})}();var wc,mc,pc,yc,bc,Ec,Ic,Sc,Tc,kc,Rc,Ac,_c,Oc,Cc,Dc={};function Nc(){if(mc)return wc;mc=1,ec();var t=z(),n=wr(),r=ic(),i=j(),e=Cn(),s=Kn(),u=e("species"),o=RegExp.prototype;return wc=function(a,c,f,h){var d=e(a),v=!i(function(){var t={};return t[d]=function(){return 7},7!==""[a](t)}),l=v&&!i(function(){var t=!1,n=/a/;if("split"===a){var r={};r[u]=function(){return n},(n={constructor:r,flags:""})[d]=/./[d]}return n.exec=function(){return t=!0,null},n[d](""),!t});if(!v||!l||f){var g=/./[d],w=c(d,""[a],function(n,i,e,s,u){var a=i.exec;return a===r||a===o.exec?v&&!u?{done:!0,value:t(g,i,e,s)}:{done:!0,value:t(n,e,i,s)}:{done:!1}});n(String.prototype,a,w[0]),n(o,d,w[1])}h&&s(o[d],"sham",!0)},wc}function Fc(){if(yc)return pc;yc=1;var t=Nt(),n=Mr(),r=ja(),i=xt(),e=t("".charAt),s=t("".charCodeAt),u=t("".slice),o=function(t){return function(o,a){var c,f,h=r(i(o)),d=n(a),v=h.length;return d<0||d>=v?t?"":void 0:(c=s(h,d))<55296||c>56319||d+1===v||(f=s(h,d+1))<56320||f>57343?t?e(h,d):c:t?u(h,d,d+2):f-56320+(c-55296<<10)+65536}};return pc={codeAt:o(!1),charAt:o(!0)}}function Pc(){if(Ec)return bc;Ec=1;var t=Fc().charAt;return bc=function(n,r,i){return r+(i&&t(n,r).length||1)}}function Mc(){if(Sc)return Ic;Sc=1;var t=Nt(),n=An(),r=Math.floor,i=t("".charAt),e=t("".replace),s=t("".slice),u=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,o=/\$([$&'`]|\d{1,2})/g;return Ic=function(t,a,c,f,h,d){var v=c+t.length,l=f.length,g=o;return void 0!==h&&(h=n(h),g=u),e(d,g,function(n,e){var u;switch(i(e,0)){case"$":return"$";case"&":return t;case"`":return s(a,0,c);case"'":return s(a,v);case"<":u=h[s(e,1,-1)];break;default:var o=+e;if(0===o)return n;if(o>l){var d=r(o/10);return 0===d?n:d<=l?void 0===f[d-1]?i(e,1):f[d-1]+i(e,1):n}u=f[o-1]}return void 0===u?"":u})}}function xc(){if(Ac)return Rc;Ac=1;var t=z(),n=_n(),r=zt(),i=function(){if(kc)return Tc;kc=1;var t=_(),n=j(),r=t.RegExp,i=!n(function(){var t=!0;try{r(".","d")}catch(n){t=!1}var n={},i="",e=t?"dgimsy":"gimsy",s=function(t,r){Object.defineProperty(n,t,{get:function(){return i+=r,!0}})},u={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in t&&(u.hasIndices="d"),u)s(o,u[o]);return Object.getOwnPropertyDescriptor(r.prototype,"flags").get.call(n)!==e||i!==e});return Tc={correct:i}}(),e=Za(),s=RegExp.prototype;return Rc=i.correct?function(t){return t.flags}:function(u){return i.correct||!r(s,u)||n(u,"flags")?u.flags:t(e,u)}}function Uc(){if(Oc)return _c;Oc=1;var t=z(),n=qn(),r=jt(),i=Ft(),e=ic(),s=TypeError;return _c=function(u,o){var a=u.exec;if(r(a)){var c=t(a,u,o);return null!==c&&n(c),c}if("RegExp"===i(u))return t(e,u,o);throw new s("RegExp#exec called on incompatible receiver")}}!function(){if(Cc)return Dc;Cc=1;var t=ks(),n=z(),r=Nt(),i=Nc(),e=j(),s=qn(),u=jt(),o=Vt(),a=Mr(),c=Ur(),f=ja(),h=xt(),d=Pc(),v=$t(),l=Mc(),g=xc(),w=Uc(),m=Cn()("replace"),p=Math.max,y=Math.min,b=r([].concat),E=r([].push),I=r("".indexOf),S=r("".slice),T=function(t){return void 0===t?t:String(t)},k="$0"==="a".replace(/./,"$0"),R=!!/./[m]&&""===/./[m]("a","$0");i("replace",function(r,i,e){var k=R?"$":"$0";return[function(t,r){var e=h(this),s=o(t)?v(t,m):void 0;return s?n(s,t,e,r):n(i,f(e),t,r)},function(n,r){var o=s(this),h=f(n),v=u(r);v||(r=f(r));var m=f(g(o));if("string"==typeof r&&!~I(r,k)&&!~I(r,"$<")&&!~I(m,"y")){var R=e(i,o,h,r);if(R.done)return R.value}var A,_=!!~I(m,"g");_&&(A=!!~I(m,"u")||!!~I(m,"v"),o.lastIndex=0);for(var O,C=[];null!==(O=w(o,h))&&(E(C,O),_);){""===f(O[0])&&(o.lastIndex=d(h,c(o.lastIndex),A))}for(var D="",N=0,F=0;F<C.length;F++){for(var P,M=f((O=C[F])[0]),x=p(y(a(O.index),h.length),0),U=[],j=1;j<O.length;j++)E(U,T(O[j]));var V=O.groups;if(v){var L=b([M],U,x,h);void 0!==V&&E(L,V),P=f(t(r,void 0,L))}else P=l(M,h,x,U,V,r);x>=N&&(D+=S(h,N,x)+P,N=x+M.length)}return D+S(h,N)}]},!!e(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})||!k||R)}();var jc,Vc={};!function(){if(jc)return Vc;jc=1;var t,n=Ti(),r=Rs(),i=Mn().f,e=Ur(),s=ja(),u=lc(),o=xt(),a=gc(),c=Sn(),f=r("".slice),h=Math.min,d=a("startsWith");n({target:"String",proto:!0,forced:!!(c||d||(t=i(String.prototype,"startsWith"),!t||t.writable))&&!d},{startsWith:function(t){var n=s(o(this));u(t);var r=s(t),i=e(h(arguments.length>1?arguments[1]:void 0,n.length));return f(n,i,i+r.length)===r}})}();var Lc,zc,Bc,Gc,Wc,qc,Hc,Kc,Xc,$c,Qc,Jc,Yc,Zc,tf,nf,rf,ef=function(){function t(t){this.baseUrl=t.baseUrl.replace(/\/$/,"")}return t.prototype.request=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i,e,s,u,o,a,c,f,h,d;return void 0===n&&(n={}),Gu(this,function(v){switch(v.label){case 0:r=n.method,i=void 0===r?"GET":r,e=n.headers,s=void 0===e?{}:e,u=n.body,o=!t||t.startsWith("/")?t:"/".concat(t),a="".concat(this.baseUrl).concat(o),v.label=1;case 1:return v.trys.push([1,6,,7]),c={method:i,headers:zu({"Content-Type":"application/json"},s),body:u?JSON.stringify(u):null},[4,fetch(a,c)];case 2:return(f=v.sent()).ok?[3,4]:[4,f.text()];case 3:throw h=v.sent(),new Error("HTTP ".concat(f.status,": ").concat(f.statusText," - ").concat(h));case 4:return[4,f.json()];case 5:return[2,v.sent()];case 6:throw d=v.sent(),this.handleError(d);case 7:return[2]}})})},t.prototype.handleError=function(t){return t instanceof Error?"AbortError"===t.name?{code:ho,message:"Request timeout",details:t}:t.message.includes("HTTP 401")||t.message.includes("HTTP 403")?{code:fo,message:"Authentication failed",details:t}:(t.message.includes("HTTP"),{code:ho,message:t.message,details:t}):{code:ho,message:"Unknown error: ".concat(String(t)),details:t}},t.prototype.get=function(t){return Bu(this,arguments,void 0,function(t,n){return void 0===n&&(n={}),Gu(this,function(r){return[2,this.request(t,zu(zu({},n),{method:"GET"}))]})})},t.prototype.post=function(t,n){return Bu(this,arguments,void 0,function(t,n,r){return void 0===r&&(r={}),Gu(this,function(i){return[2,this.request(t,zu(zu({},r),{method:"POST",body:n}))]})})},t.prototype.put=function(t,n){return Bu(this,arguments,void 0,function(t,n,r){return void 0===r&&(r={}),Gu(this,function(i){return[2,this.request(t,zu(zu({},r),{method:"PUT",body:n}))]})})},t.prototype.delete=function(t){return Bu(this,arguments,void 0,function(t,n){return void 0===n&&(n={}),Gu(this,function(r){return[2,this.request(t,zu(zu({},n),{method:"DELETE"}))]})})},t}(),sf={};function uf(){return zc?Lc:(zc=1,Lc=Object.is||function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n})}function of(){if(Hc)return qc;Hc=1;var t=_n(),n=jt(),r=An(),i=dr(),e=function(){if(Wc)return Gc;Wc=1;var t=j();return Gc=!t(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})}(),s=i("IE_PROTO"),u=Object,o=u.prototype;return qc=e?u.getPrototypeOf:function(i){var e=r(i);if(t(e,s))return e[s];var a=e.constructor;return n(a)&&e instanceof a?a.prototype:e instanceof u?o:null}}function af(){if(Xc)return Kc;Xc=1;var t,n,r,i=j(),e=jt(),s=Vt(),u=$i(),o=of(),a=wr(),c=Cn(),f=Sn(),h=c("iterator"),d=!1;return[].keys&&("next"in(r=[].keys())?(n=o(o(r)))!==Object.prototype&&(t=n):d=!0),!s(t)||i(function(){var n={};return t[h].call(n)!==n})?t={}:f&&(t=u(t)),e(t[h])||a(t,h,function(){return this}),Kc={IteratorPrototype:t,BUGGY_SAFARI_ITERATORS:d}}function cf(){if(Qc)return $c;Qc=1;var t=af().IteratorPrototype,n=$i(),r=Dt(),i=ys(),e=ou(),s=function(){return this};return $c=function(u,o,a,c){var f=o+" Iterator";return u.prototype=n(t,{next:r(+!c,a)}),i(u,f,!1,!0),e[f]=s,u}}function ff(){if(Yc)return Jc;Yc=1;var t=Ti(),n=z(),r=Sn(),i=fr(),e=jt(),s=cf(),u=of(),o=ps(),a=ys(),c=Kn(),f=wr(),h=Cn(),d=ou(),v=af(),l=i.PROPER,g=i.CONFIGURABLE,w=v.IteratorPrototype,m=v.BUGGY_SAFARI_ITERATORS,p=h("iterator"),y="keys",b="values",E="entries",I=function(){return this};return Jc=function(i,h,v,S,T,k,R){s(v,h,S);var A,_,O,C=function(t){if(t===T&&M)return M;if(!m&&t&&t in F)return F[t];switch(t){case y:case b:case E:return function(){return new v(this,t)}}return function(){return new v(this)}},D=h+" Iterator",N=!1,F=i.prototype,P=F[p]||F["@@iterator"]||T&&F[T],M=!m&&P||C(T),x="Array"===h&&F.entries||P;if(x&&(A=u(x.call(new i)))!==Object.prototype&&A.next&&(r||u(A)===w||(o?o(A,w):e(A[p])||f(A,p,I)),a(A,D,!0,!0),r&&(d[D]=I)),l&&T===b&&P&&P.name!==b&&(!r&&g?c(F,"name",b):(N=!0,M=function(){return n(P,this)})),T)if(_={values:C(b),keys:k?M:C(y),entries:C(E)},R)for(O in _)(m||N||!(O in F))&&f(F,O,_[O]);else t({target:h,proto:!0,forced:m||N},_);return r&&!R||F[p]===M||f(F,p,M,{name:T}),d[h]=M,_},Jc}function hf(){return tf?Zc:(tf=1,Zc=function(t,n){return{value:t,done:n}})}function df(){if(rf)return nf;rf=1;var t=Ut(),n=Qi(),r=ou(),i=lr(),e=Hn().f,s=ff(),u=hf(),o=Sn(),a=V(),c="Array Iterator",f=i.set,h=i.getterFor(c);nf=s(Array,"Array",function(n,r){f(this,{type:c,target:t(n),index:0,kind:r})},function(){var t=h(this),n=t.target,r=t.index++;if(!n||r>=n.length)return t.target=null,u(void 0,!0);switch(t.kind){case"keys":return u(r,!1);case"values":return u(n[r],!1)}return u([r,n[r]],!1)},"values");var d=r.Arguments=r.Array;if(n("keys"),n("values"),n("entries"),!o&&a&&"values"!==d.name)try{e(d,"name",{value:"values"})}catch(t){}return nf}!function(){if(Bc)return sf;Bc=1;var t=z(),n=Nc(),r=qn(),i=Vt(),e=xt(),s=uf(),u=ja(),o=$t(),a=Uc();n("search",function(n,c,f){return[function(r){var s=e(this),a=i(r)?o(r,n):void 0;return a?t(a,r,s):new RegExp(r)[n](u(s))},function(t){var n=r(this),i=u(t),e=f(c,n,i);if(e.done)return e.value;var o=n.lastIndex;s(o,0)||(n.lastIndex=0);var h=a(n,i);return s(n.lastIndex,o)||(n.lastIndex=o),null===h?-1:h.index}]})}(),df();var vf,lf,gf,wf,mf,pf={};function yf(){if(lf)return vf;lf=1;var t=jt(),n=Vt(),r=ps();return vf=function(i,e,s){var u,o;return r&&t(u=e.constructor)&&u!==s&&n(o=u.prototype)&&o!==s.prototype&&r(i,o),i}}function bf(){if(wf)return gf;wf=1;var t=Hn().f;return gf=function(n,r,i){i in n||t(n,i,{configurable:!0,get:function(){return r[i]},set:function(t){r[i]=t}})}}!function(){if(mf)return pf;mf=1;var t=V(),n=_(),r=Nt(),i=Si(),e=yf(),s=Kn(),u=$i(),o=Br().f,a=zt(),c=vc(),f=ja(),h=xc(),d=tc(),v=bf(),l=wr(),g=j(),w=_n(),m=lr().enforce,p=Es(),y=Cn(),b=nc(),E=rc(),I=y("match"),S=n.RegExp,T=S.prototype,k=n.SyntaxError,R=r(T.exec),A=r("".charAt),O=r("".replace),C=r("".indexOf),D=r("".slice),N=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,F=/a/g,P=/a/g,M=new S(F)!==F,x=d.MISSED_STICKY,U=d.UNSUPPORTED_Y,L=t&&(!M||x||b||E||g(function(){return P[I]=!1,S(F)!==F||S(P)===P||"/a/i"!==String(S(F,"i"))}));if(i("RegExp",L)){for(var z=function(t,n){var r,i,o,d,v,l,g=a(T,this),p=c(t),y=void 0===n,I=[],_=t;if(!g&&p&&y&&t.constructor===z)return t;if((p||a(T,t))&&(t=t.source,y&&(n=h(_))),t=void 0===t?"":f(t),n=void 0===n?"":f(n),_=t,b&&"dotAll"in F&&(i=!!n&&C(n,"s")>-1)&&(n=O(n,/s/g,"")),r=n,x&&"sticky"in F&&(o=!!n&&C(n,"y")>-1)&&U&&(n=O(n,/y/g,"")),E&&(d=function(t){for(var n,r=t.length,i=0,e="",s=[],o=u(null),a=!1,c=!1,f=0,h="";i<r;i++){if("\\"===(n=A(t,i))){if(n+=A(t,++i),!c&&"\\"===A(n,1)){e+="\\x5c";continue}}else if("]"===n)a=!1;else if(!a)switch(!0){case"["===n:a=!0;break;case"("===n:e+=n,R(N,D(t,i+1))?(i+=2,c=!0,f++):"?"!==A(t,i+1)&&f++;continue;case">"===n&&c:if(""===h||w(o,h))throw new k("Invalid capture group name");o[h]=!0,s[s.length]=[h,f],c=!1,h="";continue}c?h+=n:e+=n}for(var d=0;d<s.length;d++)for(var v="\\k<"+s[d][0]+">",l="\\"+s[d][1];C(e,v)>-1;)e=O(e,v,l);return[e,s]}(t),t=d[0],I=d[1]),v=e(S(t,n),g?this:T,z),(i||o||I.length)&&(l=m(v),i&&(l.dotAll=!0,l.raw=z(function(t){for(var n,r=t.length,i=0,e="",s=!1;i<r;i++)"\\"!==(n=A(t,i))?s||"."!==n?("["===n?s=!0:"]"===n&&(s=!1),e+=n):e+="[\\s\\S]":e+=n+A(t,++i);return e}(t),r)),o&&(l.sticky=!0),I.length&&(l.groups=I)),t!==_)try{s(v,"source",""===_?"(?:)":_)}catch(t){}return v},B=o(S),G=0;B.length>G;)v(z,S,B[G++]);T.constructor=z,z.prototype=T,l(n,"RegExp",z,{constructor:!0})}p("RegExp")}();var Ef,If={};!function(){if(Ef)return If;Ef=1;var t=fr().PROPER,n=wr(),r=qn(),i=ja(),e=j(),s=xc(),u="toString",o=RegExp.prototype,a=o[u],c=e(function(){return"/a/b"!==a.call({source:"a",flags:"b"})}),f=t&&a.name!==u;(c||f)&&n(o,u,function(){var t=r(this);return"/"+i(t.source)+"/"+i(s(t))},{unsafe:!0})}();var Sf,Tf={};function kf(){if(Sf)return Tf;Sf=1;var t=Fc().charAt,n=ja(),r=lr(),i=ff(),e=hf(),s="String Iterator",u=r.set,o=r.getterFor(s);return i(String,"String",function(t){u(this,{type:s,string:n(t),index:0})},function(){var n,r=o(this),i=r.string,s=r.index;return s>=i.length?e(void 0,!0):(n=t(i,s),r.index+=n.length,e(n,!1))}),Tf}kf();var Rf,Af={};!function(){if(Rf)return Af;Rf=1;var t=z(),n=Nt(),r=Nc(),i=qn(),e=Vt(),s=Ur(),u=ja(),o=xt(),a=$t(),c=Pc(),f=xc(),h=Uc(),d=n("".indexOf);r("match",function(n,r,v){return[function(r){var i=o(this),s=e(r)?a(r,n):void 0;return s?t(s,r,i):new RegExp(r)[n](u(i))},function(t){var n=i(this),e=u(t),o=v(r,n,e);if(o.done)return o.value;var a=u(f(n));if(!~d(a,"g"))return h(n,e);var l=!!~d(a,"u")||!!~d(a,"v");n.lastIndex=0;for(var g,w=[],m=0;null!==(g=h(n,e));){var p=u(g[0]);w[m]=p,""===p&&(n.lastIndex=c(e,s(n.lastIndex),l)),m++}return 0===m?null:w}]})}();var _f,Of={};!function(){if(_f)return Of;_f=1;var t=_(),n=Uu(),r=ju(),i=df(),e=Kn(),s=ys(),u=Cn()("iterator"),o=i.values,a=function(t,r){if(t){if(t[u]!==o)try{e(t,u,o)}catch(n){t[u]=o}if(s(t,r,!0),n[r])for(var a in i)if(t[a]!==i[a])try{e(t,a,i[a])}catch(n){t[a]=i[a]}}};for(var c in n)a(t[c]&&t[c].prototype,c);a(r,"DOMTokenList")}();var Cf,Df,Nf,Ff,Pf,Mf,xf,Uf,jf,Vf,Lf={};function zf(){if(Df)return Cf;Df=1;var t=j(),n=Cn(),r=V(),i=Sn(),e=n("iterator");return Cf=!t(function(){var t=new URL("b?a=1&b=2&c=3","https://a"),n=t.searchParams,s=new URLSearchParams("a=1&a=2&b=3"),u="";return t.pathname="c%20d",n.forEach(function(t,r){n.delete("b"),u+=r+t}),s.delete("a",2),s.delete("b",void 0),i&&(!t.toJSON||!s.has("a",1)||s.has("a",2)||!s.has("a",void 0)||s.has("b"))||!n.size&&(i||!r)||!n.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==n.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!n[e]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==u||"x"!==new URL("https://x",void 0).host})}function Bf(){if(Mf)return Pf;Mf=1;var t=qn(),n=hu();return Pf=function(r,i,e,s){try{return s?i(t(e)[0],e[1]):i(e)}catch(t){n(r,"throw",t)}}}function Gf(){if(Uf)return xf;Uf=1;var t=As(),n=z(),r=An(),i=Bf(),e=au(),s=Di(),u=jr(),o=Ai(),a=_i(),c=fu(),f=cu(),h=hu(),d=Array;return xf=function(v){var l=s(this),g=arguments.length,w=g>1?arguments[1]:void 0,m=void 0!==w;m&&(w=t(w,g>2?arguments[2]:void 0));var p,y,b,E,I,S,T=r(v),k=f(T),R=0;if(!k||this===d&&e(k))for(p=u(T),y=l?new this(p):d(p);p>R;R++)S=m?w(T[R],R):T[R],o(y,R,S);else for(y=l?new this:[],I=(E=c(T,k)).next;!(b=n(I,E)).done;R++){S=m?i(E,w,[b.value,R],!0):b.value;try{o(y,R,S)}catch(t){h(E,"throw",t)}}return a(y,R),y},xf}function Wf(){if(Vf)return jf;Vf=1;var t=Nt(),n=2147483647,r=/[^\0-\u007E]/,i=/[.\u3002\uFF0E\uFF61]/g,e="Overflow: input needs wider integers to process",s=RangeError,u=t(i.exec),o=Math.floor,a=String.fromCharCode,c=t("".charCodeAt),f=t([].join),h=t([].push),d=t("".replace),v=t("".split),l=t("".toLowerCase),g=function(t){return t+22+75*(t<26)},w=function(t,n,r){var i=0;for(t=r?o(t/700):t>>1,t+=o(t/n);t>455;)t=o(t/35),i+=36;return o(i+36*t/(t+38))},m=function(t){var r=[];t=function(t){for(var n=[],r=0,i=t.length;r<i;){var e=c(t,r++);if(e>=55296&&e<=56319&&r<i){var s=c(t,r++);56320==(64512&s)?h(n,((1023&e)<<10)+(1023&s)+65536):(h(n,e),r--)}else h(n,e)}return n}(t);var i,u,d=t.length,v=128,l=0,m=72;for(i=0;i<t.length;i++)(u=t[i])<128&&h(r,a(u));var p=r.length,y=p;for(p&&h(r,"-");y<d;){var b=n;for(i=0;i<t.length;i++)(u=t[i])>=v&&u<b&&(b=u);var E=y+1;if(b-v>o((n-l)/E))throw new s(e);for(l+=(b-v)*E,v=b,i=0;i<t.length;i++){if((u=t[i])<v&&++l>n)throw new s(e);if(u===v){for(var I=l,S=36;;){var T=S<=m?1:S>=m+26?26:S-m;if(I<T)break;var k=I-T,R=36-T;h(r,a(g(T+k%R))),I=o(k/R),S+=36}h(r,a(g(I))),m=w(l,E,y===p),l=0,y++}}l++,v++}return f(r,"")};return jf=function(t){var n,e,s=[],o=v(d(l(t),i,"."),".");for(n=0;n<o.length;n++)e=o[n],h(s,u(r,e)?"xn--"+m(e):e);return f(s,".")}}var qf,Hf,Kf,Xf,$f,Qf,Jf,Yf,Zf,th={};function nh(){if(Kf)return Hf;Kf=1;var t=wr();return Hf=function(n,r,i){for(var e in r)t(n,e,r[e],i);return n}}function rh(){if($f)return Xf;$f=1;var t=_s(),n=Math.floor,r=function(i,e){var s=i.length;if(s<8)for(var u,o,a=1;a<s;){for(o=a,u=i[a];o&&e(i[o-1],u)>0;)i[o]=i[--o];o!==a++&&(i[o]=u)}else for(var c=n(s/2),f=r(t(i,0,c),e),h=r(t(i,c),e),d=f.length,v=h.length,l=0,g=0;l<d||g<v;)i[l+g]=l<d&&g<v?e(f[l],h[g])<=0?f[l++]:h[g++]:l<d?f[l++]:h[g++];return i};return Xf=r}function ih(){if(Jf)return Qf;Jf=1,df(),function(){if(qf)return th;qf=1;var t=Ti(),n=Nt(),r=xr(),i=RangeError,e=String.fromCharCode,s=String.fromCodePoint,u=n([].join);t({target:"String",stat:!0,arity:1,forced:!!s&&1!==s.length},{fromCodePoint:function(t){for(var n,s=[],o=arguments.length,a=0;o>a;){if(r(n=+arguments[a],1114111)!==n)throw new i(n+" is not a valid code point");s[a++]=n<65536?e(n):e(55296+((n-=65536)>>10),n%1024+56320)}return u(s,"")}})}();var t=Ti(),n=_(),r=Ns(),i=Lt(),e=z(),s=Nt(),u=V(),o=zf(),a=wr(),c=bs(),f=nh(),h=ys(),d=cf(),v=lr(),l=Is(),g=jt(),w=_n(),m=As(),p=Ci(),y=qn(),b=Vt(),E=ja(),I=$i(),S=Dt(),T=fu(),k=cu(),R=hf(),A=Os(),O=Cn(),C=rh(),D=O("iterator"),N="URLSearchParams",F=N+"Iterator",P=v.set,M=v.getterFor(N),x=v.getterFor(F),U=r("fetch"),j=r("Request"),L=r("Headers"),B=j&&j.prototype,G=L&&L.prototype,W=n.TypeError,q=n.encodeURIComponent,H=String.fromCharCode,K=i("String","fromCodePoint"),X=parseInt,$=s("".charAt),Q=s([].join),J=s([].push),Y=s("".replace),Z=s([].shift),tt=s([].splice),nt=s("".split),rt=s("".slice),it=s(/./.exec),et=/\+/g,st=/^[0-9a-f]+$/i,ut=function(t,n){var r=rt(t,n,n+2);return it(st,r)?X(r,16):NaN},ot=function(t){for(var n=0,r=128;r>0&&0!==(t&r);r>>=1)n++;return n},at=function(t){var n=null,r=t.length;switch(r){case 1:n=t[0];break;case 2:n=(31&t[0])<<6|63&t[1];break;case 3:n=(15&t[0])<<12|(63&t[1])<<6|63&t[2];break;case 4:n=(7&t[0])<<18|(63&t[1])<<12|(63&t[2])<<6|63&t[3]}return null===n||n>1114111||n>=55296&&n<=57343||n<(r>3?65536:r>2?2048:r>1?128:0)?null:n},ct=function(t){for(var n=(t=Y(t,et," ")).length,r="",i=0;i<n;){var e=$(t,i);if("%"===e){if("%"===$(t,i+1)||i+3>n){r+="%",i++;continue}var s=ut(t,i+1);if(s!=s){r+=e,i++;continue}i+=2;var u=ot(s);if(0===u)e=H(s);else{if(1===u||u>4){r+="�",i++;continue}for(var o=[s],a=1;a<u&&!(++i+3>n||"%"!==$(t,i));){var c=ut(t,i+1);if(c!=c||c>191||c<128)break;if(1===a){if(224===s&&c<160)break;if(237===s&&c>159)break;if(240===s&&c<144)break;if(244===s&&c>143)break}J(o,c),i+=2,a++}if(o.length!==u){r+="�";continue}var f=at(o);if(null===f){for(var h=0;h<u;h++)r+="�";i++;continue}e=K(f)}}r+=e,i++}return r},ft=/[!'()~]|%20/g,ht={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},dt=function(t){return ht[t]},vt=function(t){return Y(q(t),ft,dt)},lt=d(function(t,n){P(this,{type:F,target:M(t).entries,index:0,kind:n})},N,function(){var t=x(this),n=t.target,r=t.index++;if(!n||r>=n.length)return t.target=null,R(void 0,!0);var i=n[r];switch(t.kind){case"keys":return R(i.key,!1);case"values":return R(i.value,!1)}return R([i.key,i.value],!1)},!0),gt=function(t){this.entries=[],this.url=null,void 0!==t&&(b(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===$(t,0)?rt(t,1):t:E(t)))};gt.prototype={type:N,bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var n,r,i,s,u,o,a,c=this.entries,f=k(t);if(f)for(r=(n=T(t,f)).next;!(i=e(r,n)).done;){if(u=(s=T(y(i.value))).next,(o=e(u,s)).done||(a=e(u,s)).done||!e(u,s).done)throw new W("Expected sequence with length 2");J(c,{key:E(o.value),value:E(a.value)})}else for(var h in t)w(t,h)&&J(c,{key:h,value:E(t[h])})},parseQuery:function(t){if(t)for(var n,r,i=this.entries,e=nt(t,"&"),s=0;s<e.length;)(n=e[s++]).length&&(r=nt(n,"="),J(i,{key:ct(Z(r)),value:ct(Q(r,"="))}))},serialize:function(){for(var t,n=this.entries,r=[],i=0;i<n.length;)t=n[i++],J(r,vt(t.key)+"="+vt(t.value));return Q(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var wt=function(){l(this,mt);var t=P(this,new gt(arguments.length>0?arguments[0]:void 0));u||(this.size=t.entries.length)},mt=wt.prototype;if(f(mt,{append:function(t,n){var r=M(this);A(arguments.length,2),J(r.entries,{key:E(t),value:E(n)}),u||this.size++,r.updateURL()},delete:function(t){for(var n=M(this),r=A(arguments.length,1),i=n.entries,e=E(t),s=r<2?void 0:arguments[1],o=void 0===s?s:E(s),a=0;a<i.length;){var c=i[a];c.key!==e||void 0!==o&&c.value!==o?a++:tt(i,a,1)}u||(this.size=i.length),n.updateURL()},get:function(t){var n=M(this).entries;A(arguments.length,1);for(var r=E(t),i=0;i<n.length;i++)if(n[i].key===r)return n[i].value;return null},getAll:function(t){var n=M(this).entries;A(arguments.length,1);for(var r=E(t),i=[],e=0;e<n.length;e++)n[e].key===r&&J(i,n[e].value);return i},has:function(t){for(var n=M(this).entries,r=A(arguments.length,1),i=E(t),e=r<2?void 0:arguments[1],s=void 0===e?e:E(e),u=0;u<n.length;){var o=n[u++];if(o.key===i&&(void 0===s||o.value===s))return!0}return!1},set:function(t,n){var r=M(this);A(arguments.length,2);for(var i,e=r.entries,s=!1,o=E(t),a=E(n),c=0;c<e.length;c++)(i=e[c]).key===o&&(s?tt(e,c--,1):(s=!0,i.value=a));s||J(e,{key:o,value:a}),u||(this.size=e.length),r.updateURL()},sort:function(){var t=M(this);C(t.entries,function(t,n){return t.key>n.key?1:-1}),t.updateURL()},forEach:function(t){for(var n,r=M(this).entries,i=m(t,arguments.length>1?arguments[1]:void 0),e=0;e<r.length;)i((n=r[e++]).value,n.key,this)},keys:function(){return new lt(this,"keys")},values:function(){return new lt(this,"values")},entries:function(){return new lt(this,"entries")}},{enumerable:!0}),a(mt,D,mt.entries,{name:"entries"}),a(mt,"toString",function(){return M(this).serialize()},{enumerable:!0}),u&&c(mt,"size",{get:function(){return M(this).entries.length},configurable:!0,enumerable:!0}),h(wt,N),t({global:!0,constructor:!0,forced:!o},{URLSearchParams:wt}),!o&&g(L)){var pt=s(G.has),yt=s(G.set),bt=function(t){if(b(t)){var n,r=t.body;if(p(r)===N)return n=t.headers?new L(t.headers):new L,pt(n,"content-type")||yt(n,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),I(t,{body:S(0,E(r)),headers:S(0,n)})}return t};if(g(U)&&t({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return U(t,arguments.length>1?bt(arguments[1]):{})}}),g(j)){var Et=function(t){return l(this,B),new j(t,arguments.length>1?bt(arguments[1]):{})};B.constructor=Et,Et.prototype=B,t({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Et})}}return Qf={URLSearchParams:wt,getState:M}}function eh(){if(Yf)return Lf;Yf=1,kf();var t,n=Ti(),r=V(),i=zf(),e=_(),s=As(),u=Nt(),o=wr(),a=bs(),c=Is(),f=_n(),h=function(){if(Ff)return Nf;Ff=1;var t=V(),n=Nt(),r=z(),i=j(),e=Ki(),s=bi(),u=Ct(),o=An(),a=Pt(),c=Object.assign,f=Object.defineProperty,h=n([].concat);return Nf=!c||i(function(){if(t&&1!==c({b:1},c(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var n={},r={},i=Symbol("assign detection"),s="abcdefghijklmnopqrst";return n[i]=7,s.split("").forEach(function(t){r[t]=t}),7!==c({},n)[i]||e(c({},r)).join("")!==s})?function(n,i){for(var c=o(n),f=arguments.length,d=1,v=s.f,l=u.f;f>d;)for(var g,w=a(arguments[d++]),m=v?h(e(w),v(w)):e(w),p=m.length,y=0;p>y;)g=m[y++],t&&!r(l,w,g)||(c[g]=w[g]);return c}:c,Nf}(),d=Gf(),v=_s(),l=Fc().codeAt,g=Wf(),w=ja(),m=ys(),p=Os(),y=ih(),b=lr(),E=b.set,I=b.getterFor("URL"),S=y.URLSearchParams,T=y.getState,k=e.URL,R=e.TypeError,A=e.encodeURIComponent,O=e.parseInt,C=Math.floor,D=Math.pow,N=u("".charAt),F=u(/./.exec),P=u([].join),M=u(1.1.toString),x=u([].pop),U=u([].push),L=u("".replace),B=u([].shift),G=u("".split),W=u("".slice),q=u("".toLowerCase),H=u([].unshift),K="Invalid scheme",X="Invalid host",$="Invalid port",Q=/[a-z]/i,J=/[\d+\-.a-z]/i,Y=/\d/,Z=/^0x/i,tt=/^[0-7]+$/,nt=/^\d+$/,rt=/^[\da-f]+$/i,it=/[\0\t\n\r #%/:<>?@[\\\]^|]/,et=/[\0\t\n\r #/:<>?@[\\\]^|]/,st=/^[\u0000-\u0020]+/,ut=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ot=/[\t\n\r]/g,at=function(t){var n,r,i,e;if("number"==typeof t){for(n=[],r=0;r<4;r++)H(n,t%256),t=C(t/256);return P(n,".")}if("object"==typeof t){for(n="",i=function(t){for(var n=null,r=1,i=null,e=0,s=0;s<8;s++)0!==t[s]?(e>r&&(n=i,r=e),i=null,e=0):(null===i&&(i=s),++e);return e>r?i:n}(t),r=0;r<8;r++)e&&0===t[r]||(e&&(e=!1),i===r?(n+=r?":":"::",e=!0):(n+=M(t[r],16),r<7&&(n+=":")));return"["+n+"]"}return t},ct={},ft=h({},ct,{" ":1,'"':1,"#":1,"<":1,">":1}),ht=h({},ft,{"'":1}),dt=h({},ct,{" ":1,'"':1,"<":1,">":1,"`":1}),vt=h({},dt,{"#":1,"?":1,"{":1,"}":1,"^":1}),lt=h({},vt,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),gt=function(t,n){var r=l(t,0);return r>=32&&r<127&&!f(n,t)?t:"'"===t&&f(n,t)?"%27":A(t)},wt={ftp:21,file:null,http:80,https:443,ws:80,wss:443},mt=function(t,n){var r;return 2===t.length&&F(Q,N(t,0))&&(":"===(r=N(t,1))||!n&&"|"===r)},pt=function(t){var n;return t.length>1&&mt(W(t,0,2))&&(2===t.length||"/"===(n=N(t,2))||"\\"===n||"?"===n||"#"===n)},yt=function(t){return"."===t||"%2e"===q(t)},bt=function(t){return".."===(t=q(t))||"%2e."===t||".%2e"===t||"%2e%2e"===t},Et={},It={},St={},Tt={},kt={},Rt={},At={},_t={},Ot={},Dt={},Ft={},Mt={},xt={},Ut={},jt={},Vt={},Lt={},zt={},Bt={},Gt={},Wt={},qt=function(t,n,r){var i,e,s,u=w(t);if(n){if(e=this.parse(u))throw new R(e);this.searchParams=null}else{if(void 0!==r&&(i=new qt(r,!0)),e=this.parse(u,null,i))throw new R(e);(s=T(new S)).bindURL(this),this.searchParams=s}};qt.prototype={type:"URL",parse:function(n,r,i){var e,s,u,o,a=this,c=r||Et,h=0,l="",g=!1,m=!1,p=!1;for(n=w(n),r||(a.scheme="",a.username="",a.password="",a.host=null,a.port=null,a.path=[],a.query=null,a.fragment=null,a.cannotBeABaseURL=!1,n=L(n,st,""),n=L(n,ut,"$1")),n=L(n,ot,""),e=d(n);h<=e.length;){switch(s=e[h],c){case Et:if(!s||!F(Q,s)){if(r)return K;c=St;continue}l+=q(s),c=It;break;case It:if(s&&F(J,s))l+=q(s);else{if(":"!==s){if(r)return K;l="",c=St,h=0;continue}if(r&&(a.isSpecial()!==f(wt,l)||"file"===l&&(a.includesCredentials()||null!==a.port)||"file"===a.scheme&&""===a.host))return;if(a.scheme=l,r)return void(a.isSpecial()&&wt[a.scheme]===a.port&&(a.port=null));l="","file"===a.scheme?c=Ut:a.isSpecial()&&i&&i.scheme===a.scheme?c=Tt:a.isSpecial()?c=_t:"/"===e[h+1]?(c=kt,h++):(a.cannotBeABaseURL=!0,U(a.path,""),c=Bt)}break;case St:if(!i||i.cannotBeABaseURL&&"#"!==s)return K;if(i.cannotBeABaseURL&&"#"===s){a.scheme=i.scheme,a.path=v(i.path),a.query=i.query,a.fragment="",a.cannotBeABaseURL=!0,c=Wt;break}c="file"===i.scheme?Ut:Rt;continue;case Tt:if("/"!==s||"/"!==e[h+1]){c=Rt;continue}c=Ot,h++;break;case kt:if("/"===s){c=Dt;break}c=zt;continue;case Rt:if(a.scheme=i.scheme,s===t)a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.query=i.query;else if("/"===s||"\\"===s&&a.isSpecial())c=At;else if("?"===s)a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.query="",c=Gt;else{if("#"!==s){a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.path.length&&a.path.length--,c=zt;continue}a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.query=i.query,a.fragment="",c=Wt}break;case At:if(!a.isSpecial()||"/"!==s&&"\\"!==s){if("/"!==s){a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,c=zt;continue}c=Dt}else c=Ot;break;case _t:if(c=Ot,"/"!==s||"/"!==e[h+1])continue;h++;break;case Ot:if("/"!==s&&"\\"!==s){c=Dt;continue}break;case Dt:if("@"===s){g&&(l="%40"+l),g=!0,u=d(l);for(var y=0;y<u.length;y++){var b=u[y];if(":"!==b||p){var E=gt(b,lt);p?a.password+=E:a.username+=E}else p=!0}l=""}else if(s===t||"/"===s||"?"===s||"#"===s||"\\"===s&&a.isSpecial()){if(g&&""===l)return"Invalid authority";h-=d(l).length+1,l="",c=Ft}else l+=s;break;case Ft:case Mt:if(r&&"file"===a.scheme){c=Vt;continue}if(":"!==s||m){if(s===t||"/"===s||"?"===s||"#"===s||"\\"===s&&a.isSpecial()){if(a.isSpecial()&&""===l)return X;if(r&&""===l&&(a.includesCredentials()||null!==a.port))return;if(o=a.parseHost(l))return o;if(l="",c=Lt,r)return;continue}"["===s?m=!0:"]"===s&&(m=!1),l+=s}else{if(""===l)return X;if(r===Mt)return;if(o=a.parseHost(l))return o;l="",c=xt}break;case xt:if(!F(Y,s)){if(s===t||"/"===s||"?"===s||"#"===s||"\\"===s&&a.isSpecial()||r){if(""!==l){var I=O(l,10);if(I>65535)return $;a.port=a.isSpecial()&&I===wt[a.scheme]?null:I,l=""}if(r)return;c=Lt;continue}return $}l+=s;break;case Ut:if(a.scheme="file",a.host="","/"===s||"\\"===s)c=jt;else{if(!i||"file"!==i.scheme){c=zt;continue}switch(s){case t:a.host=i.host,a.path=v(i.path),a.query=i.query;break;case"?":a.host=i.host,a.path=v(i.path),a.query="",c=Gt;break;case"#":a.host=i.host,a.path=v(i.path),a.query=i.query,a.fragment="",c=Wt;break;default:a.host=i.host,pt(P(v(e,h),""))||(a.path=v(i.path),a.shortenPath()),c=zt;continue}}break;case jt:if("/"===s||"\\"===s){c=Vt;break}i&&"file"===i.scheme&&(a.host=i.host,!pt(P(v(e,h),""))&&mt(i.path[0],!0)&&U(a.path,i.path[0])),c=zt;continue;case Vt:if(s===t||"/"===s||"\\"===s||"?"===s||"#"===s){if(!r&&mt(l))c=zt;else if(""===l){if(a.host="",r)return;c=Lt}else{if(o=a.parseHost(l))return o;if("localhost"===a.host&&(a.host=""),r)return;l="",c=Lt}continue}l+=s;break;case Lt:if(a.isSpecial()){if(c=zt,"/"!==s&&"\\"!==s)continue}else if(r||"?"!==s)if(r||"#"!==s){if(s!==t&&(c=zt,"/"!==s))continue}else a.fragment="",c=Wt;else a.query="",c=Gt;break;case zt:if(s===t||"/"===s||"\\"===s&&a.isSpecial()||!r&&("?"===s||"#"===s)){if(bt(l)?(a.shortenPath(),"/"===s||"\\"===s&&a.isSpecial()||U(a.path,"")):yt(l)?"/"===s||"\\"===s&&a.isSpecial()||U(a.path,""):("file"===a.scheme&&!a.path.length&&mt(l)&&(null!==a.host&&""!==a.host&&(a.host=""),l=N(l,0)+":"),U(a.path,l)),l="","file"===a.scheme&&(s===t||"?"===s||"#"===s))for(;a.path.length>1&&""===a.path[0];)B(a.path);"?"===s?(a.query="",c=Gt):"#"===s&&(a.fragment="",c=Wt)}else l+=gt(s,vt);break;case Bt:"?"===s?(a.query="",c=Gt):"#"===s?(a.fragment="",c=Wt):s!==t&&(a.path[0]+=gt(s,ct));break;case Gt:r||"#"!==s?s!==t&&(a.query+=gt(s,a.isSpecial()?ht:ft)):(a.fragment="",c=Wt);break;case Wt:s!==t&&(a.fragment+=gt(s,dt))}h++}},parseHost:function(t){var n,r,i;if("["===N(t,0)){if("]"!==N(t,t.length-1))return X;if(n=function(t){var n,r,i,e,s,u,o,a=[0,0,0,0,0,0,0,0],c=0,f=null,h=0,d=function(){return N(t,h)};if(":"===d()){if(":"!==N(t,1))return;h+=2,f=++c}for(;d();){if(8===c)return;if(":"!==d()){for(n=r=0;r<4&&F(rt,d());)n=16*n+O(d(),16),h++,r++;if("."===d()){if(0===r)return;if(h-=r,c>6)return;for(i=0;d();){if(e=null,i>0){if(!("."===d()&&i<4))return;h++}if(!F(Y,d()))return;for(;F(Y,d());){if(s=O(d(),10),null===e)e=s;else{if(0===e)return;e=10*e+s}if(e>255)return;h++}a[c]=256*a[c]+e,2!==++i&&4!==i||c++}if(4!==i)return;break}if(":"===d()){if(h++,!d())return}else if(d())return;a[c++]=n}else{if(null!==f)return;h++,f=++c}}if(null!==f)for(u=c-f,c=7;0!==c&&u>0;)o=a[c],a[c--]=a[f+u-1],a[f+--u]=o;else if(8!==c)return;return a}(W(t,1,-1)),!n)return X;this.host=n}else if(this.isSpecial()){if(t=g(t),F(it,t))return X;if(function(t){var n,r,i=G(t,".");if(""===i[i.length-1]){if(1===i.length)return!1;i.length--}return n=i[i.length-1],!!F(nt,n)||!!F(Z,n)&&(""===(r=W(n,2))||!!F(rt,r))}(t)){if(n=function(t){var n,r,i,e,s,u,o,a=G(t,".");if(a.length&&""===a[a.length-1]&&a.length--,(n=a.length)>4)return null;for(r=[],i=0;i<n;i++){if(""===(e=a[i]))return null;if(s=10,e.length>1&&"0"===N(e,0)&&(s=F(Z,e)?16:8,e=W(e,8===s?1:2)),""===e)u=0;else{if(!F(10===s?nt:8===s?tt:rt,e))return null;u=O(e,s)}U(r,u)}for(i=0;i<n;i++)if(u=r[i],i===n-1){if(u>=D(256,5-n))return null}else if(u>255)return null;for(o=x(r),i=0;i<r.length;i++)o+=r[i]*D(256,3-i);return o}(t),null===n)return X;this.host=n}else this.host=t}else{if(F(et,t))return X;for(n="",r=d(t),i=0;i<r.length;i++)n+=gt(r[i],ct);this.host=n}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return f(wt,this.scheme)},shortenPath:function(){var t=this.path,n=t.length;!n||"file"===this.scheme&&1===n&&mt(t[0],!0)||t.length--},serialize:function(){var t=this,n=t.scheme,r=t.username,i=t.password,e=t.host,s=t.port,u=t.path,o=t.query,a=t.fragment,c=n+":";return null!==e?(c+="//",t.includesCredentials()&&(c+=r+(i?":"+i:"")+"@"),c+=at(e),null!==s&&(c+=":"+s)):"file"===n&&(c+="//"),null===e&&!t.cannotBeABaseURL&&u.length>1&&""===u[0]&&(c+="/."),c+=t.cannotBeABaseURL?u[0]:u.length?"/"+P(u,"/"):"",null!==o&&(c+="?"+o),null!==a&&(c+="#"+a),c},setHref:function(t){var n=this.parse(t);if(n)throw new R(n);this.searchParams.update()},getOrigin:function(){var t=this.scheme,n=this.port;if("blob"===t)try{return new Ht(this.path[0]).origin}catch(t){return"null"}return"file"!==t&&this.isSpecial()?t+"://"+at(this.host)+(null!==n?":"+n:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(t){this.parse(w(t)+":",Et)},getUsername:function(){return this.username},setUsername:function(t){var n=d(w(t));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<n.length;r++)this.username+=gt(n[r],lt)}},getPassword:function(){return this.password},setPassword:function(t){var n=d(w(t));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<n.length;r++)this.password+=gt(n[r],lt)}},getHost:function(){var t=this.host,n=this.port;return null===t?"":null===n?at(t):at(t)+":"+n},setHost:function(t){this.cannotBeABaseURL||this.parse(t,Ft)},getHostname:function(){var t=this.host;return null===t?"":at(t)},setHostname:function(t){this.cannotBeABaseURL||this.parse(t,Mt)},getPort:function(){var t=this.port;return null===t?"":w(t)},setPort:function(t){this.cannotHaveUsernamePasswordPort()||(""===(t=w(t))?this.port=null:this.parse(t,xt))},getPathname:function(){var t=this.path;return this.cannotBeABaseURL?t[0]:t.length?"/"+P(t,"/"):""},setPathname:function(t){this.cannotBeABaseURL||(this.path=[],this.parse(t,Lt))},getSearch:function(){var t=this.query;return t?"?"+t:""},setSearch:function(t){""===(t=w(t))?this.query=null:("?"===N(t,0)&&(t=W(t,1)),this.query="",this.parse(t,Gt)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var t=this.fragment;return t?"#"+t:""},setHash:function(t){""!==(t=w(t))?("#"===N(t,0)&&(t=W(t,1)),this.fragment="",this.parse(t,Wt)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Ht=function(t){var n=c(this,Kt),i=p(arguments.length,1)>1?arguments[1]:void 0,e=E(n,new qt(t,!1,i));r||(n.href=e.serialize(),n.origin=e.getOrigin(),n.protocol=e.getProtocol(),n.username=e.getUsername(),n.password=e.getPassword(),n.host=e.getHost(),n.hostname=e.getHostname(),n.port=e.getPort(),n.pathname=e.getPathname(),n.search=e.getSearch(),n.searchParams=e.getSearchParams(),n.hash=e.getHash())},Kt=Ht.prototype,Xt=function(t,n){return{get:function(){return I(this)[t]()},set:n&&function(t){return I(this)[n](t)},configurable:!0,enumerable:!0}};if(r&&(a(Kt,"href",Xt("serialize","setHref")),a(Kt,"origin",Xt("getOrigin")),a(Kt,"protocol",Xt("getProtocol","setProtocol")),a(Kt,"username",Xt("getUsername","setUsername")),a(Kt,"password",Xt("getPassword","setPassword")),a(Kt,"host",Xt("getHost","setHost")),a(Kt,"hostname",Xt("getHostname","setHostname")),a(Kt,"port",Xt("getPort","setPort")),a(Kt,"pathname",Xt("getPathname","setPathname")),a(Kt,"search",Xt("getSearch","setSearch")),a(Kt,"searchParams",Xt("getSearchParams")),a(Kt,"hash",Xt("getHash","setHash"))),o(Kt,"toJSON",function(){return I(this).serialize()},{enumerable:!0}),o(Kt,"toString",function(){return I(this).serialize()},{enumerable:!0}),k){var $t=k.createObjectURL,Qt=k.revokeObjectURL;$t&&o(Ht,"createObjectURL",s($t,k)),Qt&&o(Ht,"revokeObjectURL",s(Qt,k))}return m(Ht,"URL"),n({global:!0,constructor:!0,forced:!i,sham:!r},{URL:Ht}),Lf}Zf||(Zf=1,eh());var sh,uh={};!function(){if(sh)return uh;sh=1;var t=Ti(),n=z();t({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return n(URL.prototype.toString,this)}})}();var oh;function ah(t,n){var r;if("undefined"!=typeof URLSearchParams)return new URLSearchParams(t).get(n);var i=new RegExp("[?&]"+n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"=([^&#]*)"),e=t.match(i);return e?decodeURIComponent(null!==(r=e[1])&&void 0!==r?r:""):null}function ch(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return"UTC"}}function fh(t){var n,r={campaignName:ah(n=window.location.search,"utm_campaign")||"",campaignSource:ah(n,"utm_source")||"",campaignMedium:ah(n,"utm_medium")||""};return{libraryName:"cap-hydra-web-sdk",libraryVersion:Ra,locale:navigator.language||navigator.languages&&navigator.languages[0]||"en-US",userAgent:navigator.userAgent||"",timezone:ch(),ip:"",campaignName:r.campaignName,campaignSource:r.campaignSource,campaignMedium:r.campaignMedium,pageUrl:window.location.href||"",pagePath:window.location.pathname||"",pageReferrer:document.referrer||"",pageTitle:document.title||"",sessionId:t}}oh||(oh=1,ih());var hh,dh={};!function(){if(hh)return dh;hh=1;var t=Ti(),n=Gf();t({target:"Array",stat:!0,forced:!vu()(function(t){Array.from(t)})},{from:n})}();var vh,lh={};!function(){if(vh)return lh;vh=1;var t=Ti(),n=Vu().map;t({target:"Array",proto:!0,forced:!Pi()("map")},{map:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var gh,wh,mh,ph,yh,bh,Eh,Ih,Sh,Th,kh,Rh,Ah,_h,Oh,Ch,Dh,Nh,Fh,Ph={};function Mh(){return wh?gh:(wh=1,gh="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView)}function xh(){if(ph)return mh;ph=1;var t=Mr(),n=Ur(),r=RangeError;return mh=function(i){if(void 0===i)return 0;var e=t(i),s=n(e);if(e!==s)throw new r("Wrong length or index");return s}}function Uh(){if(Th)return Sh;Th=1;var t=bh?yh:(bh=1,yh=Math.sign||function(t){var n=+t;return 0===n||n!=n?n:n<0?-1:1}),n=function(){if(Ih)return Eh;Ih=1;var t=4503599627370496;return Eh=function(n){return n+t-t}}(),r=Math.abs;return Sh=function(i,e,s,u){var o=+i,a=r(o),c=t(o);if(a<u)return c*n(a/u/e)*u*e;var f=(1+e/2220446049250313e-31)*a,h=f-(f-a);return h>s||h!=h?c*(1/0):c*h}}function jh(){if(_h)return Ah;_h=1;var t=Array,n=Math.abs,r=Math.pow,i=Math.floor,e=Math.log,s=Math.LN2;return Ah={pack:function(u,o,a){var c,f,h,d=t(a),v=8*a-o-1,l=(1<<v)-1,g=l>>1,w=23===o?r(2,-24)-r(2,-77):0,m=u<0||0===u&&1/u<0?1:0,p=0;for((u=n(u))!=u||u===1/0?(f=u!=u?1:0,c=l):(c=i(e(u)/s),u*(h=r(2,-c))<1&&(c--,h*=2),(u+=c+g>=1?w/h:w*r(2,1-g))*h>=2&&(c++,h/=2),c+g>=l?(f=0,c=l):c+g>=1?(f=(u*h-1)*r(2,o),c+=g):(f=u*r(2,g-1)*r(2,o),c=0));o>=8;)d[p++]=255&f,f/=256,o-=8;for(c=c<<o|f,v+=o;v>0;)d[p++]=255&c,c/=256,v-=8;return d[p-1]|=128*m,d},unpack:function(t,n){var i,e=t.length,s=8*e-n-1,u=(1<<s)-1,o=u>>1,a=s-7,c=e-1,f=t[c--],h=127&f;for(f>>=7;a>0;)h=256*h+t[c--],a-=8;for(i=h&(1<<-a)-1,h>>=-a,a+=n;a>0;)i=256*i+t[c--],a-=8;if(0===h)h=1-o;else{if(h===u)return i?NaN:f?-1/0:1/0;i+=r(2,n),h-=o}return(f?-1:1)*i*r(2,h-n)}}}function Vh(){if(Ch)return Oh;Ch=1;var t=An(),n=xr(),r=jr();return Oh=function(i){for(var e=t(this),s=r(e),u=arguments.length,o=n(u>1?arguments[1]:void 0,s),a=u>2?arguments[2]:void 0,c=void 0===a?s:n(a,s);c>o;)e[o++]=i;return e},Oh}function Lh(){if(Nh)return Dh;Nh=1;var t=_(),n=Nt(),r=V(),i=Mh(),e=fr(),s=Kn(),u=bs(),o=nh(),a=j(),c=Is(),f=Mr(),h=xh(),d=function(){if(Rh)return kh;Rh=1;var t=Uh();return kh=Math.fround||function(n){return t(n,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)}}(),v=jh(),l=of(),g=ps(),w=Vh(),m=_s(),p=yf(),y=Ii(),b=ys(),E=lr(),I=e.PROPER,S=e.CONFIGURABLE,T="ArrayBuffer",k="DataView",R="prototype",A="Wrong index",O=E.getterFor(T),C=E.getterFor(k),D=E.set,N=t[T],F=N,P=F&&F[R],M=t[k],x=M&&M[R],U=Object.prototype,L=t.Array,z=t.RangeError,B=n(w),G=n([].reverse),W=v.pack,q=v.unpack,H=function(t){return[255&t]},K=function(t){return[255&t,t>>8&255]},X=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},$=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},Q=function(t){return W(d(t),23,4)},J=function(t){return W(t,52,8)},Y=function(t,n,r){u(t[R],n,{configurable:!0,get:function(){return r(this)[n]}})},Z=function(t,n,r,i){var e=C(t),s=h(r),u=!!i;if(s+n>e.byteLength)throw new z(A);var o=e.bytes,a=s+e.byteOffset,c=m(o,a,a+n);return u?c:G(c)},tt=function(t,n,r,i,e,s){var u=C(t),o=h(r),a=i(+e),c=!!s;if(o+n>u.byteLength)throw new z(A);for(var f=u.bytes,d=o+u.byteOffset,v=0;v<n;v++)f[d+v]=a[c?v:n-v-1]};if(i){var nt=I&&N.name!==T;a(function(){N(1)})&&a(function(){new N(-1)})&&!a(function(){return new N,new N(1.5),new N(NaN),1!==N.length||nt&&!S})?nt&&S&&s(N,"name",T):((F=function(t){return c(this,P),p(new N(h(t)),this,F)})[R]=P,P.constructor=F,y(F,N)),g&&l(x)!==U&&g(x,U);var rt=new M(new F(2)),it=n(x.setInt8);rt.setInt8(0,2147483648),rt.setInt8(1,2147483649),!rt.getInt8(0)&&rt.getInt8(1)||o(x,{setInt8:function(t,n){it(this,t,n<<24>>24)},setUint8:function(t,n){it(this,t,n<<24>>24)}},{unsafe:!0})}else P=(F=function(t){c(this,P);var n=h(t);D(this,{type:T,bytes:B(L(n),0),byteLength:n}),r||(this.byteLength=n,this.detached=!1)})[R],x=(M=function(t,n,i){c(this,x),c(t,P);var e=O(t),s=e.byteLength,u=f(n);if(u<0||u>s)throw new z("Wrong offset");if(u+(i=void 0===i?s-u:h(i))>s)throw new z("Wrong length");D(this,{type:k,buffer:t,byteLength:i,byteOffset:u,bytes:e.bytes}),r||(this.buffer=t,this.byteLength=i,this.byteOffset=u)})[R],r&&(Y(F,"byteLength",O),Y(M,"buffer",C),Y(M,"byteLength",C),Y(M,"byteOffset",C)),o(x,{getInt8:function(t){return Z(this,1,t)[0]<<24>>24},getUint8:function(t){return Z(this,1,t)[0]},getInt16:function(t){var n=Z(this,2,t,arguments.length>1&&arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=Z(this,2,t,arguments.length>1&&arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return $(Z(this,4,t,arguments.length>1&&arguments[1]))},getUint32:function(t){return $(Z(this,4,t,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(t){return q(Z(this,4,t,arguments.length>1&&arguments[1]),23)},getFloat64:function(t){return q(Z(this,8,t,arguments.length>1&&arguments[1]),52)},setInt8:function(t,n){tt(this,1,t,H,n)},setUint8:function(t,n){tt(this,1,t,H,n)},setInt16:function(t,n){tt(this,2,t,K,n,arguments.length>2&&arguments[2])},setUint16:function(t,n){tt(this,2,t,K,n,arguments.length>2&&arguments[2])},setInt32:function(t,n){tt(this,4,t,X,n,arguments.length>2&&arguments[2])},setUint32:function(t,n){tt(this,4,t,X,n,arguments.length>2&&arguments[2])},setFloat32:function(t,n){tt(this,4,t,Q,n,arguments.length>2&&arguments[2])},setFloat64:function(t,n){tt(this,8,t,J,n,arguments.length>2&&arguments[2])}});return b(F,T),b(M,k),Dh={ArrayBuffer:F,DataView:M}}!function(){if(Fh)return Ph;Fh=1;var t=Ti(),n=_(),r=Lh(),i=Es(),e="ArrayBuffer",s=r[e];t({global:!0,constructor:!0,forced:n[e]!==s},{ArrayBuffer:s}),i(e)}();var zh,Bh={};!function(){if(zh)return Bh;zh=1;var t=Ti(),n=Rs(),r=j(),i=Lh(),e=qn(),s=xr(),u=Ur(),o=i.ArrayBuffer,a=i.DataView,c=a.prototype,f=n(o.prototype.slice),h=n(c.getUint8),d=n(c.setUint8);t({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:r(function(){return!new o(2).slice(1,void 0).byteLength})},{slice:function(t,n){if(f&&void 0===n)return f(e(this),t);for(var r=e(this).byteLength,i=s(t,r),c=s(void 0===n?r:n,r),v=new o(u(c-i)),l=new a(this),g=new a(v),w=0;i<c;)d(g,w++,h(l,i++));return v}})}();var Gh,Wh,qh,Hh,Kh,Xh,$h,Qh={};function Jh(){if(Hh)return qh;Hh=1;var t=Nt(),n=Ur(),r=ja(),i=function(){if(Wh)return Gh;Wh=1;var t=Mr(),n=ja(),r=xt(),i=RangeError,e=Math.floor;return Gh=function(s){var u=n(r(this)),o="",a=t(s);if(a<0||a===1/0)throw new i("Wrong number of repetitions");for(;a>0;(a=e(a/2))&&(u+=u))a%2&&(o+=u);return o}}(),e=xt(),s=t(i),u=t("".slice),o=Math.ceil,a=function(t){return function(i,a,c){var f=r(e(i)),h=n(a),d=f.length;if(h<=d)return f;var v,l,g=void 0===c?" ":r(c);return""===g?f:((l=s(g,o((v=h-d)/g.length))).length>v&&(l=u(l,0,v)),t?f+l:l+f)}};return qh={start:a(!1),end:a(!0)}}!function(){if($h)return Qh;$h=1;var t=Ti(),n=Jh().start;t({target:"String",proto:!0,forced:function(){if(Xh)return Kh;Xh=1;var t=Bt();return Kh=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(t)}()},{padStart:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var Yh,Zh,td,nd,rd,id,ed,sd,ud,od,ad,cd,fd,hd,dd,vd,ld,gd,wd,md,pd,yd,bd={exports:{}};function Ed(){if(Zh)return Yh;Zh=1;var t,n,r,i=Mh(),e=V(),s=_(),u=jt(),o=Vt(),a=_n(),c=Ci(),f=Kt(),h=Kn(),d=wr(),v=bs(),l=zt(),g=of(),w=ps(),m=Cn(),p=On(),y=lr(),b=y.enforce,E=y.get,I=s.Int8Array,S=I&&I.prototype,T=s.Uint8ClampedArray,k=T&&T.prototype,R=I&&g(I),A=S&&g(S),O=Object.prototype,C=s.TypeError,D=m("toStringTag"),N=p("TYPED_ARRAY_TAG"),F="TypedArrayConstructor",P=i&&!!w&&"Opera"!==c(s.opera),M=!1,x={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},j=function(t){var n=g(t);if(o(n)){var r=E(n);return r&&a(r,F)?r[F]:j(n)}},L=function(t){if(!o(t))return!1;var n=c(t);return a(x,n)||a(U,n)};for(t in x)(r=(n=s[t])&&n.prototype)?b(r)[F]=n:P=!1;for(t in U)(r=(n=s[t])&&n.prototype)&&(b(r)[F]=n);if((!P||!u(R)||R===Function.prototype)&&(R=function(){throw new C("Incorrect invocation")},P))for(t in x)s[t]&&w(s[t],R);if((!P||!A||A===O)&&(A=R.prototype,P))for(t in x)s[t]&&w(s[t].prototype,A);if(P&&g(k)!==A&&w(k,A),e&&!a(A,D))for(t in M=!0,v(A,D,{configurable:!0,get:function(){return o(this)?this[N]:void 0}}),x)s[t]&&h(s[t].prototype,N,t);return Yh={NATIVE_ARRAY_BUFFER_VIEWS:P,TYPED_ARRAY_TAG:M&&N,aTypedArray:function(t){if(L(t))return t;throw new C("Target is not a typed array")},aTypedArrayConstructor:function(t){if(u(t)&&(!w||l(R,t)))return t;throw new C(f(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,n,r,i){if(e){if(r)for(var u in x){var o=s[u];if(o&&a(o.prototype,t))try{delete o.prototype[t]}catch(r){try{o.prototype[t]=n}catch(t){}}}A[t]&&!r||d(A,t,r?n:P&&S[t]||n,i)}},exportTypedArrayStaticMethod:function(t,n,r){var i,u;if(e){if(w){if(r)for(i in x)if((u=s[i])&&a(u,t))try{delete u[t]}catch(t){}if(R[t]&&!r)return;try{return d(R,t,r?n:P&&R[t]||n)}catch(t){}}for(i in x)!(u=s[i])||u[t]&&!r||d(u,t,n)}},getTypedArrayConstructor:j,isView:function(t){if(!o(t))return!1;var n=c(t);return"DataView"===n||a(x,n)||a(U,n)},isTypedArray:L,TypedArray:R,TypedArrayPrototype:A}}function Id(){if(id)return rd;id=1;var t=Vt(),n=Math.floor;return rd=Number.isInteger||function(r){return!t(r)&&isFinite(r)&&n(r)===r}}function Sd(){if(sd)return ed;sd=1;var t=Mr(),n=RangeError;return ed=function(r){var i=t(r);if(i<0)throw new n("The argument can't be less than 0");return i}}function Td(){if(od)return ud;od=1;var t=Sd(),n=RangeError;return ud=function(r,i){var e=t(r);if(e%i)throw new n("Wrong offset");return e}}function kd(){if(cd)return ad;cd=1;var t=Math.floor;return ad=function(n){var r=+n;if(r!=r||r<=0)return 0;if(r>=255)return 255;var i=t(r);return i+.5<r?i+1:r<i+.5||i%2==0?i:i+1}}function Rd(){if(hd)return fd;hd=1;var t=Ci();return fd=function(n){var r=t(n);return"BigInt64Array"===r||"BigUint64Array"===r}}function Ad(){if(vd)return dd;vd=1;var t=Dn(),n=TypeError;return dd=function(r){var i=t(r,"number");if("number"==typeof i)throw new n("Can't convert number to bigint");return BigInt(i)}}function _d(){if(gd)return ld;gd=1;var t=As(),n=z(),r=Xt(),i=Ss(),e=An(),s=jr(),u=fu(),o=cu(),a=au(),c=Rd(),f=Ed().aTypedArrayConstructor,h=Ad();return ld=function(d){var v=i(this),l=arguments.length,g=l>1?arguments[1]:void 0,w=void 0!==g;w&&r(g);var m,p,y,b,E,I,S,T,k=e(d),R=o(k);if(R&&!a(R))for(T=(S=u(k,R)).next,k=[];!(I=n(T,S)).done;)k.push(I.value);for(w&&l>2&&(g=t(g,arguments[2])),p=s(k),y=new(f(v))(p),b=c(y),m=0;p>m;m++)E=w?g(k[m],m):k[m],y[m]=b?h(E):+E;return y},ld}function Od(){if(md)return wd;md=1;var t=jr();return wd=function(n,r,i){for(var e=0,s=arguments.length>2?i:t(r),u=new n(s);s>e;)u[e]=r[e++];return u},wd}function Cd(){if(pd)return bd.exports;pd=1;var t=Ti(),n=_(),r=z(),i=V(),e=function(){if(nd)return td;nd=1;var t=_(),n=j(),r=vu(),i=Ed().NATIVE_ARRAY_BUFFER_VIEWS,e=t.ArrayBuffer,s=t.Int8Array;return td=!i||!n(function(){s(1)})||!n(function(){new s(-1)})||!r(function(t){new s,new s(null),new s(1.5),new s(t)},!0)||n(function(){return 1!==new s(new e(2),1,void 0).length})}(),s=Ed(),u=Lh(),o=Is(),a=Dt(),c=Kn(),f=Id(),h=xh(),d=Td(),v=kd(),l=Nn(),g=_n(),w=Ci(),m=Vt(),p=Ht(),y=$i(),b=zt(),E=ps(),I=Br().f,S=_d(),T=Vu().forEach,k=Es(),R=bs(),A=Hn(),O=Mn(),C=Od(),D=lr(),N=yf(),F=D.get,P=D.set,M=D.enforce,x=A.f,U=O.f,L=n.RangeError,B=u.ArrayBuffer,G=B.prototype,W=u.DataView,q=s.NATIVE_ARRAY_BUFFER_VIEWS,H=s.TYPED_ARRAY_TAG,K=s.TypedArray,X=s.TypedArrayPrototype,$=s.isTypedArray,Q="BYTES_PER_ELEMENT",J="Wrong length",Y=function(t,n){R(t,n,{configurable:!0,get:function(){return F(this)[n]}})},Z=function(t){var n;return b(G,t)||"ArrayBuffer"===(n=w(t))||"SharedArrayBuffer"===n},tt=function(t,n){return $(t)&&!p(n)&&n in t&&f(+n)&&n>=0},nt=function(t,n){return n=l(n),tt(t,n)?a(2,t[n]):U(t,n)},rt=function(t,n,r){return n=l(n),!(tt(t,n)&&m(r)&&g(r,"value"))||g(r,"get")||g(r,"set")||r.configurable||g(r,"writable")&&!r.writable||g(r,"enumerable")&&!r.enumerable?x(t,n,r):(t[n]=r.value,t)};return i?(q||(O.f=nt,A.f=rt,Y(X,"buffer"),Y(X,"byteOffset"),Y(X,"byteLength"),Y(X,"length")),t({target:"Object",stat:!0,forced:!q},{getOwnPropertyDescriptor:nt,defineProperty:rt}),bd.exports=function(i,s,u){var a=i.match(/\d+/)[0]/8,f=i+(u?"Clamped":"")+"Array",l="get"+i,g="set"+i,w=n[f],p=w,b=p&&p.prototype,R={},A=function(t,n){x(t,n,{get:function(){return function(t,n){var r=F(t);return r.view[l](n*a+r.byteOffset,!0)}(this,n)},set:function(t){return function(t,n,r){var i=F(t);i.view[g](n*a+i.byteOffset,u?v(r):r,!0)}(this,n,t)},enumerable:!0})};q?e&&(p=s(function(t,n,i,e){return o(t,b),N(m(n)?Z(n)?void 0!==e?new w(n,d(i,a),e):void 0!==i?new w(n,d(i,a)):new w(n):$(n)?C(p,n):r(S,p,n):new w(h(n)),t,p)}),E&&E(p,K),T(I(w),function(t){t in p||c(p,t,w[t])}),p.prototype=b):(p=s(function(t,n,i,e){o(t,b);var s,u,c,f=0,v=0;if(m(n)){if(!Z(n))return $(n)?C(p,n):r(S,p,n);s=n,v=d(i,a);var l=n.byteLength;if(void 0===e){if(l%a)throw new L(J);if((u=l-v)<0)throw new L(J)}else if((u=h(e)*a)+v>l)throw new L(J);c=u/a}else c=h(n),s=new B(u=c*a);for(P(t,{buffer:s,byteOffset:v,byteLength:u,length:c,view:new W(s)});f<c;)A(t,f++)}),E&&E(p,K),b=p.prototype=y(X)),b.constructor!==p&&c(b,"constructor",p),M(b).TypedArrayConstructor=p,H&&c(b,H,f);var _=p!==w;R[f]=p,t({global:!0,constructor:!0,forced:_,sham:!q},R),Q in p||c(p,Q,a),Q in b||c(b,Q,a),k(f)}):bd.exports=function(){},bd.exports}yd||(yd=1,Cd()("Uint8",function(t){return function(n,r,i){return t(this,n,r,i)}}));var Dd,Nd,Fd,Pd,Md,xd={};function Ud(){if(Nd)return Dd;Nd=1;var t=Kt(),n=TypeError;return Dd=function(r,i){if(!delete r[i])throw new n("Cannot delete property "+t(i)+" of "+t(r))}}!function(){if(Md)return xd;Md=1;var t=Nt(),n=Ed(),r=function(){if(Pd)return Fd;Pd=1;var t=An(),n=xr(),r=jr(),i=Ud(),e=Math.min;return Fd=[].copyWithin||function(s,u){var o=t(this),a=r(o),c=n(s,a),f=n(u,a),h=arguments.length>2?arguments[2]:void 0,d=e((void 0===h?a:n(h,a))-f,a-c),v=1;for(f<c&&c<f+d&&(v=-1,f+=d-1,c+=d-1);d-- >0;)f in o?o[c]=o[f]:i(o,c),c+=v,f+=v;return o},Fd}(),i=t(r),e=n.aTypedArray;(0,n.exportTypedArrayMethod)("copyWithin",function(t,n){return i(e(this),t,n,arguments.length>2?arguments[2]:void 0)})}();var jd,Vd={};!function(){if(jd)return Vd;jd=1;var t=Ed(),n=Vu().every,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("every",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var Ld,zd={};!function(){if(Ld)return zd;Ld=1;var t=Ed(),n=Vh(),r=Ad(),i=Ci(),e=z(),s=Nt(),u=j(),o=t.aTypedArray,a=t.exportTypedArrayMethod,c=s("".slice);a("fill",function(t){var s=arguments.length;o(this);var u="Big"===c(i(this),0,3)?r(t):+t;return e(n,this,u,s>1?arguments[1]:void 0,s>2?arguments[2]:void 0)},u(function(){var t=0;return new Int8Array(2).fill({valueOf:function(){return t++}}),1!==t}))}();var Bd,Gd,Wd,qd={};function Hd(){if(Gd)return Bd;Gd=1;var t=Od(),n=Ed().getTypedArrayConstructor;return Bd=function(r,i){return t(n(r),i)}}!function(){if(Wd)return qd;Wd=1;var t=Ed(),n=Vu().filter,r=Hd(),i=t.aTypedArray;(0,t.exportTypedArrayMethod)("filter",function(t){var e=n(i(this),t,arguments.length>1?arguments[1]:void 0);return r(this,e)})}();var Kd,Xd={};!function(){if(Kd)return Xd;Kd=1;var t=Ed(),n=Vu().find,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("find",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var $d,Qd={};!function(){if($d)return Qd;$d=1;var t=Ed(),n=Vu().findIndex,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("findIndex",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var Jd,Yd={};!function(){if(Jd)return Yd;Jd=1;var t=Ed(),n=Vu().forEach,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("forEach",function(t){n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var Zd,tv={};!function(){if(Zd)return tv;Zd=1;var t=Ed(),n=Vr().includes,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("includes",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var nv,rv={};!function(){if(nv)return rv;nv=1;var t=Ed(),n=Vr().indexOf,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("indexOf",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var iv,ev={};!function(){if(iv)return ev;iv=1;var t=_(),n=j(),r=Nt(),i=Ed(),e=df(),s=Cn()("iterator"),u=t.Uint8Array,o=r(e.values),a=r(e.keys),c=r(e.entries),f=i.aTypedArray,h=i.exportTypedArrayMethod,d=u&&u.prototype,v=!n(function(){d[s].call([1])}),l=!!d&&d.values&&d[s]===d.values&&"values"===d.values.name,g=function(){return o(f(this))};h("entries",function(){return c(f(this))},v),h("keys",function(){return a(f(this))},v),h("values",g,v||!l,{name:"values"}),h(s,g,v||!l,{name:"values"})}();var sv,uv={};!function(){if(sv)return uv;sv=1;var t=Ed(),n=Nt(),r=t.aTypedArray,i=t.exportTypedArrayMethod,e=n([].join);i("join",function(t){return e(r(this),t)})}();var ov,av,cv,fv={};!function(){if(cv)return fv;cv=1;var t=Ed(),n=ks(),r=function(){if(av)return ov;av=1;var t=ks(),n=Ut(),r=Mr(),i=jr(),e=ne(),s=Math.min,u=[].lastIndexOf,o=!!u&&1/[1].lastIndexOf(1,-0)<0,a=e("lastIndexOf");return ov=o||!a?function(e){if(o)return t(u,this,arguments)||0;var a=n(this),c=i(a);if(0===c)return-1;var f=c-1;for(arguments.length>1&&(f=s(f,r(arguments[1]))),f<0&&(f=c+f);f>=0;f--)if(f in a&&a[f]===e)return f||0;return-1}:u,ov}(),i=t.aTypedArray;(0,t.exportTypedArrayMethod)("lastIndexOf",function(t){var e=arguments.length;return n(r,i(this),e>1?[t,arguments[1]]:[t])})}();var hv,dv={};!function(){if(hv)return dv;hv=1;var t=Ed(),n=Vu().map,r=Hd(),i=t.aTypedArray;(0,t.exportTypedArrayMethod)("map",function(t){var e=n(i(this),t,arguments.length>1?arguments[1]:void 0);return r(this,e)})}();var vv,lv,gv,wv={};function mv(){if(lv)return vv;lv=1;var t=Xt(),n=An(),r=Pt(),i=jr(),e=TypeError,s="Reduce of empty array with no initial value",u=function(u){return function(o,a,c,f){var h=n(o),d=r(h),v=i(h);if(t(a),0===v&&c<2)throw new e(s);var l=u?v-1:0,g=u?-1:1;if(c<2)for(;;){if(l in d){f=d[l],l+=g;break}if(l+=g,u?l<0:v<=l)throw new e(s)}for(;u?l>=0:v>l;l+=g)l in d&&(f=a(f,d[l],l,h));return f}};return vv={left:u(!1),right:u(!0)}}!function(){if(gv)return wv;gv=1;var t=Ed(),n=mv().left,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("reduce",function(t){var i=arguments.length;return n(r(this),t,i,i>1?arguments[1]:void 0)})}();var pv,yv={};!function(){if(pv)return yv;pv=1;var t=Ed(),n=mv().right,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("reduceRight",function(t){var i=arguments.length;return n(r(this),t,i,i>1?arguments[1]:void 0)})}();var bv,Ev={};!function(){if(bv)return Ev;bv=1;var t=Ed(),n=t.aTypedArray,r=t.exportTypedArrayMethod,i=Math.floor;r("reverse",function(){for(var t,r=this,e=n(r).length,s=i(e/2),u=0;u<s;)t=r[u],r[u++]=r[--e],r[e]=t;return r})}();var Iv,Sv={};!function(){if(Iv)return Sv;Iv=1;var t=_(),n=z(),r=Ed(),i=jr(),e=Td(),s=An(),u=j(),o=t.RangeError,a=t.Int8Array,c=a&&a.prototype,f=c&&c.set,h=r.aTypedArray,d=r.exportTypedArrayMethod,v=!u(function(){var t=new Uint8ClampedArray(2);return n(f,t,{length:1,0:3},1),3!==t[1]}),l=v&&r.NATIVE_ARRAY_BUFFER_VIEWS&&u(function(){var t=new a(2);return t.set(1),t.set("2",1),0!==t[0]||2!==t[1]});d("set",function(t){h(this);var r=e(arguments.length>1?arguments[1]:void 0,1),u=s(t);if(v)return n(f,this,u,r);var a=this.length,c=i(u),d=0;if(c+r>a)throw new o("Wrong length");for(;d<c;)this[r+d]=u[d++]},!v||l)}();var Tv,kv={};!function(){if(Tv)return kv;Tv=1;var t=Ed(),n=j(),r=_s(),i=t.aTypedArray,e=t.getTypedArrayConstructor;(0,t.exportTypedArrayMethod)("slice",function(t,n){for(var s=r(i(this),t,n),u=e(this),o=0,a=s.length,c=new u(a);a>o;)c[o]=s[o++];return c},n(function(){new Int8Array(1).slice()}))}();var Rv,Av={};!function(){if(Rv)return Av;Rv=1;var t=Ed(),n=Vu().some,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("some",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var _v,Ov,Cv,Dv,Nv,Fv,Pv,Mv={};!function(){if(Pv)return Mv;Pv=1;var t=_(),n=Rs(),r=j(),i=Xt(),e=rh(),s=Ed(),u=function(){if(Ov)return _v;Ov=1;var t=Bt().match(/firefox\/(\d+)/i);return _v=!!t&&+t[1]}(),o=function(){if(Dv)return Cv;Dv=1;var t=Bt();return Cv=/MSIE|Trident/.test(t)}(),a=Gt(),c=function(){if(Fv)return Nv;Fv=1;var t=Bt().match(/AppleWebKit\/(\d+)\./);return Nv=!!t&&+t[1]}(),f=s.aTypedArray,h=s.exportTypedArrayMethod,d=t.Uint16Array,v=d&&n(d.prototype.sort),l=!(!v||r(function(){v(new d(2),null)})&&r(function(){v(new d(2),{})})),g=!!v&&!r(function(){if(a)return a<74;if(u)return u<67;if(o)return!0;if(c)return c<602;var t,n,r=new d(516),i=Array(516);for(t=0;t<516;t++)n=t%4,r[t]=515-t,i[t]=t-2*n+3;for(v(r,function(t,n){return(t/4|0)-(n/4|0)}),t=0;t<516;t++)if(r[t]!==i[t])return!0});h("sort",function(t){return void 0!==t&&i(t),g?v(this,t):e(f(this),function(t){return function(n,r){return void 0!==t?+t(n,r)||0:r!=r?n!=n?0:-1:n!=n?1:0===n&&0===r?1/n>0?1/r>0?0:1:1/r>0?-1:0:n>r?1:n<r?-1:0}}(t))},!g||l)}();var xv,Uv={};!function(){if(xv)return Uv;xv=1;var t=Ed(),n=Ur(),r=xr(),i=t.aTypedArray,e=t.getTypedArrayConstructor;(0,t.exportTypedArrayMethod)("subarray",function(t,s){var u=i(this),o=u.length,a=r(t,o);return new(e(u))(u.buffer,u.byteOffset+a*u.BYTES_PER_ELEMENT,n((void 0===s?o:r(s,o))-a))})}();var jv,Vv={};!function(){if(jv)return Vv;jv=1;var t=_(),n=ks(),r=Ed(),i=j(),e=_s(),s=t.Int8Array,u=r.aTypedArray,o=r.exportTypedArrayMethod,a=[].toLocaleString,c=!!s&&i(function(){a.call(new s(1))});o("toLocaleString",function(){return n(a,c?e(u(this)):u(this),e(arguments))},i(function(){return[1,2].toLocaleString()!==new s([1,2]).toLocaleString()})||!i(function(){s.prototype.toLocaleString.call([1,2])}))}();var Lv,zv={};function Bv(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();var t="undefined"!=typeof crypto?crypto:null;if(null==t?void 0:t.getRandomValues){var n=new Uint8Array(16);t.getRandomValues(n);var r=new DataView(n.buffer);return r.setUint8(6,15&r.getUint8(6)|64),r.setUint8(8,63&r.getUint8(8)|128),Array.from(n).map(function(t,n){return[4,6,8,10].includes(n)?"-".concat(t.toString(16).padStart(2,"0")):t.toString(16).padStart(2,"0")}).join("")}throw new Error("No cryptographically secure random number generator available")}function Gv(){try{var t=function(){var t,n;if("undefined"!=typeof navigator&&"userAgentData"in navigator){var r=navigator.userAgentData;if(r&&r.brands)try{for(var i=Wu(r.brands),e=i.next();!e.done;e=i.next()){var s=e.value;if(s.brand&&"Chromium"!==s.brand&&!s.brand.startsWith("Not"))return s.brand}}catch(n){t={error:n}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}return null}();return t||("undefined"!=typeof navigator&&navigator.userAgent?(n=navigator.userAgent).includes("Firefox/")?"Firefox":n.includes("Edg/")?"Edge":n.includes("Chrome/")?"Chrome":n.includes("Safari/")&&!n.includes("Chrome")?"Safari":n.includes("Opera/")||n.includes("OPR/")?"Opera":null:null)}catch(t){return null}var n}function Wv(){try{var t=function(){if("undefined"!=typeof navigator&&"userAgentData"in navigator){var t=navigator.userAgentData;if(t&&t.platform)return t.platform}return null}();return t||("undefined"!=typeof navigator&&navigator.userAgent?(n=navigator.userAgent,null!==(i=null!==(r=function(t){if(!t.includes("Mac OS X"))return null;var n=t.match(/Mac OS X ([\d_]+)/);return(null==n?void 0:n[1])?"macOS ".concat(n[1].replace(/_/g,".")):"macOS"}(n))&&void 0!==r?r:function(t){var n;if(!t.includes("Windows NT"))return null;var r=t.match(/Windows NT ([\d.]+)/);return(null==r?void 0:r[1])?"Windows ".concat(null!==(n={"10.0":"10/11",6.3:"8.1",6.2:"8",6.1:"7"}[r[1]])&&void 0!==n?n:r[1]):"Windows"}(n))&&void 0!==i?i:function(t){var n;return t.includes("iPhone")||t.includes("iPad")?(null==(n=t.match(/OS ([\d_]+)/))?void 0:n[1])?"iOS ".concat(n[1].replace(/_/g,".")):"iOS":t.includes("Android")?(n=t.match(/Android ([\d.]+)/))?"Android ".concat(n[1]):"Android":t.includes("Linux")?"Linux":null}(n)):null)}catch(r){return null}var n,r,i}function qv(){try{if("undefined"!=typeof document&&document.referrer)return function(t){var n;if("undefined"!=typeof URL)try{return new URL(t).hostname}catch(t){return"direct"}var r=t.match(/^https?:\/\/([^/?#]+)/);return r&&null!==(n=r[1])&&void 0!==n?n:"direct"}(document.referrer)}catch(t){}return"direct"}function Hv(t){var n=Gv(),r=Wv(),i=function(){var t;try{if("undefined"!=typeof navigator)return navigator.language||(null===(t=navigator.languages)||void 0===t?void 0:t[0])||"en-US"}catch(t){}return"en-US"}(),e=function(){try{if("undefined"!=typeof Intl)return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch(t){}return"UTC"}(),s=function(){try{if("undefined"!=typeof window&&window.screen)return"".concat(window.screen.width,"x").concat(window.screen.height)}catch(t){}return"0x0"}(),u=function(){try{if("undefined"!=typeof window&&window.location){var t=window.location.search;return{utmSource:ah(t,"utm_source"),utmMedium:ah(t,"utm_medium"),utmCampaign:ah(t,"utm_campaign"),utmTerm:ah(t,"utm_term"),utmContent:ah(t,"utm_content"),adsId:ah(t,"gclid")||ah(t,"fbclid")||ah(t,"msclkid")||ah(t,"ttclid")}}}catch(t){}return{utmSource:null,utmMedium:null,utmCampaign:null,utmTerm:null,utmContent:null,adsId:null}}(),o=qv(),a={sdk_version:Ra,consent:(null==t?void 0:t.notificationPermissionGranted)?"yes":"no"};return function(t,n,r,i,e,s){n&&(t.browser=n),r&&(t.os_version=r),i&&"en-US"!==i&&(t.locale=i),e&&"UTC"!==e&&(t.timezone=e),s&&"0x0"!==s&&(t.screen_resolution=s)}(a,n,r,i,e,s),function(t,n,r,i){(null==n?void 0:n.appVersion)&&(t.app_version=n.appVersion),(null==n?void 0:n.fcmTokenCreatedAt)&&(t.token_creation_date=n.fcmTokenCreatedAt),r.utmSource&&(t.utm_source=r.utmSource),r.utmMedium&&(t.utm_medium=r.utmMedium),r.utmCampaign&&(t.utm_campaign=r.utmCampaign),r.utmTerm&&(t.utm_term=r.utmTerm),r.utmContent&&(t.utm_content=r.utmContent),r.adsId&&(t.ads_id=r.adsId),i&&"direct"!==i&&(t.initial_referrer=i)}(a,t,u,o),a}!function(){if(Lv)return zv;Lv=1;var t=Ed().exportTypedArrayMethod,n=j(),r=_(),i=Nt(),e=r.Uint8Array,s=e&&e.prototype||{},u=[].toString,o=i([].join);n(function(){u.call({})})&&(u=function(){return o(this)});var a=s.toString!==u;t("toString",u,a)}();var Kv=function(){function t(t,n,r,i,e){this.httpClient=new ef(t),this.logger=n,this.accountId=r,this.orgId=i,this.source=e}return t.prototype.sendEvents=function(t,n,r,i,e,s){return Bu(this,void 0,void 0,function(){var u,o,a,c,f,h,d;return Gu(this,function(v){switch(v.label){case 0:if(!n&&!r&&!i)throw new Error("Either visitorId, visitorRefId, or userId must be provided for event tracking");if(!s)throw new Error("Session ID is required for event tracking");o=(u=!!n||!!r)&&i?"identified":u?"anonymous":"user-only",this.logger.info("Sending events",{eventCount:t.length,trackingMode:o,hasVisitor:u,hasUser:!!i,sessionId:s}),a=fh(s),c={request_id:Bv(),system_data:a,events:t},n?c.visitor={identifierName:"id",identifierValue:n}:r&&(c.visitor={identifierName:"refId",identifierValue:r}),i&&e&&(c.user={identifierName:e,identifierValue:i}),v.label=1;case 1:return v.trys.push([1,3,,4]),f={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source,"X-CAP-API-AUTH-ENTITY-ID":this.orgId},[4,this.httpClient.post(Ku,c,{headers:f})];case 2:return h=v.sent(),this.logger.info(Eo,{requestId:c.request_id,eventCount:t.length,trackingMode:o,success:h.status.success}),[2,h];case 3:throw d=v.sent(),this.logger.error(Io,{requestId:c.request_id,eventCount:t.length,trackingMode:o,error:d}),d;case 4:return[2]}})})},t.prototype.getVisitorConfig=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:this.logger.info("Fetching visitor config",{orgId:t}),u.label=1;case 1:return u.trys.push([1,3,,4]),n={"X-CAP-API-AUTH-ORG-ID":t,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":ya.WEBPUSH},[4,this.httpClient.get($u,{headers:n})];case 2:return r=u.sent(),this.logger.info(Vo,{isEnabled:null===(e=r.data)||void 0===e?void 0:e.visitorTrackingEnabled,warningCount:(null===(s=r.warnings)||void 0===s?void 0:s.length)||0}),[2,r];case 3:throw i=u.sent(),this.logger.error(Lo,i),i;case 4:return[2]}})})},t.prototype.createVisitor=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:this.logger.info("Creating anonymous visitor",{orgId:t,profileCount:n.profiles.length,hasExtendedFields:!!n.extendedFields}),a.label=1;case 1:if(a.trys.push([1,3,,4]),!n.profiles||0===n.profiles.length)throw new Error("At least one profile is required");return r={"X-CAP-API-AUTH-ORG-ID":t},[4,this.httpClient.post(Qu,n,{headers:r})];case 2:return i=a.sent(),this.logger.info(qo,{visitorId:null===(s=i.data)||void 0===s?void 0:s.id,warningCount:(null===(u=i.warnings)||void 0===u?void 0:u.length)||0}),[2,i];case 3:throw e=a.sent(),this.logger.error(Ho,{error:e,accountId:null===(o=n.profiles[0])||void 0===o?void 0:o.accountId}),e;case 4:return[2]}})})},t.prototype.updateVisitor=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:this.logger.info("Updating visitor",{orgId:t,visitorId:n,profileCount:r.profiles.length,hasExtendedFields:!!r.extendedFields}),f.label=1;case 1:if(f.trys.push([1,3,,4]),!r.profiles||0===r.profiles.length)throw new Error("At least one profile is required");if(!n||""===n.trim())throw new Error("Visitor ID is required for update");return i={"X-CAP-API-AUTH-ORG-ID":t},e="".concat(Ju,"?identifierType=visitorId&identifierValue=").concat(encodeURIComponent(n)),[4,this.httpClient.put(e,r,{headers:i})];case 2:return s=f.sent(),this.logger.info($o,{visitorId:null===(o=s.data)||void 0===o?void 0:o.id,warningCount:(null===(a=s.warnings)||void 0===a?void 0:a.length)||0}),[2,s];case 3:throw u=f.sent(),this.logger.error(Qo,{error:u,visitorId:n,accountId:null===(c=r.profiles[0])||void 0===c?void 0:c.accountId}),u;case 4:return[2]}})})},t.prototype.buildMergeIdentifiers=function(t,n,r){var i=[];return t&&i.push({type:"email",value:t}),n&&i.push({type:"mobile",value:n}),r&&i.push({type:"externalId",value:r}),i},t.prototype.handleMergeResponse=function(t,n){var r,i=this;if(t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor merge warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0){var e=t.errors[0],s=e.code,u=e.message,o=String(s);if(o===Ia.ALREADY_MERGED)return void this.logger.info("Visitor already merged, treating as success",{visitorId:n});if(o===Ia.VISITOR_NOT_FOUND)throw this.logger.warn("Visitor not found, merge cannot proceed",{visitorId:n}),new Xv(o,u);throw new Error("Merge API error: [".concat(o,"] ").concat(u))}if(202!==(null===(r=t.status)||void 0===r?void 0:r.code))throw new Error("Unexpected merge API response");this.logger.info(Jo,{visitorId:n,statusCode:t.status.code,message:t.status.message})},t.prototype.mergeVisitor=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c,f,h,d,v,l,g,w,m,p,y,b;return Gu(this,function(E){switch(E.label){case 0:if(i=r.firstName,e=r.lastName,s=r.email,u=r.mobile,o=r.fcmToken,a=r.channelType,c=r.subscribed,f=void 0===c||c,h=r.fields,d=r.extendedFields,v=r.externalId,!s&&!u&&!v)throw new Error("At least one identifier (email, mobile, or externalId) is required for visitor merge");if(!t&&!n)throw new Error("Either visitorId or visitorRefId is required for visitor merge");this.logger.info("Merging visitor with user",{visitorId:t,visitorRefId:n,hasEmail:!!s,hasMobile:!!u,hasExternalId:!!v,hasFcmToken:!!o}),l=this.buildMergeIdentifiers(s,u,v),g=a||ba.WEB,w=[],o&&w.push({type:g,value:o,primary:!0,verified:!0,subscribed:f}),m={visitor:t?{identifierName:"id",identifierValue:t}:{identifierName:"refId",identifierValue:n},user:{profiles:[{firstName:i,lastName:e,identifiers:l,commChannels:w,fields:h||{},source:ya.WEBPUSH,accountId:this.accountId}],extendedFields:d||{}}},E.label=1;case 1:return E.trys.push([1,3,,4]),p={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source},[4,this.httpClient.post(Yu,m,{headers:p})];case 2:return y=E.sent(),this.handleMergeResponse(y,t),[3,4];case 3:if((b=E.sent())instanceof Xv)throw b;throw this.logger.error(Yo,{visitorId:t,error:b}),b;case 4:return[2]}})})},t.prototype.buildUserEventsRequest=function(t,n,r){var i=fh(r);return{request_id:Bv(),system_data:zu(zu({},i),{os_name:va}),events:[{name:t,eventRefId:Bv(),eventDateTime:(new Date).toISOString(),attributes:n}]}},t.prototype.sendUserEvents=function(t,n,r,i,e){return Bu(this,void 0,void 0,function(){var s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:n?t.visitor={identifierName:"id",identifierValue:n}:r&&(t.visitor={identifierName:"refId",identifierValue:r}),i&&e&&(t.user={identifierName:e,identifierValue:i}),this.logger.info("Sending user event",{eventName:null===(o=t.events[0])||void 0===o?void 0:o.name,requestId:t.request_id,hasVisitor:!!t.visitor,hasUser:!!t.user}),f.label=1;case 1:return f.trys.push([1,3,,4]),s={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source,"X-CAP-API-AUTH-ENTITY-ID":this.orgId},[4,this.httpClient.post(Xu,t,{headers:s})];case 2:return f.sent(),this.logger.info("User event sent successfully",{eventName:null===(a=t.events[0])||void 0===a?void 0:a.name,requestId:t.request_id}),[3,4];case 3:throw u=f.sent(),this.logger.error("Failed to send user event",{eventName:null===(c=t.events[0])||void 0===c?void 0:c.name,requestId:t.request_id,error:u}),u;case 4:return[2]}})})},t.prototype.sendDLR=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:this.logger.info("Sending DLR events",{eventCount:t.events.length,requestId:t.request_id,cuid:null===(e=t.user)||void 0===e?void 0:e.identifierValue,visitorId:null===(s=t.visitor)||void 0===s?void 0:s.identifierValue}),u.label=1;case 1:return u.trys.push([1,3,,4]),n={"x-cap-api-auth-org-id":this.orgId,"x-cap-request-id":t.request_id},[4,this.httpClient.post(Zu,t,{headers:n})];case 2:return r=u.sent(),this.logger.info(ha,{requestId:t.request_id,eventCount:t.events.length,success:r.status.success}),[2,r];case 3:throw i=u.sent(),this.logger.error(da,{requestId:t.request_id,eventCount:t.events.length,error:i}),i;case 4:return[2]}})})},t}(),Xv=function(t){function n(n,r){var i=t.call(this,r)||this;return i.name="MergeNonRetryableError",i.code=n,i}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}Lu(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,t),n}(Error);var $v,Qv={};!function(){if($v)return Qv;$v=1;var t=Ti(),n=Vu().filter;t({target:"Array",proto:!0,forced:!Pi()("filter")},{filter:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var Jv,Yv,Zv,tl,nl,rl,il,el,sl,ul,ol,al,cl,fl,hl={exports:{}},dl={};function vl(){if(Jv)return dl;Jv=1;var t=Ft(),n=Ut(),r=Br().f,i=_s(),e="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];return dl.f=function(s){return e&&"Window"===t(s)?function(t){try{return r(t)}catch(t){return i(e)}}(s):r(n(s))},dl}function ll(){if(nl)return tl;nl=1;var t=j(),n=Vt(),r=Ft(),i=function(){if(Zv)return Yv;Zv=1;var t=j();return Yv=t(function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})}(),e=Object.isExtensible,s=t(function(){});return tl=s||i?function(t){return!!n(t)&&((!i||"ArrayBuffer"!==r(t))&&(!e||e(t)))}:e}function gl(){if(el)return hl.exports;el=1;var t=Ti(),n=Nt(),r=vr(),i=Vt(),e=_n(),s=Hn().f,u=Br(),o=vl(),a=ll(),c=On(),f=function(){if(il)return rl;il=1;var t=j();return rl=!t(function(){return Object.isExtensible(Object.preventExtensions({}))})}(),h=!1,d=c("meta"),v=0,l=function(t){s(t,d,{value:{objectID:"O"+v++,weakData:{}}})},g=hl.exports={enable:function(){g.enable=function(){},h=!0;var r=u.f,i=n([].splice),e={};e[d]=1,r(e).length&&(u.f=function(t){for(var n=r(t),e=0,s=n.length;e<s;e++)if(n[e]===d){i(n,e,1);break}return n},t({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:o.f}))},fastKey:function(t,n){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!e(t,d)){if(!a(t))return"F";if(!n)return"E";l(t)}return t[d].objectID},getWeakData:function(t,n){if(!e(t,d)){if(!a(t))return!0;if(!n)return!1;l(t)}return t[d].weakData},onFreeze:function(t){return f&&h&&a(t)&&!e(t,d)&&l(t),t}};return r[d]=!0,hl.exports}fl||(fl=1,cl||(cl=1,function(){if(ul)return sl;ul=1;var t=Ti(),n=_(),r=Nt(),i=Si(),e=wr(),s=gl(),u=du(),o=Is(),a=jt(),c=Mt(),f=Vt(),h=j(),d=vu(),v=ys(),l=yf();return sl=function(g,w,m){var p=-1!==g.indexOf("Map"),y=-1!==g.indexOf("Weak"),b=p?"set":"add",E=n[g],I=E&&E.prototype,S=E,T={},k=function(t){var n=r(I[t]);e(I,t,"add"===t?function(t){return n(this,0===t?0:t),this}:"delete"===t?function(t){return!(y&&!f(t))&&n(this,0===t?0:t)}:"get"===t?function(t){return y&&!f(t)?void 0:n(this,0===t?0:t)}:"has"===t?function(t){return!(y&&!f(t))&&n(this,0===t?0:t)}:function(t,r){return n(this,0===t?0:t,r),this})};if(i(g,!a(E)||!(y||I.forEach&&!h(function(){(new E).entries().next()}))))S=m.getConstructor(w,g,p,b),s.enable();else if(i(g,!0)){var R=new S,A=R[b](y?{}:-0,1)!==R,_=h(function(){R.has(1)}),O=d(function(t){new E(t)}),C=!y&&h(function(){for(var t=new E,n=5;n--;)t[b](n,n);return!t.has(-0)});O||((S=w(function(t,n){o(t,I);var r=l(new E,t,S);return c(n)||u(n,r[b],{that:r,AS_ENTRIES:p}),r})).prototype=I,I.constructor=S),(_||C)&&(k("delete"),k("has"),p&&k("get")),(C||A)&&k(b),y&&I.clear&&delete I.clear}return T[g]=S,t({global:!0,constructor:!0,forced:S!==E},T),v(S,g),y||m.setStrong(S,g,p),S}}()("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},function(){if(al)return ol;al=1;var t=$i(),n=bs(),r=nh(),i=As(),e=Is(),s=Mt(),u=du(),o=ff(),a=hf(),c=Es(),f=V(),h=gl().fastKey,d=lr(),v=d.set,l=d.getterFor;return ol={getConstructor:function(o,a,c,d){var g=o(function(n,r){e(n,w),v(n,{type:a,index:t(null),first:null,last:null,size:0}),f||(n.size=0),s(r)||u(r,n[d],{that:n,AS_ENTRIES:c})}),w=g.prototype,m=l(a),p=function(t,n,r){var i,e,s=m(t),u=y(t,n);return u?u.value=r:(s.last=u={index:e=h(n,!0),key:n,value:r,previous:i=s.last,next:null,removed:!1},s.first||(s.first=u),i&&(i.next=u),f?s.size++:t.size++,"F"!==e&&(s.index[e]=u)),t},y=function(t,n){var r,i=m(t),e=h(n);if("F"!==e)return i.index[e];for(r=i.first;r;r=r.next)if(r.key===n)return r};return r(w,{clear:function(){for(var n=m(this),r=n.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=null),r=r.next;n.first=n.last=null,n.index=t(null),f?n.size=0:this.size=0},delete:function(t){var n=this,r=m(n),i=y(n,t);if(i){var e=i.next,s=i.previous;delete r.index[i.index],i.removed=!0,s&&(s.next=e),e&&(e.previous=s),r.first===i&&(r.first=e),r.last===i&&(r.last=s),f?r.size--:n.size--}return!!i},forEach:function(t){for(var n,r=m(this),e=i(t,arguments.length>1?arguments[1]:void 0);n=n?n.next:r.first;)for(e(n.value,n.key,this);n&&n.removed;)n=n.previous},has:function(t){return!!y(this,t)}}),r(w,c?{get:function(t){var n=y(this,t);return n&&n.value},set:function(t,n){return p(this,0===t?0:t,n)}}:{add:function(t){return p(this,t=0===t?0:t,t)}}),f&&n(w,"size",{configurable:!0,get:function(){return m(this).size}}),g},setStrong:function(t,n,r){var i=n+" Iterator",e=l(n),s=l(i);o(t,n,function(t,n){v(this,{type:i,target:t,state:e(t),kind:n,last:null})},function(){for(var t=s(this),n=t.kind,r=t.last;r&&r.removed;)r=r.previous;return t.target&&(t.last=r=r?r.next:t.state.first)?a("keys"===n?r.key:"values"===n?r.value:[r.key,r.value],!1):(t.target=null,a(void 0,!0))},r?"entries":"values",!r,!0),c(n)}},ol}())));var wl;wl||(wl=1,Ti()({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991}));var ml,pl,yl,bl={};function El(t){return El="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},El(t)}!function(){if(yl)return bl;yl=1;var t=Ti(),n=function(){if(pl)return ml;pl=1;var t=_(),n=j(),r=Nt(),i=ja(),e=La().trim,s=Va(),u=t.parseInt,o=t.Symbol,a=o&&o.iterator,c=/^[+-]?0x/i,f=r(c.exec),h=8!==u(s+"08")||22!==u(s+"0x16")||a&&!n(function(){u(Object(a))});return ml=h?function(t,n){var r=e(i(t));return u(r,n>>>0||(f(c,r)?16:10))}:u}();t({global:!0,forced:parseInt!==n},{parseInt:n})}();var Il,Sl=function(){function t(t,n,r){void 0===t&&(t="WebSDK"),void 0===n&&(n=2),void 0===r&&(r="data"),this.db=null,this.dbName=t,this.version=n,this.storeName=r,this.eventsStoreName="events"}return t.prototype.openDB=function(){return Bu(this,void 0,void 0,function(){var t=this;return Gu(this,function(n){return this.db?[2,this.db]:[2,new Promise(function(n,r){var i=indexedDB.open(t.dbName,t.version);i.onerror=function(){return r(i.error)},i.onsuccess=function(){t.db=i.result,n(t.db)},i.onupgradeneeded=function(n){var r=n.target.result;if(r.objectStoreNames.contains(t.storeName)||r.createObjectStore(t.storeName),!r.objectStoreNames.contains(t.eventsStoreName)){var i=r.createObjectStore(t.eventsStoreName,{keyPath:"id"});i.createIndex("timestamp","timestamp",{unique:!1}),i.createIndex("status","status",{unique:!1})}}})]})})},t.prototype.getItem=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.storeName],"readonly").objectStore(r.storeName).get(t);s.onerror=function(){return e(s.error)},s.onsuccess=function(){var t=s.result;i(null==t?null:"string"==typeof t?t:"object"===El(t)?JSON.stringify(t):String(t))}})]}})})},t.prototype.setItem=function(t,n){return Bu(this,void 0,void 0,function(){var r,i=this;return Gu(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return r=e.sent(),[2,new Promise(function(e,s){var u=r.transaction([i.storeName],"readwrite").objectStore(i.storeName).put(n,t);u.onerror=function(){return s(u.error)},u.onsuccess=function(){return e()}})]}})})},t.prototype.removeItem=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.storeName],"readwrite").objectStore(r.storeName).delete(t);s.onerror=function(){return e(s.error)},s.onsuccess=function(){return i()}})]}})})},t.prototype.clear=function(){return Bu(this,void 0,void 0,function(){var t,n=this;return Gu(this,function(r){switch(r.label){case 0:return[4,this.openDB()];case 1:return t=r.sent(),[2,new Promise(function(r,i){var e=t.transaction([n.storeName],"readwrite").objectStore(n.storeName).clear();e.onerror=function(){return i(e.error)},e.onsuccess=function(){return r()}})]}})})},t.prototype.close=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.db&&(this.db.close(),this.db=null),[2]})})},t.prototype.addEvent=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readwrite").objectStore(r.eventsStoreName).add(t);s.onerror=function(){return e(s.error)},s.onsuccess=function(){return i()}})]}})})},t.prototype.getOldestPendingEvents=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i=this;return void 0===n&&(n=50),Gu(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return r=e.sent(),[2,new Promise(function(e,s){var u=r.transaction([i.eventsStoreName],"readonly").objectStore(i.eventsStoreName).index("timestamp").openCursor(),o=[],a=0;u.onerror=function(){return s(u.error)},u.onsuccess=function(r){var i=r.target.result;if(i&&a<n){var s=i.value;"pending"===s.status&&s.accountId===t&&(o.push(s),a++),i.continue()}else e(o)}})]}})})},t.prototype.updateEventStatus=function(t,n,r,i){return Bu(this,void 0,void 0,function(){var e,s=this;return Gu(this,function(u){switch(u.label){case 0:return[4,this.openDB()];case 1:return e=u.sent(),[2,new Promise(function(u,o){var a=e.transaction([s.eventsStoreName],"readwrite").objectStore(s.eventsStoreName),c=a.get(t);c.onerror=function(){return o(c.error)},c.onsuccess=function(){var e=c.result;if(e){e.status=n,e.lastAttempt=Date.now(),r&&(e.error=r),void 0!==i&&(e.attempts=i);var s=a.put(e);s.onerror=function(){return o(s.error)},s.onsuccess=function(){return u()}}else o(new Error("Event with id ".concat(t," not found")))}})]}})})},t.prototype.removeEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readwrite").objectStore(r.eventsStoreName),u=0,o=t.length;0!==o?t.forEach(function(t){var n=s.delete(t);n.onerror=function(){return e(n.error)},n.onsuccess=function(){++u===o&&i()}}):i()})]}})})},t.prototype.recoverOrphanedEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readwrite").objectStore(r.eventsStoreName).openCursor(),u=0;s.onerror=function(){return e(s.error)},s.onsuccess=function(n){var r=n.target.result;if(r){var e=r.value;if("processing"===e.status&&e.accountId===t)e.status="failed",e.lastAttempt=Date.now(),e.error="Recovered from orphaned processing state",r.update(e).onsuccess=function(){u++};r.continue()}else i(u)}})]}})})},t.prototype.getPendingEventCount=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readonly").objectStore(r.eventsStoreName).openCursor(),u=0;s.onerror=function(){return e(s.error)},s.onsuccess=function(n){var r=n.target.result;if(r){var e=r.value;"pending"===e.status&&e.accountId===t&&u++,r.continue()}else i(u)}})]}})})},t.prototype.getRetryableEvents=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i=this;return void 0===n&&(n=5),Gu(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return r=e.sent(),[2,new Promise(function(e,s){var u=r.transaction([i.eventsStoreName],"readonly").objectStore(i.eventsStoreName).openCursor(),o=[];u.onerror=function(){return s(u.error)},u.onsuccess=function(r){var i=r.target.result;if(i){var s=i.value;"failed"===s.status&&s.attempts<=n&&s.accountId===t&&o.push(s),i.continue()}else e(o)}})]}})})},t}(),Tl=function(){function t(t,n,r,i,e){if(this.currentAccountId=null,this.currentCuid=null,this.currentUserIdentifierType=null,this.currentVisitorId=null,this.currentVisitorRefId=null,this.getSessionInfo=null,this.isProcessing=!1,this.processingPromise=null,this.paused=!1,this.apiClient=t,this.logger=n,this.BATCH_SIZE=e||no.BATCH_SIZE,this.RETRY_DELAYS=i||no.DEFAULT_RETRY_DELAYS,r&&"getIndexedDBAdapter"in r){var s=r.getIndexedDBAdapter();s?(n.info("EventQueue: Reusing existing IndexedDB adapter from StorageManager"),this.storage=s):(n.warn("EventQueue: StorageManager has no IndexedDB adapter, creating new one"),this.storage=new Sl)}else r?(n.info("EventQueue: Using provided IndexedDBStorage"),this.storage=r):(n.warn("EventQueue: No storage provided, creating new IndexedDBStorage"),this.storage=new Sl)}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Initializing EventQueue"),[4,this.processQueueIfIdle()];case 1:return t.sent(),this.logger.info("EventQueue initialized successfully"),[2]}})})},t.prototype.setUserContext=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return this.currentAccountId=t,this.currentCuid=n||null,this.currentUserIdentifierType=r||null,this.logger.debug("EventQueue user context set",{accountId:t,cuid:n,userIdentifierType:r}),[4,this.storage.recoverOrphanedEvents(t)];case 1:return(i=e.sent())>0&&this.logger.info("Recovered ".concat(i," orphaned processing events for account ").concat(t)),[2]}})})},t.prototype.setVisitorContext=function(t,n){this.currentVisitorId=t,this.currentVisitorRefId=null!=n?n:null,this.logger.debug("EventQueue visitor context set",{visitorId:t,visitorRefId:n})},t.prototype.setSessionInfoCallback=function(t){this.getSessionInfo=t,this.logger.debug("EventQueue session info callback set")},t.prototype.getCurrentAccountId=function(){return this.currentAccountId},t.prototype.getCurrentCuid=function(){return this.currentCuid},t.prototype.getCurrentVisitorId=function(){return this.currentVisitorId},t.prototype.clearUserContext=function(){this.currentCuid=null,this.currentUserIdentifierType=null,this.logger.debug("EventQueue user context cleared (cuid removed)")},t.prototype.enqueue=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i,e,s;return void 0===n&&(n=!1),Gu(this,function(u){switch(u.label){case 0:if(u.trys.push([0,7,,8]),!this.currentAccountId)throw new Error("Cannot enqueue event: No account context set");if(r=null,!this.getSessionInfo)return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.getSessionInfo()];case 2:return r=u.sent(),[3,4];case 3:return i=u.sent(),this.logger.warn("Failed to resolve session ID at enqueue time",i),[3,4];case 4:return e={id:Bv(),event:t,accountId:this.currentAccountId,timestamp:(new Date).toISOString(),attempts:0,status:no.STATUSES.PENDING,visitorId:this.currentVisitorId,visitorRefId:this.currentVisitorRefId,cuid:this.currentCuid,userIdentifierType:this.currentUserIdentifierType,sessionId:r,isDLR:n},[4,this.storage.addEvent(e)];case 5:return u.sent(),this.logger.debug("Event added to queue",{eventId:e.id,eventName:t.name,visitorId:e.visitorId,cuid:e.cuid,sessionId:e.sessionId,isDLR:n}),[4,this.processQueueIfIdle()];case 6:return u.sent(),[3,8];case 7:throw s=u.sent(),this.logger.error("Failed to enqueue event",{event:t,error:s}),s;case 8:return[2]}})})},t.prototype.processQueueIfIdle=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.paused?(this.logger.debug("Queue processing paused, skipping"),[2]):this.isProcessing?(this.logger.debug("Queue processing already in progress, skipping"),[2]):(this.processingPromise||(this.processingPromise=this.processQueue()),[2,this.processingPromise])})})},t.prototype.getIdentityKey=function(t){var n,r,i,e,s,u=null!==(n=t.visitorId)&&void 0!==n?n:"_none_",o=null!==(r=t.visitorRefId)&&void 0!==r?r:"_none_",a=null!==(i=t.cuid)&&void 0!==i?i:"_none_",c=null!==(e=t.userIdentifierType)&&void 0!==e?e:"_none_",f=null!==(s=t.sessionId)&&void 0!==s?s:"_none_";return"".concat(u,"|").concat(o,"|").concat(a,"|").concat(c,"|").concat(f)},t.prototype.groupEventsByIdentity=function(t){var n,r,i=new Map;try{for(var e=Wu(t),s=e.next();!s.done;s=e.next()){var u=s.value,o=this.getIdentityKey(u),a=i.get(o);a?a.push(u):i.set(o,[u])}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return Array.from(i.values())},t.prototype.processQueue=function(){return Bu(this,void 0,void 0,function(){var n=this;return Gu(this,function(r){switch(r.label){case 0:return this.isProcessing?[2]:"undefined"!=typeof navigator&&"locks"in navigator?[4,navigator.locks.request(t.QUEUE_LOCK_NAME,{ifAvailable:!0},function(t){return Bu(n,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return t?[4,this.executeProcessQueue()]:(this.logger.debug("Queue lock held by another tab, skipping"),[2]);case 1:return n.sent(),[2]}})})})]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,this.executeProcessQueue()];case 3:r.sent(),r.label=4;case 4:return[2]}})})},t.prototype.executeProcessQueue=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:this.isProcessing=!0,this.logger.debug("Starting queue processing"),f.label=1;case 1:f.trys.push([1,16,17,18]),f.label=2;case 2:return this.paused?(this.logger.debug("Queue processing paused mid-cycle, stopping"),[3,15]):[4,this.checkAndPromoteRetryEvents()];case 3:return f.sent(),this.currentAccountId?[4,this.storage.getOldestPendingEvents(this.currentAccountId,this.BATCH_SIZE)]:(this.logger.debug("No account context, skipping event processing"),[3,15]);case 4:if(0===(t=f.sent()).length)return this.logger.debug("No pending events to process"),[3,15];n=this.groupEventsByIdentity(t),this.logger.info("Processing events",{totalEvents:t.length,identityGroups:n.length}),f.label=5;case 5:f.trys.push([5,11,12,13]),a=void 0,r=Wu(n),i=r.next(),f.label=6;case 6:return i.done?[3,10]:(e=i.value,s=e[0],this.logger.debug("Processing identity group",{batchSize:e.length,visitorId:null==s?void 0:s.visitorId,cuid:null==s?void 0:s.cuid,sessionId:null==s?void 0:s.sessionId}),[4,this.markEventsAsProcessing(e)]);case 7:return f.sent(),[4,this.sendBatch(e)];case 8:f.sent(),f.label=9;case 9:return i=r.next(),[3,6];case 10:return[3,13];case 11:return u=f.sent(),a={error:u},[3,13];case 12:try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(a)throw a.error}return[7];case 13:return[4,this.storage.getPendingEventCount(this.currentAccountId)];case 14:return 0===f.sent()?(this.logger.debug("No more pending events"),[3,15]):[3,2];case 15:return[3,18];case 16:return o=f.sent(),this.logger.error("Queue processing failed",o),[3,18];case 17:return this.isProcessing=!1,this.processingPromise=null,this.logger.debug("Queue processing completed"),[7];case 18:return[2]}})})},t.prototype.markEventsAsProcessing=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=Wu(t),r=n.next(),a.label=1;case 1:if(r.done)return[3,6];i=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.storage.updateEventStatus(i.id,"processing")];case 3:return a.sent(),[3,5];case 4:return e=a.sent(),this.logger.warn("Failed to mark event as processing",{eventId:i.id,error:e}),[3,5];case 5:return r=n.next(),[3,1];case 6:return[3,9];case 7:return s=a.sent(),u={error:s},[3,9];case 8:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(u)throw u.error}return[7];case 9:return[2]}})})},t.prototype.sendBatch=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:if(f.trys.push([0,5,,10]),!this.currentAccountId)throw new Error("Missing account context for batch sending");return n=t[0],r=!!(null!==(c=n.visitorId)&&void 0!==c?c:n.visitorRefId),i=!!n.cuid,e=void 0,e=r&&i?"identified":r?"anonymous":"user-only",this.logger.debug("Sending event batch",{batchSize:t.length,trackingMode:e,hasVisitor:r,hasUser:i}),s=t.filter(function(t){return!0===t.isDLR}),(u=t.filter(function(t){return!0!==t.isDLR})).length>0?[4,this.sendRegularEvents(u)]:[3,2];case 1:f.sent(),f.label=2;case 2:return s.length>0?[4,this.sendDLREvents(s)]:[3,4];case 3:f.sent(),f.label=4;case 4:return[2,!0];case 5:return o=f.sent(),a=this.isRetryableHttpError(o),this.logger.error("Failed to send batch",{batchSize:t.length,error:o,isRetryable:a}),a?[4,this.handleFailedBatch(t)]:[3,7];case 6:return f.sent(),[3,9];case 7:return[4,this.removeNonRetryableEvents(t)];case 8:f.sent(),f.label=9;case 9:return[2,!1];case 10:return[2]}})})},t.prototype.sendRegularEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o,a,c,f,h,d,v,l;return Gu(this,function(g){switch(g.label){case 0:if(n=t[0],r=null!==(f=n.visitorId)&&void 0!==f?f:null,i=null!==(h=n.visitorRefId)&&void 0!==h?h:null,e=null!==(d=n.cuid)&&void 0!==d?d:null,s=null!==(v=n.userIdentifierType)&&void 0!==v?v:null,u=null!==(l=n.sessionId)&&void 0!==l?l:null,o=this.apiClient,a=t.map(function(t){return t.event}),!u)throw new Error("Session ID is required for event tracking");return[4,o.sendEvents(a,r||void 0,i||void 0,e||void 0,s||void 0,u)];case 1:return c=g.sent(),[4,this.handleBatchResponse(t,c)];case 2:return g.sent(),[2]}})})},t.prototype.sendDLREvents=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:return n=t[0],r=this.apiClient,i=null!==(o=n.sessionId)&&void 0!==o?o:"",e=fh(i),s={events:t.map(function(t){return t.event}),request_id:Bv(),system_data:e},n.cuid?s.user={identifierName:"id",identifierValue:n.cuid}:n.visitorId&&(s.visitor={identifierName:"id",identifierValue:n.visitorId}),[4,r.sendDLR(s)];case 1:return u=a.sent(),[4,this.handleBatchResponse(t,u)];case 2:return a.sent(),[2]}})})},t.prototype.removeSuccessfulEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:n=t.map(function(t){return t.id}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.storage.removeEvents(n)];case 2:return i.sent(),this.logger.debug("Successfully removed events from storage",{count:n.length}),[3,4];case 3:return r=i.sent(),this.logger.error("Failed to remove events from storage",{eventIds:n,error:r}),[3,4];case 4:return[2]}})})},t.prototype.handleBatchResponse=function(t,n){return Bu(this,void 0,void 0,function(){var r;return Gu(this,function(i){switch(i.label){case 0:return(r=parseInt(n.status.code,10))!==no.GLOBAL_SUCCESS_CODE?[3,2]:[4,this.removeSuccessfulEvents(t)];case 1:return i.sent(),this.logger.info("All events processed successfully",{count:t.length}),[3,8];case 2:return r!==no.PARTIAL_SUCCESS_CODE?[3,4]:[4,this.handlePartialSuccess(t,n.events)];case 3:return i.sent(),[3,8];case 4:return no.RETRYABLE_HTTP_CODES.includes(r)?[4,this.handleFailedBatch(t)]:[3,6];case 5:return i.sent(),this.logger.warn("Batch failed with retryable error",{code:r,message:n.status.message}),[3,8];case 6:return[4,this.removeNonRetryableEvents(t)];case 7:i.sent(),this.logger.error("Batch failed with non-retryable error",{code:r,message:n.status.message}),i.label=8;case 8:return[2]}})})},t.prototype.handlePartialSuccess=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u,o,a,c,f;return Gu(this,function(h){switch(h.label){case 0:r=new Map,n.forEach(function(t){r.set(t.eventRefId,t)}),h.label=1;case 1:h.trys.push([1,12,13,14]),i=Wu(t),e=i.next(),h.label=2;case 2:return e.done?[3,11]:(s=e.value,(u=r.get(s.event.eventRefId))?[3,4]:[4,this.markEventForRetry(s,"No response received")]);case 3:return h.sent(),[3,10];case 4:return u.status.success?[4,this.storage.removeEvents([s.id])]:[3,6];case 5:return h.sent(),this.logger.debug("Event processed successfully",{eventId:s.id}),[3,10];case 6:return o=parseInt(u.status.code,10),no.RETRYABLE_HTTP_CODES.includes(o)?[4,this.markEventForRetry(s,u.status.message)]:[3,8];case 7:return h.sent(),this.logger.debug("Event marked for retry",{eventId:s.id,code:o,message:u.status.message}),[3,10];case 8:return[4,this.storage.removeEvents([s.id])];case 9:h.sent(),this.logger.warn("Event permanently failed - removed",{eventId:s.id,code:o,message:u.status.message}),h.label=10;case 10:return e=i.next(),[3,2];case 11:return[3,14];case 12:return a=h.sent(),c={error:a},[3,14];case 13:try{e&&!e.done&&(f=i.return)&&f.call(i)}finally{if(c)throw c.error}return[7];case 14:return[2]}})})},t.prototype.markEventForRetry=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:return r=(t.attempts||0)+1,[4,this.storage.updateEventStatus(t.id,"failed","Attempt ".concat(r," failed: ").concat(n),r)];case 1:return s.sent(),i=Math.min(Math.max(r-1,0),this.RETRY_DELAYS.length-1),e=this.RETRY_DELAYS[i],this.logger.debug("Event marked for retry",{eventId:t.id,attempts:r,delay:e,isInfiniteRetry:r>this.RETRY_DELAYS.length}),[2]}})})},t.prototype.checkAndPromoteRetryEvents=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f,h;return Gu(this,function(d){switch(d.label){case 0:return d.trys.push([0,10,,11]),this.currentAccountId?[4,this.storage.getRetryableEvents(this.currentAccountId,Number.MAX_SAFE_INTEGER)]:(this.logger.debug("No account context, skipping retry check"),[2]);case 1:if(0===(t=d.sent()).length)return[2];n=0,d.label=2;case 2:d.trys.push([2,7,8,9]),r=Wu(t),i=r.next(),d.label=3;case 3:return i.done?[3,6]:(e=i.value,s=Math.min(Math.max(e.attempts-1,0),this.RETRY_DELAYS.length-1),u=this.RETRY_DELAYS[s],(o=Date.now()-(e.lastAttempt||0))>=(u||0)?[4,this.storage.updateEventStatus(e.id,"pending")]:[3,5]);case 4:d.sent(),n++,this.logger.debug("Failed event promoted to pending",{eventId:e.id,attempt:e.attempts+1,delay:u,timeSinceLastAttempt:o}),d.label=5;case 5:return i=r.next(),[3,3];case 6:return[3,9];case 7:return a=d.sent(),f={error:a},[3,9];case 8:try{i&&!i.done&&(h=r.return)&&h.call(r)}finally{if(f)throw f.error}return[7];case 9:return n>0&&this.logger.debug("Promoted ".concat(n," failed events for retry")),[3,11];case 10:return c=d.sent(),this.logger.error("Failed to check retry events",c),[3,11];case 11:return[2]}})})},t.prototype.isRetryableHttpError=function(t){var n,r,i,e,s=t;if(s.code){var u=parseInt(s.code,10);return no.RETRYABLE_HTTP_CODES.includes(u)}return null!==(e=(null===(n=s.message)||void 0===n?void 0:n.includes("network"))||(null===(r=s.message)||void 0===r?void 0:r.includes("timeout"))||(null===(i=s.message)||void 0===i?void 0:i.includes("fetch")))&&void 0!==e&&e},t.prototype.removeNonRetryableEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:n=t.map(function(t){return t.id}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.storage.removeEvents(n)];case 2:return i.sent(),this.logger.warn("Non-retryable events removed permanently",{eventIds:n}),[3,4];case 3:return r=i.sent(),this.logger.error("Failed to remove non-retryable events",{eventIds:n,error:r}),[3,4];case 4:return[2]}})})},t.prototype.handleFailedBatch=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=Wu(t),r=n.next(),a.label=1;case 1:if(r.done)return[3,6];i=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.markEventForRetry(i,"Batch failed")];case 3:return a.sent(),[3,5];case 4:return e=a.sent(),this.logger.error("Failed to mark event for retry",{eventId:i.id,error:e}),[3,5];case 5:return r=n.next(),[3,1];case 6:return[3,9];case 7:return s=a.sent(),u={error:s},[3,9];case 8:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(u)throw u.error}return[7];case 9:return[2]}})})},t.prototype.pause=function(){this.paused=!0,this.logger.info("EventQueue paused")},t.prototype.resume=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.paused=!1,this.logger.info("EventQueue resumed"),[4,this.processQueueIfIdle()];case 1:return t.sent(),[2]}})})},t.prototype.flush=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Manual flush requested"),[4,this.processQueueIfIdle()];case 1:return t.sent(),[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying EventQueue"),this.processingPromise?[4,this.processingPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this.storage.close()];case 3:return t.sent(),this.logger.info("EventQueue destroyed"),[2]}})})},t.QUEUE_LOCK_NAME="websdk-event-queue-lock",t}(),kl=function(){function t(t,n,r,i){this.eventQueue=null,this.initialized=!1,this.visitorId=null,this.visitorTrackingEnabled=null,this.config=t,this.logger=i,this.apiClient=n,this.storageManager=r}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("EventTracker already initialized"),[2]):(this.logger.info("Initializing EventTracker with IndexedDB queue"),this.eventQueue=new Tl(this.apiClient,this.logger,this.storageManager,this.config.retryDelays,this.config.batchSize),[4,this.eventQueue.init()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(po),[2]}})})},t.prototype.setUserContext=function(t,n,r){return Bu(this,void 0,void 0,function(){return Gu(this,function(i){switch(i.label){case 0:if(!this.eventQueue)throw new Error("EventTracker not initialized");return[4,this.eventQueue.setUserContext(t,n,r)];case 1:return i.sent(),this.logger.info("User context set",{accountId:t,cuid:n,userIdentifierType:r}),[2]}})})},t.prototype.setVisitorTrackingState=function(t,n,r){this.visitorId=t,this.visitorTrackingEnabled=n,this.eventQueue&&this.eventQueue.setVisitorContext(t,r),this.logger.debug("Visitor tracking state updated",{visitorId:t,visitorRefId:r,isEnabled:n,trackingMode:t?"anonymous":"not-configured"})},t.prototype.setSessionInfoCallback=function(t){if(!this.eventQueue)throw new Error("EventTracker not initialized");this.eventQueue.setSessionInfoCallback(t),this.logger.debug("Session info callback set in EventTracker")},t.prototype.clearUserContext=function(){this.eventQueue?(this.eventQueue.clearUserContext(),this.logger.info("User context cleared from EventTracker")):this.logger.warn("Cannot clear user context - EventTracker not initialized")},t.prototype.track=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:if(!this.initialized||!this.eventQueue)throw new Error("EventTracker not initialized");if(!1===this.visitorTrackingEnabled)throw this.logger.warn("Event tracking is disabled - visitor tracking is not enabled"),new Error("Event tracking is disabled");this.logger.debug("Tracking event",{event:t}),i.label=1;case 1:return i.trys.push([1,3,,4]),n=this.convertToApiEvent(t),[4,this.eventQueue.enqueue(n)];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.logger.error(bo,{event:t,error:r}),new Error("".concat(vo,": ").concat(r));case 4:return[2]}})})},t.prototype.convertToApiEvent=function(t){if(!t.name||""===t.name.trim())throw new Error("Event name is required");var n=zu({},t.data);if(!this.eventQueue)throw new Error("EventTracker not initialized");var r,i=this.eventQueue.getCurrentCuid();if(!i&&!this.visitorId){var e=null===this.visitorTrackingEnabled?"Cannot track event: User must be identified (cuid) or visitor tracking must be configured":"Cannot track event: Either visitor tracking must be enabled or user must be identified";throw this.logger.error(e,{hasVisitorId:!!this.visitorId,hasCuid:!1,visitorTrackingEnabled:this.visitorTrackingEnabled}),new Error(e)}return r=this.visitorId&&i?"identified":this.visitorId?"anonymous":"user-only",this.logger.debug("Creating event payload",{eventName:t.name,hasCuid:!!i,hasVisitorId:!!this.visitorId,trackingMode:r,visitorTrackingEnabled:this.visitorTrackingEnabled}),function(t,n){if(!t||""===t.trim())throw new Error("Event name is required");return{name:t.trim(),eventRefId:Bv(),eventDateTime:(new Date).toISOString(),attributes:n||{}}}(t.name,n)},t.prototype.pause=function(){this.eventQueue&&this.eventQueue.pause(),this.logger.info("EventTracker paused")},t.prototype.resume=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.eventQueue?[4,this.eventQueue.resume()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.logger.info("EventTracker resumed"),[2]}})})},t.prototype.flush=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized&&this.eventQueue?(this.logger.info("Manual flush requested"),[4,this.eventQueue.flush()]):(this.logger.warn("Cannot flush events - EventTracker not initialized"),[2]);case 1:return t.sent(),[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying EventTracker"),this.eventQueue?[4,this.eventQueue.destroy()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.initialized=!1,this.logger.info(yo),[2]}})})},t.prototype.trackNotificationReceived=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("received",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackNotificationClicked=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("clicked",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackNotificationDismissed=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("dismissed",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackDLREvent=function(t,n){return Bu(this,void 0,void 0,function(){var r,i;return Gu(this,function(e){switch(e.label){case 0:if(!this.initialized||!this.eventQueue)return this.logger.warn("EventTracker not initialized, skipping DLR event",{eventType:t}),[2];e.label=1;case 1:return e.trys.push([1,3,,4]),r=this.createDLREvent(t,n),[4,this.eventQueue.enqueue(r,!0)];case 2:return e.sent(),this.logger.info("DLR event tracked: ".concat(t),{eventType:t,eventName:r.name,messageId:n.messageId}),[3,4];case 3:return i=e.sent(),this.logger.error("Failed to track DLR event",{eventType:t,notificationData:n,error:i}),[3,4];case 4:return[2]}})})},t.prototype.createDLREvent=function(t,n){var r,i={received:Sa.NOTIFICATION_RECEIVED,clicked:Sa.NOTIFICATION_CLICKED,dismissed:Sa.NOTIFICATION_DISMISSED},e=null===(r=this.eventQueue)||void 0===r?void 0:r.getCurrentCuid(),s={messageId:n.messageId,gateway:Ta,result:{received:"SUCCESS",clicked:"CLICKED",dismissed:"DISMISSED"}[t],notification_route:ka,cuid:e||null,visitor_id:e?null:this.visitorId||null,scope:n.scope||null};return n.senderId&&(s.senderId=n.senderId),{attributes:s,name:i[t],eventDateTime:(new Date).toISOString(),eventRefId:Bv()}},t.prototype.dispatchDLREvent=function(t){return Bu(this,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:switch(n=zu(zu(zu(zu(zu(zu({messageId:t.messageId},void 0!==t.scope?{scope:t.scope}:{}),void 0!==t.campaignId?{campaignId:t.campaignId}:{}),void 0!==t.variationId?{variationId:t.variationId}:{}),void 0!==t.senderId?{senderId:t.senderId}:{}),void 0!==t.cuid?{cuid:t.cuid}:{}),void 0!==t.accountId?{accountId:t.accountId}:{}),t.type){case"received":return[3,1];case"clicked":return[3,3];case"dismissed":return[3,5]}return[3,7];case 1:return[4,this.trackNotificationReceived(n)];case 2:case 4:case 6:return r.sent(),[3,7];case 3:return[4,this.trackNotificationClicked(n)];case 5:return[4,this.trackNotificationDismissed(n)];case 7:return[2]}})})},t.prototype.processPendingServiceWorkerDLREvents=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:if(!this.initialized)return[2];a.label=1;case 1:return a.trys.push([1,12,,13]),[4,this.getServiceWorkerPendingDLREvents()];case 2:if(0===(t=a.sent()).length)return[2];this.logger.info("Processing pending service worker DLR events",{count:t.length}),a.label=3;case 3:a.trys.push([3,8,9,10]),n=Wu(t),r=n.next(),a.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this.dispatchDLREvent(i)]);case 5:a.sent(),a.label=6;case 6:return r=n.next(),[3,4];case 7:return[3,10];case 8:return e=a.sent(),u={error:e},[3,10];case 9:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(u)throw u.error}return[7];case 10:return[4,this.clearServiceWorkerPendingDLREvents()];case 11:return a.sent(),this.logger.info("Processed pending service worker DLR events",{count:t.length}),[3,13];case 12:return s=a.sent(),this.logger.error("Failed to process pending service worker DLR events",s),[3,13];case 13:return[2]}})})},t.prototype.getServiceWorkerPendingDLREvents=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return[2,new Promise(function(t){var n=indexedDB.open("WebSDK_DLR_SW",1);n.onerror=function(){return t([])},n.onsuccess=function(){var r=n.result;if(!r.objectStoreNames.contains("pending_dlr_events"))return r.close(),void t([]);var i=r.transaction(["pending_dlr_events"],"readonly").objectStore("pending_dlr_events").getAll();i.onerror=function(){r.close(),t([])},i.onsuccess=function(){r.close(),t(i.result||[])}},n.onupgradeneeded=function(t){var n=t.target.result;n.objectStoreNames.contains("pending_dlr_events")||n.createObjectStore("pending_dlr_events",{keyPath:"id",autoIncrement:!0})}})]})})},t.prototype.clearServiceWorkerPendingDLREvents=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return[2,new Promise(function(t){var n=indexedDB.open("WebSDK_DLR_SW",1);n.onerror=function(){return t()},n.onsuccess=function(){var r=n.result;if(!r.objectStoreNames.contains("pending_dlr_events"))return r.close(),void t();var i=r.transaction(["pending_dlr_events"],"readwrite").objectStore("pending_dlr_events").clear();i.onerror=function(){r.close(),t()},i.onsuccess=function(){r.close(),t()}},n.onupgradeneeded=function(t){var n=t.target.result;n.objectStoreNames.contains("pending_dlr_events")||n.createObjectStore("pending_dlr_events",{keyPath:"id",autoIncrement:!0})}})]})})},t}(),Rl=function(){function t(t,n,r){this.initialized=!1,this.logger=t,this.brandId=n,this.applicationId=r,this.adapter=new Al}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:if(this.initialized)return this.logger.warn("StorageManager already initialized"),[2];this.logger.info("Initializing StorageManager"),e.label=1;case 1:return e.trys.push([1,6,,7]),this.isIndexedDBSupported()?(t=["WebSDK"],this.brandId&&t.push(this.brandId),this.applicationId&&t.push(this.applicationId),n=t.join("_"),r=new Sl(n),[4,this.testStorageAdapter(r)]):[3,3];case 2:return e.sent(),this.adapter=r,this.logger.info("StorageManager initialized with IndexedDB",{dbName:n,brandId:this.brandId,applicationId:this.applicationId}),[3,5];case 3:return[4,this.testStorageAdapter(this.adapter)];case 4:e.sent(),this.logger.info("StorageManager initialized with localStorage"),e.label=5;case 5:return this.initialized=!0,[3,7];case 6:throw i=e.sent(),this.logger.error(So,i),new Error("Storage initialization failed: ".concat(i));case 7:return[2]}})})},t.prototype.isIndexedDBSupported=function(){return"undefined"!=typeof window&&"indexedDB"in window&&null!==indexedDB},t.prototype.testStorageAdapter=function(t){return Bu(this,void 0,void 0,function(){var n,r,i;return Gu(this,function(e){switch(e.label){case 0:n=oo,r=ao,e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.setItem(n,r)];case 2:return e.sent(),[4,t.getItem(n)];case 3:if(e.sent()!==r)throw new Error(ko);return[4,t.removeItem(n)];case 4:return e.sent(),[3,6];case 5:throw i=e.sent(),new Error("".concat(To," ").concat(i));case 6:return[2]}})})},t.prototype.get=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.getItem(t)]})})},t.prototype.set=function(t,n){return Bu(this,void 0,void 0,function(){return Gu(this,function(r){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.setItem(t,n)]})})},t.prototype.remove=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.removeItem(t)]})})},t.prototype.clear=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.clear()]})})},t.prototype.getIndexedDBAdapter=function(){return this.adapter instanceof Sl?this.adapter:null},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:this.logger.info("Destroying StorageManager"),n.label=1;case 1:return n.trys.push([1,4,,5]),this.adapter instanceof Sl?[4,this.adapter.close()]:[3,3];case 2:n.sent(),n.label=3;case 3:return this.initialized=!1,this.logger.info(Ro),[3,5];case 4:return t=n.sent(),this.logger.error(Ao,t),this.initialized=!1,[3,5];case 5:return[2]}})})},t}(),Al=function(){function t(){}return t.prototype.getItem=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){try{return[2,localStorage.getItem(t)]}catch(t){throw new Error("LocalStorage getItem failed: ".concat(t))}return[2]})})},t.prototype.setItem=function(t,n){return Bu(this,void 0,void 0,function(){return Gu(this,function(r){try{localStorage.setItem(t,n)}catch(t){if(t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name))throw new Error("LocalStorage quota exceeded");throw new Error("LocalStorage setItem failed: ".concat(t))}return[2]})})},t.prototype.removeItem=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){try{localStorage.removeItem(t)}catch(t){throw new Error("LocalStorage removeItem failed: ".concat(t))}return[2]})})},t.prototype.clear=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){try{localStorage.clear()}catch(t){throw new Error("LocalStorage clear failed: ".concat(t))}return[2]})})},t}();!function(t){t[t.VERBOSE=0]="VERBOSE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.NONE=5]="NONE"}(Il||(Il={}));var _l,Ol,Cl=function(){function t(t,n){void 0===t&&(t=!1),void 0===n&&(n=Il.INFO),this.logs=[],this.maxLogs=1e3,this.enabled=t,this.level=n}return t.prototype.formatMessage=function(t,n){var r=(new Date).toISOString(),i=Il[t];return"[".concat(r,"] [WebSDK:").concat(i,"] ").concat(n)},t.prototype.log=function(t,n,r){if(this.enabled&&!(t<this.level)){var i={level:t,message:n,timestamp:Date.now(),data:r};this.logs.push(i),this.logs.length>this.maxLogs&&this.logs.shift();var e=this.formatMessage(t,n),s=r?[e,r]:[e];switch(t){case Il.VERBOSE:case Il.DEBUG:console.debug.apply(console,Hu([],qu(s),!1));break;case Il.INFO:console.info.apply(console,Hu([],qu(s),!1));break;case Il.WARN:console.warn.apply(console,Hu([],qu(s),!1));break;case Il.ERROR:console.error.apply(console,Hu([],qu(s),!1))}}},t.prototype.verbose=function(t,n){this.log(Il.VERBOSE,t,n)},t.prototype.debug=function(t,n){this.log(Il.DEBUG,t,n)},t.prototype.info=function(t,n){this.log(Il.INFO,t,n)},t.prototype.warn=function(t,n){this.log(Il.WARN,t,n)},t.prototype.error=function(t,n){this.log(Il.ERROR,t,n)},t.prototype.setLevel=function(t){this.level=t},t.prototype.setEnabled=function(t){this.enabled=t},t.prototype.getLogs=function(){return Hu([],qu(this.logs),!1)},t.prototype.clearLogs=function(){this.logs=[]},t}(),Dl=function(){function t(t,n,r,i,e,s){this.initialized=!1,this.cachedConfig=null,this.orgId=t,this.apiClient=n,this.logger=r,this.storageManager=i,void 0!==e&&(this.brandId=e),void 0!==s&&(this.applicationId=s)}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("VisitorConfigManager already initialized"),[2]):(this.logger.info("Initializing VisitorConfigManager",{orgId:this.orgId}),[4,this.restoreCachedConfig()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(jo),[2]}})})},t.prototype.fetchConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i=this;return Gu(this,function(e){switch(e.label){case 0:if(!this.initialized)throw new Error("VisitorConfigManager not initialized");if(this.cachedConfig)return this.logger.info(Go),[2,this.cachedConfig];e.label=1;case 1:return e.trys.push([1,4,,5]),this.logger.info("Fetching visitor config from API",{orgId:this.orgId}),[4,this.apiClient.getVisitorConfig(this.orgId)];case 2:return(t=e.sent()).warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor config warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){i.logger.error("Visitor config error from response",{code:t.code,message:t.message})}),this.cachedConfig=t,[4,this.storeCachedConfig(t)];case 3:return e.sent(),this.logger.info(Vo,{isEnabled:null===(r=t.data)||void 0===r?void 0:r.visitorTrackingEnabled}),[2,t];case 4:throw n=e.sent(),this.logger.error(Lo,n),new Error("".concat(lo,": ").concat(n));case 5:return[2]}})})},t.prototype.isVisitorTrackingEnabled=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.fetchConfig()];case 1:return t=e.sent(),(n=!0===(null===(i=t.data)||void 0===i?void 0:i.visitorTrackingEnabled))?this.logger.info(Bo):this.logger.info(zo),[2,n];case 2:return r=e.sent(),this.logger.error("Failed to check visitor tracking status",r),[2,!1];case 3:return[2]}})})},t.prototype.refreshConfig=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){if(!this.initialized)throw new Error("VisitorConfigManager not initialized");return this.logger.info("Force refreshing visitor config from API"),this.cachedConfig=null,[2,this.fetchConfig()]})})},t.prototype.getCachedConfig=function(){return this.cachedConfig},t.prototype.storeCachedConfig=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.set(n,JSON.stringify(t))];case 1:return i.sent(),this.logger.debug("Visitor config cached to storage",{key:n}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store visitor config to cache",r),[3,3];case 3:return[2]}})})},t.prototype.restoreCachedConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e;return Gu(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t=so("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=s.sent())&&(r=JSON.parse(n),this.cachedConfig=r,this.logger.info("Visitor config restored from cache",{isEnabled:null===(e=r.data)||void 0===e?void 0:e.visitorTrackingEnabled})),[3,3];case 2:return i=s.sent(),this.logger.warn("Failed to restore visitor config from cache",i),this.cachedConfig=null,[3,3];case 3:return[2]}})})},t.prototype.clearCachedConfig=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:this.cachedConfig=null,r.label=1;case 1:return r.trys.push([1,3,,4]),t=so("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 2:return r.sent(),this.logger.debug("Visitor config cache cleared"),[3,4];case 3:return n=r.sent(),this.logger.warn("Failed to clear visitor config cache",n),[3,4];case 4:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying VisitorConfigManager"),[4,this.clearCachedConfig()];case 1:return t.sent(),this.initialized=!1,this.logger.info("VisitorConfigManager destroyed successfully"),[2]}})})},t}(),Nl={};Ol||(Ol=1,function(){if(_l)return Nl;_l=1;var t=Ti(),n=_();t({global:!0,forced:n.globalThis!==n},{globalThis:n})}());var Fl,Pl=function(){function t(t,n,r,i,e,s,u){this.initialized=!1,this.visitorId=null,this.visitorRefId=null,this.expiredAt=null,this.getFcmToken=null,this.getChannelType=null,this.getExtendedFields=null,this.getPermissionGranted=null,this.mergeRetryTimeoutId=null,this.accountId=t,this.orgId=n,this.source=r,this.apiClient=i,this.logger=e,this.storageManager=s,void 0!==(null==u?void 0:u.brandId)&&(this.brandId=u.brandId),void 0!==(null==u?void 0:u.applicationId)&&(this.applicationId=u.applicationId)}return t.prototype.setMergeDataProviders=function(t,n,r,i){this.getFcmToken=t,this.getChannelType=n,this.getExtendedFields=r,this.getPermissionGranted=i},t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("AnonymousVisitorManager already initialized"),[2]):(this.logger.info("Initializing AnonymousVisitorManager",{accountId:this.accountId,orgId:this.orgId}),[4,this.restoreVisitorId()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(Wo),[2]}})})},t.prototype.getOrCreateVisitorId=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:if(!this.initialized)throw new Error("AnonymousVisitorManager not initialized");if(this.visitorId&&!this.isVisitorExpired())return this.logger.info(Xo,{visitorId:this.visitorId}),[2,this.visitorId];if(this.visitorId&&this.isVisitorExpired()&&this.logger.info("Visitor session expired, creating new visitor via API",{visitorId:this.visitorId,expiredAt:this.expiredAt}),!this.accountId||""===this.accountId.trim())throw r=new Error("AccountId is required for visitor creation"),this.logger.error("Visitor creation validation failed",r),r;o.label=1;case 1:return o.trys.push([1,5,,6]),this.logger.info("Creating new visitor ID",{accountId:this.accountId,hasCommChannels:!!t&&t.length>0,hasExtendedFields:!!n}),[4,this.createVisitor(t,n)];case 2:return i=o.sent(),e=i.visitorId,s=i.expiredAt,this.visitorId=e,[4,this.storeVisitorId(e)];case 3:return o.sent(),[4,this.storeExpiredAt(s)];case 4:return o.sent(),this.logger.info(qo,{visitorId:e}),[2,e];case 5:throw u=o.sent(),this.logger.error(Ho,u),u;case 6:return[2]}})})},t.prototype.createVisitor=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.getOrGenerateVisitorRefId()];case 1:return r=o.sent(),i=t&&t.length>0?t:[],e=zu({visitorRefId:r,profiles:[{source:this.source,accountId:this.accountId,commChannels:i}]},n&&{extendedFields:n}),this.logger.debug("Visitor creation request payload",{request:e}),[4,this.apiClient.createVisitor(this.orgId,e)];case 2:return s=o.sent(),[2,this.handleCreateVisitorResponse(s)];case 3:throw u=o.sent(),this.handleCreateVisitorError(u),u;case 4:return[2]}})})},t.prototype.handleCreateVisitorResponse=function(t){var n,r,i=this;t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor creation warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){i.logger.error("Visitor creation error from response",{code:t.code,message:t.message})});var e=null===(n=t.data)||void 0===n?void 0:n.id;if(!e||""===e.trim())throw new Error("Invalid visitor ID received from API");var s=null===(r=t.data)||void 0===r?void 0:r.expiredAt;if(!s)throw new Error("Missing expiredAt in visitor creation response");return{visitorId:e,expiredAt:s}},t.prototype.handleCreateVisitorError=function(t){var n,r=this;try{var i=(null===(n=t.response)||void 0===n?void 0:n.data)||t;i.warnings&&i.warnings.length>0&&i.warnings.forEach(function(t){t.code===Ea.ACCOUNT_NOT_EXISTS?r.logger.error("Account does not exist",{code:t.code,message:t.message,accountId:r.accountId}):r.logger.warn("Visitor creation warning",{code:t.code,message:t.message})}),i.errors&&i.errors.length>0&&i.errors.forEach(function(t){t.code===Ea.ACCOUNT_ID_NOT_PASSED?r.logger.error("AccountId not passed",{code:t.code,message:t.message}):r.logger.error("Visitor creation error",{code:t.code,message:t.message})})}catch(t){this.logger.warn("Failed to parse visitor creation error",t)}},t.prototype.updateVisitor=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:if(!this.initialized)throw new Error("AnonymousVisitorManager not initialized");if(!this.visitorId)throw new Error("No visitor ID exists. Create a visitor first.");o.label=1;case 1:return o.trys.push([1,3,,4]),this.logger.info("Updating visitor",{visitorId:this.visitorId,hasCommChannels:!!t&&t.length>0,hasExtendedFields:!!n}),r=t&&t.length>0?t:[],i=zu({profiles:[{source:this.source,accountId:this.accountId,commChannels:r}]},n&&{extendedFields:n}),this.logger.debug("Visitor update request payload",{request:i}),[4,this.apiClient.updateVisitor(this.orgId,this.visitorId,i)];case 2:return e=o.sent(),s=this.handleUpdateVisitorResponse(e),this.logger.info($o,{visitorId:s}),[2,s];case 3:throw u=o.sent(),this.handleUpdateVisitorError(u),this.logger.error(Qo,u),u;case 4:return[2]}})})},t.prototype.handleUpdateVisitorResponse=function(t){var n,r=this;t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){r.logger.warn("Visitor update warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){r.logger.error("Visitor update error from response",{code:t.code,message:t.message})});var i=null===(n=t.data)||void 0===n?void 0:n.id;if(!i||""===i.trim())throw new Error("Invalid visitor ID received from update API");return i},t.prototype.handleUpdateVisitorError=function(t){var n,r=this;try{var i=(null===(n=t.response)||void 0===n?void 0:n.data)||t;i.warnings&&i.warnings.length>0&&i.warnings.forEach(function(t){t.code===Ea.ACCOUNT_NOT_EXISTS?r.logger.error("Account does not exist",{code:t.code,message:t.message,accountId:r.accountId}):r.logger.warn("Visitor update warning",{code:t.code,message:t.message})}),i.errors&&i.errors.length>0&&i.errors.forEach(function(t){r.logger.error("Visitor update error",{code:t.code,message:t.message})})}catch(t){this.logger.warn("Failed to parse visitor update error",t)}},t.prototype.mergeVisitorWithUser=function(t,n,r,i,e,s){var u=this;if(this.initialized)if(this.visitorId)if(r||i||e){var o=this.visitorId,a=this.visitorRefId;this.isMerged().then(function(c){if(!c)return u.persistPendingMerge(o,a,zu(zu(zu(zu({firstName:t,lastName:n},void 0!==r&&{email:r}),void 0!==i&&{mobile:i}),void 0!==e&&{externalId:e}),void 0!==s&&{customData:s})).then(function(){return u.attemptPendingMerge()});u.logger.info(Zo,{reason:"Visitor already merged",visitorId:o})}).catch(function(t){u.logger.warn("Merge background task failed unexpectedly",t)})}else this.logger.warn(Zo,{reason:"No email, mobile, or externalId"});else this.logger.warn(Zo,{reason:"No visitor ID"});else this.logger.warn(Zo,{reason:"Not initialized"})},t.prototype.retryPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,this.getPendingMerge()];case 1:return(t=r.sent())?[4,this.isMerged()]:[2];case 2:return r.sent()?[4,this.clearPendingMerge()]:[3,4];case 3:return r.sent(),this.logger.info(Zo,{reason:"Already merged"}),[2];case 4:return t.attempts>=ma?(this.logger.error(Yo,{visitorId:t.visitorId,attempts:t.attempts,message:"Max retries exhausted"}),[4,this.clearPendingMerge()]):[3,6];case 5:return r.sent(),[2];case 6:return this.scheduleMergeRetry(),[3,8];case 7:return n=r.sent(),this.logger.warn("Failed to retry pending merge",n),[3,8];case 8:return[2]}})})},t.prototype.cancelMergeRetryTimer=function(){null!==this.mergeRetryTimeoutId&&(globalThis.clearTimeout(this.mergeRetryTimeoutId),this.mergeRetryTimeoutId=null)},t.prototype.scheduleMergeRetry=function(){var t=this;this.cancelMergeRetryTimer(),this.mergeRetryTimeoutId=globalThis.setTimeout(function(){t.mergeRetryTimeoutId=null,t.attemptPendingMerge().catch(function(n){t.logger.warn("Scheduled merge retry failed unexpectedly",n)})},pa)},t.prototype.attemptPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:return[4,this.getPendingMerge()];case 1:if(!(t=a.sent()))return[2];n=this.getFcmToken?this.getFcmToken():null,r=this.getChannelType?this.getChannelType():void 0,i=!this.getPermissionGranted||this.getPermissionGranted(),a.label=2;case 2:return a.trys.push([2,6,,7]),this.getExtendedFields?[4,this.getExtendedFields()]:[3,4];case 3:return s=a.sent(),[3,5];case 4:s=void 0,a.label=5;case 5:return e=s,[3,7];case 6:return u=a.sent(),this.logger.warn("Failed to collect extended fields for merge, proceeding without them",u),e=void 0,[3,7];case 7:return a.trys.push([7,11,,13]),[4,this.apiClient.mergeVisitor(t.visitorId,t.visitorRefId||null,zu(zu(zu(zu(zu(zu(zu({firstName:t.firstName,lastName:t.lastName},void 0!==t.email&&{email:t.email}),void 0!==t.mobile&&{mobile:t.mobile}),n?{fcmToken:n,subscribed:i}:{}),void 0!==r&&{channelType:r}),{fields:t.customData||{}}),void 0!==e&&{extendedFields:e}),void 0!==t.externalId&&{externalId:t.externalId}))];case 8:return a.sent(),[4,this.markAsMerged(t.visitorId)];case 9:return a.sent(),[4,this.clearPendingMerge()];case 10:return a.sent(),this.logger.info(Jo,{visitorId:t.visitorId,attempts:t.attempts+1}),[3,13];case 11:return o=a.sent(),[4,this.handleMergeRetryOrAbort(o,t)];case 12:return a.sent(),[3,13];case 13:return[2]}})})},t.prototype.handleMergeRetryOrAbort=function(t,n){return Bu(this,void 0,void 0,function(){var r;return Gu(this,function(i){switch(i.label){case 0:return t instanceof Xv?[4,this.clearPendingMerge()]:[3,2];case 1:return i.sent(),this.logger.error("Visitor merge failed permanently, will not retry",{code:t.code,message:t.message,visitorId:n.visitorId}),[2];case 2:return r=zu(zu({},n),{attempts:n.attempts+1}),[4,this.savePendingMerge(r)];case 3:return i.sent(),r.attempts>=ma?(this.logger.error(Yo,{visitorId:n.visitorId,attempts:r.attempts,message:"Max retries exhausted"}),[4,this.clearPendingMerge()]):[3,5];case 4:return i.sent(),[2];case 5:return this.logger.warn("Visitor merge attempt failed, scheduling retry",{attempt:r.attempts,maxRetries:ma,nextRetryMs:pa,visitorId:n.visitorId,error:t}),this.scheduleMergeRetry(),[2]}})})},t.prototype.persistPendingMerge=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:return i=r.firstName,e=r.lastName,s=r.email,u=r.mobile,o=r.externalId,a=r.customData,c=zu(zu(zu(zu(zu(zu(zu({visitorId:t},n&&{visitorRefId:n}),{firstName:i,lastName:e}),void 0!==s&&{email:s}),void 0!==u&&{mobile:u}),void 0!==o&&{externalId:o}),void 0!==a&&{customData:a}),{attempts:0}),[4,this.savePendingMerge(c)];case 1:return f.sent(),this.logger.debug("Pending merge request persisted to storage",{visitorId:t}),[2]}})})},t.prototype.getPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=so("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=i.sent())?[2,JSON.parse(n)]:[2,null];case 2:return r=i.sent(),this.logger.warn("Failed to read pending merge from storage",r),[2,null];case 3:return[2]}})})},t.prototype.savePendingMerge=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.set(n,JSON.stringify(t))];case 1:return i.sent(),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to save pending merge to storage",r),[3,3];case 3:return[2]}})})},t.prototype.clearPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:this.cancelMergeRetryTimer(),r.label=1;case 1:return r.trys.push([1,3,,4]),t=so("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 2:return r.sent(),this.logger.debug("Pending merge cleared from storage"),[3,4];case 3:return n=r.sent(),this.logger.warn("Failed to clear pending merge from storage",n),[3,4];case 4:return[2]}})})},t.prototype.isMerged=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,null!=r.sent()];case 2:return n=r.sent(),this.logger.warn("Failed to check merge status",n),[2,!1];case 3:return[2]}})})},t.prototype.getMergedUserId=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,null!=(n=i.sent())?n:null];case 2:return r=i.sent(),this.logger.warn("Failed to get merge status",r),[2,null];case 3:return[2]}})})},t.prototype.clearMergedUserId=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 1:return r.sent(),this.logger.info("Merge status cleared from storage"),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to clear merge status",n),[3,3];case 3:return[2]}})})},t.prototype.markAsMerged=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),this.logger.debug("Visitor marked as merged",{visitorId:t,key:n}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store merge status",r),[3,3];case 3:return[2]}})})},t.prototype.getVisitorId=function(){return this.visitorId},t.prototype.getVisitorRefId=function(){return this.visitorRefId},t.prototype.hasVisitorId=function(){return null!==this.visitorId},t.prototype.storeVisitorId=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("VISITOR_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),this.logger.debug("Visitor ID stored to storage",{visitorId:t,key:n}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store visitor ID",r),[3,3];case 3:return[2]}})})},t.prototype.storeExpiredAt=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.expiredAt=t,n=so("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),this.logger.debug("Visitor expiredAt stored to storage",{expiredAt:t}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store visitor expiredAt",r),[3,3];case 3:return[2]}})})},t.prototype.isVisitorExpired=function(){if(!this.expiredAt)return!0;try{return new Date(this.expiredAt).getTime()<=Date.now()}catch(t){return this.logger.warn("Invalid expiredAt format, treating as expired",{expiredAt:this.expiredAt}),!0}},t.prototype.getOrGenerateVisitorRefId=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:if(this.visitorRefId)return[2,this.visitorRefId];t=Bv(),this.visitorRefId=t,i.label=1;case 1:return i.trys.push([1,3,,4]),n=so("VISITOR_REF_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 2:return i.sent(),this.logger.debug("visitorRefId generated and stored",{visitorRefId:t}),[3,4];case 3:return r=i.sent(),this.logger.warn("Failed to store visitorRefId",r),[3,4];case 4:return[2,t]}})})},t.prototype.restoreVisitorId=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),t=so("VISITOR_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=o.sent())&&(this.visitorId=n,this.logger.info(Ko,{visitorId:n})),r=so("VISITOR_REF_ID",this.brandId,this.applicationId),[4,this.storageManager.get(r)];case 2:return(i=o.sent())&&(this.visitorRefId=i),e=so("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(e)];case 3:return(s=o.sent())&&(this.expiredAt=s),[3,5];case 4:return u=o.sent(),this.logger.warn("Failed to restore visitor ID from storage",u),this.visitorId=null,[3,5];case 5:return[2]}})})},t.prototype.clearVisitorId=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),t=so("VISITOR_ID",this.brandId,this.applicationId),n=so("VISITOR_REF_ID",this.brandId,this.applicationId),r=so("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 1:return e.sent(),[4,this.storageManager.remove(n)];case 2:return e.sent(),[4,this.storageManager.remove(r)];case 3:return e.sent(),this.visitorId=null,this.visitorRefId=null,this.expiredAt=null,this.logger.info("Visitor ID cleared from storage"),[3,5];case 4:return i=e.sent(),this.logger.warn("Failed to clear visitor ID",i),this.visitorId=null,this.visitorRefId=null,this.expiredAt=null,[3,5];case 5:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.logger.info("Destroying AnonymousVisitorManager"),this.cancelMergeRetryTimer(),this.initialized=!1,this.logger.info("AnonymousVisitorManager destroyed successfully"),[2]})})},t}(),Ml={};function xl(){return"undefined"!=typeof window&&window.firebase?window.firebase:null}function Ul(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){return(t=xl())?[2,t]:[2,import("firebase/app")]})})}function jl(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){return(t=xl())&&t.messaging?[2,t]:[2,import("firebase/messaging")]})})}function Vl(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){return(t=xl())&&t.remoteConfig?[2,t]:[2,import("firebase/remote-config")]})})}!function(){if(Fl)return Ml;Fl=1;var t=Ti(),n=Vu().find,r=Qi(),i="find",e=!0;i in[]&&Array(1)[i](function(){e=!1}),t({target:"Array",proto:!0,forced:e},{find:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),r(i)}();var Ll=function(){function t(t,n,r,i,e,s,u){this.isInitialized=!1,this.firebaseApp=null,this.messaging=null,this.remoteConfig=null,this.remoteConfigGetValue=null,this.remoteConfigGetAll=null,this.currentToken=null,this.swRegistration=null,this.config=t,this.logger=n,this.vapidKey=r,this.serviceWorkerPath=i||ro,this.onTokenReceivedCallback=e,this.m=s,this.onMessageReceivedCallback=u}return t.prototype.checkFirebaseAvailability=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Ul()];case 1:return t.sent(),this.logger.info("Firebase available"),[2,!0];case 2:return t.sent(),this.logger.warn("Firebase not available - notifications will not work"),[2,!1];case 3:return[2]}})})},t.prototype.initialize=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:if(this.isInitialized)return this.logger.warn("Firebase already initialized"),[2,!0];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,this.checkFirebaseAvailability()];case 2:return n.sent()?[4,this.initializeFirebaseApp()]:[2,!1];case 3:return n.sent()?this.messaging?(this.isInitialized=!0,this.logger.info(ea),[2,!0]):(this.logger.error("Failed to initialize Firebase Messaging"),[2,!1]):[2,!1];case 4:return t=n.sent(),this.logger.error(sa,t),[2,!1];case 5:return[2]}})})},t.prototype.initializeFirebaseApp=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a;return Gu(this,function(c){switch(c.label){case 0:return(t="undefined"!=typeof window?window.firebase:null)?(this.logger.info("Initializing Firebase in compat mode"),(o=null===(a=t.apps)||void 0===a?void 0:a.find(function(t){return t.name===io}))?(this.logger.info("Using existing Firebase app"),this.firebaseApp=o):(this.logger.info("Creating new Firebase app"),this.firebaseApp=t.initializeApp(this.config,io)),this.messaging=this.firebaseApp.messaging?this.firebaseApp.messaging():null,[3,5]):[3,1];case 1:return this.logger.info("Initializing Firebase in modular mode"),[4,Ul()];case 2:return n=c.sent(),[4,jl()];case 3:return r=c.sent(),i=n.initializeApp,e=n.getApps,s=r.getMessaging,[4,(0,r.isSupported)()];case 4:if(!c.sent())return this.logger.warn("Firebase Messaging not supported in this browser"),[2,!1];u=e(),(o=u.find(function(t){return t.name===io}))?(this.logger.info("Using existing Firebase app"),this.firebaseApp=o):(this.logger.info("Creating new Firebase app"),this.firebaseApp=i(this.config,io)),this.messaging=s(this.firebaseApp),c.label=5;case 5:return[2,!0]}})})},t.prototype.ensureServiceWorkerRegistered=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:return this.swRegistration?[2,this.swRegistration]:this.isInitialized&&this.messaging?(t=this,[4,this.registerServiceWorker()]):[2,null];case 1:return t.swRegistration=n.sent(),[2,this.swRegistration]}})})},t.prototype.registerServiceWorker=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:if(!("serviceWorker"in navigator))return this.logger.warn("Service Worker not supported"),[2,null];i.label=1;case 1:return i.trys.push([1,7,,8]),[4,navigator.serviceWorker.getRegistration(this.serviceWorkerPath)];case 2:return(t=i.sent())?(this.logger.info("Service worker already registered",{scope:t.scope}),[4,this.ensureServiceWorkerActive(t)]):[3,4];case 3:return i.sent(),[2,t];case 4:return this.logger.info("Registering service worker",{path:this.serviceWorkerPath}),[4,navigator.serviceWorker.register(this.serviceWorkerPath)];case 5:return n=i.sent(),this.logger.info(ca,{scope:n.scope}),[4,this.ensureServiceWorkerActive(n)];case 6:return i.sent(),[2,n];case 7:return r=i.sent(),this.logger.error(fa,r),[2,null];case 8:return[2]}})})},t.prototype.ensureServiceWorkerActive=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){return t.active?(this.logger.debug("Service worker is already active"),[2]):(n=t.installing||t.waiting)?(this.logger.info("Waiting for service worker to activate...",{state:n.state}),[2,new Promise(function(t,i){if("activated"!==n.state){var e=function(){"activated"===n.state?(n.removeEventListener("statechange",e),r.logger.info("Service worker activated"),t()):"redundant"===n.state&&(n.removeEventListener("statechange",e),i(new Error("Service worker became redundant")))};n.addEventListener("statechange",e)}else t()})]):(this.logger.warn("No service worker found in registration"),[2])})})},t.prototype.requestToken=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:if(!this.isInitialized||!this.messaging)return this.logger.error("FirebaseManager not initialized"),[2,null];e.label=1;case 1:return e.trys.push([1,5,,6]),(n=this.swRegistration)?[3,3]:[4,this.registerServiceWorker()];case 2:n=e.sent(),e.label=3;case 3:return(t=n)?(this.swRegistration=t,[4,this.fetchFCMToken(t)]):(this.logger.warn("Service worker registration required for FCM"),[2,null]);case 4:return(r=e.sent())?(this.currentToken=r,this.logger.info(ua,{token:r}),this.onTokenReceivedCallback&&this.onTokenReceivedCallback(r),[2,r]):(this.logger.warn("No FCM token received - permission may be denied"),[2,null]);case 5:return i=e.sent(),this.logger.error(aa,i),[2,null];case 6:return[2]}})})},t.prototype.fetchFCMToken=function(t){return Bu(this,void 0,void 0,function(){var n,r,i;return Gu(this,function(e){switch(e.label){case 0:return("undefined"!=typeof window?window.firebase:null)?(this.logger.info("Getting token using compat mode"),i={serviceWorkerRegistration:t},this.vapidKey&&(i.vapidKey=this.vapidKey),[2,this.messaging.getToken(i)]):[3,1];case 1:return[4,jl()];case 2:return n=e.sent(),r=n.getToken,i={serviceWorkerRegistration:t},this.vapidKey&&(i.vapidKey=this.vapidKey),[2,r(this.messaging,i)]}})})},t.prototype.setupMessageListener=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i=this;return Gu(this,function(e){switch(e.label){case 0:if(!this.isInitialized||!this.messaging)return this.logger.error("FirebaseManager not initialized"),[2];e.label=1;case 1:return e.trys.push([1,5,,6]),("undefined"!=typeof window?window.firebase:null)?(this.logger.info("Setting up message listener (compat mode)"),this.messaging.onMessage(function(t){i.handleMessage(t)}),[3,4]):[3,2];case 2:return[4,jl()];case 3:t=e.sent(),n=t.onMessage,this.logger.info("Setting up message listener (modular mode)"),n(this.messaging,function(t){i.handleMessage(t)}),e.label=4;case 4:return this.logger.info("Message listener setup successfully"),[3,6];case 5:return r=e.sent(),this.logger.error("Failed to setup message listener",r),[3,6];case 6:return[2]}})})},t.prototype.handleMessage=function(t){this.logger.info("FCM message received",t),this.onMessageReceivedCallback&&this.onMessageReceivedCallback(t)},t.prototype.handleTokenRefresh=function(t){this.logger.info("FCM token refreshed",{token:t}),this.m&&this.m(t)},t.prototype.getCurrentToken=function(){return this.currentToken},t.prototype.isFirebaseInitialized=function(){return this.isInitialized},t.prototype.initializeRemoteConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:if(!this.isInitialized||!this.firebaseApp)return this.logger.warn("Firebase not initialized, cannot setup Remote Config"),[2];o.label=1;case 1:return o.trys.push([1,6,,7]),(t="undefined"!=typeof window?window.firebase:null)&&t.remoteConfig?(this.remoteConfig=t.remoteConfig(this.firebaseApp),this.remoteConfig.settings.minimumFetchIntervalMillis=36e5,this.logger.info("Remote Config initialized (compat mode)"),[3,5]):[3,2];case 2:return o.trys.push([2,4,,5]),[4,Vl()];case 3:return n=o.sent(),r=n.getRemoteConfig,i=n.getValue,e=n.getAll,this.remoteConfig=r(this.firebaseApp),this.remoteConfig.settings.minimumFetchIntervalMillis=36e5,this.remoteConfigGetValue=i,this.remoteConfigGetAll=e,this.logger.info("Remote Config initialized (modular mode)"),[3,5];case 4:return s=o.sent(),this.logger.warn("Remote Config module not available:",s),[2];case 5:return[3,7];case 6:return u=o.sent(),this.logger.error("Failed to initialize Remote Config:",u),[3,7];case 7:return[2]}})})},t.prototype.getRemoteConfigString=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),"";try{var n="undefined"!=typeof window?window.firebase:null;return n&&n.remoteConfig?this.remoteConfig.getString(t):this.remoteConfigGetValue?this.remoteConfigGetValue(this.remoteConfig,t).asString():(this.logger.warn("Remote Config getValue function not available"),"")}catch(n){return this.logger.error('Failed to get Remote Config value for key "'.concat(t,'":'),n),""}},t.prototype.getRemoteConfigBoolean=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),!1;try{var n="undefined"!=typeof window?window.firebase:null;return n&&n.remoteConfig?this.remoteConfig.getBoolean(t):this.remoteConfig.getBoolean(t)||!1}catch(n){return this.logger.error('Failed to get Remote Config boolean for key "'.concat(t,'":'),n),!1}},t.prototype.getRemoteConfigNumber=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),0;try{var n="undefined"!=typeof window?window.firebase:null;return n&&n.remoteConfig?this.remoteConfig.getNumber(t):this.remoteConfig.getNumber(t)||0}catch(n){return this.logger.error('Failed to get Remote Config number for key "'.concat(t,'":'),n),0}},t.prototype.getAllRemoteConfigValues=function(){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),{};try{var t="undefined"!=typeof window?window.firebase:null;if(t&&t.remoteConfig){var n=this.remoteConfig.getAll(),r={};return Object.keys(n).forEach(function(t){r[t]=n[t].asString()}),r}if(this.remoteConfigGetAll){var i=this.remoteConfigGetAll(this.remoteConfig),e={};return Object.keys(i).forEach(function(t){e[t]=i[t].asString()}),e}return this.logger.warn("Remote Config getAll function not available"),{}}catch(t){return this.logger.error("Failed to get all Remote Config values:",t),{}}},t.prototype.getRemoteConfigJSON=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),null;try{var n=this.getRemoteConfigString(t);if(!n)return this.logger.warn('Remote Config key "'.concat(t,'" is empty')),null;var r=JSON.parse(n);return this.logger.info('Remote Config JSON parsed for key "'.concat(t,'"'),r),r}catch(n){return this.logger.error('Failed to parse Remote Config JSON for key "'.concat(t,'":'),n),null}},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),this.firebaseApp?("undefined"!=typeof window?window.firebase:null)?[4,this.firebaseApp.delete()]:[3,2]:[3,5];case 1:return r.sent(),[3,5];case 2:return[4,Ul()];case 3:return t=r.sent(),[4,(0,t.deleteApp)(this.firebaseApp)];case 4:r.sent(),r.label=5;case 5:return this.isInitialized=!1,this.firebaseApp=null,this.messaging=null,this.currentToken=null,this.swRegistration=null,this.logger.info("FirebaseManager destroyed successfully"),[3,7];case 6:return n=r.sent(),this.logger.error("Failed to destroy FirebaseManager",n),[3,7];case 7:return[2]}})})},t}(),zl=function(){function t(t,n,r,i,e){this.firebaseManager=null,this.tokenUpdateCallback=null,this.config=t,this.logger=n,this.storageManager=r,this.brandId=i,this.applicationId=e,this.state={isNotificationEnabled:!1,firebaseInitialized:!1,permissionStatus:"default"}}return t.prototype.isNotificationSupported=function(){return"undefined"!=typeof window&&"undefined"!=typeof Notification&&"undefined"!=typeof navigator&&"serviceWorker"in navigator},t.prototype.getPermissionStatus=function(){return this.isNotificationSupported()?Notification.permission:"denied"},t.prototype.shouldInitializeNotifications=function(){return this.isNotificationSupported()?!!this.config.firebaseConfig||(this.logger.warn("Firebase config not provided - notifications disabled"),!1):(this.logger.warn("Notifications not supported in this browser"),!1)},t.prototype.restoreState=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e;return Gu(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t=so("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=s.sent())&&(r=JSON.parse(n),i=this.getPermissionStatus(),this.state=zu(zu(zu({},this.state),r),{permissionStatus:i}),this.logger.info("Notification state restored from storage",{storedPermission:r.permissionStatus,currentPermission:i,hasToken:!!r.fcmToken})),[3,3];case 2:return e=s.sent(),this.logger.warn("Failed to restore notification state",e),[3,3];case 3:return[2]}})})},t.prototype.saveState=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.set(t,JSON.stringify(this.state))];case 1:return r.sent(),this.logger.debug("Notification state saved to storage",this.state),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to save notification state",n),[3,3];case 3:return[2]}})})},t.prototype.init=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,15,,17]),[4,this.restoreState()];case 1:return r.sent(),this.shouldInitializeNotifications()?[3,3]:(this.logger.info(ia),this.state.isNotificationEnabled=!1,[4,this.saveState()]);case 2:return r.sent(),[2,this.state];case 3:return t=this.getPermissionStatus(),this.state.permissionStatus=t,this.logger.info("Current notification permission",{permission:t,hasStoredToken:!!this.state.fcmToken,isNotificationEnabled:this.state.isNotificationEnabled}),"denied"!==t?[3,5]:(this.logger.warn(ta),this.state.isNotificationEnabled=!1,delete this.state.fcmToken,[4,this.saveState()]);case 4:return r.sent(),[2,this.state];case 5:return"default"!==t?[3,7]:(this.logger.info("Permission not yet granted - notifications will not be shown until user grants permission"),this.state.isNotificationEnabled=!1,[4,this.saveState()]);case 6:return r.sent(),[2,this.state];case 7:return"granted"!==t?[3,14]:this.state.fcmToken?(this.logger.info("Using existing FCM token from storage",{token:this.state.fcmToken.substring(0,20)+"..."}),this.state.isNotificationEnabled=!0,this.firebaseManager?[3,9]:(this.logger.info("Initializing Firebase for message listening"),[4,this.initializeFirebaseForMessaging()])):[3,11];case 8:r.sent(),r.label=9;case 9:return[4,this.saveState()];case 10:return r.sent(),[2,this.state];case 11:return this.logger.info("Permission granted - initializing Firebase to generate FCM token"),[4,this.initializeFirebase()];case 12:return r.sent(),[4,this.saveState()];case 13:r.sent(),r.label=14;case 14:return this.logger.info(na,this.state),[2,this.state];case 15:return n=r.sent(),this.logger.error(ra,n),this.state.isNotificationEnabled=!1,[4,this.saveState()];case 16:return r.sent(),[2,this.state];case 17:return[2]}})})},t.prototype.initializeFirebaseForMessaging=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:if(!this.config.firebaseConfig)throw new Error("Firebase config is required");n.label=1;case 1:return n.trys.push([1,5,,6]),this.firebaseManager=new Ll(this.config.firebaseConfig,this.logger,this.config.vapidKey,this.config.serviceWorkerPath,this.config.onTokenReceived,this.config.onTokenRefresh,this.config.onMessageReceived),[4,this.firebaseManager.initialize()];case 2:if(!n.sent())throw new Error("Firebase initialization failed");return this.state.firebaseInitialized=!0,[4,this.firebaseManager.ensureServiceWorkerRegistered()];case 3:return n.sent(),[4,this.firebaseManager.setupMessageListener()];case 4:return n.sent(),this.initializeRemoteConfigAsync(),this.logger.info("Firebase initialized for message listening"),[3,6];case 5:throw t=n.sent(),this.logger.error("Failed to initialize Firebase for messaging",t),t;case 6:return[2]}})})},t.prototype.initializeFirebase=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:if(!this.config.firebaseConfig)throw new Error("Firebase config is required");r.label=1;case 1:return r.trys.push([1,7,,8]),this.firebaseManager=new Ll(this.config.firebaseConfig,this.logger,this.config.vapidKey,this.config.serviceWorkerPath,this.config.onTokenReceived,this.config.onTokenRefresh,this.config.onMessageReceived),[4,this.firebaseManager.initialize()];case 2:if(!r.sent())throw new Error("Firebase initialization failed");return this.state.firebaseInitialized=!0,this.state.isNotificationEnabled=!0,[4,this.firebaseManager.requestToken()];case 3:return(t=r.sent())?(this.state.fcmToken=t,[4,this.storeFCMToken(t)]):[3,5];case 4:r.sent(),r.label=5;case 5:return[4,this.firebaseManager.setupMessageListener()];case 6:return r.sent(),this.initializeRemoteConfigAsync(),this.logger.info("Firebase initialized and FCM token retrieved",{hasToken:!!t}),[3,8];case 7:throw n=r.sent(),this.logger.error("Failed to initialize Firebase",n),this.state.firebaseInitialized=!1,this.state.isNotificationEnabled=!1,n;case 8:return[2]}})})},t.prototype.initializeRemoteConfigAsync=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),this.firebaseManager?[4,this.firebaseManager.initializeRemoteConfig()]:[3,2];case 1:n.sent(),this.logger.info("✅ Remote Config initialized and fetched successfully"),n.label=2;case 2:return[3,4];case 3:return t=n.sent(),this.logger.warn("Remote Config initialization failed (non-critical):",t),[3,4];case 4:return[2]}})})},t.prototype.storeFCMToken=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),n=so("FCM_TOKEN",this.brandId,this.applicationId),r=so("FCM_TOKEN_CREATED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(n)];case 1:return i=o.sent(),e=!i||i!==t,[4,this.storageManager.set(n,t)];case 2:return o.sent(),e?(s=(new Date).toISOString(),[4,this.storageManager.set(r,s)]):[3,4];case 3:return o.sent(),this.logger.debug("FCM token and creation date stored successfully",{createdAt:s}),[3,5];case 4:this.logger.debug("FCM token stored (creation date unchanged)"),o.label=5;case 5:return this.tokenUpdateCallback&&(this.logger.info("Notifying token update callback",{isNewToken:e,tokenPreview:t.substring(0,20)+"..."}),this.tokenUpdateCallback(t,e)),[3,7];case 6:return u=o.sent(),this.logger.warn("Failed to store FCM token",u),[3,7];case 7:return[2]}})})},t.prototype.setTokenUpdateCallback=function(t){this.tokenUpdateCallback=t,this.logger.debug("Token update callback registered")},t.prototype.clearTokenUpdateCallback=function(){this.tokenUpdateCallback=null,this.logger.debug("Token update callback cleared")},t.prototype.getState=function(){return zu({},this.state)},t.prototype.getFCMToken=function(){return this.state.fcmToken||null},t.prototype.getTokenCreationDate=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("FCM_TOKEN_CREATED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,r.sent()||null];case 2:return n=r.sent(),this.logger.warn("Failed to retrieve FCM token creation date",n),[2,null];case 3:return[2]}})})},t.prototype.isEnabled=function(){return this.state.isNotificationEnabled},t.prototype.getFirebaseManager=function(){return this.firebaseManager},t.prototype.refreshToken=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:if(!this.firebaseManager||!this.state.isNotificationEnabled)return this.logger.warn("Cannot refresh token - notifications not enabled"),[2,null];r.label=1;case 1:return r.trys.push([1,6,,7]),[4,this.firebaseManager.requestToken()];case 2:return(t=r.sent())?(this.state.fcmToken=t,[4,this.storeFCMToken(t)]):[3,5];case 3:return r.sent(),[4,this.saveState()];case 4:r.sent(),this.logger.info(oa,{token:t}),r.label=5;case 5:return[2,t];case 6:return n=r.sent(),this.logger.error("Failed to refresh FCM token",n),[2,null];case 7:return[2]}})})},t.prototype.clearToken=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),this.logger.info("Clearing notification state (permission revoked)"),t=this.state.fcmToken,this.state.isNotificationEnabled=!1,this.state.firebaseInitialized=!1,this.firebaseManager?[4,this.firebaseManager.destroy()]:[3,2];case 1:r.sent(),this.firebaseManager=null,r.label=2;case 2:return[4,this.saveState()];case 3:return r.sent(),this.tokenUpdateCallback&&t&&(this.logger.info("Notifying permission revoked to sync push_opted:false with backend"),this.tokenUpdateCallback(t,!0)),this.logger.info("Notification state cleared"),[3,5];case 4:throw n=r.sent(),this.logger.error("Failed to clear notification state",n),n;case 5:return[2]}})})},t.prototype.hasPermissionChanged=function(){return this.getPermissionStatus()!==this.state.permissionStatus},t.prototype.handlePermissionChange=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return t=this.getPermissionStatus(),n=this.state.permissionStatus,this.logger.info("Permission status changed",{from:n,to:t}),this.state.permissionStatus=t,"denied"!==t&&"default"!==t?[3,5]:"granted"!==n?[3,2]:(this.logger.warn("Permission revoked - clearing FCM token"),[4,this.clearToken()]);case 1:return r.sent(),[3,4];case 2:return this.state.isNotificationEnabled=!1,[4,this.saveState()];case 3:r.sent(),r.label=4;case 4:return[3,8];case 5:return"granted"!==t||"granted"===n?[3,8]:(this.logger.info("Permission granted - initializing Firebase"),[4,this.initializeFirebase()]);case 6:return r.sent(),[4,this.saveState()];case 7:r.sent(),r.label=8;case 8:return[2,this.state]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),this.firebaseManager?[4,this.firebaseManager.destroy()]:[3,2];case 1:r.sent(),this.firebaseManager=null,r.label=2;case 2:return t=so("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 3:return r.sent(),this.logger.info("NotificationManager destroyed successfully"),[3,5];case 4:return n=r.sent(),this.logger.error("Failed to destroy NotificationManager",n),[3,5];case 5:return[2]}})})},t}(),Bl=function(){function t(t,n,r,i,e){this.currentSession=null,this.sessionNumber=0,this.storageManager=t,this.logger=n,this.brandId=r,this.applicationId=i;var s=to/6e4;this.inactivityTimeoutMs=60*(e||s)*1e3,this.logger.info("SessionManager configured with timeout:",{timeoutMinutes:e||s,timeoutMs:this.inactivityTimeoutMs,source:e?"Remote Config":"Default"})}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Initializing SessionManager"),[4,this.restoreSessionNumber()];case 1:return t.sent(),[4,this.restoreSession()];case 2:return t.sent(),this.logger.info("SessionManager initialized successfully"),[2]}})})},t.prototype.getOrCreateSession=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return t=Date.now(),this.currentSession?(n=t-this.currentSession.lastEventTime)<this.inactivityTimeoutMs?(this.currentSession.lastEventTime=t,[4,this.persistSession()]):[3,2]:[3,3];case 1:return r.sent(),this.logger.debug(Oo,{sessionId:this.currentSession.sessionId,inactivityDuration:n}),[2,this.currentSession.sessionId];case 2:this.logger.info(Co,{sessionId:this.currentSession.sessionId,inactivityDuration:n,timeoutMs:this.inactivityTimeoutMs}),r.label=3;case 3:return[2,this.startNewSession()]}})})},t.prototype.getSessionStartTime=function(){var t;return(null===(t=this.currentSession)||void 0===t?void 0:t.sessionStartTime)||null},t.prototype.getCurrentSessionId=function(){var t,n;return null!==(n=null===(t=this.currentSession)||void 0===t?void 0:t.sessionId)&&void 0!==n?n:null},t.prototype.getSessionNumber=function(){return this.sessionNumber},t.prototype.resetSessionNumber=function(){return Bu(this,arguments,void 0,function(t){return void 0===t&&(t=0),Gu(this,function(n){switch(n.label){case 0:return this.sessionNumber=t,[4,this.persistSessionNumber()];case 1:return n.sent(),this.logger.info("Session number reset",{sessionNumber:this.sessionNumber}),[2]}})})},t.prototype.endSession=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return this.currentSession?(this.logger.info(Do,{sessionId:this.currentSession.sessionId,reason:t}),this.currentSession=null,[4,this.clearSessionStorage()]):[3,3];case 1:return n.sent(),[4,this.resetSessionNumber(0)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.logger.info("Destroying SessionManager (session persists in storage)"),this.currentSession=null,[2]})})},t.prototype.startNewSession=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return t=Date.now(),n=Bv(),this.currentSession={sessionId:n,sessionStartTime:t,lastEventTime:t},this.sessionNumber+=1,[4,this.persistSession()];case 1:return r.sent(),[4,this.persistSessionNumber()];case 2:return r.sent(),this.logger.info(_o,{sessionId:n,sessionStartTime:t,sessionNumber:this.sessionNumber}),[2,n]}})})},t.prototype.restoreSession=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a;return Gu(this,function(c){switch(c.label){case 0:return c.trys.push([0,7,,9]),t=so("SESSION_ID",this.brandId,this.applicationId),n=so("SESSION_START_TIME",this.brandId,this.applicationId),r=so("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return i=c.sent(),[4,this.storageManager.get(n)];case 2:return e=c.sent(),[4,this.storageManager.get(r)];case 3:return s=c.sent(),i&&e&&s?(u=Date.now(),(o=u-parseInt(s))<this.inactivityTimeoutMs?(this.currentSession={sessionId:i,sessionStartTime:parseInt(e),lastEventTime:parseInt(s)},this.logger.info(No,{sessionId:i,timeSinceLastEvent:o}),[3,6]):[3,4]):[3,6];case 4:return this.logger.debug("Stored session expired, will create new session",{timeSinceLastEvent:o,timeoutMs:this.inactivityTimeoutMs}),[4,this.clearSessionStorage()];case 5:c.sent(),c.label=6;case 6:return[3,9];case 7:return a=c.sent(),this.logger.warn("Failed to restore session from storage",a),[4,this.clearSessionStorage()];case 8:return c.sent(),[3,9];case 9:return[2]}})})},t.prototype.persistSession=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:if(!this.currentSession)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),t=so("SESSION_ID",this.brandId,this.applicationId),n=so("SESSION_START_TIME",this.brandId,this.applicationId),r=so("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,Promise.all([this.storageManager.set(t,this.currentSession.sessionId),this.storageManager.set(n,this.currentSession.sessionStartTime.toString()),this.storageManager.set(r,this.currentSession.lastEventTime.toString())])];case 2:return e.sent(),[3,4];case 3:return i=e.sent(),this.logger.warn("Failed to persist session to storage",i),[3,4];case 4:return[2]}})})},t.prototype.clearSessionStorage=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=so("SESSION_ID",this.brandId,this.applicationId),n=so("SESSION_START_TIME",this.brandId,this.applicationId),r=so("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,Promise.all([this.storageManager.remove(t),this.storageManager.remove(n),this.storageManager.remove(r)])];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.warn("Failed to clear session storage",i),[3,3];case 3:return[2]}})})},t.prototype.restoreSessionNumber=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=so("SESSION_NUMBER",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=i.sent())&&(this.sessionNumber=parseInt(n,10)||0,this.logger.debug("Session number restored",{sessionNumber:this.sessionNumber})),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to restore session number",r),[3,3];case 3:return[2]}})})},t.prototype.persistSessionNumber=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("SESSION_NUMBER",this.brandId,this.applicationId),[4,this.storageManager.set(t,this.sessionNumber.toString())];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to persist session number",n),[3,3];case 3:return[2]}})})},t}();return function(){function t(t){this.userContextSet=!1,this.initialized=!1,this.initializationPromise=null,this.visitorTrackingEnabled=!1,this.visitorId=null,this.currentUserIdentifierType=null,this.notificationManager=null,this.permissionChangeCleanup=null,this.dlrMessageCleanup=null,this.lastAuthenticatedUser=null,this.lastUserAttributes=null,this.sdkDisabled=!1,this.userIdentified=!1,this.userOperationChain=Promise.resolve(),this.config=t,this.logger=new Cl(!1),this.validateRequiredConfig(t),this.logger.info("🔧 SDK initializing in Remote Config bootstrap mode"),this.logger.info("Will fetch configuration from Remote Config key:",t.remoteConfigKey)}return t.initialize=function(n){return t.p?(new Cl(!0).warn("WebSDK is already initialized. Returning existing instance."),t.p):(t.p=new t(n),t.p.init(),t.p)},t.getInstance=function(){return t.p},t.isInitialized=function(){return null!==t.p},t.requireInstance=function(){if(!t.p)throw new Error("WebSDK is not initialized. Call WebSDK.initialize(config) first.");return t.p},t.track=function(n,r){t.requireInstance().track(n,r)},t.pageView=function(n){t.requireInstance().pageView(n)},t.identify=function(n){t.requireInstance().identify(n)},t.getUser=function(){return t.requireInstance().getUser()},t.reset=function(){t.requireInstance().reset()},t.disableSDK=function(){t.requireInstance().disableSDK()},t.enableSDK=function(){t.requireInstance().enableSDK()},t.destroy=function(){if(!t.p)return Promise.resolve();var n=t.p.destroy();return t.p=null,n},t.prototype.shouldEnableLogging=function(t){return!(!t||"NONE"===t)&&["ERROR","WARN","INFO","DEBUG","VERBOSE"].includes(t)},t.prototype.restoreUserContext=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a;return Gu(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),t=so("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.get(t)];case 1:return(n=c.sent())?(r=JSON.parse(n),i=r.cuid,e=r.userIdentifierType,this.currentUserIdentifierType=null!=e?e:null,s=this.config.accountId||"",[4,this.eventTracker.setUserContext(s,i,e)]):[3,3];case 2:c.sent(),this.userContextSet=!0,this.logger.info("User context restored from storage",{cuid:i,accountId:this.config.accountId}),c.label=3;case 3:return u=so("LAST_AUTHENTICATED_USER",this.config.brandId,this.config.applicationId),[4,this.storageManager.get(u)];case 4:return(o=c.sent())&&(this.lastAuthenticatedUser=o,this.logger.info("Last authenticated user restored from storage",{lastAuthenticatedUser:this.lastAuthenticatedUser})),[3,6];case 5:return a=c.sent(),this.logger.warn("Failed to restore user context from storage",a),[3,6];case 6:return[2]}})})},t.prototype.validateAndClearDifferentUserContext=function(t){return Bu(this,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,7]),this.lastAuthenticatedUser&&this.lastAuthenticatedUser!==t?(this.logger.info("Different user detected, ending session and clearing context",{previousCuid:this.lastAuthenticatedUser,newCuid:t}),[4,this.sessionManager.endSession("user_switch")]):[3,3];case 1:return r.sent(),[4,this.clearUserContext()];case 2:r.sent(),this.userContextSet=!1,r.label=3;case 3:return this.lastAuthenticatedUser=t,[4,this.persistLastAuthenticatedUser(t)];case 4:return r.sent(),[3,7];case 5:return n=r.sent(),this.logger.warn("Error validating different user context",n),[4,this.clearUserContext()];case 6:return r.sent(),this.userContextSet=!1,[3,7];case 7:return[2]}})})},t.prototype.persistLastAuthenticatedUser=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("LAST_AUTHENTICATED_USER",this.config.brandId,this.config.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to persist lastAuthenticatedUser",r),[3,3];case 3:return[2]}})})},t.prototype.storeUserContext=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),r=null!=n?n:this.currentUserIdentifierType,i={cuid:t,timestamp:Date.now()},r&&(i.userIdentifierType=r),e=so("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.set(e,JSON.stringify(i))];case 1:return u.sent(),[3,3];case 2:return s=u.sent(),this.logger.warn("Failed to store user context",s),[3,3];case 3:return[2]}})})},t.prototype.init=function(){var t=this;this.initialized?this.logger.warn("WebSDK already initialized"):this.initializationPromise?this.logger.warn("WebSDK initialization already in progress"):this.initializationPromise=this.initializeAsync().catch(function(n){t.logger.error(wo,n),t.initializationPromise=null})},t.prototype.initializeAsync=function(){return Bu(this,void 0,void 0,function(){var t,n,r=this;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,12,,13]),this.logger.info("Initializing WebSDK",{version:Ra,config:this.config}),[4,this.fetchAndApplyRemoteConfig()];case 1:return i.sent(),[4,this.storageManager.init()];case 2:return i.sent(),[4,this.sessionManager.init()];case 3:return i.sent(),this.config.notifications?(t=zu(zu({},this.config.notifications),{firebaseConfig:this.config.firebaseConfig}),this.notificationManager=new zl(t,this.logger,this.storageManager,this.config.brandId,this.config.applicationId),this.setupTokenUpdateCallback(),[4,this.notificationManager.init()]):[3,5];case 4:i.sent(),this.logger.info("Notifications initialized early for FCM token availability"),i.label=5;case 5:return[4,this.initializeVisitorConfig()];case 6:return i.sent(),[4,this.eventTracker.init()];case 7:return i.sent(),this.eventTracker.setSessionInfoCallback(function(){return Bu(r,void 0,void 0,function(){return Gu(this,function(t){return[2,this.sessionManager.getOrCreateSession()]})})}),[4,this.restoreUserContext()];case 8:return i.sent(),[4,this.syncEventTrackerContext()];case 9:return i.sent(),this.initialized=!0,this.notificationManager&&this.setupPermissionChangeDetection(),this.config.notifications?(this.setupDLRServiceWorkerListener(),[4,this.eventTracker.processPendingServiceWorkerDLREvents()]):[3,11];case 10:i.sent(),i.label=11;case 11:return this.logger.info(go),[3,13];case 12:throw n=i.sent(),new Error("".concat(co,": ").concat(n));case 13:return[2]}})})},t.prototype.handleVisibilityChange=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:if("visible"!==document.visibilityState||!this.notificationManager)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),this.notificationManager.hasPermissionChanged()?(t="Notification"in window?Notification.permission:"denied",this.logger.info("Notification permission changed detected",{currentPermission:t}),[4,this.notificationManager.handlePermissionChange()]):[2];case 2:return(n=i.sent())&&this.logger.info("Notification state updated after permission change",n),[3,4];case 3:return r=i.sent(),this.logger.warn("Error handling permission change",r),[3,4];case 4:return[2]}})})},t.prototype.setupPermissionChangeDetection=function(){var t=this;if("undefined"!=typeof document&&"undefined"!=typeof window){var n=function(){return t.handleVisibilityChange()};document.addEventListener("visibilitychange",n),window.addEventListener("focus",n),this.permissionChangeCleanup=function(){document.removeEventListener("visibilitychange",n),window.removeEventListener("focus",n)},this.logger.debug("Permission change detection setup complete")}},t.prototype.setupDLRServiceWorkerListener=function(){var t=this;if("undefined"!=typeof navigator&&"serviceWorker"in navigator){var n=function(n){return Bu(t,void 0,void 0,function(){var t;return Gu(this,function(r){switch(r.label){case 0:if(!n.data||"HYDRA_DLR_EVENTS_PENDING"!==n.data.type)return[3,4];this.logger.info("Received DLR events pending notification from service worker"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.eventTracker.processPendingServiceWorkerDLREvents()];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this.logger.error("Failed to process pending DLR events",t),[3,4];case 4:return[2]}})})};navigator.serviceWorker.addEventListener("message",n),this.dlrMessageCleanup=function(){navigator.serviceWorker.removeEventListener("message",n)},this.logger.debug("DLR service worker message listener setup complete")}},t.prototype.initializeVisitorConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r=this;return Gu(this,function(i){switch(i.label){case 0:return this.logger.info("Initializing visitor configuration"),[4,this.visitorConfigManager.init()];case 1:return i.sent(),t=this,[4,this.visitorConfigManager.isVisitorTrackingEnabled()];case 2:return t.visitorTrackingEnabled=i.sent(),this.visitorTrackingEnabled?(this.logger.info(Bo),[4,this.anonymousVisitorManager.init()]):[3,5];case 3:return i.sent(),[4,this.getOrCreateVisitorId()];case 4:return i.sent(),this.anonymousVisitorManager.retryPendingMerge().catch(function(t){r.logger.warn("Failed to retry pending merge on init",t)}),[3,6];case 5:this.logger.info(zo),i.label=6;case 6:return(n=this.visitorConfigManager.getCachedConfig())&&n.warnings&&n.warnings.length>0&&n.warnings.forEach(function(t){r.logger.warn("Visitor config warning",{code:t.code,message:t.message})}),[2]}})})},t.prototype.syncEventTrackerContext=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return t=null!==(i=null===(r=this.anonymousVisitorManager)||void 0===r?void 0:r.getVisitorRefId())&&void 0!==i?i:null,this.eventTracker.setVisitorTrackingState(this.visitorId,this.visitorTrackingEnabled,t),this.visitorTrackingEnabled?(n=this.config.accountId||"",this.userContextSet?[3,2]:[4,this.eventTracker.setUserContext(n)]):(this.logger.warn("Event tracking disabled: Visitor tracking is off"),[2]);case 1:return e.sent(),this.logger.info("Account context set for visitor tracking"),[3,3];case 2:this.logger.info("User context restored from storage"),e.label=3;case 3:return[2]}})})},t.prototype.getOrCreateVisitorId=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f;return Gu(this,function(h){switch(h.label){case 0:t=[],(n=null===(a=this.notificationManager)||void 0===a?void 0:a.getFCMToken())?(r="granted"===(null===(c=this.notificationManager)||void 0===c?void 0:c.getState().permissionStatus),t.push({type:this.getChannelType(),value:n,primary:!0,verified:!0,subscribed:r}),this.logger.info("Including FCM token in visitor creation",{tokenPreview:n.substring(0,20)+"...",subscribed:r})):this.logger.info("No FCM token available, creating visitor without commChannels"),h.label=1;case 1:return h.trys.push([1,5,,6]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,3];case 2:return s=h.sent(),[3,4];case 3:s=null,h.label=4;case 4:return e=s,i=Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(f=this.notificationManager)||void 0===f?void 0:f.getState().permissionStatus),fcmTokenCreatedAt:e})),this.logger.debug("Extended fields collected",{extendedFields:i}),[3,6];case 5:return u=h.sent(),this.logger.warn("Failed to collect extended fields, proceeding without them",u),i=void 0,[3,6];case 6:return o=this,[4,this.anonymousVisitorManager.getOrCreateVisitorId(t.length>0?t:void 0,i)];case 7:return o.visitorId=h.sent(),this.logger.info("Visitor ID ready",{visitorId:this.visitorId}),[2,this.visitorId]}})})},t.prototype.setupTokenUpdateCallback=function(){var t=this;this.notificationManager&&(this.notificationManager.setTokenUpdateCallback(function(n,r){return Bu(t,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return[4,this.handleTokenUpdate(n,r)];case 1:return t.sent(),[2]}})})}),this.logger.debug("Token update callback configured for backend sync"))},t.prototype.handleTokenUpdate=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:if(!this.visitorId)return this.logger.debug("Skipping token sync - no visitor ID yet (will be included in create)",{isNewToken:n}),[2];if(!n)return this.logger.debug("Skipping token sync - token unchanged"),[2];r="granted"!==(null===(e=this.notificationManager)||void 0===e?void 0:e.getState().permissionStatus),this.logTokenSyncStart(t,r),s.label=1;case 1:return s.trys.push([1,6,,7]),this.userIdentified&&this.lastAuthenticatedUser?[4,this.syncTokenForIdentifiedUser(r)]:[3,3];case 2:return s.sent(),[3,5];case 3:return[4,this.syncTokenForAnonymousUser(t,r)];case 4:s.sent(),s.label=5;case 5:return[3,7];case 6:return i=s.sent(),this.logger.error("Failed to sync FCM token with backend",i),[3,7];case 7:return[2]}})})},t.prototype.logTokenSyncStart=function(t,n){n?this.logger.info("Permission revoked, syncing push_opted:false with backend",{visitorId:this.visitorId}):this.logger.info("FCM token updated, syncing with backend",{visitorId:this.visitorId,tokenPreview:t.substring(0,20)+"..."})},t.prototype.syncTokenForIdentifiedUser=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return this.lastAuthenticatedUser?[4,this.sendUserEventToApi(ga,this.lastAuthenticatedUser,null)]:[2];case 1:return n.sent(),this.logger.info("Token state synced via User Events API (user_update)",{permissionRevoked:t}),[2]}})})},t.prototype.syncTokenForAnonymousUser=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:r=t?[{type:this.getChannelType(),value:t,primary:!0,verified:!0,subscribed:!n}]:[],o.label=1;case 1:return o.trys.push([1,5,,6]),n||!this.notificationManager?[3,3]:[4,this.notificationManager.getTokenCreationDate()];case 2:return s=o.sent(),[3,4];case 3:s=null,o.label=4;case 4:return e=s,i=Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:!n,fcmTokenCreatedAt:e})),[3,6];case 5:return u=o.sent(),this.logger.warn("Failed to collect extended fields for token update",u),i=void 0,[3,6];case 6:return[4,this.anonymousVisitorManager.updateVisitor(r,i)];case 7:return o.sent(),n?this.logger.info("Token synced with subscribed:false (permission revoked)",{visitorId:this.visitorId}):this.logger.info("FCM token synced with backend successfully",{visitorId:this.visitorId}),[2]}})})},t.prototype.getUser=function(){var t,n,r,i,e;if(this.userIdentified)throw new Error("This data is not exposed");var s=null!==(n=null===(t=this.sessionManager)||void 0===t?void 0:t.getCurrentSessionId())&&void 0!==n?n:"",u=null!==(i=null===(r=this.sessionManager)||void 0===r?void 0:r.getSessionNumber())&&void 0!==i?i:0;return{visitorId:null!==(e=this.visitorId)&&void 0!==e?e:"",userId:null,sessionId:s,isIdentified:!1,isAnonymous:!0,profileTier:"anonymous",attributes:null,sessionNumber:u,isFirstSession:1===u,isReturningVisitor:u>1}},t.prototype.setUserContext=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:if(!this.initialized)throw new Error("WebSDK must be initialized before setting user context");return[4,this.validateAndClearDifferentUserContext(t)];case 1:return s.sent(),r=null!==(e=null!=n?n:this.currentUserIdentifierType)&&void 0!==e?e:void 0,i=this.config.accountId||"",[4,this.eventTracker.setUserContext(i,t,r)];case 2:return s.sent(),this.userContextSet=!0,n&&(this.currentUserIdentifierType=n),this.visitorId&&this.logger.info("User identified - transitioning from anonymous to identified tracking",{visitorId:this.visitorId,cuid:t,trackingMode:"identified"}),[4,this.storeUserContext(t,r)];case 3:return s.sent(),this.logger.info("User context set and persisted",{cuid:t,accountId:this.config.accountId}),[2]}})})},t.prototype.clearUserContext=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.remove(t)];case 1:return r.sent(),this.eventTracker&&this.eventTracker.clearUserContext(),this.currentUserIdentifierType=null,this.userContextSet=!1,this.userIdentified=!1,this.logger.info("User context cleared"),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to clear user context",n),this.currentUserIdentifierType=null,this.userContextSet=!1,this.userIdentified=!1,[3,3];case 3:return[2]}})})},t.prototype.track=function(t,n){this.sdkDisabled?this.logger.debug("SDK disabled, dropping track call",{eventName:t}):this.pushEvent(t,n)},t.prototype.pageView=function(t){var n,r;if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping pageView call");else{var i=null!==(n=null==t?void 0:t.url)&&void 0!==n?n:"undefined"!=typeof window?window.location.href:void 0,e=null!==(r=null==t?void 0:t.title)&&void 0!==r?r:"undefined"!=typeof document?document.title:void 0,s=zu(zu(zu(zu({},i&&{url:i}),e&&{title:e}),(null==t?void 0:t.category)&&{category:t.category}),null==t?void 0:t.properties);this.pushEvent("page_view",s)}},t.prototype.pickTraitFields=function(t){var n={},r=t.gender,i=t.birthday,e=t.city,s=t.country,u=t.timezone;return r&&(n.gender=r),i&&(n.birthday=i),e&&(n.city=e),s&&(n.country=s),u&&(n.timezone=u),n},t.prototype.identify=function(t){var n,r;if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping identify call");else{var i=t.identifier,e=t.actionType,s=t.traits,u=void 0===s?{}:s;if(!i||!i.cuid)throw new Error("identifier with a non-empty cuid is required for identify");if(!["email","mobile","externalId"].includes(i.type))throw new Error("Invalid identifier type: ".concat(i.type,". Must be 'email', 'mobile', or 'externalId'."));var o=i.cuid;this.currentUserIdentifierType=i.type;var a=zu(zu(zu(zu({firstName:null!==(n=u.firstName)&&void 0!==n?n:"",lastName:null!==(r=u.lastName)&&void 0!==r?r:""},"email"===i.type&&{email:o}),"mobile"===i.type&&{mobile:o}),"externalId"===i.type&&{externalId:o}),void 0!==u.custom&&{customData:u.custom}),c=this.pickTraitFields(u);a.customData=zu(zu({},c),a.customData),this.userIdentified=!0;var f=i.type;switch(e){case"USER_REGISTER":this.pushUserSignin(o,a,f);break;case"USER_UPDATE":this.pushUserUpdate(o,a,f);break;default:throw this.logger.error("Invalid identify actionType",{actionType:e,cuid:o}),new Error("Invalid identify actionType: ".concat(e,". Must be 'USER_REGISTER' or 'USER_UPDATE'."))}}},t.prototype.trackEvent=function(t){return Bu(this,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:if(!this.initialized)throw new Error("WebSDK must be initialized before tracking events");r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.eventTracker.track(t)];case 2:return r.sent(),[3,4];case 3:throw n=r.sent(),this.logger.error(bo,{event:t,error:n}),n;case 4:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:this.logger.info("Destroying WebSDK instance"),n.label=1;case 1:return n.trys.push([1,16,,17]),this.eventTracker?[4,this.eventTracker.flush()]:[3,4];case 2:return n.sent(),[4,this.eventTracker.destroy()];case 3:n.sent(),n.label=4;case 4:return this.visitorConfigManager?[4,this.visitorConfigManager.destroy()]:[3,6];case 5:n.sent(),n.label=6;case 6:return this.anonymousVisitorManager?[4,this.anonymousVisitorManager.destroy()]:[3,8];case 7:n.sent(),n.label=8;case 8:return this.permissionChangeCleanup&&(this.permissionChangeCleanup(),this.permissionChangeCleanup=null),this.dlrMessageCleanup&&(this.dlrMessageCleanup(),this.dlrMessageCleanup=null),this.notificationManager?(this.notificationManager.clearTokenUpdateCallback(),[4,this.notificationManager.destroy()]):[3,10];case 9:n.sent(),this.notificationManager=null,n.label=10;case 10:return this.sessionManager?[4,this.sessionManager.destroy()]:[3,12];case 11:n.sent(),n.label=12;case 12:return this.storageManager?[4,this.clearUserContext()]:[3,15];case 13:return n.sent(),[4,this.storageManager.destroy()];case 14:n.sent(),n.label=15;case 15:return this.initialized=!1,this.logger.info(mo),[3,17];case 16:throw t=n.sent(),this.logger.error(mo,t),t;case 17:return[2]}})})},t.prototype.validateUserAttributes=function(t){if(!t.email&&!t.mobile&&!t.externalId)throw new Error("At least one of email, mobile, or externalId is required")},t.prototype.attemptVisitorMerge=function(t){try{if(!this.visitorTrackingEnabled||!this.visitorId)return;if(!t.email&&!t.mobile&&!t.externalId)return void this.logger.debug(Zo,{reason:"No email, mobile, or externalId"});this.anonymousVisitorManager.mergeVisitorWithUser(t.firstName,t.lastName,t.email,t.mobile,t.externalId,t.customData),this.logger.info("Visitor merge triggered in background",{visitorId:this.visitorId})}catch(t){this.logger.warn("Visitor merge attempt failed, proceeding with user flow",t)}},t.prototype.sendUserEventToApi=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c,f,h,d,v,l,g,w,m,p;return Gu(this,function(y){switch(y.label){case 0:return i="granted"===(null===(f=this.notificationManager)||void 0===f?void 0:f.getState().permissionStatus),e=null!==(d=null===(h=this.notificationManager)||void 0===h?void 0:h.getFCMToken())&&void 0!==d?d:null,s=i&&!!e,u=e?[{interface_id:e,gateway:ba.WEB}]:[],o=null!==(l=null===(v=this.sessionManager)||void 0===v?void 0:v.getCurrentSessionId())&&void 0!==l?l:"",a=this.apiClient.buildUserEventsRequest(t,zu(zu(zu(zu({cuid:n,push_opted:s,tokens:u},(null==r?void 0:r.firstName)&&{firstName:r.firstName}),(null==r?void 0:r.lastName)&&{lastName:r.lastName}),(null==r?void 0:r.email)&&{email:r.email}),(null==r?void 0:r.mobile)&&{phone:r.mobile}),o),c=null!==(w=null===(g=this.anonymousVisitorManager)||void 0===g?void 0:g.getVisitorRefId())&&void 0!==w?w:void 0,[4,this.apiClient.sendUserEvents(a,null!==(m=this.visitorId)&&void 0!==m?m:void 0,c,n,null!==(p=this.currentUserIdentifierType)&&void 0!==p?p:void 0)];case 1:return y.sent(),this.logger.info("User event sent to User Events API",{eventName:t,cuid:n}),[2]}})})},t.prototype.pushUserSignin=function(t,n,r){var i=this;this.userIdentified=!0,this.queueUserOperation(function(){return Bu(i,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserSigninAsync(t,n,r)];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.error(Fo,{cuid:t,error:i}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserSigninAsync=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,r)];case 2:e.sent(),this.attemptVisitorMerge(n),this.lastUserAttributes=n,e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.sendUserEventToApi(la,t,n)];case 4:return e.sent(),this.logger.info("User signin event tracked",{cuid:t,firstName:n.firstName,lastName:n.lastName,email:n.email}),[3,6];case 5:throw i=e.sent(),this.logger.error(Fo,{cuid:t,error:i}),i;case 6:return[2]}})})},t.prototype.pushUserSignup=function(t,n,r){var i=this;this.userIdentified=!0,this.queueUserOperation(function(){return Bu(i,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserSignupAsync(t,n,r)];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.error(Po,{cuid:t,error:i}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserSignupAsync=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,r)];case 2:e.sent(),this.attemptVisitorMerge(n),this.lastUserAttributes=n,e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.sendUserEventToApi(la,t,n)];case 4:return e.sent(),this.logger.info("User signup event tracked (routed as user_signin)",{cuid:t,firstName:n.firstName,lastName:n.lastName,email:n.email}),[3,6];case 5:throw i=e.sent(),this.logger.error(Po,{cuid:t,error:i}),i;case 6:return[2]}})})},t.prototype.pushUserUpdate=function(t,n,r){var i=this;this.queueUserOperation(function(){return Bu(i,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserUpdateAsync(t,n,r)];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.error(Mo,{cuid:t,error:i}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserUpdateAsync=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,r)];case 2:e.sent(),this.lastUserAttributes=n,e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.sendUserEventToApi(ga,t,null)];case 4:return e.sent(),this.logger.info("User update event tracked",{cuid:t}),[3,6];case 5:throw i=e.sent(),this.logger.error(Mo,{cuid:t,error:i}),i;case 6:return[2]}})})},t.prototype.reset=function(){if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping reset call");else{var t=this.lastAuthenticatedUser;t?this.pushUserSignOut(t):this.logger.warn("reset() called but no authenticated user to sign out")}},t.prototype.pushUserSignOut=function(t){var n=this;this.queueUserOperation(function(){return Bu(n,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.pushUserSignOutAsync(t)];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.logger.error(xo,{cuid:t,error:n}),[3,3];case 3:return[2]}})})})},t.prototype.resetToAnonymousMode=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f,h,d;return Gu(this,function(v){switch(v.label){case 0:if(!this.visitorTrackingEnabled)return this.logger.info("Visitor tracking disabled per latest config, skipping anonymous mode"),this.visitorId=null,this.eventTracker.setVisitorTrackingState(null,!1),[2];v.label=1;case 1:return v.trys.push([1,11,,12]),[4,this.anonymousVisitorManager.clearVisitorId()];case 2:v.sent(),this.logger.info("Visitor ID cleared on user signout"),t=[],(n=null===(f=this.notificationManager)||void 0===f?void 0:f.getFCMToken())&&(r="granted"===(null===(h=this.notificationManager)||void 0===h?void 0:h.getState().permissionStatus),t.push({type:this.getChannelType(),value:n,primary:!0,verified:!0,subscribed:r})),i=void 0,v.label=3;case 3:return v.trys.push([3,7,,8]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,5];case 4:return s=v.sent(),[3,6];case 5:s=null,v.label=6;case 6:return e=s,i=Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(d=this.notificationManager)||void 0===d?void 0:d.getState().permissionStatus),fcmTokenCreatedAt:e})),[3,8];case 7:return u=v.sent(),this.logger.warn("Failed to collect extended fields on signout, proceeding without them",u),i=void 0,[3,8];case 8:return o=this,[4,this.anonymousVisitorManager.getOrCreateVisitorId(t.length>0?t:void 0,i)];case 9:return o.visitorId=v.sent(),[4,this.sessionManager.resetSessionNumber(1)];case 10:return v.sent(),this.logger.info("New anonymous visitor ID generated after signout",{visitorId:this.visitorId,hasFCMToken:!!n}),a=this.anonymousVisitorManager.getVisitorRefId(),this.eventTracker.setVisitorTrackingState(this.visitorId,!0,a),[3,12];case 11:return c=v.sent(),this.logger.warn("Failed to regenerate visitor ID on signout",c),this.visitorId=null,this.eventTracker.setVisitorTrackingState(null,!0),[3,12];case 12:return[2]}})})},t.prototype.pushUserSignOutAsync=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:return[4,this.ensureInitialized()];case 1:return u.sent(),[4,this.setUserContextIfNeeded(t)];case 2:u.sent(),u.label=3;case 3:return u.trys.push([3,5,,6]),[4,this.sendUserEventToApi(wa,t,this.lastUserAttributes)];case 4:return u.sent(),this.logger.info("User signout event tracked",{cuid:t}),[3,6];case 5:return n=u.sent(),this.logger.warn("Failed to track signout event (tracking may be disabled)",{cuid:t,error:n}),[3,6];case 6:return u.trys.push([6,15,,16]),[4,this.anonymousVisitorManager.clearMergedUserId()];case 7:return u.sent(),[4,this.anonymousVisitorManager.clearPendingMerge()];case 8:return u.sent(),[4,this.clearUserContext()];case 9:u.sent(),this.logger.info("User context cleared, returning to anonymous mode (session continues)"),u.label=10;case 10:return u.trys.push([10,12,,13]),[4,this.visitorConfigManager.refreshConfig()];case 11:return r=u.sent(),this.visitorTrackingEnabled=!0===(null===(s=r.data)||void 0===s?void 0:s.visitorTrackingEnabled),this.logger.info("Visitor config refreshed on signout",{visitorTrackingEnabled:this.visitorTrackingEnabled}),[3,13];case 12:return i=u.sent(),this.logger.warn("Failed to refresh visitor config on signout, using existing value",{visitorTrackingEnabled:this.visitorTrackingEnabled,error:i}),[3,13];case 13:return[4,this.resetToAnonymousMode()];case 14:return u.sent(),this.logger.info("SDK remains active for anonymous tracking"),[3,16];case 15:throw e=u.sent(),this.logger.error("Failed to clear user context on signout",e),e;case 16:return[2]}})})},t.prototype.pushEvent=function(t,n){var r=this;this.pushEventAsync(t,n).catch(function(n){r.logger.error(Uo,{eventName:t,error:n})})},t.prototype.pushEventAsync=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:return[4,this.ensureInitialized()];case 1:if(s.sent(),!this.visitorTrackingEnabled)return this.logger.warn("Event tracking skipped: Visitor tracking is disabled",{eventName:t}),[2];if(!this.userContextSet&&!this.visitorId)return this.logger.warn("Event tracking skipped: No visitor ID available and no user context set",{eventName:t}),[2];r=zu({event_name:t},null!=n?n:{}),i={type:"behavioral",name:t,timestamp:Date.now(),data:r},s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.trackEvent(i)];case 3:return s.sent(),this.logger.info("Behavioral event tracked",{eventName:t,attributes:n}),[3,5];case 4:throw e=s.sent(),this.logger.error(Uo,{eventName:t,error:e}),e;case 5:return[2]}})})},t.prototype.disableSDK=function(){this.sdkDisabled?this.logger.warn("SDK is already disabled"):(this.sdkDisabled=!0,this.eventTracker&&this.eventTracker.pause(),this.logger.info("SDK disabled — event tracking stopped"))},t.prototype.enableSDK=function(){var t=this;this.sdkDisabled?(this.sdkDisabled=!1,this.eventTracker&&this.eventTracker.resume().catch(function(n){t.logger.error("Failed to resume event tracker",n)}),this.logger.info("SDK enabled — event tracking resumed")):this.logger.warn("SDK is already enabled")},t.prototype.getChannelType=function(){return this.config.channelType||ba.WEB},t.prototype.applyRemoteConfigValues=function(t){this.config.accountId=t.accountId,this.config.baseURL=t.baseURL,this.config.orgId=t.orgId,this.config.source=t.source||ya.WEBPUSH,this.config.channelType=t.channelType||ba.WEB,this.config.brandId=this.config.brandId||t.brandId,this.config.applicationId=this.config.applicationId||t.applicationId;var n=to/6e4;this.config.sessionTimeoutMinutes=t.sessionTimeoutMinutes||n,this.config.batchSize=t.batchSize||no.BATCH_SIZE,this.config.debugLevel=t.debugLevel||"NONE",this.logger.setEnabled(this.shouldEnableLogging(this.config.debugLevel)),this.logger.info("Session timeout configured:",{timeoutMinutes:this.config.sessionTimeoutMinutes,source:t.sessionTimeoutMinutes?"Remote Config":"Default"}),this.logger.info("Batch size configured:",{batchSize:this.config.batchSize,source:t.batchSize?"Remote Config":"Default"}),this.logger.info("Debug level configured:",{debugLevel:this.config.debugLevel,source:t.debugLevel?"Remote Config":"Default"})},t.prototype.getExtendedFieldsForMerge=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,2];case 1:return n=i.sent(),[3,3];case 2:n=null,i.label=3;case 3:return t=n,[2,Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(r=this.notificationManager)||void 0===r?void 0:r.getState().permissionStatus),fcmTokenCreatedAt:t}))];case 4:return i.sent(),[2,void 0];case 5:return[2]}})})},t.prototype.initializeManagersFromConfig=function(){var t=this;this.storageManager=new Rl(this.logger,this.config.brandId,this.config.applicationId),this.sessionManager=new Bl(this.storageManager,this.logger,this.config.brandId,this.config.applicationId,this.config.sessionTimeoutMinutes),this.apiClient=new Kv({baseUrl:this.config.baseURL||""},this.logger,this.config.accountId||"",this.config.orgId||"",this.config.source||ya.WEBPUSH);var n=this.apiClient;this.eventTracker=new kl(this.config,n,this.storageManager,this.logger);var r=this.config.orgId||"",i=this.config.accountId||"",e=this.config.source||ya.WEBPUSH;this.visitorConfigManager=new Dl(r,n,this.logger,this.storageManager,this.config.brandId,this.config.applicationId),this.anonymousVisitorManager=new Pl(i,r,e,n,this.logger,this.storageManager,zu(zu({},void 0!==this.config.brandId?{brandId:this.config.brandId}:{}),void 0!==this.config.applicationId?{applicationId:this.config.applicationId}:{})),this.anonymousVisitorManager.setMergeDataProviders(function(){var n;return(null===(n=t.notificationManager)||void 0===n?void 0:n.getFCMToken())||null},function(){return t.getChannelType()},function(){return t.getExtendedFieldsForMerge()},function(){var n;return"granted"===(null===(n=t.notificationManager)||void 0===n?void 0:n.getState().permissionStatus)})},t.prototype.fetchAndApplyRemoteConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f,h;return Gu(this,function(d){switch(d.label){case 0:this.logger.info("📡 Fetching configuration from Firebase Remote Config..."),d.label=1;case 1:return d.trys.push([1,5,,6]),[4,Ul()];case 2:return t=d.sent(),[4,Vl()];case 3:return n=d.sent(),r=t.initializeApp||t,i=n.getRemoteConfig||n,e=n.fetchAndActivate,s=n.getValue,u=r(this.config.firebaseConfig),(o=i(u)).settings.minimumFetchIntervalMillis=36e5,this.logger.info("🔄 Fetching Remote Config from Firebase..."),[4,e(o)];case 4:if(d.sent()||this.logger.warn("⚠️ Remote Config fetched but not activated (using cached values)"),a=s(o,this.config.remoteConfigKey),!(c=a.asString()))throw new Error('Remote Config key "'.concat(this.config.remoteConfigKey,'" is empty or not found'));f=void 0;try{f=JSON.parse(c)}catch(t){throw new Error("Failed to parse Remote Config JSON: ".concat(t))}return this.logger.info("✅ Remote Config fetched successfully:",f),this.applyRemoteConfigValues(f),this.initializeManagersFromConfig(),this.logger.info("✅ SDK configuration applied from Remote Config"),this.logger.debug("Final SDK config:",this.config),[3,6];case 5:throw h=d.sent(),this.logger.error("❌ Failed to fetch Remote Config:",h),new Error("Remote Config bootstrap failed: ".concat(h));case 6:return[2]}})})},t.prototype.validateRequiredConfig=function(t){var n=[];if(t.firebaseConfig||n.push("firebaseConfig"),t.remoteConfigKey||n.push("remoteConfigKey"),n.length>0)throw new Error("WebSDK initialization failed: Missing required configuration fields: ".concat(n.join(", ")))},t.prototype.ensureInitialized=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:if(!this.initializationPromise)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.initializationPromise];case 2:return n.sent(),[3,4];case 3:throw t=n.sent(),new Error("SDK initialization failed: ".concat(t));case 4:if(!this.initialized)throw new Error("WebSDK must be initialized before tracking events. Call init() first.");return[2]}})})},t.prototype.setUserContextIfNeeded=function(t,n){return Bu(this,void 0,void 0,function(){return Gu(this,function(r){switch(r.label){case 0:return this.userContextSet?[3,2]:[4,this.setUserContext(t,n)];case 1:r.sent(),this.logger.debug("User context set automatically",{cuid:t}),r.label=2;case 2:return[2]}})})},t.prototype.queueUserOperation=function(t){var n=this;this.userOperationChain=this.userOperationChain.then(t).catch(function(t){n.logger.error("User operation failed",t)})},t.p=null,t}()});
|