const Ai = {}; let ZT = 0; function Io(t, e) { const n = `atom${++ZT}`, r = { toString() { return (Ai ? "production" : void 0) !== "production" && this.debugLabel ? n + ":" + this.debugLabel : n; } }; return typeof t == "function" ? r.read = t : (r.init = t, r.read = eI, r.write = tI), e && (r.write = e), r; } function eI(t) { return t(this); } function tI(t, e, n) { return e( this, typeof n == "function" ? n(t(this)) : n ); } const VS = (t, e) => t.unstable_is ? t.unstable_is(e) : e === t, dg = (t) => "init" in t, fg = (t) => !!t.write, Oh = /* @__PURE__ */ new WeakMap(), $v = (t) => { var e; return Vv(t) && !((e = Oh.get(t)) != null && e[1]); }, nI = (t, e) => { const n = Oh.get(t); if (n) n[1] = !0, n[0].forEach((r) => r(e)); else if ((Ai ? "production" : void 0) !== "production") throw new Error("[Bug] cancelable promise not found"); }, rI = (t) => { if (Oh.has(t)) return; const e = [/* @__PURE__ */ new Set(), !1]; Oh.set(t, e); const n = () => { e[1] = !0; }; t.then(n, n), t.onCancel = (r) => { e[0].add(r); }; }, Vv = (t) => typeof t?.then == "function", zS = (t) => "v" in t || "e" in t, qf = (t) => { if ("e" in t) throw t.e; if ((Ai ? "production" : void 0) !== "production" && !("v" in t)) throw new Error("[Bug] atom state is not initialized"); return t.v; }, x1 = (t, e, n) => { n.p.has(t) || (n.p.add(t), e.then( () => { n.p.delete(t); }, () => { n.p.delete(t); } )); }, qS = (t, e, n, r, i) => { var o; if ((Ai ? "production" : void 0) !== "production" && r === e) throw new Error("[Bug] atom cannot depend on itself"); n.d.set(r, i.n), $v(n.v) && x1(e, n.v, i), (o = i.m) == null || o.t.add(e), t && iI(t, r, e); }, ju = () => [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Set()], hg = (t, e, n) => { t[0].has(e) || t[0].set(e, /* @__PURE__ */ new Set()), t[1].set(e, n); }, iI = (t, e, n) => { const r = t[0].get(e); r && r.add(n); }, oI = (t, e) => t[0].get(e), HS = (t, e) => { t[2].add(e); }, Sa = (t) => { for (; t[1].size || t[2].size; ) { t[0].clear(); const e = new Set(t[1].values()); t[1].clear(); const n = new Set(t[2]); t[2].clear(), e.forEach((r) => { var i; return (i = r.m) == null ? void 0 : i.l.forEach((o) => o()); }), n.forEach((r) => r()); } }, N1 = (t) => { let e; (Ai ? "production" : void 0) !== "production" && (e = /* @__PURE__ */ new Set()); const n = (E, T, D) => { const R = "v" in T, L = T.v, j = $v(T.v) ? T.v : null; if (Vv(D)) { rI(D); for (const K of T.d.keys()) x1( E, D, t(K, T) ); T.v = D, delete T.e; } else T.v = D, delete T.e; (!R || !Object.is(L, T.v)) && (++T.n, j && nI(j, D)); }, r = (E, T, D, R) => { var L; if (!R?.(T) && zS(D) && (D.m || Array.from(D.d).every( ([ve, Z]) => ( // Recursively, read the atom state of the dependency, and // check if the atom epoch number is unchanged r(E, ve, t(ve, D), R).n === Z ) ))) return D; D.d.clear(); let j = !0; const K = (ve) => { if (VS(T, ve)) { const we = t(ve, D); if (!zS(we)) if (dg(ve)) n(ve, we, ve.init); else throw new Error("no atom init"); return qf(we); } const Z = r( E, ve, t(ve, D), R ); if (j) qS(E, T, D, ve, Z); else { const we = ju(); qS(we, T, D, ve, Z), d(we, T, D), Sa(we); } return qf(Z); }; let ue, de; const H = { get signal() { return ue || (ue = new AbortController()), ue.signal; }, get setSelf() { return (Ai ? "production" : void 0) !== "production" && !fg(T) && console.warn("setSelf function cannot be used with read-only atom"), !de && fg(T) && (de = (...ve) => { if ((Ai ? "production" : void 0) !== "production" && j && console.warn("setSelf function cannot be called in sync"), !j) return f(T, ...ve); }), de; } }; try { const ve = T.read(K, H); if (n(T, D, ve), Vv(ve)) { (L = ve.onCancel) == null || L.call(ve, () => ue?.abort()); const Z = () => { if (D.m) { const we = ju(); d(we, T, D), Sa(we); } }; ve.then(Z, Z); } return D; } catch (ve) { return delete D.v, D.e = ve, ++D.n, D; } finally { j = !1; } }, i = (E) => qf(r(void 0, E, t(E))), o = (E, T, D) => { var R, L; const j = /* @__PURE__ */ new Map(); for (const K of ((R = D.m) == null ? void 0 : R.t) || []) j.set(K, t(K, D)); for (const K of D.p) j.set( K, t(K, D) ); return (L = oI(E, T)) == null || L.forEach((K) => { j.set(K, t(K, D)); }), j; }, u = (E, T, D) => { const R = [], L = /* @__PURE__ */ new Set(), j = (de, H) => { if (!L.has(de)) { L.add(de); for (const [ve, Z] of o(E, de, H)) de !== ve && j(ve, Z); R.push([de, H, H.n]); } }; j(T, D); const K = /* @__PURE__ */ new Set([T]), ue = (de) => L.has(de); for (let de = R.length - 1; de >= 0; --de) { const [H, ve, Z] = R[de]; let we = !1; for (const ze of ve.d.keys()) if (ze !== H && K.has(ze)) { we = !0; break; } we && (r(E, H, ve, ue), d(E, H, ve), Z !== ve.n && (hg(E, H, ve), K.add(H))), L.delete(H); } }, l = (E, T, D, ...R) => { const L = (ue) => qf(r(E, ue, t(ue, D))), j = (ue, ...de) => { const H = t(ue, D); let ve; if (VS(T, ue)) { if (!dg(ue)) throw new Error("atom not writable"); const Z = "v" in H, we = H.v, ze = de[0]; n(ue, H, ze), d(E, ue, H), (!Z || !Object.is(we, H.v)) && (hg(E, ue, H), u(E, ue, H)); } else ve = l(E, ue, H, ...de); return Sa(E), ve; }; return T.write(L, j, ...R); }, f = (E, ...T) => { const D = ju(), R = l(D, E, t(E), ...T); return Sa(D), R; }, d = (E, T, D) => { if (D.m && !$v(D.v)) { for (const R of D.d.keys()) D.m.d.has(R) || (p(E, R, t(R, D)).t.add(T), D.m.d.add(R)); for (const R of D.m.d || []) if (!D.d.has(R)) { D.m.d.delete(R); const L = v(E, R, t(R, D)); L?.t.delete(T); } } }, p = (E, T, D) => { if (!D.m) { r(E, T, D); for (const R of D.d.keys()) p(E, R, t(R, D)).t.add(T); if (D.m = { l: /* @__PURE__ */ new Set(), d: new Set(D.d.keys()), t: /* @__PURE__ */ new Set() }, (Ai ? "production" : void 0) !== "production" && e.add(T), fg(T) && T.onMount) { const R = D.m, { onMount: L } = T; HS(E, () => { const j = L( (...K) => l(E, T, D, ...K) ); j && (R.u = j); }); } } return D.m; }, v = (E, T, D) => { if (D.m && !D.m.l.size && !Array.from(D.m.t).some( (R) => { var L; return (L = t(R, D).m) == null ? void 0 : L.d.has(T); } )) { const R = D.m.u; R && HS(E, R), delete D.m, (Ai ? "production" : void 0) !== "production" && e.delete(T); for (const L of D.d.keys()) { const j = v(E, L, t(L, D)); j?.t.delete(T); } return; } return D.m; }, A = { get: i, set: f, sub: (E, T) => { const D = ju(), R = t(E), L = p(D, E, R); Sa(D); const j = L.l; return j.add(T), () => { j.delete(T); const K = ju(); v(K, E, R), Sa(K); }; }, unstable_derive: (E) => N1(...E(t)) }; return (Ai ? "production" : void 0) !== "production" && Object.assign(A, { // store dev methods (these are tentative and subject to change without notice) dev4_get_internal_weak_map: () => ({ get: (T) => { const D = t(T); if (D.n !== 0) return D; } }), dev4_get_mounted_atoms: () => e, dev4_restore_atoms: (T) => { const D = ju(); for (const [R, L] of T) if (dg(R)) { const j = t(R), K = "v" in j, ue = j.v; n(R, j, L), d(D, R, j), (!K || !Object.is(ue, j.v)) && (hg(D, R, j), u(D, R, j)); } Sa(D); } }), A; }, sI = () => { const t = /* @__PURE__ */ new WeakMap(); return N1((n) => { let r = t.get(n); return r || (r = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, t.set(n, r)), r; }); }; let vc; const aI = () => (vc || (vc = sI(), (Ai ? "production" : void 0) !== "production" && (globalThis.__JOTAI_DEFAULT_STORE__ || (globalThis.__JOTAI_DEFAULT_STORE__ = vc), globalThis.__JOTAI_DEFAULT_STORE__ !== vc && console.warn( "Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044" ))), vc); var Os = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function Bs(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } function wl(t) { if (Object.prototype.hasOwnProperty.call(t, "__esModule")) return t; var e = t.default; if (typeof e == "function") { var n = function r() { var i = !1; try { i = this instanceof r; } catch { } return i ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); }; n.prototype = e.prototype; } else n = {}; return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(t).forEach(function(r) { var i = Object.getOwnPropertyDescriptor(t, r); Object.defineProperty(n, r, i.get ? i : { enumerable: !0, get: function() { return t[r]; } }); }), n; } var pg = { exports: {} }, Ot = {}; /** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var KS; function uI() { if (KS) return Ot; KS = 1; var t = Symbol.for("react.element"), e = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), u = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), d = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), v = Symbol.iterator; function y(M) { return M === null || typeof M != "object" ? null : (M = v && M[v] || M["@@iterator"], typeof M == "function" ? M : null); } var k = { isMounted: function() { return !1; }, enqueueForceUpdate: function() { }, enqueueReplaceState: function() { }, enqueueSetState: function() { } }, A = Object.assign, E = {}; function T(M, te, Te) { this.props = M, this.context = te, this.refs = E, this.updater = Te || k; } T.prototype.isReactComponent = {}, T.prototype.setState = function(M, te) { if (typeof M != "object" && typeof M != "function" && M != null) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."); this.updater.enqueueSetState(this, M, te, "setState"); }, T.prototype.forceUpdate = function(M) { this.updater.enqueueForceUpdate(this, M, "forceUpdate"); }; function D() { } D.prototype = T.prototype; function R(M, te, Te) { this.props = M, this.context = te, this.refs = E, this.updater = Te || k; } var L = R.prototype = new D(); L.constructor = R, A(L, T.prototype), L.isPureReactComponent = !0; var j = Array.isArray, K = Object.prototype.hasOwnProperty, ue = { current: null }, de = { key: !0, ref: !0, __self: !0, __source: !0 }; function H(M, te, Te) { var $, Q = {}, Ye = null, Ie = null; if (te != null) for ($ in te.ref !== void 0 && (Ie = te.ref), te.key !== void 0 && (Ye = "" + te.key), te) K.call(te, $) && !de.hasOwnProperty($) && (Q[$] = te[$]); var Ge = arguments.length - 2; if (Ge === 1) Q.children = Te; else if (1 < Ge) { for (var Re = Array(Ge), ht = 0; ht < Ge; ht++) Re[ht] = arguments[ht + 2]; Q.children = Re; } if (M && M.defaultProps) for ($ in Ge = M.defaultProps, Ge) Q[$] === void 0 && (Q[$] = Ge[$]); return { $$typeof: t, type: M, key: Ye, ref: Ie, props: Q, _owner: ue.current }; } function ve(M, te) { return { $$typeof: t, type: M.type, key: te, ref: M.ref, props: M.props, _owner: M._owner }; } function Z(M) { return typeof M == "object" && M !== null && M.$$typeof === t; } function we(M) { var te = { "=": "=0", ":": "=2" }; return "$" + M.replace(/[=:]/g, function(Te) { return te[Te]; }); } var ze = /\/+/g; function it(M, te) { return typeof M == "object" && M !== null && M.key != null ? we("" + M.key) : te.toString(36); } function dt(M, te, Te, $, Q) { var Ye = typeof M; (Ye === "undefined" || Ye === "boolean") && (M = null); var Ie = !1; if (M === null) Ie = !0; else switch (Ye) { case "string": case "number": Ie = !0; break; case "object": switch (M.$$typeof) { case t: case e: Ie = !0; } } if (Ie) return Ie = M, Q = Q(Ie), M = $ === "" ? "." + it(Ie, 0) : $, j(Q) ? (Te = "", M != null && (Te = M.replace(ze, "$&/") + "/"), dt(Q, te, Te, "", function(ht) { return ht; })) : Q != null && (Z(Q) && (Q = ve(Q, Te + (!Q.key || Ie && Ie.key === Q.key ? "" : ("" + Q.key).replace(ze, "$&/") + "/") + M)), te.push(Q)), 1; if (Ie = 0, $ = $ === "" ? "." : $ + ":", j(M)) for (var Ge = 0; Ge < M.length; Ge++) { Ye = M[Ge]; var Re = $ + it(Ye, Ge); Ie += dt(Ye, te, Te, Re, Q); } else if (Re = y(M), typeof Re == "function") for (M = Re.call(M), Ge = 0; !(Ye = M.next()).done; ) Ye = Ye.value, Re = $ + it(Ye, Ge++), Ie += dt(Ye, te, Te, Re, Q); else if (Ye === "object") throw te = String(M), Error("Objects are not valid as a React child (found: " + (te === "[object Object]" ? "object with keys {" + Object.keys(M).join(", ") + "}" : te) + "). If you meant to render a collection of children, use an array instead."); return Ie; } function ae(M, te, Te) { if (M == null) return M; var $ = [], Q = 0; return dt(M, $, "", "", function(Ye) { return te.call(Te, Ye, Q++); }), $; } function be(M) { if (M._status === -1) { var te = M._result; te = te(), te.then(function(Te) { (M._status === 0 || M._status === -1) && (M._status = 1, M._result = Te); }, function(Te) { (M._status === 0 || M._status === -1) && (M._status = 2, M._result = Te); }), M._status === -1 && (M._status = 0, M._result = te); } if (M._status === 1) return M._result.default; throw M._result; } var pe = { current: null }, ce = { transition: null }, Ee = { ReactCurrentDispatcher: pe, ReactCurrentBatchConfig: ce, ReactCurrentOwner: ue }; function B() { throw Error("act(...) is not supported in production builds of React."); } return Ot.Children = { map: ae, forEach: function(M, te, Te) { ae(M, function() { te.apply(this, arguments); }, Te); }, count: function(M) { var te = 0; return ae(M, function() { te++; }), te; }, toArray: function(M) { return ae(M, function(te) { return te; }) || []; }, only: function(M) { if (!Z(M)) throw Error("React.Children.only expected to receive a single React element child."); return M; } }, Ot.Component = T, Ot.Fragment = n, Ot.Profiler = i, Ot.PureComponent = R, Ot.StrictMode = r, Ot.Suspense = f, Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Ee, Ot.act = B, Ot.cloneElement = function(M, te, Te) { if (M == null) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + M + "."); var $ = A({}, M.props), Q = M.key, Ye = M.ref, Ie = M._owner; if (te != null) { if (te.ref !== void 0 && (Ye = te.ref, Ie = ue.current), te.key !== void 0 && (Q = "" + te.key), M.type && M.type.defaultProps) var Ge = M.type.defaultProps; for (Re in te) K.call(te, Re) && !de.hasOwnProperty(Re) && ($[Re] = te[Re] === void 0 && Ge !== void 0 ? Ge[Re] : te[Re]); } var Re = arguments.length - 2; if (Re === 1) $.children = Te; else if (1 < Re) { Ge = Array(Re); for (var ht = 0; ht < Re; ht++) Ge[ht] = arguments[ht + 2]; $.children = Ge; } return { $$typeof: t, type: M.type, key: Q, ref: Ye, props: $, _owner: Ie }; }, Ot.createContext = function(M) { return M = { $$typeof: u, _currentValue: M, _currentValue2: M, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }, M.Provider = { $$typeof: o, _context: M }, M.Consumer = M; }, Ot.createElement = H, Ot.createFactory = function(M) { var te = H.bind(null, M); return te.type = M, te; }, Ot.createRef = function() { return { current: null }; }, Ot.forwardRef = function(M) { return { $$typeof: l, render: M }; }, Ot.isValidElement = Z, Ot.lazy = function(M) { return { $$typeof: p, _payload: { _status: -1, _result: M }, _init: be }; }, Ot.memo = function(M, te) { return { $$typeof: d, type: M, compare: te === void 0 ? null : te }; }, Ot.startTransition = function(M) { var te = ce.transition; ce.transition = {}; try { M(); } finally { ce.transition = te; } }, Ot.unstable_act = B, Ot.useCallback = function(M, te) { return pe.current.useCallback(M, te); }, Ot.useContext = function(M) { return pe.current.useContext(M); }, Ot.useDebugValue = function() { }, Ot.useDeferredValue = function(M) { return pe.current.useDeferredValue(M); }, Ot.useEffect = function(M, te) { return pe.current.useEffect(M, te); }, Ot.useId = function() { return pe.current.useId(); }, Ot.useImperativeHandle = function(M, te, Te) { return pe.current.useImperativeHandle(M, te, Te); }, Ot.useInsertionEffect = function(M, te) { return pe.current.useInsertionEffect(M, te); }, Ot.useLayoutEffect = function(M, te) { return pe.current.useLayoutEffect(M, te); }, Ot.useMemo = function(M, te) { return pe.current.useMemo(M, te); }, Ot.useReducer = function(M, te, Te) { return pe.current.useReducer(M, te, Te); }, Ot.useRef = function(M) { return pe.current.useRef(M); }, Ot.useState = function(M) { return pe.current.useState(M); }, Ot.useSyncExternalStore = function(M, te, Te) { return pe.current.useSyncExternalStore(M, te, Te); }, Ot.useTransition = function() { return pe.current.useTransition(); }, Ot.version = "18.3.1", Ot; } var GS; function e0() { return GS || (GS = 1, pg.exports = uI()), pg.exports; } var gt = e0(); const zv = /* @__PURE__ */ Bs(gt), T1 = {}, lI = gt.createContext( void 0 ), I1 = (t) => gt.useContext(lI) || aI(), R1 = (t) => typeof t?.then == "function", cI = (t) => { t.status = "pending", t.then( (e) => { t.status = "fulfilled", t.value = e; }, (e) => { t.status = "rejected", t.reason = e; } ); }, dI = zv.use || ((t) => { if (t.status === "pending") throw t; if (t.status === "fulfilled") return t.value; throw t.status === "rejected" ? t.reason : (cI(t), t); }), mg = /* @__PURE__ */ new WeakMap(), fI = (t) => { let e = mg.get(t); return e || (e = new Promise((n, r) => { let i = t; const o = (f) => (d) => { i === f && n(d); }, u = (f) => (d) => { i === f && r(d); }, l = (f) => { "onCancel" in f && typeof f.onCancel == "function" && f.onCancel((d) => { if ((T1 ? "production" : void 0) !== "production" && d === f) throw new Error("[Bug] p is not updated even after cancelation"); R1(d) ? (mg.set(d, e), i = d, d.then(o(d), u(d)), l(d)) : n(d); }); }; t.then(o(t), u(t)), l(t); }), mg.set(t, e)), e; }; function Ph(t, e) { const n = I1(), [[r, i, o], u] = gt.useReducer( (d) => { const p = n.get(t); return Object.is(d[0], p) && d[1] === n && d[2] === t ? d : [p, n, t]; }, void 0, () => [n.get(t), n, t] ); let l = r; if ((i !== n || o !== t) && (u(), l = n.get(t)), gt.useEffect(() => { const d = n.sub(t, () => { u(); }); return u(), d; }, [n, t, void 0]), gt.useDebugValue(l), R1(l)) { const d = fI(l); return dI(d); } return l; } function t0(t, e) { const n = I1(); return gt.useCallback( (...i) => { if ((T1 ? "production" : void 0) !== "production" && !("write" in t)) throw new Error("not writable atom"); return n.set(t, ...i); }, [n, t] ); } function gg(t, e) { return [ Ph(t), // We do wrong type assertion here, which results in throwing an error. t0(t) ]; } const O1 = Io(null); O1.debugLabel = "accountAtom"; function hI(t, e, n) { fetch(e).then((r) => r.blob()).then((r) => P1(r, `${t}.${n}`)); } const P1 = (t, e, n) => { const r = [t], i = new Blob(r, { type: n ?? "application/octet-stream" }); if (typeof window.navigator.msSaveBlob < "u") return window.navigator.msSaveBlob(i, e); const o = window.URL && window.URL.createObjectURL ? window.URL.createObjectURL(i) : window.webkitURL.createObjectURL(i), u = document.createElement("a"); return u.style.display = "none", u.href = o, u.setAttribute("download", e), typeof u.download > "u" && u.setAttribute("target", "_blank"), document.body.appendChild(u), u.click(), setTimeout(() => { document.body.removeChild(u), window.URL.revokeObjectURL(o); }, 200); }; var pI = "2.0.3", qv = 500, WS = "user-agent", dl = "", YS = "?", Dh = "function", Ts = "undefined", fl = "object", Hv = "string", kr = "browser", Ro = "cpu", Zi = "device", Ci = "engine", ti = "os", al = "result", Me = "name", xe = "type", Le = "vendor", je = "version", Er = "architecture", sd = "major", Oe = "model", Hc = "console", Ct = "mobile", en = "tablet", Nn = "smarttv", Ji = "wearable", vg = "xr", Kc = "embedded", yc = "inapp", n0 = "brands", Ia = "formFactors", r0 = "fullVersionList", ul = "platform", i0 = "platformVersion", up = "bitness", js = "sec-ch-ua", mI = js + "-full-version-list", gI = js + "-arch", vI = js + "-" + up, yI = js + "-form-factors", wI = js + "-" + Ct, SI = js + "-" + Oe, D1 = js + "-" + ul, _I = D1 + "-version", F1 = [n0, r0, Ct, Oe, ul, i0, Er, Ia, up], Hf = "Amazon", $u = "Apple", QS = "ASUS", JS = "BlackBerry", _a = "Google", XS = "Huawei", ZS = "Lenovo", e_ = "Honor", Kf = "LG", yg = "Microsoft", wg = "Motorola", Sg = "Nvidia", t_ = "OnePlus", _g = "OPPO", wc = "Samsung", n_ = "Sharp", Sc = "Sony", bg = "Xiaomi", kg = "Zebra", r_ = "Chrome", i_ = "Chromium", vs = "Chromecast", bI = "Edge", _c = "Firefox", bc = "Opera", Eg = "Facebook", o_ = "Sogou", Vu = "Mobile ", kc = " Browser", Kv = "Windows", kI = typeof window !== Ts, Ar = kI && window.navigator ? window.navigator : void 0, As = Ar && Ar.userAgentData ? Ar.userAgentData : void 0, EI = function(t, e) { var n = {}, r = e; if (!Fh(e)) { r = {}; for (var i in e) for (var o in e[i]) r[o] = e[i][o].concat(r[o] ? r[o] : []); } for (var u in t) n[u] = r[u] && r[u].length % 2 === 0 ? r[u].concat(t[u]) : t[u]; return n; }, lp = function(t) { for (var e = {}, n = 0; n < t.length; n++) e[t[n].toUpperCase()] = t[n]; return e; }, Gv = function(t, e) { if (typeof t === fl && t.length > 0) { for (var n in t) if (Do(t[n]) == Do(e)) return !0; return !1; } return Sl(t) ? Do(e).indexOf(Do(t)) !== -1 : !1; }, Fh = function(t, e) { for (var n in t) return /^(browser|cpu|device|engine|os)$/.test(n) || (e ? Fh(t[n]) : !1); }, Sl = function(t) { return typeof t === Hv; }, Ag = function(t) { if (t) { for (var e = [], n = hl(/\\?\"/g, t).split(","), r = 0; r < n.length; r++) if (n[r].indexOf(";") > -1) { var i = ad(n[r]).split(";v="); e[r] = { brand: i[0], version: i[1] }; } else e[r] = ad(n[r]); return e; } }, Do = function(t) { return Sl(t) ? t.toLowerCase() : t; }, Cg = function(t) { return Sl(t) ? hl(/[^\d\.]/g, t).split(".")[0] : void 0; }, Fo = function(t) { for (var e in t) { var n = t[e]; typeof n == fl && n.length == 2 ? this[n[0]] = n[1] : this[n] = void 0; } return this; }, hl = function(t, e) { return Sl(e) ? e.replace(t, dl) : e; }, Ec = function(t) { return hl(/\\?\"/g, t); }, ad = function(t, e) { if (Sl(t)) return t = hl(/^\s\s*/, t), typeof e === Ts ? t : t.substring(0, qv); }, xg = function(t, e) { if (!(!t || !e)) for (var n = 0, r, i, o, u, l, f; n < e.length && !l; ) { var d = e[n], p = e[n + 1]; for (r = i = 0; r < d.length && !l && d[r]; ) if (l = d[r++].exec(t), l) for (o = 0; o < p.length; o++) f = l[++i], u = p[o], typeof u === fl && u.length > 0 ? u.length === 2 ? typeof u[1] == Dh ? this[u[0]] = u[1].call(this, f) : this[u[0]] = u[1] : u.length === 3 ? typeof u[1] === Dh && !(u[1].exec && u[1].test) ? this[u[0]] = f ? u[1].call(this, f, u[2]) : void 0 : this[u[0]] = f ? f.replace(u[1], u[2]) : void 0 : u.length === 4 && (this[u[0]] = f ? u[3].call(this, f.replace(u[1], u[2])) : void 0) : this[u] = f || void 0; n += 2; } }, Cs = function(t, e) { for (var n in e) if (typeof e[n] === fl && e[n].length > 0) { for (var r = 0; r < e[n].length; r++) if (Gv(e[n][r], t)) return n === YS ? void 0 : n; } else if (Gv(e[n], t)) return n === YS ? void 0 : n; return e.hasOwnProperty("*") ? e["*"] : t; }, s_ = { ME: "4.90", "NT 3.11": "NT3.51", "NT 4.0": "NT4.0", 2e3: "NT 5.0", XP: ["NT 5.1", "NT 5.2"], Vista: "NT 6.0", 7: "NT 6.1", 8: "NT 6.2", "8.1": "NT 6.3", 10: ["NT 6.4", "NT 10.0"], RT: "ARM" }, a_ = { embedded: "Automotive", mobile: "Mobile", tablet: ["Tablet", "EInk"], smarttv: "TV", wearable: "Watch", xr: ["VR", "XR"], "?": ["Desktop", "Unknown"], "*": void 0 }, u_ = { browser: [ [ // Most common regardless engine /\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [je, [Me, Vu + "Chrome"]], [ /edg(?:e|ios|a)?\/([\w\.]+)/i // Microsoft Edge ], [je, [Me, "Edge"]], [ // Presto based /(opera mini)\/([-\w\.]+)/i, // Opera Mini /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, // Opera Mobi/Tablet /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera ], [Me, je], [ /opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0 ], [je, [Me, bc + " Mini"]], [ /\bop(?:rg)?x\/([\w\.]+)/i // Opera GX ], [je, [Me, bc + " GX"]], [ /\bopr\/([\w\.]+)/i // Opera Webkit ], [je, [Me, bc]], [ // Mixed /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu ], [je, [Me, "Baidu"]], [ /\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i // Maxthon ], [je, [Me, "Maxthon"]], [ /(kindle)\/([\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir // Trident based /(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, // Avant/IEMobile/SlimBrowser/SlimBoat/Slimjet /(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer // Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon/LG Browser/Otter/qutebrowser/Dooble /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i, // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon /(heytap|ovi|115|surf)browser\/([\d\.]+)/i, // HeyTap/Ovi/115/Surf /(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i // Ecosia/Weibo ], [Me, je], [ /quark(?:pc)?\/([-\w\.]+)/i // Quark ], [je, [Me, "Quark"]], [ /\bddg\/([\w\.]+)/i // DuckDuckGo ], [je, [Me, "DuckDuckGo"]], [ /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser ], [je, [Me, "UCBrowser"]], [ /microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser /\bqbcore\/([\w\.]+).+microm/i, /micromessenger\/([\w\.]+)/i // WeChat ], [je, [Me, "WeChat"]], [ /konqueror\/([\w\.]+)/i // Konqueror ], [je, [Me, "Konqueror"]], [ /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11 ], [je, [Me, "IE"]], [ /ya(?:search)?browser\/([\w\.]+)/i // Yandex ], [je, [Me, "Yandex"]], [ /slbrowser\/([\w\.]+)/i // Smart Lenovo Browser ], [je, [Me, "Smart " + ZS + kc]], [ /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser ], [[Me, /(.+)/, "$1 Secure" + kc], je], [ /\bfocus\/([\w\.]+)/i // Firefox Focus ], [je, [Me, _c + " Focus"]], [ /\bopt\/([\w\.]+)/i // Opera Touch ], [je, [Me, bc + " Touch"]], [ /coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser ], [je, [Me, "Coc Coc"]], [ /dolfin\/([\w\.]+)/i // Dolphin ], [je, [Me, "Dolphin"]], [ /coast\/([\w\.]+)/i // Opera Coast ], [je, [Me, bc + " Coast"]], [ /miuibrowser\/([\w\.]+)/i // MIUI Browser ], [je, [Me, "MIUI" + kc]], [ /fxios\/([\w\.-]+)/i // Firefox for iOS ], [je, [Me, Vu + _c]], [ /\bqihoobrowser\/?([\w\.]*)/i // 360 ], [je, [Me, "360"]], [ /\b(qq)\/([\w\.]+)/i // QQ ], [[Me, /(.+)/, "$1Browser"], je], [ /(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i ], [[Me, /(.+)/, "$1" + kc], je], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser /samsungbrowser\/([\w\.]+)/i // Samsung Internet ], [je, [Me, wc + " Internet"]], [ /metasr[\/ ]?([\d\.]+)/i // Sogou Explorer ], [je, [Me, o_ + " Explorer"]], [ /(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile ], [[Me, o_ + " Mobile"], je], [ /(electron)\/([\w\.]+) safari/i, // Electron-based App /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla /m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i // QQ/2345 ], [Me, je], [ /(lbbrowser|rekonq)/i // LieBao Browser/Rekonq ], [Me], [ /ome\/([\w\.]+) \w* ?(iron) saf/i, // Iron /ome\/([\w\.]+).+qihu (360)[es]e/i // 360 ], [je, Me], [ // WebView /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android ], [[Me, Eg], je, [xe, yc]], [ /(Klarna)\/([\w\.]+)/i, // Klarna Shopping Browser for iOS & Android /(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp /(daum)apps[\/ ]([\w\.]+)/i, // Daum App /safari (line)\/([\w\.]+)/i, // Line App for iOS /\b(line)\/([\w\.]+)\/iab/i, // Line App for Android /(alipay)client\/([\w\.]+)/i, // Alipay /(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter /(instagram|snapchat)[\/ ]([-\w\.]+)/i // Instagram/Snapchat ], [Me, je, [xe, yc]], [ /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS ], [je, [Me, "GSA"], [xe, yc]], [ /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok ], [je, [Me, "TikTok"], [xe, yc]], [ /\[(linkedin)app\]/i // LinkedIn App for iOS & Android ], [Me, [xe, yc]], [ /(chromium)[\/ ]([-\w\.]+)/i // Chromium ], [Me, je], [ /headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless ], [je, [Me, r_ + " Headless"]], [ / wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView ], [[Me, r_ + " WebView"], je], [ /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser ], [je, [Me, "Android" + kc]], [ /chrome\/([\w\.]+) mobile/i // Chrome Mobile ], [je, [Me, Vu + "Chrome"]], [ /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [Me, je], [ /version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i // Safari Mobile ], [je, [Me, Vu + "Safari"]], [ /iphone .*mobile(?:\/\w+ | ?)safari/i ], [[Me, Vu + "Safari"]], [ /version\/([\w\.\,]+) .*(safari)/i // Safari ], [je, Me], [ /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [Me, [je, "1"]], [ /(webkit|khtml)\/([\w\.]+)/i ], [Me, je], [ // Gecko based /(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i // Firefox Mobile ], [[Me, Vu + _c], je], [ /(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape ], [[Me, "Netscape"], je], [ /(wolvic|librewolf)\/([\w\.]+)/i // Wolvic/LibreWolf ], [Me, je], [ /mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality ], [je, [Me, _c + " Reality"]], [ /ekiohf.+(flow)\/([\w\.]+)/i, // Flow /(swiftfox)/i, // Swiftfox /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i, // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i, // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix /(firefox)\/([\w\.]+)/i, // Other Firefox-based /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, // Mozilla // Other /(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i, // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Obigo/Mosaic/Go/ICE/UP.Browser/Ladybird /\b(links) \(([\w\.]+)/i // Links ], [Me, [je, /_/g, "."]], [ /(cobalt)\/([\w\.]+)/i // Cobalt ], [Me, [je, /[^\d\.]+./, dl]] ], cpu: [ [ /\b((amd|x|x86[-_]?|wow|win)64)\b/i // AMD64 (x64) ], [[Er, "amd64"]], [ /(ia32(?=;))/i, // IA32 (quicktime) /\b((i[346]|x)86)(pc)?\b/i // IA32 (x86) ], [[Er, "ia32"]], [ /\b(aarch64|arm(v?[89]e?l?|_?64))\b/i // ARM64 ], [[Er, "arm64"]], [ /\b(arm(v[67])?ht?n?[fl]p?)\b/i // ARMHF ], [[Er, "armhf"]], [ // PocketPC mistakenly identified as PowerPC /( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i ], [[Er, "arm"]], [ /((ppc|powerpc)(64)?)( mac|;|\))/i // PowerPC ], [[Er, /ower/, dl, Do]], [ / sun4\w[;\)]/i // SPARC ], [[Er, "sparc"]], [ /\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC ], [[Er, Do]] ], device: [ [ ////////////////////////// // MOBILES & TABLETS ///////////////////////// // Samsung /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i ], [Oe, [Le, wc], [xe, en]], [ /\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i, /samsung[- ]((?!sm-[lr])[-\w]+)/i, /sec-(sgh\w+)/i ], [Oe, [Le, wc], [xe, Ct]], [ // Apple /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone ], [Oe, [Le, $u], [xe, Ct]], [ /\((ipad);[-\w\),; ]+apple/i, // iPad /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i ], [Oe, [Le, $u], [xe, en]], [ /(macintosh);/i ], [Oe, [Le, $u]], [ // Sharp /\b(sh-?[altvz]?\d\d[a-ekm]?)/i ], [Oe, [Le, n_], [xe, Ct]], [ // Honor /\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i ], [Oe, [Le, e_], [xe, en]], [ /honor([-\w ]+)[;\)]/i ], [Oe, [Le, e_], [xe, Ct]], [ // Huawei /\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i ], [Oe, [Le, XS], [xe, en]], [ /(?:huawei)([-\w ]+)[;\)]/i, /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i ], [Oe, [Le, XS], [xe, Ct]], [ // Xiaomi /oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i, /\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i // Mi Pad tablets ], [[Oe, /_/g, " "], [Le, bg], [xe, en]], [ /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, // Xiaomi POCO /\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi /oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i, // Xiaomi Mi / ([\w ]+) miui\/v?\d/i ], [[Oe, /_/g, " "], [Le, bg], [xe, Ct]], [ // OPPO /; (\w+) bui.+ oppo/i, /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i ], [Oe, [Le, _g], [xe, Ct]], [ /\b(opd2(\d{3}a?))(?: bui|\))/i ], [Oe, [Le, Cs, { OnePlus: ["304", "403", "203"], "*": _g }], [xe, en]], [ // BLU Vivo Series /(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i ], [Oe, [Le, "BLU"], [xe, Ct]], [ // Vivo /; vivo (\w+)(?: bui|\))/i, /\b(v[12]\d{3}\w?[at])(?: bui|;)/i ], [Oe, [Le, "Vivo"], [xe, Ct]], [ // Realme /\b(rmx[1-3]\d{3})(?: bui|;|\))/i ], [Oe, [Le, "Realme"], [xe, Ct]], [ // Motorola /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i, /\bmot(?:orola)?[- ](\w*)/i, /((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i ], [Oe, [Le, wg], [xe, Ct]], [ /\b(mz60\d|xoom[2 ]{0,2}) build\//i ], [Oe, [Le, wg], [xe, en]], [ // LG /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i ], [Oe, [Le, Kf], [xe, en]], [ /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i, /\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch))(\w+)/i, /\blg-?([\d\w]+) bui/i ], [Oe, [Le, Kf], [xe, Ct]], [ // Lenovo /(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i, /lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i ], [Oe, [Le, ZS], [xe, en]], [ // Nokia /(nokia) (t[12][01])/i ], [Le, Oe, [xe, en]], [ /(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i, /nokia[-_ ]?(([-\w\. ]*))/i ], [[Oe, /_/g, " "], [xe, Ct], [Le, "Nokia"]], [ // Google /(pixel (c|tablet))\b/i // Google Pixel C/Tablet ], [Oe, [Le, _a], [xe, en]], [ /droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel ], [Oe, [Le, _a], [xe, Ct]], [ // Sony /droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i ], [Oe, [Le, Sc], [xe, Ct]], [ /sony tablet [ps]/i, /\b(?:sony)?sgp\w+(?: bui|\))/i ], [[Oe, "Xperia Tablet"], [Le, Sc], [xe, en]], [ // OnePlus / (kb2005|in20[12]5|be20[12][59])\b/i, /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i ], [Oe, [Le, t_], [xe, Ct]], [ // Amazon /(alexa)webm/i, /(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i, // Kindle Fire without Silk / Echo Show /(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD ], [Oe, [Le, Hf], [xe, en]], [ /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone ], [[Oe, /(.+)/g, "Fire Phone $1"], [Le, Hf], [xe, Ct]], [ // BlackBerry /(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook ], [Oe, Le, [xe, en]], [ /\b((?:bb[a-f]|st[hv])100-\d)/i, /\(bb10; (\w+)/i // BlackBerry 10 ], [Oe, [Le, JS], [xe, Ct]], [ // Asus /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i ], [Oe, [Le, QS], [xe, en]], [ / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i ], [Oe, [Le, QS], [xe, Ct]], [ // HTC /(nexus 9)/i // HTC Nexus 9 ], [Oe, [Le, "HTC"], [xe, en]], [ /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, // HTC // ZTE /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony ], [Le, [Oe, /_/g, " "], [xe, Ct]], [ // TCL /tcl (xess p17aa)/i, /droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i ], [Oe, [Le, "TCL"], [xe, en]], [ /droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i ], [Oe, [Le, "TCL"], [xe, Ct]], [ // itel /(itel) ((\w+))/i ], [[Le, Do], Oe, [xe, Cs, { tablet: ["p10001l", "w7001"], "*": "mobile" }]], [ // Acer /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i ], [Oe, [Le, "Acer"], [xe, en]], [ // Meizu /droid.+; (m[1-5] note) bui/i, /\bmz-([-\w]{2,})/i ], [Oe, [Le, "Meizu"], [xe, Ct]], [ // Ulefone /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i ], [Oe, [Le, "Ulefone"], [xe, Ct]], [ // Energizer /; (energy ?\w+)(?: bui|\))/i, /; energizer ([\w ]+)(?: bui|\))/i ], [Oe, [Le, "Energizer"], [xe, Ct]], [ // Cat /; cat (b35);/i, /; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i ], [Oe, [Le, "Cat"], [xe, Ct]], [ // Smartfren /((?:new )?andromax[\w- ]+)(?: bui|\))/i ], [Oe, [Le, "Smartfren"], [xe, Ct]], [ // Nothing /droid.+; (a(?:015|06[35]|142p?))/i ], [Oe, [Le, "Nothing"], [xe, Ct]], [ // Archos /; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i, /archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i ], [Oe, [Le, "Archos"], [xe, en]], [ /archos ([\w ]+)( b|\))/i, /; (ac[3-6]\d\w{2,8})( b|\))/i ], [Oe, [Le, "Archos"], [xe, Ct]], [ // MIXED /(imo) (tab \w+)/i, // IMO /(infinix) (x1101b?)/i // Infinix XPad ], [Le, Oe, [xe, en]], [ /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i, // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Infinix/Tecno/Micromax/Advan /; (blu|hmd|imo|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i, // BLU/HMD/IMO/TCL /(hp) ([\w ]+\w)/i, // HP iPAQ /(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia /(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i, // Lenovo /(oppo) ?([\w ]+) bui/i // OPPO ], [Le, Oe, [xe, Ct]], [ /(kobo)\s(ereader|touch)/i, // Kobo /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad /(kindle)\/([\w\.]+)/i // Kindle ], [Le, Oe, [xe, en]], [ /(surface duo)/i // Surface Duo ], [Oe, [Le, yg], [xe, en]], [ /droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone ], [Oe, [Le, "Fairphone"], [xe, Ct]], [ /((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i // Nvidia Tablets ], [Oe, [Le, Sg], [xe, en]], [ /(sprint) (\w+)/i // Sprint Phones ], [Le, Oe, [xe, Ct]], [ /(kin\.[onetw]{3})/i // Microsoft Kin ], [[Oe, /\./g, " "], [Le, yg], [xe, Ct]], [ /droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra ], [Oe, [Le, kg], [xe, en]], [ /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i ], [Oe, [Le, kg], [xe, Ct]], [ /////////////////// // SMARTTVS /////////////////// /smart-tv.+(samsung)/i // Samsung ], [Le, [xe, Nn]], [ /hbbtv.+maple;(\d+)/i ], [[Oe, /^/, "SmartTV"], [Le, wc], [xe, Nn]], [ /tcast.+(lg)e?. ([-\w]+)/i // LG SmartTV ], [Le, Oe, [xe, Nn]], [ /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i ], [[Le, Kf], [xe, Nn]], [ /(apple) ?tv/i // Apple TV ], [Le, [Oe, $u + " TV"], [xe, Nn]], [ /crkey.*devicetype\/chromecast/i // Google Chromecast Third Generation ], [[Oe, vs + " Third Generation"], [Le, _a], [xe, Nn]], [ /crkey.*devicetype\/([^/]*)/i // Google Chromecast with specific device type ], [[Oe, /^/, "Chromecast "], [Le, _a], [xe, Nn]], [ /fuchsia.*crkey/i // Google Chromecast Nest Hub ], [[Oe, vs + " Nest Hub"], [Le, _a], [xe, Nn]], [ /crkey/i // Google Chromecast, Linux-based or unknown ], [[Oe, vs], [Le, _a], [xe, Nn]], [ /(portaltv)/i // Facebook Portal TV ], [Oe, [Le, Eg], [xe, Nn]], [ /droid.+aft(\w+)( bui|\))/i // Fire TV ], [Oe, [Le, Hf], [xe, Nn]], [ /(shield \w+ tv)/i // Nvidia Shield TV ], [Oe, [Le, Sg], [xe, Nn]], [ /\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i // Sharp ], [Oe, [Le, n_], [xe, Nn]], [ /(bravia[\w ]+)( bui|\))/i // Sony ], [Oe, [Le, Sc], [xe, Nn]], [ /(mi(tv|box)-?\w+) bui/i // Xiaomi ], [Oe, [Le, bg], [xe, Nn]], [ /Hbbtv.*(technisat) (.*);/i // TechniSAT ], [Le, Oe, [xe, Nn]], [ /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices ], [[Le, ad], [Oe, ad], [xe, Nn]], [ // SmartTV from Unidentified Vendors /droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i ], [Oe, [xe, Nn]], [ /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i ], [[xe, Nn]], [ /////////////////// // CONSOLES /////////////////// /(ouya)/i, // Ouya /(nintendo) (\w+)/i // Nintendo ], [Le, Oe, [xe, Hc]], [ /droid.+; (shield)( bui|\))/i // Nvidia Portable ], [Oe, [Le, Sg], [xe, Hc]], [ /(playstation \w+)/i // Playstation ], [Oe, [Le, Sc], [xe, Hc]], [ /\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox ], [Oe, [Le, yg], [xe, Hc]], [ /////////////////// // WEARABLES /////////////////// /\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i // Samsung Galaxy Watch ], [Oe, [Le, wc], [xe, Ji]], [ /((pebble))app/i, // Pebble /(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i // Asus ZenWatch / LG Watch / Pixel Watch ], [Le, Oe, [xe, Ji]], [ /(ow(?:19|20)?we?[1-3]{1,3})/i // Oppo Watch ], [Oe, [Le, _g], [xe, Ji]], [ /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch ], [Oe, [Le, $u], [xe, Ji]], [ /(opwwe\d{3})/i // OnePlus Watch ], [Oe, [Le, t_], [xe, Ji]], [ /(moto 360)/i // Motorola 360 ], [Oe, [Le, wg], [xe, Ji]], [ /(smartwatch 3)/i // Sony SmartWatch ], [Oe, [Le, Sc], [xe, Ji]], [ /(g watch r)/i // LG G Watch R ], [Oe, [Le, Kf], [xe, Ji]], [ /droid.+; (wt63?0{2,3})\)/i ], [Oe, [Le, kg], [xe, Ji]], [ /////////////////// // XR /////////////////// /droid.+; (glass) \d/i // Google Glass ], [Oe, [Le, _a], [xe, vg]], [ /(pico) (4|neo3(?: link|pro)?)/i // Pico ], [Le, Oe, [xe, vg]], [ /(quest( \d| pro)?s?).+vr/i // Meta Quest ], [Oe, [Le, Eg], [xe, vg]], [ /////////////////// // EMBEDDED /////////////////// /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla ], [Le, [xe, Kc]], [ /(aeobc)\b/i // Echo Dot ], [Oe, [Le, Hf], [xe, Kc]], [ /(homepod).+mac os/i // Apple HomePod ], [Oe, [Le, $u], [xe, Kc]], [ /windows iot/i ], [[xe, Kc]], [ //////////////////// // MIXED (GENERIC) /////////////////// /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i ], [Oe, [xe, Cs, { mobile: "Mobile", xr: "VR", "*": en }]], [ /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet ], [[xe, en]], [ /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile ], [[xe, Ct]], [ /droid .+?; ([\w\. -]+)( bui|\))/i // Generic Android Device ], [Oe, [Le, "Generic"]] ], engine: [ [ /windows.+ edge\/([\w\.]+)/i // EdgeHTML ], [je, [Me, bI + "HTML"]], [ /(arkweb)\/([\w\.]+)/i // ArkWeb ], [Me, je], [ /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink ], [je, [Me, "Blink"]], [ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna/Servo /ekioh(flow)\/([\w\.]+)/i, // Flow /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links /(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab /\b(libweb)/i // LibWeb ], [Me, je], [ /ladybird\//i ], [[Me, "LibWeb"]], [ /rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko ], [je, Me] ], os: [ [ // Windows /microsoft (windows) (vista|xp)/i // Windows (iTunes) ], [Me, je], [ /(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i // Windows Phone ], [Me, [je, Cs, s_]], [ /windows nt 6\.2; (arm)/i, // Windows RT /windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i, /(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i ], [[je, Cs, s_], [Me, Kv]], [ // iOS/macOS /[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i, /cfnetwork\/.+darwin/i ], [[je, /_/g, "."], [Me, "iOS"]], [ /(mac os x) ?([\w\. ]*)/i, /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS ], [[Me, "macOS"], [je, /_/g, "."]], [ // Google Chromecast /android ([\d\.]+).*crkey/i // Google Chromecast, Android-based ], [je, [Me, vs + " Android"]], [ /fuchsia.*crkey\/([\d\.]+)/i // Google Chromecast, Fuchsia-based ], [je, [Me, vs + " Fuchsia"]], [ /crkey\/([\d\.]+).*devicetype\/smartspeaker/i // Google Chromecast, Linux-based Smart Speaker ], [je, [Me, vs + " SmartSpeaker"]], [ /linux.*crkey\/([\d\.]+)/i // Google Chromecast, Legacy Linux-based ], [je, [Me, vs + " Linux"]], [ /crkey\/([\d\.]+)/i // Google Chromecast, unknown ], [je, [Me, vs]], [ // Mobile OSes /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS ], [je, Me], [ /(ubuntu) ([\w\.]+) like android/i // Ubuntu Touch ], [[Me, /(.+)/, "$1 Touch"], je], [ // Android/Blackberry/WebOS/QNX/Bada/RIM/KaiOS/Maemo/MeeGo/S40/Sailfish OS/OpenHarmony/Tizen /(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/\.; ]?([\d\.]*)/i ], [Me, je], [ /\(bb(10);/i // BlackBerry 10 ], [je, [Me, JS]], [ /(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i // Symbian ], [je, [Me, "Symbian"]], [ /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS ], [je, [Me, _c + " OS"]], [ /web0s;.+rt(tv)/i, /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS ], [je, [Me, "webOS"]], [ /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS ], [je, [Me, "watchOS"]], [ // Google ChromeOS /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS ], [[Me, "Chrome OS"], je], [ // Smart TVs /panasonic;(viera)/i, // Panasonic Viera /(netrange)mmh/i, // Netrange /(nettv)\/(\d+\.[\w\.]+)/i, // NetTV // Console /(nintendo|playstation) (\w+)/i, // Nintendo/Playstation /(xbox); +xbox ([^\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S) /(pico) .+os([\w\.]+)/i, // Pico // Other /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, // Joli/Palm /(mint)[\/\(\) ]?(\w*)/i, // Mint /(mageia|vectorlinux)[; ]/i, // Mageia/VectorLinux /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i, // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire /(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i, // Hurd/Linux /(gnu) ?([\w\.]*)/i, // GNU /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly /(haiku) (\w+)/i // Haiku ], [Me, je], [ /(sunos) ?([\w\.\d]*)/i // Solaris ], [[Me, "Solaris"], je], [ /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris /(aix) ((\d)(?=\.|\)| )[\w\.])*/i, // AIX /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX/SerenityOS /(unix) ?([\w\.]*)/i // UNIX ], [Me, je] ] }, Gf = function() { var t = { init: {}, isIgnore: {}, isIgnoreRgx: {}, toString: {} }; return Fo.call(t.init, [ [kr, [Me, je, sd, xe]], [Ro, [Er]], [Zi, [xe, Oe, Le]], [Ci, [Me, je]], [ti, [Me, je]] ]), Fo.call(t.isIgnore, [ [kr, [je, sd]], [Ci, [je]], [ti, [je]] ]), Fo.call(t.isIgnoreRgx, [ [kr, / ?browser$/i], [ti, / ?os$/i] ]), Fo.call(t.toString, [ [kr, [Me, je]], [Ro, [Er]], [Zi, [Le, Oe]], [Ci, [Me, je]], [ti, [Me, je]] ]), t; }(), AI = function(t, e) { var n = Gf.init[e], r = Gf.isIgnore[e] || 0, i = Gf.isIgnoreRgx[e] || 0, o = Gf.toString[e] || 0; function u() { Fo.call(this, n); } return u.prototype.getItem = function() { return t; }, u.prototype.withClientHints = function() { return As ? As.getHighEntropyValues(F1).then(function(l) { return t.setCH(new L1(l, !1)).parseCH().get(); }) : t.parseCH().get(); }, u.prototype.withFeatureCheck = function() { return t.detectFeature().get(); }, e != al && (u.prototype.is = function(l) { var f = !1; for (var d in this) if (this.hasOwnProperty(d) && !Gv(r, d) && Do(i ? hl(i, this[d]) : this[d]) == Do(i ? hl(i, l) : l)) { if (f = !0, l != Ts) break; } else if (l == Ts && f) { f = !f; break; } return f; }, u.prototype.toString = function() { var l = dl; for (var f in o) typeof this[o[f]] !== Ts && (l += (l ? " " : dl) + this[o[f]]); return l || Ts; }), As || (u.prototype.then = function(l) { var f = this, d = function() { for (var v in f) f.hasOwnProperty(v) && (this[v] = f[v]); }; d.prototype = { is: u.prototype.is, toString: u.prototype.toString }; var p = new d(); return l(p), p; }), new u(); }; function L1(t, e) { if (t = t || {}, Fo.call(this, F1), e) Fo.call(this, [ [n0, Ag(t[js])], [r0, Ag(t[mI])], [Ct, /\?1/.test(t[wI])], [Oe, Ec(t[SI])], [ul, Ec(t[D1])], [i0, Ec(t[_I])], [Er, Ec(t[gI])], [Ia, Ag(t[yI])], [up, Ec(t[vI])] ]); else for (var n in t) this.hasOwnProperty(n) && typeof t[n] !== Ts && (this[n] = t[n]); } function l_(t, e, n, r) { return this.get = function(i) { return i ? this.data.hasOwnProperty(i) ? this.data[i] : void 0 : this.data; }, this.set = function(i, o) { return this.data[i] = o, this; }, this.setCH = function(i) { return this.uaCH = i, this; }, this.detectFeature = function() { if (Ar && Ar.userAgent == this.ua) switch (this.itemType) { case kr: Ar.brave && typeof Ar.brave.isBrave == Dh && this.set(Me, "Brave"); break; case Zi: !this.get(xe) && As && As[Ct] && this.set(xe, Ct), this.get(Oe) == "Macintosh" && Ar && typeof Ar.standalone !== Ts && Ar.maxTouchPoints && Ar.maxTouchPoints > 2 && this.set(Oe, "iPad").set(xe, en); break; case ti: !this.get(Me) && As && As[ul] && this.set(Me, As[ul]); break; case al: var i = this.data, o = function(u) { return i[u].getItem().detectFeature().get(); }; this.set(kr, o(kr)).set(Ro, o(Ro)).set(Zi, o(Zi)).set(Ci, o(Ci)).set(ti, o(ti)); } return this; }, this.parseUA = function() { return this.itemType != al && xg.call(this.data, this.ua, this.rgxMap), this.itemType == kr && this.set(sd, Cg(this.get(je))), this; }, this.parseCH = function() { var i = this.uaCH, o = this.rgxMap; switch (this.itemType) { case kr: case Ci: var u = i[r0] || i[n0], l; if (u) for (var f in u) { var d = u[f].brand || u[f], p = u[f].version; this.itemType == kr && !/not.a.brand/i.test(d) && (!l || /chrom/i.test(l) && d != i_) && (d = Cs(d, { Chrome: "Google Chrome", Edge: "Microsoft Edge", "Chrome WebView": "Android WebView", "Chrome Headless": "HeadlessChrome", "Huawei Browser": "HuaweiBrowser", "MIUI Browser": "Miui Browser", "Opera Mobi": "OperaMobile", Yandex: "YaBrowser" }), this.set(Me, d).set(je, p).set(sd, Cg(p)), l = d), this.itemType == Ci && d == i_ && this.set(je, p); } break; case Ro: var v = i[Er]; v && (v && i[up] == "64" && (v += "64"), xg.call(this.data, v + ";", o)); break; case Zi: if (i[Ct] && this.set(xe, Ct), i[Oe] && (this.set(Oe, i[Oe]), !this.get(xe) || !this.get(Le))) { var y = {}; xg.call(y, "droid 9; " + i[Oe] + ")", o), !this.get(xe) && y.type && this.set(xe, y.type), !this.get(Le) && y.vendor && this.set(Le, y.vendor); } if (i[Ia]) { var k; if (typeof i[Ia] != "string") for (var A = 0; !k && A < i[Ia].length; ) k = Cs(i[Ia][A++], a_); else k = Cs(i[Ia], a_); this.set(xe, k); } break; case ti: var E = i[ul]; if (E) { var T = i[i0]; E == Kv && (T = parseInt(Cg(T), 10) >= 13 ? "11" : "10"), this.set(Me, E).set(je, T); } this.get(Me) == Kv && i[Oe] == "Xbox" && this.set(Me, "Xbox").set(je, void 0); break; case al: var D = this.data, R = function(L) { return D[L].getItem().setCH(i).parseCH().get(); }; this.set(kr, R(kr)).set(Ro, R(Ro)).set(Zi, R(Zi)).set(Ci, R(Ci)).set(ti, R(ti)); } return this; }, Fo.call(this, [ ["itemType", t], ["ua", e], ["uaCH", r], ["rgxMap", n], ["data", AI(this, t)] ]), this; } function Uo(t, e, n) { if (typeof t === fl ? (Fh(t, !0) ? (typeof e === fl && (n = e), e = t) : (n = t, e = void 0), t = void 0) : typeof t === Hv && !Fh(e, !0) && (n = e, e = void 0), n && typeof n.append === Dh) { var r = {}; n.forEach(function(f, d) { r[d] = f; }), n = r; } if (!(this instanceof Uo)) return new Uo(t, e, n).getResult(); var i = typeof t === Hv ? t : ( // Passed user-agent string n && n[WS] ? n[WS] : ( // User-Agent from passed headers Ar && Ar.userAgent ? Ar.userAgent : ( // navigator.userAgent dl ) ) ), o = new L1(n, !0), u = e ? EI(u_, e) : u_, l = function(f) { return f == al ? function() { return new l_(f, i, u, o).set("ua", i).set(kr, this.getBrowser()).set(Ro, this.getCPU()).set(Zi, this.getDevice()).set(Ci, this.getEngine()).set(ti, this.getOS()).get(); } : function() { return new l_(f, i, u[f], o).parseUA().get(); }; }; return Fo.call(this, [ ["getBrowser", l(kr)], ["getCPU", l(Ro)], ["getDevice", l(Zi)], ["getEngine", l(Ci)], ["getOS", l(ti)], ["getResult", l(al)], ["getUA", function() { return i; }], ["setUA", function(f) { return Sl(f) && (i = f.length > qv ? ad(f, qv) : f), this; }] ]).setUA(i), this; } Uo.VERSION = pI; Uo.BROWSER = lp([Me, je, sd, xe]); Uo.CPU = lp([Er]); Uo.DEVICE = lp([Oe, Le, xe, Hc, Ct, Nn, en, Ji, Kc]); Uo.ENGINE = Uo.OS = lp([Me, je]); function pn(t) { return t != null && typeof t == "object" && t["@@functional/placeholder"] === !0; } function $r(t) { return function e(n) { return arguments.length === 0 || pn(n) ? e : t.apply(this, arguments); }; } function Mr(t) { return function e(n, r) { switch (arguments.length) { case 0: return e; case 1: return pn(n) ? e : $r(function(i) { return t(n, i); }); default: return pn(n) && pn(r) ? e : pn(n) ? $r(function(i) { return t(i, r); }) : pn(r) ? $r(function(i) { return t(n, i); }) : t(n, r); } }; } function cp(t, e) { switch (t) { case 0: return function() { return e.apply(this, arguments); }; case 1: return function(n) { return e.apply(this, arguments); }; case 2: return function(n, r) { return e.apply(this, arguments); }; case 3: return function(n, r, i) { return e.apply(this, arguments); }; case 4: return function(n, r, i, o) { return e.apply(this, arguments); }; case 5: return function(n, r, i, o, u) { return e.apply(this, arguments); }; case 6: return function(n, r, i, o, u, l) { return e.apply(this, arguments); }; case 7: return function(n, r, i, o, u, l, f) { return e.apply(this, arguments); }; case 8: return function(n, r, i, o, u, l, f, d) { return e.apply(this, arguments); }; case 9: return function(n, r, i, o, u, l, f, d, p) { return e.apply(this, arguments); }; case 10: return function(n, r, i, o, u, l, f, d, p, v) { return e.apply(this, arguments); }; default: throw new Error("First argument to _arity must be a non-negative integer no greater than ten"); } } function U1(t, e, n) { return function() { for (var r = [], i = 0, o = t, u = 0, l = !1; u < e.length || i < arguments.length; ) { var f; u < e.length && (!pn(e[u]) || i >= arguments.length) ? f = e[u] : (f = arguments[i], i += 1), r[u] = f, pn(f) ? l = !0 : o -= 1, u += 1; } return !l && o <= 0 ? n.apply(this, r) : cp(Math.max(0, o), U1(t, r, n)); }; } var M1 = /* @__PURE__ */ Mr(function(e, n) { return e === 1 ? $r(n) : cp(e, U1(e, [], n)); }); function o0(t) { return function e(n, r, i) { switch (arguments.length) { case 0: return e; case 1: return pn(n) ? e : Mr(function(o, u) { return t(n, o, u); }); case 2: return pn(n) && pn(r) ? e : pn(n) ? Mr(function(o, u) { return t(o, r, u); }) : pn(r) ? Mr(function(o, u) { return t(n, o, u); }) : $r(function(o) { return t(n, r, o); }); default: return pn(n) && pn(r) && pn(i) ? e : pn(n) && pn(r) ? Mr(function(o, u) { return t(o, u, i); }) : pn(n) && pn(i) ? Mr(function(o, u) { return t(o, r, u); }) : pn(r) && pn(i) ? Mr(function(o, u) { return t(n, o, u); }) : pn(n) ? $r(function(o) { return t(o, r, i); }) : pn(r) ? $r(function(o) { return t(n, o, i); }) : pn(i) ? $r(function(o) { return t(n, r, o); }) : t(n, r, i); } }; } const B1 = Array.isArray || function(e) { return e != null && e.length >= 0 && Object.prototype.toString.call(e) === "[object Array]"; }, j1 = Number.isInteger || function(e) { return e << 0 === e; }; function $1(t) { return Object.prototype.toString.call(t) === "[object String]"; } function V1(t, e) { var n = t < 0 ? e.length + t : t; return $1(e) ? e.charAt(n) : e[n]; } var CI = /* @__PURE__ */ Mr(function(e, n) { if (n != null) return j1(e) ? V1(e, n) : n[e]; }), xI = /* @__PURE__ */ $r(function(e) { return B1(e) ? !0 : !e || typeof e != "object" || $1(e) ? !1 : e.length === 0 ? !0 : e.length > 0 ? e.hasOwnProperty(0) && e.hasOwnProperty(e.length - 1) : !1; }), c_ = typeof Symbol < "u" ? Symbol.iterator : "@@iterator"; function NI(t, e, n) { return function(i, o, u) { if (xI(u)) return t(i, o, u); if (u == null) return o; if (typeof u["fantasy-land/reduce"] == "function") return e(i, o, u, "fantasy-land/reduce"); if (u[c_] != null) return n(i, o, u[c_]()); if (typeof u.next == "function") return n(i, o, u); if (typeof u.reduce == "function") return e(i, o, u, "reduce"); throw new TypeError("reduce: list must be array or iterable"); }; } function TI(t, e, n) { for (var r = 0, i = n.length; r < i; ) { if (e = t["@@transducer/step"](e, n[r]), e && e["@@transducer/reduced"]) { e = e["@@transducer/value"]; break; } r += 1; } return t["@@transducer/result"](e); } var II = /* @__PURE__ */ Mr(function(e, n) { return cp(e.length, function() { return e.apply(n, arguments); }); }); function RI(t, e, n) { for (var r = n.next(); !r.done; ) { if (e = t["@@transducer/step"](e, r.value), e && e["@@transducer/reduced"]) { e = e["@@transducer/value"]; break; } r = n.next(); } return t["@@transducer/result"](e); } function OI(t, e, n, r) { return t["@@transducer/result"](n[r](II(t["@@transducer/step"], t), e)); } var PI = /* @__PURE__ */ NI(TI, OI, RI), DI = /* @__PURE__ */ function() { function t(e) { this.f = e; } return t.prototype["@@transducer/init"] = function() { throw new Error("init not implemented on XWrap"); }, t.prototype["@@transducer/result"] = function(e) { return e; }, t.prototype["@@transducer/step"] = function(e, n) { return this.f(e, n); }, t; }(); function FI(t) { return new DI(t); } var LI = /* @__PURE__ */ o0(function(t, e, n) { return PI(typeof t == "function" ? FI(t) : t, e, n); }), UI = /* @__PURE__ */ $r(function(e) { return function() { return e; }; }), MI = /* @__PURE__ */ $r(function(e) { return M1(e.length, e); }), BI = /* @__PURE__ */ $r(function(e) { return e == null; }), jI = /* @__PURE__ */ Mr(function(e, n) { switch (e) { case 0: return function() { return n.call(this); }; case 1: return function(r) { return n.call(this, r); }; case 2: return function(r, i) { return n.call(this, r, i); }; case 3: return function(r, i, o) { return n.call(this, r, i, o); }; case 4: return function(r, i, o, u) { return n.call(this, r, i, o, u); }; case 5: return function(r, i, o, u, l) { return n.call(this, r, i, o, u, l); }; case 6: return function(r, i, o, u, l, f) { return n.call(this, r, i, o, u, l, f); }; case 7: return function(r, i, o, u, l, f, d) { return n.call(this, r, i, o, u, l, f, d); }; case 8: return function(r, i, o, u, l, f, d, p) { return n.call(this, r, i, o, u, l, f, d, p); }; case 9: return function(r, i, o, u, l, f, d, p, v) { return n.call(this, r, i, o, u, l, f, d, p, v); }; case 10: return function(r, i, o, u, l, f, d, p, v, y) { return n.call(this, r, i, o, u, l, f, d, p, v, y); }; default: throw new Error("First argument to nAry must be a non-negative integer no greater than ten"); } }); function $I(t, e) { return function() { return e.call(this, t.apply(this, arguments)); }; } function z1(t, e) { return function() { var n = arguments.length; if (n === 0) return e(); var r = arguments[n - 1]; return B1(r) || typeof r[t] != "function" ? e.apply(this, arguments) : r[t].apply(r, Array.prototype.slice.call(arguments, 0, n - 1)); }; } var VI = /* @__PURE__ */ o0(/* @__PURE__ */ z1("slice", function(e, n, r) { return Array.prototype.slice.call(r, e, n); })), zI = /* @__PURE__ */ $r(/* @__PURE__ */ z1("tail", /* @__PURE__ */ VI(1, 1 / 0))); function d_() { if (arguments.length === 0) throw new Error("pipe requires at least one argument"); return cp(arguments[0].length, LI($I, arguments[0], zI(arguments))); } var qI = /* @__PURE__ */ Mr(function(e, n) { if (e > 10) throw new Error("Constructor with greater than ten arguments"); return e === 0 ? function() { return new n(); } : MI(jI(e, function(r, i, o, u, l, f, d, p, v, y) { switch (e) { case 1: return new n(r); case 2: return new n(r, i); case 3: return new n(r, i, o); case 4: return new n(r, i, o, u); case 5: return new n(r, i, o, u, l); case 6: return new n(r, i, o, u, l, f); case 7: return new n(r, i, o, u, l, f, d); case 8: return new n(r, i, o, u, l, f, d, p); case 9: return new n(r, i, o, u, l, f, d, p, v); case 10: return new n(r, i, o, u, l, f, d, p, v, y); } })); }), HI = /* @__PURE__ */ o0(function(e, n, r) { return M1(Math.max(e.length, n.length, r.length), function() { return e.apply(this, arguments) ? n.apply(this, arguments) : r.apply(this, arguments); }); }); function KI(t, e) { for (var n = e, r = 0; r < t.length; r += 1) { if (n == null) return; var i = t[r]; j1(i) ? n = V1(i, n) : n = n[i]; } return n; } var f_ = /* @__PURE__ */ Mr(function(e, n) { for (var r = {}, i = {}, o = 0, u = e.length; o < u; ) i[e[o]] = 1, o += 1; for (var l in n) i.hasOwnProperty(l) || (r[l] = n[l]); return r; }), GI = /* @__PURE__ */ Mr(KI); class Ri extends Error { /** * Creates a new instance of DomainError. * @param name - The name of the error. * @param message - A detailed message describing the error. * @param value - Optional value that provides additional context about the error. */ constructor(e, n, r) { super(n), this.value = r, this.name = e, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor); } /** * Converts the DomainError to a plain object for transfer or logging. * @returns An object representing the error in a more readable format. */ toDTO() { return { name: this.name, message: this.message, ...this.value && { value: this.value }, // Include a human-readable stack trace if available. ...this.stack && { stack: this.formatStack() } }; } /** * Formats the error stack trace into a human-readable string. * @returns A formatted stack trace string. */ formatStack() { return this.stack ? this.stack.split(` `).map((e) => e.trim()).join(" | ") : ""; } } class q1 extends Ri { constructor(e) { super( "RESOURCE_NOT_FOUND_ERROR", `Resource with id '${e}' not found.`, e ); } } class xs extends Ri { constructor(e) { super( "APP_UNEXPECTED_ERROR", e.message ?? "An unexpected error occurred.", e ); } } class s0 extends Ri { constructor() { super("APP_ACCOUNT_INVALID_ERROR", "Account not defined"); } } class H1 extends Ri { constructor(e) { super( "INVALID_NIZZA_GLOBAL_OBJECT_ERROR", ` Configuration property invalid: "${e}". It looks like you are trying to use a configuration property that is required but is "undefined", make sure you have initialized the global object "nizza". * If you are using the @nizza/core library: import { getNizza } from '@nizza/core'; const nizza = getNizza(); nizza.configure({ account: env.account, ... }); * If you are using the window: window.nizza.configure({ account: env.account, ... }); ` ); } } function WI(t, e) { e.forEach((n) => { if (BI(GI(n.split("."), t))) throw new H1(n); }); } function zt(t) { for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r]; throw new Error(typeof t == "number" ? "[MobX] minified error nr: " + t + (n.length ? " " + n.map(String).join(",") : "") + ". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts" : "[MobX] " + t); } var YI = {}; function K1() { return typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : YI; } var G1 = Object.assign, Lh = Object.getOwnPropertyDescriptor, to = Object.defineProperty, dp = Object.prototype, Wv = []; Object.freeze(Wv); var a0 = {}; Object.freeze(a0); var QI = typeof Proxy < "u", JI = /* @__PURE__ */ Object.toString(); function W1() { QI || zt("Proxy not available"); } function Y1(t) { var e = !1; return function() { if (!e) return e = !0, t.apply(this, arguments); }; } var tl = function() { }; function Ti(t) { return typeof t == "function"; } function Ha(t) { var e = typeof t; switch (e) { case "string": case "symbol": case "number": return !0; } return !1; } function fp(t) { return t !== null && typeof t == "object"; } function Mo(t) { if (!fp(t)) return !1; var e = Object.getPrototypeOf(t); if (e == null) return !0; var n = Object.hasOwnProperty.call(e, "constructor") && e.constructor; return typeof n == "function" && n.toString() === JI; } function Q1(t) { var e = t?.constructor; return e ? e.name === "GeneratorFunction" || e.displayName === "GeneratorFunction" : !1; } function hp(t, e, n) { to(t, e, { enumerable: !1, writable: !0, configurable: !0, value: n }); } function J1(t, e, n) { to(t, e, { enumerable: !1, writable: !1, configurable: !0, value: n }); } function tu(t, e) { var n = "isMobX" + t; return e.prototype[n] = !0, function(r) { return fp(r) && r[n] === !0; }; } function _l(t) { return t != null && Object.prototype.toString.call(t) === "[object Map]"; } function XI(t) { var e = Object.getPrototypeOf(t), n = Object.getPrototypeOf(e), r = Object.getPrototypeOf(n); return r === null; } function Oo(t) { return t != null && Object.prototype.toString.call(t) === "[object Set]"; } var X1 = typeof Object.getOwnPropertySymbols < "u"; function ZI(t) { var e = Object.keys(t); if (!X1) return e; var n = Object.getOwnPropertySymbols(t); return n.length ? [].concat(e, n.filter(function(r) { return dp.propertyIsEnumerable.call(t, r); })) : e; } var ud = typeof Reflect < "u" && Reflect.ownKeys ? Reflect.ownKeys : X1 ? function(t) { return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)); } : ( /* istanbul ignore next */ Object.getOwnPropertyNames ); function Z1(t) { return t === null ? null : typeof t == "object" ? "" + t : t; } function Ps(t, e) { return dp.hasOwnProperty.call(t, e); } var eR = Object.getOwnPropertyDescriptors || function(e) { var n = {}; return ud(e).forEach(function(r) { n[r] = Lh(e, r); }), n; }; function Br(t, e) { return !!(t & e); } function jr(t, e, n) { return n ? t |= e : t &= ~e, t; } function h_(t, e) { (e == null || e > t.length) && (e = t.length); for (var n = 0, r = Array(e); n < e; n++) r[n] = t[n]; return r; } function tR(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, rR(r.key), r); } } function bl(t, e, n) { return e && tR(t.prototype, e), Object.defineProperty(t, "prototype", { writable: !1 }), t; } function nl(t, e) { var n = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"]; if (n) return (n = n.call(t)).next.bind(n); if (Array.isArray(t) || (n = iR(t)) || e) { n && (t = n); var r = 0; return function() { return r >= t.length ? { done: !0 } : { done: !1, value: t[r++] }; }; } throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } function Ka() { return Ka = Object.assign ? Object.assign.bind() : function(t) { for (var e = 1; e < arguments.length; e++) { var n = arguments[e]; for (var r in n) ({}).hasOwnProperty.call(n, r) && (t[r] = n[r]); } return t; }, Ka.apply(null, arguments); } function eA(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Yv(t, e); } function Yv(t, e) { return Yv = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) { return n.__proto__ = r, n; }, Yv(t, e); } function nR(t, e) { if (typeof t != "object" || !t) return t; var n = t[Symbol.toPrimitive]; if (n !== void 0) { var r = n.call(t, e); if (typeof r != "object") return r; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); } function rR(t) { var e = nR(t, "string"); return typeof e == "symbol" ? e : e + ""; } function iR(t, e) { if (t) { if (typeof t == "string") return h_(t, e); var n = {}.toString.call(t).slice(8, -1); return n === "Object" && t.constructor && (n = t.constructor.name), n === "Map" || n === "Set" ? Array.from(t) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? h_(t, e) : void 0; } } var rl = /* @__PURE__ */ Symbol("mobx-stored-annotations"); function no(t) { function e(n, r) { if (Ed(r)) return t.decorate_20223_(n, r); kl(n, r, t); } return Object.assign(e, t); } function kl(t, e, n) { Ps(t, rl) || hp(t, rl, Ka({}, t[rl])), dR(n) || (t[rl][e] = n); } function Ed(t) { return typeof t == "object" && typeof t.kind == "string"; } var yt = /* @__PURE__ */ Symbol("mobx administration"), $s = /* @__PURE__ */ function() { function t(n) { n === void 0 && (n = "Atom"), this.name_ = void 0, this.flags_ = 0, this.observers_ = /* @__PURE__ */ new Set(), this.lastAccessedBy_ = 0, this.lowestObserverState_ = Vt.NOT_TRACKING_, this.onBOL = void 0, this.onBUOL = void 0, this.name_ = n; } var e = t.prototype; return e.onBO = function() { this.onBOL && this.onBOL.forEach(function(r) { return r(); }); }, e.onBUO = function() { this.onBUOL && this.onBUOL.forEach(function(r) { return r(); }); }, e.reportObserved = function() { return gA(this); }, e.reportChanged = function() { si(), vA(this), ai(); }, e.toString = function() { return this.name_; }, bl(t, [{ key: "isBeingObserved", get: function() { return Br(this.flags_, t.isBeingObservedMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isBeingObservedMask_, r); } }, { key: "isPendingUnobservation", get: function() { return Br(this.flags_, t.isPendingUnobservationMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isPendingUnobservationMask_, r); } }, { key: "diffValue", get: function() { return Br(this.flags_, t.diffValueMask_) ? 1 : 0; }, set: function(r) { this.flags_ = jr(this.flags_, t.diffValueMask_, r === 1); } }]); }(); $s.isBeingObservedMask_ = 1; $s.isPendingUnobservationMask_ = 2; $s.diffValueMask_ = 4; var u0 = /* @__PURE__ */ tu("Atom", $s); function tA(t, e, n) { e === void 0 && (e = tl), n === void 0 && (n = tl); var r = new $s(t); return e !== tl && hO(r, e), n !== tl && kA(r, n), r; } function oR(t, e) { return p0(t, e); } function sR(t, e) { return p0(t, e, 1); } function aR(t, e) { return Object.is ? Object.is(t, e) : t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e; } var Ga = { structural: oR, default: aR, shallow: sR }; function Wa(t, e, n) { return xA(t) ? t : Array.isArray(t) ? Hn.array(t, { name: n }) : Mo(t) ? Hn.object(t, void 0, { name: n }) : _l(t) ? Hn.map(t, { name: n }) : Oo(t) ? Hn.set(t, { name: n }) : typeof t == "function" && !Sp(t) && !cd(t) ? Q1(t) ? pl(t) : ld(n, t) : t; } function uR(t, e, n) { if (t == null || kp(t) || bp(t) || ru(t) || El(t)) return t; if (Array.isArray(t)) return Hn.array(t, { name: n, deep: !1 }); if (Mo(t)) return Hn.object(t, void 0, { name: n, deep: !1 }); if (_l(t)) return Hn.map(t, { name: n, deep: !1 }); if (Oo(t)) return Hn.set(t, { name: n, deep: !1 }); } function pp(t) { return t; } function lR(t, e) { return p0(t, e) ? e : t; } var cR = "override"; function dR(t) { return t.annotationType_ === cR; } function Ad(t, e) { return { annotationType_: t, options_: e, make_: fR, extend_: hR, decorate_20223_: pR }; } function fR(t, e, n, r) { var i; if ((i = this.options_) != null && i.bound) return this.extend_(t, e, n, !1) === null ? 0 : 1; if (r === t.target_) return this.extend_(t, e, n, !1) === null ? 0 : 2; if (Sp(n.value)) return 1; var o = nA(t, this, e, n, !1); return to(r, e, o), 2; } function hR(t, e, n, r) { var i = nA(t, this, e, n); return t.defineProperty_(e, i, r); } function pR(t, e) { var n = e.kind, r = e.name, i = e.addInitializer, o = this, u = function(d) { var p, v, y, k; return Ls((p = (v = o.options_) == null ? void 0 : v.name) != null ? p : r.toString(), d, (y = (k = o.options_) == null ? void 0 : k.autoAction) != null ? y : !1); }; if (n == "field") { i(function() { kl(this, r, o); }); return; } if (n == "method") { var l; return Sp(t) || (t = u(t)), (l = this.options_) != null && l.bound && i(function() { var f = this, d = f[r].bind(f); d.isMobxAction = !0, f[r] = d; }), t; } zt("Cannot apply '" + o.annotationType_ + "' to '" + String(r) + "' (kind: " + n + "):" + (` '` + o.annotationType_ + "' can only be used on properties with a function value.")); } function mR(t, e, n, r) { e.annotationType_, r.value; } function nA(t, e, n, r, i) { var o, u, l, f, d, p, v; i === void 0 && (i = nt.safeDescriptors), mR(t, e, n, r); var y = r.value; if ((o = e.options_) != null && o.bound) { var k; y = y.bind((k = t.proxy_) != null ? k : t.target_); } return { value: Ls( (u = (l = e.options_) == null ? void 0 : l.name) != null ? u : n.toString(), y, (f = (d = e.options_) == null ? void 0 : d.autoAction) != null ? f : !1, // https://github.com/mobxjs/mobx/discussions/3140 (p = e.options_) != null && p.bound ? (v = t.proxy_) != null ? v : t.target_ : void 0 ), // Non-configurable for classes // prevents accidental field redefinition in subclass configurable: i ? t.isPlainObject_ : !0, // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058 enumerable: !1, // Non-obsevable, therefore non-writable // Also prevents rewriting in subclass constructor writable: !i }; } function rA(t, e) { return { annotationType_: t, options_: e, make_: gR, extend_: vR, decorate_20223_: yR }; } function gR(t, e, n, r) { var i; if (r === t.target_) return this.extend_(t, e, n, !1) === null ? 0 : 2; if ((i = this.options_) != null && i.bound && (!Ps(t.target_, e) || !cd(t.target_[e])) && this.extend_(t, e, n, !1) === null) return 0; if (cd(n.value)) return 1; var o = iA(t, this, e, n, !1, !1); return to(r, e, o), 2; } function vR(t, e, n, r) { var i, o = iA(t, this, e, n, (i = this.options_) == null ? void 0 : i.bound); return t.defineProperty_(e, o, r); } function yR(t, e) { var n, r = e.name, i = e.addInitializer; return cd(t) || (t = pl(t)), (n = this.options_) != null && n.bound && i(function() { var o = this, u = o[r].bind(o); u.isMobXFlow = !0, o[r] = u; }), t; } function wR(t, e, n, r) { e.annotationType_, r.value; } function iA(t, e, n, r, i, o) { o === void 0 && (o = nt.safeDescriptors), wR(t, e, n, r); var u = r.value; if (cd(u) || (u = pl(u)), i) { var l; u = u.bind((l = t.proxy_) != null ? l : t.target_), u.isMobXFlow = !0; } return { value: u, // Non-configurable for classes // prevents accidental field redefinition in subclass configurable: o ? t.isPlainObject_ : !0, // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058 enumerable: !1, // Non-obsevable, therefore non-writable // Also prevents rewriting in subclass constructor writable: !o }; } function l0(t, e) { return { annotationType_: t, options_: e, make_: SR, extend_: _R, decorate_20223_: bR }; } function SR(t, e, n) { return this.extend_(t, e, n, !1) === null ? 0 : 1; } function _R(t, e, n, r) { return kR(t, this, e, n), t.defineComputedProperty_(e, Ka({}, this.options_, { get: n.get, set: n.set }), r); } function bR(t, e) { var n = this, r = e.name, i = e.addInitializer; return i(function() { var o = Al(this)[yt], u = Ka({}, n.options_, { get: t, context: this }); u.name || (u.name = "ObservableObject." + r.toString()), o.values_.set(r, new Ii(u)); }), function() { return this[yt].getObservablePropValue_(r); }; } function kR(t, e, n, r) { e.annotationType_, r.get; } function mp(t, e) { return { annotationType_: t, options_: e, make_: ER, extend_: AR, decorate_20223_: CR }; } function ER(t, e, n) { return this.extend_(t, e, n, !1) === null ? 0 : 1; } function AR(t, e, n, r) { var i, o; return xR(t, this), t.defineObservableProperty_(e, n.value, (i = (o = this.options_) == null ? void 0 : o.enhancer) != null ? i : Wa, r); } function CR(t, e) { var n = this, r = e.kind, i = e.name, o = /* @__PURE__ */ new WeakSet(); function u(l, f) { var d, p, v = Al(l)[yt], y = new $a(f, (d = (p = n.options_) == null ? void 0 : p.enhancer) != null ? d : Wa, "ObservableObject." + i.toString(), !1); v.values_.set(i, y), o.add(l); } if (r == "accessor") return { get: function() { return o.has(this) || u(this, t.get.call(this)), this[yt].getObservablePropValue_(i); }, set: function(f) { return o.has(this) || u(this, f), this[yt].setObservablePropValue_(i, f); }, init: function(f) { return o.has(this) || u(this, f), f; } }; } function xR(t, e, n, r) { e.annotationType_; } var NR = "true", TR = /* @__PURE__ */ oA(); function oA(t) { return { annotationType_: NR, options_: t, make_: IR, extend_: RR, decorate_20223_: OR }; } function IR(t, e, n, r) { var i, o; if (n.get) return gp.make_(t, e, n, r); if (n.set) { var u = Ls(e.toString(), n.set); return r === t.target_ ? t.defineProperty_(e, { configurable: nt.safeDescriptors ? t.isPlainObject_ : !0, set: u }) === null ? 0 : 2 : (to(r, e, { configurable: !0, set: u }), 2); } if (r !== t.target_ && typeof n.value == "function") { var l; if (Q1(n.value)) { var f, d = (f = this.options_) != null && f.autoBind ? pl.bound : pl; return d.make_(t, e, n, r); } var p = (l = this.options_) != null && l.autoBind ? ld.bound : ld; return p.make_(t, e, n, r); } var v = ((i = this.options_) == null ? void 0 : i.deep) === !1 ? Hn.ref : Hn; if (typeof n.value == "function" && (o = this.options_) != null && o.autoBind) { var y; n.value = n.value.bind((y = t.proxy_) != null ? y : t.target_); } return v.make_(t, e, n, r); } function RR(t, e, n, r) { var i, o; if (n.get) return gp.extend_(t, e, n, r); if (n.set) return t.defineProperty_(e, { configurable: nt.safeDescriptors ? t.isPlainObject_ : !0, set: Ls(e.toString(), n.set) }, r); if (typeof n.value == "function" && (i = this.options_) != null && i.autoBind) { var u; n.value = n.value.bind((u = t.proxy_) != null ? u : t.target_); } var l = ((o = this.options_) == null ? void 0 : o.deep) === !1 ? Hn.ref : Hn; return l.extend_(t, e, n, r); } function OR(t, e) { zt("'" + this.annotationType_ + "' cannot be used as a decorator"); } var PR = "observable", DR = "observable.ref", FR = "observable.shallow", LR = "observable.struct", sA = { deep: !0, name: void 0, defaultDecorator: void 0, proxy: !0 }; Object.freeze(sA); function Wf(t) { return t || sA; } var Qv = /* @__PURE__ */ mp(PR), UR = /* @__PURE__ */ mp(DR, { enhancer: pp }), MR = /* @__PURE__ */ mp(FR, { enhancer: uR }), BR = /* @__PURE__ */ mp(LR, { enhancer: lR }), aA = /* @__PURE__ */ no(Qv); function Yf(t) { return t.deep === !0 ? Wa : t.deep === !1 ? pp : $R(t.defaultDecorator); } function jR(t) { var e; return t ? (e = t.defaultDecorator) != null ? e : oA(t) : void 0; } function $R(t) { var e, n; return t && (e = (n = t.options_) == null ? void 0 : n.enhancer) != null ? e : Wa; } function uA(t, e, n) { if (Ed(e)) return Qv.decorate_20223_(t, e); if (Ha(e)) { kl(t, e, Qv); return; } return xA(t) ? t : Mo(t) ? Hn.object(t, e, n) : Array.isArray(t) ? Hn.array(t, e) : _l(t) ? Hn.map(t, e) : Oo(t) ? Hn.set(t, e) : typeof t == "object" && t !== null ? t : Hn.box(t, e); } G1(uA, aA); var VR = { box: function(e, n) { var r = Wf(n); return new $a(e, Yf(r), r.name, !0, r.equals); }, array: function(e, n) { var r = Wf(n); return (nt.useProxies === !1 || r.proxy === !1 ? PO : kO)(e, Yf(r), r.name); }, map: function(e, n) { var r = Wf(n); return new RA(e, Yf(r), r.name); }, set: function(e, n) { var r = Wf(n); return new OA(e, Yf(r), r.name); }, object: function(e, n, r) { return iu(function() { return AA(nt.useProxies === !1 || r?.proxy === !1 ? Al({}, r) : wO({}, r), e, n); }); }, ref: /* @__PURE__ */ no(UR), shallow: /* @__PURE__ */ no(MR), deep: aA, struct: /* @__PURE__ */ no(BR) }, Hn = /* @__PURE__ */ G1(uA, VR), lA = "computed", zR = "computed.struct", Jv = /* @__PURE__ */ l0(lA), qR = /* @__PURE__ */ l0(zR, { equals: Ga.structural }), gp = function(e, n) { if (Ed(n)) return Jv.decorate_20223_(e, n); if (Ha(n)) return kl(e, n, Jv); if (Mo(e)) return no(l0(lA, e)); var r = Mo(n) ? n : {}; return r.get = e, r.name || (r.name = e.name || ""), new Ii(r); }; Object.assign(gp, Jv); gp.struct = /* @__PURE__ */ no(qR); var p_, m_, Uh = 0, HR = 1, KR = (p_ = (m_ = /* @__PURE__ */ Lh(function() { }, "name")) == null ? void 0 : m_.configurable) != null ? p_ : !1, g_ = { value: "action", configurable: !0, writable: !1, enumerable: !1 }; function Ls(t, e, n, r) { n === void 0 && (n = !1); function i() { return GR(t, n, e, r || this, arguments); } return i.isMobxAction = !0, i.toString = function() { return e.toString(); }, KR && (g_.value = t, to(i, "name", g_)), i; } function GR(t, e, n, r, i) { var o = WR(t, e); try { return n.apply(r, i); } catch (u) { throw o.error_ = u, u; } finally { YR(o); } } function WR(t, e, n, r) { var i = !1, o = 0, u = nt.trackingDerivation, l = !e || !u; si(); var f = nt.allowStateChanges; l && (nu(), f = vp(!0)); var d = c0(!0), p = { runAsAction_: l, prevDerivation_: u, prevAllowStateChanges_: f, prevAllowStateReads_: d, notifySpy_: i, startTime_: o, actionId_: HR++, parentActionId_: Uh }; return Uh = p.actionId_, p; } function YR(t) { Uh !== t.actionId_ && zt(30), Uh = t.parentActionId_, t.error_ !== void 0 && (nt.suppressReactionErrors = !0), yp(t.prevAllowStateChanges_), Jc(t.prevAllowStateReads_), ai(), t.runAsAction_ && Lo(t.prevDerivation_), nt.suppressReactionErrors = !1; } function cA(t, e) { var n = vp(t); try { return e(); } finally { yp(n); } } function vp(t) { var e = nt.allowStateChanges; return nt.allowStateChanges = t, e; } function yp(t) { nt.allowStateChanges = t; } var $a = /* @__PURE__ */ function(t) { function e(r, i, o, u, l) { var f; return o === void 0 && (o = "ObservableValue"), l === void 0 && (l = Ga.default), f = t.call(this, o) || this, f.enhancer = void 0, f.name_ = void 0, f.equals = void 0, f.hasUnreportedChange_ = !1, f.interceptors_ = void 0, f.changeListeners_ = void 0, f.value_ = void 0, f.dehancer = void 0, f.enhancer = i, f.name_ = o, f.equals = l, f.value_ = i(r, void 0, o), f; } eA(e, t); var n = e.prototype; return n.dehanceValue = function(i) { return this.dehancer !== void 0 ? this.dehancer(i) : i; }, n.set = function(i) { this.value_, i = this.prepareNewValue_(i), i !== nt.UNCHANGED && this.setNewValue_(i); }, n.prepareNewValue_ = function(i) { if (ri(this)) { var o = ii(this, { object: this, type: ro, newValue: i }); if (!o) return nt.UNCHANGED; i = o.newValue; } return i = this.enhancer(i, this.value_, this.name_), this.equals(this.value_, i) ? nt.UNCHANGED : i; }, n.setNewValue_ = function(i) { var o = this.value_; this.value_ = i, this.reportChanged(), xi(this) && Ni(this, { type: ro, object: this, newValue: i, oldValue: o }); }, n.get = function() { return this.reportObserved(), this.dehanceValue(this.value_); }, n.intercept_ = function(i) { return Cd(this, i); }, n.observe_ = function(i, o) { return o && i({ observableKind: "value", debugObjectName: this.name_, object: this, type: ro, newValue: this.value_, oldValue: void 0 }), xd(this, i); }, n.raw = function() { return this.value_; }, n.toJSON = function() { return this.get(); }, n.toString = function() { return this.name_ + "[" + this.value_ + "]"; }, n.valueOf = function() { return Z1(this.get()); }, n[Symbol.toPrimitive] = function() { return this.valueOf(); }, e; }($s), Ii = /* @__PURE__ */ function() { function t(n) { this.dependenciesState_ = Vt.NOT_TRACKING_, this.observing_ = [], this.newObserving_ = null, this.observers_ = /* @__PURE__ */ new Set(), this.runId_ = 0, this.lastAccessedBy_ = 0, this.lowestObserverState_ = Vt.UP_TO_DATE_, this.unboundDepsCount_ = 0, this.value_ = new Bh(null), this.name_ = void 0, this.triggeredBy_ = void 0, this.flags_ = 0, this.derivation = void 0, this.setter_ = void 0, this.isTracing_ = Mh.NONE, this.scope_ = void 0, this.equals_ = void 0, this.requiresReaction_ = void 0, this.keepAlive_ = void 0, this.onBOL = void 0, this.onBUOL = void 0, n.get || zt(31), this.derivation = n.get, this.name_ = n.name || "ComputedValue", n.set && (this.setter_ = Ls("ComputedValue-setter", n.set)), this.equals_ = n.equals || (n.compareStructural || n.struct ? Ga.structural : Ga.default), this.scope_ = n.context, this.requiresReaction_ = n.requiresReaction, this.keepAlive_ = !!n.keepAlive; } var e = t.prototype; return e.onBecomeStale_ = function() { ZR(this); }, e.onBO = function() { this.onBOL && this.onBOL.forEach(function(r) { return r(); }); }, e.onBUO = function() { this.onBUOL && this.onBUOL.forEach(function(r) { return r(); }); }, e.get = function() { if (this.isComputing && zt(32, this.name_, this.derivation), nt.inBatch === 0 && // !globalState.trackingDerivatpion && this.observers_.size === 0 && !this.keepAlive_) Xv(this) && (this.warnAboutUntrackedRead_(), si(), this.value_ = this.computeValue_(!1), ai()); else if (gA(this), Xv(this)) { var r = nt.trackingContext; this.keepAlive_ && !r && (nt.trackingContext = this), this.trackAndCompute() && XR(this), nt.trackingContext = r; } var i = this.value_; if (ph(i)) throw i.cause; return i; }, e.set = function(r) { if (this.setter_) { this.isRunningSetter && zt(33, this.name_), this.isRunningSetter = !0; try { this.setter_.call(this.scope_, r); } finally { this.isRunningSetter = !1; } } else zt(34, this.name_); }, e.trackAndCompute = function() { var r = this.value_, i = ( /* see #1208 */ this.dependenciesState_ === Vt.NOT_TRACKING_ ), o = this.computeValue_(!0), u = i || ph(r) || ph(o) || !this.equals_(r, o); return u && (this.value_ = o), u; }, e.computeValue_ = function(r) { this.isComputing = !0; var i = vp(!1), o; if (r) o = dA(this, this.derivation, this.scope_); else if (nt.disableErrorBoundaries === !0) o = this.derivation.call(this.scope_); else try { o = this.derivation.call(this.scope_); } catch (u) { o = new Bh(u); } return yp(i), this.isComputing = !1, o; }, e.suspend_ = function() { this.keepAlive_ || (Zv(this), this.value_ = void 0); }, e.observe_ = function(r, i) { var o = this, u = !0, l = void 0; return _p(function() { var f = o.get(); if (!u || i) { var d = nu(); r({ observableKind: "computed", debugObjectName: o.name_, type: ro, object: o, newValue: f, oldValue: l }), Lo(d); } u = !1, l = f; }); }, e.warnAboutUntrackedRead_ = function() { }, e.toString = function() { return this.name_ + "[" + this.derivation.toString() + "]"; }, e.valueOf = function() { return Z1(this.get()); }, e[Symbol.toPrimitive] = function() { return this.valueOf(); }, bl(t, [{ key: "isComputing", get: function() { return Br(this.flags_, t.isComputingMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isComputingMask_, r); } }, { key: "isRunningSetter", get: function() { return Br(this.flags_, t.isRunningSetterMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isRunningSetterMask_, r); } }, { key: "isBeingObserved", get: function() { return Br(this.flags_, t.isBeingObservedMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isBeingObservedMask_, r); } }, { key: "isPendingUnobservation", get: function() { return Br(this.flags_, t.isPendingUnobservationMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isPendingUnobservationMask_, r); } }, { key: "diffValue", get: function() { return Br(this.flags_, t.diffValueMask_) ? 1 : 0; }, set: function(r) { this.flags_ = jr(this.flags_, t.diffValueMask_, r === 1); } }]); }(); Ii.isComputingMask_ = 1; Ii.isRunningSetterMask_ = 2; Ii.isBeingObservedMask_ = 4; Ii.isPendingUnobservationMask_ = 8; Ii.diffValueMask_ = 16; var wp = /* @__PURE__ */ tu("ComputedValue", Ii), Vt; (function(t) { t[t.NOT_TRACKING_ = -1] = "NOT_TRACKING_", t[t.UP_TO_DATE_ = 0] = "UP_TO_DATE_", t[t.POSSIBLY_STALE_ = 1] = "POSSIBLY_STALE_", t[t.STALE_ = 2] = "STALE_"; })(Vt || (Vt = {})); var Mh; (function(t) { t[t.NONE = 0] = "NONE", t[t.LOG = 1] = "LOG", t[t.BREAK = 2] = "BREAK"; })(Mh || (Mh = {})); var Bh = function(e) { this.cause = void 0, this.cause = e; }; function ph(t) { return t instanceof Bh; } function Xv(t) { switch (t.dependenciesState_) { case Vt.UP_TO_DATE_: return !1; case Vt.NOT_TRACKING_: case Vt.STALE_: return !0; case Vt.POSSIBLY_STALE_: { for (var e = c0(!0), n = nu(), r = t.observing_, i = r.length, o = 0; o < i; o++) { var u = r[o]; if (wp(u)) { if (nt.disableErrorBoundaries) u.get(); else try { u.get(); } catch { return Lo(n), Jc(e), !0; } if (t.dependenciesState_ === Vt.STALE_) return Lo(n), Jc(e), !0; } } return hA(t), Lo(n), Jc(e), !1; } } } function dA(t, e, n) { var r = c0(!0); hA(t), t.newObserving_ = new Array( // Reserve constant space for initial dependencies, dynamic space otherwise. // See https://github.com/mobxjs/mobx/pull/3833 t.runId_ === 0 ? 100 : t.observing_.length ), t.unboundDepsCount_ = 0, t.runId_ = ++nt.runId; var i = nt.trackingDerivation; nt.trackingDerivation = t, nt.inBatch++; var o; if (nt.disableErrorBoundaries === !0) o = e.call(n); else try { o = e.call(n); } catch (u) { o = new Bh(u); } return nt.inBatch--, nt.trackingDerivation = i, QR(t), Jc(r), o; } function QR(t) { for (var e = t.observing_, n = t.observing_ = t.newObserving_, r = Vt.UP_TO_DATE_, i = 0, o = t.unboundDepsCount_, u = 0; u < o; u++) { var l = n[u]; l.diffValue === 0 && (l.diffValue = 1, i !== u && (n[i] = l), i++), l.dependenciesState_ > r && (r = l.dependenciesState_); } for (n.length = i, t.newObserving_ = null, o = e.length; o--; ) { var f = e[o]; f.diffValue === 0 && pA(f, t), f.diffValue = 0; } for (; i--; ) { var d = n[i]; d.diffValue === 1 && (d.diffValue = 0, JR(d, t)); } r !== Vt.UP_TO_DATE_ && (t.dependenciesState_ = r, t.onBecomeStale_()); } function Zv(t) { var e = t.observing_; t.observing_ = []; for (var n = e.length; n--; ) pA(e[n], t); t.dependenciesState_ = Vt.NOT_TRACKING_; } function fA(t) { var e = nu(); try { return t(); } finally { Lo(e); } } function nu() { var t = nt.trackingDerivation; return nt.trackingDerivation = null, t; } function Lo(t) { nt.trackingDerivation = t; } function c0(t) { var e = nt.allowStateReads; return nt.allowStateReads = t, e; } function Jc(t) { nt.allowStateReads = t; } function hA(t) { if (t.dependenciesState_ !== Vt.UP_TO_DATE_) { t.dependenciesState_ = Vt.UP_TO_DATE_; for (var e = t.observing_, n = e.length; n--; ) e[n].lowestObserverState_ = Vt.UP_TO_DATE_; } } var Ng = function() { this.version = 6, this.UNCHANGED = {}, this.trackingDerivation = null, this.trackingContext = null, this.runId = 0, this.mobxGuid = 0, this.inBatch = 0, this.pendingUnobservations = [], this.pendingReactions = [], this.isRunningReactions = !1, this.allowStateChanges = !1, this.allowStateReads = !0, this.enforceActions = !0, this.spyListeners = [], this.globalReactionErrorHandlers = [], this.computedRequiresReaction = !1, this.reactionRequiresObservable = !1, this.observableRequiresReaction = !1, this.disableErrorBoundaries = !1, this.suppressReactionErrors = !1, this.useProxies = !0, this.verifyProxies = !1, this.safeDescriptors = !0; }, Tg = !0, nt = /* @__PURE__ */ function() { var t = /* @__PURE__ */ K1(); return t.__mobxInstanceCount > 0 && !t.__mobxGlobals && (Tg = !1), t.__mobxGlobals && t.__mobxGlobals.version !== new Ng().version && (Tg = !1), Tg ? t.__mobxGlobals ? (t.__mobxInstanceCount += 1, t.__mobxGlobals.UNCHANGED || (t.__mobxGlobals.UNCHANGED = {}), t.__mobxGlobals) : (t.__mobxInstanceCount = 1, t.__mobxGlobals = /* @__PURE__ */ new Ng()) : (setTimeout(function() { zt(35); }, 1), new Ng()); }(); function JR(t, e) { t.observers_.add(e), t.lowestObserverState_ > e.dependenciesState_ && (t.lowestObserverState_ = e.dependenciesState_); } function pA(t, e) { t.observers_.delete(e), t.observers_.size === 0 && mA(t); } function mA(t) { t.isPendingUnobservation === !1 && (t.isPendingUnobservation = !0, nt.pendingUnobservations.push(t)); } function si() { nt.inBatch++; } function ai() { if (--nt.inBatch === 0) { yA(); for (var t = nt.pendingUnobservations, e = 0; e < t.length; e++) { var n = t[e]; n.isPendingUnobservation = !1, n.observers_.size === 0 && (n.isBeingObserved && (n.isBeingObserved = !1, n.onBUO()), n instanceof Ii && n.suspend_()); } nt.pendingUnobservations = []; } } function gA(t) { var e = nt.trackingDerivation; return e !== null ? (e.runId_ !== t.lastAccessedBy_ && (t.lastAccessedBy_ = e.runId_, e.newObserving_[e.unboundDepsCount_++] = t, !t.isBeingObserved && nt.trackingContext && (t.isBeingObserved = !0, t.onBO())), t.isBeingObserved) : (t.observers_.size === 0 && nt.inBatch > 0 && mA(t), !1); } function vA(t) { t.lowestObserverState_ !== Vt.STALE_ && (t.lowestObserverState_ = Vt.STALE_, t.observers_.forEach(function(e) { e.dependenciesState_ === Vt.UP_TO_DATE_ && e.onBecomeStale_(), e.dependenciesState_ = Vt.STALE_; })); } function XR(t) { t.lowestObserverState_ !== Vt.STALE_ && (t.lowestObserverState_ = Vt.STALE_, t.observers_.forEach(function(e) { e.dependenciesState_ === Vt.POSSIBLY_STALE_ ? e.dependenciesState_ = Vt.STALE_ : e.dependenciesState_ === Vt.UP_TO_DATE_ && (t.lowestObserverState_ = Vt.UP_TO_DATE_); })); } function ZR(t) { t.lowestObserverState_ === Vt.UP_TO_DATE_ && (t.lowestObserverState_ = Vt.POSSIBLY_STALE_, t.observers_.forEach(function(e) { e.dependenciesState_ === Vt.UP_TO_DATE_ && (e.dependenciesState_ = Vt.POSSIBLY_STALE_, e.onBecomeStale_()); })); } var Bo = /* @__PURE__ */ function() { function t(n, r, i, o) { n === void 0 && (n = "Reaction"), this.name_ = void 0, this.onInvalidate_ = void 0, this.errorHandler_ = void 0, this.requiresObservable_ = void 0, this.observing_ = [], this.newObserving_ = [], this.dependenciesState_ = Vt.NOT_TRACKING_, this.runId_ = 0, this.unboundDepsCount_ = 0, this.flags_ = 0, this.isTracing_ = Mh.NONE, this.name_ = n, this.onInvalidate_ = r, this.errorHandler_ = i, this.requiresObservable_ = o; } var e = t.prototype; return e.onBecomeStale_ = function() { this.schedule_(); }, e.schedule_ = function() { this.isScheduled || (this.isScheduled = !0, nt.pendingReactions.push(this), yA()); }, e.runReaction_ = function() { if (!this.isDisposed) { si(), this.isScheduled = !1; var r = nt.trackingContext; if (nt.trackingContext = this, Xv(this)) { this.isTrackPending = !0; try { this.onInvalidate_(); } catch (i) { this.reportExceptionInDerivation_(i); } } nt.trackingContext = r, ai(); } }, e.track = function(r) { if (!this.isDisposed) { si(), this.isRunning = !0; var i = nt.trackingContext; nt.trackingContext = this; var o = dA(this, r, void 0); nt.trackingContext = i, this.isRunning = !1, this.isTrackPending = !1, this.isDisposed && Zv(this), ph(o) && this.reportExceptionInDerivation_(o.cause), ai(); } }, e.reportExceptionInDerivation_ = function(r) { var i = this; if (this.errorHandler_) { this.errorHandler_(r, this); return; } if (nt.disableErrorBoundaries) throw r; var o = "[mobx] uncaught error in '" + this + "'"; nt.suppressReactionErrors || console.error(o, r), nt.globalReactionErrorHandlers.forEach(function(u) { return u(r, i); }); }, e.dispose = function() { this.isDisposed || (this.isDisposed = !0, this.isRunning || (si(), Zv(this), ai())); }, e.getDisposer_ = function(r) { var i = this, o = function u() { i.dispose(), r == null || r.removeEventListener == null || r.removeEventListener("abort", u); }; return r == null || r.addEventListener == null || r.addEventListener("abort", o), o[yt] = this, o; }, e.toString = function() { return "Reaction[" + this.name_ + "]"; }, e.trace = function(r) { }, bl(t, [{ key: "isDisposed", get: function() { return Br(this.flags_, t.isDisposedMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isDisposedMask_, r); } }, { key: "isScheduled", get: function() { return Br(this.flags_, t.isScheduledMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isScheduledMask_, r); } }, { key: "isTrackPending", get: function() { return Br(this.flags_, t.isTrackPendingMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isTrackPendingMask_, r); } }, { key: "isRunning", get: function() { return Br(this.flags_, t.isRunningMask_); }, set: function(r) { this.flags_ = jr(this.flags_, t.isRunningMask_, r); } }, { key: "diffValue", get: function() { return Br(this.flags_, t.diffValueMask_) ? 1 : 0; }, set: function(r) { this.flags_ = jr(this.flags_, t.diffValueMask_, r === 1); } }]); }(); Bo.isDisposedMask_ = 1; Bo.isScheduledMask_ = 2; Bo.isTrackPendingMask_ = 4; Bo.isRunningMask_ = 8; Bo.diffValueMask_ = 16; var eO = 100, tO = function(e) { return e(); }; function yA() { nt.inBatch > 0 || nt.isRunningReactions || tO(nO); } function nO() { nt.isRunningReactions = !0; for (var t = nt.pendingReactions, e = 0; t.length > 0; ) { ++e === eO && (console.error("[mobx] cycle in reaction: " + t[0]), t.splice(0)); for (var n = t.splice(0), r = 0, i = n.length; r < i; r++) n[r].runReaction_(); } nt.isRunningReactions = !1; } var jh = /* @__PURE__ */ tu("Reaction", Bo); function Xc() { return !1; } function rO(t) { return console.warn("[mobx.spy] Is a no-op in production builds"), function() { }; } var wA = "action", iO = "action.bound", SA = "autoAction", oO = "autoAction.bound", sO = "", ey = /* @__PURE__ */ Ad(wA), aO = /* @__PURE__ */ Ad(iO, { bound: !0 }), ty = /* @__PURE__ */ Ad(SA, { autoAction: !0 }), uO = /* @__PURE__ */ Ad(oO, { autoAction: !0, bound: !0 }); function _A(t) { var e = function(r, i) { if (Ti(r)) return Ls(r.name || sO, r, t); if (Ti(i)) return Ls(r, i, t); if (Ed(i)) return (t ? ty : ey).decorate_20223_(r, i); if (Ha(i)) return kl(r, i, t ? ty : ey); if (Ha(r)) return no(Ad(t ? SA : wA, { name: r, autoAction: t })); }; return e; } var Da = /* @__PURE__ */ _A(!1); Object.assign(Da, ey); var ld = /* @__PURE__ */ _A(!0); Object.assign(ld, ty); Da.bound = /* @__PURE__ */ no(aO); ld.bound = /* @__PURE__ */ no(uO); function Sp(t) { return Ti(t) && t.isMobxAction === !0; } function _p(t, e) { var n, r, i, o; e === void 0 && (e = a0); var u = (n = (r = e) == null ? void 0 : r.name) != null ? n : "Autorun", l = !e.scheduler && !e.delay, f; if (l) f = new Bo(u, function() { this.track(v); }, e.onError, e.requiresObservable); else { var d = bA(e), p = !1; f = new Bo(u, function() { p || (p = !0, d(function() { p = !1, f.isDisposed || f.track(v); })); }, e.onError, e.requiresObservable); } function v() { t(f); } return (i = e) != null && (i = i.signal) != null && i.aborted || f.schedule_(), f.getDisposer_((o = e) == null ? void 0 : o.signal); } var lO = function(e) { return e(); }; function bA(t) { return t.scheduler ? t.scheduler : t.delay ? function(e) { return setTimeout(e, t.delay); } : lO; } function d0(t, e, n) { var r, i, o; n === void 0 && (n = a0); var u = (r = n.name) != null ? r : "Reaction", l = Da(u, n.onError ? cO(n.onError, e) : e), f = !n.scheduler && !n.delay, d = bA(n), p = !0, v = !1, y, k = n.compareStructural ? Ga.structural : n.equals || Ga.default, A = new Bo(u, function() { p || f ? E() : v || (v = !0, d(E)); }, n.onError, n.requiresObservable); function E() { if (v = !1, !A.isDisposed) { var T = !1, D = y; A.track(function() { var R = cA(!1, function() { return t(A); }); T = p || !k(y, R), y = R; }), (p && n.fireImmediately || !p && T) && l(y, D, A), p = !1; } } return (i = n) != null && (i = i.signal) != null && i.aborted || A.schedule_(), A.getDisposer_((o = n) == null ? void 0 : o.signal); } function cO(t, e) { return function() { try { return e.apply(this, arguments); } catch (n) { t.call(this, n); } }; } var dO = "onBO", fO = "onBUO"; function hO(t, e, n) { return EA(dO, t, e, n); } function kA(t, e, n) { return EA(fO, t, e, n); } function EA(t, e, n, r) { var i = ny(e), o = Ti(r) ? r : n, u = t + "L"; return i[u] ? i[u].add(o) : i[u] = /* @__PURE__ */ new Set([o]), function() { var l = i[u]; l && (l.delete(o), l.size === 0 && delete i[u]); }; } function AA(t, e, n, r) { var i = eR(e); return iu(function() { var o = Al(t, r)[yt]; ud(i).forEach(function(u) { o.extend_( u, i[u], // must pass "undefined" for { key: undefined } n && u in n ? n[u] : !0 ); }); }), t; } var pO = 0; function CA() { this.message = "FLOW_CANCELLED"; } CA.prototype = /* @__PURE__ */ Object.create(Error.prototype); var Ig = /* @__PURE__ */ rA("flow"), mO = /* @__PURE__ */ rA("flow.bound", { bound: !0 }), pl = /* @__PURE__ */ Object.assign(function(e, n) { if (Ed(n)) return Ig.decorate_20223_(e, n); if (Ha(n)) return kl(e, n, Ig); var r = e, i = r.name || "", o = function() { var l = this, f = arguments, d = ++pO, p = Da(i + " - runid: " + d + " - init", r).apply(l, f), v, y = void 0, k = new Promise(function(A, E) { var T = 0; v = E; function D(j) { y = void 0; var K; try { K = Da(i + " - runid: " + d + " - yield " + T++, p.next).call(p, j); } catch (ue) { return E(ue); } L(K); } function R(j) { y = void 0; var K; try { K = Da(i + " - runid: " + d + " - yield " + T++, p.throw).call(p, j); } catch (ue) { return E(ue); } L(K); } function L(j) { if (Ti(j?.then)) { j.then(L, E); return; } return j.done ? A(j.value) : (y = Promise.resolve(j.value), y.then(D, R)); } D(void 0); }); return k.cancel = Da(i + " - runid: " + d + " - cancel", function() { try { y && v_(y); var A = p.return(void 0), E = Promise.resolve(A.value); E.then(tl, tl), v_(E), v(new CA()); } catch (T) { v(T); } }), k; }; return o.isMobXFlow = !0, o; }, Ig); pl.bound = /* @__PURE__ */ no(mO); function v_(t) { Ti(t.cancel) && t.cancel(); } function cd(t) { return t?.isMobXFlow === !0; } function gO(t, e) { return t ? kp(t) || !!t[yt] || u0(t) || jh(t) || wp(t) : !1; } function xA(t) { return gO(t); } function Po(t, e) { e === void 0 && (e = void 0), si(); try { return t.apply(e); } finally { ai(); } } function NA(t, e, n) { return arguments.length === 1 || e && typeof e == "object" ? vO(t, e) : TA(t, e, {}); } function TA(t, e, n) { var r; if (typeof n.timeout == "number") { var i = new Error("WHEN_TIMEOUT"); r = setTimeout(function() { if (!u[yt].isDisposed) if (u(), n.onError) n.onError(i); else throw i; }, n.timeout); } n.name = "When"; var o = Ls("When-effect", e), u = _p(function(l) { var f = cA(!1, t); f && (l.dispose(), r && clearTimeout(r), o()); }, n); return u; } function vO(t, e) { var n; if (e != null && (n = e.signal) != null && n.aborted) return Object.assign(Promise.reject(new Error("WHEN_ABORTED")), { cancel: function() { return null; } }); var r, i, o = new Promise(function(u, l) { var f, d = TA(t, u, Ka({}, e, { onError: l })); r = function() { d(), l(new Error("WHEN_CANCELLED")); }, i = function() { d(), l(new Error("WHEN_ABORTED")); }, e == null || (f = e.signal) == null || f.addEventListener == null || f.addEventListener("abort", i); }).finally(function() { var u; return e == null || (u = e.signal) == null || u.removeEventListener == null ? void 0 : u.removeEventListener("abort", i); }); return o.cancel = r, o; } function zu(t) { return t[yt]; } var yO = { has: function(e, n) { return zu(e).has_(n); }, get: function(e, n) { return zu(e).get_(n); }, set: function(e, n, r) { var i; return Ha(n) ? (i = zu(e).set_(n, r, !0)) != null ? i : !0 : !1; }, deleteProperty: function(e, n) { var r; return Ha(n) ? (r = zu(e).delete_(n, !0)) != null ? r : !0 : !1; }, defineProperty: function(e, n, r) { var i; return (i = zu(e).defineProperty_(n, r)) != null ? i : !0; }, ownKeys: function(e) { return zu(e).ownKeys_(); }, preventExtensions: function(e) { zt(13); } }; function wO(t, e) { var n, r; return W1(), t = Al(t, e), (r = (n = t[yt]).proxy_) != null ? r : n.proxy_ = new Proxy(t, yO); } function ri(t) { return t.interceptors_ !== void 0 && t.interceptors_.length > 0; } function Cd(t, e) { var n = t.interceptors_ || (t.interceptors_ = []); return n.push(e), Y1(function() { var r = n.indexOf(e); r !== -1 && n.splice(r, 1); }); } function ii(t, e) { var n = nu(); try { for (var r = [].concat(t.interceptors_ || []), i = 0, o = r.length; i < o && (e = r[i](e), e && !e.type && zt(14), !!e); i++) ; return e; } finally { Lo(n); } } function xi(t) { return t.changeListeners_ !== void 0 && t.changeListeners_.length > 0; } function xd(t, e) { var n = t.changeListeners_ || (t.changeListeners_ = []); return n.push(e), Y1(function() { var r = n.indexOf(e); r !== -1 && n.splice(r, 1); }); } function Ni(t, e) { var n = nu(), r = t.changeListeners_; if (r) { r = r.slice(); for (var i = 0, o = r.length; i < o; i++) r[i](e); Lo(n); } } var Rg = /* @__PURE__ */ Symbol("mobx-keys"); function SO(t, e, n) { return Mo(t) ? AA(t, t, e, n) : (iu(function() { var r = Al(t, n)[yt]; if (!t[Rg]) { var i = Object.getPrototypeOf(t), o = new Set([].concat(ud(t), ud(i))); o.delete("constructor"), o.delete(yt), hp(i, Rg, o); } t[Rg].forEach(function(u) { return r.make_( u, // must pass "undefined" for { key: undefined } e && u in e ? e[u] : !0 ); }); }), t); } var y_ = "splice", ro = "update", _O = 1e4, bO = { get: function(e, n) { var r = e[yt]; return n === yt ? r : n === "length" ? r.getArrayLength_() : typeof n == "string" && !isNaN(n) ? r.get_(parseInt(n)) : Ps($h, n) ? $h[n] : e[n]; }, set: function(e, n, r) { var i = e[yt]; return n === "length" && i.setArrayLength_(r), typeof n == "symbol" || isNaN(n) ? e[n] = r : i.set_(parseInt(n), r), !0; }, preventExtensions: function() { zt(15); } }, f0 = /* @__PURE__ */ function() { function t(n, r, i, o) { n === void 0 && (n = "ObservableArray"), this.owned_ = void 0, this.legacyMode_ = void 0, this.atom_ = void 0, this.values_ = [], this.interceptors_ = void 0, this.changeListeners_ = void 0, this.enhancer_ = void 0, this.dehancer = void 0, this.proxy_ = void 0, this.lastKnownLength_ = 0, this.owned_ = i, this.legacyMode_ = o, this.atom_ = new $s(n), this.enhancer_ = function(u, l) { return r(u, l, "ObservableArray[..]"); }; } var e = t.prototype; return e.dehanceValue_ = function(r) { return this.dehancer !== void 0 ? this.dehancer(r) : r; }, e.dehanceValues_ = function(r) { return this.dehancer !== void 0 && r.length > 0 ? r.map(this.dehancer) : r; }, e.intercept_ = function(r) { return Cd(this, r); }, e.observe_ = function(r, i) { return i === void 0 && (i = !1), i && r({ observableKind: "array", object: this.proxy_, debugObjectName: this.atom_.name_, type: "splice", index: 0, added: this.values_.slice(), addedCount: this.values_.length, removed: [], removedCount: 0 }), xd(this, r); }, e.getArrayLength_ = function() { return this.atom_.reportObserved(), this.values_.length; }, e.setArrayLength_ = function(r) { (typeof r != "number" || isNaN(r) || r < 0) && zt("Out of range: " + r); var i = this.values_.length; if (r !== i) if (r > i) { for (var o = new Array(r - i), u = 0; u < r - i; u++) o[u] = void 0; this.spliceWithArray_(i, 0, o); } else this.spliceWithArray_(r, i - r); }, e.updateArrayLength_ = function(r, i) { r !== this.lastKnownLength_ && zt(16), this.lastKnownLength_ += i, this.legacyMode_ && i > 0 && LA(r + i + 1); }, e.spliceWithArray_ = function(r, i, o) { var u = this; this.atom_; var l = this.values_.length; if (r === void 0 ? r = 0 : r > l ? r = l : r < 0 && (r = Math.max(0, l + r)), arguments.length === 1 ? i = l - r : i == null ? i = 0 : i = Math.max(0, Math.min(i, l - r)), o === void 0 && (o = Wv), ri(this)) { var f = ii(this, { object: this.proxy_, type: y_, index: r, removedCount: i, added: o }); if (!f) return Wv; i = f.removedCount, o = f.added; } if (o = o.length === 0 ? o : o.map(function(v) { return u.enhancer_(v, void 0); }), this.legacyMode_) { var d = o.length - i; this.updateArrayLength_(l, d); } var p = this.spliceItemsIntoValues_(r, i, o); return (i !== 0 || o.length !== 0) && this.notifyArraySplice_(r, o, p), this.dehanceValues_(p); }, e.spliceItemsIntoValues_ = function(r, i, o) { if (o.length < _O) { var u; return (u = this.values_).splice.apply(u, [r, i].concat(o)); } else { var l = this.values_.slice(r, r + i), f = this.values_.slice(r + i); this.values_.length += o.length - i; for (var d = 0; d < o.length; d++) this.values_[r + d] = o[d]; for (var p = 0; p < f.length; p++) this.values_[r + o.length + p] = f[p]; return l; } }, e.notifyArrayChildUpdate_ = function(r, i, o) { var u = !this.owned_ && Xc(), l = xi(this), f = l || u ? { observableKind: "array", object: this.proxy_, type: ro, debugObjectName: this.atom_.name_, index: r, newValue: i, oldValue: o } : null; this.atom_.reportChanged(), l && Ni(this, f); }, e.notifyArraySplice_ = function(r, i, o) { var u = !this.owned_ && Xc(), l = xi(this), f = l || u ? { observableKind: "array", object: this.proxy_, debugObjectName: this.atom_.name_, type: y_, index: r, removed: o, added: i, removedCount: o.length, addedCount: i.length } : null; this.atom_.reportChanged(), l && Ni(this, f); }, e.get_ = function(r) { if (this.legacyMode_ && r >= this.values_.length) { console.warn("[mobx] Out of bounds read: " + r); return; } return this.atom_.reportObserved(), this.dehanceValue_(this.values_[r]); }, e.set_ = function(r, i) { var o = this.values_; if (this.legacyMode_ && r > o.length && zt(17, r, o.length), r < o.length) { this.atom_; var u = o[r]; if (ri(this)) { var l = ii(this, { type: ro, object: this.proxy_, // since "this" is the real array we need to pass its proxy index: r, newValue: i }); if (!l) return; i = l.newValue; } i = this.enhancer_(i, u); var f = i !== u; f && (o[r] = i, this.notifyArrayChildUpdate_(r, i, u)); } else { for (var d = new Array(r + 1 - o.length), p = 0; p < d.length - 1; p++) d[p] = void 0; d[d.length - 1] = i, this.spliceWithArray_(o.length, 0, d); } }, t; }(); function kO(t, e, n, r) { return n === void 0 && (n = "ObservableArray"), r === void 0 && (r = !1), W1(), iu(function() { var i = new f0(n, e, r, !1); J1(i.values_, yt, i); var o = new Proxy(i.values_, bO); return i.proxy_ = o, t && t.length && i.spliceWithArray_(0, 0, t), o; }); } var $h = { clear: function() { return this.splice(0); }, replace: function(e) { var n = this[yt]; return n.spliceWithArray_(0, n.values_.length, e); }, // Used by JSON.stringify toJSON: function() { return this.slice(); }, /* * functions that do alter the internal structure of the array, (based on lib.es6.d.ts) * since these functions alter the inner structure of the array, the have side effects. * Because the have side effects, they should not be used in computed function, * and for that reason the do not call dependencyState.notifyObserved */ splice: function(e, n) { for (var r = arguments.length, i = new Array(r > 2 ? r - 2 : 0), o = 2; o < r; o++) i[o - 2] = arguments[o]; var u = this[yt]; switch (arguments.length) { case 0: return []; case 1: return u.spliceWithArray_(e); case 2: return u.spliceWithArray_(e, n); } return u.spliceWithArray_(e, n, i); }, spliceWithArray: function(e, n, r) { return this[yt].spliceWithArray_(e, n, r); }, push: function() { for (var e = this[yt], n = arguments.length, r = new Array(n), i = 0; i < n; i++) r[i] = arguments[i]; return e.spliceWithArray_(e.values_.length, 0, r), e.values_.length; }, pop: function() { return this.splice(Math.max(this[yt].values_.length - 1, 0), 1)[0]; }, shift: function() { return this.splice(0, 1)[0]; }, unshift: function() { for (var e = this[yt], n = arguments.length, r = new Array(n), i = 0; i < n; i++) r[i] = arguments[i]; return e.spliceWithArray_(0, 0, r), e.values_.length; }, reverse: function() { return nt.trackingDerivation && zt(37, "reverse"), this.replace(this.slice().reverse()), this; }, sort: function() { nt.trackingDerivation && zt(37, "sort"); var e = this.slice(); return e.sort.apply(e, arguments), this.replace(e), this; }, remove: function(e) { var n = this[yt], r = n.dehanceValues_(n.values_).indexOf(e); return r > -1 ? (this.splice(r, 1), !0) : !1; } }; cn("at", qr); cn("concat", qr); cn("flat", qr); cn("includes", qr); cn("indexOf", qr); cn("join", qr); cn("lastIndexOf", qr); cn("slice", qr); cn("toString", qr); cn("toLocaleString", qr); cn("toSorted", qr); cn("toSpliced", qr); cn("with", qr); cn("every", Oi); cn("filter", Oi); cn("find", Oi); cn("findIndex", Oi); cn("findLast", Oi); cn("findLastIndex", Oi); cn("flatMap", Oi); cn("forEach", Oi); cn("map", Oi); cn("some", Oi); cn("toReversed", Oi); cn("reduce", IA); cn("reduceRight", IA); function cn(t, e) { typeof Array.prototype[t] == "function" && ($h[t] = e(t)); } function qr(t) { return function() { var e = this[yt]; e.atom_.reportObserved(); var n = e.dehanceValues_(e.values_); return n[t].apply(n, arguments); }; } function Oi(t) { return function(e, n) { var r = this, i = this[yt]; i.atom_.reportObserved(); var o = i.dehanceValues_(i.values_); return o[t](function(u, l) { return e.call(n, u, l, r); }); }; } function IA(t) { return function() { var e = this, n = this[yt]; n.atom_.reportObserved(); var r = n.dehanceValues_(n.values_), i = arguments[0]; return arguments[0] = function(o, u, l) { return i(o, u, l, e); }, r[t].apply(r, arguments); }; } var EO = /* @__PURE__ */ tu("ObservableArrayAdministration", f0); function bp(t) { return fp(t) && EO(t[yt]); } var AO = {}, Is = "add", Vh = "delete", RA = /* @__PURE__ */ function() { function t(n, r, i) { var o = this; r === void 0 && (r = Wa), i === void 0 && (i = "ObservableMap"), this.enhancer_ = void 0, this.name_ = void 0, this[yt] = AO, this.data_ = void 0, this.hasMap_ = void 0, this.keysAtom_ = void 0, this.interceptors_ = void 0, this.changeListeners_ = void 0, this.dehancer = void 0, this.enhancer_ = r, this.name_ = i, Ti(Map) || zt(18), iu(function() { o.keysAtom_ = tA("ObservableMap.keys()"), o.data_ = /* @__PURE__ */ new Map(), o.hasMap_ = /* @__PURE__ */ new Map(), n && o.merge(n); }); } var e = t.prototype; return e.has_ = function(r) { return this.data_.has(r); }, e.has = function(r) { var i = this; if (!nt.trackingDerivation) return this.has_(r); var o = this.hasMap_.get(r); if (!o) { var u = o = new $a(this.has_(r), pp, "ObservableMap.key?", !1); this.hasMap_.set(r, u), kA(u, function() { return i.hasMap_.delete(r); }); } return o.get(); }, e.set = function(r, i) { var o = this.has_(r); if (ri(this)) { var u = ii(this, { type: o ? ro : Is, object: this, newValue: i, name: r }); if (!u) return this; i = u.newValue; } return o ? this.updateValue_(r, i) : this.addValue_(r, i), this; }, e.delete = function(r) { var i = this; if (this.keysAtom_, ri(this)) { var o = ii(this, { type: Vh, object: this, name: r }); if (!o) return !1; } if (this.has_(r)) { var u = Xc(), l = xi(this), f = l || u ? { observableKind: "map", debugObjectName: this.name_, type: Vh, object: this, oldValue: this.data_.get(r).value_, name: r } : null; return Po(function() { var d; i.keysAtom_.reportChanged(), (d = i.hasMap_.get(r)) == null || d.setNewValue_(!1); var p = i.data_.get(r); p.setNewValue_(void 0), i.data_.delete(r); }), l && Ni(this, f), !0; } return !1; }, e.updateValue_ = function(r, i) { var o = this.data_.get(r); if (i = o.prepareNewValue_(i), i !== nt.UNCHANGED) { var u = Xc(), l = xi(this), f = l || u ? { observableKind: "map", debugObjectName: this.name_, type: ro, object: this, oldValue: o.value_, name: r, newValue: i } : null; o.setNewValue_(i), l && Ni(this, f); } }, e.addValue_ = function(r, i) { var o = this; this.keysAtom_, Po(function() { var d, p = new $a(i, o.enhancer_, "ObservableMap.key", !1); o.data_.set(r, p), i = p.value_, (d = o.hasMap_.get(r)) == null || d.setNewValue_(!0), o.keysAtom_.reportChanged(); }); var u = Xc(), l = xi(this), f = l || u ? { observableKind: "map", debugObjectName: this.name_, type: Is, object: this, name: r, newValue: i } : null; l && Ni(this, f); }, e.get = function(r) { return this.has(r) ? this.dehanceValue_(this.data_.get(r).get()) : this.dehanceValue_(void 0); }, e.dehanceValue_ = function(r) { return this.dehancer !== void 0 ? this.dehancer(r) : r; }, e.keys = function() { return this.keysAtom_.reportObserved(), this.data_.keys(); }, e.values = function() { var r = this, i = this.keys(); return dd({ next: function() { var u = i.next(), l = u.done, f = u.value; return { done: l, value: l ? void 0 : r.get(f) }; } }); }, e.entries = function() { var r = this, i = this.keys(); return dd({ next: function() { var u = i.next(), l = u.done, f = u.value; return { done: l, value: l ? void 0 : [f, r.get(f)] }; } }); }, e[Symbol.iterator] = function() { return this.entries(); }, e.forEach = function(r, i) { for (var o = nl(this), u; !(u = o()).done; ) { var l = u.value, f = l[0], d = l[1]; r.call(i, d, f, this); } }, e.merge = function(r) { var i = this; return ru(r) && (r = new Map(r)), Po(function() { Mo(r) ? ZI(r).forEach(function(o) { return i.set(o, r[o]); }) : Array.isArray(r) ? r.forEach(function(o) { var u = o[0], l = o[1]; return i.set(u, l); }) : _l(r) ? (XI(r) || zt(19, r), r.forEach(function(o, u) { return i.set(u, o); })) : r != null && zt(20, r); }), this; }, e.clear = function() { var r = this; Po(function() { fA(function() { for (var i = nl(r.keys()), o; !(o = i()).done; ) { var u = o.value; r.delete(u); } }); }); }, e.replace = function(r) { var i = this; return Po(function() { for (var o = CO(r), u = /* @__PURE__ */ new Map(), l = !1, f = nl(i.data_.keys()), d; !(d = f()).done; ) { var p = d.value; if (!o.has(p)) { var v = i.delete(p); if (v) l = !0; else { var y = i.data_.get(p); u.set(p, y); } } } for (var k = nl(o.entries()), A; !(A = k()).done; ) { var E = A.value, T = E[0], D = E[1], R = i.data_.has(T); if (i.set(T, D), i.data_.has(T)) { var L = i.data_.get(T); u.set(T, L), R || (l = !0); } } if (!l) if (i.data_.size !== u.size) i.keysAtom_.reportChanged(); else for (var j = i.data_.keys(), K = u.keys(), ue = j.next(), de = K.next(); !ue.done; ) { if (ue.value !== de.value) { i.keysAtom_.reportChanged(); break; } ue = j.next(), de = K.next(); } i.data_ = u; }), this; }, e.toString = function() { return "[object ObservableMap]"; }, e.toJSON = function() { return Array.from(this); }, e.observe_ = function(r, i) { return xd(this, r); }, e.intercept_ = function(r) { return Cd(this, r); }, bl(t, [{ key: "size", get: function() { return this.keysAtom_.reportObserved(), this.data_.size; } }, { key: Symbol.toStringTag, get: function() { return "Map"; } }]); }(), ru = /* @__PURE__ */ tu("ObservableMap", RA); function CO(t) { if (_l(t) || ru(t)) return t; if (Array.isArray(t)) return new Map(t); if (Mo(t)) { var e = /* @__PURE__ */ new Map(); for (var n in t) e.set(n, t[n]); return e; } else return zt(21, t); } var xO = {}, OA = /* @__PURE__ */ function() { function t(n, r, i) { var o = this; r === void 0 && (r = Wa), i === void 0 && (i = "ObservableSet"), this.name_ = void 0, this[yt] = xO, this.data_ = /* @__PURE__ */ new Set(), this.atom_ = void 0, this.changeListeners_ = void 0, this.interceptors_ = void 0, this.dehancer = void 0, this.enhancer_ = void 0, this.name_ = i, Ti(Set) || zt(22), this.enhancer_ = function(u, l) { return r(u, l, i); }, iu(function() { o.atom_ = tA(o.name_), n && o.replace(n); }); } var e = t.prototype; return e.dehanceValue_ = function(r) { return this.dehancer !== void 0 ? this.dehancer(r) : r; }, e.clear = function() { var r = this; Po(function() { fA(function() { for (var i = nl(r.data_.values()), o; !(o = i()).done; ) { var u = o.value; r.delete(u); } }); }); }, e.forEach = function(r, i) { for (var o = nl(this), u; !(u = o()).done; ) { var l = u.value; r.call(i, l, l, this); } }, e.add = function(r) { var i = this; if (this.atom_, ri(this)) { var o = ii(this, { type: Is, object: this, newValue: r }); if (!o) return this; } if (!this.has(r)) { Po(function() { i.data_.add(i.enhancer_(r, void 0)), i.atom_.reportChanged(); }); var u = !1, l = xi(this), f = l || u ? { observableKind: "set", debugObjectName: this.name_, type: Is, object: this, newValue: r } : null; l && Ni(this, f); } return this; }, e.delete = function(r) { var i = this; if (ri(this)) { var o = ii(this, { type: Vh, object: this, oldValue: r }); if (!o) return !1; } if (this.has(r)) { var u = !1, l = xi(this), f = l || u ? { observableKind: "set", debugObjectName: this.name_, type: Vh, object: this, oldValue: r } : null; return Po(function() { i.atom_.reportChanged(), i.data_.delete(r); }), l && Ni(this, f), !0; } return !1; }, e.has = function(r) { return this.atom_.reportObserved(), this.data_.has(this.dehanceValue_(r)); }, e.entries = function() { var r = 0, i = Array.from(this.keys()), o = Array.from(this.values()); return dd({ next: function() { var l = r; return r += 1, l < o.length ? { value: [i[l], o[l]], done: !1 } : { done: !0 }; } }); }, e.keys = function() { return this.values(); }, e.values = function() { this.atom_.reportObserved(); var r = this, i = 0, o = Array.from(this.data_.values()); return dd({ next: function() { return i < o.length ? { value: r.dehanceValue_(o[i++]), done: !1 } : { done: !0 }; } }); }, e.intersection = function(r) { if (Oo(r)) return r.intersection(this); var i = new Set(this); return i.intersection(r); }, e.union = function(r) { if (Oo(r)) return r.union(this); var i = new Set(this); return i.union(r); }, e.difference = function(r) { return new Set(this).difference(r); }, e.symmetricDifference = function(r) { if (Oo(r)) return r.symmetricDifference(this); var i = new Set(this); return i.symmetricDifference(r); }, e.isSubsetOf = function(r) { return new Set(this).isSubsetOf(r); }, e.isSupersetOf = function(r) { return new Set(this).isSupersetOf(r); }, e.isDisjointFrom = function(r) { if (Oo(r)) return r.isDisjointFrom(this); var i = new Set(this); return i.isDisjointFrom(r); }, e.replace = function(r) { var i = this; return El(r) && (r = new Set(r)), Po(function() { Array.isArray(r) ? (i.clear(), r.forEach(function(o) { return i.add(o); })) : Oo(r) ? (i.clear(), r.forEach(function(o) { return i.add(o); })) : r != null && zt("Cannot initialize set from " + r); }), this; }, e.observe_ = function(r, i) { return xd(this, r); }, e.intercept_ = function(r) { return Cd(this, r); }, e.toJSON = function() { return Array.from(this); }, e.toString = function() { return "[object ObservableSet]"; }, e[Symbol.iterator] = function() { return this.values(); }, bl(t, [{ key: "size", get: function() { return this.atom_.reportObserved(), this.data_.size; } }, { key: Symbol.toStringTag, get: function() { return "Set"; } }]); }(), El = /* @__PURE__ */ tu("ObservableSet", OA), w_ = /* @__PURE__ */ Object.create(null), S_ = "remove", PA = /* @__PURE__ */ function() { function t(n, r, i, o) { r === void 0 && (r = /* @__PURE__ */ new Map()), o === void 0 && (o = TR), this.target_ = void 0, this.values_ = void 0, this.name_ = void 0, this.defaultAnnotation_ = void 0, this.keysAtom_ = void 0, this.changeListeners_ = void 0, this.interceptors_ = void 0, this.proxy_ = void 0, this.isPlainObject_ = void 0, this.appliedAnnotations_ = void 0, this.pendingKeys_ = void 0, this.target_ = n, this.values_ = r, this.name_ = i, this.defaultAnnotation_ = o, this.keysAtom_ = new $s("ObservableObject.keys"), this.isPlainObject_ = Mo(this.target_); } var e = t.prototype; return e.getObservablePropValue_ = function(r) { return this.values_.get(r).get(); }, e.setObservablePropValue_ = function(r, i) { var o = this.values_.get(r); if (o instanceof Ii) return o.set(i), !0; if (ri(this)) { var u = ii(this, { type: ro, object: this.proxy_ || this.target_, name: r, newValue: i }); if (!u) return null; i = u.newValue; } if (i = o.prepareNewValue_(i), i !== nt.UNCHANGED) { var l = xi(this), f = !1, d = l || f ? { type: ro, observableKind: "object", debugObjectName: this.name_, object: this.proxy_ || this.target_, oldValue: o.value_, name: r, newValue: i } : null; o.setNewValue_(i), l && Ni(this, d); } return !0; }, e.get_ = function(r) { return nt.trackingDerivation && !Ps(this.target_, r) && this.has_(r), this.target_[r]; }, e.set_ = function(r, i, o) { return o === void 0 && (o = !1), Ps(this.target_, r) ? this.values_.has(r) ? this.setObservablePropValue_(r, i) : o ? Reflect.set(this.target_, r, i) : (this.target_[r] = i, !0) : this.extend_(r, { value: i, enumerable: !0, writable: !0, configurable: !0 }, this.defaultAnnotation_, o); }, e.has_ = function(r) { if (!nt.trackingDerivation) return r in this.target_; this.pendingKeys_ || (this.pendingKeys_ = /* @__PURE__ */ new Map()); var i = this.pendingKeys_.get(r); return i || (i = new $a(r in this.target_, pp, "ObservableObject.key?", !1), this.pendingKeys_.set(r, i)), i.get(); }, e.make_ = function(r, i) { if (i === !0 && (i = this.defaultAnnotation_), i !== !1) { if (!(r in this.target_)) { var o; if ((o = this.target_[rl]) != null && o[r]) return; zt(1, i.annotationType_, this.name_ + "." + r.toString()); } for (var u = this.target_; u && u !== dp; ) { var l = Lh(u, r); if (l) { var f = i.make_(this, r, l, u); if (f === 0) return; if (f === 1) break; } u = Object.getPrototypeOf(u); } b_(this, i, r); } }, e.extend_ = function(r, i, o, u) { if (u === void 0 && (u = !1), o === !0 && (o = this.defaultAnnotation_), o === !1) return this.defineProperty_(r, i, u); var l = o.extend_(this, r, i, u); return l && b_(this, o, r), l; }, e.defineProperty_ = function(r, i, o) { o === void 0 && (o = !1), this.keysAtom_; try { si(); var u = this.delete_(r); if (!u) return u; if (ri(this)) { var l = ii(this, { object: this.proxy_ || this.target_, name: r, type: Is, newValue: i.value }); if (!l) return null; var f = l.newValue; i.value !== f && (i = Ka({}, i, { value: f })); } if (o) { if (!Reflect.defineProperty(this.target_, r, i)) return !1; } else to(this.target_, r, i); this.notifyPropertyAddition_(r, i.value); } finally { ai(); } return !0; }, e.defineObservableProperty_ = function(r, i, o, u) { u === void 0 && (u = !1), this.keysAtom_; try { si(); var l = this.delete_(r); if (!l) return l; if (ri(this)) { var f = ii(this, { object: this.proxy_ || this.target_, name: r, type: Is, newValue: i }); if (!f) return null; i = f.newValue; } var d = __(r), p = { configurable: nt.safeDescriptors ? this.isPlainObject_ : !0, enumerable: !0, get: d.get, set: d.set }; if (u) { if (!Reflect.defineProperty(this.target_, r, p)) return !1; } else to(this.target_, r, p); var v = new $a(i, o, "ObservableObject.key", !1); this.values_.set(r, v), this.notifyPropertyAddition_(r, v.value_); } finally { ai(); } return !0; }, e.defineComputedProperty_ = function(r, i, o) { o === void 0 && (o = !1), this.keysAtom_; try { si(); var u = this.delete_(r); if (!u) return u; if (ri(this)) { var l = ii(this, { object: this.proxy_ || this.target_, name: r, type: Is, newValue: void 0 }); if (!l) return null; } i.name || (i.name = "ObservableObject.key"), i.context = this.proxy_ || this.target_; var f = __(r), d = { configurable: nt.safeDescriptors ? this.isPlainObject_ : !0, enumerable: !1, get: f.get, set: f.set }; if (o) { if (!Reflect.defineProperty(this.target_, r, d)) return !1; } else to(this.target_, r, d); this.values_.set(r, new Ii(i)), this.notifyPropertyAddition_(r, void 0); } finally { ai(); } return !0; }, e.delete_ = function(r, i) { if (i === void 0 && (i = !1), this.keysAtom_, !Ps(this.target_, r)) return !0; if (ri(this)) { var o = ii(this, { object: this.proxy_ || this.target_, name: r, type: S_ }); if (!o) return null; } try { var u; si(); var l = xi(this), f = !1, d = this.values_.get(r), p = void 0; if (!d && (l || f)) { var v; p = (v = Lh(this.target_, r)) == null ? void 0 : v.value; } if (i) { if (!Reflect.deleteProperty(this.target_, r)) return !1; } else delete this.target_[r]; if (d && (this.values_.delete(r), d instanceof $a && (p = d.value_), vA(d)), this.keysAtom_.reportChanged(), (u = this.pendingKeys_) == null || (u = u.get(r)) == null || u.set(r in this.target_), l || f) { var y = { type: S_, observableKind: "object", object: this.proxy_ || this.target_, debugObjectName: this.name_, oldValue: p, name: r }; l && Ni(this, y); } } finally { ai(); } return !0; }, e.observe_ = function(r, i) { return xd(this, r); }, e.intercept_ = function(r) { return Cd(this, r); }, e.notifyPropertyAddition_ = function(r, i) { var o, u = xi(this), l = !1; if (u || l) { var f = u || l ? { type: Is, observableKind: "object", debugObjectName: this.name_, object: this.proxy_ || this.target_, name: r, newValue: i } : null; u && Ni(this, f); } (o = this.pendingKeys_) == null || (o = o.get(r)) == null || o.set(!0), this.keysAtom_.reportChanged(); }, e.ownKeys_ = function() { return this.keysAtom_.reportObserved(), ud(this.target_); }, e.keys_ = function() { return this.keysAtom_.reportObserved(), Object.keys(this.target_); }, t; }(); function Al(t, e) { var n; if (Ps(t, yt)) return t; var r = (n = e?.name) != null ? n : "ObservableObject", i = new PA(t, /* @__PURE__ */ new Map(), String(r), jR(e)); return hp(t, yt, i), t; } var NO = /* @__PURE__ */ tu("ObservableObjectAdministration", PA); function __(t) { return w_[t] || (w_[t] = { get: function() { return this[yt].getObservablePropValue_(t); }, set: function(n) { return this[yt].setObservablePropValue_(t, n); } }); } function kp(t) { return fp(t) ? NO(t[yt]) : !1; } function b_(t, e, n) { var r; (r = t.target_[rl]) == null || delete r[n]; } var TO = /* @__PURE__ */ FA(0), IO = /* @__PURE__ */ function() { var t = !1, e = {}; return Object.defineProperty(e, "0", { set: function() { t = !0; } }), Object.create(e)[0] = 1, t === !1; }(), Og = 0, DA = function() { }; function RO(t, e) { Object.setPrototypeOf ? Object.setPrototypeOf(t.prototype, e) : t.prototype.__proto__ !== void 0 ? t.prototype.__proto__ = e : t.prototype = e; } RO(DA, Array.prototype); var h0 = /* @__PURE__ */ function(t) { function e(r, i, o, u) { var l; return o === void 0 && (o = "ObservableArray"), u === void 0 && (u = !1), l = t.call(this) || this, iu(function() { var f = new f0(o, i, u, !0); f.proxy_ = l, J1(l, yt, f), r && r.length && l.spliceWithArray(0, 0, r), IO && Object.defineProperty(l, "0", TO); }), l; } eA(e, t); var n = e.prototype; return n.concat = function() { this[yt].atom_.reportObserved(); for (var i = arguments.length, o = new Array(i), u = 0; u < i; u++) o[u] = arguments[u]; return Array.prototype.concat.apply( this.slice(), //@ts-ignore o.map(function(l) { return bp(l) ? l.slice() : l; }) ); }, n[Symbol.iterator] = function() { var r = this, i = 0; return dd({ next: function() { return i < r.length ? { value: r[i++], done: !1 } : { done: !0, value: void 0 }; } }); }, bl(e, [{ key: "length", get: function() { return this[yt].getArrayLength_(); }, set: function(i) { this[yt].setArrayLength_(i); } }, { key: Symbol.toStringTag, get: function() { return "Array"; } }]); }(DA); Object.entries($h).forEach(function(t) { var e = t[0], n = t[1]; e !== "concat" && hp(h0.prototype, e, n); }); function FA(t) { return { enumerable: !1, configurable: !0, get: function() { return this[yt].get_(t); }, set: function(n) { this[yt].set_(t, n); } }; } function OO(t) { to(h0.prototype, "" + t, FA(t)); } function LA(t) { if (t > Og) { for (var e = Og; e < t + 100; e++) OO(e); Og = t; } } LA(1e3); function PO(t, e, n) { return new h0(t, e, n); } function ny(t, e) { if (typeof t == "object" && t !== null) { if (bp(t)) return e !== void 0 && zt(23), t[yt].atom_; if (El(t)) return t.atom_; if (ru(t)) { if (e === void 0) return t.keysAtom_; var n = t.data_.get(e) || t.hasMap_.get(e); return n || zt(25, e, ry(t)), n; } if (kp(t)) { if (!e) return zt(26); var r = t[yt].values_.get(e); return r || zt(27, e, ry(t)), r; } if (u0(t) || wp(t) || jh(t)) return t; } else if (Ti(t) && jh(t[yt])) return t[yt]; zt(28); } function DO(t, e) { if (t || zt(29), u0(t) || wp(t) || jh(t) || ru(t) || El(t)) return t; if (t[yt]) return t[yt]; zt(24, t); } function ry(t, e) { var n; if (e !== void 0) n = ny(t, e); else { if (Sp(t)) return t.name; kp(t) || ru(t) || El(t) ? n = DO(t) : n = ny(t); } return n.name_; } function iu(t) { var e = nu(), n = vp(!0); si(); try { return t(); } finally { ai(), yp(n), Lo(e); } } var k_ = dp.toString; function p0(t, e, n) { return n === void 0 && (n = -1), iy(t, e, n); } function iy(t, e, n, r, i) { if (t === e) return t !== 0 || 1 / t === 1 / e; if (t == null || e == null) return !1; if (t !== t) return e !== e; var o = typeof t; if (o !== "function" && o !== "object" && typeof e != "object") return !1; var u = k_.call(t); if (u !== k_.call(e)) return !1; switch (u) { // Strings, numbers, regular expressions, dates, and booleans are compared by value. case "[object RegExp]": // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') case "[object String]": return "" + t == "" + e; case "[object Number]": return +t != +t ? +e != +e : +t == 0 ? 1 / +t === 1 / e : +t == +e; case "[object Date]": case "[object Boolean]": return +t == +e; case "[object Symbol]": return typeof Symbol < "u" && Symbol.valueOf.call(t) === Symbol.valueOf.call(e); case "[object Map]": case "[object Set]": n >= 0 && n++; break; } t = E_(t), e = E_(e); var l = u === "[object Array]"; if (!l) { if (typeof t != "object" || typeof e != "object") return !1; var f = t.constructor, d = e.constructor; if (f !== d && !(Ti(f) && f instanceof f && Ti(d) && d instanceof d) && "constructor" in t && "constructor" in e) return !1; } if (n === 0) return !1; n < 0 && (n = -1), r = r || [], i = i || []; for (var p = r.length; p--; ) if (r[p] === t) return i[p] === e; if (r.push(t), i.push(e), l) { if (p = t.length, p !== e.length) return !1; for (; p--; ) if (!iy(t[p], e[p], n - 1, r, i)) return !1; } else { var v = Object.keys(t), y; if (p = v.length, Object.keys(e).length !== p) return !1; for (; p--; ) if (y = v[p], !(Ps(e, y) && iy(t[y], e[y], n - 1, r, i))) return !1; } return r.pop(), i.pop(), !0; } function E_(t) { return bp(t) ? t.slice() : _l(t) || ru(t) || Oo(t) || El(t) ? Array.from(t.entries()) : t; } function dd(t) { return t[Symbol.iterator] = FO, t; } function FO() { return this; } ["Symbol", "Map", "Set"].forEach(function(t) { var e = K1(); typeof e[t] > "u" && zt("MobX requires global '" + t + "' to be available or polyfilled"); }); typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ == "object" && __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({ spy: rO, extras: { getDebugName: ry }, $mobx: yt }); function LO(t, e = []) { gt.useEffect(() => { const n = _p(t); return () => n(); }, e); } function UA(t, e = {}) { const { defaultValue: n, deps: r = [] } = e, i = gt.useMemo(() => t, r), [o, u] = gt.useState( () => i() || n ); return gt.useEffect(() => { const l = _p(() => u(i())); return () => l(); }, [i, ...r]), o; } function UO(t, e, n = []) { const r = gt.useMemo(() => t, n), i = gt.useMemo(() => e, n); gt.useEffect(() => { const o = d0(r, i); return () => o(); }, [r, i]); } var Pg = { exports: {} }, Ac = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var A_; function MO() { if (A_) return Ac; A_ = 1; var t = e0(), e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 }; function u(l, f, d) { var p, v = {}, y = null, k = null; d !== void 0 && (y = "" + d), f.key !== void 0 && (y = "" + f.key), f.ref !== void 0 && (k = f.ref); for (p in f) r.call(f, p) && !o.hasOwnProperty(p) && (v[p] = f[p]); if (l && l.defaultProps) for (p in f = l.defaultProps, f) v[p] === void 0 && (v[p] = f[p]); return { $$typeof: e, type: l, key: y, ref: k, props: v, _owner: i.current }; } return Ac.Fragment = n, Ac.jsx = u, Ac.jsxs = u, Ac; } var C_; function BO() { return C_ || (C_ = 1, Pg.exports = MO()), Pg.exports; } var fd = BO(); let m0 = /* @__PURE__ */ new Map(); const oy = gt.createContext(m0), jO = ({ children: t, stores: e }) => { const n = gt.useContext(oy), r = gt.useMemo(() => { const i = /* @__PURE__ */ new Map(); return e.forEach((o) => i.set(o.class, o.value)), m0 = new Map([...n, ...i]); }, []); return /* @__PURE__ */ fd.jsx(oy.Provider, { value: r, children: t }); }; function $O(t) { return gt.useContext(oy).get(t); } function VO(t) { return m0.get(t); } var mh = { exports: {} }, zO = mh.exports, x_; function qO() { return x_ || (x_ = 1, function(t, e) { (function(n, r) { t.exports = r(); })(zO, function() { var n = function(h, g) { return (n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(S, C) { S.__proto__ = C; } || function(S, C) { for (var N in C) Object.prototype.hasOwnProperty.call(C, N) && (S[N] = C[N]); })(h, g); }, r = function() { return (r = Object.assign || function(h) { for (var g, S = 1, C = arguments.length; S < C; S++) for (var N in g = arguments[S]) Object.prototype.hasOwnProperty.call(g, N) && (h[N] = g[N]); return h; }).apply(this, arguments); }; function i(h, g, S) { for (var C, N = 0, O = g.length; N < O; N++) !C && N in g || ((C = C || Array.prototype.slice.call(g, 0, N))[N] = g[N]); return h.concat(C || Array.prototype.slice.call(g)); } var o = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Os, u = Object.keys, l = Array.isArray; function f(h, g) { return typeof g != "object" || u(g).forEach(function(S) { h[S] = g[S]; }), h; } typeof Promise > "u" || o.Promise || (o.Promise = Promise); var d = Object.getPrototypeOf, p = {}.hasOwnProperty; function v(h, g) { return p.call(h, g); } function y(h, g) { typeof g == "function" && (g = g(d(h))), (typeof Reflect > "u" ? u : Reflect.ownKeys)(g).forEach(function(S) { A(h, S, g[S]); }); } var k = Object.defineProperty; function A(h, g, S, C) { k(h, g, f(S && v(S, "get") && typeof S.get == "function" ? { get: S.get, set: S.set, configurable: !0 } : { value: S, configurable: !0, writable: !0 }, C)); } function E(h) { return { from: function(g) { return h.prototype = Object.create(g.prototype), A(h.prototype, "constructor", h), { extend: y.bind(null, h.prototype) }; } }; } var T = Object.getOwnPropertyDescriptor, D = [].slice; function R(h, g, S) { return D.call(h, g, S); } function L(h, g) { return g(h); } function j(h) { if (!h) throw new Error("Assertion Failed"); } function K(h) { o.setImmediate ? setImmediate(h) : setTimeout(h, 0); } function ue(h, g) { if (typeof g == "string" && v(h, g)) return h[g]; if (!g) return h; if (typeof g != "string") { for (var S = [], C = 0, N = g.length; C < N; ++C) { var O = ue(h, g[C]); S.push(O); } return S; } var U = g.indexOf("."); if (U !== -1) { var z = h[g.substr(0, U)]; return z == null ? void 0 : ue(z, g.substr(U + 1)); } } function de(h, g, S) { if (h && g !== void 0 && !("isFrozen" in Object && Object.isFrozen(h))) if (typeof g != "string" && "length" in g) { j(typeof S != "string" && "length" in S); for (var C = 0, N = g.length; C < N; ++C) de(h, g[C], S[C]); } else { var O, U, z = g.indexOf("."); z !== -1 ? (O = g.substr(0, z), (U = g.substr(z + 1)) === "" ? S === void 0 ? l(h) && !isNaN(parseInt(O)) ? h.splice(O, 1) : delete h[O] : h[O] = S : de(z = !(z = h[O]) || !v(h, O) ? h[O] = {} : z, U, S)) : S === void 0 ? l(h) && !isNaN(parseInt(g)) ? h.splice(g, 1) : delete h[g] : h[g] = S; } } function H(h) { var g, S = {}; for (g in h) v(h, g) && (S[g] = h[g]); return S; } var ve = [].concat; function Z(h) { return ve.apply([], h); } var At = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Z([8, 16, 32, 64].map(function(h) { return ["Int", "Uint", "Float"].map(function(g) { return g + h + "Array"; }); }))).filter(function(h) { return o[h]; }), we = new Set(At.map(function(h) { return o[h]; })), ze = null; function it(h) { return ze = /* @__PURE__ */ new WeakMap(), h = function g(S) { if (!S || typeof S != "object") return S; var C = ze.get(S); if (C) return C; if (l(S)) { C = [], ze.set(S, C); for (var N = 0, O = S.length; N < O; ++N) C.push(g(S[N])); } else if (we.has(S.constructor)) C = S; else { var U, z = d(S); for (U in C = z === Object.prototype ? {} : Object.create(z), ze.set(S, C), S) v(S, U) && (C[U] = g(S[U])); } return C; }(h), ze = null, h; } var dt = {}.toString; function ae(h) { return dt.call(h).slice(8, -1); } var be = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", pe = typeof be == "symbol" ? function(h) { var g; return h != null && (g = h[be]) && g.apply(h); } : function() { return null; }; function ce(h, g) { return g = h.indexOf(g), 0 <= g && h.splice(g, 1), 0 <= g; } var Ee = {}; function B(h) { var g, S, C, N; if (arguments.length === 1) { if (l(h)) return h.slice(); if (this === Ee && typeof h == "string") return [h]; if (N = pe(h)) { for (S = []; !(C = N.next()).done; ) S.push(C.value); return S; } if (h == null) return [h]; if (typeof (g = h.length) != "number") return [h]; for (S = new Array(g); g--; ) S[g] = h[g]; return S; } for (g = arguments.length, S = new Array(g); g--; ) S[g] = arguments[g]; return S; } var M = typeof Symbol < "u" ? function(h) { return h[Symbol.toStringTag] === "AsyncFunction"; } : function() { return !1; }, _t = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], hr = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(_t), te = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" }; function Te(h, g) { this.name = h, this.message = g; } function $(h, g) { return h + ". Errors: " + Object.keys(g).map(function(S) { return g[S].toString(); }).filter(function(S, C, N) { return N.indexOf(S) === C; }).join(` `); } function Q(h, g, S, C) { this.failures = g, this.failedKeys = C, this.successCount = S, this.message = $(h, g); } function Ye(h, g) { this.name = "BulkError", this.failures = Object.keys(g).map(function(S) { return g[S]; }), this.failuresByPos = g, this.message = $(h, this.failures); } E(Te).from(Error).extend({ toString: function() { return this.name + ": " + this.message; } }), E(Q).from(Te), E(Ye).from(Te); var Ie = hr.reduce(function(h, g) { return h[g] = g + "Error", h; }, {}), Ge = Te, Re = hr.reduce(function(h, g) { var S = g + "Error"; function C(N, O) { this.name = S, N ? typeof N == "string" ? (this.message = "".concat(N).concat(O ? ` ` + O : ""), this.inner = O || null) : typeof N == "object" && (this.message = "".concat(N.name, " ").concat(N.message), this.inner = N) : (this.message = te[g] || S, this.inner = null); } return E(C).from(Ge), h[g] = C, h; }, {}); Re.Syntax = SyntaxError, Re.Type = TypeError, Re.Range = RangeError; var ht = _t.reduce(function(h, g) { return h[g + "Error"] = Re[g], h; }, {}), ft = hr.reduce(function(h, g) { return ["Syntax", "Type", "Range"].indexOf(g) === -1 && (h[g + "Error"] = Re[g]), h; }, {}); function Je() { } function It(h) { return h; } function Rt(h, g) { return h == null || h === It ? g : function(S) { return g(h(S)); }; } function Ze(h, g) { return function() { h.apply(this, arguments), g.apply(this, arguments); }; } function Dt(h, g) { return h === Je ? g : function() { var S = h.apply(this, arguments); S !== void 0 && (arguments[0] = S); var C = this.onsuccess, N = this.onerror; this.onsuccess = null, this.onerror = null; var O = g.apply(this, arguments); return C && (this.onsuccess = this.onsuccess ? Ze(C, this.onsuccess) : C), N && (this.onerror = this.onerror ? Ze(N, this.onerror) : N), O !== void 0 ? O : S; }; } function Mt(h, g) { return h === Je ? g : function() { h.apply(this, arguments); var S = this.onsuccess, C = this.onerror; this.onsuccess = this.onerror = null, g.apply(this, arguments), S && (this.onsuccess = this.onsuccess ? Ze(S, this.onsuccess) : S), C && (this.onerror = this.onerror ? Ze(C, this.onerror) : C); }; } function P(h, g) { return h === Je ? g : function(S) { var C = h.apply(this, arguments); f(S, C); var N = this.onsuccess, O = this.onerror; return this.onsuccess = null, this.onerror = null, S = g.apply(this, arguments), N && (this.onsuccess = this.onsuccess ? Ze(N, this.onsuccess) : N), O && (this.onerror = this.onerror ? Ze(O, this.onerror) : O), C === void 0 ? S === void 0 ? void 0 : S : f(C, S); }; } function x(h, g) { return h === Je ? g : function() { return g.apply(this, arguments) !== !1 && h.apply(this, arguments); }; } function b(h, g) { return h === Je ? g : function() { var S = h.apply(this, arguments); if (S && typeof S.then == "function") { for (var C = this, N = arguments.length, O = new Array(N); N--; ) O[N] = arguments[N]; return S.then(function() { return g.apply(C, O); }); } return g.apply(this, arguments); }; } ft.ModifyError = Q, ft.DexieError = Te, ft.BulkError = Ye; var F = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href); function ee(h) { F = h; } var _e = {}, Ae = 100, At = typeof Promise > "u" ? [] : function() { var h = Promise.resolve(); if (typeof crypto > "u" || !crypto.subtle) return [h, d(h), h]; var g = crypto.subtle.digest("SHA-512", new Uint8Array([0])); return [g, d(g), h]; }(), _t = At[0], hr = At[1], At = At[2], hr = hr && hr.then, Ft = _t && _t.constructor, dn = !!At, qt = function(h, g) { oo.push([h, g]), Ir && (queueMicrotask(Pd), Ir = !1); }, dr = !0, Ir = !0, Hr = [], Vs = [], ou = It, Fi = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: Je, pgp: !1, env: {}, finalize: Je }, ut = Fi, oo = [], li = 0, Vo = []; function Xe(h) { if (typeof this != "object") throw new TypeError("Promises must be constructed via new"); this._listeners = [], this._lib = !1; var g = this._PSD = ut; if (typeof h != "function") { if (h !== _e) throw new TypeError("Not a function"); return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && su(this, this._value)); } this._state = null, this._value = null, ++g.ref, function S(C, N) { try { N(function(O) { if (C._state === null) { if (O === C) throw new TypeError("A promise cannot be resolved with itself."); var U = C._lib && Ui(); O && typeof O.then == "function" ? S(C, function(z, W) { O instanceof Xe ? O._then(z, W) : O.then(z, W); }) : (C._state = !0, C._value = O, Fl(C)), U && ao(); } }, su.bind(null, C)); } catch (O) { su(C, O); } }(this, h); } var Li = { get: function() { var h = ut, g = qo; function S(C, N) { var O = this, U = !h.global && (h !== ut || g !== qo), z = U && !Wn(), W = new Xe(function(J, ie) { au(O, new so(Ul(C, h, U, z), Ul(N, h, U, z), J, ie, h)); }); return this._consoleTask && (W._consoleTask = this._consoleTask), W; } return S.prototype = _e, S; }, set: function(h) { A(this, "then", h && h.prototype === _e ? Li : { get: function() { return h; }, set: Li.set }); } }; function so(h, g, S, C, N) { this.onFulfilled = typeof h == "function" ? h : null, this.onRejected = typeof g == "function" ? g : null, this.resolve = S, this.reject = C, this.psd = N; } function su(h, g) { var S, C; Vs.push(g), h._state === null && (S = h._lib && Ui(), g = ou(g), h._state = !1, h._value = g, C = h, Hr.some(function(N) { return N._value === C._value; }) || Hr.push(C), Fl(h), S && ao()); } function Fl(h) { var g = h._listeners; h._listeners = []; for (var S = 0, C = g.length; S < C; ++S) au(h, g[S]); var N = h._PSD; --N.ref || N.finalize(), li === 0 && (++li, qt(function() { --li == 0 && uo(); }, [])); } function au(h, g) { if (h._state !== null) { var S = h._state ? g.onFulfilled : g.onRejected; if (S === null) return (h._state ? g.resolve : g.reject)(h._value); ++g.psd.ref, ++li, qt(Od, [S, h, g]); } else h._listeners.push(g); } function Od(h, g, S) { try { var C, N = g._value; !g._state && Vs.length && (Vs = []), C = F && g._consoleTask ? g._consoleTask.run(function() { return h(N); }) : h(N), g._state || Vs.indexOf(N) !== -1 || function(O) { for (var U = Hr.length; U; ) if (Hr[--U]._value === O._value) return Hr.splice(U, 1); }(g), S.resolve(C); } catch (O) { S.reject(O); } finally { --li == 0 && uo(), --S.psd.ref || S.psd.finalize(); } } function Pd() { ji(Fi, function() { Ui() && ao(); }); } function Ui() { var h = dr; return Ir = dr = !1, h; } function ao() { var h, g, S; do for (; 0 < oo.length; ) for (h = oo, oo = [], S = h.length, g = 0; g < S; ++g) { var C = h[g]; C[0].apply(null, C[1]); } while (0 < oo.length); Ir = dr = !0; } function uo() { var h = Hr; Hr = [], h.forEach(function(C) { C._PSD.onunhandled.call(null, C._value, C); }); for (var g = Vo.slice(0), S = g.length; S; ) g[--S](); } function zo(h) { return new Xe(_e, !1, h); } function Wt(h, g) { var S = ut; return function() { var C = Ui(), N = ut; try { return Bi(S, !0), h.apply(this, arguments); } catch (O) { g && g(O); } finally { Bi(N, !1), C && ao(); } }; } y(Xe.prototype, { then: Li, _then: function(h, g) { au(this, new so(null, null, h, g, ut)); }, catch: function(h) { if (arguments.length === 1) return this.then(null, h); var g = h, S = arguments[1]; return typeof g == "function" ? this.then(null, function(C) { return (C instanceof g ? S : zo)(C); }) : this.then(null, function(C) { return (C && C.name === g ? S : zo)(C); }); }, finally: function(h) { return this.then(function(g) { return Xe.resolve(h()).then(function() { return g; }); }, function(g) { return Xe.resolve(h()).then(function() { return zo(g); }); }); }, timeout: function(h, g) { var S = this; return h < 1 / 0 ? new Xe(function(C, N) { var O = setTimeout(function() { return N(new Re.Timeout(g)); }, h); S.then(C, N).finally(clearTimeout.bind(null, O)); }) : this; } }), typeof Symbol < "u" && Symbol.toStringTag && A(Xe.prototype, Symbol.toStringTag, "Dexie.Promise"), Fi.env = Ll(), y(Xe, { all: function() { var h = B.apply(null, arguments).map(qs); return new Xe(function(g, S) { h.length === 0 && g([]); var C = h.length; h.forEach(function(N, O) { return Xe.resolve(N).then(function(U) { h[O] = U, --C || g(h); }, S); }); }); }, resolve: function(h) { return h instanceof Xe ? h : h && typeof h.then == "function" ? new Xe(function(g, S) { h.then(g, S); }) : new Xe(_e, !0, h); }, reject: zo, race: function() { var h = B.apply(null, arguments).map(qs); return new Xe(function(g, S) { h.map(function(C) { return Xe.resolve(C).then(g, S); }); }); }, PSD: { get: function() { return ut; }, set: function(h) { return ut = h; } }, totalEchoes: { get: function() { return qo; } }, newPSD: Mi, usePSD: ji, scheduler: { get: function() { return qt; }, set: function(h) { qt = h; } }, rejectionMapper: { get: function() { return ou; }, set: function(h) { ou = h; } }, follow: function(h, g) { return new Xe(function(S, C) { return Mi(function(N, O) { var U = ut; U.unhandleds = [], U.onunhandled = O, U.finalize = Ze(function() { var z, W = this; z = function() { W.unhandleds.length === 0 ? N() : O(W.unhandleds[0]); }, Vo.push(function J() { z(), Vo.splice(Vo.indexOf(J), 1); }), ++li, qt(function() { --li == 0 && uo(); }, []); }, U.finalize), h(); }, g, S, C); }); } }), Ft && (Ft.allSettled && A(Xe, "allSettled", function() { var h = B.apply(null, arguments).map(qs); return new Xe(function(g) { h.length === 0 && g([]); var S = h.length, C = new Array(S); h.forEach(function(N, O) { return Xe.resolve(N).then(function(U) { return C[O] = { status: "fulfilled", value: U }; }, function(U) { return C[O] = { status: "rejected", reason: U }; }).then(function() { return --S || g(C); }); }); }); }), Ft.any && typeof AggregateError < "u" && A(Xe, "any", function() { var h = B.apply(null, arguments).map(qs); return new Xe(function(g, S) { h.length === 0 && S(new AggregateError([])); var C = h.length, N = new Array(C); h.forEach(function(O, U) { return Xe.resolve(O).then(function(z) { return g(z); }, function(z) { N[U] = z, --C || S(new AggregateError(N)); }); }); }); }), Ft.withResolvers && (Xe.withResolvers = Ft.withResolvers)); var Cn = { awaits: 0, echoes: 0, id: 0 }, zs = 0, lo = [], co = 0, qo = 0, Hp = 0; function Mi(h, g, S, C) { var N = ut, O = Object.create(N); return O.parent = N, O.ref = 0, O.global = !1, O.id = ++Hp, Fi.env, O.env = dn ? { Promise: Xe, PromiseProp: { value: Xe, configurable: !0, writable: !0 }, all: Xe.all, race: Xe.race, allSettled: Xe.allSettled, any: Xe.any, resolve: Xe.resolve, reject: Xe.reject } : {}, g && f(O, g), ++N.ref, O.finalize = function() { --this.parent.ref || this.parent.finalize(); }, C = ji(O, h, S, C), O.ref === 0 && O.finalize(), C; } function Ho() { return Cn.id || (Cn.id = ++zs), ++Cn.awaits, Cn.echoes += Ae, Cn.id; } function Wn() { return !!Cn.awaits && (--Cn.awaits == 0 && (Cn.id = 0), Cn.echoes = Cn.awaits * Ae, !0); } function qs(h) { return Cn.echoes && h && h.constructor === Ft ? (Ho(), h.then(function(g) { return Wn(), g; }, function(g) { return Wn(), vn(g); })) : h; } function Dd() { var h = lo[lo.length - 1]; lo.pop(), Bi(h, !1); } function Bi(h, g) { var S, C = ut; (g ? !Cn.echoes || co++ && h === ut : !co || --co && h === ut) || queueMicrotask(g ? (function(N) { ++qo, Cn.echoes && --Cn.echoes != 0 || (Cn.echoes = Cn.awaits = Cn.id = 0), lo.push(ut), Bi(N, !0); }).bind(null, h) : Dd), h !== ut && (ut = h, C === Fi && (Fi.env = Ll()), dn && (S = Fi.env.Promise, g = h.env, (C.global || h.global) && (Object.defineProperty(o, "Promise", g.PromiseProp), S.all = g.all, S.race = g.race, S.resolve = g.resolve, S.reject = g.reject, g.allSettled && (S.allSettled = g.allSettled), g.any && (S.any = g.any)))); } function Ll() { var h = o.Promise; return dn ? { Promise: h, PromiseProp: Object.getOwnPropertyDescriptor(o, "Promise"), all: h.all, race: h.race, allSettled: h.allSettled, any: h.any, resolve: h.resolve, reject: h.reject } : {}; } function ji(h, g, S, C, N) { var O = ut; try { return Bi(h, !0), g(S, C, N); } finally { Bi(O, !1); } } function Ul(h, g, S, C) { return typeof h != "function" ? h : function() { var N = ut; S && Ho(), Bi(g, !0); try { return h.apply(this, arguments); } finally { Bi(N, !1), C && queueMicrotask(Wn); } }; } function uu(h) { Promise === Ft && Cn.echoes === 0 ? co === 0 ? h() : enqueueNativeMicroTask(h) : setTimeout(h, 0); } ("" + hr).indexOf("[native code]") === -1 && (Ho = Wn = Je); var vn = Xe.reject, fo = "ï¿¿", Ht = "Invalid key provided. Keys must be of type string, number, Date or Array.", Fd = "String expected.", $i = [], Hs = "__dbnames", Ko = "readonly", Ml = "readwrite"; function Vi(h, g) { return h ? g ? function() { return h.apply(this, arguments) && g.apply(this, arguments); } : h : g; } var Ks = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 }; function or(h) { return typeof h != "string" || /\./.test(h) ? function(g) { return g; } : function(g) { return g[h] === void 0 && h in g && delete (g = it(g))[h], g; }; } function Ld() { throw Re.Type(); } function wt(h, g) { try { var S = Ud(h), C = Ud(g); if (S !== C) return S === "Array" ? 1 : C === "Array" ? -1 : S === "binary" ? 1 : C === "binary" ? -1 : S === "string" ? 1 : C === "string" ? -1 : S === "Date" ? 1 : C !== "Date" ? NaN : -1; switch (S) { case "number": case "Date": case "string": return g < h ? 1 : h < g ? -1 : 0; case "binary": return function(N, O) { for (var U = N.length, z = O.length, W = U < z ? U : z, J = 0; J < W; ++J) if (N[J] !== O[J]) return N[J] < O[J] ? -1 : 1; return U === z ? 0 : U < z ? -1 : 1; }(Md(h), Md(g)); case "Array": return function(N, O) { for (var U = N.length, z = O.length, W = U < z ? U : z, J = 0; J < W; ++J) { var ie = wt(N[J], O[J]); if (ie !== 0) return ie; } return U === z ? 0 : U < z ? -1 : 1; }(h, g); } } catch { } return NaN; } function Ud(h) { var g = typeof h; return g != "object" ? g : ArrayBuffer.isView(h) ? "binary" : (h = ae(h), h === "ArrayBuffer" ? "binary" : h); } function Md(h) { return h instanceof Uint8Array ? h : ArrayBuffer.isView(h) ? new Uint8Array(h.buffer, h.byteOffset, h.byteLength) : new Uint8Array(h); } var Bd = (Yt.prototype._trans = function(h, g, S) { var C = this._tx || ut.trans, N = this.name, O = F && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(h === "readonly" ? "read" : "write", " ").concat(this.name)); function U(J, ie, q) { if (!q.schema[N]) throw new Re.NotFound("Table " + N + " not part of transaction"); return g(q.idbtrans, q); } var z = Ui(); try { var W = C && C.db._novip === this.db._novip ? C === ut.trans ? C._promise(h, U, S) : Mi(function() { return C._promise(h, U, S); }, { trans: C, transless: ut.transless || ut }) : function J(ie, q, oe, Y) { if (ie.idbdb && (ie._state.openComplete || ut.letThrough || ie._vip)) { var re = ie._createTransaction(q, oe, ie._dbSchema); try { re.create(), ie._state.PR1398_maxLoop = 3; } catch (se) { return se.name === Ie.InvalidState && ie.isOpen() && 0 < --ie._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), ie.close({ disableAutoOpen: !1 }), ie.open().then(function() { return J(ie, q, oe, Y); })) : vn(se); } return re._promise(q, function(se, ne) { return Mi(function() { return ut.trans = re, Y(se, ne, re); }); }).then(function(se) { if (q === "readwrite") try { re.idbtrans.commit(); } catch { } return q === "readonly" ? se : re._completion.then(function() { return se; }); }); } if (ie._state.openComplete) return vn(new Re.DatabaseClosed(ie._state.dbOpenError)); if (!ie._state.isBeingOpened) { if (!ie._state.autoOpen) return vn(new Re.DatabaseClosed()); ie.open().catch(Je); } return ie._state.dbReadyPromise.then(function() { return J(ie, q, oe, Y); }); }(this.db, h, [this.name], U); return O && (W._consoleTask = O, W = W.catch(function(J) { return console.trace(J), vn(J); })), W; } finally { z && ao(); } }, Yt.prototype.get = function(h, g) { var S = this; return h && h.constructor === Object ? this.where(h).first(g) : h == null ? vn(new Re.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(C) { return S.core.get({ trans: C, key: h }).then(function(N) { return S.hook.reading.fire(N); }); }).then(g); }, Yt.prototype.where = function(h) { if (typeof h == "string") return new this.db.WhereClause(this, h); if (l(h)) return new this.db.WhereClause(this, "[".concat(h.join("+"), "]")); var g = u(h); if (g.length === 1) return this.where(g[0]).equals(h[g[0]]); var S = this.schema.indexes.concat(this.schema.primKey).filter(function(z) { if (z.compound && g.every(function(J) { return 0 <= z.keyPath.indexOf(J); })) { for (var W = 0; W < g.length; ++W) if (g.indexOf(z.keyPath[W]) === -1) return !1; return !0; } return !1; }).sort(function(z, W) { return z.keyPath.length - W.keyPath.length; })[0]; if (S && this.db._maxKey !== fo) { var O = S.keyPath.slice(0, g.length); return this.where(O).equals(O.map(function(W) { return h[W]; })); } !S && F && console.warn("The query ".concat(JSON.stringify(h), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(g.join("+"), "]")); var C = this.schema.idxByName; function N(z, W) { return wt(z, W) === 0; } var U = g.reduce(function(q, W) { var J = q[0], ie = q[1], q = C[W], oe = h[W]; return [J || q, J || !q ? Vi(ie, q && q.multi ? function(Y) { return Y = ue(Y, W), l(Y) && Y.some(function(re) { return N(oe, re); }); } : function(Y) { return N(oe, ue(Y, W)); }) : ie]; }, [null, null]), O = U[0], U = U[1]; return O ? this.where(O.name).equals(h[O.keyPath]).filter(U) : S ? this.filter(U) : this.where(g).equals(""); }, Yt.prototype.filter = function(h) { return this.toCollection().and(h); }, Yt.prototype.count = function(h) { return this.toCollection().count(h); }, Yt.prototype.offset = function(h) { return this.toCollection().offset(h); }, Yt.prototype.limit = function(h) { return this.toCollection().limit(h); }, Yt.prototype.each = function(h) { return this.toCollection().each(h); }, Yt.prototype.toArray = function(h) { return this.toCollection().toArray(h); }, Yt.prototype.toCollection = function() { return new this.db.Collection(new this.db.WhereClause(this)); }, Yt.prototype.orderBy = function(h) { return new this.db.Collection(new this.db.WhereClause(this, l(h) ? "[".concat(h.join("+"), "]") : h)); }, Yt.prototype.reverse = function() { return this.toCollection().reverse(); }, Yt.prototype.mapToClass = function(h) { var g, S = this.db, C = this.name; function N() { return g !== null && g.apply(this, arguments) || this; } (this.schema.mappedClass = h).prototype instanceof Ld && (function(W, J) { if (typeof J != "function" && J !== null) throw new TypeError("Class extends value " + String(J) + " is not a constructor or null"); function ie() { this.constructor = W; } n(W, J), W.prototype = J === null ? Object.create(J) : (ie.prototype = J.prototype, new ie()); }(N, g = h), Object.defineProperty(N.prototype, "db", { get: function() { return S; }, enumerable: !1, configurable: !0 }), N.prototype.table = function() { return C; }, h = N); for (var O = /* @__PURE__ */ new Set(), U = h.prototype; U; U = d(U)) Object.getOwnPropertyNames(U).forEach(function(W) { return O.add(W); }); function z(W) { if (!W) return W; var J, ie = Object.create(h.prototype); for (J in W) if (!O.has(J)) try { ie[J] = W[J]; } catch { } return ie; } return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = z, this.hook("reading", z), h; }, Yt.prototype.defineClass = function() { return this.mapToClass(function(h) { f(this, h); }); }, Yt.prototype.add = function(h, g) { var S = this, C = this.schema.primKey, N = C.auto, O = C.keyPath, U = h; return O && N && (U = or(O)(h)), this._trans("readwrite", function(z) { return S.core.mutate({ trans: z, type: "add", keys: g != null ? [g] : null, values: [U] }); }).then(function(z) { return z.numFailures ? Xe.reject(z.failures[0]) : z.lastResult; }).then(function(z) { if (O) try { de(h, O, z); } catch { } return z; }); }, Yt.prototype.update = function(h, g) { return typeof h != "object" || l(h) ? this.where(":id").equals(h).modify(g) : (h = ue(h, this.schema.primKey.keyPath), h === void 0 ? vn(new Re.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(h).modify(g)); }, Yt.prototype.put = function(h, g) { var S = this, C = this.schema.primKey, N = C.auto, O = C.keyPath, U = h; return O && N && (U = or(O)(h)), this._trans("readwrite", function(z) { return S.core.mutate({ trans: z, type: "put", values: [U], keys: g != null ? [g] : null }); }).then(function(z) { return z.numFailures ? Xe.reject(z.failures[0]) : z.lastResult; }).then(function(z) { if (O) try { de(h, O, z); } catch { } return z; }); }, Yt.prototype.delete = function(h) { var g = this; return this._trans("readwrite", function(S) { return g.core.mutate({ trans: S, type: "delete", keys: [h] }); }).then(function(S) { return S.numFailures ? Xe.reject(S.failures[0]) : void 0; }); }, Yt.prototype.clear = function() { var h = this; return this._trans("readwrite", function(g) { return h.core.mutate({ trans: g, type: "deleteRange", range: Ks }); }).then(function(g) { return g.numFailures ? Xe.reject(g.failures[0]) : void 0; }); }, Yt.prototype.bulkGet = function(h) { var g = this; return this._trans("readonly", function(S) { return g.core.getMany({ keys: h, trans: S }).then(function(C) { return C.map(function(N) { return g.hook.reading.fire(N); }); }); }); }, Yt.prototype.bulkAdd = function(h, g, S) { var C = this, N = Array.isArray(g) ? g : void 0, O = (S = S || (N ? void 0 : g)) ? S.allKeys : void 0; return this._trans("readwrite", function(U) { var J = C.schema.primKey, z = J.auto, J = J.keyPath; if (J && N) throw new Re.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys"); if (N && N.length !== h.length) throw new Re.InvalidArgument("Arguments objects and keys must have the same length"); var W = h.length, J = J && z ? h.map(or(J)) : h; return C.core.mutate({ trans: U, type: "add", keys: N, values: J, wantResults: O }).then(function(re) { var q = re.numFailures, oe = re.results, Y = re.lastResult, re = re.failures; if (q === 0) return O ? oe : Y; throw new Ye("".concat(C.name, ".bulkAdd(): ").concat(q, " of ").concat(W, " operations failed"), re); }); }); }, Yt.prototype.bulkPut = function(h, g, S) { var C = this, N = Array.isArray(g) ? g : void 0, O = (S = S || (N ? void 0 : g)) ? S.allKeys : void 0; return this._trans("readwrite", function(U) { var J = C.schema.primKey, z = J.auto, J = J.keyPath; if (J && N) throw new Re.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys"); if (N && N.length !== h.length) throw new Re.InvalidArgument("Arguments objects and keys must have the same length"); var W = h.length, J = J && z ? h.map(or(J)) : h; return C.core.mutate({ trans: U, type: "put", keys: N, values: J, wantResults: O }).then(function(re) { var q = re.numFailures, oe = re.results, Y = re.lastResult, re = re.failures; if (q === 0) return O ? oe : Y; throw new Ye("".concat(C.name, ".bulkPut(): ").concat(q, " of ").concat(W, " operations failed"), re); }); }); }, Yt.prototype.bulkUpdate = function(h) { var g = this, S = this.core, C = h.map(function(U) { return U.key; }), N = h.map(function(U) { return U.changes; }), O = []; return this._trans("readwrite", function(U) { return S.getMany({ trans: U, keys: C, cache: "clone" }).then(function(z) { var W = [], J = []; h.forEach(function(q, oe) { var Y = q.key, re = q.changes, se = z[oe]; if (se) { for (var ne = 0, fe = Object.keys(re); ne < fe.length; ne++) { var ge = fe[ne], ye = re[ge]; if (ge === g.schema.primKey.keyPath) { if (wt(ye, Y) !== 0) throw new Re.Constraint("Cannot update primary key in bulkUpdate()"); } else de(se, ge, ye); } O.push(oe), W.push(Y), J.push(se); } }); var ie = W.length; return S.mutate({ trans: U, type: "put", keys: W, values: J, updates: { keys: C, changeSpecs: N } }).then(function(q) { var oe = q.numFailures, Y = q.failures; if (oe === 0) return ie; for (var re = 0, se = Object.keys(Y); re < se.length; re++) { var ne, fe = se[re], ge = O[Number(fe)]; ge != null && (ne = Y[fe], delete Y[fe], Y[ge] = ne); } throw new Ye("".concat(g.name, ".bulkUpdate(): ").concat(oe, " of ").concat(ie, " operations failed"), Y); }); }); }); }, Yt.prototype.bulkDelete = function(h) { var g = this, S = h.length; return this._trans("readwrite", function(C) { return g.core.mutate({ trans: C, type: "delete", keys: h }); }).then(function(U) { var N = U.numFailures, O = U.lastResult, U = U.failures; if (N === 0) return O; throw new Ye("".concat(g.name, ".bulkDelete(): ").concat(N, " of ").concat(S, " operations failed"), U); }); }, Yt); function Yt() { } function zi(h) { function g(U, z) { if (z) { for (var W = arguments.length, J = new Array(W - 1); --W; ) J[W - 1] = arguments[W]; return S[U].subscribe.apply(null, J), h; } if (typeof U == "string") return S[U]; } var S = {}; g.addEventType = O; for (var C = 1, N = arguments.length; C < N; ++C) O(arguments[C]); return g; function O(U, z, W) { if (typeof U != "object") { var J; z = z || x; var ie = { subscribers: [], fire: W = W || Je, subscribe: function(q) { ie.subscribers.indexOf(q) === -1 && (ie.subscribers.push(q), ie.fire = z(ie.fire, q)); }, unsubscribe: function(q) { ie.subscribers = ie.subscribers.filter(function(oe) { return oe !== q; }), ie.fire = ie.subscribers.reduce(z, W); } }; return S[U] = g[U] = ie; } u(J = U).forEach(function(q) { var oe = J[q]; if (l(oe)) O(q, J[q][0], J[q][1]); else { if (oe !== "asap") throw new Re.InvalidArgument("Invalid event config"); var Y = O(q, It, function() { for (var re = arguments.length, se = new Array(re); re--; ) se[re] = arguments[re]; Y.subscribers.forEach(function(ne) { K(function() { ne.apply(null, se); }); }); }); } }); } } function ci(h, g) { return E(g).from({ prototype: h }), g; } function di(h, g) { return !(h.filter || h.algorithm || h.or) && (g ? h.justLimit : !h.replayFilter); } function Bl(h, g) { h.filter = Vi(h.filter, g); } function jl(h, g, S) { var C = h.replayFilter; h.replayFilter = C ? function() { return Vi(C(), g()); } : g, h.justLimit = S && !C; } function Go(h, g) { if (h.isPrimKey) return g.primaryKey; var S = g.getIndexByKeyPath(h.index); if (!S) throw new Re.Schema("KeyPath " + h.index + " on object store " + g.name + " is not indexed"); return S; } function $l(h, g, S) { var C = Go(h, g.schema); return g.openCursor({ trans: S, values: !h.keysOnly, reverse: h.dir === "prev", unique: !!h.unique, query: { index: C, range: h.range } }); } function Wo(h, g, S, C) { var N = h.replayFilter ? Vi(h.filter, h.replayFilter()) : h.filter; if (h.or) { var O = {}, U = function(z, W, J) { var ie, q; N && !N(W, J, function(oe) { return W.stop(oe); }, function(oe) { return W.fail(oe); }) || ((q = "" + (ie = W.primaryKey)) == "[object ArrayBuffer]" && (q = "" + new Uint8Array(ie)), v(O, q) || (O[q] = !0, g(z, W, J))); }; return Promise.all([h.or._iterate(U, S), Yo($l(h, C, S), h.algorithm, U, !h.keysOnly && h.valueMapper)]); } return Yo($l(h, C, S), Vi(h.algorithm, N), g, !h.keysOnly && h.valueMapper); } function Yo(h, g, S, C) { var N = Wt(C ? function(O, U, z) { return S(C(O), U, z); } : S); return h.then(function(O) { if (O) return O.start(function() { var U = function() { return O.continue(); }; g && !g(O, function(z) { return U = z; }, function(z) { O.stop(z), U = Je; }, function(z) { O.fail(z), U = Je; }) || N(O.value, O, function(z) { return U = z; }), U(); }); }); } var Gs = (lu.prototype.execute = function(h) { var g = this["@@propmod"]; if (g.add !== void 0) { var S = g.add; if (l(S)) return i(i([], l(h) ? h : [], !0), S).sort(); if (typeof S == "number") return (Number(h) || 0) + S; if (typeof S == "bigint") try { return BigInt(h) + S; } catch { return BigInt(0) + S; } throw new TypeError("Invalid term ".concat(S)); } if (g.remove !== void 0) { var C = g.remove; if (l(C)) return l(h) ? h.filter(function(N) { return !C.includes(N); }).sort() : []; if (typeof C == "number") return Number(h) - C; if (typeof C == "bigint") try { return BigInt(h) - C; } catch { return BigInt(0) - C; } throw new TypeError("Invalid subtrahend ".concat(C)); } return S = (S = g.replacePrefix) === null || S === void 0 ? void 0 : S[0], S && typeof h == "string" && h.startsWith(S) ? g.replacePrefix[1] + h.substring(S.length) : h; }, lu); function lu(h) { this["@@propmod"] = h; } var Kt = (Ut.prototype._read = function(h, g) { var S = this._ctx; return S.error ? S.table._trans(null, vn.bind(null, S.error)) : S.table._trans("readonly", h).then(g); }, Ut.prototype._write = function(h) { var g = this._ctx; return g.error ? g.table._trans(null, vn.bind(null, g.error)) : g.table._trans("readwrite", h, "locked"); }, Ut.prototype._addAlgorithm = function(h) { var g = this._ctx; g.algorithm = Vi(g.algorithm, h); }, Ut.prototype._iterate = function(h, g) { return Wo(this._ctx, h, g, this._ctx.table.core); }, Ut.prototype.clone = function(h) { var g = Object.create(this.constructor.prototype), S = Object.create(this._ctx); return h && f(S, h), g._ctx = S, g; }, Ut.prototype.raw = function() { return this._ctx.valueMapper = null, this; }, Ut.prototype.each = function(h) { var g = this._ctx; return this._read(function(S) { return Wo(g, h, S, g.table.core); }); }, Ut.prototype.count = function(h) { var g = this; return this._read(function(S) { var C = g._ctx, N = C.table.core; if (di(C, !0)) return N.count({ trans: S, query: { index: Go(C, N.schema), range: C.range } }).then(function(U) { return Math.min(U, C.limit); }); var O = 0; return Wo(C, function() { return ++O, !1; }, S, N).then(function() { return O; }); }).then(h); }, Ut.prototype.sortBy = function(h, g) { var S = h.split(".").reverse(), C = S[0], N = S.length - 1; function O(W, J) { return J ? O(W[S[J]], J - 1) : W[C]; } var U = this._ctx.dir === "next" ? 1 : -1; function z(W, J) { return wt(O(W, N), O(J, N)) * U; } return this.toArray(function(W) { return W.sort(z); }).then(g); }, Ut.prototype.toArray = function(h) { var g = this; return this._read(function(S) { var C = g._ctx; if (C.dir === "next" && di(C, !0) && 0 < C.limit) { var N = C.valueMapper, O = Go(C, C.table.core.schema); return C.table.core.query({ trans: S, limit: C.limit, values: !0, query: { index: O, range: C.range } }).then(function(z) { return z = z.result, N ? z.map(N) : z; }); } var U = []; return Wo(C, function(z) { return U.push(z); }, S, C.table.core).then(function() { return U; }); }, h); }, Ut.prototype.offset = function(h) { var g = this._ctx; return h <= 0 || (g.offset += h, di(g) ? jl(g, function() { var S = h; return function(C, N) { return S === 0 || (S === 1 ? --S : N(function() { C.advance(S), S = 0; }), !1); }; }) : jl(g, function() { var S = h; return function() { return --S < 0; }; })), this; }, Ut.prototype.limit = function(h) { return this._ctx.limit = Math.min(this._ctx.limit, h), jl(this._ctx, function() { var g = h; return function(S, C, N) { return --g <= 0 && C(N), 0 <= g; }; }, !0), this; }, Ut.prototype.until = function(h, g) { return Bl(this._ctx, function(S, C, N) { return !h(S.value) || (C(N), g); }), this; }, Ut.prototype.first = function(h) { return this.limit(1).toArray(function(g) { return g[0]; }).then(h); }, Ut.prototype.last = function(h) { return this.reverse().first(h); }, Ut.prototype.filter = function(h) { var g; return Bl(this._ctx, function(S) { return h(S.value); }), (g = this._ctx).isMatch = Vi(g.isMatch, h), this; }, Ut.prototype.and = function(h) { return this.filter(h); }, Ut.prototype.or = function(h) { return new this.db.WhereClause(this._ctx.table, h, this); }, Ut.prototype.reverse = function() { return this._ctx.dir = this._ctx.dir === "prev" ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this; }, Ut.prototype.desc = function() { return this.reverse(); }, Ut.prototype.eachKey = function(h) { var g = this._ctx; return g.keysOnly = !g.isMatch, this.each(function(S, C) { h(C.key, C); }); }, Ut.prototype.eachUniqueKey = function(h) { return this._ctx.unique = "unique", this.eachKey(h); }, Ut.prototype.eachPrimaryKey = function(h) { var g = this._ctx; return g.keysOnly = !g.isMatch, this.each(function(S, C) { h(C.primaryKey, C); }); }, Ut.prototype.keys = function(h) { var g = this._ctx; g.keysOnly = !g.isMatch; var S = []; return this.each(function(C, N) { S.push(N.key); }).then(function() { return S; }).then(h); }, Ut.prototype.primaryKeys = function(h) { var g = this._ctx; if (g.dir === "next" && di(g, !0) && 0 < g.limit) return this._read(function(C) { var N = Go(g, g.table.core.schema); return g.table.core.query({ trans: C, values: !1, limit: g.limit, query: { index: N, range: g.range } }); }).then(function(C) { return C.result; }).then(h); g.keysOnly = !g.isMatch; var S = []; return this.each(function(C, N) { S.push(N.primaryKey); }).then(function() { return S; }).then(h); }, Ut.prototype.uniqueKeys = function(h) { return this._ctx.unique = "unique", this.keys(h); }, Ut.prototype.firstKey = function(h) { return this.limit(1).keys(function(g) { return g[0]; }).then(h); }, Ut.prototype.lastKey = function(h) { return this.reverse().firstKey(h); }, Ut.prototype.distinct = function() { var h = this._ctx, h = h.index && h.table.schema.idxByName[h.index]; if (!h || !h.multi) return this; var g = {}; return Bl(this._ctx, function(N) { var C = N.primaryKey.toString(), N = v(g, C); return g[C] = !0, !N; }), this; }, Ut.prototype.modify = function(h) { var g = this, S = this._ctx; return this._write(function(C) { var N, O, U; U = typeof h == "function" ? h : (N = u(h), O = N.length, function(ne) { for (var fe = !1, ge = 0; ge < O; ++ge) { var ye = N[ge], ke = h[ye], $e = ue(ne, ye); ke instanceof Gs ? (de(ne, ye, ke.execute($e)), fe = !0) : $e !== ke && (de(ne, ye, ke), fe = !0); } return fe; }); var z = S.table.core, q = z.schema.primaryKey, W = q.outbound, J = q.extractKey, ie = 200, q = g.db._options.modifyChunkSize; q && (ie = typeof q == "object" ? q[z.name] || q["*"] || 200 : q); function oe(ne, ye) { var ge = ye.failures, ye = ye.numFailures; re += ne - ye; for (var ke = 0, $e = u(ge); ke < $e.length; ke++) { var We = $e[ke]; Y.push(ge[We]); } } var Y = [], re = 0, se = []; return g.clone().primaryKeys().then(function(ne) { function fe(ye) { var ke = Math.min(ie, ne.length - ye); return z.getMany({ trans: C, keys: ne.slice(ye, ye + ke), cache: "immutable" }).then(function($e) { for (var We = [], Ve = [], qe = W ? [] : null, Qe = [], He = 0; He < ke; ++He) { var et = $e[He], kt = { value: it(et), primKey: ne[ye + He] }; U.call(kt, kt.value, kt) !== !1 && (kt.value == null ? Qe.push(ne[ye + He]) : W || wt(J(et), J(kt.value)) === 0 ? (Ve.push(kt.value), W && qe.push(ne[ye + He])) : (Qe.push(ne[ye + He]), We.push(kt.value))); } return Promise.resolve(0 < We.length && z.mutate({ trans: C, type: "add", values: We }).then(function(Et) { for (var Nt in Et.failures) Qe.splice(parseInt(Nt), 1); oe(We.length, Et); })).then(function() { return (0 < Ve.length || ge && typeof h == "object") && z.mutate({ trans: C, type: "put", keys: qe, values: Ve, criteria: ge, changeSpec: typeof h != "function" && h, isAdditionalChunk: 0 < ye }).then(function(Et) { return oe(Ve.length, Et); }); }).then(function() { return (0 < Qe.length || ge && h === cu) && z.mutate({ trans: C, type: "delete", keys: Qe, criteria: ge, isAdditionalChunk: 0 < ye }).then(function(Et) { return oe(Qe.length, Et); }); }).then(function() { return ne.length > ye + ke && fe(ye + ie); }); }); } var ge = di(S) && S.limit === 1 / 0 && (typeof h != "function" || h === cu) && { index: S.index, range: S.range }; return fe(0).then(function() { if (0 < Y.length) throw new Q("Error modifying one or more objects", Y, re, se); return ne.length; }); }); }); }, Ut.prototype.delete = function() { var h = this._ctx, g = h.range; return di(h) && (h.isPrimKey || g.type === 3) ? this._write(function(S) { var C = h.table.core.schema.primaryKey, N = g; return h.table.core.count({ trans: S, query: { index: C, range: N } }).then(function(O) { return h.table.core.mutate({ trans: S, type: "deleteRange", range: N }).then(function(U) { var z = U.failures; if (U.lastResult, U.results, U = U.numFailures, U) throw new Q("Could not delete some values", Object.keys(z).map(function(W) { return z[W]; }), O - U); return O - U; }); }); }) : this.modify(cu); }, Ut); function Ut() { } var cu = function(h, g) { return g.value = null; }; function Vl(h, g) { return h < g ? -1 : h === g ? 0 : 1; } function jd(h, g) { return g < h ? -1 : h === g ? 0 : 1; } function Yn(h, g, S) { return h = h instanceof hi ? new h.Collection(h) : h, h._ctx.error = new (S || TypeError)(g), h; } function ho(h) { return new h.Collection(h, function() { return fi(""); }).limit(0); } function Qo(h, g, S, C) { var N, O, U, z, W, J, ie, q = S.length; if (!S.every(function(re) { return typeof re == "string"; })) return Yn(h, Fd); function oe(re) { N = re === "next" ? function(ne) { return ne.toUpperCase(); } : function(ne) { return ne.toLowerCase(); }, O = re === "next" ? function(ne) { return ne.toLowerCase(); } : function(ne) { return ne.toUpperCase(); }, U = re === "next" ? Vl : jd; var se = S.map(function(ne) { return { lower: O(ne), upper: N(ne) }; }).sort(function(ne, fe) { return U(ne.lower, fe.lower); }); z = se.map(function(ne) { return ne.upper; }), W = se.map(function(ne) { return ne.lower; }), ie = (J = re) === "next" ? "" : C; } oe("next"), h = new h.Collection(h, function() { return Rr(z[0], W[q - 1] + C); }), h._ondirectionchange = function(re) { oe(re); }; var Y = 0; return h._addAlgorithm(function(re, se, ne) { var fe = re.key; if (typeof fe != "string") return !1; var ge = O(fe); if (g(ge, W, Y)) return !0; for (var ye = null, ke = Y; ke < q; ++ke) { var $e = function(We, Ve, qe, Qe, He, et) { for (var kt = Math.min(We.length, Qe.length), Et = -1, Nt = 0; Nt < kt; ++Nt) { var Jn = Ve[Nt]; if (Jn !== Qe[Nt]) return He(We[Nt], qe[Nt]) < 0 ? We.substr(0, Nt) + qe[Nt] + qe.substr(Nt + 1) : He(We[Nt], Qe[Nt]) < 0 ? We.substr(0, Nt) + Qe[Nt] + qe.substr(Nt + 1) : 0 <= Et ? We.substr(0, Et) + Ve[Et] + qe.substr(Et + 1) : null; He(We[Nt], Jn) < 0 && (Et = Nt); } return kt < Qe.length && et === "next" ? We + qe.substr(We.length) : kt < We.length && et === "prev" ? We.substr(0, qe.length) : Et < 0 ? null : We.substr(0, Et) + Qe[Et] + qe.substr(Et + 1); }(fe, ge, z[ke], W[ke], U, J); $e === null && ye === null ? Y = ke + 1 : (ye === null || 0 < U(ye, $e)) && (ye = $e); } return se(ye !== null ? function() { re.continue(ye + ie); } : ne), !1; }), h; } function Rr(h, g, S, C) { return { type: 2, lower: h, upper: g, lowerOpen: S, upperOpen: C }; } function fi(h) { return { type: 1, lower: h, upper: h }; } var hi = (Object.defineProperty(nn.prototype, "Collection", { get: function() { return this._ctx.table.db.Collection; }, enumerable: !1, configurable: !0 }), nn.prototype.between = function(h, g, S, C) { S = S !== !1, C = C === !0; try { return 0 < this._cmp(h, g) || this._cmp(h, g) === 0 && (S || C) && (!S || !C) ? ho(this) : new this.Collection(this, function() { return Rr(h, g, !S, !C); }); } catch { return Yn(this, Ht); } }, nn.prototype.equals = function(h) { return h == null ? Yn(this, Ht) : new this.Collection(this, function() { return fi(h); }); }, nn.prototype.above = function(h) { return h == null ? Yn(this, Ht) : new this.Collection(this, function() { return Rr(h, void 0, !0); }); }, nn.prototype.aboveOrEqual = function(h) { return h == null ? Yn(this, Ht) : new this.Collection(this, function() { return Rr(h, void 0, !1); }); }, nn.prototype.below = function(h) { return h == null ? Yn(this, Ht) : new this.Collection(this, function() { return Rr(void 0, h, !1, !0); }); }, nn.prototype.belowOrEqual = function(h) { return h == null ? Yn(this, Ht) : new this.Collection(this, function() { return Rr(void 0, h); }); }, nn.prototype.startsWith = function(h) { return typeof h != "string" ? Yn(this, Fd) : this.between(h, h + fo, !0, !0); }, nn.prototype.startsWithIgnoreCase = function(h) { return h === "" ? this.startsWith(h) : Qo(this, function(g, S) { return g.indexOf(S[0]) === 0; }, [h], fo); }, nn.prototype.equalsIgnoreCase = function(h) { return Qo(this, function(g, S) { return g === S[0]; }, [h], ""); }, nn.prototype.anyOfIgnoreCase = function() { var h = B.apply(Ee, arguments); return h.length === 0 ? ho(this) : Qo(this, function(g, S) { return S.indexOf(g) !== -1; }, h, ""); }, nn.prototype.startsWithAnyOfIgnoreCase = function() { var h = B.apply(Ee, arguments); return h.length === 0 ? ho(this) : Qo(this, function(g, S) { return S.some(function(C) { return g.indexOf(C) === 0; }); }, h, fo); }, nn.prototype.anyOf = function() { var h = this, g = B.apply(Ee, arguments), S = this._cmp; try { g.sort(S); } catch { return Yn(this, Ht); } if (g.length === 0) return ho(this); var C = new this.Collection(this, function() { return Rr(g[0], g[g.length - 1]); }); C._ondirectionchange = function(O) { S = O === "next" ? h._ascending : h._descending, g.sort(S); }; var N = 0; return C._addAlgorithm(function(O, U, z) { for (var W = O.key; 0 < S(W, g[N]); ) if (++N === g.length) return U(z), !1; return S(W, g[N]) === 0 || (U(function() { O.continue(g[N]); }), !1); }), C; }, nn.prototype.notEqual = function(h) { return this.inAnyRange([[-1 / 0, h], [h, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 }); }, nn.prototype.noneOf = function() { var h = B.apply(Ee, arguments); if (h.length === 0) return new this.Collection(this); try { h.sort(this._ascending); } catch { return Yn(this, Ht); } var g = h.reduce(function(S, C) { return S ? S.concat([[S[S.length - 1][1], C]]) : [[-1 / 0, C]]; }, null); return g.push([h[h.length - 1], this.db._maxKey]), this.inAnyRange(g, { includeLowers: !1, includeUppers: !1 }); }, nn.prototype.inAnyRange = function(fe, g) { var S = this, C = this._cmp, N = this._ascending, O = this._descending, U = this._min, z = this._max; if (fe.length === 0) return ho(this); if (!fe.every(function(ge) { return ge[0] !== void 0 && ge[1] !== void 0 && N(ge[0], ge[1]) <= 0; })) return Yn(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", Re.InvalidArgument); var W = !g || g.includeLowers !== !1, J = g && g.includeUppers === !0, ie, q = N; function oe(ge, ye) { return q(ge[0], ye[0]); } try { (ie = fe.reduce(function(ge, ye) { for (var ke = 0, $e = ge.length; ke < $e; ++ke) { var We = ge[ke]; if (C(ye[0], We[1]) < 0 && 0 < C(ye[1], We[0])) { We[0] = U(We[0], ye[0]), We[1] = z(We[1], ye[1]); break; } } return ke === $e && ge.push(ye), ge; }, [])).sort(oe); } catch { return Yn(this, Ht); } var Y = 0, re = J ? function(ge) { return 0 < N(ge, ie[Y][1]); } : function(ge) { return 0 <= N(ge, ie[Y][1]); }, se = W ? function(ge) { return 0 < O(ge, ie[Y][0]); } : function(ge) { return 0 <= O(ge, ie[Y][0]); }, ne = re, fe = new this.Collection(this, function() { return Rr(ie[0][0], ie[ie.length - 1][1], !W, !J); }); return fe._ondirectionchange = function(ge) { q = ge === "next" ? (ne = re, N) : (ne = se, O), ie.sort(oe); }, fe._addAlgorithm(function(ge, ye, ke) { for (var $e, We = ge.key; ne(We); ) if (++Y === ie.length) return ye(ke), !1; return !re($e = We) && !se($e) || (S._cmp(We, ie[Y][1]) === 0 || S._cmp(We, ie[Y][0]) === 0 || ye(function() { q === N ? ge.continue(ie[Y][0]) : ge.continue(ie[Y][1]); }), !1); }), fe; }, nn.prototype.startsWithAnyOf = function() { var h = B.apply(Ee, arguments); return h.every(function(g) { return typeof g == "string"; }) ? h.length === 0 ? ho(this) : this.inAnyRange(h.map(function(g) { return [g, g + fo]; })) : Yn(this, "startsWithAnyOf() only works with strings"); }, nn); function nn() { } function Qn(h) { return Wt(function(g) { return pi(g), h(g.target.error), !1; }); } function pi(h) { h.stopPropagation && h.stopPropagation(), h.preventDefault && h.preventDefault(); } var fr = "storagemutated", zl = "x-storagemutated-1", mi = zi(null, fr), Ws = (Kr.prototype._lock = function() { return j(!ut.global), ++this._reculock, this._reculock !== 1 || ut.global || (ut.lockOwnerFor = this), this; }, Kr.prototype._unlock = function() { if (j(!ut.global), --this._reculock == 0) for (ut.global || (ut.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) { var h = this._blockedFuncs.shift(); try { ji(h[1], h[0]); } catch { } } return this; }, Kr.prototype._locked = function() { return this._reculock && ut.lockOwnerFor !== this; }, Kr.prototype.create = function(h) { var g = this; if (!this.mode) return this; var S = this.db.idbdb, C = this.db._state.dbOpenError; if (j(!this.idbtrans), !h && !S) switch (C && C.name) { case "DatabaseClosedError": throw new Re.DatabaseClosed(C); case "MissingAPIError": throw new Re.MissingAPI(C.message, C); default: throw new Re.OpenFailed(C); } if (!this.active) throw new Re.TransactionInactive(); return j(this._completion._state === null), (h = this.idbtrans = h || (this.db.core || S).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = Wt(function(N) { pi(N), g._reject(h.error); }), h.onabort = Wt(function(N) { pi(N), g.active && g._reject(new Re.Abort(h.error)), g.active = !1, g.on("abort").fire(N); }), h.oncomplete = Wt(function() { g.active = !1, g._resolve(), "mutatedParts" in h && mi.storagemutated.fire(h.mutatedParts); }), this; }, Kr.prototype._promise = function(h, g, S) { var C = this; if (h === "readwrite" && this.mode !== "readwrite") return vn(new Re.ReadOnly("Transaction is readonly")); if (!this.active) return vn(new Re.TransactionInactive()); if (this._locked()) return new Xe(function(O, U) { C._blockedFuncs.push([function() { C._promise(h, g, S).then(O, U); }, ut]); }); if (S) return Mi(function() { var O = new Xe(function(U, z) { C._lock(); var W = g(U, z, C); W && W.then && W.then(U, z); }); return O.finally(function() { return C._unlock(); }), O._lib = !0, O; }); var N = new Xe(function(O, U) { var z = g(O, U, C); z && z.then && z.then(O, U); }); return N._lib = !0, N; }, Kr.prototype._root = function() { return this.parent ? this.parent._root() : this; }, Kr.prototype.waitFor = function(h) { var g, S = this._root(), C = Xe.resolve(h); S._waitingFor ? S._waitingFor = S._waitingFor.then(function() { return C; }) : (S._waitingFor = C, S._waitingQueue = [], g = S.idbtrans.objectStore(S.storeNames[0]), function O() { for (++S._spinCount; S._waitingQueue.length; ) S._waitingQueue.shift()(); S._waitingFor && (g.get(-1 / 0).onsuccess = O); }()); var N = S._waitingFor; return new Xe(function(O, U) { C.then(function(z) { return S._waitingQueue.push(Wt(O.bind(null, z))); }, function(z) { return S._waitingQueue.push(Wt(U.bind(null, z))); }).finally(function() { S._waitingFor === N && (S._waitingFor = null); }); }); }, Kr.prototype.abort = function() { this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new Re.Abort())); }, Kr.prototype.table = function(h) { var g = this._memoizedTables || (this._memoizedTables = {}); if (v(g, h)) return g[h]; var S = this.schema[h]; if (!S) throw new Re.NotFound("Table " + h + " not part of transaction"); return S = new this.db.Table(h, S, this), S.core = this.db.core.table(h), g[h] = S; }, Kr); function Kr() { } function du(h, g, S, C, N, O, U) { return { name: h, keyPath: g, unique: S, multi: C, auto: N, compound: O, src: (S && !U ? "&" : "") + (C ? "*" : "") + (N ? "++" : "") + Ys(g) }; } function Ys(h) { return typeof h == "string" ? h : h ? "[" + [].join.call(h, "+") + "]" : ""; } function fu(h, g, S) { return { name: h, primKey: g, indexes: S, mappedClass: null, idxByName: (C = function(N) { return [N.name, N]; }, S.reduce(function(N, O, U) { return U = C(O, U), U && (N[U[0]] = U[1]), N; }, {})) }; var C; } var Qs = function(h) { try { return h.only([[]]), Qs = function() { return [[]]; }, [[]]; } catch { return Qs = function() { return fo; }, fo; } }; function po(h) { return h == null ? function() { } : typeof h == "string" ? (g = h).split(".").length === 1 ? function(S) { return S[g]; } : function(S) { return ue(S, g); } : function(S) { return ue(S, h); }; var g; } function Jo(h) { return [].slice.call(h); } var Xo = 0; function qi(h) { return h == null ? ":id" : typeof h == "string" ? h : "[".concat(h.join("+"), "]"); } function Kp(h, g, W) { function C(ne) { if (ne.type === 3) return null; if (ne.type === 4) throw new Error("Cannot convert never type to IDBKeyRange"); var Y = ne.lower, re = ne.upper, se = ne.lowerOpen, ne = ne.upperOpen; return Y === void 0 ? re === void 0 ? null : g.upperBound(re, !!ne) : re === void 0 ? g.lowerBound(Y, !!se) : g.bound(Y, re, !!se, !!ne); } function N(oe) { var Y, re = oe.name; return { name: re, schema: oe, mutate: function(se) { var ne = se.trans, fe = se.type, ge = se.keys, ye = se.values, ke = se.range; return new Promise(function($e, We) { $e = Wt($e); var Ve = ne.objectStore(re), qe = Ve.keyPath == null, Qe = fe === "put" || fe === "add"; if (!Qe && fe !== "delete" && fe !== "deleteRange") throw new Error("Invalid operation type: " + fe); var He, et = (ge || ye || { length: 1 }).length; if (ge && ye && ge.length !== ye.length) throw new Error("Given keys array must have same length as given values array."); if (et === 0) return $e({ numFailures: 0, failures: {}, results: [], lastResult: void 0 }); function kt(mn) { ++Jn, pi(mn); } var Et = [], Nt = [], Jn = 0; if (fe === "deleteRange") { if (ke.type === 4) return $e({ numFailures: Jn, failures: Nt, results: [], lastResult: void 0 }); ke.type === 3 ? Et.push(He = Ve.clear()) : Et.push(He = Ve.delete(C(ke))); } else { var qe = Qe ? qe ? [ye, ge] : [ye, null] : [ge, null], bt = qe[0], Rn = qe[1]; if (Qe) for (var On = 0; On < et; ++On) Et.push(He = Rn && Rn[On] !== void 0 ? Ve[fe](bt[On], Rn[On]) : Ve[fe](bt[On])), He.onerror = kt; else for (On = 0; On < et; ++On) Et.push(He = Ve[fe](bt[On])), He.onerror = kt; } function sa(mn) { mn = mn.target.result, Et.forEach(function(gi, aa) { return gi.error != null && (Nt[aa] = gi.error); }), $e({ numFailures: Jn, failures: Nt, results: fe === "delete" ? ge : Et.map(function(gi) { return gi.result; }), lastResult: mn }); } He.onerror = function(mn) { kt(mn), sa(mn); }, He.onsuccess = sa; }); }, getMany: function(se) { var ne = se.trans, fe = se.keys; return new Promise(function(ge, ye) { ge = Wt(ge); for (var ke, $e = ne.objectStore(re), We = fe.length, Ve = new Array(We), qe = 0, Qe = 0, He = function(Et) { Et = Et.target, Ve[Et._pos] = Et.result, ++Qe === qe && ge(Ve); }, et = Qn(ye), kt = 0; kt < We; ++kt) fe[kt] != null && ((ke = $e.get(fe[kt]))._pos = kt, ke.onsuccess = He, ke.onerror = et, ++qe); qe === 0 && ge(Ve); }); }, get: function(se) { var ne = se.trans, fe = se.key; return new Promise(function(ge, ye) { ge = Wt(ge); var ke = ne.objectStore(re).get(fe); ke.onsuccess = function($e) { return ge($e.target.result); }, ke.onerror = Qn(ye); }); }, query: (Y = J, function(se) { return new Promise(function(ne, fe) { ne = Wt(ne); var ge, ye, ke, qe = se.trans, $e = se.values, We = se.limit, He = se.query, Ve = We === 1 / 0 ? void 0 : We, Qe = He.index, He = He.range, qe = qe.objectStore(re), Qe = Qe.isPrimaryKey ? qe : qe.index(Qe.name), He = C(He); if (We === 0) return ne({ result: [] }); Y ? ((Ve = $e ? Qe.getAll(He, Ve) : Qe.getAllKeys(He, Ve)).onsuccess = function(et) { return ne({ result: et.target.result }); }, Ve.onerror = Qn(fe)) : (ge = 0, ye = !$e && "openKeyCursor" in Qe ? Qe.openKeyCursor(He) : Qe.openCursor(He), ke = [], ye.onsuccess = function(et) { var kt = ye.result; return kt ? (ke.push($e ? kt.value : kt.primaryKey), ++ge === We ? ne({ result: ke }) : void kt.continue()) : ne({ result: ke }); }, ye.onerror = Qn(fe)); }); }), openCursor: function(se) { var ne = se.trans, fe = se.values, ge = se.query, ye = se.reverse, ke = se.unique; return new Promise(function($e, We) { $e = Wt($e); var Qe = ge.index, Ve = ge.range, qe = ne.objectStore(re), qe = Qe.isPrimaryKey ? qe : qe.index(Qe.name), Qe = ye ? ke ? "prevunique" : "prev" : ke ? "nextunique" : "next", He = !fe && "openKeyCursor" in qe ? qe.openKeyCursor(C(Ve), Qe) : qe.openCursor(C(Ve), Qe); He.onerror = Qn(We), He.onsuccess = Wt(function(et) { var kt, Et, Nt, Jn, bt = He.result; bt ? (bt.___id = ++Xo, bt.done = !1, kt = bt.continue.bind(bt), Et = (Et = bt.continuePrimaryKey) && Et.bind(bt), Nt = bt.advance.bind(bt), Jn = function() { throw new Error("Cursor not stopped"); }, bt.trans = ne, bt.stop = bt.continue = bt.continuePrimaryKey = bt.advance = function() { throw new Error("Cursor not started"); }, bt.fail = Wt(We), bt.next = function() { var Rn = this, On = 1; return this.start(function() { return On-- ? Rn.continue() : Rn.stop(); }).then(function() { return Rn; }); }, bt.start = function(Rn) { function On() { if (He.result) try { Rn(); } catch (mn) { bt.fail(mn); } else bt.done = !0, bt.start = function() { throw new Error("Cursor behind last entry"); }, bt.stop(); } var sa = new Promise(function(mn, gi) { mn = Wt(mn), He.onerror = Qn(gi), bt.fail = gi, bt.stop = function(aa) { bt.stop = bt.continue = bt.continuePrimaryKey = bt.advance = Jn, mn(aa); }; }); return He.onsuccess = Wt(function(mn) { He.onsuccess = On, On(); }), bt.continue = kt, bt.continuePrimaryKey = Et, bt.advance = Nt, On(), sa; }, $e(bt)) : $e(null); }, We); }); }, count: function(se) { var ne = se.query, fe = se.trans, ge = ne.index, ye = ne.range; return new Promise(function(ke, $e) { var We = fe.objectStore(re), Ve = ge.isPrimaryKey ? We : We.index(ge.name), We = C(ye), Ve = We ? Ve.count(We) : Ve.count(); Ve.onsuccess = Wt(function(qe) { return ke(qe.target.result); }), Ve.onerror = Qn($e); }); } }; } var O, U, z, ie = (U = W, z = Jo((O = h).objectStoreNames), { schema: { name: O.name, tables: z.map(function(oe) { return U.objectStore(oe); }).map(function(oe) { var Y = oe.keyPath, ne = oe.autoIncrement, re = l(Y), se = {}, ne = { name: oe.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: Y == null, compound: re, keyPath: Y, autoIncrement: ne, unique: !0, extractKey: po(Y) }, indexes: Jo(oe.indexNames).map(function(fe) { return oe.index(fe); }).map(function(ke) { var ge = ke.name, ye = ke.unique, $e = ke.multiEntry, ke = ke.keyPath, $e = { name: ge, compound: l(ke), keyPath: ke, unique: ye, multiEntry: $e, extractKey: po(ke) }; return se[qi(ke)] = $e; }), getIndexByKeyPath: function(fe) { return se[qi(fe)]; } }; return se[":id"] = ne.primaryKey, Y != null && (se[qi(Y)] = ne.primaryKey), ne; }) }, hasGetAll: 0 < z.length && "getAll" in U.objectStore(z[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), W = ie.schema, J = ie.hasGetAll, ie = W.tables.map(N), q = {}; return ie.forEach(function(oe) { return q[oe.name] = oe; }), { stack: "dbcore", transaction: h.transaction.bind(h), table: function(oe) { if (!q[oe]) throw new Error("Table '".concat(oe, "' not found")); return q[oe]; }, MIN_KEY: -1 / 0, MAX_KEY: Qs(g), schema: W }; } function Gp(h, g, S, C) { var N = S.IDBKeyRange; return S.indexedDB, { dbcore: (C = Kp(g, N, C), h.dbcore.reduce(function(O, U) { return U = U.create, r(r({}, O), U(O)); }, C)) }; } function Zo(h, C) { var S = C.db, C = Gp(h._middlewares, S, h._deps, C); h.core = C.dbcore, h.tables.forEach(function(N) { var O = N.name; h.core.schema.tables.some(function(U) { return U.name === O; }) && (N.core = h.core.table(O), h[O] instanceof h.Table && (h[O].core = N.core)); }); } function mo(h, g, S, C) { S.forEach(function(N) { var O = C[N]; g.forEach(function(U) { var z = function W(J, ie) { return T(J, ie) || (J = d(J)) && W(J, ie); }(U, N); (!z || "value" in z && z.value === void 0) && (U === h.Transaction.prototype || U instanceof h.Transaction ? A(U, N, { get: function() { return this.table(N); }, set: function(W) { k(this, N, { value: W, writable: !0, configurable: !0, enumerable: !0 }); } }) : U[N] = new h.Table(N, O)); }); }); } function Js(h, g) { g.forEach(function(S) { for (var C in S) S[C] instanceof h.Table && delete S[C]; }); } function $d(h, g) { return h._cfg.version - g._cfg.version; } function Hi(h, g, S, C) { var N = h._dbSchema; S.objectStoreNames.contains("$meta") && !N.$meta && (N.$meta = fu("$meta", vo("")[0], []), h._storeNames.push("$meta")); var O = h._createTransaction("readwrite", h._storeNames, N); O.create(S), O._completion.catch(C); var U = O._reject.bind(O), z = ut.transless || ut; Mi(function() { return ut.trans = O, ut.transless = z, g !== 0 ? (Zo(h, S), J = g, ((W = O).storeNames.includes("$meta") ? W.table("$meta").get("version").then(function(ie) { return ie ?? J; }) : Xe.resolve(J)).then(function(ie) { return oe = ie, Y = O, re = S, se = [], ie = (q = h)._versions, ne = q._dbSchema = Zs(0, q.idbdb, re), (ie = ie.filter(function(fe) { return fe._cfg.version >= oe; })).length !== 0 ? (ie.forEach(function(fe) { se.push(function() { var ge = ne, ye = fe._cfg.dbschema; Fn(q, ge, re), Fn(q, ye, re), ne = q._dbSchema = ye; var ke = es(ge, ye); ke.add.forEach(function(Qe) { hu(re, Qe[0], Qe[1].primKey, Qe[1].indexes); }), ke.change.forEach(function(Qe) { if (Qe.recreate) throw new Re.Upgrade("Not yet support for changing primary key"); var He = re.objectStore(Qe.name); Qe.add.forEach(function(et) { return go(He, et); }), Qe.change.forEach(function(et) { He.deleteIndex(et.name), go(He, et); }), Qe.del.forEach(function(et) { return He.deleteIndex(et); }); }); var $e = fe._cfg.contentUpgrade; if ($e && fe._cfg.version > oe) { Zo(q, re), Y._memoizedTables = {}; var We = H(ye); ke.del.forEach(function(Qe) { We[Qe] = ge[Qe]; }), Js(q, [q.Transaction.prototype]), mo(q, [q.Transaction.prototype], u(We), We), Y.schema = We; var Ve, qe = M($e); return qe && Ho(), ke = Xe.follow(function() { var Qe; (Ve = $e(Y)) && qe && (Qe = Wn.bind(null, null), Ve.then(Qe, Qe)); }), Ve && typeof Ve.then == "function" ? Xe.resolve(Ve) : ke.then(function() { return Ve; }); } }), se.push(function(ge) { var ye, ke, $e = fe._cfg.dbschema; ye = $e, ke = ge, [].slice.call(ke.db.objectStoreNames).forEach(function(We) { return ye[We] == null && ke.db.deleteObjectStore(We); }), Js(q, [q.Transaction.prototype]), mo(q, [q.Transaction.prototype], q._storeNames, q._dbSchema), Y.schema = q._dbSchema; }), se.push(function(ge) { q.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(q.idbdb.version / 10) === fe._cfg.version ? (q.idbdb.deleteObjectStore("$meta"), delete q._dbSchema.$meta, q._storeNames = q._storeNames.filter(function(ye) { return ye !== "$meta"; })) : ge.objectStore("$meta").put(fe._cfg.version, "version")); }); }), function fe() { return se.length ? Xe.resolve(se.shift()(Y.idbtrans)).then(fe) : Xe.resolve(); }().then(function() { Xs(ne, re); })) : Xe.resolve(); var q, oe, Y, re, se, ne; }).catch(U)) : (u(N).forEach(function(ie) { hu(S, ie, N[ie].primKey, N[ie].indexes); }), Zo(h, S), void Xe.follow(function() { return h.on.populate.fire(O); }).catch(U)); var W, J; }); } function ql(h, g) { Xs(h._dbSchema, g), g.db.version % 10 != 0 || g.objectStoreNames.contains("$meta") || g.db.createObjectStore("$meta").add(Math.ceil(g.db.version / 10 - 1), "version"); var S = Zs(0, h.idbdb, g); Fn(h, h._dbSchema, g); for (var C = 0, N = es(S, h._dbSchema).change; C < N.length; C++) { var O = function(U) { if (U.change.length || U.recreate) return console.warn("Unable to patch indexes of table ".concat(U.name, " because it has changes on the type of index or primary key.")), { value: void 0 }; var z = g.objectStore(U.name); U.add.forEach(function(W) { F && console.debug("Dexie upgrade patch: Creating missing index ".concat(U.name, ".").concat(W.src)), go(z, W); }); }(N[C]); if (typeof O == "object") return O.value; } } function es(h, g) { var S, C = { del: [], add: [], change: [] }; for (S in h) g[S] || C.del.push(S); for (S in g) { var N = h[S], O = g[S]; if (N) { var U = { name: S, def: O, recreate: !1, del: [], add: [], change: [] }; if ("" + (N.primKey.keyPath || "") != "" + (O.primKey.keyPath || "") || N.primKey.auto !== O.primKey.auto) U.recreate = !0, C.change.push(U); else { var z = N.idxByName, W = O.idxByName, J = void 0; for (J in z) W[J] || U.del.push(J); for (J in W) { var ie = z[J], q = W[J]; ie ? ie.src !== q.src && U.change.push(q) : U.add.push(q); } (0 < U.del.length || 0 < U.add.length || 0 < U.change.length) && C.change.push(U); } } else C.add.push([S, O]); } return C; } function hu(h, g, S, C) { var N = h.db.createObjectStore(g, S.keyPath ? { keyPath: S.keyPath, autoIncrement: S.auto } : { autoIncrement: S.auto }); return C.forEach(function(O) { return go(N, O); }), N; } function Xs(h, g) { u(h).forEach(function(S) { g.db.objectStoreNames.contains(S) || (F && console.debug("Dexie: Creating missing table", S), hu(g, S, h[S].primKey, h[S].indexes)); }); } function go(h, g) { h.createIndex(g.name, g.keyPath, { unique: g.unique, multiEntry: g.multi }); } function Zs(h, g, S) { var C = {}; return R(g.objectStoreNames, 0).forEach(function(N) { for (var O = S.objectStore(N), U = du(Ys(J = O.keyPath), J || "", !0, !1, !!O.autoIncrement, J && typeof J != "string", !0), z = [], W = 0; W < O.indexNames.length; ++W) { var ie = O.index(O.indexNames[W]), J = ie.keyPath, ie = du(ie.name, J, !!ie.unique, !!ie.multiEntry, !1, J && typeof J != "string", !1); z.push(ie); } C[N] = fu(N, U, z); }), C; } function Fn(h, g, S) { for (var C = S.db.objectStoreNames, N = 0; N < C.length; ++N) { var O = C[N], U = S.objectStore(O); h._hasGetAll = "getAll" in U; for (var z = 0; z < U.indexNames.length; ++z) { var W = U.indexNames[z], J = U.index(W).keyPath, ie = typeof J == "string" ? J : "[" + R(J).join("+") + "]"; !g[O] || (J = g[O].idxByName[ie]) && (J.name = W, delete g[O].idxByName[ie], g[O].idxByName[W] = J); } } typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && o.WorkerGlobalScope && o instanceof o.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (h._hasGetAll = !1); } function vo(h) { return h.split(",").map(function(g, S) { var C = (g = g.trim()).replace(/([&*]|\+\+)/g, ""), N = /^\[/.test(C) ? C.match(/^\[(.*)\]$/)[1].split("+") : C; return du(C, N || null, /\&/.test(g), /\*/.test(g), /\+\+/.test(g), l(N), S === 0); }); } var Hl = (Ki.prototype._parseStoresSpec = function(h, g) { u(h).forEach(function(S) { if (h[S] !== null) { var C = vo(h[S]), N = C.shift(); if (N.unique = !0, N.multi) throw new Re.Schema("Primary key cannot be multi-valued"); C.forEach(function(O) { if (O.auto) throw new Re.Schema("Only primary key can be marked as autoIncrement (++)"); if (!O.keyPath) throw new Re.Schema("Index must have a name and cannot be an empty string"); }), g[S] = fu(S, N, C); } }); }, Ki.prototype.stores = function(S) { var g = this.db; this._cfg.storesSource = this._cfg.storesSource ? f(this._cfg.storesSource, S) : S; var S = g._versions, C = {}, N = {}; return S.forEach(function(O) { f(C, O._cfg.storesSource), N = O._cfg.dbschema = {}, O._parseStoresSpec(C, N); }), g._dbSchema = N, Js(g, [g._allTables, g, g.Transaction.prototype]), mo(g, [g._allTables, g, g.Transaction.prototype, this._cfg.tables], u(N), N), g._storeNames = u(N), this; }, Ki.prototype.upgrade = function(h) { return this._cfg.contentUpgrade = b(this._cfg.contentUpgrade || Je, h), this; }, Ki); function Ki() { } function Kl(h, g) { var S = h._dbNamesDB; return S || (S = h._dbNamesDB = new Gr(Hs, { addons: [], indexedDB: h, IDBKeyRange: g })).version(1).stores({ dbnames: "name" }), S.table("dbnames"); } function ea(h) { return h && typeof h.databases == "function"; } function ta(h) { return Mi(function() { return ut.letThrough = !0, h(); }); } function yo(h) { return !("from" in h); } var kn = function(h, g) { if (!this) { var S = new kn(); return h && "d" in h && f(S, h), S; } f(this, arguments.length ? { d: 1, from: h, to: 1 < arguments.length ? g : h } : { d: 0 }); }; function ts(h, g, S) { var C = wt(g, S); if (!isNaN(C)) { if (0 < C) throw RangeError(); if (yo(h)) return f(h, { from: g, to: S, d: 1 }); var N = h.l, C = h.r; if (wt(S, h.from) < 0) return N ? ts(N, g, S) : h.l = { from: g, to: S, d: 1, l: null, r: null }, mu(h); if (0 < wt(g, h.to)) return C ? ts(C, g, S) : h.r = { from: g, to: S, d: 1, l: null, r: null }, mu(h); wt(g, h.from) < 0 && (h.from = g, h.l = null, h.d = C ? C.d + 1 : 1), 0 < wt(S, h.to) && (h.to = S, h.r = null, h.d = h.l ? h.l.d + 1 : 1), S = !h.r, N && !h.l && na(h, N), C && S && na(h, C); } } function na(h, g) { yo(g) || function S(C, W) { var O = W.from, U = W.to, z = W.l, W = W.r; ts(C, O, U), z && S(C, z), W && S(C, W); }(h, g); } function Vd(h, g) { var S = pu(g), C = S.next(); if (C.done) return !1; for (var N = C.value, O = pu(h), U = O.next(N.from), z = U.value; !C.done && !U.done; ) { if (wt(z.from, N.to) <= 0 && 0 <= wt(z.to, N.from)) return !0; wt(N.from, z.from) < 0 ? N = (C = S.next(z.from)).value : z = (U = O.next(N.from)).value; } return !1; } function pu(h) { var g = yo(h) ? null : { s: 0, n: h }; return { next: function(S) { for (var C = 0 < arguments.length; g; ) switch (g.s) { case 0: if (g.s = 1, C) for (; g.n.l && wt(S, g.n.from) < 0; ) g = { up: g, n: g.n.l, s: 1 }; else for (; g.n.l; ) g = { up: g, n: g.n.l, s: 1 }; case 1: if (g.s = 2, !C || wt(S, g.n.to) <= 0) return { value: g.n, done: !1 }; case 2: if (g.n.r) { g.s = 3, g = { up: g, n: g.n.r, s: 0 }; continue; } case 3: g = g.up; } return { done: !0 }; } }; } function mu(h) { var g, S, C = (((g = h.r) === null || g === void 0 ? void 0 : g.d) || 0) - (((S = h.l) === null || S === void 0 ? void 0 : S.d) || 0), N = 1 < C ? "r" : C < -1 ? "l" : ""; N && (g = N == "r" ? "l" : "r", S = r({}, h), C = h[N], h.from = C.from, h.to = C.to, h[N] = C[N], S[N] = C[g], (h[g] = S).d = zd(S)), h.d = zd(h); } function zd(S) { var g = S.r, S = S.l; return (g ? S ? Math.max(g.d, S.d) : g.d : S ? S.d : 0) + 1; } function gu(h, g) { return u(g).forEach(function(S) { h[S] ? na(h[S], g[S]) : h[S] = function C(N) { var O, U, z = {}; for (O in N) v(N, O) && (U = N[O], z[O] = !U || typeof U != "object" || we.has(U.constructor) ? U : C(U)); return z; }(g[S]); }), h; } function Gl(h, g) { return h.all || g.all || Object.keys(h).some(function(S) { return g[S] && Vd(g[S], h[S]); }); } y(kn.prototype, ((hr = { add: function(h) { return na(this, h), this; }, addKey: function(h) { return ts(this, h, h), this; }, addKeys: function(h) { var g = this; return h.forEach(function(S) { return ts(g, S, S); }), this; }, hasKey: function(h) { var g = pu(this).next(h).value; return g && wt(g.from, h) <= 0 && 0 <= wt(g.to, h); } })[be] = function() { return pu(this); }, hr)); var wo = {}, Wl = {}, vu = !1; function yu(h) { gu(Wl, h), vu || (vu = !0, setTimeout(function() { vu = !1, Yl(Wl, !(Wl = {})); }, 0)); } function Yl(h, g) { g === void 0 && (g = !1); var S = /* @__PURE__ */ new Set(); if (h.all) for (var C = 0, N = Object.values(wo); C < N.length; C++) qd(U = N[C], h, S, g); else for (var O in h) { var U, z = /^idb\:\/\/(.*)\/(.*)\//.exec(O); z && (O = z[1], z = z[2], (U = wo["idb://".concat(O, "/").concat(z)]) && qd(U, h, S, g)); } S.forEach(function(W) { return W(); }); } function qd(h, g, S, C) { for (var N = [], O = 0, U = Object.entries(h.queries.query); O < U.length; O++) { for (var z = U[O], W = z[0], J = [], ie = 0, q = z[1]; ie < q.length; ie++) { var oe = q[ie]; Gl(g, oe.obsSet) ? oe.subscribers.forEach(function(ne) { return S.add(ne); }) : C && J.push(oe); } C && N.push([W, J]); } if (C) for (var Y = 0, re = N; Y < re.length; Y++) { var se = re[Y], W = se[0], J = se[1]; h.queries.query[W] = J; } } function Wp(h) { var g = h._state, S = h._deps.indexedDB; if (g.isBeingOpened || h.idbdb) return g.dbReadyPromise.then(function() { return g.dbOpenError ? vn(g.dbOpenError) : h; }); g.isBeingOpened = !0, g.dbOpenError = null, g.openComplete = !1; var C = g.openCanceller, N = Math.round(10 * h.verno), O = !1; function U() { if (g.openCanceller !== C) throw new Re.DatabaseClosed("db.open() was cancelled"); } function z() { return new Xe(function(oe, Y) { if (U(), !S) throw new Re.MissingAPI(); var re = h.name, se = g.autoSchema || !N ? S.open(re) : S.open(re, N); if (!se) throw new Re.MissingAPI(); se.onerror = Qn(Y), se.onblocked = Wt(h._fireOnBlocked), se.onupgradeneeded = Wt(function(ne) { var fe; ie = se.transaction, g.autoSchema && !h._options.allowEmptyDB ? (se.onerror = pi, ie.abort(), se.result.close(), (fe = S.deleteDatabase(re)).onsuccess = fe.onerror = Wt(function() { Y(new Re.NoSuchDatabase("Database ".concat(re, " doesnt exist"))); })) : (ie.onerror = Qn(Y), ne = ne.oldVersion > Math.pow(2, 62) ? 0 : ne.oldVersion, q = ne < 1, h.idbdb = se.result, O && ql(h, ie), Hi(h, ne / 10, ie, Y)); }, Y), se.onsuccess = Wt(function() { ie = null; var ne, fe, ge, ye, ke, $e = h.idbdb = se.result, We = R($e.objectStoreNames); if (0 < We.length) try { var Ve = $e.transaction((ye = We).length === 1 ? ye[0] : ye, "readonly"); if (g.autoSchema) fe = $e, ge = Ve, (ne = h).verno = fe.version / 10, ge = ne._dbSchema = Zs(0, fe, ge), ne._storeNames = R(fe.objectStoreNames, 0), mo(ne, [ne._allTables], u(ge), ge); else if (Fn(h, h._dbSchema, Ve), ((ke = es(Zs(0, (ke = h).idbdb, Ve), ke._dbSchema)).add.length || ke.change.some(function(qe) { return qe.add.length || qe.change.length; })) && !O) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), $e.close(), N = $e.version + 1, O = !0, oe(z()); Zo(h, Ve); } catch { } $i.push(h), $e.onversionchange = Wt(function(qe) { g.vcFired = !0, h.on("versionchange").fire(qe); }), $e.onclose = Wt(function(qe) { h.on("close").fire(qe); }), q && (ke = h._deps, Ve = re, $e = ke.indexedDB, ke = ke.IDBKeyRange, ea($e) || Ve === Hs || Kl($e, ke).put({ name: Ve }).catch(Je)), oe(); }, Y); }).catch(function(oe) { switch (oe?.name) { case "UnknownError": if (0 < g.PR1398_maxLoop) return g.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"), z(); break; case "VersionError": if (0 < N) return N = 0, z(); } return Xe.reject(oe); }); } var W, J = g.dbReadyResolve, ie = null, q = !1; return Xe.race([C, (typeof navigator > "u" ? Xe.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(oe) { function Y() { return indexedDB.databases().finally(oe); } W = setInterval(Y, 100), Y(); }).finally(function() { return clearInterval(W); }) : Promise.resolve()).then(z)]).then(function() { return U(), g.onReadyBeingFired = [], Xe.resolve(ta(function() { return h.on.ready.fire(h.vip); })).then(function oe() { if (0 < g.onReadyBeingFired.length) { var Y = g.onReadyBeingFired.reduce(b, Je); return g.onReadyBeingFired = [], Xe.resolve(ta(function() { return Y(h.vip); })).then(oe); } }); }).finally(function() { g.openCanceller === C && (g.onReadyBeingFired = null, g.isBeingOpened = !1); }).catch(function(oe) { g.dbOpenError = oe; try { ie && ie.abort(); } catch { } return C === g.openCanceller && h._close(), vn(oe); }).finally(function() { g.openComplete = !0, J(); }).then(function() { var oe; return q && (oe = {}, h.tables.forEach(function(Y) { Y.schema.indexes.forEach(function(re) { re.name && (oe["idb://".concat(h.name, "/").concat(Y.name, "/").concat(re.name)] = new kn(-1 / 0, [[[]]])); }), oe["idb://".concat(h.name, "/").concat(Y.name, "/")] = oe["idb://".concat(h.name, "/").concat(Y.name, "/:dels")] = new kn(-1 / 0, [[[]]]); }), mi(fr).fire(oe), Yl(oe, !0)), h; }); } function ra(h) { function g(O) { return h.next(O); } var S = N(g), C = N(function(O) { return h.throw(O); }); function N(O) { return function(W) { var z = O(W), W = z.value; return z.done ? W : W && typeof W.then == "function" ? W.then(S, C) : l(W) ? Promise.all(W).then(S, C) : S(W); }; } return N(g)(); } function wu(h, g, S) { for (var C = l(h) ? h.slice() : [h], N = 0; N < S; ++N) C.push(g); return C; } var Yp = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(h) { return r(r({}, h), { table: function(g) { var S = h.table(g), C = S.schema, N = {}, O = []; function U(q, oe, Y) { var re = qi(q), se = N[re] = N[re] || [], ne = q == null ? 0 : typeof q == "string" ? 1 : q.length, fe = 0 < oe, fe = r(r({}, Y), { name: fe ? "".concat(re, "(virtual-from:").concat(Y.name, ")") : Y.name, lowLevelIndex: Y, isVirtual: fe, keyTail: oe, keyLength: ne, extractKey: po(q), unique: !fe && Y.unique }); return se.push(fe), fe.isPrimaryKey || O.push(fe), 1 < ne && U(ne === 2 ? q[0] : q.slice(0, ne - 1), oe + 1, Y), se.sort(function(ge, ye) { return ge.keyTail - ye.keyTail; }), fe; } g = U(C.primaryKey.keyPath, 0, C.primaryKey), N[":id"] = [g]; for (var z = 0, W = C.indexes; z < W.length; z++) { var J = W[z]; U(J.keyPath, 0, J); } function ie(q) { var oe, Y = q.query.index; return Y.isVirtual ? r(r({}, q), { query: { index: Y.lowLevelIndex, range: (oe = q.query.range, Y = Y.keyTail, { type: oe.type === 1 ? 2 : oe.type, lower: wu(oe.lower, oe.lowerOpen ? h.MAX_KEY : h.MIN_KEY, Y), lowerOpen: !0, upper: wu(oe.upper, oe.upperOpen ? h.MIN_KEY : h.MAX_KEY, Y), upperOpen: !0 }) } }) : q; } return r(r({}, S), { schema: r(r({}, C), { primaryKey: g, indexes: O, getIndexByKeyPath: function(q) { return (q = N[qi(q)]) && q[0]; } }), count: function(q) { return S.count(ie(q)); }, query: function(q) { return S.query(ie(q)); }, openCursor: function(q) { var oe = q.query.index, Y = oe.keyTail, re = oe.isVirtual, se = oe.keyLength; return re ? S.openCursor(ie(q)).then(function(fe) { return fe && ne(fe); }) : S.openCursor(q); function ne(fe) { return Object.create(fe, { continue: { value: function(ge) { ge != null ? fe.continue(wu(ge, q.reverse ? h.MAX_KEY : h.MIN_KEY, Y)) : q.unique ? fe.continue(fe.key.slice(0, se).concat(q.reverse ? h.MIN_KEY : h.MAX_KEY, Y)) : fe.continue(); } }, continuePrimaryKey: { value: function(ge, ye) { fe.continuePrimaryKey(wu(ge, h.MAX_KEY, Y), ye); } }, primaryKey: { get: function() { return fe.primaryKey; } }, key: { get: function() { var ge = fe.key; return se === 1 ? ge[0] : ge.slice(0, se); } }, value: { get: function() { return fe.value; } } }); } } }); } }); } }; function Ql(h, g, S, C) { return S = S || {}, C = C || "", u(h).forEach(function(N) { var O, U, z; v(g, N) ? (O = h[N], U = g[N], typeof O == "object" && typeof U == "object" && O && U ? (z = ae(O)) !== ae(U) ? S[C + N] = g[N] : z === "Object" ? Ql(O, U, S, C + N + ".") : O !== U && (S[C + N] = g[N]) : O !== U && (S[C + N] = g[N])) : S[C + N] = void 0; }), u(g).forEach(function(N) { v(h, N) || (S[C + N] = g[N]); }), S; } function Su(h, g) { return g.type === "delete" ? g.keys : g.keys || g.values.map(h.extractKey); } var Qp = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(h) { return r(r({}, h), { table: function(g) { var S = h.table(g), C = S.schema.primaryKey; return r(r({}, S), { mutate: function(N) { var O = ut.trans, U = O.table(g).hook, z = U.deleting, W = U.creating, J = U.updating; switch (N.type) { case "add": if (W.fire === Je) break; return O._promise("readwrite", function() { return ie(N); }, !0); case "put": if (W.fire === Je && J.fire === Je) break; return O._promise("readwrite", function() { return ie(N); }, !0); case "delete": if (z.fire === Je) break; return O._promise("readwrite", function() { return ie(N); }, !0); case "deleteRange": if (z.fire === Je) break; return O._promise("readwrite", function() { return function q(oe, Y, re) { return S.query({ trans: oe, values: !1, query: { index: C, range: Y }, limit: re }).then(function(se) { var ne = se.result; return ie({ type: "delete", keys: ne, trans: oe }).then(function(fe) { return 0 < fe.numFailures ? Promise.reject(fe.failures[0]) : ne.length < re ? { failures: [], numFailures: 0, lastResult: void 0 } : q(oe, r(r({}, Y), { lower: ne[ne.length - 1], lowerOpen: !0 }), re); }); }); }(N.trans, N.range, 1e4); }, !0); } return S.mutate(N); function ie(q) { var oe, Y, re, se = ut.trans, ne = q.keys || Su(C, q); if (!ne) throw new Error("Keys missing"); return (q = q.type === "add" || q.type === "put" ? r(r({}, q), { keys: ne }) : r({}, q)).type !== "delete" && (q.values = i([], q.values)), q.keys && (q.keys = i([], q.keys)), oe = S, re = ne, ((Y = q).type === "add" ? Promise.resolve([]) : oe.getMany({ trans: Y.trans, keys: re, cache: "immutable" })).then(function(fe) { var ge = ne.map(function(ye, ke) { var $e, We, Ve, qe = fe[ke], Qe = { onerror: null, onsuccess: null }; return q.type === "delete" ? z.fire.call(Qe, ye, qe, se) : q.type === "add" || qe === void 0 ? ($e = W.fire.call(Qe, ye, q.values[ke], se), ye == null && $e != null && (q.keys[ke] = ye = $e, C.outbound || de(q.values[ke], C.keyPath, ye))) : ($e = Ql(qe, q.values[ke]), (We = J.fire.call(Qe, $e, ye, qe, se)) && (Ve = q.values[ke], Object.keys(We).forEach(function(He) { v(Ve, He) ? Ve[He] = We[He] : de(Ve, He, We[He]); }))), Qe; }); return S.mutate(q).then(function(ye) { for (var ke = ye.failures, $e = ye.results, We = ye.numFailures, ye = ye.lastResult, Ve = 0; Ve < ne.length; ++Ve) { var qe = ($e || ne)[Ve], Qe = ge[Ve]; qe == null ? Qe.onerror && Qe.onerror(ke[Ve]) : Qe.onsuccess && Qe.onsuccess(q.type === "put" && fe[Ve] ? q.values[Ve] : qe); } return { failures: ke, results: $e, numFailures: We, lastResult: ye }; }).catch(function(ye) { return ge.forEach(function(ke) { return ke.onerror && ke.onerror(ye); }), Promise.reject(ye); }); }); } } }); } }); } }; function Hd(h, g, S) { try { if (!g || g.keys.length < h.length) return null; for (var C = [], N = 0, O = 0; N < g.keys.length && O < h.length; ++N) wt(g.keys[N], h[O]) === 0 && (C.push(S ? it(g.values[N]) : g.values[N]), ++O); return C.length === h.length ? C : null; } catch { return null; } } var Jp = { stack: "dbcore", level: -1, create: function(h) { return { table: function(g) { var S = h.table(g); return r(r({}, S), { getMany: function(C) { if (!C.cache) return S.getMany(C); var N = Hd(C.keys, C.trans._cache, C.cache === "clone"); return N ? Xe.resolve(N) : S.getMany(C).then(function(O) { return C.trans._cache = { keys: C.keys, values: C.cache === "clone" ? it(O) : O }, O; }); }, mutate: function(C) { return C.type !== "add" && (C.trans._cache = null), S.mutate(C); } }); } }; } }; function Kd(h, g) { return h.trans.mode === "readonly" && !!h.subscr && !h.trans.explicit && h.trans.db._options.cache !== "disabled" && !g.schema.primaryKey.outbound; } function Gd(h, g) { switch (h) { case "query": return g.values && !g.unique; case "get": case "getMany": case "count": case "openCursor": return !1; } } var Xp = { stack: "dbcore", level: 0, name: "Observability", create: function(h) { var g = h.schema.name, S = new kn(h.MIN_KEY, h.MAX_KEY); return r(r({}, h), { transaction: function(C, N, O) { if (ut.subscr && N !== "readonly") throw new Re.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(ut.querier)); return h.transaction(C, N, O); }, table: function(C) { var N = h.table(C), O = N.schema, U = O.primaryKey, q = O.indexes, z = U.extractKey, W = U.outbound, J = U.autoIncrement && q.filter(function(Y) { return Y.compound && Y.keyPath.includes(U.keyPath); }), ie = r(r({}, N), { mutate: function(Y) { function re(He) { return He = "idb://".concat(g, "/").concat(C, "/").concat(He), ye[He] || (ye[He] = new kn()); } var se, ne, fe, ge = Y.trans, ye = Y.mutatedParts || (Y.mutatedParts = {}), ke = re(""), $e = re(":dels"), We = Y.type, Qe = Y.type === "deleteRange" ? [Y.range] : Y.type === "delete" ? [Y.keys] : Y.values.length < 50 ? [Su(U, Y).filter(function(He) { return He; }), Y.values] : [], Ve = Qe[0], qe = Qe[1], Qe = Y.trans._cache; return l(Ve) ? (ke.addKeys(Ve), (Qe = We === "delete" || Ve.length === qe.length ? Hd(Ve, Qe) : null) || $e.addKeys(Ve), (Qe || qe) && (se = re, ne = Qe, fe = qe, O.indexes.forEach(function(He) { var et = se(He.name || ""); function kt(Nt) { return Nt != null ? He.extractKey(Nt) : null; } function Et(Nt) { return He.multiEntry && l(Nt) ? Nt.forEach(function(Jn) { return et.addKey(Jn); }) : et.addKey(Nt); } (ne || fe).forEach(function(Nt, Rn) { var bt = ne && kt(ne[Rn]), Rn = fe && kt(fe[Rn]); wt(bt, Rn) !== 0 && (bt != null && Et(bt), Rn != null && Et(Rn)); }); }))) : Ve ? (qe = { from: (qe = Ve.lower) !== null && qe !== void 0 ? qe : h.MIN_KEY, to: (qe = Ve.upper) !== null && qe !== void 0 ? qe : h.MAX_KEY }, $e.add(qe), ke.add(qe)) : (ke.add(S), $e.add(S), O.indexes.forEach(function(He) { return re(He.name).add(S); })), N.mutate(Y).then(function(He) { return !Ve || Y.type !== "add" && Y.type !== "put" || (ke.addKeys(He.results), J && J.forEach(function(et) { for (var kt = Y.values.map(function(bt) { return et.extractKey(bt); }), Et = et.keyPath.findIndex(function(bt) { return bt === U.keyPath; }), Nt = 0, Jn = He.results.length; Nt < Jn; ++Nt) kt[Nt][Et] = He.results[Nt]; re(et.name).addKeys(kt); })), ge.mutatedParts = gu(ge.mutatedParts || {}, ye), He; }); } }), q = function(re) { var se = re.query, re = se.index, se = se.range; return [re, new kn((re = se.lower) !== null && re !== void 0 ? re : h.MIN_KEY, (se = se.upper) !== null && se !== void 0 ? se : h.MAX_KEY)]; }, oe = { get: function(Y) { return [U, new kn(Y.key)]; }, getMany: function(Y) { return [U, new kn().addKeys(Y.keys)]; }, count: q, query: q, openCursor: q }; return u(oe).forEach(function(Y) { ie[Y] = function(re) { var se = ut.subscr, ne = !!se, fe = Kd(ut, N) && Gd(Y, re) ? re.obsSet = {} : se; if (ne) { var ge = function(qe) { return qe = "idb://".concat(g, "/").concat(C, "/").concat(qe), fe[qe] || (fe[qe] = new kn()); }, ye = ge(""), ke = ge(":dels"), se = oe[Y](re), ne = se[0], se = se[1]; if ((Y === "query" && ne.isPrimaryKey && !re.values ? ke : ge(ne.name || "")).add(se), !ne.isPrimaryKey) { if (Y !== "count") { var $e = Y === "query" && W && re.values && N.query(r(r({}, re), { values: !1 })); return N[Y].apply(this, arguments).then(function(qe) { if (Y === "query") { if (W && re.values) return $e.then(function(kt) { return kt = kt.result, ye.addKeys(kt), qe; }); var Qe = re.values ? qe.result.map(z) : qe.result; (re.values ? ye : ke).addKeys(Qe); } else if (Y === "openCursor") { var He = qe, et = re.values; return He && Object.create(He, { key: { get: function() { return ke.addKey(He.primaryKey), He.key; } }, primaryKey: { get: function() { var kt = He.primaryKey; return ke.addKey(kt), kt; } }, value: { get: function() { return et && ye.addKey(He.primaryKey), He.value; } } }); } return qe; }); } ke.add(S); } } return N[Y].apply(this, arguments); }; }), ie; } }); } }; function Wd(h, g, S) { if (S.numFailures === 0) return g; if (g.type === "deleteRange") return null; var C = g.keys ? g.keys.length : "values" in g && g.values ? g.values.length : 1; return S.numFailures === C ? null : (g = r({}, g), l(g.keys) && (g.keys = g.keys.filter(function(N, O) { return !(O in S.failures); })), "values" in g && l(g.values) && (g.values = g.values.filter(function(N, O) { return !(O in S.failures); })), g); } function ia(h, g) { return S = h, ((C = g).lower === void 0 || (C.lowerOpen ? 0 < wt(S, C.lower) : 0 <= wt(S, C.lower))) && (h = h, (g = g).upper === void 0 || (g.upperOpen ? wt(h, g.upper) < 0 : wt(h, g.upper) <= 0)); var S, C; } function ns(h, g, oe, C, N, O) { if (!oe || oe.length === 0) return h; var U = g.query.index, z = U.multiEntry, W = g.query.range, J = C.schema.primaryKey.extractKey, ie = U.extractKey, q = (U.lowLevelIndex || U).extractKey, oe = oe.reduce(function(Y, re) { var se = Y, ne = []; if (re.type === "add" || re.type === "put") for (var fe = new kn(), ge = re.values.length - 1; 0 <= ge; --ge) { var ye, ke = re.values[ge], $e = J(ke); fe.hasKey($e) || (ye = ie(ke), (z && l(ye) ? ye.some(function(He) { return ia(He, W); }) : ia(ye, W)) && (fe.addKey($e), ne.push(ke))); } switch (re.type) { case "add": var We = new kn().addKeys(g.values ? Y.map(function(et) { return J(et); }) : Y), se = Y.concat(g.values ? ne.filter(function(et) { return et = J(et), !We.hasKey(et) && (We.addKey(et), !0); }) : ne.map(function(et) { return J(et); }).filter(function(et) { return !We.hasKey(et) && (We.addKey(et), !0); })); break; case "put": var Ve = new kn().addKeys(re.values.map(function(et) { return J(et); })); se = Y.filter(function(et) { return !Ve.hasKey(g.values ? J(et) : et); }).concat(g.values ? ne : ne.map(function(et) { return J(et); })); break; case "delete": var qe = new kn().addKeys(re.keys); se = Y.filter(function(et) { return !qe.hasKey(g.values ? J(et) : et); }); break; case "deleteRange": var Qe = re.range; se = Y.filter(function(et) { return !ia(J(et), Qe); }); } return se; }, h); return oe === h ? h : (oe.sort(function(Y, re) { return wt(q(Y), q(re)) || wt(J(Y), J(re)); }), g.limit && g.limit < 1 / 0 && (oe.length > g.limit ? oe.length = g.limit : h.length === g.limit && oe.length < g.limit && (N.dirty = !0)), O ? Object.freeze(oe) : oe); } function Yd(h, g) { return wt(h.lower, g.lower) === 0 && wt(h.upper, g.upper) === 0 && !!h.lowerOpen == !!g.lowerOpen && !!h.upperOpen == !!g.upperOpen; } function Qd(h, g) { return function(S, C, N, O) { if (S === void 0) return C !== void 0 ? -1 : 0; if (C === void 0) return 1; if ((C = wt(S, C)) === 0) { if (N && O) return 0; if (N) return 1; if (O) return -1; } return C; }(h.lower, g.lower, h.lowerOpen, g.lowerOpen) <= 0 && 0 <= function(S, C, N, O) { if (S === void 0) return C !== void 0 ? 1 : 0; if (C === void 0) return -1; if ((C = wt(S, C)) === 0) { if (N && O) return 0; if (N) return -1; if (O) return 1; } return C; }(h.upper, g.upper, h.upperOpen, g.upperOpen); } function Jd(h, g, S, C) { h.subscribers.add(S), C.addEventListener("abort", function() { var N, O; h.subscribers.delete(S), h.subscribers.size === 0 && (N = h, O = g, setTimeout(function() { N.subscribers.size === 0 && ce(O, N); }, 3e3)); }); } var Xd = { stack: "dbcore", level: 0, name: "Cache", create: function(h) { var g = h.schema.name; return r(r({}, h), { transaction: function(S, C, N) { var O, U, z = h.transaction(S, C, N); return C === "readwrite" && (U = (O = new AbortController()).signal, N = function(W) { return function() { if (O.abort(), C === "readwrite") { for (var J = /* @__PURE__ */ new Set(), ie = 0, q = S; ie < q.length; ie++) { var oe = q[ie], Y = wo["idb://".concat(g, "/").concat(oe)]; if (Y) { var re = h.table(oe), se = Y.optimisticOps.filter(function(et) { return et.trans === z; }); if (z._explicit && W && z.mutatedParts) for (var ne = 0, fe = Object.values(Y.queries.query); ne < fe.length; ne++) for (var ge = 0, ye = (We = fe[ne]).slice(); ge < ye.length; ge++) Gl((Ve = ye[ge]).obsSet, z.mutatedParts) && (ce(We, Ve), Ve.subscribers.forEach(function(et) { return J.add(et); })); else if (0 < se.length) { Y.optimisticOps = Y.optimisticOps.filter(function(et) { return et.trans !== z; }); for (var ke = 0, $e = Object.values(Y.queries.query); ke < $e.length; ke++) for (var We, Ve, qe, Qe = 0, He = (We = $e[ke]).slice(); Qe < He.length; Qe++) (Ve = He[Qe]).res != null && z.mutatedParts && (W && !Ve.dirty ? (qe = Object.isFrozen(Ve.res), qe = ns(Ve.res, Ve.req, se, re, Ve, qe), Ve.dirty ? (ce(We, Ve), Ve.subscribers.forEach(function(et) { return J.add(et); })) : qe !== Ve.res && (Ve.res = qe, Ve.promise = Xe.resolve({ result: qe }))) : (Ve.dirty && ce(We, Ve), Ve.subscribers.forEach(function(et) { return J.add(et); }))); } } } J.forEach(function(et) { return et(); }); } }; }, z.addEventListener("abort", N(!1), { signal: U }), z.addEventListener("error", N(!1), { signal: U }), z.addEventListener("complete", N(!0), { signal: U })), z; }, table: function(S) { var C = h.table(S), N = C.schema.primaryKey; return r(r({}, C), { mutate: function(O) { var U = ut.trans; if (N.outbound || U.db._options.cache === "disabled" || U.explicit || U.idbtrans.mode !== "readwrite") return C.mutate(O); var z = wo["idb://".concat(g, "/").concat(S)]; return z ? (U = C.mutate(O), O.type !== "add" && O.type !== "put" || !(50 <= O.values.length || Su(N, O).some(function(W) { return W == null; })) ? (z.optimisticOps.push(O), O.mutatedParts && yu(O.mutatedParts), U.then(function(W) { 0 < W.numFailures && (ce(z.optimisticOps, O), (W = Wd(0, O, W)) && z.optimisticOps.push(W), O.mutatedParts && yu(O.mutatedParts)); }), U.catch(function() { ce(z.optimisticOps, O), O.mutatedParts && yu(O.mutatedParts); })) : U.then(function(W) { var J = Wd(0, r(r({}, O), { values: O.values.map(function(ie, q) { var oe; return W.failures[q] ? ie : (ie = (oe = N.keyPath) !== null && oe !== void 0 && oe.includes(".") ? it(ie) : r({}, ie), de(ie, N.keyPath, W.results[q]), ie); }) }), W); z.optimisticOps.push(J), queueMicrotask(function() { return O.mutatedParts && yu(O.mutatedParts); }); }), U) : C.mutate(O); }, query: function(O) { if (!Kd(ut, C) || !Gd("query", O)) return C.query(O); var U = ((J = ut.trans) === null || J === void 0 ? void 0 : J.db._options.cache) === "immutable", q = ut, z = q.requery, W = q.signal, J = function(re, se, ne, fe) { var ge = wo["idb://".concat(re, "/").concat(se)]; if (!ge) return []; if (!(se = ge.queries[ne])) return [null, !1, ge, null]; var ye = se[(fe.query ? fe.query.index.name : null) || ""]; if (!ye) return [null, !1, ge, null]; switch (ne) { case "query": var ke = ye.find(function($e) { return $e.req.limit === fe.limit && $e.req.values === fe.values && Yd($e.req.query.range, fe.query.range); }); return ke ? [ke, !0, ge, ye] : [ye.find(function($e) { return ("limit" in $e.req ? $e.req.limit : 1 / 0) >= fe.limit && (!fe.values || $e.req.values) && Qd($e.req.query.range, fe.query.range); }), !1, ge, ye]; case "count": return ke = ye.find(function($e) { return Yd($e.req.query.range, fe.query.range); }), [ke, !!ke, ge, ye]; } }(g, S, "query", O), ie = J[0], q = J[1], oe = J[2], Y = J[3]; return ie && q ? ie.obsSet = O.obsSet : (q = C.query(O).then(function(re) { var se = re.result; if (ie && (ie.res = se), U) { for (var ne = 0, fe = se.length; ne < fe; ++ne) Object.freeze(se[ne]); Object.freeze(se); } else re.result = it(se); return re; }).catch(function(re) { return Y && ie && ce(Y, ie), Promise.reject(re); }), ie = { obsSet: O.obsSet, promise: q, subscribers: /* @__PURE__ */ new Set(), type: "query", req: O, dirty: !1 }, Y ? Y.push(ie) : (Y = [ie], (oe = oe || (wo["idb://".concat(g, "/").concat(S)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[O.query.index.name || ""] = Y)), Jd(ie, Y, z, W), ie.promise.then(function(re) { return { result: ns(re.result, O, oe?.optimisticOps, C, ie, U) }; }); } }); } }); } }; function oa(h, g) { return new Proxy(h, { get: function(S, C, N) { return C === "db" ? g : Reflect.get(S, C, N); } }); } var Gr = (Jt.prototype.version = function(h) { if (isNaN(h) || h < 0.1) throw new Re.Type("Given version is not a positive number"); if (h = Math.round(10 * h) / 10, this.idbdb || this._state.isBeingOpened) throw new Re.Schema("Cannot add version when database is open"); this.verno = Math.max(this.verno, h); var g = this._versions, S = g.filter(function(C) { return C._cfg.version === h; })[0]; return S || (S = new this.Version(h), g.push(S), g.sort($d), S.stores({}), this._state.autoSchema = !1, S); }, Jt.prototype._whenReady = function(h) { var g = this; return this.idbdb && (this._state.openComplete || ut.letThrough || this._vip) ? h() : new Xe(function(S, C) { if (g._state.openComplete) return C(new Re.DatabaseClosed(g._state.dbOpenError)); if (!g._state.isBeingOpened) { if (!g._state.autoOpen) return void C(new Re.DatabaseClosed()); g.open().catch(Je); } g._state.dbReadyPromise.then(S, C); }).then(h); }, Jt.prototype.use = function(h) { var g = h.stack, S = h.create, C = h.level, N = h.name; return N && this.unuse({ stack: g, name: N }), h = this._middlewares[g] || (this._middlewares[g] = []), h.push({ stack: g, create: S, level: C ?? 10, name: N }), h.sort(function(O, U) { return O.level - U.level; }), this; }, Jt.prototype.unuse = function(h) { var g = h.stack, S = h.name, C = h.create; return g && this._middlewares[g] && (this._middlewares[g] = this._middlewares[g].filter(function(N) { return C ? N.create !== C : !!S && N.name !== S; })), this; }, Jt.prototype.open = function() { var h = this; return ji(Fi, function() { return Wp(h); }); }, Jt.prototype._close = function() { var h = this._state, g = $i.indexOf(this); if (0 <= g && $i.splice(g, 1), this.idbdb) { try { this.idbdb.close(); } catch { } this.idbdb = null; } h.isBeingOpened || (h.dbReadyPromise = new Xe(function(S) { h.dbReadyResolve = S; }), h.openCanceller = new Xe(function(S, C) { h.cancelOpen = C; })); }, Jt.prototype.close = function(S) { var g = (S === void 0 ? { disableAutoOpen: !0 } : S).disableAutoOpen, S = this._state; g ? (S.isBeingOpened && S.cancelOpen(new Re.DatabaseClosed()), this._close(), S.autoOpen = !1, S.dbOpenError = new Re.DatabaseClosed()) : (this._close(), S.autoOpen = this._options.autoOpen || S.isBeingOpened, S.openComplete = !1, S.dbOpenError = null); }, Jt.prototype.delete = function(h) { var g = this; h === void 0 && (h = { disableAutoOpen: !0 }); var S = 0 < arguments.length && typeof arguments[0] != "object", C = this._state; return new Xe(function(N, O) { function U() { g.close(h); var z = g._deps.indexedDB.deleteDatabase(g.name); z.onsuccess = Wt(function() { var W, J, ie; W = g._deps, J = g.name, ie = W.indexedDB, W = W.IDBKeyRange, ea(ie) || J === Hs || Kl(ie, W).delete(J).catch(Je), N(); }), z.onerror = Qn(O), z.onblocked = g._fireOnBlocked; } if (S) throw new Re.InvalidArgument("Invalid closeOptions argument to db.delete()"); C.isBeingOpened ? C.dbReadyPromise.then(U) : U(); }); }, Jt.prototype.backendDB = function() { return this.idbdb; }, Jt.prototype.isOpen = function() { return this.idbdb !== null; }, Jt.prototype.hasBeenClosed = function() { var h = this._state.dbOpenError; return h && h.name === "DatabaseClosed"; }, Jt.prototype.hasFailed = function() { return this._state.dbOpenError !== null; }, Jt.prototype.dynamicallyOpened = function() { return this._state.autoSchema; }, Object.defineProperty(Jt.prototype, "tables", { get: function() { var h = this; return u(this._allTables).map(function(g) { return h._allTables[g]; }); }, enumerable: !1, configurable: !0 }), Jt.prototype.transaction = function() { var h = (function(g, S, C) { var N = arguments.length; if (N < 2) throw new Re.InvalidArgument("Too few arguments"); for (var O = new Array(N - 1); --N; ) O[N - 1] = arguments[N]; return C = O.pop(), [g, Z(O), C]; }).apply(this, arguments); return this._transaction.apply(this, h); }, Jt.prototype._transaction = function(h, g, S) { var C = this, N = ut.trans; N && N.db === this && h.indexOf("!") === -1 || (N = null); var O, U, z = h.indexOf("?") !== -1; h = h.replace("!", "").replace("?", ""); try { if (U = g.map(function(J) { if (J = J instanceof C.Table ? J.name : J, typeof J != "string") throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed"); return J; }), h == "r" || h === Ko) O = Ko; else { if (h != "rw" && h != Ml) throw new Re.InvalidArgument("Invalid transaction mode: " + h); O = Ml; } if (N) { if (N.mode === Ko && O === Ml) { if (!z) throw new Re.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY"); N = null; } N && U.forEach(function(J) { if (N && N.storeNames.indexOf(J) === -1) { if (!z) throw new Re.SubTransaction("Table " + J + " not included in parent transaction."); N = null; } }), z && N && !N.active && (N = null); } } catch (J) { return N ? N._promise(null, function(ie, q) { q(J); }) : vn(J); } var W = (function J(ie, q, oe, Y, re) { return Xe.resolve().then(function() { var se = ut.transless || ut, ne = ie._createTransaction(q, oe, ie._dbSchema, Y); if (ne.explicit = !0, se = { trans: ne, transless: se }, Y) ne.idbtrans = Y.idbtrans; else try { ne.create(), ne.idbtrans._explicit = !0, ie._state.PR1398_maxLoop = 3; } catch (ye) { return ye.name === Ie.InvalidState && ie.isOpen() && 0 < --ie._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), ie.close({ disableAutoOpen: !1 }), ie.open().then(function() { return J(ie, q, oe, null, re); })) : vn(ye); } var fe, ge = M(re); return ge && Ho(), se = Xe.follow(function() { var ye; (fe = re.call(ne, ne)) && (ge ? (ye = Wn.bind(null, null), fe.then(ye, ye)) : typeof fe.next == "function" && typeof fe.throw == "function" && (fe = ra(fe))); }, se), (fe && typeof fe.then == "function" ? Xe.resolve(fe).then(function(ye) { return ne.active ? ye : vn(new Re.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")); }) : se.then(function() { return fe; })).then(function(ye) { return Y && ne._resolve(), ne._completion.then(function() { return ye; }); }).catch(function(ye) { return ne._reject(ye), vn(ye); }); }); }).bind(null, this, O, U, N, S); return N ? N._promise(O, W, "lock") : ut.trans ? ji(ut.transless, function() { return C._whenReady(W); }) : this._whenReady(W); }, Jt.prototype.table = function(h) { if (!v(this._allTables, h)) throw new Re.InvalidTable("Table ".concat(h, " does not exist")); return this._allTables[h]; }, Jt); function Jt(h, g) { var S = this; this._middlewares = {}, this.verno = 0; var C = Jt.dependencies; this._options = g = r({ addons: Jt.addons, autoOpen: !0, indexedDB: C.indexedDB, IDBKeyRange: C.IDBKeyRange, cache: "cloned" }, g), this._deps = { indexedDB: g.indexedDB, IDBKeyRange: g.IDBKeyRange }, C = g.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this; var N, O, U, z, W, J = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Je, dbReadyPromise: null, cancelOpen: Je, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: g.autoOpen }; J.dbReadyPromise = new Xe(function(q) { J.dbReadyResolve = q; }), J.openCanceller = new Xe(function(q, oe) { J.cancelOpen = oe; }), this._state = J, this.name = h, this.on = zi(this, "populate", "blocked", "versionchange", "close", { ready: [b, Je] }), this.on.ready.subscribe = L(this.on.ready.subscribe, function(q) { return function(oe, Y) { Jt.vip(function() { var re, se = S._state; se.openComplete ? (se.dbOpenError || Xe.resolve().then(oe), Y && q(oe)) : se.onReadyBeingFired ? (se.onReadyBeingFired.push(oe), Y && q(oe)) : (q(oe), re = S, Y || q(function ne() { re.on.ready.unsubscribe(oe), re.on.ready.unsubscribe(ne); })); }); }; }), this.Collection = (N = this, ci(Kt.prototype, function(fe, ne) { this.db = N; var Y = Ks, re = null; if (ne) try { Y = ne(); } catch (ge) { re = ge; } var se = fe._ctx, ne = se.table, fe = ne.hook.reading.fire; this._ctx = { table: ne, index: se.index, isPrimKey: !se.index || ne.schema.primKey.keyPath && se.index === ne.schema.primKey.name, range: Y, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: re, or: se.or, valueMapper: fe !== It ? fe : null }; })), this.Table = (O = this, ci(Bd.prototype, function(q, oe, Y) { this.db = O, this._tx = Y, this.name = q, this.schema = oe, this.hook = O._allTables[q] ? O._allTables[q].hook : zi(null, { creating: [Dt, Je], reading: [Rt, It], updating: [P, Je], deleting: [Mt, Je] }); })), this.Transaction = (U = this, ci(Ws.prototype, function(q, oe, Y, re, se) { var ne = this; this.db = U, this.mode = q, this.storeNames = oe, this.schema = Y, this.chromeTransactionDurability = re, this.idbtrans = null, this.on = zi(this, "complete", "error", "abort"), this.parent = se || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new Xe(function(fe, ge) { ne._resolve = fe, ne._reject = ge; }), this._completion.then(function() { ne.active = !1, ne.on.complete.fire(); }, function(fe) { var ge = ne.active; return ne.active = !1, ne.on.error.fire(fe), ne.parent ? ne.parent._reject(fe) : ge && ne.idbtrans && ne.idbtrans.abort(), vn(fe); }); })), this.Version = (z = this, ci(Hl.prototype, function(q) { this.db = z, this._cfg = { version: q, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null }; })), this.WhereClause = (W = this, ci(hi.prototype, function(q, oe, Y) { if (this.db = W, this._ctx = { table: q, index: oe === ":id" ? null : oe, or: Y }, this._cmp = this._ascending = wt, this._descending = function(re, se) { return wt(se, re); }, this._max = function(re, se) { return 0 < wt(re, se) ? re : se; }, this._min = function(re, se) { return wt(re, se) < 0 ? re : se; }, this._IDBKeyRange = W._deps.IDBKeyRange, !this._IDBKeyRange) throw new Re.MissingAPI(); })), this.on("versionchange", function(q) { 0 < q.newVersion ? console.warn("Another connection wants to upgrade database '".concat(S.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(S.name, "'. Closing db now to resume the delete request.")), S.close({ disableAutoOpen: !1 }); }), this.on("blocked", function(q) { !q.newVersion || q.newVersion < q.oldVersion ? console.warn("Dexie.delete('".concat(S.name, "') was blocked")) : console.warn("Upgrade '".concat(S.name, "' blocked by other connection holding version ").concat(q.oldVersion / 10)); }), this._maxKey = Qs(g.IDBKeyRange), this._createTransaction = function(q, oe, Y, re) { return new S.Transaction(q, oe, Y, S._options.chromeTransactionDurability, re); }, this._fireOnBlocked = function(q) { S.on("blocked").fire(q), $i.filter(function(oe) { return oe.name === S.name && oe !== S && !oe._state.vcFired; }).map(function(oe) { return oe.on("versionchange").fire(q); }); }, this.use(Jp), this.use(Xd), this.use(Xp), this.use(Yp), this.use(Qp); var ie = new Proxy(this, { get: function(q, oe, Y) { if (oe === "_vip") return !0; if (oe === "table") return function(se) { return oa(S.table(se), ie); }; var re = Reflect.get(q, oe, Y); return re instanceof Bd ? oa(re, ie) : oe === "tables" ? re.map(function(se) { return oa(se, ie); }) : oe === "_createTransaction" ? function() { return oa(re.apply(this, arguments), ie); } : re; } }); this.vip = ie, C.forEach(function(q) { return q(S); }); } var _u, hr = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", Zp = (bu.prototype.subscribe = function(h, g, S) { return this._subscribe(h && typeof h != "function" ? h : { next: h, error: g, complete: S }); }, bu.prototype[hr] = function() { return this; }, bu); function bu(h) { this._subscribe = h; } try { _u = { indexedDB: o.indexedDB || o.mozIndexedDB || o.webkitIndexedDB || o.msIndexedDB, IDBKeyRange: o.IDBKeyRange || o.webkitIDBKeyRange }; } catch { _u = { indexedDB: null, IDBKeyRange: null }; } function Jl(h) { var g, S = !1, C = new Zp(function(N) { var O = M(h), U, z = !1, W = {}, J = {}, ie = { get closed() { return z; }, unsubscribe: function() { z || (z = !0, U && U.abort(), q && mi.storagemutated.unsubscribe(Y)); } }; N.start && N.start(ie); var q = !1, oe = function() { return uu(re); }, Y = function(se) { gu(W, se), Gl(J, W) && oe(); }, re = function() { var se, ne, fe; !z && _u.indexedDB && (W = {}, se = {}, U && U.abort(), U = new AbortController(), fe = function(ge) { var ye = Ui(); try { O && Ho(); var ke = Mi(h, ge); return ke = O ? ke.finally(Wn) : ke; } finally { ye && ao(); } }(ne = { subscr: se, signal: U.signal, requery: oe, querier: h, trans: null }), Promise.resolve(fe).then(function(ge) { S = !0, g = ge, z || ne.signal.aborted || (W = {}, function(ye) { for (var ke in ye) if (v(ye, ke)) return; return 1; }(J = se) || q || (mi(fr, Y), q = !0), uu(function() { return !z && N.next && N.next(ge); })); }, function(ge) { S = !1, ["DatabaseClosedError", "AbortError"].includes(ge?.name) || z || uu(function() { z || N.error && N.error(ge); }); })); }; return setTimeout(oe, 0), ie; }); return C.hasValue = function() { return S; }, C.getValue = function() { return g; }, C; } var Or = Gr; function So(h) { var g = Pr; try { Pr = !0, mi.storagemutated.fire(h), Yl(h, !0); } finally { Pr = g; } } y(Or, r(r({}, ft), { delete: function(h) { return new Or(h, { addons: [] }).delete(); }, exists: function(h) { return new Or(h, { addons: [] }).open().then(function(g) { return g.close(), !0; }).catch("NoSuchDatabaseError", function() { return !1; }); }, getDatabaseNames: function(h) { try { return g = Or.dependencies, S = g.indexedDB, g = g.IDBKeyRange, (ea(S) ? Promise.resolve(S.databases()).then(function(C) { return C.map(function(N) { return N.name; }).filter(function(N) { return N !== Hs; }); }) : Kl(S, g).toCollection().primaryKeys()).then(h); } catch { return vn(new Re.MissingAPI()); } var g, S; }, defineClass: function() { return function(h) { f(this, h); }; }, ignoreTransaction: function(h) { return ut.trans ? ji(ut.transless, h) : h(); }, vip: ta, async: function(h) { return function() { try { var g = ra(h.apply(this, arguments)); return g && typeof g.then == "function" ? g : Xe.resolve(g); } catch (S) { return vn(S); } }; }, spawn: function(h, g, S) { try { var C = ra(h.apply(S, g || [])); return C && typeof C.then == "function" ? C : Xe.resolve(C); } catch (N) { return vn(N); } }, currentTransaction: { get: function() { return ut.trans || null; } }, waitFor: function(h, g) { return g = Xe.resolve(typeof h == "function" ? Or.ignoreTransaction(h) : h).timeout(g || 6e4), ut.trans ? ut.trans.waitFor(g) : g; }, Promise: Xe, debug: { get: function() { return F; }, set: function(h) { ee(h); } }, derive: E, extend: f, props: y, override: L, Events: zi, on: mi, liveQuery: Jl, extendObservabilitySet: gu, getByKeyPath: ue, setByKeyPath: de, delByKeyPath: function(h, g) { typeof g == "string" ? de(h, g, void 0) : "length" in g && [].map.call(g, function(S) { de(h, S, void 0); }); }, shallowClone: H, deepClone: it, getObjectDiff: Ql, cmp: wt, asap: K, minKey: -1 / 0, addons: [], connections: $i, errnames: Ie, dependencies: _u, cache: wo, semVer: "4.0.11", version: "4.0.11".split(".").map(function(h) { return parseInt(h); }).reduce(function(h, g, S) { return h + g / Math.pow(10, 2 * S); }) })), Or.maxKey = Qs(Or.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (mi(fr, function(h) { Pr || (h = new CustomEvent(zl, { detail: h }), Pr = !0, dispatchEvent(h), Pr = !1); }), addEventListener(zl, function(h) { h = h.detail, Pr || So(h); })); var rs, Pr = !1, Zd = function() { }; return typeof BroadcastChannel < "u" && ((Zd = function() { (rs = new BroadcastChannel(zl)).onmessage = function(h) { return h.data && So(h.data); }; })(), typeof rs.unref == "function" && rs.unref(), mi(fr, function(h) { Pr || rs.postMessage(h); })), typeof addEventListener < "u" && (addEventListener("pagehide", function(h) { if (!Gr.disableBfCache && h.persisted) { F && console.debug("Dexie: handling persisted pagehide"), rs?.close(); for (var g = 0, S = $i; g < S.length; g++) S[g].close({ disableAutoOpen: !1 }); } }), addEventListener("pageshow", function(h) { !Gr.disableBfCache && h.persisted && (F && console.debug("Dexie: handling persisted pageshow"), Zd(), So({ all: new kn(-1 / 0, [[]]) })); })), Xe.rejectionMapper = function(h, g) { return !h || h instanceof Te || h instanceof TypeError || h instanceof SyntaxError || !h.name || !ht[h.name] ? h : (g = new ht[h.name](g || h.message, h), "stack" in h && A(g, "stack", { get: function() { return this.inner.stack; } }), g); }, ee(F), r(Gr, Object.freeze({ __proto__: null, Dexie: Gr, liveQuery: Jl, Entity: Ld, cmp: wt, PropModification: Gs, replacePrefix: function(h, g) { return new Gs({ replacePrefix: [h, g] }); }, add: function(h) { return new Gs({ add: h }); }, remove: function(h) { return new Gs({ remove: h }); }, default: Gr, RangeSet: kn, mergeRanges: na, rangesOverlap: Vd }), { default: Gr }), Gr; }); }(mh)), mh.exports; } var HO = qO(); const sy = /* @__PURE__ */ Bs(HO), N_ = Symbol.for("Dexie"), zh = globalThis[N_] || (globalThis[N_] = sy); if (sy.semVer !== zh.semVer) throw new Error(`Two different versions of Dexie loaded in the same app: ${sy.semVer} and ${zh.semVer}`); const { liveQuery: hz, mergeRanges: pz, rangesOverlap: mz, RangeSet: gz, cmp: vz, Entity: yz, PropModification: wz, replacePrefix: Sz, add: _z, remove: bz } = zh; class MA extends zh { logs; constructor(e, n, r = {}) { super(e); const i = { logs: "id, level, time, source, account" }; this.version(n).stores({ ...i, ...r }); } } class KO extends MA { constructor() { super("nizza", 1); } } class BA { logger; channel; listeners = /* @__PURE__ */ new Map(); eventQueue = /* @__PURE__ */ new Map(); constructor(e, n) { this.logger = n.child("EventBus"); try { this.logger.debug(`Creating BroadcastChannel with name "${e}"`), this.channel = new BroadcastChannel(e), this.channel.onmessage = (r) => this.handleMessage(r), this.channel.onmessageerror = (r) => this.logger.error("NizzaBroadcastChannel error:", r); } catch (r) { throw this.logger.error("Failed to create NizzaBroadcastChannel:", r), r; } } /** * Subscribe a listener function to a specific event with wildcards. * * @param {string} pattern - The event name to subscribe to. You can use wildcards like 'user:*' or 'chat:**'. * @param {EventBusListener} listener - The listener function to handle the event. * @returns {EventBusSubscription} - A subscription object that includes the event name and the `off()` function for unsubscribing. * @example * const subscription = eventBus.on('user:*', (event) => { * console.log('User event:', event.name); * }); * const chatSubscription = eventBus.on('chat:**', (event) => { * console.log('Chat event:', event.name); * }); */ on(e, n) { return this.logger.debug(`Subscribing to pattern "${e}"`), this.subscribeToEvent(e, n), { off: () => this.unsubscribeFromEvent(e, n) }; } /** * Emit an event through the BroadcastChannel. * * @param {string} event - The event name to emit. * @param {any} data - The data associated with the event. * @param {Attributes} attrs - Optional attributes associated with the event. * @example * // Emit a user login event * eventBus.emit('user:login', { username: 'user123' }); * * // Emit a chat message event * eventBus.emit('chat:message', { text: 'Hello, world!' }); */ emit(e, n, r = {}) { this.logger.debug(`Emitting event "${e}" with data`, n), this.emitEvent(e, n, r); } /** * Handle messages received through the BroadcastChannel and call the corresponding listener functions. * * @private * @param {MessageEvent} event - The received message event. */ handleMessage(e) { const n = e.data, { name: r } = n; this.logger.debug(`Received message "${r}" with data`, n); for (const [i, o] of this.listeners.entries()) this.matchWildcard(i, r) && (this.logger.debug(`Matching pattern "${i}" for event "${r}"`), o.forEach( (u) => u({ ...n, wildcard: i }) )); } /** * Subscribe a listener function to a specific event. * * @private * @param {string} pattern - The pattern to subscribe to. * @param {EventBusListener} listener - The listener function to handle the event. */ subscribeToEvent(e, n) { if (typeof e != "string" || typeof n != "function") { const i = new Error("Invalid arguments"); throw this.logger.error(i), i; } this.listeners.has(e) || (this.logger.debug(`Adding new pattern "${e}"`), this.listeners.set(e, /* @__PURE__ */ new Set())); const r = Array.from(this.eventQueue).filter(([i]) => { const o = this.matchWildcard(e, i); return o && (this.eventQueue.delete(i), this.logger.debug(`Dequeued pending events for "${i}".`)), o; }).flatMap(([, i]) => i); for (const [i, o] of this.listeners.entries()) this.matchWildcard(i, e) && (this.logger.debug(`Adding listener to pattern "${i}"`), o.add(n), r.length && (this.logger.debug(`Delivering pending events for "${e}".`), r.forEach((u) => { n({ ...u, wildcard: i }); }))); } /** * Emit an event and deliver it to the corresponding listeners. * * @private * @param {string} event - The event name to emit. * @param {any} data - The data associated with the event. * @param {Attributes} attrs - Optional attributes associated with the event. */ emitEvent(e, n, r) { if (typeof e != "string") { const u = new Error("Invalid arguments"); throw this.logger.error(u), u; } const i = { name: e, data: n, attrs: r }, o = Array.from(this.getMatchingListeners(e)); if (o.length) { this.logger.debug(`Delivering event "${e}" to listeners`); for (const [u, l] of o) l({ ...i, wildcard: u }); } else this.logger.debug(`No listeners for event "${e}", enqueuing`), this.eventQueue.has(e) || this.eventQueue.set(e, []), this.eventQueue.get(e).push(i); this.logger.debug("Posting message to channel", i), this.channel.postMessage(i); } /** * Get listeners that match the event name pattern. * * @private * @param {string} event - The event name to match. * @returns {Iterable<[string, EventBusListener]>} - Iterable of matching listeners and their patterns. */ *getMatchingListeners(e) { this.logger.debug(`Getting matching listeners for event "${e}"`); for (const [n, r] of this.listeners.entries()) if (this.matchWildcard(n, e)) for (const i of r) yield [n, i]; } /** * Unsubscribe a listener function from a specific event. * * @private * @param {string} event - The event name to unsubscribe from. * @param {EventBusListener} listener - The listener function to unsubscribe. */ unsubscribeFromEvent(e, n) { if (this.listeners.has(e)) { this.logger.debug(`Unsubscribing from event "${e}"`); const r = this.listeners.get(e); r.delete(n), r.size === 0 && (this.logger.debug(`No more listeners for event "${e}", deleting`), this.listeners.delete(e)); } } /** * Match wildcards in event names. * * @private * @param {string} wildcard - The wildcard pattern to match. * @param {string} pattern - The event name to check. * @returns {boolean} - `true` if the event name matches the pattern, otherwise `false`. */ matchWildcard(e, n) { const r = e.replace(/\*/g, "[^:]*").replace(/\*\*/g, ".*"), o = new RegExp(`^${r}$`).test(n); return this.logger.debug( `Wildcard "${e}" matches with pattern "${n}": ${o}` ), o; } } const GO = { ALL: "*", CORE: "core:**", ADD_TO_CART_HOOKS: "core:addToCartHooks:**", LIVE_STREAMING_EVENT: "event:**", EVENT_CHAT: "event:chat:**", EVENT_PRODUCTS: "event:products:**", CUSTOMIZE_LIVE: "customize-live:**", PLAYER: "player:**", SNACK_SIZE_VIDEO: "ssv:**", SNACK_SIZE_VIDEO_ADMIN: "ssv-admin:**", UI: "ui:**", UTILS: "utils:**" }, jA = { EVENT_STATUS_CHANGED: "event:statusChanged", /** AddToCartHook events */ ATCH_ACTION_EXECUTED: "core:addToCartHooks:actionExecuted" }; var Cc = { exports: {} }, Dg, T_; function WO() { if (T_) return Dg; T_ = 1; function t(n) { try { return JSON.stringify(n); } catch { return '"[Circular]"'; } } Dg = e; function e(n, r, i) { var o = i && i.stringify || t, u = 1; if (typeof n == "object" && n !== null) { var l = r.length + u; if (l === 1) return n; var f = new Array(l); f[0] = o(n); for (var d = 1; d < l; d++) f[d] = o(r[d]); return f.join(" "); } if (typeof n != "string") return n; var p = r.length; if (p === 0) return n; for (var v = "", y = 1 - u, k = -1, A = n && n.length || 0, E = 0; E < A; ) { if (n.charCodeAt(E) === 37 && E + 1 < A) { switch (k = k > -1 ? k : 0, n.charCodeAt(E + 1)) { case 100: // 'd' case 102: if (y >= p || r[y] == null) break; k < E && (v += n.slice(k, E)), v += Number(r[y]), k = E + 2, E++; break; case 105: if (y >= p || r[y] == null) break; k < E && (v += n.slice(k, E)), v += Math.floor(Number(r[y])), k = E + 2, E++; break; case 79: // 'O' case 111: // 'o' case 106: if (y >= p || r[y] === void 0) break; k < E && (v += n.slice(k, E)); var T = typeof r[y]; if (T === "string") { v += "'" + r[y] + "'", k = E + 2, E++; break; } if (T === "function") { v += r[y].name || "", k = E + 2, E++; break; } v += o(r[y]), k = E + 2, E++; break; case 115: if (y >= p) break; k < E && (v += n.slice(k, E)), v += String(r[y]), k = E + 2, E++; break; case 37: k < E && (v += n.slice(k, E)), v += "%", k = E + 2, E++, y--; break; } ++y; } ++E; } return k === -1 ? n : (k < A && (v += n.slice(k)), v); } return Dg; } var I_; function YO() { if (I_) return Cc.exports; I_ = 1; const t = WO(); Cc.exports = p; const e = dt().console || {}, n = { mapHttpRequest: de, mapHttpResponse: de, wrapRequestSerializer: H, wrapResponseSerializer: H, wrapErrorSerializer: H, req: de, res: de, err: K, errWithCause: K }; function r(ae, be) { return ae === "silent" ? 1 / 0 : be.levels.values[ae]; } const i = Symbol("pino.logFuncs"), o = Symbol("pino.hierarchy"), u = { error: "log", fatal: "error", warn: "error", info: "log", debug: "log", trace: "log" }; function l(ae, be) { const pe = { logger: be, parent: ae[o] }; be[o] = pe; } function f(ae, be, pe) { const ce = {}; be.forEach((Ee) => { ce[Ee] = pe[Ee] ? pe[Ee] : e[Ee] || e[u[Ee] || "log"] || ve; }), ae[i] = ce; } function d(ae, be) { return Array.isArray(ae) ? ae.filter(function(ce) { return ce !== "!stdSerializers.err"; }) : ae === !0 ? Object.keys(be) : !1; } function p(ae) { ae = ae || {}, ae.browser = ae.browser || {}; const be = ae.browser.transmit; if (be && typeof be.send != "function") throw Error("pino: transmit option must have a send function"); const pe = ae.browser.write || e; ae.browser.write && (ae.browser.asObject = !0); const ce = ae.serializers || {}, Ee = d(ae.browser.serialize, ce); let B = ae.browser.serialize; Array.isArray(ae.browser.serialize) && ae.browser.serialize.indexOf("!stdSerializers.err") > -1 && (B = !1); const M = Object.keys(ae.customLevels || {}), te = ["error", "fatal", "warn", "info", "debug", "trace"].concat(M); typeof pe == "function" && te.forEach(function(ht) { pe[ht] = pe; }), (ae.enabled === !1 || ae.browser.disabled) && (ae.level = "silent"); const Te = ae.level || "info", $ = Object.create(pe); $.log || ($.log = ve), f($, te, pe), l({}, $), Object.defineProperty($, "levelVal", { get: Ye }), Object.defineProperty($, "level", { get: Ie, set: Ge }); const Q = { transmit: be, serialize: Ee, asObject: ae.browser.asObject, formatters: ae.browser.formatters, levels: te, timestamp: ue(ae), messageKey: ae.messageKey || "msg", onChild: ae.onChild || ve }; $.levels = v(ae), $.level = Te, $.setMaxListeners = $.getMaxListeners = $.emit = $.addListener = $.on = $.prependListener = $.once = $.prependOnceListener = $.removeListener = $.removeAllListeners = $.listeners = $.listenerCount = $.eventNames = $.write = $.flush = ve, $.serializers = ce, $._serialize = Ee, $._stdErrSerialize = B, $.child = function(...ht) { return Re.call(this, Q, ...ht); }, be && ($._logEvent = j()); function Ye() { return r(this.level, this); } function Ie() { return this._level; } function Ge(ht) { if (ht !== "silent" && !this.levels.values[ht]) throw Error("unknown level " + ht); this._level = ht, A(this, Q, $, "error"), A(this, Q, $, "fatal"), A(this, Q, $, "warn"), A(this, Q, $, "info"), A(this, Q, $, "debug"), A(this, Q, $, "trace"), M.forEach((ft) => { A(this, Q, $, ft); }); } function Re(ht, ft, Je) { if (!ft) throw new Error("missing bindings for child Pino"); Je = Je || {}, Ee && ft.serializers && (Je.serializers = ft.serializers); const It = Je.serializers; if (Ee && It) { var Rt = Object.assign({}, ce, It), Ze = ae.browser.serialize === !0 ? Object.keys(Rt) : Ee; delete ft.serializers, R([ft], Ze, Rt, this._stdErrSerialize); } function Dt(P) { this._childLevel = (P._childLevel | 0) + 1, this.bindings = ft, Rt && (this.serializers = Rt, this._serialize = Ze), be && (this._logEvent = j( [].concat(P._logEvent.bindings, ft) )); } Dt.prototype = this; const Mt = new Dt(this); return l(this, Mt), Mt.child = function(...P) { return Re.call(this, ht, ...P); }, Mt.level = Je.level || this.level, ht.onChild(Mt), Mt; } return $; } function v(ae) { const be = ae.customLevels || {}, pe = Object.assign({}, p.levels.values, be), ce = Object.assign({}, p.levels.labels, y(be)); return { values: pe, labels: ce }; } function y(ae) { const be = {}; return Object.keys(ae).forEach(function(pe) { be[ae[pe]] = pe; }), be; } p.levels = { values: { fatal: 60, error: 50, warn: 40, info: 30, debug: 20, trace: 10 }, labels: { 10: "trace", 20: "debug", 30: "info", 40: "warn", 50: "error", 60: "fatal" } }, p.stdSerializers = n, p.stdTimeFunctions = Object.assign({}, { nullTime: Z, epochTime: we, unixTime: ze, isoTime: it }); function k(ae) { const be = []; ae.bindings && be.push(ae.bindings); let pe = ae[o]; for (; pe.parent; ) pe = pe.parent, pe.logger.bindings && be.push(pe.logger.bindings); return be.reverse(); } function A(ae, be, pe, ce) { if (Object.defineProperty(ae, ce, { value: r(ae.level, pe) > r(ce, pe) ? ve : pe[i][ce], writable: !0, enumerable: !0, configurable: !0 }), ae[ce] === ve) { if (!be.transmit) return; const B = be.transmit.level || ae.level, M = r(B, pe); if (r(ce, pe) < M) return; } ae[ce] = T(ae, be, pe, ce); const Ee = k(ae); Ee.length !== 0 && (ae[ce] = E(Ee, ae[ce])); } function E(ae, be) { return function() { return be.apply(this, [...ae, ...arguments]); }; } function T(ae, be, pe, ce) { return /* @__PURE__ */ function(Ee) { return function() { const M = be.timestamp(), te = new Array(arguments.length), Te = Object.getPrototypeOf && Object.getPrototypeOf(this) === e ? e : this; for (var $ = 0; $ < te.length; $++) te[$] = arguments[$]; var Q = !1; if (be.serialize && (R(te, this._serialize, this.serializers, this._stdErrSerialize), Q = !0), be.asObject || be.formatters ? Ee.call(Te, D(this, ce, te, M, be)) : Ee.apply(Te, te), be.transmit) { const Ye = be.transmit.level || ae._level, Ie = r(Ye, pe), Ge = r(ce, pe); if (Ge < Ie) return; L(this, { ts: M, methodLevel: ce, methodValue: Ge, transmitValue: pe.levels.values[be.transmit.level || ae._level], send: be.transmit.send, val: r(ae._level, pe) }, te, Q); } }; }(ae[i][ce]); } function D(ae, be, pe, ce, Ee) { const { level: B, log: M = (Ie) => Ie } = Ee.formatters || {}, te = pe.slice(); let Te = te[0]; const $ = {}; if (ce && ($.time = ce), B) { const Ie = B(be, ae.levels.values[be]); Object.assign($, Ie); } else $.level = ae.levels.values[be]; let Q = (ae._childLevel | 0) + 1; if (Q < 1 && (Q = 1), Te !== null && typeof Te == "object") { for (; Q-- && typeof te[0] == "object"; ) Object.assign($, te.shift()); Te = te.length ? t(te.shift(), te) : void 0; } else typeof Te == "string" && (Te = t(te.shift(), te)); return Te !== void 0 && ($[Ee.messageKey] = Te), M($); } function R(ae, be, pe, ce) { for (const Ee in ae) if (ce && ae[Ee] instanceof Error) ae[Ee] = p.stdSerializers.err(ae[Ee]); else if (typeof ae[Ee] == "object" && !Array.isArray(ae[Ee]) && be) for (const B in ae[Ee]) be.indexOf(B) > -1 && B in pe && (ae[Ee][B] = pe[B](ae[Ee][B])); } function L(ae, be, pe, ce = !1) { const Ee = be.send, B = be.ts, M = be.methodLevel, te = be.methodValue, Te = be.val, $ = ae._logEvent.bindings; ce || R( pe, ae._serialize || Object.keys(ae.serializers), ae.serializers, ae._stdErrSerialize === void 0 ? !0 : ae._stdErrSerialize ), ae._logEvent.ts = B, ae._logEvent.messages = pe.filter(function(Q) { return $.indexOf(Q) === -1; }), ae._logEvent.level.label = M, ae._logEvent.level.value = te, Ee(M, ae._logEvent, Te), ae._logEvent = j($); } function j(ae) { return { ts: 0, messages: [], bindings: ae || [], level: { label: "", value: 0 } }; } function K(ae) { const be = { type: ae.constructor.name, msg: ae.message, stack: ae.stack }; for (const pe in ae) be[pe] === void 0 && (be[pe] = ae[pe]); return be; } function ue(ae) { return typeof ae.timestamp == "function" ? ae.timestamp : ae.timestamp === !1 ? Z : we; } function de() { return {}; } function H(ae) { return ae; } function ve() { } function Z() { return !1; } function we() { return Date.now(); } function ze() { return Math.round(Date.now() / 1e3); } function it() { return new Date(Date.now()).toISOString(); } function dt() { function ae(be) { return typeof be < "u" && be; } try { return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", { get: function() { return delete Object.prototype.globalThis, this.globalThis = this; }, configurable: !0 }), globalThis; } catch { return ae(self) || ae(window) || ae(this) || {}; } } return Cc.exports.default = p, Cc.exports.pino = p, Cc.exports; } var QO = YO(); const JO = /* @__PURE__ */ Bs(QO), Vn = []; for (let t = 0; t < 256; ++t) Vn.push((t + 256).toString(16).slice(1)); function XO(t, e = 0) { return (Vn[t[e + 0]] + Vn[t[e + 1]] + Vn[t[e + 2]] + Vn[t[e + 3]] + "-" + Vn[t[e + 4]] + Vn[t[e + 5]] + "-" + Vn[t[e + 6]] + Vn[t[e + 7]] + "-" + Vn[t[e + 8]] + Vn[t[e + 9]] + "-" + Vn[t[e + 10]] + Vn[t[e + 11]] + Vn[t[e + 12]] + Vn[t[e + 13]] + Vn[t[e + 14]] + Vn[t[e + 15]]).toLowerCase(); } let Fg; const ZO = new Uint8Array(16); function eP() { if (!Fg) { if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); Fg = crypto.getRandomValues.bind(crypto); } return Fg(ZO); } const tP = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), R_ = { randomUUID: tP }; function $A(t, e, n) { if (R_.randomUUID && !t) return R_.randomUUID(); t = t || {}; const r = t.random ?? t.rng?.() ?? eP(); if (r.length < 16) throw new Error("Random bytes length must be >= 16"); return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, XO(r); } const VA = { endpoint: "/v1/telemetry/logs", batchSize: 500, flushInterval: 10, maxRetries: 5, retryBackoffFactor: 2, maxPayloadSize: 500 }; var Sn = /* @__PURE__ */ ((t) => (t.TRACE = "trace", t.DEBUG = "debug", t.INFO = "info", t.WARN = "warn", t.ERROR = "error", t.FATAL = "fatal", t))(Sn || {}); const on = { trace: 10, debug: 20, info: 30, warn: 40, error: 50, fatal: 60 }, zA = { [on.trace]: "trace", [on.debug]: "debug", [on.info]: "info", [on.warn]: "warn", [on.error]: "error", [on.fatal]: "fatal" /* FATAL */ }; function qA(t) { return Object.values(Sn).includes( String(t).toLowerCase() ); } class g0 extends Error { /** * Creates a new instance of InvalidLogLevelError. * @param level - The invalid log level. */ constructor(e) { super(`Invalid log level: ${e}`), this.name = "InvalidLogLevelError"; } } class ei { // Global metadata shared across all instances. static globalMetadata = {}; static root = null; instance; httpLogger; consoleLogger; config; /** * Creates a new instance of PinoAdapter. * @param config - The adapter configuration. */ constructor(e) { this.config = e; const { source: n, levelService: r, metadata: i = {}, consoleLogger: o, httpLogger: u } = e; ei.root ??= ei.createRootLogger( o, u ), ei.mergeGlobalMetadata(i), this.instance = ei.root.child({ source: n }), this.consoleLogger = o, this.httpLogger = u, this.setLevel(r.getLevel(n)); } /** * Creates the root pino logger with custom options. * @param source - The source context. * @param httpLogger - The HTTP logger for production logs. * @returns A root pino logger instance. */ static createRootLogger(e, n) { return JO({ customLevels: on, browser: { write: (r) => { const { payload: i, options: o, stack: u, ...l } = r, f = { ...l, ...i }; o.silent || e.print(f, u), f.level >= on[Sn.WARN] && n.save(f); } } }); } /** * Merges new metadata into the global metadata. * @param metadata - The metadata to merge. */ static mergeGlobalMetadata(e = {}) { ei.globalMetadata = { ...ei.globalMetadata, ...e }; } /** * Creates a child logger with an extended source context. * Any additional metadata provided is merged into the global metadata. * @param source - The additional source context. * @param metadata - Optional metadata to merge globally. * @returns A new PinoAdapter instance representing the child logger. */ child(e, n = {}) { return ei.mergeGlobalMetadata(n), new ei({ source: `${this.config.source}:${e}`, levelService: this.config.levelService, consoleLogger: this.consoleLogger, httpLogger: this.httpLogger }); } /** * Sets the logging level for this adapter. * @param level - The desired log level. */ setLevel(e) { this.instance.level = e; } /** * Updates the global metadata. All subsequent log entries will include the updated metadata. * @param metadata - The metadata to merge into the global metadata. */ setMetadata(e) { ei.mergeGlobalMetadata(e); } /** * Formats a log entry into a structured log payload. * @param entry - The log entry to format. * @returns A formatted log entry. */ formatLogEntry(e) { const { content: n, stack: r, options: i = {} } = e, { message: o, args: u = [] } = n, l = $A(), f = {}; let d; return o instanceof Error ? (f.error = { name: o.name, message: o.message, stack: o.stack }, d = o.message) : d = typeof o == "object" ? JSON.stringify(o) : String(o), u.forEach((v, y) => this.formatArg(v, y, f)), { payload: { id: l, msg: d, data: f, ...ei.globalMetadata }, options: i, stack: r }; } /** * Formats an individual argument and merges it into the data object. * @param arg - The argument to format. * @param idx - The index of the argument. * @param data - The accumulator for formatted data. */ formatArg(e, n, r) { if (e instanceof Error) { const i = r.error ? `error${n + 1}` : "error"; r[i] = { message: e.message, stack: e.stack, name: e.name }; } else typeof e == "object" && e !== null ? Object.assign(r, e) : r[`$${n}`] = String(e); } /** * Logs an entry at the specified level. * @param level - The log level method to call. * @param entry - The log entry. * @throws Will throw an error if the log level method is not supported. */ log(e, n) { if (typeof this.instance[e] != "function") throw new g0(e); const r = this.formatLogEntry(n); this.instance[e](r); } trace(e) { this.log("trace", e); } debug(e) { this.log("debug", e); } info(e) { this.log("info", e); } warn(e) { this.log("warn", e); } error(e) { this.log("error", e); } fatal(e) { this.log("fatal", e); } get source() { return this.config.source; } } const O_ = { stackExclusionPatterns: /\b(PinoAdapter|ConsoleLogger|LoggerChain|Logger|Proxy|Child|pino\.js)\b/, themes: { dark: { baseStyles: { timestamp: "color: #A9A9A9; font-weight: normal;", // LightGray source: "color: #B0B0B0; font-weight: normal;", // Gray, less emphasis context: "color: #FFFFFF; font-weight: bold;", // White, more emphasis defaultMessage: "color: #E5E5E5; font-weight: normal;" // Subtle light text }, levels: { [on[Sn.TRACE]]: "color: #778899; font-weight: bold;", // SlateGray [on[Sn.DEBUG]]: "color: #008B8B; font-weight: bold;", // DarkCyan [on[Sn.INFO]]: "color: #00FFFF; font-weight: bold;", // Cyan [on[Sn.WARN]]: "color: #FFD700; font-weight: bold;", // Gold [on[Sn.ERROR]]: "color: #FF4500; font-weight: bold;", // OrangeRed [on[Sn.FATAL]]: "color: #FF0000; font-weight: bold; text-shadow: 1px 1px 1px black;" // Bright Red with shadow }, messages: { [on[Sn.WARN]]: "color: #FFD700; font-weight: normal;", // Gold, no bold [on[Sn.ERROR]]: "color: #FF4500; font-weight: normal;", // OrangeRed, no bold [on[Sn.FATAL]]: "color: #FF0000; font-weight: bold;" // Bright Red } }, light: { baseStyles: { timestamp: "color: #4D4D4D; font-weight: normal;", // DarkGray for contrast source: "color: #666666; font-weight: normal;", // Medium Gray, less emphasis context: "color: #000000; font-weight: bold;", // Black, more emphasis defaultMessage: "color: #333333; font-weight: normal;" // Dark text }, levels: { [on[Sn.TRACE]]: "color: #6A5ACD; font-weight: bold;", // SlateBlue [on[Sn.DEBUG]]: "color: #00509E; font-weight: bold;", // Rich Blue [on[Sn.INFO]]: "color: #1E90FF; font-weight: bold;", // DodgerBlue [on[Sn.WARN]]: "color: #FFA500; font-weight: bold;", // Orange [on[Sn.ERROR]]: "color: #ff0033; font-weight: bold;", // FireBrick [on[Sn.FATAL]]: "color: #D80000; font-weight: bold; text-shadow: 1px 1px 1px #660000;" // Strong Red with shadow }, messages: { [on[Sn.WARN]]: "color: #FFA500; font-weight: normal;", // Orange, no bold [on[Sn.ERROR]]: "color: #ff0033; font-weight: normal;", // FireBrick, no bold [on[Sn.FATAL]]: "color: #D80000; font-weight: bold;" // Strong Red } } } }; let nP = class { theme; constructor() { this.theme = this.initializeTheme(), this.setupThemeChangeListener(); } /** * Initializes the theme based on localStorage or browser settings. * @returns 'light' or 'dark' */ initializeTheme() { const e = localStorage.getItem("log-theme"); return e === "light" || e === "dark" ? e : this.detectTheme(); } /** * Detects the current console theme based on browser settings. * @returns 'light' or 'dark' */ detectTheme() { return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } /** * Sets up a listener to detect changes in the browser's theme settings. */ setupThemeChangeListener() { window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => { this.theme = e.matches ? "dark" : "light"; }); } /** * Manually sets the theme and stores it in localStorage. * @param theme - 'light' or 'dark' */ static setTheme(e) { localStorage.setItem("consoleLoggerTheme", e); } /** * Formats and filters the stack trace. * @param stack - Raw stack trace. * @returns Filtered and formatted stack trace. */ formatStack(e) { return e.split(` `).filter((n) => !O_.stackExclusionPatterns.test(n)).map((n) => n.replace(/^Error\s*/, "").trim()); } /** * Retrieves the appropriate style for a log level based on the theme. * @param level - Log level. * @returns Console style string. */ getStyles(e) { const n = O_.themes[this.theme]; return { ...n.baseStyles, level: n.levels[e] || n.baseStyles.defaultMessage, message: n.messages[e] || n.baseStyles.defaultMessage }; } /** * Gets the current time formatted as HH:mm:ss.SSS. * @returns Formatted time string. */ getTime() { return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: !1 }) + `.${(/* @__PURE__ */ new Date()).getMilliseconds().toString().padStart(3, "0")}`; } /** * Prints a formatted log entry to the console. * @param log - Log object containing level, source, message, and data. */ print({ level: e, source: n, msg: r, data: i }, o) { const [u, l, f] = n.split(":"), d = (zA[e] || "UNKNOWN").toUpperCase(), p = f ? `${f}: ` : "", v = l ? `:${l}` : "", y = this.getStyles(e); console.groupCollapsed( `%c${this.getTime()} %c${d} %c[${u}${v}] %c${p}%c${r}`, y.timestamp, y.level, y.source, y.context, y.message ), i && Object.keys(i).length && console.log("Data:", i); const k = this.formatStack(o || new Error().stack); k.length && console.log("Stack:", k.join(` `)), console.groupEnd(); } }; class v0 { config; isFlushing = !1; retryCount = 0; isFlushScheduled = !1; constructor(e) { this.config = e, this.setupUnloadListener(); } static create(e) { const n = { ...VA, ...e }; if (!n.db) throw new Error("Invalid Dixie DB"); if (!n.project) throw new Error("Project name is required"); return new v0(n); } async save(e) { const n = JSON.parse(JSON.stringify(e)); await this.config.db.logs.add(n), this.scheduleFlush(); } scheduleFlush(e = this.config.flushInterval * 1e3) { this.isFlushScheduled || this.isFlushing || (this.isFlushScheduled = !0, setTimeout(() => { this.isFlushScheduled = !1, this.flush(); }, e)); } async flush() { if (this.isFlushing) return; this.isFlushing = !0; let e = !1; try { await this.processLogsBatch(async (r) => { await this.sendLogs(r), await this.deleteLogs(r); }), this.retryCount = 0, e = !0; } catch (r) { this.logError("flush", r); } this.isFlushing = !1; const n = await this.hasPendingLogs(); !e && n ? this.handleRetry() : e && n && this.scheduleFlush(); } async processLogsBatch(e) { const n = await this.getLogsBatch(), r = this.splitLogsByPayloadSize(n); for (const i of r) await e(i); } async getLogsBatch(e = this.config.batchSize) { return this.config.db.logs.orderBy("time").limit(e).toArray(); } splitLogsByPayloadSize(e) { let n = [], r = 0; const i = []; return e.forEach((o) => { const u = JSON.stringify(o).length / 1024; r + u > this.config.maxPayloadSize && (i.push(n), n = [], r = 0), n.push(o), r += u; }), n.length > 0 && i.push(n), i; } async sendLogs(e) { await bn.rest({ path: this.config.endpoint, method: "POST", body: this.buildPayload(e, !1) }); } buildPayload(e, n) { const r = { project: this.config.project, logs: e }; return n ? JSON.stringify(r) : r; } async deleteLogs(e) { const n = e.map((r) => r.id); await this.config.db.logs.bulkDelete(n); } logError(e, n) { console.error(`[${e}]`, n); } handleRetry() { if (this.retryCount >= this.config.maxRetries) return; this.retryCount++; const e = this.config.flushInterval * Math.pow(this.config.retryBackoffFactor, this.retryCount) * 1e3; this.scheduleFlush(e); } async hasPendingLogs() { return await this.config.db.logs.count() > 0; } setupUnloadListener() { window.addEventListener("beforeunload", async () => { this.isFlushing || !await this.hasPendingLogs() || await this.processLogsBatch(async (e) => { const n = this.buildPayload(e, !0); navigator.sendBeacon(this.config.endpoint, n) ? await this.deleteLogs(e) : console.warn( "Failed to send logs via sendBeacon; logs will remain in the database." ); }); }); } } var Lg = {}, Ug, P_; function Ep() { if (P_) return Ug; P_ = 1; const t = "\\\\/", e = `[^${t}]`, n = "\\.", r = "\\+", i = "\\?", o = "\\/", u = "(?=.)", l = "[^/]", f = `(?:${o}|$)`, d = `(?:^|${o})`, p = `${n}{1,2}${f}`, v = `(?!${n})`, y = `(?!${d}${p})`, k = `(?!${n}{0,1}${f})`, A = `(?!${p})`, E = `[^.${o}]`, T = `${l}*?`, R = { DOT_LITERAL: n, PLUS_LITERAL: r, QMARK_LITERAL: i, SLASH_LITERAL: o, ONE_CHAR: u, QMARK: l, END_ANCHOR: f, DOTS_SLASH: p, NO_DOT: v, NO_DOTS: y, NO_DOT_SLASH: k, NO_DOTS_SLASH: A, QMARK_NO_DOT: E, STAR: T, START_ANCHOR: d, SEP: "/" }, L = { ...R, SLASH_LITERAL: `[${t}]`, QMARK: e, STAR: `${e}*?`, DOTS_SLASH: `${n}{1,2}(?:[${t}]|$)`, NO_DOT: `(?!${n})`, NO_DOTS: `(?!(?:^|[${t}])${n}{1,2}(?:[${t}]|$))`, NO_DOT_SLASH: `(?!${n}{0,1}(?:[${t}]|$))`, NO_DOTS_SLASH: `(?!${n}{1,2}(?:[${t}]|$))`, QMARK_NO_DOT: `[^.${t}]`, START_ANCHOR: `(?:^|[${t}])`, END_ANCHOR: `(?:[${t}]|$)`, SEP: "\\" }, j = { alnum: "a-zA-Z0-9", alpha: "a-zA-Z", ascii: "\\x00-\\x7F", blank: " \\t", cntrl: "\\x00-\\x1F\\x7F", digit: "0-9", graph: "\\x21-\\x7E", lower: "a-z", print: "\\x20-\\x7E ", punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~", space: " \\t\\r\\n\\v\\f", upper: "A-Z", word: "A-Za-z0-9_", xdigit: "A-Fa-f0-9" }; return Ug = { MAX_LENGTH: 1024 * 64, POSIX_REGEX_SOURCE: j, // regular expressions REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, // Replace globs with equivalent patterns to reduce parsing time. REPLACEMENTS: { "***": "*", "**/**": "**", "**/**/**": "**" }, // Digits CHAR_0: 48, /* 0 */ CHAR_9: 57, /* 9 */ // Alphabet chars. CHAR_UPPERCASE_A: 65, /* A */ CHAR_LOWERCASE_A: 97, /* a */ CHAR_UPPERCASE_Z: 90, /* Z */ CHAR_LOWERCASE_Z: 122, /* z */ CHAR_LEFT_PARENTHESES: 40, /* ( */ CHAR_RIGHT_PARENTHESES: 41, /* ) */ CHAR_ASTERISK: 42, /* * */ // Non-alphabetic chars. CHAR_AMPERSAND: 38, /* & */ CHAR_AT: 64, /* @ */ CHAR_BACKWARD_SLASH: 92, /* \ */ CHAR_CARRIAGE_RETURN: 13, /* \r */ CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ CHAR_COLON: 58, /* : */ CHAR_COMMA: 44, /* , */ CHAR_DOT: 46, /* . */ CHAR_DOUBLE_QUOTE: 34, /* " */ CHAR_EQUAL: 61, /* = */ CHAR_EXCLAMATION_MARK: 33, /* ! */ CHAR_FORM_FEED: 12, /* \f */ CHAR_FORWARD_SLASH: 47, /* / */ CHAR_GRAVE_ACCENT: 96, /* ` */ CHAR_HASH: 35, /* # */ CHAR_HYPHEN_MINUS: 45, /* - */ CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ CHAR_LEFT_CURLY_BRACE: 123, /* { */ CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ CHAR_LINE_FEED: 10, /* \n */ CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ CHAR_PERCENT: 37, /* % */ CHAR_PLUS: 43, /* + */ CHAR_QUESTION_MARK: 63, /* ? */ CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ CHAR_RIGHT_CURLY_BRACE: 125, /* } */ CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ CHAR_SEMICOLON: 59, /* ; */ CHAR_SINGLE_QUOTE: 39, /* ' */ CHAR_SPACE: 32, /* */ CHAR_TAB: 9, /* \t */ CHAR_UNDERSCORE: 95, /* _ */ CHAR_VERTICAL_LINE: 124, /* | */ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ /** * Create EXTGLOB_CHARS */ extglobChars(K) { return { "!": { type: "negate", open: "(?:(?!(?:", close: `))${K.STAR})` }, "?": { type: "qmark", open: "(?:", close: ")?" }, "+": { type: "plus", open: "(?:", close: ")+" }, "*": { type: "star", open: "(?:", close: ")*" }, "@": { type: "at", open: "(?:", close: ")" } }; }, /** * Create GLOB_CHARS */ globChars(K) { return K === !0 ? L : R; } }, Ug; } var D_; function Ap() { return D_ || (D_ = 1, function(t) { const { REGEX_BACKSLASH: e, REGEX_REMOVE_BACKSLASH: n, REGEX_SPECIAL_CHARS: r, REGEX_SPECIAL_CHARS_GLOBAL: i } = /* @__PURE__ */ Ep(); t.isObject = (o) => o !== null && typeof o == "object" && !Array.isArray(o), t.hasRegexChars = (o) => r.test(o), t.isRegexChar = (o) => o.length === 1 && t.hasRegexChars(o), t.escapeRegex = (o) => o.replace(i, "\\$1"), t.toPosixSlashes = (o) => o.replace(e, "/"), t.isWindows = () => { if (typeof navigator < "u" && navigator.platform) { const o = navigator.platform.toLowerCase(); return o === "win32" || o === "windows"; } return typeof process < "u" && process.platform ? process.platform === "win32" : !1; }, t.removeBackslashes = (o) => o.replace(n, (u) => u === "\\" ? "" : u), t.escapeLast = (o, u, l) => { const f = o.lastIndexOf(u, l); return f === -1 ? o : o[f - 1] === "\\" ? t.escapeLast(o, u, f - 1) : `${o.slice(0, f)}\\${o.slice(f)}`; }, t.removePrefix = (o, u = {}) => { let l = o; return l.startsWith("./") && (l = l.slice(2), u.prefix = "./"), l; }, t.wrapOutput = (o, u = {}, l = {}) => { const f = l.contains ? "" : "^", d = l.contains ? "" : "$"; let p = `${f}(?:${o})${d}`; return u.negated === !0 && (p = `(?:^(?!${p}).*$)`), p; }, t.basename = (o, { windows: u } = {}) => { const l = o.split(u ? /[\\/]/ : "/"), f = l[l.length - 1]; return f === "" ? l[l.length - 2] : f; }; }(Lg)), Lg; } var Mg, F_; function rP() { if (F_) return Mg; F_ = 1; const t = /* @__PURE__ */ Ap(), { CHAR_ASTERISK: e, /* * */ CHAR_AT: n, /* @ */ CHAR_BACKWARD_SLASH: r, /* \ */ CHAR_COMMA: i, /* , */ CHAR_DOT: o, /* . */ CHAR_EXCLAMATION_MARK: u, /* ! */ CHAR_FORWARD_SLASH: l, /* / */ CHAR_LEFT_CURLY_BRACE: f, /* { */ CHAR_LEFT_PARENTHESES: d, /* ( */ CHAR_LEFT_SQUARE_BRACKET: p, /* [ */ CHAR_PLUS: v, /* + */ CHAR_QUESTION_MARK: y, /* ? */ CHAR_RIGHT_CURLY_BRACE: k, /* } */ CHAR_RIGHT_PARENTHESES: A, /* ) */ CHAR_RIGHT_SQUARE_BRACKET: E /* ] */ } = /* @__PURE__ */ Ep(), T = (L) => L === l || L === r, D = (L) => { L.isPrefix !== !0 && (L.depth = L.isGlobstar ? 1 / 0 : 1); }; return Mg = (L, j) => { const K = j || {}, ue = L.length - 1, de = K.parts === !0 || K.scanToEnd === !0, H = [], ve = [], Z = []; let we = L, ze = -1, it = 0, dt = 0, ae = !1, be = !1, pe = !1, ce = !1, Ee = !1, B = !1, M = !1, te = !1, Te = !1, $ = !1, Q = 0, Ye, Ie, Ge = { value: "", depth: 0, isGlob: !1 }; const Re = () => ze >= ue, ht = () => we.charCodeAt(ze + 1), ft = () => (Ye = Ie, we.charCodeAt(++ze)); for (; ze < ue; ) { Ie = ft(); let Dt; if (Ie === r) { M = Ge.backslashes = !0, Ie = ft(), Ie === f && (B = !0); continue; } if (B === !0 || Ie === f) { for (Q++; Re() !== !0 && (Ie = ft()); ) { if (Ie === r) { M = Ge.backslashes = !0, ft(); continue; } if (Ie === f) { Q++; continue; } if (B !== !0 && Ie === o && (Ie = ft()) === o) { if (ae = Ge.isBrace = !0, pe = Ge.isGlob = !0, $ = !0, de === !0) continue; break; } if (B !== !0 && Ie === i) { if (ae = Ge.isBrace = !0, pe = Ge.isGlob = !0, $ = !0, de === !0) continue; break; } if (Ie === k && (Q--, Q === 0)) { B = !1, ae = Ge.isBrace = !0, $ = !0; break; } } if (de === !0) continue; break; } if (Ie === l) { if (H.push(ze), ve.push(Ge), Ge = { value: "", depth: 0, isGlob: !1 }, $ === !0) continue; if (Ye === o && ze === it + 1) { it += 2; continue; } dt = ze + 1; continue; } if (K.noext !== !0 && (Ie === v || Ie === n || Ie === e || Ie === y || Ie === u) === !0 && ht() === d) { if (pe = Ge.isGlob = !0, ce = Ge.isExtglob = !0, $ = !0, Ie === u && ze === it && (Te = !0), de === !0) { for (; Re() !== !0 && (Ie = ft()); ) { if (Ie === r) { M = Ge.backslashes = !0, Ie = ft(); continue; } if (Ie === A) { pe = Ge.isGlob = !0, $ = !0; break; } } continue; } break; } if (Ie === e) { if (Ye === e && (Ee = Ge.isGlobstar = !0), pe = Ge.isGlob = !0, $ = !0, de === !0) continue; break; } if (Ie === y) { if (pe = Ge.isGlob = !0, $ = !0, de === !0) continue; break; } if (Ie === p) { for (; Re() !== !0 && (Dt = ft()); ) { if (Dt === r) { M = Ge.backslashes = !0, ft(); continue; } if (Dt === E) { be = Ge.isBracket = !0, pe = Ge.isGlob = !0, $ = !0; break; } } if (de === !0) continue; break; } if (K.nonegate !== !0 && Ie === u && ze === it) { te = Ge.negated = !0, it++; continue; } if (K.noparen !== !0 && Ie === d) { if (pe = Ge.isGlob = !0, de === !0) { for (; Re() !== !0 && (Ie = ft()); ) { if (Ie === d) { M = Ge.backslashes = !0, Ie = ft(); continue; } if (Ie === A) { $ = !0; break; } } continue; } break; } if (pe === !0) { if ($ = !0, de === !0) continue; break; } } K.noext === !0 && (ce = !1, pe = !1); let Je = we, It = "", Rt = ""; it > 0 && (It = we.slice(0, it), we = we.slice(it), dt -= it), Je && pe === !0 && dt > 0 ? (Je = we.slice(0, dt), Rt = we.slice(dt)) : pe === !0 ? (Je = "", Rt = we) : Je = we, Je && Je !== "" && Je !== "/" && Je !== we && T(Je.charCodeAt(Je.length - 1)) && (Je = Je.slice(0, -1)), K.unescape === !0 && (Rt && (Rt = t.removeBackslashes(Rt)), Je && M === !0 && (Je = t.removeBackslashes(Je))); const Ze = { prefix: It, input: L, start: it, base: Je, glob: Rt, isBrace: ae, isBracket: be, isGlob: pe, isExtglob: ce, isGlobstar: Ee, negated: te, negatedExtglob: Te }; if (K.tokens === !0 && (Ze.maxDepth = 0, T(Ie) || ve.push(Ge), Ze.tokens = ve), K.parts === !0 || K.tokens === !0) { let Dt; for (let Mt = 0; Mt < H.length; Mt++) { const P = Dt ? Dt + 1 : it, x = H[Mt], b = L.slice(P, x); K.tokens && (Mt === 0 && it !== 0 ? (ve[Mt].isPrefix = !0, ve[Mt].value = It) : ve[Mt].value = b, D(ve[Mt]), Ze.maxDepth += ve[Mt].depth), (Mt !== 0 || b !== "") && Z.push(b), Dt = x; } if (Dt && Dt + 1 < L.length) { const Mt = L.slice(Dt + 1); Z.push(Mt), K.tokens && (ve[ve.length - 1].value = Mt, D(ve[ve.length - 1]), Ze.maxDepth += ve[ve.length - 1].depth); } Ze.slashes = H, Ze.parts = Z; } return Ze; }, Mg; } var Bg, L_; function iP() { if (L_) return Bg; L_ = 1; const t = /* @__PURE__ */ Ep(), e = /* @__PURE__ */ Ap(), { MAX_LENGTH: n, POSIX_REGEX_SOURCE: r, REGEX_NON_SPECIAL_CHARS: i, REGEX_SPECIAL_CHARS_BACKREF: o, REPLACEMENTS: u } = t, l = (p, v) => { if (typeof v.expandRange == "function") return v.expandRange(...p, v); p.sort(); const y = `[${p.join("-")}]`; try { new RegExp(y); } catch { return p.map((A) => e.escapeRegex(A)).join(".."); } return y; }, f = (p, v) => `Missing ${p}: "${v}" - use "\\\\${v}" to match literal characters`, d = (p, v) => { if (typeof p != "string") throw new TypeError("Expected a string"); p = u[p] || p; const y = { ...v }, k = typeof y.maxLength == "number" ? Math.min(n, y.maxLength) : n; let A = p.length; if (A > k) throw new SyntaxError(`Input length: ${A}, exceeds maximum allowed length: ${k}`); const E = { type: "bos", value: "", output: y.prepend || "" }, T = [E], D = y.capture ? "" : "?:", R = t.globChars(y.windows), L = t.extglobChars(R), { DOT_LITERAL: j, PLUS_LITERAL: K, SLASH_LITERAL: ue, ONE_CHAR: de, DOTS_SLASH: H, NO_DOT: ve, NO_DOT_SLASH: Z, NO_DOTS_SLASH: we, QMARK: ze, QMARK_NO_DOT: it, STAR: dt, START_ANCHOR: ae } = R, be = (P) => `(${D}(?:(?!${ae}${P.dot ? H : j}).)*?)`, pe = y.dot ? "" : ve, ce = y.dot ? ze : it; let Ee = y.bash === !0 ? be(y) : dt; y.capture && (Ee = `(${Ee})`), typeof y.noext == "boolean" && (y.noextglob = y.noext); const B = { input: p, index: -1, start: 0, dot: y.dot === !0, consumed: "", output: "", prefix: "", backtrack: !1, negated: !1, brackets: 0, braces: 0, parens: 0, quotes: 0, globstar: !1, tokens: T }; p = e.removePrefix(p, B), A = p.length; const M = [], te = [], Te = []; let $ = E, Q; const Ye = () => B.index === A - 1, Ie = B.peek = (P = 1) => p[B.index + P], Ge = B.advance = () => p[++B.index] || "", Re = () => p.slice(B.index + 1), ht = (P = "", x = 0) => { B.consumed += P, B.index += x; }, ft = (P) => { B.output += P.output != null ? P.output : P.value, ht(P.value); }, Je = () => { let P = 1; for (; Ie() === "!" && (Ie(2) !== "(" || Ie(3) === "?"); ) Ge(), B.start++, P++; return P % 2 === 0 ? !1 : (B.negated = !0, B.start++, !0); }, It = (P) => { B[P]++, Te.push(P); }, Rt = (P) => { B[P]--, Te.pop(); }, Ze = (P) => { if ($.type === "globstar") { const x = B.braces > 0 && (P.type === "comma" || P.type === "brace"), b = P.extglob === !0 || M.length && (P.type === "pipe" || P.type === "paren"); P.type !== "slash" && P.type !== "paren" && !x && !b && (B.output = B.output.slice(0, -$.output.length), $.type = "star", $.value = "*", $.output = Ee, B.output += $.output); } if (M.length && P.type !== "paren" && (M[M.length - 1].inner += P.value), (P.value || P.output) && ft(P), $ && $.type === "text" && P.type === "text") { $.output = ($.output || $.value) + P.value, $.value += P.value; return; } P.prev = $, T.push(P), $ = P; }, Dt = (P, x) => { const b = { ...L[x], conditions: 1, inner: "" }; b.prev = $, b.parens = B.parens, b.output = B.output; const F = (y.capture ? "(" : "") + b.open; It("parens"), Ze({ type: P, value: x, output: B.output ? "" : de }), Ze({ type: "paren", extglob: !0, value: Ge(), output: F }), M.push(b); }, Mt = (P) => { let x = P.close + (y.capture ? ")" : ""), b; if (P.type === "negate") { let F = Ee; if (P.inner && P.inner.length > 1 && P.inner.includes("/") && (F = be(y)), (F !== Ee || Ye() || /^\)+$/.test(Re())) && (x = P.close = `)$))${F}`), P.inner.includes("*") && (b = Re()) && /^\.[^\\/.]+$/.test(b)) { const ee = d(b, { ...v, fastpaths: !1 }).output; x = P.close = `)${ee})${F})`; } P.prev.type === "bos" && (B.negatedExtglob = !0); } Ze({ type: "paren", extglob: !0, value: Q, output: x }), Rt("parens"); }; if (y.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(p)) { let P = !1, x = p.replace(o, (b, F, ee, _e, Ae, _t) => _e === "\\" ? (P = !0, b) : _e === "?" ? F ? F + _e + (Ae ? ze.repeat(Ae.length) : "") : _t === 0 ? ce + (Ae ? ze.repeat(Ae.length) : "") : ze.repeat(ee.length) : _e === "." ? j.repeat(ee.length) : _e === "*" ? F ? F + _e + (Ae ? Ee : "") : Ee : F ? b : `\\${b}`); return P === !0 && (y.unescape === !0 ? x = x.replace(/\\/g, "") : x = x.replace(/\\+/g, (b) => b.length % 2 === 0 ? "\\\\" : b ? "\\" : "")), x === p && y.contains === !0 ? (B.output = p, B) : (B.output = e.wrapOutput(x, B, v), B); } for (; !Ye(); ) { if (Q = Ge(), Q === "\0") continue; if (Q === "\\") { const b = Ie(); if (b === "/" && y.bash !== !0 || b === "." || b === ";") continue; if (!b) { Q += "\\", Ze({ type: "text", value: Q }); continue; } const F = /^\\+/.exec(Re()); let ee = 0; if (F && F[0].length > 2 && (ee = F[0].length, B.index += ee, ee % 2 !== 0 && (Q += "\\")), y.unescape === !0 ? Q = Ge() : Q += Ge(), B.brackets === 0) { Ze({ type: "text", value: Q }); continue; } } if (B.brackets > 0 && (Q !== "]" || $.value === "[" || $.value === "[^")) { if (y.posix !== !1 && Q === ":") { const b = $.value.slice(1); if (b.includes("[") && ($.posix = !0, b.includes(":"))) { const F = $.value.lastIndexOf("["), ee = $.value.slice(0, F), _e = $.value.slice(F + 2), Ae = r[_e]; if (Ae) { $.value = ee + Ae, B.backtrack = !0, Ge(), !E.output && T.indexOf($) === 1 && (E.output = de); continue; } } } (Q === "[" && Ie() !== ":" || Q === "-" && Ie() === "]") && (Q = `\\${Q}`), Q === "]" && ($.value === "[" || $.value === "[^") && (Q = `\\${Q}`), y.posix === !0 && Q === "!" && $.value === "[" && (Q = "^"), $.value += Q, ft({ value: Q }); continue; } if (B.quotes === 1 && Q !== '"') { Q = e.escapeRegex(Q), $.value += Q, ft({ value: Q }); continue; } if (Q === '"') { B.quotes = B.quotes === 1 ? 0 : 1, y.keepQuotes === !0 && Ze({ type: "text", value: Q }); continue; } if (Q === "(") { It("parens"), Ze({ type: "paren", value: Q }); continue; } if (Q === ")") { if (B.parens === 0 && y.strictBrackets === !0) throw new SyntaxError(f("opening", "(")); const b = M[M.length - 1]; if (b && B.parens === b.parens + 1) { Mt(M.pop()); continue; } Ze({ type: "paren", value: Q, output: B.parens ? ")" : "\\)" }), Rt("parens"); continue; } if (Q === "[") { if (y.nobracket === !0 || !Re().includes("]")) { if (y.nobracket !== !0 && y.strictBrackets === !0) throw new SyntaxError(f("closing", "]")); Q = `\\${Q}`; } else It("brackets"); Ze({ type: "bracket", value: Q }); continue; } if (Q === "]") { if (y.nobracket === !0 || $ && $.type === "bracket" && $.value.length === 1) { Ze({ type: "text", value: Q, output: `\\${Q}` }); continue; } if (B.brackets === 0) { if (y.strictBrackets === !0) throw new SyntaxError(f("opening", "[")); Ze({ type: "text", value: Q, output: `\\${Q}` }); continue; } Rt("brackets"); const b = $.value.slice(1); if ($.posix !== !0 && b[0] === "^" && !b.includes("/") && (Q = `/${Q}`), $.value += Q, ft({ value: Q }), y.literalBrackets === !1 || e.hasRegexChars(b)) continue; const F = e.escapeRegex($.value); if (B.output = B.output.slice(0, -$.value.length), y.literalBrackets === !0) { B.output += F, $.value = F; continue; } $.value = `(${D}${F}|${$.value})`, B.output += $.value; continue; } if (Q === "{" && y.nobrace !== !0) { It("braces"); const b = { type: "brace", value: Q, output: "(", outputIndex: B.output.length, tokensIndex: B.tokens.length }; te.push(b), Ze(b); continue; } if (Q === "}") { const b = te[te.length - 1]; if (y.nobrace === !0 || !b) { Ze({ type: "text", value: Q, output: Q }); continue; } let F = ")"; if (b.dots === !0) { const ee = T.slice(), _e = []; for (let Ae = ee.length - 1; Ae >= 0 && (T.pop(), ee[Ae].type !== "brace"); Ae--) ee[Ae].type !== "dots" && _e.unshift(ee[Ae].value); F = l(_e, y), B.backtrack = !0; } if (b.comma !== !0 && b.dots !== !0) { const ee = B.output.slice(0, b.outputIndex), _e = B.tokens.slice(b.tokensIndex); b.value = b.output = "\\{", Q = F = "\\}", B.output = ee; for (const Ae of _e) B.output += Ae.output || Ae.value; } Ze({ type: "brace", value: Q, output: F }), Rt("braces"), te.pop(); continue; } if (Q === "|") { M.length > 0 && M[M.length - 1].conditions++, Ze({ type: "text", value: Q }); continue; } if (Q === ",") { let b = Q; const F = te[te.length - 1]; F && Te[Te.length - 1] === "braces" && (F.comma = !0, b = "|"), Ze({ type: "comma", value: Q, output: b }); continue; } if (Q === "/") { if ($.type === "dot" && B.index === B.start + 1) { B.start = B.index + 1, B.consumed = "", B.output = "", T.pop(), $ = E; continue; } Ze({ type: "slash", value: Q, output: ue }); continue; } if (Q === ".") { if (B.braces > 0 && $.type === "dot") { $.value === "." && ($.output = j); const b = te[te.length - 1]; $.type = "dots", $.output += Q, $.value += Q, b.dots = !0; continue; } if (B.braces + B.parens === 0 && $.type !== "bos" && $.type !== "slash") { Ze({ type: "text", value: Q, output: j }); continue; } Ze({ type: "dot", value: Q, output: j }); continue; } if (Q === "?") { if (!($ && $.value === "(") && y.noextglob !== !0 && Ie() === "(" && Ie(2) !== "?") { Dt("qmark", Q); continue; } if ($ && $.type === "paren") { const F = Ie(); let ee = Q; ($.value === "(" && !/[!=<:]/.test(F) || F === "<" && !/<([!=]|\w+>)/.test(Re())) && (ee = `\\${Q}`), Ze({ type: "text", value: Q, output: ee }); continue; } if (y.dot !== !0 && ($.type === "slash" || $.type === "bos")) { Ze({ type: "qmark", value: Q, output: it }); continue; } Ze({ type: "qmark", value: Q, output: ze }); continue; } if (Q === "!") { if (y.noextglob !== !0 && Ie() === "(" && (Ie(2) !== "?" || !/[!=<:]/.test(Ie(3)))) { Dt("negate", Q); continue; } if (y.nonegate !== !0 && B.index === 0) { Je(); continue; } } if (Q === "+") { if (y.noextglob !== !0 && Ie() === "(" && Ie(2) !== "?") { Dt("plus", Q); continue; } if ($ && $.value === "(" || y.regex === !1) { Ze({ type: "plus", value: Q, output: K }); continue; } if ($ && ($.type === "bracket" || $.type === "paren" || $.type === "brace") || B.parens > 0) { Ze({ type: "plus", value: Q }); continue; } Ze({ type: "plus", value: K }); continue; } if (Q === "@") { if (y.noextglob !== !0 && Ie() === "(" && Ie(2) !== "?") { Ze({ type: "at", extglob: !0, value: Q, output: "" }); continue; } Ze({ type: "text", value: Q }); continue; } if (Q !== "*") { (Q === "$" || Q === "^") && (Q = `\\${Q}`); const b = i.exec(Re()); b && (Q += b[0], B.index += b[0].length), Ze({ type: "text", value: Q }); continue; } if ($ && ($.type === "globstar" || $.star === !0)) { $.type = "star", $.star = !0, $.value += Q, $.output = Ee, B.backtrack = !0, B.globstar = !0, ht(Q); continue; } let P = Re(); if (y.noextglob !== !0 && /^\([^?]/.test(P)) { Dt("star", Q); continue; } if ($.type === "star") { if (y.noglobstar === !0) { ht(Q); continue; } const b = $.prev, F = b.prev, ee = b.type === "slash" || b.type === "bos", _e = F && (F.type === "star" || F.type === "globstar"); if (y.bash === !0 && (!ee || P[0] && P[0] !== "/")) { Ze({ type: "star", value: Q, output: "" }); continue; } const Ae = B.braces > 0 && (b.type === "comma" || b.type === "brace"), _t = M.length && (b.type === "pipe" || b.type === "paren"); if (!ee && b.type !== "paren" && !Ae && !_t) { Ze({ type: "star", value: Q, output: "" }); continue; } for (; P.slice(0, 3) === "/**"; ) { const At = p[B.index + 4]; if (At && At !== "/") break; P = P.slice(3), ht("/**", 3); } if (b.type === "bos" && Ye()) { $.type = "globstar", $.value += Q, $.output = be(y), B.output = $.output, B.globstar = !0, ht(Q); continue; } if (b.type === "slash" && b.prev.type !== "bos" && !_e && Ye()) { B.output = B.output.slice(0, -(b.output + $.output).length), b.output = `(?:${b.output}`, $.type = "globstar", $.output = be(y) + (y.strictSlashes ? ")" : "|$)"), $.value += Q, B.globstar = !0, B.output += b.output + $.output, ht(Q); continue; } if (b.type === "slash" && b.prev.type !== "bos" && P[0] === "/") { const At = P[1] !== void 0 ? "|$" : ""; B.output = B.output.slice(0, -(b.output + $.output).length), b.output = `(?:${b.output}`, $.type = "globstar", $.output = `${be(y)}${ue}|${ue}${At})`, $.value += Q, B.output += b.output + $.output, B.globstar = !0, ht(Q + Ge()), Ze({ type: "slash", value: "/", output: "" }); continue; } if (b.type === "bos" && P[0] === "/") { $.type = "globstar", $.value += Q, $.output = `(?:^|${ue}|${be(y)}${ue})`, B.output = $.output, B.globstar = !0, ht(Q + Ge()), Ze({ type: "slash", value: "/", output: "" }); continue; } B.output = B.output.slice(0, -$.output.length), $.type = "globstar", $.output = be(y), $.value += Q, B.output += $.output, B.globstar = !0, ht(Q); continue; } const x = { type: "star", value: Q, output: Ee }; if (y.bash === !0) { x.output = ".*?", ($.type === "bos" || $.type === "slash") && (x.output = pe + x.output), Ze(x); continue; } if ($ && ($.type === "bracket" || $.type === "paren") && y.regex === !0) { x.output = Q, Ze(x); continue; } (B.index === B.start || $.type === "slash" || $.type === "dot") && ($.type === "dot" ? (B.output += Z, $.output += Z) : y.dot === !0 ? (B.output += we, $.output += we) : (B.output += pe, $.output += pe), Ie() !== "*" && (B.output += de, $.output += de)), Ze(x); } for (; B.brackets > 0; ) { if (y.strictBrackets === !0) throw new SyntaxError(f("closing", "]")); B.output = e.escapeLast(B.output, "["), Rt("brackets"); } for (; B.parens > 0; ) { if (y.strictBrackets === !0) throw new SyntaxError(f("closing", ")")); B.output = e.escapeLast(B.output, "("), Rt("parens"); } for (; B.braces > 0; ) { if (y.strictBrackets === !0) throw new SyntaxError(f("closing", "}")); B.output = e.escapeLast(B.output, "{"), Rt("braces"); } if (y.strictSlashes !== !0 && ($.type === "star" || $.type === "bracket") && Ze({ type: "maybe_slash", value: "", output: `${ue}?` }), B.backtrack === !0) { B.output = ""; for (const P of B.tokens) B.output += P.output != null ? P.output : P.value, P.suffix && (B.output += P.suffix); } return B; }; return d.fastpaths = (p, v) => { const y = { ...v }, k = typeof y.maxLength == "number" ? Math.min(n, y.maxLength) : n, A = p.length; if (A > k) throw new SyntaxError(`Input length: ${A}, exceeds maximum allowed length: ${k}`); p = u[p] || p; const { DOT_LITERAL: E, SLASH_LITERAL: T, ONE_CHAR: D, DOTS_SLASH: R, NO_DOT: L, NO_DOTS: j, NO_DOTS_SLASH: K, STAR: ue, START_ANCHOR: de } = t.globChars(y.windows), H = y.dot ? j : L, ve = y.dot ? K : L, Z = y.capture ? "" : "?:", we = { negated: !1, prefix: "" }; let ze = y.bash === !0 ? ".*?" : ue; y.capture && (ze = `(${ze})`); const it = (pe) => pe.noglobstar === !0 ? ze : `(${Z}(?:(?!${de}${pe.dot ? R : E}).)*?)`, dt = (pe) => { switch (pe) { case "*": return `${H}${D}${ze}`; case ".*": return `${E}${D}${ze}`; case "*.*": return `${H}${ze}${E}${D}${ze}`; case "*/*": return `${H}${ze}${T}${D}${ve}${ze}`; case "**": return H + it(y); case "**/*": return `(?:${H}${it(y)}${T})?${ve}${D}${ze}`; case "**/*.*": return `(?:${H}${it(y)}${T})?${ve}${ze}${E}${D}${ze}`; case "**/.*": return `(?:${H}${it(y)}${T})?${E}${D}${ze}`; default: { const ce = /^(.*?)\.(\w+)$/.exec(pe); if (!ce) return; const Ee = dt(ce[1]); return Ee ? Ee + E + ce[2] : void 0; } } }, ae = e.removePrefix(p, we); let be = dt(ae); return be && y.strictSlashes !== !0 && (be += `${T}?`), be; }, Bg = d, Bg; } var jg, U_; function oP() { if (U_) return jg; U_ = 1; const t = /* @__PURE__ */ rP(), e = /* @__PURE__ */ iP(), n = /* @__PURE__ */ Ap(), r = /* @__PURE__ */ Ep(), i = (u) => u && typeof u == "object" && !Array.isArray(u), o = (u, l, f = !1) => { if (Array.isArray(u)) { const T = u.map((R) => o(R, l, f)); return (R) => { for (const L of T) { const j = L(R); if (j) return j; } return !1; }; } const d = i(u) && u.tokens && u.input; if (u === "" || typeof u != "string" && !d) throw new TypeError("Expected pattern to be a non-empty string"); const p = l || {}, v = p.windows, y = d ? o.compileRe(u, l) : o.makeRe(u, l, !1, !0), k = y.state; delete y.state; let A = () => !1; if (p.ignore) { const T = { ...l, ignore: null, onMatch: null, onResult: null }; A = o(p.ignore, T, f); } const E = (T, D = !1) => { const { isMatch: R, match: L, output: j } = o.test(T, y, l, { glob: u, posix: v }), K = { glob: u, state: k, regex: y, posix: v, input: T, output: j, match: L, isMatch: R }; return typeof p.onResult == "function" && p.onResult(K), R === !1 ? (K.isMatch = !1, D ? K : !1) : A(T) ? (typeof p.onIgnore == "function" && p.onIgnore(K), K.isMatch = !1, D ? K : !1) : (typeof p.onMatch == "function" && p.onMatch(K), D ? K : !0); }; return f && (E.state = k), E; }; return o.test = (u, l, f, { glob: d, posix: p } = {}) => { if (typeof u != "string") throw new TypeError("Expected input to be a string"); if (u === "") return { isMatch: !1, output: "" }; const v = f || {}, y = v.format || (p ? n.toPosixSlashes : null); let k = u === d, A = k && y ? y(u) : u; return k === !1 && (A = y ? y(u) : u, k = A === d), (k === !1 || v.capture === !0) && (v.matchBase === !0 || v.basename === !0 ? k = o.matchBase(u, l, f, p) : k = l.exec(A)), { isMatch: !!k, match: k, output: A }; }, o.matchBase = (u, l, f) => (l instanceof RegExp ? l : o.makeRe(l, f)).test(n.basename(u)), o.isMatch = (u, l, f) => o(l, f)(u), o.parse = (u, l) => Array.isArray(u) ? u.map((f) => o.parse(f, l)) : e(u, { ...l, fastpaths: !1 }), o.scan = (u, l) => t(u, l), o.compileRe = (u, l, f = !1, d = !1) => { if (f === !0) return u.output; const p = l || {}, v = p.contains ? "" : "^", y = p.contains ? "" : "$"; let k = `${v}(?:${u.output})${y}`; u && u.negated === !0 && (k = `^(?!${k}).*$`); const A = o.toRegex(k, l); return d === !0 && (A.state = u), A; }, o.makeRe = (u, l = {}, f = !1, d = !1) => { if (!u || typeof u != "string") throw new TypeError("Expected a non-empty string"); let p = { negated: !1, fastpaths: !0 }; return l.fastpaths !== !1 && (u[0] === "." || u[0] === "*") && (p.output = e.fastpaths(u, l)), p.output || (p = e(u, l)), o.compileRe(p, l, f, d); }, o.toRegex = (u, l) => { try { const f = l || {}; return new RegExp(u, f.flags || (f.nocase ? "i" : "")); } catch (f) { if (l && l.debug === !0) throw f; return /$^/; } }, o.constants = r, jg = o, jg; } var $g, M_; function sP() { if (M_) return $g; M_ = 1; const t = /* @__PURE__ */ oP(), e = /* @__PURE__ */ Ap(); function n(r, i, o = !1) { return i && (i.windows === null || i.windows === void 0) && (i = { ...i, windows: e.isWindows() }), t(r, i, o); } return Object.assign(n, t), $g = n, $g; } var aP = /* @__PURE__ */ sP(); const B_ = /* @__PURE__ */ Bs(aP), j_ = "loglevel-patterns", Qf = "loglevel:", Vg = "!", uP = Sn.INFO; class lP { projectPrefix; patternsCache = null; /** * Initializes the service with a specific project name. * @param project - The project for which log levels are managed. */ constructor(e) { this.projectPrefix = `${Qf}${e}:`; } /** * Retrieves the log level for a given context. * Resolves the most specific match, considering override rules. * @param context - The specific context to retrieve the log level for. * @returns The resolved log level. */ getLevel(e) { const n = this.loadAndUnifyPatterns(); return this.resolveLogLevelFromPatterns(e, n) || uP; } /** * Sets the log level for a specific context as an individual key. * @param context - The specific context for which to set the log level. * @param level - The log level to set, optionally with "!". */ setLevel(e, n) { const { level: r, override: i } = this.parseLogLevel(n), o = `${Qf}${e}`, u = i ? `${r}${Vg}` : r; localStorage.setItem(o, u), this.patternsCache = null; } /** * Loads and unifies patterns from both loglevel-patterns and individual keys. * Ensures the process is done only once per app lifecycle. * @returns A unified map of patterns. */ loadAndUnifyPatterns() { if (this.patternsCache) return this.patternsCache; const e = this.readPatternsFromJSON(), n = this.unifyWithIndividualKeys(e); return this.patternsCache = n, n; } /** * Resolves the log level for a context using the unified patterns. * Handles override logic and prioritizes more specific matches. * @param context - The context to resolve the log level for. * @param patterns - The unified patterns map. * @returns The resolved log level, or undefined if no match is found. */ resolveLogLevelFromPatterns(e, n) { let r; for (const [i, { level: o, override: u }] of Object.entries(n)) if (B_(i.toLowerCase())(e.toLowerCase())) { if (u) return o; (!r || B_(i)(e)) && (r = o); } return r; } /** * Reads patterns from loglevel-patterns in localStorage. * @returns The parsed patterns map. */ readPatternsFromJSON() { try { const e = localStorage.getItem(j_); return e ? JSON.parse(e) : {}; } catch { return console.error("Failed to parse loglevel-patterns from localStorage"), {}; } } /** * Unifies patterns from loglevel-patterns with individual keys from localStorage. * @param basePatterns - The base patterns loaded from loglevel-patterns. * @returns A unified map of patterns. */ unifyWithIndividualKeys(e) { const n = { ...e }; for (let r = 0; r < localStorage.length; r++) { const i = localStorage.key(r); if (!i || !i.startsWith(Qf) || i === j_) continue; const o = i.replace(Qf, "").toLowerCase(), u = localStorage.getItem(i); if (!u) continue; const { level: l, override: f } = this.parseLogLevel(u); n[o] = { level: l, override: f }; } return n; } /** * Parses a log level string, identifying if it's an override. * @param value - The value to parse (e.g., "ERROR!"). * @returns An object with the level and override flag. */ parseLogLevel(e) { const n = e.endsWith(Vg), r = n ? e.slice(0, -Vg.length) : e; if (!qA(r)) throw new g0(r); return { level: r, override: n }; } } class cP { constructor(e, n) { this.adapter = e, n && (this.chainOptions = { ...n }), Promise.resolve().then(() => this.commit()); } committed = !1; chainOptions = {}; method = null; stack = ""; args = []; options(e) { return this.chainOptions = { ...this.chainOptions, ...e }, this; } trace(...e) { return this.log("trace", e); } debug(...e) { return this.log("debug", e); } info(...e) { return this.log("info", e); } warn(...e) { return this.log("warn", e); } error(...e) { return this.log("error", e); } fatal(...e) { return this.log("fatal", e); } log(e, n) { return this.method = e, this.args = n, this.stack = new Error().stack ?? "", this; } commit() { if (!this.committed && (this.committed = !0, this.method)) { const e = this.args[0], n = this.args.slice(1), r = { stack: this.stack, content: { message: e, args: n }, options: this.chainOptions }; this.adapter[this.method](r); } } } let HA = class ay { adapter; /** * Private constructor to enforce instantiation through `Logger.create()`. * * @param {LoggerAdapter} adapter - The logging adapter implementation. */ constructor(e) { this.adapter = e; } /** * Factory Static Method to create a new Logger instance. * * This method accepts a logging adapter and returns a new Logger instance. * * @param {LoggerAdapter} adapter - The logging adapter implementation. * @returns {Logger} A new Logger instance. * * @example * ```ts * const logger = Logger.create(new PinoAdapter(config)); * ``` */ static create(e) { const n = new ay(e); return n.setMetadata({ account: null, client: JA() }), n; } /** * Creates a child logger with additional context. * * The child logger inherits the parent's configuration and metadata. * * @param {string} name - The context to append to the logger's source. * @param {LoggerMetadata} [metadata={}] - Additional metadata for the child logger. * @returns {Logger} A new child Logger instance. * * @example * ```ts * const userLogger = logger.child('UserService'); * userLogger.info('Fetching user data'); * ``` */ child(e, n = {}) { return new ay(this.adapter.child(e, n)); } /** * Creates a lazy child logger with delayed initialization. * * The lazy child logger is a proxy that initializes the child logger only when its methods are first accessed. * * @param {string} name - The context name for the lazy child logger. * @param {LoggerMetadata} [metadata={}] - Additional metadata for the lazy child logger. * @returns {Logger} A new lazy child Logger instance. * * @example * ```ts * const lazyLogger = logger.lazyChild('Deferred'); * lazyLogger.info('This is executed only when used'); * ``` */ lazyChild(e, n = {}) { let r; return new Proxy({}, { get: (i, o, u) => (r || (r = this.child(e, n)), Reflect.get(r, o, u)) }); } /** * Sets or updates the metadata for the logger. * * The provided metadata is merged with existing global metadata and included in every log entry. * * @param {LoggerMetadata} metadata - The metadata to set. * * @example * ```ts * logger.setMetadata({ account: '1234', user: 'admin' }); * ``` */ setMetadata(e) { this.adapter.setMetadata(e); } /** * Sets the log level. * * @param {LogLevel} level - The new log level to be set. * @throws {Error} Throws an error if the provided log level is invalid. */ setLevel(e) { if (!qA(e)) throw new g0(e); this.adapter.setLevel(e); } /** * Creates a new instance of LoggerChain for chaining log calls with optional settings. * * @param {LogOptions} [initialOptions] - Optional log options. * @returns {LoggerChain} A new LoggerChain instance. */ createChain(e) { return new cP(this.adapter, e); } /** * Logs a **trace-level** message for deep debugging. * * Use this for very detailed logs that help trace the execution flow. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.trace('Function execution trace', { function: 'fetchData' }); * ``` */ trace(...e) { return this.createChain().trace(...e); } /** * Logs a **debug-level** message for troubleshooting. * * Use this for diagnostic information useful during development. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.debug('User session data', session); * ``` */ debug(...e) { return this.createChain().debug(...e); } /** * Logs an **info-level** message for general system events. * * Use this for regular information that tracks system operations. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.info('User logged in', { userId: 123 }); * ``` */ info(...e) { return this.createChain().info(...e); } /** * Logs a **warning-level** message to indicate potential issues. * * Use this when an unexpected event occurs but the application can continue operating. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.warn('API response took too long', { duration: 5000 }); * ``` */ warn(...e) { return this.createChain().warn(...e); } /** * Logs an **error-level** message for recoverable failures. * * Use this when an error occurs that does not require immediate termination of the application. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.error(new Error('Database connection lost')); * ``` */ error(...e) { return this.createChain().error(...e); } /** * Logs a **fatal-level** message for critical failures. * * Use this when an unrecoverable error occurs and the system must be terminated. * * @param {...any} args - The log message and optional additional data. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.fatal('Critical system failure', { code: 'SYSTEM_CRASH' }); * ``` */ fatal(...e) { return this.createChain().fatal(...e); } /** * Sets the log options for the current chain. * * This method allows modifying log behavior (e.g., silencing the console output) * before calling a log method. * * @param {LogOptions} opts - The log options to apply. * @returns {LoggerChain} A chainable logger instance. * * @example * ```ts * logger.options({ silent: true }).error(new Error('Silent error')); * ``` */ options(e) { return this.createChain(e); } }; function y0(t) { return Kn().baseLogger.lazyChild(t); } function KA(t, e) { return HA.create( new ei({ source: t, levelService: new lP(t), consoleLogger: new nP(), httpLogger: v0.create({ db: e, project: t }) }) ); } const dP = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"; let fP = (t = 21) => { let e = "", n = crypto.getRandomValues(new Uint8Array(t)); for (; t--; ) e += dP[n[t] & 63]; return e; }; const Us = (t = 8) => fP(t), uy = (t, e = !1) => { const n = Object.entries(t).reduce((r, [i, o]) => o !== void 0 && (!e || o !== null) ? `${r}${r ? "&" : ""}${i}=${o}` : r, ""); return n ? `?${n}` : ""; }, GA = (t) => { const e = document.getElementById(t); return e ? new URL(e.src).searchParams : new URLSearchParams(); }; function hP() { const t = new Error().stack.split(` `); return t.length < 3 ? "" : t[2].trim().substring(3); } function WA(t) { return new Promise((e) => setTimeout(e, t)); } class Xi { static version = "11"; static instanceRef; projectName = "nizza"; instanceId = Us(); db = new KO(); baseLogger = KA(this.projectName, this.db); coreLogger = this.baseLogger.child("core"); logger = this.coreLogger.child("NizzaStore"); eventBus = new BA( this.projectName, this.coreLogger ); cfg = null; accountData; statusInternal = "idle"; currentFetchId = null; pds; constructor() { SO( this, { projectName: !1, instanceId: !1, db: !1, logger: !1, coreLogger: !1, eventBus: !1 }, { autoBind: !0 } ), d0( () => [this.cfg?.account, this.cfg?.authToken], ([e, n]) => { e && this.loadAccount(e, !!n); }, { delay: 500, equals: Ga.shallow } ); } /** * Returns the singleton instance. */ static instance() { const e = window; return e.nizza?.store ? Xi.instanceRef = e.nizza.store : (Xi.instanceRef = new Xi(), Xi.instanceRef.logger.debug("Created NizzaStore")), e.nizza = e.nizza || {}, e.nz = e.nz || e.nizza, e.nizza.store = Xi.instanceRef, e.nz = e.nizza, Xi.instanceRef; } /** * Initializes config and triggers account load. * @param config Full NizzaConfig */ async configure(e) { try { this.logger.debug("Configuring NizzaStore", e), await this.applyConfig(e); } catch (n) { this.setStatus("error"), this.logger.error("Configuration error", n); } } /** * Updates configuration and sets product source. * @param config Partial */ async applyConfig(e = {}) { this.cfg = { ...this.cfg, ...e }, e.getProductDataSource && this.setProductDataSource(await e.getProductDataSource()); } /** * Loads account from API with supersede check. * @param name Account identifier * @param isPrivate Fetch private account if true */ async loadAccount(e, n) { this.setStatus("loading"); const r = Us(); this.currentFetchId = r, this.logger.setMetadata({ account: e }); try { const i = await jx(e, n); if (this.currentFetchId !== r) return; this.setAccount(i), this.setStatus("success"), this.logger.debug("Account loaded", i); } catch (i) { if (this.currentFetchId !== r) return; this.setStatus("error"), i instanceof M0 ? this.logger.fatal("Account not found", e).options({ silent: !0 }) : this.logger.fatal("Error loading account", i); } } /** @param account NizzaAccount | PrivateNizzaAccount */ setAccount(e) { this.accountData = e; } /** @param status AccountStatus */ setStatus(e) { this.statusInternal = e; } /** @param source NizzaProductDataSource */ setProductDataSource(e) { this.pds = e; } /** @param id Product identifier */ setProductId(e) { this.cfg && (this.cfg.productId = e); } /** @param id Order form identifier */ setOrderFormId(e) { this.cfg && (this.cfg.orderFormId = e); } /** @param config AddToCartConfig - must call configure() first */ setAddToCartConfig(e) { if (!this.cfg) throw new Error("Call configure() first"); this.cfg.addToCartConfig = e; } /** @param token Authentication token */ setAuthToken(e) { this.applyConfig({ authToken: e }); } /** Forces reload of current account */ async refetchAccount() { this.cfg?.account && await this.loadAccount(this.cfg.account, !!this.cfg.authToken); } /** * Reset account state and related config fields to their initial values. */ resetAccount() { this.accountData = void 0, this.statusInternal = "idle", this.currentFetchId = null, this.pds = void 0, this.cfg && (this.cfg.account = void 0, this.cfg.authToken = void 0, this.cfg.productId = null, this.cfg.orderFormId = null), this.logger.debug( "Account state and related config fields have been reset" ); } /** @returns Current version */ get version() { return Xi.version; } /** @returns Active configuration */ get config() { return this.cfg; } /** @returns Loaded account data */ get account() { return this.accountData; } /** @returns Current fetch status */ get accountStatus() { return this.statusInternal; } /** @returns Configured account name */ get accountName() { return this.cfg?.account; } /** @returns True if using private account */ isPvtAccount(e) { return !!(e && this.cfg?.authToken); } /** @returns True if using public account */ isPubAccount(e) { return !!(e && !this.cfg?.authToken); } /** @returns Product data source */ get productDataSource() { return this.pds; } } const Kn = (t) => { const e = Xi.instance(); return NA( () => !!e.account, () => t?.(e) ), e; }; function w0() { return gt.useMemo(() => Kn(), []); } function YA(t, e) { const n = w0(); return UA(() => t(n), e); } const { coreLogger: pP } = Kn(), mP = pP.child("getClientTimeZone"); function QA(t = !1) { let e = null, n = null, r = null; try { e = Intl.DateTimeFormat()?.resolvedOptions()?.timeZone ?? null; const o = -(/* @__PURE__ */ new Date()).getTimezoneOffset(); r = o; const u = o >= 0 ? "+" : "-", l = String( Math.floor(Math.abs(o) / 60) ).padStart(2, "0"), f = String(Math.abs(o) % 60).padStart( 2, "0" ); n = `${u}${l}:${f}`; } catch (o) { mP.error("Error obtaining time zone or offset", o); } const i = { offset: n, offsetValue: r, value: e, country: null, included: null, label: null }; if (t) { const { country: o, included: u, label: l, ...f } = i; return f; } return i; } function JA() { const e = typeof navigator < "u" ? navigator.userAgent : "server", n = gP(e), { language: r, languages: i } = vP(), o = yP(), u = wP(), { hardwareConcurrency: l, deviceMemory: f } = SP(), d = _P(); return { userAgent: e, browser: n.browser, os: n.os, device: n.device, language: r, languages: i, screen: o, connection: u, hardwareConcurrency: l, deviceMemory: f, timezone: d }; } function gP(t) { try { const n = new Uo(t).getResult(); return { browser: { name: n.browser.name || "Unknown", version: n.browser.version || "Unknown" }, os: { name: n.os.name || "Unknown", version: n.os.version || "Unknown" }, device: { model: n.device.model || "Unknown", // For desktop, UAParser.js may not set device.type; fallback to 'Desktop' type: n.device.type || "Desktop", vendor: n.device.vendor || "Unknown" } }; } catch (e) { return console.error("Error parsing user agent:", e), { browser: { name: "Unknown", version: "Unknown" }, os: { name: "Unknown", version: "Unknown" }, device: { model: "Unknown", type: "Desktop", vendor: "Unknown" } }; } } function vP() { return typeof navigator < "u" ? { language: navigator.language || "Unknown", languages: navigator.languages ? [...navigator.languages] : [] } : { language: "Unknown", languages: [] }; } function yP() { return typeof window < "u" && window.screen ? { width: window.screen.width, height: window.screen.height, colorDepth: window.screen.colorDepth } : null; } function wP() { if (typeof navigator < "u" && "connection" in navigator) { const t = navigator.connection; return { downlink: t?.downlink ?? 0, effectiveType: t?.effectiveType ?? "Unknown", rtt: t?.rtt ?? 0, saveData: t?.saveData ?? !1 }; } return null; } function SP() { return typeof navigator < "u" ? { hardwareConcurrency: navigator.hardwareConcurrency || null, deviceMemory: navigator.deviceMemory || null } : { hardwareConcurrency: null, deviceMemory: null }; } function _P() { try { return QA(!0); } catch (t) { return console.error("Error retrieving client timezone:", t), { offset: null, offsetValue: null, value: "Unknown", country: null, included: null, label: null }; } } var bP = "Logging", kP = function(t) { var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], r = 0; if (n) return n.call(t); if (t && typeof t.length == "number") return { next: function() { return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t }; } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); }, EP = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, o = [], u; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) o.push(i.value); } catch (l) { u = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (u) throw u.error; } } return o; }, qu = function() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(EP(arguments[e])); return t; }, $_ = { VERBOSE: 1, DEBUG: 2, INFO: 3, WARN: 4, ERROR: 5 }, Ei; (function(t) { t.DEBUG = "DEBUG", t.ERROR = "ERROR", t.INFO = "INFO", t.WARN = "WARN", t.VERBOSE = "VERBOSE"; })(Ei || (Ei = {})); var Pi = ( /** @class */ function() { function t(e, n) { n === void 0 && (n = Ei.WARN), this.name = e, this.level = n, this._pluggables = []; } return t.prototype._padding = function(e) { return e < 10 ? "0" + e : "" + e; }, t.prototype._ts = function() { var e = /* @__PURE__ */ new Date(); return [this._padding(e.getMinutes()), this._padding(e.getSeconds())].join(":") + "." + e.getMilliseconds(); }, t.prototype.configure = function(e) { return e ? (this._config = e, this._config) : this._config; }, t.prototype._log = function(e) { for (var n, r, i = [], o = 1; o < arguments.length; o++) i[o - 1] = arguments[o]; var u = this.level; t.LOG_LEVEL && (u = t.LOG_LEVEL), typeof window < "u" && window.LOG_LEVEL && (u = window.LOG_LEVEL); var l = $_[u], f = $_[e]; if (f >= l) { var d = console.log.bind(console); e === Ei.ERROR && console.error && (d = console.error.bind(console)), e === Ei.WARN && console.warn && (d = console.warn.bind(console)); var p = "[" + e + "] " + this._ts() + " " + this.name, v = ""; if (i.length === 1 && typeof i[0] == "string") v = p + " - " + i[0], d(v); else if (i.length === 1) v = p + " " + i[0], d(p, i[0]); else if (typeof i[0] == "string") { var y = i.slice(1); y.length === 1 && (y = y[0]), v = p + " - " + i[0] + " " + y, d(p + " - " + i[0], y); } else v = p + " " + i, d(p, i); try { for (var k = kP(this._pluggables), A = k.next(); !A.done; A = k.next()) { var E = A.value, T = { message: v, timestamp: Date.now() }; E.pushLogs([T]); } } catch (D) { n = { error: D }; } finally { try { A && !A.done && (r = k.return) && r.call(k); } finally { if (n) throw n.error; } } } }, t.prototype.log = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, qu([Ei.INFO], e)); }, t.prototype.info = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, qu([Ei.INFO], e)); }, t.prototype.warn = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, qu([Ei.WARN], e)); }, t.prototype.error = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, qu([Ei.ERROR], e)); }, t.prototype.debug = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, qu([Ei.DEBUG], e)); }, t.prototype.verbose = function() { for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n]; this._log.apply(this, qu([Ei.VERBOSE], e)); }, t.prototype.addPluggable = function(e) { e && e.getCategoryName() === bP && (this._pluggables.push(e), e.configure(this._config)); }, t.prototype.listPluggables = function() { return this._pluggables; }, t.LOG_LEVEL = null, t; }() ), AP = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, o = [], u; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) o.push(i.value); } catch (l) { u = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (u) throw u.error; } } return o; }, zg = new Pi("Amplify"), CP = ( /** @class */ function() { function t() { this._components = [], this._config = {}, this._modules = {}, this.Auth = null, this.Analytics = null, this.API = null, this.Credentials = null, this.Storage = null, this.I18n = null, this.Cache = null, this.PubSub = null, this.Interactions = null, this.Pushnotification = null, this.UI = null, this.XR = null, this.Predictions = null, this.DataStore = null, this.Geo = null, this.Logger = Pi, this.ServiceWorker = null; } return t.prototype.register = function(e) { zg.debug("component registered in amplify", e), this._components.push(e), typeof e.getModuleName == "function" ? (this._modules[e.getModuleName()] = e, this[e.getModuleName()] = e) : zg.debug("no getModuleName method for component", e), e.configure(this._config); }, t.prototype.configure = function(e) { var n = this; return e ? (this._config = Object.assign(this._config, e), zg.debug("amplify config", this._config), Object.entries(this._modules).forEach(function(r) { var i = AP(r, 2); i[0]; var o = i[1]; Object.keys(o).forEach(function(u) { n._modules[u] && (o[u] = n._modules[u]); }); }), this._components.map(function(r) { r.configure(n._config); }), this._config) : this._config; }, t.prototype.addPluggable = function(e) { e && e.getCategory && typeof e.getCategory == "function" && this._components.map(function(n) { n.addPluggable && typeof n.addPluggable == "function" && n.addPluggable(e); }); }, t; }() ), S0 = new CP(), xP = "4.7.14", ly = "aws-amplify/" + xP, Na = { userAgent: ly + " js", product: "", navigator: null, isReactNative: !1 }; if (typeof navigator < "u" && navigator.product) switch (Na.product = navigator.product || "", Na.navigator = navigator || null, navigator.product) { case "ReactNative": Na.userAgent = ly + " react-native", Na.isReactNative = !0; break; default: Na.userAgent = ly + " js", Na.isReactNative = !1; break; } var NP = function(t) { return "" + Na.userAgent; }, Zc = function() { return Zc = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Zc.apply(this, arguments); }, XA = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, o = [], u; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) o.push(i.value); } catch (l) { u = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (u) throw u.error; } } return o; }, V_ = function() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(XA(arguments[e])); return t; }, To = new Pi("Hub"), TP = typeof Symbol < "u" && typeof Symbol.for == "function" ? Symbol.for("amplify_default") : "@@amplify_default"; function IP(t) { return t.onHubCapsule !== void 0; } var RP = ( /** @class */ function() { function t(e) { this.listeners = [], this.patterns = [], this.protectedChannels = [ "core", "auth", "api", "analytics", "interactions", "pubsub", "storage", "ui", "xr" ], this.name = e; } return t.prototype.remove = function(e, n) { if (e instanceof RegExp) { var r = this.patterns.find(function(o) { var u = o.pattern; return u.source === e.source; }); if (!r) { To.warn("No listeners for " + e); return; } this.patterns = V_(this.patterns.filter(function(o) { return o !== r; })); } else { var i = this.listeners[e]; if (!i) { To.warn("No listeners for " + e); return; } this.listeners[e] = V_(i.filter(function(o) { var u = o.callback; return u !== n; })); } }, t.prototype.dispatch = function(e, n, r, i) { if (r === void 0 && (r = ""), this.protectedChannels.indexOf(e) > -1) { var o = i === TP; o || To.warn("WARNING: " + e + " is protected and dispatching on it can have unintended consequences"); } var u = { channel: e, payload: Zc({}, n), source: r, patternInfo: [] }; try { this._toListeners(u); } catch (l) { To.error(l); } }, t.prototype.listen = function(e, n, r) { var i = this; r === void 0 && (r = "noname"); var o; if (IP(n)) To.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."), o = n.onHubCapsule.bind(n); else { if (typeof n != "function") throw new Error("No callback supplied to Hub"); o = n; } if (e instanceof RegExp) this.patterns.push({ pattern: e, callback: o }); else { var u = this.listeners[e]; u || (u = [], this.listeners[e] = u), u.push({ name: r, callback: o }); } return function() { i.remove(e, o); }; }, t.prototype._toListeners = function(e) { var n = e.channel, r = e.payload, i = this.listeners[n]; if (i && i.forEach(function(u) { To.debug("Dispatching to " + n + " with ", r); try { u.callback(e); } catch (l) { To.error(l); } }), this.patterns.length > 0) { if (!r.message) { To.warn("Cannot perform pattern matching without a message key"); return; } var o = r.message; this.patterns.forEach(function(u) { var l = o.match(u.pattern); if (l) { var f = XA(l), d = f.slice(1), p = Zc(Zc({}, e), { patternInfo: d }); try { u.callback(p); } catch (v) { To.error(v); } } }); } }, t; }() ), _s = new RP("__default__"), OP = function(t) { if (t.isResolved) return t; var e = !0, n = !1, r = !1, i = t.then(function(o) { return r = !0, e = !1, o; }, function(o) { throw n = !0, e = !1, o; }); return i.isFullfilled = function() { return r; }, i.isPending = function() { return e; }, i.isRejected = function() { return n; }, i; }, jo = function() { var t = typeof window < "u" && typeof window.document < "u", e = typeof process < "u" && process.versions != null && process.versions.node != null; return { isBrowser: t, isNode: e }; }; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var cy = function(t, e) { return cy = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) { n.__proto__ = r; } || function(n, r) { for (var i in r) r.hasOwnProperty(i) && (n[i] = r[i]); }, cy(t, e); }; function _0(t, e) { cy(t, e); function n() { this.constructor = t; } t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n()); } var Tt = function() { return Tt = Object.assign || function(e) { for (var n, r = 1, i = arguments.length; r < i; r++) { n = arguments[r]; for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]); } return e; }, Tt.apply(this, arguments); }; function b0(t, e) { var n = {}; for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]); if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, r = Object.getOwnPropertySymbols(t); i < r.length; i++) e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]); return n; } function PP(t, e, n, r) { var i = arguments.length, o = i < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, n) : r, u; if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(t, e, n, r); else for (var l = t.length - 1; l >= 0; l--) (u = t[l]) && (o = (i < 3 ? u(o) : i > 3 ? u(e, n, o) : u(e, n)) || o); return i > 3 && o && Object.defineProperty(e, n, o), o; } function DP(t, e) { return function(n, r) { e(n, r, t); }; } function FP(t, e) { if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, e); } function sn(t, e, n, r) { function i(o) { return o instanceof n ? o : new n(function(u) { u(o); }); } return new (n || (n = Promise))(function(o, u) { function l(p) { try { d(r.next(p)); } catch (v) { u(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { u(v); } } function d(p) { p.done ? o(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); } function tn(t, e) { var n = { label: 0, sent: function() { if (o[0] & 1) throw o[1]; return o[1]; }, trys: [], ops: [] }, r, i, o, u; return u = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() { return this; }), u; function l(d) { return function(p) { return f([d, p]); }; } function f(d) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (o = d[0] & 2 ? i.return : d[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, d[1])).done) return o; switch (i = 0, o && (d = [d[0] & 2, o.value]), d[0]) { case 0: case 1: o = d; break; case 4: return n.label++, { value: d[1], done: !1 }; case 5: n.label++, i = d[1], d = [0]; continue; case 7: d = n.ops.pop(), n.trys.pop(); continue; default: if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!o || d[1] > o[0] && d[1] < o[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < o[1]) { n.label = o[1], o = d; break; } if (o && n.label < o[2]) { n.label = o[2], n.ops.push(d); break; } o[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = o = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } } function LP(t, e, n, r) { r === void 0 && (r = n), t[r] = e[n]; } function UP(t, e) { for (var n in t) n !== "default" && !e.hasOwnProperty(n) && (e[n] = t[n]); } function Tr(t) { var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], r = 0; if (n) return n.call(t); if (t && typeof t.length == "number") return { next: function() { return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t }; } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } function Cl(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, o = [], u; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) o.push(i.value); } catch (l) { u = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (u) throw u.error; } } return o; } function io() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(Cl(arguments[e])); return t; } function MP() { for (var t = 0, e = 0, n = arguments.length; e < n; e++) t += arguments[e].length; for (var r = Array(t), i = 0, e = 0; e < n; e++) for (var o = arguments[e], u = 0, l = o.length; u < l; u++, i++) r[i] = o[u]; return r; } function hd(t) { return this instanceof hd ? (this.v = t, this) : new hd(t); } function BP(t, e, n) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var r = n.apply(t, e || []), i, o = []; return i = {}, u("next"), u("throw"), u("return"), i[Symbol.asyncIterator] = function() { return this; }, i; function u(y) { r[y] && (i[y] = function(k) { return new Promise(function(A, E) { o.push([y, k, A, E]) > 1 || l(y, k); }); }); } function l(y, k) { try { f(r[y](k)); } catch (A) { v(o[0][3], A); } } function f(y) { y.value instanceof hd ? Promise.resolve(y.value.v).then(d, p) : v(o[0][2], y); } function d(y) { l("next", y); } function p(y) { l("throw", y); } function v(y, k) { y(k), o.shift(), o.length && l(o[0][0], o[0][1]); } } function jP(t) { var e, n; return e = {}, r("next"), r("throw", function(i) { throw i; }), r("return"), e[Symbol.iterator] = function() { return this; }, e; function r(i, o) { e[i] = t[i] ? function(u) { return (n = !n) ? { value: hd(t[i](u)), done: i === "return" } : o ? o(u) : u; } : o; } } function $P(t) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var e = t[Symbol.asyncIterator], n; return e ? e.call(t) : (t = typeof Tr == "function" ? Tr(t) : t[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() { return this; }, n); function r(o) { n[o] = t[o] && function(u) { return new Promise(function(l, f) { u = t[o](u), i(l, f, u.done, u.value); }); }; } function i(o, u, l, f) { Promise.resolve(f).then(function(d) { o({ value: d, done: l }); }, u); } } function VP(t, e) { return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t; } function zP(t) { if (t && t.__esModule) return t; var e = {}; if (t != null) for (var n in t) Object.hasOwnProperty.call(t, n) && (e[n] = t[n]); return e.default = t, e; } function qP(t) { return t && t.__esModule ? t : { default: t }; } function HP(t, e) { if (!e.has(t)) throw new TypeError("attempted to get private field on non-instance"); return e.get(t); } function KP(t, e, n) { if (!e.has(t)) throw new TypeError("attempted to set private field on non-instance"); return e.set(t, n), n; } const GP = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, get __assign() { return Tt; }, __asyncDelegator: jP, __asyncGenerator: BP, __asyncValues: $P, __await: hd, __awaiter: sn, __classPrivateFieldGet: HP, __classPrivateFieldSet: KP, __createBinding: LP, __decorate: PP, __exportStar: UP, __extends: _0, __generator: tn, __importDefault: qP, __importStar: zP, __makeTemplateObject: VP, __metadata: FP, __param: DP, __read: Cl, __rest: b0, __spread: io, __spreadArrays: MP, __values: Tr }, Symbol.toStringTag, { value: "Module" })), xl = /* @__PURE__ */ wl(GP); var ZA = {}; for (var Jf = 0; Jf < 256; Jf++) { var Xf = Jf.toString(16).toLowerCase(); Xf.length === 1 && (Xf = "0" + Xf), ZA[Jf] = Xf; } function il(t) { for (var e = "", n = 0; n < t.byteLength; n++) e += ZA[t[n]]; return e; } var ba = {}, Gc = { exports: {} }; /*! https://mths.be/punycode v1.3.2 by @mathias */ var WP = Gc.exports, z_; function YP() { return z_ || (z_ = 1, function(t, e) { (function(n) { var r = e && !e.nodeType && e, i = t && !t.nodeType && t, o = typeof Os == "object" && Os; (o.global === o || o.window === o || o.self === o) && (n = o); var u, l = 2147483647, f = 36, d = 1, p = 26, v = 38, y = 700, k = 72, A = 128, E = "-", T = /^xn--/, D = /[^\x20-\x7E]/, R = /[\x2E\u3002\uFF0E\uFF61]/g, L = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, j = f - d, K = Math.floor, ue = String.fromCharCode, de; function H(B) { throw RangeError(L[B]); } function ve(B, M) { for (var te = B.length, Te = []; te--; ) Te[te] = M(B[te]); return Te; } function Z(B, M) { var te = B.split("@"), Te = ""; te.length > 1 && (Te = te[0] + "@", B = te[1]), B = B.replace(R, "."); var $ = B.split("."), Q = ve($, M).join("."); return Te + Q; } function we(B) { for (var M = [], te = 0, Te = B.length, $, Q; te < Te; ) $ = B.charCodeAt(te++), $ >= 55296 && $ <= 56319 && te < Te ? (Q = B.charCodeAt(te++), (Q & 64512) == 56320 ? M.push((($ & 1023) << 10) + (Q & 1023) + 65536) : (M.push($), te--)) : M.push($); return M; } function ze(B) { return ve(B, function(M) { var te = ""; return M > 65535 && (M -= 65536, te += ue(M >>> 10 & 1023 | 55296), M = 56320 | M & 1023), te += ue(M), te; }).join(""); } function it(B) { return B - 48 < 10 ? B - 22 : B - 65 < 26 ? B - 65 : B - 97 < 26 ? B - 97 : f; } function dt(B, M) { return B + 22 + 75 * (B < 26) - ((M != 0) << 5); } function ae(B, M, te) { var Te = 0; for (B = te ? K(B / y) : B >> 1, B += K(B / M); B > j * p >> 1; Te += f) B = K(B / j); return K(Te + (j + 1) * B / (B + v)); } function be(B) { var M = [], te = B.length, Te, $ = 0, Q = A, Ye = k, Ie, Ge, Re, ht, ft, Je, It, Rt, Ze; for (Ie = B.lastIndexOf(E), Ie < 0 && (Ie = 0), Ge = 0; Ge < Ie; ++Ge) B.charCodeAt(Ge) >= 128 && H("not-basic"), M.push(B.charCodeAt(Ge)); for (Re = Ie > 0 ? Ie + 1 : 0; Re < te; ) { for (ht = $, ft = 1, Je = f; Re >= te && H("invalid-input"), It = it(B.charCodeAt(Re++)), (It >= f || It > K((l - $) / ft)) && H("overflow"), $ += It * ft, Rt = Je <= Ye ? d : Je >= Ye + p ? p : Je - Ye, !(It < Rt); Je += f) Ze = f - Rt, ft > K(l / Ze) && H("overflow"), ft *= Ze; Te = M.length + 1, Ye = ae($ - ht, Te, ht == 0), K($ / Te) > l - Q && H("overflow"), Q += K($ / Te), $ %= Te, M.splice($++, 0, Q); } return ze(M); } function pe(B) { var M, te, Te, $, Q, Ye, Ie, Ge, Re, ht, ft, Je = [], It, Rt, Ze, Dt; for (B = we(B), It = B.length, M = A, te = 0, Q = k, Ye = 0; Ye < It; ++Ye) ft = B[Ye], ft < 128 && Je.push(ue(ft)); for (Te = $ = Je.length, $ && Je.push(E); Te < It; ) { for (Ie = l, Ye = 0; Ye < It; ++Ye) ft = B[Ye], ft >= M && ft < Ie && (Ie = ft); for (Rt = Te + 1, Ie - M > K((l - te) / Rt) && H("overflow"), te += (Ie - M) * Rt, M = Ie, Ye = 0; Ye < It; ++Ye) if (ft = B[Ye], ft < M && ++te > l && H("overflow"), ft == M) { for (Ge = te, Re = f; ht = Re <= Q ? d : Re >= Q + p ? p : Re - Q, !(Ge < ht); Re += f) Dt = Ge - ht, Ze = f - ht, Je.push( ue(dt(ht + Dt % Ze, 0)) ), Ge = K(Dt / Ze); Je.push(ue(dt(Ge, 0))), Q = ae(te, Rt, Te == $), te = 0, ++Te; } ++te, ++M; } return Je.join(""); } function ce(B) { return Z(B, function(M) { return T.test(M) ? be(M.slice(4).toLowerCase()) : M; }); } function Ee(B) { return Z(B, function(M) { return D.test(M) ? "xn--" + pe(M) : M; }); } if (u = { /** * A string representing the current Punycode.js version number. * @memberOf punycode * @type String */ version: "1.3.2", /** * An object of methods to convert from JavaScript's internal character * representation (UCS-2) to Unicode code points, and back. * @see * @memberOf punycode * @type Object */ ucs2: { decode: we, encode: ze }, decode: be, encode: pe, toASCII: Ee, toUnicode: ce }, r && i) if (t.exports == r) i.exports = u; else for (de in u) u.hasOwnProperty(de) && (r[de] = u[de]); else n.punycode = u; })(WP); }(Gc, Gc.exports)), Gc.exports; } var Hu = {}, qg, q_; function QP() { if (q_) return qg; q_ = 1; function t(e, n) { return Object.prototype.hasOwnProperty.call(e, n); } return qg = function(e, n, r, i) { n = n || "&", r = r || "="; var o = {}; if (typeof e != "string" || e.length === 0) return o; var u = /\+/g; e = e.split(n); var l = 1e3; i && typeof i.maxKeys == "number" && (l = i.maxKeys); var f = e.length; l > 0 && f > l && (f = l); for (var d = 0; d < f; ++d) { var p = e[d].replace(u, "%20"), v = p.indexOf(r), y, k, A, E; v >= 0 ? (y = p.substr(0, v), k = p.substr(v + 1)) : (y = p, k = ""), A = decodeURIComponent(y), E = decodeURIComponent(k), t(o, A) ? Array.isArray(o[A]) ? o[A].push(E) : o[A] = [o[A], E] : o[A] = E; } return o; }, qg; } var Hg, H_; function JP() { if (H_) return Hg; H_ = 1; var t = function(e) { switch (typeof e) { case "string": return e; case "boolean": return e ? "true" : "false"; case "number": return isFinite(e) ? e : ""; default: return ""; } }; return Hg = function(e, n, r, i) { return n = n || "&", r = r || "=", e === null && (e = void 0), typeof e == "object" ? Object.keys(e).map(function(o) { var u = encodeURIComponent(t(o)) + r; return Array.isArray(e[o]) ? e[o].map(function(l) { return u + encodeURIComponent(t(l)); }).join(n) : u + encodeURIComponent(t(e[o])); }).join(n) : i ? encodeURIComponent(t(i)) + r + encodeURIComponent(t(e)) : ""; }, Hg; } var K_; function XP() { return K_ || (K_ = 1, Hu.decode = Hu.parse = QP(), Hu.encode = Hu.stringify = JP()), Hu; } var G_; function ZP() { if (G_) return ba; G_ = 1; var t = YP(); ba.parse = T, ba.resolve = R, ba.resolveObject = L, ba.format = D, ba.Url = e; function e() { this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null; } var n = /^([a-z0-9.+-]+:)/i, r = /:[0-9]*$/, i = ["<", ">", '"', "`", " ", "\r", ` `, " "], o = ["{", "}", "|", "\\", "^", "`"].concat(i), u = ["'"].concat(o), l = ["%", "/", "?", ";", "#"].concat(u), f = ["/", "?", "#"], d = 255, p = /^[a-z0-9A-Z_-]{0,63}$/, v = /^([a-z0-9A-Z_-]{0,63})(.*)$/, y = { javascript: !0, "javascript:": !0 }, k = { javascript: !0, "javascript:": !0 }, A = { http: !0, https: !0, ftp: !0, gopher: !0, file: !0, "http:": !0, "https:": !0, "ftp:": !0, "gopher:": !0, "file:": !0 }, E = XP(); function T(H, ve, Z) { if (H && K(H) && H instanceof e) return H; var we = new e(); return we.parse(H, ve, Z), we; } e.prototype.parse = function(H, ve, Z) { if (!j(H)) throw new TypeError("Parameter 'url' must be a string, not " + typeof H); var we = H; we = we.trim(); var ze = n.exec(we); if (ze) { ze = ze[0]; var it = ze.toLowerCase(); this.protocol = it, we = we.substr(ze.length); } if (Z || ze || we.match(/^\/\/[^@\/]+@[^@\/]+/)) { var dt = we.substr(0, 2) === "//"; dt && !(ze && k[ze]) && (we = we.substr(2), this.slashes = !0); } if (!k[ze] && (dt || ze && !A[ze])) { for (var ae = -1, be = 0; be < f.length; be++) { var pe = we.indexOf(f[be]); pe !== -1 && (ae === -1 || pe < ae) && (ae = pe); } var ce, Ee; ae === -1 ? Ee = we.lastIndexOf("@") : Ee = we.lastIndexOf("@", ae), Ee !== -1 && (ce = we.slice(0, Ee), we = we.slice(Ee + 1), this.auth = decodeURIComponent(ce)), ae = -1; for (var be = 0; be < l.length; be++) { var pe = we.indexOf(l[be]); pe !== -1 && (ae === -1 || pe < ae) && (ae = pe); } ae === -1 && (ae = we.length), this.host = we.slice(0, ae), we = we.slice(ae), this.parseHost(), this.hostname = this.hostname || ""; var B = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]"; if (!B) for (var M = this.hostname.split(/\./), be = 0, te = M.length; be < te; be++) { var Te = M[be]; if (Te && !Te.match(p)) { for (var $ = "", Q = 0, Ye = Te.length; Q < Ye; Q++) Te.charCodeAt(Q) > 127 ? $ += "x" : $ += Te[Q]; if (!$.match(p)) { var Ie = M.slice(0, be), Ge = M.slice(be + 1), Re = Te.match(v); Re && (Ie.push(Re[1]), Ge.unshift(Re[2])), Ge.length && (we = "/" + Ge.join(".") + we), this.hostname = Ie.join("."); break; } } } if (this.hostname.length > d ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), !B) { for (var ht = this.hostname.split("."), ft = [], be = 0; be < ht.length; ++be) { var Je = ht[be]; ft.push(Je.match(/[^A-Za-z0-9_-]/) ? "xn--" + t.encode(Je) : Je); } this.hostname = ft.join("."); } var It = this.port ? ":" + this.port : "", Rt = this.hostname || ""; this.host = Rt + It, this.href += this.host, B && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), we[0] !== "/" && (we = "/" + we)); } if (!y[it]) for (var be = 0, te = u.length; be < te; be++) { var Ze = u[be], Dt = encodeURIComponent(Ze); Dt === Ze && (Dt = escape(Ze)), we = we.split(Ze).join(Dt); } var Mt = we.indexOf("#"); Mt !== -1 && (this.hash = we.substr(Mt), we = we.slice(0, Mt)); var P = we.indexOf("?"); if (P !== -1 ? (this.search = we.substr(P), this.query = we.substr(P + 1), ve && (this.query = E.parse(this.query)), we = we.slice(0, P)) : ve && (this.search = "", this.query = {}), we && (this.pathname = we), A[it] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) { var It = this.pathname || "", Je = this.search || ""; this.path = It + Je; } return this.href = this.format(), this; }; function D(H) { return j(H) && (H = T(H)), H instanceof e ? H.format() : e.prototype.format.call(H); } e.prototype.format = function() { var H = this.auth || ""; H && (H = encodeURIComponent(H), H = H.replace(/%3A/i, ":"), H += "@"); var ve = this.protocol || "", Z = this.pathname || "", we = this.hash || "", ze = !1, it = ""; this.host ? ze = H + this.host : this.hostname && (ze = H + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]"), this.port && (ze += ":" + this.port)), this.query && K(this.query) && Object.keys(this.query).length && (it = E.stringify(this.query)); var dt = this.search || it && "?" + it || ""; return ve && ve.substr(-1) !== ":" && (ve += ":"), this.slashes || (!ve || A[ve]) && ze !== !1 ? (ze = "//" + (ze || ""), Z && Z.charAt(0) !== "/" && (Z = "/" + Z)) : ze || (ze = ""), we && we.charAt(0) !== "#" && (we = "#" + we), dt && dt.charAt(0) !== "?" && (dt = "?" + dt), Z = Z.replace(/[?#]/g, function(ae) { return encodeURIComponent(ae); }), dt = dt.replace("#", "%23"), ve + ze + Z + dt + we; }; function R(H, ve) { return T(H, !1, !0).resolve(ve); } e.prototype.resolve = function(H) { return this.resolveObject(T(H, !1, !0)).format(); }; function L(H, ve) { return H ? T(H, !1, !0).resolveObject(ve) : ve; } e.prototype.resolveObject = function(H) { if (j(H)) { var ve = new e(); ve.parse(H, !1, !0), H = ve; } var Z = new e(); if (Object.keys(this).forEach(function(Ye) { Z[Ye] = this[Ye]; }, this), Z.hash = H.hash, H.href === "") return Z.href = Z.format(), Z; if (H.slashes && !H.protocol) return Object.keys(H).forEach(function(Ye) { Ye !== "protocol" && (Z[Ye] = H[Ye]); }), A[Z.protocol] && Z.hostname && !Z.pathname && (Z.path = Z.pathname = "/"), Z.href = Z.format(), Z; if (H.protocol && H.protocol !== Z.protocol) { if (!A[H.protocol]) return Object.keys(H).forEach(function(Ye) { Z[Ye] = H[Ye]; }), Z.href = Z.format(), Z; if (Z.protocol = H.protocol, !H.host && !k[H.protocol]) { for (var ce = (H.pathname || "").split("/"); ce.length && !(H.host = ce.shift()); ) ; H.host || (H.host = ""), H.hostname || (H.hostname = ""), ce[0] !== "" && ce.unshift(""), ce.length < 2 && ce.unshift(""), Z.pathname = ce.join("/"); } else Z.pathname = H.pathname; if (Z.search = H.search, Z.query = H.query, Z.host = H.host || "", Z.auth = H.auth, Z.hostname = H.hostname || H.host, Z.port = H.port, Z.pathname || Z.search) { var we = Z.pathname || "", ze = Z.search || ""; Z.path = we + ze; } return Z.slashes = Z.slashes || H.slashes, Z.href = Z.format(), Z; } var it = Z.pathname && Z.pathname.charAt(0) === "/", dt = H.host || H.pathname && H.pathname.charAt(0) === "/", ae = dt || it || Z.host && H.pathname, be = ae, pe = Z.pathname && Z.pathname.split("/") || [], ce = H.pathname && H.pathname.split("/") || [], Ee = Z.protocol && !A[Z.protocol]; if (Ee && (Z.hostname = "", Z.port = null, Z.host && (pe[0] === "" ? pe[0] = Z.host : pe.unshift(Z.host)), Z.host = "", H.protocol && (H.hostname = null, H.port = null, H.host && (ce[0] === "" ? ce[0] = H.host : ce.unshift(H.host)), H.host = null), ae = ae && (ce[0] === "" || pe[0] === "")), dt) Z.host = H.host || H.host === "" ? H.host : Z.host, Z.hostname = H.hostname || H.hostname === "" ? H.hostname : Z.hostname, Z.search = H.search, Z.query = H.query, pe = ce; else if (ce.length) pe || (pe = []), pe.pop(), pe = pe.concat(ce), Z.search = H.search, Z.query = H.query; else if (!de(H.search)) { if (Ee) { Z.hostname = Z.host = pe.shift(); var B = Z.host && Z.host.indexOf("@") > 0 ? Z.host.split("@") : !1; B && (Z.auth = B.shift(), Z.host = Z.hostname = B.shift()); } return Z.search = H.search, Z.query = H.query, (!ue(Z.pathname) || !ue(Z.search)) && (Z.path = (Z.pathname ? Z.pathname : "") + (Z.search ? Z.search : "")), Z.href = Z.format(), Z; } if (!pe.length) return Z.pathname = null, Z.search ? Z.path = "/" + Z.search : Z.path = null, Z.href = Z.format(), Z; for (var M = pe.slice(-1)[0], te = (Z.host || H.host) && (M === "." || M === "..") || M === "", Te = 0, $ = pe.length; $ >= 0; $--) M = pe[$], M == "." ? pe.splice($, 1) : M === ".." ? (pe.splice($, 1), Te++) : Te && (pe.splice($, 1), Te--); if (!ae && !be) for (; Te--; Te) pe.unshift(".."); ae && pe[0] !== "" && (!pe[0] || pe[0].charAt(0) !== "/") && pe.unshift(""), te && pe.join("/").substr(-1) !== "/" && pe.push(""); var Q = pe[0] === "" || pe[0] && pe[0].charAt(0) === "/"; if (Ee) { Z.hostname = Z.host = Q ? "" : pe.length ? pe.shift() : ""; var B = Z.host && Z.host.indexOf("@") > 0 ? Z.host.split("@") : !1; B && (Z.auth = B.shift(), Z.host = Z.hostname = B.shift()); } return ae = ae || Z.host && pe.length, ae && !Q && pe.unshift(""), pe.length ? Z.pathname = pe.join("/") : (Z.pathname = null, Z.path = null), (!ue(Z.pathname) || !ue(Z.search)) && (Z.path = (Z.pathname ? Z.pathname : "") + (Z.search ? Z.search : "")), Z.auth = H.auth || Z.auth, Z.slashes = Z.slashes || H.slashes, Z.href = Z.format(), Z; }, e.prototype.parseHost = function() { var H = this.host, ve = r.exec(H); ve && (ve = ve[0], ve !== ":" && (this.port = ve.substr(1)), H = H.substr(0, H.length - ve.length)), H && (this.hostname = H); }; function j(H) { return typeof H == "string"; } function K(H) { return typeof H == "object" && H !== null; } function ue(H) { return H === null; } function de(H) { return H == null; } return ba; } var bs = ZP(), eD = /* @__PURE__ */ function() { var t = function(e, n) { return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, i) { r.__proto__ = i; } || function(r, i) { for (var o in i) i.hasOwnProperty(o) && (r[o] = i[o]); }, t(e, n); }; return function(e, n) { t(e, n); function r() { this.constructor = e; } e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r()); }; }(), W_ = function(t, e, n, r) { function i(o) { return o instanceof n ? o : new n(function(u) { u(o); }); } return new (n || (n = Promise))(function(o, u) { function l(p) { try { d(r.next(p)); } catch (v) { u(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { u(v); } } function d(p) { p.done ? o(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, Kg = function(t, e) { var n = { label: 0, sent: function() { if (o[0] & 1) throw o[1]; return o[1]; }, trys: [], ops: [] }, r, i, o, u; return u = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() { return this; }), u; function l(d) { return function(p) { return f([d, p]); }; } function f(d) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (o = d[0] & 2 ? i.return : d[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, d[1])).done) return o; switch (i = 0, o && (d = [d[0] & 2, o.value]), d[0]) { case 0: case 1: o = d; break; case 4: return n.label++, { value: d[1], done: !1 }; case 5: n.label++, i = d[1], d = [0]; continue; case 7: d = n.ops.pop(), n.trys.pop(); continue; default: if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!o || d[1] > o[0] && d[1] < o[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < o[1]) { n.label = o[1], o = d; break; } if (o && n.label < o[2]) { n.label = o[2], n.ops.push(d); break; } o[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = o = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, tD = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, o = [], u; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) o.push(i.value); } catch (l) { u = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (u) throw u.error; } } return o; }, nD = function() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(tD(arguments[e])); return t; }, Zf = new Pi("Util"), Fa = ( /** @class */ function(t) { eD(e, t); function e(n) { var r = t.call(this, n) || this; return r.nonRetryable = !0, r; } return e; }(Error) ), rD = function(t) { var e = "nonRetryable"; return t && t[e]; }; function iD(t, e, n, r) { return W_(this, void 0, void 0, function() { var i = this; return Kg(this, function(o) { if (typeof t != "function") throw Error("functionToRetry must be a function"); return [2, new Promise(function(u, l) { return W_(i, void 0, void 0, function() { var f, d, p, v, y, k; return Kg(this, function(A) { switch (A.label) { case 0: f = 0, d = !1, p = function() { }, y = function() { var E, T, D, R; return Kg(this, function(L) { switch (L.label) { case 0: f++, Zf.debug(t.name + " attempt #" + f + " with this vars: " + JSON.stringify(e)), L.label = 1; case 1: return L.trys.push([1, 3, , 7]), E = {}, T = u, [4, t.apply(void 0, nD(e))]; case 2: return [2, (E.value = T.apply(void 0, [L.sent()]), E)]; case 3: return D = L.sent(), v = D, Zf.debug("error on " + t.name, D), rD(D) ? (Zf.debug(t.name + " non retryable error", D), [2, { value: l(D) }]) : (R = n(f, e, D), Zf.debug(t.name + " retrying in " + R + " ms"), R === !1 || d ? [2, { value: l(D) }] : [3, 4]); case 4: return [4, new Promise(function(j) { p = j, setTimeout(p, R); })]; case 5: L.sent(), L.label = 6; case 6: return [3, 7]; case 7: return [ 2 /*return*/ ]; } }); }, A.label = 1; case 1: return d ? [3, 3] : [5, y()]; case 2: return k = A.sent(), typeof k == "object" ? [2, k.value] : [3, 1]; case 3: return l(v), [ 2 /*return*/ ]; } }); }); })]; }); }); } function oD(t) { var e = 100, n = 100; return function(r) { var i = Math.pow(2, r) * e + n * Math.random(); return i > t ? !1 : i; }; } var sD = function(t, e, n, r) { return iD(t, e, oD(n)); }; function aD(t) { return t.split("").map(function(e) { return e.charCodeAt(0).toString(16).padStart(2, "0"); }).join(""); } function uD(t) { return t.match(/.{2}/g).map(function(e) { return String.fromCharCode(parseInt(e, 16)); }).join(""); } var qh = function() { return qh = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, qh.apply(this, arguments); }, lD = new Pi("Parser"), cD = function(t) { var e = {}; if (t.aws_mobile_analytics_app_id) { var n = { AWSPinpoint: { appId: t.aws_mobile_analytics_app_id, region: t.aws_mobile_analytics_app_region } }; e.Analytics = n; } (t.aws_cognito_identity_pool_id || t.aws_user_pools_id) && (e.Auth = { userPoolId: t.aws_user_pools_id, userPoolWebClientId: t.aws_user_pools_web_client_id, region: t.aws_cognito_region, identityPoolId: t.aws_cognito_identity_pool_id, identityPoolRegion: t.aws_cognito_region, mandatorySignIn: t.aws_mandatory_sign_in === "enable", signUpVerificationMethod: t.aws_cognito_sign_up_verification_method || "code" }); var r; return t.aws_user_files_s3_bucket ? r = { AWSS3: { bucket: t.aws_user_files_s3_bucket, region: t.aws_user_files_s3_bucket_region, dangerouslyConnectToHttpEndpointForTesting: t.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing } } : r = t ? t.Storage || t : {}, t.Logging && (e.Logging = qh(qh({}, t.Logging), { region: t.aws_project_region })), t.geo && (e.Geo = Object.assign({}, t.geo), t.geo.amazon_location_service && (e.Geo = { AmazonLocationService: t.geo.amazon_location_service })), e.Analytics = Object.assign({}, e.Analytics, t.Analytics), e.Auth = Object.assign({}, e.Auth, t.Auth), e.Storage = Object.assign({}, r), e.Logging = Object.assign({}, e.Logging, t.Logging), lD.debug("parse config", t, "to amplifyconfig", e), e; }, dD = ( /** @class */ function() { function t() { } return t.parseMobilehubConfig = cD, t; }() ), dy = function(t, e) { return dy = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) { n.__proto__ = r; } || function(n, r) { for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]); }, dy(t, e); }; function k0(t, e) { if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); dy(t, e); function n() { this.constructor = t; } t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n()); } var Ce = function() { return Ce = Object.assign || function(e) { for (var n, r = 1, i = arguments.length; r < i; r++) { n = arguments[r]; for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]); } return e; }, Ce.apply(this, arguments); }; function rr(t, e, n, r) { function i(o) { return o instanceof n ? o : new n(function(u) { u(o); }); } return new (n || (n = Promise))(function(o, u) { function l(p) { try { d(r.next(p)); } catch (v) { u(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { u(v); } } function d(p) { p.done ? o(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); } function ir(t, e) { var n = { label: 0, sent: function() { if (o[0] & 1) throw o[1]; return o[1]; }, trys: [], ops: [] }, r, i, o, u = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype); return u.next = l(0), u.throw = l(1), u.return = l(2), typeof Symbol == "function" && (u[Symbol.iterator] = function() { return this; }), u; function l(d) { return function(p) { return f([d, p]); }; } function f(d) { if (r) throw new TypeError("Generator is already executing."); for (; u && (u = 0, d[0] && (n = 0)), n; ) try { if (r = 1, i && (o = d[0] & 2 ? i.return : d[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, d[1])).done) return o; switch (i = 0, o && (d = [d[0] & 2, o.value]), d[0]) { case 0: case 1: o = d; break; case 4: return n.label++, { value: d[1], done: !1 }; case 5: n.label++, i = d[1], d = [0]; continue; case 7: d = n.ops.pop(), n.trys.pop(); continue; default: if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!o || d[1] > o[0] && d[1] < o[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < o[1]) { n.label = o[1], o = d; break; } if (o && n.label < o[2]) { n.label = o[2], n.ops.push(d); break; } o[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = o = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } } function fD(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, o = [], u; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) o.push(i.value); } catch (l) { u = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (u) throw u.error; } } return o; } var Gg = {}, xc = {}, Nc = {}, Tc = {}, Y_; function hD() { if (Y_) return Tc; Y_ = 1, Object.defineProperty(Tc, "__esModule", { value: !0 }), Tc.isEmptyData = void 0; function t(e) { return typeof e == "string" ? e.length === 0 : e.byteLength === 0; } return Tc.isEmptyData = t, Tc; } var Wg = {}, Q_; function eC() { return Q_ || (Q_ = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.EMPTY_DATA_SHA_256 = t.SHA_256_HMAC_ALGO = t.SHA_256_HASH = void 0, t.SHA_256_HASH = { name: "SHA-256" }, t.SHA_256_HMAC_ALGO = { name: "HMAC", hash: t.SHA_256_HASH }, t.EMPTY_DATA_SHA_256 = new Uint8Array([ 227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85 ]); }(Wg)), Wg; } var pD = function(t) { for (var e = [], n = 0, r = t.length; n < r; n++) { var i = t.charCodeAt(n); if (i < 128) e.push(i); else if (i < 2048) e.push(i >> 6 | 192, i & 63 | 128); else if (n + 1 < t.length && (i & 64512) === 55296 && (t.charCodeAt(n + 1) & 64512) === 56320) { var o = 65536 + ((i & 1023) << 10) + (t.charCodeAt(++n) & 1023); e.push(o >> 18 | 240, o >> 12 & 63 | 128, o >> 6 & 63 | 128, o & 63 | 128); } else e.push(i >> 12 | 224, i >> 6 & 63 | 128, i & 63 | 128); } return Uint8Array.from(e); }, mD = function(t) { for (var e = "", n = 0, r = t.length; n < r; n++) { var i = t[n]; if (i < 128) e += String.fromCharCode(i); else if (192 <= i && i < 224) { var o = t[++n]; e += String.fromCharCode((i & 31) << 6 | o & 63); } else if (240 <= i && i < 365) { var u = [i, t[++n], t[++n], t[++n]], l = "%" + u.map(function(f) { return f.toString(16); }).join("%"); e += decodeURIComponent(l); } else e += String.fromCharCode((i & 15) << 12 | (t[++n] & 63) << 6 | t[++n] & 63); } return e; }; function gD(t) { return new TextEncoder().encode(t); } function vD(t) { return new TextDecoder("utf-8").decode(t); } var tC = function(t) { return typeof TextEncoder == "function" ? gD(t) : pD(t); }, nC = function(t) { return typeof TextDecoder == "function" ? vD(t) : mD(t); }; const yD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, fromUtf8: tC, toUtf8: nC }, Symbol.toStringTag, { value: "Module" })), wD = /* @__PURE__ */ wl(yD), SD = {}; function _D() { return typeof window < "u" ? window : typeof self < "u" ? self : SD; } const bD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, locateWindow: _D }, Symbol.toStringTag, { value: "Module" })), E0 = /* @__PURE__ */ wl(bD); var J_; function rC() { if (J_) return Nc; J_ = 1, Object.defineProperty(Nc, "__esModule", { value: !0 }), Nc.Sha256 = void 0; var t = hD(), e = eC(), n = wD, r = E0, i = ( /** @class */ function() { function l(f) { f ? (this.operation = o(f).then(function(d) { return (0, r.locateWindow)().msCrypto.subtle.sign(e.SHA_256_HMAC_ALGO, d); }), this.operation.catch(function() { })) : this.operation = Promise.resolve((0, r.locateWindow)().msCrypto.subtle.digest("SHA-256")); } return l.prototype.update = function(f) { var d = this; (0, t.isEmptyData)(f) || (this.operation = this.operation.then(function(p) { return p.onerror = function() { d.operation = Promise.reject(new Error("Error encountered updating hash")); }, p.process(u(f)), p; }), this.operation.catch(function() { })); }, l.prototype.digest = function() { return this.operation.then(function(f) { return new Promise(function(d, p) { f.onerror = function() { p(new Error("Error encountered finalizing hash")); }, f.oncomplete = function() { f.result && d(new Uint8Array(f.result)), p(new Error("Error encountered finalizing hash")); }, f.finish(); }); }); }, l; }() ); Nc.Sha256 = i; function o(l) { return new Promise(function(f, d) { var p = (0, r.locateWindow)().msCrypto.subtle.importKey("raw", u(l), e.SHA_256_HMAC_ALGO, !1, ["sign"]); p.oncomplete = function() { p.result && f(p.result), d(new Error("ImportKey completed without importing key.")); }, p.onerror = function() { d(new Error("ImportKey failed to import key.")); }; }); } function u(l) { return typeof l == "string" ? (0, n.fromUtf8)(l) : ArrayBuffer.isView(l) ? new Uint8Array(l.buffer, l.byteOffset, l.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(l); } return Nc; } var Ic = {}, Yg = {}, Rc = {}; const kD = (t) => { const e = []; for (let n = 0, r = t.length; n < r; n++) { const i = t.charCodeAt(n); if (i < 128) e.push(i); else if (i < 2048) e.push(i >> 6 | 192, i & 63 | 128); else if (n + 1 < t.length && (i & 64512) === 55296 && (t.charCodeAt(n + 1) & 64512) === 56320) { const o = 65536 + ((i & 1023) << 10) + (t.charCodeAt(++n) & 1023); e.push(o >> 18 | 240, o >> 12 & 63 | 128, o >> 6 & 63 | 128, o & 63 | 128); } else e.push(i >> 12 | 224, i >> 6 & 63 | 128, i & 63 | 128); } return Uint8Array.from(e); }, ED = (t) => { let e = ""; for (let n = 0, r = t.length; n < r; n++) { const i = t[n]; if (i < 128) e += String.fromCharCode(i); else if (192 <= i && i < 224) { const o = t[++n]; e += String.fromCharCode((i & 31) << 6 | o & 63); } else if (240 <= i && i < 365) { const u = "%" + [i, t[++n], t[++n], t[++n]].map((l) => l.toString(16)).join("%"); e += decodeURIComponent(u); } else e += String.fromCharCode((i & 15) << 12 | (t[++n] & 63) << 6 | t[++n] & 63); } return e; }; function AD(t) { return new TextEncoder().encode(t); } function CD(t) { return new TextDecoder("utf-8").decode(t); } const xD = (t) => typeof TextEncoder == "function" ? AD(t) : kD(t), ND = (t) => typeof TextDecoder == "function" ? CD(t) : ED(t), TD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, fromUtf8: xD, toUtf8: ND }, Symbol.toStringTag, { value: "Module" })), ID = /* @__PURE__ */ wl(TD); var X_; function RD() { if (X_) return Rc; X_ = 1, Object.defineProperty(Rc, "__esModule", { value: !0 }), Rc.convertToBuffer = void 0; var t = ID, e = typeof Buffer < "u" && Buffer.from ? function(r) { return Buffer.from(r, "utf8"); } : t.fromUtf8; function n(r) { return r instanceof Uint8Array ? r : typeof r == "string" ? e(r) : ArrayBuffer.isView(r) ? new Uint8Array(r.buffer, r.byteOffset, r.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(r); } return Rc.convertToBuffer = n, Rc; } var Oc = {}, Z_; function OD() { if (Z_) return Oc; Z_ = 1, Object.defineProperty(Oc, "__esModule", { value: !0 }), Oc.isEmptyData = void 0; function t(e) { return typeof e == "string" ? e.length === 0 : e.byteLength === 0; } return Oc.isEmptyData = t, Oc; } var Pc = {}, eb; function PD() { if (eb) return Pc; eb = 1, Object.defineProperty(Pc, "__esModule", { value: !0 }), Pc.numToUint8 = void 0; function t(e) { return new Uint8Array([ (e & 4278190080) >> 24, (e & 16711680) >> 16, (e & 65280) >> 8, e & 255 ]); } return Pc.numToUint8 = t, Pc; } var Dc = {}, tb; function DD() { if (tb) return Dc; tb = 1, Object.defineProperty(Dc, "__esModule", { value: !0 }), Dc.uint32ArrayFrom = void 0; function t(e) { if (!Array.from) { for (var n = new Uint32Array(e.length), r = 0; r < e.length; ) n[r] = e[r]; return n; } return Uint32Array.from(e); } return Dc.uint32ArrayFrom = t, Dc; } var nb; function iC() { return nb || (nb = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.uint32ArrayFrom = t.numToUint8 = t.isEmptyData = t.convertToBuffer = void 0; var e = RD(); Object.defineProperty(t, "convertToBuffer", { enumerable: !0, get: function() { return e.convertToBuffer; } }); var n = OD(); Object.defineProperty(t, "isEmptyData", { enumerable: !0, get: function() { return n.isEmptyData; } }); var r = PD(); Object.defineProperty(t, "numToUint8", { enumerable: !0, get: function() { return r.numToUint8; } }); var i = DD(); Object.defineProperty(t, "uint32ArrayFrom", { enumerable: !0, get: function() { return i.uint32ArrayFrom; } }); }(Yg)), Yg; } var rb; function oC() { if (rb) return Ic; rb = 1, Object.defineProperty(Ic, "__esModule", { value: !0 }), Ic.Sha256 = void 0; var t = iC(), e = eC(), n = E0, r = ( /** @class */ function() { function i(o) { this.toHash = new Uint8Array(0), o !== void 0 && (this.key = new Promise(function(u, l) { (0, n.locateWindow)().crypto.subtle.importKey("raw", (0, t.convertToBuffer)(o), e.SHA_256_HMAC_ALGO, !1, ["sign"]).then(u, l); }), this.key.catch(function() { })); } return i.prototype.update = function(o) { if (!(0, t.isEmptyData)(o)) { var u = (0, t.convertToBuffer)(o), l = new Uint8Array(this.toHash.byteLength + u.byteLength); l.set(this.toHash, 0), l.set(u, this.toHash.byteLength), this.toHash = l; } }, i.prototype.digest = function() { var o = this; return this.key ? this.key.then(function(u) { return (0, n.locateWindow)().crypto.subtle.sign(e.SHA_256_HMAC_ALGO, u, o.toHash).then(function(l) { return new Uint8Array(l); }); }) : (0, t.isEmptyData)(this.toHash) ? Promise.resolve(e.EMPTY_DATA_SHA_256) : Promise.resolve().then(function() { return (0, n.locateWindow)().crypto.subtle.digest(e.SHA_256_HASH, o.toHash); }).then(function(u) { return Promise.resolve(new Uint8Array(u)); }); }, i; }() ); return Ic.Sha256 = r, Ic; } var Qg = {}, Fc = {}, Ur = {}, ib; function sC() { return ib || (ib = 1, Object.defineProperty(Ur, "__esModule", { value: !0 }), Ur.MAX_HASHABLE_LENGTH = Ur.INIT = Ur.KEY = Ur.DIGEST_LENGTH = Ur.BLOCK_SIZE = void 0, Ur.BLOCK_SIZE = 64, Ur.DIGEST_LENGTH = 32, Ur.KEY = new Uint32Array([ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298 ]), Ur.INIT = [ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 ], Ur.MAX_HASHABLE_LENGTH = Math.pow(2, 53) - 1), Ur; } var Lc = {}, ob; function FD() { if (ob) return Lc; ob = 1, Object.defineProperty(Lc, "__esModule", { value: !0 }), Lc.RawSha256 = void 0; var t = sC(), e = ( /** @class */ function() { function n() { this.state = Int32Array.from(t.INIT), this.temp = new Int32Array(64), this.buffer = new Uint8Array(64), this.bufferLength = 0, this.bytesHashed = 0, this.finished = !1; } return n.prototype.update = function(r) { if (this.finished) throw new Error("Attempted to update an already finished hash."); var i = 0, o = r.byteLength; if (this.bytesHashed += o, this.bytesHashed * 8 > t.MAX_HASHABLE_LENGTH) throw new Error("Cannot hash more than 2^53 - 1 bits"); for (; o > 0; ) this.buffer[this.bufferLength++] = r[i++], o--, this.bufferLength === t.BLOCK_SIZE && (this.hashBuffer(), this.bufferLength = 0); }, n.prototype.digest = function() { if (!this.finished) { var r = this.bytesHashed * 8, i = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength), o = this.bufferLength; if (i.setUint8(this.bufferLength++, 128), o % t.BLOCK_SIZE >= t.BLOCK_SIZE - 8) { for (var u = this.bufferLength; u < t.BLOCK_SIZE; u++) i.setUint8(u, 0); this.hashBuffer(), this.bufferLength = 0; } for (var u = this.bufferLength; u < t.BLOCK_SIZE - 8; u++) i.setUint8(u, 0); i.setUint32(t.BLOCK_SIZE - 8, Math.floor(r / 4294967296), !0), i.setUint32(t.BLOCK_SIZE - 4, r), this.hashBuffer(), this.finished = !0; } for (var l = new Uint8Array(t.DIGEST_LENGTH), u = 0; u < 8; u++) l[u * 4] = this.state[u] >>> 24 & 255, l[u * 4 + 1] = this.state[u] >>> 16 & 255, l[u * 4 + 2] = this.state[u] >>> 8 & 255, l[u * 4 + 3] = this.state[u] >>> 0 & 255; return l; }, n.prototype.hashBuffer = function() { for (var r = this, i = r.buffer, o = r.state, u = o[0], l = o[1], f = o[2], d = o[3], p = o[4], v = o[5], y = o[6], k = o[7], A = 0; A < t.BLOCK_SIZE; A++) { if (A < 16) this.temp[A] = (i[A * 4] & 255) << 24 | (i[A * 4 + 1] & 255) << 16 | (i[A * 4 + 2] & 255) << 8 | i[A * 4 + 3] & 255; else { var E = this.temp[A - 2], T = (E >>> 17 | E << 15) ^ (E >>> 19 | E << 13) ^ E >>> 10; E = this.temp[A - 15]; var D = (E >>> 7 | E << 25) ^ (E >>> 18 | E << 14) ^ E >>> 3; this.temp[A] = (T + this.temp[A - 7] | 0) + (D + this.temp[A - 16] | 0); } var R = (((p >>> 6 | p << 26) ^ (p >>> 11 | p << 21) ^ (p >>> 25 | p << 7)) + (p & v ^ ~p & y) | 0) + (k + (t.KEY[A] + this.temp[A] | 0) | 0) | 0, L = ((u >>> 2 | u << 30) ^ (u >>> 13 | u << 19) ^ (u >>> 22 | u << 10)) + (u & l ^ u & f ^ l & f) | 0; k = y, y = v, v = p, p = d + R | 0, d = f, f = l, l = u, u = R + L | 0; } o[0] += u, o[1] += l, o[2] += f, o[3] += d, o[4] += p, o[5] += v, o[6] += y, o[7] += k; }, n; }() ); return Lc.RawSha256 = e, Lc; } var sb; function LD() { if (sb) return Fc; sb = 1, Object.defineProperty(Fc, "__esModule", { value: !0 }), Fc.Sha256 = void 0; var t = xl, e = sC(), n = FD(), r = iC(), i = ( /** @class */ function() { function u(l) { if (this.hash = new n.RawSha256(), l) { this.outer = new n.RawSha256(); var f = o(l), d = new Uint8Array(e.BLOCK_SIZE); d.set(f); for (var p = 0; p < e.BLOCK_SIZE; p++) f[p] ^= 54, d[p] ^= 92; this.hash.update(f), this.outer.update(d); for (var p = 0; p < f.byteLength; p++) f[p] = 0; } } return u.prototype.update = function(l) { if (!((0, r.isEmptyData)(l) || this.error)) try { this.hash.update((0, r.convertToBuffer)(l)); } catch (f) { this.error = f; } }, u.prototype.digestSync = function() { if (this.error) throw this.error; return this.outer ? (this.outer.finished || this.outer.update(this.hash.digest()), this.outer.digest()) : this.hash.digest(); }, u.prototype.digest = function() { return (0, t.__awaiter)(this, void 0, void 0, function() { return (0, t.__generator)(this, function(l) { return [2, this.digestSync()]; }); }); }, u; }() ); Fc.Sha256 = i; function o(u) { var l = (0, r.convertToBuffer)(u); if (l.byteLength > e.BLOCK_SIZE) { var f = new n.RawSha256(); f.update(l), l = f.digest(); } var d = new Uint8Array(e.BLOCK_SIZE); return d.set(l), d; } return Fc; } var ab; function UD() { return ab || (ab = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = xl; (0, e.__exportStar)(LD(), t); }(Qg)), Qg; } var Jg = {}, bi = {}, ub; function MD() { if (ub) return bi; ub = 1, Object.defineProperty(bi, "__esModule", { value: !0 }), bi.supportsZeroByteGCM = bi.supportsSubtleCrypto = bi.supportsSecureRandom = bi.supportsWebCrypto = void 0; var t = xl, e = [ "decrypt", "digest", "encrypt", "exportKey", "generateKey", "importKey", "sign", "verify" ]; function n(u) { if (r(u) && typeof u.crypto.subtle == "object") { var l = u.crypto.subtle; return i(l); } return !1; } bi.supportsWebCrypto = n; function r(u) { if (typeof u == "object" && typeof u.crypto == "object") { var l = u.crypto.getRandomValues; return typeof l == "function"; } return !1; } bi.supportsSecureRandom = r; function i(u) { return u && e.every(function(l) { return typeof u[l] == "function"; }); } bi.supportsSubtleCrypto = i; function o(u) { return t.__awaiter(this, void 0, void 0, function() { var l, f; return t.__generator(this, function(d) { switch (d.label) { case 0: if (!i(u)) return [2, !1]; d.label = 1; case 1: return d.trys.push([1, 4, , 5]), [4, u.generateKey({ name: "AES-GCM", length: 128 }, !1, ["encrypt"])]; case 2: return l = d.sent(), [4, u.encrypt({ name: "AES-GCM", iv: new Uint8Array(Array(12)), additionalData: new Uint8Array(Array(16)), tagLength: 128 }, l, new Uint8Array(0))]; case 3: return f = d.sent(), [2, f.byteLength === 16]; case 4: return d.sent(), [2, !1]; case 5: return [ 2 /*return*/ ]; } }); }); } return bi.supportsZeroByteGCM = o, bi; } var lb; function BD() { return lb || (lb = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = xl; e.__exportStar(MD(), t); }(Jg)), Jg; } var Xg = {}, Zg = {}, cb; function jD() { return cb || (cb = 1, Object.defineProperty(Zg, "__esModule", { value: !0 })), Zg; } var ev = {}, db; function $D() { return db || (db = 1, Object.defineProperty(ev, "__esModule", { value: !0 })), ev; } var tv = {}, fb; function VD() { return fb || (fb = 1, Object.defineProperty(tv, "__esModule", { value: !0 })), tv; } var nv = {}, hb; function zD() { return hb || (hb = 1, Object.defineProperty(nv, "__esModule", { value: !0 })), nv; } var Uc = {}, pb; function qD() { if (pb) return Uc; pb = 1, Object.defineProperty(Uc, "__esModule", { value: !0 }), Uc.isMsWindow = void 0; var t = [ "decrypt", "digest", "encrypt", "exportKey", "generateKey", "importKey", "sign", "verify" ]; function e(r) { return "MSInputMethodContext" in r && "msCrypto" in r; } function n(r) { if (e(r) && r.msCrypto.subtle !== void 0) { var i = r.msCrypto, o = i.getRandomValues, u = i.subtle; return t.map(function(l) { return u[l]; }).concat(o).every(function(l) { return typeof l == "function"; }); } return !1; } return Uc.isMsWindow = n, Uc; } var mb; function HD() { return mb || (mb = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = xl; e.__exportStar(jD(), t), e.__exportStar($D(), t), e.__exportStar(VD(), t), e.__exportStar(zD(), t), e.__exportStar(qD(), t); }(Xg)), Xg; } var gb; function KD() { if (gb) return xc; gb = 1, Object.defineProperty(xc, "__esModule", { value: !0 }), xc.Sha256 = void 0; var t = rC(), e = oC(), n = UD(), r = BD(), i = HD(), o = E0, u = ( /** @class */ function() { function l(f) { (0, r.supportsWebCrypto)((0, o.locateWindow)()) ? this.hash = new e.Sha256(f) : (0, i.isMsWindow)((0, o.locateWindow)()) ? this.hash = new t.Sha256(f) : this.hash = new n.Sha256(f); } return l.prototype.update = function(f, d) { this.hash.update(f, d); }, l.prototype.digest = function() { return this.hash.digest(); }, l; }() ); return xc.Sha256 = u, xc; } var vb; function GD() { return vb || (vb = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.WebCryptoSha256 = t.Ie11Sha256 = void 0; var e = xl; (0, e.__exportStar)(KD(), t); var n = rC(); Object.defineProperty(t, "Ie11Sha256", { enumerable: !0, get: function() { return n.Sha256; } }); var r = oC(); Object.defineProperty(t, "WebCryptoSha256", { enumerable: !0, get: function() { return r.Sha256; } }); }(Gg)), Gg; } var WD = GD(), yb = ( /** @class */ function() { function t(e) { this.statusCode = e.statusCode, this.headers = e.headers || {}, this.body = e.body; } return t.isInstance = function(e) { if (!e) return !1; var n = e; return typeof n.statusCode == "number" && typeof n.headers == "object"; }, t; }() ), ml = ( /** @class */ function() { function t(e) { this.method = e.method || "GET", this.hostname = e.hostname || "localhost", this.port = e.port, this.query = e.query || {}, this.headers = e.headers || {}, this.body = e.body, this.protocol = e.protocol ? e.protocol.substr(-1) !== ":" ? e.protocol + ":" : e.protocol : "https:", this.path = e.path ? e.path.charAt(0) !== "/" ? "/" + e.path : e.path : "/"; } return t.isInstance = function(e) { if (!e) return !1; var n = e; return "method" in n && "protocol" in n && "hostname" in n && "path" in n && typeof n.query == "object" && typeof n.headers == "object"; }, t.prototype.clone = function() { var e = new t(Tt(Tt({}, this), { headers: Tt({}, this.headers) })); return e.query && (e.query = YD(e.query)), e; }, t; }() ); function YD(t) { return Object.keys(t).reduce(function(e, n) { var r, i = t[n]; return Tt(Tt({}, e), (r = {}, r[n] = Array.isArray(i) ? io(i) : i, r)); }, {}); } var La = function(t) { return encodeURIComponent(t).replace(/[!'()*]/g, QD); }, QD = function(t) { return "%" + t.charCodeAt(0).toString(16).toUpperCase(); }; function JD(t) { var e, n, r = []; try { for (var i = Tr(Object.keys(t).sort()), o = i.next(); !o.done; o = i.next()) { var u = o.value, l = t[u]; if (u = La(u), Array.isArray(l)) for (var f = 0, d = l.length; f < d; f++) r.push(u + "=" + La(l[f])); else { var p = u; (l || typeof l == "string") && (p += "=" + La(l)), r.push(p); } } } catch (v) { e = { error: v }; } finally { try { o && !o.done && (n = i.return) && n.call(i); } finally { if (e) throw e.error; } } return r.join("&"); } function XD(t) { return t === void 0 && (t = 0), new Promise(function(e, n) { t && setTimeout(function() { var r = new Error("Request did not complete within " + t + " ms"); r.name = "TimeoutError", n(r); }, t); }); } var ZD = ( /** @class */ function() { function t(e) { var n = e === void 0 ? {} : e, r = n.requestTimeout; this.requestTimeout = r; } return t.prototype.destroy = function() { }, t.prototype.handle = function(e, n) { var r = n === void 0 ? {} : n, i = r.abortSignal, o = this.requestTimeout; if (i?.aborted) { var u = new Error("Request aborted"); return u.name = "AbortError", Promise.reject(u); } var l = e.path; if (e.query) { var f = JD(e.query); f && (l += "?" + f); } var d = e.port, p = e.method, v = e.protocol + "//" + e.hostname + (d ? ":" + d : "") + l, y = p === "GET" || p === "HEAD" ? void 0 : e.body, k = { body: y, headers: new Headers(e.headers), method: p }; typeof AbortController < "u" && (k.signal = i); var A = new Request(v, k), E = [ fetch(A).then(function(T) { var D, R, L = T.headers, j = {}; try { for (var K = Tr(L.entries()), ue = K.next(); !ue.done; ue = K.next()) { var de = ue.value; j[de[0]] = de[1]; } } catch (ve) { D = { error: ve }; } finally { try { ue && !ue.done && (R = K.return) && R.call(K); } finally { if (D) throw D.error; } } var H = T.body !== void 0; return H ? { response: new yb({ headers: j, statusCode: T.status, body: T.body }) } : T.blob().then(function(ve) { return { response: new yb({ headers: j, statusCode: T.status, body: ve }) }; }); }), XD(o) ]; return i && E.push(new Promise(function(T, D) { i.onabort = function() { var R = new Error("Request aborted"); R.name = "AbortError", D(R); }; })), Promise.race(E); }, t; }() ), Ya = {}, Nl = new Array(64); for (var qn = 0, pd = 65, A0 = 90; qn + pd <= A0; qn++) { var Ms = String.fromCharCode(qn + pd); Ya[Ms] = qn, Nl[qn] = Ms; } for (var qn = 0, pd = 97, A0 = 122; qn + pd <= A0; qn++) { var Ms = String.fromCharCode(qn + pd), md = qn + 26; Ya[Ms] = md, Nl[md] = Ms; } for (var qn = 0; qn < 10; qn++) { Ya[qn.toString(10)] = qn + 52; var Ms = qn.toString(10), md = qn + 52; Ya[Ms] = md, Nl[md] = Ms; } Ya["+"] = 62; Nl[62] = "+"; Ya["/"] = 63; Nl[63] = "/"; var ll = 6, ed = 8, eF = 63; function aC(t) { var e = t.length / 4 * 3; t.substr(-2) === "==" ? e -= 2 : t.substr(-1) === "=" && e--; for (var n = new ArrayBuffer(e), r = new DataView(n), i = 0; i < t.length; i += 4) { for (var o = 0, u = 0, l = i, f = i + 3; l <= f; l++) t[l] !== "=" ? (o |= Ya[t[l]] << (f - l) * ll, u += ll) : o >>= ll; var d = i / 4 * 3; o >>= u % ed; for (var p = Math.floor(u / ed), v = 0; v < p; v++) { var y = (p - v - 1) * ed; r.setUint8(d + v, (o & 255 << y) >> y); } } return new Uint8Array(n); } function tF(t) { for (var e = "", n = 0; n < t.length; n += 3) { for (var r = 0, i = 0, o = n, u = Math.min(n + 3, t.length); o < u; o++) r |= t[o] << (u - o - 1) * ed, i += ed; var l = Math.ceil(i / ll); r <<= l * ll - i; for (var f = 1; f <= l; f++) { var d = (l - f) * ll; e += Nl[(r & eF << d) >> d]; } e += "==".slice(0, 4 - l); } return e; } var nF = function(t) { return typeof Blob == "function" && t instanceof Blob ? rF(t) : iF(t); }; function rF(t) { return sn(this, void 0, void 0, function() { var e, n; return tn(this, function(r) { switch (r.label) { case 0: return [4, oF(t)]; case 1: return e = r.sent(), n = aC(e), [2, new Uint8Array(n)]; } }); }); } function iF(t) { return sn(this, void 0, void 0, function() { var e, n, r, i, o, u, l; return tn(this, function(f) { switch (f.label) { case 0: e = new Uint8Array(0), n = t.getReader(), r = !1, f.label = 1; case 1: return r ? [3, 3] : [4, n.read()]; case 2: return i = f.sent(), o = i.done, u = i.value, u && (l = e, e = new Uint8Array(l.length + u.length), e.set(l), e.set(u, l.length)), r = o, [3, 1]; case 3: return [2, e]; } }); }); } function oF(t) { return new Promise(function(e, n) { var r = new FileReader(); r.onloadend = function() { var i; if (r.readyState !== 2) return n(new Error("Reader aborted too early")); var o = (i = r.result) !== null && i !== void 0 ? i : "", u = o.indexOf(","), l = u > -1 ? u + 1 : o.length; e(o.substring(l)); }, r.onabort = function() { return n(new Error("Read aborted")); }, r.onerror = function() { return n(r.error); }, r.readAsDataURL(t); }); } var sF = function(t) { return function() { return Promise.reject(t); }; }, aF = function(t) { return function(e, n) { return function(r) { return sn(void 0, void 0, void 0, function() { var i; return tn(this, function(o) { return !((i = t?.retryStrategy) === null || i === void 0) && i.mode && (n.userAgent = io(n.userAgent || [], [["cfg/retry-mode", t.retryStrategy.mode]])), [2, t.retryStrategy.retry(e, r)]; }); }); }; }; }, uF = { name: "retryMiddleware", tags: ["RETRY"], step: "finalizeRequest", priority: "high", override: !0 }, lF = function(t) { return { applyToStack: function(e) { e.add(aF(t), uF); } }; }, cF = 100, dF = 20 * 1e3, fF = 500, hF = 500, pF = 5, mF = 10, gF = 1, vF = "amz-sdk-invocation-id", yF = "amz-sdk-request", wF = [ "AuthFailure", "InvalidSignatureException", "RequestExpired", "RequestInTheFuture", "RequestTimeTooSkewed", "SignatureDoesNotMatch" ], SF = [ "BandwidthLimitExceeded", "EC2ThrottledException", "LimitExceededException", "PriorRequestNotComplete", "ProvisionedThroughputExceededException", "RequestLimitExceeded", "RequestThrottled", "RequestThrottledException", "SlowDown", "ThrottledException", "Throttling", "ThrottlingException", "TooManyRequestsException", "TransactionInProgressException" ], _F = ["AbortError", "TimeoutError", "RequestTimeout", "RequestTimeoutException"], bF = [500, 502, 503, 504], kF = function(t) { return t.$retryable !== void 0; }, EF = function(t) { return wF.includes(t.name); }, uC = function(t) { var e, n; return ((e = t.$metadata) === null || e === void 0 ? void 0 : e.httpStatusCode) === 429 || SF.includes(t.name) || ((n = t.$retryable) === null || n === void 0 ? void 0 : n.throttling) == !0; }, AF = function(t) { var e; return _F.includes(t.name) || bF.includes(((e = t.$metadata) === null || e === void 0 ? void 0 : e.httpStatusCode) || 0); }, eh = { exports: {} }, wb; function lC() { if (wb) return eh.exports; wb = 1; var t = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof window.msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto); if (t) { var e = new Uint8Array(16); eh.exports = function() { return t(e), e; }; } else { var n = new Array(16); eh.exports = function() { for (var i = 0, o; i < 16; i++) (i & 3) === 0 && (o = Math.random() * 4294967296), n[i] = o >>> ((i & 3) << 3) & 255; return n; }; } return eh.exports; } var rv, Sb; function cC() { if (Sb) return rv; Sb = 1; for (var t = [], e = 0; e < 256; ++e) t[e] = (e + 256).toString(16).substr(1); function n(r, i) { var o = i || 0, u = t; return [ u[r[o++]], u[r[o++]], u[r[o++]], u[r[o++]], "-", u[r[o++]], u[r[o++]], "-", u[r[o++]], u[r[o++]], "-", u[r[o++]], u[r[o++]], "-", u[r[o++]], u[r[o++]], u[r[o++]], u[r[o++]], u[r[o++]], u[r[o++]] ].join(""); } return rv = n, rv; } var iv, _b; function CF() { if (_b) return iv; _b = 1; var t = lC(), e = cC(), n, r, i = 0, o = 0; function u(l, f, d) { var p = f && d || 0, v = f || []; l = l || {}; var y = l.node || n, k = l.clockseq !== void 0 ? l.clockseq : r; if (y == null || k == null) { var A = t(); y == null && (y = n = [ A[0] | 1, A[1], A[2], A[3], A[4], A[5] ]), k == null && (k = r = (A[6] << 8 | A[7]) & 16383); } var E = l.msecs !== void 0 ? l.msecs : (/* @__PURE__ */ new Date()).getTime(), T = l.nsecs !== void 0 ? l.nsecs : o + 1, D = E - i + (T - o) / 1e4; if (D < 0 && l.clockseq === void 0 && (k = k + 1 & 16383), (D < 0 || E > i) && l.nsecs === void 0 && (T = 0), T >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); i = E, o = T, r = k, E += 122192928e5; var R = ((E & 268435455) * 1e4 + T) % 4294967296; v[p++] = R >>> 24 & 255, v[p++] = R >>> 16 & 255, v[p++] = R >>> 8 & 255, v[p++] = R & 255; var L = E / 4294967296 * 1e4 & 268435455; v[p++] = L >>> 8 & 255, v[p++] = L & 255, v[p++] = L >>> 24 & 15 | 16, v[p++] = L >>> 16 & 255, v[p++] = k >>> 8 | 128, v[p++] = k & 255; for (var j = 0; j < 6; ++j) v[p + j] = y[j]; return f || e(v); } return iv = u, iv; } var ov, bb; function xF() { if (bb) return ov; bb = 1; var t = lC(), e = cC(); function n(r, i, o) { var u = i && o || 0; typeof r == "string" && (i = r === "binary" ? new Array(16) : null, r = null), r = r || {}; var l = r.random || (r.rng || t)(); if (l[6] = l[6] & 15 | 64, l[8] = l[8] & 63 | 128, i) for (var f = 0; f < 16; ++f) i[u + f] = l[f]; return i || e(l); } return ov = n, ov; } var sv, kb; function NF() { if (kb) return sv; kb = 1; var t = CF(), e = xF(), n = e; return n.v1 = t, n.v4 = e, sv = n, sv; } var TF = NF(), IF = function(t) { var e = t, n = t, r = function(l) { return l.name === "TimeoutError" ? mF : pF; }, i = function(l) { return r(l) <= n; }, o = function(l) { if (!i(l)) throw new Error("No retry token available"); var f = r(l); return n -= f, f; }, u = function(l) { n += l ?? gF, n = Math.min(n, e); }; return Object.freeze({ hasRetryTokens: i, retrieveRetryTokens: o, releaseRetryTokens: u }); }, RF = function(t, e) { return Math.floor(Math.min(dF, Math.random() * Math.pow(2, e) * t)); }, OF = function(t) { return t ? kF(t) || EF(t) || uC(t) || AF(t) : !1; }, C0 = 3, PF = "standard", DF = ( /** @class */ function() { function t(e, n) { var r, i, o; this.maxAttemptsProvider = e, this.mode = PF, this.retryDecider = (r = n?.retryDecider) !== null && r !== void 0 ? r : OF, this.delayDecider = (i = n?.delayDecider) !== null && i !== void 0 ? i : RF, this.retryQuota = (o = n?.retryQuota) !== null && o !== void 0 ? o : IF(hF); } return t.prototype.shouldRetry = function(e, n, r) { return n < r && this.retryDecider(e) && this.retryQuota.hasRetryTokens(e); }, t.prototype.getMaxAttempts = function() { return sn(this, void 0, void 0, function() { var e; return tn(this, function(n) { switch (n.label) { case 0: return n.trys.push([0, 2, , 3]), [4, this.maxAttemptsProvider()]; case 1: return e = n.sent(), [3, 3]; case 2: return n.sent(), e = C0, [3, 3]; case 3: return [2, e]; } }); }); }, t.prototype.retry = function(e, n) { return sn(this, void 0, void 0, function() { var r, i, o, u, l, f, d, p; return tn(this, function(v) { switch (v.label) { case 0: return i = 0, o = 0, [4, this.getMaxAttempts()]; case 1: u = v.sent(), l = n.request, ml.isInstance(l) && (l.headers[vF] = TF.v4()), f = function() { var y, k, A, E, T; return tn(this, function(D) { switch (D.label) { case 0: return D.trys.push([0, 2, , 5]), ml.isInstance(l) && (l.headers[yF] = "attempt=" + (i + 1) + "; max=" + u), [4, e(n)]; case 1: return y = D.sent(), k = y.response, A = y.output, d.retryQuota.releaseRetryTokens(r), A.$metadata.attempts = i + 1, A.$metadata.totalRetryDelay = o, [2, { value: { response: k, output: A } }]; case 2: return E = D.sent(), i++, d.shouldRetry(E, i, u) ? (r = d.retryQuota.retrieveRetryTokens(E), T = d.delayDecider(uC(E) ? fF : cF, i), o += T, [4, new Promise(function(R) { return setTimeout(R, T); })]) : [3, 4]; case 3: return D.sent(), [2, "continue"]; case 4: throw E.$metadata || (E.$metadata = {}), E.$metadata.attempts = i, E.$metadata.totalRetryDelay = o, E; case 5: return [ 2 /*return*/ ]; } }); }, d = this, v.label = 2; case 2: return [5, f()]; case 3: return p = v.sent(), typeof p == "object" ? [2, p.value] : [3, 2]; case 4: return [ 2 /*return*/ ]; } }); }); }, t; }() ), FF = function(t) { var e = LF(t.maxAttempts); return Tt(Tt({}, t), { maxAttempts: e, retryStrategy: t.retryStrategy || new DF(e) }); }, LF = function(t) { if (t === void 0 && (t = C0), typeof t == "number") { var e = Promise.resolve(t); return function() { return e; }; } return t; }; function UF(t) { if (typeof t == "string") { for (var e = t.length, n = e - 1; n >= 0; n--) { var r = t.charCodeAt(n); r > 127 && r <= 2047 ? e++ : r > 2047 && r <= 65535 && (e += 2); } return e; } else { if (typeof t.byteLength == "number") return t.byteLength; if (typeof t.size == "number") return t.size; } } const MF = { "Amazon Silk": "amazon_silk", "Android Browser": "android", Bada: "bada", BlackBerry: "blackberry", Chrome: "chrome", Chromium: "chromium", Electron: "electron", Epiphany: "epiphany", Firefox: "firefox", Focus: "focus", Generic: "generic", "Google Search": "google_search", Googlebot: "googlebot", "Internet Explorer": "ie", "K-Meleon": "k_meleon", Maxthon: "maxthon", "Microsoft Edge": "edge", "MZ Browser": "mz", "NAVER Whale Browser": "naver", Opera: "opera", "Opera Coast": "opera_coast", PhantomJS: "phantomjs", Puffin: "puffin", QupZilla: "qupzilla", QQ: "qq", QQLite: "qqlite", Safari: "safari", Sailfish: "sailfish", "Samsung Internet for Android": "samsung_internet", SeaMonkey: "seamonkey", Sleipnir: "sleipnir", Swing: "swing", Tizen: "tizen", "UC Browser": "uc", Vivaldi: "vivaldi", "WebOS Browser": "webos", WeChat: "wechat", "Yandex Browser": "yandex", Roku: "roku" }, dC = { amazon_silk: "Amazon Silk", android: "Android Browser", bada: "Bada", blackberry: "BlackBerry", chrome: "Chrome", chromium: "Chromium", electron: "Electron", epiphany: "Epiphany", firefox: "Firefox", focus: "Focus", generic: "Generic", googlebot: "Googlebot", google_search: "Google Search", ie: "Internet Explorer", k_meleon: "K-Meleon", maxthon: "Maxthon", edge: "Microsoft Edge", mz: "MZ Browser", naver: "NAVER Whale Browser", opera: "Opera", opera_coast: "Opera Coast", phantomjs: "PhantomJS", puffin: "Puffin", qupzilla: "QupZilla", qq: "QQ Browser", qqlite: "QQ Browser Lite", safari: "Safari", sailfish: "Sailfish", samsung_internet: "Samsung Internet for Android", seamonkey: "SeaMonkey", sleipnir: "Sleipnir", swing: "Swing", tizen: "Tizen", uc: "UC Browser", vivaldi: "Vivaldi", webos: "WebOS Browser", wechat: "WeChat", yandex: "Yandex Browser" }, An = { tablet: "tablet", mobile: "mobile", desktop: "desktop", tv: "tv" }, ur = { WindowsPhone: "Windows Phone", Windows: "Windows", MacOS: "macOS", iOS: "iOS", Android: "Android", WebOS: "WebOS", BlackBerry: "BlackBerry", Bada: "Bada", Tizen: "Tizen", Linux: "Linux", ChromeOS: "Chrome OS", PlayStation4: "PlayStation 4", Roku: "Roku" }, ws = { EdgeHTML: "EdgeHTML", Blink: "Blink", Trident: "Trident", Presto: "Presto", Gecko: "Gecko", WebKit: "WebKit" }; class Pe { /** * Get first matched item for a string * @param {RegExp} regexp * @param {String} ua * @return {Array|{index: number, input: string}|*|boolean|string} */ static getFirstMatch(e, n) { const r = n.match(e); return r && r.length > 0 && r[1] || ""; } /** * Get second matched item for a string * @param regexp * @param {String} ua * @return {Array|{index: number, input: string}|*|boolean|string} */ static getSecondMatch(e, n) { const r = n.match(e); return r && r.length > 1 && r[2] || ""; } /** * Match a regexp and return a constant or undefined * @param {RegExp} regexp * @param {String} ua * @param {*} _const Any const that will be returned if regexp matches the string * @return {*} */ static matchAndReturnConst(e, n, r) { if (e.test(n)) return r; } static getWindowsVersionName(e) { switch (e) { case "NT": return "NT"; case "XP": return "XP"; case "NT 5.0": return "2000"; case "NT 5.1": return "XP"; case "NT 5.2": return "2003"; case "NT 6.0": return "Vista"; case "NT 6.1": return "7"; case "NT 6.2": return "8"; case "NT 6.3": return "8.1"; case "NT 10.0": return "10"; default: return; } } /** * Get macOS version name * 10.5 - Leopard * 10.6 - Snow Leopard * 10.7 - Lion * 10.8 - Mountain Lion * 10.9 - Mavericks * 10.10 - Yosemite * 10.11 - El Capitan * 10.12 - Sierra * 10.13 - High Sierra * 10.14 - Mojave * 10.15 - Catalina * * @example * getMacOSVersionName("10.14") // 'Mojave' * * @param {string} version * @return {string} versionName */ static getMacOSVersionName(e) { const n = e.split(".").splice(0, 2).map((r) => parseInt(r, 10) || 0); if (n.push(0), n[0] === 10) switch (n[1]) { case 5: return "Leopard"; case 6: return "Snow Leopard"; case 7: return "Lion"; case 8: return "Mountain Lion"; case 9: return "Mavericks"; case 10: return "Yosemite"; case 11: return "El Capitan"; case 12: return "Sierra"; case 13: return "High Sierra"; case 14: return "Mojave"; case 15: return "Catalina"; default: return; } } /** * Get Android version name * 1.5 - Cupcake * 1.6 - Donut * 2.0 - Eclair * 2.1 - Eclair * 2.2 - Froyo * 2.x - Gingerbread * 3.x - Honeycomb * 4.0 - Ice Cream Sandwich * 4.1 - Jelly Bean * 4.4 - KitKat * 5.x - Lollipop * 6.x - Marshmallow * 7.x - Nougat * 8.x - Oreo * 9.x - Pie * * @example * getAndroidVersionName("7.0") // 'Nougat' * * @param {string} version * @return {string} versionName */ static getAndroidVersionName(e) { const n = e.split(".").splice(0, 2).map((r) => parseInt(r, 10) || 0); if (n.push(0), !(n[0] === 1 && n[1] < 5)) { if (n[0] === 1 && n[1] < 6) return "Cupcake"; if (n[0] === 1 && n[1] >= 6) return "Donut"; if (n[0] === 2 && n[1] < 2) return "Eclair"; if (n[0] === 2 && n[1] === 2) return "Froyo"; if (n[0] === 2 && n[1] > 2) return "Gingerbread"; if (n[0] === 3) return "Honeycomb"; if (n[0] === 4 && n[1] < 1) return "Ice Cream Sandwich"; if (n[0] === 4 && n[1] < 4) return "Jelly Bean"; if (n[0] === 4 && n[1] >= 4) return "KitKat"; if (n[0] === 5) return "Lollipop"; if (n[0] === 6) return "Marshmallow"; if (n[0] === 7) return "Nougat"; if (n[0] === 8) return "Oreo"; if (n[0] === 9) return "Pie"; } } /** * Get version precisions count * * @example * getVersionPrecision("1.10.3") // 3 * * @param {string} version * @return {number} */ static getVersionPrecision(e) { return e.split(".").length; } /** * Calculate browser version weight * * @example * compareVersions('1.10.2.1', '1.8.2.1.90') // 1 * compareVersions('1.010.2.1', '1.09.2.1.90'); // 1 * compareVersions('1.10.2.1', '1.10.2.1'); // 0 * compareVersions('1.10.2.1', '1.0800.2'); // -1 * compareVersions('1.10.2.1', '1.10', true); // 0 * * @param {String} versionA versions versions to compare * @param {String} versionB versions versions to compare * @param {boolean} [isLoose] enable loose comparison * @return {Number} comparison result: -1 when versionA is lower, * 1 when versionA is bigger, 0 when both equal */ /* eslint consistent-return: 1 */ static compareVersions(e, n, r = !1) { const i = Pe.getVersionPrecision(e), o = Pe.getVersionPrecision(n); let u = Math.max(i, o), l = 0; const f = Pe.map([e, n], (d) => { const p = u - Pe.getVersionPrecision(d), v = d + new Array(p + 1).join(".0"); return Pe.map(v.split("."), (y) => new Array(20 - y.length).join("0") + y).reverse(); }); for (r && (l = u - Math.min(i, o)), u -= 1; u >= l; ) { if (f[0][u] > f[1][u]) return 1; if (f[0][u] === f[1][u]) { if (u === l) return 0; u -= 1; } else if (f[0][u] < f[1][u]) return -1; } } /** * Array::map polyfill * * @param {Array} arr * @param {Function} iterator * @return {Array} */ static map(e, n) { const r = []; let i; if (Array.prototype.map) return Array.prototype.map.call(e, n); for (i = 0; i < e.length; i += 1) r.push(n(e[i])); return r; } /** * Array::find polyfill * * @param {Array} arr * @param {Function} predicate * @return {Array} */ static find(e, n) { let r, i; if (Array.prototype.find) return Array.prototype.find.call(e, n); for (r = 0, i = e.length; r < i; r += 1) { const o = e[r]; if (n(o, r)) return o; } } /** * Object::assign polyfill * * @param {Object} obj * @param {Object} ...objs * @return {Object} */ static assign(e, ...n) { const r = e; let i, o; if (Object.assign) return Object.assign(e, ...n); for (i = 0, o = n.length; i < o; i += 1) { const u = n[i]; typeof u == "object" && u !== null && Object.keys(u).forEach((f) => { r[f] = u[f]; }); } return e; } /** * Get short version/alias for a browser name * * @example * getBrowserAlias('Microsoft Edge') // edge * * @param {string} browserName * @return {string} */ static getBrowserAlias(e) { return MF[e]; } /** * Get short version/alias for a browser name * * @example * getBrowserAlias('edge') // Microsoft Edge * * @param {string} browserAlias * @return {string} */ static getBrowserTypeByAlias(e) { return dC[e] || ""; } } const rn = /version\/(\d+(\.?_?\d+)+)/i, BF = [ /* Googlebot */ { test: [/googlebot/i], describe(t) { const e = { name: "Googlebot" }, n = Pe.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, /* Opera < 13.0 */ { test: [/opera/i], describe(t) { const e = { name: "Opera" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Opera > 13.0 */ { test: [/opr\/|opios/i], describe(t) { const e = { name: "Opera" }, n = Pe.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/SamsungBrowser/i], describe(t) { const e = { name: "Samsung Internet for Android" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/Whale/i], describe(t) { const e = { name: "NAVER Whale Browser" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/MZBrowser/i], describe(t) { const e = { name: "MZ Browser" }, n = Pe.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/focus/i], describe(t) { const e = { name: "Focus" }, n = Pe.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/swing/i], describe(t) { const e = { name: "Swing" }, n = Pe.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/coast/i], describe(t) { const e = { name: "Opera Coast" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/opt\/\d+(?:.?_?\d+)+/i], describe(t) { const e = { name: "Opera Touch" }, n = Pe.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/yabrowser/i], describe(t) { const e = { name: "Yandex Browser" }, n = Pe.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/ucbrowser/i], describe(t) { const e = { name: "UC Browser" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/Maxthon|mxios/i], describe(t) { const e = { name: "Maxthon" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/epiphany/i], describe(t) { const e = { name: "Epiphany" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/puffin/i], describe(t) { const e = { name: "Puffin" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/sleipnir/i], describe(t) { const e = { name: "Sleipnir" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/k-meleon/i], describe(t) { const e = { name: "K-Meleon" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/micromessenger/i], describe(t) { const e = { name: "WeChat" }, n = Pe.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/qqbrowser/i], describe(t) { const e = { name: /qqbrowserlite/i.test(t) ? "QQ Browser Lite" : "QQ Browser" }, n = Pe.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/msie|trident/i], describe(t) { const e = { name: "Internet Explorer" }, n = Pe.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/\sedg\//i], describe(t) { const e = { name: "Microsoft Edge" }, n = Pe.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/edg([ea]|ios)/i], describe(t) { const e = { name: "Microsoft Edge" }, n = Pe.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/vivaldi/i], describe(t) { const e = { name: "Vivaldi" }, n = Pe.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/seamonkey/i], describe(t) { const e = { name: "SeaMonkey" }, n = Pe.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/sailfish/i], describe(t) { const e = { name: "Sailfish" }, n = Pe.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, t); return n && (e.version = n), e; } }, { test: [/silk/i], describe(t) { const e = { name: "Amazon Silk" }, n = Pe.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/phantom/i], describe(t) { const e = { name: "PhantomJS" }, n = Pe.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/slimerjs/i], describe(t) { const e = { name: "SlimerJS" }, n = Pe.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/blackberry|\bbb\d+/i, /rim\stablet/i], describe(t) { const e = { name: "BlackBerry" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/(web|hpw)[o0]s/i], describe(t) { const e = { name: "WebOS Browser" }, n = Pe.getFirstMatch(rn, t) || Pe.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/bada/i], describe(t) { const e = { name: "Bada" }, n = Pe.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/tizen/i], describe(t) { const e = { name: "Tizen" }, n = Pe.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/qupzilla/i], describe(t) { const e = { name: "QupZilla" }, n = Pe.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/firefox|iceweasel|fxios/i], describe(t) { const e = { name: "Firefox" }, n = Pe.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/electron/i], describe(t) { const e = { name: "Electron" }, n = Pe.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/MiuiBrowser/i], describe(t) { const e = { name: "Miui" }, n = Pe.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/chromium/i], describe(t) { const e = { name: "Chromium" }, n = Pe.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, t) || Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, { test: [/chrome|crios|crmo/i], describe(t) { const e = { name: "Chrome" }, n = Pe.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/GSA/i], describe(t) { const e = { name: "Google Search" }, n = Pe.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Android Browser */ { test(t) { const e = !t.test(/like android/i), n = t.test(/android/i); return e && n; }, describe(t) { const e = { name: "Android Browser" }, n = Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, /* PlayStation 4 */ { test: [/playstation 4/i], describe(t) { const e = { name: "PlayStation 4" }, n = Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, /* Safari */ { test: [/safari|applewebkit/i], describe(t) { const e = { name: "Safari" }, n = Pe.getFirstMatch(rn, t); return n && (e.version = n), e; } }, /* Something else */ { test: [/.*/i], describe(t) { const e = /^(.*)\/(.*) /, n = /^(.*)\/(.*)[ \t]\((.*)/, i = t.search("\\(") !== -1 ? n : e; return { name: Pe.getFirstMatch(i, t), version: Pe.getSecondMatch(i, t) }; } } ], jF = [ /* Roku */ { test: [/Roku\/DVP/], describe(t) { const e = Pe.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, t); return { name: ur.Roku, version: e }; } }, /* Windows Phone */ { test: [/windows phone/i], describe(t) { const e = Pe.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, t); return { name: ur.WindowsPhone, version: e }; } }, /* Windows */ { test: [/windows /i], describe(t) { const e = Pe.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, t), n = Pe.getWindowsVersionName(e); return { name: ur.Windows, version: e, versionName: n }; } }, /* Firefox on iPad */ { test: [/Macintosh(.*?) FxiOS(.*?)\//], describe(t) { const e = { name: ur.iOS }, n = Pe.getSecondMatch(/(Version\/)(\d[\d.]+)/, t); return n && (e.version = n), e; } }, /* macOS */ { test: [/macintosh/i], describe(t) { const e = Pe.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, t).replace(/[_\s]/g, "."), n = Pe.getMacOSVersionName(e), r = { name: ur.MacOS, version: e }; return n && (r.versionName = n), r; } }, /* iOS */ { test: [/(ipod|iphone|ipad)/i], describe(t) { const e = Pe.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, t).replace(/[_\s]/g, "."); return { name: ur.iOS, version: e }; } }, /* Android */ { test(t) { const e = !t.test(/like android/i), n = t.test(/android/i); return e && n; }, describe(t) { const e = Pe.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, t), n = Pe.getAndroidVersionName(e), r = { name: ur.Android, version: e }; return n && (r.versionName = n), r; } }, /* WebOS */ { test: [/(web|hpw)[o0]s/i], describe(t) { const e = Pe.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, t), n = { name: ur.WebOS }; return e && e.length && (n.version = e), n; } }, /* BlackBerry */ { test: [/blackberry|\bbb\d+/i, /rim\stablet/i], describe(t) { const e = Pe.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, t) || Pe.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, t) || Pe.getFirstMatch(/\bbb(\d+)/i, t); return { name: ur.BlackBerry, version: e }; } }, /* Bada */ { test: [/bada/i], describe(t) { const e = Pe.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, t); return { name: ur.Bada, version: e }; } }, /* Tizen */ { test: [/tizen/i], describe(t) { const e = Pe.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, t); return { name: ur.Tizen, version: e }; } }, /* Linux */ { test: [/linux/i], describe() { return { name: ur.Linux }; } }, /* Chrome OS */ { test: [/CrOS/], describe() { return { name: ur.ChromeOS }; } }, /* Playstation 4 */ { test: [/PlayStation 4/], describe(t) { const e = Pe.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, t); return { name: ur.PlayStation4, version: e }; } } ], $F = [ /* Googlebot */ { test: [/googlebot/i], describe() { return { type: "bot", vendor: "Google" }; } }, /* Huawei */ { test: [/huawei/i], describe(t) { const e = Pe.getFirstMatch(/(can-l01)/i, t) && "Nova", n = { type: An.mobile, vendor: "Huawei" }; return e && (n.model = e), n; } }, /* Nexus Tablet */ { test: [/nexus\s*(?:7|8|9|10).*/i], describe() { return { type: An.tablet, vendor: "Nexus" }; } }, /* iPad */ { test: [/ipad/i], describe() { return { type: An.tablet, vendor: "Apple", model: "iPad" }; } }, /* Firefox on iPad */ { test: [/Macintosh(.*?) FxiOS(.*?)\//], describe() { return { type: An.tablet, vendor: "Apple", model: "iPad" }; } }, /* Amazon Kindle Fire */ { test: [/kftt build/i], describe() { return { type: An.tablet, vendor: "Amazon", model: "Kindle Fire HD 7" }; } }, /* Another Amazon Tablet with Silk */ { test: [/silk/i], describe() { return { type: An.tablet, vendor: "Amazon" }; } }, /* Tablet */ { test: [/tablet(?! pc)/i], describe() { return { type: An.tablet }; } }, /* iPod/iPhone */ { test(t) { const e = t.test(/ipod|iphone/i), n = t.test(/like (ipod|iphone)/i); return e && !n; }, describe(t) { const e = Pe.getFirstMatch(/(ipod|iphone)/i, t); return { type: An.mobile, vendor: "Apple", model: e }; } }, /* Nexus Mobile */ { test: [/nexus\s*[0-6].*/i, /galaxy nexus/i], describe() { return { type: An.mobile, vendor: "Nexus" }; } }, /* Mobile */ { test: [/[^-]mobi/i], describe() { return { type: An.mobile }; } }, /* BlackBerry */ { test(t) { return t.getBrowserName(!0) === "blackberry"; }, describe() { return { type: An.mobile, vendor: "BlackBerry" }; } }, /* Bada */ { test(t) { return t.getBrowserName(!0) === "bada"; }, describe() { return { type: An.mobile }; } }, /* Windows Phone */ { test(t) { return t.getBrowserName() === "windows phone"; }, describe() { return { type: An.mobile, vendor: "Microsoft" }; } }, /* Android Tablet */ { test(t) { const e = Number(String(t.getOSVersion()).split(".")[0]); return t.getOSName(!0) === "android" && e >= 3; }, describe() { return { type: An.tablet }; } }, /* Android Mobile */ { test(t) { return t.getOSName(!0) === "android"; }, describe() { return { type: An.mobile }; } }, /* desktop */ { test(t) { return t.getOSName(!0) === "macos"; }, describe() { return { type: An.desktop, vendor: "Apple" }; } }, /* Windows */ { test(t) { return t.getOSName(!0) === "windows"; }, describe() { return { type: An.desktop }; } }, /* Linux */ { test(t) { return t.getOSName(!0) === "linux"; }, describe() { return { type: An.desktop }; } }, /* PlayStation 4 */ { test(t) { return t.getOSName(!0) === "playstation 4"; }, describe() { return { type: An.tv }; } }, /* Roku */ { test(t) { return t.getOSName(!0) === "roku"; }, describe() { return { type: An.tv }; } } ], VF = [ /* EdgeHTML */ { test(t) { return t.getBrowserName(!0) === "microsoft edge"; }, describe(t) { if (/\sedg\//i.test(t)) return { name: ws.Blink }; const n = Pe.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, t); return { name: ws.EdgeHTML, version: n }; } }, /* Trident */ { test: [/trident/i], describe(t) { const e = { name: ws.Trident }, n = Pe.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Presto */ { test(t) { return t.test(/presto/i); }, describe(t) { const e = { name: ws.Presto }, n = Pe.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Gecko */ { test(t) { const e = t.test(/gecko/i), n = t.test(/like gecko/i); return e && !n; }, describe(t) { const e = { name: ws.Gecko }, n = Pe.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Blink */ { test: [/(apple)?webkit\/537\.36/i], describe() { return { name: ws.Blink }; } }, /* WebKit */ { test: [/(apple)?webkit/i], describe(t) { const e = { name: ws.WebKit }, n = Pe.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } } ]; let Eb = class { /** * Create instance of Parser * * @param {String} UA User-Agent string * @param {Boolean} [skipParsing=false] parser can skip parsing in purpose of performance * improvements if you need to make a more particular parsing * like {@link Parser#parseBrowser} or {@link Parser#parsePlatform} * * @throw {Error} in case of empty UA String * * @constructor */ constructor(e, n = !1) { if (e == null || e === "") throw new Error("UserAgent parameter can't be empty"); this._ua = e, this.parsedResult = {}, n !== !0 && this.parse(); } /** * Get UserAgent string of current Parser instance * @return {String} User-Agent String of the current object * * @public */ getUA() { return this._ua; } /** * Test a UA string for a regexp * @param {RegExp} regex * @return {Boolean} */ test(e) { return e.test(this._ua); } /** * Get parsed browser object * @return {Object} */ parseBrowser() { this.parsedResult.browser = {}; const e = Pe.find(BF, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return e && (this.parsedResult.browser = e.describe(this.getUA())), this.parsedResult.browser; } /** * Get parsed browser object * @return {Object} * * @public */ getBrowser() { return this.parsedResult.browser ? this.parsedResult.browser : this.parseBrowser(); } /** * Get browser's name * @return {String} Browser's name or an empty string * * @public */ getBrowserName(e) { return e ? String(this.getBrowser().name).toLowerCase() || "" : this.getBrowser().name || ""; } /** * Get browser's version * @return {String} version of browser * * @public */ getBrowserVersion() { return this.getBrowser().version; } /** * Get OS * @return {Object} * * @example * this.getOS(); * { * name: 'macOS', * version: '10.11.12' * } */ getOS() { return this.parsedResult.os ? this.parsedResult.os : this.parseOS(); } /** * Parse OS and save it to this.parsedResult.os * @return {*|{}} */ parseOS() { this.parsedResult.os = {}; const e = Pe.find(jF, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return e && (this.parsedResult.os = e.describe(this.getUA())), this.parsedResult.os; } /** * Get OS name * @param {Boolean} [toLowerCase] return lower-cased value * @return {String} name of the OS — macOS, Windows, Linux, etc. */ getOSName(e) { const { name: n } = this.getOS(); return e ? String(n).toLowerCase() || "" : n || ""; } /** * Get OS version * @return {String} full version with dots ('10.11.12', '5.6', etc) */ getOSVersion() { return this.getOS().version; } /** * Get parsed platform * @return {{}} */ getPlatform() { return this.parsedResult.platform ? this.parsedResult.platform : this.parsePlatform(); } /** * Get platform name * @param {Boolean} [toLowerCase=false] * @return {*} */ getPlatformType(e = !1) { const { type: n } = this.getPlatform(); return e ? String(n).toLowerCase() || "" : n || ""; } /** * Get parsed platform * @return {{}} */ parsePlatform() { this.parsedResult.platform = {}; const e = Pe.find($F, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return e && (this.parsedResult.platform = e.describe(this.getUA())), this.parsedResult.platform; } /** * Get parsed engine * @return {{}} */ getEngine() { return this.parsedResult.engine ? this.parsedResult.engine : this.parseEngine(); } /** * Get engines's name * @return {String} Engines's name or an empty string * * @public */ getEngineName(e) { return e ? String(this.getEngine().name).toLowerCase() || "" : this.getEngine().name || ""; } /** * Get parsed platform * @return {{}} */ parseEngine() { this.parsedResult.engine = {}; const e = Pe.find(VF, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return e && (this.parsedResult.engine = e.describe(this.getUA())), this.parsedResult.engine; } /** * Parse full information about the browser * @returns {Parser} */ parse() { return this.parseBrowser(), this.parseOS(), this.parsePlatform(), this.parseEngine(), this; } /** * Get parsed result * @return {ParsedResult} */ getResult() { return Pe.assign({}, this.parsedResult); } /** * Check if parsed browser matches certain conditions * * @param {Object} checkTree It's one or two layered object, * which can include a platform or an OS on the first layer * and should have browsers specs on the bottom-laying layer * * @returns {Boolean|undefined} Whether the browser satisfies the set conditions or not. * Returns `undefined` when the browser is no described in the checkTree object. * * @example * const browser = Bowser.getParser(window.navigator.userAgent); * if (browser.satisfies({chrome: '>118.01.1322' })) * // or with os * if (browser.satisfies({windows: { chrome: '>118.01.1322' } })) * // or with platforms * if (browser.satisfies({desktop: { chrome: '>118.01.1322' } })) */ satisfies(e) { const n = {}; let r = 0; const i = {}; let o = 0; if (Object.keys(e).forEach((l) => { const f = e[l]; typeof f == "string" ? (i[l] = f, o += 1) : typeof f == "object" && (n[l] = f, r += 1); }), r > 0) { const l = Object.keys(n), f = Pe.find(l, (p) => this.isOS(p)); if (f) { const p = this.satisfies(n[f]); if (p !== void 0) return p; } const d = Pe.find( l, (p) => this.isPlatform(p) ); if (d) { const p = this.satisfies(n[d]); if (p !== void 0) return p; } } if (o > 0) { const l = Object.keys(i), f = Pe.find(l, (d) => this.isBrowser(d, !0)); if (f !== void 0) return this.compareVersion(i[f]); } } /** * Check if the browser name equals the passed string * @param browserName The string to compare with the browser name * @param [includingAlias=false] The flag showing whether alias will be included into comparison * @returns {boolean} */ isBrowser(e, n = !1) { const r = this.getBrowserName().toLowerCase(); let i = e.toLowerCase(); const o = Pe.getBrowserTypeByAlias(i); return n && o && (i = o.toLowerCase()), i === r; } compareVersion(e) { let n = [0], r = e, i = !1; const o = this.getBrowserVersion(); if (typeof o == "string") return e[0] === ">" || e[0] === "<" ? (r = e.substr(1), e[1] === "=" ? (i = !0, r = e.substr(2)) : n = [], e[0] === ">" ? n.push(1) : n.push(-1)) : e[0] === "=" ? r = e.substr(1) : e[0] === "~" && (i = !0, r = e.substr(1)), n.indexOf( Pe.compareVersions(o, r, i) ) > -1; } isOS(e) { return this.getOSName(!0) === String(e).toLowerCase(); } isPlatform(e) { return this.getPlatformType(!0) === String(e).toLowerCase(); } isEngine(e) { return this.getEngineName(!0) === String(e).toLowerCase(); } /** * Is anything? Check if the browser is called "anything", * the OS called "anything" or the platform called "anything" * @param {String} anything * @param [includingAlias=false] The flag showing whether alias will be included into comparison * @returns {Boolean} */ is(e, n = !1) { return this.isBrowser(e, n) || this.isOS(e) || this.isPlatform(e); } /** * Check if any of the given values satisfies this.is(anything) * @param {String[]} anythings * @returns {Boolean} */ some(e = []) { return e.some((n) => this.is(n)); } }; /*! * Bowser - a browser detector * https://github.com/lancedikson/bowser * MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Denis Demchenko 2015-2019 */ class zF { /** * Creates a {@link Parser} instance * * @param {String} UA UserAgent string * @param {Boolean} [skipParsing=false] Will make the Parser postpone parsing until you ask it * explicitly. Same as `skipParsing` for {@link Parser}. * @returns {Parser} * @throws {Error} when UA is not a String * * @example * const parser = Bowser.getParser(window.navigator.userAgent); * const result = parser.getResult(); */ static getParser(e, n = !1) { if (typeof e != "string") throw new Error("UserAgent should be a string"); return new Eb(e, n); } /** * Creates a {@link Parser} instance and runs {@link Parser.getResult} immediately * * @param UA * @return {ParsedResult} * * @example * const result = Bowser.parse(window.navigator.userAgent); */ static parse(e) { return new Eb(e).getResult(); } static get BROWSER_MAP() { return dC; } static get ENGINE_MAP() { return ws; } static get OS_MAP() { return ur; } static get PLATFORMS_MAP() { return An; } } var qF = function(t) { var e = t.serviceId, n = t.clientVersion; return function() { return sn(void 0, void 0, void 0, function() { var r, i, o, u, l, f, d, p, v; return tn(this, function(y) { return r = !((o = window?.navigator) === null || o === void 0) && o.userAgent ? zF.parse(window.navigator.userAgent) : void 0, i = [ // sdk-metadata ["aws-sdk-js", n], // os-metadata ["os/" + (((u = r?.os) === null || u === void 0 ? void 0 : u.name) || "other"), (l = r?.os) === null || l === void 0 ? void 0 : l.version], // language-metadata // ECMAScript edition doesn't matter in JS. ["lang/js"], // browser vendor and version. ["md/browser", ((d = (f = r?.browser) === null || f === void 0 ? void 0 : f.name) !== null && d !== void 0 ? d : "unknown") + "_" + ((v = (p = r?.browser) === null || p === void 0 ? void 0 : p.version) !== null && v !== void 0 ? v : "unknown")] ], e && i.push(["api/" + e, n]), [2, i]; }); }); }; }; function HF(t) { var e, n, r = {}; if (t = t.replace(/^\?/, ""), t) try { for (var i = Tr(t.split("&")), o = i.next(); !o.done; o = i.next()) { var u = o.value, l = Cl(u.split("="), 2), f = l[0], d = l[1], p = d === void 0 ? null : d; f = decodeURIComponent(f), p && (p = decodeURIComponent(p)), f in r ? Array.isArray(r[f]) ? r[f].push(p) : r[f] = [r[f], p] : r[f] = p; } } catch (v) { e = { error: v }; } finally { try { o && !o.done && (n = i.return) && n.call(i); } finally { if (e) throw e.error; } } return r; } var KF = function(t) { var e = new URL(t), n = e.hostname, r = e.pathname, i = e.port, o = e.protocol, u = e.search, l; return u && (l = HF(u)), { hostname: n, port: i ? parseInt(i) : void 0, protocol: o, path: r, query: l }; }, GF = function(t) { var e; return Tt(Tt({}, t), { tls: (e = t.tls) !== null && e !== void 0 ? e : !0, endpoint: t.endpoint ? WF(t) : function() { return YF(t); }, isCustomEndpoint: !!t.endpoint }); }, WF = function(t) { var e = t.endpoint, n = t.urlParser; if (typeof e == "string") { var r = Promise.resolve(n(e)); return function() { return r; }; } else if (typeof e == "object") { var i = Promise.resolve(e); return function() { return i; }; } return e; }, YF = function(t) { return sn(void 0, void 0, void 0, function() { var e, n, r, i, o, u; return tn(this, function(l) { switch (l.label) { case 0: return e = t.tls, n = e === void 0 ? !0 : e, [4, t.region()]; case 1: if (r = l.sent(), i = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/), !i.test(r)) throw new Error("Invalid region in client config"); return [4, t.regionInfoProvider(r)]; case 2: if (o = ((u = l.sent()) !== null && u !== void 0 ? u : {}).hostname, !o) throw new Error("Cannot resolve hostname from client config"); return [2, t.urlParser((n ? "https:" : "http:") + "//" + o)]; } }); }); }, QF = function(t) { if (!t.region) throw new Error("Region is missing"); return Tt(Tt({}, t), { region: JF(t.region) }); }, JF = function(t) { if (typeof t == "string") { var e = Promise.resolve(t); return function() { return e; }; } return t; }, Ab = "content-length"; function XF(t) { var e = this; return function(n) { return function(r) { return sn(e, void 0, void 0, function() { var i, o, u, l, f; return tn(this, function(d) { return i = r.request, ml.isInstance(i) && (o = i.body, u = i.headers, o && Object.keys(u).map(function(p) { return p.toLowerCase(); }).indexOf(Ab) === -1 && (l = t(o), l !== void 0 && (i.headers = Tt(Tt({}, i.headers), (f = {}, f[Ab] = String(l), f))))), [2, n(Tt(Tt({}, r), { request: i }))]; }); }); }; }; } var ZF = { step: "build", tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"], name: "contentLengthMiddleware", override: !0 }, e2 = function(t) { return { applyToStack: function(e) { e.add(XF(t.bodyLengthChecker), ZF); } }; }; var t2 = function(t) { return function(e) { return function(n) { return sn(void 0, void 0, void 0, function() { var r, i, o; return tn(this, function(u) { return ml.isInstance(n.request) ? (r = n.request, i = (t.requestHandler.metadata || {}).handlerProtocol, o = i === void 0 ? "" : i, o.indexOf("h2") >= 0 && !r.headers[":authority"] ? (delete r.headers.host, r.headers[":authority"] = "") : r.headers.host || (r.headers.host = r.hostname), [2, e(n)]) : [2, e(n)]; }); }); }; }; }, n2 = { name: "hostHeaderMiddleware", step: "build", priority: "low", tags: ["HOST"], override: !0 }, r2 = function(t) { return { applyToStack: function(e) { e.add(t2(t), n2); } }; }, i2 = function() { return function(t, e) { return function(n) { return sn(void 0, void 0, void 0, function() { var r, i, o, u, l, f, d, p, v; return tn(this, function(y) { switch (y.label) { case 0: return r = e.clientName, i = e.commandName, o = e.inputFilterSensitiveLog, u = e.logger, l = e.outputFilterSensitiveLog, [4, t(n)]; case 1: return f = y.sent(), u ? (typeof u.info == "function" && (d = f.output, p = d.$metadata, v = b0(d, ["$metadata"]), u.info({ clientName: r, commandName: i, input: o(n.input), output: l(v), metadata: p })), [2, f]) : [2, f]; } }); }); }; }; }, o2 = { name: "loggerMiddleware", tags: ["LOGGER"], step: "initialize", override: !0 }, s2 = function(t) { return { applyToStack: function(e) { e.add(i2(), o2); } }; }, a2 = "X-Amz-Algorithm", u2 = "X-Amz-Credential", fC = "X-Amz-Date", l2 = "X-Amz-SignedHeaders", c2 = "X-Amz-Expires", hC = "X-Amz-Signature", pC = "X-Amz-Security-Token", mC = "authorization", gC = fC.toLowerCase(), d2 = "date", f2 = [mC, gC, d2], h2 = hC.toLowerCase(), fy = "x-amz-content-sha256", p2 = pC.toLowerCase(), m2 = { authorization: !0, "cache-control": !0, connection: !0, expect: !0, from: !0, "keep-alive": !0, "max-forwards": !0, pragma: !0, referer: !0, te: !0, trailer: !0, "transfer-encoding": !0, upgrade: !0, "user-agent": !0, "x-amzn-trace-id": !0 }, g2 = /^proxy-/, v2 = /^sec-/, av = "AWS4-HMAC-SHA256", y2 = "AWS4-HMAC-SHA256-PAYLOAD", w2 = "UNSIGNED-PAYLOAD", S2 = 50, vC = "aws4_request", _2 = 60 * 60 * 24 * 7, th = {}, uv = []; function lv(t, e, n) { return t + "/" + e + "/" + n + "/" + vC; } var b2 = function(t, e, n, r, i) { return sn(void 0, void 0, void 0, function() { var o, u, l, f, d, p, v, y, k; return tn(this, function(A) { switch (A.label) { case 0: return [4, Cb(t, e.secretAccessKey, e.accessKeyId)]; case 1: if (o = A.sent(), u = n + ":" + r + ":" + i + ":" + il(o) + ":" + e.sessionToken, u in th) return [2, th[u]]; for (uv.push(u); uv.length > S2; ) delete th[uv.shift()]; l = "AWS4" + e.secretAccessKey, A.label = 2; case 2: A.trys.push([2, 7, 8, 9]), f = Tr([n, r, i, vC]), d = f.next(), A.label = 3; case 3: return d.done ? [3, 6] : (p = d.value, [4, Cb(t, l, p)]); case 4: l = A.sent(), A.label = 5; case 5: return d = f.next(), [3, 3]; case 6: return [3, 9]; case 7: return v = A.sent(), y = { error: v }, [3, 9]; case 8: try { d && !d.done && (k = f.return) && k.call(f); } finally { if (y) throw y.error; } return [ 7 /*endfinally*/ ]; case 9: return [2, th[u] = l]; } }); }); }; function Cb(t, e, n) { var r = new t(e); return r.update(n), r.digest(); } function xb(t, e, n) { var r, i, o = t.headers, u = {}; try { for (var l = Tr(Object.keys(o).sort()), f = l.next(); !f.done; f = l.next()) { var d = f.value, p = d.toLowerCase(); (p in m2 || e?.has(p) || g2.test(p) || v2.test(p)) && (!n || n && !n.has(p)) || (u[p] = o[d].trim().replace(/\s+/g, " ")); } } catch (v) { r = { error: v }; } finally { try { f && !f.done && (i = l.return) && i.call(l); } finally { if (r) throw r.error; } } return u; } function k2(t) { var e, n, r = t.query, i = r === void 0 ? {} : r, o = [], u = {}, l = function(v) { if (v.toLowerCase() === h2) return "continue"; o.push(v); var y = i[v]; typeof y == "string" ? u[v] = La(v) + "=" + La(y) : Array.isArray(y) && (u[v] = y.slice(0).sort().reduce(function(k, A) { return k.concat([La(v) + "=" + La(A)]); }, []).join("&")); }; try { for (var f = Tr(Object.keys(i).sort()), d = f.next(); !d.done; d = f.next()) { var p = d.value; l(p); } } catch (v) { e = { error: v }; } finally { try { d && !d.done && (n = f.return) && n.call(f); } finally { if (e) throw e.error; } } return o.map(function(v) { return u[v]; }).filter(function(v) { return v; }).join("&"); } var E2 = function(t) { return typeof ArrayBuffer == "function" && t instanceof ArrayBuffer || Object.prototype.toString.call(t) === "[object ArrayBuffer]"; }; function cv(t, e) { var n = t.headers, r = t.body; return sn(this, void 0, void 0, function() { var i, o, u, l, f, d, p; return tn(this, function(v) { switch (v.label) { case 0: try { for (i = Tr(Object.keys(n)), o = i.next(); !o.done; o = i.next()) if (u = o.value, u.toLowerCase() === fy) return [2, n[u]]; } catch (y) { d = { error: y }; } finally { try { o && !o.done && (p = i.return) && p.call(i); } finally { if (d) throw d.error; } } return r != null ? [3, 1] : [2, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"]; case 1: return typeof r == "string" || ArrayBuffer.isView(r) || E2(r) ? (l = new e(), l.update(r), f = il, [4, l.digest()]) : [3, 3]; case 2: return [2, f.apply(void 0, [v.sent()])]; case 3: return [2, w2]; } }); }); } function A2(t, e) { var n, r; t = t.toLowerCase(); try { for (var i = Tr(Object.keys(e)), o = i.next(); !o.done; o = i.next()) { var u = o.value; if (t === u.toLowerCase()) return !0; } } catch (l) { n = { error: l }; } finally { try { o && !o.done && (r = i.return) && r.call(i); } finally { if (n) throw n.error; } } return !1; } function yC(t) { var e = t.headers, n = t.query, r = b0(t, ["headers", "query"]); return Tt(Tt({}, r), { headers: Tt({}, e), query: n ? C2(n) : void 0 }); } function C2(t) { return Object.keys(t).reduce(function(e, n) { var r, i = t[n]; return Tt(Tt({}, e), (r = {}, r[n] = Array.isArray(i) ? io(i) : i, r)); }, {}); } function x2(t, e) { var n, r, i; e === void 0 && (e = {}); var o = typeof t.clone == "function" ? t.clone() : yC(t), u = o.headers, l = o.query, f = l === void 0 ? {} : l; try { for (var d = Tr(Object.keys(u)), p = d.next(); !p.done; p = d.next()) { var v = p.value, y = v.toLowerCase(); y.substr(0, 6) === "x-amz-" && !(!((i = e.unhoistableHeaders) === null || i === void 0) && i.has(y)) && (f[v] = u[v], delete u[v]); } } catch (k) { n = { error: k }; } finally { try { p && !p.done && (r = d.return) && r.call(d); } finally { if (n) throw n.error; } } return Tt(Tt({}, t), { headers: u, query: f }); } function Nb(t) { var e, n; t = typeof t.clone == "function" ? t.clone() : yC(t); try { for (var r = Tr(Object.keys(t.headers)), i = r.next(); !i.done; i = r.next()) { var o = i.value; f2.indexOf(o.toLowerCase()) > -1 && delete t.headers[o]; } } catch (u) { e = { error: u }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (e) throw e.error; } } return t; } function N2(t) { return T2(t).toISOString().replace(/\.\d{3}Z$/, "Z"); } function T2(t) { return typeof t == "number" ? new Date(t * 1e3) : typeof t == "string" ? Number(t) ? new Date(Number(t) * 1e3) : new Date(t) : t; } var I2 = ( /** @class */ function() { function t(e) { var n = e.applyChecksum, r = e.credentials, i = e.region, o = e.service, u = e.sha256, l = e.uriEscapePath, f = l === void 0 ? !0 : l; this.service = o, this.sha256 = u, this.uriEscapePath = f, this.applyChecksum = typeof n == "boolean" ? n : !0, this.regionProvider = R2(i), this.credentialProvider = O2(r); } return t.prototype.presign = function(e, n) { return n === void 0 && (n = {}), sn(this, void 0, void 0, function() { var r, i, o, u, l, f, d, p, v, y, k, A, E, T, D, R, L, j, K, ue, de, H, ve, Z; return tn(this, function(we) { switch (we.label) { case 0: return r = n.signingDate, i = r === void 0 ? /* @__PURE__ */ new Date() : r, o = n.expiresIn, u = o === void 0 ? 3600 : o, l = n.unsignableHeaders, f = n.unhoistableHeaders, d = n.signableHeaders, p = n.signingRegion, v = n.signingService, [4, this.credentialProvider()]; case 1: return y = we.sent(), p == null ? [3, 2] : (A = p, [3, 4]); case 2: return [4, this.regionProvider()]; case 3: A = we.sent(), we.label = 4; case 4: return k = A, E = nh(i), T = E.longDate, D = E.shortDate, u > _2 ? [2, Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")] : (R = lv(D, k, v ?? this.service), L = x2(Nb(e), { unhoistableHeaders: f }), y.sessionToken && (L.query[pC] = y.sessionToken), L.query[a2] = av, L.query[u2] = y.accessKeyId + "/" + R, L.query[fC] = T, L.query[c2] = u.toString(10), j = xb(L, l, d), L.query[l2] = Tb(j), K = L.query, ue = hC, de = this.getSignature, H = [ T, R, this.getSigningKey(y, k, D, v) ], ve = this.createCanonicalRequest, Z = [L, j], [4, cv(e, this.sha256)]); case 5: return [4, de.apply(this, H.concat([ve.apply(this, Z.concat([we.sent()]))]))]; case 6: return K[ue] = we.sent(), [2, L]; } }); }); }, t.prototype.sign = function(e, n) { return sn(this, void 0, void 0, function() { return tn(this, function(r) { return typeof e == "string" ? [2, this.signString(e, n)] : e.headers && e.payload ? [2, this.signEvent(e, n)] : [2, this.signRequest(e, n)]; }); }); }, t.prototype.signEvent = function(e, n) { var r = e.headers, i = e.payload, o = n.signingDate, u = o === void 0 ? /* @__PURE__ */ new Date() : o, l = n.priorSignature, f = n.signingRegion, d = n.signingService; return sn(this, void 0, void 0, function() { var p, v, y, k, A, E, T, D, R, L, j; return tn(this, function(K) { switch (K.label) { case 0: return f == null ? [3, 1] : (v = f, [3, 3]); case 1: return [4, this.regionProvider()]; case 2: v = K.sent(), K.label = 3; case 3: return p = v, y = nh(u), k = y.shortDate, A = y.longDate, E = lv(k, p, d ?? this.service), [4, cv({ headers: {}, body: i }, this.sha256)]; case 4: return T = K.sent(), D = new this.sha256(), D.update(r), L = il, [4, D.digest()]; case 5: return R = L.apply(void 0, [K.sent()]), j = [ y2, A, E, l, R, T ].join(` `), [2, this.signString(j, { signingDate: u, signingRegion: p, signingService: d })]; } }); }); }, t.prototype.signString = function(e, n) { var r = n === void 0 ? {} : n, i = r.signingDate, o = i === void 0 ? /* @__PURE__ */ new Date() : i, u = r.signingRegion, l = r.signingService; return sn(this, void 0, void 0, function() { var f, d, p, v, y, k, A, E; return tn(this, function(T) { switch (T.label) { case 0: return [4, this.credentialProvider()]; case 1: return f = T.sent(), u == null ? [3, 2] : (p = u, [3, 4]); case 2: return [4, this.regionProvider()]; case 3: p = T.sent(), T.label = 4; case 4: return d = p, v = nh(o).shortDate, A = (k = this.sha256).bind, [4, this.getSigningKey(f, d, v, l)]; case 5: return y = new (A.apply(k, [void 0, T.sent()]))(), y.update(e), E = il, [4, y.digest()]; case 6: return [2, E.apply(void 0, [T.sent()])]; } }); }); }, t.prototype.signRequest = function(e, n) { var r = n === void 0 ? {} : n, i = r.signingDate, o = i === void 0 ? /* @__PURE__ */ new Date() : i, u = r.signableHeaders, l = r.unsignableHeaders, f = r.signingRegion, d = r.signingService; return sn(this, void 0, void 0, function() { var p, v, y, k, A, E, T, D, R, L, j; return tn(this, function(K) { switch (K.label) { case 0: return [4, this.credentialProvider()]; case 1: return p = K.sent(), f == null ? [3, 2] : (y = f, [3, 4]); case 2: return [4, this.regionProvider()]; case 3: y = K.sent(), K.label = 4; case 4: return v = y, k = Nb(e), A = nh(o), E = A.longDate, T = A.shortDate, D = lv(T, v, d ?? this.service), k.headers[gC] = E, p.sessionToken && (k.headers[p2] = p.sessionToken), [4, cv(k, this.sha256)]; case 5: return R = K.sent(), !A2(fy, k.headers) && this.applyChecksum && (k.headers[fy] = R), L = xb(k, l, u), [4, this.getSignature(E, D, this.getSigningKey(p, v, T, d), this.createCanonicalRequest(k, L, R))]; case 6: return j = K.sent(), k.headers[mC] = av + " " + ("Credential=" + p.accessKeyId + "/" + D + ", ") + ("SignedHeaders=" + Tb(L) + ", ") + ("Signature=" + j), [2, k]; } }); }); }, t.prototype.createCanonicalRequest = function(e, n, r) { var i = Object.keys(n).sort(); return e.method + ` ` + this.getCanonicalPath(e) + ` ` + k2(e) + ` ` + i.map(function(o) { return o + ":" + n[o]; }).join(` `) + ` ` + i.join(";") + ` ` + r; }, t.prototype.createStringToSign = function(e, n, r) { return sn(this, void 0, void 0, function() { var i, o; return tn(this, function(u) { switch (u.label) { case 0: return i = new this.sha256(), i.update(r), [4, i.digest()]; case 1: return o = u.sent(), [2, av + ` ` + e + ` ` + n + ` ` + il(o)]; } }); }); }, t.prototype.getCanonicalPath = function(e) { var n = e.path; if (this.uriEscapePath) { var r = encodeURIComponent(n.replace(/^\//, "")); return "/" + r.replace(/%2F/g, "/"); } return n; }, t.prototype.getSignature = function(e, n, r, i) { return sn(this, void 0, void 0, function() { var o, u, l, f, d; return tn(this, function(p) { switch (p.label) { case 0: return [4, this.createStringToSign(e, n, i)]; case 1: return o = p.sent(), f = (l = this.sha256).bind, [4, r]; case 2: return u = new (f.apply(l, [void 0, p.sent()]))(), u.update(o), d = il, [4, u.digest()]; case 3: return [2, d.apply(void 0, [p.sent()])]; } }); }); }, t.prototype.getSigningKey = function(e, n, r, i) { return b2(this.sha256, e, r, n, i || this.service); }, t; }() ), nh = function(t) { var e = N2(t).replace(/[\-:]/g, ""); return { longDate: e, shortDate: e.substr(0, 8) }; }, Tb = function(t) { return Object.keys(t).sort().join(";"); }, R2 = function(t) { if (typeof t == "string") { var e = Promise.resolve(t); return function() { return e; }; } else return t; }, O2 = function(t) { if (typeof t == "object") { var e = Promise.resolve(t); return function() { return e; }; } else return t; }; function P2(t) { var e = this, n = t.credentials || t.credentialDefaultProvider(t), r = dv(n), i = t.signingEscapePath, o = i === void 0 ? !0 : i, u = t.systemClockOffset, l = u === void 0 ? t.systemClockOffset || 0 : u, f = t.sha256, d; return t.signer ? d = dv(t.signer) : d = function() { return dv(t.region)().then(function(p) { return sn(e, void 0, void 0, function() { return tn(this, function(v) { switch (v.label) { case 0: return [4, t.regionInfoProvider(p)]; case 1: return [2, [v.sent() || {}, p]]; } }); }); }).then(function(p) { var v = Cl(p, 2), y = v[0], k = v[1], A = y.signingRegion, E = y.signingService; return t.signingRegion = t.signingRegion || A || k, t.signingName = t.signingName || E || t.serviceId, new I2({ credentials: r, region: t.signingRegion, service: t.signingName, sha256: f, uriEscapePath: o }); }); }, Tt(Tt({}, t), { systemClockOffset: l, signingEscapePath: o, credentials: r, signer: d }); } function dv(t) { if (typeof t == "object") { var e = Promise.resolve(t); return function() { return e; }; } return t; } function D2(t) { return Tt(Tt({}, t), { customUserAgent: typeof t.customUserAgent == "string" ? [[t.customUserAgent]] : t.customUserAgent }); } var fv = "user-agent", F2 = "x-amz-user-agent", Ib = " ", L2 = /[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g, U2 = function(t) { return function(e, n) { return function(r) { return sn(void 0, void 0, void 0, function() { var i, o, u, l, f, d, p, v; return tn(this, function(y) { switch (y.label) { case 0: return i = r.request, ml.isInstance(i) ? (o = i.headers, u = ((p = n?.userAgent) === null || p === void 0 ? void 0 : p.map(hv)) || [], [4, t.defaultUserAgentProvider()]) : [2, e(r)]; case 1: return l = y.sent().map(hv), f = ((v = t?.customUserAgent) === null || v === void 0 ? void 0 : v.map(hv)) || [], o[F2] = io(l, u, f).join(Ib), d = io(l.filter(function(k) { return k.startsWith("aws-sdk-"); }), f).join(Ib), t.runtime !== "browser" && d && (o[fv] = o[fv] ? o[fv] + " " + d : d), [2, e(Tt(Tt({}, r), { request: i }))]; } }); }); }; }; }, hv = function(t) { var e = Cl(t, 2), n = e[0], r = e[1], i = n.indexOf("/"), o = n.substring(0, i), u = n.substring(i + 1); return o === "api" && (u = u.toLowerCase()), [o, u, r].filter(function(l) { return l && l.length > 0; }).map(function(l) { return l?.replace(L2, "_"); }).join("/"); }, M2 = { name: "getUserAgentMiddleware", step: "build", priority: "low", tags: ["SET_USER_AGENT", "USER_AGENT"], override: !0 }, B2 = function(t) { return { applyToStack: function(e) { e.add(U2(t), M2); } }; }, Hh = function() { var t = [], e = [], n = /* @__PURE__ */ new Set(), r = function(p) { return p.sort(function(v, y) { return Rb[y.step] - Rb[v.step] || Ob[y.priority || "normal"] - Ob[v.priority || "normal"]; }); }, i = function(p) { var v = !1, y = function(k) { return k.name && k.name === p ? (v = !0, n.delete(p), !1) : !0; }; return t = t.filter(y), e = e.filter(y), v; }, o = function(p) { var v = !1, y = function(k) { return k.middleware === p ? (v = !0, k.name && n.delete(k.name), !1) : !0; }; return t = t.filter(y), e = e.filter(y), v; }, u = function(p) { return t.forEach(function(v) { p.add(v.middleware, Tt({}, v)); }), e.forEach(function(v) { p.addRelativeTo(v.middleware, Tt({}, v)); }), p; }, l = function(p) { var v = []; return p.before.forEach(function(y) { y.before.length === 0 && y.after.length === 0 ? v.push(y) : v.push.apply(v, io(l(y))); }), v.push(p), p.after.reverse().forEach(function(y) { y.before.length === 0 && y.after.length === 0 ? v.push(y) : v.push.apply(v, io(l(y))); }), v; }, f = function() { var p = [], v = [], y = {}; t.forEach(function(A) { var E = Tt(Tt({}, A), { before: [], after: [] }); E.name && (y[E.name] = E), p.push(E); }), e.forEach(function(A) { var E = Tt(Tt({}, A), { before: [], after: [] }); E.name && (y[E.name] = E), v.push(E); }), v.forEach(function(A) { if (A.toMiddleware) { var E = y[A.toMiddleware]; if (E === void 0) throw new Error(A.toMiddleware + " is not found when adding " + (A.name || "anonymous") + " middleware " + A.relation + " " + A.toMiddleware); A.relation === "after" && E.after.push(A), A.relation === "before" && E.before.push(A); } }); var k = r(p).map(l).reduce(function(A, E) { return A.push.apply(A, io(E)), A; }, []); return k.map(function(A) { return A.middleware; }); }, d = { add: function(p, v) { v === void 0 && (v = {}); var y = v.name, k = v.override, A = Tt({ step: "initialize", priority: "normal", middleware: p }, v); if (y) { if (n.has(y)) { if (!k) throw new Error("Duplicate middleware name '" + y + "'"); var E = t.findIndex(function(D) { return D.name === y; }), T = t[E]; if (T.step !== A.step || T.priority !== A.priority) throw new Error('"' + y + '" middleware with ' + T.priority + " priority in " + T.step + " step cannot be " + ("overridden by same-name middleware with " + A.priority + " priority in " + A.step + " step.")); t.splice(E, 1); } n.add(y); } t.push(A); }, addRelativeTo: function(p, v) { var y = v.name, k = v.override, A = Tt({ middleware: p }, v); if (y) { if (n.has(y)) { if (!k) throw new Error("Duplicate middleware name '" + y + "'"); var E = e.findIndex(function(D) { return D.name === y; }), T = e[E]; if (T.toMiddleware !== A.toMiddleware || T.relation !== A.relation) throw new Error('"' + y + '" middleware ' + T.relation + ' "' + T.toMiddleware + '" middleware cannot be overridden ' + ("by same-name middleware " + A.relation + ' "' + A.toMiddleware + '" middleware.')); e.splice(E, 1); } n.add(y); } e.push(A); }, clone: function() { return u(Hh()); }, use: function(p) { p.applyToStack(d); }, remove: function(p) { return typeof p == "string" ? i(p) : o(p); }, removeByTag: function(p) { var v = !1, y = function(k) { var A = k.tags, E = k.name; return A && A.includes(p) ? (E && n.delete(E), v = !0, !1) : !0; }; return t = t.filter(y), e = e.filter(y), v; }, concat: function(p) { var v = u(Hh()); return v.use(p), v; }, applyToStack: u, resolve: function(p, v) { var y, k; try { for (var A = Tr(f().reverse()), E = A.next(); !E.done; E = A.next()) { var T = E.value; p = T(p, v); } } catch (D) { y = { error: D }; } finally { try { E && !E.done && (k = A.return) && k.call(A); } finally { if (y) throw y.error; } } return p; } }; return d; }, Rb = { initialize: 5, serialize: 4, build: 3, finalizeRequest: 2, deserialize: 1 }, Ob = { high: 3, normal: 2, low: 1 }, j2 = ( /** @class */ function() { function t(e) { this.middlewareStack = Hh(), this.config = e; } return t.prototype.send = function(e, n, r) { var i = typeof n != "function" ? n : void 0, o = typeof n == "function" ? n : r, u = e.resolveMiddleware(this.middlewareStack, this.config, i); if (o) u(e).then(function(l) { return o(null, l.output); }, function(l) { return o(l); }).catch( // prevent any errors thrown in the callback from triggering an // unhandled promise rejection function() { } ); else return u(e).then(function(l) { return l.output; }); }, t.prototype.destroy = function() { this.config.requestHandler.destroy && this.config.requestHandler.destroy(); }, t; }() ), wC = ( /** @class */ /* @__PURE__ */ function() { function t() { this.middlewareStack = Hh(); } return t; }() ), Kh = function() { var t = Object.getPrototypeOf(this).constructor, e = Function.bind.apply(String, io([null], arguments)), n = new e(); return Object.setPrototypeOf(n, t.prototype), n; }; Kh.prototype = Object.create(String.prototype, { constructor: { value: Kh, enumerable: !1, writable: !0, configurable: !0 } }); Object.setPrototypeOf(Kh, String); (function(t) { _0(e, t); function e() { return t !== null && t.apply(this, arguments) || this; } return e.prototype.deserializeJSON = function() { return JSON.parse(t.prototype.toString.call(this)); }, e.prototype.toJSON = function() { return t.prototype.toString.call(this); }, e.fromObject = function(n) { return n instanceof e ? n : n instanceof String || typeof n == "string" ? new e(n) : new e(JSON.stringify(n)); }, e; })(Kh); var $2 = function(t, e) { return function(n, r) { return function(i) { return sn(void 0, void 0, void 0, function() { var o, u; return tn(this, function(l) { switch (l.label) { case 0: return [4, n(i)]; case 1: return o = l.sent().response, [4, e(o, t)]; case 2: return u = l.sent(), [2, { response: o, output: u }]; } }); }); }; }; }, V2 = function(t, e) { return function(n, r) { return function(i) { return sn(void 0, void 0, void 0, function() { var o; return tn(this, function(u) { switch (u.label) { case 0: return [4, e(i.input, t)]; case 1: return o = u.sent(), [2, n(Tt(Tt({}, i), { request: o }))]; } }); }); }; }; }, z2 = { name: "deserializerMiddleware", step: "deserialize", tags: ["DESERIALIZER"], override: !0 }, q2 = { name: "serializerMiddleware", step: "serialize", tags: ["SERIALIZER"], override: !0 }; function SC(t, e, n) { return { applyToStack: function(r) { r.add($2(t, n), z2), r.add(V2(t, e), q2); } }; } var H2 = function(t, e, n, r) { function i(o) { return o instanceof n ? o : new n(function(u) { u(o); }); } return new (n || (n = Promise))(function(o, u) { function l(p) { try { d(r.next(p)); } catch (v) { u(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { u(v); } } function d(p) { p.done ? o(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, K2 = function(t, e) { var n = { label: 0, sent: function() { if (o[0] & 1) throw o[1]; return o[1]; }, trys: [], ops: [] }, r, i, o, u; return u = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() { return this; }), u; function l(d) { return function(p) { return f([d, p]); }; } function f(d) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (o = d[0] & 2 ? i.return : d[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, d[1])).done) return o; switch (i = 0, o && (d = [d[0] & 2, o.value]), d[0]) { case 0: case 1: o = d; break; case 4: return n.label++, { value: d[1], done: !1 }; case 5: n.label++, i = d[1], d = [0]; continue; case 7: d = n.ops.pop(), n.trys.pop(); continue; default: if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!o || d[1] > o[0] && d[1] < o[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < o[1]) { n.label = o[1], o = d; break; } if (o && n.label < o[2]) { n.label = o[2], n.ops.push(d); break; } o[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = o = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, ks = new Pi("CognitoCredentials"), G2 = new Promise(function(t, e) { if (!jo().isBrowser) return ks.debug("not in the browser, directly resolved"), t(); var n = window.gapi && window.gapi.auth2 ? window.gapi.auth2 : null; if (n) return ks.debug("google api already loaded"), t(); setTimeout(function() { return t(); }, 2e3); }), W2 = ( /** @class */ function() { function t() { this.initialized = !1, this.refreshGoogleToken = this.refreshGoogleToken.bind(this), this._refreshGoogleTokenImpl = this._refreshGoogleTokenImpl.bind(this); } return t.prototype.refreshGoogleToken = function() { return H2(this, void 0, void 0, function() { return K2(this, function(e) { switch (e.label) { case 0: return this.initialized ? [3, 2] : (ks.debug("need to wait for the Google SDK loaded"), [4, G2]); case 1: e.sent(), this.initialized = !0, ks.debug("finish waiting"), e.label = 2; case 2: return [2, this._refreshGoogleTokenImpl()]; } }); }); }, t.prototype._refreshGoogleTokenImpl = function() { var e = null; return jo().isBrowser && (e = window.gapi && window.gapi.auth2 ? window.gapi.auth2 : null), e ? new Promise(function(n, r) { e.getAuthInstance().then(function(i) { i || (ks.debug("google Auth undefined"), r(new Fa("google Auth undefined"))); var o = i.currentUser.get(); o.isSignedIn() ? (ks.debug("refreshing the google access token"), o.reloadAuthResponse().then(function(u) { var l = u.id_token, f = u.expires_at; n({ token: l, expires_at: f }); }).catch(function(u) { u && u.error === "network_error" ? r("Network error reloading google auth response") : r(new Fa("Failed to reload google auth response")); })) : r(new Fa("User is not signed in with Google")); }).catch(function(i) { ks.debug("Failed to refresh google token", i), r(new Fa("Failed to refresh google token")); }); }) : (ks.debug("no gapi auth2 available"), Promise.reject("no gapi auth2 available")); }, t; }() ), Y2 = function(t, e, n, r) { function i(o) { return o instanceof n ? o : new n(function(u) { u(o); }); } return new (n || (n = Promise))(function(o, u) { function l(p) { try { d(r.next(p)); } catch (v) { u(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { u(v); } } function d(p) { p.done ? o(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, Q2 = function(t, e) { var n = { label: 0, sent: function() { if (o[0] & 1) throw o[1]; return o[1]; }, trys: [], ops: [] }, r, i, o, u; return u = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() { return this; }), u; function l(d) { return function(p) { return f([d, p]); }; } function f(d) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (o = d[0] & 2 ? i.return : d[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, d[1])).done) return o; switch (i = 0, o && (d = [d[0] & 2, o.value]), d[0]) { case 0: case 1: o = d; break; case 4: return n.label++, { value: d[1], done: !1 }; case 5: n.label++, i = d[1], d = [0]; continue; case 7: d = n.ops.pop(), n.trys.pop(); continue; default: if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!o || d[1] > o[0] && d[1] < o[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < o[1]) { n.label = o[1], o = d; break; } if (o && n.label < o[2]) { n.label = o[2], n.ops.push(d); break; } o[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = o = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, Ra = new Pi("CognitoCredentials"), J2 = new Promise(function(t, e) { if (!jo().isBrowser) return Ra.debug("not in the browser, directly resolved"), t(); var n = window.FB; if (n) return Ra.debug("FB SDK already loaded"), t(); setTimeout(function() { return t(); }, 2e3); }), X2 = ( /** @class */ function() { function t() { this.initialized = !1, this.refreshFacebookToken = this.refreshFacebookToken.bind(this), this._refreshFacebookTokenImpl = this._refreshFacebookTokenImpl.bind(this); } return t.prototype.refreshFacebookToken = function() { return Y2(this, void 0, void 0, function() { return Q2(this, function(e) { switch (e.label) { case 0: return this.initialized ? [3, 2] : (Ra.debug("need to wait for the Facebook SDK loaded"), [4, J2]); case 1: e.sent(), this.initialized = !0, Ra.debug("finish waiting"), e.label = 2; case 2: return [2, this._refreshFacebookTokenImpl()]; } }); }); }, t.prototype._refreshFacebookTokenImpl = function() { var e = null; if (jo().isBrowser && (e = window.FB), !e) { var n = "no fb sdk available"; return Ra.debug(n), Promise.reject(new Fa(n)); } return new Promise(function(r, i) { e.getLoginStatus(function(o) { if (!o || !o.authResponse) { var u = "no response from facebook when refreshing the jwt token"; Ra.debug(u), i(new Fa(u)); } else { var l = o.authResponse, f = l.accessToken, d = l.expiresIn, p = /* @__PURE__ */ new Date(), v = d * 1e3 + p.getTime(); if (!f) { var u = "the jwtToken is undefined"; Ra.debug(u), i(new Fa(u)); } r({ token: f, expires_at: v }); } }, { scope: "public_profile,email" }); }); }, t; }() ), Z2 = new W2(), eL = new X2(), ka = {}, tL = ( /** @class */ function() { function t() { } return t.setItem = function(e, n) { return ka[e] = n, ka[e]; }, t.getItem = function(e) { return Object.prototype.hasOwnProperty.call(ka, e) ? ka[e] : void 0; }, t.removeItem = function(e) { return delete ka[e]; }, t.clear = function() { return ka = {}, ka; }, t; }() ), _C = ( /** @class */ function() { function t() { try { this.storageWindow = window.localStorage, this.storageWindow.setItem("aws.amplify.test-ls", 1), this.storageWindow.removeItem("aws.amplify.test-ls"); } catch { this.storageWindow = tL; } } return t.prototype.getStorage = function() { return this.storageWindow; }, t; }() ); const nL = "3.6.1", rL = { version: nL }; var Pb = "cognito-identity.{region}.amazonaws.com", iL = "cognito-identity.{region}.amazonaws.com.cn", oL = "cognito-identity.{region}.c2s.ic.gov", sL = "cognito-identity.{region}.sc2s.sgov.gov", aL = "cognito-identity.{region}.amazonaws.com", uL = /* @__PURE__ */ new Set([ "af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-north-1", "eu-south-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2" ]), lL = /* @__PURE__ */ new Set(["cn-north-1", "cn-northwest-1"]), cL = /* @__PURE__ */ new Set(["us-iso-east-1"]), dL = /* @__PURE__ */ new Set(["us-isob-east-1"]), fL = /* @__PURE__ */ new Set(["us-gov-east-1", "us-gov-west-1"]), hL = function(t, e) { var n = void 0; switch (t) { // First, try to match exact region names. case "ap-northeast-1": n = { hostname: "cognito-identity.ap-northeast-1.amazonaws.com", partition: "aws" }; break; case "ap-northeast-2": n = { hostname: "cognito-identity.ap-northeast-2.amazonaws.com", partition: "aws" }; break; case "ap-south-1": n = { hostname: "cognito-identity.ap-south-1.amazonaws.com", partition: "aws" }; break; case "ap-southeast-1": n = { hostname: "cognito-identity.ap-southeast-1.amazonaws.com", partition: "aws" }; break; case "ap-southeast-2": n = { hostname: "cognito-identity.ap-southeast-2.amazonaws.com", partition: "aws" }; break; case "ca-central-1": n = { hostname: "cognito-identity.ca-central-1.amazonaws.com", partition: "aws" }; break; case "cn-north-1": n = { hostname: "cognito-identity.cn-north-1.amazonaws.com.cn", partition: "aws-cn" }; break; case "eu-central-1": n = { hostname: "cognito-identity.eu-central-1.amazonaws.com", partition: "aws" }; break; case "eu-north-1": n = { hostname: "cognito-identity.eu-north-1.amazonaws.com", partition: "aws" }; break; case "eu-west-1": n = { hostname: "cognito-identity.eu-west-1.amazonaws.com", partition: "aws" }; break; case "eu-west-2": n = { hostname: "cognito-identity.eu-west-2.amazonaws.com", partition: "aws" }; break; case "eu-west-3": n = { hostname: "cognito-identity.eu-west-3.amazonaws.com", partition: "aws" }; break; case "fips-us-east-1": n = { hostname: "cognito-identity-fips.us-east-1.amazonaws.com", partition: "aws", signingRegion: "us-east-1" }; break; case "fips-us-east-2": n = { hostname: "cognito-identity-fips.us-east-2.amazonaws.com", partition: "aws", signingRegion: "us-east-2" }; break; case "fips-us-gov-west-1": n = { hostname: "cognito-identity-fips.us-gov-west-1.amazonaws.com", partition: "aws-us-gov", signingRegion: "us-gov-west-1" }; break; case "fips-us-west-2": n = { hostname: "cognito-identity-fips.us-west-2.amazonaws.com", partition: "aws", signingRegion: "us-west-2" }; break; case "sa-east-1": n = { hostname: "cognito-identity.sa-east-1.amazonaws.com", partition: "aws" }; break; case "us-east-1": n = { hostname: "cognito-identity.us-east-1.amazonaws.com", partition: "aws" }; break; case "us-east-2": n = { hostname: "cognito-identity.us-east-2.amazonaws.com", partition: "aws" }; break; case "us-gov-west-1": n = { hostname: "cognito-identity.us-gov-west-1.amazonaws.com", partition: "aws-us-gov" }; break; case "us-west-1": n = { hostname: "cognito-identity.us-west-1.amazonaws.com", partition: "aws" }; break; case "us-west-2": n = { hostname: "cognito-identity.us-west-2.amazonaws.com", partition: "aws" }; break; // Next, try to match partition endpoints. default: uL.has(t) && (n = { hostname: Pb.replace("{region}", t), partition: "aws" }), lL.has(t) && (n = { hostname: iL.replace("{region}", t), partition: "aws-cn" }), cL.has(t) && (n = { hostname: oL.replace("{region}", t), partition: "aws-iso" }), dL.has(t) && (n = { hostname: sL.replace("{region}", t), partition: "aws-iso-b" }), fL.has(t) && (n = { hostname: aL.replace("{region}", t), partition: "aws-us-gov" }), n === void 0 && (n = { hostname: Pb.replace("{region}", t), partition: "aws" }); } return Promise.resolve(Ce({ signingService: "cognito-identity" }, n)); }, Db = { apiVersion: "2014-06-30", disableHostPrefix: !1, logger: {}, regionInfoProvider: hL, serviceId: "Cognito Identity", urlParser: KF }, pL = Ce(Ce({}, Db), { runtime: "browser", base64Decoder: aC, base64Encoder: tF, bodyLengthChecker: UF, credentialDefaultProvider: function(t) { return function() { return Promise.reject(new Error("Credential is missing")); }; }, defaultUserAgentProvider: qF({ serviceId: Db.serviceId, clientVersion: rL.version }), maxAttempts: C0, region: sF("Region is missing"), requestHandler: new ZD(), sha256: WD.Sha256, streamCollector: nF, utf8Decoder: tC, utf8Encoder: nC }), mL = ( /** @class */ function(t) { k0(e, t); function e(n) { var r = this, i = Ce(Ce({}, pL), n), o = QF(i), u = GF(o), l = P2(u), f = FF(l), d = f, p = D2(d); return r = t.call(this, p) || this, r.config = p, r.middlewareStack.use(lF(r.config)), r.middlewareStack.use(e2(r.config)), r.middlewareStack.use(r2(r.config)), r.middlewareStack.use(s2(r.config)), r.middlewareStack.use(B2(r.config)), r; } return e.prototype.destroy = function() { t.prototype.destroy.call(this); }, e; }(j2) ), Fb; (function(t) { t.AUTHENTICATED_ROLE = "AuthenticatedRole", t.DENY = "Deny"; })(Fb || (Fb = {})); var Lb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Lb || (Lb = {})); var Ub; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Ub || (Ub = {})); var Mb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Mb || (Mb = {})); var Bb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Bb || (Bb = {})); var jb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(jb || (jb = {})); var $b; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })($b || ($b = {})); var Vb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Vb || (Vb = {})); var zb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(zb || (zb = {})); var qb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(qb || (qb = {})); var Hb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Hb || (Hb = {})); var Kb; (function(t) { t.ACCESS_DENIED = "AccessDenied", t.INTERNAL_SERVER_ERROR = "InternalServerError"; })(Kb || (Kb = {})); var Gb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Gb || (Gb = {})); var Wb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Wb || (Wb = {})); var Yb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Yb || (Yb = {})); var Qb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Qb || (Qb = {})); var Jb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Jb || (Jb = {})); var Xb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Xb || (Xb = {})); var Zb; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Zb || (Zb = {})); var ek; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(ek || (ek = {})); var hy; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(hy || (hy = {})); var tk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(tk || (tk = {})); var py; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(py || (py = {})); var nk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(nk || (nk = {})); var my; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(my || (my = {})); var gy; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(gy || (gy = {})); var rk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(rk || (rk = {})); var ik; (function(t) { t.CONTAINS = "Contains", t.EQUALS = "Equals", t.NOT_EQUAL = "NotEqual", t.STARTS_WITH = "StartsWith"; })(ik || (ik = {})); var ok; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(ok || (ok = {})); var sk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(sk || (sk = {})); var ak; (function(t) { t.RULES = "Rules", t.TOKEN = "Token"; })(ak || (ak = {})); var uk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(uk || (uk = {})); var lk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(lk || (lk = {})); var ck; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(ck || (ck = {})); var dk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(dk || (dk = {})); var fk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(fk || (fk = {})); var hk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(hk || (hk = {})); var pk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(pk || (pk = {})); var mk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(mk || (mk = {})); var gk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(gk || (gk = {})); var vk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(vk || (vk = {})); var yk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(yk || (yk = {})); var wk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(wk || (wk = {})); var Sk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Sk || (Sk = {})); var _k; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(_k || (_k = {})); var bk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(bk || (bk = {})); var kk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(kk || (kk = {})); var Ek; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Ek || (Ek = {})); var Ak; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Ak || (Ak = {})); var Ck; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Ck || (Ck = {})); var xk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(xk || (xk = {})); var Nk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Nk || (Nk = {})); var Tk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Tk || (Tk = {})); var Ik; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Ik || (Ik = {})); var Rk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Rk || (Rk = {})); var Ok; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Ok || (Ok = {})); var Pk; (function(t) { t.filterSensitiveLog = function(e) { return Ce({}, e); }; })(Pk || (Pk = {})); var gL = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r; return ir(this, function(i) { return n = { "content-type": "application/x-amz-json-1.1", "x-amz-target": "AWSCognitoIdentityService.GetCredentialsForIdentity" }, r = JSON.stringify(EL(t)), [2, IC(e, n, "/", void 0, r)]; }); }); }, vL = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r; return ir(this, function(i) { return n = { "content-type": "application/x-amz-json-1.1", "x-amz-target": "AWSCognitoIdentityService.GetId" }, r = JSON.stringify(AL(t)), [2, IC(e, n, "/", void 0, r)]; }); }); }, yL = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { switch (o.label) { case 0: return t.statusCode >= 300 ? [2, wL(t, e)] : [4, Cp(t.body, e)]; case 1: return n = o.sent(), r = {}, r = NL(n), i = Ce({ $metadata: Qt(t) }, r), [2, Promise.resolve(i)]; } }); }); }, wL = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i, o, u, l, f, d, p, v, y, k, A, E, T, D; return ir(this, function(R) { switch (R.label) { case 0: return r = [Ce({}, t)], D = {}, [4, Cp(t.body, e)]; case 1: switch (n = Ce.apply(void 0, r.concat([(D.body = R.sent(), D)])), o = "UnknownError", o = RC(t, n.body), u = o, u) { case "ExternalServiceException": return [3, 2]; case "com.amazonaws.cognitoidentity#ExternalServiceException": return [3, 2]; case "InternalErrorException": return [3, 4]; case "com.amazonaws.cognitoidentity#InternalErrorException": return [3, 4]; case "InvalidIdentityPoolConfigurationException": return [3, 6]; case "com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException": return [3, 6]; case "InvalidParameterException": return [3, 8]; case "com.amazonaws.cognitoidentity#InvalidParameterException": return [3, 8]; case "NotAuthorizedException": return [3, 10]; case "com.amazonaws.cognitoidentity#NotAuthorizedException": return [3, 10]; case "ResourceConflictException": return [3, 12]; case "com.amazonaws.cognitoidentity#ResourceConflictException": return [3, 12]; case "ResourceNotFoundException": return [3, 14]; case "com.amazonaws.cognitoidentity#ResourceNotFoundException": return [3, 14]; case "TooManyRequestsException": return [3, 16]; case "com.amazonaws.cognitoidentity#TooManyRequestsException": return [3, 16]; } return [3, 18]; case 2: return l = [{}], [4, bC(n)]; case 3: return i = Ce.apply(void 0, [Ce.apply(void 0, l.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 4: return f = [{}], [4, kC(n)]; case 5: return i = Ce.apply(void 0, [Ce.apply(void 0, f.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 6: return d = [{}], [4, bL(n)]; case 7: return i = Ce.apply(void 0, [Ce.apply(void 0, d.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 8: return p = [{}], [4, EC(n)]; case 9: return i = Ce.apply(void 0, [Ce.apply(void 0, p.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 10: return v = [{}], [4, AC(n)]; case 11: return i = Ce.apply(void 0, [Ce.apply(void 0, v.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 12: return y = [{}], [4, CC(n)]; case 13: return i = Ce.apply(void 0, [Ce.apply(void 0, y.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 14: return k = [{}], [4, xC(n)]; case 15: return i = Ce.apply(void 0, [Ce.apply(void 0, k.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 16: return A = [{}], [4, NC(n)]; case 17: return i = Ce.apply(void 0, [Ce.apply(void 0, A.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 18: E = n.body, o = E.code || E.Code || o, i = Ce(Ce({}, E), { name: "" + o, message: E.message || E.Message || o, $fault: "client", $metadata: Qt(t) }), R.label = 19; case 19: return T = i.message || i.Message || o, i.message = T, delete i.Message, [2, Promise.reject(Object.assign(new Error(T), i))]; } }); }); }, SL = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { switch (o.label) { case 0: return t.statusCode >= 300 ? [2, _L(t, e)] : [4, Cp(t.body, e)]; case 1: return n = o.sent(), r = {}, r = TL(n), i = Ce({ $metadata: Qt(t) }, r), [2, Promise.resolve(i)]; } }); }); }, _L = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i, o, u, l, f, d, p, v, y, k, A, E, T, D; return ir(this, function(R) { switch (R.label) { case 0: return r = [Ce({}, t)], D = {}, [4, Cp(t.body, e)]; case 1: switch (n = Ce.apply(void 0, r.concat([(D.body = R.sent(), D)])), o = "UnknownError", o = RC(t, n.body), u = o, u) { case "ExternalServiceException": return [3, 2]; case "com.amazonaws.cognitoidentity#ExternalServiceException": return [3, 2]; case "InternalErrorException": return [3, 4]; case "com.amazonaws.cognitoidentity#InternalErrorException": return [3, 4]; case "InvalidParameterException": return [3, 6]; case "com.amazonaws.cognitoidentity#InvalidParameterException": return [3, 6]; case "LimitExceededException": return [3, 8]; case "com.amazonaws.cognitoidentity#LimitExceededException": return [3, 8]; case "NotAuthorizedException": return [3, 10]; case "com.amazonaws.cognitoidentity#NotAuthorizedException": return [3, 10]; case "ResourceConflictException": return [3, 12]; case "com.amazonaws.cognitoidentity#ResourceConflictException": return [3, 12]; case "ResourceNotFoundException": return [3, 14]; case "com.amazonaws.cognitoidentity#ResourceNotFoundException": return [3, 14]; case "TooManyRequestsException": return [3, 16]; case "com.amazonaws.cognitoidentity#TooManyRequestsException": return [3, 16]; } return [3, 18]; case 2: return l = [{}], [4, bC(n)]; case 3: return i = Ce.apply(void 0, [Ce.apply(void 0, l.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 4: return f = [{}], [4, kC(n)]; case 5: return i = Ce.apply(void 0, [Ce.apply(void 0, f.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 6: return d = [{}], [4, EC(n)]; case 7: return i = Ce.apply(void 0, [Ce.apply(void 0, d.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 8: return p = [{}], [4, kL(n)]; case 9: return i = Ce.apply(void 0, [Ce.apply(void 0, p.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 10: return v = [{}], [4, AC(n)]; case 11: return i = Ce.apply(void 0, [Ce.apply(void 0, v.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 12: return y = [{}], [4, CC(n)]; case 13: return i = Ce.apply(void 0, [Ce.apply(void 0, y.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 14: return k = [{}], [4, xC(n)]; case 15: return i = Ce.apply(void 0, [Ce.apply(void 0, k.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 16: return A = [{}], [4, NC(n)]; case 17: return i = Ce.apply(void 0, [Ce.apply(void 0, A.concat([R.sent()])), { name: o, $metadata: Qt(t) }]), [3, 19]; case 18: E = n.body, o = E.code || E.Code || o, i = Ce(Ce({}, E), { name: "" + o, message: E.message || E.Message || o, $fault: "client", $metadata: Qt(t) }), R.label = 19; case 19: return T = i.message || i.Message || o, i.message = T, delete i.Message, [2, Promise.reject(Object.assign(new Error(T), i))]; } }); }); }, bC = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { return n = t.body, r = xL(n), i = Ce({ name: "ExternalServiceException", $fault: "client", $metadata: Qt(t) }, r), [2, i]; }); }); }, kC = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { return n = t.body, r = IL(n), i = Ce({ name: "InternalErrorException", $fault: "server", $metadata: Qt(t) }, r), [2, i]; }); }); }, bL = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { return n = t.body, r = RL(n), i = Ce({ name: "InvalidIdentityPoolConfigurationException", $fault: "client", $metadata: Qt(t) }, r), [2, i]; }); }); }, EC = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { return n = t.body, r = OL(n), i = Ce({ name: "InvalidParameterException", $fault: "client", $metadata: Qt(t) }, r), [2, i]; }); }); }, kL = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { return n = t.body, r = PL(n), i = Ce({ name: "LimitExceededException", $fault: "client", $metadata: Qt(t) }, r), [2, i]; }); }); }, AC = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { return n = t.body, r = DL(n), i = Ce({ name: "NotAuthorizedException", $fault: "client", $metadata: Qt(t) }, r), [2, i]; }); }); }, CC = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { return n = t.body, r = FL(n), i = Ce({ name: "ResourceConflictException", $fault: "client", $metadata: Qt(t) }, r), [2, i]; }); }); }, xC = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { return n = t.body, r = LL(n), i = Ce({ name: "ResourceNotFoundException", $fault: "client", $metadata: Qt(t) }, r), [2, i]; }); }); }, NC = function(t, e) { return rr(void 0, void 0, void 0, function() { var n, r, i; return ir(this, function(o) { return n = t.body, r = UL(n), i = Ce({ name: "TooManyRequestsException", $fault: "client", $metadata: Qt(t) }, r), [2, i]; }); }); }, EL = function(t, e) { return Ce(Ce(Ce({}, t.CustomRoleArn !== void 0 && t.CustomRoleArn !== null && { CustomRoleArn: t.CustomRoleArn }), t.IdentityId !== void 0 && t.IdentityId !== null && { IdentityId: t.IdentityId }), t.Logins !== void 0 && t.Logins !== null && { Logins: TC(t.Logins) }); }, AL = function(t, e) { return Ce(Ce(Ce({}, t.AccountId !== void 0 && t.AccountId !== null && { AccountId: t.AccountId }), t.IdentityPoolId !== void 0 && t.IdentityPoolId !== null && { IdentityPoolId: t.IdentityPoolId }), t.Logins !== void 0 && t.Logins !== null && { Logins: TC(t.Logins) }); }, TC = function(t, e) { return Object.entries(t).reduce(function(n, r) { var i, o = fD(r, 2), u = o[0], l = o[1]; return l === null ? n : Ce(Ce({}, n), (i = {}, i[u] = l, i)); }, {}); }, CL = function(t, e) { return { AccessKeyId: t.AccessKeyId !== void 0 && t.AccessKeyId !== null ? t.AccessKeyId : void 0, Expiration: t.Expiration !== void 0 && t.Expiration !== null ? new Date(Math.round(t.Expiration * 1e3)) : void 0, SecretKey: t.SecretKey !== void 0 && t.SecretKey !== null ? t.SecretKey : void 0, SessionToken: t.SessionToken !== void 0 && t.SessionToken !== null ? t.SessionToken : void 0 }; }, xL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, NL = function(t, e) { return { Credentials: t.Credentials !== void 0 && t.Credentials !== null ? CL(t.Credentials) : void 0, IdentityId: t.IdentityId !== void 0 && t.IdentityId !== null ? t.IdentityId : void 0 }; }, TL = function(t, e) { return { IdentityId: t.IdentityId !== void 0 && t.IdentityId !== null ? t.IdentityId : void 0 }; }, IL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, RL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, OL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, PL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, DL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, FL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, LL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, UL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, Qt = function(t) { var e; return { httpStatusCode: t.statusCode, requestId: (e = t.headers["x-amzn-requestid"]) !== null && e !== void 0 ? e : t.headers["x-amzn-request-id"], extendedRequestId: t.headers["x-amz-id-2"], cfId: t.headers["x-amz-cf-id"] }; }, ML = function(t, e) { return t === void 0 && (t = new Uint8Array()), t instanceof Uint8Array ? Promise.resolve(t) : e.streamCollector(t) || Promise.resolve(new Uint8Array()); }, BL = function(t, e) { return ML(t, e).then(function(n) { return e.utf8Encoder(n); }); }, IC = function(t, e, n, r, i) { return rr(void 0, void 0, void 0, function() { var o, u, l, f, d, p; return ir(this, function(v) { switch (v.label) { case 0: return [4, t.endpoint()]; case 1: return o = v.sent(), u = o.hostname, l = o.protocol, f = l === void 0 ? "https" : l, d = o.port, p = { protocol: f, hostname: u, port: d, method: "POST", path: n, headers: e }, i !== void 0 && (p.body = i), [2, new ml(p)]; } }); }); }, Cp = function(t, e) { return BL(t, e).then(function(n) { return n.length ? JSON.parse(n) : {}; }); }, RC = function(t, e) { var n = function(o, u) { return Object.keys(o).find(function(l) { return l.toLowerCase() === u.toLowerCase(); }); }, r = function(o) { var u = o; return u.indexOf(":") >= 0 && (u = u.split(":")[0]), u.indexOf("#") >= 0 && (u = u.split("#")[1]), u; }, i = n(t.headers, "x-amzn-errortype"); return i !== void 0 ? r(t.headers[i]) : e.code !== void 0 ? r(e.code) : e.__type !== void 0 ? r(e.__type) : ""; }, vy = ( /** @class */ function(t) { k0(e, t); function e(n) { var r = ( // Start section: command_constructor t.call(this) || this ); return r.input = n, r; } return e.prototype.resolveMiddleware = function(n, r, i) { this.middlewareStack.use(SC(r, this.serialize, this.deserialize)); var o = n.concat(this.middlewareStack), u = r.logger, l = "CognitoIdentityClient", f = "GetCredentialsForIdentityCommand", d = { logger: u, clientName: l, commandName: f, inputFilterSensitiveLog: hy.filterSensitiveLog, outputFilterSensitiveLog: py.filterSensitiveLog }, p = r.requestHandler; return o.resolve(function(v) { return p.handle(v.request, i || {}); }, d); }, e.prototype.serialize = function(n, r) { return gL(n, r); }, e.prototype.deserialize = function(n, r) { return yL(n, r); }, e; }(wC) ), td = ( /** @class */ function(t) { k0(e, t); function e(n) { var r = ( // Start section: command_constructor t.call(this) || this ); return r.input = n, r; } return e.prototype.resolveMiddleware = function(n, r, i) { this.middlewareStack.use(SC(r, this.serialize, this.deserialize)); var o = n.concat(this.middlewareStack), u = r.logger, l = "CognitoIdentityClient", f = "GetIdCommand", d = { logger: u, clientName: l, commandName: f, inputFilterSensitiveLog: my.filterSensitiveLog, outputFilterSensitiveLog: gy.filterSensitiveLog }, p = r.requestHandler; return o.resolve(function(v) { return p.handle(v.request, i || {}); }, d); }, e.prototype.serialize = function(n, r) { return vL(n, r); }, e.prototype.deserialize = function(n, r) { return SL(n, r); }, e; }(wC) ), xp = ( /** @class */ function(t) { _0(e, t); function e(n, r) { r === void 0 && (r = !0); var i = t.call(this, n) || this; return i.tryNextLink = r, i; } return e; }(Error) ); function OC(t) { return Promise.all(Object.keys(t).reduce(function(e, n) { var r = t[n]; return typeof r == "string" ? e.push([n, r]) : e.push(r().then(function(i) { return [n, i]; })), e; }, [])).then(function(e) { return e.reduce(function(n, r) { var i = Cl(r, 2), o = i[0], u = i[1]; return n[o] = u, n; }, {}); }); } function Wc(t) { var e = this; return function() { return sn(e, void 0, void 0, function() { var n, r, i, o, u, l, f, d, p, v, y, k, A; return tn(this, function(E) { switch (E.label) { case 0: return v = (p = t.client).send, y = vy.bind, A = { CustomRoleArn: t.customRoleArn, IdentityId: t.identityId }, t.logins ? [4, OC(t.logins)] : [3, 2]; case 1: return k = E.sent(), [3, 3]; case 2: k = void 0, E.label = 3; case 3: return [4, v.apply(p, [new (y.apply(vy, [void 0, (A.Logins = k, A)]))()])]; case 4: return n = E.sent().Credentials, r = n === void 0 ? $L() : n, i = r.AccessKeyId, o = i === void 0 ? jL() : i, u = r.Expiration, l = r.SecretKey, f = l === void 0 ? VL() : l, d = r.SessionToken, [2, { identityId: t.identityId, accessKeyId: o, secretAccessKey: f, sessionToken: d, expiration: u }]; } }); }); }; } function jL() { throw new xp("Response from Amazon Cognito contained no access key ID"); } function $L() { throw new xp("Response from Amazon Cognito contained no credentials"); } function VL() { throw new xp("Response from Amazon Cognito contained no secret key"); } var pv = "IdentityIds", zL = ( /** @class */ function() { function t(e) { e === void 0 && (e = "aws:cognito-identity-ids"), this.dbName = e; } return t.prototype.getItem = function(e) { return this.withObjectStore("readonly", function(n) { var r = n.get(e); return new Promise(function(i) { r.onerror = function() { return i(null); }, r.onsuccess = function() { return i(r.result ? r.result.value : null); }; }); }).catch(function() { return null; }); }, t.prototype.removeItem = function(e) { return this.withObjectStore("readwrite", function(n) { var r = n.delete(e); return new Promise(function(i, o) { r.onerror = function() { return o(r.error); }, r.onsuccess = function() { return i(); }; }); }); }, t.prototype.setItem = function(e, n) { return this.withObjectStore("readwrite", function(r) { var i = r.put({ id: e, value: n }); return new Promise(function(o, u) { i.onerror = function() { return u(i.error); }, i.onsuccess = function() { return o(); }; }); }); }, t.prototype.getDb = function() { var e = self.indexedDB.open(this.dbName, 1); return new Promise(function(n, r) { e.onsuccess = function() { n(e.result); }, e.onerror = function() { r(e.error); }, e.onblocked = function() { r(new Error("Unable to access DB")); }, e.onupgradeneeded = function() { var i = e.result; i.onerror = function() { r(new Error("Failed to create object store")); }, i.createObjectStore(pv, { keyPath: "id" }); }; }); }, t.prototype.withObjectStore = function(e, n) { return this.getDb().then(function(r) { var i = r.transaction(pv, e); return i.oncomplete = function() { return r.close(); }, new Promise(function(o, u) { i.onerror = function() { return u(i.error); }, o(n(i.objectStore(pv))); }).catch(function(o) { throw r.close(), o; }); }); }, t; }() ), qL = ( /** @class */ function() { function t(e) { e === void 0 && (e = {}), this.store = e; } return t.prototype.getItem = function(e) { return e in this.store ? this.store[e] : null; }, t.prototype.removeItem = function(e) { delete this.store[e]; }, t.prototype.setItem = function(e, n) { this.store[e] = n; }, t; }() ), HL = new qL(); function KL() { return typeof self == "object" && self.indexedDB ? new zL() : typeof window == "object" && window.localStorage ? window.localStorage : HL; } function GL(t) { var e = this, n = t.accountId, r = t.cache, i = r === void 0 ? KL() : r, o = t.client, u = t.customRoleArn, l = t.identityPoolId, f = t.logins, d = t.userIdentifier, p = d === void 0 ? !f || Object.keys(f).length === 0 ? "ANONYMOUS" : void 0 : d, v = p ? "aws:cognito-identity-credentials:" + l + ":" + p : void 0, y = function() { return sn(e, void 0, void 0, function() { var k, A, E, T, D, R, L, j, K; return tn(this, function(ue) { switch (ue.label) { case 0: return A = v, A ? [4, i.getItem(v)] : [3, 2]; case 1: A = ue.sent(), ue.label = 2; case 2: return k = A, k ? [3, 7] : (R = (D = o).send, L = td.bind, K = { AccountId: n, IdentityPoolId: l }, f ? [4, OC(f)] : [3, 4]); case 3: return j = ue.sent(), [3, 5]; case 4: j = void 0, ue.label = 5; case 5: return [4, R.apply(D, [new (L.apply(td, [void 0, (K.Logins = j, K)]))()])]; case 6: E = ue.sent().IdentityId, T = E === void 0 ? WL() : E, k = T, v && Promise.resolve(i.setItem(v, k)).catch(function() { }), ue.label = 7; case 7: return y = Wc({ client: o, customRoleArn: u, logins: f, identityId: k }), [2, y()]; } }); }); }; return function() { return y().catch(function(k) { return sn(e, void 0, void 0, function() { return tn(this, function(A) { throw v && Promise.resolve(i.removeItem(v)).catch(function() { }), k; }); }); }); }; } function WL() { throw new xp("Response from Amazon Cognito contained no identity ID"); } var Es = function() { return Es = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Es.apply(this, arguments); }; function mv(t) { var e = new mL({ region: t.region, customUserAgent: NP() }); return e.middlewareStack.add(function(n, r) { return function(i) { return n(YL(i)); }; }, { step: "build", name: "cacheControlMiddleWare" }), e; } function YL(t) { return Es(Es({}, t), { request: Es(Es({}, t.request), { headers: Es(Es({}, t.request.headers), { "cache-control": "no-store" }) }) }); } var Gh = function() { return Gh = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Gh.apply(this, arguments); }, wr = function(t, e, n, r) { function i(o) { return o instanceof n ? o : new n(function(u) { u(o); }); } return new (n || (n = Promise))(function(o, u) { function l(p) { try { d(r.next(p)); } catch (v) { u(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { u(v); } } function d(p) { p.done ? o(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, Sr = function(t, e) { var n = { label: 0, sent: function() { if (o[0] & 1) throw o[1]; return o[1]; }, trys: [], ops: [] }, r, i, o, u; return u = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() { return this; }), u; function l(d) { return function(p) { return f([d, p]); }; } function f(d) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (o = d[0] & 2 ? i.return : d[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, d[1])).done) return o; switch (i = 0, o && (d = [d[0] & 2, o.value]), d[0]) { case 0: case 1: o = d; break; case 4: return n.label++, { value: d[1], done: !1 }; case 5: n.label++, i = d[1], d = [0]; continue; case 7: d = n.ops.pop(), n.trys.pop(); continue; default: if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!o || d[1] > o[0] && d[1] < o[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < o[1]) { n.label = o[1], o = d; break; } if (o && n.label < o[2]) { n.label = o[2], n.ops.push(d); break; } o[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = o = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, Pt = new Pi("Credentials"), QL = 50 * 60 * 1e3, JL = "CognitoIdentityId-", XL = ( /** @class */ function() { function t(e) { this._gettingCredPromise = null, this._refreshHandlers = {}, this.Auth = void 0, this.configure(e), this._refreshHandlers.google = Z2.refreshGoogleToken, this._refreshHandlers.facebook = eL.refreshFacebookToken; } return t.prototype.getModuleName = function() { return "Credentials"; }, t.prototype.getCredSource = function() { return this._credentials_source; }, t.prototype.configure = function(e) { if (!e) return this._config || {}; this._config = Object.assign({}, this._config, e); var n = this._config.refreshHandlers; return n && (this._refreshHandlers = Gh(Gh({}, this._refreshHandlers), n)), this._storage = this._config.storage, this._storage || (this._storage = new _C().getStorage()), this._storageSync = Promise.resolve(), typeof this._storage.sync == "function" && (this._storageSync = this._storage.sync()), this._config; }, t.prototype.get = function() { return Pt.debug("getting credentials"), this._pickupCredentials(); }, t.prototype._getCognitoIdentityIdStorageKey = function(e) { return "" + JL + e; }, t.prototype._pickupCredentials = function() { return Pt.debug("picking up credentials"), !this._gettingCredPromise || !this._gettingCredPromise.isPending() ? (Pt.debug("getting new cred promise"), this._gettingCredPromise = OP(this._keepAlive())) : Pt.debug("getting old cred promise"), this._gettingCredPromise; }, t.prototype._keepAlive = function() { return wr(this, void 0, void 0, function() { var e, n, r, i, o, u, l, f; return Sr(this, function(d) { switch (d.label) { case 0: if (Pt.debug("checking if credentials exists and not expired"), e = this._credentials, e && !this._isExpired(e) && !this._isPastTTL()) return Pt.debug("credentials not changed and not expired, directly return"), [2, Promise.resolve(e)]; if (Pt.debug("need to get a new credential or refresh the existing one"), n = this.Auth, r = n === void 0 ? S0.Auth : n, !r || typeof r.currentUserCredentials != "function") return [2, Promise.reject("No Auth module registered in Amplify")]; if (!(!this._isExpired(e) && this._isPastTTL())) return [3, 6]; Pt.debug("ttl has passed but token is not yet expired"), d.label = 1; case 1: return d.trys.push([1, 5, , 6]), [4, r.currentUserPoolUser()]; case 2: return i = d.sent(), [4, r.currentSession()]; case 3: return o = d.sent(), u = o.refreshToken, l = new Promise(function(p, v) { i.refreshSession(u, function(y, k) { return y ? v(y) : p(k); }); }), [4, l]; case 4: return d.sent(), [3, 6]; case 5: return f = d.sent(), Pt.debug("Error attempting to refreshing the session", f), [3, 6]; case 6: return [2, r.currentUserCredentials()]; } }); }); }, t.prototype.refreshFederatedToken = function(e) { Pt.debug("Getting federated credentials"); var n = e.provider, r = e.user, i = e.token, o = e.identity_id, u = e.expires_at; u = new Date(u).getFullYear() === 1970 ? u * 1e3 : u; var l = this; return Pt.debug("checking if federated jwt token expired"), u > (/* @__PURE__ */ new Date()).getTime() ? (Pt.debug("token not expired"), this._setCredentialsFromFederation({ provider: n, token: i, user: r, identity_id: o, expires_at: u })) : l._refreshHandlers[n] && typeof l._refreshHandlers[n] == "function" ? (Pt.debug("getting refreshed jwt token from federation provider"), this._providerRefreshWithRetry({ refreshHandler: l._refreshHandlers[n], provider: n, user: r })) : (Pt.debug("no refresh handler for provider:", n), this.clear(), Promise.reject("no refresh handler for provider")); }, t.prototype._providerRefreshWithRetry = function(e) { var n = this, r = e.refreshHandler, i = e.provider, o = e.user, u = 10 * 1e3; return sD(r, [], u).then(function(l) { return Pt.debug("refresh federated token sucessfully", l), n._setCredentialsFromFederation({ provider: i, token: l.token, user: o, identity_id: l.identity_id, expires_at: l.expires_at }); }).catch(function(l) { var f = typeof l == "string" && l.toLowerCase().lastIndexOf("network error", l.length) === 0; return f || n.clear(), Pt.debug("refresh federated token failed", l), Promise.reject("refreshing federation token failed: " + l); }); }, t.prototype._isExpired = function(e) { if (!e) return Pt.debug("no credentials for expiration check"), !0; Pt.debug("are these credentials expired?", e); var n = Date.now(), r = e.expiration; return r.getTime() <= n; }, t.prototype._isPastTTL = function() { return this._nextCredentialsRefresh <= Date.now(); }, t.prototype._setCredentialsForGuest = function() { return wr(this, void 0, void 0, function() { var e, n, r, i, o, u, l, f, d, p, v = this; return Sr(this, function(y) { switch (y.label) { case 0: return Pt.debug("setting credentials for guest"), e = this._config, n = e.identityPoolId, r = e.region, i = e.mandatorySignIn, i ? [2, Promise.reject("cannot get guest credentials when mandatory signin enabled")] : n ? r ? (u = this, [4, this._getGuestIdentityId()]) : (Pt.debug("region is not configured for getting the credentials"), [2, Promise.reject("region is not configured for getting the credentials")]) : (Pt.debug("No Cognito Identity pool provided for unauthenticated access"), [2, Promise.reject("No Cognito Identity pool provided for unauthenticated access")]); case 1: return o = u._identityId = y.sent(), l = mv({ region: r }), f = void 0, o ? (d = { identityId: o, client: l }, f = Wc(d)()) : (p = function() { return wr(v, void 0, void 0, function() { var k, A, E; return Sr(this, function(T) { switch (T.label) { case 0: return [4, l.send(new td({ IdentityPoolId: n }))]; case 1: return k = T.sent().IdentityId, this._identityId = k, A = { client: l, identityId: k }, E = Wc(A), [2, E()]; } }); }); }, f = p().catch(function(k) { return wr(v, void 0, void 0, function() { return Sr(this, function(A) { throw k; }); }); })), [2, this._loadCredentials(f, "guest", !1, null).then(function(k) { return k; }).catch(function(k) { return wr(v, void 0, void 0, function() { var A, E = this; return Sr(this, function(T) { switch (T.label) { case 0: return k.name === "ResourceNotFoundException" && k.message === "Identity '" + o + "' not found." ? (Pt.debug("Failed to load guest credentials"), [4, this._removeGuestIdentityId()]) : [3, 2]; case 1: return T.sent(), A = function() { return wr(E, void 0, void 0, function() { var D, R, L; return Sr(this, function(j) { switch (j.label) { case 0: return [4, l.send(new td({ IdentityPoolId: n }))]; case 1: return D = j.sent().IdentityId, this._identityId = D, R = { client: l, identityId: D }, L = Wc(R), [2, L()]; } }); }); }, f = A().catch(function(D) { return wr(E, void 0, void 0, function() { return Sr(this, function(R) { throw D; }); }); }), [2, this._loadCredentials(f, "guest", !1, null)]; case 2: return [2, k]; } }); }); })]; } }); }); }, t.prototype._setCredentialsFromFederation = function(e) { var n = e.provider, r = e.token, i = e.identity_id, o = { google: "accounts.google.com", facebook: "graph.facebook.com", amazon: "www.amazon.com", developer: "cognito-identity.amazonaws.com" }, u = o[n] || n; if (!u) return Promise.reject("You must specify a federated provider"); var l = {}; l[u] = r; var f = this._config, d = f.identityPoolId, p = f.region; if (!d) return Pt.debug("No Cognito Federated Identity pool provided"), Promise.reject("No Cognito Federated Identity pool provided"); if (!p) return Pt.debug("region is not configured for getting the credentials"), Promise.reject("region is not configured for getting the credentials"); var v = mv({ region: p }), y = void 0; if (i) { var k = { identityId: i, logins: l, client: v }; y = Wc(k)(); } else { var k = { logins: l, identityPoolId: d, client: v }; y = GL(k)(); } return this._loadCredentials(y, "federated", !0, e); }, t.prototype._setCredentialsFromSession = function(e) { var n = this; Pt.debug("set credentials from session"); var r = e.getIdToken().getJwtToken(), i = this._config, o = i.region, u = i.userPoolId, l = i.identityPoolId; if (!l) return Pt.debug("No Cognito Federated Identity pool provided"), Promise.reject("No Cognito Federated Identity pool provided"); if (!o) return Pt.debug("region is not configured for getting the credentials"), Promise.reject("region is not configured for getting the credentials"); var f = "cognito-idp." + o + ".amazonaws.com/" + u, d = {}; d[f] = r; var p = mv({ region: o }), v = function() { return wr(n, void 0, void 0, function() { var k, A, E, T, D, R, L, j, K, ue; return Sr(this, function(de) { switch (de.label) { case 0: return [4, this._getGuestIdentityId()]; case 1: return k = de.sent(), k ? [3, 3] : [4, p.send(new td({ IdentityPoolId: l, Logins: d }))]; case 2: E = de.sent().IdentityId, A = E, de.label = 3; case 3: return [4, p.send(new vy({ IdentityId: k || A, Logins: d }))]; case 4: return T = de.sent(), D = T.Credentials, R = D.AccessKeyId, L = D.Expiration, j = D.SecretKey, K = D.SessionToken, ue = T.IdentityId, this._identityId = ue, k ? (Pt.debug("The guest identity " + k + " has been successfully linked to the logins"), k === ue && Pt.debug("The guest identity " + k + " has become the primary identity"), [4, this._removeGuestIdentityId()]) : [3, 6]; case 5: de.sent(), de.label = 6; case 6: return [2, { accessKeyId: R, secretAccessKey: j, sessionToken: K, expiration: L, identityId: ue }]; } }); }); }, y = v().catch(function(k) { return wr(n, void 0, void 0, function() { return Sr(this, function(A) { throw k; }); }); }); return this._loadCredentials(y, "userPool", !0, null); }, t.prototype._loadCredentials = function(e, n, r, i) { var o = this, u = this; return new Promise(function(l, f) { e.then(function(d) { return wr(o, void 0, void 0, function() { var p, v, y, k, A; return Sr(this, function(E) { switch (E.label) { case 0: if (Pt.debug("Load credentials successfully", d), this._identityId && !d.identityId && (d.identityId = this._identityId), u._credentials = d, u._credentials.authenticated = r, u._credentials_source = n, u._nextCredentialsRefresh = (/* @__PURE__ */ new Date()).getTime() + QL, n === "federated") { p = Object.assign({ id: this._credentials.identityId }, i.user), v = i.provider, y = i.token, k = i.expires_at, A = i.identity_id; try { this._storage.setItem("aws-amplify-federatedInfo", JSON.stringify({ provider: v, token: y, user: p, expires_at: k, identity_id: A })); } catch (T) { Pt.debug("Failed to put federated info into auth storage", T); } } return n !== "guest" ? [3, 2] : [4, this._setGuestIdentityId(d.identityId)]; case 1: E.sent(), E.label = 2; case 2: return l(u._credentials), [ 2 /*return*/ ]; } }); }); }).catch(function(d) { if (d) { Pt.debug("Failed to load credentials", e), Pt.debug("Error loading credentials", d), f(d); return; } }); }); }, t.prototype.set = function(e, n) { return n === "session" ? this._setCredentialsFromSession(e) : n === "federation" ? this._setCredentialsFromFederation(e) : n === "guest" ? this._setCredentialsForGuest() : (Pt.debug("no source specified for setting credentials"), Promise.reject("invalid source")); }, t.prototype.clear = function() { return wr(this, void 0, void 0, function() { return Sr(this, function(e) { return this._credentials = null, this._credentials_source = null, Pt.debug("removing aws-amplify-federatedInfo from storage"), this._storage.removeItem("aws-amplify-federatedInfo"), [ 2 /*return*/ ]; }); }); }, t.prototype._getGuestIdentityId = function() { return wr(this, void 0, void 0, function() { var e, n; return Sr(this, function(r) { switch (r.label) { case 0: e = this._config.identityPoolId, r.label = 1; case 1: return r.trys.push([1, 3, , 4]), [4, this._storageSync]; case 2: return r.sent(), [2, this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))]; case 3: return n = r.sent(), Pt.debug("Failed to get the cached guest identityId", n), [3, 4]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype._setGuestIdentityId = function(e) { return wr(this, void 0, void 0, function() { var n, r; return Sr(this, function(i) { switch (i.label) { case 0: n = this._config.identityPoolId, i.label = 1; case 1: return i.trys.push([1, 3, , 4]), [4, this._storageSync]; case 2: return i.sent(), this._storage.setItem(this._getCognitoIdentityIdStorageKey(n), e), [3, 4]; case 3: return r = i.sent(), Pt.debug("Failed to cache guest identityId", r), [3, 4]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype._removeGuestIdentityId = function() { return wr(this, void 0, void 0, function() { var e; return Sr(this, function(n) { return e = this._config.identityPoolId, Pt.debug("removing " + this._getCognitoIdentityIdStorageKey(e) + " from storage"), this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)), [ 2 /*return*/ ]; }); }); }, t.prototype.shear = function(e) { return { accessKeyId: e.accessKeyId, sessionToken: e.sessionToken, secretAccessKey: e.secretAccessKey, identityId: e.identityId, authenticated: e.authenticated }; }, t; }() ), PC = new XL(null); S0.register(PC); var rh = {}; /*! * cookie * Copyright(c) 2012-2014 Roman Shtylman * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed */ var Dk; function ZL() { if (Dk) return rh; Dk = 1, rh.parse = r, rh.serialize = i; var t = decodeURIComponent, e = encodeURIComponent, n = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; function r(u, l) { if (typeof u != "string") throw new TypeError("argument str must be a string"); for (var f = {}, d = l || {}, p = u.split(";"), v = d.decode || t, y = 0; y < p.length; y++) { var k = p[y], A = k.indexOf("="); if (!(A < 0)) { var E = k.substring(0, A).trim(); if (f[E] == null) { var T = k.substring(A + 1, k.length).trim(); T[0] === '"' && (T = T.slice(1, -1)), f[E] = o(T, v); } } } return f; } function i(u, l, f) { var d = f || {}, p = d.encode || e; if (typeof p != "function") throw new TypeError("option encode is invalid"); if (!n.test(u)) throw new TypeError("argument name is invalid"); var v = p(l); if (v && !n.test(v)) throw new TypeError("argument val is invalid"); var y = u + "=" + v; if (d.maxAge != null) { var k = d.maxAge - 0; if (isNaN(k) || !isFinite(k)) throw new TypeError("option maxAge is invalid"); y += "; Max-Age=" + Math.floor(k); } if (d.domain) { if (!n.test(d.domain)) throw new TypeError("option domain is invalid"); y += "; Domain=" + d.domain; } if (d.path) { if (!n.test(d.path)) throw new TypeError("option path is invalid"); y += "; Path=" + d.path; } if (d.expires) { if (typeof d.expires.toUTCString != "function") throw new TypeError("option expires is invalid"); y += "; Expires=" + d.expires.toUTCString(); } if (d.httpOnly && (y += "; HttpOnly"), d.secure && (y += "; Secure"), d.sameSite) { var A = typeof d.sameSite == "string" ? d.sameSite.toLowerCase() : d.sameSite; switch (A) { case !0: y += "; SameSite=Strict"; break; case "lax": y += "; SameSite=Lax"; break; case "strict": y += "; SameSite=Strict"; break; case "none": y += "; SameSite=None"; break; default: throw new TypeError("option sameSite is invalid"); } } return y; } function o(u, l) { try { return l(u); } catch { return u; } } return rh; } var gh = ZL(); function eU() { return typeof document == "object" && typeof document.cookie == "string"; } function tU(t, e) { return typeof t == "string" ? gh.parse(t, e) : typeof t == "object" && t !== null ? t : {}; } function nU(t, e) { return typeof e > "u" && (e = !t || t[0] !== "{" && t[0] !== "[" && t[0] !== '"'), !e; } function Fk(t, e) { e === void 0 && (e = {}); var n = rU(t); if (nU(n, e.doNotParse)) try { return JSON.parse(n); } catch { } return t; } function rU(t) { return t && t[0] === "j" && t[1] === ":" ? t.substr(2) : t; } var Oa = function() { return Oa = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Oa.apply(this, arguments); }, gv = ( /** @class */ function() { function t(e, n) { var r = this; this.changeListeners = [], this.HAS_DOCUMENT_COOKIE = !1, this.cookies = tU(e, n), new Promise(function() { r.HAS_DOCUMENT_COOKIE = eU(); }).catch(function() { }); } return t.prototype._updateBrowserValues = function(e) { this.HAS_DOCUMENT_COOKIE && (this.cookies = gh.parse(document.cookie, e)); }, t.prototype._emitChange = function(e) { for (var n = 0; n < this.changeListeners.length; ++n) this.changeListeners[n](e); }, t.prototype.get = function(e, n, r) { return n === void 0 && (n = {}), this._updateBrowserValues(r), Fk(this.cookies[e], n); }, t.prototype.getAll = function(e, n) { e === void 0 && (e = {}), this._updateBrowserValues(n); var r = {}; for (var i in this.cookies) r[i] = Fk(this.cookies[i], e); return r; }, t.prototype.set = function(e, n, r) { var i; typeof n == "object" && (n = JSON.stringify(n)), this.cookies = Oa(Oa({}, this.cookies), (i = {}, i[e] = n, i)), this.HAS_DOCUMENT_COOKIE && (document.cookie = gh.serialize(e, n, r)), this._emitChange({ name: e, value: n, options: r }); }, t.prototype.remove = function(e, n) { var r = n = Oa(Oa({}, n), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }); this.cookies = Oa({}, this.cookies), delete this.cookies[e], this.HAS_DOCUMENT_COOKIE && (document.cookie = gh.serialize(e, "", r)), this._emitChange({ name: e, value: void 0, options: n }); }, t.prototype.addChangeListener = function(e) { this.changeListeners.push(e); }, t.prototype.removeChangeListener = function(e) { var n = this.changeListeners.indexOf(e); n >= 0 && this.changeListeners.splice(n, 1); }, t; }() ), Lk = jo().isBrowser, iU = ( /** @class */ function() { function t(e) { e === void 0 && (e = {}), this.cookies = new gv(), this.store = Lk ? window.localStorage : /* @__PURE__ */ Object.create(null), this.cookies = e.req ? new gv(e.req.headers.cookie) : new gv(), Object.assign(this.store, this.cookies.getAll()); } return Object.defineProperty(t.prototype, "length", { get: function() { return Object.entries(this.store).length; }, enumerable: !0, configurable: !0 }), t.prototype.clear = function() { var e = this; Array.from(new Array(this.length)).map(function(n, r) { return e.key(r); }).forEach(function(n) { return e.removeItem(n); }); }, t.prototype.getItem = function(e) { return this.getLocalItem(e); }, t.prototype.getLocalItem = function(e) { return Object.prototype.hasOwnProperty.call(this.store, e) ? this.store[e] : null; }, t.prototype.getUniversalItem = function(e) { return this.cookies.get(e); }, t.prototype.key = function(e) { return Object.keys(this.store)[e]; }, t.prototype.removeItem = function(e) { this.removeLocalItem(e), this.removeUniversalItem(e); }, t.prototype.removeLocalItem = function(e) { delete this.store[e]; }, t.prototype.removeUniversalItem = function(e) { this.cookies.remove(e, { path: "/" }); }, t.prototype.setItem = function(e, n) { this.setLocalItem(e, n); var r = e.split(".").pop(); switch (r) { // LastAuthUser is needed for computing other key names case "LastAuthUser": // accessToken is required for CognitoUserSession case "accessToken": // refreshToken originates on the client, but SSR pages won't fail when this expires // Note: the new `accessToken` will also be refreshed on the client (since Amplify doesn't set server-side cookies) case "refreshToken": // Required for CognitoUserSession case "idToken": Lk ? this.setUniversalItem(e, n) : this.setLocalItem(e, n); } }, t.prototype.setLocalItem = function(e, n) { this.store[e] = n; }, t.prototype.setUniversalItem = function(e, n) { this.cookies.set(e, n, { path: "/", // `httpOnly` cannot be set via JavaScript: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#JavaScript_access_using_Document.cookie sameSite: !0, // Allow unsecure requests to http://localhost:3000/ when in development. secure: window.location.hostname !== "localhost" }); }, t; }() ), Wh; (function(t) { t.Cognito = "COGNITO", t.Google = "Google", t.Facebook = "Facebook", t.Amazon = "LoginWithAmazon", t.Apple = "SignInWithApple"; })(Wh || (Wh = {})); function vv(t) { var e = ["provider"]; return t && !!e.find(function(n) { return t.hasOwnProperty(n); }); } function oU(t) { var e = ["customProvider"]; return t && !!e.find(function(n) { return t.hasOwnProperty(n); }); } function sU(t) { var e = ["customState"]; return t && !!e.find(function(n) { return t.hasOwnProperty(n); }); } function Ua(t) { return t.redirectSignIn !== void 0; } var Gt; (function(t) { t.NoConfig = "noConfig", t.MissingAuthConfig = "missingAuthConfig", t.EmptyUsername = "emptyUsername", t.InvalidUsername = "invalidUsername", t.EmptyPassword = "emptyPassword", t.EmptyCode = "emptyCode", t.SignUpError = "signUpError", t.NoMFA = "noMFA", t.InvalidMFA = "invalidMFA", t.EmptyChallengeResponse = "emptyChallengeResponse", t.NoUserSession = "noUserSession", t.Default = "default", t.DeviceConfig = "deviceConfig", t.NetworkError = "networkError", t.AutoSignInError = "autoSignInError"; })(Gt || (Gt = {})); function aU(t) { return !!t.username; } var Uk; (function(t) { t.API_KEY = "API_KEY", t.AWS_IAM = "AWS_IAM", t.OPENID_CONNECT = "OPENID_CONNECT", t.AMAZON_COGNITO_USER_POOLS = "AMAZON_COGNITO_USER_POOLS", t.AWS_LAMBDA = "AWS_LAMBDA"; })(Uk || (Uk = {})); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Mk = /* @__PURE__ */ function() { function t(n) { var r = n || {}, i = r.ValidationData, o = r.Username, u = r.Password, l = r.AuthParameters, f = r.ClientMetadata; this.validationData = i || {}, this.authParameters = l || {}, this.clientMetadata = f || {}, this.username = o, this.password = u; } var e = t.prototype; return e.getUsername = function() { return this.username; }, e.getPassword = function() { return this.password; }, e.getValidationData = function() { return this.validationData; }, e.getAuthParameters = function() { return this.authParameters; }, e.getClientMetadata = function() { return this.clientMetadata; }, t; }(), yv = {}, Mc = {}, Bk; function uU() { if (Bk) return Mc; Bk = 1, Mc.byteLength = l, Mc.toByteArray = d, Mc.fromByteArray = y; for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = 0, o = r.length; i < o; ++i) t[i] = r[i], e[r.charCodeAt(i)] = i; e[45] = 62, e[95] = 63; function u(k) { var A = k.length; if (A % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); var E = k.indexOf("="); E === -1 && (E = A); var T = E === A ? 0 : 4 - E % 4; return [E, T]; } function l(k) { var A = u(k), E = A[0], T = A[1]; return (E + T) * 3 / 4 - T; } function f(k, A, E) { return (A + E) * 3 / 4 - E; } function d(k) { var A, E = u(k), T = E[0], D = E[1], R = new n(f(k, T, D)), L = 0, j = D > 0 ? T - 4 : T, K; for (K = 0; K < j; K += 4) A = e[k.charCodeAt(K)] << 18 | e[k.charCodeAt(K + 1)] << 12 | e[k.charCodeAt(K + 2)] << 6 | e[k.charCodeAt(K + 3)], R[L++] = A >> 16 & 255, R[L++] = A >> 8 & 255, R[L++] = A & 255; return D === 2 && (A = e[k.charCodeAt(K)] << 2 | e[k.charCodeAt(K + 1)] >> 4, R[L++] = A & 255), D === 1 && (A = e[k.charCodeAt(K)] << 10 | e[k.charCodeAt(K + 1)] << 4 | e[k.charCodeAt(K + 2)] >> 2, R[L++] = A >> 8 & 255, R[L++] = A & 255), R; } function p(k) { return t[k >> 18 & 63] + t[k >> 12 & 63] + t[k >> 6 & 63] + t[k & 63]; } function v(k, A, E) { for (var T, D = [], R = A; R < E; R += 3) T = (k[R] << 16 & 16711680) + (k[R + 1] << 8 & 65280) + (k[R + 2] & 255), D.push(p(T)); return D.join(""); } function y(k) { for (var A, E = k.length, T = E % 3, D = [], R = 16383, L = 0, j = E - T; L < j; L += R) D.push(v(k, L, L + R > j ? j : L + R)); return T === 1 ? (A = k[E - 1], D.push( t[A >> 2] + t[A << 4 & 63] + "==" )) : T === 2 && (A = (k[E - 2] << 8) + k[E - 1], D.push( t[A >> 10] + t[A >> 4 & 63] + t[A << 2 & 63] + "=" )), D.join(""); } return Mc; } var ih = {}; /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ var jk; function lU() { return jk || (jk = 1, ih.read = function(t, e, n, r, i) { var o, u, l = i * 8 - r - 1, f = (1 << l) - 1, d = f >> 1, p = -7, v = n ? i - 1 : 0, y = n ? -1 : 1, k = t[e + v]; for (v += y, o = k & (1 << -p) - 1, k >>= -p, p += l; p > 0; o = o * 256 + t[e + v], v += y, p -= 8) ; for (u = o & (1 << -p) - 1, o >>= -p, p += r; p > 0; u = u * 256 + t[e + v], v += y, p -= 8) ; if (o === 0) o = 1 - d; else { if (o === f) return u ? NaN : (k ? -1 : 1) * (1 / 0); u = u + Math.pow(2, r), o = o - d; } return (k ? -1 : 1) * u * Math.pow(2, o - r); }, ih.write = function(t, e, n, r, i, o) { var u, l, f, d = o * 8 - i - 1, p = (1 << d) - 1, v = p >> 1, y = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, k = r ? 0 : o - 1, A = r ? 1 : -1, E = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0; for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, u = p) : (u = Math.floor(Math.log(e) / Math.LN2), e * (f = Math.pow(2, -u)) < 1 && (u--, f *= 2), u + v >= 1 ? e += y / f : e += y * Math.pow(2, 1 - v), e * f >= 2 && (u++, f /= 2), u + v >= p ? (l = 0, u = p) : u + v >= 1 ? (l = (e * f - 1) * Math.pow(2, i), u = u + v) : (l = e * Math.pow(2, v - 1) * Math.pow(2, i), u = 0)); i >= 8; t[n + k] = l & 255, k += A, l /= 256, i -= 8) ; for (u = u << i | l, d += i; d > 0; t[n + k] = u & 255, k += A, u /= 256, d -= 8) ; t[n + k - A] |= E * 128; }), ih; } var wv, $k; function cU() { if ($k) return wv; $k = 1; var t = {}.toString; return wv = Array.isArray || function(e) { return t.call(e) == "[object Array]"; }, wv; } /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var Vk; function dU() { return Vk || (Vk = 1, function(t) { var e = uU(), n = lU(), r = cU(); t.Buffer = l, t.SlowBuffer = D, t.INSPECT_MAX_BYTES = 50, l.TYPED_ARRAY_SUPPORT = Os.TYPED_ARRAY_SUPPORT !== void 0 ? Os.TYPED_ARRAY_SUPPORT : i(), t.kMaxLength = o(); function i() { try { var P = new Uint8Array(1); return P.__proto__ = { __proto__: Uint8Array.prototype, foo: function() { return 42; } }, P.foo() === 42 && // typed array instances can be augmented typeof P.subarray == "function" && // chrome 9-10 lack `subarray` P.subarray(1, 1).byteLength === 0; } catch { return !1; } } function o() { return l.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823; } function u(P, x) { if (o() < x) throw new RangeError("Invalid typed array length"); return l.TYPED_ARRAY_SUPPORT ? (P = new Uint8Array(x), P.__proto__ = l.prototype) : (P === null && (P = new l(x)), P.length = x), P; } function l(P, x, b) { if (!l.TYPED_ARRAY_SUPPORT && !(this instanceof l)) return new l(P, x, b); if (typeof P == "number") { if (typeof x == "string") throw new Error( "If encoding is specified then the first argument must be a string" ); return v(this, P); } return f(this, P, x, b); } l.poolSize = 8192, l._augment = function(P) { return P.__proto__ = l.prototype, P; }; function f(P, x, b, F) { if (typeof x == "number") throw new TypeError('"value" argument must not be a number'); return typeof ArrayBuffer < "u" && x instanceof ArrayBuffer ? A(P, x, b, F) : typeof x == "string" ? y(P, x, b) : E(P, x); } l.from = function(P, x, b) { return f(null, P, x, b); }, l.TYPED_ARRAY_SUPPORT && (l.prototype.__proto__ = Uint8Array.prototype, l.__proto__ = Uint8Array, typeof Symbol < "u" && Symbol.species && l[Symbol.species] === l && Object.defineProperty(l, Symbol.species, { value: null, configurable: !0 })); function d(P) { if (typeof P != "number") throw new TypeError('"size" argument must be a number'); if (P < 0) throw new RangeError('"size" argument must not be negative'); } function p(P, x, b, F) { return d(x), x <= 0 ? u(P, x) : b !== void 0 ? typeof F == "string" ? u(P, x).fill(b, F) : u(P, x).fill(b) : u(P, x); } l.alloc = function(P, x, b) { return p(null, P, x, b); }; function v(P, x) { if (d(x), P = u(P, x < 0 ? 0 : T(x) | 0), !l.TYPED_ARRAY_SUPPORT) for (var b = 0; b < x; ++b) P[b] = 0; return P; } l.allocUnsafe = function(P) { return v(null, P); }, l.allocUnsafeSlow = function(P) { return v(null, P); }; function y(P, x, b) { if ((typeof b != "string" || b === "") && (b = "utf8"), !l.isEncoding(b)) throw new TypeError('"encoding" must be a valid string encoding'); var F = R(x, b) | 0; P = u(P, F); var ee = P.write(x, b); return ee !== F && (P = P.slice(0, ee)), P; } function k(P, x) { var b = x.length < 0 ? 0 : T(x.length) | 0; P = u(P, b); for (var F = 0; F < b; F += 1) P[F] = x[F] & 255; return P; } function A(P, x, b, F) { if (x.byteLength, b < 0 || x.byteLength < b) throw new RangeError("'offset' is out of bounds"); if (x.byteLength < b + (F || 0)) throw new RangeError("'length' is out of bounds"); return b === void 0 && F === void 0 ? x = new Uint8Array(x) : F === void 0 ? x = new Uint8Array(x, b) : x = new Uint8Array(x, b, F), l.TYPED_ARRAY_SUPPORT ? (P = x, P.__proto__ = l.prototype) : P = k(P, x), P; } function E(P, x) { if (l.isBuffer(x)) { var b = T(x.length) | 0; return P = u(P, b), P.length === 0 || x.copy(P, 0, 0, b), P; } if (x) { if (typeof ArrayBuffer < "u" && x.buffer instanceof ArrayBuffer || "length" in x) return typeof x.length != "number" || Mt(x.length) ? u(P, 0) : k(P, x); if (x.type === "Buffer" && r(x.data)) return k(P, x.data); } throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object."); } function T(P) { if (P >= o()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + o().toString(16) + " bytes"); return P | 0; } function D(P) { return +P != P && (P = 0), l.alloc(+P); } l.isBuffer = function(x) { return !!(x != null && x._isBuffer); }, l.compare = function(x, b) { if (!l.isBuffer(x) || !l.isBuffer(b)) throw new TypeError("Arguments must be Buffers"); if (x === b) return 0; for (var F = x.length, ee = b.length, _e = 0, Ae = Math.min(F, ee); _e < Ae; ++_e) if (x[_e] !== b[_e]) { F = x[_e], ee = b[_e]; break; } return F < ee ? -1 : ee < F ? 1 : 0; }, l.isEncoding = function(x) { switch (String(x).toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "latin1": case "binary": case "base64": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return !0; default: return !1; } }, l.concat = function(x, b) { if (!r(x)) throw new TypeError('"list" argument must be an Array of Buffers'); if (x.length === 0) return l.alloc(0); var F; if (b === void 0) for (b = 0, F = 0; F < x.length; ++F) b += x[F].length; var ee = l.allocUnsafe(b), _e = 0; for (F = 0; F < x.length; ++F) { var Ae = x[F]; if (!l.isBuffer(Ae)) throw new TypeError('"list" argument must be an Array of Buffers'); Ae.copy(ee, _e), _e += Ae.length; } return ee; }; function R(P, x) { if (l.isBuffer(P)) return P.length; if (typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" && (ArrayBuffer.isView(P) || P instanceof ArrayBuffer)) return P.byteLength; typeof P != "string" && (P = "" + P); var b = P.length; if (b === 0) return 0; for (var F = !1; ; ) switch (x) { case "ascii": case "latin1": case "binary": return b; case "utf8": case "utf-8": case void 0: return Je(P).length; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return b * 2; case "hex": return b >>> 1; case "base64": return Ze(P).length; default: if (F) return Je(P).length; x = ("" + x).toLowerCase(), F = !0; } } l.byteLength = R; function L(P, x, b) { var F = !1; if ((x === void 0 || x < 0) && (x = 0), x > this.length || ((b === void 0 || b > this.length) && (b = this.length), b <= 0) || (b >>>= 0, x >>>= 0, b <= x)) return ""; for (P || (P = "utf8"); ; ) switch (P) { case "hex": return Ee(this, x, b); case "utf8": case "utf-8": return dt(this, x, b); case "ascii": return pe(this, x, b); case "latin1": case "binary": return ce(this, x, b); case "base64": return it(this, x, b); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return B(this, x, b); default: if (F) throw new TypeError("Unknown encoding: " + P); P = (P + "").toLowerCase(), F = !0; } } l.prototype._isBuffer = !0; function j(P, x, b) { var F = P[x]; P[x] = P[b], P[b] = F; } l.prototype.swap16 = function() { var x = this.length; if (x % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); for (var b = 0; b < x; b += 2) j(this, b, b + 1); return this; }, l.prototype.swap32 = function() { var x = this.length; if (x % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); for (var b = 0; b < x; b += 4) j(this, b, b + 3), j(this, b + 1, b + 2); return this; }, l.prototype.swap64 = function() { var x = this.length; if (x % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); for (var b = 0; b < x; b += 8) j(this, b, b + 7), j(this, b + 1, b + 6), j(this, b + 2, b + 5), j(this, b + 3, b + 4); return this; }, l.prototype.toString = function() { var x = this.length | 0; return x === 0 ? "" : arguments.length === 0 ? dt(this, 0, x) : L.apply(this, arguments); }, l.prototype.equals = function(x) { if (!l.isBuffer(x)) throw new TypeError("Argument must be a Buffer"); return this === x ? !0 : l.compare(this, x) === 0; }, l.prototype.inspect = function() { var x = "", b = t.INSPECT_MAX_BYTES; return this.length > 0 && (x = this.toString("hex", 0, b).match(/.{2}/g).join(" "), this.length > b && (x += " ... ")), ""; }, l.prototype.compare = function(x, b, F, ee, _e) { if (!l.isBuffer(x)) throw new TypeError("Argument must be a Buffer"); if (b === void 0 && (b = 0), F === void 0 && (F = x ? x.length : 0), ee === void 0 && (ee = 0), _e === void 0 && (_e = this.length), b < 0 || F > x.length || ee < 0 || _e > this.length) throw new RangeError("out of range index"); if (ee >= _e && b >= F) return 0; if (ee >= _e) return -1; if (b >= F) return 1; if (b >>>= 0, F >>>= 0, ee >>>= 0, _e >>>= 0, this === x) return 0; for (var Ae = _e - ee, _t = F - b, At = Math.min(Ae, _t), Ft = this.slice(ee, _e), dn = x.slice(b, F), qt = 0; qt < At; ++qt) if (Ft[qt] !== dn[qt]) { Ae = Ft[qt], _t = dn[qt]; break; } return Ae < _t ? -1 : _t < Ae ? 1 : 0; }; function K(P, x, b, F, ee) { if (P.length === 0) return -1; if (typeof b == "string" ? (F = b, b = 0) : b > 2147483647 ? b = 2147483647 : b < -2147483648 && (b = -2147483648), b = +b, isNaN(b) && (b = ee ? 0 : P.length - 1), b < 0 && (b = P.length + b), b >= P.length) { if (ee) return -1; b = P.length - 1; } else if (b < 0) if (ee) b = 0; else return -1; if (typeof x == "string" && (x = l.from(x, F)), l.isBuffer(x)) return x.length === 0 ? -1 : ue(P, x, b, F, ee); if (typeof x == "number") return x = x & 255, l.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf == "function" ? ee ? Uint8Array.prototype.indexOf.call(P, x, b) : Uint8Array.prototype.lastIndexOf.call(P, x, b) : ue(P, [x], b, F, ee); throw new TypeError("val must be string, number or Buffer"); } function ue(P, x, b, F, ee) { var _e = 1, Ae = P.length, _t = x.length; if (F !== void 0 && (F = String(F).toLowerCase(), F === "ucs2" || F === "ucs-2" || F === "utf16le" || F === "utf-16le")) { if (P.length < 2 || x.length < 2) return -1; _e = 2, Ae /= 2, _t /= 2, b /= 2; } function At(Ir, Hr) { return _e === 1 ? Ir[Hr] : Ir.readUInt16BE(Hr * _e); } var Ft; if (ee) { var dn = -1; for (Ft = b; Ft < Ae; Ft++) if (At(P, Ft) === At(x, dn === -1 ? 0 : Ft - dn)) { if (dn === -1 && (dn = Ft), Ft - dn + 1 === _t) return dn * _e; } else dn !== -1 && (Ft -= Ft - dn), dn = -1; } else for (b + _t > Ae && (b = Ae - _t), Ft = b; Ft >= 0; Ft--) { for (var qt = !0, dr = 0; dr < _t; dr++) if (At(P, Ft + dr) !== At(x, dr)) { qt = !1; break; } if (qt) return Ft; } return -1; } l.prototype.includes = function(x, b, F) { return this.indexOf(x, b, F) !== -1; }, l.prototype.indexOf = function(x, b, F) { return K(this, x, b, F, !0); }, l.prototype.lastIndexOf = function(x, b, F) { return K(this, x, b, F, !1); }; function de(P, x, b, F) { b = Number(b) || 0; var ee = P.length - b; F ? (F = Number(F), F > ee && (F = ee)) : F = ee; var _e = x.length; if (_e % 2 !== 0) throw new TypeError("Invalid hex string"); F > _e / 2 && (F = _e / 2); for (var Ae = 0; Ae < F; ++Ae) { var _t = parseInt(x.substr(Ae * 2, 2), 16); if (isNaN(_t)) return Ae; P[b + Ae] = _t; } return Ae; } function H(P, x, b, F) { return Dt(Je(x, P.length - b), P, b, F); } function ve(P, x, b, F) { return Dt(It(x), P, b, F); } function Z(P, x, b, F) { return ve(P, x, b, F); } function we(P, x, b, F) { return Dt(Ze(x), P, b, F); } function ze(P, x, b, F) { return Dt(Rt(x, P.length - b), P, b, F); } l.prototype.write = function(x, b, F, ee) { if (b === void 0) ee = "utf8", F = this.length, b = 0; else if (F === void 0 && typeof b == "string") ee = b, F = this.length, b = 0; else if (isFinite(b)) b = b | 0, isFinite(F) ? (F = F | 0, ee === void 0 && (ee = "utf8")) : (ee = F, F = void 0); else throw new Error( "Buffer.write(string, encoding, offset[, length]) is no longer supported" ); var _e = this.length - b; if ((F === void 0 || F > _e) && (F = _e), x.length > 0 && (F < 0 || b < 0) || b > this.length) throw new RangeError("Attempt to write outside buffer bounds"); ee || (ee = "utf8"); for (var Ae = !1; ; ) switch (ee) { case "hex": return de(this, x, b, F); case "utf8": case "utf-8": return H(this, x, b, F); case "ascii": return ve(this, x, b, F); case "latin1": case "binary": return Z(this, x, b, F); case "base64": return we(this, x, b, F); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return ze(this, x, b, F); default: if (Ae) throw new TypeError("Unknown encoding: " + ee); ee = ("" + ee).toLowerCase(), Ae = !0; } }, l.prototype.toJSON = function() { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) }; }; function it(P, x, b) { return x === 0 && b === P.length ? e.fromByteArray(P) : e.fromByteArray(P.slice(x, b)); } function dt(P, x, b) { b = Math.min(P.length, b); for (var F = [], ee = x; ee < b; ) { var _e = P[ee], Ae = null, _t = _e > 239 ? 4 : _e > 223 ? 3 : _e > 191 ? 2 : 1; if (ee + _t <= b) { var At, Ft, dn, qt; switch (_t) { case 1: _e < 128 && (Ae = _e); break; case 2: At = P[ee + 1], (At & 192) === 128 && (qt = (_e & 31) << 6 | At & 63, qt > 127 && (Ae = qt)); break; case 3: At = P[ee + 1], Ft = P[ee + 2], (At & 192) === 128 && (Ft & 192) === 128 && (qt = (_e & 15) << 12 | (At & 63) << 6 | Ft & 63, qt > 2047 && (qt < 55296 || qt > 57343) && (Ae = qt)); break; case 4: At = P[ee + 1], Ft = P[ee + 2], dn = P[ee + 3], (At & 192) === 128 && (Ft & 192) === 128 && (dn & 192) === 128 && (qt = (_e & 15) << 18 | (At & 63) << 12 | (Ft & 63) << 6 | dn & 63, qt > 65535 && qt < 1114112 && (Ae = qt)); } } Ae === null ? (Ae = 65533, _t = 1) : Ae > 65535 && (Ae -= 65536, F.push(Ae >>> 10 & 1023 | 55296), Ae = 56320 | Ae & 1023), F.push(Ae), ee += _t; } return be(F); } var ae = 4096; function be(P) { var x = P.length; if (x <= ae) return String.fromCharCode.apply(String, P); for (var b = "", F = 0; F < x; ) b += String.fromCharCode.apply( String, P.slice(F, F += ae) ); return b; } function pe(P, x, b) { var F = ""; b = Math.min(P.length, b); for (var ee = x; ee < b; ++ee) F += String.fromCharCode(P[ee] & 127); return F; } function ce(P, x, b) { var F = ""; b = Math.min(P.length, b); for (var ee = x; ee < b; ++ee) F += String.fromCharCode(P[ee]); return F; } function Ee(P, x, b) { var F = P.length; (!x || x < 0) && (x = 0), (!b || b < 0 || b > F) && (b = F); for (var ee = "", _e = x; _e < b; ++_e) ee += ft(P[_e]); return ee; } function B(P, x, b) { for (var F = P.slice(x, b), ee = "", _e = 0; _e < F.length; _e += 2) ee += String.fromCharCode(F[_e] + F[_e + 1] * 256); return ee; } l.prototype.slice = function(x, b) { var F = this.length; x = ~~x, b = b === void 0 ? F : ~~b, x < 0 ? (x += F, x < 0 && (x = 0)) : x > F && (x = F), b < 0 ? (b += F, b < 0 && (b = 0)) : b > F && (b = F), b < x && (b = x); var ee; if (l.TYPED_ARRAY_SUPPORT) ee = this.subarray(x, b), ee.__proto__ = l.prototype; else { var _e = b - x; ee = new l(_e, void 0); for (var Ae = 0; Ae < _e; ++Ae) ee[Ae] = this[Ae + x]; } return ee; }; function M(P, x, b) { if (P % 1 !== 0 || P < 0) throw new RangeError("offset is not uint"); if (P + x > b) throw new RangeError("Trying to access beyond buffer length"); } l.prototype.readUIntLE = function(x, b, F) { x = x | 0, b = b | 0, F || M(x, b, this.length); for (var ee = this[x], _e = 1, Ae = 0; ++Ae < b && (_e *= 256); ) ee += this[x + Ae] * _e; return ee; }, l.prototype.readUIntBE = function(x, b, F) { x = x | 0, b = b | 0, F || M(x, b, this.length); for (var ee = this[x + --b], _e = 1; b > 0 && (_e *= 256); ) ee += this[x + --b] * _e; return ee; }, l.prototype.readUInt8 = function(x, b) { return b || M(x, 1, this.length), this[x]; }, l.prototype.readUInt16LE = function(x, b) { return b || M(x, 2, this.length), this[x] | this[x + 1] << 8; }, l.prototype.readUInt16BE = function(x, b) { return b || M(x, 2, this.length), this[x] << 8 | this[x + 1]; }, l.prototype.readUInt32LE = function(x, b) { return b || M(x, 4, this.length), (this[x] | this[x + 1] << 8 | this[x + 2] << 16) + this[x + 3] * 16777216; }, l.prototype.readUInt32BE = function(x, b) { return b || M(x, 4, this.length), this[x] * 16777216 + (this[x + 1] << 16 | this[x + 2] << 8 | this[x + 3]); }, l.prototype.readIntLE = function(x, b, F) { x = x | 0, b = b | 0, F || M(x, b, this.length); for (var ee = this[x], _e = 1, Ae = 0; ++Ae < b && (_e *= 256); ) ee += this[x + Ae] * _e; return _e *= 128, ee >= _e && (ee -= Math.pow(2, 8 * b)), ee; }, l.prototype.readIntBE = function(x, b, F) { x = x | 0, b = b | 0, F || M(x, b, this.length); for (var ee = b, _e = 1, Ae = this[x + --ee]; ee > 0 && (_e *= 256); ) Ae += this[x + --ee] * _e; return _e *= 128, Ae >= _e && (Ae -= Math.pow(2, 8 * b)), Ae; }, l.prototype.readInt8 = function(x, b) { return b || M(x, 1, this.length), this[x] & 128 ? (255 - this[x] + 1) * -1 : this[x]; }, l.prototype.readInt16LE = function(x, b) { b || M(x, 2, this.length); var F = this[x] | this[x + 1] << 8; return F & 32768 ? F | 4294901760 : F; }, l.prototype.readInt16BE = function(x, b) { b || M(x, 2, this.length); var F = this[x + 1] | this[x] << 8; return F & 32768 ? F | 4294901760 : F; }, l.prototype.readInt32LE = function(x, b) { return b || M(x, 4, this.length), this[x] | this[x + 1] << 8 | this[x + 2] << 16 | this[x + 3] << 24; }, l.prototype.readInt32BE = function(x, b) { return b || M(x, 4, this.length), this[x] << 24 | this[x + 1] << 16 | this[x + 2] << 8 | this[x + 3]; }, l.prototype.readFloatLE = function(x, b) { return b || M(x, 4, this.length), n.read(this, x, !0, 23, 4); }, l.prototype.readFloatBE = function(x, b) { return b || M(x, 4, this.length), n.read(this, x, !1, 23, 4); }, l.prototype.readDoubleLE = function(x, b) { return b || M(x, 8, this.length), n.read(this, x, !0, 52, 8); }, l.prototype.readDoubleBE = function(x, b) { return b || M(x, 8, this.length), n.read(this, x, !1, 52, 8); }; function te(P, x, b, F, ee, _e) { if (!l.isBuffer(P)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (x > ee || x < _e) throw new RangeError('"value" argument is out of bounds'); if (b + F > P.length) throw new RangeError("Index out of range"); } l.prototype.writeUIntLE = function(x, b, F, ee) { if (x = +x, b = b | 0, F = F | 0, !ee) { var _e = Math.pow(2, 8 * F) - 1; te(this, x, b, F, _e, 0); } var Ae = 1, _t = 0; for (this[b] = x & 255; ++_t < F && (Ae *= 256); ) this[b + _t] = x / Ae & 255; return b + F; }, l.prototype.writeUIntBE = function(x, b, F, ee) { if (x = +x, b = b | 0, F = F | 0, !ee) { var _e = Math.pow(2, 8 * F) - 1; te(this, x, b, F, _e, 0); } var Ae = F - 1, _t = 1; for (this[b + Ae] = x & 255; --Ae >= 0 && (_t *= 256); ) this[b + Ae] = x / _t & 255; return b + F; }, l.prototype.writeUInt8 = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 1, 255, 0), l.TYPED_ARRAY_SUPPORT || (x = Math.floor(x)), this[b] = x & 255, b + 1; }; function Te(P, x, b, F) { x < 0 && (x = 65535 + x + 1); for (var ee = 0, _e = Math.min(P.length - b, 2); ee < _e; ++ee) P[b + ee] = (x & 255 << 8 * (F ? ee : 1 - ee)) >>> (F ? ee : 1 - ee) * 8; } l.prototype.writeUInt16LE = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 2, 65535, 0), l.TYPED_ARRAY_SUPPORT ? (this[b] = x & 255, this[b + 1] = x >>> 8) : Te(this, x, b, !0), b + 2; }, l.prototype.writeUInt16BE = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 2, 65535, 0), l.TYPED_ARRAY_SUPPORT ? (this[b] = x >>> 8, this[b + 1] = x & 255) : Te(this, x, b, !1), b + 2; }; function $(P, x, b, F) { x < 0 && (x = 4294967295 + x + 1); for (var ee = 0, _e = Math.min(P.length - b, 4); ee < _e; ++ee) P[b + ee] = x >>> (F ? ee : 3 - ee) * 8 & 255; } l.prototype.writeUInt32LE = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 4, 4294967295, 0), l.TYPED_ARRAY_SUPPORT ? (this[b + 3] = x >>> 24, this[b + 2] = x >>> 16, this[b + 1] = x >>> 8, this[b] = x & 255) : $(this, x, b, !0), b + 4; }, l.prototype.writeUInt32BE = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 4, 4294967295, 0), l.TYPED_ARRAY_SUPPORT ? (this[b] = x >>> 24, this[b + 1] = x >>> 16, this[b + 2] = x >>> 8, this[b + 3] = x & 255) : $(this, x, b, !1), b + 4; }, l.prototype.writeIntLE = function(x, b, F, ee) { if (x = +x, b = b | 0, !ee) { var _e = Math.pow(2, 8 * F - 1); te(this, x, b, F, _e - 1, -_e); } var Ae = 0, _t = 1, At = 0; for (this[b] = x & 255; ++Ae < F && (_t *= 256); ) x < 0 && At === 0 && this[b + Ae - 1] !== 0 && (At = 1), this[b + Ae] = (x / _t >> 0) - At & 255; return b + F; }, l.prototype.writeIntBE = function(x, b, F, ee) { if (x = +x, b = b | 0, !ee) { var _e = Math.pow(2, 8 * F - 1); te(this, x, b, F, _e - 1, -_e); } var Ae = F - 1, _t = 1, At = 0; for (this[b + Ae] = x & 255; --Ae >= 0 && (_t *= 256); ) x < 0 && At === 0 && this[b + Ae + 1] !== 0 && (At = 1), this[b + Ae] = (x / _t >> 0) - At & 255; return b + F; }, l.prototype.writeInt8 = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 1, 127, -128), l.TYPED_ARRAY_SUPPORT || (x = Math.floor(x)), x < 0 && (x = 255 + x + 1), this[b] = x & 255, b + 1; }, l.prototype.writeInt16LE = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 2, 32767, -32768), l.TYPED_ARRAY_SUPPORT ? (this[b] = x & 255, this[b + 1] = x >>> 8) : Te(this, x, b, !0), b + 2; }, l.prototype.writeInt16BE = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 2, 32767, -32768), l.TYPED_ARRAY_SUPPORT ? (this[b] = x >>> 8, this[b + 1] = x & 255) : Te(this, x, b, !1), b + 2; }, l.prototype.writeInt32LE = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 4, 2147483647, -2147483648), l.TYPED_ARRAY_SUPPORT ? (this[b] = x & 255, this[b + 1] = x >>> 8, this[b + 2] = x >>> 16, this[b + 3] = x >>> 24) : $(this, x, b, !0), b + 4; }, l.prototype.writeInt32BE = function(x, b, F) { return x = +x, b = b | 0, F || te(this, x, b, 4, 2147483647, -2147483648), x < 0 && (x = 4294967295 + x + 1), l.TYPED_ARRAY_SUPPORT ? (this[b] = x >>> 24, this[b + 1] = x >>> 16, this[b + 2] = x >>> 8, this[b + 3] = x & 255) : $(this, x, b, !1), b + 4; }; function Q(P, x, b, F, ee, _e) { if (b + F > P.length) throw new RangeError("Index out of range"); if (b < 0) throw new RangeError("Index out of range"); } function Ye(P, x, b, F, ee) { return ee || Q(P, x, b, 4), n.write(P, x, b, F, 23, 4), b + 4; } l.prototype.writeFloatLE = function(x, b, F) { return Ye(this, x, b, !0, F); }, l.prototype.writeFloatBE = function(x, b, F) { return Ye(this, x, b, !1, F); }; function Ie(P, x, b, F, ee) { return ee || Q(P, x, b, 8), n.write(P, x, b, F, 52, 8), b + 8; } l.prototype.writeDoubleLE = function(x, b, F) { return Ie(this, x, b, !0, F); }, l.prototype.writeDoubleBE = function(x, b, F) { return Ie(this, x, b, !1, F); }, l.prototype.copy = function(x, b, F, ee) { if (F || (F = 0), !ee && ee !== 0 && (ee = this.length), b >= x.length && (b = x.length), b || (b = 0), ee > 0 && ee < F && (ee = F), ee === F || x.length === 0 || this.length === 0) return 0; if (b < 0) throw new RangeError("targetStart out of bounds"); if (F < 0 || F >= this.length) throw new RangeError("sourceStart out of bounds"); if (ee < 0) throw new RangeError("sourceEnd out of bounds"); ee > this.length && (ee = this.length), x.length - b < ee - F && (ee = x.length - b + F); var _e = ee - F, Ae; if (this === x && F < b && b < ee) for (Ae = _e - 1; Ae >= 0; --Ae) x[Ae + b] = this[Ae + F]; else if (_e < 1e3 || !l.TYPED_ARRAY_SUPPORT) for (Ae = 0; Ae < _e; ++Ae) x[Ae + b] = this[Ae + F]; else Uint8Array.prototype.set.call( x, this.subarray(F, F + _e), b ); return _e; }, l.prototype.fill = function(x, b, F, ee) { if (typeof x == "string") { if (typeof b == "string" ? (ee = b, b = 0, F = this.length) : typeof F == "string" && (ee = F, F = this.length), x.length === 1) { var _e = x.charCodeAt(0); _e < 256 && (x = _e); } if (ee !== void 0 && typeof ee != "string") throw new TypeError("encoding must be a string"); if (typeof ee == "string" && !l.isEncoding(ee)) throw new TypeError("Unknown encoding: " + ee); } else typeof x == "number" && (x = x & 255); if (b < 0 || this.length < b || this.length < F) throw new RangeError("Out of range index"); if (F <= b) return this; b = b >>> 0, F = F === void 0 ? this.length : F >>> 0, x || (x = 0); var Ae; if (typeof x == "number") for (Ae = b; Ae < F; ++Ae) this[Ae] = x; else { var _t = l.isBuffer(x) ? x : Je(new l(x, ee).toString()), At = _t.length; for (Ae = 0; Ae < F - b; ++Ae) this[Ae + b] = _t[Ae % At]; } return this; }; var Ge = /[^+\/0-9A-Za-z-_]/g; function Re(P) { if (P = ht(P).replace(Ge, ""), P.length < 2) return ""; for (; P.length % 4 !== 0; ) P = P + "="; return P; } function ht(P) { return P.trim ? P.trim() : P.replace(/^\s+|\s+$/g, ""); } function ft(P) { return P < 16 ? "0" + P.toString(16) : P.toString(16); } function Je(P, x) { x = x || 1 / 0; for (var b, F = P.length, ee = null, _e = [], Ae = 0; Ae < F; ++Ae) { if (b = P.charCodeAt(Ae), b > 55295 && b < 57344) { if (!ee) { if (b > 56319) { (x -= 3) > -1 && _e.push(239, 191, 189); continue; } else if (Ae + 1 === F) { (x -= 3) > -1 && _e.push(239, 191, 189); continue; } ee = b; continue; } if (b < 56320) { (x -= 3) > -1 && _e.push(239, 191, 189), ee = b; continue; } b = (ee - 55296 << 10 | b - 56320) + 65536; } else ee && (x -= 3) > -1 && _e.push(239, 191, 189); if (ee = null, b < 128) { if ((x -= 1) < 0) break; _e.push(b); } else if (b < 2048) { if ((x -= 2) < 0) break; _e.push( b >> 6 | 192, b & 63 | 128 ); } else if (b < 65536) { if ((x -= 3) < 0) break; _e.push( b >> 12 | 224, b >> 6 & 63 | 128, b & 63 | 128 ); } else if (b < 1114112) { if ((x -= 4) < 0) break; _e.push( b >> 18 | 240, b >> 12 & 63 | 128, b >> 6 & 63 | 128, b & 63 | 128 ); } else throw new Error("Invalid code point"); } return _e; } function It(P) { for (var x = [], b = 0; b < P.length; ++b) x.push(P.charCodeAt(b) & 255); return x; } function Rt(P, x) { for (var b, F, ee, _e = [], Ae = 0; Ae < P.length && !((x -= 2) < 0); ++Ae) b = P.charCodeAt(Ae), F = b >> 8, ee = b % 256, _e.push(ee), _e.push(F); return _e; } function Ze(P) { return e.toByteArray(Re(P)); } function Dt(P, x, b, F) { for (var ee = 0; ee < F && !(ee + b >= x.length || ee >= P.length); ++ee) x[ee + b] = P[ee]; return ee; } function Mt(P) { return P !== P; } }(yv)), yv; } var ln = dU(); function fU(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var vh = { exports: {} }; const hU = {}, pU = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: hU }, Symbol.toStringTag, { value: "Module" })), mU = /* @__PURE__ */ wl(pU); var gU = vh.exports, zk; function Tl() { return zk || (zk = 1, function(t, e) { (function(n, r) { t.exports = r(); })(gU, function() { var n = n || function(r, i) { var o; if (typeof window < "u" && window.crypto && (o = window.crypto), typeof self < "u" && self.crypto && (o = self.crypto), typeof globalThis < "u" && globalThis.crypto && (o = globalThis.crypto), !o && typeof window < "u" && window.msCrypto && (o = window.msCrypto), !o && typeof Os < "u" && Os.crypto && (o = Os.crypto), !o && typeof fU == "function") try { o = mU; } catch { } var u = function() { if (o) { if (typeof o.getRandomValues == "function") try { return o.getRandomValues(new Uint32Array(1))[0]; } catch { } if (typeof o.randomBytes == "function") try { return o.randomBytes(4).readInt32LE(); } catch { } } throw new Error("Native crypto module could not be used to get secure random number."); }, l = Object.create || /* @__PURE__ */ function() { function R() { } return function(L) { var j; return R.prototype = L, j = new R(), R.prototype = null, j; }; }(), f = {}, d = f.lib = {}, p = d.Base = /* @__PURE__ */ function() { return { /** * Creates a new object that inherits from this object. * * @param {Object} overrides Properties to copy into the new object. * * @return {Object} The new object. * * @static * * @example * * var MyType = CryptoJS.lib.Base.extend({ * field: 'value', * * method: function () { * } * }); */ extend: function(R) { var L = l(this); return R && L.mixIn(R), (!L.hasOwnProperty("init") || this.init === L.init) && (L.init = function() { L.$super.init.apply(this, arguments); }), L.init.prototype = L, L.$super = this, L; }, /** * Extends this object and runs the init method. * Arguments to create() will be passed to init(). * * @return {Object} The new object. * * @static * * @example * * var instance = MyType.create(); */ create: function() { var R = this.extend(); return R.init.apply(R, arguments), R; }, /** * Initializes a newly created object. * Override this method to add some logic when your objects are created. * * @example * * var MyType = CryptoJS.lib.Base.extend({ * init: function () { * // ... * } * }); */ init: function() { }, /** * Copies properties into this object. * * @param {Object} properties The properties to mix in. * * @example * * MyType.mixIn({ * field: 'value' * }); */ mixIn: function(R) { for (var L in R) R.hasOwnProperty(L) && (this[L] = R[L]); R.hasOwnProperty("toString") && (this.toString = R.toString); }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = instance.clone(); */ clone: function() { return this.init.prototype.extend(this); } }; }(), v = d.WordArray = p.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of 32-bit words. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.lib.WordArray.create(); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); */ init: function(R, L) { R = this.words = R || [], L != i ? this.sigBytes = L : this.sigBytes = R.length * 4; }, /** * Converts this word array to a string. * * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex * * @return {string} The stringified word array. * * @example * * var string = wordArray + ''; * var string = wordArray.toString(); * var string = wordArray.toString(CryptoJS.enc.Utf8); */ toString: function(R) { return (R || k).stringify(this); }, /** * Concatenates a word array to this word array. * * @param {WordArray} wordArray The word array to append. * * @return {WordArray} This word array. * * @example * * wordArray1.concat(wordArray2); */ concat: function(R) { var L = this.words, j = R.words, K = this.sigBytes, ue = R.sigBytes; if (this.clamp(), K % 4) for (var de = 0; de < ue; de++) { var H = j[de >>> 2] >>> 24 - de % 4 * 8 & 255; L[K + de >>> 2] |= H << 24 - (K + de) % 4 * 8; } else for (var ve = 0; ve < ue; ve += 4) L[K + ve >>> 2] = j[ve >>> 2]; return this.sigBytes += ue, this; }, /** * Removes insignificant bits. * * @example * * wordArray.clamp(); */ clamp: function() { var R = this.words, L = this.sigBytes; R[L >>> 2] &= 4294967295 << 32 - L % 4 * 8, R.length = r.ceil(L / 4); }, /** * Creates a copy of this word array. * * @return {WordArray} The clone. * * @example * * var clone = wordArray.clone(); */ clone: function() { var R = p.clone.call(this); return R.words = this.words.slice(0), R; }, /** * Creates a word array filled with random bytes. * * @param {number} nBytes The number of random bytes to generate. * * @return {WordArray} The random word array. * * @static * * @example * * var wordArray = CryptoJS.lib.WordArray.random(16); */ random: function(R) { for (var L = [], j = 0; j < R; j += 4) L.push(u()); return new v.init(L, R); } }), y = f.enc = {}, k = y.Hex = { /** * Converts a word array to a hex string. * * @param {WordArray} wordArray The word array. * * @return {string} The hex string. * * @static * * @example * * var hexString = CryptoJS.enc.Hex.stringify(wordArray); */ stringify: function(R) { for (var L = R.words, j = R.sigBytes, K = [], ue = 0; ue < j; ue++) { var de = L[ue >>> 2] >>> 24 - ue % 4 * 8 & 255; K.push((de >>> 4).toString(16)), K.push((de & 15).toString(16)); } return K.join(""); }, /** * Converts a hex string to a word array. * * @param {string} hexStr The hex string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Hex.parse(hexString); */ parse: function(R) { for (var L = R.length, j = [], K = 0; K < L; K += 2) j[K >>> 3] |= parseInt(R.substr(K, 2), 16) << 24 - K % 8 * 4; return new v.init(j, L / 2); } }, A = y.Latin1 = { /** * Converts a word array to a Latin1 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Latin1 string. * * @static * * @example * * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); */ stringify: function(R) { for (var L = R.words, j = R.sigBytes, K = [], ue = 0; ue < j; ue++) { var de = L[ue >>> 2] >>> 24 - ue % 4 * 8 & 255; K.push(String.fromCharCode(de)); } return K.join(""); }, /** * Converts a Latin1 string to a word array. * * @param {string} latin1Str The Latin1 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); */ parse: function(R) { for (var L = R.length, j = [], K = 0; K < L; K++) j[K >>> 2] |= (R.charCodeAt(K) & 255) << 24 - K % 4 * 8; return new v.init(j, L); } }, E = y.Utf8 = { /** * Converts a word array to a UTF-8 string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-8 string. * * @static * * @example * * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); */ stringify: function(R) { try { return decodeURIComponent(escape(A.stringify(R))); } catch { throw new Error("Malformed UTF-8 data"); } }, /** * Converts a UTF-8 string to a word array. * * @param {string} utf8Str The UTF-8 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); */ parse: function(R) { return A.parse(unescape(encodeURIComponent(R))); } }, T = d.BufferedBlockAlgorithm = p.extend({ /** * Resets this block algorithm's data buffer to its initial state. * * @example * * bufferedBlockAlgorithm.reset(); */ reset: function() { this._data = new v.init(), this._nDataBytes = 0; }, /** * Adds new data to this block algorithm's buffer. * * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. * * @example * * bufferedBlockAlgorithm._append('data'); * bufferedBlockAlgorithm._append(wordArray); */ _append: function(R) { typeof R == "string" && (R = E.parse(R)), this._data.concat(R), this._nDataBytes += R.sigBytes; }, /** * Processes available data blocks. * * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. * * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. * * @return {WordArray} The processed data. * * @example * * var processedData = bufferedBlockAlgorithm._process(); * var processedData = bufferedBlockAlgorithm._process(!!'flush'); */ _process: function(R) { var L, j = this._data, K = j.words, ue = j.sigBytes, de = this.blockSize, H = de * 4, ve = ue / H; R ? ve = r.ceil(ve) : ve = r.max((ve | 0) - this._minBufferSize, 0); var Z = ve * de, we = r.min(Z * 4, ue); if (Z) { for (var ze = 0; ze < Z; ze += de) this._doProcessBlock(K, ze); L = K.splice(0, Z), j.sigBytes -= we; } return new v.init(L, we); }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = bufferedBlockAlgorithm.clone(); */ clone: function() { var R = p.clone.call(this); return R._data = this._data.clone(), R; }, _minBufferSize: 0 }); d.Hasher = T.extend({ /** * Configuration options. */ cfg: p.extend(), /** * Initializes a newly created hasher. * * @param {Object} cfg (Optional) The configuration options to use for this hash computation. * * @example * * var hasher = CryptoJS.algo.SHA256.create(); */ init: function(R) { this.cfg = this.cfg.extend(R), this.reset(); }, /** * Resets this hasher to its initial state. * * @example * * hasher.reset(); */ reset: function() { T.reset.call(this), this._doReset(); }, /** * Updates this hasher with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {Hasher} This hasher. * * @example * * hasher.update('message'); * hasher.update(wordArray); */ update: function(R) { return this._append(R), this._process(), this; }, /** * Finalizes the hash computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The hash. * * @example * * var hash = hasher.finalize(); * var hash = hasher.finalize('message'); * var hash = hasher.finalize(wordArray); */ finalize: function(R) { R && this._append(R); var L = this._doFinalize(); return L; }, blockSize: 16, /** * Creates a shortcut function to a hasher's object interface. * * @param {Hasher} hasher The hasher to create a helper for. * * @return {Function} The shortcut function. * * @static * * @example * * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); */ _createHelper: function(R) { return function(L, j) { return new R.init(j).finalize(L); }; }, /** * Creates a shortcut function to the HMAC's object interface. * * @param {Hasher} hasher The hasher to use in this HMAC helper. * * @return {Function} The shortcut function. * * @static * * @example * * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); */ _createHmacHelper: function(R) { return function(L, j) { return new D.HMAC.init(R, j).finalize(L); }; } }); var D = f.algo = {}; return f; }(Math); return n; }); }(vh)), vh.exports; } var vU = Tl(); const Rs = /* @__PURE__ */ Bs(vU); var yh = { exports: {} }, yU = yh.exports, qk; function wU() { return qk || (qk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(yU, function(n) { return function() { if (typeof ArrayBuffer == "function") { var r = n, i = r.lib, o = i.WordArray, u = o.init, l = o.init = function(f) { if (f instanceof ArrayBuffer && (f = new Uint8Array(f)), (f instanceof Int8Array || typeof Uint8ClampedArray < "u" && f instanceof Uint8ClampedArray || f instanceof Int16Array || f instanceof Uint16Array || f instanceof Int32Array || f instanceof Uint32Array || f instanceof Float32Array || f instanceof Float64Array) && (f = new Uint8Array(f.buffer, f.byteOffset, f.byteLength)), f instanceof Uint8Array) { for (var d = f.byteLength, p = [], v = 0; v < d; v++) p[v >>> 2] |= f[v] << 24 - v % 4 * 8; u.call(this, p, d); } else u.apply(this, arguments); }; l.prototype = o; } }(), n.lib.WordArray; }); }(yh)), yh.exports; } wU(); var wh = { exports: {} }, SU = wh.exports, Hk; function DC() { return Hk || (Hk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(SU, function(n) { return function(r) { var i = n, o = i.lib, u = o.WordArray, l = o.Hasher, f = i.algo, d = [], p = []; (function() { function k(D) { for (var R = r.sqrt(D), L = 2; L <= R; L++) if (!(D % L)) return !1; return !0; } function A(D) { return (D - (D | 0)) * 4294967296 | 0; } for (var E = 2, T = 0; T < 64; ) k(E) && (T < 8 && (d[T] = A(r.pow(E, 1 / 2))), p[T] = A(r.pow(E, 1 / 3)), T++), E++; })(); var v = [], y = f.SHA256 = l.extend({ _doReset: function() { this._hash = new u.init(d.slice(0)); }, _doProcessBlock: function(k, A) { for (var E = this._hash.words, T = E[0], D = E[1], R = E[2], L = E[3], j = E[4], K = E[5], ue = E[6], de = E[7], H = 0; H < 64; H++) { if (H < 16) v[H] = k[A + H] | 0; else { var ve = v[H - 15], Z = (ve << 25 | ve >>> 7) ^ (ve << 14 | ve >>> 18) ^ ve >>> 3, we = v[H - 2], ze = (we << 15 | we >>> 17) ^ (we << 13 | we >>> 19) ^ we >>> 10; v[H] = Z + v[H - 7] + ze + v[H - 16]; } var it = j & K ^ ~j & ue, dt = T & D ^ T & R ^ D & R, ae = (T << 30 | T >>> 2) ^ (T << 19 | T >>> 13) ^ (T << 10 | T >>> 22), be = (j << 26 | j >>> 6) ^ (j << 21 | j >>> 11) ^ (j << 7 | j >>> 25), pe = de + be + it + p[H] + v[H], ce = ae + dt; de = ue, ue = K, K = j, j = L + pe | 0, L = R, R = D, D = T, T = pe + ce | 0; } E[0] = E[0] + T | 0, E[1] = E[1] + D | 0, E[2] = E[2] + R | 0, E[3] = E[3] + L | 0, E[4] = E[4] + j | 0, E[5] = E[5] + K | 0, E[6] = E[6] + ue | 0, E[7] = E[7] + de | 0; }, _doFinalize: function() { var k = this._data, A = k.words, E = this._nDataBytes * 8, T = k.sigBytes * 8; return A[T >>> 5] |= 128 << 24 - T % 32, A[(T + 64 >>> 9 << 4) + 14] = r.floor(E / 4294967296), A[(T + 64 >>> 9 << 4) + 15] = E, k.sigBytes = A.length * 4, this._process(), this._hash; }, clone: function() { var k = l.clone.call(this); return k._hash = this._hash.clone(), k; } }); i.SHA256 = l._createHelper(y), i.HmacSHA256 = l._createHmacHelper(y); }(Math), n.SHA256; }); }(wh)), wh.exports; } var _U = DC(); const FC = /* @__PURE__ */ Bs(_U); var Sh = { exports: {} }, _h = { exports: {} }, bU = _h.exports, Kk; function kU() { return Kk || (Kk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(bU, function(n) { (function() { var r = n, i = r.lib, o = i.Base, u = r.enc, l = u.Utf8, f = r.algo; f.HMAC = o.extend({ /** * Initializes a newly created HMAC. * * @param {Hasher} hasher The hash algorithm to use. * @param {WordArray|string} key The secret key. * * @example * * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); */ init: function(d, p) { d = this._hasher = new d.init(), typeof p == "string" && (p = l.parse(p)); var v = d.blockSize, y = v * 4; p.sigBytes > y && (p = d.finalize(p)), p.clamp(); for (var k = this._oKey = p.clone(), A = this._iKey = p.clone(), E = k.words, T = A.words, D = 0; D < v; D++) E[D] ^= 1549556828, T[D] ^= 909522486; k.sigBytes = A.sigBytes = y, this.reset(); }, /** * Resets this HMAC to its initial state. * * @example * * hmacHasher.reset(); */ reset: function() { var d = this._hasher; d.reset(), d.update(this._iKey); }, /** * Updates this HMAC with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {HMAC} This HMAC instance. * * @example * * hmacHasher.update('message'); * hmacHasher.update(wordArray); */ update: function(d) { return this._hasher.update(d), this; }, /** * Finalizes the HMAC computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The HMAC. * * @example * * var hmac = hmacHasher.finalize(); * var hmac = hmacHasher.finalize('message'); * var hmac = hmacHasher.finalize(wordArray); */ finalize: function(d) { var p = this._hasher, v = p.finalize(d); p.reset(); var y = p.finalize(this._oKey.clone().concat(v)); return y; } }); })(); }); }(_h)), _h.exports; } var EU = Sh.exports, Gk; function AU() { return Gk || (Gk = 1, function(t, e) { (function(n, r, i) { t.exports = r(Tl(), DC(), kU()); })(EU, function(n) { return n.HmacSHA256; }); }(Sh)), Sh.exports; } var CU = AU(); const Yh = /* @__PURE__ */ Bs(CU); var oi; typeof window < "u" && window.crypto && (oi = window.crypto); !oi && typeof window < "u" && window.msCrypto && (oi = window.msCrypto); !oi && typeof global < "u" && global.crypto && (oi = global.crypto); if (!oi && typeof require == "function") try { oi = require("crypto"); } catch { } function xU() { if (oi) { if (typeof oi.getRandomValues == "function") try { return oi.getRandomValues(new Uint32Array(1))[0]; } catch { } if (typeof oi.randomBytes == "function") try { return oi.randomBytes(4).readInt32LE(); } catch { } } throw new Error("Native crypto module could not be used to get secure random number."); } function NU(t) { for (var e = t.words, n = t.sigBytes, r = [], i = 0; i < n; i++) { var o = e[i >>> 2] >>> 24 - i % 4 * 8 & 255; r.push((o >>> 4).toString(16)), r.push((o & 15).toString(16)); } return r.join(""); } var TU = /* @__PURE__ */ function() { function t(n, r) { n = this.words = n || [], r != null ? this.sigBytes = r : this.sigBytes = n.length * 4; } var e = t.prototype; return e.random = function(r) { for (var i = [], o = 0; o < r; o += 4) i.push(xU()); return new t(i, r); }, e.toString = function() { return NU(this); }, t; }(); function ot(t, e) { t != null && this.fromString(t, e); } function cr() { return new ot(null); } var Ds, IU = 244837814094590, Wk = (IU & 16777215) == 15715070; function RU(t, e, n, r, i, o) { for (; --o >= 0; ) { var u = e * this[t++] + n[r] + i; i = Math.floor(u / 67108864), n[r++] = u & 67108863; } return i; } function OU(t, e, n, r, i, o) { for (var u = e & 32767, l = e >> 15; --o >= 0; ) { var f = this[t] & 32767, d = this[t++] >> 15, p = l * f + d * u; f = u * f + ((p & 32767) << 15) + n[r] + (i & 1073741823), i = (f >>> 30) + (p >>> 15) + l * d + (i >>> 30), n[r++] = f & 1073741823; } return i; } function PU(t, e, n, r, i, o) { for (var u = e & 16383, l = e >> 14; --o >= 0; ) { var f = this[t] & 16383, d = this[t++] >> 14, p = l * f + d * u; f = u * f + ((p & 16383) << 14) + n[r] + i, i = (f >> 28) + (p >> 14) + l * d, n[r++] = f & 268435455; } return i; } var Yk = typeof navigator < "u"; Yk && Wk && navigator.appName == "Microsoft Internet Explorer" ? (ot.prototype.am = OU, Ds = 30) : Yk && Wk && navigator.appName != "Netscape" ? (ot.prototype.am = RU, Ds = 26) : (ot.prototype.am = PU, Ds = 28); ot.prototype.DB = Ds; ot.prototype.DM = (1 << Ds) - 1; ot.prototype.DV = 1 << Ds; var x0 = 52; ot.prototype.FV = Math.pow(2, x0); ot.prototype.F1 = x0 - Ds; ot.prototype.F2 = 2 * Ds - x0; var DU = "0123456789abcdefghijklmnopqrstuvwxyz", Np = new Array(), Il, ui; Il = 48; for (ui = 0; ui <= 9; ++ui) Np[Il++] = ui; Il = 97; for (ui = 10; ui < 36; ++ui) Np[Il++] = ui; Il = 65; for (ui = 10; ui < 36; ++ui) Np[Il++] = ui; function Qk(t) { return DU.charAt(t); } function FU(t, e) { var n = Np[t.charCodeAt(e)]; return n ?? -1; } function LU(t) { for (var e = this.t - 1; e >= 0; --e) t[e] = this[e]; t.t = this.t, t.s = this.s; } function UU(t) { this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0; } function N0(t) { var e = cr(); return e.fromInt(t), e; } function MU(t, e) { var n; if (e == 16) n = 4; else if (e == 8) n = 3; else if (e == 2) n = 1; else if (e == 32) n = 5; else if (e == 4) n = 2; else throw new Error("Only radix 2, 4, 8, 16, 32 are supported"); this.t = 0, this.s = 0; for (var r = t.length, i = !1, o = 0; --r >= 0; ) { var u = FU(t, r); if (u < 0) { t.charAt(r) == "-" && (i = !0); continue; } i = !1, o == 0 ? this[this.t++] = u : o + n > this.DB ? (this[this.t - 1] |= (u & (1 << this.DB - o) - 1) << o, this[this.t++] = u >> this.DB - o) : this[this.t - 1] |= u << o, o += n, o >= this.DB && (o -= this.DB); } this.clamp(), i && ot.ZERO.subTo(this, this); } function BU() { for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; ) --this.t; } function jU(t) { if (this.s < 0) return "-" + this.negate().toString(t); var e; if (t == 16) e = 4; else if (t == 8) e = 3; else if (t == 2) e = 1; else if (t == 32) e = 5; else if (t == 4) e = 2; else throw new Error("Only radix 2, 4, 8, 16, 32 are supported"); var n = (1 << e) - 1, r, i = !1, o = "", u = this.t, l = this.DB - u * this.DB % e; if (u-- > 0) for (l < this.DB && (r = this[u] >> l) > 0 && (i = !0, o = Qk(r)); u >= 0; ) l < e ? (r = (this[u] & (1 << l) - 1) << e - l, r |= this[--u] >> (l += this.DB - e)) : (r = this[u] >> (l -= e) & n, l <= 0 && (l += this.DB, --u)), r > 0 && (i = !0), i && (o += Qk(r)); return i ? o : "0"; } function $U() { var t = cr(); return ot.ZERO.subTo(this, t), t; } function VU() { return this.s < 0 ? this.negate() : this; } function zU(t) { var e = this.s - t.s; if (e != 0) return e; var n = this.t; if (e = n - t.t, e != 0) return this.s < 0 ? -e : e; for (; --n >= 0; ) if ((e = this[n] - t[n]) != 0) return e; return 0; } function T0(t) { var e = 1, n; return (n = t >>> 16) != 0 && (t = n, e += 16), (n = t >> 8) != 0 && (t = n, e += 8), (n = t >> 4) != 0 && (t = n, e += 4), (n = t >> 2) != 0 && (t = n, e += 2), (n = t >> 1) != 0 && (t = n, e += 1), e; } function qU() { return this.t <= 0 ? 0 : this.DB * (this.t - 1) + T0(this[this.t - 1] ^ this.s & this.DM); } function HU(t, e) { var n; for (n = this.t - 1; n >= 0; --n) e[n + t] = this[n]; for (n = t - 1; n >= 0; --n) e[n] = 0; e.t = this.t + t, e.s = this.s; } function KU(t, e) { for (var n = t; n < this.t; ++n) e[n - t] = this[n]; e.t = Math.max(this.t - t, 0), e.s = this.s; } function GU(t, e) { var n = t % this.DB, r = this.DB - n, i = (1 << r) - 1, o = Math.floor(t / this.DB), u = this.s << n & this.DM, l; for (l = this.t - 1; l >= 0; --l) e[l + o + 1] = this[l] >> r | u, u = (this[l] & i) << n; for (l = o - 1; l >= 0; --l) e[l] = 0; e[o] = u, e.t = this.t + o + 1, e.s = this.s, e.clamp(); } function WU(t, e) { e.s = this.s; var n = Math.floor(t / this.DB); if (n >= this.t) { e.t = 0; return; } var r = t % this.DB, i = this.DB - r, o = (1 << r) - 1; e[0] = this[n] >> r; for (var u = n + 1; u < this.t; ++u) e[u - n - 1] |= (this[u] & o) << i, e[u - n] = this[u] >> r; r > 0 && (e[this.t - n - 1] |= (this.s & o) << i), e.t = this.t - n, e.clamp(); } function YU(t, e) { for (var n = 0, r = 0, i = Math.min(t.t, this.t); n < i; ) r += this[n] - t[n], e[n++] = r & this.DM, r >>= this.DB; if (t.t < this.t) { for (r -= t.s; n < this.t; ) r += this[n], e[n++] = r & this.DM, r >>= this.DB; r += this.s; } else { for (r += this.s; n < t.t; ) r -= t[n], e[n++] = r & this.DM, r >>= this.DB; r -= t.s; } e.s = r < 0 ? -1 : 0, r < -1 ? e[n++] = this.DV + r : r > 0 && (e[n++] = r), e.t = n, e.clamp(); } function QU(t, e) { var n = this.abs(), r = t.abs(), i = n.t; for (e.t = i + r.t; --i >= 0; ) e[i] = 0; for (i = 0; i < r.t; ++i) e[i + n.t] = n.am(0, r[i], e, i, 0, n.t); e.s = 0, e.clamp(), this.s != t.s && ot.ZERO.subTo(e, e); } function JU(t) { for (var e = this.abs(), n = t.t = 2 * e.t; --n >= 0; ) t[n] = 0; for (n = 0; n < e.t - 1; ++n) { var r = e.am(n, e[n], t, 2 * n, 0, 1); (t[n + e.t] += e.am(n + 1, 2 * e[n], t, 2 * n + 1, r, e.t - n - 1)) >= e.DV && (t[n + e.t] -= e.DV, t[n + e.t + 1] = 1); } t.t > 0 && (t[t.t - 1] += e.am(n, e[n], t, 2 * n, 0, 1)), t.s = 0, t.clamp(); } function XU(t, e, n) { var r = t.abs(); if (!(r.t <= 0)) { var i = this.abs(); if (i.t < r.t) { e?.fromInt(0), n != null && this.copyTo(n); return; } n == null && (n = cr()); var o = cr(), u = this.s, l = t.s, f = this.DB - T0(r[r.t - 1]); f > 0 ? (r.lShiftTo(f, o), i.lShiftTo(f, n)) : (r.copyTo(o), i.copyTo(n)); var d = o.t, p = o[d - 1]; if (p != 0) { var v = p * (1 << this.F1) + (d > 1 ? o[d - 2] >> this.F2 : 0), y = this.FV / v, k = (1 << this.F1) / v, A = 1 << this.F2, E = n.t, T = E - d, D = e ?? cr(); for (o.dlShiftTo(T, D), n.compareTo(D) >= 0 && (n[n.t++] = 1, n.subTo(D, n)), ot.ONE.dlShiftTo(d, D), D.subTo(o, o); o.t < d; ) o[o.t++] = 0; for (; --T >= 0; ) { var R = n[--E] == p ? this.DM : Math.floor(n[E] * y + (n[E - 1] + A) * k); if ((n[E] += o.am(0, R, n, T, 0, d)) < R) for (o.dlShiftTo(T, D), n.subTo(D, n); n[E] < --R; ) n.subTo(D, n); } e != null && (n.drShiftTo(d, e), u != l && ot.ZERO.subTo(e, e)), n.t = d, n.clamp(), f > 0 && n.rShiftTo(f, n), u < 0 && ot.ZERO.subTo(n, n); } } } function ZU(t) { var e = cr(); return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(ot.ZERO) > 0 && t.subTo(e, e), e; } function eM() { if (this.t < 1) return 0; var t = this[0]; if ((t & 1) == 0) return 0; var e = t & 3; return e = e * (2 - (t & 15) * e) & 15, e = e * (2 - (t & 255) * e) & 255, e = e * (2 - ((t & 65535) * e & 65535)) & 65535, e = e * (2 - t * e % this.DV) % this.DV, e > 0 ? this.DV - e : -e; } function tM(t) { return this.compareTo(t) == 0; } function nM(t, e) { for (var n = 0, r = 0, i = Math.min(t.t, this.t); n < i; ) r += this[n] + t[n], e[n++] = r & this.DM, r >>= this.DB; if (t.t < this.t) { for (r += t.s; n < this.t; ) r += this[n], e[n++] = r & this.DM, r >>= this.DB; r += this.s; } else { for (r += this.s; n < t.t; ) r += t[n], e[n++] = r & this.DM, r >>= this.DB; r += t.s; } e.s = r < 0 ? -1 : 0, r > 0 ? e[n++] = r : r < -1 && (e[n++] = this.DV + r), e.t = n, e.clamp(); } function rM(t) { var e = cr(); return this.addTo(t, e), e; } function iM(t) { var e = cr(); return this.subTo(t, e), e; } function oM(t) { var e = cr(); return this.multiplyTo(t, e), e; } function sM(t) { var e = cr(); return this.divRemTo(t, e, null), e; } function Rl(t) { this.m = t, this.mp = t.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t; } function aM(t) { var e = cr(); return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(ot.ZERO) > 0 && this.m.subTo(e, e), e; } function uM(t) { var e = cr(); return t.copyTo(e), this.reduce(e), e; } function lM(t) { for (; t.t <= this.mt2; ) t[t.t++] = 0; for (var e = 0; e < this.m.t; ++e) { var n = t[e] & 32767, r = n * this.mpl + ((n * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM; for (n = e + this.m.t, t[n] += this.m.am(0, r, t, e, 0, this.m.t); t[n] >= t.DV; ) t[n] -= t.DV, t[++n]++; } t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t); } function cM(t, e) { t.squareTo(e), this.reduce(e); } function dM(t, e, n) { t.multiplyTo(e, n), this.reduce(n); } Rl.prototype.convert = aM; Rl.prototype.revert = uM; Rl.prototype.reduce = lM; Rl.prototype.mulTo = dM; Rl.prototype.sqrTo = cM; function fM(t, e, n) { var r = t.bitLength(), i, o = N0(1), u = new Rl(e); if (r <= 0) return o; r < 18 ? i = 1 : r < 48 ? i = 3 : r < 144 ? i = 4 : r < 768 ? i = 5 : i = 6; var l = new Array(), f = 3, d = i - 1, p = (1 << i) - 1; if (l[1] = u.convert(this), i > 1) { var v = cr(); for (u.sqrTo(l[1], v); f <= p; ) l[f] = cr(), u.mulTo(v, l[f - 2], l[f]), f += 2; } var y = t.t - 1, k, A = !0, E = cr(), T; for (r = T0(t[y]) - 1; y >= 0; ) { for (r >= d ? k = t[y] >> r - d & p : (k = (t[y] & (1 << r + 1) - 1) << d - r, y > 0 && (k |= t[y - 1] >> this.DB + r - d)), f = i; (k & 1) == 0; ) k >>= 1, --f; if ((r -= f) < 0 && (r += this.DB, --y), A) l[k].copyTo(o), A = !1; else { for (; f > 1; ) u.sqrTo(o, E), u.sqrTo(E, o), f -= 2; f > 0 ? u.sqrTo(o, E) : (T = o, o = E, E = T), u.mulTo(E, l[k], o); } for (; y >= 0 && (t[y] & 1 << r) == 0; ) u.sqrTo(o, E), T = o, o = E, E = T, --r < 0 && (r = this.DB - 1, --y); } var D = u.revert(o); return n(null, D), D; } ot.prototype.copyTo = LU; ot.prototype.fromInt = UU; ot.prototype.fromString = MU; ot.prototype.clamp = BU; ot.prototype.dlShiftTo = HU; ot.prototype.drShiftTo = KU; ot.prototype.lShiftTo = GU; ot.prototype.rShiftTo = WU; ot.prototype.subTo = YU; ot.prototype.multiplyTo = QU; ot.prototype.squareTo = JU; ot.prototype.divRemTo = XU; ot.prototype.invDigit = eM; ot.prototype.addTo = nM; ot.prototype.toString = jU; ot.prototype.negate = $U; ot.prototype.abs = VU; ot.prototype.compareTo = zU; ot.prototype.bitLength = qU; ot.prototype.mod = ZU; ot.prototype.equals = tM; ot.prototype.add = rM; ot.prototype.subtract = iM; ot.prototype.multiply = oM; ot.prototype.divide = sM; ot.prototype.modPow = fM; ot.ZERO = N0(0); ot.ONE = N0(1); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ function Sv(t) { return ln.Buffer.from(new TU().random(t).toString(), "hex"); } var hM = /^[89a-f]/i, pM = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF", mM = "userAttributes.", Ku = /* @__PURE__ */ function() { function t(n) { this.N = new ot(pM, 16), this.g = new ot("2", 16), this.k = new ot(this.hexHash("" + this.padHex(this.N) + this.padHex(this.g)), 16), this.smallAValue = this.generateRandomSmallA(), this.getLargeAValue(function() { }), this.infoBits = ln.Buffer.from("Caldera Derived Key", "utf8"), this.poolName = n; } var e = t.prototype; return e.getSmallAValue = function() { return this.smallAValue; }, e.getLargeAValue = function(r) { var i = this; this.largeAValue ? r(null, this.largeAValue) : this.calculateA(this.smallAValue, function(o, u) { o && r(o, null), i.largeAValue = u, r(null, i.largeAValue); }); }, e.generateRandomSmallA = function() { var r = Sv(128).toString("hex"), i = new ot(r, 16); return i; }, e.generateRandomString = function() { return Sv(40).toString("base64"); }, e.getRandomPassword = function() { return this.randomPassword; }, e.getSaltDevices = function() { return this.SaltToHashDevices; }, e.getVerifierDevices = function() { return this.verifierDevices; }, e.generateHashDevice = function(r, i, o) { var u = this; this.randomPassword = this.generateRandomString(); var l = "" + r + i + ":" + this.randomPassword, f = this.hash(l), d = Sv(16).toString("hex"); this.SaltToHashDevices = this.padHex(new ot(d, 16)), this.g.modPow(new ot(this.hexHash(this.SaltToHashDevices + f), 16), this.N, function(p, v) { p && o(p, null), u.verifierDevices = u.padHex(v), o(null, null); }); }, e.calculateA = function(r, i) { var o = this; this.g.modPow(r, this.N, function(u, l) { u && i(u, null), l.mod(o.N).equals(ot.ZERO) && i(new Error("Illegal paramater. A mod N cannot be 0."), null), i(null, l); }); }, e.calculateU = function(r, i) { this.UHexHash = this.hexHash(this.padHex(r) + this.padHex(i)); var o = new ot(this.UHexHash, 16); return o; }, e.hash = function(r) { var i = r instanceof ln.Buffer ? Rs.lib.WordArray.create(r) : r, o = FC(i).toString(); return new Array(64 - o.length).join("0") + o; }, e.hexHash = function(r) { return this.hash(ln.Buffer.from(r, "hex")); }, e.computehkdf = function(r, i) { var o = Rs.lib.WordArray.create(ln.Buffer.concat([this.infoBits, ln.Buffer.from("", "utf8")])), u = r instanceof ln.Buffer ? Rs.lib.WordArray.create(r) : r, l = i instanceof ln.Buffer ? Rs.lib.WordArray.create(i) : i, f = Yh(u, l), d = Yh(o, f); return ln.Buffer.from(d.toString(), "hex").slice(0, 16); }, e.getPasswordAuthenticationKey = function(r, i, o, u, l) { var f = this; if (o.mod(this.N).equals(ot.ZERO)) throw new Error("B cannot be zero."); if (this.UValue = this.calculateU(this.largeAValue, o), this.UValue.equals(ot.ZERO)) throw new Error("U cannot be zero."); var d = "" + this.poolName + r + ":" + i, p = this.hash(d), v = new ot(this.hexHash(this.padHex(u) + p), 16); this.calculateS(v, o, function(y, k) { y && l(y, null); var A = f.computehkdf(ln.Buffer.from(f.padHex(k), "hex"), ln.Buffer.from(f.padHex(f.UValue), "hex")); l(null, A); }); }, e.calculateS = function(r, i, o) { var u = this; this.g.modPow(r, this.N, function(l, f) { l && o(l, null); var d = i.subtract(u.k.multiply(f)); d.modPow(u.smallAValue.add(u.UValue.multiply(r)), u.N, function(p, v) { p && o(p, null), o(null, v.mod(u.N)); }); }); }, e.getNewPasswordRequiredChallengeUserAttributePrefix = function() { return mM; }, e.padHex = function(r) { if (!(r instanceof ot)) throw new Error("Not a BigInteger"); var i = r.compareTo(ot.ZERO) < 0, o = r.abs().toString(16); if (o = o.length % 2 !== 0 ? "0" + o : o, o = hM.test(o) ? "00" + o : o, i) { var u = o.split("").map(function(f) { var d = ~parseInt(f, 16) & 15; return "0123456789ABCDEF".charAt(d); }).join(""), l = new ot(u, 16).add(ot.ONE); o = l.toString(16), o.toUpperCase().startsWith("FF8") && (o = o.substring(2)); } return o; }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var LC = /* @__PURE__ */ function() { function t(n) { this.jwtToken = n || "", this.payload = this.decodePayload(); } var e = t.prototype; return e.getJwtToken = function() { return this.jwtToken; }, e.getExpiration = function() { return this.payload.exp; }, e.getIssuedAt = function() { return this.payload.iat; }, e.decodePayload = function() { var r = this.jwtToken.split(".")[1]; try { return JSON.parse(ln.Buffer.from(r, "base64").toString("utf8")); } catch { return {}; } }, t; }(); function gM(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, yy(t, e); } function yy(t, e) { return yy = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, yy(t, e); } var wy = /* @__PURE__ */ function(t) { gM(e, t); function e(n) { var r = n === void 0 ? {} : n, i = r.AccessToken; return t.call(this, i || "") || this; } return e; }(LC); function vM(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Sy(t, e); } function Sy(t, e) { return Sy = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, Sy(t, e); } var _y = /* @__PURE__ */ function(t) { vM(e, t); function e(n) { var r = n === void 0 ? {} : n, i = r.IdToken; return t.call(this, i || "") || this; } return e; }(LC); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var by = /* @__PURE__ */ function() { function t(n) { var r = n === void 0 ? {} : n, i = r.RefreshToken; this.token = i || ""; } var e = t.prototype; return e.getToken = function() { return this.token; }, t; }(), bh = { exports: {} }, yM = bh.exports, Jk; function wM() { return Jk || (Jk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(yM, function(n) { return function() { var r = n, i = r.lib, o = i.WordArray, u = r.enc; u.Base64 = { /** * Converts a word array to a Base64 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Base64 string. * * @static * * @example * * var base64String = CryptoJS.enc.Base64.stringify(wordArray); */ stringify: function(f) { var d = f.words, p = f.sigBytes, v = this._map; f.clamp(); for (var y = [], k = 0; k < p; k += 3) for (var A = d[k >>> 2] >>> 24 - k % 4 * 8 & 255, E = d[k + 1 >>> 2] >>> 24 - (k + 1) % 4 * 8 & 255, T = d[k + 2 >>> 2] >>> 24 - (k + 2) % 4 * 8 & 255, D = A << 16 | E << 8 | T, R = 0; R < 4 && k + R * 0.75 < p; R++) y.push(v.charAt(D >>> 6 * (3 - R) & 63)); var L = v.charAt(64); if (L) for (; y.length % 4; ) y.push(L); return y.join(""); }, /** * Converts a Base64 string to a word array. * * @param {string} base64Str The Base64 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Base64.parse(base64String); */ parse: function(f) { var d = f.length, p = this._map, v = this._reverseMap; if (!v) { v = this._reverseMap = []; for (var y = 0; y < p.length; y++) v[p.charCodeAt(y)] = y; } var k = p.charAt(64); if (k) { var A = f.indexOf(k); A !== -1 && (d = A); } return l(f, d, v); }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" }; function l(f, d, p) { for (var v = [], y = 0, k = 0; k < d; k++) if (k % 4) { var A = p[f.charCodeAt(k - 1)] << k % 4 * 2, E = p[f.charCodeAt(k)] >>> 6 - k % 4 * 2, T = A | E; v[y >>> 2] |= T << 24 - y % 4 * 8, y++; } return o.create(v, y); } }(), n.enc.Base64; }); }(bh)), bh.exports; } var SM = wM(); const ky = /* @__PURE__ */ Bs(SM); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Ey = /* @__PURE__ */ function() { function t(n) { var r = n === void 0 ? {} : n, i = r.IdToken, o = r.RefreshToken, u = r.AccessToken, l = r.ClockDrift; if (u == null || i == null) throw new Error("Id token and Access Token must be present."); this.idToken = i, this.refreshToken = o, this.accessToken = u, this.clockDrift = l === void 0 ? this.calculateClockDrift() : l; } var e = t.prototype; return e.getIdToken = function() { return this.idToken; }, e.getRefreshToken = function() { return this.refreshToken; }, e.getAccessToken = function() { return this.accessToken; }, e.getClockDrift = function() { return this.clockDrift; }, e.calculateClockDrift = function() { var r = Math.floor(/* @__PURE__ */ new Date() / 1e3), i = Math.min(this.accessToken.getIssuedAt(), this.idToken.getIssuedAt()); return r - i; }, e.isValid = function() { var r = Math.floor(/* @__PURE__ */ new Date() / 1e3), i = r - this.clockDrift; return i < this.accessToken.getExpiration() && i < this.idToken.getExpiration(); }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var _M = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], bM = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], Xk = /* @__PURE__ */ function() { function t() { } var e = t.prototype; return e.getNowString = function() { var r = /* @__PURE__ */ new Date(), i = bM[r.getUTCDay()], o = _M[r.getUTCMonth()], u = r.getUTCDate(), l = r.getUTCHours(); l < 10 && (l = "0" + l); var f = r.getUTCMinutes(); f < 10 && (f = "0" + f); var d = r.getUTCSeconds(); d < 10 && (d = "0" + d); var p = r.getUTCFullYear(), v = i + " " + o + " " + u + " " + l + ":" + f + ":" + d + " UTC " + p; return v; }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Ju = /* @__PURE__ */ function() { function t(n) { var r = n === void 0 ? {} : n, i = r.Name, o = r.Value; this.Name = i || "", this.Value = o || ""; } var e = t.prototype; return e.getValue = function() { return this.Value; }, e.setValue = function(r) { return this.Value = r, this; }, e.getName = function() { return this.Name; }, e.setName = function(r) { return this.Name = r, this; }, e.toString = function() { return JSON.stringify(this); }, e.toJSON = function() { return { Name: this.Name, Value: this.Value }; }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Ea = {}, kM = /* @__PURE__ */ function() { function t() { } return t.setItem = function(n, r) { return Ea[n] = r, Ea[n]; }, t.getItem = function(n) { return Object.prototype.hasOwnProperty.call(Ea, n) ? Ea[n] : void 0; }, t.removeItem = function(n) { return delete Ea[n]; }, t.clear = function() { return Ea = {}, Ea; }, t; }(), UC = /* @__PURE__ */ function() { function t() { try { this.storageWindow = window.localStorage, this.storageWindow.setItem("aws.cognito.test-ls", 1), this.storageWindow.removeItem("aws.cognito.test-ls"); } catch { this.storageWindow = kM; } } var e = t.prototype; return e.getStorage = function() { return this.storageWindow; }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var EM = typeof navigator < "u", Zk = EM ? navigator.userAgent : "nodejs", Ay = /* @__PURE__ */ function() { function t(n) { if (n == null || n.Username == null || n.Pool == null) throw new Error("Username and Pool information are required."); this.username = n.Username || "", this.pool = n.Pool, this.Session = null, this.client = n.Pool.client, this.signInUserSession = null, this.authenticationFlowType = "USER_SRP_AUTH", this.storage = n.Storage || new UC().getStorage(), this.keyPrefix = "CognitoIdentityServiceProvider." + this.pool.getClientId(), this.userDataKey = this.keyPrefix + "." + this.username + ".userData"; } var e = t.prototype; return e.setSignInUserSession = function(r) { this.clearCachedUserData(), this.signInUserSession = r, this.cacheTokens(); }, e.getSignInUserSession = function() { return this.signInUserSession; }, e.getUsername = function() { return this.username; }, e.getAuthenticationFlowType = function() { return this.authenticationFlowType; }, e.setAuthenticationFlowType = function(r) { this.authenticationFlowType = r; }, e.initiateAuth = function(r, i) { var o = this, u = r.getAuthParameters(); u.USERNAME = this.username; var l = Object.keys(r.getValidationData()).length !== 0 ? r.getValidationData() : r.getClientMetadata(), f = { AuthFlow: "CUSTOM_AUTH", ClientId: this.pool.getClientId(), AuthParameters: u, ClientMetadata: l }; this.getUserContextData() && (f.UserContextData = this.getUserContextData()), this.client.request("InitiateAuth", f, function(d, p) { if (d) return i.onFailure(d); var v = p.ChallengeName, y = p.ChallengeParameters; return v === "CUSTOM_CHALLENGE" ? (o.Session = p.Session, i.customChallenge(y)) : (o.signInUserSession = o.getCognitoUserSession(p.AuthenticationResult), o.cacheTokens(), i.onSuccess(o.signInUserSession)); }); }, e.authenticateUser = function(r, i) { return this.authenticationFlowType === "USER_PASSWORD_AUTH" ? this.authenticateUserPlainUsernamePassword(r, i) : this.authenticationFlowType === "USER_SRP_AUTH" || this.authenticationFlowType === "CUSTOM_AUTH" ? this.authenticateUserDefaultAuth(r, i) : i.onFailure(new Error("Authentication flow type is invalid.")); }, e.authenticateUserDefaultAuth = function(r, i) { var o = this, u = new Ku(this.pool.getUserPoolName()), l = new Xk(), f, d, p = {}; this.deviceKey != null && (p.DEVICE_KEY = this.deviceKey), p.USERNAME = this.username, u.getLargeAValue(function(v, y) { v && i.onFailure(v), p.SRP_A = y.toString(16), o.authenticationFlowType === "CUSTOM_AUTH" && (p.CHALLENGE_NAME = "SRP_A"); var k = Object.keys(r.getValidationData()).length !== 0 ? r.getValidationData() : r.getClientMetadata(), A = { AuthFlow: o.authenticationFlowType, ClientId: o.pool.getClientId(), AuthParameters: p, ClientMetadata: k }; o.getUserContextData(o.username) && (A.UserContextData = o.getUserContextData(o.username)), o.client.request("InitiateAuth", A, function(E, T) { if (E) return i.onFailure(E); var D = T.ChallengeParameters; o.username = D.USER_ID_FOR_SRP, o.userDataKey = o.keyPrefix + "." + o.username + ".userData", f = new ot(D.SRP_B, 16), d = new ot(D.SALT, 16), o.getCachedDeviceKeyAndPassword(), u.getPasswordAuthenticationKey(o.username, r.getPassword(), f, d, function(R, L) { R && i.onFailure(R); var j = l.getNowString(), K = Rs.lib.WordArray.create(ln.Buffer.concat([ln.Buffer.from(o.pool.getUserPoolName(), "utf8"), ln.Buffer.from(o.username, "utf8"), ln.Buffer.from(D.SECRET_BLOCK, "base64"), ln.Buffer.from(j, "utf8")])), ue = Rs.lib.WordArray.create(L), de = ky.stringify(Yh(K, ue)), H = {}; H.USERNAME = o.username, H.PASSWORD_CLAIM_SECRET_BLOCK = D.SECRET_BLOCK, H.TIMESTAMP = j, H.PASSWORD_CLAIM_SIGNATURE = de, o.deviceKey != null && (H.DEVICE_KEY = o.deviceKey); var ve = function we(ze, it) { return o.client.request("RespondToAuthChallenge", ze, function(dt, ae) { return dt && dt.code === "ResourceNotFoundException" && dt.message.toLowerCase().indexOf("device") !== -1 ? (H.DEVICE_KEY = null, o.deviceKey = null, o.randomPassword = null, o.deviceGroupKey = null, o.clearCachedDeviceKeyAndPassword(), we(ze, it)) : it(dt, ae); }); }, Z = { ChallengeName: "PASSWORD_VERIFIER", ClientId: o.pool.getClientId(), ChallengeResponses: H, Session: T.Session, ClientMetadata: k }; o.getUserContextData() && (Z.UserContextData = o.getUserContextData()), ve(Z, function(we, ze) { return we ? i.onFailure(we) : o.authenticateUserInternal(ze, u, i); }); }); }); }); }, e.authenticateUserPlainUsernamePassword = function(r, i) { var o = this, u = {}; if (u.USERNAME = this.username, u.PASSWORD = r.getPassword(), !u.PASSWORD) { i.onFailure(new Error("PASSWORD parameter is required")); return; } var l = new Ku(this.pool.getUserPoolName()); this.getCachedDeviceKeyAndPassword(), this.deviceKey != null && (u.DEVICE_KEY = this.deviceKey); var f = Object.keys(r.getValidationData()).length !== 0 ? r.getValidationData() : r.getClientMetadata(), d = { AuthFlow: "USER_PASSWORD_AUTH", ClientId: this.pool.getClientId(), AuthParameters: u, ClientMetadata: f }; this.getUserContextData(this.username) && (d.UserContextData = this.getUserContextData(this.username)), this.client.request("InitiateAuth", d, function(p, v) { return p ? i.onFailure(p) : o.authenticateUserInternal(v, l, i); }); }, e.authenticateUserInternal = function(r, i, o) { var u = this, l = r.ChallengeName, f = r.ChallengeParameters; if (l === "SMS_MFA") return this.Session = r.Session, o.mfaRequired(l, f); if (l === "SELECT_MFA_TYPE") return this.Session = r.Session, o.selectMFAType(l, f); if (l === "MFA_SETUP") return this.Session = r.Session, o.mfaSetup(l, f); if (l === "SOFTWARE_TOKEN_MFA") return this.Session = r.Session, o.totpRequired(l, f); if (l === "CUSTOM_CHALLENGE") return this.Session = r.Session, o.customChallenge(f); if (l === "NEW_PASSWORD_REQUIRED") { this.Session = r.Session; var d = null, p = null, v = [], y = i.getNewPasswordRequiredChallengeUserAttributePrefix(); if (f && (d = JSON.parse(r.ChallengeParameters.userAttributes), p = JSON.parse(r.ChallengeParameters.requiredAttributes)), p) for (var k = 0; k < p.length; k++) v[k] = p[k].substr(y.length); return o.newPasswordRequired(d, v); } if (l === "DEVICE_SRP_AUTH") { this.Session = r.Session, this.getDeviceResponse(o); return; } this.signInUserSession = this.getCognitoUserSession(r.AuthenticationResult), this.challengeName = l, this.cacheTokens(); var A = r.AuthenticationResult.NewDeviceMetadata; if (A == null) return o.onSuccess(this.signInUserSession); i.generateHashDevice(r.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, r.AuthenticationResult.NewDeviceMetadata.DeviceKey, function(E) { if (E) return o.onFailure(E); var T = { Salt: ln.Buffer.from(i.getSaltDevices(), "hex").toString("base64"), PasswordVerifier: ln.Buffer.from(i.getVerifierDevices(), "hex").toString("base64") }; u.verifierDevices = T.PasswordVerifier, u.deviceGroupKey = A.DeviceGroupKey, u.randomPassword = i.getRandomPassword(), u.client.request("ConfirmDevice", { DeviceKey: A.DeviceKey, AccessToken: u.signInUserSession.getAccessToken().getJwtToken(), DeviceSecretVerifierConfig: T, DeviceName: Zk }, function(D, R) { return D ? o.onFailure(D) : (u.deviceKey = r.AuthenticationResult.NewDeviceMetadata.DeviceKey, u.cacheDeviceKeyAndPassword(), R.UserConfirmationNecessary === !0 ? o.onSuccess(u.signInUserSession, R.UserConfirmationNecessary) : o.onSuccess(u.signInUserSession)); }); }); }, e.completeNewPasswordChallenge = function(r, i, o, u) { var l = this; if (!r) return o.onFailure(new Error("New password is required.")); var f = new Ku(this.pool.getUserPoolName()), d = f.getNewPasswordRequiredChallengeUserAttributePrefix(), p = {}; i && Object.keys(i).forEach(function(y) { p[d + y] = i[y]; }), p.NEW_PASSWORD = r, p.USERNAME = this.username; var v = { ChallengeName: "NEW_PASSWORD_REQUIRED", ClientId: this.pool.getClientId(), ChallengeResponses: p, Session: this.Session, ClientMetadata: u }; this.getUserContextData() && (v.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", v, function(y, k) { return y ? o.onFailure(y) : l.authenticateUserInternal(k, f, o); }); }, e.getDeviceResponse = function(r, i) { var o = this, u = new Ku(this.deviceGroupKey), l = new Xk(), f = {}; f.USERNAME = this.username, f.DEVICE_KEY = this.deviceKey, u.getLargeAValue(function(d, p) { d && r.onFailure(d), f.SRP_A = p.toString(16); var v = { ChallengeName: "DEVICE_SRP_AUTH", ClientId: o.pool.getClientId(), ChallengeResponses: f, ClientMetadata: i, Session: o.Session }; o.getUserContextData() && (v.UserContextData = o.getUserContextData()), o.client.request("RespondToAuthChallenge", v, function(y, k) { if (y) return r.onFailure(y); var A = k.ChallengeParameters, E = new ot(A.SRP_B, 16), T = new ot(A.SALT, 16); u.getPasswordAuthenticationKey(o.deviceKey, o.randomPassword, E, T, function(D, R) { if (D) return r.onFailure(D); var L = l.getNowString(), j = Rs.lib.WordArray.create(ln.Buffer.concat([ln.Buffer.from(o.deviceGroupKey, "utf8"), ln.Buffer.from(o.deviceKey, "utf8"), ln.Buffer.from(A.SECRET_BLOCK, "base64"), ln.Buffer.from(L, "utf8")])), K = Rs.lib.WordArray.create(R), ue = ky.stringify(Yh(j, K)), de = {}; de.USERNAME = o.username, de.PASSWORD_CLAIM_SECRET_BLOCK = A.SECRET_BLOCK, de.TIMESTAMP = L, de.PASSWORD_CLAIM_SIGNATURE = ue, de.DEVICE_KEY = o.deviceKey; var H = { ChallengeName: "DEVICE_PASSWORD_VERIFIER", ClientId: o.pool.getClientId(), ChallengeResponses: de, Session: k.Session }; o.getUserContextData() && (H.UserContextData = o.getUserContextData()), o.client.request("RespondToAuthChallenge", H, function(ve, Z) { return ve ? r.onFailure(ve) : (o.signInUserSession = o.getCognitoUserSession(Z.AuthenticationResult), o.cacheTokens(), r.onSuccess(o.signInUserSession)); }); }); }); }); }, e.confirmRegistration = function(r, i, o, u) { var l = { ClientId: this.pool.getClientId(), ConfirmationCode: r, Username: this.username, ForceAliasCreation: i, ClientMetadata: u }; this.getUserContextData() && (l.UserContextData = this.getUserContextData()), this.client.request("ConfirmSignUp", l, function(f) { return f ? o(f, null) : o(null, "SUCCESS"); }); }, e.sendCustomChallengeAnswer = function(r, i, o) { var u = this, l = {}; l.USERNAME = this.username, l.ANSWER = r; var f = new Ku(this.pool.getUserPoolName()); this.getCachedDeviceKeyAndPassword(), this.deviceKey != null && (l.DEVICE_KEY = this.deviceKey); var d = { ChallengeName: "CUSTOM_CHALLENGE", ChallengeResponses: l, ClientId: this.pool.getClientId(), Session: this.Session, ClientMetadata: o }; this.getUserContextData() && (d.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", d, function(p, v) { return p ? i.onFailure(p) : u.authenticateUserInternal(v, f, i); }); }, e.sendMFACode = function(r, i, o, u) { var l = this, f = {}; f.USERNAME = this.username, f.SMS_MFA_CODE = r; var d = o || "SMS_MFA"; d === "SOFTWARE_TOKEN_MFA" && (f.SOFTWARE_TOKEN_MFA_CODE = r), this.deviceKey != null && (f.DEVICE_KEY = this.deviceKey); var p = { ChallengeName: d, ChallengeResponses: f, ClientId: this.pool.getClientId(), Session: this.Session, ClientMetadata: u }; this.getUserContextData() && (p.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", p, function(v, y) { if (v) return i.onFailure(v); var k = y.ChallengeName; if (k === "DEVICE_SRP_AUTH") { l.getDeviceResponse(i); return; } if (l.signInUserSession = l.getCognitoUserSession(y.AuthenticationResult), l.cacheTokens(), y.AuthenticationResult.NewDeviceMetadata == null) return i.onSuccess(l.signInUserSession); var A = new Ku(l.pool.getUserPoolName()); A.generateHashDevice(y.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, y.AuthenticationResult.NewDeviceMetadata.DeviceKey, function(E) { if (E) return i.onFailure(E); var T = { Salt: ln.Buffer.from(A.getSaltDevices(), "hex").toString("base64"), PasswordVerifier: ln.Buffer.from(A.getVerifierDevices(), "hex").toString("base64") }; l.verifierDevices = T.PasswordVerifier, l.deviceGroupKey = y.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, l.randomPassword = A.getRandomPassword(), l.client.request("ConfirmDevice", { DeviceKey: y.AuthenticationResult.NewDeviceMetadata.DeviceKey, AccessToken: l.signInUserSession.getAccessToken().getJwtToken(), DeviceSecretVerifierConfig: T, DeviceName: Zk }, function(D, R) { return D ? i.onFailure(D) : (l.deviceKey = y.AuthenticationResult.NewDeviceMetadata.DeviceKey, l.cacheDeviceKeyAndPassword(), R.UserConfirmationNecessary === !0 ? i.onSuccess(l.signInUserSession, R.UserConfirmationNecessary) : i.onSuccess(l.signInUserSession)); }); }); }); }, e.changePassword = function(r, i, o, u) { if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return o(new Error("User is not authenticated"), null); this.client.request("ChangePassword", { PreviousPassword: r, ProposedPassword: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), ClientMetadata: u }, function(l) { return l ? o(l, null) : o(null, "SUCCESS"); }); }, e.enableMFA = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r(new Error("User is not authenticated"), null); var i = [], o = { DeliveryMedium: "SMS", AttributeName: "phone_number" }; i.push(o), this.client.request("SetUserSettings", { MFAOptions: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(u) { return u ? r(u, null) : r(null, "SUCCESS"); }); }, e.setUserMfaPreference = function(r, i, o) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return o(new Error("User is not authenticated"), null); this.client.request("SetUserMFAPreference", { SMSMfaSettings: r, SoftwareTokenMfaSettings: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(u) { return u ? o(u, null) : o(null, "SUCCESS"); }); }, e.disableMFA = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r(new Error("User is not authenticated"), null); var i = []; this.client.request("SetUserSettings", { MFAOptions: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(o) { return o ? r(o, null) : r(null, "SUCCESS"); }); }, e.deleteUser = function(r, i) { var o = this; if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r(new Error("User is not authenticated"), null); this.client.request("DeleteUser", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), ClientMetadata: i }, function(u) { return u ? r(u, null) : (o.clearCachedUser(), r(null, "SUCCESS")); }); }, e.updateAttributes = function(r, i, o) { var u = this; if (this.signInUserSession == null || !this.signInUserSession.isValid()) return i(new Error("User is not authenticated"), null); this.client.request("UpdateUserAttributes", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), UserAttributes: r, ClientMetadata: o }, function(l) { return l ? i(l, null) : u.getUserData(function() { return i(null, "SUCCESS"); }, { bypassCache: !0 }); }); }, e.getUserAttributes = function(r) { if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return r(new Error("User is not authenticated"), null); this.client.request("GetUser", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(i, o) { if (i) return r(i, null); for (var u = [], l = 0; l < o.UserAttributes.length; l++) { var f = { Name: o.UserAttributes[l].Name, Value: o.UserAttributes[l].Value }, d = new Ju(f); u.push(d); } return r(null, u); }); }, e.getMFAOptions = function(r) { if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return r(new Error("User is not authenticated"), null); this.client.request("GetUser", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(i, o) { return i ? r(i, null) : r(null, o.MFAOptions); }); }, e.createGetUserRequest = function() { return this.client.promisifyRequest("GetUser", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }); }, e.refreshSessionIfPossible = function(r) { var i = this; return r === void 0 && (r = {}), new Promise(function(o) { var u = i.signInUserSession.getRefreshToken(); u && u.getToken() ? i.refreshSession(u, o, r.clientMetadata) : o(); }); }, e.getUserData = function(r, i) { var o = this; if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return this.clearCachedUserData(), r(new Error("User is not authenticated"), null); var u = this.getUserDataFromCache(); if (!u) { this.fetchUserData().then(function(l) { r(null, l); }).catch(r); return; } if (this.isFetchUserDataAndTokenRequired(i)) { this.fetchUserData().then(function(l) { return o.refreshSessionIfPossible(i).then(function() { return l; }); }).then(function(l) { return r(null, l); }).catch(r); return; } try { r(null, JSON.parse(u)); return; } catch (l) { this.clearCachedUserData(), r(l, null); return; } }, e.getUserDataFromCache = function() { var r = this.storage.getItem(this.userDataKey); return r; }, e.isFetchUserDataAndTokenRequired = function(r) { var i = r || {}, o = i.bypassCache, u = o === void 0 ? !1 : o; return u; }, e.fetchUserData = function() { var r = this; return this.createGetUserRequest().then(function(i) { return r.cacheUserData(i), i; }); }, e.deleteAttributes = function(r, i) { var o = this; if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return i(new Error("User is not authenticated"), null); this.client.request("DeleteUserAttributes", { UserAttributeNames: r, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(u) { return u ? i(u, null) : o.getUserData(function() { return i(null, "SUCCESS"); }, { bypassCache: !0 }); }); }, e.resendConfirmationCode = function(r, i) { var o = { ClientId: this.pool.getClientId(), Username: this.username, ClientMetadata: i }; this.client.request("ResendConfirmationCode", o, function(u, l) { return u ? r(u, null) : r(null, l); }); }, e.getSession = function(r, i) { if (i === void 0 && (i = {}), this.username == null) return r(new Error("Username is null. Cannot retrieve a new session"), null); if (this.signInUserSession != null && this.signInUserSession.isValid()) return r(null, this.signInUserSession); var o = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, u = o + ".idToken", l = o + ".accessToken", f = o + ".refreshToken", d = o + ".clockDrift"; if (this.storage.getItem(u)) { var p = new _y({ IdToken: this.storage.getItem(u) }), v = new wy({ AccessToken: this.storage.getItem(l) }), y = new by({ RefreshToken: this.storage.getItem(f) }), k = parseInt(this.storage.getItem(d), 0) || 0, A = { IdToken: p, AccessToken: v, RefreshToken: y, ClockDrift: k }, E = new Ey(A); if (E.isValid()) return this.signInUserSession = E, r(null, this.signInUserSession); if (!y.getToken()) return r(new Error("Cannot retrieve a new session. Please authenticate."), null); this.refreshSession(y, r, i.clientMetadata); } else r(new Error("Local storage is missing an ID Token, Please authenticate"), null); }, e.refreshSession = function(r, i, o) { var u = this, l = this.pool.wrapRefreshSessionCallback ? this.pool.wrapRefreshSessionCallback(i) : i, f = {}; f.REFRESH_TOKEN = r.getToken(); var d = "CognitoIdentityServiceProvider." + this.pool.getClientId(), p = d + ".LastAuthUser"; if (this.storage.getItem(p)) { this.username = this.storage.getItem(p); var v = d + "." + this.username + ".deviceKey"; this.deviceKey = this.storage.getItem(v), f.DEVICE_KEY = this.deviceKey; } var y = { ClientId: this.pool.getClientId(), AuthFlow: "REFRESH_TOKEN_AUTH", AuthParameters: f, ClientMetadata: o }; this.getUserContextData() && (y.UserContextData = this.getUserContextData()), this.client.request("InitiateAuth", y, function(k, A) { if (k) return k.code === "NotAuthorizedException" && u.clearCachedUser(), l(k, null); if (A) { var E = A.AuthenticationResult; return Object.prototype.hasOwnProperty.call(E, "RefreshToken") || (E.RefreshToken = r.getToken()), u.signInUserSession = u.getCognitoUserSession(E), u.cacheTokens(), l(null, u.signInUserSession); } }); }, e.cacheTokens = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId(), i = r + "." + this.username + ".idToken", o = r + "." + this.username + ".accessToken", u = r + "." + this.username + ".refreshToken", l = r + "." + this.username + ".clockDrift", f = r + ".LastAuthUser"; this.storage.setItem(i, this.signInUserSession.getIdToken().getJwtToken()), this.storage.setItem(o, this.signInUserSession.getAccessToken().getJwtToken()), this.storage.setItem(u, this.signInUserSession.getRefreshToken().getToken()), this.storage.setItem(l, "" + this.signInUserSession.getClockDrift()), this.storage.setItem(f, this.username); }, e.cacheUserData = function(r) { this.storage.setItem(this.userDataKey, JSON.stringify(r)); }, e.clearCachedUserData = function() { this.storage.removeItem(this.userDataKey); }, e.clearCachedUser = function() { this.clearCachedTokens(), this.clearCachedUserData(); }, e.cacheDeviceKeyAndPassword = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, i = r + ".deviceKey", o = r + ".randomPasswordKey", u = r + ".deviceGroupKey"; this.storage.setItem(i, this.deviceKey), this.storage.setItem(o, this.randomPassword), this.storage.setItem(u, this.deviceGroupKey); }, e.getCachedDeviceKeyAndPassword = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, i = r + ".deviceKey", o = r + ".randomPasswordKey", u = r + ".deviceGroupKey"; this.storage.getItem(i) && (this.deviceKey = this.storage.getItem(i), this.randomPassword = this.storage.getItem(o), this.deviceGroupKey = this.storage.getItem(u)); }, e.clearCachedDeviceKeyAndPassword = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, i = r + ".deviceKey", o = r + ".randomPasswordKey", u = r + ".deviceGroupKey"; this.storage.removeItem(i), this.storage.removeItem(o), this.storage.removeItem(u); }, e.clearCachedTokens = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId(), i = r + "." + this.username + ".idToken", o = r + "." + this.username + ".accessToken", u = r + "." + this.username + ".refreshToken", l = r + ".LastAuthUser", f = r + "." + this.username + ".clockDrift"; this.storage.removeItem(i), this.storage.removeItem(o), this.storage.removeItem(u), this.storage.removeItem(l), this.storage.removeItem(f); }, e.getCognitoUserSession = function(r) { var i = new _y(r), o = new wy(r), u = new by(r), l = { IdToken: i, AccessToken: o, RefreshToken: u }; return new Ey(l); }, e.forgotPassword = function(r, i) { var o = { ClientId: this.pool.getClientId(), Username: this.username, ClientMetadata: i }; this.getUserContextData() && (o.UserContextData = this.getUserContextData()), this.client.request("ForgotPassword", o, function(u, l) { return u ? r.onFailure(u) : typeof r.inputVerificationCode == "function" ? r.inputVerificationCode(l) : r.onSuccess(l); }); }, e.confirmPassword = function(r, i, o, u) { var l = { ClientId: this.pool.getClientId(), Username: this.username, ConfirmationCode: r, Password: i, ClientMetadata: u }; this.getUserContextData() && (l.UserContextData = this.getUserContextData()), this.client.request("ConfirmForgotPassword", l, function(f) { return f ? o.onFailure(f) : o.onSuccess("SUCCESS"); }); }, e.getAttributeVerificationCode = function(r, i, o) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return i.onFailure(new Error("User is not authenticated")); this.client.request("GetUserAttributeVerificationCode", { AttributeName: r, AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), ClientMetadata: o }, function(u, l) { return u ? i.onFailure(u) : typeof i.inputVerificationCode == "function" ? i.inputVerificationCode(l) : i.onSuccess("SUCCESS"); }); }, e.verifyAttribute = function(r, i, o) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return o.onFailure(new Error("User is not authenticated")); this.client.request("VerifyUserAttribute", { AttributeName: r, Code: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(u) { return u ? o.onFailure(u) : o.onSuccess("SUCCESS"); }); }, e.getDevice = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r.onFailure(new Error("User is not authenticated")); this.client.request("GetDevice", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), DeviceKey: this.deviceKey }, function(i, o) { return i ? r.onFailure(i) : r.onSuccess(o); }); }, e.forgetSpecificDevice = function(r, i) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return i.onFailure(new Error("User is not authenticated")); this.client.request("ForgetDevice", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), DeviceKey: r }, function(o) { return o ? i.onFailure(o) : i.onSuccess("SUCCESS"); }); }, e.forgetDevice = function(r) { var i = this; this.forgetSpecificDevice(this.deviceKey, { onFailure: r.onFailure, onSuccess: function(u) { return i.deviceKey = null, i.deviceGroupKey = null, i.randomPassword = null, i.clearCachedDeviceKeyAndPassword(), r.onSuccess(u); } }); }, e.setDeviceStatusRemembered = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r.onFailure(new Error("User is not authenticated")); this.client.request("UpdateDeviceStatus", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), DeviceKey: this.deviceKey, DeviceRememberedStatus: "remembered" }, function(i) { return i ? r.onFailure(i) : r.onSuccess("SUCCESS"); }); }, e.setDeviceStatusNotRemembered = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r.onFailure(new Error("User is not authenticated")); this.client.request("UpdateDeviceStatus", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), DeviceKey: this.deviceKey, DeviceRememberedStatus: "not_remembered" }, function(i) { return i ? r.onFailure(i) : r.onSuccess("SUCCESS"); }); }, e.listDevices = function(r, i, o) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return o.onFailure(new Error("User is not authenticated")); var u = { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), Limit: r }; i && (u.PaginationToken = i), this.client.request("ListDevices", u, function(l, f) { return l ? o.onFailure(l) : o.onSuccess(f); }); }, e.globalSignOut = function(r) { var i = this; if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r.onFailure(new Error("User is not authenticated")); this.client.request("GlobalSignOut", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(o) { return o ? r.onFailure(o) : (i.clearCachedUser(), r.onSuccess("SUCCESS")); }); }, e.signOut = function(r) { var i = this; if (!r || typeof r != "function") { this.cleanClientData(); return; } this.getSession(function(o, u) { if (o) return r(o); i.revokeTokens(function(l) { i.cleanClientData(), r(l); }); }); }, e.revokeTokens = function(r) { if (r === void 0 && (r = function() { }), typeof r != "function") throw new Error("Invalid revokeTokenCallback. It should be a function."); if (!this.signInUserSession) { var i = new Error("User is not authenticated"); return r(i); } if (!this.signInUserSession.getAccessToken()) { var o = new Error("No Access token available"); return r(o); } var u = this.signInUserSession.getRefreshToken().getToken(), l = this.signInUserSession.getAccessToken(); if (this.isSessionRevocable(l) && u) return this.revokeToken({ token: u, callback: r }); r(); }, e.isSessionRevocable = function(r) { if (r && typeof r.decodePayload == "function") try { var i = r.decodePayload(), o = i.origin_jti; return !!o; } catch { } return !1; }, e.cleanClientData = function() { this.signInUserSession = null, this.clearCachedUser(); }, e.revokeToken = function(r) { var i = r.token, o = r.callback; this.client.requestWithRetry("RevokeToken", { Token: i, ClientId: this.pool.getClientId() }, function(u) { if (u) return o(u); o(); }); }, e.sendMFASelectionAnswer = function(r, i) { var o = this, u = {}; u.USERNAME = this.username, u.ANSWER = r; var l = { ChallengeName: "SELECT_MFA_TYPE", ChallengeResponses: u, ClientId: this.pool.getClientId(), Session: this.Session }; this.getUserContextData() && (l.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", l, function(f, d) { if (f) return i.onFailure(f); if (o.Session = d.Session, r === "SMS_MFA") return i.mfaRequired(d.ChallengeName, d.ChallengeParameters); if (r === "SOFTWARE_TOKEN_MFA") return i.totpRequired(d.ChallengeName, d.ChallengeParameters); }); }, e.getUserContextData = function() { var r = this.pool; return r.getUserContextData(this.username); }, e.associateSoftwareToken = function(r) { var i = this; this.signInUserSession != null && this.signInUserSession.isValid() ? this.client.request("AssociateSoftwareToken", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(o, u) { return o ? r.onFailure(o) : r.associateSecretCode(u.SecretCode); }) : this.client.request("AssociateSoftwareToken", { Session: this.Session }, function(o, u) { return o ? r.onFailure(o) : (i.Session = u.Session, r.associateSecretCode(u.SecretCode)); }); }, e.verifySoftwareToken = function(r, i, o) { var u = this; this.signInUserSession != null && this.signInUserSession.isValid() ? this.client.request("VerifySoftwareToken", { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), UserCode: r, FriendlyDeviceName: i }, function(l, f) { return l ? o.onFailure(l) : o.onSuccess(f); }) : this.client.request("VerifySoftwareToken", { Session: this.Session, UserCode: r, FriendlyDeviceName: i }, function(l, f) { if (l) return o.onFailure(l); u.Session = f.Session; var d = {}; d.USERNAME = u.username; var p = { ChallengeName: "MFA_SETUP", ClientId: u.pool.getClientId(), ChallengeResponses: d, Session: u.Session }; u.getUserContextData() && (p.UserContextData = u.getUserContextData()), u.client.request("RespondToAuthChallenge", p, function(v, y) { return v ? o.onFailure(v) : (u.signInUserSession = u.getCognitoUserSession(y.AuthenticationResult), u.cacheTokens(), o.onSuccess(u.signInUserSession)); }); }); }, t; }(); function AM(t, e) { return e = e || {}, new Promise(function(n, r) { var i = new XMLHttpRequest(), o = [], u = [], l = {}, f = function() { return { ok: (i.status / 100 | 0) == 2, statusText: i.statusText, status: i.status, url: i.responseURL, text: function() { return Promise.resolve(i.responseText); }, json: function() { return Promise.resolve(i.responseText).then(JSON.parse); }, blob: function() { return Promise.resolve(new Blob([i.response])); }, clone: f, headers: { keys: function() { return o; }, entries: function() { return u; }, get: function(p) { return l[p.toLowerCase()]; }, has: function(p) { return p.toLowerCase() in l; } } }; }; for (var d in i.open(e.method || "get", t, !0), i.onload = function() { i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(p, v, y) { o.push(v = v.toLowerCase()), u.push([v, y]), l[v] = l[v] ? l[v] + "," + y : y; }), n(f()); }, i.onerror = r, i.withCredentials = e.credentials == "include", e.headers) i.setRequestHeader(d, e.headers[d]); i.send(e.body || null); }); } const CM = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: AM }, Symbol.toStringTag, { value: "Module" })), eE = /* @__PURE__ */ wl(CM); var _v, tE; function xM() { return tE || (tE = 1, _v = self.fetch || (self.fetch = eE.default || eE)), _v; } xM(); var NM = "5.0.4"; /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Cy = "aws-amplify/" + NM, Ta = { userAgent: Cy + " js", product: "", navigator: null, isReactNative: !1 }; if (typeof navigator < "u" && navigator.product) switch (Ta.product = navigator.product || "", Ta.navigator = navigator || null, navigator.product) { case "ReactNative": Ta.userAgent = Cy + " react-native", Ta.isReactNative = !0; break; default: Ta.userAgent = Cy + " js", Ta.isReactNative = !1; break; } var TM = function() { return Ta.userAgent; }; function MC() { } MC.prototype.userAgent = TM(); function IM(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, gd(t, e); } function xy(t) { var e = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0; return xy = function(r) { if (r === null || !OM(r)) return r; if (typeof r != "function") throw new TypeError("Super expression must either be null or a function"); if (typeof e < "u") { if (e.has(r)) return e.get(r); e.set(r, i); } function i() { return kh(r, arguments, Ny(this).constructor); } return i.prototype = Object.create(r.prototype, { constructor: { value: i, enumerable: !1, writable: !0, configurable: !0 } }), gd(i, r); }, xy(t); } function kh(t, e, n) { return RM() ? kh = Reflect.construct.bind() : kh = function(i, o, u) { var l = [null]; l.push.apply(l, o); var f = Function.bind.apply(i, l), d = new f(); return u && gd(d, u.prototype), d; }, kh.apply(null, arguments); } function RM() { if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1; if (typeof Proxy == "function") return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })), !0; } catch { return !1; } } function OM(t) { return Function.toString.call(t).indexOf("[native code]") !== -1; } function gd(t, e) { return gd = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, gd(t, e); } function Ny(t) { return Ny = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) { return n.__proto__ || Object.getPrototypeOf(n); }, Ny(t); } var PM = /* @__PURE__ */ function(t) { IM(e, t); function e(n, r, i, o) { var u; return u = t.call(this, n) || this, u.code = r, u.name = i, u.statusCode = o, u; } return e; }(/* @__PURE__ */ xy(Error)), DM = /* @__PURE__ */ function() { function t(n, r, i) { this.endpoint = r || "https://cognito-idp." + n + ".amazonaws.com/"; var o = i || {}, u = o.credentials; this.fetchOptions = u ? { credentials: u } : {}; } var e = t.prototype; return e.promisifyRequest = function(r, i) { var o = this; return new Promise(function(u, l) { o.request(r, i, function(f, d) { f ? l(new PM(f.message, f.code, f.name, f.statusCode)) : u(d); }); }); }, e.requestWithRetry = function(r, i, o) { var u = this, l = 5 * 1e3; UM(function(f) { return new Promise(function(d, p) { u.request(r, f, function(v, y) { v ? p(v) : d(y); }); }); }, [i], l).then(function(f) { return o(null, f); }).catch(function(f) { return o(f); }); }, e.request = function(r, i, o) { var u = { "Content-Type": "application/x-amz-json-1.1", "X-Amz-Target": "AWSCognitoIdentityProviderService." + r, "X-Amz-User-Agent": MC.prototype.userAgent, "Cache-Control": "no-store" }, l = Object.assign({}, this.fetchOptions, { headers: u, method: "POST", mode: "cors", body: JSON.stringify(i) }), f; fetch(this.endpoint, l).then(function(d) { return f = d, d; }, function(d) { throw d instanceof TypeError ? new Error("Network error") : d; }).then(function(d) { return d.json().catch(function() { return {}; }); }).then(function(d) { if (f.ok) return o(null, d); var p = (d.__type || d.code).split("#").pop(), v = new Error(d.message || d.Message || null); return v.name = p, v.code = p, o(v); }).catch(function(d) { if (f && f.headers && f.headers.get("x-amzn-errortype")) try { var p = f.headers.get("x-amzn-errortype").split(":")[0], v = new Error(f.status ? f.status.toString() : null); return v.code = p, v.name = p, v.statusCode = f.status, o(v); } catch { return o(d); } else d instanceof Error && d.message === "Network error" && (d.code = "NetworkError"); return o(d); }); }, t; }(), oh = { debug: function() { } }, FM = function(e) { var n = "nonRetryable"; return e && e[n]; }; function BC(t, e, n, r) { if (r === void 0 && (r = 1), typeof t != "function") throw Error("functionToRetry must be a function"); return oh.debug(t.name + " attempt #" + r + " with args: " + JSON.stringify(e)), t.apply(void 0, e).catch(function(i) { if (oh.debug("error on " + t.name, i), FM(i)) throw oh.debug(t.name + " non retryable error", i), i; var o = n(r, e, i); if (oh.debug(t.name + " retrying in " + o + " ms"), o !== !1) return new Promise(function(u) { return setTimeout(u, o); }).then(function() { return BC(t, e, n, r + 1); }); throw i; }); } function LM(t) { var e = 100, n = 100; return function(r) { var i = Math.pow(2, r) * e + n * Math.random(); return i > t ? !1 : i; }; } function UM(t, e, n) { return BC(t, e, LM(n)); } /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var MM = 55, BM = /* @__PURE__ */ function() { function t(n, r) { var i = n || {}, o = i.UserPoolId, u = i.ClientId, l = i.endpoint, f = i.fetchOptions, d = i.AdvancedSecurityDataCollectionFlag; if (!o || !u) throw new Error("Both UserPoolId and ClientId are required."); if (o.length > MM || !/^[\w-]+_[0-9a-zA-Z]+$/.test(o)) throw new Error("Invalid UserPoolId format."); var p = o.split("_")[0]; this.userPoolId = o, this.clientId = u, this.client = new DM(p, l, f), this.advancedSecurityDataCollectionFlag = d !== !1, this.storage = n.Storage || new UC().getStorage(), r && (this.wrapRefreshSessionCallback = r); } var e = t.prototype; return e.getUserPoolId = function() { return this.userPoolId; }, e.getUserPoolName = function() { return this.getUserPoolId().split("_")[1]; }, e.getClientId = function() { return this.clientId; }, e.signUp = function(r, i, o, u, l, f) { var d = this, p = { ClientId: this.clientId, Username: r, Password: i, UserAttributes: o, ValidationData: u, ClientMetadata: f }; this.getUserContextData(r) && (p.UserContextData = this.getUserContextData(r)), this.client.request("SignUp", p, function(v, y) { if (v) return l(v, null); var k = { Username: r, Pool: d, Storage: d.storage }, A = { user: new Ay(k), userConfirmed: y.UserConfirmed, userSub: y.UserSub, codeDeliveryDetails: y.CodeDeliveryDetails }; return l(null, A); }); }, e.getCurrentUser = function() { var r = "CognitoIdentityServiceProvider." + this.clientId + ".LastAuthUser", i = this.storage.getItem(r); if (i) { var o = { Username: i, Pool: this, Storage: this.storage }; return new Ay(o); } return null; }, e.getUserContextData = function(r) { if (!(typeof AmazonCognitoAdvancedSecurityData > "u")) { var i = AmazonCognitoAdvancedSecurityData; if (this.advancedSecurityDataCollectionFlag) { var o = i.getData(r, this.userPoolId, this.clientId); if (o) { var u = { EncodedData: o }; return u; } } return {}; } }, t; }(), bv = { exports: {} }; /*! * JavaScript Cookie v2.2.1 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license */ var nE; function jM() { return nE || (nE = 1, function(t, e) { (function(n) { var r; if (t.exports = n(), r = !0, !r) { var i = window.Cookies, o = window.Cookies = n(); o.noConflict = function() { return window.Cookies = i, o; }; } })(function() { function n() { for (var o = 0, u = {}; o < arguments.length; o++) { var l = arguments[o]; for (var f in l) u[f] = l[f]; } return u; } function r(o) { return o.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); } function i(o) { function u() { } function l(d, p, v) { if (!(typeof document > "u")) { v = n({ path: "/" }, u.defaults, v), typeof v.expires == "number" && (v.expires = new Date(/* @__PURE__ */ new Date() * 1 + v.expires * 864e5)), v.expires = v.expires ? v.expires.toUTCString() : ""; try { var y = JSON.stringify(p); /^[\{\[]/.test(y) && (p = y); } catch { } p = o.write ? o.write(p, d) : encodeURIComponent(String(p)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), d = encodeURIComponent(String(d)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape); var k = ""; for (var A in v) v[A] && (k += "; " + A, v[A] !== !0 && (k += "=" + v[A].split(";")[0])); return document.cookie = d + "=" + p + k; } } function f(d, p) { if (!(typeof document > "u")) { for (var v = {}, y = document.cookie ? document.cookie.split("; ") : [], k = 0; k < y.length; k++) { var A = y[k].split("="), E = A.slice(1).join("="); !p && E.charAt(0) === '"' && (E = E.slice(1, -1)); try { var T = r(A[0]); if (E = (o.read || o)(E, T) || r(E), p) try { E = JSON.parse(E); } catch { } if (v[T] = E, d === T) break; } catch { } } return d ? v[d] : v; } } return u.set = l, u.get = function(d) { return f( d, !1 /* read as raw */ ); }, u.getJSON = function(d) { return f( d, !0 /* read as json */ ); }, u.remove = function(d, p) { l(d, "", n(p, { expires: -1 })); }, u.defaults = {}, u.withConverter = i, u; } return i(function() { }); }); }(bv)), bv.exports; } var Bc = jM(), $M = /* @__PURE__ */ function() { function t(n) { if (n.domain) this.domain = n.domain; else throw new Error("The domain of cookieStorage can not be undefined."); if (n.path ? this.path = n.path : this.path = "/", Object.prototype.hasOwnProperty.call(n, "expires") ? this.expires = n.expires : this.expires = 365, Object.prototype.hasOwnProperty.call(n, "secure") ? this.secure = n.secure : this.secure = !0, Object.prototype.hasOwnProperty.call(n, "sameSite")) { if (!["strict", "lax", "none"].includes(n.sameSite)) throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".'); if (n.sameSite === "none" && !this.secure) throw new Error("sameSite = None requires the Secure attribute in latest browser versions."); this.sameSite = n.sameSite; } else this.sameSite = null; } var e = t.prototype; return e.setItem = function(r, i) { var o = { path: this.path, expires: this.expires, domain: this.domain, secure: this.secure }; return this.sameSite && (o.sameSite = this.sameSite), Bc.set(r, i, o), Bc.get(r); }, e.getItem = function(r) { return Bc.get(r); }, e.removeItem = function(r) { var i = { path: this.path, expires: this.expires, domain: this.domain, secure: this.secure }; return this.sameSite && (i.sameSite = this.sameSite), Bc.remove(r, i); }, e.clear = function() { for (var r = Bc.get(), i = Object.keys(r).length, o = 0; o < i; ++o) this.removeItem(Object.keys(r)[o]); return {}; }, t; }(), VM = "_self", zM = function(t) { var e = window.open(t, VM); return e ? Promise.resolve(e) : Promise.reject(); }, qM = function(t) { window.sessionStorage.setItem("oauth_state", t); }, HM = function() { var t = window.sessionStorage.getItem("oauth_state"); return window.sessionStorage.removeItem("oauth_state"), t; }, KM = function(t) { window.sessionStorage.setItem("ouath_pkce_key", t); }, GM = function() { var t = window.sessionStorage.getItem("ouath_pkce_key"); return window.sessionStorage.removeItem("ouath_pkce_key"), t; }, lr = function() { return lr = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, lr.apply(this, arguments); }, sh = function(t, e, n, r) { function i(o) { return o instanceof n ? o : new n(function(u) { u(o); }); } return new (n || (n = Promise))(function(o, u) { function l(p) { try { d(r.next(p)); } catch (v) { u(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { u(v); } } function d(p) { p.done ? o(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, ah = function(t, e) { var n = { label: 0, sent: function() { if (o[0] & 1) throw o[1]; return o[1]; }, trys: [], ops: [] }, r, i, o, u; return u = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() { return this; }), u; function l(d) { return function(p) { return f([d, p]); }; } function f(d) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (o = d[0] & 2 ? i.return : d[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, d[1])).done) return o; switch (i = 0, o && (d = [d[0] & 2, o.value]), d[0]) { case 0: case 1: o = d; break; case 4: return n.label++, { value: d[1], done: !1 }; case 5: n.label++, i = d[1], d = [0]; continue; case 7: d = n.ops.pop(), n.trys.pop(); continue; default: if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!o || d[1] > o[0] && d[1] < o[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < o[1]) { n.label = o[1], o = d; break; } if (o && n.label < o[2]) { n.label = o[2], n.ops.push(d); break; } o[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = o = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, Aa = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, o = [], u; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) o.push(i.value); } catch (l) { u = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (u) throw u.error; } } return o; }, WM = typeof Symbol < "u" && typeof Symbol.for == "function" ? Symbol.for("amplify_default") : "@@amplify_default", kv = function(t, e, n) { _s.dispatch("auth", { event: t, data: e, message: n }, "Auth", WM); }, Gu = new Pi("OAuth"), YM = ( /** @class */ function() { function t(e) { var n = e.config, r = e.cognitoClientId, i = e.scopes, o = i === void 0 ? [] : i; if (this._urlOpener = n.urlOpener || zM, this._config = n, this._cognitoClientId = r, !this.isValidScopes(o)) throw Error("scopes must be a String Array"); this._scopes = o; } return t.prototype.isValidScopes = function(e) { return Array.isArray(e) && e.every(function(n) { return typeof n == "string"; }); }, t.prototype.oauthSignIn = function(e, n, r, i, o, u) { e === void 0 && (e = "code"), o === void 0 && (o = Wh.Cognito); var l = this._generateState(32), f = u ? l + "-" + aD(u) : l; qM(f); var d = this._generateRandom(128); KM(d); var p = this._generateChallenge(d), v = "S256", y = this._scopes.join(" "), k = Object.entries(lr(lr({ redirect_uri: r, response_type: e, client_id: i, identity_provider: o, scope: y, state: f }, e === "code" ? { code_challenge: p } : {}), e === "code" ? { code_challenge_method: v } : {})).map(function(E) { var T = Aa(E, 2), D = T[0], R = T[1]; return encodeURIComponent(D) + "=" + encodeURIComponent(R); }).join("&"), A = "https://" + n + "/oauth2/authorize?" + k; Gu.debug("Redirecting to " + A), this._urlOpener(A, r); }, t.prototype._handleCodeFlow = function(e) { return sh(this, void 0, void 0, function() { var n, r, i, o, u, l, f, d, p, v, y, k, A, E; return ah(this, function(T) { switch (T.label) { case 0: return n = (bs.parse(e).query || "").split("&").map(function(D) { return D.split("="); }).reduce(function(D, R) { var L, j = Aa(R, 2), K = j[0], ue = j[1]; return lr(lr({}, D), (L = {}, L[K] = ue, L)); }, { code: void 0 }).code, r = bs.parse(e).pathname || "/", i = bs.parse(this._config.redirectSignIn).pathname || "/", !n || r !== i ? [ 2 /*return*/ ] : (o = "https://" + this._config.domain + "/oauth2/token", kv("codeFlow", {}, "Retrieving tokens from " + o), u = Ua(this._config) ? this._cognitoClientId : this._config.clientID, l = Ua(this._config) ? this._config.redirectSignIn : this._config.redirectUri, f = GM(), d = lr({ grant_type: "authorization_code", code: n, client_id: u, redirect_uri: l }, f ? { code_verifier: f } : {}), Gu.debug("Calling token endpoint: " + o + " with", d), p = Object.entries(d).map(function(D) { var R = Aa(D, 2), L = R[0], j = R[1]; return encodeURIComponent(L) + "=" + encodeURIComponent(j); }).join("&"), [4, fetch(o, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: p })]); case 1: return [4, T.sent().json()]; case 2: if (v = T.sent(), y = v.access_token, k = v.refresh_token, A = v.id_token, E = v.error, E) throw new Error(E); return [2, { accessToken: y, refreshToken: k, idToken: A }]; } }); }); }, t.prototype._handleImplicitFlow = function(e) { return sh(this, void 0, void 0, function() { var n, r, i; return ah(this, function(o) { return n = (bs.parse(e).hash || "#").substr(1).split("&").map(function(u) { return u.split("="); }).reduce(function(u, l) { var f, d = Aa(l, 2), p = d[0], v = d[1]; return lr(lr({}, u), (f = {}, f[p] = v, f)); }, { id_token: void 0, access_token: void 0 }), r = n.id_token, i = n.access_token, kv("implicitFlow", {}, "Got tokens from " + e), Gu.debug("Retrieving implicit tokens from " + e + " with"), [2, { accessToken: i, idToken: r, refreshToken: null }]; }); }); }, t.prototype.handleAuthResponse = function(e) { return sh(this, void 0, void 0, function() { var n, r, i, o, u, l, f; return ah(this, function(d) { switch (d.label) { case 0: if (d.trys.push([0, 5, , 6]), n = e ? lr(lr({}, (bs.parse(e).hash || "#").substr(1).split("&").map(function(p) { return p.split("="); }).reduce(function(p, v) { var y = Aa(v, 2), k = y[0], A = y[1]; return p[k] = A, p; }, {})), (bs.parse(e).query || "").split("&").map(function(p) { return p.split("="); }).reduce(function(p, v) { var y = Aa(v, 2), k = y[0], A = y[1]; return p[k] = A, p; }, {})) : {}, r = n.error, i = n.error_description, r) throw new Error(i); return o = this._validateState(n), Gu.debug("Starting " + this._config.responseType + " flow with " + e), this._config.responseType !== "code" ? [3, 2] : (u = [{}], [4, this._handleCodeFlow(e)]); case 1: return [2, lr.apply(void 0, [lr.apply(void 0, u.concat([d.sent()])), { state: o }])]; case 2: return l = [{}], [4, this._handleImplicitFlow(e)]; case 3: return [2, lr.apply(void 0, [lr.apply(void 0, l.concat([d.sent()])), { state: o }])]; case 4: return [3, 6]; case 5: throw f = d.sent(), Gu.error("Error handling auth response.", f), f; case 6: return [ 2 /*return*/ ]; } }); }); }, t.prototype._validateState = function(e) { if (e) { var n = HM(), r = e.state; if (n && n !== r) throw new Error("Invalid state in OAuth flow"); return r; } }, t.prototype.signOut = function() { return sh(this, void 0, void 0, function() { var e, n, r; return ah(this, function(i) { return e = "https://" + this._config.domain + "/logout?", n = Ua(this._config) ? this._cognitoClientId : this._config.oauth.clientID, r = Ua(this._config) ? this._config.redirectSignOut : this._config.returnTo, e += Object.entries({ client_id: n, logout_uri: encodeURIComponent(r) }).map(function(o) { var u = Aa(o, 2), l = u[0], f = u[1]; return l + "=" + f; }).join("&"), kv("oAuthSignOut", { oAuth: "signOut" }, "Signing out from " + e), Gu.debug("Signing out from " + e), [2, this._urlOpener(e, r)]; }); }); }, t.prototype._generateState = function(e) { for (var n = "", r = e, i = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; r > 0; --r) n += i[Math.round(Math.random() * (i.length - 1))]; return n; }, t.prototype._generateChallenge = function(e) { return this._base64URL(FC(e)); }, t.prototype._base64URL = function(e) { return e.toString(ky).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_"); }, t.prototype._generateRandom = function(e) { var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~", r = new Uint8Array(e); if (typeof window < "u" && window.crypto) window.crypto.getRandomValues(r); else for (var i = 0; i < e; i += 1) r[i] = Math.random() * n.length | 0; return this._bufferToString(r); }, t.prototype._bufferToString = function(e) { for (var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", r = [], i = 0; i < e.byteLength; i += 1) { var o = e[i] % n.length; r.push(n[o]); } return r.join(""); }, t; }() ); const QM = function(t) { if (jo().isBrowser && window.location) { var e = window.location.href; t({ url: e }); } else if (!jo().isNode) throw new Error("Not supported"); }; var zn; (function(t) { t.DEFAULT_MSG = "Authentication Error", t.EMPTY_EMAIL = "Email cannot be empty", t.EMPTY_PHONE = "Phone number cannot be empty", t.EMPTY_USERNAME = "Username cannot be empty", t.INVALID_USERNAME = "The username should either be a string or one of the sign in types", t.EMPTY_PASSWORD = "Password cannot be empty", t.EMPTY_CODE = "Confirmation code cannot be empty", t.SIGN_UP_ERROR = "Error creating account", t.NO_MFA = "No valid MFA method provided", t.INVALID_MFA = "Invalid MFA type", t.EMPTY_CHALLENGE = "Challenge response cannot be empty", t.NO_USER_SESSION = "Failed to get the session because the user is empty", t.NETWORK_ERROR = "Network Error", t.DEVICE_CONFIG = "Device tracking has not been configured in this User Pool", t.AUTOSIGNIN_ERROR = "Please use your credentials to sign in"; })(zn || (zn = {})); var jC = /* @__PURE__ */ function() { var t = function(e, n) { return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, i) { r.__proto__ = i; } || function(r, i) { for (var o in i) i.hasOwnProperty(o) && (r[o] = i[o]); }, t(e, n); }; return function(e, n) { t(e, n); function r() { this.constructor = e; } e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r()); }; }(), JM = new Pi("AuthError"), Ss = ( /** @class */ function(t) { jC(e, t); function e(n) { var r = this, i = ZM[n], o = i.message, u = i.log; return r = t.call(this, o) || this, r.constructor = e, Object.setPrototypeOf(r, e.prototype), r.name = "AuthError", r.log = u || o, JM.error(r.log), r; } return e; }(Error) ), XM = ( /** @class */ function(t) { jC(e, t); function e(n) { var r = t.call(this, n) || this; return r.constructor = e, Object.setPrototypeOf(r, e.prototype), r.name = "NoUserPoolError", r; } return e; }(Ss) ), ZM = { noConfig: { message: zn.DEFAULT_MSG, log: ` Error: Amplify has not been configured correctly. This error is typically caused by one of the following scenarios: 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information 2. There might be multiple conflicting versions of amplify packages in your node_modules. Refer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) ` }, missingAuthConfig: { message: zn.DEFAULT_MSG, log: ` Error: Amplify has not been configured correctly. The configuration object is missing required auth properties. This error is typically caused by one of the following scenarios: 1. Did you run \`amplify push\` after adding auth via \`amplify add auth\`? See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages. ` }, emptyUsername: { message: zn.EMPTY_USERNAME }, // TODO: should include a list of valid sign-in types invalidUsername: { message: zn.INVALID_USERNAME }, emptyPassword: { message: zn.EMPTY_PASSWORD }, emptyCode: { message: zn.EMPTY_CODE }, signUpError: { message: zn.SIGN_UP_ERROR, log: "The first parameter should either be non-null string or object" }, noMFA: { message: zn.NO_MFA }, invalidMFA: { message: zn.INVALID_MFA }, emptyChallengeResponse: { message: zn.EMPTY_CHALLENGE }, noUserSession: { message: zn.NO_USER_SESSION }, deviceConfig: { message: zn.DEVICE_CONFIG }, networkError: { message: zn.NETWORK_ERROR }, autoSignInError: { message: zn.AUTOSIGNIN_ERROR }, default: { message: zn.DEFAULT_MSG } }, Qh = function() { return Qh = Object.assign || function(t) { for (var e, n = 1, r = arguments.length; n < r; n++) { e = arguments[n]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Qh.apply(this, arguments); }, Xt = function(t, e, n, r) { function i(o) { return o instanceof n ? o : new n(function(u) { u(o); }); } return new (n || (n = Promise))(function(o, u) { function l(p) { try { d(r.next(p)); } catch (v) { u(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { u(v); } } function d(p) { p.done ? o(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, Zt = function(t, e) { var n = { label: 0, sent: function() { if (o[0] & 1) throw o[1]; return o[1]; }, trys: [], ops: [] }, r, i, o, u; return u = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() { return this; }), u; function l(d) { return function(p) { return f([d, p]); }; } function f(d) { if (r) throw new TypeError("Generator is already executing."); for (; n; ) try { if (r = 1, i && (o = d[0] & 2 ? i.return : d[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, d[1])).done) return o; switch (i = 0, o && (d = [d[0] & 2, o.value]), d[0]) { case 0: case 1: o = d; break; case 4: return n.label++, { value: d[1], done: !1 }; case 5: n.label++, i = d[1], d = [0]; continue; case 7: d = n.ops.pop(), n.trys.pop(); continue; default: if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!o || d[1] > o[0] && d[1] < o[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < o[1]) { n.label = o[1], o = d; break; } if (o && n.label < o[2]) { n.label = o[2], n.ops.push(d); break; } o[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = o = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, rE = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, o = [], u; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) o.push(i.value); } catch (l) { u = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (u) throw u.error; } } return o; }, De = new Pi("AuthClass"), iE = "aws.cognito.signin.user.admin", eB = 10 * 1e3, tB = typeof Symbol < "u" && typeof Symbol.for == "function" ? Symbol.for("amplify_default") : "@@amplify_default", $t = function(t, e, n) { _s.dispatch("auth", { event: t, data: e, message: n }, "Auth", tB); }, nB = 60, rB = 3 * 60 * 1e3, iB = ( /** @class */ function() { function t(e) { var n = this; this.userPool = null, this.user = null, this.oAuthFlowInProgress = !1, this.autoSignInInitiated = !1, this.Credentials = PC, this.wrapRefreshSessionCallback = function(r) { var i = function(o, u) { return u ? $t("tokenRefresh", void 0, "New token retrieved") : $t("tokenRefresh_failure", o, "Failed to retrieve new token"), r(o, u); }; return i; }, this.configure(e), this.currentCredentials = this.currentCredentials.bind(this), this.currentUserCredentials = this.currentUserCredentials.bind(this), _s.listen("auth", function(r) { var i = r.payload, o = i.event; switch (o) { case "signIn": n._storage.setItem("amplify-signin-with-hostedUI", "false"); break; case "signOut": n._storage.removeItem("amplify-signin-with-hostedUI"); break; case "cognitoHostedUI": n._storage.setItem("amplify-signin-with-hostedUI", "true"); break; } }); } return t.prototype.getModuleName = function() { return "Auth"; }, t.prototype.configure = function(e) { var n = this; if (!e) return this._config || {}; De.debug("configure Auth"); var r = Object.assign({}, this._config, dD.parseMobilehubConfig(e).Auth, e); this._config = r; var i = this._config, o = i.userPoolId, u = i.userPoolWebClientId, l = i.cookieStorage, f = i.oauth, d = i.region, p = i.identityPoolId, v = i.mandatorySignIn, y = i.refreshHandlers, k = i.identityPoolRegion, A = i.clientMetadata, E = i.endpoint; if (!this._config.storage) l ? this._storage = new $M(l) : this._storage = e.ssr ? new iU() : new _C().getStorage(); else { if (!this._isValidAuthStorage(this._config.storage)) throw De.error("The storage in the Auth config is not valid!"), new Error("Empty storage object"); this._storage = this._config.storage; } if (this._storageSync = Promise.resolve(), typeof this._storage.sync == "function" && (this._storageSync = this._storage.sync()), o) { var T = { UserPoolId: o, ClientId: u, endpoint: E }; T.Storage = this._storage, this.userPool = new BM(T, this.wrapRefreshSessionCallback); } this.Credentials.configure({ mandatorySignIn: v, region: k || d, userPoolId: o, identityPoolId: p, refreshHandlers: y, storage: this._storage }); var D = f ? Ua(this._config.oauth) ? f : f.awsCognito : void 0; if (D) { var R = Object.assign({ cognitoClientId: u, UserPoolId: o, domain: D.domain, scopes: D.scope, redirectSignIn: D.redirectSignIn, redirectSignOut: D.redirectSignOut, responseType: D.responseType, Storage: this._storage, urlOpener: D.urlOpener, clientMetadata: A }, D.options); this._oAuthHandler = new YM({ scopes: R.scopes, config: R, cognitoClientId: R.cognitoClientId }); var L = {}; QM(function(K) { var ue = K.url; L[ue] || (L[ue] = !0, n._handleAuthResponse(ue)); }); } if ($t("configured", null, "The Auth category has been configured successfully"), !this.autoSignInInitiated && typeof this._storage.getItem == "function") { var j = this.isTrueStorageValue("amplify-polling-started"); j && ($t("autoSignIn_failure", null, Gt.AutoSignInError), this._storage.removeItem("amplify-auto-sign-in")), this._storage.removeItem("amplify-polling-started"); } return this._config; }, t.prototype.signUp = function(e) { for (var n = this, r = [], i = 1; i < arguments.length; i++) r[i - 1] = arguments[i]; var o, u, l; if (!this.userPool) return this.rejectNoUserPool(); var f = null, d = null, p = [], v = null, y, k = { enabled: !1 }, A = {}, E = {}; if (e && typeof e == "string") { f = e, d = r ? r[0] : null; var T = r ? r[1] : null, D = r ? r[2] : null; T && p.push(new Ju({ Name: "email", Value: T })), D && p.push(new Ju({ Name: "phone_number", Value: D })); } else if (e && typeof e == "object") { f = e.username, d = e.password, e && e.clientMetadata ? y = e.clientMetadata : this._config.clientMetadata && (y = this._config.clientMetadata); var R = e.attributes; R && Object.keys(R).map(function(j) { p.push(new Ju({ Name: j, Value: R[j] })); }); var L = e.validationData; L && (v = [], Object.keys(L).map(function(j) { v.push(new Ju({ Name: j, Value: L[j] })); })), k = (o = e.autoSignIn) !== null && o !== void 0 ? o : { enabled: !1 }, k.enabled && (this._storage.setItem("amplify-auto-sign-in", "true"), A = (u = k.validationData) !== null && u !== void 0 ? u : {}, E = (l = k.clientMetaData) !== null && l !== void 0 ? l : {}); } else return this.rejectAuthError(Gt.SignUpError); return f ? d ? (De.debug("signUp attrs:", p), De.debug("signUp validation data:", v), new Promise(function(j, K) { n.userPool.signUp(f, d, p, v, function(ue, de) { ue ? ($t("signUp_failure", ue, f + " failed to signup"), K(ue)) : ($t("signUp", de, f + " has signed up successfully"), k.enabled && n.handleAutoSignIn(f, d, A, E, de), j(de)); }, y); })) : this.rejectAuthError(Gt.EmptyPassword) : this.rejectAuthError(Gt.EmptyUsername); }, t.prototype.handleAutoSignIn = function(e, n, r, i, o) { this.autoSignInInitiated = !0; var u = new Mk({ Username: e, Password: n, ValidationData: r, ClientMetadata: i }); o.userConfirmed ? this.signInAfterUserConfirmed(u) : this._config.signUpVerificationMethod === "link" ? this.handleLinkAutoSignIn(u) : this.handleCodeAutoSignIn(u); }, t.prototype.handleCodeAutoSignIn = function(e) { var n = this, r = function(i) { var o = i.payload; o.event === "confirmSignUp" && n.signInAfterUserConfirmed(e, r); }; _s.listen("auth", r); }, t.prototype.handleLinkAutoSignIn = function(e) { var n = this; this._storage.setItem("amplify-polling-started", "true"); var r = Date.now(), i = setInterval(function() { Date.now() - r > rB ? (clearInterval(i), $t("autoSignIn_failure", null, "Please confirm your account and use your credentials to sign in."), n._storage.removeItem("amplify-auto-sign-in")) : n.signInAfterUserConfirmed(e, null, i); }, 5e3); }, t.prototype.signInAfterUserConfirmed = function(e, n, r) { return Xt(this, void 0, void 0, function() { var i, o, u = this; return Zt(this, function(l) { switch (l.label) { case 0: i = this.createCognitoUser(e.getUsername()), l.label = 1; case 1: return l.trys.push([1, 3, , 4]), [4, i.authenticateUser(e, this.authCallbacks(i, function(f) { $t("autoSignIn", f, e.getUsername() + " has signed in successfully"), n && _s.remove("auth", n), r && (clearInterval(r), u._storage.removeItem("amplify-polling-started")), u._storage.removeItem("amplify-auto-sign-in"); }, function(f) { De.error(f), u._storage.removeItem("amplify-auto-sign-in"); }))]; case 2: return l.sent(), [3, 4]; case 3: return o = l.sent(), De.error(o), [3, 4]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype.confirmSignUp = function(e, n, r) { var i = this; if (!this.userPool) return this.rejectNoUserPool(); if (!e) return this.rejectAuthError(Gt.EmptyUsername); if (!n) return this.rejectAuthError(Gt.EmptyCode); var o = this.createCognitoUser(e), u = r && typeof r.forceAliasCreation == "boolean" ? r.forceAliasCreation : !0, l; return r && r.clientMetadata ? l = r.clientMetadata : this._config.clientMetadata && (l = this._config.clientMetadata), new Promise(function(f, d) { o.confirmRegistration(n, u, function(p, v) { if (p) d(p); else { $t("confirmSignUp", v, e + " has been confirmed successfully"); var y = i.isTrueStorageValue("amplify-auto-sign-in"); y && !i.autoSignInInitiated && ($t("autoSignIn_failure", null, Gt.AutoSignInError), i._storage.removeItem("amplify-auto-sign-in")), f(v); } }, l); }); }, t.prototype.isTrueStorageValue = function(e) { var n = this._storage.getItem(e); return n ? n === "true" : !1; }, t.prototype.resendSignUp = function(e, n) { if (n === void 0 && (n = this._config.clientMetadata), !this.userPool) return this.rejectNoUserPool(); if (!e) return this.rejectAuthError(Gt.EmptyUsername); var r = this.createCognitoUser(e); return new Promise(function(i, o) { r.resendConfirmationCode(function(u, l) { u ? o(u) : i(l); }, n); }); }, t.prototype.signIn = function(e, n, r) { if (r === void 0 && (r = this._config.clientMetadata), !this.userPool) return this.rejectNoUserPool(); var i = null, o = null, u = {}; if (typeof e == "string") i = e, o = n; else if (aU(e)) typeof n < "u" && De.warn("The password should be defined under the first parameter object!"), i = e.username, o = e.password, u = e.validationData; else return this.rejectAuthError(Gt.InvalidUsername); if (!i) return this.rejectAuthError(Gt.EmptyUsername); var l = new Mk({ Username: i, Password: o, ValidationData: u, ClientMetadata: r }); return o ? this.signInWithPassword(l) : this.signInWithoutPassword(l); }, t.prototype.authCallbacks = function(e, n, r) { var i = this, o = this; return { onSuccess: function(u) { return Xt(i, void 0, void 0, function() { var l, f, d, p; return Zt(this, function(v) { switch (v.label) { case 0: De.debug(u), delete e.challengeName, delete e.challengeParam, v.label = 1; case 1: return v.trys.push([1, 4, 5, 9]), [4, this.Credentials.clear()]; case 2: return v.sent(), [4, this.Credentials.set(u, "session")]; case 3: return l = v.sent(), De.debug("succeed to get cognito credentials", l), [3, 9]; case 4: return f = v.sent(), De.debug("cannot get cognito credentials", f), [3, 9]; case 5: return v.trys.push([5, 7, , 8]), [4, this.currentUserPoolUser()]; case 6: return d = v.sent(), o.user = d, $t("signIn", d, "A user " + e.getUsername() + " has been signed in"), n(d), [3, 8]; case 7: return p = v.sent(), De.error("Failed to get the signed in user", p), r(p), [3, 8]; case 8: return [ 7 /*endfinally*/ ]; case 9: return [ 2 /*return*/ ]; } }); }); }, onFailure: function(u) { De.debug("signIn failure", u), $t("signIn_failure", u, e.getUsername() + " failed to signin"), r(u); }, customChallenge: function(u) { De.debug("signIn custom challenge answer required"), e.challengeName = "CUSTOM_CHALLENGE", e.challengeParam = u, n(e); }, mfaRequired: function(u, l) { De.debug("signIn MFA required"), e.challengeName = u, e.challengeParam = l, n(e); }, mfaSetup: function(u, l) { De.debug("signIn mfa setup", u), e.challengeName = u, e.challengeParam = l, n(e); }, newPasswordRequired: function(u, l) { De.debug("signIn new password"), e.challengeName = "NEW_PASSWORD_REQUIRED", e.challengeParam = { userAttributes: u, requiredAttributes: l }, n(e); }, totpRequired: function(u, l) { De.debug("signIn totpRequired"), e.challengeName = u, e.challengeParam = l, n(e); }, selectMFAType: function(u, l) { De.debug("signIn selectMFAType", u), e.challengeName = u, e.challengeParam = l, n(e); } }; }, t.prototype.signInWithPassword = function(e) { var n = this; if (this.pendingSignIn) throw new Error("Pending sign-in attempt already in progress"); var r = this.createCognitoUser(e.getUsername()); return this.pendingSignIn = new Promise(function(i, o) { r.authenticateUser(e, n.authCallbacks(r, function(u) { n.pendingSignIn = null, i(u); }, function(u) { n.pendingSignIn = null, o(u); })); }), this.pendingSignIn; }, t.prototype.signInWithoutPassword = function(e) { var n = this, r = this.createCognitoUser(e.getUsername()); return r.setAuthenticationFlowType("CUSTOM_AUTH"), new Promise(function(i, o) { r.initiateAuth(e, n.authCallbacks(r, i, o)); }); }, t.prototype.getMFAOptions = function(e) { return new Promise(function(n, r) { e.getMFAOptions(function(i, o) { if (i) { De.debug("get MFA Options failed", i), r(i); return; } De.debug("get MFA options success", o), n(o); }); }); }, t.prototype.getPreferredMFA = function(e, n) { var r = this, i = this; return new Promise(function(o, u) { var l = r._config.clientMetadata, f = n ? n.bypassCache : !1; e.getUserData(function(d, p) { return Xt(r, void 0, void 0, function() { var v, y; return Zt(this, function(k) { switch (k.label) { case 0: if (!d) return [3, 5]; if (De.debug("getting preferred mfa failed", d), !this.isSessionInvalid(d)) return [3, 4]; k.label = 1; case 1: return k.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(e)]; case 2: return k.sent(), [3, 4]; case 3: return v = k.sent(), u(new Error("Session is invalid due to: " + d.message + " and failed to clean up invalid session: " + v.message)), [ 2 /*return*/ ]; case 4: return u(d), [ 2 /*return*/ ]; case 5: return y = i._getMfaTypeFromUserData(p), y ? (o(y), [ 2 /*return*/ ]) : (u("invalid MFA Type"), [ 2 /*return*/ ]); } }); }); }, { bypassCache: f, clientMetadata: l }); }); }, t.prototype._getMfaTypeFromUserData = function(e) { var n = null, r = e.PreferredMfaSetting; if (r) n = r; else { var i = e.UserMFASettingList; if (i) i.length === 0 ? n = "NOMFA" : De.debug("invalid case for getPreferredMFA", e); else { var o = e.MFAOptions; o ? n = "SMS_MFA" : n = "NOMFA"; } } return n; }, t.prototype._getUserData = function(e, n) { var r = this; return new Promise(function(i, o) { e.getUserData(function(u, l) { return Xt(r, void 0, void 0, function() { var f; return Zt(this, function(d) { switch (d.label) { case 0: if (!u) return [3, 5]; if (De.debug("getting user data failed", u), !this.isSessionInvalid(u)) return [3, 4]; d.label = 1; case 1: return d.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(e)]; case 2: return d.sent(), [3, 4]; case 3: return f = d.sent(), o(new Error("Session is invalid due to: " + u.message + " and failed to clean up invalid session: " + f.message)), [ 2 /*return*/ ]; case 4: return o(u), [ 2 /*return*/ ]; case 5: i(l), d.label = 6; case 6: return [ 2 /*return*/ ]; } }); }); }, n); }); }, t.prototype.setPreferredMFA = function(e, n) { return Xt(this, void 0, void 0, function() { var r, i, o, u, l, f, d, p = this; return Zt(this, function(v) { switch (v.label) { case 0: return r = this._config.clientMetadata, [4, this._getUserData(e, { bypassCache: !0, clientMetadata: r })]; case 1: switch (i = v.sent(), o = null, u = null, l = n, l) { case "TOTP": return [3, 2]; case "SOFTWARE_TOKEN_MFA": return [3, 2]; case "SMS": return [3, 3]; case "SMS_MFA": return [3, 3]; case "NOMFA": return [3, 4]; } return [3, 6]; case 2: return u = { PreferredMfa: !0, Enabled: !0 }, [3, 7]; case 3: return o = { PreferredMfa: !0, Enabled: !0 }, [3, 7]; case 4: return f = i.UserMFASettingList, [4, this._getMfaTypeFromUserData(i)]; case 5: if (d = v.sent(), d === "NOMFA") return [2, Promise.resolve("No change for mfa type")]; if (d === "SMS_MFA") o = { PreferredMfa: !1, Enabled: !1 }; else if (d === "SOFTWARE_TOKEN_MFA") u = { PreferredMfa: !1, Enabled: !1 }; else return [2, this.rejectAuthError(Gt.InvalidMFA)]; return f && f.length !== 0 && f.forEach(function(y) { y === "SMS_MFA" ? o = { PreferredMfa: !1, Enabled: !1 } : y === "SOFTWARE_TOKEN_MFA" && (u = { PreferredMfa: !1, Enabled: !1 }); }), [3, 7]; case 6: return De.debug("no validmfa method provided"), [2, this.rejectAuthError(Gt.NoMFA)]; case 7: return [2, new Promise(function(y, k) { e.setUserMfaPreference(o, u, function(A, E) { if (A) return De.debug("Set user mfa preference error", A), k(A); De.debug("Set user mfa success", E), De.debug("Caching the latest user data into local"), e.getUserData(function(T, D) { return Xt(p, void 0, void 0, function() { var R; return Zt(this, function(L) { switch (L.label) { case 0: if (!T) return [3, 5]; if (De.debug("getting user data failed", T), !this.isSessionInvalid(T)) return [3, 4]; L.label = 1; case 1: return L.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(e)]; case 2: return L.sent(), [3, 4]; case 3: return R = L.sent(), k(new Error("Session is invalid due to: " + T.message + " and failed to clean up invalid session: " + R.message)), [ 2 /*return*/ ]; case 4: return [2, k(T)]; case 5: return [2, y(E)]; } }); }); }, { bypassCache: !0, clientMetadata: r }); }); })]; } }); }); }, t.prototype.disableSMS = function(e) { return new Promise(function(n, r) { e.disableMFA(function(i, o) { if (i) { De.debug("disable mfa failed", i), r(i); return; } De.debug("disable mfa succeed", o), n(o); }); }); }, t.prototype.enableSMS = function(e) { return new Promise(function(n, r) { e.enableMFA(function(i, o) { if (i) { De.debug("enable mfa failed", i), r(i); return; } De.debug("enable mfa succeed", o), n(o); }); }); }, t.prototype.setupTOTP = function(e) { return new Promise(function(n, r) { e.associateSoftwareToken({ onFailure: function(i) { De.debug("associateSoftwareToken failed", i), r(i); }, associateSecretCode: function(i) { De.debug("associateSoftwareToken sucess", i), n(i); } }); }); }, t.prototype.verifyTotpToken = function(e, n) { return De.debug("verification totp token", e, n), new Promise(function(r, i) { e.verifySoftwareToken(n, "My TOTP device", { onFailure: function(o) { De.debug("verifyTotpToken failed", o), i(o); }, onSuccess: function(o) { $t("signIn", e, "A user " + e.getUsername() + " has been signed in"), De.debug("verifyTotpToken success", o), r(o); } }); }); }, t.prototype.confirmSignIn = function(e, n, r, i) { var o = this; if (i === void 0 && (i = this._config.clientMetadata), !n) return this.rejectAuthError(Gt.EmptyCode); var u = this; return new Promise(function(l, f) { e.sendMFACode(n, { onSuccess: function(d) { return Xt(o, void 0, void 0, function() { var p, v; return Zt(this, function(y) { switch (y.label) { case 0: De.debug(d), y.label = 1; case 1: return y.trys.push([1, 4, 5, 6]), [4, this.Credentials.clear()]; case 2: return y.sent(), [4, this.Credentials.set(d, "session")]; case 3: return p = y.sent(), De.debug("succeed to get cognito credentials", p), [3, 6]; case 4: return v = y.sent(), De.debug("cannot get cognito credentials", v), [3, 6]; case 5: return u.user = e, $t("signIn", e, "A user " + e.getUsername() + " has been signed in"), l(e), [ 7 /*endfinally*/ ]; case 6: return [ 2 /*return*/ ]; } }); }); }, onFailure: function(d) { De.debug("confirm signIn failure", d), f(d); } }, r, i); }); }, t.prototype.completeNewPassword = function(e, n, r, i) { var o = this; if (r === void 0 && (r = {}), i === void 0 && (i = this._config.clientMetadata), !n) return this.rejectAuthError(Gt.EmptyPassword); var u = this; return new Promise(function(l, f) { e.completeNewPasswordChallenge(n, r, { onSuccess: function(d) { return Xt(o, void 0, void 0, function() { var p, v; return Zt(this, function(y) { switch (y.label) { case 0: De.debug(d), y.label = 1; case 1: return y.trys.push([1, 4, 5, 6]), [4, this.Credentials.clear()]; case 2: return y.sent(), [4, this.Credentials.set(d, "session")]; case 3: return p = y.sent(), De.debug("succeed to get cognito credentials", p), [3, 6]; case 4: return v = y.sent(), De.debug("cannot get cognito credentials", v), [3, 6]; case 5: return u.user = e, $t("signIn", e, "A user " + e.getUsername() + " has been signed in"), l(e), [ 7 /*endfinally*/ ]; case 6: return [ 2 /*return*/ ]; } }); }); }, onFailure: function(d) { De.debug("completeNewPassword failure", d), $t("completeNewPassword_failure", d, o.user + " failed to complete the new password flow"), f(d); }, mfaRequired: function(d, p) { De.debug("signIn MFA required"), e.challengeName = d, e.challengeParam = p, l(e); }, mfaSetup: function(d, p) { De.debug("signIn mfa setup", d), e.challengeName = d, e.challengeParam = p, l(e); }, totpRequired: function(d, p) { De.debug("signIn mfa setup", d), e.challengeName = d, e.challengeParam = p, l(e); } }, i); }); }, t.prototype.sendCustomChallengeAnswer = function(e, n, r) { var i = this; return r === void 0 && (r = this._config.clientMetadata), this.userPool ? n ? new Promise(function(o, u) { e.sendCustomChallengeAnswer(n, i.authCallbacks(e, o, u), r); }) : this.rejectAuthError(Gt.EmptyChallengeResponse) : this.rejectNoUserPool(); }, t.prototype.deleteUserAttributes = function(e, n) { var r = this; return new Promise(function(i, o) { r.userSession(e).then(function(u) { e.deleteAttributes(n, function(l, f) { return l ? o(l) : i(f); }); }); }); }, t.prototype.deleteUser = function() { return Xt(this, void 0, void 0, function() { var e, n, r = this; return Zt(this, function(i) { switch (i.label) { case 0: return i.trys.push([0, 2, , 3]), [4, this._storageSync]; case 1: return i.sent(), [3, 3]; case 2: throw e = i.sent(), De.debug("Failed to sync cache info into memory", e), new Error(e); case 3: return n = this._oAuthHandler && this._storage.getItem("amplify-signin-with-hostedUI") === "true", [2, new Promise(function(o, u) { return Xt(r, void 0, void 0, function() { var l, f = this; return Zt(this, function(d) { if (this.userPool) if (l = this.userPool.getCurrentUser(), l) l.getSession(function(p, v) { return Xt(f, void 0, void 0, function() { var y, k = this; return Zt(this, function(A) { switch (A.label) { case 0: if (!p) return [3, 5]; if (De.debug("Failed to get the user session", p), !this.isSessionInvalid(p)) return [3, 4]; A.label = 1; case 1: return A.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(l)]; case 2: return A.sent(), [3, 4]; case 3: return y = A.sent(), u(new Error("Session is invalid due to: " + p.message + " and failed to clean up invalid session: " + y.message)), [ 2 /*return*/ ]; case 4: return [2, u(p)]; case 5: l.deleteUser(function(E, T) { if (E) u(E); else { $t("userDeleted", T, "The authenticated user has been deleted."), l.signOut(), k.user = null; try { k.cleanCachedItems(); } catch { De.debug("failed to clear cached items"); } n ? k.oAuthSignOutRedirect(o, u) : ($t("signOut", k.user, "A user has been signed out"), o(T)); } }), A.label = 6; case 6: return [ 2 /*return*/ ]; } }); }); }); else return De.debug("Failed to get user from user pool"), [2, u(new Error("No current user."))]; else De.debug("no Congito User pool"), u(new Error("Cognito User pool does not exist")); return [ 2 /*return*/ ]; }); }); })]; } }); }); }, t.prototype.updateUserAttributes = function(e, n, r) { r === void 0 && (r = this._config.clientMetadata); var i = [], o = this; return new Promise(function(u, l) { o.userSession(e).then(function(f) { for (var d in n) if (d !== "sub" && d.indexOf("_verified") < 0) { var p = { Name: d, Value: n[d] }; i.push(p); } e.updateAttributes(i, function(v, y) { return v ? l(v) : u(y); }, r); }); }); }, t.prototype.userAttributes = function(e) { var n = this; return new Promise(function(r, i) { n.userSession(e).then(function(o) { e.getUserAttributes(function(u, l) { u ? i(u) : r(l); }); }); }); }, t.prototype.verifiedContact = function(e) { var n = this; return this.userAttributes(e).then(function(r) { var i = n.attributesToObject(r), o = {}, u = {}; return i.email && (i.email_verified ? u.email = i.email : o.email = i.email), i.phone_number && (i.phone_number_verified ? u.phone_number = i.phone_number : o.phone_number = i.phone_number), { verified: u, unverified: o }; }); }, t.prototype.isErrorWithMessage = function(e) { return typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "message"); }, t.prototype.isTokenRevokedError = function(e) { return this.isErrorWithMessage(e) && e.message === "Access Token has been revoked"; }, t.prototype.isRefreshTokenRevokedError = function(e) { return this.isErrorWithMessage(e) && e.message === "Refresh Token has been revoked"; }, t.prototype.isUserDisabledError = function(e) { return this.isErrorWithMessage(e) && e.message === "User is disabled."; }, t.prototype.isUserDoesNotExistError = function(e) { return this.isErrorWithMessage(e) && e.message === "User does not exist."; }, t.prototype.isRefreshTokenExpiredError = function(e) { return this.isErrorWithMessage(e) && e.message === "Refresh Token has expired"; }, t.prototype.isSignedInHostedUI = function() { return this._oAuthHandler && this._storage.getItem("amplify-signin-with-hostedUI") === "true"; }, t.prototype.isSessionInvalid = function(e) { return this.isUserDisabledError(e) || this.isUserDoesNotExistError(e) || this.isTokenRevokedError(e) || this.isRefreshTokenRevokedError(e) || this.isRefreshTokenExpiredError(e); }, t.prototype.cleanUpInvalidSession = function(e) { return Xt(this, void 0, void 0, function() { var n = this; return Zt(this, function(r) { switch (r.label) { case 0: e.signOut(), this.user = null, r.label = 1; case 1: return r.trys.push([1, 3, , 4]), [4, this.cleanCachedItems()]; case 2: return r.sent(), [3, 4]; case 3: return r.sent(), De.debug("failed to clear cached items"), [3, 4]; case 4: return this.isSignedInHostedUI() ? [2, new Promise(function(i, o) { n.oAuthSignOutRedirect(i, o); })] : ($t("signOut", this.user, "A user has been signed out"), [ 2 /*return*/ ]); } }); }); }, t.prototype.currentUserPoolUser = function(e) { var n = this; return this.userPool ? new Promise(function(r, i) { n._storageSync.then(function() { return Xt(n, void 0, void 0, function() { var o, u, l = this; return Zt(this, function(f) { switch (f.label) { case 0: return this.isOAuthInProgress() ? (De.debug("OAuth signIn in progress, waiting for resolution..."), [4, new Promise(function(d) { var p = setTimeout(function() { De.debug("OAuth signIn in progress timeout"), _s.remove("auth", v), d(); }, eB); _s.listen("auth", v); function v(y) { var k = y.payload, A = k.event; (A === "cognitoHostedUI" || A === "cognitoHostedUI_failure") && (De.debug("OAuth signIn resolved: " + A), clearTimeout(p), _s.remove("auth", v), d()); } })]) : [3, 2]; case 1: f.sent(), f.label = 2; case 2: return o = this.userPool.getCurrentUser(), o ? (u = this._config.clientMetadata, o.getSession(function(d, p) { return Xt(l, void 0, void 0, function() { var v, y, k, A, E, T = this; return Zt(this, function(D) { switch (D.label) { case 0: if (!d) return [3, 5]; if (De.debug("Failed to get the user session", d), !this.isSessionInvalid(d)) return [3, 4]; D.label = 1; case 1: return D.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(o)]; case 2: return D.sent(), [3, 4]; case 3: return v = D.sent(), i(new Error("Session is invalid due to: " + d.message + " and failed to clean up invalid session: " + v.message)), [ 2 /*return*/ ]; case 4: return i(d), [ 2 /*return*/ ]; case 5: return y = e ? e.bypassCache : !1, y ? [4, this.Credentials.clear()] : [3, 7]; case 6: D.sent(), D.label = 7; case 7: if (k = this._config.clientMetadata, A = p.getAccessToken().decodePayload().scope, E = A === void 0 ? "" : A, E.split(" ").includes(iE)) o.getUserData(function(R, L) { return Xt(T, void 0, void 0, function() { var j, K, ue, de, H, ve, Z; return Zt(this, function(we) { switch (we.label) { case 0: if (!R) return [3, 7]; if (De.debug("getting user data failed", R), !this.isSessionInvalid(R)) return [3, 5]; we.label = 1; case 1: return we.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(o)]; case 2: return we.sent(), [3, 4]; case 3: return j = we.sent(), i(new Error("Session is invalid due to: " + R.message + " and failed to clean up invalid session: " + j.message)), [ 2 /*return*/ ]; case 4: return i(R), [3, 6]; case 5: r(o), we.label = 6; case 6: return [ 2 /*return*/ ]; case 7: for (K = L.PreferredMfaSetting || "NOMFA", ue = [], de = 0; de < L.UserAttributes.length; de++) H = { Name: L.UserAttributes[de].Name, Value: L.UserAttributes[de].Value }, ve = new Ju(H), ue.push(ve); return Z = this.attributesToObject(ue), Object.assign(o, { attributes: Z, preferredMFA: K }), [2, r(o)]; } }); }); }, { bypassCache: y, clientMetadata: k }); else return De.debug("Unable to get the user data because the " + iE + " is not in the scopes of the access token"), [2, r(o)]; return [ 2 /*return*/ ]; } }); }); }, { clientMetadata: u }), [ 2 /*return*/ ]) : (De.debug("Failed to get user from user pool"), i("No current user"), [ 2 /*return*/ ]); } }); }); }).catch(function(o) { return De.debug("Failed to sync cache info into memory", o), i(o); }); }) : this.rejectNoUserPool(); }, t.prototype.isOAuthInProgress = function() { return this.oAuthFlowInProgress; }, t.prototype.currentAuthenticatedUser = function(e) { return Xt(this, void 0, void 0, function() { var n, r, i, o, u; return Zt(this, function(l) { switch (l.label) { case 0: De.debug("getting current authenticated user"), n = null, l.label = 1; case 1: return l.trys.push([1, 3, , 4]), [4, this._storageSync]; case 2: return l.sent(), [3, 4]; case 3: throw r = l.sent(), De.debug("Failed to sync cache info into memory", r), r; case 4: try { i = JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")), i && (n = Qh(Qh({}, i.user), { token: i.token })); } catch { De.debug("cannot load federated user from auth storage"); } return n ? (this.user = n, De.debug("get current authenticated federated user", this.user), [2, this.user]) : [3, 5]; case 5: De.debug("get current authenticated userpool user"), o = null, l.label = 6; case 6: return l.trys.push([6, 8, , 9]), [4, this.currentUserPoolUser(e)]; case 7: return o = l.sent(), [3, 9]; case 8: return u = l.sent(), u === "No userPool" && De.error("Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID"), De.debug("The user is not authenticated by the error", u), [2, Promise.reject("The user is not authenticated")]; case 9: return this.user = o, [2, this.user]; } }); }); }, t.prototype.currentSession = function() { var e = this; return De.debug("Getting current session"), this.userPool ? new Promise(function(n, r) { e.currentUserPoolUser().then(function(i) { e.userSession(i).then(function(o) { n(o); }).catch(function(o) { De.debug("Failed to get the current session", o), r(o); }); }).catch(function(i) { De.debug("Failed to get the current user", i), r(i); }); }) : Promise.reject(new Error("No User Pool in the configuration.")); }, t.prototype.userSession = function(e) { var n = this; if (!e) return De.debug("the user is null"), this.rejectAuthError(Gt.NoUserSession); var r = this._config.clientMetadata; return new Promise(function(i, o) { De.debug("Getting the session from this user:", e), e.getSession(function(u, l) { return Xt(n, void 0, void 0, function() { var f; return Zt(this, function(d) { switch (d.label) { case 0: if (!u) return [3, 5]; if (De.debug("Failed to get the session from user", e), !this.isSessionInvalid(u)) return [3, 4]; d.label = 1; case 1: return d.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(e)]; case 2: return d.sent(), [3, 4]; case 3: return f = d.sent(), o(new Error("Session is invalid due to: " + u.message + " and failed to clean up invalid session: " + f.message)), [ 2 /*return*/ ]; case 4: return o(u), [ 2 /*return*/ ]; case 5: return De.debug("Succeed to get the user session", l), i(l), [ 2 /*return*/ ]; } }); }); }, { clientMetadata: r }); }); }, t.prototype.currentUserCredentials = function() { return Xt(this, void 0, void 0, function() { var e, n, r = this; return Zt(this, function(i) { switch (i.label) { case 0: De.debug("Getting current user credentials"), i.label = 1; case 1: return i.trys.push([1, 3, , 4]), [4, this._storageSync]; case 2: return i.sent(), [3, 4]; case 3: throw e = i.sent(), De.debug("Failed to sync cache info into memory", e), e; case 4: n = null; try { n = JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")); } catch (o) { De.debug("failed to get or parse item aws-amplify-federatedInfo", o); } return n ? [2, this.Credentials.refreshFederatedToken(n)] : [2, this.currentSession().then(function(o) { return De.debug("getting session success", o), r.Credentials.set(o, "session"); }).catch(function() { return De.debug("getting guest credentials"), r.Credentials.set(null, "guest"); })]; } }); }); }, t.prototype.currentCredentials = function() { return De.debug("getting current credentials"), this.Credentials.get(); }, t.prototype.verifyUserAttribute = function(e, n, r) { return r === void 0 && (r = this._config.clientMetadata), new Promise(function(i, o) { e.getAttributeVerificationCode(n, { onSuccess: function(u) { return i(u); }, onFailure: function(u) { return o(u); } }, r); }); }, t.prototype.verifyUserAttributeSubmit = function(e, n, r) { return r ? new Promise(function(i, o) { e.verifyAttribute(n, r, { onSuccess: function(u) { i(u); }, onFailure: function(u) { o(u); } }); }) : this.rejectAuthError(Gt.EmptyCode); }, t.prototype.verifyCurrentUserAttribute = function(e) { var n = this; return n.currentUserPoolUser().then(function(r) { return n.verifyUserAttribute(r, e); }); }, t.prototype.verifyCurrentUserAttributeSubmit = function(e, n) { var r = this; return r.currentUserPoolUser().then(function(i) { return r.verifyUserAttributeSubmit(i, e, n); }); }, t.prototype.cognitoIdentitySignOut = function(e, n) { return Xt(this, void 0, void 0, function() { var r, i, o = this; return Zt(this, function(u) { switch (u.label) { case 0: return u.trys.push([0, 2, , 3]), [4, this._storageSync]; case 1: return u.sent(), [3, 3]; case 2: throw r = u.sent(), De.debug("Failed to sync cache info into memory", r), r; case 3: return i = this._oAuthHandler && this._storage.getItem("amplify-signin-with-hostedUI") === "true", [2, new Promise(function(l, f) { if (e && e.global) { De.debug("user global sign out", n); var d = o._config.clientMetadata; n.getSession(function(p, v) { return Xt(o, void 0, void 0, function() { var y, k = this; return Zt(this, function(A) { switch (A.label) { case 0: if (!p) return [3, 5]; if (De.debug("failed to get the user session", p), !this.isSessionInvalid(p)) return [3, 4]; A.label = 1; case 1: return A.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(n)]; case 2: return A.sent(), [3, 4]; case 3: return y = A.sent(), f(new Error("Session is invalid due to: " + p.message + " and failed to clean up invalid session: " + y.message)), [ 2 /*return*/ ]; case 4: return [2, f(p)]; case 5: return n.globalSignOut({ onSuccess: function(E) { if (De.debug("global sign out success"), i) k.oAuthSignOutRedirect(l, f); else return l(); }, onFailure: function(E) { return De.debug("global sign out failed", E), f(E); } }), [ 2 /*return*/ ]; } }); }); }, { clientMetadata: d }); } else De.debug("user sign out", n), n.signOut(function() { if (i) o.oAuthSignOutRedirect(l, f); else return l(); }); })]; } }); }); }, t.prototype.oAuthSignOutRedirect = function(e, n) { var r = jo().isBrowser; r ? this.oAuthSignOutRedirectOrReject(n) : this.oAuthSignOutAndResolve(e); }, t.prototype.oAuthSignOutAndResolve = function(e) { this._oAuthHandler.signOut(), e(); }, t.prototype.oAuthSignOutRedirectOrReject = function(e) { this._oAuthHandler.signOut(), setTimeout(function() { return e(Error("Signout timeout fail")); }, 3e3); }, t.prototype.signOut = function(e) { return Xt(this, void 0, void 0, function() { var n; return Zt(this, function(r) { switch (r.label) { case 0: return r.trys.push([0, 2, , 3]), [4, this.cleanCachedItems()]; case 1: return r.sent(), [3, 3]; case 2: return r.sent(), De.debug("failed to clear cached items"), [3, 3]; case 3: return this.userPool ? (n = this.userPool.getCurrentUser(), n ? [4, this.cognitoIdentitySignOut(e, n)] : [3, 5]) : [3, 7]; case 4: return r.sent(), [3, 6]; case 5: De.debug("no current Cognito user"), r.label = 6; case 6: return [3, 8]; case 7: De.debug("no Cognito User pool"), r.label = 8; case 8: return $t("signOut", this.user, "A user has been signed out"), this.user = null, [ 2 /*return*/ ]; } }); }); }, t.prototype.cleanCachedItems = function() { return Xt(this, void 0, void 0, function() { return Zt(this, function(e) { switch (e.label) { case 0: return [4, this.Credentials.clear()]; case 1: return e.sent(), [ 2 /*return*/ ]; } }); }); }, t.prototype.changePassword = function(e, n, r, i) { var o = this; return i === void 0 && (i = this._config.clientMetadata), new Promise(function(u, l) { o.userSession(e).then(function(f) { e.changePassword(n, r, function(d, p) { return d ? (De.debug("change password failure", d), l(d)) : u(p); }, i); }); }); }, t.prototype.forgotPassword = function(e, n) { if (n === void 0 && (n = this._config.clientMetadata), !this.userPool) return this.rejectNoUserPool(); if (!e) return this.rejectAuthError(Gt.EmptyUsername); var r = this.createCognitoUser(e); return new Promise(function(i, o) { r.forgotPassword({ onSuccess: function() { i(); }, onFailure: function(u) { De.debug("forgot password failure", u), $t("forgotPassword_failure", u, e + " forgotPassword failed"), o(u); }, inputVerificationCode: function(u) { $t("forgotPassword", r, e + " has initiated forgot password flow"), i(u); } }, n); }); }, t.prototype.forgotPasswordSubmit = function(e, n, r, i) { if (i === void 0 && (i = this._config.clientMetadata), !this.userPool) return this.rejectNoUserPool(); if (!e) return this.rejectAuthError(Gt.EmptyUsername); if (!n) return this.rejectAuthError(Gt.EmptyCode); if (!r) return this.rejectAuthError(Gt.EmptyPassword); var o = this.createCognitoUser(e); return new Promise(function(u, l) { o.confirmPassword(n, r, { onSuccess: function(f) { $t("forgotPasswordSubmit", o, e + " forgotPasswordSubmit successful"), u(f); }, onFailure: function(f) { $t("forgotPasswordSubmit_failure", f, e + " forgotPasswordSubmit failed"), l(f); } }, i); }); }, t.prototype.currentUserInfo = function() { return Xt(this, void 0, void 0, function() { var e, f, n, r, i, o, u, l, f; return Zt(this, function(d) { switch (d.label) { case 0: return e = this.Credentials.getCredSource(), !e || e === "aws" || e === "userPool" ? [4, this.currentUserPoolUser().catch(function(p) { return De.error(p); })] : [3, 9]; case 1: if (f = d.sent(), !f) return [2, null]; d.label = 2; case 2: return d.trys.push([2, 8, , 9]), [4, this.userAttributes(f)]; case 3: n = d.sent(), r = this.attributesToObject(n), i = null, d.label = 4; case 4: return d.trys.push([4, 6, , 7]), [4, this.currentCredentials()]; case 5: return i = d.sent(), [3, 7]; case 6: return o = d.sent(), De.debug("Failed to retrieve credentials while getting current user info", o), [3, 7]; case 7: return u = { id: i ? i.identityId : void 0, username: f.getUsername(), attributes: r }, [2, u]; case 8: return l = d.sent(), De.error("currentUserInfo error", l), [2, {}]; case 9: return e === "federated" ? (f = this.user, [2, f || {}]) : [ 2 /*return*/ ]; } }); }); }, t.prototype.federatedSignIn = function(e, n, r) { return Xt(this, void 0, void 0, function() { var i, f, o, u, l, f, d, p, v, y, k, A; return Zt(this, function(E) { switch (E.label) { case 0: if (!this._config.identityPoolId && !this._config.userPoolId) throw new Error("Federation requires either a User Pool or Identity Pool in config"); if (typeof e > "u" && this._config.identityPoolId && !this._config.userPoolId) throw new Error("Federation with Identity Pools requires tokens passed as arguments"); return vv(e) || oU(e) || sU(e) || typeof e > "u" ? (i = e || { provider: Wh.Cognito }, f = vv(i) ? i.provider : i.customProvider, o = (vv(i), i.customState), this._config.userPoolId && (u = Ua(this._config.oauth) ? this._config.userPoolWebClientId : this._config.oauth.clientID, l = Ua(this._config.oauth) ? this._config.oauth.redirectSignIn : this._config.oauth.redirectUri, this._oAuthHandler.oauthSignIn(this._config.oauth.responseType, this._config.oauth.domain, l, u, f, o)), [3, 4]) : [3, 1]; case 1: f = e; try { d = JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user), d && De.warn("There is already a signed in user: " + d + ` in your app. You should not call Auth.federatedSignIn method again as it may cause unexpected behavior.`); } catch { } return p = n.token, v = n.identity_id, y = n.expires_at, [4, this.Credentials.set({ provider: f, token: p, identity_id: v, user: r, expires_at: y }, "federation")]; case 2: return k = E.sent(), [4, this.currentAuthenticatedUser()]; case 3: return A = E.sent(), $t("signIn", A, "A user " + A.username + " has been signed in"), De.debug("federated sign in credentials", k), [2, k]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype._handleAuthResponse = function(e) { return Xt(this, void 0, void 0, function() { var n, r, i, o, u, l, f, d, p, v, y, k, A, E; return Zt(this, function(T) { switch (T.label) { case 0: if (this.oAuthFlowInProgress) return De.debug("Skipping URL " + e + " current flow in progress"), [ 2 /*return*/ ]; T.label = 1; case 1: if (T.trys.push([1, , 8, 9]), this.oAuthFlowInProgress = !0, !this._config.userPoolId) throw new Error("OAuth responses require a User Pool defined in config"); if ($t("parsingCallbackUrl", { url: e }, "The callback url is being parsed"), n = e || (jo().isBrowser ? window.location.href : ""), r = !!(bs.parse(n).query || "").split("&").map(function(D) { return D.split("="); }).find(function(D) { var R = rE(D, 1), L = R[0]; return L === "code" || L === "error"; }), i = !!(bs.parse(n).hash || "#").substr(1).split("&").map(function(D) { return D.split("="); }).find(function(D) { var R = rE(D, 1), L = R[0]; return L === "access_token" || L === "error"; }), !(r || i)) return [3, 7]; this._storage.setItem("amplify-redirected-from-hosted-ui", "true"), T.label = 2; case 2: return T.trys.push([2, 6, , 7]), [4, this._oAuthHandler.handleAuthResponse(n)]; case 3: return o = T.sent(), u = o.accessToken, l = o.idToken, f = o.refreshToken, d = o.state, p = new Ey({ IdToken: new _y({ IdToken: l }), RefreshToken: new by({ RefreshToken: f }), AccessToken: new wy({ AccessToken: u }) }), v = void 0, this._config.identityPoolId ? [4, this.Credentials.set(p, "session")] : [3, 5]; case 4: v = T.sent(), De.debug("AWS credentials", v), T.label = 5; case 5: return y = /-/.test(d), k = this.createCognitoUser(p.getIdToken().decodePayload()["cognito:username"]), k.setSignInUserSession(p), window && typeof window.history < "u" && window.history.replaceState({}, null, this._config.oauth.redirectSignIn), $t("signIn", k, "A user " + k.getUsername() + " has been signed in"), $t("cognitoHostedUI", k, "A user " + k.getUsername() + " has been signed in via Cognito Hosted UI"), y && (A = d.split("-").splice(1).join("-"), $t("customOAuthState", uD(A), "State for user " + k.getUsername())), [2, v]; case 6: return E = T.sent(), De.debug("Error in cognito hosted auth response", E), window && typeof window.history < "u" && window.history.replaceState({}, null, this._config.oauth.redirectSignIn), $t("signIn_failure", E, "The OAuth response flow failed"), $t("cognitoHostedUI_failure", E, "A failure occurred when returning to the Cognito Hosted UI"), $t("customState_failure", E, "A failure occurred when returning state"), [3, 7]; case 7: return [3, 9]; case 8: return this.oAuthFlowInProgress = !1, [ 7 /*endfinally*/ ]; case 9: return [ 2 /*return*/ ]; } }); }); }, t.prototype.essentialCredentials = function(e) { return { accessKeyId: e.accessKeyId, sessionToken: e.sessionToken, secretAccessKey: e.secretAccessKey, identityId: e.identityId, authenticated: e.authenticated }; }, t.prototype.attributesToObject = function(e) { var n = this, r = {}; return e && e.map(function(i) { i.Name === "email_verified" || i.Name === "phone_number_verified" ? r[i.Name] = n.isTruthyString(i.Value) || i.Value === !0 : r[i.Name] = i.Value; }), r; }, t.prototype.isTruthyString = function(e) { return typeof e.toLowerCase == "function" && e.toLowerCase() === "true"; }, t.prototype.createCognitoUser = function(e) { var n = { Username: e, Pool: this.userPool }; n.Storage = this._storage; var r = this._config.authenticationFlowType, i = new Ay(n); return r && i.setAuthenticationFlowType(r), i; }, t.prototype._isValidAuthStorage = function(e) { return !!e && typeof e.getItem == "function" && typeof e.setItem == "function" && typeof e.removeItem == "function" && typeof e.clear == "function"; }, t.prototype.noUserPoolErrorHandler = function(e) { return e && (!e.userPoolId || !e.identityPoolId) ? Gt.MissingAuthConfig : Gt.NoConfig; }, t.prototype.rejectAuthError = function(e) { return Promise.reject(new Ss(e)); }, t.prototype.rejectNoUserPool = function() { var e = this.noUserPoolErrorHandler(this._config); return Promise.reject(new XM(e)); }, t.prototype.rememberDevice = function() { return Xt(this, void 0, void 0, function() { var e, n; return Zt(this, function(r) { switch (r.label) { case 0: return r.trys.push([0, 2, , 3]), [4, this.currentUserPoolUser()]; case 1: return e = r.sent(), [3, 3]; case 2: return n = r.sent(), De.debug("The user is not authenticated by the error", n), [2, Promise.reject("The user is not authenticated")]; case 3: return e.getCachedDeviceKeyAndPassword(), [2, new Promise(function(i, o) { e.setDeviceStatusRemembered({ onSuccess: function(u) { i(u); }, onFailure: function(u) { u.code === "InvalidParameterException" ? o(new Ss(Gt.DeviceConfig)) : u.code === "NetworkError" ? o(new Ss(Gt.NetworkError)) : o(u); } }); })]; } }); }); }, t.prototype.forgetDevice = function() { return Xt(this, void 0, void 0, function() { var e, n; return Zt(this, function(r) { switch (r.label) { case 0: return r.trys.push([0, 2, , 3]), [4, this.currentUserPoolUser()]; case 1: return e = r.sent(), [3, 3]; case 2: return n = r.sent(), De.debug("The user is not authenticated by the error", n), [2, Promise.reject("The user is not authenticated")]; case 3: return e.getCachedDeviceKeyAndPassword(), [2, new Promise(function(i, o) { e.forgetDevice({ onSuccess: function(u) { i(u); }, onFailure: function(u) { u.code === "InvalidParameterException" ? o(new Ss(Gt.DeviceConfig)) : u.code === "NetworkError" ? o(new Ss(Gt.NetworkError)) : o(u); } }); })]; } }); }); }, t.prototype.fetchDevices = function() { return Xt(this, void 0, void 0, function() { var e, n; return Zt(this, function(r) { switch (r.label) { case 0: return r.trys.push([0, 2, , 3]), [4, this.currentUserPoolUser()]; case 1: return e = r.sent(), [3, 3]; case 2: throw n = r.sent(), De.debug("The user is not authenticated by the error", n), new Error("The user is not authenticated"); case 3: return e.getCachedDeviceKeyAndPassword(), [2, new Promise(function(i, o) { var u = { onSuccess: function(l) { var f = l.Devices.map(function(d) { var p = d.DeviceAttributes.find(function(y) { var k = y.Name; return k === "device_name"; }) || {}, v = { id: d.DeviceKey, name: p.Value }; return v; }); i(f); }, onFailure: function(l) { l.code === "InvalidParameterException" ? o(new Ss(Gt.DeviceConfig)) : l.code === "NetworkError" ? o(new Ss(Gt.NetworkError)) : o(l); } }; e.listDevices(nB, null, u); })]; } }); }); }, t; }() ), $C = new iB(null); S0.register($C); const oB = { NZ_AWS_REGION: "us-east-1" }, { NZ_AWS_REGION: sB, NZ_CORE_SERVICES_GRAPHQL_URL: aB, NZ_CORE_SERVICES_REST_URL: uB } = oB, Qa = { AWS: { region: sB, cognito: { userPoolId: "us-east-1_EZ7wuZ4ig", userPoolWebClientId: "2jok7cst8ebf6ppscrhji57gvr" } }, // Back services apiUrls: { restV2: uB || "https://core-services-prod.nizza.com/api", graphql: aB || "https://core-services-prod.nizza.com/graphql", corsProxy: "https://3hvqfl2xcg.execute-api.us-east-1.amazonaws.com" }, publicUrls: { // Public app url platformSite: "https://platform.nizza.com", // Nizza CDN nizzaCdn: "https://cdn.nizza.com", // Bundle bundleSite: "https://bundle.nizza.com", // WSS IVS CHAT wssIVSChat: "wss://edge.ivschat.us-east-1.amazonaws.com", // Global Page globalPage: "https://live.nizza.com" } }; function VC(t, e) { return function() { return t.apply(e, arguments); }; } const { toString: lB } = Object.prototype, { getPrototypeOf: I0 } = Object, Tp = /* @__PURE__ */ ((t) => (e) => { const n = lB.call(e); return t[n] || (t[n] = n.slice(8, -1).toLowerCase()); })(/* @__PURE__ */ Object.create(null)), Di = (t) => (t = t.toLowerCase(), (e) => Tp(e) === t), Ip = (t) => (e) => typeof e === t, { isArray: Ol } = Array, vd = Ip("undefined"); function cB(t) { return t !== null && !vd(t) && t.constructor !== null && !vd(t.constructor) && zr(t.constructor.isBuffer) && t.constructor.isBuffer(t); } const zC = Di("ArrayBuffer"); function dB(t) { let e; return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && zC(t.buffer), e; } const fB = Ip("string"), zr = Ip("function"), qC = Ip("number"), Rp = (t) => t !== null && typeof t == "object", hB = (t) => t === !0 || t === !1, Eh = (t) => { if (Tp(t) !== "object") return !1; const e = I0(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); }, pB = Di("Date"), mB = Di("File"), gB = Di("Blob"), vB = Di("FileList"), yB = (t) => Rp(t) && zr(t.pipe), wB = (t) => { let e; return t && (typeof FormData == "function" && t instanceof FormData || zr(t.append) && ((e = Tp(t)) === "formdata" || // detect form-data instance e === "object" && zr(t.toString) && t.toString() === "[object FormData]")); }, SB = Di("URLSearchParams"), [_B, bB, kB, EB] = ["ReadableStream", "Request", "Response", "Headers"].map(Di), AB = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); function Nd(t, e, { allOwnKeys: n = !1 } = {}) { if (t === null || typeof t > "u") return; let r, i; if (typeof t != "object" && (t = [t]), Ol(t)) for (r = 0, i = t.length; r < i; r++) e.call(null, t[r], r, t); else { const o = n ? Object.getOwnPropertyNames(t) : Object.keys(t), u = o.length; let l; for (r = 0; r < u; r++) l = o[r], e.call(null, t[l], l, t); } } function HC(t, e) { e = e.toLowerCase(); const n = Object.keys(t); let r = n.length, i; for (; r-- > 0; ) if (i = n[r], e === i.toLowerCase()) return i; return null; } const Ma = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, KC = (t) => !vd(t) && t !== Ma; function Ty() { const { caseless: t } = KC(this) && this || {}, e = {}, n = (r, i) => { const o = t && HC(e, i) || i; Eh(e[o]) && Eh(r) ? e[o] = Ty(e[o], r) : Eh(r) ? e[o] = Ty({}, r) : Ol(r) ? e[o] = r.slice() : e[o] = r; }; for (let r = 0, i = arguments.length; r < i; r++) arguments[r] && Nd(arguments[r], n); return e; } const CB = (t, e, n, { allOwnKeys: r } = {}) => (Nd(e, (i, o) => { n && zr(i) ? t[o] = VC(i, n) : t[o] = i; }, { allOwnKeys: r }), t), xB = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), NB = (t, e, n, r) => { t.prototype = Object.create(e.prototype, r), t.prototype.constructor = t, Object.defineProperty(t, "super", { value: e.prototype }), n && Object.assign(t.prototype, n); }, TB = (t, e, n, r) => { let i, o, u; const l = {}; if (e = e || {}, t == null) return e; do { for (i = Object.getOwnPropertyNames(t), o = i.length; o-- > 0; ) u = i[o], (!r || r(u, t, e)) && !l[u] && (e[u] = t[u], l[u] = !0); t = n !== !1 && I0(t); } while (t && (!n || n(t, e)) && t !== Object.prototype); return e; }, IB = (t, e, n) => { t = String(t), (n === void 0 || n > t.length) && (n = t.length), n -= e.length; const r = t.indexOf(e, n); return r !== -1 && r === n; }, RB = (t) => { if (!t) return null; if (Ol(t)) return t; let e = t.length; if (!qC(e)) return null; const n = new Array(e); for (; e-- > 0; ) n[e] = t[e]; return n; }, OB = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && I0(Uint8Array)), PB = (t, e) => { const r = (t && t[Symbol.iterator]).call(t); let i; for (; (i = r.next()) && !i.done; ) { const o = i.value; e.call(t, o[0], o[1]); } }, DB = (t, e) => { let n; const r = []; for (; (n = t.exec(e)) !== null; ) r.push(n); return r; }, FB = Di("HTMLFormElement"), LB = (t) => t.toLowerCase().replace( /[-_\s]([a-z\d])(\w*)/g, function(n, r, i) { return r.toUpperCase() + i; } ), oE = (({ hasOwnProperty: t }) => (e, n) => t.call(e, n))(Object.prototype), UB = Di("RegExp"), GC = (t, e) => { const n = Object.getOwnPropertyDescriptors(t), r = {}; Nd(n, (i, o) => { let u; (u = e(i, o, t)) !== !1 && (r[o] = u || i); }), Object.defineProperties(t, r); }, MB = (t) => { GC(t, (e, n) => { if (zr(t) && ["arguments", "caller", "callee"].indexOf(n) !== -1) return !1; const r = t[n]; if (zr(r)) { if (e.enumerable = !1, "writable" in e) { e.writable = !1; return; } e.set || (e.set = () => { throw Error("Can not rewrite read-only method '" + n + "'"); }); } }); }, BB = (t, e) => { const n = {}, r = (i) => { i.forEach((o) => { n[o] = !0; }); }; return Ol(t) ? r(t) : r(String(t).split(e)), n; }, jB = () => { }, $B = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Ev = "abcdefghijklmnopqrstuvwxyz", sE = "0123456789", WC = { DIGIT: sE, ALPHA: Ev, ALPHA_DIGIT: Ev + Ev.toUpperCase() + sE }, VB = (t = 16, e = WC.ALPHA_DIGIT) => { let n = ""; const { length: r } = e; for (; t--; ) n += e[Math.random() * r | 0]; return n; }; function zB(t) { return !!(t && zr(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); } const qB = (t) => { const e = new Array(10), n = (r, i) => { if (Rp(r)) { if (e.indexOf(r) >= 0) return; if (!("toJSON" in r)) { e[i] = r; const o = Ol(r) ? [] : {}; return Nd(r, (u, l) => { const f = n(u, i + 1); !vd(f) && (o[l] = f); }), e[i] = void 0, o; } } return r; }; return n(t, 0); }, HB = Di("AsyncFunction"), KB = (t) => t && (Rp(t) || zr(t)) && zr(t.then) && zr(t.catch), YC = ((t, e) => t ? setImmediate : e ? ((n, r) => (Ma.addEventListener("message", ({ source: i, data: o }) => { i === Ma && o === n && r.length && r.shift()(); }, !1), (i) => { r.push(i), Ma.postMessage(n, "*"); }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))( typeof setImmediate == "function", zr(Ma.postMessage) ), GB = typeof queueMicrotask < "u" ? queueMicrotask.bind(Ma) : typeof process < "u" && process.nextTick || YC, Se = { isArray: Ol, isArrayBuffer: zC, isBuffer: cB, isFormData: wB, isArrayBufferView: dB, isString: fB, isNumber: qC, isBoolean: hB, isObject: Rp, isPlainObject: Eh, isReadableStream: _B, isRequest: bB, isResponse: kB, isHeaders: EB, isUndefined: vd, isDate: pB, isFile: mB, isBlob: gB, isRegExp: UB, isFunction: zr, isStream: yB, isURLSearchParams: SB, isTypedArray: OB, isFileList: vB, forEach: Nd, merge: Ty, extend: CB, trim: AB, stripBOM: xB, inherits: NB, toFlatObject: TB, kindOf: Tp, kindOfTest: Di, endsWith: IB, toArray: RB, forEachEntry: PB, matchAll: DB, isHTMLForm: FB, hasOwnProperty: oE, hasOwnProp: oE, // an alias to avoid ESLint no-prototype-builtins detection reduceDescriptors: GC, freezeMethods: MB, toObjectSet: BB, toCamelCase: LB, noop: jB, toFiniteNumber: $B, findKey: HC, global: Ma, isContextDefined: KC, ALPHABET: WC, generateString: VB, isSpecCompliantForm: zB, toJSONObject: qB, isAsyncFn: HB, isThenable: KB, setImmediate: YC, asap: GB }; function xt(t, e, n, r, i) { Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), n && (this.config = n), r && (this.request = r), i && (this.response = i, this.status = i.status ? i.status : null); } Se.inherits(xt, Error, { toJSON: function() { return { // Standard message: this.message, name: this.name, // Microsoft description: this.description, number: this.number, // Mozilla fileName: this.fileName, lineNumber: this.lineNumber, columnNumber: this.columnNumber, stack: this.stack, // Axios config: Se.toJSONObject(this.config), code: this.code, status: this.status }; } }); const QC = xt.prototype, JC = {}; [ "ERR_BAD_OPTION_VALUE", "ERR_BAD_OPTION", "ECONNABORTED", "ETIMEDOUT", "ERR_NETWORK", "ERR_FR_TOO_MANY_REDIRECTS", "ERR_DEPRECATED", "ERR_BAD_RESPONSE", "ERR_BAD_REQUEST", "ERR_CANCELED", "ERR_NOT_SUPPORT", "ERR_INVALID_URL" // eslint-disable-next-line func-names ].forEach((t) => { JC[t] = { value: t }; }); Object.defineProperties(xt, JC); Object.defineProperty(QC, "isAxiosError", { value: !0 }); xt.from = (t, e, n, r, i, o) => { const u = Object.create(QC); return Se.toFlatObject(t, u, function(f) { return f !== Error.prototype; }, (l) => l !== "isAxiosError"), xt.call(u, t.message, e, n, r, i), u.cause = t, u.name = t.name, o && Object.assign(u, o), u; }; const WB = null; function Iy(t) { return Se.isPlainObject(t) || Se.isArray(t); } function XC(t) { return Se.endsWith(t, "[]") ? t.slice(0, -2) : t; } function aE(t, e, n) { return t ? t.concat(e).map(function(i, o) { return i = XC(i), !n && o ? "[" + i + "]" : i; }).join(n ? "." : "") : e; } function YB(t) { return Se.isArray(t) && !t.some(Iy); } const QB = Se.toFlatObject(Se, {}, null, function(e) { return /^is[A-Z]/.test(e); }); function Op(t, e, n) { if (!Se.isObject(t)) throw new TypeError("target must be an object"); e = e || new FormData(), n = Se.toFlatObject(n, { metaTokens: !0, dots: !1, indexes: !1 }, !1, function(E, T) { return !Se.isUndefined(T[E]); }); const r = n.metaTokens, i = n.visitor || p, o = n.dots, u = n.indexes, f = (n.Blob || typeof Blob < "u" && Blob) && Se.isSpecCompliantForm(e); if (!Se.isFunction(i)) throw new TypeError("visitor must be a function"); function d(A) { if (A === null) return ""; if (Se.isDate(A)) return A.toISOString(); if (!f && Se.isBlob(A)) throw new xt("Blob is not supported. Use a Buffer instead."); return Se.isArrayBuffer(A) || Se.isTypedArray(A) ? f && typeof Blob == "function" ? new Blob([A]) : Buffer.from(A) : A; } function p(A, E, T) { let D = A; if (A && !T && typeof A == "object") { if (Se.endsWith(E, "{}")) E = r ? E : E.slice(0, -2), A = JSON.stringify(A); else if (Se.isArray(A) && YB(A) || (Se.isFileList(A) || Se.endsWith(E, "[]")) && (D = Se.toArray(A))) return E = XC(E), D.forEach(function(L, j) { !(Se.isUndefined(L) || L === null) && e.append( // eslint-disable-next-line no-nested-ternary u === !0 ? aE([E], j, o) : u === null ? E : E + "[]", d(L) ); }), !1; } return Iy(A) ? !0 : (e.append(aE(T, E, o), d(A)), !1); } const v = [], y = Object.assign(QB, { defaultVisitor: p, convertValue: d, isVisitable: Iy }); function k(A, E) { if (!Se.isUndefined(A)) { if (v.indexOf(A) !== -1) throw Error("Circular reference detected in " + E.join(".")); v.push(A), Se.forEach(A, function(D, R) { (!(Se.isUndefined(D) || D === null) && i.call( e, D, Se.isString(R) ? R.trim() : R, E, y )) === !0 && k(D, E ? E.concat(R) : [R]); }), v.pop(); } } if (!Se.isObject(t)) throw new TypeError("data must be an object"); return k(t), e; } function uE(t) { const e = { "!": "%21", "'": "%27", "(": "%28", ")": "%29", "~": "%7E", "%20": "+", "%00": "\0" }; return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(r) { return e[r]; }); } function R0(t, e) { this._pairs = [], t && Op(t, this, e); } const ZC = R0.prototype; ZC.append = function(e, n) { this._pairs.push([e, n]); }; ZC.toString = function(e) { const n = e ? function(r) { return e.call(this, r, uE); } : uE; return this._pairs.map(function(i) { return n(i[0]) + "=" + n(i[1]); }, "").join("&"); }; function JB(t) { return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } function ex(t, e, n) { if (!e) return t; const r = n && n.encode || JB, i = n && n.serialize; let o; if (i ? o = i(e, n) : o = Se.isURLSearchParams(e) ? e.toString() : new R0(e, n).toString(r), o) { const u = t.indexOf("#"); u !== -1 && (t = t.slice(0, u)), t += (t.indexOf("?") === -1 ? "?" : "&") + o; } return t; } class lE { constructor() { this.handlers = []; } /** * Add a new interceptor to the stack * * @param {Function} fulfilled The function to handle `then` for a `Promise` * @param {Function} rejected The function to handle `reject` for a `Promise` * * @return {Number} An ID used to remove interceptor later */ use(e, n, r) { return this.handlers.push({ fulfilled: e, rejected: n, synchronous: r ? r.synchronous : !1, runWhen: r ? r.runWhen : null }), this.handlers.length - 1; } /** * Remove an interceptor from the stack * * @param {Number} id The ID that was returned by `use` * * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise */ eject(e) { this.handlers[e] && (this.handlers[e] = null); } /** * Clear all interceptors from the stack * * @returns {void} */ clear() { this.handlers && (this.handlers = []); } /** * Iterate over all the registered interceptors * * This method is particularly useful for skipping over any * interceptors that may have become `null` calling `eject`. * * @param {Function} fn The function to call for each interceptor * * @returns {void} */ forEach(e) { Se.forEach(this.handlers, function(r) { r !== null && e(r); }); } } const tx = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 }, XB = typeof URLSearchParams < "u" ? URLSearchParams : R0, ZB = typeof FormData < "u" ? FormData : null, e3 = typeof Blob < "u" ? Blob : null, t3 = { isBrowser: !0, classes: { URLSearchParams: XB, FormData: ZB, Blob: e3 }, protocols: ["http", "https", "file", "blob", "url", "data"] }, O0 = typeof window < "u" && typeof document < "u", Ry = typeof navigator == "object" && navigator || void 0, n3 = O0 && (!Ry || ["ReactNative", "NativeScript", "NS"].indexOf(Ry.product) < 0), r3 = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef self instanceof WorkerGlobalScope && typeof self.importScripts == "function", i3 = O0 && window.location.href || "http://localhost", o3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, hasBrowserEnv: O0, hasStandardBrowserEnv: n3, hasStandardBrowserWebWorkerEnv: r3, navigator: Ry, origin: i3 }, Symbol.toStringTag, { value: "Module" })), xr = { ...o3, ...t3 }; function s3(t, e) { return Op(t, new xr.classes.URLSearchParams(), Object.assign({ visitor: function(n, r, i, o) { return xr.isNode && Se.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments); } }, e)); } function a3(t) { return Se.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]); } function u3(t) { const e = {}, n = Object.keys(t); let r; const i = n.length; let o; for (r = 0; r < i; r++) o = n[r], e[o] = t[o]; return e; } function nx(t) { function e(n, r, i, o) { let u = n[o++]; if (u === "__proto__") return !0; const l = Number.isFinite(+u), f = o >= n.length; return u = !u && Se.isArray(i) ? i.length : u, f ? (Se.hasOwnProp(i, u) ? i[u] = [i[u], r] : i[u] = r, !l) : ((!i[u] || !Se.isObject(i[u])) && (i[u] = []), e(n, r, i[u], o) && Se.isArray(i[u]) && (i[u] = u3(i[u])), !l); } if (Se.isFormData(t) && Se.isFunction(t.entries)) { const n = {}; return Se.forEachEntry(t, (r, i) => { e(a3(r), i, n, 0); }), n; } return null; } function l3(t, e, n) { if (Se.isString(t)) try { return (e || JSON.parse)(t), Se.trim(t); } catch (r) { if (r.name !== "SyntaxError") throw r; } return (n || JSON.stringify)(t); } const Td = { transitional: tx, adapter: ["xhr", "http", "fetch"], transformRequest: [function(e, n) { const r = n.getContentType() || "", i = r.indexOf("application/json") > -1, o = Se.isObject(e); if (o && Se.isHTMLForm(e) && (e = new FormData(e)), Se.isFormData(e)) return i ? JSON.stringify(nx(e)) : e; if (Se.isArrayBuffer(e) || Se.isBuffer(e) || Se.isStream(e) || Se.isFile(e) || Se.isBlob(e) || Se.isReadableStream(e)) return e; if (Se.isArrayBufferView(e)) return e.buffer; if (Se.isURLSearchParams(e)) return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString(); let l; if (o) { if (r.indexOf("application/x-www-form-urlencoded") > -1) return s3(e, this.formSerializer).toString(); if ((l = Se.isFileList(e)) || r.indexOf("multipart/form-data") > -1) { const f = this.env && this.env.FormData; return Op( l ? { "files[]": e } : e, f && new f(), this.formSerializer ); } } return o || i ? (n.setContentType("application/json", !1), l3(e)) : e; }], transformResponse: [function(e) { const n = this.transitional || Td.transitional, r = n && n.forcedJSONParsing, i = this.responseType === "json"; if (Se.isResponse(e) || Se.isReadableStream(e)) return e; if (e && Se.isString(e) && (r && !this.responseType || i)) { const u = !(n && n.silentJSONParsing) && i; try { return JSON.parse(e); } catch (l) { if (u) throw l.name === "SyntaxError" ? xt.from(l, xt.ERR_BAD_RESPONSE, this, null, this.response) : l; } } return e; }], /** * A timeout in milliseconds to abort a request. If set to 0 (default) a * timeout is not created. */ timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", maxContentLength: -1, maxBodyLength: -1, env: { FormData: xr.classes.FormData, Blob: xr.classes.Blob }, validateStatus: function(e) { return e >= 200 && e < 300; }, headers: { common: { Accept: "application/json, text/plain, */*", "Content-Type": void 0 } } }; Se.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => { Td.headers[t] = {}; }); const c3 = Se.toObjectSet([ "age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent" ]), d3 = (t) => { const e = {}; let n, r, i; return t && t.split(` `).forEach(function(u) { i = u.indexOf(":"), n = u.substring(0, i).trim().toLowerCase(), r = u.substring(i + 1).trim(), !(!n || e[n] && c3[n]) && (n === "set-cookie" ? e[n] ? e[n].push(r) : e[n] = [r] : e[n] = e[n] ? e[n] + ", " + r : r); }), e; }, cE = Symbol("internals"); function jc(t) { return t && String(t).trim().toLowerCase(); } function Ah(t) { return t === !1 || t == null ? t : Se.isArray(t) ? t.map(Ah) : String(t); } function f3(t) { const e = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; let r; for (; r = n.exec(t); ) e[r[1]] = r[2]; return e; } const h3 = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); function Av(t, e, n, r, i) { if (Se.isFunction(r)) return r.call(this, e, n); if (i && (e = n), !!Se.isString(e)) { if (Se.isString(r)) return e.indexOf(r) !== -1; if (Se.isRegExp(r)) return r.test(e); } } function p3(t) { return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, n, r) => n.toUpperCase() + r); } function m3(t, e) { const n = Se.toCamelCase(" " + e); ["get", "set", "has"].forEach((r) => { Object.defineProperty(t, r + n, { value: function(i, o, u) { return this[r].call(this, e, i, o, u); }, configurable: !0 }); }); } let Nr = class { constructor(e) { e && this.set(e); } set(e, n, r) { const i = this; function o(l, f, d) { const p = jc(f); if (!p) throw new Error("header name must be a non-empty string"); const v = Se.findKey(i, p); (!v || i[v] === void 0 || d === !0 || d === void 0 && i[v] !== !1) && (i[v || f] = Ah(l)); } const u = (l, f) => Se.forEach(l, (d, p) => o(d, p, f)); if (Se.isPlainObject(e) || e instanceof this.constructor) u(e, n); else if (Se.isString(e) && (e = e.trim()) && !h3(e)) u(d3(e), n); else if (Se.isHeaders(e)) for (const [l, f] of e.entries()) o(f, l, r); else e != null && o(n, e, r); return this; } get(e, n) { if (e = jc(e), e) { const r = Se.findKey(this, e); if (r) { const i = this[r]; if (!n) return i; if (n === !0) return f3(i); if (Se.isFunction(n)) return n.call(this, i, r); if (Se.isRegExp(n)) return n.exec(i); throw new TypeError("parser must be boolean|regexp|function"); } } } has(e, n) { if (e = jc(e), e) { const r = Se.findKey(this, e); return !!(r && this[r] !== void 0 && (!n || Av(this, this[r], r, n))); } return !1; } delete(e, n) { const r = this; let i = !1; function o(u) { if (u = jc(u), u) { const l = Se.findKey(r, u); l && (!n || Av(r, r[l], l, n)) && (delete r[l], i = !0); } } return Se.isArray(e) ? e.forEach(o) : o(e), i; } clear(e) { const n = Object.keys(this); let r = n.length, i = !1; for (; r--; ) { const o = n[r]; (!e || Av(this, this[o], o, e, !0)) && (delete this[o], i = !0); } return i; } normalize(e) { const n = this, r = {}; return Se.forEach(this, (i, o) => { const u = Se.findKey(r, o); if (u) { n[u] = Ah(i), delete n[o]; return; } const l = e ? p3(o) : String(o).trim(); l !== o && delete n[o], n[l] = Ah(i), r[l] = !0; }), this; } concat(...e) { return this.constructor.concat(this, ...e); } toJSON(e) { const n = /* @__PURE__ */ Object.create(null); return Se.forEach(this, (r, i) => { r != null && r !== !1 && (n[i] = e && Se.isArray(r) ? r.join(", ") : r); }), n; } [Symbol.iterator]() { return Object.entries(this.toJSON())[Symbol.iterator](); } toString() { return Object.entries(this.toJSON()).map(([e, n]) => e + ": " + n).join(` `); } get [Symbol.toStringTag]() { return "AxiosHeaders"; } static from(e) { return e instanceof this ? e : new this(e); } static concat(e, ...n) { const r = new this(e); return n.forEach((i) => r.set(i)), r; } static accessor(e) { const r = (this[cE] = this[cE] = { accessors: {} }).accessors, i = this.prototype; function o(u) { const l = jc(u); r[l] || (m3(i, u), r[l] = !0); } return Se.isArray(e) ? e.forEach(o) : o(e), this; } }; Nr.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); Se.reduceDescriptors(Nr.prototype, ({ value: t }, e) => { let n = e[0].toUpperCase() + e.slice(1); return { get: () => t, set(r) { this[n] = r; } }; }); Se.freezeMethods(Nr); function Cv(t, e) { const n = this || Td, r = e || n, i = Nr.from(r.headers); let o = r.data; return Se.forEach(t, function(l) { o = l.call(n, o, i.normalize(), e ? e.status : void 0); }), i.normalize(), o; } function rx(t) { return !!(t && t.__CANCEL__); } function Pl(t, e, n) { xt.call(this, t ?? "canceled", xt.ERR_CANCELED, e, n), this.name = "CanceledError"; } Se.inherits(Pl, xt, { __CANCEL__: !0 }); function ix(t, e, n) { const r = n.config.validateStatus; !n.status || !r || r(n.status) ? t(n) : e(new xt( "Request failed with status code " + n.status, [xt.ERR_BAD_REQUEST, xt.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4], n.config, n.request, n )); } function g3(t) { const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t); return e && e[1] || ""; } function v3(t, e) { t = t || 10; const n = new Array(t), r = new Array(t); let i = 0, o = 0, u; return e = e !== void 0 ? e : 1e3, function(f) { const d = Date.now(), p = r[o]; u || (u = d), n[i] = f, r[i] = d; let v = o, y = 0; for (; v !== i; ) y += n[v++], v = v % t; if (i = (i + 1) % t, i === o && (o = (o + 1) % t), d - u < e) return; const k = p && d - p; return k ? Math.round(y * 1e3 / k) : void 0; }; } function y3(t, e) { let n = 0, r = 1e3 / e, i, o; const u = (d, p = Date.now()) => { n = p, i = null, o && (clearTimeout(o), o = null), t.apply(null, d); }; return [(...d) => { const p = Date.now(), v = p - n; v >= r ? u(d, p) : (i = d, o || (o = setTimeout(() => { o = null, u(i); }, r - v))); }, () => i && u(i)]; } const Jh = (t, e, n = 3) => { let r = 0; const i = v3(50, 250); return y3((o) => { const u = o.loaded, l = o.lengthComputable ? o.total : void 0, f = u - r, d = i(f), p = u <= l; r = u; const v = { loaded: u, total: l, progress: l ? u / l : void 0, bytes: f, rate: d || void 0, estimated: d && l && p ? (l - u) / d : void 0, event: o, lengthComputable: l != null, [e ? "download" : "upload"]: !0 }; t(v); }, n); }, dE = (t, e) => { const n = t != null; return [(r) => e[0]({ lengthComputable: n, total: t, loaded: r }), e[1]]; }, fE = (t) => (...e) => Se.asap(() => t(...e)), w3 = xr.hasStandardBrowserEnv ? ( // Standard browser envs have full support of the APIs needed to test // whether the request URL is of the same origin as current location. function() { const e = xr.navigator && /(msie|trident)/i.test(xr.navigator.userAgent), n = document.createElement("a"); let r; function i(o) { let u = o; return e && (n.setAttribute("href", u), u = n.href), n.setAttribute("href", u), { href: n.href, protocol: n.protocol ? n.protocol.replace(/:$/, "") : "", host: n.host, search: n.search ? n.search.replace(/^\?/, "") : "", hash: n.hash ? n.hash.replace(/^#/, "") : "", hostname: n.hostname, port: n.port, pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname }; } return r = i(window.location.href), function(u) { const l = Se.isString(u) ? i(u) : u; return l.protocol === r.protocol && l.host === r.host; }; }() ) : ( // Non standard browser envs (web workers, react-native) lack needed support. /* @__PURE__ */ function() { return function() { return !0; }; }() ), S3 = xr.hasStandardBrowserEnv ? ( // Standard browser envs support document.cookie { write(t, e, n, r, i, o) { const u = [t + "=" + encodeURIComponent(e)]; Se.isNumber(n) && u.push("expires=" + new Date(n).toGMTString()), Se.isString(r) && u.push("path=" + r), Se.isString(i) && u.push("domain=" + i), o === !0 && u.push("secure"), document.cookie = u.join("; "); }, read(t) { const e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)")); return e ? decodeURIComponent(e[3]) : null; }, remove(t) { this.write(t, "", Date.now() - 864e5); } } ) : ( // Non-standard browser env (web workers, react-native) lack needed support. { write() { }, read() { return null; }, remove() { } } ); function _3(t) { return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t); } function b3(t, e) { return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; } function ox(t, e) { return t && !_3(e) ? b3(t, e) : e; } const hE = (t) => t instanceof Nr ? { ...t } : t; function Ja(t, e) { e = e || {}; const n = {}; function r(d, p, v) { return Se.isPlainObject(d) && Se.isPlainObject(p) ? Se.merge.call({ caseless: v }, d, p) : Se.isPlainObject(p) ? Se.merge({}, p) : Se.isArray(p) ? p.slice() : p; } function i(d, p, v) { if (Se.isUndefined(p)) { if (!Se.isUndefined(d)) return r(void 0, d, v); } else return r(d, p, v); } function o(d, p) { if (!Se.isUndefined(p)) return r(void 0, p); } function u(d, p) { if (Se.isUndefined(p)) { if (!Se.isUndefined(d)) return r(void 0, d); } else return r(void 0, p); } function l(d, p, v) { if (v in e) return r(d, p); if (v in t) return r(void 0, d); } const f = { url: o, method: o, data: o, baseURL: u, transformRequest: u, transformResponse: u, paramsSerializer: u, timeout: u, timeoutMessage: u, withCredentials: u, withXSRFToken: u, adapter: u, responseType: u, xsrfCookieName: u, xsrfHeaderName: u, onUploadProgress: u, onDownloadProgress: u, decompress: u, maxContentLength: u, maxBodyLength: u, beforeRedirect: u, transport: u, httpAgent: u, httpsAgent: u, cancelToken: u, socketPath: u, responseEncoding: u, validateStatus: l, headers: (d, p) => i(hE(d), hE(p), !0) }; return Se.forEach(Object.keys(Object.assign({}, t, e)), function(p) { const v = f[p] || i, y = v(t[p], e[p], p); Se.isUndefined(y) && v !== l || (n[p] = y); }), n; } const sx = (t) => { const e = Ja({}, t); let { data: n, withXSRFToken: r, xsrfHeaderName: i, xsrfCookieName: o, headers: u, auth: l } = e; e.headers = u = Nr.from(u), e.url = ex(ox(e.baseURL, e.url), t.params, t.paramsSerializer), l && u.set( "Authorization", "Basic " + btoa((l.username || "") + ":" + (l.password ? unescape(encodeURIComponent(l.password)) : "")) ); let f; if (Se.isFormData(n)) { if (xr.hasStandardBrowserEnv || xr.hasStandardBrowserWebWorkerEnv) u.setContentType(void 0); else if ((f = u.getContentType()) !== !1) { const [d, ...p] = f ? f.split(";").map((v) => v.trim()).filter(Boolean) : []; u.setContentType([d || "multipart/form-data", ...p].join("; ")); } } if (xr.hasStandardBrowserEnv && (r && Se.isFunction(r) && (r = r(e)), r || r !== !1 && w3(e.url))) { const d = i && o && S3.read(o); d && u.set(i, d); } return e; }, k3 = typeof XMLHttpRequest < "u", E3 = k3 && function(t) { return new Promise(function(n, r) { const i = sx(t); let o = i.data; const u = Nr.from(i.headers).normalize(); let { responseType: l, onUploadProgress: f, onDownloadProgress: d } = i, p, v, y, k, A; function E() { k && k(), A && A(), i.cancelToken && i.cancelToken.unsubscribe(p), i.signal && i.signal.removeEventListener("abort", p); } let T = new XMLHttpRequest(); T.open(i.method.toUpperCase(), i.url, !0), T.timeout = i.timeout; function D() { if (!T) return; const L = Nr.from( "getAllResponseHeaders" in T && T.getAllResponseHeaders() ), K = { data: !l || l === "text" || l === "json" ? T.responseText : T.response, status: T.status, statusText: T.statusText, headers: L, config: t, request: T }; ix(function(de) { n(de), E(); }, function(de) { r(de), E(); }, K), T = null; } "onloadend" in T ? T.onloadend = D : T.onreadystatechange = function() { !T || T.readyState !== 4 || T.status === 0 && !(T.responseURL && T.responseURL.indexOf("file:") === 0) || setTimeout(D); }, T.onabort = function() { T && (r(new xt("Request aborted", xt.ECONNABORTED, t, T)), T = null); }, T.onerror = function() { r(new xt("Network Error", xt.ERR_NETWORK, t, T)), T = null; }, T.ontimeout = function() { let j = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded"; const K = i.transitional || tx; i.timeoutErrorMessage && (j = i.timeoutErrorMessage), r(new xt( j, K.clarifyTimeoutError ? xt.ETIMEDOUT : xt.ECONNABORTED, t, T )), T = null; }, o === void 0 && u.setContentType(null), "setRequestHeader" in T && Se.forEach(u.toJSON(), function(j, K) { T.setRequestHeader(K, j); }), Se.isUndefined(i.withCredentials) || (T.withCredentials = !!i.withCredentials), l && l !== "json" && (T.responseType = i.responseType), d && ([y, A] = Jh(d, !0), T.addEventListener("progress", y)), f && T.upload && ([v, k] = Jh(f), T.upload.addEventListener("progress", v), T.upload.addEventListener("loadend", k)), (i.cancelToken || i.signal) && (p = (L) => { T && (r(!L || L.type ? new Pl(null, t, T) : L), T.abort(), T = null); }, i.cancelToken && i.cancelToken.subscribe(p), i.signal && (i.signal.aborted ? p() : i.signal.addEventListener("abort", p))); const R = g3(i.url); if (R && xr.protocols.indexOf(R) === -1) { r(new xt("Unsupported protocol " + R + ":", xt.ERR_BAD_REQUEST, t)); return; } T.send(o || null); }); }, A3 = (t, e) => { const { length: n } = t = t ? t.filter(Boolean) : []; if (e || n) { let r = new AbortController(), i; const o = function(d) { if (!i) { i = !0, l(); const p = d instanceof Error ? d : this.reason; r.abort(p instanceof xt ? p : new Pl(p instanceof Error ? p.message : p)); } }; let u = e && setTimeout(() => { u = null, o(new xt(`timeout ${e} of ms exceeded`, xt.ETIMEDOUT)); }, e); const l = () => { t && (u && clearTimeout(u), u = null, t.forEach((d) => { d.unsubscribe ? d.unsubscribe(o) : d.removeEventListener("abort", o); }), t = null); }; t.forEach((d) => d.addEventListener("abort", o)); const { signal: f } = r; return f.unsubscribe = () => Se.asap(l), f; } }, C3 = function* (t, e) { let n = t.byteLength; if (n < e) { yield t; return; } let r = 0, i; for (; r < n; ) i = r + e, yield t.slice(r, i), r = i; }, x3 = async function* (t, e) { for await (const n of N3(t)) yield* C3(n, e); }, N3 = async function* (t) { if (t[Symbol.asyncIterator]) { yield* t; return; } const e = t.getReader(); try { for (; ; ) { const { done: n, value: r } = await e.read(); if (n) break; yield r; } } finally { await e.cancel(); } }, pE = (t, e, n, r) => { const i = x3(t, e); let o = 0, u, l = (f) => { u || (u = !0, r && r(f)); }; return new ReadableStream({ async pull(f) { try { const { done: d, value: p } = await i.next(); if (d) { l(), f.close(); return; } let v = p.byteLength; if (n) { let y = o += v; n(y); } f.enqueue(new Uint8Array(p)); } catch (d) { throw l(d), d; } }, cancel(f) { return l(f), i.return(); } }, { highWaterMark: 2 }); }, Pp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", ax = Pp && typeof ReadableStream == "function", T3 = Pp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), ux = (t, ...e) => { try { return !!t(...e); } catch { return !1; } }, I3 = ax && ux(() => { let t = !1; const e = new Request(xr.origin, { body: new ReadableStream(), method: "POST", get duplex() { return t = !0, "half"; } }).headers.has("Content-Type"); return t && !e; }), mE = 64 * 1024, Oy = ax && ux(() => Se.isReadableStream(new Response("").body)), Xh = { stream: Oy && ((t) => t.body) }; Pp && ((t) => { ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => { !Xh[e] && (Xh[e] = Se.isFunction(t[e]) ? (n) => n[e]() : (n, r) => { throw new xt(`Response type '${e}' is not supported`, xt.ERR_NOT_SUPPORT, r); }); }); })(new Response()); const R3 = async (t) => { if (t == null) return 0; if (Se.isBlob(t)) return t.size; if (Se.isSpecCompliantForm(t)) return (await new Request(xr.origin, { method: "POST", body: t }).arrayBuffer()).byteLength; if (Se.isArrayBufferView(t) || Se.isArrayBuffer(t)) return t.byteLength; if (Se.isURLSearchParams(t) && (t = t + ""), Se.isString(t)) return (await T3(t)).byteLength; }, O3 = async (t, e) => { const n = Se.toFiniteNumber(t.getContentLength()); return n ?? R3(e); }, P3 = Pp && (async (t) => { let { url: e, method: n, data: r, signal: i, cancelToken: o, timeout: u, onDownloadProgress: l, onUploadProgress: f, responseType: d, headers: p, withCredentials: v = "same-origin", fetchOptions: y } = sx(t); d = d ? (d + "").toLowerCase() : "text"; let k = A3([i, o && o.toAbortSignal()], u), A; const E = k && k.unsubscribe && (() => { k.unsubscribe(); }); let T; try { if (f && I3 && n !== "get" && n !== "head" && (T = await O3(p, r)) !== 0) { let K = new Request(e, { method: "POST", body: r, duplex: "half" }), ue; if (Se.isFormData(r) && (ue = K.headers.get("content-type")) && p.setContentType(ue), K.body) { const [de, H] = dE( T, Jh(fE(f)) ); r = pE(K.body, mE, de, H); } } Se.isString(v) || (v = v ? "include" : "omit"); const D = "credentials" in Request.prototype; A = new Request(e, { ...y, signal: k, method: n.toUpperCase(), headers: p.normalize().toJSON(), body: r, duplex: "half", credentials: D ? v : void 0 }); let R = await fetch(A); const L = Oy && (d === "stream" || d === "response"); if (Oy && (l || L && E)) { const K = {}; ["status", "statusText", "headers"].forEach((ve) => { K[ve] = R[ve]; }); const ue = Se.toFiniteNumber(R.headers.get("content-length")), [de, H] = l && dE( ue, Jh(fE(l), !0) ) || []; R = new Response( pE(R.body, mE, de, () => { H && H(), E && E(); }), K ); } d = d || "text"; let j = await Xh[Se.findKey(Xh, d) || "text"](R, t); return !L && E && E(), await new Promise((K, ue) => { ix(K, ue, { data: j, headers: Nr.from(R.headers), status: R.status, statusText: R.statusText, config: t, request: A }); }); } catch (D) { throw E && E(), D && D.name === "TypeError" && /fetch/i.test(D.message) ? Object.assign( new xt("Network Error", xt.ERR_NETWORK, t, A), { cause: D.cause || D } ) : xt.from(D, D && D.code, t, A); } }), Py = { http: WB, xhr: E3, fetch: P3 }; Se.forEach(Py, (t, e) => { if (t) { try { Object.defineProperty(t, "name", { value: e }); } catch { } Object.defineProperty(t, "adapterName", { value: e }); } }); const gE = (t) => `- ${t}`, D3 = (t) => Se.isFunction(t) || t === null || t === !1, lx = { getAdapter: (t) => { t = Se.isArray(t) ? t : [t]; const { length: e } = t; let n, r; const i = {}; for (let o = 0; o < e; o++) { n = t[o]; let u; if (r = n, !D3(n) && (r = Py[(u = String(n)).toLowerCase()], r === void 0)) throw new xt(`Unknown adapter '${u}'`); if (r) break; i[u || "#" + o] = r; } if (!r) { const o = Object.entries(i).map( ([l, f]) => `adapter ${l} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build") ); let u = e ? o.length > 1 ? `since : ` + o.map(gE).join(` `) : " " + gE(o[0]) : "as no adapter specified"; throw new xt( "There is no suitable adapter to dispatch the request " + u, "ERR_NOT_SUPPORT" ); } return r; }, adapters: Py }; function xv(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Pl(null, t); } function vE(t) { return xv(t), t.headers = Nr.from(t.headers), t.data = Cv.call( t, t.transformRequest ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), lx.getAdapter(t.adapter || Td.adapter)(t).then(function(r) { return xv(t), r.data = Cv.call( t, t.transformResponse, r ), r.headers = Nr.from(r.headers), r; }, function(r) { return rx(r) || (xv(t), r && r.response && (r.response.data = Cv.call( t, t.transformResponse, r.response ), r.response.headers = Nr.from(r.response.headers))), Promise.reject(r); }); } const cx = "1.7.7", P0 = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { P0[t] = function(r) { return typeof r === t || "a" + (e < 1 ? "n " : " ") + t; }; }); const yE = {}; P0.transitional = function(e, n, r) { function i(o, u) { return "[Axios v" + cx + "] Transitional option '" + o + "'" + u + (r ? ". " + r : ""); } return (o, u, l) => { if (e === !1) throw new xt( i(u, " has been removed" + (n ? " in " + n : "")), xt.ERR_DEPRECATED ); return n && !yE[u] && (yE[u] = !0, console.warn( i( u, " has been deprecated since v" + n + " and will be removed in the near future" ) )), e ? e(o, u, l) : !0; }; }; function F3(t, e, n) { if (typeof t != "object") throw new xt("options must be an object", xt.ERR_BAD_OPTION_VALUE); const r = Object.keys(t); let i = r.length; for (; i-- > 0; ) { const o = r[i], u = e[o]; if (u) { const l = t[o], f = l === void 0 || u(l, o, t); if (f !== !0) throw new xt("option " + o + " must be " + f, xt.ERR_BAD_OPTION_VALUE); continue; } if (n !== !0) throw new xt("Unknown option " + o, xt.ERR_BAD_OPTION); } } const Dy = { assertOptions: F3, validators: P0 }, ys = Dy.validators; let Va = class { constructor(e) { this.defaults = e, this.interceptors = { request: new lE(), response: new lE() }; } /** * Dispatch a request * * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) * @param {?Object} config * * @returns {Promise} The Promise to be fulfilled */ async request(e, n) { try { return await this._request(e, n); } catch (r) { if (r instanceof Error) { let i; Error.captureStackTrace ? Error.captureStackTrace(i = {}) : i = new Error(); const o = i.stack ? i.stack.replace(/^.+\n/, "") : ""; try { r.stack ? o && !String(r.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (r.stack += ` ` + o) : r.stack = o; } catch { } } throw r; } } _request(e, n) { typeof e == "string" ? (n = n || {}, n.url = e) : n = e || {}, n = Ja(this.defaults, n); const { transitional: r, paramsSerializer: i, headers: o } = n; r !== void 0 && Dy.assertOptions(r, { silentJSONParsing: ys.transitional(ys.boolean), forcedJSONParsing: ys.transitional(ys.boolean), clarifyTimeoutError: ys.transitional(ys.boolean) }, !1), i != null && (Se.isFunction(i) ? n.paramsSerializer = { serialize: i } : Dy.assertOptions(i, { encode: ys.function, serialize: ys.function }, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase(); let u = o && Se.merge( o.common, o[n.method] ); o && Se.forEach( ["delete", "get", "head", "post", "put", "patch", "common"], (A) => { delete o[A]; } ), n.headers = Nr.concat(u, o); const l = []; let f = !0; this.interceptors.request.forEach(function(E) { typeof E.runWhen == "function" && E.runWhen(n) === !1 || (f = f && E.synchronous, l.unshift(E.fulfilled, E.rejected)); }); const d = []; this.interceptors.response.forEach(function(E) { d.push(E.fulfilled, E.rejected); }); let p, v = 0, y; if (!f) { const A = [vE.bind(this), void 0]; for (A.unshift.apply(A, l), A.push.apply(A, d), y = A.length, p = Promise.resolve(n); v < y; ) p = p.then(A[v++], A[v++]); return p; } y = l.length; let k = n; for (v = 0; v < y; ) { const A = l[v++], E = l[v++]; try { k = A(k); } catch (T) { E.call(this, T); break; } } try { p = vE.call(this, k); } catch (A) { return Promise.reject(A); } for (v = 0, y = d.length; v < y; ) p = p.then(d[v++], d[v++]); return p; } getUri(e) { e = Ja(this.defaults, e); const n = ox(e.baseURL, e.url); return ex(n, e.params, e.paramsSerializer); } }; Se.forEach(["delete", "get", "head", "options"], function(e) { Va.prototype[e] = function(n, r) { return this.request(Ja(r || {}, { method: e, url: n, data: (r || {}).data })); }; }); Se.forEach(["post", "put", "patch"], function(e) { function n(r) { return function(o, u, l) { return this.request(Ja(l || {}, { method: e, headers: r ? { "Content-Type": "multipart/form-data" } : {}, url: o, data: u })); }; } Va.prototype[e] = n(), Va.prototype[e + "Form"] = n(!0); }); let L3 = class dx { constructor(e) { if (typeof e != "function") throw new TypeError("executor must be a function."); let n; this.promise = new Promise(function(o) { n = o; }); const r = this; this.promise.then((i) => { if (!r._listeners) return; let o = r._listeners.length; for (; o-- > 0; ) r._listeners[o](i); r._listeners = null; }), this.promise.then = (i) => { let o; const u = new Promise((l) => { r.subscribe(l), o = l; }).then(i); return u.cancel = function() { r.unsubscribe(o); }, u; }, e(function(o, u, l) { r.reason || (r.reason = new Pl(o, u, l), n(r.reason)); }); } /** * Throws a `CanceledError` if cancellation has been requested. */ throwIfRequested() { if (this.reason) throw this.reason; } /** * Subscribe to the cancel signal */ subscribe(e) { if (this.reason) { e(this.reason); return; } this._listeners ? this._listeners.push(e) : this._listeners = [e]; } /** * Unsubscribe from the cancel signal */ unsubscribe(e) { if (!this._listeners) return; const n = this._listeners.indexOf(e); n !== -1 && this._listeners.splice(n, 1); } toAbortSignal() { const e = new AbortController(), n = (r) => { e.abort(r); }; return this.subscribe(n), e.signal.unsubscribe = () => this.unsubscribe(n), e.signal; } /** * Returns an object that contains a new `CancelToken` and a function that, when called, * cancels the `CancelToken`. */ static source() { let e; return { token: new dx(function(i) { e = i; }), cancel: e }; } }; function U3(t) { return function(n) { return t.apply(null, n); }; } function M3(t) { return Se.isObject(t) && t.isAxiosError === !0; } const Fy = { Continue: 100, SwitchingProtocols: 101, Processing: 102, EarlyHints: 103, Ok: 200, Created: 201, Accepted: 202, NonAuthoritativeInformation: 203, NoContent: 204, ResetContent: 205, PartialContent: 206, MultiStatus: 207, AlreadyReported: 208, ImUsed: 226, MultipleChoices: 300, MovedPermanently: 301, Found: 302, SeeOther: 303, NotModified: 304, UseProxy: 305, Unused: 306, TemporaryRedirect: 307, PermanentRedirect: 308, BadRequest: 400, Unauthorized: 401, PaymentRequired: 402, Forbidden: 403, NotFound: 404, MethodNotAllowed: 405, NotAcceptable: 406, ProxyAuthenticationRequired: 407, RequestTimeout: 408, Conflict: 409, Gone: 410, LengthRequired: 411, PreconditionFailed: 412, PayloadTooLarge: 413, UriTooLong: 414, UnsupportedMediaType: 415, RangeNotSatisfiable: 416, ExpectationFailed: 417, ImATeapot: 418, MisdirectedRequest: 421, UnprocessableEntity: 422, Locked: 423, FailedDependency: 424, TooEarly: 425, UpgradeRequired: 426, PreconditionRequired: 428, TooManyRequests: 429, RequestHeaderFieldsTooLarge: 431, UnavailableForLegalReasons: 451, InternalServerError: 500, NotImplemented: 501, BadGateway: 502, ServiceUnavailable: 503, GatewayTimeout: 504, HttpVersionNotSupported: 505, VariantAlsoNegotiates: 506, InsufficientStorage: 507, LoopDetected: 508, NotExtended: 510, NetworkAuthenticationRequired: 511 }; Object.entries(Fy).forEach(([t, e]) => { Fy[e] = t; }); function fx(t) { const e = new Va(t), n = VC(Va.prototype.request, e); return Se.extend(n, Va.prototype, e, { allOwnKeys: !0 }), Se.extend(n, e, null, { allOwnKeys: !0 }), n.create = function(i) { return fx(Ja(t, i)); }, n; } const an = fx(Td); an.Axios = Va; an.CanceledError = Pl; an.CancelToken = L3; an.isCancel = rx; an.VERSION = cx; an.toFormData = Op; an.AxiosError = xt; an.Cancel = an.CanceledError; an.all = function(e) { return Promise.all(e); }; an.spread = U3; an.isAxiosError = M3; an.mergeConfig = Ja; an.AxiosHeaders = Nr; an.formToJSON = (t) => nx(Se.isHTMLForm(t) ? new FormData(t) : t); an.getAdapter = lx.getAdapter; an.HttpStatusCode = Fy; an.default = an; const { Axios: xz, AxiosError: Nz, CanceledError: Tz, isCancel: Iz, CancelToken: Rz, VERSION: Oz, all: Pz, Cancel: Dz, isAxiosError: Fz, spread: Lz, toFormData: Uz, AxiosHeaders: Mz, HttpStatusCode: Bz, formToJSON: jz, getAdapter: $z, mergeConfig: Vz } = an; class za extends Error { response; request; constructor(e, n) { const r = `${za.extractMessage(e)}: ${JSON.stringify({ response: e, request: n })}`; super(r), Object.setPrototypeOf(this, za.prototype), this.response = e, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, za); } static extractMessage(e) { return e.errors?.[0]?.message ?? `GraphQL Error (Code: ${String(e.status)})`; } } const wE = (t) => t.toUpperCase(), Nv = (t) => typeof t == "function" ? t() : t, hx = (t, e) => t.map((n, r) => [n, e[r]]), Wu = (t) => { let e = {}; return t instanceof Headers ? e = B3(t) : Array.isArray(t) ? t.forEach(([n, r]) => { n && r !== void 0 && (e[n] = r); }) : t && (e = t), e; }, B3 = (t) => { const e = {}; return t.forEach((n, r) => { e[r] = n; }), e; }, j3 = (t) => { try { const e = t(); return $3(e) ? e.catch((n) => SE(n)) : e; } catch (e) { return SE(e); } }, SE = (t) => t instanceof Error ? t : new Error(String(t)), $3 = (t) => typeof t == "object" && t !== null && "then" in t && typeof t.then == "function" && "catch" in t && typeof t.catch == "function" && "finally" in t && typeof t.finally == "function", D0 = (t) => { throw new Error(`Unhandled case: ${String(t)}`); }, Ch = (t) => typeof t == "object" && t !== null && !Array.isArray(t), V3 = (t, e) => t.documents ? t : { documents: t, requestHeaders: e, signal: void 0 }, z3 = (t, e, n) => t.query ? t : { query: t, variables: e, requestHeaders: n, signal: void 0 }; function xh(t, e) { if (!!!t) throw new Error(e); } function q3(t) { return typeof t == "object" && t !== null; } function H3(t, e) { if (!!!t) throw new Error( "Unexpected invariant triggered." ); } const K3 = /\r\n|[\n\r]/g; function Ly(t, e) { let n = 0, r = 1; for (const i of t.body.matchAll(K3)) { if (typeof i.index == "number" || H3(!1), i.index >= e) break; n = i.index + i[0].length, r += 1; } return { line: r, column: e + 1 - n }; } function G3(t) { return px( t.source, Ly(t.source, t.start) ); } function px(t, e) { const n = t.locationOffset.column - 1, r = "".padStart(n) + t.body, i = e.line - 1, o = t.locationOffset.line - 1, u = e.line + o, l = e.line === 1 ? n : 0, f = e.column + l, d = `${t.name}:${u}:${f} `, p = r.split(/\r\n|[\n\r]/g), v = p[i]; if (v.length > 120) { const y = Math.floor(f / 80), k = f % 80, A = []; for (let E = 0; E < v.length; E += 80) A.push(v.slice(E, E + 80)); return d + _E([ [`${u} |`, A[0]], ...A.slice(1, y + 1).map((E) => ["|", E]), ["|", "^".padStart(k)], ["|", A[y + 1]] ]); } return d + _E([ // Lines specified like this: ["prefix", "string"], [`${u - 1} |`, p[i - 1]], [`${u} |`, v], ["|", "^".padStart(f)], [`${u + 1} |`, p[i + 1]] ]); } function _E(t) { const e = t.filter(([r, i]) => i !== void 0), n = Math.max(...e.map(([r]) => r.length)); return e.map(([r, i]) => r.padStart(n) + (i ? " " + i : "")).join(` `); } function W3(t) { const e = t[0]; return e == null || "kind" in e || "length" in e ? { nodes: e, source: t[1], positions: t[2], path: t[3], originalError: t[4], extensions: t[5] } : e; } class F0 extends Error { /** * An array of `{ line, column }` locations within the source GraphQL document * which correspond to this error. * * Errors during validation often contain multiple locations, for example to * point out two things with the same name. Errors during execution include a * single location, the field which produced the error. * * Enumerable, and appears in the result of JSON.stringify(). */ /** * An array describing the JSON-path into the execution response which * corresponds to this error. Only included for errors during execution. * * Enumerable, and appears in the result of JSON.stringify(). */ /** * An array of GraphQL AST Nodes corresponding to this error. */ /** * The source GraphQL document for the first location of this error. * * Note that if this Error represents more than one node, the source may not * represent nodes after the first node. */ /** * An array of character offsets within the source GraphQL document * which correspond to this error. */ /** * The original error thrown from a field resolver during execution. */ /** * Extension fields to add to the formatted error. */ /** * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. */ constructor(e, ...n) { var r, i, o; const { nodes: u, source: l, positions: f, path: d, originalError: p, extensions: v } = W3(n); super(e), this.name = "GraphQLError", this.path = d ?? void 0, this.originalError = p ?? void 0, this.nodes = bE( Array.isArray(u) ? u : u ? [u] : void 0 ); const y = bE( (r = this.nodes) === null || r === void 0 ? void 0 : r.map((A) => A.loc).filter((A) => A != null) ); this.source = l ?? (y == null || (i = y[0]) === null || i === void 0 ? void 0 : i.source), this.positions = f ?? y?.map((A) => A.start), this.locations = f && l ? f.map((A) => Ly(l, A)) : y?.map((A) => Ly(A.source, A.start)); const k = q3( p?.extensions ) ? p?.extensions : void 0; this.extensions = (o = v ?? k) !== null && o !== void 0 ? o : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, { message: { writable: !0, enumerable: !0 }, name: { enumerable: !1 }, nodes: { enumerable: !1 }, source: { enumerable: !1 }, positions: { enumerable: !1 }, originalError: { enumerable: !1 } }), p != null && p.stack ? Object.defineProperty(this, "stack", { value: p.stack, writable: !0, configurable: !0 }) : Error.captureStackTrace ? Error.captureStackTrace(this, F0) : Object.defineProperty(this, "stack", { value: Error().stack, writable: !0, configurable: !0 }); } get [Symbol.toStringTag]() { return "GraphQLError"; } toString() { let e = this.message; if (this.nodes) for (const n of this.nodes) n.loc && (e += ` ` + G3(n.loc)); else if (this.source && this.locations) for (const n of this.locations) e += ` ` + px(this.source, n); return e; } toJSON() { const e = { message: this.message }; return this.locations != null && (e.locations = this.locations), this.path != null && (e.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (e.extensions = this.extensions), e; } } function bE(t) { return t === void 0 || t.length === 0 ? void 0 : t; } function Bn(t, e, n) { return new F0(`Syntax Error: ${n}`, { source: t, positions: [e] }); } class Y3 { /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The Token at which this Node begins. */ /** * The Token at which this Node ends. */ /** * The Source document the AST represents. */ constructor(e, n, r) { this.start = e.start, this.end = n.end, this.startToken = e, this.endToken = n, this.source = r; } get [Symbol.toStringTag]() { return "Location"; } toJSON() { return { start: this.start, end: this.end }; } } class mx { /** * The kind of Token. */ /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The 1-indexed line number on which this Token appears. */ /** * The 1-indexed column number at which this Token begins. */ /** * For non-punctuation tokens, represents the interpreted value of the token. * * Note: is undefined for punctuation tokens, but typed as string for * convenience in the parser. */ /** * Tokens exist as nodes in a double-linked-list amongst all tokens * including ignored tokens. is always the first node and * the last. */ constructor(e, n, r, i, o, u) { this.kind = e, this.start = n, this.end = r, this.line = i, this.column = o, this.value = u, this.prev = null, this.next = null; } get [Symbol.toStringTag]() { return "Token"; } toJSON() { return { kind: this.kind, value: this.value, line: this.line, column: this.column }; } } const gx = { Name: [], Document: ["definitions"], OperationDefinition: [ "name", "variableDefinitions", "directives", "selectionSet" ], VariableDefinition: ["variable", "type", "defaultValue", "directives"], Variable: ["name"], SelectionSet: ["selections"], Field: ["alias", "name", "arguments", "directives", "selectionSet"], Argument: ["name", "value"], FragmentSpread: ["name", "directives"], InlineFragment: ["typeCondition", "directives", "selectionSet"], FragmentDefinition: [ "name", // Note: fragment variable definitions are deprecated and will removed in v17.0.0 "variableDefinitions", "typeCondition", "directives", "selectionSet" ], IntValue: [], FloatValue: [], StringValue: [], BooleanValue: [], NullValue: [], EnumValue: [], ListValue: ["values"], ObjectValue: ["fields"], ObjectField: ["name", "value"], Directive: ["name", "arguments"], NamedType: ["name"], ListType: ["type"], NonNullType: ["type"], SchemaDefinition: ["description", "directives", "operationTypes"], OperationTypeDefinition: ["type"], ScalarTypeDefinition: ["description", "name", "directives"], ObjectTypeDefinition: [ "description", "name", "interfaces", "directives", "fields" ], FieldDefinition: ["description", "name", "arguments", "type", "directives"], InputValueDefinition: [ "description", "name", "type", "defaultValue", "directives" ], InterfaceTypeDefinition: [ "description", "name", "interfaces", "directives", "fields" ], UnionTypeDefinition: ["description", "name", "directives", "types"], EnumTypeDefinition: ["description", "name", "directives", "values"], EnumValueDefinition: ["description", "name", "directives"], InputObjectTypeDefinition: ["description", "name", "directives", "fields"], DirectiveDefinition: ["description", "name", "arguments", "locations"], SchemaExtension: ["directives", "operationTypes"], ScalarTypeExtension: ["name", "directives"], ObjectTypeExtension: ["name", "interfaces", "directives", "fields"], InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"], UnionTypeExtension: ["name", "directives", "types"], EnumTypeExtension: ["name", "directives", "values"], InputObjectTypeExtension: ["name", "directives", "fields"] }, Q3 = new Set(Object.keys(gx)); function kE(t) { const e = t?.kind; return typeof e == "string" && Q3.has(e); } var ol; (function(t) { t.QUERY = "query", t.MUTATION = "mutation", t.SUBSCRIPTION = "subscription"; })(ol || (ol = {})); var Uy; (function(t) { t.QUERY = "QUERY", t.MUTATION = "MUTATION", t.SUBSCRIPTION = "SUBSCRIPTION", t.FIELD = "FIELD", t.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", t.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", t.INLINE_FRAGMENT = "INLINE_FRAGMENT", t.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", t.SCHEMA = "SCHEMA", t.SCALAR = "SCALAR", t.OBJECT = "OBJECT", t.FIELD_DEFINITION = "FIELD_DEFINITION", t.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", t.INTERFACE = "INTERFACE", t.UNION = "UNION", t.ENUM = "ENUM", t.ENUM_VALUE = "ENUM_VALUE", t.INPUT_OBJECT = "INPUT_OBJECT", t.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION"; })(Uy || (Uy = {})); var vt; (function(t) { t.NAME = "Name", t.DOCUMENT = "Document", t.OPERATION_DEFINITION = "OperationDefinition", t.VARIABLE_DEFINITION = "VariableDefinition", t.SELECTION_SET = "SelectionSet", t.FIELD = "Field", t.ARGUMENT = "Argument", t.FRAGMENT_SPREAD = "FragmentSpread", t.INLINE_FRAGMENT = "InlineFragment", t.FRAGMENT_DEFINITION = "FragmentDefinition", t.VARIABLE = "Variable", t.INT = "IntValue", t.FLOAT = "FloatValue", t.STRING = "StringValue", t.BOOLEAN = "BooleanValue", t.NULL = "NullValue", t.ENUM = "EnumValue", t.LIST = "ListValue", t.OBJECT = "ObjectValue", t.OBJECT_FIELD = "ObjectField", t.DIRECTIVE = "Directive", t.NAMED_TYPE = "NamedType", t.LIST_TYPE = "ListType", t.NON_NULL_TYPE = "NonNullType", t.SCHEMA_DEFINITION = "SchemaDefinition", t.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", t.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", t.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", t.FIELD_DEFINITION = "FieldDefinition", t.INPUT_VALUE_DEFINITION = "InputValueDefinition", t.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", t.UNION_TYPE_DEFINITION = "UnionTypeDefinition", t.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", t.ENUM_VALUE_DEFINITION = "EnumValueDefinition", t.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", t.DIRECTIVE_DEFINITION = "DirectiveDefinition", t.SCHEMA_EXTENSION = "SchemaExtension", t.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", t.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", t.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", t.UNION_TYPE_EXTENSION = "UnionTypeExtension", t.ENUM_TYPE_EXTENSION = "EnumTypeExtension", t.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension"; })(vt || (vt = {})); function My(t) { return t === 9 || t === 32; } function yd(t) { return t >= 48 && t <= 57; } function vx(t) { return t >= 97 && t <= 122 || // A-Z t >= 65 && t <= 90; } function yx(t) { return vx(t) || t === 95; } function J3(t) { return vx(t) || yd(t) || t === 95; } function X3(t) { var e; let n = Number.MAX_SAFE_INTEGER, r = null, i = -1; for (let u = 0; u < t.length; ++u) { var o; const l = t[u], f = Z3(l); f !== l.length && (r = (o = r) !== null && o !== void 0 ? o : u, i = u, u !== 0 && f < n && (n = f)); } return t.map((u, l) => l === 0 ? u : u.slice(n)).slice( (e = r) !== null && e !== void 0 ? e : 0, i + 1 ); } function Z3(t) { let e = 0; for (; e < t.length && My(t.charCodeAt(e)); ) ++e; return e; } function ej(t, e) { const n = t.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, o = r.length > 1 && r.slice(1).every((k) => k.length === 0 || My(k.charCodeAt(0))), u = n.endsWith('\\"""'), l = t.endsWith('"') && !u, f = t.endsWith("\\"), d = l || f, p = ( // add leading and trailing new lines only if it improves readability !i || t.length > 70 || d || o || u ); let v = ""; const y = i && My(t.charCodeAt(0)); return (p && !y || o) && (v += ` `), v += n, (p || d) && (v += ` `), '"""' + v + '"""'; } var Ne; (function(t) { t.SOF = "", t.EOF = "", t.BANG = "!", t.DOLLAR = "$", t.AMP = "&", t.PAREN_L = "(", t.PAREN_R = ")", t.SPREAD = "...", t.COLON = ":", t.EQUALS = "=", t.AT = "@", t.BRACKET_L = "[", t.BRACKET_R = "]", t.BRACE_L = "{", t.PIPE = "|", t.BRACE_R = "}", t.NAME = "Name", t.INT = "Int", t.FLOAT = "Float", t.STRING = "String", t.BLOCK_STRING = "BlockString", t.COMMENT = "Comment"; })(Ne || (Ne = {})); class tj { /** * The previously focused non-ignored token. */ /** * The currently focused non-ignored token. */ /** * The (1-indexed) line containing the current token. */ /** * The character offset at which the current line begins. */ constructor(e) { const n = new mx(Ne.SOF, 0, 0, 0, 0); this.source = e, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0; } get [Symbol.toStringTag]() { return "Lexer"; } /** * Advances the token stream to the next non-ignored token. */ advance() { return this.lastToken = this.token, this.token = this.lookahead(); } /** * Looks ahead and returns the next non-ignored token, but does not change * the state of Lexer. */ lookahead() { let e = this.token; if (e.kind !== Ne.EOF) do if (e.next) e = e.next; else { const n = rj(this, e.end); e.next = n, n.prev = e, e = n; } while (e.kind === Ne.COMMENT); return e; } } function nj(t) { return t === Ne.BANG || t === Ne.DOLLAR || t === Ne.AMP || t === Ne.PAREN_L || t === Ne.PAREN_R || t === Ne.SPREAD || t === Ne.COLON || t === Ne.EQUALS || t === Ne.AT || t === Ne.BRACKET_L || t === Ne.BRACKET_R || t === Ne.BRACE_L || t === Ne.PIPE || t === Ne.BRACE_R; } function Dl(t) { return t >= 0 && t <= 55295 || t >= 57344 && t <= 1114111; } function Dp(t, e) { return wx(t.charCodeAt(e)) && Sx(t.charCodeAt(e + 1)); } function wx(t) { return t >= 55296 && t <= 56319; } function Sx(t) { return t >= 56320 && t <= 57343; } function Xa(t, e) { const n = t.source.body.codePointAt(e); if (n === void 0) return Ne.EOF; if (n >= 32 && n <= 126) { const r = String.fromCodePoint(n); return r === '"' ? `'"'` : `"${r}"`; } return "U+" + n.toString(16).toUpperCase().padStart(4, "0"); } function Tn(t, e, n, r, i) { const o = t.line, u = 1 + n - t.lineStart; return new mx(e, n, r, o, u, i); } function rj(t, e) { const n = t.source.body, r = n.length; let i = e; for (; i < r; ) { const o = n.charCodeAt(i); switch (o) { // Ignored :: // - UnicodeBOM // - WhiteSpace // - LineTerminator // - Comment // - Comma // // UnicodeBOM :: "Byte Order Mark (U+FEFF)" // // WhiteSpace :: // - "Horizontal Tab (U+0009)" // - "Space (U+0020)" // // Comma :: , case 65279: // case 9: // \t case 32: // case 44: ++i; continue; // LineTerminator :: // - "New Line (U+000A)" // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"] // - "Carriage Return (U+000D)" "New Line (U+000A)" case 10: ++i, ++t.line, t.lineStart = i; continue; case 13: n.charCodeAt(i + 1) === 10 ? i += 2 : ++i, ++t.line, t.lineStart = i; continue; // Comment case 35: return ij(t, i); // Token :: // - Punctuator // - Name // - IntValue // - FloatValue // - StringValue // // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } case 33: return Tn(t, Ne.BANG, i, i + 1); case 36: return Tn(t, Ne.DOLLAR, i, i + 1); case 38: return Tn(t, Ne.AMP, i, i + 1); case 40: return Tn(t, Ne.PAREN_L, i, i + 1); case 41: return Tn(t, Ne.PAREN_R, i, i + 1); case 46: if (n.charCodeAt(i + 1) === 46 && n.charCodeAt(i + 2) === 46) return Tn(t, Ne.SPREAD, i, i + 3); break; case 58: return Tn(t, Ne.COLON, i, i + 1); case 61: return Tn(t, Ne.EQUALS, i, i + 1); case 64: return Tn(t, Ne.AT, i, i + 1); case 91: return Tn(t, Ne.BRACKET_L, i, i + 1); case 93: return Tn(t, Ne.BRACKET_R, i, i + 1); case 123: return Tn(t, Ne.BRACE_L, i, i + 1); case 124: return Tn(t, Ne.PIPE, i, i + 1); case 125: return Tn(t, Ne.BRACE_R, i, i + 1); // StringValue case 34: return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ? cj(t, i) : sj(t, i); } if (yd(o) || o === 45) return oj(t, i, o); if (yx(o)) return dj(t, i); throw Bn( t.source, i, o === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : Dl(o) || Dp(n, i) ? `Unexpected character: ${Xa(t, i)}.` : `Invalid character: ${Xa(t, i)}.` ); } return Tn(t, Ne.EOF, r, r); } function ij(t, e) { const n = t.source.body, r = n.length; let i = e + 1; for (; i < r; ) { const o = n.charCodeAt(i); if (o === 10 || o === 13) break; if (Dl(o)) ++i; else if (Dp(n, i)) i += 2; else break; } return Tn( t, Ne.COMMENT, e, i, n.slice(e + 1, i) ); } function oj(t, e, n) { const r = t.source.body; let i = e, o = n, u = !1; if (o === 45 && (o = r.charCodeAt(++i)), o === 48) { if (o = r.charCodeAt(++i), yd(o)) throw Bn( t.source, i, `Invalid number, unexpected digit after 0: ${Xa( t, i )}.` ); } else i = Tv(t, i, o), o = r.charCodeAt(i); if (o === 46 && (u = !0, o = r.charCodeAt(++i), i = Tv(t, i, o), o = r.charCodeAt(i)), (o === 69 || o === 101) && (u = !0, o = r.charCodeAt(++i), (o === 43 || o === 45) && (o = r.charCodeAt(++i)), i = Tv(t, i, o), o = r.charCodeAt(i)), o === 46 || yx(o)) throw Bn( t.source, i, `Invalid number, expected digit but got: ${Xa( t, i )}.` ); return Tn( t, u ? Ne.FLOAT : Ne.INT, e, i, r.slice(e, i) ); } function Tv(t, e, n) { if (!yd(n)) throw Bn( t.source, e, `Invalid number, expected digit but got: ${Xa( t, e )}.` ); const r = t.source.body; let i = e + 1; for (; yd(r.charCodeAt(i)); ) ++i; return i; } function sj(t, e) { const n = t.source.body, r = n.length; let i = e + 1, o = i, u = ""; for (; i < r; ) { const l = n.charCodeAt(i); if (l === 34) return u += n.slice(o, i), Tn(t, Ne.STRING, e, i + 1, u); if (l === 92) { u += n.slice(o, i); const f = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? aj(t, i) : uj(t, i) : lj(t, i); u += f.value, i += f.size, o = i; continue; } if (l === 10 || l === 13) break; if (Dl(l)) ++i; else if (Dp(n, i)) i += 2; else throw Bn( t.source, i, `Invalid character within String: ${Xa( t, i )}.` ); } throw Bn(t.source, i, "Unterminated string."); } function aj(t, e) { const n = t.source.body; let r = 0, i = 3; for (; i < 12; ) { const o = n.charCodeAt(e + i++); if (o === 125) { if (i < 5 || !Dl(r)) break; return { value: String.fromCodePoint(r), size: i }; } if (r = r << 4 | Yc(o), r < 0) break; } throw Bn( t.source, e, `Invalid Unicode escape sequence: "${n.slice( e, e + i )}".` ); } function uj(t, e) { const n = t.source.body, r = EE(n, e + 2); if (Dl(r)) return { value: String.fromCodePoint(r), size: 6 }; if (wx(r) && n.charCodeAt(e + 6) === 92 && n.charCodeAt(e + 7) === 117) { const i = EE(n, e + 8); if (Sx(i)) return { value: String.fromCodePoint(r, i), size: 12 }; } throw Bn( t.source, e, `Invalid Unicode escape sequence: "${n.slice(e, e + 6)}".` ); } function EE(t, e) { return Yc(t.charCodeAt(e)) << 12 | Yc(t.charCodeAt(e + 1)) << 8 | Yc(t.charCodeAt(e + 2)) << 4 | Yc(t.charCodeAt(e + 3)); } function Yc(t) { return t >= 48 && t <= 57 ? t - 48 : t >= 65 && t <= 70 ? t - 55 : t >= 97 && t <= 102 ? t - 87 : -1; } function lj(t, e) { const n = t.source.body; switch (n.charCodeAt(e + 1)) { case 34: return { value: '"', size: 2 }; case 92: return { value: "\\", size: 2 }; case 47: return { value: "/", size: 2 }; case 98: return { value: "\b", size: 2 }; case 102: return { value: "\f", size: 2 }; case 110: return { value: ` `, size: 2 }; case 114: return { value: "\r", size: 2 }; case 116: return { value: " ", size: 2 }; } throw Bn( t.source, e, `Invalid character escape sequence: "${n.slice( e, e + 2 )}".` ); } function cj(t, e) { const n = t.source.body, r = n.length; let i = t.lineStart, o = e + 3, u = o, l = ""; const f = []; for (; o < r; ) { const d = n.charCodeAt(o); if (d === 34 && n.charCodeAt(o + 1) === 34 && n.charCodeAt(o + 2) === 34) { l += n.slice(u, o), f.push(l); const p = Tn( t, Ne.BLOCK_STRING, e, o + 3, // Return a string of the lines joined with U+000A. X3(f).join(` `) ); return t.line += f.length - 1, t.lineStart = i, p; } if (d === 92 && n.charCodeAt(o + 1) === 34 && n.charCodeAt(o + 2) === 34 && n.charCodeAt(o + 3) === 34) { l += n.slice(u, o), u = o + 1, o += 4; continue; } if (d === 10 || d === 13) { l += n.slice(u, o), f.push(l), d === 13 && n.charCodeAt(o + 1) === 10 ? o += 2 : ++o, l = "", u = o, i = o; continue; } if (Dl(d)) ++o; else if (Dp(n, o)) o += 2; else throw Bn( t.source, o, `Invalid character within String: ${Xa( t, o )}.` ); } throw Bn(t.source, o, "Unterminated string."); } function dj(t, e) { const n = t.source.body, r = n.length; let i = e + 1; for (; i < r; ) { const o = n.charCodeAt(i); if (J3(o)) ++i; else break; } return Tn( t, Ne.NAME, e, i, n.slice(e, i) ); } const fj = 10, _x = 2; function L0(t) { return Fp(t, []); } function Fp(t, e) { switch (typeof t) { case "string": return JSON.stringify(t); case "function": return t.name ? `[function ${t.name}]` : "[function]"; case "object": return hj(t, e); default: return String(t); } } function hj(t, e) { if (t === null) return "null"; if (e.includes(t)) return "[Circular]"; const n = [...e, t]; if (pj(t)) { const r = t.toJSON(); if (r !== t) return typeof r == "string" ? r : Fp(r, n); } else if (Array.isArray(t)) return gj(t, n); return mj(t, n); } function pj(t) { return typeof t.toJSON == "function"; } function mj(t, e) { const n = Object.entries(t); return n.length === 0 ? "{}" : e.length > _x ? "[" + vj(t) + "]" : "{ " + n.map( ([i, o]) => i + ": " + Fp(o, e) ).join(", ") + " }"; } function gj(t, e) { if (t.length === 0) return "[]"; if (e.length > _x) return "[Array]"; const n = Math.min(fj, t.length), r = t.length - n, i = []; for (let o = 0; o < n; ++o) i.push(Fp(t[o], e)); return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]"; } function vj(t) { const e = Object.prototype.toString.call(t).replace(/^\[object /, "").replace(/]$/, ""); if (e === "Object" && typeof t.constructor == "function") { const n = t.constructor.name; if (typeof n == "string" && n !== "") return n; } return e; } const yj = globalThis.process && // eslint-disable-next-line no-undef !0, wj = ( /* c8 ignore next 6 */ // FIXME: https://github.com/graphql/graphql-js/issues/2317 yj ? function(e, n) { return e instanceof n; } : function(e, n) { if (e instanceof n) return !0; if (typeof e == "object" && e !== null) { var r; const i = n.prototype[Symbol.toStringTag], o = ( // We still need to support constructor's name to detect conflicts with older versions of this library. Symbol.toStringTag in e ? e[Symbol.toStringTag] : (r = e.constructor) === null || r === void 0 ? void 0 : r.name ); if (i === o) { const u = L0(e); throw new Error(`Cannot use ${i} "${u}" from another module or realm. Ensure that there is only one instance of "graphql" in the node_modules directory. If different versions of "graphql" are the dependencies of other relied on modules, use "resolutions" to ensure only one version is installed. https://yarnpkg.com/en/docs/selective-version-resolutions Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior. The data from one version used in the function from another could produce confusing and spurious results.`); } } return !1; } ); class bx { constructor(e, n = "GraphQL request", r = { line: 1, column: 1 }) { typeof e == "string" || xh(!1, `Body must be a string. Received: ${L0(e)}.`), this.body = e, this.name = n, this.locationOffset = r, this.locationOffset.line > 0 || xh( !1, "line in locationOffset is 1-indexed and must be positive." ), this.locationOffset.column > 0 || xh( !1, "column in locationOffset is 1-indexed and must be positive." ); } get [Symbol.toStringTag]() { return "Source"; } } function Sj(t) { return wj(t, bx); } function _j(t, e) { return new bj(t, e).parseDocument(); } class bj { constructor(e, n = {}) { const r = Sj(e) ? e : new bx(e); this._lexer = new tj(r), this._options = n, this._tokenCounter = 0; } /** * Converts a name lex token into a name parse node. */ parseName() { const e = this.expectToken(Ne.NAME); return this.node(e, { kind: vt.NAME, value: e.value }); } // Implements the parsing rules in the Document section. /** * Document : Definition+ */ parseDocument() { return this.node(this._lexer.token, { kind: vt.DOCUMENT, definitions: this.many( Ne.SOF, this.parseDefinition, Ne.EOF ) }); } /** * Definition : * - ExecutableDefinition * - TypeSystemDefinition * - TypeSystemExtension * * ExecutableDefinition : * - OperationDefinition * - FragmentDefinition * * TypeSystemDefinition : * - SchemaDefinition * - TypeDefinition * - DirectiveDefinition * * TypeDefinition : * - ScalarTypeDefinition * - ObjectTypeDefinition * - InterfaceTypeDefinition * - UnionTypeDefinition * - EnumTypeDefinition * - InputObjectTypeDefinition */ parseDefinition() { if (this.peek(Ne.BRACE_L)) return this.parseOperationDefinition(); const e = this.peekDescription(), n = e ? this._lexer.lookahead() : this._lexer.token; if (n.kind === Ne.NAME) { switch (n.value) { case "schema": return this.parseSchemaDefinition(); case "scalar": return this.parseScalarTypeDefinition(); case "type": return this.parseObjectTypeDefinition(); case "interface": return this.parseInterfaceTypeDefinition(); case "union": return this.parseUnionTypeDefinition(); case "enum": return this.parseEnumTypeDefinition(); case "input": return this.parseInputObjectTypeDefinition(); case "directive": return this.parseDirectiveDefinition(); } if (e) throw Bn( this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are supported only on type definitions." ); switch (n.value) { case "query": case "mutation": case "subscription": return this.parseOperationDefinition(); case "fragment": return this.parseFragmentDefinition(); case "extend": return this.parseTypeSystemExtension(); } } throw this.unexpected(n); } // Implements the parsing rules in the Operations section. /** * OperationDefinition : * - SelectionSet * - OperationType Name? VariableDefinitions? Directives? SelectionSet */ parseOperationDefinition() { const e = this._lexer.token; if (this.peek(Ne.BRACE_L)) return this.node(e, { kind: vt.OPERATION_DEFINITION, operation: ol.QUERY, name: void 0, variableDefinitions: [], directives: [], selectionSet: this.parseSelectionSet() }); const n = this.parseOperationType(); let r; return this.peek(Ne.NAME) && (r = this.parseName()), this.node(e, { kind: vt.OPERATION_DEFINITION, operation: n, name: r, variableDefinitions: this.parseVariableDefinitions(), directives: this.parseDirectives(!1), selectionSet: this.parseSelectionSet() }); } /** * OperationType : one of query mutation subscription */ parseOperationType() { const e = this.expectToken(Ne.NAME); switch (e.value) { case "query": return ol.QUERY; case "mutation": return ol.MUTATION; case "subscription": return ol.SUBSCRIPTION; } throw this.unexpected(e); } /** * VariableDefinitions : ( VariableDefinition+ ) */ parseVariableDefinitions() { return this.optionalMany( Ne.PAREN_L, this.parseVariableDefinition, Ne.PAREN_R ); } /** * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? */ parseVariableDefinition() { return this.node(this._lexer.token, { kind: vt.VARIABLE_DEFINITION, variable: this.parseVariable(), type: (this.expectToken(Ne.COLON), this.parseTypeReference()), defaultValue: this.expectOptionalToken(Ne.EQUALS) ? this.parseConstValueLiteral() : void 0, directives: this.parseConstDirectives() }); } /** * Variable : $ Name */ parseVariable() { const e = this._lexer.token; return this.expectToken(Ne.DOLLAR), this.node(e, { kind: vt.VARIABLE, name: this.parseName() }); } /** * ``` * SelectionSet : { Selection+ } * ``` */ parseSelectionSet() { return this.node(this._lexer.token, { kind: vt.SELECTION_SET, selections: this.many( Ne.BRACE_L, this.parseSelection, Ne.BRACE_R ) }); } /** * Selection : * - Field * - FragmentSpread * - InlineFragment */ parseSelection() { return this.peek(Ne.SPREAD) ? this.parseFragment() : this.parseField(); } /** * Field : Alias? Name Arguments? Directives? SelectionSet? * * Alias : Name : */ parseField() { const e = this._lexer.token, n = this.parseName(); let r, i; return this.expectOptionalToken(Ne.COLON) ? (r = n, i = this.parseName()) : i = n, this.node(e, { kind: vt.FIELD, alias: r, name: i, arguments: this.parseArguments(!1), directives: this.parseDirectives(!1), selectionSet: this.peek(Ne.BRACE_L) ? this.parseSelectionSet() : void 0 }); } /** * Arguments[Const] : ( Argument[?Const]+ ) */ parseArguments(e) { const n = e ? this.parseConstArgument : this.parseArgument; return this.optionalMany(Ne.PAREN_L, n, Ne.PAREN_R); } /** * Argument[Const] : Name : Value[?Const] */ parseArgument(e = !1) { const n = this._lexer.token, r = this.parseName(); return this.expectToken(Ne.COLON), this.node(n, { kind: vt.ARGUMENT, name: r, value: this.parseValueLiteral(e) }); } parseConstArgument() { return this.parseArgument(!0); } // Implements the parsing rules in the Fragments section. /** * Corresponds to both FragmentSpread and InlineFragment in the spec. * * FragmentSpread : ... FragmentName Directives? * * InlineFragment : ... TypeCondition? Directives? SelectionSet */ parseFragment() { const e = this._lexer.token; this.expectToken(Ne.SPREAD); const n = this.expectOptionalKeyword("on"); return !n && this.peek(Ne.NAME) ? this.node(e, { kind: vt.FRAGMENT_SPREAD, name: this.parseFragmentName(), directives: this.parseDirectives(!1) }) : this.node(e, { kind: vt.INLINE_FRAGMENT, typeCondition: n ? this.parseNamedType() : void 0, directives: this.parseDirectives(!1), selectionSet: this.parseSelectionSet() }); } /** * FragmentDefinition : * - fragment FragmentName on TypeCondition Directives? SelectionSet * * TypeCondition : NamedType */ parseFragmentDefinition() { const e = this._lexer.token; return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(e, { kind: vt.FRAGMENT_DEFINITION, name: this.parseFragmentName(), variableDefinitions: this.parseVariableDefinitions(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(!1), selectionSet: this.parseSelectionSet() }) : this.node(e, { kind: vt.FRAGMENT_DEFINITION, name: this.parseFragmentName(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(!1), selectionSet: this.parseSelectionSet() }); } /** * FragmentName : Name but not `on` */ parseFragmentName() { if (this._lexer.token.value === "on") throw this.unexpected(); return this.parseName(); } // Implements the parsing rules in the Values section. /** * Value[Const] : * - [~Const] Variable * - IntValue * - FloatValue * - StringValue * - BooleanValue * - NullValue * - EnumValue * - ListValue[?Const] * - ObjectValue[?Const] * * BooleanValue : one of `true` `false` * * NullValue : `null` * * EnumValue : Name but not `true`, `false` or `null` */ parseValueLiteral(e) { const n = this._lexer.token; switch (n.kind) { case Ne.BRACKET_L: return this.parseList(e); case Ne.BRACE_L: return this.parseObject(e); case Ne.INT: return this.advanceLexer(), this.node(n, { kind: vt.INT, value: n.value }); case Ne.FLOAT: return this.advanceLexer(), this.node(n, { kind: vt.FLOAT, value: n.value }); case Ne.STRING: case Ne.BLOCK_STRING: return this.parseStringLiteral(); case Ne.NAME: switch (this.advanceLexer(), n.value) { case "true": return this.node(n, { kind: vt.BOOLEAN, value: !0 }); case "false": return this.node(n, { kind: vt.BOOLEAN, value: !1 }); case "null": return this.node(n, { kind: vt.NULL }); default: return this.node(n, { kind: vt.ENUM, value: n.value }); } case Ne.DOLLAR: if (e) if (this.expectToken(Ne.DOLLAR), this._lexer.token.kind === Ne.NAME) { const r = this._lexer.token.value; throw Bn( this._lexer.source, n.start, `Unexpected variable "$${r}" in constant value.` ); } else throw this.unexpected(n); return this.parseVariable(); default: throw this.unexpected(); } } parseConstValueLiteral() { return this.parseValueLiteral(!0); } parseStringLiteral() { const e = this._lexer.token; return this.advanceLexer(), this.node(e, { kind: vt.STRING, value: e.value, block: e.kind === Ne.BLOCK_STRING }); } /** * ListValue[Const] : * - [ ] * - [ Value[?Const]+ ] */ parseList(e) { const n = () => this.parseValueLiteral(e); return this.node(this._lexer.token, { kind: vt.LIST, values: this.any(Ne.BRACKET_L, n, Ne.BRACKET_R) }); } /** * ``` * ObjectValue[Const] : * - { } * - { ObjectField[?Const]+ } * ``` */ parseObject(e) { const n = () => this.parseObjectField(e); return this.node(this._lexer.token, { kind: vt.OBJECT, fields: this.any(Ne.BRACE_L, n, Ne.BRACE_R) }); } /** * ObjectField[Const] : Name : Value[?Const] */ parseObjectField(e) { const n = this._lexer.token, r = this.parseName(); return this.expectToken(Ne.COLON), this.node(n, { kind: vt.OBJECT_FIELD, name: r, value: this.parseValueLiteral(e) }); } // Implements the parsing rules in the Directives section. /** * Directives[Const] : Directive[?Const]+ */ parseDirectives(e) { const n = []; for (; this.peek(Ne.AT); ) n.push(this.parseDirective(e)); return n; } parseConstDirectives() { return this.parseDirectives(!0); } /** * ``` * Directive[Const] : @ Name Arguments[?Const]? * ``` */ parseDirective(e) { const n = this._lexer.token; return this.expectToken(Ne.AT), this.node(n, { kind: vt.DIRECTIVE, name: this.parseName(), arguments: this.parseArguments(e) }); } // Implements the parsing rules in the Types section. /** * Type : * - NamedType * - ListType * - NonNullType */ parseTypeReference() { const e = this._lexer.token; let n; if (this.expectOptionalToken(Ne.BRACKET_L)) { const r = this.parseTypeReference(); this.expectToken(Ne.BRACKET_R), n = this.node(e, { kind: vt.LIST_TYPE, type: r }); } else n = this.parseNamedType(); return this.expectOptionalToken(Ne.BANG) ? this.node(e, { kind: vt.NON_NULL_TYPE, type: n }) : n; } /** * NamedType : Name */ parseNamedType() { return this.node(this._lexer.token, { kind: vt.NAMED_TYPE, name: this.parseName() }); } // Implements the parsing rules in the Type Definition section. peekDescription() { return this.peek(Ne.STRING) || this.peek(Ne.BLOCK_STRING); } /** * Description : StringValue */ parseDescription() { if (this.peekDescription()) return this.parseStringLiteral(); } /** * ``` * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } * ``` */ parseSchemaDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("schema"); const r = this.parseConstDirectives(), i = this.many( Ne.BRACE_L, this.parseOperationTypeDefinition, Ne.BRACE_R ); return this.node(e, { kind: vt.SCHEMA_DEFINITION, description: n, directives: r, operationTypes: i }); } /** * OperationTypeDefinition : OperationType : NamedType */ parseOperationTypeDefinition() { const e = this._lexer.token, n = this.parseOperationType(); this.expectToken(Ne.COLON); const r = this.parseNamedType(); return this.node(e, { kind: vt.OPERATION_TYPE_DEFINITION, operation: n, type: r }); } /** * ScalarTypeDefinition : Description? scalar Name Directives[Const]? */ parseScalarTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("scalar"); const r = this.parseName(), i = this.parseConstDirectives(); return this.node(e, { kind: vt.SCALAR_TYPE_DEFINITION, description: n, name: r, directives: i }); } /** * ObjectTypeDefinition : * Description? * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? */ parseObjectTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("type"); const r = this.parseName(), i = this.parseImplementsInterfaces(), o = this.parseConstDirectives(), u = this.parseFieldsDefinition(); return this.node(e, { kind: vt.OBJECT_TYPE_DEFINITION, description: n, name: r, interfaces: i, directives: o, fields: u }); } /** * ImplementsInterfaces : * - implements `&`? NamedType * - ImplementsInterfaces & NamedType */ parseImplementsInterfaces() { return this.expectOptionalKeyword("implements") ? this.delimitedMany(Ne.AMP, this.parseNamedType) : []; } /** * ``` * FieldsDefinition : { FieldDefinition+ } * ``` */ parseFieldsDefinition() { return this.optionalMany( Ne.BRACE_L, this.parseFieldDefinition, Ne.BRACE_R ); } /** * FieldDefinition : * - Description? Name ArgumentsDefinition? : Type Directives[Const]? */ parseFieldDefinition() { const e = this._lexer.token, n = this.parseDescription(), r = this.parseName(), i = this.parseArgumentDefs(); this.expectToken(Ne.COLON); const o = this.parseTypeReference(), u = this.parseConstDirectives(); return this.node(e, { kind: vt.FIELD_DEFINITION, description: n, name: r, arguments: i, type: o, directives: u }); } /** * ArgumentsDefinition : ( InputValueDefinition+ ) */ parseArgumentDefs() { return this.optionalMany( Ne.PAREN_L, this.parseInputValueDef, Ne.PAREN_R ); } /** * InputValueDefinition : * - Description? Name : Type DefaultValue? Directives[Const]? */ parseInputValueDef() { const e = this._lexer.token, n = this.parseDescription(), r = this.parseName(); this.expectToken(Ne.COLON); const i = this.parseTypeReference(); let o; this.expectOptionalToken(Ne.EQUALS) && (o = this.parseConstValueLiteral()); const u = this.parseConstDirectives(); return this.node(e, { kind: vt.INPUT_VALUE_DEFINITION, description: n, name: r, type: i, defaultValue: o, directives: u }); } /** * InterfaceTypeDefinition : * - Description? interface Name Directives[Const]? FieldsDefinition? */ parseInterfaceTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("interface"); const r = this.parseName(), i = this.parseImplementsInterfaces(), o = this.parseConstDirectives(), u = this.parseFieldsDefinition(); return this.node(e, { kind: vt.INTERFACE_TYPE_DEFINITION, description: n, name: r, interfaces: i, directives: o, fields: u }); } /** * UnionTypeDefinition : * - Description? union Name Directives[Const]? UnionMemberTypes? */ parseUnionTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("union"); const r = this.parseName(), i = this.parseConstDirectives(), o = this.parseUnionMemberTypes(); return this.node(e, { kind: vt.UNION_TYPE_DEFINITION, description: n, name: r, directives: i, types: o }); } /** * UnionMemberTypes : * - = `|`? NamedType * - UnionMemberTypes | NamedType */ parseUnionMemberTypes() { return this.expectOptionalToken(Ne.EQUALS) ? this.delimitedMany(Ne.PIPE, this.parseNamedType) : []; } /** * EnumTypeDefinition : * - Description? enum Name Directives[Const]? EnumValuesDefinition? */ parseEnumTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("enum"); const r = this.parseName(), i = this.parseConstDirectives(), o = this.parseEnumValuesDefinition(); return this.node(e, { kind: vt.ENUM_TYPE_DEFINITION, description: n, name: r, directives: i, values: o }); } /** * ``` * EnumValuesDefinition : { EnumValueDefinition+ } * ``` */ parseEnumValuesDefinition() { return this.optionalMany( Ne.BRACE_L, this.parseEnumValueDefinition, Ne.BRACE_R ); } /** * EnumValueDefinition : Description? EnumValue Directives[Const]? */ parseEnumValueDefinition() { const e = this._lexer.token, n = this.parseDescription(), r = this.parseEnumValueName(), i = this.parseConstDirectives(); return this.node(e, { kind: vt.ENUM_VALUE_DEFINITION, description: n, name: r, directives: i }); } /** * EnumValue : Name but not `true`, `false` or `null` */ parseEnumValueName() { if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw Bn( this._lexer.source, this._lexer.token.start, `${uh( this._lexer.token )} is reserved and cannot be used for an enum value.` ); return this.parseName(); } /** * InputObjectTypeDefinition : * - Description? input Name Directives[Const]? InputFieldsDefinition? */ parseInputObjectTypeDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("input"); const r = this.parseName(), i = this.parseConstDirectives(), o = this.parseInputFieldsDefinition(); return this.node(e, { kind: vt.INPUT_OBJECT_TYPE_DEFINITION, description: n, name: r, directives: i, fields: o }); } /** * ``` * InputFieldsDefinition : { InputValueDefinition+ } * ``` */ parseInputFieldsDefinition() { return this.optionalMany( Ne.BRACE_L, this.parseInputValueDef, Ne.BRACE_R ); } /** * TypeSystemExtension : * - SchemaExtension * - TypeExtension * * TypeExtension : * - ScalarTypeExtension * - ObjectTypeExtension * - InterfaceTypeExtension * - UnionTypeExtension * - EnumTypeExtension * - InputObjectTypeDefinition */ parseTypeSystemExtension() { const e = this._lexer.lookahead(); if (e.kind === Ne.NAME) switch (e.value) { case "schema": return this.parseSchemaExtension(); case "scalar": return this.parseScalarTypeExtension(); case "type": return this.parseObjectTypeExtension(); case "interface": return this.parseInterfaceTypeExtension(); case "union": return this.parseUnionTypeExtension(); case "enum": return this.parseEnumTypeExtension(); case "input": return this.parseInputObjectTypeExtension(); } throw this.unexpected(e); } /** * ``` * SchemaExtension : * - extend schema Directives[Const]? { OperationTypeDefinition+ } * - extend schema Directives[Const] * ``` */ parseSchemaExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("schema"); const n = this.parseConstDirectives(), r = this.optionalMany( Ne.BRACE_L, this.parseOperationTypeDefinition, Ne.BRACE_R ); if (n.length === 0 && r.length === 0) throw this.unexpected(); return this.node(e, { kind: vt.SCHEMA_EXTENSION, directives: n, operationTypes: r }); } /** * ScalarTypeExtension : * - extend scalar Name Directives[Const] */ parseScalarTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("scalar"); const n = this.parseName(), r = this.parseConstDirectives(); if (r.length === 0) throw this.unexpected(); return this.node(e, { kind: vt.SCALAR_TYPE_EXTENSION, name: n, directives: r }); } /** * ObjectTypeExtension : * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition * - extend type Name ImplementsInterfaces? Directives[Const] * - extend type Name ImplementsInterfaces */ parseObjectTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("type"); const n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), o = this.parseFieldsDefinition(); if (r.length === 0 && i.length === 0 && o.length === 0) throw this.unexpected(); return this.node(e, { kind: vt.OBJECT_TYPE_EXTENSION, name: n, interfaces: r, directives: i, fields: o }); } /** * InterfaceTypeExtension : * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition * - extend interface Name ImplementsInterfaces? Directives[Const] * - extend interface Name ImplementsInterfaces */ parseInterfaceTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("interface"); const n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), o = this.parseFieldsDefinition(); if (r.length === 0 && i.length === 0 && o.length === 0) throw this.unexpected(); return this.node(e, { kind: vt.INTERFACE_TYPE_EXTENSION, name: n, interfaces: r, directives: i, fields: o }); } /** * UnionTypeExtension : * - extend union Name Directives[Const]? UnionMemberTypes * - extend union Name Directives[Const] */ parseUnionTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("union"); const n = this.parseName(), r = this.parseConstDirectives(), i = this.parseUnionMemberTypes(); if (r.length === 0 && i.length === 0) throw this.unexpected(); return this.node(e, { kind: vt.UNION_TYPE_EXTENSION, name: n, directives: r, types: i }); } /** * EnumTypeExtension : * - extend enum Name Directives[Const]? EnumValuesDefinition * - extend enum Name Directives[Const] */ parseEnumTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("enum"); const n = this.parseName(), r = this.parseConstDirectives(), i = this.parseEnumValuesDefinition(); if (r.length === 0 && i.length === 0) throw this.unexpected(); return this.node(e, { kind: vt.ENUM_TYPE_EXTENSION, name: n, directives: r, values: i }); } /** * InputObjectTypeExtension : * - extend input Name Directives[Const]? InputFieldsDefinition * - extend input Name Directives[Const] */ parseInputObjectTypeExtension() { const e = this._lexer.token; this.expectKeyword("extend"), this.expectKeyword("input"); const n = this.parseName(), r = this.parseConstDirectives(), i = this.parseInputFieldsDefinition(); if (r.length === 0 && i.length === 0) throw this.unexpected(); return this.node(e, { kind: vt.INPUT_OBJECT_TYPE_EXTENSION, name: n, directives: r, fields: i }); } /** * ``` * DirectiveDefinition : * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations * ``` */ parseDirectiveDefinition() { const e = this._lexer.token, n = this.parseDescription(); this.expectKeyword("directive"), this.expectToken(Ne.AT); const r = this.parseName(), i = this.parseArgumentDefs(), o = this.expectOptionalKeyword("repeatable"); this.expectKeyword("on"); const u = this.parseDirectiveLocations(); return this.node(e, { kind: vt.DIRECTIVE_DEFINITION, description: n, name: r, arguments: i, repeatable: o, locations: u }); } /** * DirectiveLocations : * - `|`? DirectiveLocation * - DirectiveLocations | DirectiveLocation */ parseDirectiveLocations() { return this.delimitedMany(Ne.PIPE, this.parseDirectiveLocation); } /* * DirectiveLocation : * - ExecutableDirectiveLocation * - TypeSystemDirectiveLocation * * ExecutableDirectiveLocation : one of * `QUERY` * `MUTATION` * `SUBSCRIPTION` * `FIELD` * `FRAGMENT_DEFINITION` * `FRAGMENT_SPREAD` * `INLINE_FRAGMENT` * * TypeSystemDirectiveLocation : one of * `SCHEMA` * `SCALAR` * `OBJECT` * `FIELD_DEFINITION` * `ARGUMENT_DEFINITION` * `INTERFACE` * `UNION` * `ENUM` * `ENUM_VALUE` * `INPUT_OBJECT` * `INPUT_FIELD_DEFINITION` */ parseDirectiveLocation() { const e = this._lexer.token, n = this.parseName(); if (Object.prototype.hasOwnProperty.call(Uy, n.value)) return n; throw this.unexpected(e); } // Core parsing utility functions /** * Returns a node that, if configured to do so, sets a "loc" field as a * location object, used to identify the place in the source that created a * given parsed object. */ node(e, n) { return this._options.noLocation !== !0 && (n.loc = new Y3( e, this._lexer.lastToken, this._lexer.source )), n; } /** * Determines if the next token is of a given kind */ peek(e) { return this._lexer.token.kind === e; } /** * If the next token is of the given kind, return that token after advancing the lexer. * Otherwise, do not change the parser state and throw an error. */ expectToken(e) { const n = this._lexer.token; if (n.kind === e) return this.advanceLexer(), n; throw Bn( this._lexer.source, n.start, `Expected ${kx(e)}, found ${uh(n)}.` ); } /** * If the next token is of the given kind, return "true" after advancing the lexer. * Otherwise, do not change the parser state and return "false". */ expectOptionalToken(e) { return this._lexer.token.kind === e ? (this.advanceLexer(), !0) : !1; } /** * If the next token is a given keyword, advance the lexer. * Otherwise, do not change the parser state and throw an error. */ expectKeyword(e) { const n = this._lexer.token; if (n.kind === Ne.NAME && n.value === e) this.advanceLexer(); else throw Bn( this._lexer.source, n.start, `Expected "${e}", found ${uh(n)}.` ); } /** * If the next token is a given keyword, return "true" after advancing the lexer. * Otherwise, do not change the parser state and return "false". */ expectOptionalKeyword(e) { const n = this._lexer.token; return n.kind === Ne.NAME && n.value === e ? (this.advanceLexer(), !0) : !1; } /** * Helper function for creating an error when an unexpected lexed token is encountered. */ unexpected(e) { const n = e ?? this._lexer.token; return Bn( this._lexer.source, n.start, `Unexpected ${uh(n)}.` ); } /** * Returns a possibly empty list of parse nodes, determined by the parseFn. * This list begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ any(e, n, r) { this.expectToken(e); const i = []; for (; !this.expectOptionalToken(r); ) i.push(n.call(this)); return i; } /** * Returns a list of parse nodes, determined by the parseFn. * It can be empty only if open token is missing otherwise it will always return non-empty list * that begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ optionalMany(e, n, r) { if (this.expectOptionalToken(e)) { const i = []; do i.push(n.call(this)); while (!this.expectOptionalToken(r)); return i; } return []; } /** * Returns a non-empty list of parse nodes, determined by the parseFn. * This list begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ many(e, n, r) { this.expectToken(e); const i = []; do i.push(n.call(this)); while (!this.expectOptionalToken(r)); return i; } /** * Returns a non-empty list of parse nodes, determined by the parseFn. * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. * Advances the parser to the next lex token after last item in the list. */ delimitedMany(e, n) { this.expectOptionalToken(e); const r = []; do r.push(n.call(this)); while (this.expectOptionalToken(e)); return r; } advanceLexer() { const { maxTokens: e } = this._options, n = this._lexer.advance(); if (e !== void 0 && n.kind !== Ne.EOF && (++this._tokenCounter, this._tokenCounter > e)) throw Bn( this._lexer.source, n.start, `Document contains more that ${e} tokens. Parsing aborted.` ); } } function uh(t) { const e = t.value; return kx(t.kind) + (e != null ? ` "${e}"` : ""); } function kx(t) { return nj(t) ? `"${t}"` : t; } function kj(t) { return `"${t.replace(Ej, Aj)}"`; } const Ej = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; function Aj(t) { return Cj[t.charCodeAt(0)]; } const Cj = [ "\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\u000B", "\\f", "\\r", "\\u000E", "\\u000F", "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001A", "\\u001B", "\\u001C", "\\u001D", "\\u001E", "\\u001F", "", "", '\\"', "", "", "", "", "", "", "", "", "", "", "", "", "", // 2F "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", // 3F "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", // 4F "", "", "", "", "", "", "", "", "", "", "", "", "\\\\", "", "", "", // 5F "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", // 6F "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\\u007F", "\\u0080", "\\u0081", "\\u0082", "\\u0083", "\\u0084", "\\u0085", "\\u0086", "\\u0087", "\\u0088", "\\u0089", "\\u008A", "\\u008B", "\\u008C", "\\u008D", "\\u008E", "\\u008F", "\\u0090", "\\u0091", "\\u0092", "\\u0093", "\\u0094", "\\u0095", "\\u0096", "\\u0097", "\\u0098", "\\u0099", "\\u009A", "\\u009B", "\\u009C", "\\u009D", "\\u009E", "\\u009F" ], xj = Object.freeze({}); function Nj(t, e, n = gx) { const r = /* @__PURE__ */ new Map(); for (const D of Object.values(vt)) r.set(D, Tj(e, D)); let i, o = Array.isArray(t), u = [t], l = -1, f = [], d = t, p, v; const y = [], k = []; do { l++; const D = l === u.length, R = D && f.length !== 0; if (D) { if (p = k.length === 0 ? void 0 : y[y.length - 1], d = v, v = k.pop(), R) if (o) { d = d.slice(); let j = 0; for (const [K, ue] of f) { const de = K - j; ue === null ? (d.splice(de, 1), j++) : d[de] = ue; } } else { d = Object.defineProperties( {}, Object.getOwnPropertyDescriptors(d) ); for (const [j, K] of f) d[j] = K; } l = i.index, u = i.keys, f = i.edits, o = i.inArray, i = i.prev; } else if (v) { if (p = o ? l : u[l], d = v[p], d == null) continue; y.push(p); } let L; if (!Array.isArray(d)) { var A, E; kE(d) || xh(!1, `Invalid AST Node: ${L0(d)}.`); const j = D ? (A = r.get(d.kind)) === null || A === void 0 ? void 0 : A.leave : (E = r.get(d.kind)) === null || E === void 0 ? void 0 : E.enter; if (L = j?.call(e, d, p, v, y, k), L === xj) break; if (L === !1) { if (!D) { y.pop(); continue; } } else if (L !== void 0 && (f.push([p, L]), !D)) if (kE(L)) d = L; else { y.pop(); continue; } } if (L === void 0 && R && f.push([p, d]), D) y.pop(); else { var T; i = { inArray: o, index: l, keys: u, edits: f, prev: i }, o = Array.isArray(d), u = o ? d : (T = n[d.kind]) !== null && T !== void 0 ? T : [], l = -1, f = [], v && k.push(v), v = d; } } while (i !== void 0); return f.length !== 0 ? f[f.length - 1][1] : t; } function Tj(t, e) { const n = t[e]; return typeof n == "object" ? n : typeof n == "function" ? { enter: n, leave: void 0 } : { enter: t.enter, leave: t.leave }; } function Ij(t) { return Nj(t, Oj); } const Rj = 80, Oj = { Name: { leave: (t) => t.value }, Variable: { leave: (t) => "$" + t.name }, // Document Document: { leave: (t) => at(t.definitions, ` `) }, OperationDefinition: { leave(t) { const e = Lt("(", at(t.variableDefinitions, ", "), ")"), n = at( [ t.operation, at([t.name, e]), at(t.directives, " ") ], " " ); return (n === "query" ? "" : n + " ") + t.selectionSet; } }, VariableDefinition: { leave: ({ variable: t, type: e, defaultValue: n, directives: r }) => t + ": " + e + Lt(" = ", n) + Lt(" ", at(r, " ")) }, SelectionSet: { leave: ({ selections: t }) => ki(t) }, Field: { leave({ alias: t, name: e, arguments: n, directives: r, selectionSet: i }) { const o = Lt("", t, ": ") + e; let u = o + Lt("(", at(n, ", "), ")"); return u.length > Rj && (u = o + Lt(`( `, Nh(at(n, ` `)), ` )`)), at([u, at(r, " "), i], " "); } }, Argument: { leave: ({ name: t, value: e }) => t + ": " + e }, // Fragments FragmentSpread: { leave: ({ name: t, directives: e }) => "..." + t + Lt(" ", at(e, " ")) }, InlineFragment: { leave: ({ typeCondition: t, directives: e, selectionSet: n }) => at( [ "...", Lt("on ", t), at(e, " "), n ], " " ) }, FragmentDefinition: { leave: ({ name: t, typeCondition: e, variableDefinitions: n, directives: r, selectionSet: i }) => ( // or removed in the future. `fragment ${t}${Lt("(", at(n, ", "), ")")} on ${e} ${Lt("", at(r, " "), " ")}` + i ) }, // Value IntValue: { leave: ({ value: t }) => t }, FloatValue: { leave: ({ value: t }) => t }, StringValue: { leave: ({ value: t, block: e }) => e ? ej(t) : kj(t) }, BooleanValue: { leave: ({ value: t }) => t ? "true" : "false" }, NullValue: { leave: () => "null" }, EnumValue: { leave: ({ value: t }) => t }, ListValue: { leave: ({ values: t }) => "[" + at(t, ", ") + "]" }, ObjectValue: { leave: ({ fields: t }) => "{" + at(t, ", ") + "}" }, ObjectField: { leave: ({ name: t, value: e }) => t + ": " + e }, // Directive Directive: { leave: ({ name: t, arguments: e }) => "@" + t + Lt("(", at(e, ", "), ")") }, // Type NamedType: { leave: ({ name: t }) => t }, ListType: { leave: ({ type: t }) => "[" + t + "]" }, NonNullType: { leave: ({ type: t }) => t + "!" }, // Type System Definitions SchemaDefinition: { leave: ({ description: t, directives: e, operationTypes: n }) => Lt("", t, ` `) + at(["schema", at(e, " "), ki(n)], " ") }, OperationTypeDefinition: { leave: ({ operation: t, type: e }) => t + ": " + e }, ScalarTypeDefinition: { leave: ({ description: t, name: e, directives: n }) => Lt("", t, ` `) + at(["scalar", e, at(n, " ")], " ") }, ObjectTypeDefinition: { leave: ({ description: t, name: e, interfaces: n, directives: r, fields: i }) => Lt("", t, ` `) + at( [ "type", e, Lt("implements ", at(n, " & ")), at(r, " "), ki(i) ], " " ) }, FieldDefinition: { leave: ({ description: t, name: e, arguments: n, type: r, directives: i }) => Lt("", t, ` `) + e + (AE(n) ? Lt(`( `, Nh(at(n, ` `)), ` )`) : Lt("(", at(n, ", "), ")")) + ": " + r + Lt(" ", at(i, " ")) }, InputValueDefinition: { leave: ({ description: t, name: e, type: n, defaultValue: r, directives: i }) => Lt("", t, ` `) + at( [e + ": " + n, Lt("= ", r), at(i, " ")], " " ) }, InterfaceTypeDefinition: { leave: ({ description: t, name: e, interfaces: n, directives: r, fields: i }) => Lt("", t, ` `) + at( [ "interface", e, Lt("implements ", at(n, " & ")), at(r, " "), ki(i) ], " " ) }, UnionTypeDefinition: { leave: ({ description: t, name: e, directives: n, types: r }) => Lt("", t, ` `) + at( ["union", e, at(n, " "), Lt("= ", at(r, " | "))], " " ) }, EnumTypeDefinition: { leave: ({ description: t, name: e, directives: n, values: r }) => Lt("", t, ` `) + at(["enum", e, at(n, " "), ki(r)], " ") }, EnumValueDefinition: { leave: ({ description: t, name: e, directives: n }) => Lt("", t, ` `) + at([e, at(n, " ")], " ") }, InputObjectTypeDefinition: { leave: ({ description: t, name: e, directives: n, fields: r }) => Lt("", t, ` `) + at(["input", e, at(n, " "), ki(r)], " ") }, DirectiveDefinition: { leave: ({ description: t, name: e, arguments: n, repeatable: r, locations: i }) => Lt("", t, ` `) + "directive @" + e + (AE(n) ? Lt(`( `, Nh(at(n, ` `)), ` )`) : Lt("(", at(n, ", "), ")")) + (r ? " repeatable" : "") + " on " + at(i, " | ") }, SchemaExtension: { leave: ({ directives: t, operationTypes: e }) => at( ["extend schema", at(t, " "), ki(e)], " " ) }, ScalarTypeExtension: { leave: ({ name: t, directives: e }) => at(["extend scalar", t, at(e, " ")], " ") }, ObjectTypeExtension: { leave: ({ name: t, interfaces: e, directives: n, fields: r }) => at( [ "extend type", t, Lt("implements ", at(e, " & ")), at(n, " "), ki(r) ], " " ) }, InterfaceTypeExtension: { leave: ({ name: t, interfaces: e, directives: n, fields: r }) => at( [ "extend interface", t, Lt("implements ", at(e, " & ")), at(n, " "), ki(r) ], " " ) }, UnionTypeExtension: { leave: ({ name: t, directives: e, types: n }) => at( [ "extend union", t, at(e, " "), Lt("= ", at(n, " | ")) ], " " ) }, EnumTypeExtension: { leave: ({ name: t, directives: e, values: n }) => at(["extend enum", t, at(e, " "), ki(n)], " ") }, InputObjectTypeExtension: { leave: ({ name: t, directives: e, fields: n }) => at(["extend input", t, at(e, " "), ki(n)], " ") } }; function at(t, e = "") { var n; return (n = t?.filter((r) => r).join(e)) !== null && n !== void 0 ? n : ""; } function ki(t) { return Lt(`{ `, Nh(at(t, ` `)), ` }`); } function Lt(t, e, n = "") { return e != null && e !== "" ? t + e + n : ""; } function Nh(t) { return Lt(" ", t.replace(/\n/g, ` `)); } function AE(t) { var e; return (e = t?.some((n) => n.includes(` `))) !== null && e !== void 0 ? e : !1; } const CE = "Accept", By = "Content-Type", jy = "application/json", Ex = "application/graphql-response+json", xE = (t) => t.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Pj = (t) => { const e = t.toLowerCase(); return e.includes(Ex) || e.includes(jy); }, NE = (t) => { try { if (Array.isArray(t)) return { _tag: "Batch", executionResults: t.map(TE) }; if (Ch(t)) return { _tag: "Single", executionResult: TE(t) }; throw new Error(`Invalid execution result: result is not object or array. Got: ${String(t)}`); } catch (e) { return e; } }, TE = (t) => { if (typeof t != "object" || t === null) throw new Error("Invalid execution result: result is not object"); let e, n, r; if ("errors" in t) { if (!Ch(t.errors) && !Array.isArray(t.errors)) throw new Error("Invalid execution result: errors is not plain object OR array"); e = t.errors; } if ("data" in t) { if (!Ch(t.data) && t.data !== null) throw new Error("Invalid execution result: data is not plain object"); n = t.data; } if ("extensions" in t) { if (!Ch(t.extensions)) throw new Error("Invalid execution result: extensions is not plain object"); r = t.extensions; } return { data: n, errors: e, extensions: r }; }, Dj = (t) => t._tag === "Batch" ? t.executionResults.some(IE) : IE(t.executionResult), IE = (t) => Array.isArray(t.errors) ? t.errors.length > 0 : !!t.errors, Ax = (t) => typeof t == "object" && t !== null && "kind" in t && t.kind === vt.OPERATION_DEFINITION, Fj = (t) => { let e; const n = t.definitions.filter(Ax); return n.length === 1 && (e = n[0].name?.value), e; }, Lj = (t) => { let e = !1; const n = t.definitions.filter(Ax); return n.length === 1 && (e = n[0].operation === "mutation"), e; }, Iv = (t, e) => { const n = typeof t == "string" ? t : Ij(t); let r = !1, i; if (e) return { expression: n, isMutation: r, operationName: i }; const o = j3(() => typeof t == "string" ? _j(t) : t); return o instanceof Error ? { expression: n, isMutation: r, operationName: i } : (i = Fj(o), r = Lj(o), { expression: n, operationName: i, isMutation: r }); }, U0 = JSON, Rv = async (t) => { const e = { ...t, method: t.request._tag === "Single" ? t.request.document.isMutation ? "POST" : wE(t.method ?? "post") : t.request.hasMutations ? "POST" : wE(t.method ?? "post"), fetchOptions: { ...t.fetchOptions, errorPolicy: t.fetchOptions.errorPolicy ?? "none" } }, r = await Mj(e.method)(e); if (!r.ok) return new za({ status: r.status, headers: r.headers }, { query: t.request._tag === "Single" ? t.request.document.expression : t.request.query, variables: t.request.variables }); const i = await Uj(r, t.fetchOptions.jsonSerializer ?? U0); if (i instanceof Error) throw i; const o = { status: r.status, headers: r.headers }; if (Dj(i) && e.fetchOptions.errorPolicy === "none") { const u = i._tag === "Batch" ? { ...i.executionResults, ...o } : { ...i.executionResult, ...o }; return new za(u, { query: t.request._tag === "Single" ? t.request.document.expression : t.request.query, variables: t.request.variables }); } switch (i._tag) { case "Single": return { ...o, ...RE(e)(i.executionResult) }; case "Batch": return { ...o, data: i.executionResults.map(RE(e)) }; default: D0(i); } }, RE = (t) => (e) => ({ extensions: e.extensions, data: e.data, errors: t.fetchOptions.errorPolicy === "all" ? e.errors : void 0 }), Uj = async (t, e) => { const n = t.headers.get(By), r = await t.text(); return n && Pj(n) ? NE(e.parse(r)) : NE(r); }, Mj = (t) => async (e) => { const n = new Headers(e.headers); let r = null, i; n.has(CE) || n.set(CE, [Ex, jy].join(", ")), t === "POST" ? (i = (e.fetchOptions.jsonSerializer ?? U0).stringify(Bj(e)), typeof i == "string" && !n.has(By) && n.set(By, jy)) : r = jj(e); const o = { method: t, headers: n, body: i, ...e.fetchOptions }; let u = new URL(e.url), l = o; if (e.middleware) { const d = await Promise.resolve(e.middleware({ ...o, url: e.url, operationName: e.request._tag === "Single" ? e.request.document.operationName : void 0, variables: e.request.variables })), { url: p, ...v } = d; u = new URL(p), l = v; } return r && r.forEach((d, p) => { u.searchParams.append(p, d); }), await (e.fetch ?? fetch)(u, l); }, Bj = (t) => { switch (t.request._tag) { case "Single": return { query: t.request.document.expression, variables: t.request.variables, operationName: t.request.document.operationName }; case "Batch": return hx(t.request.query, t.request.variables ?? []).map(([e, n]) => ({ query: e, variables: n })); default: throw D0(t.request); } }, jj = (t) => { const e = t.fetchOptions.jsonSerializer ?? U0, n = new URLSearchParams(); switch (t.request._tag) { case "Single": return n.append("query", xE(t.request.document.expression)), t.request.variables && n.append("variables", e.stringify(t.request.variables)), t.request.document.operationName && n.append("operationName", t.request.document.operationName), n; case "Batch": { const r = t.request.variables?.map((u) => e.stringify(u)) ?? [], i = t.request.query.map(xE), o = hx(i, r).map(([u, l]) => ({ query: u, variables: l })); return n.append("query", e.stringify(o)), n; } default: throw D0(t.request); } }; class OE { url; requestConfig; constructor(e, n = {}) { this.url = e, this.requestConfig = n; } /** * Send a GraphQL query to the server. */ rawRequest = async (...e) => { const [n, r, i] = e, o = z3(n, r, i), { headers: u, fetch: l = globalThis.fetch, method: f = "POST", requestMiddleware: d, responseMiddleware: p, excludeOperationName: v, ...y } = this.requestConfig, { url: k } = this; o.signal !== void 0 && (y.signal = o.signal); const A = Iv(o.query, v), E = await Rv({ url: k, request: { _tag: "Single", document: A, variables: o.variables }, headers: { ...Wu(Nv(u)), ...Wu(o.requestHeaders) }, fetch: l, method: f, fetchOptions: y, middleware: d }); if (p && await p(E, { operationName: A.operationName, variables: r, url: this.url }), E instanceof Error) throw E; return E; }; async request(e, ...n) { const [r, i] = n, o = $j(e, r, i), { headers: u, fetch: l = globalThis.fetch, method: f = "POST", requestMiddleware: d, responseMiddleware: p, excludeOperationName: v, ...y } = this.requestConfig, { url: k } = this; o.signal !== void 0 && (y.signal = o.signal); const A = Iv(o.document, v), E = await Rv({ url: k, request: { _tag: "Single", document: A, variables: o.variables }, headers: { ...Wu(Nv(u)), ...Wu(o.requestHeaders) }, fetch: l, method: f, fetchOptions: y, middleware: d }); if (p && await p(E, { operationName: A.operationName, variables: o.variables, url: this.url }), E instanceof Error) throw E; return E.data; } async batchRequests(e, n) { const r = V3(e, n), { headers: i, excludeOperationName: o, ...u } = this.requestConfig; r.signal !== void 0 && (u.signal = r.signal); const l = r.documents.map(({ document: y }) => Iv(y, o)), f = l.map(({ expression: y }) => y), d = l.some(({ isMutation: y }) => y), p = r.documents.map(({ variables: y }) => y), v = await Rv({ url: this.url, request: { _tag: "Batch", operationName: void 0, query: f, hasMutations: d, variables: p }, headers: { ...Wu(Nv(i)), ...Wu(r.requestHeaders) }, fetch: this.requestConfig.fetch ?? globalThis.fetch, method: this.requestConfig.method || "POST", fetchOptions: u, middleware: this.requestConfig.requestMiddleware }); if (this.requestConfig.responseMiddleware && await this.requestConfig.responseMiddleware(v, { operationName: void 0, variables: p, url: this.url }), v instanceof Error) throw v; return v.data; } setHeaders(e) { return this.requestConfig.headers = e, this; } /** * Attach a header to the client. All subsequent requests will have this header. */ setHeader(e, n) { const { headers: r } = this.requestConfig; return r ? r[e] = n : this.requestConfig.headers = { [e]: n }, this; } /** * Change the client endpoint. All subsequent requests will send to this endpoint. */ setEndpoint(e) { return this.url = e, this; } } const $j = (t, e, n) => t.document ? t : { document: t, variables: e, requestHeaders: n, signal: void 0 }; class Fs extends Error { /** The original error object, useful for debugging underlying issues. */ originalError; /** Discriminator property to easily identify errors from this client. */ isApiError = !0; constructor(e, n) { super(e), this.name = this.constructor.name, this.originalError = n, Object.setPrototypeOf(this, new.target.prototype); } } class Th extends Fs { constructor(e = "Request timed out", n) { super(e, n); } } class $y extends Fs { constructor(e = "A network error occurred", n) { super(e, n); } } class Vy extends Fs { response; constructor(e, n, r) { super(e, r), this.response = n; } } class Cx extends Fs { response; constructor(e, n, r) { super(e, r), this.response = n; } } function Vj(t) { const e = t.filter( (i) => i instanceof AbortSignal ); if (e.length === 0) return; if (e.length === 1) return e[0]; if (typeof AbortSignal.any == "function") return AbortSignal.any(e); const n = new AbortController(), r = (i) => { const o = i.target; n.abort( o?.reason ?? "Signal aborted by one of the combined signals" ); }; for (const i of e) { if (i.aborted) { n.abort(i.reason ?? "Signal was already aborted"); break; } i.addEventListener("abort", r, { once: !0, signal: n.signal }); } return n.signal; } function PE(t) { const e = {}; if (!t) return e; for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) { const r = t[n]; r === null ? e[n] = void 0 : typeof r == "number" || typeof r == "boolean" ? e[n] = String(r) : e[n] = r; } return e; } class xx { logger; defaultTimeout; getAuthTokenFn; getAccountFn; axiosInstance; graphqlClient; restBaseUrl; graphqlApiBaseUrl; /** * Creates an instance of ApiClient. * @param {ApiConfig} config - Configuration for the ApiClient. * `restApiBaseUrl`, `graphqlApiBaseUrl`, and `logger` are required. * @throws {Error} If required configuration properties are missing. */ constructor(e) { if (!e.logger) throw console.error("A Logger instance is required in the configuration."), new Error("A Logger instance is required in the configuration."); if (this.logger = e.logger.child("ApiClient"), !e.restApiBaseUrl) { const n = "restApiBaseUrl is required in the configuration."; throw this.logger.error(n), new Error(n); } if (this.restBaseUrl = e.restApiBaseUrl, !e.graphqlApiBaseUrl) { const n = "graphqlApiBaseUrl is required in the configuration."; throw this.logger.error(n), new Error(n); } this.graphqlApiBaseUrl = e.graphqlApiBaseUrl, this.defaultTimeout = e.defaultTimeout ?? 3e4, this.getAuthTokenFn = e.getAuthToken ?? (async () => (this.logger.warn( "getAuthTokenFn was not provided. Secure calls will not be authenticated." ), null)), this.getAccountFn = e.getAccount ?? (async () => (this.logger.warn( "getAccountFn was not provided. Secure calls without `account` option may fail." ), null)), this.axiosInstance = an.create({ baseURL: this.restBaseUrl }), this.graphqlClient = new OE(this.graphqlApiBaseUrl); } /** * Overrides the API base URLs after the client has been instantiated. * This is intended for development or special runtime scenarios. * @param newUrls An object containing the new base URLs to set. */ overrideApiUrls(e) { e.restApiBaseUrl && (this.restBaseUrl = e.restApiBaseUrl, this.axiosInstance = an.create({ baseURL: this.restBaseUrl }), this.logger.warn(`REST API URL overridden to ${this.restBaseUrl}`)), e.graphqlApiBaseUrl && (this.graphqlApiBaseUrl = e.graphqlApiBaseUrl, this.graphqlClient = new OE(this.graphqlApiBaseUrl), this.logger.warn( `GraphQL API URL overridden to ${this.graphqlApiBaseUrl}` )); } /** * Main implementation of the `rest` method. Do not call this directly; use one of the overloads. * @private */ async rest(e) { const { baseURL: n, path: r = "", method: i = "GET", signal: o, timeout: u } = e, l = new URL(r, n || this.restBaseUrl).toString(); if (!r && !n) throw new Vy( 'It is assumed that path = "" but it is necessary to provide baseURL' ); const { operationSignal: f, clearInternalTimeout: d } = this.createAbortSignal( o, u ); try { const p = await this.prepareAuthHeaders(e), v = { url: r, method: i, data: e.body, params: e.queryParams, headers: p, signal: f, responseType: e.raw ? e.responseType || "text" : "json", ...n && { baseURL: n } }, y = await this.executeRestRequest(v); return e.raw === !0 ? { status: y.status, data: y.data, headers: PE(y.headers) } : this.processStandardRestResponse(y); } catch (p) { throw this.handleRestError(p, l, f); } finally { d(); } } /** * Performs a GraphQL request with improved type inference using TypedDocumentNode. * If a plain string or a non-typed DocumentNode is passed, TResult (response data type) * will default to `any` unless explicitly provided by the caller. * * @template TResult The expected shape of the data returned by the GraphQL query/mutation. * This is often inferred if a TypedDocumentNode is provided as the `document`. * @template TVars The shape of the variables object for the GraphQL query/mutation. * This is also often inferred if a TypedDocumentNode is provided. * @param {ApiGraphQLDocument} document The GraphQL query or mutation. * Your `ApiGraphQLDocument` type should be `string | LibGraphQLRequestDocument | TypedDocumentNode`. * @param {TVars} [variables] An object containing variables for the GraphQL request. * The type should match the variables expected by the document. * @param {ApiGraphQLRequestConfig} [options={}] Optional configurations for this GraphQL request. * @returns {Promise} A promise that resolves to the typed data from the GraphQL response. * @throws {ApiGraphQLError | ApiTimeoutError | ApiNetworkError | ApiError} Throws a custom API error on failure. * * @example * // Assuming GetUserDocument is a TypedDocumentNode * // const { user } = await apiClient.graphql(GetUserDocument, { id: "123" }); * // console.log(user.name); // user and its properties are strongly typed * * // With a string query, explicit types are needed for TResult if not 'any' * // const { specificField } = await apiClient.graphql<{ specificField: string }>( * // "query { specificField }", * // ); * // console.log(specificField); */ async graphql(e, n, r = {}) { const { timeout: i, signal: o } = r, { operationSignal: u, clearInternalTimeout: l } = this.createAbortSignal( o, i ); try { const f = await this.prepareAuthHeaders(r), d = { document: e, requestHeaders: f, signal: u }; n !== void 0 && (d.variables = n); const p = d; return await this.executeGraphQLRequest(p); } catch (f) { throw this.handleGraphQLError(f, u); } finally { l(); } } /** * Executes the actual REST request using the configured Axios instance. * @private */ async executeRestRequest(e) { return this.axiosInstance.request(e); } /** * Processes a successful standard (non-raw) REST response into the customFetch-compatible format. * @private */ processStandardRestResponse(e) { const n = e.data, r = e.status >= 200 && e.status < 300; return typeof n == "object" && n !== null && !Array.isArray(n) ? { ...n, success: r, statusCode: e.status } : { _rawData: n, success: r, statusCode: e.status }; } /** * Handles errors from REST requests, transforming them into custom ApiError types. * This method always throws. * @private * @returns {never} */ handleRestError(e, n, r) { throw r?.aborted ? new Th( typeof r.reason == "string" ? r.reason : `REST request to '${n}' aborted.`, e ) : an.isAxiosError(e) ? e.code === "ECONNABORTED" || e.message.toLowerCase().includes("timeout") || e.code && ["ETIMEDOUT", "ESOCKETTIMEDOUT"].includes(e.code) ? new Th( `REST request to '${n}' timed out. (${e.message})`, e ) : e.response ? new Vy( e.response.data?.message || e.response.data?.error || e.message || "REST request failed", { status: e.response.status, data: e.response.data, headers: PE(e.response.headers) }, e ) : new $y( `Network error for REST request to '${n}': ${e.message}`, e ) : new Fs( `Unexpected error during REST request to '${n}': ${e.message || "Unknown error"}`, e ); } /** * Executes the actual GraphQL request using the configured GraphQLClient instance. * @private */ async executeGraphQLRequest(e) { return this.graphqlClient.request(e); } /** * Handles errors from GraphQL requests, transforming them into custom ApiError types. * This method always throws. * @private * @returns {never} */ handleGraphQLError(e, n) { if (n?.aborted) throw new Th( typeof n.reason == "string" ? n.reason : "GraphQL request aborted.", e ); if (e instanceof za) { const r = e.response?.errors?.[0]?.message || e.message || "GraphQL request failed"; throw new Cx( r, { status: e.response?.status, data: e.response?.data, errors: e.response?.errors }, e ); } throw e instanceof TypeError && // Network errors in fetch-based clients often manifest as TypeErrors (e.message.toLowerCase().includes("failed to fetch") || e.message.toLowerCase().includes("networkerror")) ? new $y( `Network error during GraphQL request: ${e.message}`, e ) : new Fs( `Unexpected error during GraphQL request: ${e.message || "Unknown error"}`, e ); } /** * Retrieves the JWT authentication token using the injected `getAuthTokenFn`. * @private * @returns {Promise} The JWT token or null if unavailable/error. */ async getAuthToken() { try { return await this.getAuthTokenFn(); } catch (e) { return this.logger.error( "Error retrieving auth token via getAuthTokenFn:", e.message, e ), null; } } /** * Retrieves the account identifier using the injected `getAccountFn`. * @private * @returns {Promise} The account identifier or null if unavailable/error. */ async getAccount() { try { return await this.getAccountFn(); } catch (e) { return this.logger.error( "Error retrieving account via getAccountFn:", e.message, e ), null; } } /** * Normalizes security option to internal representation * * Converts boolean and string security modes to a consistent internal format, * maintaining backward compatibility with legacy boolean usage. * * @param secure - Security configuration from request * @returns Normalized security mode */ normalizeSecureOption(e) { return e === !1 || e === void 0 ? "none" : e === !0 ? "full" : e; } /** * Prepares request headers, primarily for authentication * * Handles different security modes: * - 'none': No authentication headers * - 'token-only': Only JWT token, no account header * - 'full': JWT token + account header * * @private * @param options Configuration for header preparation, including security flags and existing headers * @returns The prepared headers */ async prepareAuthHeaders(e) { const n = {}; if (e.headers) { if (e.headers instanceof Headers) e.headers.forEach((f, d) => { n[d] = f; }); else for (const f in e.headers) if (Object.prototype.hasOwnProperty.call(e.headers, f)) { const d = e.headers[f]; typeof d == "string" && (n[f] = d); } } const r = this.normalizeSecureOption(e.secure); if (r === "none") return n; const i = r === "full", u = e.account ?? await this.getAccount(); if (!u && i) { const f = "Secure request: account identifier is required. Provide the `account` option or ensure getAccountFn returns a valid account."; throw this.logger.error(f), new Fs(f); } const l = await this.getAuthToken(); return l ? (n.Authorization = `Bearer ${l}`, u && i && (n["ls-account"] = u)) : this.logger.warn( "Secure request: Auth token not available or getAuthTokenFn failed." ), n; } /** * Creates and manages a combined AbortSignal for request timeout and external cancellation. * Uses `createCombinedSignal` utility. * @private * @param externalSignal An optional AbortSignal provided by the caller. * @param requestTimeout The timeout duration for this specific request. * @returns An object containing the `operationSignal` to be used for the request, * and a `clearInternalTimeout` function to clear any internal timers. */ createAbortSignal(e, n) { const r = n ?? this.defaultTimeout; let i, o; r > 0 && (i = new AbortController(), o = setTimeout(() => { i.abort( "Request timed out by ApiClient internal timeout" ); }, r)); const u = () => { o && clearTimeout(o); }, l = Vj([ e, i?.signal ]); return l?.aborted ? u() : l?.addEventListener("abort", u, { once: !0 }), { operationSignal: l, clearInternalTimeout: u }; } } const zj = async () => { try { return (await $C.currentSession()).getIdToken().getJwtToken(); } catch { return Kn().config?.authToken ?? null; } }, qj = async () => Kn().config?.account ?? null, Hj = { restApiBaseUrl: Qa.apiUrls.restV2, graphqlApiBaseUrl: Qa.apiUrls.graphql, logger: Kn().coreLogger, getAuthToken: zj, getAccount: qj }, bn = new xx(Hj); var sl = /* @__PURE__ */ ((t) => (t.VTEX = "VTEX", t.VTEX_IO = "VTEX-IO", t.VTEX_CMS = "PORTAL-VTEX", t.PLATFORM = "PLATFORM", t.UNKNOWN = "UNKNOWN", t))(sl || {}), Nx = /* @__PURE__ */ ((t) => (t.PLATFORM = "platform_module", t.ADENDA = "subscription_module", t.APP_STORE = "app_store", t))(Nx || {}), Tx = /* @__PURE__ */ ((t) => (t.ACTIVE = "active_contract", t.INACTIVE = "inactive_contract", t))(Tx || {}), Ix = /* @__PURE__ */ ((t) => (t.LITE = "lite", t.STANDARD = "standard", t.PRO = "pro", t))(Ix || {}), Rx = /* @__PURE__ */ ((t) => (t.LITE = "PLAN_LITE", t.STANDARD = "PLAN_ESTANDAR", t.PRO = "PLAN_PRO", t.NONE = "NO_PLAN", t))(Rx || {}), Ox = /* @__PURE__ */ ((t) => (t.PAST = "past", t.LIVE = "live", t.FUTURE = "future", t))(Ox || {}); class M0 extends Ri { constructor(e) { super("NIZZA_ACCOUNT_NOT_FOUND_ERROR", `Error finding account: ${e}`); } } class Px extends Ri { constructor(e) { super("NIZZA_PLAN_NOT_FOUND_ERROR", `Error finding plan: ${e}`); } } class Dx extends Ri { constructor(e) { super("NIZZA_CREATE_PLAN_ERROR", `Error creating plan: ${e.plan}`, e); } } class Fx { async get(e, n) { return (await bn.rest({ path: "/v1/plans/info", queryParams: { planType: e }, account: n })).data; } async create(e) { const { success: n } = await bn.rest({ path: "/v1/plans/create", method: "POST", body: e }); if (!n) throw new Dx(e); } } function Kj(t) { const { host: e, account: n, username: r, createdAt: i, subscriptionType: o, installationDateApp: u, ...l } = t; return { ...l, account: n, host: e ?? null, username: r ?? n, createdAt: new Date(i), subscriptionType: o ?? null, installationDateApp: new Date(u) }; } function Gj(t) { const { host: e, ...n } = t; return { ...n, host: e ?? null, plan: {} }; } class Lx { async get(e) { const { data: n } = await bn.rest({ path: `/v1/accounts/${e}/public`, account: e }); return n ? Gj(n) : null; } } class Wj { async get(e) { const { data: n } = await bn.rest({ path: `/v1/accounts/${e}`, secure: !0, account: e }); return n ? Kj(n) : null; } } class Ux { constructor(e, n, r) { this.publicAccountRepo = e, this.privateAccountRepo = n, this.accountPlanRepo = r; } async get(e, n = !1) { try { const r = n ? await this.privateAccountRepo.get(e) : await this.publicAccountRepo.get(e); if (!r) throw new M0(e); const i = await this.accountPlanRepo.get( r.descriptionPlan, r.account ); if (!i) throw new Px(r.descriptionPlan); return { ...r, plan: i }; } catch (r) { throw new xs(r); } } } const Yj = new Lx(), Qj = new Wj(), Jj = new Fx(), Mx = new Ux( Yj, Qj, Jj ), Bx = () => { const { account: t, accountName: e, accountStatus: n, refetchAccount: r, isPvtAccount: i, isPubAccount: o } = YA((d) => ({ account: d.account, accountName: d.accountName, accountStatus: d.accountStatus, refetchAccount: d.refetchAccount, isPvtAccount: d.isPvtAccount, isPubAccount: d.isPubAccount })), u = ["idle", "loading"].includes(n); return { account: t, accountName: e, isLoading: u, isError: n === "error", isSuccess: n === "success", accountStatus: n, refetchAccount: r, isPvtAccount: i, isPubAccount: o }; }; async function jx(t, e) { return Mx.get(t, e); } const Xj = 4; var $x = /* @__PURE__ */ ((t) => (t.Created = "CREATED", t.CreateComplete = "CREATE_COMPLETE", t.Finalized = "FINALIZED", t.Live = "LIVE", t.Starting = "STARTING", t))($x || {}), Vx = /* @__PURE__ */ ((t) => (t.Add = "add", t.Remove = "remove", t))(Vx || {}), zx = /* @__PURE__ */ ((t) => (t.Vtex = "VTEX", t))(zx || {}), qx = /* @__PURE__ */ ((t) => (t.Active = "active", t.Inactive = "inactive", t))(qx || {}); const Zj = { kind: "Document", definitions: [{ kind: "FragmentDefinition", name: { kind: "Name", value: "MetricDataFields" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "MetricData" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "label" } }, { kind: "Field", name: { kind: "Name", value: "average" } }, { kind: "Field", name: { kind: "Name", value: "startTime" } }, { kind: "Field", name: { kind: "Name", value: "endTime" } }, { kind: "Field", name: { kind: "Name", value: "numSamples" } }] } }] }, Hx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "AddCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CreateCollectionInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Kx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "DeleteCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Gx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FindCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "findCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }, { kind: "Field", name: { kind: "Name", value: "products" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", name: { kind: "Name", value: "link" } }, { kind: "Field", name: { kind: "Name", value: "pictures" } }, { kind: "Field", name: { kind: "Name", value: "price" } }, { kind: "Field", name: { kind: "Name", value: "salesprice" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Wx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetAllCollections" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccessArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }, { kind: "Field", name: { kind: "Name", value: "products" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", name: { kind: "Name", value: "link" } }, { kind: "Field", name: { kind: "Name", value: "pictures" } }, { kind: "Field", name: { kind: "Name", value: "price" } }, { kind: "Field", name: { kind: "Name", value: "salesprice" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Yx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "ManageCollectionProduct" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ManageCollectionProductInInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "manageCollectionProduct" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Qx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "SearchCollections" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "searchCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccessArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }, { kind: "Field", name: { kind: "Name", value: "products" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", name: { kind: "Name", value: "link" } }, { kind: "Field", name: { kind: "Name", value: "pictures" } }, { kind: "Field", name: { kind: "Name", value: "price" } }, { kind: "Field", name: { kind: "Name", value: "salesprice" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Jx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "UpdateCollectionInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, e4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FindMinimalEvent" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "FindEventInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "findEvent" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EventData" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailsPath" } }, { kind: "Field", name: { kind: "Name", value: "recordVideoPath" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "thumbnails" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, t4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetEventStreamMetrics" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetEventStreamMetricsInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getEventStreamMetrics" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "GetEventStreamMetricsSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "channelArn" } }, { kind: "Field", name: { kind: "Name", value: "health" } }, { kind: "Field", name: { kind: "Name", value: "playbackUrl" } }, { kind: "Field", name: { kind: "Name", value: "state" } }, { kind: "Field", name: { kind: "Name", value: "streamId" } }, { kind: "Field", name: { kind: "Name", value: "viewerCount" } }, { kind: "Field", name: { kind: "Name", value: "startTime" } }, { kind: "Field", name: { kind: "Name", value: "metrics" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "ingestAudioBitrate" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "MetricDataFields" } }] } }, { kind: "Field", name: { kind: "Name", value: "ingestVideoBitrate" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "MetricDataFields" } }] } }, { kind: "Field", name: { kind: "Name", value: "ingestFramerate" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "MetricDataFields" } }] } }, { kind: "Field", name: { kind: "Name", value: "keyframeInterval" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "MetricDataFields" } }] } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }] } }] } }] } }, { kind: "FragmentDefinition", name: { kind: "Name", value: "MetricDataFields" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "MetricData" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "label" } }, { kind: "Field", name: { kind: "Name", value: "average" } }, { kind: "Field", name: { kind: "Name", value: "startTime" } }, { kind: "Field", name: { kind: "Name", value: "endTime" } }, { kind: "Field", name: { kind: "Name", value: "numSamples" } }] } }] }, n4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "SearchMinimalEvents" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SearchEventInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "searchEvent" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EventArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailsPath" } }, { kind: "Field", name: { kind: "Name", value: "recordVideoPath" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "status" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, r4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "BlockUser" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "BlockUserInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "blockUser" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "BlockUserSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, i4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "ChangeAccountUsername" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ChangeUsernameInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "changeAccountUsername" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ChangeUsernameSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, o4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "DeleteChatMessage" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "DeleteChatInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteChatMessage" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DeleteChatMessageSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, s4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetAllAdminChatMessages" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetAllAdminChatMessagesInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllAdminChatMessages" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "AdminChatMessageArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "idEvent" } }, { kind: "Field", name: { kind: "Name", value: "data" } }, { kind: "Field", name: { kind: "Name", value: "username" } }, { kind: "Field", name: { kind: "Name", value: "email" } }, { kind: "Field", name: { kind: "Name", value: "sendDate" } }, { kind: "Field", name: { kind: "Name", value: "type" } }, { kind: "Field", name: { kind: "Name", value: "isAdmin" } }, { kind: "Field", name: { kind: "Name", value: "urlGif" } }, { kind: "Field", name: { kind: "Name", value: "second" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, a4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetAllChatMessages" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetAllChatMessagesInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllChatMessages" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ChatMessageArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "idEvent" } }, { kind: "Field", name: { kind: "Name", value: "data" } }, { kind: "Field", name: { kind: "Name", value: "username" } }, { kind: "Field", name: { kind: "Name", value: "sendDate" } }, { kind: "Field", name: { kind: "Name", value: "type" } }, { kind: "Field", name: { kind: "Name", value: "isAdmin" } }, { kind: "Field", name: { kind: "Name", value: "urlGif" } }, { kind: "Field", name: { kind: "Name", value: "second" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, Xx = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetChatRoomToken" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetChatRoomInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getChatRoomToken" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ChatRoomTokenData" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "token" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, u4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "PinChatMessage" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "PinChatInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "pinChatMessage" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "PinChatMessageSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, l4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "SendAdminChatMessage" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SaveChatInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "sendAdminChatMessage" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SendAdminChatMessageSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, c4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "highlightProduct" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "HighlightProductInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "highlightProduct" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "HighlightProductSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, d4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "deleteAllCustomization" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomPlayerInputAccount" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteAllCustomPlayer" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, f4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "getAllCustomization" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllCustomPlayer" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CustomPlayerSuccessArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "data" } }, { kind: "Field", name: { kind: "Name", value: "section" } }, { kind: "Field", name: { kind: "Name", value: "id" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, h4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "updateCustomization" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomPlayerInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomPlayer" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, p4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "sendAddToCart" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "AddToCartInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "sendAddToCart" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "AddToCartSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, m4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetTimeLine" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetTimeLineInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getTimeLine" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "TimeLineArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "time" } }, { kind: "Field", name: { kind: "Name", value: "likes" } }, { kind: "Field", name: { kind: "Name", value: "comments" } }, { kind: "Field", name: { kind: "Name", value: "viewers" } }, { kind: "Field", name: { kind: "Name", value: "orders" } }, { kind: "Field", name: { kind: "Name", value: "minute" } }, { kind: "Field", name: { kind: "Name", value: "hour" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, g4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "AppendProductsToSnackVideo" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "RelateToProductsSnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "appendProductsSnackVideo" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ActionSnackVideoSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, v4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreatePlayList" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CreatePlayListInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createPlayList" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CreatePlayListSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, y4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreateSnackVideoBatch" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CreateSnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createSnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, w4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "DeleteRelationshipWithSnackVideo" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoRelationshipKeys" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteRelationshipSnackVideo" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ActionSnackVideoSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }] } }] } }] } }] }, S4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "DeleteSnackVideo" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "DeleteSnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteSnackVideo" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ActionSnackVideoSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, _4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FindManySnackVideos" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "FindManySnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "findManySnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "uploadProgress" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "eventId" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, b4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetAllSnackVideos" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllSnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoCreatedArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "snackVideos" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "uploadProgress" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "eventId" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "created" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }] } }, { kind: "Field", name: { kind: "Name", value: "cursor" } }, { kind: "Field", name: { kind: "Name", value: "totalItems" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, k4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetPlayLists" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getPlayLists" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "PlayListArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "created" } }, { kind: "Field", name: { kind: "Name", value: "videoAmount" } }, { kind: "Field", name: { kind: "Name", value: "productAmount" } }, { kind: "Field", name: { kind: "Name", value: "updated" } }, { kind: "Field", name: { kind: "Name", value: "videos" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "order" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, E4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetSnackVideoRelationships" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoRelationshipInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getRelationshipSnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "RelationshipSnackVideoArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "sourceEntity" } }, { kind: "Field", name: { kind: "Name", value: "attributeId" } }] } }] } }] } }] } }] }, A4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "SearchSnackVideos" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SearchInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "searchSnackVideos" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoCreatedArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "snackVideos" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "uploadProgress" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "eventId" } }, { kind: "Field", name: { kind: "Name", value: "eventName" } }, { kind: "Field", name: { kind: "Name", value: "created" } }] } }, { kind: "Field", name: { kind: "Name", value: "cursor" } }, { kind: "Field", name: { kind: "Name", value: "totalItems" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, C4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdatePlayList" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "UpdatePlayListInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updatePlayList" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "UpdatePlayListSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }] } }] } }] } }] }, x4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FindByProductSnackVideo" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "FindByProductSnackVideoInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "findByProductSnackVideo" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SnackVideoArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, N4 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetPlayList" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "GetPlayListQueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getPlayList" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "PlayListData" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "videos" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "productId" } }, { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "url" } }, { kind: "Field", name: { kind: "Name", value: "thumbnailUrl" } }, { kind: "Field", name: { kind: "Name", value: "duration" } }, { kind: "Field", name: { kind: "Name", value: "transmitionType" } }, { kind: "Field", name: { kind: "Name", value: "order" } }, { kind: "Field", name: { kind: "Name", value: "productName" } }, { kind: "Field", name: { kind: "Name", value: "productImageUrl" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, T4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, AddCollectionDocument: Hx, AppendProductsToSnackVideoDocument: g4, BlockUserDocument: r4, ChangeAccountUsernameDocument: i4, CreatePlayListDocument: v4, CreateSnackVideoBatchDocument: y4, DeleteAllCustomizationDocument: d4, DeleteChatMessageDocument: o4, DeleteCollectionDocument: Kx, DeleteRelationshipWithSnackVideoDocument: w4, DeleteSnackVideoDocument: S4, EventStatus: $x, FindByProductSnackVideoDocument: x4, FindCollectionDocument: Gx, FindManySnackVideosDocument: _4, FindMinimalEventDocument: e4, GetAllAdminChatMessagesDocument: s4, GetAllChatMessagesDocument: a4, GetAllCollectionsDocument: Wx, GetAllCustomizationDocument: f4, GetAllSnackVideosDocument: b4, GetChatRoomTokenDocument: Xx, GetEventStreamMetricsDocument: t4, GetPlayListDocument: N4, GetPlayListsDocument: k4, GetSnackVideoRelationshipsDocument: E4, GetTimeLineDocument: m4, HighlightProductDocument: c4, ManageCollectionProductDocument: Yx, Methods: Vx, MetricDataFieldsFragmentDoc: Zj, PinChatMessageDocument: u4, SearchCollectionsDocument: Qx, SearchMinimalEventsDocument: n4, SearchSnackVideosDocument: A4, SendAddToCartDocument: p4, SendAdminChatMessageDocument: l4, SignProvider: zx, Status: qx, UpdateCollectionDocument: Jx, UpdateCustomizationDocument: h4, UpdatePlayListDocument: C4 }, Symbol.toStringTag, { value: "Module" })); var Lp = /* @__PURE__ */ ((t) => (t.OPEN_TAB = "openTab", t.OPEN_VARIATION_SELECTOR = "openVariationSelector", t.ADD_TO_CART = "addToCart", t))(Lp || {}); function I4(t) { return { class: t, _value: null, get value() { return this._value || (this._value = new t(), Object.freeze(this)), this._value; } }; } var Vr = /* @__PURE__ */ ((t) => (t.Local = "local", t.VtexLegacy = "vtexlegacy", t.VtexIO = "vtexio", t.VtexFastStore = "faststore", t.Platform = "platform", t.External = "external", t))(Vr || {}), B0 = /* @__PURE__ */ ((t) => (t.PROD = "prod", t.DEV = "dev", t.LOCAL = "local", t))(B0 || {}); const { coreLogger: R4 } = Kn(), zy = R4.child("addToCartHooks"), qy = { // eslint-disable-next-line sonarjs/no-duplicate-string errorAddingToCart: "addToCartHooks.notification.error", errorOpeningVariationSelector: "addToCartHooks.notification.error", errorOpeningNewTab: "addToCartHooks.notification.error", successAddingToCart: "addToCartHooks.notification.success" }; async function O4(t) { const e = { ...t, action: { type: Lp.ADD_TO_CART, exec: () => zy.error("action no implemented in validate hook") } }; try { const n = await P4(e), r = await D4(n); await F4(r); } catch (n) { zy.error("error unhandled", n); } } async function P4(t) { const { context: e, userAddToCartConfig: n } = t, r = n?.hooks?.transform; let i = t.product; if (r) try { i = await r({ product: { ...i }, data: e.data ?? {} }); } catch (o) { Zh("transform", o); } return { ...t, product: i }; } async function D4(t) { const { context: e, hookStrategy: n, userAddToCartConfig: r, product: i } = t, o = Zx(t), u = r?.hooks?.validate; let l = n.validate({ ...t, actionFactory: o }); if (u) try { l = await u({ product: { ...i }, defaultAction: { ...l }, action: o, data: e.data ?? {} }); } catch (f) { Zh("validate", f); } return { ...t, action: l, actionFactory: o }; } async function F4(t) { const { eventBus: e } = Kn(), { product: n, userAddToCartConfig: r, notifyFactory: i, action: o, actionFactory: u } = t, { isVariationSelectorOpen: l, data: f = {} } = t.context, d = r?.hooks?.end, p = o.type === Lp.ADD_TO_CART; let v = null, y = !1; const k = () => { !p || !l || u.openVariationSelector(!1).exec(); }, A = () => { !p || y || (v ? i.error(qy.errorAddingToCart) : i.success(qy.successAddingToCart)); }, E = () => { const T = { product: n, actionType: o.type, success: !v, error: v }; e.emit(jA.ATCH_ACTION_EXECUTED, T); }; try { if (!o.type || !o.exec) throw new Error("Invalid action object, missing keys 'type' or 'exec'"); await o.exec(); } catch (T) { Zh("end", T), v = T; } if (d) try { y = !!await d({ data: f, error: v, notify: i, actionExecuted: o }); } catch (T) { Zh("end", T); } k(), A(), E(); } function Zx(t) { const { actionFactory: e, userAddToCartConfig: n } = t, r = (i) => Object.entries(i ?? {}).reduce( (o, [u, l]) => ({ ...o, [u]: (f) => ({ type: u, exec: () => l(f) }) }), {} ); return { ...r(e), ...r(n?.actionFactory) }; } function Zh(t, e) { zy.error(`addToCartHooks error running ${t}: `, e); } class eN { aggregate; _numSetPropsApplied = 0; constructor(e) { this.aggregate = e; } setProps(e) { for (const [n, r] of Object.entries(e)) n in this.aggregate && (this.aggregate[n] = r); this._numSetPropsApplied++; } get isFirstSetProps() { return this._numSetPropsApplied === 1; } } function Up(t) { return new eN(t); } class L4 { _value; constructor(e) { e !== void 0 && (this._value = e); } get value() { return this._value; } } var nr = /* @__PURE__ */ ((t) => (t.GENERAL_ERROR = "GENERAL_ERROR", t.AXIOS_ERROR = "AXIOS_ERROR", t.NETWORK_ERROR = "NETWORK_ERROR", t.CONFIG_ERROR = "CONFIG_ERROR", t.TIMEOUT_ERROR = "TIMEOUT_ERROR", t.AUTH_ERROR = "AUTH_ERROR", t.NOT_FOUND = "NOT_FOUND", t.VALIDATION_ERROR = "VALIDATION_ERROR", t.SERVER_ERROR = "SERVER_ERROR", t.BAD_REQUEST = "BAD_REQUEST", t.UNAUTHORIZED = "UNAUTHORIZED", t.FORBIDDEN = "FORBIDDEN", t.CONFLICT = "CONFLICT", t.GONE = "GONE", t.UNSUPPORTED_MEDIA_TYPE = "UNSUPPORTED_MEDIA_TYPE", t.TOO_MANY_REQUESTS = "TOO_MANY_REQUESTS", t.INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR", t.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", t))(nr || {}); const U4 = { type: "logger", log(t) { this.output("log", t); }, warn(t) { this.output("warn", t); }, error(t) { this.output("error", t); }, output(t, e) { console && console[t] && console[t].apply(console, e); } }; class ep { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.init(e, n); } init(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.prefix = n.prefix || "i18next:", this.logger = e || U4, this.options = n, this.debug = n.debug; } log() { for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++) n[r] = arguments[r]; return this.forward(n, "log", "", !0); } warn() { for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++) n[r] = arguments[r]; return this.forward(n, "warn", "", !0); } error() { for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++) n[r] = arguments[r]; return this.forward(n, "error", ""); } deprecate() { for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++) n[r] = arguments[r]; return this.forward(n, "warn", "WARNING DEPRECATED: ", !0); } forward(e, n, r, i) { return i && !this.debug ? null : (typeof e[0] == "string" && (e[0] = `${r}${this.prefix} ${e[0]}`), this.logger[n](e)); } create(e) { return new ep(this.logger, { prefix: `${this.prefix}:${e}:`, ...this.options }); } clone(e) { return e = e || this.options, e.prefix = e.prefix || this.prefix, new ep(this.logger, e); } } var eo = new ep(); class Mp { constructor() { this.observers = {}; } on(e, n) { return e.split(" ").forEach((r) => { this.observers[r] || (this.observers[r] = /* @__PURE__ */ new Map()); const i = this.observers[r].get(n) || 0; this.observers[r].set(n, i + 1); }), this; } off(e, n) { if (this.observers[e]) { if (!n) { delete this.observers[e]; return; } this.observers[e].delete(n); } } emit(e) { for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++) r[i - 1] = arguments[i]; this.observers[e] && Array.from(this.observers[e].entries()).forEach((u) => { let [l, f] = u; for (let d = 0; d < f; d++) l(...r); }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((u) => { let [l, f] = u; for (let d = 0; d < f; d++) l.apply(l, [e, ...r]); }); } } const $c = () => { let t, e; const n = new Promise((r, i) => { t = r, e = i; }); return n.resolve = t, n.reject = e, n; }, DE = (t) => t == null ? "" : "" + t, M4 = (t, e, n) => { t.forEach((r) => { e[r] && (n[r] = e[r]); }); }, B4 = /###/g, FE = (t) => t && t.indexOf("###") > -1 ? t.replace(B4, ".") : t, LE = (t) => !t || typeof t == "string", nd = (t, e, n) => { const r = typeof e != "string" ? e : e.split("."); let i = 0; for (; i < r.length - 1; ) { if (LE(t)) return {}; const o = FE(r[i]); !t[o] && n && (t[o] = new n()), Object.prototype.hasOwnProperty.call(t, o) ? t = t[o] : t = {}, ++i; } return LE(t) ? {} : { obj: t, k: FE(r[i]) }; }, UE = (t, e, n) => { const { obj: r, k: i } = nd(t, e, Object); if (r !== void 0 || e.length === 1) { r[i] = n; return; } let o = e[e.length - 1], u = e.slice(0, e.length - 1), l = nd(t, u, Object); for (; l.obj === void 0 && u.length; ) o = `${u[u.length - 1]}.${o}`, u = u.slice(0, u.length - 1), l = nd(t, u, Object), l && l.obj && typeof l.obj[`${l.k}.${o}`] < "u" && (l.obj = void 0); l.obj[`${l.k}.${o}`] = n; }, j4 = (t, e, n, r) => { const { obj: i, k: o } = nd(t, e, Object); i[o] = i[o] || [], i[o].push(n); }, tp = (t, e) => { const { obj: n, k: r } = nd(t, e); if (n) return n[r]; }, $4 = (t, e, n) => { const r = tp(t, n); return r !== void 0 ? r : tp(e, n); }, tN = (t, e, n) => { for (const r in e) r !== "__proto__" && r !== "constructor" && (r in t ? typeof t[r] == "string" || t[r] instanceof String || typeof e[r] == "string" || e[r] instanceof String ? n && (t[r] = e[r]) : tN(t[r], e[r], n) : t[r] = e[r]); return t; }, Yu = (t) => t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); var V4 = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", "/": "/" }; const z4 = (t) => typeof t == "string" ? t.replace(/[&<>"'\/]/g, (e) => V4[e]) : t; class q4 { constructor(e) { this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = []; } getRegExp(e) { const n = this.regExpMap.get(e); if (n !== void 0) return n; const r = new RegExp(e); return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, r), this.regExpQueue.push(e), r; } } const H4 = [" ", ",", "?", "!", ";"], K4 = new q4(20), G4 = (t, e, n) => { e = e || "", n = n || ""; const r = H4.filter((u) => e.indexOf(u) < 0 && n.indexOf(u) < 0); if (r.length === 0) return !0; const i = K4.getRegExp(`(${r.map((u) => u === "?" ? "\\?" : u).join("|")})`); let o = !i.test(t); if (!o) { const u = t.indexOf(n); u > 0 && !i.test(t.substring(0, u)) && (o = !0); } return o; }, Hy = function(t, e) { let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "."; if (!t) return; if (t[e]) return t[e]; const r = e.split(n); let i = t; for (let o = 0; o < r.length; ) { if (!i || typeof i != "object") return; let u, l = ""; for (let f = o; f < r.length; ++f) if (f !== o && (l += n), l += r[f], u = i[l], u !== void 0) { if (["string", "number", "boolean"].indexOf(typeof u) > -1 && f < r.length - 1) continue; o += f - o + 1; break; } i = u; } return i; }, np = (t) => t && t.indexOf("_") > 0 ? t.replace("_", "-") : t; class ME extends Mp { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { ns: ["translation"], defaultNS: "translation" }; super(), this.data = e || {}, this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0); } addNamespaces(e) { this.options.ns.indexOf(e) < 0 && this.options.ns.push(e); } removeNamespaces(e) { const n = this.options.ns.indexOf(e); n > -1 && this.options.ns.splice(n, 1); } getResource(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; const o = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, u = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure; let l; e.indexOf(".") > -1 ? l = e.split(".") : (l = [e, n], r && (Array.isArray(r) ? l.push(...r) : typeof r == "string" && o ? l.push(...r.split(o)) : l.push(r))); const f = tp(this.data, l); return !f && !n && !r && e.indexOf(".") > -1 && (e = l[0], n = l[1], r = l.slice(2).join(".")), f || !u || typeof r != "string" ? f : Hy(this.data && this.data[e] && this.data[e][n], r, o); } addResource(e, n, r, i) { let o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : { silent: !1 }; const u = o.keySeparator !== void 0 ? o.keySeparator : this.options.keySeparator; let l = [e, n]; r && (l = l.concat(u ? r.split(u) : r)), e.indexOf(".") > -1 && (l = e.split("."), i = n, n = l[1]), this.addNamespaces(n), UE(this.data, l, i), o.silent || this.emit("added", e, n, r, i); } addResources(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : { silent: !1 }; for (const o in r) (typeof r[o] == "string" || Array.isArray(r[o])) && this.addResource(e, n, o, r[o], { silent: !0 }); i.silent || this.emit("added", e, n, r); } addResourceBundle(e, n, r, i, o) { let u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : { silent: !1, skipCopy: !1 }, l = [e, n]; e.indexOf(".") > -1 && (l = e.split("."), i = r, r = n, n = l[1]), this.addNamespaces(n); let f = tp(this.data, l) || {}; u.skipCopy || (r = JSON.parse(JSON.stringify(r))), i ? tN(f, r, o) : f = { ...f, ...r }, UE(this.data, l, f), u.silent || this.emit("added", e, n, r); } removeResourceBundle(e, n) { this.hasResourceBundle(e, n) && delete this.data[e][n], this.removeNamespaces(n), this.emit("removed", e, n); } hasResourceBundle(e, n) { return this.getResource(e, n) !== void 0; } getResourceBundle(e, n) { return n || (n = this.options.defaultNS), this.options.compatibilityAPI === "v1" ? { ...this.getResource(e, n) } : this.getResource(e, n); } getDataByLanguage(e) { return this.data[e]; } hasLanguageSomeTranslations(e) { const n = this.getDataByLanguage(e); return !!(n && Object.keys(n) || []).find((i) => n[i] && Object.keys(n[i]).length > 0); } toJSON() { return this.data; } } var nN = { processors: {}, addPostProcessor(t) { this.processors[t.name] = t; }, handle(t, e, n, r, i) { return t.forEach((o) => { this.processors[o] && (e = this.processors[o].process(e, n, r, i)); }), e; } }; const BE = {}; class rp extends Mp { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; super(), M4(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = eo.create("translator"); } changeLanguage(e) { e && (this.language = e); } exists(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { interpolation: {} }; if (e == null) return !1; const r = this.resolve(e, n); return r && r.res !== void 0; } extractFromKey(e, n) { let r = n.nsSeparator !== void 0 ? n.nsSeparator : this.options.nsSeparator; r === void 0 && (r = ":"); const i = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator; let o = n.ns || this.options.defaultNS || []; const u = r && e.indexOf(r) > -1, l = !this.options.userDefinedKeySeparator && !n.keySeparator && !this.options.userDefinedNsSeparator && !n.nsSeparator && !G4(e, r, i); if (u && !l) { const f = e.match(this.interpolator.nestingRegexp); if (f && f.length > 0) return { key: e, namespaces: o }; const d = e.split(r); (r !== i || r === i && this.options.ns.indexOf(d[0]) > -1) && (o = d.shift()), e = d.join(i); } return typeof o == "string" && (o = [o]), { key: e, namespaces: o }; } translate(e, n, r) { if (typeof n != "object" && this.options.overloadTranslationOptionHandler && (n = this.options.overloadTranslationOptionHandler(arguments)), typeof n == "object" && (n = { ...n }), n || (n = {}), e == null) return ""; Array.isArray(e) || (e = [String(e)]); const i = n.returnDetails !== void 0 ? n.returnDetails : this.options.returnDetails, o = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, { key: u, namespaces: l } = this.extractFromKey(e[e.length - 1], n), f = l[l.length - 1], d = n.lng || this.language, p = n.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; if (d && d.toLowerCase() === "cimode") { if (p) { const j = n.nsSeparator || this.options.nsSeparator; return i ? { res: `${f}${j}${u}`, usedKey: u, exactUsedKey: u, usedLng: d, usedNS: f, usedParams: this.getUsedParamsDetails(n) } : `${f}${j}${u}`; } return i ? { res: u, usedKey: u, exactUsedKey: u, usedLng: d, usedNS: f, usedParams: this.getUsedParamsDetails(n) } : u; } const v = this.resolve(e, n); let y = v && v.res; const k = v && v.usedKey || u, A = v && v.exactUsedKey || u, E = Object.prototype.toString.apply(y), T = ["[object Number]", "[object Function]", "[object RegExp]"], D = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, R = !this.i18nFormat || this.i18nFormat.handleAsObject; if (R && y && (typeof y != "string" && typeof y != "boolean" && typeof y != "number") && T.indexOf(E) < 0 && !(typeof D == "string" && Array.isArray(y))) { if (!n.returnObjects && !this.options.returnObjects) { this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!"); const j = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(k, y, { ...n, ns: l }) : `key '${u} (${this.language})' returned an object instead of string.`; return i ? (v.res = j, v.usedParams = this.getUsedParamsDetails(n), v) : j; } if (o) { const j = Array.isArray(y), K = j ? [] : {}, ue = j ? A : k; for (const de in y) if (Object.prototype.hasOwnProperty.call(y, de)) { const H = `${ue}${o}${de}`; K[de] = this.translate(H, { ...n, joinArrays: !1, ns: l }), K[de] === H && (K[de] = y[de]); } y = K; } } else if (R && typeof D == "string" && Array.isArray(y)) y = y.join(D), y && (y = this.extendTranslation(y, e, n, r)); else { let j = !1, K = !1; const ue = n.count !== void 0 && typeof n.count != "string", de = rp.hasDefaultValue(n), H = ue ? this.pluralResolver.getSuffix(d, n.count, n) : "", ve = n.ordinal && ue ? this.pluralResolver.getSuffix(d, n.count, { ordinal: !1 }) : "", Z = ue && !n.ordinal && n.count === 0 && this.pluralResolver.shouldUseIntlApi(), we = Z && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${H}`] || n[`defaultValue${ve}`] || n.defaultValue; !this.isValidLookup(y) && de && (j = !0, y = we), this.isValidLookup(y) || (K = !0, y = u); const it = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && K ? void 0 : y, dt = de && we !== y && this.options.updateMissing; if (K || j || dt) { if (this.logger.log(dt ? "updateKey" : "missingKey", d, f, u, dt ? we : y), o) { const ce = this.resolve(u, { ...n, keySeparator: !1 }); ce && ce.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format."); } let ae = []; const be = this.languageUtils.getFallbackCodes(this.options.fallbackLng, n.lng || this.language); if (this.options.saveMissingTo === "fallback" && be && be[0]) for (let ce = 0; ce < be.length; ce++) ae.push(be[ce]); else this.options.saveMissingTo === "all" ? ae = this.languageUtils.toResolveHierarchy(n.lng || this.language) : ae.push(n.lng || this.language); const pe = (ce, Ee, B) => { const M = de && B !== y ? B : it; this.options.missingKeyHandler ? this.options.missingKeyHandler(ce, f, Ee, M, dt, n) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(ce, f, Ee, M, dt, n), this.emit("missingKey", ce, f, Ee, y); }; this.options.saveMissing && (this.options.saveMissingPlurals && ue ? ae.forEach((ce) => { const Ee = this.pluralResolver.getSuffixes(ce, n); Z && n[`defaultValue${this.options.pluralSeparator}zero`] && Ee.indexOf(`${this.options.pluralSeparator}zero`) < 0 && Ee.push(`${this.options.pluralSeparator}zero`), Ee.forEach((B) => { pe([ce], u + B, n[`defaultValue${B}`] || we); }); }) : pe(ae, u, we)); } y = this.extendTranslation(y, e, n, v, r), K && y === u && this.options.appendNamespaceToMissingKey && (y = `${f}:${u}`), (K || j) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? y = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${f}:${u}` : u, j ? y : void 0) : y = this.options.parseMissingKeyHandler(y)); } return i ? (v.res = y, v.usedParams = this.getUsedParamsDetails(n), v) : y; } extendTranslation(e, n, r, i, o) { var u = this; if (this.i18nFormat && this.i18nFormat.parse) e = this.i18nFormat.parse(e, { ...this.options.interpolation.defaultVariables, ...r }, r.lng || this.language || i.usedLng, i.usedNS, i.usedKey, { resolved: i }); else if (!r.skipInterpolation) { r.interpolation && this.interpolator.init({ ...r, interpolation: { ...this.options.interpolation, ...r.interpolation } }); const d = typeof e == "string" && (r && r.interpolation && r.interpolation.skipOnVariables !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables); let p; if (d) { const y = e.match(this.interpolator.nestingRegexp); p = y && y.length; } let v = r.replace && typeof r.replace != "string" ? r.replace : r; if (this.options.interpolation.defaultVariables && (v = { ...this.options.interpolation.defaultVariables, ...v }), e = this.interpolator.interpolate(e, v, r.lng || this.language || i.usedLng, r), d) { const y = e.match(this.interpolator.nestingRegexp), k = y && y.length; p < k && (r.nest = !1); } !r.lng && this.options.compatibilityAPI !== "v1" && i && i.res && (r.lng = this.language || i.usedLng), r.nest !== !1 && (e = this.interpolator.nest(e, function() { for (var y = arguments.length, k = new Array(y), A = 0; A < y; A++) k[A] = arguments[A]; return o && o[0] === k[0] && !r.context ? (u.logger.warn(`It seems you are nesting recursively key: ${k[0]} in key: ${n[0]}`), null) : u.translate(...k, n); }, r)), r.interpolation && this.interpolator.reset(); } const l = r.postProcess || this.options.postProcess, f = typeof l == "string" ? [l] : l; return e != null && f && f.length && r.applyPostProcessor !== !1 && (e = nN.handle(f, e, n, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...i, usedParams: this.getUsedParamsDetails(r) }, ...r } : r, this)), e; } resolve(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r, i, o, u, l; return typeof e == "string" && (e = [e]), e.forEach((f) => { if (this.isValidLookup(r)) return; const d = this.extractFromKey(f, n), p = d.key; i = p; let v = d.namespaces; this.options.fallbackNS && (v = v.concat(this.options.fallbackNS)); const y = n.count !== void 0 && typeof n.count != "string", k = y && !n.ordinal && n.count === 0 && this.pluralResolver.shouldUseIntlApi(), A = n.context !== void 0 && (typeof n.context == "string" || typeof n.context == "number") && n.context !== "", E = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng); v.forEach((T) => { this.isValidLookup(r) || (l = T, !BE[`${E[0]}-${T}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(l) && (BE[`${E[0]}-${T}`] = !0, this.logger.warn(`key "${i}" for languages "${E.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), E.forEach((D) => { if (this.isValidLookup(r)) return; u = D; const R = [p]; if (this.i18nFormat && this.i18nFormat.addLookupKeys) this.i18nFormat.addLookupKeys(R, p, D, T, n); else { let j; y && (j = this.pluralResolver.getSuffix(D, n.count, n)); const K = `${this.options.pluralSeparator}zero`, ue = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`; if (y && (R.push(p + j), n.ordinal && j.indexOf(ue) === 0 && R.push(p + j.replace(ue, this.options.pluralSeparator)), k && R.push(p + K)), A) { const de = `${p}${this.options.contextSeparator}${n.context}`; R.push(de), y && (R.push(de + j), n.ordinal && j.indexOf(ue) === 0 && R.push(de + j.replace(ue, this.options.pluralSeparator)), k && R.push(de + K)); } } let L; for (; L = R.pop(); ) this.isValidLookup(r) || (o = L, r = this.getResource(D, T, L, n)); })); }); }), { res: r, usedKey: i, exactUsedKey: o, usedLng: u, usedNS: l }; } isValidLookup(e) { return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === ""); } getResource(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; return this.i18nFormat && this.i18nFormat.getResource ? this.i18nFormat.getResource(e, n, r, i) : this.resourceStore.getResource(e, n, r, i); } getUsedParamsDetails() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; const n = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], r = e.replace && typeof e.replace != "string"; let i = r ? e.replace : e; if (r && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = { ...this.options.interpolation.defaultVariables, ...i }), !r) { i = { ...i }; for (const o of n) delete i[o]; } return i; } static hasDefaultValue(e) { const n = "defaultValue"; for (const r in e) if (Object.prototype.hasOwnProperty.call(e, r) && n === r.substring(0, n.length) && e[r] !== void 0) return !0; return !1; } } const Ov = (t) => t.charAt(0).toUpperCase() + t.slice(1); class jE { constructor(e) { this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = eo.create("languageUtils"); } getScriptPartFromCode(e) { if (e = np(e), !e || e.indexOf("-") < 0) return null; const n = e.split("-"); return n.length === 2 || (n.pop(), n[n.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(n.join("-")); } getLanguagePartFromCode(e) { if (e = np(e), !e || e.indexOf("-") < 0) return e; const n = e.split("-"); return this.formatLanguageCode(n[0]); } formatLanguageCode(e) { if (typeof e == "string" && e.indexOf("-") > -1) { const n = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"]; let r = e.split("-"); return this.options.lowerCaseLng ? r = r.map((i) => i.toLowerCase()) : r.length === 2 ? (r[0] = r[0].toLowerCase(), r[1] = r[1].toUpperCase(), n.indexOf(r[1].toLowerCase()) > -1 && (r[1] = Ov(r[1].toLowerCase()))) : r.length === 3 && (r[0] = r[0].toLowerCase(), r[1].length === 2 && (r[1] = r[1].toUpperCase()), r[0] !== "sgn" && r[2].length === 2 && (r[2] = r[2].toUpperCase()), n.indexOf(r[1].toLowerCase()) > -1 && (r[1] = Ov(r[1].toLowerCase())), n.indexOf(r[2].toLowerCase()) > -1 && (r[2] = Ov(r[2].toLowerCase()))), r.join("-"); } return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e; } isSupportedCode(e) { return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1; } getBestMatchFromCodes(e) { if (!e) return null; let n; return e.forEach((r) => { if (n) return; const i = this.formatLanguageCode(r); (!this.options.supportedLngs || this.isSupportedCode(i)) && (n = i); }), !n && this.options.supportedLngs && e.forEach((r) => { if (n) return; const i = this.getLanguagePartFromCode(r); if (this.isSupportedCode(i)) return n = i; n = this.options.supportedLngs.find((o) => { if (o === i) return o; if (!(o.indexOf("-") < 0 && i.indexOf("-") < 0) && (o.indexOf("-") > 0 && i.indexOf("-") < 0 && o.substring(0, o.indexOf("-")) === i || o.indexOf(i) === 0 && i.length > 1)) return o; }); }), n || (n = this.getFallbackCodes(this.options.fallbackLng)[0]), n; } getFallbackCodes(e, n) { if (!e) return []; if (typeof e == "function" && (e = e(n)), typeof e == "string" && (e = [e]), Array.isArray(e)) return e; if (!n) return e.default || []; let r = e[n]; return r || (r = e[this.getScriptPartFromCode(n)]), r || (r = e[this.formatLanguageCode(n)]), r || (r = e[this.getLanguagePartFromCode(n)]), r || (r = e.default), r || []; } toResolveHierarchy(e, n) { const r = this.getFallbackCodes(n || this.options.fallbackLng || [], e), i = [], o = (u) => { u && (this.isSupportedCode(u) ? i.push(u) : this.logger.warn(`rejecting language code not found in supportedLngs: ${u}`)); }; return typeof e == "string" && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && o(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && o(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && o(this.getLanguagePartFromCode(e))) : typeof e == "string" && o(this.formatLanguageCode(e)), r.forEach((u) => { i.indexOf(u) < 0 && o(this.formatLanguageCode(u)); }), i; } } let W4 = [{ lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"], nr: [1, 2], fc: 1 }, { lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"], nr: [1, 2], fc: 2 }, { lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"], nr: [1], fc: 3 }, { lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"], nr: [1, 2, 5], fc: 4 }, { lngs: ["ar"], nr: [0, 1, 2, 3, 11, 100], fc: 5 }, { lngs: ["cs", "sk"], nr: [1, 2, 5], fc: 6 }, { lngs: ["csb", "pl"], nr: [1, 2, 5], fc: 7 }, { lngs: ["cy"], nr: [1, 2, 3, 8], fc: 8 }, { lngs: ["fr"], nr: [1, 2], fc: 9 }, { lngs: ["ga"], nr: [1, 2, 3, 7, 11], fc: 10 }, { lngs: ["gd"], nr: [1, 2, 3, 20], fc: 11 }, { lngs: ["is"], nr: [1, 2], fc: 12 }, { lngs: ["jv"], nr: [0, 1], fc: 13 }, { lngs: ["kw"], nr: [1, 2, 3, 4], fc: 14 }, { lngs: ["lt"], nr: [1, 2, 10], fc: 15 }, { lngs: ["lv"], nr: [1, 2, 0], fc: 16 }, { lngs: ["mk"], nr: [1, 2], fc: 17 }, { lngs: ["mnk"], nr: [0, 1, 2], fc: 18 }, { lngs: ["mt"], nr: [1, 2, 11, 20], fc: 19 }, { lngs: ["or"], nr: [2, 1], fc: 2 }, { lngs: ["ro"], nr: [1, 2, 20], fc: 20 }, { lngs: ["sl"], nr: [5, 1, 2, 3], fc: 21 }, { lngs: ["he", "iw"], nr: [1, 2, 20, 21], fc: 22 }], Y4 = { 1: (t) => +(t > 1), 2: (t) => +(t != 1), 3: (t) => 0, 4: (t) => t % 10 == 1 && t % 100 != 11 ? 0 : t % 10 >= 2 && t % 10 <= 4 && (t % 100 < 10 || t % 100 >= 20) ? 1 : 2, 5: (t) => t == 0 ? 0 : t == 1 ? 1 : t == 2 ? 2 : t % 100 >= 3 && t % 100 <= 10 ? 3 : t % 100 >= 11 ? 4 : 5, 6: (t) => t == 1 ? 0 : t >= 2 && t <= 4 ? 1 : 2, 7: (t) => t == 1 ? 0 : t % 10 >= 2 && t % 10 <= 4 && (t % 100 < 10 || t % 100 >= 20) ? 1 : 2, 8: (t) => t == 1 ? 0 : t == 2 ? 1 : t != 8 && t != 11 ? 2 : 3, 9: (t) => +(t >= 2), 10: (t) => t == 1 ? 0 : t == 2 ? 1 : t < 7 ? 2 : t < 11 ? 3 : 4, 11: (t) => t == 1 || t == 11 ? 0 : t == 2 || t == 12 ? 1 : t > 2 && t < 20 ? 2 : 3, 12: (t) => +(t % 10 != 1 || t % 100 == 11), 13: (t) => +(t !== 0), 14: (t) => t == 1 ? 0 : t == 2 ? 1 : t == 3 ? 2 : 3, 15: (t) => t % 10 == 1 && t % 100 != 11 ? 0 : t % 10 >= 2 && (t % 100 < 10 || t % 100 >= 20) ? 1 : 2, 16: (t) => t % 10 == 1 && t % 100 != 11 ? 0 : t !== 0 ? 1 : 2, 17: (t) => t == 1 || t % 10 == 1 && t % 100 != 11 ? 0 : 1, 18: (t) => t == 0 ? 0 : t == 1 ? 1 : 2, 19: (t) => t == 1 ? 0 : t == 0 || t % 100 > 1 && t % 100 < 11 ? 1 : t % 100 > 10 && t % 100 < 20 ? 2 : 3, 20: (t) => t == 1 ? 0 : t == 0 || t % 100 > 0 && t % 100 < 20 ? 1 : 2, 21: (t) => t % 100 == 1 ? 1 : t % 100 == 2 ? 2 : t % 100 == 3 || t % 100 == 4 ? 3 : 0, 22: (t) => t == 1 ? 0 : t == 2 ? 1 : (t < 0 || t > 10) && t % 10 == 0 ? 2 : 3 }; const Q4 = ["v1", "v2", "v3"], J4 = ["v4"], $E = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }, X4 = () => { const t = {}; return W4.forEach((e) => { e.lngs.forEach((n) => { t[n] = { numbers: e.nr, plurals: Y4[e.fc] }; }); }), t; }; class Z4 { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.languageUtils = e, this.options = n, this.logger = eo.create("pluralResolver"), (!this.options.compatibilityJSON || J4.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = X4(), this.pluralRulesCache = {}; } addRule(e, n) { this.rules[e] = n; } clearCache() { this.pluralRulesCache = {}; } getRule(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (this.shouldUseIntlApi()) try { const r = np(e === "dev" ? "en" : e), i = n.ordinal ? "ordinal" : "cardinal", o = JSON.stringify({ cleanedCode: r, type: i }); if (o in this.pluralRulesCache) return this.pluralRulesCache[o]; const u = new Intl.PluralRules(r, { type: i }); return this.pluralRulesCache[o] = u, u; } catch { return; } return this.rules[e] || this.rules[this.languageUtils.getLanguagePartFromCode(e)]; } needsPlural(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const r = this.getRule(e, n); return this.shouldUseIntlApi() ? r && r.resolvedOptions().pluralCategories.length > 1 : r && r.numbers.length > 1; } getPluralFormsOfKey(e, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; return this.getSuffixes(e, r).map((i) => `${n}${i}`); } getSuffixes(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const r = this.getRule(e, n); return r ? this.shouldUseIntlApi() ? r.resolvedOptions().pluralCategories.sort((i, o) => $E[i] - $E[o]).map((i) => `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : r.numbers.map((i) => this.getSuffix(e, i, n)) : []; } getSuffix(e, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; const i = this.getRule(e, r); return i ? this.shouldUseIntlApi() ? `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(n)}` : this.getSuffixRetroCompatible(i, n) : (this.logger.warn(`no plural rule found for: ${e}`), ""); } getSuffixRetroCompatible(e, n) { const r = e.noAbs ? e.plurals(n) : e.plurals(Math.abs(n)); let i = e.numbers[r]; this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 && (i === 2 ? i = "plural" : i === 1 && (i = "")); const o = () => this.options.prepend && i.toString() ? this.options.prepend + i.toString() : i.toString(); return this.options.compatibilityJSON === "v1" ? i === 1 ? "" : typeof i == "number" ? `_plural_${i.toString()}` : o() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 ? o() : this.options.prepend && r.toString() ? this.options.prepend + r.toString() : r.toString(); } shouldUseIntlApi() { return !Q4.includes(this.options.compatibilityJSON); } } const VE = function(t, e, n) { let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, o = $4(t, e, n); return !o && i && typeof n == "string" && (o = Hy(t, n, r), o === void 0 && (o = Hy(e, n, r))), o; }, Pv = (t) => t.replace(/\$/g, "$$$$"); class e$ { constructor() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.logger = eo.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((n) => n), this.init(e); } init() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; e.interpolation || (e.interpolation = { escapeValue: !0 }); const { escape: n, escapeValue: r, useRawValueToEscape: i, prefix: o, prefixEscaped: u, suffix: l, suffixEscaped: f, formatSeparator: d, unescapeSuffix: p, unescapePrefix: v, nestingPrefix: y, nestingPrefixEscaped: k, nestingSuffix: A, nestingSuffixEscaped: E, nestingOptionsSeparator: T, maxReplaces: D, alwaysFormat: R } = e.interpolation; this.escape = n !== void 0 ? n : z4, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = o ? Yu(o) : u || "{{", this.suffix = l ? Yu(l) : f || "}}", this.formatSeparator = d || ",", this.unescapePrefix = p ? "" : v || "-", this.unescapeSuffix = this.unescapePrefix ? "" : p || "", this.nestingPrefix = y ? Yu(y) : k || Yu("$t("), this.nestingSuffix = A ? Yu(A) : E || Yu(")"), this.nestingOptionsSeparator = T || ",", this.maxReplaces = D || 1e3, this.alwaysFormat = R !== void 0 ? R : !1, this.resetRegExp(); } reset() { this.options && this.init(this.options); } resetRegExp() { const e = (n, r) => n && n.source === r ? (n.lastIndex = 0, n) : new RegExp(r, "g"); this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`); } interpolate(e, n, r, i) { let o, u, l; const f = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, d = (k) => { if (k.indexOf(this.formatSeparator) < 0) { const D = VE(n, f, k, this.options.keySeparator, this.options.ignoreJSONStructure); return this.alwaysFormat ? this.format(D, void 0, r, { ...i, ...n, interpolationkey: k }) : D; } const A = k.split(this.formatSeparator), E = A.shift().trim(), T = A.join(this.formatSeparator).trim(); return this.format(VE(n, f, E, this.options.keySeparator, this.options.ignoreJSONStructure), T, r, { ...i, ...n, interpolationkey: E }); }; this.resetRegExp(); const p = i && i.missingInterpolationHandler || this.options.missingInterpolationHandler, v = i && i.interpolation && i.interpolation.skipOnVariables !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables; return [{ regex: this.regexpUnescape, safeValue: (k) => Pv(k) }, { regex: this.regexp, safeValue: (k) => this.escapeValue ? Pv(this.escape(k)) : Pv(k) }].forEach((k) => { for (l = 0; o = k.regex.exec(e); ) { const A = o[1].trim(); if (u = d(A), u === void 0) if (typeof p == "function") { const T = p(e, o, i); u = typeof T == "string" ? T : ""; } else if (i && Object.prototype.hasOwnProperty.call(i, A)) u = ""; else if (v) { u = o[0]; continue; } else this.logger.warn(`missed to pass in variable ${A} for interpolating ${e}`), u = ""; else typeof u != "string" && !this.useRawValueToEscape && (u = DE(u)); const E = k.safeValue(u); if (e = e.replace(o[0], E), v ? (k.regex.lastIndex += u.length, k.regex.lastIndex -= o[0].length) : k.regex.lastIndex = 0, l++, l >= this.maxReplaces) break; } }), e; } nest(e, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, o, u; const l = (f, d) => { const p = this.nestingOptionsSeparator; if (f.indexOf(p) < 0) return f; const v = f.split(new RegExp(`${p}[ ]*{`)); let y = `{${v[1]}`; f = v[0], y = this.interpolate(y, u); const k = y.match(/'/g), A = y.match(/"/g); (k && k.length % 2 === 0 && !A || A.length % 2 !== 0) && (y = y.replace(/'/g, '"')); try { u = JSON.parse(y), d && (u = { ...d, ...u }); } catch (E) { return this.logger.warn(`failed parsing options string in nesting for key ${f}`, E), `${f}${p}${y}`; } return u.defaultValue && u.defaultValue.indexOf(this.prefix) > -1 && delete u.defaultValue, f; }; for (; i = this.nestingRegexp.exec(e); ) { let f = []; u = { ...r }, u = u.replace && typeof u.replace != "string" ? u.replace : u, u.applyPostProcessor = !1, delete u.defaultValue; let d = !1; if (i[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(i[1])) { const p = i[1].split(this.formatSeparator).map((v) => v.trim()); i[1] = p.shift(), f = p, d = !0; } if (o = n(l.call(this, i[1].trim(), u), u), o && i[0] === e && typeof o != "string") return o; typeof o != "string" && (o = DE(o)), o || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), o = ""), d && (o = f.reduce((p, v) => this.format(p, v, r.lng, { ...r, interpolationkey: i[1].trim() }), o.trim())), e = e.replace(i[0], o), this.regexp.lastIndex = 0; } return e; } } const t$ = (t) => { let e = t.toLowerCase().trim(); const n = {}; if (t.indexOf("(") > -1) { const r = t.split("("); e = r[0].toLowerCase().trim(); const i = r[1].substring(0, r[1].length - 1); e === "currency" && i.indexOf(":") < 0 ? n.currency || (n.currency = i.trim()) : e === "relativetime" && i.indexOf(":") < 0 ? n.range || (n.range = i.trim()) : i.split(";").forEach((u) => { if (u) { const [l, ...f] = u.split(":"), d = f.join(":").trim().replace(/^'+|'+$/g, ""), p = l.trim(); n[p] || (n[p] = d), d === "false" && (n[p] = !1), d === "true" && (n[p] = !0), isNaN(d) || (n[p] = parseInt(d, 10)); } }); } return { formatName: e, formatOptions: n }; }, Qu = (t) => { const e = {}; return (n, r, i) => { let o = i; i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (o = { ...o, [i.interpolationkey]: void 0 }); const u = r + JSON.stringify(o); let l = e[u]; return l || (l = t(np(r), i), e[u] = l), l(n); }; }; class n$ { constructor() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.logger = eo.create("formatter"), this.options = e, this.formats = { number: Qu((n, r) => { const i = new Intl.NumberFormat(n, { ...r }); return (o) => i.format(o); }), currency: Qu((n, r) => { const i = new Intl.NumberFormat(n, { ...r, style: "currency" }); return (o) => i.format(o); }), datetime: Qu((n, r) => { const i = new Intl.DateTimeFormat(n, { ...r }); return (o) => i.format(o); }), relativetime: Qu((n, r) => { const i = new Intl.RelativeTimeFormat(n, { ...r }); return (o) => i.format(o, r.range || "day"); }), list: Qu((n, r) => { const i = new Intl.ListFormat(n, { ...r }); return (o) => i.format(o); }) }, this.init(e); } init(e) { const r = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { interpolation: {} }).interpolation; this.formatSeparator = r.formatSeparator ? r.formatSeparator : r.formatSeparator || ","; } add(e, n) { this.formats[e.toLowerCase().trim()] = n; } addCached(e, n) { this.formats[e.toLowerCase().trim()] = Qu(n); } format(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; const o = n.split(this.formatSeparator); if (o.length > 1 && o[0].indexOf("(") > 1 && o[0].indexOf(")") < 0 && o.find((l) => l.indexOf(")") > -1)) { const l = o.findIndex((f) => f.indexOf(")") > -1); o[0] = [o[0], ...o.splice(1, l)].join(this.formatSeparator); } return o.reduce((l, f) => { const { formatName: d, formatOptions: p } = t$(f); if (this.formats[d]) { let v = l; try { const y = i && i.formatParams && i.formatParams[i.interpolationkey] || {}, k = y.locale || y.lng || i.locale || i.lng || r; v = this.formats[d](l, k, { ...p, ...i, ...y }); } catch (y) { this.logger.warn(y); } return v; } else this.logger.warn(`there was no format function for ${d}`); return l; }, e); } } const r$ = (t, e) => { t.pending[e] !== void 0 && (delete t.pending[e], t.pendingCount--); }; class i$ extends Mp { constructor(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; super(), this.backend = e, this.store = n, this.services = r, this.languageUtils = r.languageUtils, this.options = i, this.logger = eo.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = i.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = i.maxRetries >= 0 ? i.maxRetries : 5, this.retryTimeout = i.retryTimeout >= 1 ? i.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(r, i.backend, i); } queueLoad(e, n, r, i) { const o = {}, u = {}, l = {}, f = {}; return e.forEach((d) => { let p = !0; n.forEach((v) => { const y = `${d}|${v}`; !r.reload && this.store.hasResourceBundle(d, v) ? this.state[y] = 2 : this.state[y] < 0 || (this.state[y] === 1 ? u[y] === void 0 && (u[y] = !0) : (this.state[y] = 1, p = !1, u[y] === void 0 && (u[y] = !0), o[y] === void 0 && (o[y] = !0), f[v] === void 0 && (f[v] = !0))); }), p || (l[d] = !0); }), (Object.keys(o).length || Object.keys(u).length) && this.queue.push({ pending: u, pendingCount: Object.keys(u).length, loaded: {}, errors: [], callback: i }), { toLoad: Object.keys(o), pending: Object.keys(u), toLoadLanguages: Object.keys(l), toLoadNamespaces: Object.keys(f) }; } loaded(e, n, r) { const i = e.split("|"), o = i[0], u = i[1]; n && this.emit("failedLoading", o, u, n), !n && r && this.store.addResourceBundle(o, u, r, void 0, void 0, { skipCopy: !0 }), this.state[e] = n ? -1 : 2, n && r && (this.state[e] = 0); const l = {}; this.queue.forEach((f) => { j4(f.loaded, [o], u), r$(f, e), n && f.errors.push(n), f.pendingCount === 0 && !f.done && (Object.keys(f.loaded).forEach((d) => { l[d] || (l[d] = {}); const p = f.loaded[d]; p.length && p.forEach((v) => { l[d][v] === void 0 && (l[d][v] = !0); }); }), f.done = !0, f.errors.length ? f.callback(f.errors) : f.callback()); }), this.emit("loaded", l), this.queue = this.queue.filter((f) => !f.done); } read(e, n, r) { let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, u = arguments.length > 5 ? arguments[5] : void 0; if (!e.length) return u(null, {}); if (this.readingCalls >= this.maxParallelReads) { this.waitingReads.push({ lng: e, ns: n, fcName: r, tried: i, wait: o, callback: u }); return; } this.readingCalls++; const l = (d, p) => { if (this.readingCalls--, this.waitingReads.length > 0) { const v = this.waitingReads.shift(); this.read(v.lng, v.ns, v.fcName, v.tried, v.wait, v.callback); } if (d && p && i < this.maxRetries) { setTimeout(() => { this.read.call(this, e, n, r, i + 1, o * 2, u); }, o); return; } u(d, p); }, f = this.backend[r].bind(this.backend); if (f.length === 2) { try { const d = f(e, n); d && typeof d.then == "function" ? d.then((p) => l(null, p)).catch(l) : l(null, d); } catch (d) { l(d); } return; } return f(e, n, l); } prepareLoading(e, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 ? arguments[3] : void 0; if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i(); typeof e == "string" && (e = this.languageUtils.toResolveHierarchy(e)), typeof n == "string" && (n = [n]); const o = this.queueLoad(e, n, r, i); if (!o.toLoad.length) return o.pending.length || i(), null; o.toLoad.forEach((u) => { this.loadOne(u); }); } load(e, n, r) { this.prepareLoading(e, n, {}, r); } reload(e, n, r) { this.prepareLoading(e, n, { reload: !0 }, r); } loadOne(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; const r = e.split("|"), i = r[0], o = r[1]; this.read(i, o, "read", void 0, void 0, (u, l) => { u && this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`, u), !u && l && this.logger.log(`${n}loaded namespace ${o} for language ${i}`, l), this.loaded(e, u, l); }); } saveMissing(e, n, r, i, o) { let u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, l = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => { }; if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(n)) { this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"); return; } if (!(r == null || r === "")) { if (this.backend && this.backend.create) { const f = { ...u, isUpdate: o }, d = this.backend.create.bind(this.backend); if (d.length < 6) try { let p; d.length === 5 ? p = d(e, n, r, i, f) : p = d(e, n, r, i), p && typeof p.then == "function" ? p.then((v) => l(null, v)).catch(l) : l(null, p); } catch (p) { l(p); } else d(e, n, r, i, l, f); } !e || !e[0] || this.store.addResource(e[0], n, r, i); } } } const zE = () => ({ debug: !1, initImmediate: !0, ns: ["translation"], defaultNS: ["translation"], fallbackLng: ["dev"], fallbackNS: !1, supportedLngs: !1, nonExplicitSupportedLngs: !1, load: "all", preload: !1, simplifyPluralSuffix: !0, keySeparator: ".", nsSeparator: ":", pluralSeparator: "_", contextSeparator: "_", partialBundledLanguages: !1, saveMissing: !1, updateMissing: !1, saveMissingTo: "fallback", saveMissingPlurals: !0, missingKeyHandler: !1, missingInterpolationHandler: !1, postProcess: !1, postProcessPassResolved: !1, returnNull: !1, returnEmptyString: !0, returnObjects: !1, joinArrays: !1, returnedObjectHandler: !1, parseMissingKeyHandler: !1, appendNamespaceToMissingKey: !1, appendNamespaceToCIMode: !1, overloadTranslationOptionHandler: (t) => { let e = {}; if (typeof t[1] == "object" && (e = t[1]), typeof t[1] == "string" && (e.defaultValue = t[1]), typeof t[2] == "string" && (e.tDescription = t[2]), typeof t[2] == "object" || typeof t[3] == "object") { const n = t[3] || t[2]; Object.keys(n).forEach((r) => { e[r] = n[r]; }); } return e; }, interpolation: { escapeValue: !0, format: (t) => t, prefix: "{{", suffix: "}}", formatSeparator: ",", unescapePrefix: "-", nestingPrefix: "$t(", nestingSuffix: ")", nestingOptionsSeparator: ",", maxReplaces: 1e3, skipOnVariables: !0 } }), qE = (t) => (typeof t.ns == "string" && (t.ns = [t.ns]), typeof t.fallbackLng == "string" && (t.fallbackLng = [t.fallbackLng]), typeof t.fallbackNS == "string" && (t.fallbackNS = [t.fallbackNS]), t.supportedLngs && t.supportedLngs.indexOf("cimode") < 0 && (t.supportedLngs = t.supportedLngs.concat(["cimode"])), t), lh = () => { }, o$ = (t) => { Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach((n) => { typeof t[n] == "function" && (t[n] = t[n].bind(t)); }); }; class wd extends Mp { constructor() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 ? arguments[1] : void 0; if (super(), this.options = qE(e), this.services = {}, this.logger = eo, this.modules = { external: [] }, o$(this), n && !this.isInitialized && !e.isClone) { if (!this.options.initImmediate) return this.init(e, n), this; setTimeout(() => { this.init(e, n); }, 0); } } init() { var e = this; let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 ? arguments[1] : void 0; this.isInitializing = !0, typeof n == "function" && (r = n, n = {}), !n.defaultNS && n.defaultNS !== !1 && n.ns && (typeof n.ns == "string" ? n.defaultNS = n.ns : n.ns.indexOf("translation") < 0 && (n.defaultNS = n.ns[0])); const i = zE(); this.options = { ...i, ...this.options, ...qE(n) }, this.options.compatibilityAPI !== "v1" && (this.options.interpolation = { ...i.interpolation, ...this.options.interpolation }), n.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = n.keySeparator), n.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = n.nsSeparator); const o = (p) => p ? typeof p == "function" ? new p() : p : null; if (!this.options.isClone) { this.modules.logger ? eo.init(o(this.modules.logger), this.options) : eo.init(null, this.options); let p; this.modules.formatter ? p = this.modules.formatter : typeof Intl < "u" && (p = n$); const v = new jE(this.options); this.store = new ME(this.options.resources, this.options); const y = this.services; y.logger = eo, y.resourceStore = this.store, y.languageUtils = v, y.pluralResolver = new Z4(v, { prepend: this.options.pluralSeparator, compatibilityJSON: this.options.compatibilityJSON, simplifyPluralSuffix: this.options.simplifyPluralSuffix }), p && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (y.formatter = o(p), y.formatter.init(y, this.options), this.options.interpolation.format = y.formatter.format.bind(y.formatter)), y.interpolator = new e$(this.options), y.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, y.backendConnector = new i$(o(this.modules.backend), y.resourceStore, y, this.options), y.backendConnector.on("*", function(k) { for (var A = arguments.length, E = new Array(A > 1 ? A - 1 : 0), T = 1; T < A; T++) E[T - 1] = arguments[T]; e.emit(k, ...E); }), this.modules.languageDetector && (y.languageDetector = o(this.modules.languageDetector), y.languageDetector.init && y.languageDetector.init(y, this.options.detection, this.options)), this.modules.i18nFormat && (y.i18nFormat = o(this.modules.i18nFormat), y.i18nFormat.init && y.i18nFormat.init(this)), this.translator = new rp(this.services, this.options), this.translator.on("*", function(k) { for (var A = arguments.length, E = new Array(A > 1 ? A - 1 : 0), T = 1; T < A; T++) E[T - 1] = arguments[T]; e.emit(k, ...E); }), this.modules.external.forEach((k) => { k.init && k.init(this); }); } if (this.format = this.options.interpolation.format, r || (r = lh), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) { const p = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng); p.length > 0 && p[0] !== "dev" && (this.options.lng = p[0]); } !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((p) => { this[p] = function() { return e.store[p](...arguments); }; }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((p) => { this[p] = function() { return e.store[p](...arguments), e; }; }); const f = $c(), d = () => { const p = (v, y) => { this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), f.resolve(y), r(v, y); }; if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return p(null, this.t.bind(this)); this.changeLanguage(this.options.lng, p); }; return this.options.resources || !this.options.initImmediate ? d() : setTimeout(d, 0), f; } loadResources(e) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : lh; const i = typeof e == "string" ? e : this.language; if (typeof e == "function" && (r = e), !this.options.resources || this.options.partialBundledLanguages) { if (i && i.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return r(); const o = [], u = (l) => { if (!l || l === "cimode") return; this.services.languageUtils.toResolveHierarchy(l).forEach((d) => { d !== "cimode" && o.indexOf(d) < 0 && o.push(d); }); }; i ? u(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((f) => u(f)), this.options.preload && this.options.preload.forEach((l) => u(l)), this.services.backendConnector.load(o, this.options.ns, (l) => { !l && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), r(l); }); } else r(null); } reloadResources(e, n, r) { const i = $c(); return typeof e == "function" && (r = e, e = void 0), typeof n == "function" && (r = n, n = void 0), e || (e = this.languages), n || (n = this.options.ns), r || (r = lh), this.services.backendConnector.reload(e, n, (o) => { i.resolve(), r(o); }), i; } use(e) { if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()"); if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()"); return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && nN.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this; } setResolvedLanguage(e) { if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) for (let n = 0; n < this.languages.length; n++) { const r = this.languages[n]; if (!(["cimode", "dev"].indexOf(r) > -1) && this.store.hasLanguageSomeTranslations(r)) { this.resolvedLanguage = r; break; } } } changeLanguage(e, n) { var r = this; this.isLanguageChangingTo = e; const i = $c(); this.emit("languageChanging", e); const o = (f) => { this.language = f, this.languages = this.services.languageUtils.toResolveHierarchy(f), this.resolvedLanguage = void 0, this.setResolvedLanguage(f); }, u = (f, d) => { d ? (o(d), this.translator.changeLanguage(d), this.isLanguageChangingTo = void 0, this.emit("languageChanged", d), this.logger.log("languageChanged", d)) : this.isLanguageChangingTo = void 0, i.resolve(function() { return r.t(...arguments); }), n && n(f, function() { return r.t(...arguments); }); }, l = (f) => { !e && !f && this.services.languageDetector && (f = []); const d = typeof f == "string" ? f : this.services.languageUtils.getBestMatchFromCodes(f); d && (this.language || o(d), this.translator.language || this.translator.changeLanguage(d), this.services.languageDetector && this.services.languageDetector.cacheUserLanguage && this.services.languageDetector.cacheUserLanguage(d)), this.loadResources(d, (p) => { u(p, d); }); }; return !e && this.services.languageDetector && !this.services.languageDetector.async ? l(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(l) : this.services.languageDetector.detect(l) : l(e), i; } getFixedT(e, n, r) { var i = this; const o = function(u, l) { let f; if (typeof l != "object") { for (var d = arguments.length, p = new Array(d > 2 ? d - 2 : 0), v = 2; v < d; v++) p[v - 2] = arguments[v]; f = i.options.overloadTranslationOptionHandler([u, l].concat(p)); } else f = { ...l }; f.lng = f.lng || o.lng, f.lngs = f.lngs || o.lngs, f.ns = f.ns || o.ns, f.keyPrefix !== "" && (f.keyPrefix = f.keyPrefix || r || o.keyPrefix); const y = i.options.keySeparator || "."; let k; return f.keyPrefix && Array.isArray(u) ? k = u.map((A) => `${f.keyPrefix}${y}${A}`) : k = f.keyPrefix ? `${f.keyPrefix}${y}${u}` : u, i.t(k, f); }; return typeof e == "string" ? o.lng = e : o.lngs = e, o.ns = n, o.keyPrefix = r, o; } t() { return this.translator && this.translator.translate(...arguments); } exists() { return this.translator && this.translator.exists(...arguments); } setDefaultNamespace(e) { this.options.defaultNS = e; } hasLoadedNamespace(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1; if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1; const r = n.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, o = this.languages[this.languages.length - 1]; if (r.toLowerCase() === "cimode") return !0; const u = (l, f) => { const d = this.services.backendConnector.state[`${l}|${f}`]; return d === -1 || d === 0 || d === 2; }; if (n.precheck) { const l = n.precheck(this, u); if (l !== void 0) return l; } return !!(this.hasResourceBundle(r, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || u(r, e) && (!i || u(o, e))); } loadNamespaces(e, n) { const r = $c(); return this.options.ns ? (typeof e == "string" && (e = [e]), e.forEach((i) => { this.options.ns.indexOf(i) < 0 && this.options.ns.push(i); }), this.loadResources((i) => { r.resolve(), n && n(i); }), r) : (n && n(), Promise.resolve()); } loadLanguages(e, n) { const r = $c(); typeof e == "string" && (e = [e]); const i = this.options.preload || [], o = e.filter((u) => i.indexOf(u) < 0 && this.services.languageUtils.isSupportedCode(u)); return o.length ? (this.options.preload = i.concat(o), this.loadResources((u) => { r.resolve(), n && n(u); }), r) : (n && n(), Promise.resolve()); } dir(e) { if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e) return "rtl"; const n = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], r = this.services && this.services.languageUtils || new jE(zE()); return n.indexOf(r.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr"; } static createInstance() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 ? arguments[1] : void 0; return new wd(e, n); } cloneInstance() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : lh; const r = e.forkResourceStore; r && delete e.forkResourceStore; const i = { ...this.options, ...e, isClone: !0 }, o = new wd(i); return (e.debug !== void 0 || e.prefix !== void 0) && (o.logger = o.logger.clone(e)), ["store", "services", "language"].forEach((l) => { o[l] = this[l]; }), o.services = { ...this.services }, o.services.utils = { hasLoadedNamespace: o.hasLoadedNamespace.bind(o) }, r && (o.store = new ME(this.store.data, i), o.services.resourceStore = o.store), o.translator = new rp(o.services, i), o.translator.on("*", function(l) { for (var f = arguments.length, d = new Array(f > 1 ? f - 1 : 0), p = 1; p < f; p++) d[p - 1] = arguments[p]; o.emit(l, ...d); }), o.init(i, n), o.translator.options = i, o.translator.backendConnector.services.utils = { hasLoadedNamespace: o.hasLoadedNamespace.bind(o) }, o; } toJSON() { return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage }; } } const Gn = wd.createInstance(); Gn.createInstance = wd.createInstance; Gn.createInstance; Gn.dir; Gn.init; Gn.loadResources; Gn.reloadResources; Gn.use; Gn.changeLanguage; Gn.getFixedT; const HE = Gn.t; Gn.exists; Gn.setDefaultNamespace; Gn.hasLoadedNamespace; Gn.loadNamespaces; Gn.loadLanguages; const rN = (t) => HE(t ? `errorCodes.${t}` : "errorCodes.DEFAULT"); class s$ { logger; axiosInstance; constructor(e) { this.logger = e.logger, this.axiosInstance = an.create({ baseURL: e.baseUrl, headers: e.accessToken ? { Authorization: `Bearer ${e.accessToken}` } : {} }); } /** * Performs a GET request to the specified path. * * @param {string} path - The endpoint path. * @returns {Promise} - The response data. * @throws {Error} - Throws a user-friendly error message if the request fails. */ async get(e) { try { return (await this.axiosInstance.get(e)).data; } catch (n) { throw this.handleError(n); } } /** * Performs a POST request to the specified path with the provided data. * * @param {string} path - The endpoint path. * @param {PostRequestInput} input - The request config. * @returns {Promise} - The response data. * @throws {Error} - Throws a user-friendly error message if the request fails. */ async post(e, n) { const { data: r = {}, ignoreError: i = !1 } = n; try { return (await this.axiosInstance.post( e, r )).data; } catch (o) { if (i && an.isAxiosError(o)) return o.response?.data; throw this.handleError(o); } } /** * Performs a PUT request to the specified path with the provided data. * * @param {string} path - The endpoint path. * @param {PostRequestInput} input - The request config. * @returns {Promise} - The response data. * @throws {Error} - Throws a user-friendly error message if the request fails. */ async put(e, n) { const { data: r = {}, ignoreError: i = !1 } = n; try { return (await this.axiosInstance.put( e, r )).data; } catch (o) { if (i && an.isAxiosError(o)) return o.response?.data; throw this.handleError(o); } } /** * Performs a DELETE request to the specified path. * * @param {string} path - The endpoint path. * @returns {Promise} - The response data. * @throws {Error} - Throws a user-friendly error message if the request fails. */ async delete(e) { try { return (await this.axiosInstance.delete(e)).data; } catch (n) { throw this.handleError(n); } } /** * Handles errors from Axios requests, logging them and returning a user-friendly error message. * * @param {unknown} error - The error object from Axios. * @returns {Error} - A new error with a user-friendly message. */ handleError(e) { let n = nr.GENERAL_ERROR; if (an.isAxiosError(e)) if (e.response) switch (e.response.status) { case 400: n = nr.BAD_REQUEST; break; case 401: n = nr.UNAUTHORIZED; break; case 403: n = nr.FORBIDDEN; break; case 404: n = nr.NOT_FOUND; break; case 409: n = nr.CONFLICT; break; case 410: n = nr.GONE; break; case 415: n = nr.UNSUPPORTED_MEDIA_TYPE; break; case 429: n = nr.TOO_MANY_REQUESTS; break; case 500: n = nr.INTERNAL_SERVER_ERROR; break; case 503: n = nr.SERVICE_UNAVAILABLE; break; default: n = nr.SERVER_ERROR; } else e.request ? n = nr.NETWORK_ERROR : n = nr.CONFIG_ERROR; const r = rN(n); return this.logger.error("Error Code:", n, "Message:", r), this.logger.error("Result Data:", e.response?.data), new Error(r); } } var iN = /* @__PURE__ */ ((t) => (t.CREATED = "CREATED", t.STARTING = "STARTING", t.LIVE = "LIVE", t.FINALIZED = "FINALIZED", t))(iN || {}), oN = /* @__PURE__ */ ((t) => (t.COMBO = "Combo", t.BADGE = "Badged", t))(oN || {}), qa = /* @__PURE__ */ ((t) => (t.VTEX = "VTEX", t.PLATFORM = "platform", t.GLOBAL_PAGE = "globalPage", t.CUSTOMIZATION = "customization", t.FAST_STORE = "faststore", t.UNKNOWN = "unknown", t))(qa || {}); function a$(t) { return Symbol(t); } function u$(t) { return Symbol(t); } function l$(t) { return { key: t, isOptional: !0 }; } function c$(t, e) { return Object.entries(e).reduce((n, [r, i]) => (n[r] = t.token(i), n), {}); } var Dv = /* @__PURE__ */ new WeakMap(), sN = /* @__PURE__ */ new Map(), d$ = /* @__PURE__ */ new Map(), Za; (function(t) { t[t.Constant = 0] = "Constant", t[t.Instance = 1] = "Instance", t[t.Factory = 2] = "Factory"; })(Za || (Za = {})); var $o; (function(t) { t[t.Container = 0] = "Container", t[t.Resolution = 1] = "Resolution", t[t.Singleton = 2] = "Singleton", t[t.Transient = 3] = "Transient"; })($o || ($o = {})); var f$ = class { constructor(t) { this.impl = t, this.type = Za.Constant; } }, h$ = class { constructor(t) { this.impl = t, this.type = Za.Factory; } }, p$ = (t) => t.type === Za.Factory, Bp = class { constructor(t) { this.impl = t, this.type = Za.Instance; } }, m$ = class extends Bp { constructor() { super(...arguments), this.scope = $o.Container, this.cache = /* @__PURE__ */ new WeakMap(); } }, g$ = class extends Bp { constructor() { super(...arguments), this.scope = $o.Resolution; } }, v$ = class extends Bp { constructor(t) { super(t), this.impl = t, this.scope = $o.Singleton; } }, y$ = class extends Bp { constructor() { super(...arguments), this.scope = $o.Transient; } }, w$ = (t) => t.type === Za.Instance, S$ = (t) => t.scope === $o.Container, _$ = (t) => t.scope === $o.Resolution, b$ = (t) => t.scope === $o.Singleton, aN = (t) => Symbol(t), k$ = (t) => { const e = Symbol(t); return { __t: null, __d: t, __s: e, __o: !1, optional: { __t: null, __d: t, __s: e, __o: !0 } }; }, Qc = class { constructor() { this.parent = null, this.map = /* @__PURE__ */ new Map(); } set(t, e, n = Qc.notag) { const r = this.map.get(e.__s); r ? r.set(n, t) : this.map.set(e.__s, (/* @__PURE__ */ new Map()).set(n, t)); } find(t, e, n) { const r = this.map.get(t.__s); if (r !== void 0) { if (n) { const i = r.get(n); if (i) return i; } if (e) for (let i = 0, o = e.length; i < o; i += 1) { const u = r.get(e[i]); if (u) return u; } return r.get(Qc.notag); } } resolve(t, e, n, r) { const i = this.find(t, n, r); return i === void 0 ? this.parent ? this.parent.resolve(t, e, n, r) : null : i instanceof Qc ? (e.vaults.push(i), i.resolve(t, e, n, r)) : i; } get(t, e, n, r) { const i = this.resolve(t, e, n, r); if (i) return i; for (let o = 0, u = e.vaults, l = u.length; o < l; o += 1) { const f = u[o].resolve(t, e, n, r); if (f) return f; } return null; } from(t) { const e = new Qc(); return e.parent = this.parent, this.map.forEach((n, r) => { e.map.set(r, t(n)); }), e; } clone() { return this.from((t) => new Map(t)); } }, uN = Qc; uN.notag = aN("NO_TAG"); var E$ = class { constructor(t, e, n, r) { this.vault = t, this.tokens = e, this.getVault = n, this.condition = r; } from(t) { const { tokens: e } = this; for (let n = 0, r = e.length; n < r; n += 1) this.vault.set(this.getVault(t), e[n], this.condition); } }, A$ = class { constructor(t, e, n, r) { this.vault = t, this.impl = e, this.token = n, this.condition = r; } inContainerScope() { this.set(m$); } inResolutionScope() { this.set(g$); } inSingletonScope() { this.set(v$); } inTransientScope() { this.set(y$); } set(t) { this.vault.set(new t(this.impl), this.token, this.condition); } }, C$ = class { constructor(t, e, n) { this.vault = t, this.token = e, this.condition = n; } toConstant(t) { this.vault.set(new f$(t), this.token, this.condition); } toFactory(t, e) { this.vault.set(new h$({ creator: t, initializer: e }), this.token, this.condition); } toInstance(t) { return new A$(this.vault, t, this.token, this.condition); } }, Ky = class { constructor(t, e) { this.vault = t, this.condition = e; } static vault(t) { return t.vault; } bind(t) { return new C$(this.vault, t, this.condition); } use(...t) { return new E$(this.vault, t, Ky.vault, this.condition); } }, x$ = class extends Ky { when(t) { return new Ky(this.vault, t); } }, N$ = class extends x$ { constructor() { super(new uN()); } }, lN = class { constructor(t = /* @__PURE__ */ new Map(), e = []) { this.instances = t, this.vaults = e; } split() { return new lN(this.instances, this.vaults.slice()); } }, Ih = class extends N$ { constructor() { super(), this.snapshot = null; } extend(t) { return this.vault.parent = t === null ? null : t.vault, this; } clone() { const t = new Ih(); return t.vault = this.vault.clone(), t; } get(t, e) { return this.resolveToken(t, e); } resolveTokens(t, e, n, r) { return t.map((i) => this.resolveToken(i, n, r, e.split())); } resolveToken(t, e, n, r = new lN()) { const i = this.vault.get(t, r, e, n); if (i) return this.resolveBinding(i, r); if (!t.__o) throw new Error(`No matching bindings found for '${t.__d}' token.`); } resolveBinding(t, e) { return w$(t) ? b$(t) ? this.resolveCache(t, e, () => t.cache, (n) => { t.cache = n; }) : S$(t) ? this.resolveCache(t, e, () => t.cache.get(this.vault), (n) => { t.cache.set(this.vault, n); }) : _$(t) ? this.resolveCache(t, e, () => e.instances.get(t), (n) => { e.instances.set(t, n); }) : this.createInstance(t.impl, e) : p$(t) ? (...n) => { const r = this.createInstance(t.impl.creator, e); return r instanceof Promise ? r.then((i) => Ih.resolveInitialization(i, n, t.impl.initializer)) : Ih.resolveInitialization(r, n, t.impl.initializer); } : t.impl; } resolveCache(t, e, n, r) { const i = n(); if (i !== void 0) return i; const o = this.createInstance(t.impl, e); return r(o), o; } createInstance(t, e) { const n = this.getParameters(t, e), r = Dv.get(t); if (r !== void 0) return r ? t(...n) : new t(...n); try { const i = t(...n); return Dv.set(t, !0), i; } catch { const o = new t(...n); return Dv.set(t, !1), o; } } getParameters(t, e) { const n = sN.get(t); if (n) return this.resolveTokens(n, e, d$.get(t), t); if (t.length === 0) return []; throw new Error(`Missing required 'injected' registration of '${t.name}'`); } static resolveInitialization(t, e, n) { const r = n?.(t, ...e); return r instanceof Promise ? r.then(() => t) : t; } }, KE = (t, ...e) => (sN.set(t, e), t); function j0(t) { return typeof t == "object" && t !== null && t.isOptional === !0; } function cN(t) { return "useClass" in t; } function dN(t) { return "useValue" in t; } function fN(t) { return "useFactory" in t; } var Ba = /* @__PURE__ */ ((t) => (t.Singleton = "singleton", t.Transient = "transient", t.Container = "container", t.Resolution = "resolution", t))(Ba || {}); function Xu(t, e) { return t.has(e) || t.set(e, k$(e.description ?? "unknown_key")), t.get(e); } function $0(t, e) { return t.has(e) || t.set(e, aN(e.description ?? "unknown_tag")), t.get(e); } function hN(t, e) { return typeof e == "symbol" ? $0(t, e) : e; } function Gy(t, e, n) { return e.map((r) => { const i = j0(r), o = i ? r.key : r, u = t.get(o); if (!u) throw new Error( `DI Error: Dependency key "${String( o.description )}" required by "${String(n.description)}" not found.` ); return i ? u.optional : u; }); } function pN(t, e) { switch (e) { case Ba.Singleton: t.inSingletonScope(); break; case Ba.Container: t.inContainerScope(); break; case Ba.Resolution: t.inResolutionScope(); break; case Ba.Transient: default: t.inTransientScope(); break; } } class V0 { /** * Creates and initializes a new DependencyInjector with the given providers. * This is the recommended way to create a new injector instance. * * @param providers - Array of providers to register with the injector * @returns A new configured DependencyInjector instance * @throws Error if provider configuration is invalid */ static create(e) { const n = new V0(); return n.initializeTokensAndTags(e), n.bindProviders(e), n; } /** * Brandi container instance used for dependency resolution. * This is exposed to allow direct access to Brandi's features if needed. */ container; /** * Internal mapping of dependency keys to Brandi tokens. * Used for type-safe token resolution. */ keyToTokenMap = /* @__PURE__ */ new Map(); /** * Internal mapping of custom tags to Brandi tags. * Used for conditional binding resolution. */ tagToBrandiTagMap = /* @__PURE__ */ new Map(); /** * Private constructor to enforce creation through static create method. * Initializes the Brandi container. */ constructor() { this.container = new Ih(); } /** * Retrieves a registered token from a dependency key. * This method provides type-safe access to registered tokens. * * @template T - The type of the dependency * @param k - The dependency key to resolve * @returns The corresponding Brandi Token instance * @throws Error if the token is not found */ token(e) { const n = this.keyToTokenMap.get(e); if (!n) throw new Error( `DI Error: Token for key "${String(e.description)}" not found.` ); return n; } /** * Ensures all tokens and tags used in the providers are initialized. * This method is called during injector creation to validate and prepare * all dependencies before binding. * * @param providers - Array of providers to initialize * @throws Error if any dependency is invalid or missing */ initializeTokensAndTags(e) { e.forEach((n) => { Xu(this.keyToTokenMap, n.key), n.when && typeof n.when == "symbol" && $0(this.tagToBrandiTagMap, n.when), "deps" in n && n.deps && n.deps.forEach((r) => { const i = j0(r) ? r.key : r; Xu(this.keyToTokenMap, i); }); }); } /** * Binds all providers to the internal container. * This method handles the actual registration of providers with Brandi, * including conditional binding and scope configuration. * * @param providers - Array of providers to bind */ bindProviders(e) { e.forEach((n) => { const r = n.when ? hN(this.tagToBrandiTagMap, n.when) : void 0, i = r ? this.container.when(r) : this.container; cN(n) ? this.bindClassProvider(i, n) : dN(n) ? this.bindValueProvider(i, n) : fN(n) && this.bindFactoryProvider(i, n); }); } /** * Binds a class provider with scope and dependencies. * Handles the registration of class-based services with optional * dependency injection and scope configuration. * * @param binder - The Brandi container binding context * @param config - The class provider configuration */ bindClassProvider(e, n) { const { key: r, useClass: i, deps: o = [], scope: u = Ba.Transient } = n, l = Xu(this.keyToTokenMap, r), f = Gy( this.keyToTokenMap, o, r ); f.length > 0 && KE(i, ...f); const d = e.bind(l).toInstance(i); pN(d, u); } /** * Binds a value provider. * Registers a constant value with the dependency injection system. * * @param binder - The Brandi container binding context * @param config - The value provider configuration */ bindValueProvider(e, n) { const r = Xu(this.keyToTokenMap, n.key); e.bind(r).toConstant(n.useValue); } /** * Binds a factory provider. * Registers a factory function that can create instances on demand, * with support for dependency injection and initialization. * * @param binder - The Brandi container binding context * @param config - The factory provider configuration */ bindFactoryProvider(e, n) { const { key: r, useFactory: i, deps: o = [], initializer: u } = n, l = Xu(this.keyToTokenMap, r); if (typeof i == "function" && i.prototype?.constructor === i && o.length > 0) { const f = Gy( this.keyToTokenMap, o, r ); f.length > 0 && KE(i, ...f); } e.bind(l).toFactory(i, u); } } function mN(t) { const e = Object.values(t); return Object.assign({}, ...e); } function gN(t) { return Object.entries(t).reduce( (e, [n, r]) => { const i = mN(r); return { ...e, [n]: i }; }, {} ); } function vN(t, e) { const n = gN(e); Object.entries(n).forEach(([r, i]) => { t.addResourceBundle(r, "translation", i, !0); }); } var yN = /* @__PURE__ */ ((t) => (t.English = "en", t.Spanish = "es", t.Portuguese = "pt", t))(yN || {}); const { slice: T$, forEach: I$ } = []; function R$(t) { return I$.call(T$.call(arguments, 1), (e) => { if (e) for (const n in e) t[n] === void 0 && (t[n] = e[n]); }), t; } const GE = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, O$ = (t, e, n) => { const r = n || {}; r.path = r.path || "/"; const i = encodeURIComponent(e); let o = `${t}=${i}`; if (r.maxAge > 0) { const u = r.maxAge - 0; if (Number.isNaN(u)) throw new Error("maxAge should be a Number"); o += `; Max-Age=${Math.floor(u)}`; } if (r.domain) { if (!GE.test(r.domain)) throw new TypeError("option domain is invalid"); o += `; Domain=${r.domain}`; } if (r.path) { if (!GE.test(r.path)) throw new TypeError("option path is invalid"); o += `; Path=${r.path}`; } if (r.expires) { if (typeof r.expires.toUTCString != "function") throw new TypeError("option expires is invalid"); o += `; Expires=${r.expires.toUTCString()}`; } if (r.httpOnly && (o += "; HttpOnly"), r.secure && (o += "; Secure"), r.sameSite) switch (typeof r.sameSite == "string" ? r.sameSite.toLowerCase() : r.sameSite) { case !0: o += "; SameSite=Strict"; break; case "lax": o += "; SameSite=Lax"; break; case "strict": o += "; SameSite=Strict"; break; case "none": o += "; SameSite=None"; break; default: throw new TypeError("option sameSite is invalid"); } return o; }, WE = { create(t, e, n, r) { let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : { path: "/", sameSite: "strict" }; n && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + n * 60 * 1e3)), r && (i.domain = r), document.cookie = O$(t, encodeURIComponent(e), i); }, read(t) { const e = `${t}=`, n = document.cookie.split(";"); for (let r = 0; r < n.length; r++) { let i = n[r]; for (; i.charAt(0) === " "; ) i = i.substring(1, i.length); if (i.indexOf(e) === 0) return i.substring(e.length, i.length); } return null; }, remove(t) { this.create(t, "", -1); } }; var P$ = { name: "cookie", // Deconstruct the options object and extract the lookupCookie property lookup(t) { let { lookupCookie: e } = t; if (e && typeof document < "u") return WE.read(e) || void 0; }, // Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties cacheUserLanguage(t, e) { let { lookupCookie: n, cookieMinutes: r, cookieDomain: i, cookieOptions: o } = e; n && typeof document < "u" && WE.create(n, t, r, i, o); } }, D$ = { name: "querystring", // Deconstruct the options object and extract the lookupQuerystring property lookup(t) { let { lookupQuerystring: e } = t, n; if (typeof window < "u") { let { search: r } = window.location; !window.location.search && window.location.hash?.indexOf("?") > -1 && (r = window.location.hash.substring(window.location.hash.indexOf("?"))); const o = r.substring(1).split("&"); for (let u = 0; u < o.length; u++) { const l = o[u].indexOf("="); l > 0 && o[u].substring(0, l) === e && (n = o[u].substring(l + 1)); } } return n; } }; let Vc = null; const YE = () => { if (Vc !== null) return Vc; try { Vc = window !== "undefined" && window.localStorage !== null; const t = "i18next.translate.boo"; window.localStorage.setItem(t, "foo"), window.localStorage.removeItem(t); } catch { Vc = !1; } return Vc; }; var F$ = { name: "localStorage", // Deconstruct the options object and extract the lookupLocalStorage property lookup(t) { let { lookupLocalStorage: e } = t; if (e && YE()) return window.localStorage.getItem(e) || void 0; }, // Deconstruct the options object and extract the lookupLocalStorage property cacheUserLanguage(t, e) { let { lookupLocalStorage: n } = e; n && YE() && window.localStorage.setItem(n, t); } }; let zc = null; const QE = () => { if (zc !== null) return zc; try { zc = window !== "undefined" && window.sessionStorage !== null; const t = "i18next.translate.boo"; window.sessionStorage.setItem(t, "foo"), window.sessionStorage.removeItem(t); } catch { zc = !1; } return zc; }; var L$ = { name: "sessionStorage", lookup(t) { let { lookupSessionStorage: e } = t; if (e && QE()) return window.sessionStorage.getItem(e) || void 0; }, cacheUserLanguage(t, e) { let { lookupSessionStorage: n } = e; n && QE() && window.sessionStorage.setItem(n, t); } }, U$ = { name: "navigator", lookup(t) { const e = []; if (typeof navigator < "u") { const { languages: n, userLanguage: r, language: i } = navigator; if (n) for (let o = 0; o < n.length; o++) e.push(n[o]); r && e.push(r), i && e.push(i); } return e.length > 0 ? e : void 0; } }, M$ = { name: "htmlTag", // Deconstruct the options object and extract the htmlTag property lookup(t) { let { htmlTag: e } = t, n; const r = e || (typeof document < "u" ? document.documentElement : null); return r && typeof r.getAttribute == "function" && (n = r.getAttribute("lang")), n; } }, B$ = { name: "path", // Deconstruct the options object and extract the lookupFromPathIndex property lookup(t) { let { lookupFromPathIndex: e } = t; if (typeof window > "u") return; const n = window.location.pathname.match(/\/([a-zA-Z-]*)/g); return Array.isArray(n) ? n[typeof e == "number" ? e : 0]?.replace("/", "") : void 0; } }, j$ = { name: "subdomain", lookup(t) { let { lookupFromSubdomainIndex: e } = t; const n = typeof e == "number" ? e + 1 : 1, r = typeof window < "u" && window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i); if (r) return r[n]; } }; function $$() { return { order: ["querystring", "cookie", "localStorage", "sessionStorage", "navigator", "htmlTag"], lookupQuerystring: "lng", lookupCookie: "i18next", lookupLocalStorage: "i18nextLng", lookupSessionStorage: "i18nextLng", // cache user language caches: ["localStorage"], excludeCacheFor: ["cimode"], // cookieMinutes: 10, // cookieDomain: 'myDomain' convertDetectedLanguage: (t) => t }; } class wN { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.type = "languageDetector", this.detectors = {}, this.init(e, n); } init(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; this.services = e || { languageUtils: {} }, this.options = R$(n, this.options || {}, $$()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (i) => i.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = r, this.addDetector(P$), this.addDetector(D$), this.addDetector(F$), this.addDetector(L$), this.addDetector(U$), this.addDetector(M$), this.addDetector(B$), this.addDetector(j$); } addDetector(e) { return this.detectors[e.name] = e, this; } detect(e) { e || (e = this.options.order); let n = []; return e.forEach((r) => { if (this.detectors[r]) { let i = this.detectors[r].lookup(this.options); i && typeof i == "string" && (i = [i]), i && (n = n.concat(i)); } }), n = n.map((r) => this.options.convertDetectedLanguage(r)), this.services.languageUtils.getBestMatchFromCodes ? n : n.length > 0 ? n[0] : null; } cacheUserLanguage(e, n) { n || (n = this.options.caches), n && (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(e) > -1 || n.forEach((r) => { this.detectors[r] && this.detectors[r].cacheUserLanguage(e, this.options); })); } } wN.type = "languageDetector"; function SN(t, e) { t.use(e).use(wN).init({ resources: {}, fallbackLng: "en", debug: !1, interpolation: { escapeValue: !1, // not needed for react as it escapes by default format: (n, r, i) => { if (r) { const [o, ...u] = r.split(",").map((l) => l.trim()); if (o === "number") return new Intl.NumberFormat(i).format(n); if (o === "date") return new Intl.DateTimeFormat(i).format(n); if (o === "currency") return new Intl.NumberFormat(i, { style: "currency", currency: u[0] || "USD", currencyDisplay: "narrowSymbol" }).format(n).replace("$", "").trim(); } return n; } }, detection: { // order and from where user language should be detected order: [ "navigator", "cookie", "localStorage", "sessionStorage", "querystring", "htmlTag", "path", "subdomain" ] } }); } const V$ = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, z$ = { "&": "&", "&": "&", "<": "<", "<": "<", ">": ">", ">": ">", "'": "'", "'": "'", """: '"', """: '"', " ": " ", " ": " ", "©": "©", "©": "©", "®": "®", "®": "®", "…": "…", "…": "…", "/": "/", "/": "/" }, q$ = (t) => z$[t], H$ = (t) => t.replace(V$, q$); let JE = { bindI18n: "languageChanged", bindI18nStore: "", transEmptyNodeValue: "", transSupportBasicHtmlNodes: !0, transWrapTextNodes: "", transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"], useSuspense: !0, unescape: H$ }; function K$() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; JE = { ...JE, ...t }; } const G$ = { type: "3rdParty", init(t) { K$(t.options.react); } }; SN(Gn, G$); const W$ = (t) => vN(Gn, t), XE = { startTime: "UNKNOWN", viewerCount: 0, status: "UNKNOWN" }, Y$ = () => { const [t, e] = gt.useState([]), [n, r] = gt.useState(XE); return { realTimeStreamInfo: n, productsInCart: t, onTextMetadataCue: (u) => { const { action: l, data: f, startTime: d, viewerCount: p, status: v } = JSON.parse( u?.text ); switch (l) { case "sendivsdatarealtime": { r({ startTime: d, viewerCount: p, status: v }); break; } case "sendaddtocart": { const { id: y, sessionId: k, productId: A, productImageUrl: E, productName: T } = f; e((D) => [ ...D, { id: y, sessionId: k, productId: A, productImageUrl: E, productName: T } ]); } break; } }, resetRealTimeStreamInfo: () => { r(XE); }, setProductsInCart: e }; }; class _N extends Ri { constructor() { super( "EVENT_CHAT_ROOM_TOKEN_ERROR", "Error getting chat room connection token" ); } } class jp { root = Up(this); token; constructor(e) { this.root.setProps(e); } static toDomain(e) { const n = { token: e.token }; return new jp(n); } toPrimitives() { const { root: e, ...n } = this; return { ...n }; } } class bN { async getChatRoom(e) { const { getChatRoomToken: n } = await bn.graphql( Xx, { data: { account: e.account, idEvent: e.eventId, userName: e.userName } } ); this.propagateGraphqlErrorIfExists( n ); const r = n.data?.token; if (!r) throw new _N(); return jp.toDomain({ token: r }); } propagateGraphqlErrorIfExists(e) { if (e.__typename === "ErrorGeneral") throw new Error(e.message); } } class kN { constructor(e) { this.eventChatRoomRepository = e; } account; async get(e) { this.validateAccount(); try { return await this.eventChatRoomRepository.getChatRoom({ ...e, account: this.account }); } catch (n) { throw new xs(n); } } setAccount(e) { this.account = e; } validateAccount() { if (!this.account) throw new s0(); } } const Q$ = new bN(), Wy = new kN( Q$ ), $p = Io(void 0); $p.debugLabel = "chatSocketAtom"; const Vp = Io(!1); Vp.debugLabel = "chatIsConnectedAtom"; const Id = Io([]); Id.debugLabel = "chatMessageListAtom"; const EN = (t) => { t.data = t.data.replace("replace_gif", t.urlGif ?? ""); const e = t.data.indexOf("::question__") > -1; if (e) { const [n, r] = t.data.split("::question__") || ["none", "none"]; let i = null; try { i = JSON.parse(r); } catch { console.error("addQuestionData failed to parse question JSON:", r); } const o = { response: n.replace("response__", ""), question: i }; return { ...t, data: o.response, isResponse: e, responseData: t.data, question: e ? o.question : null }; } return t; }, AN = (t) => { const { url: e, token: n, onOpen: r, onClose: i, onMessage: o, onError: u } = t, l = new WebSocket(e, n); return l.onopen = (f) => r(f), l.onclose = (f) => i(f), l.onerror = (f) => u(f), l.onmessage = (f) => o(f), l; }, CN = () => { const t = "0123456789ABCDEF"; let e = "#"; for (let n = 0; n < 6; n += 1) e += t[Math.floor(Math.random() * 16)]; return e; }, ip = (t, e) => { const { Content: n, Attributes: r, Sender: { Attributes: i } } = e, { username: o, type: u, email: l } = r, { isAdmin: f } = i, d = r?.id ?? Us(8), p = t.find((y) => y.username === o)?.color || CN(), v = { id: d, type: u, color: p, username: o, email: l, data: n, sendDate: r.sendDate, isAdmin: f === "true", responseAdmin: !1, question: null, account: r.account, idEvent: r.idEvent, urlGif: r.urlGif, ip: r.ip }; return EN(v); }, xN = (t) => { const { eventId: e, userName: n, enabled: r = !0 } = t, { accountName: i } = Bx(), [o, u] = gt.useState(""), l = () => { r && i && (Wy.setAccount(i), Wy.get({ eventId: e, userName: n }).then((f) => { u(f.token); })); }; return gt.useEffect(() => { l(); }, [i, r]), { getQuery: { refetch: l }, token: o }; }, { coreLogger: J$ } = Kn(), br = J$.child("useConnectChatSocket"), X$ = Qa.publicUrls.wssIVSChat, Z$ = 10, e6 = (t) => Math.min(1e4, 1e3 * Math.pow(2, t)), t6 = (t, e, n) => { const r = JSON.parse(t.data); switch (r.Type) { case "EVENT": e?.(r); break; case "MESSAGE": n?.(r); break; case "ERROR": br.error("Chat room error:", r); break; default: br.error("Unknown chat room event:", t); } }, NN = (t) => { const { onMessage: e, eventId: n, enabled: r = !0, userName: i, onEvent: o } = t, { token: u, getQuery: l } = xN({ eventId: n, userName: i, enabled: r }), [f, d] = gg($p), [p, v] = gg(Vp), [y, k] = gg(Id), A = gt.useRef(0), E = gt.useCallback( (j) => br.error("Chat room socket error:", j), [] ), T = gt.useCallback(() => { v(!0), A.current = 0, br.debug("Successfully connected to the chat room"); }, [v]), D = gt.useCallback(() => { if (A.current >= Z$) { br.error( "Max reconnection attempts reached. No further attempts will be made." ); return; } v(!1), A.current += 1; const j = e6(A.current); br.debug( `Disconnected from chat room. Reconnecting in ${j / 1e3} seconds... (Attempt ${A.current})` ), setTimeout(() => l.refetch(), j); }, [l, v]), R = gt.useCallback(() => { if (!u) { br.debug("No token available. Connection aborted."); return; } if (f?.readyState === WebSocket.OPEN) { br.debug("WebSocket is already open. No need to reconnect."); return; } br.debug("Connecting to the chat room..."); const j = AN({ token: u, url: X$, onOpen: T, onClose: D, onError: E, onMessage: (K) => t6(K, o, e) }); d(j); }, [ u, f, o, e, T, D, E, d ]), L = gt.useCallback(() => { if (!f || f.readyState !== WebSocket.OPEN) { br.debug("No open socket to close."); return; } br.debug("Closing chat room socket..."), f.close(); }, [f]); return gt.useEffect(() => { if (!r) { br.debug("Chat is disabled, skipping connection."); return; } if (!u) { br.debug("Token not available, skipping connection."); return; } return br.debug("Initializing connection with token:", u), L(), R(), L; }, [u, r]), { socket: f, chatIsConnected: p, chatMessageList: y, setChatMessageList: k }; }, n6 = () => { const t = Ph($p), e = Ph(Vp); return { sendMessage: gt.useCallback( (r, i) => { if (!t || !e) return; const o = { id: i.id, sendDate: /* @__PURE__ */ new Date(), content: r, action: "SEND_MESSAGE", attributes: i }, u = JSON.stringify(o); t.send(u); }, [e, t] ) }; }, TN = () => { const t = t0(Id); return { handleEvent: (r) => { if (r.EventName === "senddeletemessage") { const i = JSON.parse(r.Attributes?.data); t((o) => o.filter((u) => u.id !== i.id)); } else if (r.EventName === "sendadminmessage") { const i = JSON.parse(r.Attributes?.data); t((o) => [ ...o, ip(o, { Content: i.data, Attributes: { username: i.username, type: i.type, email: i.email, isAdmin: "true", sendDate: i.sendDate, id: i.id }, Sender: { Attributes: { username: i.username, type: i.type, email: i.email, isAdmin: "true" } } }) ]); } }, handleMessage: (r) => { t((i) => [...i, ip(i, r)]); } }; }, r6 = (t) => { const { eventId: e, userName: n } = t, [r, i] = gt.useState(!1), [o, u] = gt.useState(), [l, f] = gt.useState(), [d, p] = gt.useState([]), { handleEvent: v } = TN(), y = t0(Id), k = (R) => { y((L) => [ip(L, R), ...L]), i(!1); }, A = (R) => { if (v(R), R.EventName === "sendpinmessage") { const L = JSON.parse(R.Attributes?.data); u({ data: L.data, id: L.id, username: L.username }); } if (R.EventName === "sendunpinmessage" && u(void 0), R.EventName === "sendhighlightproduct") { const L = JSON.parse(R.Attributes?.data); f({ products: L.productIds, collection: L.collection, livestreamingId: L.idEvent }); } if (R.EventName === "sendaddtocart") { const L = JSON.parse(R.Attributes?.data); p((j) => [ ...j, { id: L.id, sessionId: L.sessionId, productId: L.productId, productImageUrl: L.productImageUrl, productName: L.productName } ]); } }, { socket: E, chatMessageList: T, setChatMessageList: D } = NN({ onMessage: k, onEvent: A, eventId: e, userName: n }); return { socket: E, chat: T, showLoader: r, pinnedMessage: o, highlightProduct: l, productsInCart: d, setChat: D, setShowLoader: i, setPinnedMessage: u, setProductsInCart: p }; }; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const Rh = globalThis, z0 = Rh.ShadowRoot && (Rh.ShadyCSS === void 0 || Rh.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, q0 = Symbol(), ZE = /* @__PURE__ */ new WeakMap(); let IN = class { constructor(e, n, r) { if (this._$cssResult$ = !0, r !== q0) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); this.cssText = e, this.t = n; } get styleSheet() { let e = this.o; const n = this.t; if (z0 && e === void 0) { const r = n !== void 0 && n.length === 1; r && (e = ZE.get(n)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), r && ZE.set(n, e)); } return e; } toString() { return this.cssText; } }; const i6 = (t) => new IN(typeof t == "string" ? t : t + "", void 0, q0), o6 = (t, ...e) => { const n = t.length === 1 ? t[0] : e.reduce((r, i, o) => r + ((u) => { if (u._$cssResult$ === !0) return u.cssText; if (typeof u == "number") return u; throw Error("Value passed to 'css' function must be a 'css' function result: " + u + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); })(i) + t[o + 1], t[0]); return new IN(n, t, q0); }, s6 = (t, e) => { if (z0) t.adoptedStyleSheets = e.map((n) => n instanceof CSSStyleSheet ? n : n.styleSheet); else for (const n of e) { const r = document.createElement("style"), i = Rh.litNonce; i !== void 0 && r.setAttribute("nonce", i), r.textContent = n.cssText, t.appendChild(r); } }, e1 = z0 ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => { let n = ""; for (const r of e.cssRules) n += r.cssText; return i6(n); })(t) : t; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const { is: a6, defineProperty: u6, getOwnPropertyDescriptor: l6, getOwnPropertyNames: c6, getOwnPropertySymbols: d6, getPrototypeOf: f6 } = Object, zp = globalThis, t1 = zp.trustedTypes, h6 = t1 ? t1.emptyScript : "", p6 = zp.reactiveElementPolyfillSupport, rd = (t, e) => t, Yy = { toAttribute(t, e) { switch (e) { case Boolean: t = t ? h6 : null; break; case Object: case Array: t = t == null ? t : JSON.stringify(t); } return t; }, fromAttribute(t, e) { let n = t; switch (e) { case Boolean: n = t !== null; break; case Number: n = t === null ? null : Number(t); break; case Object: case Array: try { n = JSON.parse(t); } catch { n = null; } } return n; } }, RN = (t, e) => !a6(t, e), n1 = { attribute: !0, type: String, converter: Yy, reflect: !1, hasChanged: RN }; Symbol.metadata ??= Symbol("metadata"), zp.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); class Zu extends HTMLElement { static addInitializer(e) { this._$Ei(), (this.l ??= []).push(e); } static get observedAttributes() { return this.finalize(), this._$Eh && [...this._$Eh.keys()]; } static createProperty(e, n = n1) { if (n.state && (n.attribute = !1), this._$Ei(), this.elementProperties.set(e, n), !n.noAccessor) { const r = Symbol(), i = this.getPropertyDescriptor(e, r, n); i !== void 0 && u6(this.prototype, e, i); } } static getPropertyDescriptor(e, n, r) { const { get: i, set: o } = l6(this.prototype, e) ?? { get() { return this[n]; }, set(u) { this[n] = u; } }; return { get() { return i?.call(this); }, set(u) { const l = i?.call(this); o.call(this, u), this.requestUpdate(e, l, r); }, configurable: !0, enumerable: !0 }; } static getPropertyOptions(e) { return this.elementProperties.get(e) ?? n1; } static _$Ei() { if (this.hasOwnProperty(rd("elementProperties"))) return; const e = f6(this); e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties); } static finalize() { if (this.hasOwnProperty(rd("finalized"))) return; if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(rd("properties"))) { const n = this.properties, r = [...c6(n), ...d6(n)]; for (const i of r) this.createProperty(i, n[i]); } const e = this[Symbol.metadata]; if (e !== null) { const n = litPropertyMetadata.get(e); if (n !== void 0) for (const [r, i] of n) this.elementProperties.set(r, i); } this._$Eh = /* @__PURE__ */ new Map(); for (const [n, r] of this.elementProperties) { const i = this._$Eu(n, r); i !== void 0 && this._$Eh.set(i, n); } this.elementStyles = this.finalizeStyles(this.styles); } static finalizeStyles(e) { const n = []; if (Array.isArray(e)) { const r = new Set(e.flat(1 / 0).reverse()); for (const i of r) n.unshift(e1(i)); } else e !== void 0 && n.push(e1(e)); return n; } static _$Eu(e, n) { const r = n.attribute; return r === !1 ? void 0 : typeof r == "string" ? r : typeof e == "string" ? e.toLowerCase() : void 0; } constructor() { super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev(); } _$Ev() { this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this)); } addController(e) { (this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.(); } removeController(e) { this._$EO?.delete(e); } _$E_() { const e = /* @__PURE__ */ new Map(), n = this.constructor.elementProperties; for (const r of n.keys()) this.hasOwnProperty(r) && (e.set(r, this[r]), delete this[r]); e.size > 0 && (this._$Ep = e); } createRenderRoot() { const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); return s6(e, this.constructor.elementStyles), e; } connectedCallback() { this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.()); } enableUpdating(e) { } disconnectedCallback() { this._$EO?.forEach((e) => e.hostDisconnected?.()); } attributeChangedCallback(e, n, r) { this._$AK(e, r); } _$EC(e, n) { const r = this.constructor.elementProperties.get(e), i = this.constructor._$Eu(e, r); if (i !== void 0 && r.reflect === !0) { const o = (r.converter?.toAttribute !== void 0 ? r.converter : Yy).toAttribute(n, r.type); this._$Em = e, o == null ? this.removeAttribute(i) : this.setAttribute(i, o), this._$Em = null; } } _$AK(e, n) { const r = this.constructor, i = r._$Eh.get(e); if (i !== void 0 && this._$Em !== i) { const o = r.getPropertyOptions(i), u = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : Yy; this._$Em = i, this[i] = u.fromAttribute(n, o.type), this._$Em = null; } } requestUpdate(e, n, r) { if (e !== void 0) { if (r ??= this.constructor.getPropertyOptions(e), !(r.hasChanged ?? RN)(this[e], n)) return; this.P(e, n, r); } this.isUpdatePending === !1 && (this._$ES = this._$ET()); } P(e, n, r) { this._$AL.has(e) || this._$AL.set(e, n), r.reflect === !0 && this._$Em !== e && (this._$Ej ??= /* @__PURE__ */ new Set()).add(e); } async _$ET() { this.isUpdatePending = !0; try { await this._$ES; } catch (n) { Promise.reject(n); } const e = this.scheduleUpdate(); return e != null && await e, !this.isUpdatePending; } scheduleUpdate() { return this.performUpdate(); } performUpdate() { if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { for (const [i, o] of this._$Ep) this[i] = o; this._$Ep = void 0; } const r = this.constructor.elementProperties; if (r.size > 0) for (const [i, o] of r) o.wrapped !== !0 || this._$AL.has(i) || this[i] === void 0 || this.P(i, this[i], o); } let e = !1; const n = this._$AL; try { e = this.shouldUpdate(n), e ? (this.willUpdate(n), this._$EO?.forEach((r) => r.hostUpdate?.()), this.update(n)) : this._$EU(); } catch (r) { throw e = !1, this._$EU(), r; } e && this._$AE(n); } willUpdate(e) { } _$AE(e) { this._$EO?.forEach((n) => n.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e); } _$EU() { this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1; } get updateComplete() { return this.getUpdateComplete(); } getUpdateComplete() { return this._$ES; } shouldUpdate(e) { return !0; } update(e) { this._$Ej &&= this._$Ej.forEach((n) => this._$EC(n, this[n])), this._$EU(); } updated(e) { } firstUpdated(e) { } } Zu.elementStyles = [], Zu.shadowRootOptions = { mode: "open" }, Zu[rd("elementProperties")] = /* @__PURE__ */ new Map(), Zu[rd("finalized")] = /* @__PURE__ */ new Map(), p6?.({ ReactiveElement: Zu }), (zp.reactiveElementVersions ??= []).push("2.0.4"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const H0 = globalThis, op = H0.trustedTypes, r1 = op ? op.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, ON = "$lit$", Ns = `lit$${Math.random().toFixed(9).slice(2)}$`, PN = "?" + Ns, m6 = `<${PN}>`, eu = document, Sd = () => eu.createComment(""), _d = (t) => t === null || typeof t != "object" && typeof t != "function", K0 = Array.isArray, g6 = (t) => K0(t) || typeof t?.[Symbol.iterator] == "function", Fv = `[ \f\r]`, qc = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, i1 = /-->/g, o1 = />/g, Ca = RegExp(`>|${Fv}(?:([^\\s"'>=/]+)(${Fv}*=${Fv}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`, "g"), s1 = /'/g, a1 = /"/g, DN = /^(?:script|style|textarea|title)$/i, v6 = (t) => (e, ...n) => ({ _$litType$: t, strings: e, values: n }), y6 = v6(1), gl = Symbol.for("lit-noChange"), In = Symbol.for("lit-nothing"), u1 = /* @__PURE__ */ new WeakMap(), ja = eu.createTreeWalker(eu, 129); function FN(t, e) { if (!K0(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array"); return r1 !== void 0 ? r1.createHTML(e) : e; } const w6 = (t, e) => { const n = t.length - 1, r = []; let i, o = e === 2 ? "" : e === 3 ? "" : "", u = qc; for (let l = 0; l < n; l++) { const f = t[l]; let d, p, v = -1, y = 0; for (; y < f.length && (u.lastIndex = y, p = u.exec(f), p !== null); ) y = u.lastIndex, u === qc ? p[1] === "!--" ? u = i1 : p[1] !== void 0 ? u = o1 : p[2] !== void 0 ? (DN.test(p[2]) && (i = RegExp("" ? (u = i ?? qc, v = -1) : p[1] === void 0 ? v = -2 : (v = u.lastIndex - p[2].length, d = p[1], u = p[3] === void 0 ? Ca : p[3] === '"' ? a1 : s1) : u === a1 || u === s1 ? u = Ca : u === i1 || u === o1 ? u = qc : (u = Ca, i = void 0); const k = u === Ca && t[l + 1].startsWith("/>") ? " " : ""; o += u === qc ? f + m6 : v >= 0 ? (r.push(d), f.slice(0, v) + ON + f.slice(v) + Ns + k) : f + Ns + (v === -2 ? l : k); } return [FN(t, o + (t[n] || "") + (e === 2 ? "" : e === 3 ? "" : "")), r]; }; class bd { constructor({ strings: e, _$litType$: n }, r) { let i; this.parts = []; let o = 0, u = 0; const l = e.length - 1, f = this.parts, [d, p] = w6(e, n); if (this.el = bd.createElement(d, r), ja.currentNode = this.el.content, n === 2 || n === 3) { const v = this.el.content.firstChild; v.replaceWith(...v.childNodes); } for (; (i = ja.nextNode()) !== null && f.length < l; ) { if (i.nodeType === 1) { if (i.hasAttributes()) for (const v of i.getAttributeNames()) if (v.endsWith(ON)) { const y = p[u++], k = i.getAttribute(v).split(Ns), A = /([.?@])?(.*)/.exec(y); f.push({ type: 1, index: o, name: A[2], strings: k, ctor: A[1] === "." ? _6 : A[1] === "?" ? b6 : A[1] === "@" ? k6 : qp }), i.removeAttribute(v); } else v.startsWith(Ns) && (f.push({ type: 6, index: o }), i.removeAttribute(v)); if (DN.test(i.tagName)) { const v = i.textContent.split(Ns), y = v.length - 1; if (y > 0) { i.textContent = op ? op.emptyScript : ""; for (let k = 0; k < y; k++) i.append(v[k], Sd()), ja.nextNode(), f.push({ type: 2, index: ++o }); i.append(v[y], Sd()); } } } else if (i.nodeType === 8) if (i.data === PN) f.push({ type: 2, index: o }); else { let v = -1; for (; (v = i.data.indexOf(Ns, v + 1)) !== -1; ) f.push({ type: 7, index: o }), v += Ns.length - 1; } o++; } } static createElement(e, n) { const r = eu.createElement("template"); return r.innerHTML = e, r; } } function vl(t, e, n = t, r) { if (e === gl) return e; let i = r !== void 0 ? n.o?.[r] : n.l; const o = _d(e) ? void 0 : e._$litDirective$; return i?.constructor !== o && (i?._$AO?.(!1), o === void 0 ? i = void 0 : (i = new o(t), i._$AT(t, n, r)), r !== void 0 ? (n.o ??= [])[r] = i : n.l = i), i !== void 0 && (e = vl(t, i._$AS(t, e.values), i, r)), e; } class S6 { constructor(e, n) { this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = n; } get parentNode() { return this._$AM.parentNode; } get _$AU() { return this._$AM._$AU; } u(e) { const { el: { content: n }, parts: r } = this._$AD, i = (e?.creationScope ?? eu).importNode(n, !0); ja.currentNode = i; let o = ja.nextNode(), u = 0, l = 0, f = r[0]; for (; f !== void 0; ) { if (u === f.index) { let d; f.type === 2 ? d = new Rd(o, o.nextSibling, this, e) : f.type === 1 ? d = new f.ctor(o, f.name, f.strings, this, e) : f.type === 6 && (d = new E6(o, this, e)), this._$AV.push(d), f = r[++l]; } u !== f?.index && (o = ja.nextNode(), u++); } return ja.currentNode = eu, i; } p(e) { let n = 0; for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(e, r, n), n += r.strings.length - 2) : r._$AI(e[n])), n++; } } class Rd { get _$AU() { return this._$AM?._$AU ?? this.v; } constructor(e, n, r, i) { this.type = 2, this._$AH = In, this._$AN = void 0, this._$AA = e, this._$AB = n, this._$AM = r, this.options = i, this.v = i?.isConnected ?? !0; } get parentNode() { let e = this._$AA.parentNode; const n = this._$AM; return n !== void 0 && e?.nodeType === 11 && (e = n.parentNode), e; } get startNode() { return this._$AA; } get endNode() { return this._$AB; } _$AI(e, n = this) { e = vl(this, e, n), _d(e) ? e === In || e == null || e === "" ? (this._$AH !== In && this._$AR(), this._$AH = In) : e !== this._$AH && e !== gl && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : g6(e) ? this.k(e) : this._(e); } O(e) { return this._$AA.parentNode.insertBefore(e, this._$AB); } T(e) { this._$AH !== e && (this._$AR(), this._$AH = this.O(e)); } _(e) { this._$AH !== In && _d(this._$AH) ? this._$AA.nextSibling.data = e : this.T(eu.createTextNode(e)), this._$AH = e; } $(e) { const { values: n, _$litType$: r } = e, i = typeof r == "number" ? this._$AC(e) : (r.el === void 0 && (r.el = bd.createElement(FN(r.h, r.h[0]), this.options)), r); if (this._$AH?._$AD === i) this._$AH.p(n); else { const o = new S6(i, this), u = o.u(this.options); o.p(n), this.T(u), this._$AH = o; } } _$AC(e) { let n = u1.get(e.strings); return n === void 0 && u1.set(e.strings, n = new bd(e)), n; } k(e) { K0(this._$AH) || (this._$AH = [], this._$AR()); const n = this._$AH; let r, i = 0; for (const o of e) i === n.length ? n.push(r = new Rd(this.O(Sd()), this.O(Sd()), this, this.options)) : r = n[i], r._$AI(o), i++; i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i); } _$AR(e = this._$AA.nextSibling, n) { for (this._$AP?.(!1, !0, n); e && e !== this._$AB; ) { const r = e.nextSibling; e.remove(), e = r; } } setConnected(e) { this._$AM === void 0 && (this.v = e, this._$AP?.(e)); } } class qp { get tagName() { return this.element.tagName; } get _$AU() { return this._$AM._$AU; } constructor(e, n, r, i, o) { this.type = 1, this._$AH = In, this._$AN = void 0, this.element = e, this.name = n, this._$AM = i, this.options = o, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = In; } _$AI(e, n = this, r, i) { const o = this.strings; let u = !1; if (o === void 0) e = vl(this, e, n, 0), u = !_d(e) || e !== this._$AH && e !== gl, u && (this._$AH = e); else { const l = e; let f, d; for (e = o[0], f = 0; f < o.length - 1; f++) d = vl(this, l[r + f], n, f), d === gl && (d = this._$AH[f]), u ||= !_d(d) || d !== this._$AH[f], d === In ? e = In : e !== In && (e += (d ?? "") + o[f + 1]), this._$AH[f] = d; } u && !i && this.j(e); } j(e) { e === In ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? ""); } } class _6 extends qp { constructor() { super(...arguments), this.type = 3; } j(e) { this.element[this.name] = e === In ? void 0 : e; } } class b6 extends qp { constructor() { super(...arguments), this.type = 4; } j(e) { this.element.toggleAttribute(this.name, !!e && e !== In); } } class k6 extends qp { constructor(e, n, r, i, o) { super(e, n, r, i, o), this.type = 5; } _$AI(e, n = this) { if ((e = vl(this, e, n, 0) ?? In) === gl) return; const r = this._$AH, i = e === In && r !== In || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, o = e !== In && (r === In || i); i && this.element.removeEventListener(this.name, this, r), o && this.element.addEventListener(this.name, this, e), this._$AH = e; } handleEvent(e) { typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e); } } class E6 { constructor(e, n, r) { this.element = e, this.type = 6, this._$AN = void 0, this._$AM = n, this.options = r; } get _$AU() { return this._$AM._$AU; } _$AI(e) { vl(this, e); } } const A6 = H0.litHtmlPolyfillSupport; A6?.(bd, Rd), (H0.litHtmlVersions ??= []).push("3.2.0"); const G0 = (t, e, n) => { const r = n?.renderBefore ?? e; let i = r._$litPart$; if (i === void 0) { const o = n?.renderBefore ?? null; r._$litPart$ = i = new Rd(e.insertBefore(Sd(), o), o, void 0, n ?? {}); } return i._$AI(t), i; }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class id extends Zu { constructor() { super(...arguments), this.renderOptions = { host: this }, this.o = void 0; } createRenderRoot() { const e = super.createRenderRoot(); return this.renderOptions.renderBefore ??= e.firstChild, e; } update(e) { const n = this.render(); this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this.o = G0(n, this.renderRoot, this.renderOptions); } connectedCallback() { super.connectedCallback(), this.o?.setConnected(!0); } disconnectedCallback() { super.disconnectedCallback(), this.o?.setConnected(!1); } render() { return gl; } } id._$litElement$ = !0, id.finalized = !0, globalThis.litElementHydrateSupport?.({ LitElement: id }); const C6 = globalThis.litElementPolyfillSupport; C6?.({ LitElement: id }); (globalThis.litElementVersions ??= []).push("4.1.0"); /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const x6 = (t) => t.strings === void 0; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const N6 = { CHILD: 2 }, T6 = (t) => (...e) => ({ _$litDirective$: t, values: e }); class I6 { constructor(e) { } get _$AU() { return this._$AM._$AU; } _$AT(e, n, r) { this.t = e, this._$AM = n, this.i = r; } _$AS(e, n) { return this.update(e, n); } update(e, n) { return this.render(...n); } } /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const od = (t, e) => { const n = t._$AN; if (n === void 0) return !1; for (const r of n) r._$AO?.(e, !1), od(r, e); return !0; }, sp = (t) => { let e, n; do { if ((e = t._$AM) === void 0) break; n = e._$AN, n.delete(t), t = e; } while (n?.size === 0); }, LN = (t) => { for (let e; e = t._$AM; t = e) { let n = e._$AN; if (n === void 0) e._$AN = n = /* @__PURE__ */ new Set(); else if (n.has(t)) break; n.add(t), P6(e); } }; function R6(t) { this._$AN !== void 0 ? (sp(this), this._$AM = t, LN(this)) : this._$AM = t; } function O6(t, e = !1, n = 0) { const r = this._$AH, i = this._$AN; if (i !== void 0 && i.size !== 0) if (e) if (Array.isArray(r)) for (let o = n; o < r.length; o++) od(r[o], !1), sp(r[o]); else r != null && (od(r, !1), sp(r)); else od(this, t); } const P6 = (t) => { t.type == N6.CHILD && (t._$AP ??= O6, t._$AQ ??= R6); }; class D6 extends I6 { constructor() { super(...arguments), this._$AN = void 0; } _$AT(e, n, r) { super._$AT(e, n, r), LN(this), this.isConnected = e._$AU; } _$AO(e, n = !0) { e !== this.isConnected && (this.isConnected = e, e ? this.reconnected?.() : this.disconnected?.()), n && (od(this, e), sp(this)); } setValue(e) { if (x6(this.t)) this.t._$AI(e, this); else { const n = [...this.t._$AH]; n[this.i] = e, this.t._$AI(n, this, 0); } } disconnected() { } reconnected() { } } /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const F6 = () => new L6(); class L6 { } const Lv = /* @__PURE__ */ new WeakMap(), U6 = T6(class extends D6 { render(t) { return In; } update(t, [e]) { const n = e !== this.Y; return n && this.Y !== void 0 && this.rt(void 0), (n || this.lt !== this.ct) && (this.Y = e, this.ht = t.options?.host, this.rt(this.ct = t.element)), In; } rt(t) { if (this.isConnected || (t = void 0), typeof this.Y == "function") { const e = this.ht ?? globalThis; let n = Lv.get(e); n === void 0 && (n = /* @__PURE__ */ new WeakMap(), Lv.set(e, n)), n.get(this.Y) !== void 0 && this.Y.call(this.ht, void 0), n.set(this.Y, t), t !== void 0 && this.Y.call(this.ht, t); } else this.Y.value = t; } get lt() { return typeof this.Y == "function" ? Lv.get(this.ht ?? globalThis)?.get(this.Y) : this.Y?.value; } disconnected() { this.lt === this.ct && this.rt(void 0); } reconnected() { this.rt(this.ct); } }); var ch = {}, Uv = { exports: {} }, _r = {}, Mv = { exports: {} }, Bv = {}; /** * @license React * scheduler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var l1; function M6() { return l1 || (l1 = 1, function(t) { function e(ce, Ee) { var B = ce.length; ce.push(Ee); e: for (; 0 < B; ) { var M = B - 1 >>> 1, te = ce[M]; if (0 < i(te, Ee)) ce[M] = Ee, ce[B] = te, B = M; else break e; } } function n(ce) { return ce.length === 0 ? null : ce[0]; } function r(ce) { if (ce.length === 0) return null; var Ee = ce[0], B = ce.pop(); if (B !== Ee) { ce[0] = B; e: for (var M = 0, te = ce.length, Te = te >>> 1; M < Te; ) { var $ = 2 * (M + 1) - 1, Q = ce[$], Ye = $ + 1, Ie = ce[Ye]; if (0 > i(Q, B)) Ye < te && 0 > i(Ie, Q) ? (ce[M] = Ie, ce[Ye] = B, M = Ye) : (ce[M] = Q, ce[$] = B, M = $); else if (Ye < te && 0 > i(Ie, B)) ce[M] = Ie, ce[Ye] = B, M = Ye; else break e; } } return Ee; } function i(ce, Ee) { var B = ce.sortIndex - Ee.sortIndex; return B !== 0 ? B : ce.id - Ee.id; } if (typeof performance == "object" && typeof performance.now == "function") { var o = performance; t.unstable_now = function() { return o.now(); }; } else { var u = Date, l = u.now(); t.unstable_now = function() { return u.now() - l; }; } var f = [], d = [], p = 1, v = null, y = 3, k = !1, A = !1, E = !1, T = typeof setTimeout == "function" ? setTimeout : null, D = typeof clearTimeout == "function" ? clearTimeout : null, R = typeof setImmediate < "u" ? setImmediate : null; typeof navigator < "u" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 && navigator.scheduling.isInputPending.bind(navigator.scheduling); function L(ce) { for (var Ee = n(d); Ee !== null; ) { if (Ee.callback === null) r(d); else if (Ee.startTime <= ce) r(d), Ee.sortIndex = Ee.expirationTime, e(f, Ee); else break; Ee = n(d); } } function j(ce) { if (E = !1, L(ce), !A) if (n(f) !== null) A = !0, be(K); else { var Ee = n(d); Ee !== null && pe(j, Ee.startTime - ce); } } function K(ce, Ee) { A = !1, E && (E = !1, D(H), H = -1), k = !0; var B = y; try { for (L(Ee), v = n(f); v !== null && (!(v.expirationTime > Ee) || ce && !we()); ) { var M = v.callback; if (typeof M == "function") { v.callback = null, y = v.priorityLevel; var te = M(v.expirationTime <= Ee); Ee = t.unstable_now(), typeof te == "function" ? v.callback = te : v === n(f) && r(f), L(Ee); } else r(f); v = n(f); } if (v !== null) var Te = !0; else { var $ = n(d); $ !== null && pe(j, $.startTime - Ee), Te = !1; } return Te; } finally { v = null, y = B, k = !1; } } var ue = !1, de = null, H = -1, ve = 5, Z = -1; function we() { return !(t.unstable_now() - Z < ve); } function ze() { if (de !== null) { var ce = t.unstable_now(); Z = ce; var Ee = !0; try { Ee = de(!0, ce); } finally { Ee ? it() : (ue = !1, de = null); } } else ue = !1; } var it; if (typeof R == "function") it = function() { R(ze); }; else if (typeof MessageChannel < "u") { var dt = new MessageChannel(), ae = dt.port2; dt.port1.onmessage = ze, it = function() { ae.postMessage(null); }; } else it = function() { T(ze, 0); }; function be(ce) { de = ce, ue || (ue = !0, it()); } function pe(ce, Ee) { H = T(function() { ce(t.unstable_now()); }, Ee); } t.unstable_IdlePriority = 5, t.unstable_ImmediatePriority = 1, t.unstable_LowPriority = 4, t.unstable_NormalPriority = 3, t.unstable_Profiling = null, t.unstable_UserBlockingPriority = 2, t.unstable_cancelCallback = function(ce) { ce.callback = null; }, t.unstable_continueExecution = function() { A || k || (A = !0, be(K)); }, t.unstable_forceFrameRate = function(ce) { 0 > ce || 125 < ce ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : ve = 0 < ce ? Math.floor(1e3 / ce) : 5; }, t.unstable_getCurrentPriorityLevel = function() { return y; }, t.unstable_getFirstCallbackNode = function() { return n(f); }, t.unstable_next = function(ce) { switch (y) { case 1: case 2: case 3: var Ee = 3; break; default: Ee = y; } var B = y; y = Ee; try { return ce(); } finally { y = B; } }, t.unstable_pauseExecution = function() { }, t.unstable_requestPaint = function() { }, t.unstable_runWithPriority = function(ce, Ee) { switch (ce) { case 1: case 2: case 3: case 4: case 5: break; default: ce = 3; } var B = y; y = ce; try { return Ee(); } finally { y = B; } }, t.unstable_scheduleCallback = function(ce, Ee, B) { var M = t.unstable_now(); switch (typeof B == "object" && B !== null ? (B = B.delay, B = typeof B == "number" && 0 < B ? M + B : M) : B = M, ce) { case 1: var te = -1; break; case 2: te = 250; break; case 5: te = 1073741823; break; case 4: te = 1e4; break; default: te = 5e3; } return te = B + te, ce = { id: p++, callback: Ee, priorityLevel: ce, startTime: B, expirationTime: te, sortIndex: -1 }, B > M ? (ce.sortIndex = B, e(d, ce), n(f) === null && ce === n(d) && (E ? (D(H), H = -1) : E = !0, pe(j, B - M))) : (ce.sortIndex = te, e(f, ce), A || k || (A = !0, be(K))), ce; }, t.unstable_shouldYield = we, t.unstable_wrapCallback = function(ce) { var Ee = y; return function() { var B = y; y = Ee; try { return ce.apply(this, arguments); } finally { y = B; } }; }; }(Bv)), Bv; } var c1; function B6() { return c1 || (c1 = 1, Mv.exports = M6()), Mv.exports; } /** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var d1; function j6() { if (d1) return _r; d1 = 1; var t = e0(), e = B6(); function n(s) { for (var a = "https://reactjs.org/docs/error-decoder.html?invariant=" + s, c = 1; c < arguments.length; c++) a += "&args[]=" + encodeURIComponent(arguments[c]); return "Minified React error #" + s + "; visit " + a + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; } var r = /* @__PURE__ */ new Set(), i = {}; function o(s, a) { u(s, a), u(s + "Capture", a); } function u(s, a) { for (i[s] = a, s = 0; s < a.length; s++) r.add(a[s]); } var l = !(typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u"), f = Object.prototype.hasOwnProperty, d = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, p = {}, v = {}; function y(s) { return f.call(v, s) ? !0 : f.call(p, s) ? !1 : d.test(s) ? v[s] = !0 : (p[s] = !0, !1); } function k(s, a, c, m) { if (c !== null && c.type === 0) return !1; switch (typeof a) { case "function": case "symbol": return !0; case "boolean": return m ? !1 : c !== null ? !c.acceptsBooleans : (s = s.toLowerCase().slice(0, 5), s !== "data-" && s !== "aria-"); default: return !1; } } function A(s, a, c, m) { if (a === null || typeof a > "u" || k(s, a, c, m)) return !0; if (m) return !1; if (c !== null) switch (c.type) { case 3: return !a; case 4: return a === !1; case 5: return isNaN(a); case 6: return isNaN(a) || 1 > a; } return !1; } function E(s, a, c, m, w, _, I) { this.acceptsBooleans = a === 2 || a === 3 || a === 4, this.attributeName = m, this.attributeNamespace = w, this.mustUseProperty = c, this.propertyName = s, this.type = a, this.sanitizeURL = _, this.removeEmptyString = I; } var T = {}; "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s) { T[s] = new E(s, 0, !1, s, null, !1, !1); }), [["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(s) { var a = s[0]; T[a] = new E(a, 1, !1, s[1], null, !1, !1); }), ["contentEditable", "draggable", "spellCheck", "value"].forEach(function(s) { T[s] = new E(s, 2, !1, s.toLowerCase(), null, !1, !1); }), ["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(s) { T[s] = new E(s, 2, !1, s, null, !1, !1); }), "allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s) { T[s] = new E(s, 3, !1, s.toLowerCase(), null, !1, !1); }), ["checked", "multiple", "muted", "selected"].forEach(function(s) { T[s] = new E(s, 3, !0, s, null, !1, !1); }), ["capture", "download"].forEach(function(s) { T[s] = new E(s, 4, !1, s, null, !1, !1); }), ["cols", "rows", "size", "span"].forEach(function(s) { T[s] = new E(s, 6, !1, s, null, !1, !1); }), ["rowSpan", "start"].forEach(function(s) { T[s] = new E(s, 5, !1, s.toLowerCase(), null, !1, !1); }); var D = /[\-:]([a-z])/g; function R(s) { return s[1].toUpperCase(); } "accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s) { var a = s.replace( D, R ); T[a] = new E(a, 1, !1, s, null, !1, !1); }), "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s) { var a = s.replace(D, R); T[a] = new E(a, 1, !1, s, "http://www.w3.org/1999/xlink", !1, !1); }), ["xml:base", "xml:lang", "xml:space"].forEach(function(s) { var a = s.replace(D, R); T[a] = new E(a, 1, !1, s, "http://www.w3.org/XML/1998/namespace", !1, !1); }), ["tabIndex", "crossOrigin"].forEach(function(s) { T[s] = new E(s, 1, !1, s.toLowerCase(), null, !1, !1); }), T.xlinkHref = new E("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1), ["src", "href", "action", "formAction"].forEach(function(s) { T[s] = new E(s, 1, !1, s.toLowerCase(), null, !0, !0); }); function L(s, a, c, m) { var w = T.hasOwnProperty(a) ? T[a] : null; (w !== null ? w.type !== 0 : m || !(2 < a.length) || a[0] !== "o" && a[0] !== "O" || a[1] !== "n" && a[1] !== "N") && (A(a, c, w, m) && (c = null), m || w === null ? y(a) && (c === null ? s.removeAttribute(a) : s.setAttribute(a, "" + c)) : w.mustUseProperty ? s[w.propertyName] = c === null ? w.type === 3 ? !1 : "" : c : (a = w.attributeName, m = w.attributeNamespace, c === null ? s.removeAttribute(a) : (w = w.type, c = w === 3 || w === 4 && c === !0 ? "" : "" + c, m ? s.setAttributeNS(m, a, c) : s.setAttribute(a, c)))); } var j = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, K = Symbol.for("react.element"), ue = Symbol.for("react.portal"), de = Symbol.for("react.fragment"), H = Symbol.for("react.strict_mode"), ve = Symbol.for("react.profiler"), Z = Symbol.for("react.provider"), we = Symbol.for("react.context"), ze = Symbol.for("react.forward_ref"), it = Symbol.for("react.suspense"), dt = Symbol.for("react.suspense_list"), ae = Symbol.for("react.memo"), be = Symbol.for("react.lazy"), pe = Symbol.for("react.offscreen"), ce = Symbol.iterator; function Ee(s) { return s === null || typeof s != "object" ? null : (s = ce && s[ce] || s["@@iterator"], typeof s == "function" ? s : null); } var B = Object.assign, M; function te(s) { if (M === void 0) try { throw Error(); } catch (c) { var a = c.stack.trim().match(/\n( *(at )?)/); M = a && a[1] || ""; } return ` ` + M + s; } var Te = !1; function $(s, a) { if (!s || Te) return ""; Te = !0; var c = Error.prepareStackTrace; Error.prepareStackTrace = void 0; try { if (a) if (a = function() { throw Error(); }, Object.defineProperty(a.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(a, []); } catch (me) { var m = me; } Reflect.construct(s, [], a); } else { try { a.call(); } catch (me) { m = me; } s.call(a.prototype); } else { try { throw Error(); } catch (me) { m = me; } s(); } } catch (me) { if (me && m && typeof me.stack == "string") { for (var w = me.stack.split(` `), _ = m.stack.split(` `), I = w.length - 1, V = _.length - 1; 1 <= I && 0 <= V && w[I] !== _[V]; ) V--; for (; 1 <= I && 0 <= V; I--, V--) if (w[I] !== _[V]) { if (I !== 1 || V !== 1) do if (I--, V--, 0 > V || w[I] !== _[V]) { var G = ` ` + w[I].replace(" at new ", " at "); return s.displayName && G.includes("") && (G = G.replace("", s.displayName)), G; } while (1 <= I && 0 <= V); break; } } } finally { Te = !1, Error.prepareStackTrace = c; } return (s = s ? s.displayName || s.name : "") ? te(s) : ""; } function Q(s) { switch (s.tag) { case 5: return te(s.type); case 16: return te("Lazy"); case 13: return te("Suspense"); case 19: return te("SuspenseList"); case 0: case 2: case 15: return s = $(s.type, !1), s; case 11: return s = $(s.type.render, !1), s; case 1: return s = $(s.type, !0), s; default: return ""; } } function Ye(s) { if (s == null) return null; if (typeof s == "function") return s.displayName || s.name || null; if (typeof s == "string") return s; switch (s) { case de: return "Fragment"; case ue: return "Portal"; case ve: return "Profiler"; case H: return "StrictMode"; case it: return "Suspense"; case dt: return "SuspenseList"; } if (typeof s == "object") switch (s.$$typeof) { case we: return (s.displayName || "Context") + ".Consumer"; case Z: return (s._context.displayName || "Context") + ".Provider"; case ze: var a = s.render; return s = s.displayName, s || (s = a.displayName || a.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s; case ae: return a = s.displayName || null, a !== null ? a : Ye(s.type) || "Memo"; case be: a = s._payload, s = s._init; try { return Ye(s(a)); } catch { } } return null; } function Ie(s) { var a = s.type; switch (s.tag) { case 24: return "Cache"; case 9: return (a.displayName || "Context") + ".Consumer"; case 10: return (a._context.displayName || "Context") + ".Provider"; case 18: return "DehydratedFragment"; case 11: return s = a.render, s = s.displayName || s.name || "", a.displayName || (s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"); case 7: return "Fragment"; case 5: return a; case 4: return "Portal"; case 3: return "Root"; case 6: return "Text"; case 16: return Ye(a); case 8: return a === H ? "StrictMode" : "Mode"; case 22: return "Offscreen"; case 12: return "Profiler"; case 21: return "Scope"; case 13: return "Suspense"; case 19: return "SuspenseList"; case 25: return "TracingMarker"; case 1: case 0: case 17: case 2: case 14: case 15: if (typeof a == "function") return a.displayName || a.name || null; if (typeof a == "string") return a; } return null; } function Ge(s) { switch (typeof s) { case "boolean": case "number": case "string": case "undefined": return s; case "object": return s; default: return ""; } } function Re(s) { var a = s.type; return (s = s.nodeName) && s.toLowerCase() === "input" && (a === "checkbox" || a === "radio"); } function ht(s) { var a = Re(s) ? "checked" : "value", c = Object.getOwnPropertyDescriptor(s.constructor.prototype, a), m = "" + s[a]; if (!s.hasOwnProperty(a) && typeof c < "u" && typeof c.get == "function" && typeof c.set == "function") { var w = c.get, _ = c.set; return Object.defineProperty(s, a, { configurable: !0, get: function() { return w.call(this); }, set: function(I) { m = "" + I, _.call(this, I); } }), Object.defineProperty(s, a, { enumerable: c.enumerable }), { getValue: function() { return m; }, setValue: function(I) { m = "" + I; }, stopTracking: function() { s._valueTracker = null, delete s[a]; } }; } } function ft(s) { s._valueTracker || (s._valueTracker = ht(s)); } function Je(s) { if (!s) return !1; var a = s._valueTracker; if (!a) return !0; var c = a.getValue(), m = ""; return s && (m = Re(s) ? s.checked ? "true" : "false" : s.value), s = m, s !== c ? (a.setValue(s), !0) : !1; } function It(s) { if (s = s || (typeof document < "u" ? document : void 0), typeof s > "u") return null; try { return s.activeElement || s.body; } catch { return s.body; } } function Rt(s, a) { var c = a.checked; return B({}, a, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: c ?? s._wrapperState.initialChecked }); } function Ze(s, a) { var c = a.defaultValue == null ? "" : a.defaultValue, m = a.checked != null ? a.checked : a.defaultChecked; c = Ge(a.value != null ? a.value : c), s._wrapperState = { initialChecked: m, initialValue: c, controlled: a.type === "checkbox" || a.type === "radio" ? a.checked != null : a.value != null }; } function Dt(s, a) { a = a.checked, a != null && L(s, "checked", a, !1); } function Mt(s, a) { Dt(s, a); var c = Ge(a.value), m = a.type; if (c != null) m === "number" ? (c === 0 && s.value === "" || s.value != c) && (s.value = "" + c) : s.value !== "" + c && (s.value = "" + c); else if (m === "submit" || m === "reset") { s.removeAttribute("value"); return; } a.hasOwnProperty("value") ? x(s, a.type, c) : a.hasOwnProperty("defaultValue") && x(s, a.type, Ge(a.defaultValue)), a.checked == null && a.defaultChecked != null && (s.defaultChecked = !!a.defaultChecked); } function P(s, a, c) { if (a.hasOwnProperty("value") || a.hasOwnProperty("defaultValue")) { var m = a.type; if (!(m !== "submit" && m !== "reset" || a.value !== void 0 && a.value !== null)) return; a = "" + s._wrapperState.initialValue, c || a === s.value || (s.value = a), s.defaultValue = a; } c = s.name, c !== "" && (s.name = ""), s.defaultChecked = !!s._wrapperState.initialChecked, c !== "" && (s.name = c); } function x(s, a, c) { (a !== "number" || It(s.ownerDocument) !== s) && (c == null ? s.defaultValue = "" + s._wrapperState.initialValue : s.defaultValue !== "" + c && (s.defaultValue = "" + c)); } var b = Array.isArray; function F(s, a, c, m) { if (s = s.options, a) { a = {}; for (var w = 0; w < c.length; w++) a["$" + c[w]] = !0; for (c = 0; c < s.length; c++) w = a.hasOwnProperty("$" + s[c].value), s[c].selected !== w && (s[c].selected = w), w && m && (s[c].defaultSelected = !0); } else { for (c = "" + Ge(c), a = null, w = 0; w < s.length; w++) { if (s[w].value === c) { s[w].selected = !0, m && (s[w].defaultSelected = !0); return; } a !== null || s[w].disabled || (a = s[w]); } a !== null && (a.selected = !0); } } function ee(s, a) { if (a.dangerouslySetInnerHTML != null) throw Error(n(91)); return B({}, a, { value: void 0, defaultValue: void 0, children: "" + s._wrapperState.initialValue }); } function _e(s, a) { var c = a.value; if (c == null) { if (c = a.children, a = a.defaultValue, c != null) { if (a != null) throw Error(n(92)); if (b(c)) { if (1 < c.length) throw Error(n(93)); c = c[0]; } a = c; } a == null && (a = ""), c = a; } s._wrapperState = { initialValue: Ge(c) }; } function Ae(s, a) { var c = Ge(a.value), m = Ge(a.defaultValue); c != null && (c = "" + c, c !== s.value && (s.value = c), a.defaultValue == null && s.defaultValue !== c && (s.defaultValue = c)), m != null && (s.defaultValue = "" + m); } function _t(s) { var a = s.textContent; a === s._wrapperState.initialValue && a !== "" && a !== null && (s.value = a); } function At(s) { switch (s) { case "svg": return "http://www.w3.org/2000/svg"; case "math": return "http://www.w3.org/1998/Math/MathML"; default: return "http://www.w3.org/1999/xhtml"; } } function Ft(s, a) { return s == null || s === "http://www.w3.org/1999/xhtml" ? At(a) : s === "http://www.w3.org/2000/svg" && a === "foreignObject" ? "http://www.w3.org/1999/xhtml" : s; } var dn, qt = function(s) { return typeof MSApp < "u" && MSApp.execUnsafeLocalFunction ? function(a, c, m, w) { MSApp.execUnsafeLocalFunction(function() { return s(a, c, m, w); }); } : s; }(function(s, a) { if (s.namespaceURI !== "http://www.w3.org/2000/svg" || "innerHTML" in s) s.innerHTML = a; else { for (dn = dn || document.createElement("div"), dn.innerHTML = "" + a.valueOf().toString() + "", a = dn.firstChild; s.firstChild; ) s.removeChild(s.firstChild); for (; a.firstChild; ) s.appendChild(a.firstChild); } }); function dr(s, a) { if (a) { var c = s.firstChild; if (c && c === s.lastChild && c.nodeType === 3) { c.nodeValue = a; return; } } s.textContent = a; } var Ir = { animationIterationCount: !0, aspectRatio: !0, borderImageOutset: !0, borderImageSlice: !0, borderImageWidth: !0, boxFlex: !0, boxFlexGroup: !0, boxOrdinalGroup: !0, columnCount: !0, columns: !0, flex: !0, flexGrow: !0, flexPositive: !0, flexShrink: !0, flexNegative: !0, flexOrder: !0, gridArea: !0, gridRow: !0, gridRowEnd: !0, gridRowSpan: !0, gridRowStart: !0, gridColumn: !0, gridColumnEnd: !0, gridColumnSpan: !0, gridColumnStart: !0, fontWeight: !0, lineClamp: !0, lineHeight: !0, opacity: !0, order: !0, orphans: !0, tabSize: !0, widows: !0, zIndex: !0, zoom: !0, fillOpacity: !0, floodOpacity: !0, stopOpacity: !0, strokeDasharray: !0, strokeDashoffset: !0, strokeMiterlimit: !0, strokeOpacity: !0, strokeWidth: !0 }, Hr = ["Webkit", "ms", "Moz", "O"]; Object.keys(Ir).forEach(function(s) { Hr.forEach(function(a) { a = a + s.charAt(0).toUpperCase() + s.substring(1), Ir[a] = Ir[s]; }); }); function Vs(s, a, c) { return a == null || typeof a == "boolean" || a === "" ? "" : c || typeof a != "number" || a === 0 || Ir.hasOwnProperty(s) && Ir[s] ? ("" + a).trim() : a + "px"; } function ou(s, a) { s = s.style; for (var c in a) if (a.hasOwnProperty(c)) { var m = c.indexOf("--") === 0, w = Vs(c, a[c], m); c === "float" && (c = "cssFloat"), m ? s.setProperty(c, w) : s[c] = w; } } var Fi = B({ menuitem: !0 }, { area: !0, base: !0, br: !0, col: !0, embed: !0, hr: !0, img: !0, input: !0, keygen: !0, link: !0, meta: !0, param: !0, source: !0, track: !0, wbr: !0 }); function ut(s, a) { if (a) { if (Fi[s] && (a.children != null || a.dangerouslySetInnerHTML != null)) throw Error(n(137, s)); if (a.dangerouslySetInnerHTML != null) { if (a.children != null) throw Error(n(60)); if (typeof a.dangerouslySetInnerHTML != "object" || !("__html" in a.dangerouslySetInnerHTML)) throw Error(n(61)); } if (a.style != null && typeof a.style != "object") throw Error(n(62)); } } function oo(s, a) { if (s.indexOf("-") === -1) return typeof a.is == "string"; switch (s) { case "annotation-xml": case "color-profile": case "font-face": case "font-face-src": case "font-face-uri": case "font-face-format": case "font-face-name": case "missing-glyph": return !1; default: return !0; } } var li = null; function Vo(s) { return s = s.target || s.srcElement || window, s.correspondingUseElement && (s = s.correspondingUseElement), s.nodeType === 3 ? s.parentNode : s; } var Xe = null, Li = null, so = null; function su(s) { if (s = nc(s)) { if (typeof Xe != "function") throw Error(n(280)); var a = s.stateNode; a && (a = of(a), Xe(s.stateNode, s.type, a)); } } function Fl(s) { Li ? so ? so.push(s) : so = [s] : Li = s; } function au() { if (Li) { var s = Li, a = so; if (so = Li = null, su(s), a) for (s = 0; s < a.length; s++) su(a[s]); } } function Od(s, a) { return s(a); } function Pd() { } var Ui = !1; function ao(s, a, c) { if (Ui) return s(a, c); Ui = !0; try { return Od(s, a, c); } finally { Ui = !1, (Li !== null || so !== null) && (Pd(), au()); } } function uo(s, a) { var c = s.stateNode; if (c === null) return null; var m = of(c); if (m === null) return null; c = m[a]; e: switch (a) { case "onClick": case "onClickCapture": case "onDoubleClick": case "onDoubleClickCapture": case "onMouseDown": case "onMouseDownCapture": case "onMouseMove": case "onMouseMoveCapture": case "onMouseUp": case "onMouseUpCapture": case "onMouseEnter": (m = !m.disabled) || (s = s.type, m = !(s === "button" || s === "input" || s === "select" || s === "textarea")), s = !m; break e; default: s = !1; } if (s) return null; if (c && typeof c != "function") throw Error(n(231, a, typeof c)); return c; } var zo = !1; if (l) try { var Wt = {}; Object.defineProperty(Wt, "passive", { get: function() { zo = !0; } }), window.addEventListener("test", Wt, Wt), window.removeEventListener("test", Wt, Wt); } catch { zo = !1; } function Cn(s, a, c, m, w, _, I, V, G) { var me = Array.prototype.slice.call(arguments, 3); try { a.apply(c, me); } catch (Ue) { this.onError(Ue); } } var zs = !1, lo = null, co = !1, qo = null, Hp = { onError: function(s) { zs = !0, lo = s; } }; function Mi(s, a, c, m, w, _, I, V, G) { zs = !1, lo = null, Cn.apply(Hp, arguments); } function Ho(s, a, c, m, w, _, I, V, G) { if (Mi.apply(this, arguments), zs) { if (zs) { var me = lo; zs = !1, lo = null; } else throw Error(n(198)); co || (co = !0, qo = me); } } function Wn(s) { var a = s, c = s; if (s.alternate) for (; a.return; ) a = a.return; else { s = a; do a = s, (a.flags & 4098) !== 0 && (c = a.return), s = a.return; while (s); } return a.tag === 3 ? c : null; } function qs(s) { if (s.tag === 13) { var a = s.memoizedState; if (a === null && (s = s.alternate, s !== null && (a = s.memoizedState)), a !== null) return a.dehydrated; } return null; } function Dd(s) { if (Wn(s) !== s) throw Error(n(188)); } function Bi(s) { var a = s.alternate; if (!a) { if (a = Wn(s), a === null) throw Error(n(188)); return a !== s ? null : s; } for (var c = s, m = a; ; ) { var w = c.return; if (w === null) break; var _ = w.alternate; if (_ === null) { if (m = w.return, m !== null) { c = m; continue; } break; } if (w.child === _.child) { for (_ = w.child; _; ) { if (_ === c) return Dd(w), s; if (_ === m) return Dd(w), a; _ = _.sibling; } throw Error(n(188)); } if (c.return !== m.return) c = w, m = _; else { for (var I = !1, V = w.child; V; ) { if (V === c) { I = !0, c = w, m = _; break; } if (V === m) { I = !0, m = w, c = _; break; } V = V.sibling; } if (!I) { for (V = _.child; V; ) { if (V === c) { I = !0, c = _, m = w; break; } if (V === m) { I = !0, m = _, c = w; break; } V = V.sibling; } if (!I) throw Error(n(189)); } } if (c.alternate !== m) throw Error(n(190)); } if (c.tag !== 3) throw Error(n(188)); return c.stateNode.current === c ? s : a; } function Ll(s) { return s = Bi(s), s !== null ? ji(s) : null; } function ji(s) { if (s.tag === 5 || s.tag === 6) return s; for (s = s.child; s !== null; ) { var a = ji(s); if (a !== null) return a; s = s.sibling; } return null; } var Ul = e.unstable_scheduleCallback, uu = e.unstable_cancelCallback, vn = e.unstable_shouldYield, fo = e.unstable_requestPaint, Ht = e.unstable_now, Fd = e.unstable_getCurrentPriorityLevel, $i = e.unstable_ImmediatePriority, Hs = e.unstable_UserBlockingPriority, Ko = e.unstable_NormalPriority, Ml = e.unstable_LowPriority, Vi = e.unstable_IdlePriority, Ks = null, or = null; function Ld(s) { if (or && typeof or.onCommitFiberRoot == "function") try { or.onCommitFiberRoot(Ks, s, void 0, (s.current.flags & 128) === 128); } catch { } } var wt = Math.clz32 ? Math.clz32 : Bd, Ud = Math.log, Md = Math.LN2; function Bd(s) { return s >>>= 0, s === 0 ? 32 : 31 - (Ud(s) / Md | 0) | 0; } var Yt = 64, zi = 4194304; function ci(s) { switch (s & -s) { case 1: return 1; case 2: return 2; case 4: return 4; case 8: return 8; case 16: return 16; case 32: return 32; case 64: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return s & 4194240; case 4194304: case 8388608: case 16777216: case 33554432: case 67108864: return s & 130023424; case 134217728: return 134217728; case 268435456: return 268435456; case 536870912: return 536870912; case 1073741824: return 1073741824; default: return s; } } function di(s, a) { var c = s.pendingLanes; if (c === 0) return 0; var m = 0, w = s.suspendedLanes, _ = s.pingedLanes, I = c & 268435455; if (I !== 0) { var V = I & ~w; V !== 0 ? m = ci(V) : (_ &= I, _ !== 0 && (m = ci(_))); } else I = c & ~w, I !== 0 ? m = ci(I) : _ !== 0 && (m = ci(_)); if (m === 0) return 0; if (a !== 0 && a !== m && (a & w) === 0 && (w = m & -m, _ = a & -a, w >= _ || w === 16 && (_ & 4194240) !== 0)) return a; if ((m & 4) !== 0 && (m |= c & 16), a = s.entangledLanes, a !== 0) for (s = s.entanglements, a &= m; 0 < a; ) c = 31 - wt(a), w = 1 << c, m |= s[c], a &= ~w; return m; } function Bl(s, a) { switch (s) { case 1: case 2: case 4: return a + 250; case 8: case 16: case 32: case 64: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return a + 5e3; case 4194304: case 8388608: case 16777216: case 33554432: case 67108864: return -1; case 134217728: case 268435456: case 536870912: case 1073741824: return -1; default: return -1; } } function jl(s, a) { for (var c = s.suspendedLanes, m = s.pingedLanes, w = s.expirationTimes, _ = s.pendingLanes; 0 < _; ) { var I = 31 - wt(_), V = 1 << I, G = w[I]; G === -1 ? ((V & c) === 0 || (V & m) !== 0) && (w[I] = Bl(V, a)) : G <= a && (s.expiredLanes |= V), _ &= ~V; } } function Go(s) { return s = s.pendingLanes & -1073741825, s !== 0 ? s : s & 1073741824 ? 1073741824 : 0; } function $l() { var s = Yt; return Yt <<= 1, (Yt & 4194240) === 0 && (Yt = 64), s; } function Wo(s) { for (var a = [], c = 0; 31 > c; c++) a.push(s); return a; } function Yo(s, a, c) { s.pendingLanes |= a, a !== 536870912 && (s.suspendedLanes = 0, s.pingedLanes = 0), s = s.eventTimes, a = 31 - wt(a), s[a] = c; } function Gs(s, a) { var c = s.pendingLanes & ~a; s.pendingLanes = a, s.suspendedLanes = 0, s.pingedLanes = 0, s.expiredLanes &= a, s.mutableReadLanes &= a, s.entangledLanes &= a, a = s.entanglements; var m = s.eventTimes; for (s = s.expirationTimes; 0 < c; ) { var w = 31 - wt(c), _ = 1 << w; a[w] = 0, m[w] = -1, s[w] = -1, c &= ~_; } } function lu(s, a) { var c = s.entangledLanes |= a; for (s = s.entanglements; c; ) { var m = 31 - wt(c), w = 1 << m; w & a | s[m] & a && (s[m] |= a), c &= ~w; } } var Kt = 0; function Ut(s) { return s &= -s, 1 < s ? 4 < s ? (s & 268435455) !== 0 ? 16 : 536870912 : 4 : 1; } var cu, Vl, jd, Yn, ho, Qo = !1, Rr = [], fi = null, hi = null, nn = null, Qn = /* @__PURE__ */ new Map(), pi = /* @__PURE__ */ new Map(), fr = [], zl = "mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" "); function mi(s, a) { switch (s) { case "focusin": case "focusout": fi = null; break; case "dragenter": case "dragleave": hi = null; break; case "mouseover": case "mouseout": nn = null; break; case "pointerover": case "pointerout": Qn.delete(a.pointerId); break; case "gotpointercapture": case "lostpointercapture": pi.delete(a.pointerId); } } function Ws(s, a, c, m, w, _) { return s === null || s.nativeEvent !== _ ? (s = { blockedOn: a, domEventName: c, eventSystemFlags: m, nativeEvent: _, targetContainers: [w] }, a !== null && (a = nc(a), a !== null && Vl(a)), s) : (s.eventSystemFlags |= m, a = s.targetContainers, w !== null && a.indexOf(w) === -1 && a.push(w), s); } function Kr(s, a, c, m, w) { switch (a) { case "focusin": return fi = Ws(fi, s, a, c, m, w), !0; case "dragenter": return hi = Ws(hi, s, a, c, m, w), !0; case "mouseover": return nn = Ws(nn, s, a, c, m, w), !0; case "pointerover": var _ = w.pointerId; return Qn.set(_, Ws(Qn.get(_) || null, s, a, c, m, w)), !0; case "gotpointercapture": return _ = w.pointerId, pi.set(_, Ws(pi.get(_) || null, s, a, c, m, w)), !0; } return !1; } function du(s) { var a = ua(s.target); if (a !== null) { var c = Wn(a); if (c !== null) { if (a = c.tag, a === 13) { if (a = qs(c), a !== null) { s.blockedOn = a, ho(s.priority, function() { jd(c); }); return; } } else if (a === 3 && c.stateNode.current.memoizedState.isDehydrated) { s.blockedOn = c.tag === 3 ? c.stateNode.containerInfo : null; return; } } } s.blockedOn = null; } function Ys(s) { if (s.blockedOn !== null) return !1; for (var a = s.targetContainers; 0 < a.length; ) { var c = Js(s.domEventName, s.eventSystemFlags, a[0], s.nativeEvent); if (c === null) { c = s.nativeEvent; var m = new c.constructor(c.type, c); li = m, c.target.dispatchEvent(m), li = null; } else return a = nc(c), a !== null && Vl(a), s.blockedOn = c, !1; a.shift(); } return !0; } function fu(s, a, c) { Ys(s) && c.delete(a); } function Qs() { Qo = !1, fi !== null && Ys(fi) && (fi = null), hi !== null && Ys(hi) && (hi = null), nn !== null && Ys(nn) && (nn = null), Qn.forEach(fu), pi.forEach(fu); } function po(s, a) { s.blockedOn === a && (s.blockedOn = null, Qo || (Qo = !0, e.unstable_scheduleCallback(e.unstable_NormalPriority, Qs))); } function Jo(s) { function a(w) { return po(w, s); } if (0 < Rr.length) { po(Rr[0], s); for (var c = 1; c < Rr.length; c++) { var m = Rr[c]; m.blockedOn === s && (m.blockedOn = null); } } for (fi !== null && po(fi, s), hi !== null && po(hi, s), nn !== null && po(nn, s), Qn.forEach(a), pi.forEach(a), c = 0; c < fr.length; c++) m = fr[c], m.blockedOn === s && (m.blockedOn = null); for (; 0 < fr.length && (c = fr[0], c.blockedOn === null); ) du(c), c.blockedOn === null && fr.shift(); } var Xo = j.ReactCurrentBatchConfig, qi = !0; function Kp(s, a, c, m) { var w = Kt, _ = Xo.transition; Xo.transition = null; try { Kt = 1, Zo(s, a, c, m); } finally { Kt = w, Xo.transition = _; } } function Gp(s, a, c, m) { var w = Kt, _ = Xo.transition; Xo.transition = null; try { Kt = 4, Zo(s, a, c, m); } finally { Kt = w, Xo.transition = _; } } function Zo(s, a, c, m) { if (qi) { var w = Js(s, a, c, m); if (w === null) tm(s, a, m, mo, c), mi(s, m); else if (Kr(w, s, a, c, m)) m.stopPropagation(); else if (mi(s, m), a & 4 && -1 < zl.indexOf(s)) { for (; w !== null; ) { var _ = nc(w); if (_ !== null && cu(_), _ = Js(s, a, c, m), _ === null && tm(s, a, m, mo, c), _ === w) break; w = _; } w !== null && m.stopPropagation(); } else tm(s, a, m, null, c); } } var mo = null; function Js(s, a, c, m) { if (mo = null, s = Vo(m), s = ua(s), s !== null) if (a = Wn(s), a === null) s = null; else if (c = a.tag, c === 13) { if (s = qs(a), s !== null) return s; s = null; } else if (c === 3) { if (a.stateNode.current.memoizedState.isDehydrated) return a.tag === 3 ? a.stateNode.containerInfo : null; s = null; } else a !== s && (s = null); return mo = s, null; } function $d(s) { switch (s) { case "cancel": case "click": case "close": case "contextmenu": case "copy": case "cut": case "auxclick": case "dblclick": case "dragend": case "dragstart": case "drop": case "focusin": case "focusout": case "input": case "invalid": case "keydown": case "keypress": case "keyup": case "mousedown": case "mouseup": case "paste": case "pause": case "play": case "pointercancel": case "pointerdown": case "pointerup": case "ratechange": case "reset": case "resize": case "seeked": case "submit": case "touchcancel": case "touchend": case "touchstart": case "volumechange": case "change": case "selectionchange": case "textInput": case "compositionstart": case "compositionend": case "compositionupdate": case "beforeblur": case "afterblur": case "beforeinput": case "blur": case "fullscreenchange": case "focus": case "hashchange": case "popstate": case "select": case "selectstart": return 1; case "drag": case "dragenter": case "dragexit": case "dragleave": case "dragover": case "mousemove": case "mouseout": case "mouseover": case "pointermove": case "pointerout": case "pointerover": case "scroll": case "toggle": case "touchmove": case "wheel": case "mouseenter": case "mouseleave": case "pointerenter": case "pointerleave": return 4; case "message": switch (Fd()) { case $i: return 1; case Hs: return 4; case Ko: case Ml: return 16; case Vi: return 536870912; default: return 16; } default: return 16; } } var Hi = null, ql = null, es = null; function hu() { if (es) return es; var s, a = ql, c = a.length, m, w = "value" in Hi ? Hi.value : Hi.textContent, _ = w.length; for (s = 0; s < c && a[s] === w[s]; s++) ; var I = c - s; for (m = 1; m <= I && a[c - m] === w[_ - m]; m++) ; return es = w.slice(s, 1 < m ? 1 - m : void 0); } function Xs(s) { var a = s.keyCode; return "charCode" in s ? (s = s.charCode, s === 0 && a === 13 && (s = 13)) : s = a, s === 10 && (s = 13), 32 <= s || s === 13 ? s : 0; } function go() { return !0; } function Zs() { return !1; } function Fn(s) { function a(c, m, w, _, I) { this._reactName = c, this._targetInst = w, this.type = m, this.nativeEvent = _, this.target = I, this.currentTarget = null; for (var V in s) s.hasOwnProperty(V) && (c = s[V], this[V] = c ? c(_) : _[V]); return this.isDefaultPrevented = (_.defaultPrevented != null ? _.defaultPrevented : _.returnValue === !1) ? go : Zs, this.isPropagationStopped = Zs, this; } return B(a.prototype, { preventDefault: function() { this.defaultPrevented = !0; var c = this.nativeEvent; c && (c.preventDefault ? c.preventDefault() : typeof c.returnValue != "unknown" && (c.returnValue = !1), this.isDefaultPrevented = go); }, stopPropagation: function() { var c = this.nativeEvent; c && (c.stopPropagation ? c.stopPropagation() : typeof c.cancelBubble != "unknown" && (c.cancelBubble = !0), this.isPropagationStopped = go); }, persist: function() { }, isPersistent: go }), a; } var vo = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function(s) { return s.timeStamp || Date.now(); }, defaultPrevented: 0, isTrusted: 0 }, Hl = Fn(vo), Ki = B({}, vo, { view: 0, detail: 0 }), Kl = Fn(Ki), ea, ta, yo, kn = B({}, Ki, { screenX: 0, screenY: 0, clientX: 0, clientY: 0, pageX: 0, pageY: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, getModifierState: ra, button: 0, buttons: 0, relatedTarget: function(s) { return s.relatedTarget === void 0 ? s.fromElement === s.srcElement ? s.toElement : s.fromElement : s.relatedTarget; }, movementX: function(s) { return "movementX" in s ? s.movementX : (s !== yo && (yo && s.type === "mousemove" ? (ea = s.screenX - yo.screenX, ta = s.screenY - yo.screenY) : ta = ea = 0, yo = s), ea); }, movementY: function(s) { return "movementY" in s ? s.movementY : ta; } }), ts = Fn(kn), na = B({}, kn, { dataTransfer: 0 }), Vd = Fn(na), pu = B({}, Ki, { relatedTarget: 0 }), mu = Fn(pu), zd = B({}, vo, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }), gu = Fn(zd), Gl = B({}, vo, { clipboardData: function(s) { return "clipboardData" in s ? s.clipboardData : window.clipboardData; } }), wo = Fn(Gl), Wl = B({}, vo, { data: 0 }), vu = Fn(Wl), yu = { Esc: "Escape", Spacebar: " ", Left: "ArrowLeft", Up: "ArrowUp", Right: "ArrowRight", Down: "ArrowDown", Del: "Delete", Win: "OS", Menu: "ContextMenu", Apps: "ContextMenu", Scroll: "ScrollLock", MozPrintableKey: "Unidentified" }, Yl = { 8: "Backspace", 9: "Tab", 12: "Clear", 13: "Enter", 16: "Shift", 17: "Control", 18: "Alt", 19: "Pause", 20: "CapsLock", 27: "Escape", 32: " ", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "ArrowLeft", 38: "ArrowUp", 39: "ArrowRight", 40: "ArrowDown", 45: "Insert", 46: "Delete", 112: "F1", 113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7", 119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 144: "NumLock", 145: "ScrollLock", 224: "Meta" }, qd = { Alt: "altKey", Control: "ctrlKey", Meta: "metaKey", Shift: "shiftKey" }; function Wp(s) { var a = this.nativeEvent; return a.getModifierState ? a.getModifierState(s) : (s = qd[s]) ? !!a[s] : !1; } function ra() { return Wp; } var wu = B({}, Ki, { key: function(s) { if (s.key) { var a = yu[s.key] || s.key; if (a !== "Unidentified") return a; } return s.type === "keypress" ? (s = Xs(s), s === 13 ? "Enter" : String.fromCharCode(s)) : s.type === "keydown" || s.type === "keyup" ? Yl[s.keyCode] || "Unidentified" : ""; }, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: ra, charCode: function(s) { return s.type === "keypress" ? Xs(s) : 0; }, keyCode: function(s) { return s.type === "keydown" || s.type === "keyup" ? s.keyCode : 0; }, which: function(s) { return s.type === "keypress" ? Xs(s) : s.type === "keydown" || s.type === "keyup" ? s.keyCode : 0; } }), Yp = Fn(wu), Ql = B({}, kn, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }), Su = Fn(Ql), Qp = B({}, Ki, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: ra }), Hd = Fn(Qp), Jp = B({}, vo, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }), Kd = Fn(Jp), Gd = B({}, kn, { deltaX: function(s) { return "deltaX" in s ? s.deltaX : "wheelDeltaX" in s ? -s.wheelDeltaX : 0; }, deltaY: function(s) { return "deltaY" in s ? s.deltaY : "wheelDeltaY" in s ? -s.wheelDeltaY : "wheelDelta" in s ? -s.wheelDelta : 0; }, deltaZ: 0, deltaMode: 0 }), Xp = Fn(Gd), Wd = [9, 13, 27, 32], ia = l && "CompositionEvent" in window, ns = null; l && "documentMode" in document && (ns = document.documentMode); var Yd = l && "TextEvent" in window && !ns, Qd = l && (!ia || ns && 8 < ns && 11 >= ns), Jd = " ", Xd = !1; function oa(s, a) { switch (s) { case "keyup": return Wd.indexOf(a.keyCode) !== -1; case "keydown": return a.keyCode !== 229; case "keypress": case "mousedown": case "focusout": return !0; default: return !1; } } function Gr(s) { return s = s.detail, typeof s == "object" && "data" in s ? s.data : null; } var Jt = !1; function _u(s, a) { switch (s) { case "compositionend": return Gr(a); case "keypress": return a.which !== 32 ? null : (Xd = !0, Jd); case "textInput": return s = a.data, s === Jd && Xd ? null : s; default: return null; } } function hr(s, a) { if (Jt) return s === "compositionend" || !ia && oa(s, a) ? (s = hu(), es = ql = Hi = null, Jt = !1, s) : null; switch (s) { case "paste": return null; case "keypress": if (!(a.ctrlKey || a.altKey || a.metaKey) || a.ctrlKey && a.altKey) { if (a.char && 1 < a.char.length) return a.char; if (a.which) return String.fromCharCode(a.which); } return null; case "compositionend": return Qd && a.locale !== "ko" ? null : a.data; default: return null; } } var Zp = { color: !0, date: !0, datetime: !0, "datetime-local": !0, email: !0, month: !0, number: !0, password: !0, range: !0, search: !0, tel: !0, text: !0, time: !0, url: !0, week: !0 }; function bu(s) { var a = s && s.nodeName && s.nodeName.toLowerCase(); return a === "input" ? !!Zp[s.type] : a === "textarea"; } function Jl(s, a, c, m) { Fl(m), a = tf(a, "onChange"), 0 < a.length && (c = new Hl("onChange", "change", null, c, m), s.push({ event: c, listeners: a })); } var Or = null, So = null; function rs(s) { iw(s, 0); } function Pr(s) { var a = Au(s); if (Je(a)) return s; } function Zd(s, a) { if (s === "change") return a; } var h = !1; if (l) { var g; if (l) { var S = "oninput" in document; if (!S) { var C = document.createElement("div"); C.setAttribute("oninput", "return;"), S = typeof C.oninput == "function"; } g = S; } else g = !1; h = g && (!document.documentMode || 9 < document.documentMode); } function N() { Or && (Or.detachEvent("onpropertychange", O), So = Or = null); } function O(s) { if (s.propertyName === "value" && Pr(So)) { var a = []; Jl(a, So, s, Vo(s)), ao(rs, a); } } function U(s, a, c) { s === "focusin" ? (N(), Or = a, So = c, Or.attachEvent("onpropertychange", O)) : s === "focusout" && N(); } function z(s) { if (s === "selectionchange" || s === "keyup" || s === "keydown") return Pr(So); } function W(s, a) { if (s === "click") return Pr(a); } function J(s, a) { if (s === "input" || s === "change") return Pr(a); } function ie(s, a) { return s === a && (s !== 0 || 1 / s === 1 / a) || s !== s && a !== a; } var q = typeof Object.is == "function" ? Object.is : ie; function oe(s, a) { if (q(s, a)) return !0; if (typeof s != "object" || s === null || typeof a != "object" || a === null) return !1; var c = Object.keys(s), m = Object.keys(a); if (c.length !== m.length) return !1; for (m = 0; m < c.length; m++) { var w = c[m]; if (!f.call(a, w) || !q(s[w], a[w])) return !1; } return !0; } function Y(s) { for (; s && s.firstChild; ) s = s.firstChild; return s; } function re(s, a) { var c = Y(s); s = 0; for (var m; c; ) { if (c.nodeType === 3) { if (m = s + c.textContent.length, s <= a && m >= a) return { node: c, offset: a - s }; s = m; } e: { for (; c; ) { if (c.nextSibling) { c = c.nextSibling; break e; } c = c.parentNode; } c = void 0; } c = Y(c); } } function se(s, a) { return s && a ? s === a ? !0 : s && s.nodeType === 3 ? !1 : a && a.nodeType === 3 ? se(s, a.parentNode) : "contains" in s ? s.contains(a) : s.compareDocumentPosition ? !!(s.compareDocumentPosition(a) & 16) : !1 : !1; } function ne() { for (var s = window, a = It(); a instanceof s.HTMLIFrameElement; ) { try { var c = typeof a.contentWindow.location.href == "string"; } catch { c = !1; } if (c) s = a.contentWindow; else break; a = It(s.document); } return a; } function fe(s) { var a = s && s.nodeName && s.nodeName.toLowerCase(); return a && (a === "input" && (s.type === "text" || s.type === "search" || s.type === "tel" || s.type === "url" || s.type === "password") || a === "textarea" || s.contentEditable === "true"); } function ge(s) { var a = ne(), c = s.focusedElem, m = s.selectionRange; if (a !== c && c && c.ownerDocument && se(c.ownerDocument.documentElement, c)) { if (m !== null && fe(c)) { if (a = m.start, s = m.end, s === void 0 && (s = a), "selectionStart" in c) c.selectionStart = a, c.selectionEnd = Math.min(s, c.value.length); else if (s = (a = c.ownerDocument || document) && a.defaultView || window, s.getSelection) { s = s.getSelection(); var w = c.textContent.length, _ = Math.min(m.start, w); m = m.end === void 0 ? _ : Math.min(m.end, w), !s.extend && _ > m && (w = m, m = _, _ = w), w = re(c, _); var I = re( c, m ); w && I && (s.rangeCount !== 1 || s.anchorNode !== w.node || s.anchorOffset !== w.offset || s.focusNode !== I.node || s.focusOffset !== I.offset) && (a = a.createRange(), a.setStart(w.node, w.offset), s.removeAllRanges(), _ > m ? (s.addRange(a), s.extend(I.node, I.offset)) : (a.setEnd(I.node, I.offset), s.addRange(a))); } } for (a = [], s = c; s = s.parentNode; ) s.nodeType === 1 && a.push({ element: s, left: s.scrollLeft, top: s.scrollTop }); for (typeof c.focus == "function" && c.focus(), c = 0; c < a.length; c++) s = a[c], s.element.scrollLeft = s.left, s.element.scrollTop = s.top; } } var ye = l && "documentMode" in document && 11 >= document.documentMode, ke = null, $e = null, We = null, Ve = !1; function qe(s, a, c) { var m = c.window === c ? c.document : c.nodeType === 9 ? c : c.ownerDocument; Ve || ke == null || ke !== It(m) || (m = ke, "selectionStart" in m && fe(m) ? m = { start: m.selectionStart, end: m.selectionEnd } : (m = (m.ownerDocument && m.ownerDocument.defaultView || window).getSelection(), m = { anchorNode: m.anchorNode, anchorOffset: m.anchorOffset, focusNode: m.focusNode, focusOffset: m.focusOffset }), We && oe(We, m) || (We = m, m = tf($e, "onSelect"), 0 < m.length && (a = new Hl("onSelect", "select", null, a, c), s.push({ event: a, listeners: m }), a.target = ke))); } function Qe(s, a) { var c = {}; return c[s.toLowerCase()] = a.toLowerCase(), c["Webkit" + s] = "webkit" + a, c["Moz" + s] = "moz" + a, c; } var He = { animationend: Qe("Animation", "AnimationEnd"), animationiteration: Qe("Animation", "AnimationIteration"), animationstart: Qe("Animation", "AnimationStart"), transitionend: Qe("Transition", "TransitionEnd") }, et = {}, kt = {}; l && (kt = document.createElement("div").style, "AnimationEvent" in window || (delete He.animationend.animation, delete He.animationiteration.animation, delete He.animationstart.animation), "TransitionEvent" in window || delete He.transitionend.transition); function Et(s) { if (et[s]) return et[s]; if (!He[s]) return s; var a = He[s], c; for (c in a) if (a.hasOwnProperty(c) && c in kt) return et[s] = a[c]; return s; } var Nt = Et("animationend"), Jn = Et("animationiteration"), bt = Et("animationstart"), Rn = Et("transitionend"), On = /* @__PURE__ */ new Map(), sa = "abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" "); function mn(s, a) { On.set(s, a), o(a, [s]); } for (var gi = 0; gi < sa.length; gi++) { var aa = sa[gi], uT = aa.toLowerCase(), lT = aa[0].toUpperCase() + aa.slice(1); mn(uT, "on" + lT); } mn(Nt, "onAnimationEnd"), mn(Jn, "onAnimationIteration"), mn(bt, "onAnimationStart"), mn("dblclick", "onDoubleClick"), mn("focusin", "onFocus"), mn("focusout", "onBlur"), mn(Rn, "onTransitionEnd"), u("onMouseEnter", ["mouseout", "mouseover"]), u("onMouseLeave", ["mouseout", "mouseover"]), u("onPointerEnter", ["pointerout", "pointerover"]), u("onPointerLeave", ["pointerout", "pointerover"]), o("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" ")), o("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")), o("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]), o("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" ")), o("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" ")), o("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" ")); var Xl = "abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "), cT = new Set("cancel close invalid load scroll toggle".split(" ").concat(Xl)); function rw(s, a, c) { var m = s.type || "unknown-event"; s.currentTarget = c, Ho(m, a, void 0, s), s.currentTarget = null; } function iw(s, a) { a = (a & 4) !== 0; for (var c = 0; c < s.length; c++) { var m = s[c], w = m.event; m = m.listeners; e: { var _ = void 0; if (a) for (var I = m.length - 1; 0 <= I; I--) { var V = m[I], G = V.instance, me = V.currentTarget; if (V = V.listener, G !== _ && w.isPropagationStopped()) break e; rw(w, V, me), _ = G; } else for (I = 0; I < m.length; I++) { if (V = m[I], G = V.instance, me = V.currentTarget, V = V.listener, G !== _ && w.isPropagationStopped()) break e; rw(w, V, me), _ = G; } } } if (co) throw s = qo, co = !1, qo = null, s; } function fn(s, a) { var c = a[am]; c === void 0 && (c = a[am] = /* @__PURE__ */ new Set()); var m = s + "__bubble"; c.has(m) || (ow(a, s, 2, !1), c.add(m)); } function em(s, a, c) { var m = 0; a && (m |= 4), ow(c, s, m, a); } var ef = "_reactListening" + Math.random().toString(36).slice(2); function Zl(s) { if (!s[ef]) { s[ef] = !0, r.forEach(function(c) { c !== "selectionchange" && (cT.has(c) || em(c, !1, s), em(c, !0, s)); }); var a = s.nodeType === 9 ? s : s.ownerDocument; a === null || a[ef] || (a[ef] = !0, em("selectionchange", !1, a)); } } function ow(s, a, c, m) { switch ($d(a)) { case 1: var w = Kp; break; case 4: w = Gp; break; default: w = Zo; } c = w.bind(null, a, c, s), w = void 0, !zo || a !== "touchstart" && a !== "touchmove" && a !== "wheel" || (w = !0), m ? w !== void 0 ? s.addEventListener(a, c, { capture: !0, passive: w }) : s.addEventListener(a, c, !0) : w !== void 0 ? s.addEventListener(a, c, { passive: w }) : s.addEventListener(a, c, !1); } function tm(s, a, c, m, w) { var _ = m; if ((a & 1) === 0 && (a & 2) === 0 && m !== null) e: for (; ; ) { if (m === null) return; var I = m.tag; if (I === 3 || I === 4) { var V = m.stateNode.containerInfo; if (V === w || V.nodeType === 8 && V.parentNode === w) break; if (I === 4) for (I = m.return; I !== null; ) { var G = I.tag; if ((G === 3 || G === 4) && (G = I.stateNode.containerInfo, G === w || G.nodeType === 8 && G.parentNode === w)) return; I = I.return; } for (; V !== null; ) { if (I = ua(V), I === null) return; if (G = I.tag, G === 5 || G === 6) { m = _ = I; continue e; } V = V.parentNode; } } m = m.return; } ao(function() { var me = _, Ue = Vo(c), Be = []; e: { var Fe = On.get(s); if (Fe !== void 0) { var tt = Hl, st = s; switch (s) { case "keypress": if (Xs(c) === 0) break e; case "keydown": case "keyup": tt = Yp; break; case "focusin": st = "focus", tt = mu; break; case "focusout": st = "blur", tt = mu; break; case "beforeblur": case "afterblur": tt = mu; break; case "click": if (c.button === 2) break e; case "auxclick": case "dblclick": case "mousedown": case "mousemove": case "mouseup": case "mouseout": case "mouseover": case "contextmenu": tt = ts; break; case "drag": case "dragend": case "dragenter": case "dragexit": case "dragleave": case "dragover": case "dragstart": case "drop": tt = Vd; break; case "touchcancel": case "touchend": case "touchmove": case "touchstart": tt = Hd; break; case Nt: case Jn: case bt: tt = gu; break; case Rn: tt = Kd; break; case "scroll": tt = Kl; break; case "wheel": tt = Xp; break; case "copy": case "cut": case "paste": tt = wo; break; case "gotpointercapture": case "lostpointercapture": case "pointercancel": case "pointerdown": case "pointermove": case "pointerout": case "pointerover": case "pointerup": tt = Su; } var lt = (a & 4) !== 0, En = !lt && s === "scroll", le = lt ? Fe !== null ? Fe + "Capture" : null : Fe; lt = []; for (var X = me, he; X !== null; ) { he = X; var Ke = he.stateNode; if (he.tag === 5 && Ke !== null && (he = Ke, le !== null && (Ke = uo(X, le), Ke != null && lt.push(ec(X, Ke, he)))), En) break; X = X.return; } 0 < lt.length && (Fe = new tt(Fe, st, null, c, Ue), Be.push({ event: Fe, listeners: lt })); } } if ((a & 7) === 0) { e: { if (Fe = s === "mouseover" || s === "pointerover", tt = s === "mouseout" || s === "pointerout", Fe && c !== li && (st = c.relatedTarget || c.fromElement) && (ua(st) || st[_o])) break e; if ((tt || Fe) && (Fe = Ue.window === Ue ? Ue : (Fe = Ue.ownerDocument) ? Fe.defaultView || Fe.parentWindow : window, tt ? (st = c.relatedTarget || c.toElement, tt = me, st = st ? ua(st) : null, st !== null && (En = Wn(st), st !== En || st.tag !== 5 && st.tag !== 6) && (st = null)) : (tt = null, st = me), tt !== st)) { if (lt = ts, Ke = "onMouseLeave", le = "onMouseEnter", X = "mouse", (s === "pointerout" || s === "pointerover") && (lt = Su, Ke = "onPointerLeave", le = "onPointerEnter", X = "pointer"), En = tt == null ? Fe : Au(tt), he = st == null ? Fe : Au(st), Fe = new lt(Ke, X + "leave", tt, c, Ue), Fe.target = En, Fe.relatedTarget = he, Ke = null, ua(Ue) === me && (lt = new lt(le, X + "enter", st, c, Ue), lt.target = he, lt.relatedTarget = En, Ke = lt), En = Ke, tt && st) t: { for (lt = tt, le = st, X = 0, he = lt; he; he = ku(he)) X++; for (he = 0, Ke = le; Ke; Ke = ku(Ke)) he++; for (; 0 < X - he; ) lt = ku(lt), X--; for (; 0 < he - X; ) le = ku(le), he--; for (; X--; ) { if (lt === le || le !== null && lt === le.alternate) break t; lt = ku(lt), le = ku(le); } lt = null; } else lt = null; tt !== null && sw(Be, Fe, tt, lt, !1), st !== null && En !== null && sw(Be, En, st, lt, !0); } } e: { if (Fe = me ? Au(me) : window, tt = Fe.nodeName && Fe.nodeName.toLowerCase(), tt === "select" || tt === "input" && Fe.type === "file") var ct = Zd; else if (bu(Fe)) if (h) ct = J; else { ct = z; var pt = U; } else (tt = Fe.nodeName) && tt.toLowerCase() === "input" && (Fe.type === "checkbox" || Fe.type === "radio") && (ct = W); if (ct && (ct = ct(s, me))) { Jl(Be, ct, c, Ue); break e; } pt && pt(s, Fe, me), s === "focusout" && (pt = Fe._wrapperState) && pt.controlled && Fe.type === "number" && x(Fe, "number", Fe.value); } switch (pt = me ? Au(me) : window, s) { case "focusin": (bu(pt) || pt.contentEditable === "true") && (ke = pt, $e = me, We = null); break; case "focusout": We = $e = ke = null; break; case "mousedown": Ve = !0; break; case "contextmenu": case "mouseup": case "dragend": Ve = !1, qe(Be, c, Ue); break; case "selectionchange": if (ye) break; case "keydown": case "keyup": qe(Be, c, Ue); } var mt; if (ia) e: { switch (s) { case "compositionstart": var St = "onCompositionStart"; break e; case "compositionend": St = "onCompositionEnd"; break e; case "compositionupdate": St = "onCompositionUpdate"; break e; } St = void 0; } else Jt ? oa(s, c) && (St = "onCompositionEnd") : s === "keydown" && c.keyCode === 229 && (St = "onCompositionStart"); St && (Qd && c.locale !== "ko" && (Jt || St !== "onCompositionStart" ? St === "onCompositionEnd" && Jt && (mt = hu()) : (Hi = Ue, ql = "value" in Hi ? Hi.value : Hi.textContent, Jt = !0)), pt = tf(me, St), 0 < pt.length && (St = new vu(St, s, null, c, Ue), Be.push({ event: St, listeners: pt }), mt ? St.data = mt : (mt = Gr(c), mt !== null && (St.data = mt)))), (mt = Yd ? _u(s, c) : hr(s, c)) && (me = tf(me, "onBeforeInput"), 0 < me.length && (Ue = new vu("onBeforeInput", "beforeinput", null, c, Ue), Be.push({ event: Ue, listeners: me }), Ue.data = mt)); } iw(Be, a); }); } function ec(s, a, c) { return { instance: s, listener: a, currentTarget: c }; } function tf(s, a) { for (var c = a + "Capture", m = []; s !== null; ) { var w = s, _ = w.stateNode; w.tag === 5 && _ !== null && (w = _, _ = uo(s, c), _ != null && m.unshift(ec(s, _, w)), _ = uo(s, a), _ != null && m.push(ec(s, _, w))), s = s.return; } return m; } function ku(s) { if (s === null) return null; do s = s.return; while (s && s.tag !== 5); return s || null; } function sw(s, a, c, m, w) { for (var _ = a._reactName, I = []; c !== null && c !== m; ) { var V = c, G = V.alternate, me = V.stateNode; if (G !== null && G === m) break; V.tag === 5 && me !== null && (V = me, w ? (G = uo(c, _), G != null && I.unshift(ec(c, G, V))) : w || (G = uo(c, _), G != null && I.push(ec(c, G, V)))), c = c.return; } I.length !== 0 && s.push({ event: a, listeners: I }); } var dT = /\r\n?/g, fT = /\u0000|\uFFFD/g; function aw(s) { return (typeof s == "string" ? s : "" + s).replace(dT, ` `).replace(fT, ""); } function nf(s, a, c) { if (a = aw(a), aw(s) !== a && c) throw Error(n(425)); } function rf() { } var nm = null, rm = null; function im(s, a) { return s === "textarea" || s === "noscript" || typeof a.children == "string" || typeof a.children == "number" || typeof a.dangerouslySetInnerHTML == "object" && a.dangerouslySetInnerHTML !== null && a.dangerouslySetInnerHTML.__html != null; } var om = typeof setTimeout == "function" ? setTimeout : void 0, hT = typeof clearTimeout == "function" ? clearTimeout : void 0, uw = typeof Promise == "function" ? Promise : void 0, pT = typeof queueMicrotask == "function" ? queueMicrotask : typeof uw < "u" ? function(s) { return uw.resolve(null).then(s).catch(mT); } : om; function mT(s) { setTimeout(function() { throw s; }); } function sm(s, a) { var c = a, m = 0; do { var w = c.nextSibling; if (s.removeChild(c), w && w.nodeType === 8) if (c = w.data, c === "/$") { if (m === 0) { s.removeChild(w), Jo(a); return; } m--; } else c !== "$" && c !== "$?" && c !== "$!" || m++; c = w; } while (c); Jo(a); } function is(s) { for (; s != null; s = s.nextSibling) { var a = s.nodeType; if (a === 1 || a === 3) break; if (a === 8) { if (a = s.data, a === "$" || a === "$!" || a === "$?") break; if (a === "/$") return null; } } return s; } function lw(s) { s = s.previousSibling; for (var a = 0; s; ) { if (s.nodeType === 8) { var c = s.data; if (c === "$" || c === "$!" || c === "$?") { if (a === 0) return s; a--; } else c === "/$" && a++; } s = s.previousSibling; } return null; } var Eu = Math.random().toString(36).slice(2), Gi = "__reactFiber$" + Eu, tc = "__reactProps$" + Eu, _o = "__reactContainer$" + Eu, am = "__reactEvents$" + Eu, gT = "__reactListeners$" + Eu, vT = "__reactHandles$" + Eu; function ua(s) { var a = s[Gi]; if (a) return a; for (var c = s.parentNode; c; ) { if (a = c[_o] || c[Gi]) { if (c = a.alternate, a.child !== null || c !== null && c.child !== null) for (s = lw(s); s !== null; ) { if (c = s[Gi]) return c; s = lw(s); } return a; } s = c, c = s.parentNode; } return null; } function nc(s) { return s = s[Gi] || s[_o], !s || s.tag !== 5 && s.tag !== 6 && s.tag !== 13 && s.tag !== 3 ? null : s; } function Au(s) { if (s.tag === 5 || s.tag === 6) return s.stateNode; throw Error(n(33)); } function of(s) { return s[tc] || null; } var um = [], Cu = -1; function os(s) { return { current: s }; } function hn(s) { 0 > Cu || (s.current = um[Cu], um[Cu] = null, Cu--); } function un(s, a) { Cu++, um[Cu] = s.current, s.current = a; } var ss = {}, Xn = os(ss), pr = os(!1), la = ss; function xu(s, a) { var c = s.type.contextTypes; if (!c) return ss; var m = s.stateNode; if (m && m.__reactInternalMemoizedUnmaskedChildContext === a) return m.__reactInternalMemoizedMaskedChildContext; var w = {}, _; for (_ in c) w[_] = a[_]; return m && (s = s.stateNode, s.__reactInternalMemoizedUnmaskedChildContext = a, s.__reactInternalMemoizedMaskedChildContext = w), w; } function mr(s) { return s = s.childContextTypes, s != null; } function sf() { hn(pr), hn(Xn); } function cw(s, a, c) { if (Xn.current !== ss) throw Error(n(168)); un(Xn, a), un(pr, c); } function dw(s, a, c) { var m = s.stateNode; if (a = a.childContextTypes, typeof m.getChildContext != "function") return c; m = m.getChildContext(); for (var w in m) if (!(w in a)) throw Error(n(108, Ie(s) || "Unknown", w)); return B({}, c, m); } function af(s) { return s = (s = s.stateNode) && s.__reactInternalMemoizedMergedChildContext || ss, la = Xn.current, un(Xn, s), un(pr, pr.current), !0; } function fw(s, a, c) { var m = s.stateNode; if (!m) throw Error(n(169)); c ? (s = dw(s, a, la), m.__reactInternalMemoizedMergedChildContext = s, hn(pr), hn(Xn), un(Xn, s)) : hn(pr), un(pr, c); } var bo = null, uf = !1, lm = !1; function hw(s) { bo === null ? bo = [s] : bo.push(s); } function yT(s) { uf = !0, hw(s); } function as() { if (!lm && bo !== null) { lm = !0; var s = 0, a = Kt; try { var c = bo; for (Kt = 1; s < c.length; s++) { var m = c[s]; do m = m(!0); while (m !== null); } bo = null, uf = !1; } catch (w) { throw bo !== null && (bo = bo.slice(s + 1)), Ul($i, as), w; } finally { Kt = a, lm = !1; } } return null; } var Nu = [], Tu = 0, lf = null, cf = 0, Wr = [], Yr = 0, ca = null, ko = 1, Eo = ""; function da(s, a) { Nu[Tu++] = cf, Nu[Tu++] = lf, lf = s, cf = a; } function pw(s, a, c) { Wr[Yr++] = ko, Wr[Yr++] = Eo, Wr[Yr++] = ca, ca = s; var m = ko; s = Eo; var w = 32 - wt(m) - 1; m &= ~(1 << w), c += 1; var _ = 32 - wt(a) + w; if (30 < _) { var I = w - w % 5; _ = (m & (1 << I) - 1).toString(32), m >>= I, w -= I, ko = 1 << 32 - wt(a) + w | c << w | m, Eo = _ + s; } else ko = 1 << _ | c << w | m, Eo = s; } function cm(s) { s.return !== null && (da(s, 1), pw(s, 1, 0)); } function dm(s) { for (; s === lf; ) lf = Nu[--Tu], Nu[Tu] = null, cf = Nu[--Tu], Nu[Tu] = null; for (; s === ca; ) ca = Wr[--Yr], Wr[Yr] = null, Eo = Wr[--Yr], Wr[Yr] = null, ko = Wr[--Yr], Wr[Yr] = null; } var Dr = null, Fr = null, gn = !1, vi = null; function mw(s, a) { var c = Zr(5, null, null, 0); c.elementType = "DELETED", c.stateNode = a, c.return = s, a = s.deletions, a === null ? (s.deletions = [c], s.flags |= 16) : a.push(c); } function gw(s, a) { switch (s.tag) { case 5: var c = s.type; return a = a.nodeType !== 1 || c.toLowerCase() !== a.nodeName.toLowerCase() ? null : a, a !== null ? (s.stateNode = a, Dr = s, Fr = is(a.firstChild), !0) : !1; case 6: return a = s.pendingProps === "" || a.nodeType !== 3 ? null : a, a !== null ? (s.stateNode = a, Dr = s, Fr = null, !0) : !1; case 13: return a = a.nodeType !== 8 ? null : a, a !== null ? (c = ca !== null ? { id: ko, overflow: Eo } : null, s.memoizedState = { dehydrated: a, treeContext: c, retryLane: 1073741824 }, c = Zr(18, null, null, 0), c.stateNode = a, c.return = s, s.child = c, Dr = s, Fr = null, !0) : !1; default: return !1; } } function fm(s) { return (s.mode & 1) !== 0 && (s.flags & 128) === 0; } function hm(s) { if (gn) { var a = Fr; if (a) { var c = a; if (!gw(s, a)) { if (fm(s)) throw Error(n(418)); a = is(c.nextSibling); var m = Dr; a && gw(s, a) ? mw(m, c) : (s.flags = s.flags & -4097 | 2, gn = !1, Dr = s); } } else { if (fm(s)) throw Error(n(418)); s.flags = s.flags & -4097 | 2, gn = !1, Dr = s; } } } function vw(s) { for (s = s.return; s !== null && s.tag !== 5 && s.tag !== 3 && s.tag !== 13; ) s = s.return; Dr = s; } function df(s) { if (s !== Dr) return !1; if (!gn) return vw(s), gn = !0, !1; var a; if ((a = s.tag !== 3) && !(a = s.tag !== 5) && (a = s.type, a = a !== "head" && a !== "body" && !im(s.type, s.memoizedProps)), a && (a = Fr)) { if (fm(s)) throw yw(), Error(n(418)); for (; a; ) mw(s, a), a = is(a.nextSibling); } if (vw(s), s.tag === 13) { if (s = s.memoizedState, s = s !== null ? s.dehydrated : null, !s) throw Error(n(317)); e: { for (s = s.nextSibling, a = 0; s; ) { if (s.nodeType === 8) { var c = s.data; if (c === "/$") { if (a === 0) { Fr = is(s.nextSibling); break e; } a--; } else c !== "$" && c !== "$!" && c !== "$?" || a++; } s = s.nextSibling; } Fr = null; } } else Fr = Dr ? is(s.stateNode.nextSibling) : null; return !0; } function yw() { for (var s = Fr; s; ) s = is(s.nextSibling); } function Iu() { Fr = Dr = null, gn = !1; } function pm(s) { vi === null ? vi = [s] : vi.push(s); } var wT = j.ReactCurrentBatchConfig; function rc(s, a, c) { if (s = c.ref, s !== null && typeof s != "function" && typeof s != "object") { if (c._owner) { if (c = c._owner, c) { if (c.tag !== 1) throw Error(n(309)); var m = c.stateNode; } if (!m) throw Error(n(147, s)); var w = m, _ = "" + s; return a !== null && a.ref !== null && typeof a.ref == "function" && a.ref._stringRef === _ ? a.ref : (a = function(I) { var V = w.refs; I === null ? delete V[_] : V[_] = I; }, a._stringRef = _, a); } if (typeof s != "string") throw Error(n(284)); if (!c._owner) throw Error(n(290, s)); } return s; } function ff(s, a) { throw s = Object.prototype.toString.call(a), Error(n(31, s === "[object Object]" ? "object with keys {" + Object.keys(a).join(", ") + "}" : s)); } function ww(s) { var a = s._init; return a(s._payload); } function Sw(s) { function a(le, X) { if (s) { var he = le.deletions; he === null ? (le.deletions = [X], le.flags |= 16) : he.push(X); } } function c(le, X) { if (!s) return null; for (; X !== null; ) a(le, X), X = X.sibling; return null; } function m(le, X) { for (le = /* @__PURE__ */ new Map(); X !== null; ) X.key !== null ? le.set(X.key, X) : le.set(X.index, X), X = X.sibling; return le; } function w(le, X) { return le = ms(le, X), le.index = 0, le.sibling = null, le; } function _(le, X, he) { return le.index = he, s ? (he = le.alternate, he !== null ? (he = he.index, he < X ? (le.flags |= 2, X) : he) : (le.flags |= 2, X)) : (le.flags |= 1048576, X); } function I(le) { return s && le.alternate === null && (le.flags |= 2), le; } function V(le, X, he, Ke) { return X === null || X.tag !== 6 ? (X = og(he, le.mode, Ke), X.return = le, X) : (X = w(X, he), X.return = le, X); } function G(le, X, he, Ke) { var ct = he.type; return ct === de ? Ue(le, X, he.props.children, Ke, he.key) : X !== null && (X.elementType === ct || typeof ct == "object" && ct !== null && ct.$$typeof === be && ww(ct) === X.type) ? (Ke = w(X, he.props), Ke.ref = rc(le, X, he), Ke.return = le, Ke) : (Ke = Lf(he.type, he.key, he.props, null, le.mode, Ke), Ke.ref = rc(le, X, he), Ke.return = le, Ke); } function me(le, X, he, Ke) { return X === null || X.tag !== 4 || X.stateNode.containerInfo !== he.containerInfo || X.stateNode.implementation !== he.implementation ? (X = sg(he, le.mode, Ke), X.return = le, X) : (X = w(X, he.children || []), X.return = le, X); } function Ue(le, X, he, Ke, ct) { return X === null || X.tag !== 7 ? (X = wa(he, le.mode, Ke, ct), X.return = le, X) : (X = w(X, he), X.return = le, X); } function Be(le, X, he) { if (typeof X == "string" && X !== "" || typeof X == "number") return X = og("" + X, le.mode, he), X.return = le, X; if (typeof X == "object" && X !== null) { switch (X.$$typeof) { case K: return he = Lf(X.type, X.key, X.props, null, le.mode, he), he.ref = rc(le, null, X), he.return = le, he; case ue: return X = sg(X, le.mode, he), X.return = le, X; case be: var Ke = X._init; return Be(le, Ke(X._payload), he); } if (b(X) || Ee(X)) return X = wa(X, le.mode, he, null), X.return = le, X; ff(le, X); } return null; } function Fe(le, X, he, Ke) { var ct = X !== null ? X.key : null; if (typeof he == "string" && he !== "" || typeof he == "number") return ct !== null ? null : V(le, X, "" + he, Ke); if (typeof he == "object" && he !== null) { switch (he.$$typeof) { case K: return he.key === ct ? G(le, X, he, Ke) : null; case ue: return he.key === ct ? me(le, X, he, Ke) : null; case be: return ct = he._init, Fe( le, X, ct(he._payload), Ke ); } if (b(he) || Ee(he)) return ct !== null ? null : Ue(le, X, he, Ke, null); ff(le, he); } return null; } function tt(le, X, he, Ke, ct) { if (typeof Ke == "string" && Ke !== "" || typeof Ke == "number") return le = le.get(he) || null, V(X, le, "" + Ke, ct); if (typeof Ke == "object" && Ke !== null) { switch (Ke.$$typeof) { case K: return le = le.get(Ke.key === null ? he : Ke.key) || null, G(X, le, Ke, ct); case ue: return le = le.get(Ke.key === null ? he : Ke.key) || null, me(X, le, Ke, ct); case be: var pt = Ke._init; return tt(le, X, he, pt(Ke._payload), ct); } if (b(Ke) || Ee(Ke)) return le = le.get(he) || null, Ue(X, le, Ke, ct, null); ff(X, Ke); } return null; } function st(le, X, he, Ke) { for (var ct = null, pt = null, mt = X, St = X = 0, Mn = null; mt !== null && St < he.length; St++) { mt.index > St ? (Mn = mt, mt = null) : Mn = mt.sibling; var jt = Fe(le, mt, he[St], Ke); if (jt === null) { mt === null && (mt = Mn); break; } s && mt && jt.alternate === null && a(le, mt), X = _(jt, X, St), pt === null ? ct = jt : pt.sibling = jt, pt = jt, mt = Mn; } if (St === he.length) return c(le, mt), gn && da(le, St), ct; if (mt === null) { for (; St < he.length; St++) mt = Be(le, he[St], Ke), mt !== null && (X = _(mt, X, St), pt === null ? ct = mt : pt.sibling = mt, pt = mt); return gn && da(le, St), ct; } for (mt = m(le, mt); St < he.length; St++) Mn = tt(mt, le, St, he[St], Ke), Mn !== null && (s && Mn.alternate !== null && mt.delete(Mn.key === null ? St : Mn.key), X = _(Mn, X, St), pt === null ? ct = Mn : pt.sibling = Mn, pt = Mn); return s && mt.forEach(function(gs) { return a(le, gs); }), gn && da(le, St), ct; } function lt(le, X, he, Ke) { var ct = Ee(he); if (typeof ct != "function") throw Error(n(150)); if (he = ct.call(he), he == null) throw Error(n(151)); for (var pt = ct = null, mt = X, St = X = 0, Mn = null, jt = he.next(); mt !== null && !jt.done; St++, jt = he.next()) { mt.index > St ? (Mn = mt, mt = null) : Mn = mt.sibling; var gs = Fe(le, mt, jt.value, Ke); if (gs === null) { mt === null && (mt = Mn); break; } s && mt && gs.alternate === null && a(le, mt), X = _(gs, X, St), pt === null ? ct = gs : pt.sibling = gs, pt = gs, mt = Mn; } if (jt.done) return c( le, mt ), gn && da(le, St), ct; if (mt === null) { for (; !jt.done; St++, jt = he.next()) jt = Be(le, jt.value, Ke), jt !== null && (X = _(jt, X, St), pt === null ? ct = jt : pt.sibling = jt, pt = jt); return gn && da(le, St), ct; } for (mt = m(le, mt); !jt.done; St++, jt = he.next()) jt = tt(mt, le, St, jt.value, Ke), jt !== null && (s && jt.alternate !== null && mt.delete(jt.key === null ? St : jt.key), X = _(jt, X, St), pt === null ? ct = jt : pt.sibling = jt, pt = jt); return s && mt.forEach(function(XT) { return a(le, XT); }), gn && da(le, St), ct; } function En(le, X, he, Ke) { if (typeof he == "object" && he !== null && he.type === de && he.key === null && (he = he.props.children), typeof he == "object" && he !== null) { switch (he.$$typeof) { case K: e: { for (var ct = he.key, pt = X; pt !== null; ) { if (pt.key === ct) { if (ct = he.type, ct === de) { if (pt.tag === 7) { c(le, pt.sibling), X = w(pt, he.props.children), X.return = le, le = X; break e; } } else if (pt.elementType === ct || typeof ct == "object" && ct !== null && ct.$$typeof === be && ww(ct) === pt.type) { c(le, pt.sibling), X = w(pt, he.props), X.ref = rc(le, pt, he), X.return = le, le = X; break e; } c(le, pt); break; } else a(le, pt); pt = pt.sibling; } he.type === de ? (X = wa(he.props.children, le.mode, Ke, he.key), X.return = le, le = X) : (Ke = Lf(he.type, he.key, he.props, null, le.mode, Ke), Ke.ref = rc(le, X, he), Ke.return = le, le = Ke); } return I(le); case ue: e: { for (pt = he.key; X !== null; ) { if (X.key === pt) if (X.tag === 4 && X.stateNode.containerInfo === he.containerInfo && X.stateNode.implementation === he.implementation) { c(le, X.sibling), X = w(X, he.children || []), X.return = le, le = X; break e; } else { c(le, X); break; } else a(le, X); X = X.sibling; } X = sg(he, le.mode, Ke), X.return = le, le = X; } return I(le); case be: return pt = he._init, En(le, X, pt(he._payload), Ke); } if (b(he)) return st(le, X, he, Ke); if (Ee(he)) return lt(le, X, he, Ke); ff(le, he); } return typeof he == "string" && he !== "" || typeof he == "number" ? (he = "" + he, X !== null && X.tag === 6 ? (c(le, X.sibling), X = w(X, he), X.return = le, le = X) : (c(le, X), X = og(he, le.mode, Ke), X.return = le, le = X), I(le)) : c(le, X); } return En; } var Ru = Sw(!0), _w = Sw(!1), hf = os(null), pf = null, Ou = null, mm = null; function gm() { mm = Ou = pf = null; } function vm(s) { var a = hf.current; hn(hf), s._currentValue = a; } function ym(s, a, c) { for (; s !== null; ) { var m = s.alternate; if ((s.childLanes & a) !== a ? (s.childLanes |= a, m !== null && (m.childLanes |= a)) : m !== null && (m.childLanes & a) !== a && (m.childLanes |= a), s === c) break; s = s.return; } } function Pu(s, a) { pf = s, mm = Ou = null, s = s.dependencies, s !== null && s.firstContext !== null && ((s.lanes & a) !== 0 && (gr = !0), s.firstContext = null); } function Qr(s) { var a = s._currentValue; if (mm !== s) if (s = { context: s, memoizedValue: a, next: null }, Ou === null) { if (pf === null) throw Error(n(308)); Ou = s, pf.dependencies = { lanes: 0, firstContext: s }; } else Ou = Ou.next = s; return a; } var fa = null; function wm(s) { fa === null ? fa = [s] : fa.push(s); } function bw(s, a, c, m) { var w = a.interleaved; return w === null ? (c.next = c, wm(a)) : (c.next = w.next, w.next = c), a.interleaved = c, Ao(s, m); } function Ao(s, a) { s.lanes |= a; var c = s.alternate; for (c !== null && (c.lanes |= a), c = s, s = s.return; s !== null; ) s.childLanes |= a, c = s.alternate, c !== null && (c.childLanes |= a), c = s, s = s.return; return c.tag === 3 ? c.stateNode : null; } var us = !1; function Sm(s) { s.updateQueue = { baseState: s.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: 0 }, effects: null }; } function kw(s, a) { s = s.updateQueue, a.updateQueue === s && (a.updateQueue = { baseState: s.baseState, firstBaseUpdate: s.firstBaseUpdate, lastBaseUpdate: s.lastBaseUpdate, shared: s.shared, effects: s.effects }); } function Co(s, a) { return { eventTime: s, lane: a, tag: 0, payload: null, callback: null, next: null }; } function ls(s, a, c) { var m = s.updateQueue; if (m === null) return null; if (m = m.shared, (Bt & 2) !== 0) { var w = m.pending; return w === null ? a.next = a : (a.next = w.next, w.next = a), m.pending = a, Ao(s, c); } return w = m.interleaved, w === null ? (a.next = a, wm(m)) : (a.next = w.next, w.next = a), m.interleaved = a, Ao(s, c); } function mf(s, a, c) { if (a = a.updateQueue, a !== null && (a = a.shared, (c & 4194240) !== 0)) { var m = a.lanes; m &= s.pendingLanes, c |= m, a.lanes = c, lu(s, c); } } function Ew(s, a) { var c = s.updateQueue, m = s.alternate; if (m !== null && (m = m.updateQueue, c === m)) { var w = null, _ = null; if (c = c.firstBaseUpdate, c !== null) { do { var I = { eventTime: c.eventTime, lane: c.lane, tag: c.tag, payload: c.payload, callback: c.callback, next: null }; _ === null ? w = _ = I : _ = _.next = I, c = c.next; } while (c !== null); _ === null ? w = _ = a : _ = _.next = a; } else w = _ = a; c = { baseState: m.baseState, firstBaseUpdate: w, lastBaseUpdate: _, shared: m.shared, effects: m.effects }, s.updateQueue = c; return; } s = c.lastBaseUpdate, s === null ? c.firstBaseUpdate = a : s.next = a, c.lastBaseUpdate = a; } function gf(s, a, c, m) { var w = s.updateQueue; us = !1; var _ = w.firstBaseUpdate, I = w.lastBaseUpdate, V = w.shared.pending; if (V !== null) { w.shared.pending = null; var G = V, me = G.next; G.next = null, I === null ? _ = me : I.next = me, I = G; var Ue = s.alternate; Ue !== null && (Ue = Ue.updateQueue, V = Ue.lastBaseUpdate, V !== I && (V === null ? Ue.firstBaseUpdate = me : V.next = me, Ue.lastBaseUpdate = G)); } if (_ !== null) { var Be = w.baseState; I = 0, Ue = me = G = null, V = _; do { var Fe = V.lane, tt = V.eventTime; if ((m & Fe) === Fe) { Ue !== null && (Ue = Ue.next = { eventTime: tt, lane: 0, tag: V.tag, payload: V.payload, callback: V.callback, next: null }); e: { var st = s, lt = V; switch (Fe = a, tt = c, lt.tag) { case 1: if (st = lt.payload, typeof st == "function") { Be = st.call(tt, Be, Fe); break e; } Be = st; break e; case 3: st.flags = st.flags & -65537 | 128; case 0: if (st = lt.payload, Fe = typeof st == "function" ? st.call(tt, Be, Fe) : st, Fe == null) break e; Be = B({}, Be, Fe); break e; case 2: us = !0; } } V.callback !== null && V.lane !== 0 && (s.flags |= 64, Fe = w.effects, Fe === null ? w.effects = [V] : Fe.push(V)); } else tt = { eventTime: tt, lane: Fe, tag: V.tag, payload: V.payload, callback: V.callback, next: null }, Ue === null ? (me = Ue = tt, G = Be) : Ue = Ue.next = tt, I |= Fe; if (V = V.next, V === null) { if (V = w.shared.pending, V === null) break; Fe = V, V = Fe.next, Fe.next = null, w.lastBaseUpdate = Fe, w.shared.pending = null; } } while (!0); if (Ue === null && (G = Be), w.baseState = G, w.firstBaseUpdate = me, w.lastBaseUpdate = Ue, a = w.shared.interleaved, a !== null) { w = a; do I |= w.lane, w = w.next; while (w !== a); } else _ === null && (w.shared.lanes = 0); ma |= I, s.lanes = I, s.memoizedState = Be; } } function Aw(s, a, c) { if (s = a.effects, a.effects = null, s !== null) for (a = 0; a < s.length; a++) { var m = s[a], w = m.callback; if (w !== null) { if (m.callback = null, m = c, typeof w != "function") throw Error(n(191, w)); w.call(m); } } } var ic = {}, Wi = os(ic), oc = os(ic), sc = os(ic); function ha(s) { if (s === ic) throw Error(n(174)); return s; } function _m(s, a) { switch (un(sc, a), un(oc, s), un(Wi, ic), s = a.nodeType, s) { case 9: case 11: a = (a = a.documentElement) ? a.namespaceURI : Ft(null, ""); break; default: s = s === 8 ? a.parentNode : a, a = s.namespaceURI || null, s = s.tagName, a = Ft(a, s); } hn(Wi), un(Wi, a); } function Du() { hn(Wi), hn(oc), hn(sc); } function Cw(s) { ha(sc.current); var a = ha(Wi.current), c = Ft(a, s.type); a !== c && (un(oc, s), un(Wi, c)); } function bm(s) { oc.current === s && (hn(Wi), hn(oc)); } var yn = os(0); function vf(s) { for (var a = s; a !== null; ) { if (a.tag === 13) { var c = a.memoizedState; if (c !== null && (c = c.dehydrated, c === null || c.data === "$?" || c.data === "$!")) return a; } else if (a.tag === 19 && a.memoizedProps.revealOrder !== void 0) { if ((a.flags & 128) !== 0) return a; } else if (a.child !== null) { a.child.return = a, a = a.child; continue; } if (a === s) break; for (; a.sibling === null; ) { if (a.return === null || a.return === s) return null; a = a.return; } a.sibling.return = a.return, a = a.sibling; } return null; } var km = []; function Em() { for (var s = 0; s < km.length; s++) km[s]._workInProgressVersionPrimary = null; km.length = 0; } var yf = j.ReactCurrentDispatcher, Am = j.ReactCurrentBatchConfig, pa = 0, wn = null, Pn = null, Ln = null, wf = !1, ac = !1, uc = 0, ST = 0; function Zn() { throw Error(n(321)); } function Cm(s, a) { if (a === null) return !1; for (var c = 0; c < a.length && c < s.length; c++) if (!q(s[c], a[c])) return !1; return !0; } function xm(s, a, c, m, w, _) { if (pa = _, wn = a, a.memoizedState = null, a.updateQueue = null, a.lanes = 0, yf.current = s === null || s.memoizedState === null ? ET : AT, s = c(m, w), ac) { _ = 0; do { if (ac = !1, uc = 0, 25 <= _) throw Error(n(301)); _ += 1, Ln = Pn = null, a.updateQueue = null, yf.current = CT, s = c(m, w); } while (ac); } if (yf.current = bf, a = Pn !== null && Pn.next !== null, pa = 0, Ln = Pn = wn = null, wf = !1, a) throw Error(n(300)); return s; } function Nm() { var s = uc !== 0; return uc = 0, s; } function Yi() { var s = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null }; return Ln === null ? wn.memoizedState = Ln = s : Ln = Ln.next = s, Ln; } function Jr() { if (Pn === null) { var s = wn.alternate; s = s !== null ? s.memoizedState : null; } else s = Pn.next; var a = Ln === null ? wn.memoizedState : Ln.next; if (a !== null) Ln = a, Pn = s; else { if (s === null) throw Error(n(310)); Pn = s, s = { memoizedState: Pn.memoizedState, baseState: Pn.baseState, baseQueue: Pn.baseQueue, queue: Pn.queue, next: null }, Ln === null ? wn.memoizedState = Ln = s : Ln = Ln.next = s; } return Ln; } function lc(s, a) { return typeof a == "function" ? a(s) : a; } function Tm(s) { var a = Jr(), c = a.queue; if (c === null) throw Error(n(311)); c.lastRenderedReducer = s; var m = Pn, w = m.baseQueue, _ = c.pending; if (_ !== null) { if (w !== null) { var I = w.next; w.next = _.next, _.next = I; } m.baseQueue = w = _, c.pending = null; } if (w !== null) { _ = w.next, m = m.baseState; var V = I = null, G = null, me = _; do { var Ue = me.lane; if ((pa & Ue) === Ue) G !== null && (G = G.next = { lane: 0, action: me.action, hasEagerState: me.hasEagerState, eagerState: me.eagerState, next: null }), m = me.hasEagerState ? me.eagerState : s(m, me.action); else { var Be = { lane: Ue, action: me.action, hasEagerState: me.hasEagerState, eagerState: me.eagerState, next: null }; G === null ? (V = G = Be, I = m) : G = G.next = Be, wn.lanes |= Ue, ma |= Ue; } me = me.next; } while (me !== null && me !== _); G === null ? I = m : G.next = V, q(m, a.memoizedState) || (gr = !0), a.memoizedState = m, a.baseState = I, a.baseQueue = G, c.lastRenderedState = m; } if (s = c.interleaved, s !== null) { w = s; do _ = w.lane, wn.lanes |= _, ma |= _, w = w.next; while (w !== s); } else w === null && (c.lanes = 0); return [a.memoizedState, c.dispatch]; } function Im(s) { var a = Jr(), c = a.queue; if (c === null) throw Error(n(311)); c.lastRenderedReducer = s; var m = c.dispatch, w = c.pending, _ = a.memoizedState; if (w !== null) { c.pending = null; var I = w = w.next; do _ = s(_, I.action), I = I.next; while (I !== w); q(_, a.memoizedState) || (gr = !0), a.memoizedState = _, a.baseQueue === null && (a.baseState = _), c.lastRenderedState = _; } return [_, m]; } function xw() { } function Nw(s, a) { var c = wn, m = Jr(), w = a(), _ = !q(m.memoizedState, w); if (_ && (m.memoizedState = w, gr = !0), m = m.queue, Rm(Rw.bind(null, c, m, s), [s]), m.getSnapshot !== a || _ || Ln !== null && Ln.memoizedState.tag & 1) { if (c.flags |= 2048, cc(9, Iw.bind(null, c, m, w, a), void 0, null), Un === null) throw Error(n(349)); (pa & 30) !== 0 || Tw(c, a, w); } return w; } function Tw(s, a, c) { s.flags |= 16384, s = { getSnapshot: a, value: c }, a = wn.updateQueue, a === null ? (a = { lastEffect: null, stores: null }, wn.updateQueue = a, a.stores = [s]) : (c = a.stores, c === null ? a.stores = [s] : c.push(s)); } function Iw(s, a, c, m) { a.value = c, a.getSnapshot = m, Ow(a) && Pw(s); } function Rw(s, a, c) { return c(function() { Ow(a) && Pw(s); }); } function Ow(s) { var a = s.getSnapshot; s = s.value; try { var c = a(); return !q(s, c); } catch { return !0; } } function Pw(s) { var a = Ao(s, 1); a !== null && _i(a, s, 1, -1); } function Dw(s) { var a = Yi(); return typeof s == "function" && (s = s()), a.memoizedState = a.baseState = s, s = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: lc, lastRenderedState: s }, a.queue = s, s = s.dispatch = kT.bind(null, wn, s), [a.memoizedState, s]; } function cc(s, a, c, m) { return s = { tag: s, create: a, destroy: c, deps: m, next: null }, a = wn.updateQueue, a === null ? (a = { lastEffect: null, stores: null }, wn.updateQueue = a, a.lastEffect = s.next = s) : (c = a.lastEffect, c === null ? a.lastEffect = s.next = s : (m = c.next, c.next = s, s.next = m, a.lastEffect = s)), s; } function Fw() { return Jr().memoizedState; } function Sf(s, a, c, m) { var w = Yi(); wn.flags |= s, w.memoizedState = cc(1 | a, c, void 0, m === void 0 ? null : m); } function _f(s, a, c, m) { var w = Jr(); m = m === void 0 ? null : m; var _ = void 0; if (Pn !== null) { var I = Pn.memoizedState; if (_ = I.destroy, m !== null && Cm(m, I.deps)) { w.memoizedState = cc(a, c, _, m); return; } } wn.flags |= s, w.memoizedState = cc(1 | a, c, _, m); } function Lw(s, a) { return Sf(8390656, 8, s, a); } function Rm(s, a) { return _f(2048, 8, s, a); } function Uw(s, a) { return _f(4, 2, s, a); } function Mw(s, a) { return _f(4, 4, s, a); } function Bw(s, a) { if (typeof a == "function") return s = s(), a(s), function() { a(null); }; if (a != null) return s = s(), a.current = s, function() { a.current = null; }; } function jw(s, a, c) { return c = c != null ? c.concat([s]) : null, _f(4, 4, Bw.bind(null, a, s), c); } function Om() { } function $w(s, a) { var c = Jr(); a = a === void 0 ? null : a; var m = c.memoizedState; return m !== null && a !== null && Cm(a, m[1]) ? m[0] : (c.memoizedState = [s, a], s); } function Vw(s, a) { var c = Jr(); a = a === void 0 ? null : a; var m = c.memoizedState; return m !== null && a !== null && Cm(a, m[1]) ? m[0] : (s = s(), c.memoizedState = [s, a], s); } function zw(s, a, c) { return (pa & 21) === 0 ? (s.baseState && (s.baseState = !1, gr = !0), s.memoizedState = c) : (q(c, a) || (c = $l(), wn.lanes |= c, ma |= c, s.baseState = !0), a); } function _T(s, a) { var c = Kt; Kt = c !== 0 && 4 > c ? c : 4, s(!0); var m = Am.transition; Am.transition = {}; try { s(!1), a(); } finally { Kt = c, Am.transition = m; } } function qw() { return Jr().memoizedState; } function bT(s, a, c) { var m = hs(s); if (c = { lane: m, action: c, hasEagerState: !1, eagerState: null, next: null }, Hw(s)) Kw(a, c); else if (c = bw(s, a, c, m), c !== null) { var w = ar(); _i(c, s, m, w), Gw(c, a, m); } } function kT(s, a, c) { var m = hs(s), w = { lane: m, action: c, hasEagerState: !1, eagerState: null, next: null }; if (Hw(s)) Kw(a, w); else { var _ = s.alternate; if (s.lanes === 0 && (_ === null || _.lanes === 0) && (_ = a.lastRenderedReducer, _ !== null)) try { var I = a.lastRenderedState, V = _(I, c); if (w.hasEagerState = !0, w.eagerState = V, q(V, I)) { var G = a.interleaved; G === null ? (w.next = w, wm(a)) : (w.next = G.next, G.next = w), a.interleaved = w; return; } } catch { } finally { } c = bw(s, a, w, m), c !== null && (w = ar(), _i(c, s, m, w), Gw(c, a, m)); } } function Hw(s) { var a = s.alternate; return s === wn || a !== null && a === wn; } function Kw(s, a) { ac = wf = !0; var c = s.pending; c === null ? a.next = a : (a.next = c.next, c.next = a), s.pending = a; } function Gw(s, a, c) { if ((c & 4194240) !== 0) { var m = a.lanes; m &= s.pendingLanes, c |= m, a.lanes = c, lu(s, c); } } var bf = { readContext: Qr, useCallback: Zn, useContext: Zn, useEffect: Zn, useImperativeHandle: Zn, useInsertionEffect: Zn, useLayoutEffect: Zn, useMemo: Zn, useReducer: Zn, useRef: Zn, useState: Zn, useDebugValue: Zn, useDeferredValue: Zn, useTransition: Zn, useMutableSource: Zn, useSyncExternalStore: Zn, useId: Zn, unstable_isNewReconciler: !1 }, ET = { readContext: Qr, useCallback: function(s, a) { return Yi().memoizedState = [s, a === void 0 ? null : a], s; }, useContext: Qr, useEffect: Lw, useImperativeHandle: function(s, a, c) { return c = c != null ? c.concat([s]) : null, Sf( 4194308, 4, Bw.bind(null, a, s), c ); }, useLayoutEffect: function(s, a) { return Sf(4194308, 4, s, a); }, useInsertionEffect: function(s, a) { return Sf(4, 2, s, a); }, useMemo: function(s, a) { var c = Yi(); return a = a === void 0 ? null : a, s = s(), c.memoizedState = [s, a], s; }, useReducer: function(s, a, c) { var m = Yi(); return a = c !== void 0 ? c(a) : a, m.memoizedState = m.baseState = a, s = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: s, lastRenderedState: a }, m.queue = s, s = s.dispatch = bT.bind(null, wn, s), [m.memoizedState, s]; }, useRef: function(s) { var a = Yi(); return s = { current: s }, a.memoizedState = s; }, useState: Dw, useDebugValue: Om, useDeferredValue: function(s) { return Yi().memoizedState = s; }, useTransition: function() { var s = Dw(!1), a = s[0]; return s = _T.bind(null, s[1]), Yi().memoizedState = s, [a, s]; }, useMutableSource: function() { }, useSyncExternalStore: function(s, a, c) { var m = wn, w = Yi(); if (gn) { if (c === void 0) throw Error(n(407)); c = c(); } else { if (c = a(), Un === null) throw Error(n(349)); (pa & 30) !== 0 || Tw(m, a, c); } w.memoizedState = c; var _ = { value: c, getSnapshot: a }; return w.queue = _, Lw(Rw.bind( null, m, _, s ), [s]), m.flags |= 2048, cc(9, Iw.bind(null, m, _, c, a), void 0, null), c; }, useId: function() { var s = Yi(), a = Un.identifierPrefix; if (gn) { var c = Eo, m = ko; c = (m & ~(1 << 32 - wt(m) - 1)).toString(32) + c, a = ":" + a + "R" + c, c = uc++, 0 < c && (a += "H" + c.toString(32)), a += ":"; } else c = ST++, a = ":" + a + "r" + c.toString(32) + ":"; return s.memoizedState = a; }, unstable_isNewReconciler: !1 }, AT = { readContext: Qr, useCallback: $w, useContext: Qr, useEffect: Rm, useImperativeHandle: jw, useInsertionEffect: Uw, useLayoutEffect: Mw, useMemo: Vw, useReducer: Tm, useRef: Fw, useState: function() { return Tm(lc); }, useDebugValue: Om, useDeferredValue: function(s) { var a = Jr(); return zw(a, Pn.memoizedState, s); }, useTransition: function() { var s = Tm(lc)[0], a = Jr().memoizedState; return [s, a]; }, useMutableSource: xw, useSyncExternalStore: Nw, useId: qw, unstable_isNewReconciler: !1 }, CT = { readContext: Qr, useCallback: $w, useContext: Qr, useEffect: Rm, useImperativeHandle: jw, useInsertionEffect: Uw, useLayoutEffect: Mw, useMemo: Vw, useReducer: Im, useRef: Fw, useState: function() { return Im(lc); }, useDebugValue: Om, useDeferredValue: function(s) { var a = Jr(); return Pn === null ? a.memoizedState = s : zw(a, Pn.memoizedState, s); }, useTransition: function() { var s = Im(lc)[0], a = Jr().memoizedState; return [s, a]; }, useMutableSource: xw, useSyncExternalStore: Nw, useId: qw, unstable_isNewReconciler: !1 }; function yi(s, a) { if (s && s.defaultProps) { a = B({}, a), s = s.defaultProps; for (var c in s) a[c] === void 0 && (a[c] = s[c]); return a; } return a; } function Pm(s, a, c, m) { a = s.memoizedState, c = c(m, a), c = c == null ? a : B({}, a, c), s.memoizedState = c, s.lanes === 0 && (s.updateQueue.baseState = c); } var kf = { isMounted: function(s) { return (s = s._reactInternals) ? Wn(s) === s : !1; }, enqueueSetState: function(s, a, c) { s = s._reactInternals; var m = ar(), w = hs(s), _ = Co(m, w); _.payload = a, c != null && (_.callback = c), a = ls(s, _, w), a !== null && (_i(a, s, w, m), mf(a, s, w)); }, enqueueReplaceState: function(s, a, c) { s = s._reactInternals; var m = ar(), w = hs(s), _ = Co(m, w); _.tag = 1, _.payload = a, c != null && (_.callback = c), a = ls(s, _, w), a !== null && (_i(a, s, w, m), mf(a, s, w)); }, enqueueForceUpdate: function(s, a) { s = s._reactInternals; var c = ar(), m = hs(s), w = Co(c, m); w.tag = 2, a != null && (w.callback = a), a = ls(s, w, m), a !== null && (_i(a, s, m, c), mf(a, s, m)); } }; function Ww(s, a, c, m, w, _, I) { return s = s.stateNode, typeof s.shouldComponentUpdate == "function" ? s.shouldComponentUpdate(m, _, I) : a.prototype && a.prototype.isPureReactComponent ? !oe(c, m) || !oe(w, _) : !0; } function Yw(s, a, c) { var m = !1, w = ss, _ = a.contextType; return typeof _ == "object" && _ !== null ? _ = Qr(_) : (w = mr(a) ? la : Xn.current, m = a.contextTypes, _ = (m = m != null) ? xu(s, w) : ss), a = new a(c, _), s.memoizedState = a.state !== null && a.state !== void 0 ? a.state : null, a.updater = kf, s.stateNode = a, a._reactInternals = s, m && (s = s.stateNode, s.__reactInternalMemoizedUnmaskedChildContext = w, s.__reactInternalMemoizedMaskedChildContext = _), a; } function Qw(s, a, c, m) { s = a.state, typeof a.componentWillReceiveProps == "function" && a.componentWillReceiveProps(c, m), typeof a.UNSAFE_componentWillReceiveProps == "function" && a.UNSAFE_componentWillReceiveProps(c, m), a.state !== s && kf.enqueueReplaceState(a, a.state, null); } function Dm(s, a, c, m) { var w = s.stateNode; w.props = c, w.state = s.memoizedState, w.refs = {}, Sm(s); var _ = a.contextType; typeof _ == "object" && _ !== null ? w.context = Qr(_) : (_ = mr(a) ? la : Xn.current, w.context = xu(s, _)), w.state = s.memoizedState, _ = a.getDerivedStateFromProps, typeof _ == "function" && (Pm(s, a, _, c), w.state = s.memoizedState), typeof a.getDerivedStateFromProps == "function" || typeof w.getSnapshotBeforeUpdate == "function" || typeof w.UNSAFE_componentWillMount != "function" && typeof w.componentWillMount != "function" || (a = w.state, typeof w.componentWillMount == "function" && w.componentWillMount(), typeof w.UNSAFE_componentWillMount == "function" && w.UNSAFE_componentWillMount(), a !== w.state && kf.enqueueReplaceState(w, w.state, null), gf(s, c, w, m), w.state = s.memoizedState), typeof w.componentDidMount == "function" && (s.flags |= 4194308); } function Fu(s, a) { try { var c = "", m = a; do c += Q(m), m = m.return; while (m); var w = c; } catch (_) { w = ` Error generating stack: ` + _.message + ` ` + _.stack; } return { value: s, source: a, stack: w, digest: null }; } function Fm(s, a, c) { return { value: s, source: null, stack: c ?? null, digest: a ?? null }; } function Lm(s, a) { try { console.error(a.value); } catch (c) { setTimeout(function() { throw c; }); } } var xT = typeof WeakMap == "function" ? WeakMap : Map; function Jw(s, a, c) { c = Co(-1, c), c.tag = 3, c.payload = { element: null }; var m = a.value; return c.callback = function() { If || (If = !0, Jm = m), Lm(s, a); }, c; } function Xw(s, a, c) { c = Co(-1, c), c.tag = 3; var m = s.type.getDerivedStateFromError; if (typeof m == "function") { var w = a.value; c.payload = function() { return m(w); }, c.callback = function() { Lm(s, a); }; } var _ = s.stateNode; return _ !== null && typeof _.componentDidCatch == "function" && (c.callback = function() { Lm(s, a), typeof m != "function" && (ds === null ? ds = /* @__PURE__ */ new Set([this]) : ds.add(this)); var I = a.stack; this.componentDidCatch(a.value, { componentStack: I !== null ? I : "" }); }), c; } function Zw(s, a, c) { var m = s.pingCache; if (m === null) { m = s.pingCache = new xT(); var w = /* @__PURE__ */ new Set(); m.set(a, w); } else w = m.get(a), w === void 0 && (w = /* @__PURE__ */ new Set(), m.set(a, w)); w.has(c) || (w.add(c), s = $T.bind(null, s, a, c), a.then(s, s)); } function eS(s) { do { var a; if ((a = s.tag === 13) && (a = s.memoizedState, a = a !== null ? a.dehydrated !== null : !0), a) return s; s = s.return; } while (s !== null); return null; } function tS(s, a, c, m, w) { return (s.mode & 1) === 0 ? (s === a ? s.flags |= 65536 : (s.flags |= 128, c.flags |= 131072, c.flags &= -52805, c.tag === 1 && (c.alternate === null ? c.tag = 17 : (a = Co(-1, 1), a.tag = 2, ls(c, a, 1))), c.lanes |= 1), s) : (s.flags |= 65536, s.lanes = w, s); } var NT = j.ReactCurrentOwner, gr = !1; function sr(s, a, c, m) { a.child = s === null ? _w(a, null, c, m) : Ru(a, s.child, c, m); } function nS(s, a, c, m, w) { c = c.render; var _ = a.ref; return Pu(a, w), m = xm(s, a, c, m, _, w), c = Nm(), s !== null && !gr ? (a.updateQueue = s.updateQueue, a.flags &= -2053, s.lanes &= ~w, xo(s, a, w)) : (gn && c && cm(a), a.flags |= 1, sr(s, a, m, w), a.child); } function rS(s, a, c, m, w) { if (s === null) { var _ = c.type; return typeof _ == "function" && !ig(_) && _.defaultProps === void 0 && c.compare === null && c.defaultProps === void 0 ? (a.tag = 15, a.type = _, iS(s, a, _, m, w)) : (s = Lf(c.type, null, m, a, a.mode, w), s.ref = a.ref, s.return = a, a.child = s); } if (_ = s.child, (s.lanes & w) === 0) { var I = _.memoizedProps; if (c = c.compare, c = c !== null ? c : oe, c(I, m) && s.ref === a.ref) return xo(s, a, w); } return a.flags |= 1, s = ms(_, m), s.ref = a.ref, s.return = a, a.child = s; } function iS(s, a, c, m, w) { if (s !== null) { var _ = s.memoizedProps; if (oe(_, m) && s.ref === a.ref) if (gr = !1, a.pendingProps = m = _, (s.lanes & w) !== 0) (s.flags & 131072) !== 0 && (gr = !0); else return a.lanes = s.lanes, xo(s, a, w); } return Um(s, a, c, m, w); } function oS(s, a, c) { var m = a.pendingProps, w = m.children, _ = s !== null ? s.memoizedState : null; if (m.mode === "hidden") if ((a.mode & 1) === 0) a.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, un(Uu, Lr), Lr |= c; else { if ((c & 1073741824) === 0) return s = _ !== null ? _.baseLanes | c : c, a.lanes = a.childLanes = 1073741824, a.memoizedState = { baseLanes: s, cachePool: null, transitions: null }, a.updateQueue = null, un(Uu, Lr), Lr |= s, null; a.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, m = _ !== null ? _.baseLanes : c, un(Uu, Lr), Lr |= m; } else _ !== null ? (m = _.baseLanes | c, a.memoizedState = null) : m = c, un(Uu, Lr), Lr |= m; return sr(s, a, w, c), a.child; } function sS(s, a) { var c = a.ref; (s === null && c !== null || s !== null && s.ref !== c) && (a.flags |= 512, a.flags |= 2097152); } function Um(s, a, c, m, w) { var _ = mr(c) ? la : Xn.current; return _ = xu(a, _), Pu(a, w), c = xm(s, a, c, m, _, w), m = Nm(), s !== null && !gr ? (a.updateQueue = s.updateQueue, a.flags &= -2053, s.lanes &= ~w, xo(s, a, w)) : (gn && m && cm(a), a.flags |= 1, sr(s, a, c, w), a.child); } function aS(s, a, c, m, w) { if (mr(c)) { var _ = !0; af(a); } else _ = !1; if (Pu(a, w), a.stateNode === null) Af(s, a), Yw(a, c, m), Dm(a, c, m, w), m = !0; else if (s === null) { var I = a.stateNode, V = a.memoizedProps; I.props = V; var G = I.context, me = c.contextType; typeof me == "object" && me !== null ? me = Qr(me) : (me = mr(c) ? la : Xn.current, me = xu(a, me)); var Ue = c.getDerivedStateFromProps, Be = typeof Ue == "function" || typeof I.getSnapshotBeforeUpdate == "function"; Be || typeof I.UNSAFE_componentWillReceiveProps != "function" && typeof I.componentWillReceiveProps != "function" || (V !== m || G !== me) && Qw(a, I, m, me), us = !1; var Fe = a.memoizedState; I.state = Fe, gf(a, m, I, w), G = a.memoizedState, V !== m || Fe !== G || pr.current || us ? (typeof Ue == "function" && (Pm(a, c, Ue, m), G = a.memoizedState), (V = us || Ww(a, c, V, m, Fe, G, me)) ? (Be || typeof I.UNSAFE_componentWillMount != "function" && typeof I.componentWillMount != "function" || (typeof I.componentWillMount == "function" && I.componentWillMount(), typeof I.UNSAFE_componentWillMount == "function" && I.UNSAFE_componentWillMount()), typeof I.componentDidMount == "function" && (a.flags |= 4194308)) : (typeof I.componentDidMount == "function" && (a.flags |= 4194308), a.memoizedProps = m, a.memoizedState = G), I.props = m, I.state = G, I.context = me, m = V) : (typeof I.componentDidMount == "function" && (a.flags |= 4194308), m = !1); } else { I = a.stateNode, kw(s, a), V = a.memoizedProps, me = a.type === a.elementType ? V : yi(a.type, V), I.props = me, Be = a.pendingProps, Fe = I.context, G = c.contextType, typeof G == "object" && G !== null ? G = Qr(G) : (G = mr(c) ? la : Xn.current, G = xu(a, G)); var tt = c.getDerivedStateFromProps; (Ue = typeof tt == "function" || typeof I.getSnapshotBeforeUpdate == "function") || typeof I.UNSAFE_componentWillReceiveProps != "function" && typeof I.componentWillReceiveProps != "function" || (V !== Be || Fe !== G) && Qw(a, I, m, G), us = !1, Fe = a.memoizedState, I.state = Fe, gf(a, m, I, w); var st = a.memoizedState; V !== Be || Fe !== st || pr.current || us ? (typeof tt == "function" && (Pm(a, c, tt, m), st = a.memoizedState), (me = us || Ww(a, c, me, m, Fe, st, G) || !1) ? (Ue || typeof I.UNSAFE_componentWillUpdate != "function" && typeof I.componentWillUpdate != "function" || (typeof I.componentWillUpdate == "function" && I.componentWillUpdate(m, st, G), typeof I.UNSAFE_componentWillUpdate == "function" && I.UNSAFE_componentWillUpdate(m, st, G)), typeof I.componentDidUpdate == "function" && (a.flags |= 4), typeof I.getSnapshotBeforeUpdate == "function" && (a.flags |= 1024)) : (typeof I.componentDidUpdate != "function" || V === s.memoizedProps && Fe === s.memoizedState || (a.flags |= 4), typeof I.getSnapshotBeforeUpdate != "function" || V === s.memoizedProps && Fe === s.memoizedState || (a.flags |= 1024), a.memoizedProps = m, a.memoizedState = st), I.props = m, I.state = st, I.context = G, m = me) : (typeof I.componentDidUpdate != "function" || V === s.memoizedProps && Fe === s.memoizedState || (a.flags |= 4), typeof I.getSnapshotBeforeUpdate != "function" || V === s.memoizedProps && Fe === s.memoizedState || (a.flags |= 1024), m = !1); } return Mm(s, a, c, m, _, w); } function Mm(s, a, c, m, w, _) { sS(s, a); var I = (a.flags & 128) !== 0; if (!m && !I) return w && fw(a, c, !1), xo(s, a, _); m = a.stateNode, NT.current = a; var V = I && typeof c.getDerivedStateFromError != "function" ? null : m.render(); return a.flags |= 1, s !== null && I ? (a.child = Ru(a, s.child, null, _), a.child = Ru(a, null, V, _)) : sr(s, a, V, _), a.memoizedState = m.state, w && fw(a, c, !0), a.child; } function uS(s) { var a = s.stateNode; a.pendingContext ? cw(s, a.pendingContext, a.pendingContext !== a.context) : a.context && cw(s, a.context, !1), _m(s, a.containerInfo); } function lS(s, a, c, m, w) { return Iu(), pm(w), a.flags |= 256, sr(s, a, c, m), a.child; } var Bm = { dehydrated: null, treeContext: null, retryLane: 0 }; function jm(s) { return { baseLanes: s, cachePool: null, transitions: null }; } function cS(s, a, c) { var m = a.pendingProps, w = yn.current, _ = !1, I = (a.flags & 128) !== 0, V; if ((V = I) || (V = s !== null && s.memoizedState === null ? !1 : (w & 2) !== 0), V ? (_ = !0, a.flags &= -129) : (s === null || s.memoizedState !== null) && (w |= 1), un(yn, w & 1), s === null) return hm(a), s = a.memoizedState, s !== null && (s = s.dehydrated, s !== null) ? ((a.mode & 1) === 0 ? a.lanes = 1 : s.data === "$!" ? a.lanes = 8 : a.lanes = 1073741824, null) : (I = m.children, s = m.fallback, _ ? (m = a.mode, _ = a.child, I = { mode: "hidden", children: I }, (m & 1) === 0 && _ !== null ? (_.childLanes = 0, _.pendingProps = I) : _ = Uf(I, m, 0, null), s = wa(s, m, c, null), _.return = a, s.return = a, _.sibling = s, a.child = _, a.child.memoizedState = jm(c), a.memoizedState = Bm, s) : $m(a, I)); if (w = s.memoizedState, w !== null && (V = w.dehydrated, V !== null)) return TT(s, a, I, m, V, w, c); if (_) { _ = m.fallback, I = a.mode, w = s.child, V = w.sibling; var G = { mode: "hidden", children: m.children }; return (I & 1) === 0 && a.child !== w ? (m = a.child, m.childLanes = 0, m.pendingProps = G, a.deletions = null) : (m = ms(w, G), m.subtreeFlags = w.subtreeFlags & 14680064), V !== null ? _ = ms(V, _) : (_ = wa(_, I, c, null), _.flags |= 2), _.return = a, m.return = a, m.sibling = _, a.child = m, m = _, _ = a.child, I = s.child.memoizedState, I = I === null ? jm(c) : { baseLanes: I.baseLanes | c, cachePool: null, transitions: I.transitions }, _.memoizedState = I, _.childLanes = s.childLanes & ~c, a.memoizedState = Bm, m; } return _ = s.child, s = _.sibling, m = ms(_, { mode: "visible", children: m.children }), (a.mode & 1) === 0 && (m.lanes = c), m.return = a, m.sibling = null, s !== null && (c = a.deletions, c === null ? (a.deletions = [s], a.flags |= 16) : c.push(s)), a.child = m, a.memoizedState = null, m; } function $m(s, a) { return a = Uf({ mode: "visible", children: a }, s.mode, 0, null), a.return = s, s.child = a; } function Ef(s, a, c, m) { return m !== null && pm(m), Ru(a, s.child, null, c), s = $m(a, a.pendingProps.children), s.flags |= 2, a.memoizedState = null, s; } function TT(s, a, c, m, w, _, I) { if (c) return a.flags & 256 ? (a.flags &= -257, m = Fm(Error(n(422))), Ef(s, a, I, m)) : a.memoizedState !== null ? (a.child = s.child, a.flags |= 128, null) : (_ = m.fallback, w = a.mode, m = Uf({ mode: "visible", children: m.children }, w, 0, null), _ = wa(_, w, I, null), _.flags |= 2, m.return = a, _.return = a, m.sibling = _, a.child = m, (a.mode & 1) !== 0 && Ru(a, s.child, null, I), a.child.memoizedState = jm(I), a.memoizedState = Bm, _); if ((a.mode & 1) === 0) return Ef(s, a, I, null); if (w.data === "$!") { if (m = w.nextSibling && w.nextSibling.dataset, m) var V = m.dgst; return m = V, _ = Error(n(419)), m = Fm(_, m, void 0), Ef(s, a, I, m); } if (V = (I & s.childLanes) !== 0, gr || V) { if (m = Un, m !== null) { switch (I & -I) { case 4: w = 2; break; case 16: w = 8; break; case 64: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: case 4194304: case 8388608: case 16777216: case 33554432: case 67108864: w = 32; break; case 536870912: w = 268435456; break; default: w = 0; } w = (w & (m.suspendedLanes | I)) !== 0 ? 0 : w, w !== 0 && w !== _.retryLane && (_.retryLane = w, Ao(s, w), _i(m, s, w, -1)); } return rg(), m = Fm(Error(n(421))), Ef(s, a, I, m); } return w.data === "$?" ? (a.flags |= 128, a.child = s.child, a = VT.bind(null, s), w._reactRetry = a, null) : (s = _.treeContext, Fr = is(w.nextSibling), Dr = a, gn = !0, vi = null, s !== null && (Wr[Yr++] = ko, Wr[Yr++] = Eo, Wr[Yr++] = ca, ko = s.id, Eo = s.overflow, ca = a), a = $m(a, m.children), a.flags |= 4096, a); } function dS(s, a, c) { s.lanes |= a; var m = s.alternate; m !== null && (m.lanes |= a), ym(s.return, a, c); } function Vm(s, a, c, m, w) { var _ = s.memoizedState; _ === null ? s.memoizedState = { isBackwards: a, rendering: null, renderingStartTime: 0, last: m, tail: c, tailMode: w } : (_.isBackwards = a, _.rendering = null, _.renderingStartTime = 0, _.last = m, _.tail = c, _.tailMode = w); } function fS(s, a, c) { var m = a.pendingProps, w = m.revealOrder, _ = m.tail; if (sr(s, a, m.children, c), m = yn.current, (m & 2) !== 0) m = m & 1 | 2, a.flags |= 128; else { if (s !== null && (s.flags & 128) !== 0) e: for (s = a.child; s !== null; ) { if (s.tag === 13) s.memoizedState !== null && dS(s, c, a); else if (s.tag === 19) dS(s, c, a); else if (s.child !== null) { s.child.return = s, s = s.child; continue; } if (s === a) break e; for (; s.sibling === null; ) { if (s.return === null || s.return === a) break e; s = s.return; } s.sibling.return = s.return, s = s.sibling; } m &= 1; } if (un(yn, m), (a.mode & 1) === 0) a.memoizedState = null; else switch (w) { case "forwards": for (c = a.child, w = null; c !== null; ) s = c.alternate, s !== null && vf(s) === null && (w = c), c = c.sibling; c = w, c === null ? (w = a.child, a.child = null) : (w = c.sibling, c.sibling = null), Vm(a, !1, w, c, _); break; case "backwards": for (c = null, w = a.child, a.child = null; w !== null; ) { if (s = w.alternate, s !== null && vf(s) === null) { a.child = w; break; } s = w.sibling, w.sibling = c, c = w, w = s; } Vm(a, !0, c, null, _); break; case "together": Vm(a, !1, null, null, void 0); break; default: a.memoizedState = null; } return a.child; } function Af(s, a) { (a.mode & 1) === 0 && s !== null && (s.alternate = null, a.alternate = null, a.flags |= 2); } function xo(s, a, c) { if (s !== null && (a.dependencies = s.dependencies), ma |= a.lanes, (c & a.childLanes) === 0) return null; if (s !== null && a.child !== s.child) throw Error(n(153)); if (a.child !== null) { for (s = a.child, c = ms(s, s.pendingProps), a.child = c, c.return = a; s.sibling !== null; ) s = s.sibling, c = c.sibling = ms(s, s.pendingProps), c.return = a; c.sibling = null; } return a.child; } function IT(s, a, c) { switch (a.tag) { case 3: uS(a), Iu(); break; case 5: Cw(a); break; case 1: mr(a.type) && af(a); break; case 4: _m(a, a.stateNode.containerInfo); break; case 10: var m = a.type._context, w = a.memoizedProps.value; un(hf, m._currentValue), m._currentValue = w; break; case 13: if (m = a.memoizedState, m !== null) return m.dehydrated !== null ? (un(yn, yn.current & 1), a.flags |= 128, null) : (c & a.child.childLanes) !== 0 ? cS(s, a, c) : (un(yn, yn.current & 1), s = xo(s, a, c), s !== null ? s.sibling : null); un(yn, yn.current & 1); break; case 19: if (m = (c & a.childLanes) !== 0, (s.flags & 128) !== 0) { if (m) return fS(s, a, c); a.flags |= 128; } if (w = a.memoizedState, w !== null && (w.rendering = null, w.tail = null, w.lastEffect = null), un(yn, yn.current), m) break; return null; case 22: case 23: return a.lanes = 0, oS(s, a, c); } return xo(s, a, c); } var hS, zm, pS, mS; hS = function(s, a) { for (var c = a.child; c !== null; ) { if (c.tag === 5 || c.tag === 6) s.appendChild(c.stateNode); else if (c.tag !== 4 && c.child !== null) { c.child.return = c, c = c.child; continue; } if (c === a) break; for (; c.sibling === null; ) { if (c.return === null || c.return === a) return; c = c.return; } c.sibling.return = c.return, c = c.sibling; } }, zm = function() { }, pS = function(s, a, c, m) { var w = s.memoizedProps; if (w !== m) { s = a.stateNode, ha(Wi.current); var _ = null; switch (c) { case "input": w = Rt(s, w), m = Rt(s, m), _ = []; break; case "select": w = B({}, w, { value: void 0 }), m = B({}, m, { value: void 0 }), _ = []; break; case "textarea": w = ee(s, w), m = ee(s, m), _ = []; break; default: typeof w.onClick != "function" && typeof m.onClick == "function" && (s.onclick = rf); } ut(c, m); var I; c = null; for (me in w) if (!m.hasOwnProperty(me) && w.hasOwnProperty(me) && w[me] != null) if (me === "style") { var V = w[me]; for (I in V) V.hasOwnProperty(I) && (c || (c = {}), c[I] = ""); } else me !== "dangerouslySetInnerHTML" && me !== "children" && me !== "suppressContentEditableWarning" && me !== "suppressHydrationWarning" && me !== "autoFocus" && (i.hasOwnProperty(me) ? _ || (_ = []) : (_ = _ || []).push(me, null)); for (me in m) { var G = m[me]; if (V = w?.[me], m.hasOwnProperty(me) && G !== V && (G != null || V != null)) if (me === "style") if (V) { for (I in V) !V.hasOwnProperty(I) || G && G.hasOwnProperty(I) || (c || (c = {}), c[I] = ""); for (I in G) G.hasOwnProperty(I) && V[I] !== G[I] && (c || (c = {}), c[I] = G[I]); } else c || (_ || (_ = []), _.push( me, c )), c = G; else me === "dangerouslySetInnerHTML" ? (G = G ? G.__html : void 0, V = V ? V.__html : void 0, G != null && V !== G && (_ = _ || []).push(me, G)) : me === "children" ? typeof G != "string" && typeof G != "number" || (_ = _ || []).push(me, "" + G) : me !== "suppressContentEditableWarning" && me !== "suppressHydrationWarning" && (i.hasOwnProperty(me) ? (G != null && me === "onScroll" && fn("scroll", s), _ || V === G || (_ = [])) : (_ = _ || []).push(me, G)); } c && (_ = _ || []).push("style", c); var me = _; (a.updateQueue = me) && (a.flags |= 4); } }, mS = function(s, a, c, m) { c !== m && (a.flags |= 4); }; function dc(s, a) { if (!gn) switch (s.tailMode) { case "hidden": a = s.tail; for (var c = null; a !== null; ) a.alternate !== null && (c = a), a = a.sibling; c === null ? s.tail = null : c.sibling = null; break; case "collapsed": c = s.tail; for (var m = null; c !== null; ) c.alternate !== null && (m = c), c = c.sibling; m === null ? a || s.tail === null ? s.tail = null : s.tail.sibling = null : m.sibling = null; } } function er(s) { var a = s.alternate !== null && s.alternate.child === s.child, c = 0, m = 0; if (a) for (var w = s.child; w !== null; ) c |= w.lanes | w.childLanes, m |= w.subtreeFlags & 14680064, m |= w.flags & 14680064, w.return = s, w = w.sibling; else for (w = s.child; w !== null; ) c |= w.lanes | w.childLanes, m |= w.subtreeFlags, m |= w.flags, w.return = s, w = w.sibling; return s.subtreeFlags |= m, s.childLanes = c, a; } function RT(s, a, c) { var m = a.pendingProps; switch (dm(a), a.tag) { case 2: case 16: case 15: case 0: case 11: case 7: case 8: case 12: case 9: case 14: return er(a), null; case 1: return mr(a.type) && sf(), er(a), null; case 3: return m = a.stateNode, Du(), hn(pr), hn(Xn), Em(), m.pendingContext && (m.context = m.pendingContext, m.pendingContext = null), (s === null || s.child === null) && (df(a) ? a.flags |= 4 : s === null || s.memoizedState.isDehydrated && (a.flags & 256) === 0 || (a.flags |= 1024, vi !== null && (eg(vi), vi = null))), zm(s, a), er(a), null; case 5: bm(a); var w = ha(sc.current); if (c = a.type, s !== null && a.stateNode != null) pS(s, a, c, m, w), s.ref !== a.ref && (a.flags |= 512, a.flags |= 2097152); else { if (!m) { if (a.stateNode === null) throw Error(n(166)); return er(a), null; } if (s = ha(Wi.current), df(a)) { m = a.stateNode, c = a.type; var _ = a.memoizedProps; switch (m[Gi] = a, m[tc] = _, s = (a.mode & 1) !== 0, c) { case "dialog": fn("cancel", m), fn("close", m); break; case "iframe": case "object": case "embed": fn("load", m); break; case "video": case "audio": for (w = 0; w < Xl.length; w++) fn(Xl[w], m); break; case "source": fn("error", m); break; case "img": case "image": case "link": fn( "error", m ), fn("load", m); break; case "details": fn("toggle", m); break; case "input": Ze(m, _), fn("invalid", m); break; case "select": m._wrapperState = { wasMultiple: !!_.multiple }, fn("invalid", m); break; case "textarea": _e(m, _), fn("invalid", m); } ut(c, _), w = null; for (var I in _) if (_.hasOwnProperty(I)) { var V = _[I]; I === "children" ? typeof V == "string" ? m.textContent !== V && (_.suppressHydrationWarning !== !0 && nf(m.textContent, V, s), w = ["children", V]) : typeof V == "number" && m.textContent !== "" + V && (_.suppressHydrationWarning !== !0 && nf( m.textContent, V, s ), w = ["children", "" + V]) : i.hasOwnProperty(I) && V != null && I === "onScroll" && fn("scroll", m); } switch (c) { case "input": ft(m), P(m, _, !0); break; case "textarea": ft(m), _t(m); break; case "select": case "option": break; default: typeof _.onClick == "function" && (m.onclick = rf); } m = w, a.updateQueue = m, m !== null && (a.flags |= 4); } else { I = w.nodeType === 9 ? w : w.ownerDocument, s === "http://www.w3.org/1999/xhtml" && (s = At(c)), s === "http://www.w3.org/1999/xhtml" ? c === "script" ? (s = I.createElement("div"), s.innerHTML = "