var iI = Object.defineProperty; var sI = (t, e, n) => e in t ? iI(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; var ve = (t, e, n) => sI(t, typeof e != "symbol" ? e + "" : e, n); const Ci = {}; let oI = 0; function Ts(t, e) { const n = `atom${++oI}`, r = { toString() { return (Ci ? "production" : void 0) !== "production" && this.debugLabel ? n + ":" + this.debugLabel : n; } }; return typeof t == "function" ? r.read = t : (r.init = t, r.read = aI, r.write = uI), e && (r.write = e), r; } function aI(t) { return t(this); } function uI(t, e, n) { return e( this, typeof n == "function" ? n(t(this)) : n ); } const Q_ = (t, e) => t.unstable_is ? t.unstable_is(e) : e === t, gg = (t) => "init" in t, vg = (t) => !!t.write, Fh = /* @__PURE__ */ new WeakMap(), Wv = (t) => { var e; return Yv(t) && !((e = Fh.get(t)) != null && e[1]); }, lI = (t, e) => { const n = Fh.get(t); if (n) n[1] = !0, n[0].forEach((r) => r(e)); else if ((Ci ? "production" : void 0) !== "production") throw new Error("[Bug] cancelable promise not found"); }, cI = (t) => { if (Fh.has(t)) return; const e = [/* @__PURE__ */ new Set(), !1]; Fh.set(t, e); const n = () => { e[1] = !0; }; t.then(n, n), t.onCancel = (r) => { e[0].add(r); }; }, Yv = (t) => typeof (t == null ? void 0 : t.then) == "function", J_ = (t) => "v" in t || "e" in t, Gf = (t) => { if ("e" in t) throw t.e; if ((Ci ? "production" : void 0) !== "production" && !("v" in t)) throw new Error("[Bug] atom state is not initialized"); return t.v; }, F1 = (t, e, n) => { n.p.has(t) || (n.p.add(t), e.then( () => { n.p.delete(t); }, () => { n.p.delete(t); } )); }, X_ = (t, e, n, r, i) => { var s; if ((Ci ? "production" : void 0) !== "production" && r === e) throw new Error("[Bug] atom cannot depend on itself"); n.d.set(r, i.n), Wv(n.v) && F1(e, n.v, i), (s = i.m) == null || s.t.add(e), t && dI(t, r, e); }, ju = () => [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Set()], yg = (t, e, n) => { t[0].has(e) || t[0].set(e, /* @__PURE__ */ new Set()), t[1].set(e, n); }, dI = (t, e, n) => { const r = t[0].get(e); r && r.add(n); }, fI = (t, e) => t[0].get(e), Z_ = (t, e) => { t[2].add(e); }, _a = (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((s) => s()); }), n.forEach((r) => r()); } }, L1 = (t) => { let e; (Ci ? "production" : void 0) !== "production" && (e = /* @__PURE__ */ new Set()); const n = (A, T, O) => { const R = "v" in T, U = T.v, j = Wv(T.v) ? T.v : null; if (Yv(O)) { cI(O); for (const K of T.d.keys()) F1( A, O, t(K, T) ); T.v = O, delete T.e; } else T.v = O, delete T.e; (!R || !Object.is(U, T.v)) && (++T.n, j && lI(j, O)); }, r = (A, T, O, R) => { var U; if (!(R != null && R(T)) && J_(O) && (O.m || Array.from(O.d).every( ([ye, Z]) => ( // Recursively, read the atom state of the dependency, and // check if the atom epoch number is unchanged r(A, ye, t(ye, O), R).n === Z ) ))) return O; O.d.clear(); let j = !0; const K = (ye) => { if (Q_(T, ye)) { const _e = t(ye, O); if (!J_(_e)) if (gg(ye)) n(ye, _e, ye.init); else throw new Error("no atom init"); return Gf(_e); } const Z = r( A, ye, t(ye, O), R ); if (j) X_(A, T, O, ye, Z); else { const _e = ju(); X_(_e, T, O, ye, Z), d(_e, T, O), _a(_e); } return Gf(Z); }; let ie, ce; const H = { get signal() { return ie || (ie = new AbortController()), ie.signal; }, get setSelf() { return (Ci ? "production" : void 0) !== "production" && !vg(T) && console.warn("setSelf function cannot be used with read-only atom"), !ce && vg(T) && (ce = (...ye) => { if ((Ci ? "production" : void 0) !== "production" && j && console.warn("setSelf function cannot be called in sync"), !j) return f(T, ...ye); }), ce; } }; try { const ye = T.read(K, H); if (n(T, O, ye), Yv(ye)) { (U = ye.onCancel) == null || U.call(ye, () => ie == null ? void 0 : ie.abort()); const Z = () => { if (O.m) { const _e = ju(); d(_e, T, O), _a(_e); } }; ye.then(Z, Z); } return O; } catch (ye) { return delete O.v, O.e = ye, ++O.n, O; } finally { j = !1; } }, i = (A) => Gf(r(void 0, A, t(A))), s = (A, T, O) => { var R, U; const j = /* @__PURE__ */ new Map(); for (const K of ((R = O.m) == null ? void 0 : R.t) || []) j.set(K, t(K, O)); for (const K of O.p) j.set( K, t(K, O) ); return (U = fI(A, T)) == null || U.forEach((K) => { j.set(K, t(K, O)); }), j; }, a = (A, T, O) => { const R = [], U = /* @__PURE__ */ new Set(), j = (ce, H) => { if (!U.has(ce)) { U.add(ce); for (const [ye, Z] of s(A, ce, H)) ce !== ye && j(ye, Z); R.push([ce, H, H.n]); } }; j(T, O); const K = /* @__PURE__ */ new Set([T]), ie = (ce) => U.has(ce); for (let ce = R.length - 1; ce >= 0; --ce) { const [H, ye, Z] = R[ce]; let _e = !1; for (const qe of ye.d.keys()) if (qe !== H && K.has(qe)) { _e = !0; break; } _e && (r(A, H, ye, ie), d(A, H, ye), Z !== ye.n && (yg(A, H, ye), K.add(H))), U.delete(H); } }, l = (A, T, O, ...R) => { const U = (ie) => Gf(r(A, ie, t(ie, O))), j = (ie, ...ce) => { const H = t(ie, O); let ye; if (Q_(T, ie)) { if (!gg(ie)) throw new Error("atom not writable"); const Z = "v" in H, _e = H.v, qe = ce[0]; n(ie, H, qe), d(A, ie, H), (!Z || !Object.is(_e, H.v)) && (yg(A, ie, H), a(A, ie, H)); } else ye = l(A, ie, H, ...ce); return _a(A), ye; }; return T.write(U, j, ...R); }, f = (A, ...T) => { const O = ju(), R = l(O, A, t(A), ...T); return _a(O), R; }, d = (A, T, O) => { if (O.m && !Wv(O.v)) { for (const R of O.d.keys()) O.m.d.has(R) || (p(A, R, t(R, O)).t.add(T), O.m.d.add(R)); for (const R of O.m.d || []) if (!O.d.has(R)) { O.m.d.delete(R); const U = v(A, R, t(R, O)); U == null || U.t.delete(T); } } }, p = (A, T, O) => { if (!O.m) { r(A, T, O); for (const R of O.d.keys()) p(A, R, t(R, O)).t.add(T); if (O.m = { l: /* @__PURE__ */ new Set(), d: new Set(O.d.keys()), t: /* @__PURE__ */ new Set() }, (Ci ? "production" : void 0) !== "production" && e.add(T), vg(T) && T.onMount) { const R = O.m, { onMount: U } = T; Z_(A, () => { const j = U( (...K) => l(A, T, O, ...K) ); j && (R.u = j); }); } } return O.m; }, v = (A, T, O) => { if (O.m && !O.m.l.size && !Array.from(O.m.t).some( (R) => { var U; return (U = t(R, O).m) == null ? void 0 : U.d.has(T); } )) { const R = O.m.u; R && Z_(A, R), delete O.m, (Ci ? "production" : void 0) !== "production" && e.delete(T); for (const U of O.d.keys()) { const j = v(A, U, t(U, O)); j == null || j.t.delete(T); } return; } return O.m; }, E = { get: i, set: f, sub: (A, T) => { const O = ju(), R = t(A), U = p(O, A, R); _a(O); const j = U.l; return j.add(T), () => { j.delete(T); const K = ju(); v(K, A, R), _a(K); }; }, unstable_derive: (A) => L1(...A(t)) }; return (Ci ? "production" : void 0) !== "production" && Object.assign(E, { // store dev methods (these are tentative and subject to change without notice) dev4_get_internal_weak_map: () => ({ get: (T) => { const O = t(T); if (O.n !== 0) return O; } }), dev4_get_mounted_atoms: () => e, dev4_restore_atoms: (T) => { const O = ju(); for (const [R, U] of T) if (gg(R)) { const j = t(R), K = "v" in j, ie = j.v; n(R, j, U), d(O, R, j), (!K || !Object.is(ie, j.v)) && (yg(O, R, j), a(O, R, j)); } _a(O); } }), E; }, hI = () => { const t = /* @__PURE__ */ new WeakMap(); return L1((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 yc; const pI = () => (yc || (yc = hI(), (Ci ? "production" : void 0) !== "production" && (globalThis.__JOTAI_DEFAULT_STORE__ || (globalThis.__JOTAI_DEFAULT_STORE__ = yc), globalThis.__JOTAI_DEFAULT_STORE__ !== yc && console.warn( "Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044" ))), yc); var Oo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function Bo(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } function wl(t) { if (t.__esModule) return t; var e = t.default; if (typeof e == "function") { var n = function r() { return this instanceof r ? 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 wg = { exports: {} }, Pt = {}; /** * @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 eS; function mI() { if (eS) return Pt; eS = 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"), s = Symbol.for("react.provider"), a = 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() { } }, E = Object.assign, A = {}; function T(M, te, Ie) { this.props = M, this.context = te, this.refs = A, this.updater = Ie || 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 O() { } O.prototype = T.prototype; function R(M, te, Ie) { this.props = M, this.context = te, this.refs = A, this.updater = Ie || k; } var U = R.prototype = new O(); U.constructor = R, E(U, T.prototype), U.isPureReactComponent = !0; var j = Array.isArray, K = Object.prototype.hasOwnProperty, ie = { current: null }, ce = { key: !0, ref: !0, __self: !0, __source: !0 }; function H(M, te, Ie) { var $, Q = {}, Qe = null, Re = null; if (te != null) for ($ in te.ref !== void 0 && (Re = te.ref), te.key !== void 0 && (Qe = "" + te.key), te) K.call(te, $) && !ce.hasOwnProperty($) && (Q[$] = te[$]); var We = arguments.length - 2; if (We === 1) Q.children = Ie; else if (1 < We) { for (var Oe = Array(We), pt = 0; pt < We; pt++) Oe[pt] = arguments[pt + 2]; Q.children = Oe; } if (M && M.defaultProps) for ($ in We = M.defaultProps, We) Q[$] === void 0 && (Q[$] = We[$]); return { $$typeof: t, type: M, key: Qe, ref: Re, props: Q, _owner: ie.current }; } function ye(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 _e(M) { var te = { "=": "=0", ":": "=2" }; return "$" + M.replace(/[=:]/g, function(Ie) { return te[Ie]; }); } var qe = /\/+/g; function st(M, te) { return typeof M == "object" && M !== null && M.key != null ? _e("" + M.key) : te.toString(36); } function ft(M, te, Ie, $, Q) { var Qe = typeof M; (Qe === "undefined" || Qe === "boolean") && (M = null); var Re = !1; if (M === null) Re = !0; else switch (Qe) { case "string": case "number": Re = !0; break; case "object": switch (M.$$typeof) { case t: case e: Re = !0; } } if (Re) return Re = M, Q = Q(Re), M = $ === "" ? "." + st(Re, 0) : $, j(Q) ? (Ie = "", M != null && (Ie = M.replace(qe, "$&/") + "/"), ft(Q, te, Ie, "", function(pt) { return pt; })) : Q != null && (Z(Q) && (Q = ye(Q, Ie + (!Q.key || Re && Re.key === Q.key ? "" : ("" + Q.key).replace(qe, "$&/") + "/") + M)), te.push(Q)), 1; if (Re = 0, $ = $ === "" ? "." : $ + ":", j(M)) for (var We = 0; We < M.length; We++) { Qe = M[We]; var Oe = $ + st(Qe, We); Re += ft(Qe, te, Ie, Oe, Q); } else if (Oe = y(M), typeof Oe == "function") for (M = Oe.call(M), We = 0; !(Qe = M.next()).done; ) Qe = Qe.value, Oe = $ + st(Qe, We++), Re += ft(Qe, te, Ie, Oe, Q); else if (Qe === "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 Re; } function ue(M, te, Ie) { if (M == null) return M; var $ = [], Q = 0; return ft(M, $, "", "", function(Qe) { return te.call(Ie, Qe, Q++); }), $; } function ke(M) { if (M._status === -1) { var te = M._result; te = te(), te.then(function(Ie) { (M._status === 0 || M._status === -1) && (M._status = 1, M._result = Ie); }, function(Ie) { (M._status === 0 || M._status === -1) && (M._status = 2, M._result = Ie); }), M._status === -1 && (M._status = 0, M._result = te); } if (M._status === 1) return M._result.default; throw M._result; } var pe = { current: null }, de = { transition: null }, Ae = { ReactCurrentDispatcher: pe, ReactCurrentBatchConfig: de, ReactCurrentOwner: ie }; function B() { throw Error("act(...) is not supported in production builds of React."); } return Pt.Children = { map: ue, forEach: function(M, te, Ie) { ue(M, function() { te.apply(this, arguments); }, Ie); }, count: function(M) { var te = 0; return ue(M, function() { te++; }), te; }, toArray: function(M) { return ue(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; } }, Pt.Component = T, Pt.Fragment = n, Pt.Profiler = i, Pt.PureComponent = R, Pt.StrictMode = r, Pt.Suspense = f, Pt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Ae, Pt.act = B, Pt.cloneElement = function(M, te, Ie) { if (M == null) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + M + "."); var $ = E({}, M.props), Q = M.key, Qe = M.ref, Re = M._owner; if (te != null) { if (te.ref !== void 0 && (Qe = te.ref, Re = ie.current), te.key !== void 0 && (Q = "" + te.key), M.type && M.type.defaultProps) var We = M.type.defaultProps; for (Oe in te) K.call(te, Oe) && !ce.hasOwnProperty(Oe) && ($[Oe] = te[Oe] === void 0 && We !== void 0 ? We[Oe] : te[Oe]); } var Oe = arguments.length - 2; if (Oe === 1) $.children = Ie; else if (1 < Oe) { We = Array(Oe); for (var pt = 0; pt < Oe; pt++) We[pt] = arguments[pt + 2]; $.children = We; } return { $$typeof: t, type: M.type, key: Q, ref: Qe, props: $, _owner: Re }; }, Pt.createContext = function(M) { return M = { $$typeof: a, _currentValue: M, _currentValue2: M, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }, M.Provider = { $$typeof: s, _context: M }, M.Consumer = M; }, Pt.createElement = H, Pt.createFactory = function(M) { var te = H.bind(null, M); return te.type = M, te; }, Pt.createRef = function() { return { current: null }; }, Pt.forwardRef = function(M) { return { $$typeof: l, render: M }; }, Pt.isValidElement = Z, Pt.lazy = function(M) { return { $$typeof: p, _payload: { _status: -1, _result: M }, _init: ke }; }, Pt.memo = function(M, te) { return { $$typeof: d, type: M, compare: te === void 0 ? null : te }; }, Pt.startTransition = function(M) { var te = de.transition; de.transition = {}; try { M(); } finally { de.transition = te; } }, Pt.unstable_act = B, Pt.useCallback = function(M, te) { return pe.current.useCallback(M, te); }, Pt.useContext = function(M) { return pe.current.useContext(M); }, Pt.useDebugValue = function() { }, Pt.useDeferredValue = function(M) { return pe.current.useDeferredValue(M); }, Pt.useEffect = function(M, te) { return pe.current.useEffect(M, te); }, Pt.useId = function() { return pe.current.useId(); }, Pt.useImperativeHandle = function(M, te, Ie) { return pe.current.useImperativeHandle(M, te, Ie); }, Pt.useInsertionEffect = function(M, te) { return pe.current.useInsertionEffect(M, te); }, Pt.useLayoutEffect = function(M, te) { return pe.current.useLayoutEffect(M, te); }, Pt.useMemo = function(M, te) { return pe.current.useMemo(M, te); }, Pt.useReducer = function(M, te, Ie) { return pe.current.useReducer(M, te, Ie); }, Pt.useRef = function(M) { return pe.current.useRef(M); }, Pt.useState = function(M) { return pe.current.useState(M); }, Pt.useSyncExternalStore = function(M, te, Ie) { return pe.current.useSyncExternalStore(M, te, Ie); }, Pt.useTransition = function() { return pe.current.useTransition(); }, Pt.version = "18.3.1", Pt; } var tS; function uw() { return tS || (tS = 1, wg.exports = mI()), wg.exports; } var vt = uw(); const Qv = /* @__PURE__ */ Bo(vt), U1 = {}, gI = vt.createContext( void 0 ), M1 = (t) => vt.useContext(gI) || pI(), B1 = (t) => typeof (t == null ? void 0 : t.then) == "function", vI = (t) => { t.status = "pending", t.then( (e) => { t.status = "fulfilled", t.value = e; }, (e) => { t.status = "rejected", t.reason = e; } ); }, yI = Qv.use || ((t) => { if (t.status === "pending") throw t; if (t.status === "fulfilled") return t.value; throw t.status === "rejected" ? t.reason : (vI(t), t); }), _g = /* @__PURE__ */ new WeakMap(), wI = (t) => { let e = _g.get(t); return e || (e = new Promise((n, r) => { let i = t; const s = (f) => (d) => { i === f && n(d); }, a = (f) => (d) => { i === f && r(d); }, l = (f) => { "onCancel" in f && typeof f.onCancel == "function" && f.onCancel((d) => { if ((U1 ? "production" : void 0) !== "production" && d === f) throw new Error("[Bug] p is not updated even after cancelation"); B1(d) ? (_g.set(d, e), i = d, d.then(s(d), a(d)), l(d)) : n(d); }); }; t.then(s(t), a(t)), l(t); }), _g.set(t, e)), e; }; function Lh(t, e) { const n = M1(), [[r, i, s], a] = vt.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 || s !== t) && (a(), l = n.get(t)), vt.useEffect(() => { const d = n.sub(t, () => { a(); }); return a(), d; }, [n, t, void 0]), vt.useDebugValue(l), B1(l)) { const d = wI(l); return yI(d); } return l; } function lw(t, e) { const n = M1(); return vt.useCallback( (...i) => { if ((U1 ? "production" : void 0) !== "production" && !("write" in t)) throw new Error("not writable atom"); return n.set(t, ...i); }, [n, t] ); } function Sg(t, e) { return [ Lh(t), // We do wrong type assertion here, which results in throwing an error. lw(t) ]; } const j1 = Ts(null); j1.debugLabel = "accountAtom"; function _I(t, e, n) { fetch(e).then((r) => r.blob()).then((r) => $1(r, `${t}.${n}`)); } const $1 = (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 s = window.URL && window.URL.createObjectURL ? window.URL.createObjectURL(i) : window.webkitURL.createObjectURL(i), a = document.createElement("a"); return a.style.display = "none", a.href = s, a.setAttribute("download", e), typeof a.download > "u" && a.setAttribute("target", "_blank"), document.body.appendChild(a), a.click(), setTimeout(() => { document.body.removeChild(a), window.URL.revokeObjectURL(s); }, 200); }; var SI = "2.0.3", Jv = 500, nS = "user-agent", dl = "", rS = "?", Uh = "function", To = "undefined", fl = "object", Xv = "string", Ar = "browser", Is = "cpu", Zi = "device", xi = "engine", ni = "os", al = "result", Be = "name", Ne = "type", Ue = "vendor", $e = "version", Cr = "architecture", ud = "major", Pe = "model", Kc = "console", xt = "mobile", tn = "tablet", Tn = "smarttv", Xi = "wearable", bg = "xr", Gc = "embedded", wc = "inapp", cw = "brands", Ia = "formFactors", dw = "fullVersionList", ul = "platform", fw = "platformVersion", dp = "bitness", jo = "sec-ch-ua", bI = jo + "-full-version-list", kI = jo + "-arch", EI = jo + "-" + dp, AI = jo + "-form-factors", CI = jo + "-" + xt, xI = jo + "-" + Pe, V1 = jo + "-" + ul, NI = V1 + "-version", z1 = [cw, dw, xt, Pe, ul, fw, Cr, Ia, dp], Wf = "Amazon", $u = "Apple", iS = "ASUS", sS = "BlackBerry", Sa = "Google", oS = "Huawei", aS = "Lenovo", uS = "Honor", Yf = "LG", kg = "Microsoft", Eg = "Motorola", Ag = "Nvidia", lS = "OnePlus", Cg = "OPPO", _c = "Samsung", cS = "Sharp", Sc = "Sony", xg = "Xiaomi", Ng = "Zebra", dS = "Chrome", fS = "Chromium", vo = "Chromecast", TI = "Edge", bc = "Firefox", kc = "Opera", Tg = "Facebook", hS = "Sogou", Vu = "Mobile ", Ec = " Browser", Zv = "Windows", II = typeof window !== To, xr = II && window.navigator ? window.navigator : void 0, Ao = xr && xr.userAgentData ? xr.userAgentData : void 0, RI = function(t, e) { var n = {}, r = e; if (!Mh(e)) { r = {}; for (var i in e) for (var s in e[i]) r[s] = e[i][s].concat(r[s] ? r[s] : []); } for (var a in t) n[a] = r[a] && r[a].length % 2 === 0 ? r[a].concat(t[a]) : t[a]; return n; }, fp = function(t) { for (var e = {}, n = 0; n < t.length; n++) e[t[n].toUpperCase()] = t[n]; return e; }, ey = function(t, e) { if (typeof t === fl && t.length > 0) { for (var n in t) if (Ps(t[n]) == Ps(e)) return !0; return !1; } return _l(t) ? Ps(e).indexOf(Ps(t)) !== -1 : !1; }, Mh = function(t, e) { for (var n in t) return /^(browser|cpu|device|engine|os)$/.test(n) || (e ? Mh(t[n]) : !1); }, _l = function(t) { return typeof t === Xv; }, Ig = 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 = ld(n[r]).split(";v="); e[r] = { brand: i[0], version: i[1] }; } else e[r] = ld(n[r]); return e; } }, Ps = function(t) { return _l(t) ? t.toLowerCase() : t; }, Rg = function(t) { return _l(t) ? hl(/[^\d\.]/g, t).split(".")[0] : void 0; }, Ds = 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 _l(e) ? e.replace(t, dl) : e; }, Ac = function(t) { return hl(/\\?\"/g, t); }, ld = function(t, e) { if (_l(t)) return t = hl(/^\s\s*/, t), typeof e === To ? t : t.substring(0, Jv); }, Og = function(t, e) { if (!(!t || !e)) for (var n = 0, r, i, s, a, 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 (s = 0; s < p.length; s++) f = l[++i], a = p[s], typeof a === fl && a.length > 0 ? a.length === 2 ? typeof a[1] == Uh ? this[a[0]] = a[1].call(this, f) : this[a[0]] = a[1] : a.length === 3 ? typeof a[1] === Uh && !(a[1].exec && a[1].test) ? this[a[0]] = f ? a[1].call(this, f, a[2]) : void 0 : this[a[0]] = f ? f.replace(a[1], a[2]) : void 0 : a.length === 4 && (this[a[0]] = f ? a[3].call(this, f.replace(a[1], a[2])) : void 0) : this[a] = f || void 0; n += 2; } }, Co = 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 (ey(e[n][r], t)) return n === rS ? void 0 : n; } else if (ey(e[n], t)) return n === rS ? void 0 : n; return e.hasOwnProperty("*") ? e["*"] : t; }, pS = { 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" }, mS = { embedded: "Automotive", mobile: "Mobile", tablet: ["Tablet", "EInk"], smarttv: "TV", wearable: "Watch", xr: ["VR", "XR"], "?": ["Desktop", "Unknown"], "*": void 0 }, gS = { browser: [ [ // Most common regardless engine /\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [$e, [Be, Vu + "Chrome"]], [ /edg(?:e|ios|a)?\/([\w\.]+)/i // Microsoft Edge ], [$e, [Be, "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 ], [Be, $e], [ /opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0 ], [$e, [Be, kc + " Mini"]], [ /\bop(?:rg)?x\/([\w\.]+)/i // Opera GX ], [$e, [Be, kc + " GX"]], [ /\bopr\/([\w\.]+)/i // Opera Webkit ], [$e, [Be, kc]], [ // Mixed /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu ], [$e, [Be, "Baidu"]], [ /\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i // Maxthon ], [$e, [Be, "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 ], [Be, $e], [ /quark(?:pc)?\/([-\w\.]+)/i // Quark ], [$e, [Be, "Quark"]], [ /\bddg\/([\w\.]+)/i // DuckDuckGo ], [$e, [Be, "DuckDuckGo"]], [ /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser ], [$e, [Be, "UCBrowser"]], [ /microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser /\bqbcore\/([\w\.]+).+microm/i, /micromessenger\/([\w\.]+)/i // WeChat ], [$e, [Be, "WeChat"]], [ /konqueror\/([\w\.]+)/i // Konqueror ], [$e, [Be, "Konqueror"]], [ /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11 ], [$e, [Be, "IE"]], [ /ya(?:search)?browser\/([\w\.]+)/i // Yandex ], [$e, [Be, "Yandex"]], [ /slbrowser\/([\w\.]+)/i // Smart Lenovo Browser ], [$e, [Be, "Smart " + aS + Ec]], [ /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser ], [[Be, /(.+)/, "$1 Secure" + Ec], $e], [ /\bfocus\/([\w\.]+)/i // Firefox Focus ], [$e, [Be, bc + " Focus"]], [ /\bopt\/([\w\.]+)/i // Opera Touch ], [$e, [Be, kc + " Touch"]], [ /coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser ], [$e, [Be, "Coc Coc"]], [ /dolfin\/([\w\.]+)/i // Dolphin ], [$e, [Be, "Dolphin"]], [ /coast\/([\w\.]+)/i // Opera Coast ], [$e, [Be, kc + " Coast"]], [ /miuibrowser\/([\w\.]+)/i // MIUI Browser ], [$e, [Be, "MIUI" + Ec]], [ /fxios\/([\w\.-]+)/i // Firefox for iOS ], [$e, [Be, Vu + bc]], [ /\bqihoobrowser\/?([\w\.]*)/i // 360 ], [$e, [Be, "360"]], [ /\b(qq)\/([\w\.]+)/i // QQ ], [[Be, /(.+)/, "$1Browser"], $e], [ /(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i ], [[Be, /(.+)/, "$1" + Ec], $e], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser /samsungbrowser\/([\w\.]+)/i // Samsung Internet ], [$e, [Be, _c + " Internet"]], [ /metasr[\/ ]?([\d\.]+)/i // Sogou Explorer ], [$e, [Be, hS + " Explorer"]], [ /(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile ], [[Be, hS + " Mobile"], $e], [ /(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 ], [Be, $e], [ /(lbbrowser|rekonq)/i // LieBao Browser/Rekonq ], [Be], [ /ome\/([\w\.]+) \w* ?(iron) saf/i, // Iron /ome\/([\w\.]+).+qihu (360)[es]e/i // 360 ], [$e, Be], [ // WebView /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android ], [[Be, Tg], $e, [Ne, wc]], [ /(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 ], [Be, $e, [Ne, wc]], [ /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS ], [$e, [Be, "GSA"], [Ne, wc]], [ /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok ], [$e, [Be, "TikTok"], [Ne, wc]], [ /\[(linkedin)app\]/i // LinkedIn App for iOS & Android ], [Be, [Ne, wc]], [ /(chromium)[\/ ]([-\w\.]+)/i // Chromium ], [Be, $e], [ /headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless ], [$e, [Be, dS + " Headless"]], [ / wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView ], [[Be, dS + " WebView"], $e], [ /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser ], [$e, [Be, "Android" + Ec]], [ /chrome\/([\w\.]+) mobile/i // Chrome Mobile ], [$e, [Be, Vu + "Chrome"]], [ /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [Be, $e], [ /version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i // Safari Mobile ], [$e, [Be, Vu + "Safari"]], [ /iphone .*mobile(?:\/\w+ | ?)safari/i ], [[Be, Vu + "Safari"]], [ /version\/([\w\.\,]+) .*(safari)/i // Safari ], [$e, Be], [ /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [Be, [$e, "1"]], [ /(webkit|khtml)\/([\w\.]+)/i ], [Be, $e], [ // Gecko based /(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i // Firefox Mobile ], [[Be, Vu + bc], $e], [ /(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape ], [[Be, "Netscape"], $e], [ /(wolvic|librewolf)\/([\w\.]+)/i // Wolvic/LibreWolf ], [Be, $e], [ /mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality ], [$e, [Be, bc + " 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 ], [Be, [$e, /_/g, "."]], [ /(cobalt)\/([\w\.]+)/i // Cobalt ], [Be, [$e, /[^\d\.]+./, dl]] ], cpu: [ [ /\b((amd|x|x86[-_]?|wow|win)64)\b/i // AMD64 (x64) ], [[Cr, "amd64"]], [ /(ia32(?=;))/i, // IA32 (quicktime) /\b((i[346]|x)86)(pc)?\b/i // IA32 (x86) ], [[Cr, "ia32"]], [ /\b(aarch64|arm(v?[89]e?l?|_?64))\b/i // ARM64 ], [[Cr, "arm64"]], [ /\b(arm(v[67])?ht?n?[fl]p?)\b/i // ARMHF ], [[Cr, "armhf"]], [ // PocketPC mistakenly identified as PowerPC /( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i ], [[Cr, "arm"]], [ /((ppc|powerpc)(64)?)( mac|;|\))/i // PowerPC ], [[Cr, /ower/, dl, Ps]], [ / sun4\w[;\)]/i // SPARC ], [[Cr, "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 ], [[Cr, Ps]] ], 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 ], [Pe, [Ue, _c], [Ne, tn]], [ /\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i, /samsung[- ]((?!sm-[lr])[-\w]+)/i, /sec-(sgh\w+)/i ], [Pe, [Ue, _c], [Ne, xt]], [ // Apple /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone ], [Pe, [Ue, $u], [Ne, xt]], [ /\((ipad);[-\w\),; ]+apple/i, // iPad /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i ], [Pe, [Ue, $u], [Ne, tn]], [ /(macintosh);/i ], [Pe, [Ue, $u]], [ // Sharp /\b(sh-?[altvz]?\d\d[a-ekm]?)/i ], [Pe, [Ue, cS], [Ne, xt]], [ // Honor /\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i ], [Pe, [Ue, uS], [Ne, tn]], [ /honor([-\w ]+)[;\)]/i ], [Pe, [Ue, uS], [Ne, xt]], [ // 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 ], [Pe, [Ue, oS], [Ne, tn]], [ /(?:huawei)([-\w ]+)[;\)]/i, /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i ], [Pe, [Ue, oS], [Ne, xt]], [ // 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 ], [[Pe, /_/g, " "], [Ue, xg], [Ne, tn]], [ /\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 ], [[Pe, /_/g, " "], [Ue, xg], [Ne, xt]], [ // OPPO /; (\w+) bui.+ oppo/i, /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i ], [Pe, [Ue, Cg], [Ne, xt]], [ /\b(opd2(\d{3}a?))(?: bui|\))/i ], [Pe, [Ue, Co, { OnePlus: ["304", "403", "203"], "*": Cg }], [Ne, tn]], [ // BLU Vivo Series /(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i ], [Pe, [Ue, "BLU"], [Ne, xt]], [ // Vivo /; vivo (\w+)(?: bui|\))/i, /\b(v[12]\d{3}\w?[at])(?: bui|;)/i ], [Pe, [Ue, "Vivo"], [Ne, xt]], [ // Realme /\b(rmx[1-3]\d{3})(?: bui|;|\))/i ], [Pe, [Ue, "Realme"], [Ne, xt]], [ // 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 ], [Pe, [Ue, Eg], [Ne, xt]], [ /\b(mz60\d|xoom[2 ]{0,2}) build\//i ], [Pe, [Ue, Eg], [Ne, tn]], [ // LG /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i ], [Pe, [Ue, Yf], [Ne, tn]], [ /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i, /\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch))(\w+)/i, /\blg-?([\d\w]+) bui/i ], [Pe, [Ue, Yf], [Ne, xt]], [ // 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 ], [Pe, [Ue, aS], [Ne, tn]], [ // Nokia /(nokia) (t[12][01])/i ], [Ue, Pe, [Ne, tn]], [ /(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i, /nokia[-_ ]?(([-\w\. ]*))/i ], [[Pe, /_/g, " "], [Ne, xt], [Ue, "Nokia"]], [ // Google /(pixel (c|tablet))\b/i // Google Pixel C/Tablet ], [Pe, [Ue, Sa], [Ne, tn]], [ /droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel ], [Pe, [Ue, Sa], [Ne, xt]], [ // 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 ], [Pe, [Ue, Sc], [Ne, xt]], [ /sony tablet [ps]/i, /\b(?:sony)?sgp\w+(?: bui|\))/i ], [[Pe, "Xperia Tablet"], [Ue, Sc], [Ne, tn]], [ // OnePlus / (kb2005|in20[12]5|be20[12][59])\b/i, /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i ], [Pe, [Ue, lS], [Ne, xt]], [ // 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 ], [Pe, [Ue, Wf], [Ne, tn]], [ /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone ], [[Pe, /(.+)/g, "Fire Phone $1"], [Ue, Wf], [Ne, xt]], [ // BlackBerry /(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook ], [Pe, Ue, [Ne, tn]], [ /\b((?:bb[a-f]|st[hv])100-\d)/i, /\(bb10; (\w+)/i // BlackBerry 10 ], [Pe, [Ue, sS], [Ne, xt]], [ // Asus /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i ], [Pe, [Ue, iS], [Ne, tn]], [ / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i ], [Pe, [Ue, iS], [Ne, xt]], [ // HTC /(nexus 9)/i // HTC Nexus 9 ], [Pe, [Ue, "HTC"], [Ne, tn]], [ /(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 ], [Ue, [Pe, /_/g, " "], [Ne, xt]], [ // 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 ], [Pe, [Ue, "TCL"], [Ne, tn]], [ /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 ], [Pe, [Ue, "TCL"], [Ne, xt]], [ // itel /(itel) ((\w+))/i ], [[Ue, Ps], Pe, [Ne, Co, { tablet: ["p10001l", "w7001"], "*": "mobile" }]], [ // Acer /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i ], [Pe, [Ue, "Acer"], [Ne, tn]], [ // Meizu /droid.+; (m[1-5] note) bui/i, /\bmz-([-\w]{2,})/i ], [Pe, [Ue, "Meizu"], [Ne, xt]], [ // Ulefone /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i ], [Pe, [Ue, "Ulefone"], [Ne, xt]], [ // Energizer /; (energy ?\w+)(?: bui|\))/i, /; energizer ([\w ]+)(?: bui|\))/i ], [Pe, [Ue, "Energizer"], [Ne, xt]], [ // Cat /; cat (b35);/i, /; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i ], [Pe, [Ue, "Cat"], [Ne, xt]], [ // Smartfren /((?:new )?andromax[\w- ]+)(?: bui|\))/i ], [Pe, [Ue, "Smartfren"], [Ne, xt]], [ // Nothing /droid.+; (a(?:015|06[35]|142p?))/i ], [Pe, [Ue, "Nothing"], [Ne, xt]], [ // Archos /; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i, /archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i ], [Pe, [Ue, "Archos"], [Ne, tn]], [ /archos ([\w ]+)( b|\))/i, /; (ac[3-6]\d\w{2,8})( b|\))/i ], [Pe, [Ue, "Archos"], [Ne, xt]], [ // MIXED /(imo) (tab \w+)/i, // IMO /(infinix) (x1101b?)/i // Infinix XPad ], [Ue, Pe, [Ne, tn]], [ /(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 ], [Ue, Pe, [Ne, xt]], [ /(kobo)\s(ereader|touch)/i, // Kobo /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad /(kindle)\/([\w\.]+)/i // Kindle ], [Ue, Pe, [Ne, tn]], [ /(surface duo)/i // Surface Duo ], [Pe, [Ue, kg], [Ne, tn]], [ /droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone ], [Pe, [Ue, "Fairphone"], [Ne, xt]], [ /((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i // Nvidia Tablets ], [Pe, [Ue, Ag], [Ne, tn]], [ /(sprint) (\w+)/i // Sprint Phones ], [Ue, Pe, [Ne, xt]], [ /(kin\.[onetw]{3})/i // Microsoft Kin ], [[Pe, /\./g, " "], [Ue, kg], [Ne, xt]], [ /droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra ], [Pe, [Ue, Ng], [Ne, tn]], [ /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i ], [Pe, [Ue, Ng], [Ne, xt]], [ /////////////////// // SMARTTVS /////////////////// /smart-tv.+(samsung)/i // Samsung ], [Ue, [Ne, Tn]], [ /hbbtv.+maple;(\d+)/i ], [[Pe, /^/, "SmartTV"], [Ue, _c], [Ne, Tn]], [ /tcast.+(lg)e?. ([-\w]+)/i // LG SmartTV ], [Ue, Pe, [Ne, Tn]], [ /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i ], [[Ue, Yf], [Ne, Tn]], [ /(apple) ?tv/i // Apple TV ], [Ue, [Pe, $u + " TV"], [Ne, Tn]], [ /crkey.*devicetype\/chromecast/i // Google Chromecast Third Generation ], [[Pe, vo + " Third Generation"], [Ue, Sa], [Ne, Tn]], [ /crkey.*devicetype\/([^/]*)/i // Google Chromecast with specific device type ], [[Pe, /^/, "Chromecast "], [Ue, Sa], [Ne, Tn]], [ /fuchsia.*crkey/i // Google Chromecast Nest Hub ], [[Pe, vo + " Nest Hub"], [Ue, Sa], [Ne, Tn]], [ /crkey/i // Google Chromecast, Linux-based or unknown ], [[Pe, vo], [Ue, Sa], [Ne, Tn]], [ /(portaltv)/i // Facebook Portal TV ], [Pe, [Ue, Tg], [Ne, Tn]], [ /droid.+aft(\w+)( bui|\))/i // Fire TV ], [Pe, [Ue, Wf], [Ne, Tn]], [ /(shield \w+ tv)/i // Nvidia Shield TV ], [Pe, [Ue, Ag], [Ne, Tn]], [ /\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i // Sharp ], [Pe, [Ue, cS], [Ne, Tn]], [ /(bravia[\w ]+)( bui|\))/i // Sony ], [Pe, [Ue, Sc], [Ne, Tn]], [ /(mi(tv|box)-?\w+) bui/i // Xiaomi ], [Pe, [Ue, xg], [Ne, Tn]], [ /Hbbtv.*(technisat) (.*);/i // TechniSAT ], [Ue, Pe, [Ne, Tn]], [ /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices ], [[Ue, ld], [Pe, ld], [Ne, Tn]], [ // SmartTV from Unidentified Vendors /droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i ], [Pe, [Ne, Tn]], [ /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i ], [[Ne, Tn]], [ /////////////////// // CONSOLES /////////////////// /(ouya)/i, // Ouya /(nintendo) (\w+)/i // Nintendo ], [Ue, Pe, [Ne, Kc]], [ /droid.+; (shield)( bui|\))/i // Nvidia Portable ], [Pe, [Ue, Ag], [Ne, Kc]], [ /(playstation \w+)/i // Playstation ], [Pe, [Ue, Sc], [Ne, Kc]], [ /\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox ], [Pe, [Ue, kg], [Ne, Kc]], [ /////////////////// // WEARABLES /////////////////// /\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i // Samsung Galaxy Watch ], [Pe, [Ue, _c], [Ne, Xi]], [ /((pebble))app/i, // Pebble /(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i // Asus ZenWatch / LG Watch / Pixel Watch ], [Ue, Pe, [Ne, Xi]], [ /(ow(?:19|20)?we?[1-3]{1,3})/i // Oppo Watch ], [Pe, [Ue, Cg], [Ne, Xi]], [ /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch ], [Pe, [Ue, $u], [Ne, Xi]], [ /(opwwe\d{3})/i // OnePlus Watch ], [Pe, [Ue, lS], [Ne, Xi]], [ /(moto 360)/i // Motorola 360 ], [Pe, [Ue, Eg], [Ne, Xi]], [ /(smartwatch 3)/i // Sony SmartWatch ], [Pe, [Ue, Sc], [Ne, Xi]], [ /(g watch r)/i // LG G Watch R ], [Pe, [Ue, Yf], [Ne, Xi]], [ /droid.+; (wt63?0{2,3})\)/i ], [Pe, [Ue, Ng], [Ne, Xi]], [ /////////////////// // XR /////////////////// /droid.+; (glass) \d/i // Google Glass ], [Pe, [Ue, Sa], [Ne, bg]], [ /(pico) (4|neo3(?: link|pro)?)/i // Pico ], [Ue, Pe, [Ne, bg]], [ /(quest( \d| pro)?s?).+vr/i // Meta Quest ], [Pe, [Ue, Tg], [Ne, bg]], [ /////////////////// // EMBEDDED /////////////////// /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla ], [Ue, [Ne, Gc]], [ /(aeobc)\b/i // Echo Dot ], [Pe, [Ue, Wf], [Ne, Gc]], [ /(homepod).+mac os/i // Apple HomePod ], [Pe, [Ue, $u], [Ne, Gc]], [ /windows iot/i ], [[Ne, Gc]], [ //////////////////// // MIXED (GENERIC) /////////////////// /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i ], [Pe, [Ne, Co, { mobile: "Mobile", xr: "VR", "*": tn }]], [ /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet ], [[Ne, tn]], [ /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile ], [[Ne, xt]], [ /droid .+?; ([\w\. -]+)( bui|\))/i // Generic Android Device ], [Pe, [Ue, "Generic"]] ], engine: [ [ /windows.+ edge\/([\w\.]+)/i // EdgeHTML ], [$e, [Be, TI + "HTML"]], [ /(arkweb)\/([\w\.]+)/i // ArkWeb ], [Be, $e], [ /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink ], [$e, [Be, "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 ], [Be, $e], [ /ladybird\//i ], [[Be, "LibWeb"]], [ /rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko ], [$e, Be] ], os: [ [ // Windows /microsoft (windows) (vista|xp)/i // Windows (iTunes) ], [Be, $e], [ /(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i // Windows Phone ], [Be, [$e, Co, pS]], [ /windows nt 6\.2; (arm)/i, // Windows RT /windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i, /(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i ], [[$e, Co, pS], [Be, Zv]], [ // iOS/macOS /[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i, /cfnetwork\/.+darwin/i ], [[$e, /_/g, "."], [Be, "iOS"]], [ /(mac os x) ?([\w\. ]*)/i, /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS ], [[Be, "macOS"], [$e, /_/g, "."]], [ // Google Chromecast /android ([\d\.]+).*crkey/i // Google Chromecast, Android-based ], [$e, [Be, vo + " Android"]], [ /fuchsia.*crkey\/([\d\.]+)/i // Google Chromecast, Fuchsia-based ], [$e, [Be, vo + " Fuchsia"]], [ /crkey\/([\d\.]+).*devicetype\/smartspeaker/i // Google Chromecast, Linux-based Smart Speaker ], [$e, [Be, vo + " SmartSpeaker"]], [ /linux.*crkey\/([\d\.]+)/i // Google Chromecast, Legacy Linux-based ], [$e, [Be, vo + " Linux"]], [ /crkey\/([\d\.]+)/i // Google Chromecast, unknown ], [$e, [Be, vo]], [ // Mobile OSes /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS ], [$e, Be], [ /(ubuntu) ([\w\.]+) like android/i // Ubuntu Touch ], [[Be, /(.+)/, "$1 Touch"], $e], [ // 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 ], [Be, $e], [ /\(bb(10);/i // BlackBerry 10 ], [$e, [Be, sS]], [ /(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i // Symbian ], [$e, [Be, "Symbian"]], [ /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS ], [$e, [Be, bc + " OS"]], [ /web0s;.+rt(tv)/i, /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS ], [$e, [Be, "webOS"]], [ /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS ], [$e, [Be, "watchOS"]], [ // Google ChromeOS /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS ], [[Be, "Chrome OS"], $e], [ // 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 ], [Be, $e], [ /(sunos) ?([\w\.\d]*)/i // Solaris ], [[Be, "Solaris"], $e], [ /((?: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 ], [Be, $e] ] }, Qf = function() { var t = { init: {}, isIgnore: {}, isIgnoreRgx: {}, toString: {} }; return Ds.call(t.init, [ [Ar, [Be, $e, ud, Ne]], [Is, [Cr]], [Zi, [Ne, Pe, Ue]], [xi, [Be, $e]], [ni, [Be, $e]] ]), Ds.call(t.isIgnore, [ [Ar, [$e, ud]], [xi, [$e]], [ni, [$e]] ]), Ds.call(t.isIgnoreRgx, [ [Ar, / ?browser$/i], [ni, / ?os$/i] ]), Ds.call(t.toString, [ [Ar, [Be, $e]], [Is, [Cr]], [Zi, [Ue, Pe]], [xi, [Be, $e]], [ni, [Be, $e]] ]), t; }(), OI = function(t, e) { var n = Qf.init[e], r = Qf.isIgnore[e] || 0, i = Qf.isIgnoreRgx[e] || 0, s = Qf.toString[e] || 0; function a() { Ds.call(this, n); } return a.prototype.getItem = function() { return t; }, a.prototype.withClientHints = function() { return Ao ? Ao.getHighEntropyValues(z1).then(function(l) { return t.setCH(new q1(l, !1)).parseCH().get(); }) : t.parseCH().get(); }, a.prototype.withFeatureCheck = function() { return t.detectFeature().get(); }, e != al && (a.prototype.is = function(l) { var f = !1; for (var d in this) if (this.hasOwnProperty(d) && !ey(r, d) && Ps(i ? hl(i, this[d]) : this[d]) == Ps(i ? hl(i, l) : l)) { if (f = !0, l != To) break; } else if (l == To && f) { f = !f; break; } return f; }, a.prototype.toString = function() { var l = dl; for (var f in s) typeof this[s[f]] !== To && (l += (l ? " " : dl) + this[s[f]]); return l || To; }), Ao || (a.prototype.then = function(l) { var f = this, d = function() { for (var v in f) f.hasOwnProperty(v) && (this[v] = f[v]); }; d.prototype = { is: a.prototype.is, toString: a.prototype.toString }; var p = new d(); return l(p), p; }), new a(); }; function q1(t, e) { if (t = t || {}, Ds.call(this, z1), e) Ds.call(this, [ [cw, Ig(t[jo])], [dw, Ig(t[bI])], [xt, /\?1/.test(t[CI])], [Pe, Ac(t[xI])], [ul, Ac(t[V1])], [fw, Ac(t[NI])], [Cr, Ac(t[kI])], [Ia, Ig(t[AI])], [dp, Ac(t[EI])] ]); else for (var n in t) this.hasOwnProperty(n) && typeof t[n] !== To && (this[n] = t[n]); } function vS(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, s) { return this.data[i] = s, this; }, this.setCH = function(i) { return this.uaCH = i, this; }, this.detectFeature = function() { if (xr && xr.userAgent == this.ua) switch (this.itemType) { case Ar: xr.brave && typeof xr.brave.isBrave == Uh && this.set(Be, "Brave"); break; case Zi: !this.get(Ne) && Ao && Ao[xt] && this.set(Ne, xt), this.get(Pe) == "Macintosh" && xr && typeof xr.standalone !== To && xr.maxTouchPoints && xr.maxTouchPoints > 2 && this.set(Pe, "iPad").set(Ne, tn); break; case ni: !this.get(Be) && Ao && Ao[ul] && this.set(Be, Ao[ul]); break; case al: var i = this.data, s = function(a) { return i[a].getItem().detectFeature().get(); }; this.set(Ar, s(Ar)).set(Is, s(Is)).set(Zi, s(Zi)).set(xi, s(xi)).set(ni, s(ni)); } return this; }, this.parseUA = function() { return this.itemType != al && Og.call(this.data, this.ua, this.rgxMap), this.itemType == Ar && this.set(ud, Rg(this.get($e))), this; }, this.parseCH = function() { var i = this.uaCH, s = this.rgxMap; switch (this.itemType) { case Ar: case xi: var a = i[dw] || i[cw], l; if (a) for (var f in a) { var d = a[f].brand || a[f], p = a[f].version; this.itemType == Ar && !/not.a.brand/i.test(d) && (!l || /chrom/i.test(l) && d != fS) && (d = Co(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(Be, d).set($e, p).set(ud, Rg(p)), l = d), this.itemType == xi && d == fS && this.set($e, p); } break; case Is: var v = i[Cr]; v && (v && i[dp] == "64" && (v += "64"), Og.call(this.data, v + ";", s)); break; case Zi: if (i[xt] && this.set(Ne, xt), i[Pe] && (this.set(Pe, i[Pe]), !this.get(Ne) || !this.get(Ue))) { var y = {}; Og.call(y, "droid 9; " + i[Pe] + ")", s), !this.get(Ne) && y.type && this.set(Ne, y.type), !this.get(Ue) && y.vendor && this.set(Ue, y.vendor); } if (i[Ia]) { var k; if (typeof i[Ia] != "string") for (var E = 0; !k && E < i[Ia].length; ) k = Co(i[Ia][E++], mS); else k = Co(i[Ia], mS); this.set(Ne, k); } break; case ni: var A = i[ul]; if (A) { var T = i[fw]; A == Zv && (T = parseInt(Rg(T), 10) >= 13 ? "11" : "10"), this.set(Be, A).set($e, T); } this.get(Be) == Zv && i[Pe] == "Xbox" && this.set(Be, "Xbox").set($e, void 0); break; case al: var O = this.data, R = function(U) { return O[U].getItem().setCH(i).parseCH().get(); }; this.set(Ar, R(Ar)).set(Is, R(Is)).set(Zi, R(Zi)).set(xi, R(xi)).set(ni, R(ni)); } return this; }, Ds.call(this, [ ["itemType", t], ["ua", e], ["uaCH", r], ["rgxMap", n], ["data", OI(this, t)] ]), this; } function Ls(t, e, n) { if (typeof t === fl ? (Mh(t, !0) ? (typeof e === fl && (n = e), e = t) : (n = t, e = void 0), t = void 0) : typeof t === Xv && !Mh(e, !0) && (n = e, e = void 0), n && typeof n.append === Uh) { var r = {}; n.forEach(function(f, d) { r[d] = f; }), n = r; } if (!(this instanceof Ls)) return new Ls(t, e, n).getResult(); var i = typeof t === Xv ? t : ( // Passed user-agent string n && n[nS] ? n[nS] : ( // User-Agent from passed headers xr && xr.userAgent ? xr.userAgent : ( // navigator.userAgent dl ) ) ), s = new q1(n, !0), a = e ? RI(gS, e) : gS, l = function(f) { return f == al ? function() { return new vS(f, i, a, s).set("ua", i).set(Ar, this.getBrowser()).set(Is, this.getCPU()).set(Zi, this.getDevice()).set(xi, this.getEngine()).set(ni, this.getOS()).get(); } : function() { return new vS(f, i, a[f], s).parseUA().get(); }; }; return Ds.call(this, [ ["getBrowser", l(Ar)], ["getCPU", l(Is)], ["getDevice", l(Zi)], ["getEngine", l(xi)], ["getOS", l(ni)], ["getResult", l(al)], ["getUA", function() { return i; }], ["setUA", function(f) { return _l(f) && (i = f.length > Jv ? ld(f, Jv) : f), this; }] ]).setUA(i), this; } Ls.VERSION = SI; Ls.BROWSER = fp([Be, $e, ud, Ne]); Ls.CPU = fp([Cr]); Ls.DEVICE = fp([Pe, Ue, Ne, Kc, xt, Tn, tn, Xi, Gc]); Ls.ENGINE = Ls.OS = fp([Be, $e]); function mn(t) { return t != null && typeof t == "object" && t["@@functional/placeholder"] === !0; } function zr(t) { return function e(n) { return arguments.length === 0 || mn(n) ? e : t.apply(this, arguments); }; } function jr(t) { return function e(n, r) { switch (arguments.length) { case 0: return e; case 1: return mn(n) ? e : zr(function(i) { return t(n, i); }); default: return mn(n) && mn(r) ? e : mn(n) ? zr(function(i) { return t(i, r); }) : mn(r) ? zr(function(i) { return t(n, i); }) : t(n, r); } }; } function hp(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, s) { return e.apply(this, arguments); }; case 5: return function(n, r, i, s, a) { return e.apply(this, arguments); }; case 6: return function(n, r, i, s, a, l) { return e.apply(this, arguments); }; case 7: return function(n, r, i, s, a, l, f) { return e.apply(this, arguments); }; case 8: return function(n, r, i, s, a, l, f, d) { return e.apply(this, arguments); }; case 9: return function(n, r, i, s, a, l, f, d, p) { return e.apply(this, arguments); }; case 10: return function(n, r, i, s, a, 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 H1(t, e, n) { return function() { for (var r = [], i = 0, s = t, a = 0, l = !1; a < e.length || i < arguments.length; ) { var f; a < e.length && (!mn(e[a]) || i >= arguments.length) ? f = e[a] : (f = arguments[i], i += 1), r[a] = f, mn(f) ? l = !0 : s -= 1, a += 1; } return !l && s <= 0 ? n.apply(this, r) : hp(Math.max(0, s), H1(t, r, n)); }; } var K1 = /* @__PURE__ */ jr(function(e, n) { return e === 1 ? zr(n) : hp(e, H1(e, [], n)); }); function hw(t) { return function e(n, r, i) { switch (arguments.length) { case 0: return e; case 1: return mn(n) ? e : jr(function(s, a) { return t(n, s, a); }); case 2: return mn(n) && mn(r) ? e : mn(n) ? jr(function(s, a) { return t(s, r, a); }) : mn(r) ? jr(function(s, a) { return t(n, s, a); }) : zr(function(s) { return t(n, r, s); }); default: return mn(n) && mn(r) && mn(i) ? e : mn(n) && mn(r) ? jr(function(s, a) { return t(s, a, i); }) : mn(n) && mn(i) ? jr(function(s, a) { return t(s, r, a); }) : mn(r) && mn(i) ? jr(function(s, a) { return t(n, s, a); }) : mn(n) ? zr(function(s) { return t(s, r, i); }) : mn(r) ? zr(function(s) { return t(n, s, i); }) : mn(i) ? zr(function(s) { return t(n, r, s); }) : t(n, r, i); } }; } const G1 = Array.isArray || function(e) { return e != null && e.length >= 0 && Object.prototype.toString.call(e) === "[object Array]"; }, W1 = Number.isInteger || function(e) { return e << 0 === e; }; function Y1(t) { return Object.prototype.toString.call(t) === "[object String]"; } function Q1(t, e) { var n = t < 0 ? e.length + t : t; return Y1(e) ? e.charAt(n) : e[n]; } var PI = /* @__PURE__ */ jr(function(e, n) { if (n != null) return W1(e) ? Q1(e, n) : n[e]; }), DI = /* @__PURE__ */ zr(function(e) { return G1(e) ? !0 : !e || typeof e != "object" || Y1(e) ? !1 : e.length === 0 ? !0 : e.length > 0 ? e.hasOwnProperty(0) && e.hasOwnProperty(e.length - 1) : !1; }), yS = typeof Symbol < "u" ? Symbol.iterator : "@@iterator"; function FI(t, e, n) { return function(i, s, a) { if (DI(a)) return t(i, s, a); if (a == null) return s; if (typeof a["fantasy-land/reduce"] == "function") return e(i, s, a, "fantasy-land/reduce"); if (a[yS] != null) return n(i, s, a[yS]()); if (typeof a.next == "function") return n(i, s, a); if (typeof a.reduce == "function") return e(i, s, a, "reduce"); throw new TypeError("reduce: list must be array or iterable"); }; } function LI(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 UI = /* @__PURE__ */ jr(function(e, n) { return hp(e.length, function() { return e.apply(n, arguments); }); }); function MI(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 BI(t, e, n, r) { return t["@@transducer/result"](n[r](UI(t["@@transducer/step"], t), e)); } var jI = /* @__PURE__ */ FI(LI, BI, MI), $I = /* @__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 VI(t) { return new $I(t); } var zI = /* @__PURE__ */ hw(function(t, e, n) { return jI(typeof t == "function" ? VI(t) : t, e, n); }), qI = /* @__PURE__ */ zr(function(e) { return function() { return e; }; }), HI = /* @__PURE__ */ zr(function(e) { return K1(e.length, e); }), KI = /* @__PURE__ */ zr(function(e) { return e == null; }), GI = /* @__PURE__ */ jr(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, s) { return n.call(this, r, i, s); }; case 4: return function(r, i, s, a) { return n.call(this, r, i, s, a); }; case 5: return function(r, i, s, a, l) { return n.call(this, r, i, s, a, l); }; case 6: return function(r, i, s, a, l, f) { return n.call(this, r, i, s, a, l, f); }; case 7: return function(r, i, s, a, l, f, d) { return n.call(this, r, i, s, a, l, f, d); }; case 8: return function(r, i, s, a, l, f, d, p) { return n.call(this, r, i, s, a, l, f, d, p); }; case 9: return function(r, i, s, a, l, f, d, p, v) { return n.call(this, r, i, s, a, l, f, d, p, v); }; case 10: return function(r, i, s, a, l, f, d, p, v, y) { return n.call(this, r, i, s, a, 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 WI(t, e) { return function() { return e.call(this, t.apply(this, arguments)); }; } function J1(t, e) { return function() { var n = arguments.length; if (n === 0) return e(); var r = arguments[n - 1]; return G1(r) || typeof r[t] != "function" ? e.apply(this, arguments) : r[t].apply(r, Array.prototype.slice.call(arguments, 0, n - 1)); }; } var YI = /* @__PURE__ */ hw(/* @__PURE__ */ J1("slice", function(e, n, r) { return Array.prototype.slice.call(r, e, n); })), QI = /* @__PURE__ */ zr(/* @__PURE__ */ J1("tail", /* @__PURE__ */ YI(1, 1 / 0))); function wS() { if (arguments.length === 0) throw new Error("pipe requires at least one argument"); return hp(arguments[0].length, zI(WI, arguments[0], QI(arguments))); } var JI = /* @__PURE__ */ jr(function(e, n) { if (e > 10) throw new Error("Constructor with greater than ten arguments"); return e === 0 ? function() { return new n(); } : HI(GI(e, function(r, i, s, a, 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, s); case 4: return new n(r, i, s, a); case 5: return new n(r, i, s, a, l); case 6: return new n(r, i, s, a, l, f); case 7: return new n(r, i, s, a, l, f, d); case 8: return new n(r, i, s, a, l, f, d, p); case 9: return new n(r, i, s, a, l, f, d, p, v); case 10: return new n(r, i, s, a, l, f, d, p, v, y); } })); }), XI = /* @__PURE__ */ hw(function(e, n, r) { return K1(Math.max(e.length, n.length, r.length), function() { return e.apply(this, arguments) ? n.apply(this, arguments) : r.apply(this, arguments); }); }); function ZI(t, e) { for (var n = e, r = 0; r < t.length; r += 1) { if (n == null) return; var i = t[r]; W1(i) ? n = Q1(i, n) : n = n[i]; } return n; } var _S = /* @__PURE__ */ jr(function(e, n) { for (var r = {}, i = {}, s = 0, a = e.length; s < a; ) i[e[s]] = 1, s += 1; for (var l in n) i.hasOwnProperty(l) || (r[l] = n[l]); return r; }), eR = /* @__PURE__ */ jr(ZI); class Oi 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 X1 extends Oi { constructor(e) { super( "RESOURCE_NOT_FOUND_ERROR", `Resource with id '${e}' not found.`, e ); } } class xo extends Oi { constructor(e) { super( "APP_UNEXPECTED_ERROR", e.message ?? "An unexpected error occurred.", e ); } } class pw extends Oi { constructor() { super("APP_ACCOUNT_INVALID_ERROR", "Account not defined"); } } class Z1 extends Oi { 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 tR(t, e) { e.forEach((n) => { if (KI(eR(n.split("."), t))) throw new Z1(n); }); } function qt(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 nR = {}; function eA() { return typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : nR; } var tA = Object.assign, Bh = Object.getOwnPropertyDescriptor, ts = Object.defineProperty, pp = Object.prototype, ty = []; Object.freeze(ty); var mw = {}; Object.freeze(mw); var rR = typeof Proxy < "u", iR = /* @__PURE__ */ Object.toString(); function nA() { rR || qt("Proxy not available"); } function rA(t) { var e = !1; return function() { if (!e) return e = !0, t.apply(this, arguments); }; } var tl = function() { }; function Ii(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 mp(t) { return t !== null && typeof t == "object"; } function Us(t) { if (!mp(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() === iR; } function iA(t) { var e = t == null ? void 0 : t.constructor; return e ? e.name === "GeneratorFunction" || e.displayName === "GeneratorFunction" : !1; } function gp(t, e, n) { ts(t, e, { enumerable: !1, writable: !0, configurable: !0, value: n }); } function sA(t, e, n) { ts(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 mp(r) && r[n] === !0; }; } function Sl(t) { return t != null && Object.prototype.toString.call(t) === "[object Map]"; } function sR(t) { var e = Object.getPrototypeOf(t), n = Object.getPrototypeOf(e), r = Object.getPrototypeOf(n); return r === null; } function Rs(t) { return t != null && Object.prototype.toString.call(t) === "[object Set]"; } var oA = typeof Object.getOwnPropertySymbols < "u"; function oR(t) { var e = Object.keys(t); if (!oA) return e; var n = Object.getOwnPropertySymbols(t); return n.length ? [].concat(e, n.filter(function(r) { return pp.propertyIsEnumerable.call(t, r); })) : e; } var cd = typeof Reflect < "u" && Reflect.ownKeys ? Reflect.ownKeys : oA ? function(t) { return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)); } : ( /* istanbul ignore next */ Object.getOwnPropertyNames ); function aA(t) { return t === null ? null : typeof t == "object" ? "" + t : t; } function Po(t, e) { return pp.hasOwnProperty.call(t, e); } var aR = Object.getOwnPropertyDescriptors || function(e) { var n = {}; return cd(e).forEach(function(r) { n[r] = Bh(e, r); }), n; }; function $r(t, e) { return !!(t & e); } function Vr(t, e, n) { return n ? t |= e : t &= ~e, t; } function SS(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 uR(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, cR(r.key), r); } } function bl(t, e, n) { return e && uR(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 = dR(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 uA(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, ny(t, e); } function ny(t, e) { return ny = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) { return n.__proto__ = r, n; }, ny(t, e); } function lR(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 cR(t) { var e = lR(t, "string"); return typeof e == "symbol" ? e : e + ""; } function dR(t, e) { if (t) { if (typeof t == "string") return SS(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) ? SS(t, e) : void 0; } } var rl = /* @__PURE__ */ Symbol("mobx-stored-annotations"); function ns(t) { function e(n, r) { if (xd(r)) return t.decorate_20223_(n, r); kl(n, r, t); } return Object.assign(e, t); } function kl(t, e, n) { Po(t, rl) || gp(t, rl, Ka({}, t[rl])), yR(n) || (t[rl][e] = n); } function xd(t) { return typeof t == "object" && typeof t.kind == "string"; } var wt = /* @__PURE__ */ Symbol("mobx administration"), $o = /* @__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_ = zt.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 EA(this); }, e.reportChanged = function() { oi(), AA(this), ai(); }, e.toString = function() { return this.name_; }, bl(t, [{ key: "isBeingObserved", get: function() { return $r(this.flags_, t.isBeingObservedMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isBeingObservedMask_, r); } }, { key: "isPendingUnobservation", get: function() { return $r(this.flags_, t.isPendingUnobservationMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isPendingUnobservationMask_, r); } }, { key: "diffValue", get: function() { return $r(this.flags_, t.diffValueMask_) ? 1 : 0; }, set: function(r) { this.flags_ = Vr(this.flags_, t.diffValueMask_, r === 1); } }]); }(); $o.isBeingObservedMask_ = 1; $o.isPendingUnobservationMask_ = 2; $o.diffValueMask_ = 4; var gw = /* @__PURE__ */ tu("Atom", $o); function lA(t, e, n) { e === void 0 && (e = tl), n === void 0 && (n = tl); var r = new $o(t); return e !== tl && _O(r, e), n !== tl && RA(r, n), r; } function fR(t, e) { return bw(t, e); } function hR(t, e) { return bw(t, e, 1); } function pR(t, e) { return Object.is ? Object.is(t, e) : t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e; } var Ga = { structural: fR, default: pR, shallow: hR }; function Wa(t, e, n) { return FA(t) ? t : Array.isArray(t) ? Kn.array(t, { name: n }) : Us(t) ? Kn.object(t, void 0, { name: n }) : Sl(t) ? Kn.map(t, { name: n }) : Rs(t) ? Kn.set(t, { name: n }) : typeof t == "function" && !kp(t) && !fd(t) ? iA(t) ? pl(t) : dd(n, t) : t; } function mR(t, e, n) { if (t == null || Cp(t) || Ap(t) || ru(t) || El(t)) return t; if (Array.isArray(t)) return Kn.array(t, { name: n, deep: !1 }); if (Us(t)) return Kn.object(t, void 0, { name: n, deep: !1 }); if (Sl(t)) return Kn.map(t, { name: n, deep: !1 }); if (Rs(t)) return Kn.set(t, { name: n, deep: !1 }); } function vp(t) { return t; } function gR(t, e) { return bw(t, e) ? e : t; } var vR = "override"; function yR(t) { return t.annotationType_ === vR; } function Nd(t, e) { return { annotationType_: t, options_: e, make_: wR, extend_: _R, decorate_20223_: SR }; } function wR(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 (kp(n.value)) return 1; var s = cA(t, this, e, n, !1); return ts(r, e, s), 2; } function _R(t, e, n, r) { var i = cA(t, this, e, n); return t.defineProperty_(e, i, r); } function SR(t, e) { var n = e.kind, r = e.name, i = e.addInitializer, s = this, a = function(d) { var p, v, y, k; return Lo((p = (v = s.options_) == null ? void 0 : v.name) != null ? p : r.toString(), d, (y = (k = s.options_) == null ? void 0 : k.autoAction) != null ? y : !1); }; if (n == "field") { i(function() { kl(this, r, s); }); return; } if (n == "method") { var l; return kp(t) || (t = a(t)), (l = this.options_) != null && l.bound && i(function() { var f = this, d = f[r].bind(f); d.isMobxAction = !0, f[r] = d; }), t; } qt("Cannot apply '" + s.annotationType_ + "' to '" + String(r) + "' (kind: " + n + "):" + (` '` + s.annotationType_ + "' can only be used on properties with a function value.")); } function bR(t, e, n, r) { e.annotationType_, r.value; } function cA(t, e, n, r, i) { var s, a, l, f, d, p, v; i === void 0 && (i = rt.safeDescriptors), bR(t, e, n, r); var y = r.value; if ((s = e.options_) != null && s.bound) { var k; y = y.bind((k = t.proxy_) != null ? k : t.target_); } return { value: Lo( (a = (l = e.options_) == null ? void 0 : l.name) != null ? a : 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 dA(t, e) { return { annotationType_: t, options_: e, make_: kR, extend_: ER, decorate_20223_: AR }; } function kR(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 && (!Po(t.target_, e) || !fd(t.target_[e])) && this.extend_(t, e, n, !1) === null) return 0; if (fd(n.value)) return 1; var s = fA(t, this, e, n, !1, !1); return ts(r, e, s), 2; } function ER(t, e, n, r) { var i, s = fA(t, this, e, n, (i = this.options_) == null ? void 0 : i.bound); return t.defineProperty_(e, s, r); } function AR(t, e) { var n, r = e.name, i = e.addInitializer; return fd(t) || (t = pl(t)), (n = this.options_) != null && n.bound && i(function() { var s = this, a = s[r].bind(s); a.isMobXFlow = !0, s[r] = a; }), t; } function CR(t, e, n, r) { e.annotationType_, r.value; } function fA(t, e, n, r, i, s) { s === void 0 && (s = rt.safeDescriptors), CR(t, e, n, r); var a = r.value; if (fd(a) || (a = pl(a)), i) { var l; a = a.bind((l = t.proxy_) != null ? l : t.target_), a.isMobXFlow = !0; } return { value: a, // Non-configurable for classes // prevents accidental field redefinition in subclass configurable: s ? 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: !s }; } function vw(t, e) { return { annotationType_: t, options_: e, make_: xR, extend_: NR, decorate_20223_: TR }; } function xR(t, e, n) { return this.extend_(t, e, n, !1) === null ? 0 : 1; } function NR(t, e, n, r) { return IR(t, this, e, n), t.defineComputedProperty_(e, Ka({}, this.options_, { get: n.get, set: n.set }), r); } function TR(t, e) { var n = this, r = e.name, i = e.addInitializer; return i(function() { var s = Al(this)[wt], a = Ka({}, n.options_, { get: t, context: this }); a.name || (a.name = "ObservableObject." + r.toString()), s.values_.set(r, new Ri(a)); }), function() { return this[wt].getObservablePropValue_(r); }; } function IR(t, e, n, r) { e.annotationType_, r.get; } function yp(t, e) { return { annotationType_: t, options_: e, make_: RR, extend_: OR, decorate_20223_: PR }; } function RR(t, e, n) { return this.extend_(t, e, n, !1) === null ? 0 : 1; } function OR(t, e, n, r) { var i, s; return DR(t, this), t.defineObservableProperty_(e, n.value, (i = (s = this.options_) == null ? void 0 : s.enhancer) != null ? i : Wa, r); } function PR(t, e) { var n = this, r = e.kind, i = e.name, s = /* @__PURE__ */ new WeakSet(); function a(l, f) { var d, p, v = Al(l)[wt], 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), s.add(l); } if (r == "accessor") return { get: function() { return s.has(this) || a(this, t.get.call(this)), this[wt].getObservablePropValue_(i); }, set: function(f) { return s.has(this) || a(this, f), this[wt].setObservablePropValue_(i, f); }, init: function(f) { return s.has(this) || a(this, f), f; } }; } function DR(t, e, n, r) { e.annotationType_; } var FR = "true", LR = /* @__PURE__ */ hA(); function hA(t) { return { annotationType_: FR, options_: t, make_: UR, extend_: MR, decorate_20223_: BR }; } function UR(t, e, n, r) { var i, s; if (n.get) return wp.make_(t, e, n, r); if (n.set) { var a = Lo(e.toString(), n.set); return r === t.target_ ? t.defineProperty_(e, { configurable: rt.safeDescriptors ? t.isPlainObject_ : !0, set: a }) === null ? 0 : 2 : (ts(r, e, { configurable: !0, set: a }), 2); } if (r !== t.target_ && typeof n.value == "function") { var l; if (iA(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 ? dd.bound : dd; return p.make_(t, e, n, r); } var v = ((i = this.options_) == null ? void 0 : i.deep) === !1 ? Kn.ref : Kn; if (typeof n.value == "function" && (s = this.options_) != null && s.autoBind) { var y; n.value = n.value.bind((y = t.proxy_) != null ? y : t.target_); } return v.make_(t, e, n, r); } function MR(t, e, n, r) { var i, s; if (n.get) return wp.extend_(t, e, n, r); if (n.set) return t.defineProperty_(e, { configurable: rt.safeDescriptors ? t.isPlainObject_ : !0, set: Lo(e.toString(), n.set) }, r); if (typeof n.value == "function" && (i = this.options_) != null && i.autoBind) { var a; n.value = n.value.bind((a = t.proxy_) != null ? a : t.target_); } var l = ((s = this.options_) == null ? void 0 : s.deep) === !1 ? Kn.ref : Kn; return l.extend_(t, e, n, r); } function BR(t, e) { qt("'" + this.annotationType_ + "' cannot be used as a decorator"); } var jR = "observable", $R = "observable.ref", VR = "observable.shallow", zR = "observable.struct", pA = { deep: !0, name: void 0, defaultDecorator: void 0, proxy: !0 }; Object.freeze(pA); function Jf(t) { return t || pA; } var ry = /* @__PURE__ */ yp(jR), qR = /* @__PURE__ */ yp($R, { enhancer: vp }), HR = /* @__PURE__ */ yp(VR, { enhancer: mR }), KR = /* @__PURE__ */ yp(zR, { enhancer: gR }), mA = /* @__PURE__ */ ns(ry); function Xf(t) { return t.deep === !0 ? Wa : t.deep === !1 ? vp : WR(t.defaultDecorator); } function GR(t) { var e; return t ? (e = t.defaultDecorator) != null ? e : hA(t) : void 0; } function WR(t) { var e, n; return t && (e = (n = t.options_) == null ? void 0 : n.enhancer) != null ? e : Wa; } function gA(t, e, n) { if (xd(e)) return ry.decorate_20223_(t, e); if (Ha(e)) { kl(t, e, ry); return; } return FA(t) ? t : Us(t) ? Kn.object(t, e, n) : Array.isArray(t) ? Kn.array(t, e) : Sl(t) ? Kn.map(t, e) : Rs(t) ? Kn.set(t, e) : typeof t == "object" && t !== null ? t : Kn.box(t, e); } tA(gA, mA); var YR = { box: function(e, n) { var r = Jf(n); return new $a(e, Xf(r), r.name, !0, r.equals); }, array: function(e, n) { var r = Jf(n); return (rt.useProxies === !1 || r.proxy === !1 ? jO : IO)(e, Xf(r), r.name); }, map: function(e, n) { var r = Jf(n); return new BA(e, Xf(r), r.name); }, set: function(e, n) { var r = Jf(n); return new jA(e, Xf(r), r.name); }, object: function(e, n, r) { return iu(function() { return PA(rt.useProxies === !1 || (r == null ? void 0 : r.proxy) === !1 ? Al({}, r) : CO({}, r), e, n); }); }, ref: /* @__PURE__ */ ns(qR), shallow: /* @__PURE__ */ ns(HR), deep: mA, struct: /* @__PURE__ */ ns(KR) }, Kn = /* @__PURE__ */ tA(gA, YR), vA = "computed", QR = "computed.struct", iy = /* @__PURE__ */ vw(vA), JR = /* @__PURE__ */ vw(QR, { equals: Ga.structural }), wp = function(e, n) { if (xd(n)) return iy.decorate_20223_(e, n); if (Ha(n)) return kl(e, n, iy); if (Us(e)) return ns(vw(vA, e)); var r = Us(n) ? n : {}; return r.get = e, r.name || (r.name = e.name || ""), new Ri(r); }; Object.assign(wp, iy); wp.struct = /* @__PURE__ */ ns(JR); var bS, kS, jh = 0, XR = 1, ZR = (bS = (kS = /* @__PURE__ */ Bh(function() { }, "name")) == null ? void 0 : kS.configurable) != null ? bS : !1, ES = { value: "action", configurable: !0, writable: !1, enumerable: !1 }; function Lo(t, e, n, r) { n === void 0 && (n = !1); function i() { return eO(t, n, e, r || this, arguments); } return i.isMobxAction = !0, i.toString = function() { return e.toString(); }, ZR && (ES.value = t, ts(i, "name", ES)), i; } function eO(t, e, n, r, i) { var s = tO(t, e); try { return n.apply(r, i); } catch (a) { throw s.error_ = a, a; } finally { nO(s); } } function tO(t, e, n, r) { var i = !1, s = 0, a = rt.trackingDerivation, l = !e || !a; oi(); var f = rt.allowStateChanges; l && (nu(), f = _p(!0)); var d = yw(!0), p = { runAsAction_: l, prevDerivation_: a, prevAllowStateChanges_: f, prevAllowStateReads_: d, notifySpy_: i, startTime_: s, actionId_: XR++, parentActionId_: jh }; return jh = p.actionId_, p; } function nO(t) { jh !== t.actionId_ && qt(30), jh = t.parentActionId_, t.error_ !== void 0 && (rt.suppressReactionErrors = !0), Sp(t.prevAllowStateChanges_), Xc(t.prevAllowStateReads_), ai(), t.runAsAction_ && Fs(t.prevDerivation_), rt.suppressReactionErrors = !1; } function yA(t, e) { var n = _p(t); try { return e(); } finally { Sp(n); } } function _p(t) { var e = rt.allowStateChanges; return rt.allowStateChanges = t, e; } function Sp(t) { rt.allowStateChanges = t; } var $a = /* @__PURE__ */ function(t) { function e(r, i, s, a, l) { var f; return s === void 0 && (s = "ObservableValue"), l === void 0 && (l = Ga.default), f = t.call(this, s) || 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_ = s, f.equals = l, f.value_ = i(r, void 0, s), f; } uA(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 !== rt.UNCHANGED && this.setNewValue_(i); }, n.prepareNewValue_ = function(i) { if (ri(this)) { var s = ii(this, { object: this, type: rs, newValue: i }); if (!s) return rt.UNCHANGED; i = s.newValue; } return i = this.enhancer(i, this.value_, this.name_), this.equals(this.value_, i) ? rt.UNCHANGED : i; }, n.setNewValue_ = function(i) { var s = this.value_; this.value_ = i, this.reportChanged(), Ni(this) && Ti(this, { type: rs, object: this, newValue: i, oldValue: s }); }, n.get = function() { return this.reportObserved(), this.dehanceValue(this.value_); }, n.intercept_ = function(i) { return Td(this, i); }, n.observe_ = function(i, s) { return s && i({ observableKind: "value", debugObjectName: this.name_, object: this, type: rs, newValue: this.value_, oldValue: void 0 }), Id(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 aA(this.get()); }, n[Symbol.toPrimitive] = function() { return this.valueOf(); }, e; }($o), Ri = /* @__PURE__ */ function() { function t(n) { this.dependenciesState_ = zt.NOT_TRACKING_, this.observing_ = [], this.newObserving_ = null, this.observers_ = /* @__PURE__ */ new Set(), this.runId_ = 0, this.lastAccessedBy_ = 0, this.lowestObserverState_ = zt.UP_TO_DATE_, this.unboundDepsCount_ = 0, this.value_ = new Vh(null), this.name_ = void 0, this.triggeredBy_ = void 0, this.flags_ = 0, this.derivation = void 0, this.setter_ = void 0, this.isTracing_ = $h.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 || qt(31), this.derivation = n.get, this.name_ = n.name || "ComputedValue", n.set && (this.setter_ = Lo("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() { oO(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 && qt(32, this.name_, this.derivation), rt.inBatch === 0 && // !globalState.trackingDerivatpion && this.observers_.size === 0 && !this.keepAlive_) sy(this) && (this.warnAboutUntrackedRead_(), oi(), this.value_ = this.computeValue_(!1), ai()); else if (EA(this), sy(this)) { var r = rt.trackingContext; this.keepAlive_ && !r && (rt.trackingContext = this), this.trackAndCompute() && sO(this), rt.trackingContext = r; } var i = this.value_; if (vh(i)) throw i.cause; return i; }, e.set = function(r) { if (this.setter_) { this.isRunningSetter && qt(33, this.name_), this.isRunningSetter = !0; try { this.setter_.call(this.scope_, r); } finally { this.isRunningSetter = !1; } } else qt(34, this.name_); }, e.trackAndCompute = function() { var r = this.value_, i = ( /* see #1208 */ this.dependenciesState_ === zt.NOT_TRACKING_ ), s = this.computeValue_(!0), a = i || vh(r) || vh(s) || !this.equals_(r, s); return a && (this.value_ = s), a; }, e.computeValue_ = function(r) { this.isComputing = !0; var i = _p(!1), s; if (r) s = wA(this, this.derivation, this.scope_); else if (rt.disableErrorBoundaries === !0) s = this.derivation.call(this.scope_); else try { s = this.derivation.call(this.scope_); } catch (a) { s = new Vh(a); } return Sp(i), this.isComputing = !1, s; }, e.suspend_ = function() { this.keepAlive_ || (oy(this), this.value_ = void 0); }, e.observe_ = function(r, i) { var s = this, a = !0, l = void 0; return Ep(function() { var f = s.get(); if (!a || i) { var d = nu(); r({ observableKind: "computed", debugObjectName: s.name_, type: rs, object: s, newValue: f, oldValue: l }), Fs(d); } a = !1, l = f; }); }, e.warnAboutUntrackedRead_ = function() { }, e.toString = function() { return this.name_ + "[" + this.derivation.toString() + "]"; }, e.valueOf = function() { return aA(this.get()); }, e[Symbol.toPrimitive] = function() { return this.valueOf(); }, bl(t, [{ key: "isComputing", get: function() { return $r(this.flags_, t.isComputingMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isComputingMask_, r); } }, { key: "isRunningSetter", get: function() { return $r(this.flags_, t.isRunningSetterMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isRunningSetterMask_, r); } }, { key: "isBeingObserved", get: function() { return $r(this.flags_, t.isBeingObservedMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isBeingObservedMask_, r); } }, { key: "isPendingUnobservation", get: function() { return $r(this.flags_, t.isPendingUnobservationMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isPendingUnobservationMask_, r); } }, { key: "diffValue", get: function() { return $r(this.flags_, t.diffValueMask_) ? 1 : 0; }, set: function(r) { this.flags_ = Vr(this.flags_, t.diffValueMask_, r === 1); } }]); }(); Ri.isComputingMask_ = 1; Ri.isRunningSetterMask_ = 2; Ri.isBeingObservedMask_ = 4; Ri.isPendingUnobservationMask_ = 8; Ri.diffValueMask_ = 16; var bp = /* @__PURE__ */ tu("ComputedValue", Ri), zt; (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_"; })(zt || (zt = {})); var $h; (function(t) { t[t.NONE = 0] = "NONE", t[t.LOG = 1] = "LOG", t[t.BREAK = 2] = "BREAK"; })($h || ($h = {})); var Vh = function(e) { this.cause = void 0, this.cause = e; }; function vh(t) { return t instanceof Vh; } function sy(t) { switch (t.dependenciesState_) { case zt.UP_TO_DATE_: return !1; case zt.NOT_TRACKING_: case zt.STALE_: return !0; case zt.POSSIBLY_STALE_: { for (var e = yw(!0), n = nu(), r = t.observing_, i = r.length, s = 0; s < i; s++) { var a = r[s]; if (bp(a)) { if (rt.disableErrorBoundaries) a.get(); else try { a.get(); } catch { return Fs(n), Xc(e), !0; } if (t.dependenciesState_ === zt.STALE_) return Fs(n), Xc(e), !0; } } return SA(t), Fs(n), Xc(e), !1; } } } function wA(t, e, n) { var r = yw(!0); SA(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_ = ++rt.runId; var i = rt.trackingDerivation; rt.trackingDerivation = t, rt.inBatch++; var s; if (rt.disableErrorBoundaries === !0) s = e.call(n); else try { s = e.call(n); } catch (a) { s = new Vh(a); } return rt.inBatch--, rt.trackingDerivation = i, rO(t), Xc(r), s; } function rO(t) { for (var e = t.observing_, n = t.observing_ = t.newObserving_, r = zt.UP_TO_DATE_, i = 0, s = t.unboundDepsCount_, a = 0; a < s; a++) { var l = n[a]; l.diffValue === 0 && (l.diffValue = 1, i !== a && (n[i] = l), i++), l.dependenciesState_ > r && (r = l.dependenciesState_); } for (n.length = i, t.newObserving_ = null, s = e.length; s--; ) { var f = e[s]; f.diffValue === 0 && bA(f, t), f.diffValue = 0; } for (; i--; ) { var d = n[i]; d.diffValue === 1 && (d.diffValue = 0, iO(d, t)); } r !== zt.UP_TO_DATE_ && (t.dependenciesState_ = r, t.onBecomeStale_()); } function oy(t) { var e = t.observing_; t.observing_ = []; for (var n = e.length; n--; ) bA(e[n], t); t.dependenciesState_ = zt.NOT_TRACKING_; } function _A(t) { var e = nu(); try { return t(); } finally { Fs(e); } } function nu() { var t = rt.trackingDerivation; return rt.trackingDerivation = null, t; } function Fs(t) { rt.trackingDerivation = t; } function yw(t) { var e = rt.allowStateReads; return rt.allowStateReads = t, e; } function Xc(t) { rt.allowStateReads = t; } function SA(t) { if (t.dependenciesState_ !== zt.UP_TO_DATE_) { t.dependenciesState_ = zt.UP_TO_DATE_; for (var e = t.observing_, n = e.length; n--; ) e[n].lowestObserverState_ = zt.UP_TO_DATE_; } } var Pg = 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; }, Dg = !0, rt = /* @__PURE__ */ function() { var t = /* @__PURE__ */ eA(); return t.__mobxInstanceCount > 0 && !t.__mobxGlobals && (Dg = !1), t.__mobxGlobals && t.__mobxGlobals.version !== new Pg().version && (Dg = !1), Dg ? t.__mobxGlobals ? (t.__mobxInstanceCount += 1, t.__mobxGlobals.UNCHANGED || (t.__mobxGlobals.UNCHANGED = {}), t.__mobxGlobals) : (t.__mobxInstanceCount = 1, t.__mobxGlobals = /* @__PURE__ */ new Pg()) : (setTimeout(function() { qt(35); }, 1), new Pg()); }(); function iO(t, e) { t.observers_.add(e), t.lowestObserverState_ > e.dependenciesState_ && (t.lowestObserverState_ = e.dependenciesState_); } function bA(t, e) { t.observers_.delete(e), t.observers_.size === 0 && kA(t); } function kA(t) { t.isPendingUnobservation === !1 && (t.isPendingUnobservation = !0, rt.pendingUnobservations.push(t)); } function oi() { rt.inBatch++; } function ai() { if (--rt.inBatch === 0) { CA(); for (var t = rt.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 Ri && n.suspend_()); } rt.pendingUnobservations = []; } } function EA(t) { var e = rt.trackingDerivation; return e !== null ? (e.runId_ !== t.lastAccessedBy_ && (t.lastAccessedBy_ = e.runId_, e.newObserving_[e.unboundDepsCount_++] = t, !t.isBeingObserved && rt.trackingContext && (t.isBeingObserved = !0, t.onBO())), t.isBeingObserved) : (t.observers_.size === 0 && rt.inBatch > 0 && kA(t), !1); } function AA(t) { t.lowestObserverState_ !== zt.STALE_ && (t.lowestObserverState_ = zt.STALE_, t.observers_.forEach(function(e) { e.dependenciesState_ === zt.UP_TO_DATE_ && e.onBecomeStale_(), e.dependenciesState_ = zt.STALE_; })); } function sO(t) { t.lowestObserverState_ !== zt.STALE_ && (t.lowestObserverState_ = zt.STALE_, t.observers_.forEach(function(e) { e.dependenciesState_ === zt.POSSIBLY_STALE_ ? e.dependenciesState_ = zt.STALE_ : e.dependenciesState_ === zt.UP_TO_DATE_ && (t.lowestObserverState_ = zt.UP_TO_DATE_); })); } function oO(t) { t.lowestObserverState_ === zt.UP_TO_DATE_ && (t.lowestObserverState_ = zt.POSSIBLY_STALE_, t.observers_.forEach(function(e) { e.dependenciesState_ === zt.UP_TO_DATE_ && (e.dependenciesState_ = zt.POSSIBLY_STALE_, e.onBecomeStale_()); })); } var Ms = /* @__PURE__ */ function() { function t(n, r, i, s) { 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_ = zt.NOT_TRACKING_, this.runId_ = 0, this.unboundDepsCount_ = 0, this.flags_ = 0, this.isTracing_ = $h.NONE, this.name_ = n, this.onInvalidate_ = r, this.errorHandler_ = i, this.requiresObservable_ = s; } var e = t.prototype; return e.onBecomeStale_ = function() { this.schedule_(); }, e.schedule_ = function() { this.isScheduled || (this.isScheduled = !0, rt.pendingReactions.push(this), CA()); }, e.runReaction_ = function() { if (!this.isDisposed) { oi(), this.isScheduled = !1; var r = rt.trackingContext; if (rt.trackingContext = this, sy(this)) { this.isTrackPending = !0; try { this.onInvalidate_(); } catch (i) { this.reportExceptionInDerivation_(i); } } rt.trackingContext = r, ai(); } }, e.track = function(r) { if (!this.isDisposed) { oi(), this.isRunning = !0; var i = rt.trackingContext; rt.trackingContext = this; var s = wA(this, r, void 0); rt.trackingContext = i, this.isRunning = !1, this.isTrackPending = !1, this.isDisposed && oy(this), vh(s) && this.reportExceptionInDerivation_(s.cause), ai(); } }, e.reportExceptionInDerivation_ = function(r) { var i = this; if (this.errorHandler_) { this.errorHandler_(r, this); return; } if (rt.disableErrorBoundaries) throw r; var s = "[mobx] uncaught error in '" + this + "'"; rt.suppressReactionErrors || console.error(s, r), rt.globalReactionErrorHandlers.forEach(function(a) { return a(r, i); }); }, e.dispose = function() { this.isDisposed || (this.isDisposed = !0, this.isRunning || (oi(), oy(this), ai())); }, e.getDisposer_ = function(r) { var i = this, s = function a() { i.dispose(), r == null || r.removeEventListener == null || r.removeEventListener("abort", a); }; return r == null || r.addEventListener == null || r.addEventListener("abort", s), s[wt] = this, s; }, e.toString = function() { return "Reaction[" + this.name_ + "]"; }, e.trace = function(r) { }, bl(t, [{ key: "isDisposed", get: function() { return $r(this.flags_, t.isDisposedMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isDisposedMask_, r); } }, { key: "isScheduled", get: function() { return $r(this.flags_, t.isScheduledMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isScheduledMask_, r); } }, { key: "isTrackPending", get: function() { return $r(this.flags_, t.isTrackPendingMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isTrackPendingMask_, r); } }, { key: "isRunning", get: function() { return $r(this.flags_, t.isRunningMask_); }, set: function(r) { this.flags_ = Vr(this.flags_, t.isRunningMask_, r); } }, { key: "diffValue", get: function() { return $r(this.flags_, t.diffValueMask_) ? 1 : 0; }, set: function(r) { this.flags_ = Vr(this.flags_, t.diffValueMask_, r === 1); } }]); }(); Ms.isDisposedMask_ = 1; Ms.isScheduledMask_ = 2; Ms.isTrackPendingMask_ = 4; Ms.isRunningMask_ = 8; Ms.diffValueMask_ = 16; var aO = 100, uO = function(e) { return e(); }; function CA() { rt.inBatch > 0 || rt.isRunningReactions || uO(lO); } function lO() { rt.isRunningReactions = !0; for (var t = rt.pendingReactions, e = 0; t.length > 0; ) { ++e === aO && (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_(); } rt.isRunningReactions = !1; } var zh = /* @__PURE__ */ tu("Reaction", Ms); function Zc() { return !1; } function cO(t) { return console.warn("[mobx.spy] Is a no-op in production builds"), function() { }; } var xA = "action", dO = "action.bound", NA = "autoAction", fO = "autoAction.bound", hO = "", ay = /* @__PURE__ */ Nd(xA), pO = /* @__PURE__ */ Nd(dO, { bound: !0 }), uy = /* @__PURE__ */ Nd(NA, { autoAction: !0 }), mO = /* @__PURE__ */ Nd(fO, { autoAction: !0, bound: !0 }); function TA(t) { var e = function(r, i) { if (Ii(r)) return Lo(r.name || hO, r, t); if (Ii(i)) return Lo(r, i, t); if (xd(i)) return (t ? uy : ay).decorate_20223_(r, i); if (Ha(i)) return kl(r, i, t ? uy : ay); if (Ha(r)) return ns(Nd(t ? NA : xA, { name: r, autoAction: t })); }; return e; } var Da = /* @__PURE__ */ TA(!1); Object.assign(Da, ay); var dd = /* @__PURE__ */ TA(!0); Object.assign(dd, uy); Da.bound = /* @__PURE__ */ ns(pO); dd.bound = /* @__PURE__ */ ns(mO); function kp(t) { return Ii(t) && t.isMobxAction === !0; } function Ep(t, e) { var n, r, i, s; e === void 0 && (e = mw); var a = (n = (r = e) == null ? void 0 : r.name) != null ? n : "Autorun", l = !e.scheduler && !e.delay, f; if (l) f = new Ms(a, function() { this.track(v); }, e.onError, e.requiresObservable); else { var d = IA(e), p = !1; f = new Ms(a, 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_((s = e) == null ? void 0 : s.signal); } var gO = function(e) { return e(); }; function IA(t) { return t.scheduler ? t.scheduler : t.delay ? function(e) { return setTimeout(e, t.delay); } : gO; } function ww(t, e, n) { var r, i, s; n === void 0 && (n = mw); var a = (r = n.name) != null ? r : "Reaction", l = Da(a, n.onError ? vO(n.onError, e) : e), f = !n.scheduler && !n.delay, d = IA(n), p = !0, v = !1, y, k = n.compareStructural ? Ga.structural : n.equals || Ga.default, E = new Ms(a, function() { p || f ? A() : v || (v = !0, d(A)); }, n.onError, n.requiresObservable); function A() { if (v = !1, !E.isDisposed) { var T = !1, O = y; E.track(function() { var R = yA(!1, function() { return t(E); }); T = p || !k(y, R), y = R; }), (p && n.fireImmediately || !p && T) && l(y, O, E), p = !1; } } return (i = n) != null && (i = i.signal) != null && i.aborted || E.schedule_(), E.getDisposer_((s = n) == null ? void 0 : s.signal); } function vO(t, e) { return function() { try { return e.apply(this, arguments); } catch (n) { t.call(this, n); } }; } var yO = "onBO", wO = "onBUO"; function _O(t, e, n) { return OA(yO, t, e, n); } function RA(t, e, n) { return OA(wO, t, e, n); } function OA(t, e, n, r) { var i = ly(e), s = Ii(r) ? r : n, a = t + "L"; return i[a] ? i[a].add(s) : i[a] = /* @__PURE__ */ new Set([s]), function() { var l = i[a]; l && (l.delete(s), l.size === 0 && delete i[a]); }; } function PA(t, e, n, r) { var i = aR(e); return iu(function() { var s = Al(t, r)[wt]; cd(i).forEach(function(a) { s.extend_( a, i[a], // must pass "undefined" for { key: undefined } n && a in n ? n[a] : !0 ); }); }), t; } var SO = 0; function DA() { this.message = "FLOW_CANCELLED"; } DA.prototype = /* @__PURE__ */ Object.create(Error.prototype); var Fg = /* @__PURE__ */ dA("flow"), bO = /* @__PURE__ */ dA("flow.bound", { bound: !0 }), pl = /* @__PURE__ */ Object.assign(function(e, n) { if (xd(n)) return Fg.decorate_20223_(e, n); if (Ha(n)) return kl(e, n, Fg); var r = e, i = r.name || "", s = function() { var l = this, f = arguments, d = ++SO, p = Da(i + " - runid: " + d + " - init", r).apply(l, f), v, y = void 0, k = new Promise(function(E, A) { var T = 0; v = A; function O(j) { y = void 0; var K; try { K = Da(i + " - runid: " + d + " - yield " + T++, p.next).call(p, j); } catch (ie) { return A(ie); } U(K); } function R(j) { y = void 0; var K; try { K = Da(i + " - runid: " + d + " - yield " + T++, p.throw).call(p, j); } catch (ie) { return A(ie); } U(K); } function U(j) { if (Ii(j == null ? void 0 : j.then)) { j.then(U, A); return; } return j.done ? E(j.value) : (y = Promise.resolve(j.value), y.then(O, R)); } O(void 0); }); return k.cancel = Da(i + " - runid: " + d + " - cancel", function() { try { y && AS(y); var E = p.return(void 0), A = Promise.resolve(E.value); A.then(tl, tl), AS(A), v(new DA()); } catch (T) { v(T); } }), k; }; return s.isMobXFlow = !0, s; }, Fg); pl.bound = /* @__PURE__ */ ns(bO); function AS(t) { Ii(t.cancel) && t.cancel(); } function fd(t) { return (t == null ? void 0 : t.isMobXFlow) === !0; } function kO(t, e) { return t ? Cp(t) || !!t[wt] || gw(t) || zh(t) || bp(t) : !1; } function FA(t) { return kO(t); } function Os(t, e) { e === void 0 && (e = void 0), oi(); try { return t.apply(e); } finally { ai(); } } function LA(t, e, n) { return arguments.length === 1 || e && typeof e == "object" ? EO(t, e) : UA(t, e, {}); } function UA(t, e, n) { var r; if (typeof n.timeout == "number") { var i = new Error("WHEN_TIMEOUT"); r = setTimeout(function() { if (!a[wt].isDisposed) if (a(), n.onError) n.onError(i); else throw i; }, n.timeout); } n.name = "When"; var s = Lo("When-effect", e), a = Ep(function(l) { var f = yA(!1, t); f && (l.dispose(), r && clearTimeout(r), s()); }, n); return a; } function EO(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, s = new Promise(function(a, l) { var f, d = UA(t, a, 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 a; return e == null || (a = e.signal) == null || a.removeEventListener == null ? void 0 : a.removeEventListener("abort", i); }); return s.cancel = r, s; } function zu(t) { return t[wt]; } var AO = { 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) { qt(13); } }; function CO(t, e) { var n, r; return nA(), t = Al(t, e), (r = (n = t[wt]).proxy_) != null ? r : n.proxy_ = new Proxy(t, AO); } function ri(t) { return t.interceptors_ !== void 0 && t.interceptors_.length > 0; } function Td(t, e) { var n = t.interceptors_ || (t.interceptors_ = []); return n.push(e), rA(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, s = r.length; i < s && (e = r[i](e), e && !e.type && qt(14), !!e); i++) ; return e; } finally { Fs(n); } } function Ni(t) { return t.changeListeners_ !== void 0 && t.changeListeners_.length > 0; } function Id(t, e) { var n = t.changeListeners_ || (t.changeListeners_ = []); return n.push(e), rA(function() { var r = n.indexOf(e); r !== -1 && n.splice(r, 1); }); } function Ti(t, e) { var n = nu(), r = t.changeListeners_; if (r) { r = r.slice(); for (var i = 0, s = r.length; i < s; i++) r[i](e); Fs(n); } } var Lg = /* @__PURE__ */ Symbol("mobx-keys"); function xO(t, e, n) { return Us(t) ? PA(t, t, e, n) : (iu(function() { var r = Al(t, n)[wt]; if (!t[Lg]) { var i = Object.getPrototypeOf(t), s = new Set([].concat(cd(t), cd(i))); s.delete("constructor"), s.delete(wt), gp(i, Lg, s); } t[Lg].forEach(function(a) { return r.make_( a, // must pass "undefined" for { key: undefined } e && a in e ? e[a] : !0 ); }); }), t); } var CS = "splice", rs = "update", NO = 1e4, TO = { get: function(e, n) { var r = e[wt]; return n === wt ? r : n === "length" ? r.getArrayLength_() : typeof n == "string" && !isNaN(n) ? r.get_(parseInt(n)) : Po(qh, n) ? qh[n] : e[n]; }, set: function(e, n, r) { var i = e[wt]; return n === "length" && i.setArrayLength_(r), typeof n == "symbol" || isNaN(n) ? e[n] = r : i.set_(parseInt(n), r), !0; }, preventExtensions: function() { qt(15); } }, _w = /* @__PURE__ */ function() { function t(n, r, i, s) { 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_ = s, this.atom_ = new $o(n), this.enhancer_ = function(a, l) { return r(a, 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 Td(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 }), Id(this, r); }, e.getArrayLength_ = function() { return this.atom_.reportObserved(), this.values_.length; }, e.setArrayLength_ = function(r) { (typeof r != "number" || isNaN(r) || r < 0) && qt("Out of range: " + r); var i = this.values_.length; if (r !== i) if (r > i) { for (var s = new Array(r - i), a = 0; a < r - i; a++) s[a] = void 0; this.spliceWithArray_(i, 0, s); } else this.spliceWithArray_(r, i - r); }, e.updateArrayLength_ = function(r, i) { r !== this.lastKnownLength_ && qt(16), this.lastKnownLength_ += i, this.legacyMode_ && i > 0 && qA(r + i + 1); }, e.spliceWithArray_ = function(r, i, s) { var a = 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)), s === void 0 && (s = ty), ri(this)) { var f = ii(this, { object: this.proxy_, type: CS, index: r, removedCount: i, added: s }); if (!f) return ty; i = f.removedCount, s = f.added; } if (s = s.length === 0 ? s : s.map(function(v) { return a.enhancer_(v, void 0); }), this.legacyMode_) { var d = s.length - i; this.updateArrayLength_(l, d); } var p = this.spliceItemsIntoValues_(r, i, s); return (i !== 0 || s.length !== 0) && this.notifyArraySplice_(r, s, p), this.dehanceValues_(p); }, e.spliceItemsIntoValues_ = function(r, i, s) { if (s.length < NO) { var a; return (a = this.values_).splice.apply(a, [r, i].concat(s)); } else { var l = this.values_.slice(r, r + i), f = this.values_.slice(r + i); this.values_.length += s.length - i; for (var d = 0; d < s.length; d++) this.values_[r + d] = s[d]; for (var p = 0; p < f.length; p++) this.values_[r + s.length + p] = f[p]; return l; } }, e.notifyArrayChildUpdate_ = function(r, i, s) { var a = !this.owned_ && Zc(), l = Ni(this), f = l || a ? { observableKind: "array", object: this.proxy_, type: rs, debugObjectName: this.atom_.name_, index: r, newValue: i, oldValue: s } : null; this.atom_.reportChanged(), l && Ti(this, f); }, e.notifyArraySplice_ = function(r, i, s) { var a = !this.owned_ && Zc(), l = Ni(this), f = l || a ? { observableKind: "array", object: this.proxy_, debugObjectName: this.atom_.name_, type: CS, index: r, removed: s, added: i, removedCount: s.length, addedCount: i.length } : null; this.atom_.reportChanged(), l && Ti(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 s = this.values_; if (this.legacyMode_ && r > s.length && qt(17, r, s.length), r < s.length) { this.atom_; var a = s[r]; if (ri(this)) { var l = ii(this, { type: rs, 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, a); var f = i !== a; f && (s[r] = i, this.notifyArrayChildUpdate_(r, i, a)); } else { for (var d = new Array(r + 1 - s.length), p = 0; p < d.length - 1; p++) d[p] = void 0; d[d.length - 1] = i, this.spliceWithArray_(s.length, 0, d); } }, t; }(); function IO(t, e, n, r) { return n === void 0 && (n = "ObservableArray"), r === void 0 && (r = !1), nA(), iu(function() { var i = new _w(n, e, r, !1); sA(i.values_, wt, i); var s = new Proxy(i.values_, TO); return i.proxy_ = s, t && t.length && i.spliceWithArray_(0, 0, t), s; }); } var qh = { clear: function() { return this.splice(0); }, replace: function(e) { var n = this[wt]; 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), s = 2; s < r; s++) i[s - 2] = arguments[s]; var a = this[wt]; switch (arguments.length) { case 0: return []; case 1: return a.spliceWithArray_(e); case 2: return a.spliceWithArray_(e, n); } return a.spliceWithArray_(e, n, i); }, spliceWithArray: function(e, n, r) { return this[wt].spliceWithArray_(e, n, r); }, push: function() { for (var e = this[wt], 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[wt].values_.length - 1, 0), 1)[0]; }, shift: function() { return this.splice(0, 1)[0]; }, unshift: function() { for (var e = this[wt], 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 rt.trackingDerivation && qt(37, "reverse"), this.replace(this.slice().reverse()), this; }, sort: function() { rt.trackingDerivation && qt(37, "sort"); var e = this.slice(); return e.sort.apply(e, arguments), this.replace(e), this; }, remove: function(e) { var n = this[wt], r = n.dehanceValues_(n.values_).indexOf(e); return r > -1 ? (this.splice(r, 1), !0) : !1; } }; dn("at", Kr); dn("concat", Kr); dn("flat", Kr); dn("includes", Kr); dn("indexOf", Kr); dn("join", Kr); dn("lastIndexOf", Kr); dn("slice", Kr); dn("toString", Kr); dn("toLocaleString", Kr); dn("toSorted", Kr); dn("toSpliced", Kr); dn("with", Kr); dn("every", Pi); dn("filter", Pi); dn("find", Pi); dn("findIndex", Pi); dn("findLast", Pi); dn("findLastIndex", Pi); dn("flatMap", Pi); dn("forEach", Pi); dn("map", Pi); dn("some", Pi); dn("toReversed", Pi); dn("reduce", MA); dn("reduceRight", MA); function dn(t, e) { typeof Array.prototype[t] == "function" && (qh[t] = e(t)); } function Kr(t) { return function() { var e = this[wt]; e.atom_.reportObserved(); var n = e.dehanceValues_(e.values_); return n[t].apply(n, arguments); }; } function Pi(t) { return function(e, n) { var r = this, i = this[wt]; i.atom_.reportObserved(); var s = i.dehanceValues_(i.values_); return s[t](function(a, l) { return e.call(n, a, l, r); }); }; } function MA(t) { return function() { var e = this, n = this[wt]; n.atom_.reportObserved(); var r = n.dehanceValues_(n.values_), i = arguments[0]; return arguments[0] = function(s, a, l) { return i(s, a, l, e); }, r[t].apply(r, arguments); }; } var RO = /* @__PURE__ */ tu("ObservableArrayAdministration", _w); function Ap(t) { return mp(t) && RO(t[wt]); } var OO = {}, Io = "add", Hh = "delete", BA = /* @__PURE__ */ function() { function t(n, r, i) { var s = this; r === void 0 && (r = Wa), i === void 0 && (i = "ObservableMap"), this.enhancer_ = void 0, this.name_ = void 0, this[wt] = OO, 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, Ii(Map) || qt(18), iu(function() { s.keysAtom_ = lA("ObservableMap.keys()"), s.data_ = /* @__PURE__ */ new Map(), s.hasMap_ = /* @__PURE__ */ new Map(), n && s.merge(n); }); } var e = t.prototype; return e.has_ = function(r) { return this.data_.has(r); }, e.has = function(r) { var i = this; if (!rt.trackingDerivation) return this.has_(r); var s = this.hasMap_.get(r); if (!s) { var a = s = new $a(this.has_(r), vp, "ObservableMap.key?", !1); this.hasMap_.set(r, a), RA(a, function() { return i.hasMap_.delete(r); }); } return s.get(); }, e.set = function(r, i) { var s = this.has_(r); if (ri(this)) { var a = ii(this, { type: s ? rs : Io, object: this, newValue: i, name: r }); if (!a) return this; i = a.newValue; } return s ? this.updateValue_(r, i) : this.addValue_(r, i), this; }, e.delete = function(r) { var i = this; if (this.keysAtom_, ri(this)) { var s = ii(this, { type: Hh, object: this, name: r }); if (!s) return !1; } if (this.has_(r)) { var a = Zc(), l = Ni(this), f = l || a ? { observableKind: "map", debugObjectName: this.name_, type: Hh, object: this, oldValue: this.data_.get(r).value_, name: r } : null; return Os(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 && Ti(this, f), !0; } return !1; }, e.updateValue_ = function(r, i) { var s = this.data_.get(r); if (i = s.prepareNewValue_(i), i !== rt.UNCHANGED) { var a = Zc(), l = Ni(this), f = l || a ? { observableKind: "map", debugObjectName: this.name_, type: rs, object: this, oldValue: s.value_, name: r, newValue: i } : null; s.setNewValue_(i), l && Ti(this, f); } }, e.addValue_ = function(r, i) { var s = this; this.keysAtom_, Os(function() { var d, p = new $a(i, s.enhancer_, "ObservableMap.key", !1); s.data_.set(r, p), i = p.value_, (d = s.hasMap_.get(r)) == null || d.setNewValue_(!0), s.keysAtom_.reportChanged(); }); var a = Zc(), l = Ni(this), f = l || a ? { observableKind: "map", debugObjectName: this.name_, type: Io, object: this, name: r, newValue: i } : null; l && Ti(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 hd({ next: function() { var a = i.next(), l = a.done, f = a.value; return { done: l, value: l ? void 0 : r.get(f) }; } }); }, e.entries = function() { var r = this, i = this.keys(); return hd({ next: function() { var a = i.next(), l = a.done, f = a.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 s = nl(this), a; !(a = s()).done; ) { var l = a.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)), Os(function() { Us(r) ? oR(r).forEach(function(s) { return i.set(s, r[s]); }) : Array.isArray(r) ? r.forEach(function(s) { var a = s[0], l = s[1]; return i.set(a, l); }) : Sl(r) ? (sR(r) || qt(19, r), r.forEach(function(s, a) { return i.set(a, s); })) : r != null && qt(20, r); }), this; }, e.clear = function() { var r = this; Os(function() { _A(function() { for (var i = nl(r.keys()), s; !(s = i()).done; ) { var a = s.value; r.delete(a); } }); }); }, e.replace = function(r) { var i = this; return Os(function() { for (var s = PO(r), a = /* @__PURE__ */ new Map(), l = !1, f = nl(i.data_.keys()), d; !(d = f()).done; ) { var p = d.value; if (!s.has(p)) { var v = i.delete(p); if (v) l = !0; else { var y = i.data_.get(p); a.set(p, y); } } } for (var k = nl(s.entries()), E; !(E = k()).done; ) { var A = E.value, T = A[0], O = A[1], R = i.data_.has(T); if (i.set(T, O), i.data_.has(T)) { var U = i.data_.get(T); a.set(T, U), R || (l = !0); } } if (!l) if (i.data_.size !== a.size) i.keysAtom_.reportChanged(); else for (var j = i.data_.keys(), K = a.keys(), ie = j.next(), ce = K.next(); !ie.done; ) { if (ie.value !== ce.value) { i.keysAtom_.reportChanged(); break; } ie = j.next(), ce = K.next(); } i.data_ = a; }), this; }, e.toString = function() { return "[object ObservableMap]"; }, e.toJSON = function() { return Array.from(this); }, e.observe_ = function(r, i) { return Id(this, r); }, e.intercept_ = function(r) { return Td(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", BA); function PO(t) { if (Sl(t) || ru(t)) return t; if (Array.isArray(t)) return new Map(t); if (Us(t)) { var e = /* @__PURE__ */ new Map(); for (var n in t) e.set(n, t[n]); return e; } else return qt(21, t); } var DO = {}, jA = /* @__PURE__ */ function() { function t(n, r, i) { var s = this; r === void 0 && (r = Wa), i === void 0 && (i = "ObservableSet"), this.name_ = void 0, this[wt] = DO, 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, Ii(Set) || qt(22), this.enhancer_ = function(a, l) { return r(a, l, i); }, iu(function() { s.atom_ = lA(s.name_), n && s.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; Os(function() { _A(function() { for (var i = nl(r.data_.values()), s; !(s = i()).done; ) { var a = s.value; r.delete(a); } }); }); }, e.forEach = function(r, i) { for (var s = nl(this), a; !(a = s()).done; ) { var l = a.value; r.call(i, l, l, this); } }, e.add = function(r) { var i = this; if (this.atom_, ri(this)) { var s = ii(this, { type: Io, object: this, newValue: r }); if (!s) return this; } if (!this.has(r)) { Os(function() { i.data_.add(i.enhancer_(r, void 0)), i.atom_.reportChanged(); }); var a = !1, l = Ni(this), f = l || a ? { observableKind: "set", debugObjectName: this.name_, type: Io, object: this, newValue: r } : null; l && Ti(this, f); } return this; }, e.delete = function(r) { var i = this; if (ri(this)) { var s = ii(this, { type: Hh, object: this, oldValue: r }); if (!s) return !1; } if (this.has(r)) { var a = !1, l = Ni(this), f = l || a ? { observableKind: "set", debugObjectName: this.name_, type: Hh, object: this, oldValue: r } : null; return Os(function() { i.atom_.reportChanged(), i.data_.delete(r); }), l && Ti(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()), s = Array.from(this.values()); return hd({ next: function() { var l = r; return r += 1, l < s.length ? { value: [i[l], s[l]], done: !1 } : { done: !0 }; } }); }, e.keys = function() { return this.values(); }, e.values = function() { this.atom_.reportObserved(); var r = this, i = 0, s = Array.from(this.data_.values()); return hd({ next: function() { return i < s.length ? { value: r.dehanceValue_(s[i++]), done: !1 } : { done: !0 }; } }); }, e.intersection = function(r) { if (Rs(r)) return r.intersection(this); var i = new Set(this); return i.intersection(r); }, e.union = function(r) { if (Rs(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 (Rs(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 (Rs(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)), Os(function() { Array.isArray(r) ? (i.clear(), r.forEach(function(s) { return i.add(s); })) : Rs(r) ? (i.clear(), r.forEach(function(s) { return i.add(s); })) : r != null && qt("Cannot initialize set from " + r); }), this; }, e.observe_ = function(r, i) { return Id(this, r); }, e.intercept_ = function(r) { return Td(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", jA), xS = /* @__PURE__ */ Object.create(null), NS = "remove", $A = /* @__PURE__ */ function() { function t(n, r, i, s) { r === void 0 && (r = /* @__PURE__ */ new Map()), s === void 0 && (s = LR), 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_ = s, this.keysAtom_ = new $o("ObservableObject.keys"), this.isPlainObject_ = Us(this.target_); } var e = t.prototype; return e.getObservablePropValue_ = function(r) { return this.values_.get(r).get(); }, e.setObservablePropValue_ = function(r, i) { var s = this.values_.get(r); if (s instanceof Ri) return s.set(i), !0; if (ri(this)) { var a = ii(this, { type: rs, object: this.proxy_ || this.target_, name: r, newValue: i }); if (!a) return null; i = a.newValue; } if (i = s.prepareNewValue_(i), i !== rt.UNCHANGED) { var l = Ni(this), f = !1, d = l || f ? { type: rs, observableKind: "object", debugObjectName: this.name_, object: this.proxy_ || this.target_, oldValue: s.value_, name: r, newValue: i } : null; s.setNewValue_(i), l && Ti(this, d); } return !0; }, e.get_ = function(r) { return rt.trackingDerivation && !Po(this.target_, r) && this.has_(r), this.target_[r]; }, e.set_ = function(r, i, s) { return s === void 0 && (s = !1), Po(this.target_, r) ? this.values_.has(r) ? this.setObservablePropValue_(r, i) : s ? Reflect.set(this.target_, r, i) : (this.target_[r] = i, !0) : this.extend_(r, { value: i, enumerable: !0, writable: !0, configurable: !0 }, this.defaultAnnotation_, s); }, e.has_ = function(r) { if (!rt.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_, vp, "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 s; if ((s = this.target_[rl]) != null && s[r]) return; qt(1, i.annotationType_, this.name_ + "." + r.toString()); } for (var a = this.target_; a && a !== pp; ) { var l = Bh(a, r); if (l) { var f = i.make_(this, r, l, a); if (f === 0) return; if (f === 1) break; } a = Object.getPrototypeOf(a); } IS(this, i, r); } }, e.extend_ = function(r, i, s, a) { if (a === void 0 && (a = !1), s === !0 && (s = this.defaultAnnotation_), s === !1) return this.defineProperty_(r, i, a); var l = s.extend_(this, r, i, a); return l && IS(this, s, r), l; }, e.defineProperty_ = function(r, i, s) { s === void 0 && (s = !1), this.keysAtom_; try { oi(); var a = this.delete_(r); if (!a) return a; if (ri(this)) { var l = ii(this, { object: this.proxy_ || this.target_, name: r, type: Io, newValue: i.value }); if (!l) return null; var f = l.newValue; i.value !== f && (i = Ka({}, i, { value: f })); } if (s) { if (!Reflect.defineProperty(this.target_, r, i)) return !1; } else ts(this.target_, r, i); this.notifyPropertyAddition_(r, i.value); } finally { ai(); } return !0; }, e.defineObservableProperty_ = function(r, i, s, a) { a === void 0 && (a = !1), this.keysAtom_; try { oi(); var l = this.delete_(r); if (!l) return l; if (ri(this)) { var f = ii(this, { object: this.proxy_ || this.target_, name: r, type: Io, newValue: i }); if (!f) return null; i = f.newValue; } var d = TS(r), p = { configurable: rt.safeDescriptors ? this.isPlainObject_ : !0, enumerable: !0, get: d.get, set: d.set }; if (a) { if (!Reflect.defineProperty(this.target_, r, p)) return !1; } else ts(this.target_, r, p); var v = new $a(i, s, "ObservableObject.key", !1); this.values_.set(r, v), this.notifyPropertyAddition_(r, v.value_); } finally { ai(); } return !0; }, e.defineComputedProperty_ = function(r, i, s) { s === void 0 && (s = !1), this.keysAtom_; try { oi(); var a = this.delete_(r); if (!a) return a; if (ri(this)) { var l = ii(this, { object: this.proxy_ || this.target_, name: r, type: Io, newValue: void 0 }); if (!l) return null; } i.name || (i.name = "ObservableObject.key"), i.context = this.proxy_ || this.target_; var f = TS(r), d = { configurable: rt.safeDescriptors ? this.isPlainObject_ : !0, enumerable: !1, get: f.get, set: f.set }; if (s) { if (!Reflect.defineProperty(this.target_, r, d)) return !1; } else ts(this.target_, r, d); this.values_.set(r, new Ri(i)), this.notifyPropertyAddition_(r, void 0); } finally { ai(); } return !0; }, e.delete_ = function(r, i) { if (i === void 0 && (i = !1), this.keysAtom_, !Po(this.target_, r)) return !0; if (ri(this)) { var s = ii(this, { object: this.proxy_ || this.target_, name: r, type: NS }); if (!s) return null; } try { var a; oi(); var l = Ni(this), f = !1, d = this.values_.get(r), p = void 0; if (!d && (l || f)) { var v; p = (v = Bh(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_), AA(d)), this.keysAtom_.reportChanged(), (a = this.pendingKeys_) == null || (a = a.get(r)) == null || a.set(r in this.target_), l || f) { var y = { type: NS, observableKind: "object", object: this.proxy_ || this.target_, debugObjectName: this.name_, oldValue: p, name: r }; l && Ti(this, y); } } finally { ai(); } return !0; }, e.observe_ = function(r, i) { return Id(this, r); }, e.intercept_ = function(r) { return Td(this, r); }, e.notifyPropertyAddition_ = function(r, i) { var s, a = Ni(this), l = !1; if (a || l) { var f = a || l ? { type: Io, observableKind: "object", debugObjectName: this.name_, object: this.proxy_ || this.target_, name: r, newValue: i } : null; a && Ti(this, f); } (s = this.pendingKeys_) == null || (s = s.get(r)) == null || s.set(!0), this.keysAtom_.reportChanged(); }, e.ownKeys_ = function() { return this.keysAtom_.reportObserved(), cd(this.target_); }, e.keys_ = function() { return this.keysAtom_.reportObserved(), Object.keys(this.target_); }, t; }(); function Al(t, e) { var n; if (Po(t, wt)) return t; var r = (n = e == null ? void 0 : e.name) != null ? n : "ObservableObject", i = new $A(t, /* @__PURE__ */ new Map(), String(r), GR(e)); return gp(t, wt, i), t; } var FO = /* @__PURE__ */ tu("ObservableObjectAdministration", $A); function TS(t) { return xS[t] || (xS[t] = { get: function() { return this[wt].getObservablePropValue_(t); }, set: function(n) { return this[wt].setObservablePropValue_(t, n); } }); } function Cp(t) { return mp(t) ? FO(t[wt]) : !1; } function IS(t, e, n) { var r; (r = t.target_[rl]) == null || delete r[n]; } var LO = /* @__PURE__ */ zA(0), UO = /* @__PURE__ */ function() { var t = !1, e = {}; return Object.defineProperty(e, "0", { set: function() { t = !0; } }), Object.create(e)[0] = 1, t === !1; }(), Ug = 0, VA = function() { }; function MO(t, e) { Object.setPrototypeOf ? Object.setPrototypeOf(t.prototype, e) : t.prototype.__proto__ !== void 0 ? t.prototype.__proto__ = e : t.prototype = e; } MO(VA, Array.prototype); var Sw = /* @__PURE__ */ function(t) { function e(r, i, s, a) { var l; return s === void 0 && (s = "ObservableArray"), a === void 0 && (a = !1), l = t.call(this) || this, iu(function() { var f = new _w(s, i, a, !0); f.proxy_ = l, sA(l, wt, f), r && r.length && l.spliceWithArray(0, 0, r), UO && Object.defineProperty(l, "0", LO); }), l; } uA(e, t); var n = e.prototype; return n.concat = function() { this[wt].atom_.reportObserved(); for (var i = arguments.length, s = new Array(i), a = 0; a < i; a++) s[a] = arguments[a]; return Array.prototype.concat.apply( this.slice(), //@ts-ignore s.map(function(l) { return Ap(l) ? l.slice() : l; }) ); }, n[Symbol.iterator] = function() { var r = this, i = 0; return hd({ next: function() { return i < r.length ? { value: r[i++], done: !1 } : { done: !0, value: void 0 }; } }); }, bl(e, [{ key: "length", get: function() { return this[wt].getArrayLength_(); }, set: function(i) { this[wt].setArrayLength_(i); } }, { key: Symbol.toStringTag, get: function() { return "Array"; } }]); }(VA); Object.entries(qh).forEach(function(t) { var e = t[0], n = t[1]; e !== "concat" && gp(Sw.prototype, e, n); }); function zA(t) { return { enumerable: !1, configurable: !0, get: function() { return this[wt].get_(t); }, set: function(n) { this[wt].set_(t, n); } }; } function BO(t) { ts(Sw.prototype, "" + t, zA(t)); } function qA(t) { if (t > Ug) { for (var e = Ug; e < t + 100; e++) BO(e); Ug = t; } } qA(1e3); function jO(t, e, n) { return new Sw(t, e, n); } function ly(t, e) { if (typeof t == "object" && t !== null) { if (Ap(t)) return e !== void 0 && qt(23), t[wt].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 || qt(25, e, cy(t)), n; } if (Cp(t)) { if (!e) return qt(26); var r = t[wt].values_.get(e); return r || qt(27, e, cy(t)), r; } if (gw(t) || bp(t) || zh(t)) return t; } else if (Ii(t) && zh(t[wt])) return t[wt]; qt(28); } function $O(t, e) { if (t || qt(29), gw(t) || bp(t) || zh(t) || ru(t) || El(t)) return t; if (t[wt]) return t[wt]; qt(24, t); } function cy(t, e) { var n; if (e !== void 0) n = ly(t, e); else { if (kp(t)) return t.name; Cp(t) || ru(t) || El(t) ? n = $O(t) : n = ly(t); } return n.name_; } function iu(t) { var e = nu(), n = _p(!0); oi(); try { return t(); } finally { ai(), Sp(n), Fs(e); } } var RS = pp.toString; function bw(t, e, n) { return n === void 0 && (n = -1), dy(t, e, n); } function dy(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 s = typeof t; if (s !== "function" && s !== "object" && typeof e != "object") return !1; var a = RS.call(t); if (a !== RS.call(e)) return !1; switch (a) { // 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 = OS(t), e = OS(e); var l = a === "[object Array]"; if (!l) { if (typeof t != "object" || typeof e != "object") return !1; var f = t.constructor, d = e.constructor; if (f !== d && !(Ii(f) && f instanceof f && Ii(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 (!dy(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], !(Po(e, y) && dy(t[y], e[y], n - 1, r, i))) return !1; } return r.pop(), i.pop(), !0; } function OS(t) { return Ap(t) ? t.slice() : Sl(t) || ru(t) || Rs(t) || El(t) ? Array.from(t.entries()) : t; } function hd(t) { return t[Symbol.iterator] = VO, t; } function VO() { return this; } ["Symbol", "Map", "Set"].forEach(function(t) { var e = eA(); typeof e[t] > "u" && qt("MobX requires global '" + t + "' to be available or polyfilled"); }); typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ == "object" && __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({ spy: cO, extras: { getDebugName: cy }, $mobx: wt }); function zO(t, e = []) { vt.useEffect(() => { const n = Ep(t); return () => n(); }, e); } function HA(t, e = {}) { const { defaultValue: n, deps: r = [] } = e, i = vt.useMemo(() => t, r), [s, a] = vt.useState( () => i() || n ); return vt.useEffect(() => { const l = Ep(() => a(i())); return () => l(); }, [i, ...r]), s; } function qO(t, e, n = []) { const r = vt.useMemo(() => t, n), i = vt.useMemo(() => e, n); vt.useEffect(() => { const s = ww(r, i); return () => s(); }, [r, i]); } var Mg = { exports: {} }, Cc = {}; /** * @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 PS; function HO() { if (PS) return Cc; PS = 1; var t = uw(), 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, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function a(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) && !s.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 Cc.Fragment = n, Cc.jsx = a, Cc.jsxs = a, Cc; } var DS; function KO() { return DS || (DS = 1, Mg.exports = HO()), Mg.exports; } var pd = KO(); let kw = /* @__PURE__ */ new Map(); const fy = vt.createContext(kw), GO = ({ children: t, stores: e }) => { const n = vt.useContext(fy), r = vt.useMemo(() => { const i = /* @__PURE__ */ new Map(); return e.forEach((s) => i.set(s.class, s.value)), kw = new Map([...n, ...i]); }, []); return /* @__PURE__ */ pd.jsx(fy.Provider, { value: r, children: t }); }; function WO(t) { return vt.useContext(fy).get(t); } function YO(t) { return kw.get(t); } var yh = { exports: {} }, QO = yh.exports, FS; function JO() { return FS || (FS = 1, function(t, e) { (function(n, r) { t.exports = r(); })(QO, function() { var n = function(h, g) { return (n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(_, C) { _.__proto__ = C; } || function(_, C) { for (var N in C) Object.prototype.hasOwnProperty.call(C, N) && (_[N] = C[N]); })(h, g); }, r = function() { return (r = Object.assign || function(h) { for (var g, _ = 1, C = arguments.length; _ < C; _++) for (var N in g = arguments[_]) Object.prototype.hasOwnProperty.call(g, N) && (h[N] = g[N]); return h; }).apply(this, arguments); }; function i(h, g, _) { for (var C, N = 0, P = g.length; N < P; 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 s = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Oo, a = Object.keys, l = Array.isArray; function f(h, g) { return typeof g != "object" || a(g).forEach(function(_) { h[_] = g[_]; }), h; } typeof Promise > "u" || s.Promise || (s.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" ? a : Reflect.ownKeys)(g).forEach(function(_) { E(h, _, g[_]); }); } var k = Object.defineProperty; function E(h, g, _, C) { k(h, g, f(_ && v(_, "get") && typeof _.get == "function" ? { get: _.get, set: _.set, configurable: !0 } : { value: _, configurable: !0, writable: !0 }, C)); } function A(h) { return { from: function(g) { return h.prototype = Object.create(g.prototype), E(h.prototype, "constructor", h), { extend: y.bind(null, h.prototype) }; } }; } var T = Object.getOwnPropertyDescriptor, O = [].slice; function R(h, g, _) { return O.call(h, g, _); } function U(h, g) { return g(h); } function j(h) { if (!h) throw new Error("Assertion Failed"); } function K(h) { s.setImmediate ? setImmediate(h) : setTimeout(h, 0); } function ie(h, g) { if (typeof g == "string" && v(h, g)) return h[g]; if (!g) return h; if (typeof g != "string") { for (var _ = [], C = 0, N = g.length; C < N; ++C) { var P = ie(h, g[C]); _.push(P); } return _; } var L = g.indexOf("."); if (L !== -1) { var z = h[g.substr(0, L)]; return z == null ? void 0 : ie(z, g.substr(L + 1)); } } function ce(h, g, _) { if (h && g !== void 0 && !("isFrozen" in Object && Object.isFrozen(h))) if (typeof g != "string" && "length" in g) { j(typeof _ != "string" && "length" in _); for (var C = 0, N = g.length; C < N; ++C) ce(h, g[C], _[C]); } else { var P, L, z = g.indexOf("."); z !== -1 ? (P = g.substr(0, z), (L = g.substr(z + 1)) === "" ? _ === void 0 ? l(h) && !isNaN(parseInt(P)) ? h.splice(P, 1) : delete h[P] : h[P] = _ : ce(z = !(z = h[P]) || !v(h, P) ? h[P] = {} : z, L, _)) : _ === void 0 ? l(h) && !isNaN(parseInt(g)) ? h.splice(g, 1) : delete h[g] : h[g] = _; } } function H(h) { var g, _ = {}; for (g in h) v(h, g) && (_[g] = h[g]); return _; } var ye = [].concat; function Z(h) { return ye.apply([], h); } var Ct = "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 s[h]; }), _e = new Set(Ct.map(function(h) { return s[h]; })), qe = null; function st(h) { return qe = /* @__PURE__ */ new WeakMap(), h = function g(_) { if (!_ || typeof _ != "object") return _; var C = qe.get(_); if (C) return C; if (l(_)) { C = [], qe.set(_, C); for (var N = 0, P = _.length; N < P; ++N) C.push(g(_[N])); } else if (_e.has(_.constructor)) C = _; else { var L, z = d(_); for (L in C = z === Object.prototype ? {} : Object.create(z), qe.set(_, C), _) v(_, L) && (C[L] = g(_[L])); } return C; }(h), qe = null, h; } var ft = {}.toString; function ue(h) { return ft.call(h).slice(8, -1); } var ke = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", pe = typeof ke == "symbol" ? function(h) { var g; return h != null && (g = h[ke]) && g.apply(h); } : function() { return null; }; function de(h, g) { return g = h.indexOf(g), 0 <= g && h.splice(g, 1), 0 <= g; } var Ae = {}; function B(h) { var g, _, C, N; if (arguments.length === 1) { if (l(h)) return h.slice(); if (this === Ae && typeof h == "string") return [h]; if (N = pe(h)) { for (_ = []; !(C = N.next()).done; ) _.push(C.value); return _; } if (h == null) return [h]; if (typeof (g = h.length) != "number") return [h]; for (_ = new Array(g); g--; ) _[g] = h[g]; return _; } for (g = arguments.length, _ = new Array(g); g--; ) _[g] = arguments[g]; return _; } var M = typeof Symbol < "u" ? function(h) { return h[Symbol.toStringTag] === "AsyncFunction"; } : function() { return !1; }, bt = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], mr = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(bt), 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 Ie(h, g) { this.name = h, this.message = g; } function $(h, g) { return h + ". Errors: " + Object.keys(g).map(function(_) { return g[_].toString(); }).filter(function(_, C, N) { return N.indexOf(_) === C; }).join(` `); } function Q(h, g, _, C) { this.failures = g, this.failedKeys = C, this.successCount = _, this.message = $(h, g); } function Qe(h, g) { this.name = "BulkError", this.failures = Object.keys(g).map(function(_) { return g[_]; }), this.failuresByPos = g, this.message = $(h, this.failures); } A(Ie).from(Error).extend({ toString: function() { return this.name + ": " + this.message; } }), A(Q).from(Ie), A(Qe).from(Ie); var Re = mr.reduce(function(h, g) { return h[g] = g + "Error", h; }, {}), We = Ie, Oe = mr.reduce(function(h, g) { var _ = g + "Error"; function C(N, P) { this.name = _, N ? typeof N == "string" ? (this.message = "".concat(N).concat(P ? ` ` + P : ""), this.inner = P || null) : typeof N == "object" && (this.message = "".concat(N.name, " ").concat(N.message), this.inner = N) : (this.message = te[g] || _, this.inner = null); } return A(C).from(We), h[g] = C, h; }, {}); Oe.Syntax = SyntaxError, Oe.Type = TypeError, Oe.Range = RangeError; var pt = bt.reduce(function(h, g) { return h[g + "Error"] = Oe[g], h; }, {}), ht = mr.reduce(function(h, g) { return ["Syntax", "Type", "Range"].indexOf(g) === -1 && (h[g + "Error"] = Oe[g]), h; }, {}); function Xe() { } function Rt(h) { return h; } function Ot(h, g) { return h == null || h === Rt ? g : function(_) { return g(h(_)); }; } function et(h, g) { return function() { h.apply(this, arguments), g.apply(this, arguments); }; } function Ft(h, g) { return h === Xe ? g : function() { var _ = h.apply(this, arguments); _ !== void 0 && (arguments[0] = _); var C = this.onsuccess, N = this.onerror; this.onsuccess = null, this.onerror = null; var P = g.apply(this, arguments); return C && (this.onsuccess = this.onsuccess ? et(C, this.onsuccess) : C), N && (this.onerror = this.onerror ? et(N, this.onerror) : N), P !== void 0 ? P : _; }; } function Bt(h, g) { return h === Xe ? g : function() { h.apply(this, arguments); var _ = this.onsuccess, C = this.onerror; this.onsuccess = this.onerror = null, g.apply(this, arguments), _ && (this.onsuccess = this.onsuccess ? et(_, this.onsuccess) : _), C && (this.onerror = this.onerror ? et(C, this.onerror) : C); }; } function D(h, g) { return h === Xe ? g : function(_) { var C = h.apply(this, arguments); f(_, C); var N = this.onsuccess, P = this.onerror; return this.onsuccess = null, this.onerror = null, _ = g.apply(this, arguments), N && (this.onsuccess = this.onsuccess ? et(N, this.onsuccess) : N), P && (this.onerror = this.onerror ? et(P, this.onerror) : P), C === void 0 ? _ === void 0 ? void 0 : _ : f(C, _); }; } function x(h, g) { return h === Xe ? g : function() { return g.apply(this, arguments) !== !1 && h.apply(this, arguments); }; } function b(h, g) { return h === Xe ? g : function() { var _ = h.apply(this, arguments); if (_ && typeof _.then == "function") { for (var C = this, N = arguments.length, P = new Array(N); N--; ) P[N] = arguments[N]; return _.then(function() { return g.apply(C, P); }); } return g.apply(this, arguments); }; } ht.ModifyError = Q, ht.DexieError = Ie, ht.BulkError = Qe; var F = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href); function ee(h) { F = h; } var be = {}, Ce = 100, Ct = 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]; }(), bt = Ct[0], mr = Ct[1], Ct = Ct[2], mr = mr && mr.then, Lt = bt && bt.constructor, fn = !!Ct, Ht = function(h, g) { ss.push([h, g]), Or && (queueMicrotask(Ld), Or = !1); }, hr = !0, Or = !0, Gr = [], Vo = [], su = Rt, Li = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: Xe, pgp: !1, env: {}, finalize: Xe }, lt = Li, ss = [], li = 0, $s = []; function Ze(h) { if (typeof this != "object") throw new TypeError("Promises must be constructed via new"); this._listeners = [], this._lib = !1; var g = this._PSD = lt; if (typeof h != "function") { if (h !== be) throw new TypeError("Not a function"); return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && ou(this, this._value)); } this._state = null, this._value = null, ++g.ref, function _(C, N) { try { N(function(P) { if (C._state === null) { if (P === C) throw new TypeError("A promise cannot be resolved with itself."); var L = C._lib && Mi(); P && typeof P.then == "function" ? _(C, function(z, W) { P instanceof Ze ? P._then(z, W) : P.then(z, W); }) : (C._state = !0, C._value = P, Ll(C)), L && as(); } }, ou.bind(null, C)); } catch (P) { ou(C, P); } }(this, h); } var Ui = { get: function() { var h = lt, g = zs; function _(C, N) { var P = this, L = !h.global && (h !== lt || g !== zs), z = L && !Wn(), W = new Ze(function(J, se) { au(P, new os(Ml(C, h, L, z), Ml(N, h, L, z), J, se, h)); }); return this._consoleTask && (W._consoleTask = this._consoleTask), W; } return _.prototype = be, _; }, set: function(h) { E(this, "then", h && h.prototype === be ? Ui : { get: function() { return h; }, set: Ui.set }); } }; function os(h, g, _, C, N) { this.onFulfilled = typeof h == "function" ? h : null, this.onRejected = typeof g == "function" ? g : null, this.resolve = _, this.reject = C, this.psd = N; } function ou(h, g) { var _, C; Vo.push(g), h._state === null && (_ = h._lib && Mi(), g = su(g), h._state = !1, h._value = g, C = h, Gr.some(function(N) { return N._value === C._value; }) || Gr.push(C), Ll(h), _ && as()); } function Ll(h) { var g = h._listeners; h._listeners = []; for (var _ = 0, C = g.length; _ < C; ++_) au(h, g[_]); var N = h._PSD; --N.ref || N.finalize(), li === 0 && (++li, Ht(function() { --li == 0 && us(); }, [])); } function au(h, g) { if (h._state !== null) { var _ = h._state ? g.onFulfilled : g.onRejected; if (_ === null) return (h._state ? g.resolve : g.reject)(h._value); ++g.psd.ref, ++li, Ht(Fd, [_, h, g]); } else h._listeners.push(g); } function Fd(h, g, _) { try { var C, N = g._value; !g._state && Vo.length && (Vo = []), C = F && g._consoleTask ? g._consoleTask.run(function() { return h(N); }) : h(N), g._state || Vo.indexOf(N) !== -1 || function(P) { for (var L = Gr.length; L; ) if (Gr[--L]._value === P._value) return Gr.splice(L, 1); }(g), _.resolve(C); } catch (P) { _.reject(P); } finally { --li == 0 && us(), --_.psd.ref || _.psd.finalize(); } } function Ld() { $i(Li, function() { Mi() && as(); }); } function Mi() { var h = hr; return Or = hr = !1, h; } function as() { var h, g, _; do for (; 0 < ss.length; ) for (h = ss, ss = [], _ = h.length, g = 0; g < _; ++g) { var C = h[g]; C[0].apply(null, C[1]); } while (0 < ss.length); Or = hr = !0; } function us() { var h = Gr; Gr = [], h.forEach(function(C) { C._PSD.onunhandled.call(null, C._value, C); }); for (var g = $s.slice(0), _ = g.length; _; ) g[--_](); } function Vs(h) { return new Ze(be, !1, h); } function Yt(h, g) { var _ = lt; return function() { var C = Mi(), N = lt; try { return ji(_, !0), h.apply(this, arguments); } catch (P) { g && g(P); } finally { ji(N, !1), C && as(); } }; } y(Ze.prototype, { then: Ui, _then: function(h, g) { au(this, new os(null, null, h, g, lt)); }, catch: function(h) { if (arguments.length === 1) return this.then(null, h); var g = h, _ = arguments[1]; return typeof g == "function" ? this.then(null, function(C) { return (C instanceof g ? _ : Vs)(C); }) : this.then(null, function(C) { return (C && C.name === g ? _ : Vs)(C); }); }, finally: function(h) { return this.then(function(g) { return Ze.resolve(h()).then(function() { return g; }); }, function(g) { return Ze.resolve(h()).then(function() { return Vs(g); }); }); }, timeout: function(h, g) { var _ = this; return h < 1 / 0 ? new Ze(function(C, N) { var P = setTimeout(function() { return N(new Oe.Timeout(g)); }, h); _.then(C, N).finally(clearTimeout.bind(null, P)); }) : this; } }), typeof Symbol < "u" && Symbol.toStringTag && E(Ze.prototype, Symbol.toStringTag, "Dexie.Promise"), Li.env = Ul(), y(Ze, { all: function() { var h = B.apply(null, arguments).map(qo); return new Ze(function(g, _) { h.length === 0 && g([]); var C = h.length; h.forEach(function(N, P) { return Ze.resolve(N).then(function(L) { h[P] = L, --C || g(h); }, _); }); }); }, resolve: function(h) { return h instanceof Ze ? h : h && typeof h.then == "function" ? new Ze(function(g, _) { h.then(g, _); }) : new Ze(be, !0, h); }, reject: Vs, race: function() { var h = B.apply(null, arguments).map(qo); return new Ze(function(g, _) { h.map(function(C) { return Ze.resolve(C).then(g, _); }); }); }, PSD: { get: function() { return lt; }, set: function(h) { return lt = h; } }, totalEchoes: { get: function() { return zs; } }, newPSD: Bi, usePSD: $i, scheduler: { get: function() { return Ht; }, set: function(h) { Ht = h; } }, rejectionMapper: { get: function() { return su; }, set: function(h) { su = h; } }, follow: function(h, g) { return new Ze(function(_, C) { return Bi(function(N, P) { var L = lt; L.unhandleds = [], L.onunhandled = P, L.finalize = et(function() { var z, W = this; z = function() { W.unhandleds.length === 0 ? N() : P(W.unhandleds[0]); }, $s.push(function J() { z(), $s.splice($s.indexOf(J), 1); }), ++li, Ht(function() { --li == 0 && us(); }, []); }, L.finalize), h(); }, g, _, C); }); } }), Lt && (Lt.allSettled && E(Ze, "allSettled", function() { var h = B.apply(null, arguments).map(qo); return new Ze(function(g) { h.length === 0 && g([]); var _ = h.length, C = new Array(_); h.forEach(function(N, P) { return Ze.resolve(N).then(function(L) { return C[P] = { status: "fulfilled", value: L }; }, function(L) { return C[P] = { status: "rejected", reason: L }; }).then(function() { return --_ || g(C); }); }); }); }), Lt.any && typeof AggregateError < "u" && E(Ze, "any", function() { var h = B.apply(null, arguments).map(qo); return new Ze(function(g, _) { h.length === 0 && _(new AggregateError([])); var C = h.length, N = new Array(C); h.forEach(function(P, L) { return Ze.resolve(P).then(function(z) { return g(z); }, function(z) { N[L] = z, --C || _(new AggregateError(N)); }); }); }); }), Lt.withResolvers && (Ze.withResolvers = Lt.withResolvers)); var xn = { awaits: 0, echoes: 0, id: 0 }, zo = 0, ls = [], cs = 0, zs = 0, Qp = 0; function Bi(h, g, _, C) { var N = lt, P = Object.create(N); return P.parent = N, P.ref = 0, P.global = !1, P.id = ++Qp, Li.env, P.env = fn ? { Promise: Ze, PromiseProp: { value: Ze, configurable: !0, writable: !0 }, all: Ze.all, race: Ze.race, allSettled: Ze.allSettled, any: Ze.any, resolve: Ze.resolve, reject: Ze.reject } : {}, g && f(P, g), ++N.ref, P.finalize = function() { --this.parent.ref || this.parent.finalize(); }, C = $i(P, h, _, C), P.ref === 0 && P.finalize(), C; } function qs() { return xn.id || (xn.id = ++zo), ++xn.awaits, xn.echoes += Ce, xn.id; } function Wn() { return !!xn.awaits && (--xn.awaits == 0 && (xn.id = 0), xn.echoes = xn.awaits * Ce, !0); } function qo(h) { return xn.echoes && h && h.constructor === Lt ? (qs(), h.then(function(g) { return Wn(), g; }, function(g) { return Wn(), yn(g); })) : h; } function Ud() { var h = ls[ls.length - 1]; ls.pop(), ji(h, !1); } function ji(h, g) { var _, C = lt; (g ? !xn.echoes || cs++ && h === lt : !cs || --cs && h === lt) || queueMicrotask(g ? (function(N) { ++zs, xn.echoes && --xn.echoes != 0 || (xn.echoes = xn.awaits = xn.id = 0), ls.push(lt), ji(N, !0); }).bind(null, h) : Ud), h !== lt && (lt = h, C === Li && (Li.env = Ul()), fn && (_ = Li.env.Promise, g = h.env, (C.global || h.global) && (Object.defineProperty(s, "Promise", g.PromiseProp), _.all = g.all, _.race = g.race, _.resolve = g.resolve, _.reject = g.reject, g.allSettled && (_.allSettled = g.allSettled), g.any && (_.any = g.any)))); } function Ul() { var h = s.Promise; return fn ? { Promise: h, PromiseProp: Object.getOwnPropertyDescriptor(s, "Promise"), all: h.all, race: h.race, allSettled: h.allSettled, any: h.any, resolve: h.resolve, reject: h.reject } : {}; } function $i(h, g, _, C, N) { var P = lt; try { return ji(h, !0), g(_, C, N); } finally { ji(P, !1); } } function Ml(h, g, _, C) { return typeof h != "function" ? h : function() { var N = lt; _ && qs(), ji(g, !0); try { return h.apply(this, arguments); } finally { ji(N, !1), C && queueMicrotask(Wn); } }; } function uu(h) { Promise === Lt && xn.echoes === 0 ? cs === 0 ? h() : enqueueNativeMicroTask(h) : setTimeout(h, 0); } ("" + mr).indexOf("[native code]") === -1 && (qs = Wn = Xe); var yn = Ze.reject, ds = "ï¿¿", Kt = "Invalid key provided. Keys must be of type string, number, Date or Array.", Md = "String expected.", Vi = [], Ho = "__dbnames", Hs = "readonly", Bl = "readwrite"; function zi(h, g) { return h ? g ? function() { return h.apply(this, arguments) && g.apply(this, arguments); } : h : g; } var Ko = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 }; function ar(h) { return typeof h != "string" || /\./.test(h) ? function(g) { return g; } : function(g) { return g[h] === void 0 && h in g && delete (g = st(g))[h], g; }; } function Bd() { throw Oe.Type(); } function _t(h, g) { try { var _ = jd(h), C = jd(g); if (_ !== C) return _ === "Array" ? 1 : C === "Array" ? -1 : _ === "binary" ? 1 : C === "binary" ? -1 : _ === "string" ? 1 : C === "string" ? -1 : _ === "Date" ? 1 : C !== "Date" ? NaN : -1; switch (_) { case "number": case "Date": case "string": return g < h ? 1 : h < g ? -1 : 0; case "binary": return function(N, P) { for (var L = N.length, z = P.length, W = L < z ? L : z, J = 0; J < W; ++J) if (N[J] !== P[J]) return N[J] < P[J] ? -1 : 1; return L === z ? 0 : L < z ? -1 : 1; }($d(h), $d(g)); case "Array": return function(N, P) { for (var L = N.length, z = P.length, W = L < z ? L : z, J = 0; J < W; ++J) { var se = _t(N[J], P[J]); if (se !== 0) return se; } return L === z ? 0 : L < z ? -1 : 1; }(h, g); } } catch { } return NaN; } function jd(h) { var g = typeof h; return g != "object" ? g : ArrayBuffer.isView(h) ? "binary" : (h = ue(h), h === "ArrayBuffer" ? "binary" : h); } function $d(h) { return h instanceof Uint8Array ? h : ArrayBuffer.isView(h) ? new Uint8Array(h.buffer, h.byteOffset, h.byteLength) : new Uint8Array(h); } var Vd = (Qt.prototype._trans = function(h, g, _) { var C = this._tx || lt.trans, N = this.name, P = F && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(h === "readonly" ? "read" : "write", " ").concat(this.name)); function L(J, se, q) { if (!q.schema[N]) throw new Oe.NotFound("Table " + N + " not part of transaction"); return g(q.idbtrans, q); } var z = Mi(); try { var W = C && C.db._novip === this.db._novip ? C === lt.trans ? C._promise(h, L, _) : Bi(function() { return C._promise(h, L, _); }, { trans: C, transless: lt.transless || lt }) : function J(se, q, oe, Y) { if (se.idbdb && (se._state.openComplete || lt.letThrough || se._vip)) { var re = se._createTransaction(q, oe, se._dbSchema); try { re.create(), se._state.PR1398_maxLoop = 3; } catch (ae) { return ae.name === Re.InvalidState && se.isOpen() && 0 < --se._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), se.close({ disableAutoOpen: !1 }), se.open().then(function() { return J(se, q, oe, Y); })) : yn(ae); } return re._promise(q, function(ae, ne) { return Bi(function() { return lt.trans = re, Y(ae, ne, re); }); }).then(function(ae) { if (q === "readwrite") try { re.idbtrans.commit(); } catch { } return q === "readonly" ? ae : re._completion.then(function() { return ae; }); }); } if (se._state.openComplete) return yn(new Oe.DatabaseClosed(se._state.dbOpenError)); if (!se._state.isBeingOpened) { if (!se._state.autoOpen) return yn(new Oe.DatabaseClosed()); se.open().catch(Xe); } return se._state.dbReadyPromise.then(function() { return J(se, q, oe, Y); }); }(this.db, h, [this.name], L); return P && (W._consoleTask = P, W = W.catch(function(J) { return console.trace(J), yn(J); })), W; } finally { z && as(); } }, Qt.prototype.get = function(h, g) { var _ = this; return h && h.constructor === Object ? this.where(h).first(g) : h == null ? yn(new Oe.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(C) { return _.core.get({ trans: C, key: h }).then(function(N) { return _.hook.reading.fire(N); }); }).then(g); }, Qt.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 = a(h); if (g.length === 1) return this.where(g[0]).equals(h[g[0]]); var _ = 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 (_ && this.db._maxKey !== ds) { var P = _.keyPath.slice(0, g.length); return this.where(P).equals(P.map(function(W) { return h[W]; })); } !_ && 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 _t(z, W) === 0; } var L = g.reduce(function(q, W) { var J = q[0], se = q[1], q = C[W], oe = h[W]; return [J || q, J || !q ? zi(se, q && q.multi ? function(Y) { return Y = ie(Y, W), l(Y) && Y.some(function(re) { return N(oe, re); }); } : function(Y) { return N(oe, ie(Y, W)); }) : se]; }, [null, null]), P = L[0], L = L[1]; return P ? this.where(P.name).equals(h[P.keyPath]).filter(L) : _ ? this.filter(L) : this.where(g).equals(""); }, Qt.prototype.filter = function(h) { return this.toCollection().and(h); }, Qt.prototype.count = function(h) { return this.toCollection().count(h); }, Qt.prototype.offset = function(h) { return this.toCollection().offset(h); }, Qt.prototype.limit = function(h) { return this.toCollection().limit(h); }, Qt.prototype.each = function(h) { return this.toCollection().each(h); }, Qt.prototype.toArray = function(h) { return this.toCollection().toArray(h); }, Qt.prototype.toCollection = function() { return new this.db.Collection(new this.db.WhereClause(this)); }, Qt.prototype.orderBy = function(h) { return new this.db.Collection(new this.db.WhereClause(this, l(h) ? "[".concat(h.join("+"), "]") : h)); }, Qt.prototype.reverse = function() { return this.toCollection().reverse(); }, Qt.prototype.mapToClass = function(h) { var g, _ = this.db, C = this.name; function N() { return g !== null && g.apply(this, arguments) || this; } (this.schema.mappedClass = h).prototype instanceof Bd && (function(W, J) { if (typeof J != "function" && J !== null) throw new TypeError("Class extends value " + String(J) + " is not a constructor or null"); function se() { this.constructor = W; } n(W, J), W.prototype = J === null ? Object.create(J) : (se.prototype = J.prototype, new se()); }(N, g = h), Object.defineProperty(N.prototype, "db", { get: function() { return _; }, enumerable: !1, configurable: !0 }), N.prototype.table = function() { return C; }, h = N); for (var P = /* @__PURE__ */ new Set(), L = h.prototype; L; L = d(L)) Object.getOwnPropertyNames(L).forEach(function(W) { return P.add(W); }); function z(W) { if (!W) return W; var J, se = Object.create(h.prototype); for (J in W) if (!P.has(J)) try { se[J] = W[J]; } catch { } return se; } return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = z, this.hook("reading", z), h; }, Qt.prototype.defineClass = function() { return this.mapToClass(function(h) { f(this, h); }); }, Qt.prototype.add = function(h, g) { var _ = this, C = this.schema.primKey, N = C.auto, P = C.keyPath, L = h; return P && N && (L = ar(P)(h)), this._trans("readwrite", function(z) { return _.core.mutate({ trans: z, type: "add", keys: g != null ? [g] : null, values: [L] }); }).then(function(z) { return z.numFailures ? Ze.reject(z.failures[0]) : z.lastResult; }).then(function(z) { if (P) try { ce(h, P, z); } catch { } return z; }); }, Qt.prototype.update = function(h, g) { return typeof h != "object" || l(h) ? this.where(":id").equals(h).modify(g) : (h = ie(h, this.schema.primKey.keyPath), h === void 0 ? yn(new Oe.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(h).modify(g)); }, Qt.prototype.put = function(h, g) { var _ = this, C = this.schema.primKey, N = C.auto, P = C.keyPath, L = h; return P && N && (L = ar(P)(h)), this._trans("readwrite", function(z) { return _.core.mutate({ trans: z, type: "put", values: [L], keys: g != null ? [g] : null }); }).then(function(z) { return z.numFailures ? Ze.reject(z.failures[0]) : z.lastResult; }).then(function(z) { if (P) try { ce(h, P, z); } catch { } return z; }); }, Qt.prototype.delete = function(h) { var g = this; return this._trans("readwrite", function(_) { return g.core.mutate({ trans: _, type: "delete", keys: [h] }); }).then(function(_) { return _.numFailures ? Ze.reject(_.failures[0]) : void 0; }); }, Qt.prototype.clear = function() { var h = this; return this._trans("readwrite", function(g) { return h.core.mutate({ trans: g, type: "deleteRange", range: Ko }); }).then(function(g) { return g.numFailures ? Ze.reject(g.failures[0]) : void 0; }); }, Qt.prototype.bulkGet = function(h) { var g = this; return this._trans("readonly", function(_) { return g.core.getMany({ keys: h, trans: _ }).then(function(C) { return C.map(function(N) { return g.hook.reading.fire(N); }); }); }); }, Qt.prototype.bulkAdd = function(h, g, _) { var C = this, N = Array.isArray(g) ? g : void 0, P = (_ = _ || (N ? void 0 : g)) ? _.allKeys : void 0; return this._trans("readwrite", function(L) { var J = C.schema.primKey, z = J.auto, J = J.keyPath; if (J && N) throw new Oe.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys"); if (N && N.length !== h.length) throw new Oe.InvalidArgument("Arguments objects and keys must have the same length"); var W = h.length, J = J && z ? h.map(ar(J)) : h; return C.core.mutate({ trans: L, type: "add", keys: N, values: J, wantResults: P }).then(function(re) { var q = re.numFailures, oe = re.results, Y = re.lastResult, re = re.failures; if (q === 0) return P ? oe : Y; throw new Qe("".concat(C.name, ".bulkAdd(): ").concat(q, " of ").concat(W, " operations failed"), re); }); }); }, Qt.prototype.bulkPut = function(h, g, _) { var C = this, N = Array.isArray(g) ? g : void 0, P = (_ = _ || (N ? void 0 : g)) ? _.allKeys : void 0; return this._trans("readwrite", function(L) { var J = C.schema.primKey, z = J.auto, J = J.keyPath; if (J && N) throw new Oe.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys"); if (N && N.length !== h.length) throw new Oe.InvalidArgument("Arguments objects and keys must have the same length"); var W = h.length, J = J && z ? h.map(ar(J)) : h; return C.core.mutate({ trans: L, type: "put", keys: N, values: J, wantResults: P }).then(function(re) { var q = re.numFailures, oe = re.results, Y = re.lastResult, re = re.failures; if (q === 0) return P ? oe : Y; throw new Qe("".concat(C.name, ".bulkPut(): ").concat(q, " of ").concat(W, " operations failed"), re); }); }); }, Qt.prototype.bulkUpdate = function(h) { var g = this, _ = this.core, C = h.map(function(L) { return L.key; }), N = h.map(function(L) { return L.changes; }), P = []; return this._trans("readwrite", function(L) { return _.getMany({ trans: L, keys: C, cache: "clone" }).then(function(z) { var W = [], J = []; h.forEach(function(q, oe) { var Y = q.key, re = q.changes, ae = z[oe]; if (ae) { for (var ne = 0, fe = Object.keys(re); ne < fe.length; ne++) { var ge = fe[ne], we = re[ge]; if (ge === g.schema.primKey.keyPath) { if (_t(we, Y) !== 0) throw new Oe.Constraint("Cannot update primary key in bulkUpdate()"); } else ce(ae, ge, we); } P.push(oe), W.push(Y), J.push(ae); } }); var se = W.length; return _.mutate({ trans: L, 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 se; for (var re = 0, ae = Object.keys(Y); re < ae.length; re++) { var ne, fe = ae[re], ge = P[Number(fe)]; ge != null && (ne = Y[fe], delete Y[fe], Y[ge] = ne); } throw new Qe("".concat(g.name, ".bulkUpdate(): ").concat(oe, " of ").concat(se, " operations failed"), Y); }); }); }); }, Qt.prototype.bulkDelete = function(h) { var g = this, _ = h.length; return this._trans("readwrite", function(C) { return g.core.mutate({ trans: C, type: "delete", keys: h }); }).then(function(L) { var N = L.numFailures, P = L.lastResult, L = L.failures; if (N === 0) return P; throw new Qe("".concat(g.name, ".bulkDelete(): ").concat(N, " of ").concat(_, " operations failed"), L); }); }, Qt); function Qt() { } function qi(h) { function g(L, z) { if (z) { for (var W = arguments.length, J = new Array(W - 1); --W; ) J[W - 1] = arguments[W]; return _[L].subscribe.apply(null, J), h; } if (typeof L == "string") return _[L]; } var _ = {}; g.addEventType = P; for (var C = 1, N = arguments.length; C < N; ++C) P(arguments[C]); return g; function P(L, z, W) { if (typeof L != "object") { var J; z = z || x; var se = { subscribers: [], fire: W = W || Xe, subscribe: function(q) { se.subscribers.indexOf(q) === -1 && (se.subscribers.push(q), se.fire = z(se.fire, q)); }, unsubscribe: function(q) { se.subscribers = se.subscribers.filter(function(oe) { return oe !== q; }), se.fire = se.subscribers.reduce(z, W); } }; return _[L] = g[L] = se; } a(J = L).forEach(function(q) { var oe = J[q]; if (l(oe)) P(q, J[q][0], J[q][1]); else { if (oe !== "asap") throw new Oe.InvalidArgument("Invalid event config"); var Y = P(q, Rt, function() { for (var re = arguments.length, ae = new Array(re); re--; ) ae[re] = arguments[re]; Y.subscribers.forEach(function(ne) { K(function() { ne.apply(null, ae); }); }); }); } }); } } function ci(h, g) { return A(g).from({ prototype: h }), g; } function di(h, g) { return !(h.filter || h.algorithm || h.or) && (g ? h.justLimit : !h.replayFilter); } function jl(h, g) { h.filter = zi(h.filter, g); } function $l(h, g, _) { var C = h.replayFilter; h.replayFilter = C ? function() { return zi(C(), g()); } : g, h.justLimit = _ && !C; } function Ks(h, g) { if (h.isPrimKey) return g.primaryKey; var _ = g.getIndexByKeyPath(h.index); if (!_) throw new Oe.Schema("KeyPath " + h.index + " on object store " + g.name + " is not indexed"); return _; } function Vl(h, g, _) { var C = Ks(h, g.schema); return g.openCursor({ trans: _, values: !h.keysOnly, reverse: h.dir === "prev", unique: !!h.unique, query: { index: C, range: h.range } }); } function Gs(h, g, _, C) { var N = h.replayFilter ? zi(h.filter, h.replayFilter()) : h.filter; if (h.or) { var P = {}, L = function(z, W, J) { var se, q; N && !N(W, J, function(oe) { return W.stop(oe); }, function(oe) { return W.fail(oe); }) || ((q = "" + (se = W.primaryKey)) == "[object ArrayBuffer]" && (q = "" + new Uint8Array(se)), v(P, q) || (P[q] = !0, g(z, W, J))); }; return Promise.all([h.or._iterate(L, _), Ws(Vl(h, C, _), h.algorithm, L, !h.keysOnly && h.valueMapper)]); } return Ws(Vl(h, C, _), zi(h.algorithm, N), g, !h.keysOnly && h.valueMapper); } function Ws(h, g, _, C) { var N = Yt(C ? function(P, L, z) { return _(C(P), L, z); } : _); return h.then(function(P) { if (P) return P.start(function() { var L = function() { return P.continue(); }; g && !g(P, function(z) { return L = z; }, function(z) { P.stop(z), L = Xe; }, function(z) { P.fail(z), L = Xe; }) || N(P.value, P, function(z) { return L = z; }), L(); }); }); } var Go = (lu.prototype.execute = function(h) { var g = this["@@propmod"]; if (g.add !== void 0) { var _ = g.add; if (l(_)) return i(i([], l(h) ? h : [], !0), _).sort(); if (typeof _ == "number") return (Number(h) || 0) + _; if (typeof _ == "bigint") try { return BigInt(h) + _; } catch { return BigInt(0) + _; } throw new TypeError("Invalid term ".concat(_)); } 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 _ = (_ = g.replacePrefix) === null || _ === void 0 ? void 0 : _[0], _ && typeof h == "string" && h.startsWith(_) ? g.replacePrefix[1] + h.substring(_.length) : h; }, lu); function lu(h) { this["@@propmod"] = h; } var Gt = (Mt.prototype._read = function(h, g) { var _ = this._ctx; return _.error ? _.table._trans(null, yn.bind(null, _.error)) : _.table._trans("readonly", h).then(g); }, Mt.prototype._write = function(h) { var g = this._ctx; return g.error ? g.table._trans(null, yn.bind(null, g.error)) : g.table._trans("readwrite", h, "locked"); }, Mt.prototype._addAlgorithm = function(h) { var g = this._ctx; g.algorithm = zi(g.algorithm, h); }, Mt.prototype._iterate = function(h, g) { return Gs(this._ctx, h, g, this._ctx.table.core); }, Mt.prototype.clone = function(h) { var g = Object.create(this.constructor.prototype), _ = Object.create(this._ctx); return h && f(_, h), g._ctx = _, g; }, Mt.prototype.raw = function() { return this._ctx.valueMapper = null, this; }, Mt.prototype.each = function(h) { var g = this._ctx; return this._read(function(_) { return Gs(g, h, _, g.table.core); }); }, Mt.prototype.count = function(h) { var g = this; return this._read(function(_) { var C = g._ctx, N = C.table.core; if (di(C, !0)) return N.count({ trans: _, query: { index: Ks(C, N.schema), range: C.range } }).then(function(L) { return Math.min(L, C.limit); }); var P = 0; return Gs(C, function() { return ++P, !1; }, _, N).then(function() { return P; }); }).then(h); }, Mt.prototype.sortBy = function(h, g) { var _ = h.split(".").reverse(), C = _[0], N = _.length - 1; function P(W, J) { return J ? P(W[_[J]], J - 1) : W[C]; } var L = this._ctx.dir === "next" ? 1 : -1; function z(W, J) { return _t(P(W, N), P(J, N)) * L; } return this.toArray(function(W) { return W.sort(z); }).then(g); }, Mt.prototype.toArray = function(h) { var g = this; return this._read(function(_) { var C = g._ctx; if (C.dir === "next" && di(C, !0) && 0 < C.limit) { var N = C.valueMapper, P = Ks(C, C.table.core.schema); return C.table.core.query({ trans: _, limit: C.limit, values: !0, query: { index: P, range: C.range } }).then(function(z) { return z = z.result, N ? z.map(N) : z; }); } var L = []; return Gs(C, function(z) { return L.push(z); }, _, C.table.core).then(function() { return L; }); }, h); }, Mt.prototype.offset = function(h) { var g = this._ctx; return h <= 0 || (g.offset += h, di(g) ? $l(g, function() { var _ = h; return function(C, N) { return _ === 0 || (_ === 1 ? --_ : N(function() { C.advance(_), _ = 0; }), !1); }; }) : $l(g, function() { var _ = h; return function() { return --_ < 0; }; })), this; }, Mt.prototype.limit = function(h) { return this._ctx.limit = Math.min(this._ctx.limit, h), $l(this._ctx, function() { var g = h; return function(_, C, N) { return --g <= 0 && C(N), 0 <= g; }; }, !0), this; }, Mt.prototype.until = function(h, g) { return jl(this._ctx, function(_, C, N) { return !h(_.value) || (C(N), g); }), this; }, Mt.prototype.first = function(h) { return this.limit(1).toArray(function(g) { return g[0]; }).then(h); }, Mt.prototype.last = function(h) { return this.reverse().first(h); }, Mt.prototype.filter = function(h) { var g; return jl(this._ctx, function(_) { return h(_.value); }), (g = this._ctx).isMatch = zi(g.isMatch, h), this; }, Mt.prototype.and = function(h) { return this.filter(h); }, Mt.prototype.or = function(h) { return new this.db.WhereClause(this._ctx.table, h, this); }, Mt.prototype.reverse = function() { return this._ctx.dir = this._ctx.dir === "prev" ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this; }, Mt.prototype.desc = function() { return this.reverse(); }, Mt.prototype.eachKey = function(h) { var g = this._ctx; return g.keysOnly = !g.isMatch, this.each(function(_, C) { h(C.key, C); }); }, Mt.prototype.eachUniqueKey = function(h) { return this._ctx.unique = "unique", this.eachKey(h); }, Mt.prototype.eachPrimaryKey = function(h) { var g = this._ctx; return g.keysOnly = !g.isMatch, this.each(function(_, C) { h(C.primaryKey, C); }); }, Mt.prototype.keys = function(h) { var g = this._ctx; g.keysOnly = !g.isMatch; var _ = []; return this.each(function(C, N) { _.push(N.key); }).then(function() { return _; }).then(h); }, Mt.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 = Ks(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 _ = []; return this.each(function(C, N) { _.push(N.primaryKey); }).then(function() { return _; }).then(h); }, Mt.prototype.uniqueKeys = function(h) { return this._ctx.unique = "unique", this.keys(h); }, Mt.prototype.firstKey = function(h) { return this.limit(1).keys(function(g) { return g[0]; }).then(h); }, Mt.prototype.lastKey = function(h) { return this.reverse().firstKey(h); }, Mt.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 jl(this._ctx, function(N) { var C = N.primaryKey.toString(), N = v(g, C); return g[C] = !0, !N; }), this; }, Mt.prototype.modify = function(h) { var g = this, _ = this._ctx; return this._write(function(C) { var N, P, L; L = typeof h == "function" ? h : (N = a(h), P = N.length, function(ne) { for (var fe = !1, ge = 0; ge < P; ++ge) { var we = N[ge], Ee = h[we], Ve = ie(ne, we); Ee instanceof Go ? (ce(ne, we, Ee.execute(Ve)), fe = !0) : Ve !== Ee && (ce(ne, we, Ee), fe = !0); } return fe; }); var z = _.table.core, q = z.schema.primaryKey, W = q.outbound, J = q.extractKey, se = 200, q = g.db._options.modifyChunkSize; q && (se = typeof q == "object" ? q[z.name] || q["*"] || 200 : q); function oe(ne, we) { var ge = we.failures, we = we.numFailures; re += ne - we; for (var Ee = 0, Ve = a(ge); Ee < Ve.length; Ee++) { var Ye = Ve[Ee]; Y.push(ge[Ye]); } } var Y = [], re = 0, ae = []; return g.clone().primaryKeys().then(function(ne) { function fe(we) { var Ee = Math.min(se, ne.length - we); return z.getMany({ trans: C, keys: ne.slice(we, we + Ee), cache: "immutable" }).then(function(Ve) { for (var Ye = [], ze = [], He = W ? [] : null, Je = [], Ke = 0; Ke < Ee; ++Ke) { var tt = Ve[Ke], Et = { value: st(tt), primKey: ne[we + Ke] }; L.call(Et, Et.value, Et) !== !1 && (Et.value == null ? Je.push(ne[we + Ke]) : W || _t(J(tt), J(Et.value)) === 0 ? (ze.push(Et.value), W && He.push(ne[we + Ke])) : (Je.push(ne[we + Ke]), Ye.push(Et.value))); } return Promise.resolve(0 < Ye.length && z.mutate({ trans: C, type: "add", values: Ye }).then(function(At) { for (var Tt in At.failures) Je.splice(parseInt(Tt), 1); oe(Ye.length, At); })).then(function() { return (0 < ze.length || ge && typeof h == "object") && z.mutate({ trans: C, type: "put", keys: He, values: ze, criteria: ge, changeSpec: typeof h != "function" && h, isAdditionalChunk: 0 < we }).then(function(At) { return oe(ze.length, At); }); }).then(function() { return (0 < Je.length || ge && h === cu) && z.mutate({ trans: C, type: "delete", keys: Je, criteria: ge, isAdditionalChunk: 0 < we }).then(function(At) { return oe(Je.length, At); }); }).then(function() { return ne.length > we + Ee && fe(we + se); }); }); } var ge = di(_) && _.limit === 1 / 0 && (typeof h != "function" || h === cu) && { index: _.index, range: _.range }; return fe(0).then(function() { if (0 < Y.length) throw new Q("Error modifying one or more objects", Y, re, ae); return ne.length; }); }); }); }, Mt.prototype.delete = function() { var h = this._ctx, g = h.range; return di(h) && (h.isPrimKey || g.type === 3) ? this._write(function(_) { var C = h.table.core.schema.primaryKey, N = g; return h.table.core.count({ trans: _, query: { index: C, range: N } }).then(function(P) { return h.table.core.mutate({ trans: _, type: "deleteRange", range: N }).then(function(L) { var z = L.failures; if (L.lastResult, L.results, L = L.numFailures, L) throw new Q("Could not delete some values", Object.keys(z).map(function(W) { return z[W]; }), P - L); return P - L; }); }); }) : this.modify(cu); }, Mt); function Mt() { } var cu = function(h, g) { return g.value = null; }; function zl(h, g) { return h < g ? -1 : h === g ? 0 : 1; } function zd(h, g) { return g < h ? -1 : h === g ? 0 : 1; } function Yn(h, g, _) { return h = h instanceof hi ? new h.Collection(h) : h, h._ctx.error = new (_ || TypeError)(g), h; } function fs(h) { return new h.Collection(h, function() { return fi(""); }).limit(0); } function Ys(h, g, _, C) { var N, P, L, z, W, J, se, q = _.length; if (!_.every(function(re) { return typeof re == "string"; })) return Yn(h, Md); function oe(re) { N = re === "next" ? function(ne) { return ne.toUpperCase(); } : function(ne) { return ne.toLowerCase(); }, P = re === "next" ? function(ne) { return ne.toLowerCase(); } : function(ne) { return ne.toUpperCase(); }, L = re === "next" ? zl : zd; var ae = _.map(function(ne) { return { lower: P(ne), upper: N(ne) }; }).sort(function(ne, fe) { return L(ne.lower, fe.lower); }); z = ae.map(function(ne) { return ne.upper; }), W = ae.map(function(ne) { return ne.lower; }), se = (J = re) === "next" ? "" : C; } oe("next"), h = new h.Collection(h, function() { return Pr(z[0], W[q - 1] + C); }), h._ondirectionchange = function(re) { oe(re); }; var Y = 0; return h._addAlgorithm(function(re, ae, ne) { var fe = re.key; if (typeof fe != "string") return !1; var ge = P(fe); if (g(ge, W, Y)) return !0; for (var we = null, Ee = Y; Ee < q; ++Ee) { var Ve = function(Ye, ze, He, Je, Ke, tt) { for (var Et = Math.min(Ye.length, Je.length), At = -1, Tt = 0; Tt < Et; ++Tt) { var Jn = ze[Tt]; if (Jn !== Je[Tt]) return Ke(Ye[Tt], He[Tt]) < 0 ? Ye.substr(0, Tt) + He[Tt] + He.substr(Tt + 1) : Ke(Ye[Tt], Je[Tt]) < 0 ? Ye.substr(0, Tt) + Je[Tt] + He.substr(Tt + 1) : 0 <= At ? Ye.substr(0, At) + ze[At] + He.substr(At + 1) : null; Ke(Ye[Tt], Jn) < 0 && (At = Tt); } return Et < Je.length && tt === "next" ? Ye + He.substr(Ye.length) : Et < Ye.length && tt === "prev" ? Ye.substr(0, He.length) : At < 0 ? null : Ye.substr(0, At) + Je[At] + He.substr(At + 1); }(fe, ge, z[Ee], W[Ee], L, J); Ve === null && we === null ? Y = Ee + 1 : (we === null || 0 < L(we, Ve)) && (we = Ve); } return ae(we !== null ? function() { re.continue(we + se); } : ne), !1; }), h; } function Pr(h, g, _, C) { return { type: 2, lower: h, upper: g, lowerOpen: _, upperOpen: C }; } function fi(h) { return { type: 1, lower: h, upper: h }; } var hi = (Object.defineProperty(rn.prototype, "Collection", { get: function() { return this._ctx.table.db.Collection; }, enumerable: !1, configurable: !0 }), rn.prototype.between = function(h, g, _, C) { _ = _ !== !1, C = C === !0; try { return 0 < this._cmp(h, g) || this._cmp(h, g) === 0 && (_ || C) && (!_ || !C) ? fs(this) : new this.Collection(this, function() { return Pr(h, g, !_, !C); }); } catch { return Yn(this, Kt); } }, rn.prototype.equals = function(h) { return h == null ? Yn(this, Kt) : new this.Collection(this, function() { return fi(h); }); }, rn.prototype.above = function(h) { return h == null ? Yn(this, Kt) : new this.Collection(this, function() { return Pr(h, void 0, !0); }); }, rn.prototype.aboveOrEqual = function(h) { return h == null ? Yn(this, Kt) : new this.Collection(this, function() { return Pr(h, void 0, !1); }); }, rn.prototype.below = function(h) { return h == null ? Yn(this, Kt) : new this.Collection(this, function() { return Pr(void 0, h, !1, !0); }); }, rn.prototype.belowOrEqual = function(h) { return h == null ? Yn(this, Kt) : new this.Collection(this, function() { return Pr(void 0, h); }); }, rn.prototype.startsWith = function(h) { return typeof h != "string" ? Yn(this, Md) : this.between(h, h + ds, !0, !0); }, rn.prototype.startsWithIgnoreCase = function(h) { return h === "" ? this.startsWith(h) : Ys(this, function(g, _) { return g.indexOf(_[0]) === 0; }, [h], ds); }, rn.prototype.equalsIgnoreCase = function(h) { return Ys(this, function(g, _) { return g === _[0]; }, [h], ""); }, rn.prototype.anyOfIgnoreCase = function() { var h = B.apply(Ae, arguments); return h.length === 0 ? fs(this) : Ys(this, function(g, _) { return _.indexOf(g) !== -1; }, h, ""); }, rn.prototype.startsWithAnyOfIgnoreCase = function() { var h = B.apply(Ae, arguments); return h.length === 0 ? fs(this) : Ys(this, function(g, _) { return _.some(function(C) { return g.indexOf(C) === 0; }); }, h, ds); }, rn.prototype.anyOf = function() { var h = this, g = B.apply(Ae, arguments), _ = this._cmp; try { g.sort(_); } catch { return Yn(this, Kt); } if (g.length === 0) return fs(this); var C = new this.Collection(this, function() { return Pr(g[0], g[g.length - 1]); }); C._ondirectionchange = function(P) { _ = P === "next" ? h._ascending : h._descending, g.sort(_); }; var N = 0; return C._addAlgorithm(function(P, L, z) { for (var W = P.key; 0 < _(W, g[N]); ) if (++N === g.length) return L(z), !1; return _(W, g[N]) === 0 || (L(function() { P.continue(g[N]); }), !1); }), C; }, rn.prototype.notEqual = function(h) { return this.inAnyRange([[-1 / 0, h], [h, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 }); }, rn.prototype.noneOf = function() { var h = B.apply(Ae, arguments); if (h.length === 0) return new this.Collection(this); try { h.sort(this._ascending); } catch { return Yn(this, Kt); } var g = h.reduce(function(_, C) { return _ ? _.concat([[_[_.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 }); }, rn.prototype.inAnyRange = function(fe, g) { var _ = this, C = this._cmp, N = this._ascending, P = this._descending, L = this._min, z = this._max; if (fe.length === 0) return fs(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", Oe.InvalidArgument); var W = !g || g.includeLowers !== !1, J = g && g.includeUppers === !0, se, q = N; function oe(ge, we) { return q(ge[0], we[0]); } try { (se = fe.reduce(function(ge, we) { for (var Ee = 0, Ve = ge.length; Ee < Ve; ++Ee) { var Ye = ge[Ee]; if (C(we[0], Ye[1]) < 0 && 0 < C(we[1], Ye[0])) { Ye[0] = L(Ye[0], we[0]), Ye[1] = z(Ye[1], we[1]); break; } } return Ee === Ve && ge.push(we), ge; }, [])).sort(oe); } catch { return Yn(this, Kt); } var Y = 0, re = J ? function(ge) { return 0 < N(ge, se[Y][1]); } : function(ge) { return 0 <= N(ge, se[Y][1]); }, ae = W ? function(ge) { return 0 < P(ge, se[Y][0]); } : function(ge) { return 0 <= P(ge, se[Y][0]); }, ne = re, fe = new this.Collection(this, function() { return Pr(se[0][0], se[se.length - 1][1], !W, !J); }); return fe._ondirectionchange = function(ge) { q = ge === "next" ? (ne = re, N) : (ne = ae, P), se.sort(oe); }, fe._addAlgorithm(function(ge, we, Ee) { for (var Ve, Ye = ge.key; ne(Ye); ) if (++Y === se.length) return we(Ee), !1; return !re(Ve = Ye) && !ae(Ve) || (_._cmp(Ye, se[Y][1]) === 0 || _._cmp(Ye, se[Y][0]) === 0 || we(function() { q === N ? ge.continue(se[Y][0]) : ge.continue(se[Y][1]); }), !1); }), fe; }, rn.prototype.startsWithAnyOf = function() { var h = B.apply(Ae, arguments); return h.every(function(g) { return typeof g == "string"; }) ? h.length === 0 ? fs(this) : this.inAnyRange(h.map(function(g) { return [g, g + ds]; })) : Yn(this, "startsWithAnyOf() only works with strings"); }, rn); function rn() { } function Qn(h) { return Yt(function(g) { return pi(g), h(g.target.error), !1; }); } function pi(h) { h.stopPropagation && h.stopPropagation(), h.preventDefault && h.preventDefault(); } var pr = "storagemutated", ql = "x-storagemutated-1", mi = qi(null, pr), Wo = (Wr.prototype._lock = function() { return j(!lt.global), ++this._reculock, this._reculock !== 1 || lt.global || (lt.lockOwnerFor = this), this; }, Wr.prototype._unlock = function() { if (j(!lt.global), --this._reculock == 0) for (lt.global || (lt.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) { var h = this._blockedFuncs.shift(); try { $i(h[1], h[0]); } catch { } } return this; }, Wr.prototype._locked = function() { return this._reculock && lt.lockOwnerFor !== this; }, Wr.prototype.create = function(h) { var g = this; if (!this.mode) return this; var _ = this.db.idbdb, C = this.db._state.dbOpenError; if (j(!this.idbtrans), !h && !_) switch (C && C.name) { case "DatabaseClosedError": throw new Oe.DatabaseClosed(C); case "MissingAPIError": throw new Oe.MissingAPI(C.message, C); default: throw new Oe.OpenFailed(C); } if (!this.active) throw new Oe.TransactionInactive(); return j(this._completion._state === null), (h = this.idbtrans = h || (this.db.core || _).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = Yt(function(N) { pi(N), g._reject(h.error); }), h.onabort = Yt(function(N) { pi(N), g.active && g._reject(new Oe.Abort(h.error)), g.active = !1, g.on("abort").fire(N); }), h.oncomplete = Yt(function() { g.active = !1, g._resolve(), "mutatedParts" in h && mi.storagemutated.fire(h.mutatedParts); }), this; }, Wr.prototype._promise = function(h, g, _) { var C = this; if (h === "readwrite" && this.mode !== "readwrite") return yn(new Oe.ReadOnly("Transaction is readonly")); if (!this.active) return yn(new Oe.TransactionInactive()); if (this._locked()) return new Ze(function(P, L) { C._blockedFuncs.push([function() { C._promise(h, g, _).then(P, L); }, lt]); }); if (_) return Bi(function() { var P = new Ze(function(L, z) { C._lock(); var W = g(L, z, C); W && W.then && W.then(L, z); }); return P.finally(function() { return C._unlock(); }), P._lib = !0, P; }); var N = new Ze(function(P, L) { var z = g(P, L, C); z && z.then && z.then(P, L); }); return N._lib = !0, N; }, Wr.prototype._root = function() { return this.parent ? this.parent._root() : this; }, Wr.prototype.waitFor = function(h) { var g, _ = this._root(), C = Ze.resolve(h); _._waitingFor ? _._waitingFor = _._waitingFor.then(function() { return C; }) : (_._waitingFor = C, _._waitingQueue = [], g = _.idbtrans.objectStore(_.storeNames[0]), function P() { for (++_._spinCount; _._waitingQueue.length; ) _._waitingQueue.shift()(); _._waitingFor && (g.get(-1 / 0).onsuccess = P); }()); var N = _._waitingFor; return new Ze(function(P, L) { C.then(function(z) { return _._waitingQueue.push(Yt(P.bind(null, z))); }, function(z) { return _._waitingQueue.push(Yt(L.bind(null, z))); }).finally(function() { _._waitingFor === N && (_._waitingFor = null); }); }); }, Wr.prototype.abort = function() { this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new Oe.Abort())); }, Wr.prototype.table = function(h) { var g = this._memoizedTables || (this._memoizedTables = {}); if (v(g, h)) return g[h]; var _ = this.schema[h]; if (!_) throw new Oe.NotFound("Table " + h + " not part of transaction"); return _ = new this.db.Table(h, _, this), _.core = this.db.core.table(h), g[h] = _; }, Wr); function Wr() { } function du(h, g, _, C, N, P, L) { return { name: h, keyPath: g, unique: _, multi: C, auto: N, compound: P, src: (_ && !L ? "&" : "") + (C ? "*" : "") + (N ? "++" : "") + Yo(g) }; } function Yo(h) { return typeof h == "string" ? h : h ? "[" + [].join.call(h, "+") + "]" : ""; } function fu(h, g, _) { return { name: h, primKey: g, indexes: _, mappedClass: null, idxByName: (C = function(N) { return [N.name, N]; }, _.reduce(function(N, P, L) { return L = C(P, L), L && (N[L[0]] = L[1]), N; }, {})) }; var C; } var Qo = function(h) { try { return h.only([[]]), Qo = function() { return [[]]; }, [[]]; } catch { return Qo = function() { return ds; }, ds; } }; function hs(h) { return h == null ? function() { } : typeof h == "string" ? (g = h).split(".").length === 1 ? function(_) { return _[g]; } : function(_) { return ie(_, g); } : function(_) { return ie(_, h); }; var g; } function Qs(h) { return [].slice.call(h); } var Js = 0; function Hi(h) { return h == null ? ":id" : typeof h == "string" ? h : "[".concat(h.join("+"), "]"); } function Jp(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, ae = ne.lowerOpen, ne = ne.upperOpen; return Y === void 0 ? re === void 0 ? null : g.upperBound(re, !!ne) : re === void 0 ? g.lowerBound(Y, !!ae) : g.bound(Y, re, !!ae, !!ne); } function N(oe) { var Y, re = oe.name; return { name: re, schema: oe, mutate: function(ae) { var ne = ae.trans, fe = ae.type, ge = ae.keys, we = ae.values, Ee = ae.range; return new Promise(function(Ve, Ye) { Ve = Yt(Ve); var ze = ne.objectStore(re), He = ze.keyPath == null, Je = fe === "put" || fe === "add"; if (!Je && fe !== "delete" && fe !== "deleteRange") throw new Error("Invalid operation type: " + fe); var Ke, tt = (ge || we || { length: 1 }).length; if (ge && we && ge.length !== we.length) throw new Error("Given keys array must have same length as given values array."); if (tt === 0) return Ve({ numFailures: 0, failures: {}, results: [], lastResult: void 0 }); function Et(gn) { ++Jn, pi(gn); } var At = [], Tt = [], Jn = 0; if (fe === "deleteRange") { if (Ee.type === 4) return Ve({ numFailures: Jn, failures: Tt, results: [], lastResult: void 0 }); Ee.type === 3 ? At.push(Ke = ze.clear()) : At.push(Ke = ze.delete(C(Ee))); } else { var He = Je ? He ? [we, ge] : [we, null] : [ge, null], kt = He[0], On = He[1]; if (Je) for (var Pn = 0; Pn < tt; ++Pn) At.push(Ke = On && On[Pn] !== void 0 ? ze[fe](kt[Pn], On[Pn]) : ze[fe](kt[Pn])), Ke.onerror = Et; else for (Pn = 0; Pn < tt; ++Pn) At.push(Ke = ze[fe](kt[Pn])), Ke.onerror = Et; } function oa(gn) { gn = gn.target.result, At.forEach(function(gi, aa) { return gi.error != null && (Tt[aa] = gi.error); }), Ve({ numFailures: Jn, failures: Tt, results: fe === "delete" ? ge : At.map(function(gi) { return gi.result; }), lastResult: gn }); } Ke.onerror = function(gn) { Et(gn), oa(gn); }, Ke.onsuccess = oa; }); }, getMany: function(ae) { var ne = ae.trans, fe = ae.keys; return new Promise(function(ge, we) { ge = Yt(ge); for (var Ee, Ve = ne.objectStore(re), Ye = fe.length, ze = new Array(Ye), He = 0, Je = 0, Ke = function(At) { At = At.target, ze[At._pos] = At.result, ++Je === He && ge(ze); }, tt = Qn(we), Et = 0; Et < Ye; ++Et) fe[Et] != null && ((Ee = Ve.get(fe[Et]))._pos = Et, Ee.onsuccess = Ke, Ee.onerror = tt, ++He); He === 0 && ge(ze); }); }, get: function(ae) { var ne = ae.trans, fe = ae.key; return new Promise(function(ge, we) { ge = Yt(ge); var Ee = ne.objectStore(re).get(fe); Ee.onsuccess = function(Ve) { return ge(Ve.target.result); }, Ee.onerror = Qn(we); }); }, query: (Y = J, function(ae) { return new Promise(function(ne, fe) { ne = Yt(ne); var ge, we, Ee, He = ae.trans, Ve = ae.values, Ye = ae.limit, Ke = ae.query, ze = Ye === 1 / 0 ? void 0 : Ye, Je = Ke.index, Ke = Ke.range, He = He.objectStore(re), Je = Je.isPrimaryKey ? He : He.index(Je.name), Ke = C(Ke); if (Ye === 0) return ne({ result: [] }); Y ? ((ze = Ve ? Je.getAll(Ke, ze) : Je.getAllKeys(Ke, ze)).onsuccess = function(tt) { return ne({ result: tt.target.result }); }, ze.onerror = Qn(fe)) : (ge = 0, we = !Ve && "openKeyCursor" in Je ? Je.openKeyCursor(Ke) : Je.openCursor(Ke), Ee = [], we.onsuccess = function(tt) { var Et = we.result; return Et ? (Ee.push(Ve ? Et.value : Et.primaryKey), ++ge === Ye ? ne({ result: Ee }) : void Et.continue()) : ne({ result: Ee }); }, we.onerror = Qn(fe)); }); }), openCursor: function(ae) { var ne = ae.trans, fe = ae.values, ge = ae.query, we = ae.reverse, Ee = ae.unique; return new Promise(function(Ve, Ye) { Ve = Yt(Ve); var Je = ge.index, ze = ge.range, He = ne.objectStore(re), He = Je.isPrimaryKey ? He : He.index(Je.name), Je = we ? Ee ? "prevunique" : "prev" : Ee ? "nextunique" : "next", Ke = !fe && "openKeyCursor" in He ? He.openKeyCursor(C(ze), Je) : He.openCursor(C(ze), Je); Ke.onerror = Qn(Ye), Ke.onsuccess = Yt(function(tt) { var Et, At, Tt, Jn, kt = Ke.result; kt ? (kt.___id = ++Js, kt.done = !1, Et = kt.continue.bind(kt), At = (At = kt.continuePrimaryKey) && At.bind(kt), Tt = kt.advance.bind(kt), Jn = function() { throw new Error("Cursor not stopped"); }, kt.trans = ne, kt.stop = kt.continue = kt.continuePrimaryKey = kt.advance = function() { throw new Error("Cursor not started"); }, kt.fail = Yt(Ye), kt.next = function() { var On = this, Pn = 1; return this.start(function() { return Pn-- ? On.continue() : On.stop(); }).then(function() { return On; }); }, kt.start = function(On) { function Pn() { if (Ke.result) try { On(); } catch (gn) { kt.fail(gn); } else kt.done = !0, kt.start = function() { throw new Error("Cursor behind last entry"); }, kt.stop(); } var oa = new Promise(function(gn, gi) { gn = Yt(gn), Ke.onerror = Qn(gi), kt.fail = gi, kt.stop = function(aa) { kt.stop = kt.continue = kt.continuePrimaryKey = kt.advance = Jn, gn(aa); }; }); return Ke.onsuccess = Yt(function(gn) { Ke.onsuccess = Pn, Pn(); }), kt.continue = Et, kt.continuePrimaryKey = At, kt.advance = Tt, Pn(), oa; }, Ve(kt)) : Ve(null); }, Ye); }); }, count: function(ae) { var ne = ae.query, fe = ae.trans, ge = ne.index, we = ne.range; return new Promise(function(Ee, Ve) { var Ye = fe.objectStore(re), ze = ge.isPrimaryKey ? Ye : Ye.index(ge.name), Ye = C(we), ze = Ye ? ze.count(Ye) : ze.count(); ze.onsuccess = Yt(function(He) { return Ee(He.target.result); }), ze.onerror = Qn(Ve); }); } }; } var P, L, z, se = (L = W, z = Qs((P = h).objectStoreNames), { schema: { name: P.name, tables: z.map(function(oe) { return L.objectStore(oe); }).map(function(oe) { var Y = oe.keyPath, ne = oe.autoIncrement, re = l(Y), ae = {}, ne = { name: oe.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: Y == null, compound: re, keyPath: Y, autoIncrement: ne, unique: !0, extractKey: hs(Y) }, indexes: Qs(oe.indexNames).map(function(fe) { return oe.index(fe); }).map(function(Ee) { var ge = Ee.name, we = Ee.unique, Ve = Ee.multiEntry, Ee = Ee.keyPath, Ve = { name: ge, compound: l(Ee), keyPath: Ee, unique: we, multiEntry: Ve, extractKey: hs(Ee) }; return ae[Hi(Ee)] = Ve; }), getIndexByKeyPath: function(fe) { return ae[Hi(fe)]; } }; return ae[":id"] = ne.primaryKey, Y != null && (ae[Hi(Y)] = ne.primaryKey), ne; }) }, hasGetAll: 0 < z.length && "getAll" in L.objectStore(z[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), W = se.schema, J = se.hasGetAll, se = W.tables.map(N), q = {}; return se.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: Qo(g), schema: W }; } function Xp(h, g, _, C) { var N = _.IDBKeyRange; return _.indexedDB, { dbcore: (C = Jp(g, N, C), h.dbcore.reduce(function(P, L) { return L = L.create, r(r({}, P), L(P)); }, C)) }; } function Xs(h, C) { var _ = C.db, C = Xp(h._middlewares, _, h._deps, C); h.core = C.dbcore, h.tables.forEach(function(N) { var P = N.name; h.core.schema.tables.some(function(L) { return L.name === P; }) && (N.core = h.core.table(P), h[P] instanceof h.Table && (h[P].core = N.core)); }); } function ps(h, g, _, C) { _.forEach(function(N) { var P = C[N]; g.forEach(function(L) { var z = function W(J, se) { return T(J, se) || (J = d(J)) && W(J, se); }(L, N); (!z || "value" in z && z.value === void 0) && (L === h.Transaction.prototype || L instanceof h.Transaction ? E(L, N, { get: function() { return this.table(N); }, set: function(W) { k(this, N, { value: W, writable: !0, configurable: !0, enumerable: !0 }); } }) : L[N] = new h.Table(N, P)); }); }); } function Jo(h, g) { g.forEach(function(_) { for (var C in _) _[C] instanceof h.Table && delete _[C]; }); } function qd(h, g) { return h._cfg.version - g._cfg.version; } function Ki(h, g, _, C) { var N = h._dbSchema; _.objectStoreNames.contains("$meta") && !N.$meta && (N.$meta = fu("$meta", gs("")[0], []), h._storeNames.push("$meta")); var P = h._createTransaction("readwrite", h._storeNames, N); P.create(_), P._completion.catch(C); var L = P._reject.bind(P), z = lt.transless || lt; Bi(function() { return lt.trans = P, lt.transless = z, g !== 0 ? (Xs(h, _), J = g, ((W = P).storeNames.includes("$meta") ? W.table("$meta").get("version").then(function(se) { return se ?? J; }) : Ze.resolve(J)).then(function(se) { return oe = se, Y = P, re = _, ae = [], se = (q = h)._versions, ne = q._dbSchema = Zo(0, q.idbdb, re), (se = se.filter(function(fe) { return fe._cfg.version >= oe; })).length !== 0 ? (se.forEach(function(fe) { ae.push(function() { var ge = ne, we = fe._cfg.dbschema; Ln(q, ge, re), Ln(q, we, re), ne = q._dbSchema = we; var Ee = Zs(ge, we); Ee.add.forEach(function(Je) { hu(re, Je[0], Je[1].primKey, Je[1].indexes); }), Ee.change.forEach(function(Je) { if (Je.recreate) throw new Oe.Upgrade("Not yet support for changing primary key"); var Ke = re.objectStore(Je.name); Je.add.forEach(function(tt) { return ms(Ke, tt); }), Je.change.forEach(function(tt) { Ke.deleteIndex(tt.name), ms(Ke, tt); }), Je.del.forEach(function(tt) { return Ke.deleteIndex(tt); }); }); var Ve = fe._cfg.contentUpgrade; if (Ve && fe._cfg.version > oe) { Xs(q, re), Y._memoizedTables = {}; var Ye = H(we); Ee.del.forEach(function(Je) { Ye[Je] = ge[Je]; }), Jo(q, [q.Transaction.prototype]), ps(q, [q.Transaction.prototype], a(Ye), Ye), Y.schema = Ye; var ze, He = M(Ve); return He && qs(), Ee = Ze.follow(function() { var Je; (ze = Ve(Y)) && He && (Je = Wn.bind(null, null), ze.then(Je, Je)); }), ze && typeof ze.then == "function" ? Ze.resolve(ze) : Ee.then(function() { return ze; }); } }), ae.push(function(ge) { var we, Ee, Ve = fe._cfg.dbschema; we = Ve, Ee = ge, [].slice.call(Ee.db.objectStoreNames).forEach(function(Ye) { return we[Ye] == null && Ee.db.deleteObjectStore(Ye); }), Jo(q, [q.Transaction.prototype]), ps(q, [q.Transaction.prototype], q._storeNames, q._dbSchema), Y.schema = q._dbSchema; }), ae.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(we) { return we !== "$meta"; })) : ge.objectStore("$meta").put(fe._cfg.version, "version")); }); }), function fe() { return ae.length ? Ze.resolve(ae.shift()(Y.idbtrans)).then(fe) : Ze.resolve(); }().then(function() { Xo(ne, re); })) : Ze.resolve(); var q, oe, Y, re, ae, ne; }).catch(L)) : (a(N).forEach(function(se) { hu(_, se, N[se].primKey, N[se].indexes); }), Xs(h, _), void Ze.follow(function() { return h.on.populate.fire(P); }).catch(L)); var W, J; }); } function Hl(h, g) { Xo(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 _ = Zo(0, h.idbdb, g); Ln(h, h._dbSchema, g); for (var C = 0, N = Zs(_, h._dbSchema).change; C < N.length; C++) { var P = function(L) { if (L.change.length || L.recreate) return console.warn("Unable to patch indexes of table ".concat(L.name, " because it has changes on the type of index or primary key.")), { value: void 0 }; var z = g.objectStore(L.name); L.add.forEach(function(W) { F && console.debug("Dexie upgrade patch: Creating missing index ".concat(L.name, ".").concat(W.src)), ms(z, W); }); }(N[C]); if (typeof P == "object") return P.value; } } function Zs(h, g) { var _, C = { del: [], add: [], change: [] }; for (_ in h) g[_] || C.del.push(_); for (_ in g) { var N = h[_], P = g[_]; if (N) { var L = { name: _, def: P, recreate: !1, del: [], add: [], change: [] }; if ("" + (N.primKey.keyPath || "") != "" + (P.primKey.keyPath || "") || N.primKey.auto !== P.primKey.auto) L.recreate = !0, C.change.push(L); else { var z = N.idxByName, W = P.idxByName, J = void 0; for (J in z) W[J] || L.del.push(J); for (J in W) { var se = z[J], q = W[J]; se ? se.src !== q.src && L.change.push(q) : L.add.push(q); } (0 < L.del.length || 0 < L.add.length || 0 < L.change.length) && C.change.push(L); } } else C.add.push([_, P]); } return C; } function hu(h, g, _, C) { var N = h.db.createObjectStore(g, _.keyPath ? { keyPath: _.keyPath, autoIncrement: _.auto } : { autoIncrement: _.auto }); return C.forEach(function(P) { return ms(N, P); }), N; } function Xo(h, g) { a(h).forEach(function(_) { g.db.objectStoreNames.contains(_) || (F && console.debug("Dexie: Creating missing table", _), hu(g, _, h[_].primKey, h[_].indexes)); }); } function ms(h, g) { h.createIndex(g.name, g.keyPath, { unique: g.unique, multiEntry: g.multi }); } function Zo(h, g, _) { var C = {}; return R(g.objectStoreNames, 0).forEach(function(N) { for (var P = _.objectStore(N), L = du(Yo(J = P.keyPath), J || "", !0, !1, !!P.autoIncrement, J && typeof J != "string", !0), z = [], W = 0; W < P.indexNames.length; ++W) { var se = P.index(P.indexNames[W]), J = se.keyPath, se = du(se.name, J, !!se.unique, !!se.multiEntry, !1, J && typeof J != "string", !1); z.push(se); } C[N] = fu(N, L, z); }), C; } function Ln(h, g, _) { for (var C = _.db.objectStoreNames, N = 0; N < C.length; ++N) { var P = C[N], L = _.objectStore(P); h._hasGetAll = "getAll" in L; for (var z = 0; z < L.indexNames.length; ++z) { var W = L.indexNames[z], J = L.index(W).keyPath, se = typeof J == "string" ? J : "[" + R(J).join("+") + "]"; !g[P] || (J = g[P].idxByName[se]) && (J.name = W, delete g[P].idxByName[se], g[P].idxByName[W] = J); } } typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && s.WorkerGlobalScope && s instanceof s.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (h._hasGetAll = !1); } function gs(h) { return h.split(",").map(function(g, _) { 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), _ === 0); }); } var Kl = (Gi.prototype._parseStoresSpec = function(h, g) { a(h).forEach(function(_) { if (h[_] !== null) { var C = gs(h[_]), N = C.shift(); if (N.unique = !0, N.multi) throw new Oe.Schema("Primary key cannot be multi-valued"); C.forEach(function(P) { if (P.auto) throw new Oe.Schema("Only primary key can be marked as autoIncrement (++)"); if (!P.keyPath) throw new Oe.Schema("Index must have a name and cannot be an empty string"); }), g[_] = fu(_, N, C); } }); }, Gi.prototype.stores = function(_) { var g = this.db; this._cfg.storesSource = this._cfg.storesSource ? f(this._cfg.storesSource, _) : _; var _ = g._versions, C = {}, N = {}; return _.forEach(function(P) { f(C, P._cfg.storesSource), N = P._cfg.dbschema = {}, P._parseStoresSpec(C, N); }), g._dbSchema = N, Jo(g, [g._allTables, g, g.Transaction.prototype]), ps(g, [g._allTables, g, g.Transaction.prototype, this._cfg.tables], a(N), N), g._storeNames = a(N), this; }, Gi.prototype.upgrade = function(h) { return this._cfg.contentUpgrade = b(this._cfg.contentUpgrade || Xe, h), this; }, Gi); function Gi() { } function Gl(h, g) { var _ = h._dbNamesDB; return _ || (_ = h._dbNamesDB = new Yr(Ho, { addons: [], indexedDB: h, IDBKeyRange: g })).version(1).stores({ dbnames: "name" }), _.table("dbnames"); } function ea(h) { return h && typeof h.databases == "function"; } function ta(h) { return Bi(function() { return lt.letThrough = !0, h(); }); } function vs(h) { return !("from" in h); } var kn = function(h, g) { if (!this) { var _ = new kn(); return h && "d" in h && f(_, h), _; } f(this, arguments.length ? { d: 1, from: h, to: 1 < arguments.length ? g : h } : { d: 0 }); }; function eo(h, g, _) { var C = _t(g, _); if (!isNaN(C)) { if (0 < C) throw RangeError(); if (vs(h)) return f(h, { from: g, to: _, d: 1 }); var N = h.l, C = h.r; if (_t(_, h.from) < 0) return N ? eo(N, g, _) : h.l = { from: g, to: _, d: 1, l: null, r: null }, mu(h); if (0 < _t(g, h.to)) return C ? eo(C, g, _) : h.r = { from: g, to: _, d: 1, l: null, r: null }, mu(h); _t(g, h.from) < 0 && (h.from = g, h.l = null, h.d = C ? C.d + 1 : 1), 0 < _t(_, h.to) && (h.to = _, h.r = null, h.d = h.l ? h.l.d + 1 : 1), _ = !h.r, N && !h.l && na(h, N), C && _ && na(h, C); } } function na(h, g) { vs(g) || function _(C, W) { var P = W.from, L = W.to, z = W.l, W = W.r; eo(C, P, L), z && _(C, z), W && _(C, W); }(h, g); } function Hd(h, g) { var _ = pu(g), C = _.next(); if (C.done) return !1; for (var N = C.value, P = pu(h), L = P.next(N.from), z = L.value; !C.done && !L.done; ) { if (_t(z.from, N.to) <= 0 && 0 <= _t(z.to, N.from)) return !0; _t(N.from, z.from) < 0 ? N = (C = _.next(z.from)).value : z = (L = P.next(N.from)).value; } return !1; } function pu(h) { var g = vs(h) ? null : { s: 0, n: h }; return { next: function(_) { for (var C = 0 < arguments.length; g; ) switch (g.s) { case 0: if (g.s = 1, C) for (; g.n.l && _t(_, 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 || _t(_, 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, _, C = (((g = h.r) === null || g === void 0 ? void 0 : g.d) || 0) - (((_ = h.l) === null || _ === void 0 ? void 0 : _.d) || 0), N = 1 < C ? "r" : C < -1 ? "l" : ""; N && (g = N == "r" ? "l" : "r", _ = r({}, h), C = h[N], h.from = C.from, h.to = C.to, h[N] = C[N], _[N] = C[g], (h[g] = _).d = Kd(_)), h.d = Kd(h); } function Kd(_) { var g = _.r, _ = _.l; return (g ? _ ? Math.max(g.d, _.d) : g.d : _ ? _.d : 0) + 1; } function gu(h, g) { return a(g).forEach(function(_) { h[_] ? na(h[_], g[_]) : h[_] = function C(N) { var P, L, z = {}; for (P in N) v(N, P) && (L = N[P], z[P] = !L || typeof L != "object" || _e.has(L.constructor) ? L : C(L)); return z; }(g[_]); }), h; } function Wl(h, g) { return h.all || g.all || Object.keys(h).some(function(_) { return g[_] && Hd(g[_], h[_]); }); } y(kn.prototype, ((mr = { add: function(h) { return na(this, h), this; }, addKey: function(h) { return eo(this, h, h), this; }, addKeys: function(h) { var g = this; return h.forEach(function(_) { return eo(g, _, _); }), this; }, hasKey: function(h) { var g = pu(this).next(h).value; return g && _t(g.from, h) <= 0 && 0 <= _t(g.to, h); } })[ke] = function() { return pu(this); }, mr)); var ys = {}, Yl = {}, vu = !1; function yu(h) { gu(Yl, h), vu || (vu = !0, setTimeout(function() { vu = !1, Ql(Yl, !(Yl = {})); }, 0)); } function Ql(h, g) { g === void 0 && (g = !1); var _ = /* @__PURE__ */ new Set(); if (h.all) for (var C = 0, N = Object.values(ys); C < N.length; C++) Gd(L = N[C], h, _, g); else for (var P in h) { var L, z = /^idb\:\/\/(.*)\/(.*)\//.exec(P); z && (P = z[1], z = z[2], (L = ys["idb://".concat(P, "/").concat(z)]) && Gd(L, h, _, g)); } _.forEach(function(W) { return W(); }); } function Gd(h, g, _, C) { for (var N = [], P = 0, L = Object.entries(h.queries.query); P < L.length; P++) { for (var z = L[P], W = z[0], J = [], se = 0, q = z[1]; se < q.length; se++) { var oe = q[se]; Wl(g, oe.obsSet) ? oe.subscribers.forEach(function(ne) { return _.add(ne); }) : C && J.push(oe); } C && N.push([W, J]); } if (C) for (var Y = 0, re = N; Y < re.length; Y++) { var ae = re[Y], W = ae[0], J = ae[1]; h.queries.query[W] = J; } } function Zp(h) { var g = h._state, _ = h._deps.indexedDB; if (g.isBeingOpened || h.idbdb) return g.dbReadyPromise.then(function() { return g.dbOpenError ? yn(g.dbOpenError) : h; }); g.isBeingOpened = !0, g.dbOpenError = null, g.openComplete = !1; var C = g.openCanceller, N = Math.round(10 * h.verno), P = !1; function L() { if (g.openCanceller !== C) throw new Oe.DatabaseClosed("db.open() was cancelled"); } function z() { return new Ze(function(oe, Y) { if (L(), !_) throw new Oe.MissingAPI(); var re = h.name, ae = g.autoSchema || !N ? _.open(re) : _.open(re, N); if (!ae) throw new Oe.MissingAPI(); ae.onerror = Qn(Y), ae.onblocked = Yt(h._fireOnBlocked), ae.onupgradeneeded = Yt(function(ne) { var fe; se = ae.transaction, g.autoSchema && !h._options.allowEmptyDB ? (ae.onerror = pi, se.abort(), ae.result.close(), (fe = _.deleteDatabase(re)).onsuccess = fe.onerror = Yt(function() { Y(new Oe.NoSuchDatabase("Database ".concat(re, " doesnt exist"))); })) : (se.onerror = Qn(Y), ne = ne.oldVersion > Math.pow(2, 62) ? 0 : ne.oldVersion, q = ne < 1, h.idbdb = ae.result, P && Hl(h, se), Ki(h, ne / 10, se, Y)); }, Y), ae.onsuccess = Yt(function() { se = null; var ne, fe, ge, we, Ee, Ve = h.idbdb = ae.result, Ye = R(Ve.objectStoreNames); if (0 < Ye.length) try { var ze = Ve.transaction((we = Ye).length === 1 ? we[0] : we, "readonly"); if (g.autoSchema) fe = Ve, ge = ze, (ne = h).verno = fe.version / 10, ge = ne._dbSchema = Zo(0, fe, ge), ne._storeNames = R(fe.objectStoreNames, 0), ps(ne, [ne._allTables], a(ge), ge); else if (Ln(h, h._dbSchema, ze), ((Ee = Zs(Zo(0, (Ee = h).idbdb, ze), Ee._dbSchema)).add.length || Ee.change.some(function(He) { return He.add.length || He.change.length; })) && !P) 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."), Ve.close(), N = Ve.version + 1, P = !0, oe(z()); Xs(h, ze); } catch { } Vi.push(h), Ve.onversionchange = Yt(function(He) { g.vcFired = !0, h.on("versionchange").fire(He); }), Ve.onclose = Yt(function(He) { h.on("close").fire(He); }), q && (Ee = h._deps, ze = re, Ve = Ee.indexedDB, Ee = Ee.IDBKeyRange, ea(Ve) || ze === Ho || Gl(Ve, Ee).put({ name: ze }).catch(Xe)), oe(); }, Y); }).catch(function(oe) { switch (oe == null ? void 0 : 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 Ze.reject(oe); }); } var W, J = g.dbReadyResolve, se = null, q = !1; return Ze.race([C, (typeof navigator > "u" ? Ze.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 L(), g.onReadyBeingFired = [], Ze.resolve(ta(function() { return h.on.ready.fire(h.vip); })).then(function oe() { if (0 < g.onReadyBeingFired.length) { var Y = g.onReadyBeingFired.reduce(b, Xe); return g.onReadyBeingFired = [], Ze.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 { se && se.abort(); } catch { } return C === g.openCanceller && h._close(), yn(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(pr).fire(oe), Ql(oe, !0)), h; }); } function ra(h) { function g(P) { return h.next(P); } var _ = N(g), C = N(function(P) { return h.throw(P); }); function N(P) { return function(W) { var z = P(W), W = z.value; return z.done ? W : W && typeof W.then == "function" ? W.then(_, C) : l(W) ? Promise.all(W).then(_, C) : _(W); }; } return N(g)(); } function wu(h, g, _) { for (var C = l(h) ? h.slice() : [h], N = 0; N < _; ++N) C.push(g); return C; } var em = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(h) { return r(r({}, h), { table: function(g) { var _ = h.table(g), C = _.schema, N = {}, P = []; function L(q, oe, Y) { var re = Hi(q), ae = 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: hs(q), unique: !fe && Y.unique }); return ae.push(fe), fe.isPrimaryKey || P.push(fe), 1 < ne && L(ne === 2 ? q[0] : q.slice(0, ne - 1), oe + 1, Y), ae.sort(function(ge, we) { return ge.keyTail - we.keyTail; }), fe; } g = L(C.primaryKey.keyPath, 0, C.primaryKey), N[":id"] = [g]; for (var z = 0, W = C.indexes; z < W.length; z++) { var J = W[z]; L(J.keyPath, 0, J); } function se(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({}, _), { schema: r(r({}, C), { primaryKey: g, indexes: P, getIndexByKeyPath: function(q) { return (q = N[Hi(q)]) && q[0]; } }), count: function(q) { return _.count(se(q)); }, query: function(q) { return _.query(se(q)); }, openCursor: function(q) { var oe = q.query.index, Y = oe.keyTail, re = oe.isVirtual, ae = oe.keyLength; return re ? _.openCursor(se(q)).then(function(fe) { return fe && ne(fe); }) : _.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, ae).concat(q.reverse ? h.MIN_KEY : h.MAX_KEY, Y)) : fe.continue(); } }, continuePrimaryKey: { value: function(ge, we) { fe.continuePrimaryKey(wu(ge, h.MAX_KEY, Y), we); } }, primaryKey: { get: function() { return fe.primaryKey; } }, key: { get: function() { var ge = fe.key; return ae === 1 ? ge[0] : ge.slice(0, ae); } }, value: { get: function() { return fe.value; } } }); } } }); } }); } }; function Jl(h, g, _, C) { return _ = _ || {}, C = C || "", a(h).forEach(function(N) { var P, L, z; v(g, N) ? (P = h[N], L = g[N], typeof P == "object" && typeof L == "object" && P && L ? (z = ue(P)) !== ue(L) ? _[C + N] = g[N] : z === "Object" ? Jl(P, L, _, C + N + ".") : P !== L && (_[C + N] = g[N]) : P !== L && (_[C + N] = g[N])) : _[C + N] = void 0; }), a(g).forEach(function(N) { v(h, N) || (_[C + N] = g[N]); }), _; } function _u(h, g) { return g.type === "delete" ? g.keys : g.keys || g.values.map(h.extractKey); } var tm = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(h) { return r(r({}, h), { table: function(g) { var _ = h.table(g), C = _.schema.primaryKey; return r(r({}, _), { mutate: function(N) { var P = lt.trans, L = P.table(g).hook, z = L.deleting, W = L.creating, J = L.updating; switch (N.type) { case "add": if (W.fire === Xe) break; return P._promise("readwrite", function() { return se(N); }, !0); case "put": if (W.fire === Xe && J.fire === Xe) break; return P._promise("readwrite", function() { return se(N); }, !0); case "delete": if (z.fire === Xe) break; return P._promise("readwrite", function() { return se(N); }, !0); case "deleteRange": if (z.fire === Xe) break; return P._promise("readwrite", function() { return function q(oe, Y, re) { return _.query({ trans: oe, values: !1, query: { index: C, range: Y }, limit: re }).then(function(ae) { var ne = ae.result; return se({ 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 _.mutate(N); function se(q) { var oe, Y, re, ae = lt.trans, ne = q.keys || _u(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 = _, 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(we, Ee) { var Ve, Ye, ze, He = fe[Ee], Je = { onerror: null, onsuccess: null }; return q.type === "delete" ? z.fire.call(Je, we, He, ae) : q.type === "add" || He === void 0 ? (Ve = W.fire.call(Je, we, q.values[Ee], ae), we == null && Ve != null && (q.keys[Ee] = we = Ve, C.outbound || ce(q.values[Ee], C.keyPath, we))) : (Ve = Jl(He, q.values[Ee]), (Ye = J.fire.call(Je, Ve, we, He, ae)) && (ze = q.values[Ee], Object.keys(Ye).forEach(function(Ke) { v(ze, Ke) ? ze[Ke] = Ye[Ke] : ce(ze, Ke, Ye[Ke]); }))), Je; }); return _.mutate(q).then(function(we) { for (var Ee = we.failures, Ve = we.results, Ye = we.numFailures, we = we.lastResult, ze = 0; ze < ne.length; ++ze) { var He = (Ve || ne)[ze], Je = ge[ze]; He == null ? Je.onerror && Je.onerror(Ee[ze]) : Je.onsuccess && Je.onsuccess(q.type === "put" && fe[ze] ? q.values[ze] : He); } return { failures: Ee, results: Ve, numFailures: Ye, lastResult: we }; }).catch(function(we) { return ge.forEach(function(Ee) { return Ee.onerror && Ee.onerror(we); }), Promise.reject(we); }); }); } } }); } }); } }; function Wd(h, g, _) { try { if (!g || g.keys.length < h.length) return null; for (var C = [], N = 0, P = 0; N < g.keys.length && P < h.length; ++N) _t(g.keys[N], h[P]) === 0 && (C.push(_ ? st(g.values[N]) : g.values[N]), ++P); return C.length === h.length ? C : null; } catch { return null; } } var nm = { stack: "dbcore", level: -1, create: function(h) { return { table: function(g) { var _ = h.table(g); return r(r({}, _), { getMany: function(C) { if (!C.cache) return _.getMany(C); var N = Wd(C.keys, C.trans._cache, C.cache === "clone"); return N ? Ze.resolve(N) : _.getMany(C).then(function(P) { return C.trans._cache = { keys: C.keys, values: C.cache === "clone" ? st(P) : P }, P; }); }, mutate: function(C) { return C.type !== "add" && (C.trans._cache = null), _.mutate(C); } }); } }; } }; function Yd(h, g) { return h.trans.mode === "readonly" && !!h.subscr && !h.trans.explicit && h.trans.db._options.cache !== "disabled" && !g.schema.primaryKey.outbound; } function Qd(h, g) { switch (h) { case "query": return g.values && !g.unique; case "get": case "getMany": case "count": case "openCursor": return !1; } } var rm = { stack: "dbcore", level: 0, name: "Observability", create: function(h) { var g = h.schema.name, _ = new kn(h.MIN_KEY, h.MAX_KEY); return r(r({}, h), { transaction: function(C, N, P) { if (lt.subscr && N !== "readonly") throw new Oe.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(lt.querier)); return h.transaction(C, N, P); }, table: function(C) { var N = h.table(C), P = N.schema, L = P.primaryKey, q = P.indexes, z = L.extractKey, W = L.outbound, J = L.autoIncrement && q.filter(function(Y) { return Y.compound && Y.keyPath.includes(L.keyPath); }), se = r(r({}, N), { mutate: function(Y) { function re(Ke) { return Ke = "idb://".concat(g, "/").concat(C, "/").concat(Ke), we[Ke] || (we[Ke] = new kn()); } var ae, ne, fe, ge = Y.trans, we = Y.mutatedParts || (Y.mutatedParts = {}), Ee = re(""), Ve = re(":dels"), Ye = Y.type, Je = Y.type === "deleteRange" ? [Y.range] : Y.type === "delete" ? [Y.keys] : Y.values.length < 50 ? [_u(L, Y).filter(function(Ke) { return Ke; }), Y.values] : [], ze = Je[0], He = Je[1], Je = Y.trans._cache; return l(ze) ? (Ee.addKeys(ze), (Je = Ye === "delete" || ze.length === He.length ? Wd(ze, Je) : null) || Ve.addKeys(ze), (Je || He) && (ae = re, ne = Je, fe = He, P.indexes.forEach(function(Ke) { var tt = ae(Ke.name || ""); function Et(Tt) { return Tt != null ? Ke.extractKey(Tt) : null; } function At(Tt) { return Ke.multiEntry && l(Tt) ? Tt.forEach(function(Jn) { return tt.addKey(Jn); }) : tt.addKey(Tt); } (ne || fe).forEach(function(Tt, On) { var kt = ne && Et(ne[On]), On = fe && Et(fe[On]); _t(kt, On) !== 0 && (kt != null && At(kt), On != null && At(On)); }); }))) : ze ? (He = { from: (He = ze.lower) !== null && He !== void 0 ? He : h.MIN_KEY, to: (He = ze.upper) !== null && He !== void 0 ? He : h.MAX_KEY }, Ve.add(He), Ee.add(He)) : (Ee.add(_), Ve.add(_), P.indexes.forEach(function(Ke) { return re(Ke.name).add(_); })), N.mutate(Y).then(function(Ke) { return !ze || Y.type !== "add" && Y.type !== "put" || (Ee.addKeys(Ke.results), J && J.forEach(function(tt) { for (var Et = Y.values.map(function(kt) { return tt.extractKey(kt); }), At = tt.keyPath.findIndex(function(kt) { return kt === L.keyPath; }), Tt = 0, Jn = Ke.results.length; Tt < Jn; ++Tt) Et[Tt][At] = Ke.results[Tt]; re(tt.name).addKeys(Et); })), ge.mutatedParts = gu(ge.mutatedParts || {}, we), Ke; }); } }), q = function(re) { var ae = re.query, re = ae.index, ae = ae.range; return [re, new kn((re = ae.lower) !== null && re !== void 0 ? re : h.MIN_KEY, (ae = ae.upper) !== null && ae !== void 0 ? ae : h.MAX_KEY)]; }, oe = { get: function(Y) { return [L, new kn(Y.key)]; }, getMany: function(Y) { return [L, new kn().addKeys(Y.keys)]; }, count: q, query: q, openCursor: q }; return a(oe).forEach(function(Y) { se[Y] = function(re) { var ae = lt.subscr, ne = !!ae, fe = Yd(lt, N) && Qd(Y, re) ? re.obsSet = {} : ae; if (ne) { var ge = function(He) { return He = "idb://".concat(g, "/").concat(C, "/").concat(He), fe[He] || (fe[He] = new kn()); }, we = ge(""), Ee = ge(":dels"), ae = oe[Y](re), ne = ae[0], ae = ae[1]; if ((Y === "query" && ne.isPrimaryKey && !re.values ? Ee : ge(ne.name || "")).add(ae), !ne.isPrimaryKey) { if (Y !== "count") { var Ve = Y === "query" && W && re.values && N.query(r(r({}, re), { values: !1 })); return N[Y].apply(this, arguments).then(function(He) { if (Y === "query") { if (W && re.values) return Ve.then(function(Et) { return Et = Et.result, we.addKeys(Et), He; }); var Je = re.values ? He.result.map(z) : He.result; (re.values ? we : Ee).addKeys(Je); } else if (Y === "openCursor") { var Ke = He, tt = re.values; return Ke && Object.create(Ke, { key: { get: function() { return Ee.addKey(Ke.primaryKey), Ke.key; } }, primaryKey: { get: function() { var Et = Ke.primaryKey; return Ee.addKey(Et), Et; } }, value: { get: function() { return tt && we.addKey(Ke.primaryKey), Ke.value; } } }); } return He; }); } Ee.add(_); } } return N[Y].apply(this, arguments); }; }), se; } }); } }; function Jd(h, g, _) { if (_.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 _.numFailures === C ? null : (g = r({}, g), l(g.keys) && (g.keys = g.keys.filter(function(N, P) { return !(P in _.failures); })), "values" in g && l(g.values) && (g.values = g.values.filter(function(N, P) { return !(P in _.failures); })), g); } function ia(h, g) { return _ = h, ((C = g).lower === void 0 || (C.lowerOpen ? 0 < _t(_, C.lower) : 0 <= _t(_, C.lower))) && (h = h, (g = g).upper === void 0 || (g.upperOpen ? _t(h, g.upper) < 0 : _t(h, g.upper) <= 0)); var _, C; } function to(h, g, oe, C, N, P) { if (!oe || oe.length === 0) return h; var L = g.query.index, z = L.multiEntry, W = g.query.range, J = C.schema.primaryKey.extractKey, se = L.extractKey, q = (L.lowLevelIndex || L).extractKey, oe = oe.reduce(function(Y, re) { var ae = Y, ne = []; if (re.type === "add" || re.type === "put") for (var fe = new kn(), ge = re.values.length - 1; 0 <= ge; --ge) { var we, Ee = re.values[ge], Ve = J(Ee); fe.hasKey(Ve) || (we = se(Ee), (z && l(we) ? we.some(function(Ke) { return ia(Ke, W); }) : ia(we, W)) && (fe.addKey(Ve), ne.push(Ee))); } switch (re.type) { case "add": var Ye = new kn().addKeys(g.values ? Y.map(function(tt) { return J(tt); }) : Y), ae = Y.concat(g.values ? ne.filter(function(tt) { return tt = J(tt), !Ye.hasKey(tt) && (Ye.addKey(tt), !0); }) : ne.map(function(tt) { return J(tt); }).filter(function(tt) { return !Ye.hasKey(tt) && (Ye.addKey(tt), !0); })); break; case "put": var ze = new kn().addKeys(re.values.map(function(tt) { return J(tt); })); ae = Y.filter(function(tt) { return !ze.hasKey(g.values ? J(tt) : tt); }).concat(g.values ? ne : ne.map(function(tt) { return J(tt); })); break; case "delete": var He = new kn().addKeys(re.keys); ae = Y.filter(function(tt) { return !He.hasKey(g.values ? J(tt) : tt); }); break; case "deleteRange": var Je = re.range; ae = Y.filter(function(tt) { return !ia(J(tt), Je); }); } return ae; }, h); return oe === h ? h : (oe.sort(function(Y, re) { return _t(q(Y), q(re)) || _t(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)), P ? Object.freeze(oe) : oe); } function Xd(h, g) { return _t(h.lower, g.lower) === 0 && _t(h.upper, g.upper) === 0 && !!h.lowerOpen == !!g.lowerOpen && !!h.upperOpen == !!g.upperOpen; } function Zd(h, g) { return function(_, C, N, P) { if (_ === void 0) return C !== void 0 ? -1 : 0; if (C === void 0) return 1; if ((C = _t(_, C)) === 0) { if (N && P) return 0; if (N) return 1; if (P) return -1; } return C; }(h.lower, g.lower, h.lowerOpen, g.lowerOpen) <= 0 && 0 <= function(_, C, N, P) { if (_ === void 0) return C !== void 0 ? 1 : 0; if (C === void 0) return -1; if ((C = _t(_, C)) === 0) { if (N && P) return 0; if (N) return -1; if (P) return 1; } return C; }(h.upper, g.upper, h.upperOpen, g.upperOpen); } function ef(h, g, _, C) { h.subscribers.add(_), C.addEventListener("abort", function() { var N, P; h.subscribers.delete(_), h.subscribers.size === 0 && (N = h, P = g, setTimeout(function() { N.subscribers.size === 0 && de(P, N); }, 3e3)); }); } var tf = { stack: "dbcore", level: 0, name: "Cache", create: function(h) { var g = h.schema.name; return r(r({}, h), { transaction: function(_, C, N) { var P, L, z = h.transaction(_, C, N); return C === "readwrite" && (L = (P = new AbortController()).signal, N = function(W) { return function() { if (P.abort(), C === "readwrite") { for (var J = /* @__PURE__ */ new Set(), se = 0, q = _; se < q.length; se++) { var oe = q[se], Y = ys["idb://".concat(g, "/").concat(oe)]; if (Y) { var re = h.table(oe), ae = Y.optimisticOps.filter(function(tt) { return tt.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, we = (Ye = fe[ne]).slice(); ge < we.length; ge++) Wl((ze = we[ge]).obsSet, z.mutatedParts) && (de(Ye, ze), ze.subscribers.forEach(function(tt) { return J.add(tt); })); else if (0 < ae.length) { Y.optimisticOps = Y.optimisticOps.filter(function(tt) { return tt.trans !== z; }); for (var Ee = 0, Ve = Object.values(Y.queries.query); Ee < Ve.length; Ee++) for (var Ye, ze, He, Je = 0, Ke = (Ye = Ve[Ee]).slice(); Je < Ke.length; Je++) (ze = Ke[Je]).res != null && z.mutatedParts && (W && !ze.dirty ? (He = Object.isFrozen(ze.res), He = to(ze.res, ze.req, ae, re, ze, He), ze.dirty ? (de(Ye, ze), ze.subscribers.forEach(function(tt) { return J.add(tt); })) : He !== ze.res && (ze.res = He, ze.promise = Ze.resolve({ result: He }))) : (ze.dirty && de(Ye, ze), ze.subscribers.forEach(function(tt) { return J.add(tt); }))); } } } J.forEach(function(tt) { return tt(); }); } }; }, z.addEventListener("abort", N(!1), { signal: L }), z.addEventListener("error", N(!1), { signal: L }), z.addEventListener("complete", N(!0), { signal: L })), z; }, table: function(_) { var C = h.table(_), N = C.schema.primaryKey; return r(r({}, C), { mutate: function(P) { var L = lt.trans; if (N.outbound || L.db._options.cache === "disabled" || L.explicit || L.idbtrans.mode !== "readwrite") return C.mutate(P); var z = ys["idb://".concat(g, "/").concat(_)]; return z ? (L = C.mutate(P), P.type !== "add" && P.type !== "put" || !(50 <= P.values.length || _u(N, P).some(function(W) { return W == null; })) ? (z.optimisticOps.push(P), P.mutatedParts && yu(P.mutatedParts), L.then(function(W) { 0 < W.numFailures && (de(z.optimisticOps, P), (W = Jd(0, P, W)) && z.optimisticOps.push(W), P.mutatedParts && yu(P.mutatedParts)); }), L.catch(function() { de(z.optimisticOps, P), P.mutatedParts && yu(P.mutatedParts); })) : L.then(function(W) { var J = Jd(0, r(r({}, P), { values: P.values.map(function(se, q) { var oe; return W.failures[q] ? se : (se = (oe = N.keyPath) !== null && oe !== void 0 && oe.includes(".") ? st(se) : r({}, se), ce(se, N.keyPath, W.results[q]), se); }) }), W); z.optimisticOps.push(J), queueMicrotask(function() { return P.mutatedParts && yu(P.mutatedParts); }); }), L) : C.mutate(P); }, query: function(P) { if (!Yd(lt, C) || !Qd("query", P)) return C.query(P); var L = ((J = lt.trans) === null || J === void 0 ? void 0 : J.db._options.cache) === "immutable", q = lt, z = q.requery, W = q.signal, J = function(re, ae, ne, fe) { var ge = ys["idb://".concat(re, "/").concat(ae)]; if (!ge) return []; if (!(ae = ge.queries[ne])) return [null, !1, ge, null]; var we = ae[(fe.query ? fe.query.index.name : null) || ""]; if (!we) return [null, !1, ge, null]; switch (ne) { case "query": var Ee = we.find(function(Ve) { return Ve.req.limit === fe.limit && Ve.req.values === fe.values && Xd(Ve.req.query.range, fe.query.range); }); return Ee ? [Ee, !0, ge, we] : [we.find(function(Ve) { return ("limit" in Ve.req ? Ve.req.limit : 1 / 0) >= fe.limit && (!fe.values || Ve.req.values) && Zd(Ve.req.query.range, fe.query.range); }), !1, ge, we]; case "count": return Ee = we.find(function(Ve) { return Xd(Ve.req.query.range, fe.query.range); }), [Ee, !!Ee, ge, we]; } }(g, _, "query", P), se = J[0], q = J[1], oe = J[2], Y = J[3]; return se && q ? se.obsSet = P.obsSet : (q = C.query(P).then(function(re) { var ae = re.result; if (se && (se.res = ae), L) { for (var ne = 0, fe = ae.length; ne < fe; ++ne) Object.freeze(ae[ne]); Object.freeze(ae); } else re.result = st(ae); return re; }).catch(function(re) { return Y && se && de(Y, se), Promise.reject(re); }), se = { obsSet: P.obsSet, promise: q, subscribers: /* @__PURE__ */ new Set(), type: "query", req: P, dirty: !1 }, Y ? Y.push(se) : (Y = [se], (oe = oe || (ys["idb://".concat(g, "/").concat(_)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[P.query.index.name || ""] = Y)), ef(se, Y, z, W), se.promise.then(function(re) { return { result: to(re.result, P, oe == null ? void 0 : oe.optimisticOps, C, se, L) }; }); } }); } }); } }; function sa(h, g) { return new Proxy(h, { get: function(_, C, N) { return C === "db" ? g : Reflect.get(_, C, N); } }); } var Yr = (Xt.prototype.version = function(h) { if (isNaN(h) || h < 0.1) throw new Oe.Type("Given version is not a positive number"); if (h = Math.round(10 * h) / 10, this.idbdb || this._state.isBeingOpened) throw new Oe.Schema("Cannot add version when database is open"); this.verno = Math.max(this.verno, h); var g = this._versions, _ = g.filter(function(C) { return C._cfg.version === h; })[0]; return _ || (_ = new this.Version(h), g.push(_), g.sort(qd), _.stores({}), this._state.autoSchema = !1, _); }, Xt.prototype._whenReady = function(h) { var g = this; return this.idbdb && (this._state.openComplete || lt.letThrough || this._vip) ? h() : new Ze(function(_, C) { if (g._state.openComplete) return C(new Oe.DatabaseClosed(g._state.dbOpenError)); if (!g._state.isBeingOpened) { if (!g._state.autoOpen) return void C(new Oe.DatabaseClosed()); g.open().catch(Xe); } g._state.dbReadyPromise.then(_, C); }).then(h); }, Xt.prototype.use = function(h) { var g = h.stack, _ = 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: _, level: C ?? 10, name: N }), h.sort(function(P, L) { return P.level - L.level; }), this; }, Xt.prototype.unuse = function(h) { var g = h.stack, _ = h.name, C = h.create; return g && this._middlewares[g] && (this._middlewares[g] = this._middlewares[g].filter(function(N) { return C ? N.create !== C : !!_ && N.name !== _; })), this; }, Xt.prototype.open = function() { var h = this; return $i(Li, function() { return Zp(h); }); }, Xt.prototype._close = function() { var h = this._state, g = Vi.indexOf(this); if (0 <= g && Vi.splice(g, 1), this.idbdb) { try { this.idbdb.close(); } catch { } this.idbdb = null; } h.isBeingOpened || (h.dbReadyPromise = new Ze(function(_) { h.dbReadyResolve = _; }), h.openCanceller = new Ze(function(_, C) { h.cancelOpen = C; })); }, Xt.prototype.close = function(_) { var g = (_ === void 0 ? { disableAutoOpen: !0 } : _).disableAutoOpen, _ = this._state; g ? (_.isBeingOpened && _.cancelOpen(new Oe.DatabaseClosed()), this._close(), _.autoOpen = !1, _.dbOpenError = new Oe.DatabaseClosed()) : (this._close(), _.autoOpen = this._options.autoOpen || _.isBeingOpened, _.openComplete = !1, _.dbOpenError = null); }, Xt.prototype.delete = function(h) { var g = this; h === void 0 && (h = { disableAutoOpen: !0 }); var _ = 0 < arguments.length && typeof arguments[0] != "object", C = this._state; return new Ze(function(N, P) { function L() { g.close(h); var z = g._deps.indexedDB.deleteDatabase(g.name); z.onsuccess = Yt(function() { var W, J, se; W = g._deps, J = g.name, se = W.indexedDB, W = W.IDBKeyRange, ea(se) || J === Ho || Gl(se, W).delete(J).catch(Xe), N(); }), z.onerror = Qn(P), z.onblocked = g._fireOnBlocked; } if (_) throw new Oe.InvalidArgument("Invalid closeOptions argument to db.delete()"); C.isBeingOpened ? C.dbReadyPromise.then(L) : L(); }); }, Xt.prototype.backendDB = function() { return this.idbdb; }, Xt.prototype.isOpen = function() { return this.idbdb !== null; }, Xt.prototype.hasBeenClosed = function() { var h = this._state.dbOpenError; return h && h.name === "DatabaseClosed"; }, Xt.prototype.hasFailed = function() { return this._state.dbOpenError !== null; }, Xt.prototype.dynamicallyOpened = function() { return this._state.autoSchema; }, Object.defineProperty(Xt.prototype, "tables", { get: function() { var h = this; return a(this._allTables).map(function(g) { return h._allTables[g]; }); }, enumerable: !1, configurable: !0 }), Xt.prototype.transaction = function() { var h = (function(g, _, C) { var N = arguments.length; if (N < 2) throw new Oe.InvalidArgument("Too few arguments"); for (var P = new Array(N - 1); --N; ) P[N - 1] = arguments[N]; return C = P.pop(), [g, Z(P), C]; }).apply(this, arguments); return this._transaction.apply(this, h); }, Xt.prototype._transaction = function(h, g, _) { var C = this, N = lt.trans; N && N.db === this && h.indexOf("!") === -1 || (N = null); var P, L, z = h.indexOf("?") !== -1; h = h.replace("!", "").replace("?", ""); try { if (L = 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 === Hs) P = Hs; else { if (h != "rw" && h != Bl) throw new Oe.InvalidArgument("Invalid transaction mode: " + h); P = Bl; } if (N) { if (N.mode === Hs && P === Bl) { if (!z) throw new Oe.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY"); N = null; } N && L.forEach(function(J) { if (N && N.storeNames.indexOf(J) === -1) { if (!z) throw new Oe.SubTransaction("Table " + J + " not included in parent transaction."); N = null; } }), z && N && !N.active && (N = null); } } catch (J) { return N ? N._promise(null, function(se, q) { q(J); }) : yn(J); } var W = (function J(se, q, oe, Y, re) { return Ze.resolve().then(function() { var ae = lt.transless || lt, ne = se._createTransaction(q, oe, se._dbSchema, Y); if (ne.explicit = !0, ae = { trans: ne, transless: ae }, Y) ne.idbtrans = Y.idbtrans; else try { ne.create(), ne.idbtrans._explicit = !0, se._state.PR1398_maxLoop = 3; } catch (we) { return we.name === Re.InvalidState && se.isOpen() && 0 < --se._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), se.close({ disableAutoOpen: !1 }), se.open().then(function() { return J(se, q, oe, null, re); })) : yn(we); } var fe, ge = M(re); return ge && qs(), ae = Ze.follow(function() { var we; (fe = re.call(ne, ne)) && (ge ? (we = Wn.bind(null, null), fe.then(we, we)) : typeof fe.next == "function" && typeof fe.throw == "function" && (fe = ra(fe))); }, ae), (fe && typeof fe.then == "function" ? Ze.resolve(fe).then(function(we) { return ne.active ? we : yn(new Oe.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")); }) : ae.then(function() { return fe; })).then(function(we) { return Y && ne._resolve(), ne._completion.then(function() { return we; }); }).catch(function(we) { return ne._reject(we), yn(we); }); }); }).bind(null, this, P, L, N, _); return N ? N._promise(P, W, "lock") : lt.trans ? $i(lt.transless, function() { return C._whenReady(W); }) : this._whenReady(W); }, Xt.prototype.table = function(h) { if (!v(this._allTables, h)) throw new Oe.InvalidTable("Table ".concat(h, " does not exist")); return this._allTables[h]; }, Xt); function Xt(h, g) { var _ = this; this._middlewares = {}, this.verno = 0; var C = Xt.dependencies; this._options = g = r({ addons: Xt.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, P, L, z, W, J = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Xe, dbReadyPromise: null, cancelOpen: Xe, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: g.autoOpen }; J.dbReadyPromise = new Ze(function(q) { J.dbReadyResolve = q; }), J.openCanceller = new Ze(function(q, oe) { J.cancelOpen = oe; }), this._state = J, this.name = h, this.on = qi(this, "populate", "blocked", "versionchange", "close", { ready: [b, Xe] }), this.on.ready.subscribe = U(this.on.ready.subscribe, function(q) { return function(oe, Y) { Xt.vip(function() { var re, ae = _._state; ae.openComplete ? (ae.dbOpenError || Ze.resolve().then(oe), Y && q(oe)) : ae.onReadyBeingFired ? (ae.onReadyBeingFired.push(oe), Y && q(oe)) : (q(oe), re = _, Y || q(function ne() { re.on.ready.unsubscribe(oe), re.on.ready.unsubscribe(ne); })); }); }; }), this.Collection = (N = this, ci(Gt.prototype, function(fe, ne) { this.db = N; var Y = Ko, re = null; if (ne) try { Y = ne(); } catch (ge) { re = ge; } var ae = fe._ctx, ne = ae.table, fe = ne.hook.reading.fire; this._ctx = { table: ne, index: ae.index, isPrimKey: !ae.index || ne.schema.primKey.keyPath && ae.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: ae.or, valueMapper: fe !== Rt ? fe : null }; })), this.Table = (P = this, ci(Vd.prototype, function(q, oe, Y) { this.db = P, this._tx = Y, this.name = q, this.schema = oe, this.hook = P._allTables[q] ? P._allTables[q].hook : qi(null, { creating: [Ft, Xe], reading: [Ot, Rt], updating: [D, Xe], deleting: [Bt, Xe] }); })), this.Transaction = (L = this, ci(Wo.prototype, function(q, oe, Y, re, ae) { var ne = this; this.db = L, this.mode = q, this.storeNames = oe, this.schema = Y, this.chromeTransactionDurability = re, this.idbtrans = null, this.on = qi(this, "complete", "error", "abort"), this.parent = ae || 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 Ze(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(), yn(fe); }); })), this.Version = (z = this, ci(Kl.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 = _t, this._descending = function(re, ae) { return _t(ae, re); }, this._max = function(re, ae) { return 0 < _t(re, ae) ? re : ae; }, this._min = function(re, ae) { return _t(re, ae) < 0 ? re : ae; }, this._IDBKeyRange = W._deps.IDBKeyRange, !this._IDBKeyRange) throw new Oe.MissingAPI(); })), this.on("versionchange", function(q) { 0 < q.newVersion ? console.warn("Another connection wants to upgrade database '".concat(_.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(_.name, "'. Closing db now to resume the delete request.")), _.close({ disableAutoOpen: !1 }); }), this.on("blocked", function(q) { !q.newVersion || q.newVersion < q.oldVersion ? console.warn("Dexie.delete('".concat(_.name, "') was blocked")) : console.warn("Upgrade '".concat(_.name, "' blocked by other connection holding version ").concat(q.oldVersion / 10)); }), this._maxKey = Qo(g.IDBKeyRange), this._createTransaction = function(q, oe, Y, re) { return new _.Transaction(q, oe, Y, _._options.chromeTransactionDurability, re); }, this._fireOnBlocked = function(q) { _.on("blocked").fire(q), Vi.filter(function(oe) { return oe.name === _.name && oe !== _ && !oe._state.vcFired; }).map(function(oe) { return oe.on("versionchange").fire(q); }); }, this.use(nm), this.use(tf), this.use(rm), this.use(em), this.use(tm); var se = new Proxy(this, { get: function(q, oe, Y) { if (oe === "_vip") return !0; if (oe === "table") return function(ae) { return sa(_.table(ae), se); }; var re = Reflect.get(q, oe, Y); return re instanceof Vd ? sa(re, se) : oe === "tables" ? re.map(function(ae) { return sa(ae, se); }) : oe === "_createTransaction" ? function() { return sa(re.apply(this, arguments), se); } : re; } }); this.vip = se, C.forEach(function(q) { return q(_); }); } var Su, mr = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", im = (bu.prototype.subscribe = function(h, g, _) { return this._subscribe(h && typeof h != "function" ? h : { next: h, error: g, complete: _ }); }, bu.prototype[mr] = function() { return this; }, bu); function bu(h) { this._subscribe = h; } try { Su = { indexedDB: s.indexedDB || s.mozIndexedDB || s.webkitIndexedDB || s.msIndexedDB, IDBKeyRange: s.IDBKeyRange || s.webkitIDBKeyRange }; } catch { Su = { indexedDB: null, IDBKeyRange: null }; } function Xl(h) { var g, _ = !1, C = new im(function(N) { var P = M(h), L, z = !1, W = {}, J = {}, se = { get closed() { return z; }, unsubscribe: function() { z || (z = !0, L && L.abort(), q && mi.storagemutated.unsubscribe(Y)); } }; N.start && N.start(se); var q = !1, oe = function() { return uu(re); }, Y = function(ae) { gu(W, ae), Wl(J, W) && oe(); }, re = function() { var ae, ne, fe; !z && Su.indexedDB && (W = {}, ae = {}, L && L.abort(), L = new AbortController(), fe = function(ge) { var we = Mi(); try { P && qs(); var Ee = Bi(h, ge); return Ee = P ? Ee.finally(Wn) : Ee; } finally { we && as(); } }(ne = { subscr: ae, signal: L.signal, requery: oe, querier: h, trans: null }), Promise.resolve(fe).then(function(ge) { _ = !0, g = ge, z || ne.signal.aborted || (W = {}, function(we) { for (var Ee in we) if (v(we, Ee)) return; return 1; }(J = ae) || q || (mi(pr, Y), q = !0), uu(function() { return !z && N.next && N.next(ge); })); }, function(ge) { _ = !1, ["DatabaseClosedError", "AbortError"].includes(ge == null ? void 0 : ge.name) || z || uu(function() { z || N.error && N.error(ge); }); })); }; return setTimeout(oe, 0), se; }); return C.hasValue = function() { return _; }, C.getValue = function() { return g; }, C; } var Dr = Yr; function ws(h) { var g = Fr; try { Fr = !0, mi.storagemutated.fire(h), Ql(h, !0); } finally { Fr = g; } } y(Dr, r(r({}, ht), { delete: function(h) { return new Dr(h, { addons: [] }).delete(); }, exists: function(h) { return new Dr(h, { addons: [] }).open().then(function(g) { return g.close(), !0; }).catch("NoSuchDatabaseError", function() { return !1; }); }, getDatabaseNames: function(h) { try { return g = Dr.dependencies, _ = g.indexedDB, g = g.IDBKeyRange, (ea(_) ? Promise.resolve(_.databases()).then(function(C) { return C.map(function(N) { return N.name; }).filter(function(N) { return N !== Ho; }); }) : Gl(_, g).toCollection().primaryKeys()).then(h); } catch { return yn(new Oe.MissingAPI()); } var g, _; }, defineClass: function() { return function(h) { f(this, h); }; }, ignoreTransaction: function(h) { return lt.trans ? $i(lt.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 : Ze.resolve(g); } catch (_) { return yn(_); } }; }, spawn: function(h, g, _) { try { var C = ra(h.apply(_, g || [])); return C && typeof C.then == "function" ? C : Ze.resolve(C); } catch (N) { return yn(N); } }, currentTransaction: { get: function() { return lt.trans || null; } }, waitFor: function(h, g) { return g = Ze.resolve(typeof h == "function" ? Dr.ignoreTransaction(h) : h).timeout(g || 6e4), lt.trans ? lt.trans.waitFor(g) : g; }, Promise: Ze, debug: { get: function() { return F; }, set: function(h) { ee(h); } }, derive: A, extend: f, props: y, override: U, Events: qi, on: mi, liveQuery: Xl, extendObservabilitySet: gu, getByKeyPath: ie, setByKeyPath: ce, delByKeyPath: function(h, g) { typeof g == "string" ? ce(h, g, void 0) : "length" in g && [].map.call(g, function(_) { ce(h, _, void 0); }); }, shallowClone: H, deepClone: st, getObjectDiff: Jl, cmp: _t, asap: K, minKey: -1 / 0, addons: [], connections: Vi, errnames: Re, dependencies: Su, cache: ys, semVer: "4.0.11", version: "4.0.11".split(".").map(function(h) { return parseInt(h); }).reduce(function(h, g, _) { return h + g / Math.pow(10, 2 * _); }) })), Dr.maxKey = Qo(Dr.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (mi(pr, function(h) { Fr || (h = new CustomEvent(ql, { detail: h }), Fr = !0, dispatchEvent(h), Fr = !1); }), addEventListener(ql, function(h) { h = h.detail, Fr || ws(h); })); var no, Fr = !1, nf = function() { }; return typeof BroadcastChannel < "u" && ((nf = function() { (no = new BroadcastChannel(ql)).onmessage = function(h) { return h.data && ws(h.data); }; })(), typeof no.unref == "function" && no.unref(), mi(pr, function(h) { Fr || no.postMessage(h); })), typeof addEventListener < "u" && (addEventListener("pagehide", function(h) { if (!Yr.disableBfCache && h.persisted) { F && console.debug("Dexie: handling persisted pagehide"), no != null && no.close(); for (var g = 0, _ = Vi; g < _.length; g++) _[g].close({ disableAutoOpen: !1 }); } }), addEventListener("pageshow", function(h) { !Yr.disableBfCache && h.persisted && (F && console.debug("Dexie: handling persisted pageshow"), nf(), ws({ all: new kn(-1 / 0, [[]]) })); })), Ze.rejectionMapper = function(h, g) { return !h || h instanceof Ie || h instanceof TypeError || h instanceof SyntaxError || !h.name || !pt[h.name] ? h : (g = new pt[h.name](g || h.message, h), "stack" in h && E(g, "stack", { get: function() { return this.inner.stack; } }), g); }, ee(F), r(Yr, Object.freeze({ __proto__: null, Dexie: Yr, liveQuery: Xl, Entity: Bd, cmp: _t, PropModification: Go, replacePrefix: function(h, g) { return new Go({ replacePrefix: [h, g] }); }, add: function(h) { return new Go({ add: h }); }, remove: function(h) { return new Go({ remove: h }); }, default: Yr, RangeSet: kn, mergeRanges: na, rangesOverlap: Hd }), { default: Yr }), Yr; }); }(yh)), yh.exports; } var XO = JO(); const hy = /* @__PURE__ */ Bo(XO), LS = Symbol.for("Dexie"), Kh = globalThis[LS] || (globalThis[LS] = hy); if (hy.semVer !== Kh.semVer) throw new Error(`Two different versions of Dexie loaded in the same app: ${hy.semVer} and ${Kh.semVer}`); const { liveQuery: mz, mergeRanges: gz, rangesOverlap: vz, RangeSet: yz, cmp: wz, Entity: _z, PropModification: Sz, replacePrefix: bz, add: kz, remove: Ez } = Kh; class KA extends Kh { constructor(n, r, i = {}) { super(n); ve(this, "logs"); const s = { logs: "id, level, time, source, account" }; this.version(r).stores({ ...s, ...i }); } } class ZO extends KA { constructor() { super("nizza", 1); } } class GA { constructor(e, n) { ve(this, "logger"); ve(this, "channel"); ve(this, "listeners", /* @__PURE__ */ new Map()); ve(this, "eventQueue", /* @__PURE__ */ new Map()); 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, s] of this.listeners.entries()) this.matchWildcard(i, r) && (this.logger.debug(`Matching pattern "${i}" for event "${r}"`), s.forEach( (a) => a({ ...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 s = this.matchWildcard(e, i); return s && (this.eventQueue.delete(i), this.logger.debug(`Dequeued pending events for "${i}".`)), s; }).flatMap(([, i]) => i); for (const [i, s] of this.listeners.entries()) this.matchWildcard(i, e) && (this.logger.debug(`Adding listener to pattern "${i}"`), s.add(n), r.length && (this.logger.debug(`Delivering pending events for "${e}".`), r.forEach((a) => { n({ ...a, 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 a = new Error("Invalid arguments"); throw this.logger.error(a), a; } const i = { name: e, data: n, attrs: r }, s = Array.from(this.getMatchingListeners(e)); if (s.length) { this.logger.debug(`Delivering event "${e}" to listeners`); for (const [a, l] of s) l({ ...i, wildcard: a }); } 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, ".*"), s = new RegExp(`^${r}$`).test(n); return this.logger.debug( `Wildcard "${e}" matches with pattern "${n}": ${s}` ), s; } } var xc = { exports: {} }, Bg, US; function eP() { if (US) return Bg; US = 1; function t(n) { try { return JSON.stringify(n); } catch { return '"[Circular]"'; } } Bg = e; function e(n, r, i) { var s = i && i.stringify || t, a = 1; if (typeof n == "object" && n !== null) { var l = r.length + a; if (l === 1) return n; var f = new Array(l); f[0] = s(n); for (var d = 1; d < l; d++) f[d] = s(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 - a, k = -1, E = n && n.length || 0, A = 0; A < E; ) { if (n.charCodeAt(A) === 37 && A + 1 < E) { switch (k = k > -1 ? k : 0, n.charCodeAt(A + 1)) { case 100: // 'd' case 102: if (y >= p || r[y] == null) break; k < A && (v += n.slice(k, A)), v += Number(r[y]), k = A + 2, A++; break; case 105: if (y >= p || r[y] == null) break; k < A && (v += n.slice(k, A)), v += Math.floor(Number(r[y])), k = A + 2, A++; break; case 79: // 'O' case 111: // 'o' case 106: if (y >= p || r[y] === void 0) break; k < A && (v += n.slice(k, A)); var T = typeof r[y]; if (T === "string") { v += "'" + r[y] + "'", k = A + 2, A++; break; } if (T === "function") { v += r[y].name || "", k = A + 2, A++; break; } v += s(r[y]), k = A + 2, A++; break; case 115: if (y >= p) break; k < A && (v += n.slice(k, A)), v += String(r[y]), k = A + 2, A++; break; case 37: k < A && (v += n.slice(k, A)), v += "%", k = A + 2, A++, y--; break; } ++y; } ++A; } return k === -1 ? n : (k < E && (v += n.slice(k)), v); } return Bg; } var MS; function tP() { if (MS) return xc.exports; MS = 1; const t = eP(); xc.exports = p; const e = ft().console || {}, n = { mapHttpRequest: ce, mapHttpResponse: ce, wrapRequestSerializer: H, wrapResponseSerializer: H, wrapErrorSerializer: H, req: ce, res: ce, err: K, errWithCause: K }; function r(ue, ke) { return ue === "silent" ? 1 / 0 : ke.levels.values[ue]; } const i = Symbol("pino.logFuncs"), s = Symbol("pino.hierarchy"), a = { error: "log", fatal: "error", warn: "error", info: "log", debug: "log", trace: "log" }; function l(ue, ke) { const pe = { logger: ke, parent: ue[s] }; ke[s] = pe; } function f(ue, ke, pe) { const de = {}; ke.forEach((Ae) => { de[Ae] = pe[Ae] ? pe[Ae] : e[Ae] || e[a[Ae] || "log"] || ye; }), ue[i] = de; } function d(ue, ke) { return Array.isArray(ue) ? ue.filter(function(de) { return de !== "!stdSerializers.err"; }) : ue === !0 ? Object.keys(ke) : !1; } function p(ue) { ue = ue || {}, ue.browser = ue.browser || {}; const ke = ue.browser.transmit; if (ke && typeof ke.send != "function") throw Error("pino: transmit option must have a send function"); const pe = ue.browser.write || e; ue.browser.write && (ue.browser.asObject = !0); const de = ue.serializers || {}, Ae = d(ue.browser.serialize, de); let B = ue.browser.serialize; Array.isArray(ue.browser.serialize) && ue.browser.serialize.indexOf("!stdSerializers.err") > -1 && (B = !1); const M = Object.keys(ue.customLevels || {}), te = ["error", "fatal", "warn", "info", "debug", "trace"].concat(M); typeof pe == "function" && te.forEach(function(pt) { pe[pt] = pe; }), (ue.enabled === !1 || ue.browser.disabled) && (ue.level = "silent"); const Ie = ue.level || "info", $ = Object.create(pe); $.log || ($.log = ye), f($, te, pe), l({}, $), Object.defineProperty($, "levelVal", { get: Qe }), Object.defineProperty($, "level", { get: Re, set: We }); const Q = { transmit: ke, serialize: Ae, asObject: ue.browser.asObject, formatters: ue.browser.formatters, levels: te, timestamp: ie(ue), messageKey: ue.messageKey || "msg", onChild: ue.onChild || ye }; $.levels = v(ue), $.level = Ie, $.setMaxListeners = $.getMaxListeners = $.emit = $.addListener = $.on = $.prependListener = $.once = $.prependOnceListener = $.removeListener = $.removeAllListeners = $.listeners = $.listenerCount = $.eventNames = $.write = $.flush = ye, $.serializers = de, $._serialize = Ae, $._stdErrSerialize = B, $.child = function(...pt) { return Oe.call(this, Q, ...pt); }, ke && ($._logEvent = j()); function Qe() { return r(this.level, this); } function Re() { return this._level; } function We(pt) { if (pt !== "silent" && !this.levels.values[pt]) throw Error("unknown level " + pt); this._level = pt, E(this, Q, $, "error"), E(this, Q, $, "fatal"), E(this, Q, $, "warn"), E(this, Q, $, "info"), E(this, Q, $, "debug"), E(this, Q, $, "trace"), M.forEach((ht) => { E(this, Q, $, ht); }); } function Oe(pt, ht, Xe) { if (!ht) throw new Error("missing bindings for child Pino"); Xe = Xe || {}, Ae && ht.serializers && (Xe.serializers = ht.serializers); const Rt = Xe.serializers; if (Ae && Rt) { var Ot = Object.assign({}, de, Rt), et = ue.browser.serialize === !0 ? Object.keys(Ot) : Ae; delete ht.serializers, R([ht], et, Ot, this._stdErrSerialize); } function Ft(D) { this._childLevel = (D._childLevel | 0) + 1, this.bindings = ht, Ot && (this.serializers = Ot, this._serialize = et), ke && (this._logEvent = j( [].concat(D._logEvent.bindings, ht) )); } Ft.prototype = this; const Bt = new Ft(this); return l(this, Bt), Bt.child = function(...D) { return Oe.call(this, pt, ...D); }, Bt.level = Xe.level || this.level, pt.onChild(Bt), Bt; } return $; } function v(ue) { const ke = ue.customLevels || {}, pe = Object.assign({}, p.levels.values, ke), de = Object.assign({}, p.levels.labels, y(ke)); return { values: pe, labels: de }; } function y(ue) { const ke = {}; return Object.keys(ue).forEach(function(pe) { ke[ue[pe]] = pe; }), ke; } 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: _e, unixTime: qe, isoTime: st }); function k(ue) { const ke = []; ue.bindings && ke.push(ue.bindings); let pe = ue[s]; for (; pe.parent; ) pe = pe.parent, pe.logger.bindings && ke.push(pe.logger.bindings); return ke.reverse(); } function E(ue, ke, pe, de) { if (Object.defineProperty(ue, de, { value: r(ue.level, pe) > r(de, pe) ? ye : pe[i][de], writable: !0, enumerable: !0, configurable: !0 }), ue[de] === ye) { if (!ke.transmit) return; const B = ke.transmit.level || ue.level, M = r(B, pe); if (r(de, pe) < M) return; } ue[de] = T(ue, ke, pe, de); const Ae = k(ue); Ae.length !== 0 && (ue[de] = A(Ae, ue[de])); } function A(ue, ke) { return function() { return ke.apply(this, [...ue, ...arguments]); }; } function T(ue, ke, pe, de) { return /* @__PURE__ */ function(Ae) { return function() { const M = ke.timestamp(), te = new Array(arguments.length), Ie = Object.getPrototypeOf && Object.getPrototypeOf(this) === e ? e : this; for (var $ = 0; $ < te.length; $++) te[$] = arguments[$]; var Q = !1; if (ke.serialize && (R(te, this._serialize, this.serializers, this._stdErrSerialize), Q = !0), ke.asObject || ke.formatters ? Ae.call(Ie, O(this, de, te, M, ke)) : Ae.apply(Ie, te), ke.transmit) { const Qe = ke.transmit.level || ue._level, Re = r(Qe, pe), We = r(de, pe); if (We < Re) return; U(this, { ts: M, methodLevel: de, methodValue: We, transmitValue: pe.levels.values[ke.transmit.level || ue._level], send: ke.transmit.send, val: r(ue._level, pe) }, te, Q); } }; }(ue[i][de]); } function O(ue, ke, pe, de, Ae) { const { level: B, log: M = (Re) => Re } = Ae.formatters || {}, te = pe.slice(); let Ie = te[0]; const $ = {}; if (de && ($.time = de), B) { const Re = B(ke, ue.levels.values[ke]); Object.assign($, Re); } else $.level = ue.levels.values[ke]; let Q = (ue._childLevel | 0) + 1; if (Q < 1 && (Q = 1), Ie !== null && typeof Ie == "object") { for (; Q-- && typeof te[0] == "object"; ) Object.assign($, te.shift()); Ie = te.length ? t(te.shift(), te) : void 0; } else typeof Ie == "string" && (Ie = t(te.shift(), te)); return Ie !== void 0 && ($[Ae.messageKey] = Ie), M($); } function R(ue, ke, pe, de) { for (const Ae in ue) if (de && ue[Ae] instanceof Error) ue[Ae] = p.stdSerializers.err(ue[Ae]); else if (typeof ue[Ae] == "object" && !Array.isArray(ue[Ae]) && ke) for (const B in ue[Ae]) ke.indexOf(B) > -1 && B in pe && (ue[Ae][B] = pe[B](ue[Ae][B])); } function U(ue, ke, pe, de = !1) { const Ae = ke.send, B = ke.ts, M = ke.methodLevel, te = ke.methodValue, Ie = ke.val, $ = ue._logEvent.bindings; de || R( pe, ue._serialize || Object.keys(ue.serializers), ue.serializers, ue._stdErrSerialize === void 0 ? !0 : ue._stdErrSerialize ), ue._logEvent.ts = B, ue._logEvent.messages = pe.filter(function(Q) { return $.indexOf(Q) === -1; }), ue._logEvent.level.label = M, ue._logEvent.level.value = te, Ae(M, ue._logEvent, Ie), ue._logEvent = j($); } function j(ue) { return { ts: 0, messages: [], bindings: ue || [], level: { label: "", value: 0 } }; } function K(ue) { const ke = { type: ue.constructor.name, msg: ue.message, stack: ue.stack }; for (const pe in ue) ke[pe] === void 0 && (ke[pe] = ue[pe]); return ke; } function ie(ue) { return typeof ue.timestamp == "function" ? ue.timestamp : ue.timestamp === !1 ? Z : _e; } function ce() { return {}; } function H(ue) { return ue; } function ye() { } function Z() { return !1; } function _e() { return Date.now(); } function qe() { return Math.round(Date.now() / 1e3); } function st() { return new Date(Date.now()).toISOString(); } function ft() { function ue(ke) { return typeof ke < "u" && ke; } 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 ue(self) || ue(window) || ue(this) || {}; } } return xc.exports.default = p, xc.exports.pino = p, xc.exports; } var nP = tP(); const rP = /* @__PURE__ */ Bo(nP), zn = []; for (let t = 0; t < 256; ++t) zn.push((t + 256).toString(16).slice(1)); function iP(t, e = 0) { return (zn[t[e + 0]] + zn[t[e + 1]] + zn[t[e + 2]] + zn[t[e + 3]] + "-" + zn[t[e + 4]] + zn[t[e + 5]] + "-" + zn[t[e + 6]] + zn[t[e + 7]] + "-" + zn[t[e + 8]] + zn[t[e + 9]] + "-" + zn[t[e + 10]] + zn[t[e + 11]] + zn[t[e + 12]] + zn[t[e + 13]] + zn[t[e + 14]] + zn[t[e + 15]]).toLowerCase(); } let jg; const sP = new Uint8Array(16); function oP() { if (!jg) { if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); jg = crypto.getRandomValues.bind(crypto); } return jg(sP); } const aP = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), BS = { randomUUID: aP }; function WA(t, e, n) { var i; if (BS.randomUUID && !t) return BS.randomUUID(); t = t || {}; const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? oP(); 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, iP(r); } const uP = 4; var YA = /* @__PURE__ */ ((t) => (t.CREATED = "CREATED", t.STARTING = "STARTING", t.LIVE = "LIVE", t.FINALIZED = "FINALIZED", t))(YA || {}); const lP = { 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:**" }, QA = { EVENT_STATUS_CHANGED: "event:statusChanged", /** AddToCartHook events */ ATCH_ACTION_EXECUTED: "core:addToCartHooks:actionExecuted" }; var JA = /* @__PURE__ */ ((t) => (t.English = "en", t.Spanish = "es", t.Portuguese = "pt", t))(JA || {}), 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 }, XA = { [on.trace]: "trace", [on.debug]: "debug", [on.info]: "info", [on.warn]: "warn", [on.error]: "error", [on.fatal]: "fatal" /* FATAL */ }; var ZA = /* @__PURE__ */ ((t) => (t.COMBO = "Combo", t.BADGE = "Badged", t))(ZA || {}), Va = /* @__PURE__ */ ((t) => (t.VTEX = "VTEX", t.PLATFORM = "platform", t.GLOBAL_PAGE = "globalPage", t.CUSTOMIZATION = "customization", t.FAST_STORE = "faststore", t.UNKNOWN = "unknown", t))(Va || {}); function eC(t) { return Object.values(Sn).includes( String(t).toLowerCase() ); } class Ew extends Error { /** * Creates a new instance of InvalidLogLevelError. * @param level - The invalid log level. */ constructor(e) { super(`Invalid log level: ${e}`), this.name = "InvalidLogLevelError"; } } const rr = class rr { /** * Creates a new instance of PinoAdapter. * @param config - The adapter configuration. */ constructor(e) { ve(this, "instance"); ve(this, "httpLogger"); ve(this, "consoleLogger"); ve(this, "config"); this.config = e; const { source: n, levelService: r, metadata: i = {}, consoleLogger: s, httpLogger: a } = e; rr.root ?? (rr.root = rr.createRootLogger( s, a )), rr.mergeGlobalMetadata(i), this.instance = rr.root.child({ source: n }), this.consoleLogger = s, this.httpLogger = a, 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 rP({ customLevels: on, browser: { write: (r) => { const { payload: i, options: s, stack: a, ...l } = r, f = { ...l, ...i }; s.silent || e.print(f, a), f.level >= on[Sn.WARN] && n.save(f); } } }); } /** * Merges new metadata into the global metadata. * @param metadata - The metadata to merge. */ static mergeGlobalMetadata(e = {}) { rr.globalMetadata = { ...rr.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 rr.mergeGlobalMetadata(n), new rr({ 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) { rr.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: s, args: a = [] } = n, l = WA(), f = {}; let d; return s instanceof Error ? (f.error = { name: s.name, message: s.message, stack: s.stack }, d = s.message) : d = typeof s == "object" ? JSON.stringify(s) : String(s), a.forEach((v, y) => this.formatArg(v, y, f)), { payload: { id: l, msg: d, data: f, ...rr.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 Ew(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; } }; // Global metadata shared across all instances. ve(rr, "globalMetadata", {}), ve(rr, "root", null); let py = rr; const jS = { 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 cP = class { constructor() { ve(this, "theme"); 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) => !jS.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 = jS.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 }, s) { const [a, l, f] = n.split(":"), d = (XA[e] || "UNKNOWN").toUpperCase(), p = f ? `${f}: ` : "", v = l ? `:${l}` : "", y = this.getStyles(e); console.groupCollapsed( `%c${this.getTime()} %c${d} %c[${a}${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(s || new Error().stack); k.length && console.log("Stack:", k.join(` `)), console.groupEnd(); } }; const dP = { endpoint: "/v1/telemetry/logs", batchSize: 500, flushInterval: 10, maxRetries: 5, retryBackoffFactor: 2, maxPayloadSize: 500 }; class Aw { constructor(e) { ve(this, "config"); ve(this, "isFlushing", !1); ve(this, "retryCount", 0); ve(this, "isFlushScheduled", !1); this.config = e, this.setupUnloadListener(); } static create(e) { const n = { ...dP, ...e }; if (!n.db) throw new Error("Invalid Dixie DB"); if (!n.project) throw new Error("Project name is required"); return new Aw(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((s) => { const a = JSON.stringify(s).length / 1024; r + a > this.config.maxPayloadSize && (i.push(n), n = [], r = 0), n.push(s), r += a; }), n.length > 0 && i.push(n), i; } async sendLogs(e) { await Cn.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 $g = {}, Vg, $S; function xp() { if ($S) return Vg; $S = 1; const t = "\\\\/", e = `[^${t}]`, n = "\\.", r = "\\+", i = "\\?", s = "\\/", a = "(?=.)", l = "[^/]", f = `(?:${s}|$)`, d = `(?:^|${s})`, p = `${n}{1,2}${f}`, v = `(?!${n})`, y = `(?!${d}${p})`, k = `(?!${n}{0,1}${f})`, E = `(?!${p})`, A = `[^.${s}]`, T = `${l}*?`, R = { DOT_LITERAL: n, PLUS_LITERAL: r, QMARK_LITERAL: i, SLASH_LITERAL: s, ONE_CHAR: a, QMARK: l, END_ANCHOR: f, DOTS_SLASH: p, NO_DOT: v, NO_DOTS: y, NO_DOT_SLASH: k, NO_DOTS_SLASH: E, QMARK_NO_DOT: A, STAR: T, START_ANCHOR: d, SEP: "/" }, U = { ...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 Vg = { 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 ? U : R; } }, Vg; } var VS; function Np() { return VS || (VS = 1, function(t) { const { REGEX_BACKSLASH: e, REGEX_REMOVE_BACKSLASH: n, REGEX_SPECIAL_CHARS: r, REGEX_SPECIAL_CHARS_GLOBAL: i } = /* @__PURE__ */ xp(); t.isObject = (s) => s !== null && typeof s == "object" && !Array.isArray(s), t.hasRegexChars = (s) => r.test(s), t.isRegexChar = (s) => s.length === 1 && t.hasRegexChars(s), t.escapeRegex = (s) => s.replace(i, "\\$1"), t.toPosixSlashes = (s) => s.replace(e, "/"), t.isWindows = () => { if (typeof navigator < "u" && navigator.platform) { const s = navigator.platform.toLowerCase(); return s === "win32" || s === "windows"; } return typeof process < "u" && process.platform ? process.platform === "win32" : !1; }, t.removeBackslashes = (s) => s.replace(n, (a) => a === "\\" ? "" : a), t.escapeLast = (s, a, l) => { const f = s.lastIndexOf(a, l); return f === -1 ? s : s[f - 1] === "\\" ? t.escapeLast(s, a, f - 1) : `${s.slice(0, f)}\\${s.slice(f)}`; }, t.removePrefix = (s, a = {}) => { let l = s; return l.startsWith("./") && (l = l.slice(2), a.prefix = "./"), l; }, t.wrapOutput = (s, a = {}, l = {}) => { const f = l.contains ? "" : "^", d = l.contains ? "" : "$"; let p = `${f}(?:${s})${d}`; return a.negated === !0 && (p = `(?:^(?!${p}).*$)`), p; }, t.basename = (s, { windows: a } = {}) => { const l = s.split(a ? /[\\/]/ : "/"), f = l[l.length - 1]; return f === "" ? l[l.length - 2] : f; }; }($g)), $g; } var zg, zS; function fP() { if (zS) return zg; zS = 1; const t = /* @__PURE__ */ Np(), { CHAR_ASTERISK: e, /* * */ CHAR_AT: n, /* @ */ CHAR_BACKWARD_SLASH: r, /* \ */ CHAR_COMMA: i, /* , */ CHAR_DOT: s, /* . */ CHAR_EXCLAMATION_MARK: a, /* ! */ 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: E, /* ) */ CHAR_RIGHT_SQUARE_BRACKET: A /* ] */ } = /* @__PURE__ */ xp(), T = (U) => U === l || U === r, O = (U) => { U.isPrefix !== !0 && (U.depth = U.isGlobstar ? 1 / 0 : 1); }; return zg = (U, j) => { const K = j || {}, ie = U.length - 1, ce = K.parts === !0 || K.scanToEnd === !0, H = [], ye = [], Z = []; let _e = U, qe = -1, st = 0, ft = 0, ue = !1, ke = !1, pe = !1, de = !1, Ae = !1, B = !1, M = !1, te = !1, Ie = !1, $ = !1, Q = 0, Qe, Re, We = { value: "", depth: 0, isGlob: !1 }; const Oe = () => qe >= ie, pt = () => _e.charCodeAt(qe + 1), ht = () => (Qe = Re, _e.charCodeAt(++qe)); for (; qe < ie; ) { Re = ht(); let Ft; if (Re === r) { M = We.backslashes = !0, Re = ht(), Re === f && (B = !0); continue; } if (B === !0 || Re === f) { for (Q++; Oe() !== !0 && (Re = ht()); ) { if (Re === r) { M = We.backslashes = !0, ht(); continue; } if (Re === f) { Q++; continue; } if (B !== !0 && Re === s && (Re = ht()) === s) { if (ue = We.isBrace = !0, pe = We.isGlob = !0, $ = !0, ce === !0) continue; break; } if (B !== !0 && Re === i) { if (ue = We.isBrace = !0, pe = We.isGlob = !0, $ = !0, ce === !0) continue; break; } if (Re === k && (Q--, Q === 0)) { B = !1, ue = We.isBrace = !0, $ = !0; break; } } if (ce === !0) continue; break; } if (Re === l) { if (H.push(qe), ye.push(We), We = { value: "", depth: 0, isGlob: !1 }, $ === !0) continue; if (Qe === s && qe === st + 1) { st += 2; continue; } ft = qe + 1; continue; } if (K.noext !== !0 && (Re === v || Re === n || Re === e || Re === y || Re === a) === !0 && pt() === d) { if (pe = We.isGlob = !0, de = We.isExtglob = !0, $ = !0, Re === a && qe === st && (Ie = !0), ce === !0) { for (; Oe() !== !0 && (Re = ht()); ) { if (Re === r) { M = We.backslashes = !0, Re = ht(); continue; } if (Re === E) { pe = We.isGlob = !0, $ = !0; break; } } continue; } break; } if (Re === e) { if (Qe === e && (Ae = We.isGlobstar = !0), pe = We.isGlob = !0, $ = !0, ce === !0) continue; break; } if (Re === y) { if (pe = We.isGlob = !0, $ = !0, ce === !0) continue; break; } if (Re === p) { for (; Oe() !== !0 && (Ft = ht()); ) { if (Ft === r) { M = We.backslashes = !0, ht(); continue; } if (Ft === A) { ke = We.isBracket = !0, pe = We.isGlob = !0, $ = !0; break; } } if (ce === !0) continue; break; } if (K.nonegate !== !0 && Re === a && qe === st) { te = We.negated = !0, st++; continue; } if (K.noparen !== !0 && Re === d) { if (pe = We.isGlob = !0, ce === !0) { for (; Oe() !== !0 && (Re = ht()); ) { if (Re === d) { M = We.backslashes = !0, Re = ht(); continue; } if (Re === E) { $ = !0; break; } } continue; } break; } if (pe === !0) { if ($ = !0, ce === !0) continue; break; } } K.noext === !0 && (de = !1, pe = !1); let Xe = _e, Rt = "", Ot = ""; st > 0 && (Rt = _e.slice(0, st), _e = _e.slice(st), ft -= st), Xe && pe === !0 && ft > 0 ? (Xe = _e.slice(0, ft), Ot = _e.slice(ft)) : pe === !0 ? (Xe = "", Ot = _e) : Xe = _e, Xe && Xe !== "" && Xe !== "/" && Xe !== _e && T(Xe.charCodeAt(Xe.length - 1)) && (Xe = Xe.slice(0, -1)), K.unescape === !0 && (Ot && (Ot = t.removeBackslashes(Ot)), Xe && M === !0 && (Xe = t.removeBackslashes(Xe))); const et = { prefix: Rt, input: U, start: st, base: Xe, glob: Ot, isBrace: ue, isBracket: ke, isGlob: pe, isExtglob: de, isGlobstar: Ae, negated: te, negatedExtglob: Ie }; if (K.tokens === !0 && (et.maxDepth = 0, T(Re) || ye.push(We), et.tokens = ye), K.parts === !0 || K.tokens === !0) { let Ft; for (let Bt = 0; Bt < H.length; Bt++) { const D = Ft ? Ft + 1 : st, x = H[Bt], b = U.slice(D, x); K.tokens && (Bt === 0 && st !== 0 ? (ye[Bt].isPrefix = !0, ye[Bt].value = Rt) : ye[Bt].value = b, O(ye[Bt]), et.maxDepth += ye[Bt].depth), (Bt !== 0 || b !== "") && Z.push(b), Ft = x; } if (Ft && Ft + 1 < U.length) { const Bt = U.slice(Ft + 1); Z.push(Bt), K.tokens && (ye[ye.length - 1].value = Bt, O(ye[ye.length - 1]), et.maxDepth += ye[ye.length - 1].depth); } et.slashes = H, et.parts = Z; } return et; }, zg; } var qg, qS; function hP() { if (qS) return qg; qS = 1; const t = /* @__PURE__ */ xp(), e = /* @__PURE__ */ Np(), { MAX_LENGTH: n, POSIX_REGEX_SOURCE: r, REGEX_NON_SPECIAL_CHARS: i, REGEX_SPECIAL_CHARS_BACKREF: s, REPLACEMENTS: a } = 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((E) => e.escapeRegex(E)).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 = a[p] || p; const y = { ...v }, k = typeof y.maxLength == "number" ? Math.min(n, y.maxLength) : n; let E = p.length; if (E > k) throw new SyntaxError(`Input length: ${E}, exceeds maximum allowed length: ${k}`); const A = { type: "bos", value: "", output: y.prepend || "" }, T = [A], O = y.capture ? "" : "?:", R = t.globChars(y.windows), U = t.extglobChars(R), { DOT_LITERAL: j, PLUS_LITERAL: K, SLASH_LITERAL: ie, ONE_CHAR: ce, DOTS_SLASH: H, NO_DOT: ye, NO_DOT_SLASH: Z, NO_DOTS_SLASH: _e, QMARK: qe, QMARK_NO_DOT: st, STAR: ft, START_ANCHOR: ue } = R, ke = (D) => `(${O}(?:(?!${ue}${D.dot ? H : j}).)*?)`, pe = y.dot ? "" : ye, de = y.dot ? qe : st; let Ae = y.bash === !0 ? ke(y) : ft; y.capture && (Ae = `(${Ae})`), 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), E = p.length; const M = [], te = [], Ie = []; let $ = A, Q; const Qe = () => B.index === E - 1, Re = B.peek = (D = 1) => p[B.index + D], We = B.advance = () => p[++B.index] || "", Oe = () => p.slice(B.index + 1), pt = (D = "", x = 0) => { B.consumed += D, B.index += x; }, ht = (D) => { B.output += D.output != null ? D.output : D.value, pt(D.value); }, Xe = () => { let D = 1; for (; Re() === "!" && (Re(2) !== "(" || Re(3) === "?"); ) We(), B.start++, D++; return D % 2 === 0 ? !1 : (B.negated = !0, B.start++, !0); }, Rt = (D) => { B[D]++, Ie.push(D); }, Ot = (D) => { B[D]--, Ie.pop(); }, et = (D) => { if ($.type === "globstar") { const x = B.braces > 0 && (D.type === "comma" || D.type === "brace"), b = D.extglob === !0 || M.length && (D.type === "pipe" || D.type === "paren"); D.type !== "slash" && D.type !== "paren" && !x && !b && (B.output = B.output.slice(0, -$.output.length), $.type = "star", $.value = "*", $.output = Ae, B.output += $.output); } if (M.length && D.type !== "paren" && (M[M.length - 1].inner += D.value), (D.value || D.output) && ht(D), $ && $.type === "text" && D.type === "text") { $.output = ($.output || $.value) + D.value, $.value += D.value; return; } D.prev = $, T.push(D), $ = D; }, Ft = (D, x) => { const b = { ...U[x], conditions: 1, inner: "" }; b.prev = $, b.parens = B.parens, b.output = B.output; const F = (y.capture ? "(" : "") + b.open; Rt("parens"), et({ type: D, value: x, output: B.output ? "" : ce }), et({ type: "paren", extglob: !0, value: We(), output: F }), M.push(b); }, Bt = (D) => { let x = D.close + (y.capture ? ")" : ""), b; if (D.type === "negate") { let F = Ae; if (D.inner && D.inner.length > 1 && D.inner.includes("/") && (F = ke(y)), (F !== Ae || Qe() || /^\)+$/.test(Oe())) && (x = D.close = `)$))${F}`), D.inner.includes("*") && (b = Oe()) && /^\.[^\\/.]+$/.test(b)) { const ee = d(b, { ...v, fastpaths: !1 }).output; x = D.close = `)${ee})${F})`; } D.prev.type === "bos" && (B.negatedExtglob = !0); } et({ type: "paren", extglob: !0, value: Q, output: x }), Ot("parens"); }; if (y.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(p)) { let D = !1, x = p.replace(s, (b, F, ee, be, Ce, bt) => be === "\\" ? (D = !0, b) : be === "?" ? F ? F + be + (Ce ? qe.repeat(Ce.length) : "") : bt === 0 ? de + (Ce ? qe.repeat(Ce.length) : "") : qe.repeat(ee.length) : be === "." ? j.repeat(ee.length) : be === "*" ? F ? F + be + (Ce ? Ae : "") : Ae : F ? b : `\\${b}`); return D === !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 (; !Qe(); ) { if (Q = We(), Q === "\0") continue; if (Q === "\\") { const b = Re(); if (b === "/" && y.bash !== !0 || b === "." || b === ";") continue; if (!b) { Q += "\\", et({ type: "text", value: Q }); continue; } const F = /^\\+/.exec(Oe()); let ee = 0; if (F && F[0].length > 2 && (ee = F[0].length, B.index += ee, ee % 2 !== 0 && (Q += "\\")), y.unescape === !0 ? Q = We() : Q += We(), B.brackets === 0) { et({ 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), be = $.value.slice(F + 2), Ce = r[be]; if (Ce) { $.value = ee + Ce, B.backtrack = !0, We(), !A.output && T.indexOf($) === 1 && (A.output = ce); continue; } } } (Q === "[" && Re() !== ":" || Q === "-" && Re() === "]") && (Q = `\\${Q}`), Q === "]" && ($.value === "[" || $.value === "[^") && (Q = `\\${Q}`), y.posix === !0 && Q === "!" && $.value === "[" && (Q = "^"), $.value += Q, ht({ value: Q }); continue; } if (B.quotes === 1 && Q !== '"') { Q = e.escapeRegex(Q), $.value += Q, ht({ value: Q }); continue; } if (Q === '"') { B.quotes = B.quotes === 1 ? 0 : 1, y.keepQuotes === !0 && et({ type: "text", value: Q }); continue; } if (Q === "(") { Rt("parens"), et({ 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) { Bt(M.pop()); continue; } et({ type: "paren", value: Q, output: B.parens ? ")" : "\\)" }), Ot("parens"); continue; } if (Q === "[") { if (y.nobracket === !0 || !Oe().includes("]")) { if (y.nobracket !== !0 && y.strictBrackets === !0) throw new SyntaxError(f("closing", "]")); Q = `\\${Q}`; } else Rt("brackets"); et({ type: "bracket", value: Q }); continue; } if (Q === "]") { if (y.nobracket === !0 || $ && $.type === "bracket" && $.value.length === 1) { et({ type: "text", value: Q, output: `\\${Q}` }); continue; } if (B.brackets === 0) { if (y.strictBrackets === !0) throw new SyntaxError(f("opening", "[")); et({ type: "text", value: Q, output: `\\${Q}` }); continue; } Ot("brackets"); const b = $.value.slice(1); if ($.posix !== !0 && b[0] === "^" && !b.includes("/") && (Q = `/${Q}`), $.value += Q, ht({ 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 = `(${O}${F}|${$.value})`, B.output += $.value; continue; } if (Q === "{" && y.nobrace !== !0) { Rt("braces"); const b = { type: "brace", value: Q, output: "(", outputIndex: B.output.length, tokensIndex: B.tokens.length }; te.push(b), et(b); continue; } if (Q === "}") { const b = te[te.length - 1]; if (y.nobrace === !0 || !b) { et({ type: "text", value: Q, output: Q }); continue; } let F = ")"; if (b.dots === !0) { const ee = T.slice(), be = []; for (let Ce = ee.length - 1; Ce >= 0 && (T.pop(), ee[Ce].type !== "brace"); Ce--) ee[Ce].type !== "dots" && be.unshift(ee[Ce].value); F = l(be, y), B.backtrack = !0; } if (b.comma !== !0 && b.dots !== !0) { const ee = B.output.slice(0, b.outputIndex), be = B.tokens.slice(b.tokensIndex); b.value = b.output = "\\{", Q = F = "\\}", B.output = ee; for (const Ce of be) B.output += Ce.output || Ce.value; } et({ type: "brace", value: Q, output: F }), Ot("braces"), te.pop(); continue; } if (Q === "|") { M.length > 0 && M[M.length - 1].conditions++, et({ type: "text", value: Q }); continue; } if (Q === ",") { let b = Q; const F = te[te.length - 1]; F && Ie[Ie.length - 1] === "braces" && (F.comma = !0, b = "|"), et({ 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(), $ = A; continue; } et({ type: "slash", value: Q, output: ie }); 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") { et({ type: "text", value: Q, output: j }); continue; } et({ type: "dot", value: Q, output: j }); continue; } if (Q === "?") { if (!($ && $.value === "(") && y.noextglob !== !0 && Re() === "(" && Re(2) !== "?") { Ft("qmark", Q); continue; } if ($ && $.type === "paren") { const F = Re(); let ee = Q; ($.value === "(" && !/[!=<:]/.test(F) || F === "<" && !/<([!=]|\w+>)/.test(Oe())) && (ee = `\\${Q}`), et({ type: "text", value: Q, output: ee }); continue; } if (y.dot !== !0 && ($.type === "slash" || $.type === "bos")) { et({ type: "qmark", value: Q, output: st }); continue; } et({ type: "qmark", value: Q, output: qe }); continue; } if (Q === "!") { if (y.noextglob !== !0 && Re() === "(" && (Re(2) !== "?" || !/[!=<:]/.test(Re(3)))) { Ft("negate", Q); continue; } if (y.nonegate !== !0 && B.index === 0) { Xe(); continue; } } if (Q === "+") { if (y.noextglob !== !0 && Re() === "(" && Re(2) !== "?") { Ft("plus", Q); continue; } if ($ && $.value === "(" || y.regex === !1) { et({ type: "plus", value: Q, output: K }); continue; } if ($ && ($.type === "bracket" || $.type === "paren" || $.type === "brace") || B.parens > 0) { et({ type: "plus", value: Q }); continue; } et({ type: "plus", value: K }); continue; } if (Q === "@") { if (y.noextglob !== !0 && Re() === "(" && Re(2) !== "?") { et({ type: "at", extglob: !0, value: Q, output: "" }); continue; } et({ type: "text", value: Q }); continue; } if (Q !== "*") { (Q === "$" || Q === "^") && (Q = `\\${Q}`); const b = i.exec(Oe()); b && (Q += b[0], B.index += b[0].length), et({ type: "text", value: Q }); continue; } if ($ && ($.type === "globstar" || $.star === !0)) { $.type = "star", $.star = !0, $.value += Q, $.output = Ae, B.backtrack = !0, B.globstar = !0, pt(Q); continue; } let D = Oe(); if (y.noextglob !== !0 && /^\([^?]/.test(D)) { Ft("star", Q); continue; } if ($.type === "star") { if (y.noglobstar === !0) { pt(Q); continue; } const b = $.prev, F = b.prev, ee = b.type === "slash" || b.type === "bos", be = F && (F.type === "star" || F.type === "globstar"); if (y.bash === !0 && (!ee || D[0] && D[0] !== "/")) { et({ type: "star", value: Q, output: "" }); continue; } const Ce = B.braces > 0 && (b.type === "comma" || b.type === "brace"), bt = M.length && (b.type === "pipe" || b.type === "paren"); if (!ee && b.type !== "paren" && !Ce && !bt) { et({ type: "star", value: Q, output: "" }); continue; } for (; D.slice(0, 3) === "/**"; ) { const Ct = p[B.index + 4]; if (Ct && Ct !== "/") break; D = D.slice(3), pt("/**", 3); } if (b.type === "bos" && Qe()) { $.type = "globstar", $.value += Q, $.output = ke(y), B.output = $.output, B.globstar = !0, pt(Q); continue; } if (b.type === "slash" && b.prev.type !== "bos" && !be && Qe()) { B.output = B.output.slice(0, -(b.output + $.output).length), b.output = `(?:${b.output}`, $.type = "globstar", $.output = ke(y) + (y.strictSlashes ? ")" : "|$)"), $.value += Q, B.globstar = !0, B.output += b.output + $.output, pt(Q); continue; } if (b.type === "slash" && b.prev.type !== "bos" && D[0] === "/") { const Ct = D[1] !== void 0 ? "|$" : ""; B.output = B.output.slice(0, -(b.output + $.output).length), b.output = `(?:${b.output}`, $.type = "globstar", $.output = `${ke(y)}${ie}|${ie}${Ct})`, $.value += Q, B.output += b.output + $.output, B.globstar = !0, pt(Q + We()), et({ type: "slash", value: "/", output: "" }); continue; } if (b.type === "bos" && D[0] === "/") { $.type = "globstar", $.value += Q, $.output = `(?:^|${ie}|${ke(y)}${ie})`, B.output = $.output, B.globstar = !0, pt(Q + We()), et({ type: "slash", value: "/", output: "" }); continue; } B.output = B.output.slice(0, -$.output.length), $.type = "globstar", $.output = ke(y), $.value += Q, B.output += $.output, B.globstar = !0, pt(Q); continue; } const x = { type: "star", value: Q, output: Ae }; if (y.bash === !0) { x.output = ".*?", ($.type === "bos" || $.type === "slash") && (x.output = pe + x.output), et(x); continue; } if ($ && ($.type === "bracket" || $.type === "paren") && y.regex === !0) { x.output = Q, et(x); continue; } (B.index === B.start || $.type === "slash" || $.type === "dot") && ($.type === "dot" ? (B.output += Z, $.output += Z) : y.dot === !0 ? (B.output += _e, $.output += _e) : (B.output += pe, $.output += pe), Re() !== "*" && (B.output += ce, $.output += ce)), et(x); } for (; B.brackets > 0; ) { if (y.strictBrackets === !0) throw new SyntaxError(f("closing", "]")); B.output = e.escapeLast(B.output, "["), Ot("brackets"); } for (; B.parens > 0; ) { if (y.strictBrackets === !0) throw new SyntaxError(f("closing", ")")); B.output = e.escapeLast(B.output, "("), Ot("parens"); } for (; B.braces > 0; ) { if (y.strictBrackets === !0) throw new SyntaxError(f("closing", "}")); B.output = e.escapeLast(B.output, "{"), Ot("braces"); } if (y.strictSlashes !== !0 && ($.type === "star" || $.type === "bracket") && et({ type: "maybe_slash", value: "", output: `${ie}?` }), B.backtrack === !0) { B.output = ""; for (const D of B.tokens) B.output += D.output != null ? D.output : D.value, D.suffix && (B.output += D.suffix); } return B; }; return d.fastpaths = (p, v) => { const y = { ...v }, k = typeof y.maxLength == "number" ? Math.min(n, y.maxLength) : n, E = p.length; if (E > k) throw new SyntaxError(`Input length: ${E}, exceeds maximum allowed length: ${k}`); p = a[p] || p; const { DOT_LITERAL: A, SLASH_LITERAL: T, ONE_CHAR: O, DOTS_SLASH: R, NO_DOT: U, NO_DOTS: j, NO_DOTS_SLASH: K, STAR: ie, START_ANCHOR: ce } = t.globChars(y.windows), H = y.dot ? j : U, ye = y.dot ? K : U, Z = y.capture ? "" : "?:", _e = { negated: !1, prefix: "" }; let qe = y.bash === !0 ? ".*?" : ie; y.capture && (qe = `(${qe})`); const st = (pe) => pe.noglobstar === !0 ? qe : `(${Z}(?:(?!${ce}${pe.dot ? R : A}).)*?)`, ft = (pe) => { switch (pe) { case "*": return `${H}${O}${qe}`; case ".*": return `${A}${O}${qe}`; case "*.*": return `${H}${qe}${A}${O}${qe}`; case "*/*": return `${H}${qe}${T}${O}${ye}${qe}`; case "**": return H + st(y); case "**/*": return `(?:${H}${st(y)}${T})?${ye}${O}${qe}`; case "**/*.*": return `(?:${H}${st(y)}${T})?${ye}${qe}${A}${O}${qe}`; case "**/.*": return `(?:${H}${st(y)}${T})?${A}${O}${qe}`; default: { const de = /^(.*?)\.(\w+)$/.exec(pe); if (!de) return; const Ae = ft(de[1]); return Ae ? Ae + A + de[2] : void 0; } } }, ue = e.removePrefix(p, _e); let ke = ft(ue); return ke && y.strictSlashes !== !0 && (ke += `${T}?`), ke; }, qg = d, qg; } var Hg, HS; function pP() { if (HS) return Hg; HS = 1; const t = /* @__PURE__ */ fP(), e = /* @__PURE__ */ hP(), n = /* @__PURE__ */ Np(), r = /* @__PURE__ */ xp(), i = (a) => a && typeof a == "object" && !Array.isArray(a), s = (a, l, f = !1) => { if (Array.isArray(a)) { const T = a.map((R) => s(R, l, f)); return (R) => { for (const U of T) { const j = U(R); if (j) return j; } return !1; }; } const d = i(a) && a.tokens && a.input; if (a === "" || typeof a != "string" && !d) throw new TypeError("Expected pattern to be a non-empty string"); const p = l || {}, v = p.windows, y = d ? s.compileRe(a, l) : s.makeRe(a, l, !1, !0), k = y.state; delete y.state; let E = () => !1; if (p.ignore) { const T = { ...l, ignore: null, onMatch: null, onResult: null }; E = s(p.ignore, T, f); } const A = (T, O = !1) => { const { isMatch: R, match: U, output: j } = s.test(T, y, l, { glob: a, posix: v }), K = { glob: a, state: k, regex: y, posix: v, input: T, output: j, match: U, isMatch: R }; return typeof p.onResult == "function" && p.onResult(K), R === !1 ? (K.isMatch = !1, O ? K : !1) : E(T) ? (typeof p.onIgnore == "function" && p.onIgnore(K), K.isMatch = !1, O ? K : !1) : (typeof p.onMatch == "function" && p.onMatch(K), O ? K : !0); }; return f && (A.state = k), A; }; return s.test = (a, l, f, { glob: d, posix: p } = {}) => { if (typeof a != "string") throw new TypeError("Expected input to be a string"); if (a === "") return { isMatch: !1, output: "" }; const v = f || {}, y = v.format || (p ? n.toPosixSlashes : null); let k = a === d, E = k && y ? y(a) : a; return k === !1 && (E = y ? y(a) : a, k = E === d), (k === !1 || v.capture === !0) && (v.matchBase === !0 || v.basename === !0 ? k = s.matchBase(a, l, f, p) : k = l.exec(E)), { isMatch: !!k, match: k, output: E }; }, s.matchBase = (a, l, f) => (l instanceof RegExp ? l : s.makeRe(l, f)).test(n.basename(a)), s.isMatch = (a, l, f) => s(l, f)(a), s.parse = (a, l) => Array.isArray(a) ? a.map((f) => s.parse(f, l)) : e(a, { ...l, fastpaths: !1 }), s.scan = (a, l) => t(a, l), s.compileRe = (a, l, f = !1, d = !1) => { if (f === !0) return a.output; const p = l || {}, v = p.contains ? "" : "^", y = p.contains ? "" : "$"; let k = `${v}(?:${a.output})${y}`; a && a.negated === !0 && (k = `^(?!${k}).*$`); const E = s.toRegex(k, l); return d === !0 && (E.state = a), E; }, s.makeRe = (a, l = {}, f = !1, d = !1) => { if (!a || typeof a != "string") throw new TypeError("Expected a non-empty string"); let p = { negated: !1, fastpaths: !0 }; return l.fastpaths !== !1 && (a[0] === "." || a[0] === "*") && (p.output = e.fastpaths(a, l)), p.output || (p = e(a, l)), s.compileRe(p, l, f, d); }, s.toRegex = (a, l) => { try { const f = l || {}; return new RegExp(a, f.flags || (f.nocase ? "i" : "")); } catch (f) { if (l && l.debug === !0) throw f; return /$^/; } }, s.constants = r, Hg = s, Hg; } var Kg, KS; function mP() { if (KS) return Kg; KS = 1; const t = /* @__PURE__ */ pP(), e = /* @__PURE__ */ Np(); function n(r, i, s = !1) { return i && (i.windows === null || i.windows === void 0) && (i = { ...i, windows: e.isWindows() }), t(r, i, s); } return Object.assign(n, t), Kg = n, Kg; } var gP = /* @__PURE__ */ mP(); const GS = /* @__PURE__ */ Bo(gP), WS = "loglevel-patterns", Zf = "loglevel:", Gg = "!", vP = Sn.INFO; class yP { /** * Initializes the service with a specific project name. * @param project - The project for which log levels are managed. */ constructor(e) { ve(this, "projectPrefix"); ve(this, "patternsCache", null); this.projectPrefix = `${Zf}${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) || vP; } /** * 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), s = `${Zf}${e}`, a = i ? `${r}${Gg}` : r; localStorage.setItem(s, a), 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: s, override: a }] of Object.entries(n)) if (GS(i.toLowerCase())(e.toLowerCase())) { if (a) return s; (!r || GS(i)(e)) && (r = s); } return r; } /** * Reads patterns from loglevel-patterns in localStorage. * @returns The parsed patterns map. */ readPatternsFromJSON() { try { const e = localStorage.getItem(WS); 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(Zf) || i === WS) continue; const s = i.replace(Zf, "").toLowerCase(), a = localStorage.getItem(i); if (!a) continue; const { level: l, override: f } = this.parseLogLevel(a); n[s] = { 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(Gg), r = n ? e.slice(0, -Gg.length) : e; if (!eC(r)) throw new Ew(r); return { level: r, override: n }; } } class wP { constructor(e, n) { ve(this, "committed", !1); ve(this, "chainOptions", {}); ve(this, "method", null); ve(this, "stack", ""); ve(this, "args", []); this.adapter = e, n && (this.chainOptions = { ...n }), Promise.resolve().then(() => this.commit()); } 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 tC = class my { /** * Private constructor to enforce instantiation through `Logger.create()`. * * @param {LoggerAdapter} adapter - The logging adapter implementation. */ constructor(e) { ve(this, "adapter"); 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 my(e); return n.setMetadata({ account: null, client: aC() }), 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 my(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, s, a) => (r || (r = this.child(e, n)), Reflect.get(r, s, a)) }); } /** * 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 (!eC(e)) throw new Ew(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 wP(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 Cw(t) { return ir().baseLogger.lazyChild(t); } function nC(t, e) { return tC.create( new py({ source: t, levelService: new yP(t), consoleLogger: new cP(), httpLogger: Aw.create({ db: e, project: t }) }) ); } const _P = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"; let SP = (t = 21) => { let e = "", n = crypto.getRandomValues(new Uint8Array(t)); for (; t--; ) e += _P[n[t] & 63]; return e; }; const Uo = (t = 8) => SP(t), gy = (t, e = !1) => { const n = Object.entries(t).reduce((r, [i, s]) => s !== void 0 && (!e || s !== null) ? `${r}${r ? "&" : ""}${i}=${s}` : r, ""); return n ? `?${n}` : ""; }, rC = (t) => { const e = document.getElementById(t); return e ? new URL(e.src).searchParams : new URLSearchParams(); }; function bP() { const t = new Error().stack.split(` `); return t.length < 3 ? "" : t[2].trim().substring(3); } function iC(t) { return new Promise((e) => setTimeout(e, t)); } const Ai = class Ai { constructor() { ve(this, "projectName", "nizza"); ve(this, "instanceId", Uo()); ve(this, "db", new ZO()); ve(this, "baseLogger", nC(this.projectName, this.db)); ve(this, "coreLogger", this.baseLogger.child("core")); ve(this, "logger", this.coreLogger.child("NizzaStore")); ve(this, "eventBus", new GA( this.projectName, this.coreLogger )); ve(this, "cfg", null); ve(this, "accountData"); ve(this, "statusInternal", "idle"); ve(this, "currentFetchId", null); ve(this, "pds"); xO( this, { projectName: !1, instanceId: !1, db: !1, logger: !1, coreLogger: !1, eventBus: !1 }, { autoBind: !0 } ), ww( () => { var e, n; return [(e = this.cfg) == null ? void 0 : e.account, (n = this.cfg) == null ? void 0 : n.authToken]; }, ([e, n]) => { e && this.loadAccount(e, !!n); }, { delay: 500, equals: Ga.shallow } ); } /** * Returns the singleton instance. */ static instance() { var n; const e = window; return (n = e.nizza) != null && n.store ? Ai.instanceRef = e.nizza.store : (Ai.instanceRef = new Ai(), Ai.instanceRef.logger.debug("Created NizzaStore")), e.nizza = e.nizza || {}, e.nz = e.nz || e.nizza, e.nizza.store = Ai.instanceRef, e.nz = e.nizza, Ai.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 = Uo(); this.currentFetchId = r, this.logger.setMetadata({ account: e }); try { const i = await Qx(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 Kw ? 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() { var e; (e = this.cfg) != null && e.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 Ai.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() { var e; return (e = this.cfg) == null ? void 0 : e.account; } /** @returns True if using private account */ isPvtAccount(e) { var n; return !!(e && ((n = this.cfg) != null && n.authToken)); } /** @returns True if using public account */ isPubAccount(e) { var n; return !!(e && !((n = this.cfg) != null && n.authToken)); } /** @returns Product data source */ get productDataSource() { return this.pds; } }; ve(Ai, "version", "11"), ve(Ai, "instanceRef"); let Gh = Ai; const ir = (t) => { const e = Gh.instance(); return LA( () => !!e.account, () => t == null ? void 0 : t(e) ), e; }; function xw() { return vt.useMemo(() => ir(), []); } function sC(t, e) { const n = xw(); return HA(() => t(n), e); } const { coreLogger: kP } = ir(), EP = kP.child("getClientTimeZone"); function oC(t = !1) { var s, a; let e = null, n = null, r = null; try { e = ((a = (s = Intl.DateTimeFormat()) == null ? void 0 : s.resolvedOptions()) == null ? void 0 : a.timeZone) ?? null; const l = -(/* @__PURE__ */ new Date()).getTimezoneOffset(); r = l; const f = l >= 0 ? "+" : "-", d = String( Math.floor(Math.abs(l) / 60) ).padStart(2, "0"), p = String(Math.abs(l) % 60).padStart( 2, "0" ); n = `${f}${d}:${p}`; } catch (l) { EP.error("Error obtaining time zone or offset", l); } const i = { offset: n, offsetValue: r, value: e, country: null, included: null, label: null }; if (t) { const { country: l, included: f, label: d, ...p } = i; return p; } return i; } function aC() { const e = typeof navigator < "u" ? navigator.userAgent : "server", n = AP(e), { language: r, languages: i } = CP(), s = xP(), a = NP(), { hardwareConcurrency: l, deviceMemory: f } = TP(), d = IP(); return { userAgent: e, browser: n.browser, os: n.os, device: n.device, language: r, languages: i, screen: s, connection: a, hardwareConcurrency: l, deviceMemory: f, timezone: d }; } function AP(t) { try { const n = new Ls(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 CP() { return typeof navigator < "u" ? { language: navigator.language || "Unknown", languages: navigator.languages ? [...navigator.languages] : [] } : { language: "Unknown", languages: [] }; } function xP() { return typeof window < "u" && window.screen ? { width: window.screen.width, height: window.screen.height, colorDepth: window.screen.colorDepth } : null; } function NP() { if (typeof navigator < "u" && "connection" in navigator) { const t = navigator.connection; return { downlink: (t == null ? void 0 : t.downlink) ?? 0, effectiveType: (t == null ? void 0 : t.effectiveType) ?? "Unknown", rtt: (t == null ? void 0 : t.rtt) ?? 0, saveData: (t == null ? void 0 : t.saveData) ?? !1 }; } return null; } function TP() { return typeof navigator < "u" ? { hardwareConcurrency: navigator.hardwareConcurrency || null, deviceMemory: navigator.deviceMemory || null } : { hardwareConcurrency: null, deviceMemory: null }; } function IP() { try { return oC(!0); } catch (t) { return console.error("Error retrieving client timezone:", t), { offset: null, offsetValue: null, value: "Unknown", country: null, included: null, label: null }; } } var RP = "Logging", OP = 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."); }, PP = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, qu = function() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(PP(arguments[e])); return t; }, YS = { 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 Di = ( /** @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 = [], s = 1; s < arguments.length; s++) i[s - 1] = arguments[s]; var a = this.level; t.LOG_LEVEL && (a = t.LOG_LEVEL), typeof window < "u" && window.LOG_LEVEL && (a = window.LOG_LEVEL); var l = YS[a], f = YS[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 = OP(this._pluggables), E = k.next(); !E.done; E = k.next()) { var A = E.value, T = { message: v, timestamp: Date.now() }; A.pushLogs([T]); } } catch (O) { n = { error: O }; } finally { try { E && !E.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() === RP && (this._pluggables.push(e), e.configure(this._config)); }, t.prototype.listPluggables = function() { return this._pluggables; }, t.LOG_LEVEL = null, t; }() ), DP = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, Wg = new Di("Amplify"), FP = ( /** @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 = Di, this.ServiceWorker = null; } return t.prototype.register = function(e) { Wg.debug("component registered in amplify", e), this._components.push(e), typeof e.getModuleName == "function" ? (this._modules[e.getModuleName()] = e, this[e.getModuleName()] = e) : Wg.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), Wg.debug("amplify config", this._config), Object.entries(this._modules).forEach(function(r) { var i = DP(r, 2); i[0]; var s = i[1]; Object.keys(s).forEach(function(a) { n._modules[a] && (s[a] = n._modules[a]); }); }), 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; }() ), Nw = new FP(), LP = "4.7.14", vy = "aws-amplify/" + LP, Na = { userAgent: vy + " 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 = vy + " react-native", Na.isReactNative = !0; break; default: Na.userAgent = vy + " js", Na.isReactNative = !1; break; } var UP = function(t) { return "" + Na.userAgent; }, ed = function() { return ed = 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; }, ed.apply(this, arguments); }, uC = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, QS = function() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(uC(arguments[e])); return t; }, Ns = new Di("Hub"), MP = typeof Symbol < "u" && typeof Symbol.for == "function" ? Symbol.for("amplify_default") : "@@amplify_default"; function BP(t) { return t.onHubCapsule !== void 0; } var jP = ( /** @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(s) { var a = s.pattern; return a.source === e.source; }); if (!r) { Ns.warn("No listeners for " + e); return; } this.patterns = QS(this.patterns.filter(function(s) { return s !== r; })); } else { var i = this.listeners[e]; if (!i) { Ns.warn("No listeners for " + e); return; } this.listeners[e] = QS(i.filter(function(s) { var a = s.callback; return a !== n; })); } }, t.prototype.dispatch = function(e, n, r, i) { if (r === void 0 && (r = ""), this.protectedChannels.indexOf(e) > -1) { var s = i === MP; s || Ns.warn("WARNING: " + e + " is protected and dispatching on it can have unintended consequences"); } var a = { channel: e, payload: ed({}, n), source: r, patternInfo: [] }; try { this._toListeners(a); } catch (l) { Ns.error(l); } }, t.prototype.listen = function(e, n, r) { var i = this; r === void 0 && (r = "noname"); var s; if (BP(n)) Ns.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."), s = n.onHubCapsule.bind(n); else { if (typeof n != "function") throw new Error("No callback supplied to Hub"); s = n; } if (e instanceof RegExp) this.patterns.push({ pattern: e, callback: s }); else { var a = this.listeners[e]; a || (a = [], this.listeners[e] = a), a.push({ name: r, callback: s }); } return function() { i.remove(e, s); }; }, t.prototype._toListeners = function(e) { var n = e.channel, r = e.payload, i = this.listeners[n]; if (i && i.forEach(function(a) { Ns.debug("Dispatching to " + n + " with ", r); try { a.callback(e); } catch (l) { Ns.error(l); } }), this.patterns.length > 0) { if (!r.message) { Ns.warn("Cannot perform pattern matching without a message key"); return; } var s = r.message; this.patterns.forEach(function(a) { var l = s.match(a.pattern); if (l) { var f = uC(l), d = f.slice(1), p = ed(ed({}, e), { patternInfo: d }); try { a.callback(p); } catch (v) { Ns.error(v); } } }); } }, t; }() ), So = new jP("__default__"), $P = function(t) { if (t.isResolved) return t; var e = !0, n = !1, r = !1, i = t.then(function(s) { return r = !0, e = !1, s; }, function(s) { throw n = !0, e = !1, s; }); return i.isFullfilled = function() { return r; }, i.isPending = function() { return e; }, i.isRejected = function() { return n; }, i; }, Bs = 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 yy = function(t, e) { return yy = 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]); }, yy(t, e); }; function Tw(t, e) { yy(t, e); function n() { this.constructor = t; } t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n()); } var It = function() { return It = Object.assign || function(e) { for (var n, r = 1, i = arguments.length; r < i; r++) { n = arguments[r]; for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]); } return e; }, It.apply(this, arguments); }; function Iw(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 VP(t, e, n, r) { var i = arguments.length, s = i < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, n) : r, a; if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(t, e, n, r); else for (var l = t.length - 1; l >= 0; l--) (a = t[l]) && (s = (i < 3 ? a(s) : i > 3 ? a(e, n, s) : a(e, n)) || s); return i > 3 && s && Object.defineProperty(e, n, s), s; } function zP(t, e) { return function(n, r) { e(n, r, t); }; } function qP(t, e) { if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(t, e); } function an(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(p) { try { d(r.next(p)); } catch (v) { a(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { a(v); } } function d(p) { p.done ? s(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); } function nn(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; 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 && (s = d[0] & 2 ? i.return : d[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, d[1])).done) return s; switch (i = 0, s && (d = [d[0] & 2, s.value]), d[0]) { case 0: case 1: s = 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 (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!s || d[1] > s[0] && d[1] < s[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < s[1]) { n.label = s[1], s = d; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(d); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = s = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } } function HP(t, e, n, r) { r === void 0 && (r = n), t[r] = e[n]; } function KP(t, e) { for (var n in t) n !== "default" && !e.hasOwnProperty(n) && (e[n] = t[n]); } function Rr(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, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; } function is() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(Cl(arguments[e])); return t; } function GP() { 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 s = arguments[e], a = 0, l = s.length; a < l; a++, i++) r[i] = s[a]; return r; } function md(t) { return this instanceof md ? (this.v = t, this) : new md(t); } function WP(t, e, n) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var r = n.apply(t, e || []), i, s = []; return i = {}, a("next"), a("throw"), a("return"), i[Symbol.asyncIterator] = function() { return this; }, i; function a(y) { r[y] && (i[y] = function(k) { return new Promise(function(E, A) { s.push([y, k, E, A]) > 1 || l(y, k); }); }); } function l(y, k) { try { f(r[y](k)); } catch (E) { v(s[0][3], E); } } function f(y) { y.value instanceof md ? Promise.resolve(y.value.v).then(d, p) : v(s[0][2], y); } function d(y) { l("next", y); } function p(y) { l("throw", y); } function v(y, k) { y(k), s.shift(), s.length && l(s[0][0], s[0][1]); } } function YP(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, s) { e[i] = t[i] ? function(a) { return (n = !n) ? { value: md(t[i](a)), done: i === "return" } : s ? s(a) : a; } : s; } } function QP(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 Rr == "function" ? Rr(t) : t[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() { return this; }, n); function r(s) { n[s] = t[s] && function(a) { return new Promise(function(l, f) { a = t[s](a), i(l, f, a.done, a.value); }); }; } function i(s, a, l, f) { Promise.resolve(f).then(function(d) { s({ value: d, done: l }); }, a); } } function JP(t, e) { return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t; } function XP(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 ZP(t) { return t && t.__esModule ? t : { default: t }; } function eD(t, e) { if (!e.has(t)) throw new TypeError("attempted to get private field on non-instance"); return e.get(t); } function tD(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 nD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, get __assign() { return It; }, __asyncDelegator: YP, __asyncGenerator: WP, __asyncValues: QP, __await: md, __awaiter: an, __classPrivateFieldGet: eD, __classPrivateFieldSet: tD, __createBinding: HP, __decorate: VP, __exportStar: KP, __extends: Tw, __generator: nn, __importDefault: ZP, __importStar: XP, __makeTemplateObject: JP, __metadata: qP, __param: zP, __read: Cl, __rest: Iw, __spread: is, __spreadArrays: GP, __values: Rr }, Symbol.toStringTag, { value: "Module" })), xl = /* @__PURE__ */ wl(nD); var lC = {}; for (var eh = 0; eh < 256; eh++) { var th = eh.toString(16).toLowerCase(); th.length === 1 && (th = "0" + th), lC[eh] = th; } function il(t) { for (var e = "", n = 0; n < t.byteLength; n++) e += lC[t[n]]; return e; } var ba = {}, Wc = { exports: {} }; /*! https://mths.be/punycode v1.3.2 by @mathias */ var rD = Wc.exports, JS; function iD() { return JS || (JS = 1, function(t, e) { (function(n) { var r = e && !e.nodeType && e, i = t && !t.nodeType && t, s = typeof Oo == "object" && Oo; (s.global === s || s.window === s || s.self === s) && (n = s); var a, l = 2147483647, f = 36, d = 1, p = 26, v = 38, y = 700, k = 72, E = 128, A = "-", T = /^xn--/, O = /[^\x20-\x7E]/, R = /[\x2E\u3002\uFF0E\uFF61]/g, U = { 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, ie = String.fromCharCode, ce; function H(B) { throw RangeError(U[B]); } function ye(B, M) { for (var te = B.length, Ie = []; te--; ) Ie[te] = M(B[te]); return Ie; } function Z(B, M) { var te = B.split("@"), Ie = ""; te.length > 1 && (Ie = te[0] + "@", B = te[1]), B = B.replace(R, "."); var $ = B.split("."), Q = ye($, M).join("."); return Ie + Q; } function _e(B) { for (var M = [], te = 0, Ie = B.length, $, Q; te < Ie; ) $ = B.charCodeAt(te++), $ >= 55296 && $ <= 56319 && te < Ie ? (Q = B.charCodeAt(te++), (Q & 64512) == 56320 ? M.push((($ & 1023) << 10) + (Q & 1023) + 65536) : (M.push($), te--)) : M.push($); return M; } function qe(B) { return ye(B, function(M) { var te = ""; return M > 65535 && (M -= 65536, te += ie(M >>> 10 & 1023 | 55296), M = 56320 | M & 1023), te += ie(M), te; }).join(""); } function st(B) { return B - 48 < 10 ? B - 22 : B - 65 < 26 ? B - 65 : B - 97 < 26 ? B - 97 : f; } function ft(B, M) { return B + 22 + 75 * (B < 26) - ((M != 0) << 5); } function ue(B, M, te) { var Ie = 0; for (B = te ? K(B / y) : B >> 1, B += K(B / M); B > j * p >> 1; Ie += f) B = K(B / j); return K(Ie + (j + 1) * B / (B + v)); } function ke(B) { var M = [], te = B.length, Ie, $ = 0, Q = E, Qe = k, Re, We, Oe, pt, ht, Xe, Rt, Ot, et; for (Re = B.lastIndexOf(A), Re < 0 && (Re = 0), We = 0; We < Re; ++We) B.charCodeAt(We) >= 128 && H("not-basic"), M.push(B.charCodeAt(We)); for (Oe = Re > 0 ? Re + 1 : 0; Oe < te; ) { for (pt = $, ht = 1, Xe = f; Oe >= te && H("invalid-input"), Rt = st(B.charCodeAt(Oe++)), (Rt >= f || Rt > K((l - $) / ht)) && H("overflow"), $ += Rt * ht, Ot = Xe <= Qe ? d : Xe >= Qe + p ? p : Xe - Qe, !(Rt < Ot); Xe += f) et = f - Ot, ht > K(l / et) && H("overflow"), ht *= et; Ie = M.length + 1, Qe = ue($ - pt, Ie, pt == 0), K($ / Ie) > l - Q && H("overflow"), Q += K($ / Ie), $ %= Ie, M.splice($++, 0, Q); } return qe(M); } function pe(B) { var M, te, Ie, $, Q, Qe, Re, We, Oe, pt, ht, Xe = [], Rt, Ot, et, Ft; for (B = _e(B), Rt = B.length, M = E, te = 0, Q = k, Qe = 0; Qe < Rt; ++Qe) ht = B[Qe], ht < 128 && Xe.push(ie(ht)); for (Ie = $ = Xe.length, $ && Xe.push(A); Ie < Rt; ) { for (Re = l, Qe = 0; Qe < Rt; ++Qe) ht = B[Qe], ht >= M && ht < Re && (Re = ht); for (Ot = Ie + 1, Re - M > K((l - te) / Ot) && H("overflow"), te += (Re - M) * Ot, M = Re, Qe = 0; Qe < Rt; ++Qe) if (ht = B[Qe], ht < M && ++te > l && H("overflow"), ht == M) { for (We = te, Oe = f; pt = Oe <= Q ? d : Oe >= Q + p ? p : Oe - Q, !(We < pt); Oe += f) Ft = We - pt, et = f - pt, Xe.push( ie(ft(pt + Ft % et, 0)) ), We = K(Ft / et); Xe.push(ie(ft(We, 0))), Q = ue(te, Ot, Ie == $), te = 0, ++Ie; } ++te, ++M; } return Xe.join(""); } function de(B) { return Z(B, function(M) { return T.test(M) ? ke(M.slice(4).toLowerCase()) : M; }); } function Ae(B) { return Z(B, function(M) { return O.test(M) ? "xn--" + pe(M) : M; }); } if (a = { /** * 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: _e, encode: qe }, decode: ke, encode: pe, toASCII: Ae, toUnicode: de }, r && i) if (t.exports == r) i.exports = a; else for (ce in a) a.hasOwnProperty(ce) && (r[ce] = a[ce]); else n.punycode = a; })(rD); }(Wc, Wc.exports)), Wc.exports; } var Hu = {}, Yg, XS; function sD() { if (XS) return Yg; XS = 1; function t(e, n) { return Object.prototype.hasOwnProperty.call(e, n); } return Yg = function(e, n, r, i) { n = n || "&", r = r || "="; var s = {}; if (typeof e != "string" || e.length === 0) return s; var a = /\+/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(a, "%20"), v = p.indexOf(r), y, k, E, A; v >= 0 ? (y = p.substr(0, v), k = p.substr(v + 1)) : (y = p, k = ""), E = decodeURIComponent(y), A = decodeURIComponent(k), t(s, E) ? Array.isArray(s[E]) ? s[E].push(A) : s[E] = [s[E], A] : s[E] = A; } return s; }, Yg; } var Qg, ZS; function oD() { if (ZS) return Qg; ZS = 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 Qg = function(e, n, r, i) { return n = n || "&", r = r || "=", e === null && (e = void 0), typeof e == "object" ? Object.keys(e).map(function(s) { var a = encodeURIComponent(t(s)) + r; return Array.isArray(e[s]) ? e[s].map(function(l) { return a + encodeURIComponent(t(l)); }).join(n) : a + encodeURIComponent(t(e[s])); }).join(n) : i ? encodeURIComponent(t(i)) + r + encodeURIComponent(t(e)) : ""; }, Qg; } var eb; function aD() { return eb || (eb = 1, Hu.decode = Hu.parse = sD(), Hu.encode = Hu.stringify = oD()), Hu; } var tb; function uD() { if (tb) return ba; tb = 1; var t = iD(); ba.parse = T, ba.resolve = R, ba.resolveObject = U, ba.format = O, 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", ` `, " "], s = ["{", "}", "|", "\\", "^", "`"].concat(i), a = ["'"].concat(s), l = ["%", "/", "?", ";", "#"].concat(a), 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 }, E = { http: !0, https: !0, ftp: !0, gopher: !0, file: !0, "http:": !0, "https:": !0, "ftp:": !0, "gopher:": !0, "file:": !0 }, A = aD(); function T(H, ye, Z) { if (H && K(H) && H instanceof e) return H; var _e = new e(); return _e.parse(H, ye, Z), _e; } e.prototype.parse = function(H, ye, Z) { if (!j(H)) throw new TypeError("Parameter 'url' must be a string, not " + typeof H); var _e = H; _e = _e.trim(); var qe = n.exec(_e); if (qe) { qe = qe[0]; var st = qe.toLowerCase(); this.protocol = st, _e = _e.substr(qe.length); } if (Z || qe || _e.match(/^\/\/[^@\/]+@[^@\/]+/)) { var ft = _e.substr(0, 2) === "//"; ft && !(qe && k[qe]) && (_e = _e.substr(2), this.slashes = !0); } if (!k[qe] && (ft || qe && !E[qe])) { for (var ue = -1, ke = 0; ke < f.length; ke++) { var pe = _e.indexOf(f[ke]); pe !== -1 && (ue === -1 || pe < ue) && (ue = pe); } var de, Ae; ue === -1 ? Ae = _e.lastIndexOf("@") : Ae = _e.lastIndexOf("@", ue), Ae !== -1 && (de = _e.slice(0, Ae), _e = _e.slice(Ae + 1), this.auth = decodeURIComponent(de)), ue = -1; for (var ke = 0; ke < l.length; ke++) { var pe = _e.indexOf(l[ke]); pe !== -1 && (ue === -1 || pe < ue) && (ue = pe); } ue === -1 && (ue = _e.length), this.host = _e.slice(0, ue), _e = _e.slice(ue), 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(/\./), ke = 0, te = M.length; ke < te; ke++) { var Ie = M[ke]; if (Ie && !Ie.match(p)) { for (var $ = "", Q = 0, Qe = Ie.length; Q < Qe; Q++) Ie.charCodeAt(Q) > 127 ? $ += "x" : $ += Ie[Q]; if (!$.match(p)) { var Re = M.slice(0, ke), We = M.slice(ke + 1), Oe = Ie.match(v); Oe && (Re.push(Oe[1]), We.unshift(Oe[2])), We.length && (_e = "/" + We.join(".") + _e), this.hostname = Re.join("."); break; } } } if (this.hostname.length > d ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), !B) { for (var pt = this.hostname.split("."), ht = [], ke = 0; ke < pt.length; ++ke) { var Xe = pt[ke]; ht.push(Xe.match(/[^A-Za-z0-9_-]/) ? "xn--" + t.encode(Xe) : Xe); } this.hostname = ht.join("."); } var Rt = this.port ? ":" + this.port : "", Ot = this.hostname || ""; this.host = Ot + Rt, this.href += this.host, B && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), _e[0] !== "/" && (_e = "/" + _e)); } if (!y[st]) for (var ke = 0, te = a.length; ke < te; ke++) { var et = a[ke], Ft = encodeURIComponent(et); Ft === et && (Ft = escape(et)), _e = _e.split(et).join(Ft); } var Bt = _e.indexOf("#"); Bt !== -1 && (this.hash = _e.substr(Bt), _e = _e.slice(0, Bt)); var D = _e.indexOf("?"); if (D !== -1 ? (this.search = _e.substr(D), this.query = _e.substr(D + 1), ye && (this.query = A.parse(this.query)), _e = _e.slice(0, D)) : ye && (this.search = "", this.query = {}), _e && (this.pathname = _e), E[st] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) { var Rt = this.pathname || "", Xe = this.search || ""; this.path = Rt + Xe; } return this.href = this.format(), this; }; function O(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 ye = this.protocol || "", Z = this.pathname || "", _e = this.hash || "", qe = !1, st = ""; this.host ? qe = H + this.host : this.hostname && (qe = H + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]"), this.port && (qe += ":" + this.port)), this.query && K(this.query) && Object.keys(this.query).length && (st = A.stringify(this.query)); var ft = this.search || st && "?" + st || ""; return ye && ye.substr(-1) !== ":" && (ye += ":"), this.slashes || (!ye || E[ye]) && qe !== !1 ? (qe = "//" + (qe || ""), Z && Z.charAt(0) !== "/" && (Z = "/" + Z)) : qe || (qe = ""), _e && _e.charAt(0) !== "#" && (_e = "#" + _e), ft && ft.charAt(0) !== "?" && (ft = "?" + ft), Z = Z.replace(/[?#]/g, function(ue) { return encodeURIComponent(ue); }), ft = ft.replace("#", "%23"), ye + qe + Z + ft + _e; }; function R(H, ye) { return T(H, !1, !0).resolve(ye); } e.prototype.resolve = function(H) { return this.resolveObject(T(H, !1, !0)).format(); }; function U(H, ye) { return H ? T(H, !1, !0).resolveObject(ye) : ye; } e.prototype.resolveObject = function(H) { if (j(H)) { var ye = new e(); ye.parse(H, !1, !0), H = ye; } var Z = new e(); if (Object.keys(this).forEach(function(Qe) { Z[Qe] = this[Qe]; }, this), Z.hash = H.hash, H.href === "") return Z.href = Z.format(), Z; if (H.slashes && !H.protocol) return Object.keys(H).forEach(function(Qe) { Qe !== "protocol" && (Z[Qe] = H[Qe]); }), E[Z.protocol] && Z.hostname && !Z.pathname && (Z.path = Z.pathname = "/"), Z.href = Z.format(), Z; if (H.protocol && H.protocol !== Z.protocol) { if (!E[H.protocol]) return Object.keys(H).forEach(function(Qe) { Z[Qe] = H[Qe]; }), Z.href = Z.format(), Z; if (Z.protocol = H.protocol, !H.host && !k[H.protocol]) { for (var de = (H.pathname || "").split("/"); de.length && !(H.host = de.shift()); ) ; H.host || (H.host = ""), H.hostname || (H.hostname = ""), de[0] !== "" && de.unshift(""), de.length < 2 && de.unshift(""), Z.pathname = de.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 _e = Z.pathname || "", qe = Z.search || ""; Z.path = _e + qe; } return Z.slashes = Z.slashes || H.slashes, Z.href = Z.format(), Z; } var st = Z.pathname && Z.pathname.charAt(0) === "/", ft = H.host || H.pathname && H.pathname.charAt(0) === "/", ue = ft || st || Z.host && H.pathname, ke = ue, pe = Z.pathname && Z.pathname.split("/") || [], de = H.pathname && H.pathname.split("/") || [], Ae = Z.protocol && !E[Z.protocol]; if (Ae && (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 && (de[0] === "" ? de[0] = H.host : de.unshift(H.host)), H.host = null), ue = ue && (de[0] === "" || pe[0] === "")), ft) 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 = de; else if (de.length) pe || (pe = []), pe.pop(), pe = pe.concat(de), Z.search = H.search, Z.query = H.query; else if (!ce(H.search)) { if (Ae) { 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, (!ie(Z.pathname) || !ie(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 === "", Ie = 0, $ = pe.length; $ >= 0; $--) M = pe[$], M == "." ? pe.splice($, 1) : M === ".." ? (pe.splice($, 1), Ie++) : Ie && (pe.splice($, 1), Ie--); if (!ue && !ke) for (; Ie--; Ie) pe.unshift(".."); ue && 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 (Ae) { 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 ue = ue || Z.host && pe.length, ue && !Q && pe.unshift(""), pe.length ? Z.pathname = pe.join("/") : (Z.pathname = null, Z.path = null), (!ie(Z.pathname) || !ie(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, ye = r.exec(H); ye && (ye = ye[0], ye !== ":" && (this.port = ye.substr(1)), H = H.substr(0, H.length - ye.length)), H && (this.hostname = H); }; function j(H) { return typeof H == "string"; } function K(H) { return typeof H == "object" && H !== null; } function ie(H) { return H === null; } function ce(H) { return H == null; } return ba; } var bo = uD(), lD = /* @__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 s in i) i.hasOwnProperty(s) && (r[s] = i[s]); }, 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()); }; }(), nb = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(p) { try { d(r.next(p)); } catch (v) { a(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { a(v); } } function d(p) { p.done ? s(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, Jg = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; 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 && (s = d[0] & 2 ? i.return : d[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, d[1])).done) return s; switch (i = 0, s && (d = [d[0] & 2, s.value]), d[0]) { case 0: case 1: s = 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 (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!s || d[1] > s[0] && d[1] < s[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < s[1]) { n.label = s[1], s = d; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(d); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = s = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, cD = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, dD = function() { for (var t = [], e = 0; e < arguments.length; e++) t = t.concat(cD(arguments[e])); return t; }, nh = new Di("Util"), Fa = ( /** @class */ function(t) { lD(e, t); function e(n) { var r = t.call(this, n) || this; return r.nonRetryable = !0, r; } return e; }(Error) ), fD = function(t) { var e = "nonRetryable"; return t && t[e]; }; function hD(t, e, n, r) { return nb(this, void 0, void 0, function() { var i = this; return Jg(this, function(s) { if (typeof t != "function") throw Error("functionToRetry must be a function"); return [2, new Promise(function(a, l) { return nb(i, void 0, void 0, function() { var f, d, p, v, y, k; return Jg(this, function(E) { switch (E.label) { case 0: f = 0, d = !1, p = function() { }, y = function() { var A, T, O, R; return Jg(this, function(U) { switch (U.label) { case 0: f++, nh.debug(t.name + " attempt #" + f + " with this vars: " + JSON.stringify(e)), U.label = 1; case 1: return U.trys.push([1, 3, , 7]), A = {}, T = a, [4, t.apply(void 0, dD(e))]; case 2: return [2, (A.value = T.apply(void 0, [U.sent()]), A)]; case 3: return O = U.sent(), v = O, nh.debug("error on " + t.name, O), fD(O) ? (nh.debug(t.name + " non retryable error", O), [2, { value: l(O) }]) : (R = n(f, e, O), nh.debug(t.name + " retrying in " + R + " ms"), R === !1 || d ? [2, { value: l(O) }] : [3, 4]); case 4: return [4, new Promise(function(j) { p = j, setTimeout(p, R); })]; case 5: U.sent(), U.label = 6; case 6: return [3, 7]; case 7: return [ 2 /*return*/ ]; } }); }, E.label = 1; case 1: return d ? [3, 3] : [5, y()]; case 2: return k = E.sent(), typeof k == "object" ? [2, k.value] : [3, 1]; case 3: return l(v), [ 2 /*return*/ ]; } }); }); })]; }); }); } function pD(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 mD = function(t, e, n, r) { return hD(t, e, pD(n)); }; function gD(t) { return t.split("").map(function(e) { return e.charCodeAt(0).toString(16).padStart(2, "0"); }).join(""); } function vD(t) { return t.match(/.{2}/g).map(function(e) { return String.fromCharCode(parseInt(e, 16)); }).join(""); } var Wh = function() { return Wh = 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; }, Wh.apply(this, arguments); }, yD = new Di("Parser"), wD = 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 = Wh(Wh({}, 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), yD.debug("parse config", t, "to amplifyconfig", e), e; }, _D = ( /** @class */ function() { function t() { } return t.parseMobilehubConfig = wD, t; }() ), wy = function(t, e) { return wy = 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]); }, wy(t, e); }; function Rw(t, e) { if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); wy(t, e); function n() { this.constructor = t; } t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n()); } var xe = function() { return xe = Object.assign || function(e) { for (var n, r = 1, i = arguments.length; r < i; r++) { n = arguments[r]; for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]); } return e; }, xe.apply(this, arguments); }; function sr(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(p) { try { d(r.next(p)); } catch (v) { a(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { a(v); } } function d(p) { p.done ? s(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); } function or(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype); return a.next = l(0), a.throw = l(1), a.return = l(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function l(d) { return function(p) { return f([d, p]); }; } function f(d) { if (r) throw new TypeError("Generator is already executing."); for (; a && (a = 0, d[0] && (n = 0)), n; ) try { if (r = 1, i && (s = d[0] & 2 ? i.return : d[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, d[1])).done) return s; switch (i = 0, s && (d = [d[0] & 2, s.value]), d[0]) { case 0: case 1: s = 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 (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!s || d[1] > s[0] && d[1] < s[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < s[1]) { n.label = s[1], s = d; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(d); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = s = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } } function SD(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; } var Xg = {}, Nc = {}, Tc = {}, Ic = {}, rb; function bD() { if (rb) return Ic; rb = 1, Object.defineProperty(Ic, "__esModule", { value: !0 }), Ic.isEmptyData = void 0; function t(e) { return typeof e == "string" ? e.length === 0 : e.byteLength === 0; } return Ic.isEmptyData = t, Ic; } var Zg = {}, ib; function cC() { return ib || (ib = 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 ]); }(Zg)), Zg; } var kD = 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 s = 65536 + ((i & 1023) << 10) + (t.charCodeAt(++n) & 1023); e.push(s >> 18 | 240, s >> 12 & 63 | 128, s >> 6 & 63 | 128, s & 63 | 128); } else e.push(i >> 12 | 224, i >> 6 & 63 | 128, i & 63 | 128); } return Uint8Array.from(e); }, ED = 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 s = t[++n]; e += String.fromCharCode((i & 31) << 6 | s & 63); } else if (240 <= i && i < 365) { var a = [i, t[++n], t[++n], t[++n]], l = "%" + a.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 AD(t) { return new TextEncoder().encode(t); } function CD(t) { return new TextDecoder("utf-8").decode(t); } var dC = function(t) { return typeof TextEncoder == "function" ? AD(t) : kD(t); }, fC = function(t) { return typeof TextDecoder == "function" ? CD(t) : ED(t); }; const xD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, fromUtf8: dC, toUtf8: fC }, Symbol.toStringTag, { value: "Module" })), ND = /* @__PURE__ */ wl(xD), TD = {}; function ID() { return typeof window < "u" ? window : typeof self < "u" ? self : TD; } const RD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, locateWindow: ID }, Symbol.toStringTag, { value: "Module" })), Ow = /* @__PURE__ */ wl(RD); var sb; function hC() { if (sb) return Tc; sb = 1, Object.defineProperty(Tc, "__esModule", { value: !0 }), Tc.Sha256 = void 0; var t = bD(), e = cC(), n = ND, r = Ow, i = ( /** @class */ function() { function l(f) { f ? (this.operation = s(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(a(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; }() ); Tc.Sha256 = i; function s(l) { return new Promise(function(f, d) { var p = (0, r.locateWindow)().msCrypto.subtle.importKey("raw", a(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 a(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 Tc; } var Rc = {}, ev = {}, Oc = {}; const OD = (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 s = 65536 + ((i & 1023) << 10) + (t.charCodeAt(++n) & 1023); e.push(s >> 18 | 240, s >> 12 & 63 | 128, s >> 6 & 63 | 128, s & 63 | 128); } else e.push(i >> 12 | 224, i >> 6 & 63 | 128, i & 63 | 128); } return Uint8Array.from(e); }, PD = (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 s = t[++n]; e += String.fromCharCode((i & 31) << 6 | s & 63); } else if (240 <= i && i < 365) { const a = "%" + [i, t[++n], t[++n], t[++n]].map((l) => l.toString(16)).join("%"); e += decodeURIComponent(a); } else e += String.fromCharCode((i & 15) << 12 | (t[++n] & 63) << 6 | t[++n] & 63); } return e; }; function DD(t) { return new TextEncoder().encode(t); } function FD(t) { return new TextDecoder("utf-8").decode(t); } const LD = (t) => typeof TextEncoder == "function" ? DD(t) : OD(t), UD = (t) => typeof TextDecoder == "function" ? FD(t) : PD(t), MD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, fromUtf8: LD, toUtf8: UD }, Symbol.toStringTag, { value: "Module" })), BD = /* @__PURE__ */ wl(MD); var ob; function jD() { if (ob) return Oc; ob = 1, Object.defineProperty(Oc, "__esModule", { value: !0 }), Oc.convertToBuffer = void 0; var t = BD, 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 Oc.convertToBuffer = n, Oc; } var Pc = {}, ab; function $D() { if (ab) return Pc; ab = 1, Object.defineProperty(Pc, "__esModule", { value: !0 }), Pc.isEmptyData = void 0; function t(e) { return typeof e == "string" ? e.length === 0 : e.byteLength === 0; } return Pc.isEmptyData = t, Pc; } var Dc = {}, ub; function VD() { if (ub) return Dc; ub = 1, Object.defineProperty(Dc, "__esModule", { value: !0 }), Dc.numToUint8 = void 0; function t(e) { return new Uint8Array([ (e & 4278190080) >> 24, (e & 16711680) >> 16, (e & 65280) >> 8, e & 255 ]); } return Dc.numToUint8 = t, Dc; } var Fc = {}, lb; function zD() { if (lb) return Fc; lb = 1, Object.defineProperty(Fc, "__esModule", { value: !0 }), Fc.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 Fc.uint32ArrayFrom = t, Fc; } var cb; function pC() { return cb || (cb = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.uint32ArrayFrom = t.numToUint8 = t.isEmptyData = t.convertToBuffer = void 0; var e = jD(); Object.defineProperty(t, "convertToBuffer", { enumerable: !0, get: function() { return e.convertToBuffer; } }); var n = $D(); Object.defineProperty(t, "isEmptyData", { enumerable: !0, get: function() { return n.isEmptyData; } }); var r = VD(); Object.defineProperty(t, "numToUint8", { enumerable: !0, get: function() { return r.numToUint8; } }); var i = zD(); Object.defineProperty(t, "uint32ArrayFrom", { enumerable: !0, get: function() { return i.uint32ArrayFrom; } }); }(ev)), ev; } var db; function mC() { if (db) return Rc; db = 1, Object.defineProperty(Rc, "__esModule", { value: !0 }), Rc.Sha256 = void 0; var t = pC(), e = cC(), n = Ow, r = ( /** @class */ function() { function i(s) { this.toHash = new Uint8Array(0), s !== void 0 && (this.key = new Promise(function(a, l) { (0, n.locateWindow)().crypto.subtle.importKey("raw", (0, t.convertToBuffer)(s), e.SHA_256_HMAC_ALGO, !1, ["sign"]).then(a, l); }), this.key.catch(function() { })); } return i.prototype.update = function(s) { if (!(0, t.isEmptyData)(s)) { var a = (0, t.convertToBuffer)(s), l = new Uint8Array(this.toHash.byteLength + a.byteLength); l.set(this.toHash, 0), l.set(a, this.toHash.byteLength), this.toHash = l; } }, i.prototype.digest = function() { var s = this; return this.key ? this.key.then(function(a) { return (0, n.locateWindow)().crypto.subtle.sign(e.SHA_256_HMAC_ALGO, a, s.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, s.toHash); }).then(function(a) { return Promise.resolve(new Uint8Array(a)); }); }, i; }() ); return Rc.Sha256 = r, Rc; } var tv = {}, Lc = {}, Br = {}, fb; function gC() { return fb || (fb = 1, Object.defineProperty(Br, "__esModule", { value: !0 }), Br.MAX_HASHABLE_LENGTH = Br.INIT = Br.KEY = Br.DIGEST_LENGTH = Br.BLOCK_SIZE = void 0, Br.BLOCK_SIZE = 64, Br.DIGEST_LENGTH = 32, Br.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 ]), Br.INIT = [ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 ], Br.MAX_HASHABLE_LENGTH = Math.pow(2, 53) - 1), Br; } var Uc = {}, hb; function qD() { if (hb) return Uc; hb = 1, Object.defineProperty(Uc, "__esModule", { value: !0 }), Uc.RawSha256 = void 0; var t = gC(), 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, s = r.byteLength; if (this.bytesHashed += s, this.bytesHashed * 8 > t.MAX_HASHABLE_LENGTH) throw new Error("Cannot hash more than 2^53 - 1 bits"); for (; s > 0; ) this.buffer[this.bufferLength++] = r[i++], s--, 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), s = this.bufferLength; if (i.setUint8(this.bufferLength++, 128), s % t.BLOCK_SIZE >= t.BLOCK_SIZE - 8) { for (var a = this.bufferLength; a < t.BLOCK_SIZE; a++) i.setUint8(a, 0); this.hashBuffer(), this.bufferLength = 0; } for (var a = this.bufferLength; a < t.BLOCK_SIZE - 8; a++) i.setUint8(a, 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), a = 0; a < 8; a++) l[a * 4] = this.state[a] >>> 24 & 255, l[a * 4 + 1] = this.state[a] >>> 16 & 255, l[a * 4 + 2] = this.state[a] >>> 8 & 255, l[a * 4 + 3] = this.state[a] >>> 0 & 255; return l; }, n.prototype.hashBuffer = function() { for (var r = this, i = r.buffer, s = r.state, a = s[0], l = s[1], f = s[2], d = s[3], p = s[4], v = s[5], y = s[6], k = s[7], E = 0; E < t.BLOCK_SIZE; E++) { if (E < 16) this.temp[E] = (i[E * 4] & 255) << 24 | (i[E * 4 + 1] & 255) << 16 | (i[E * 4 + 2] & 255) << 8 | i[E * 4 + 3] & 255; else { var A = this.temp[E - 2], T = (A >>> 17 | A << 15) ^ (A >>> 19 | A << 13) ^ A >>> 10; A = this.temp[E - 15]; var O = (A >>> 7 | A << 25) ^ (A >>> 18 | A << 14) ^ A >>> 3; this.temp[E] = (T + this.temp[E - 7] | 0) + (O + this.temp[E - 16] | 0); } var R = (((p >>> 6 | p << 26) ^ (p >>> 11 | p << 21) ^ (p >>> 25 | p << 7)) + (p & v ^ ~p & y) | 0) + (k + (t.KEY[E] + this.temp[E] | 0) | 0) | 0, U = ((a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10)) + (a & l ^ a & f ^ l & f) | 0; k = y, y = v, v = p, p = d + R | 0, d = f, f = l, l = a, a = R + U | 0; } s[0] += a, s[1] += l, s[2] += f, s[3] += d, s[4] += p, s[5] += v, s[6] += y, s[7] += k; }, n; }() ); return Uc.RawSha256 = e, Uc; } var pb; function HD() { if (pb) return Lc; pb = 1, Object.defineProperty(Lc, "__esModule", { value: !0 }), Lc.Sha256 = void 0; var t = xl, e = gC(), n = qD(), r = pC(), i = ( /** @class */ function() { function a(l) { if (this.hash = new n.RawSha256(), l) { this.outer = new n.RawSha256(); var f = s(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 a.prototype.update = function(l) { if (!((0, r.isEmptyData)(l) || this.error)) try { this.hash.update((0, r.convertToBuffer)(l)); } catch (f) { this.error = f; } }, a.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(); }, a.prototype.digest = function() { return (0, t.__awaiter)(this, void 0, void 0, function() { return (0, t.__generator)(this, function(l) { return [2, this.digestSync()]; }); }); }, a; }() ); Lc.Sha256 = i; function s(a) { var l = (0, r.convertToBuffer)(a); 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 Lc; } var mb; function KD() { return mb || (mb = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = xl; (0, e.__exportStar)(HD(), t); }(tv)), tv; } var nv = {}, bi = {}, gb; function GD() { if (gb) return bi; gb = 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(a) { if (r(a) && typeof a.crypto.subtle == "object") { var l = a.crypto.subtle; return i(l); } return !1; } bi.supportsWebCrypto = n; function r(a) { if (typeof a == "object" && typeof a.crypto == "object") { var l = a.crypto.getRandomValues; return typeof l == "function"; } return !1; } bi.supportsSecureRandom = r; function i(a) { return a && e.every(function(l) { return typeof a[l] == "function"; }); } bi.supportsSubtleCrypto = i; function s(a) { 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(a)) return [2, !1]; d.label = 1; case 1: return d.trys.push([1, 4, , 5]), [4, a.generateKey({ name: "AES-GCM", length: 128 }, !1, ["encrypt"])]; case 2: return l = d.sent(), [4, a.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 = s, bi; } var vb; function WD() { return vb || (vb = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = xl; e.__exportStar(GD(), t); }(nv)), nv; } var rv = {}, iv = {}, yb; function YD() { return yb || (yb = 1, Object.defineProperty(iv, "__esModule", { value: !0 })), iv; } var sv = {}, wb; function QD() { return wb || (wb = 1, Object.defineProperty(sv, "__esModule", { value: !0 })), sv; } var ov = {}, _b; function JD() { return _b || (_b = 1, Object.defineProperty(ov, "__esModule", { value: !0 })), ov; } var av = {}, Sb; function XD() { return Sb || (Sb = 1, Object.defineProperty(av, "__esModule", { value: !0 })), av; } var Mc = {}, bb; function ZD() { if (bb) return Mc; bb = 1, Object.defineProperty(Mc, "__esModule", { value: !0 }), Mc.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, s = i.getRandomValues, a = i.subtle; return t.map(function(l) { return a[l]; }).concat(s).every(function(l) { return typeof l == "function"; }); } return !1; } return Mc.isMsWindow = n, Mc; } var kb; function eF() { return kb || (kb = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }); var e = xl; e.__exportStar(YD(), t), e.__exportStar(QD(), t), e.__exportStar(JD(), t), e.__exportStar(XD(), t), e.__exportStar(ZD(), t); }(rv)), rv; } var Eb; function tF() { if (Eb) return Nc; Eb = 1, Object.defineProperty(Nc, "__esModule", { value: !0 }), Nc.Sha256 = void 0; var t = hC(), e = mC(), n = KD(), r = WD(), i = eF(), s = Ow, a = ( /** @class */ function() { function l(f) { (0, r.supportsWebCrypto)((0, s.locateWindow)()) ? this.hash = new e.Sha256(f) : (0, i.isMsWindow)((0, s.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 Nc.Sha256 = a, Nc; } var Ab; function nF() { return Ab || (Ab = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.WebCryptoSha256 = t.Ie11Sha256 = void 0; var e = xl; (0, e.__exportStar)(tF(), t); var n = hC(); Object.defineProperty(t, "Ie11Sha256", { enumerable: !0, get: function() { return n.Sha256; } }); var r = mC(); Object.defineProperty(t, "WebCryptoSha256", { enumerable: !0, get: function() { return r.Sha256; } }); }(Xg)), Xg; } var rF = nF(), Cb = ( /** @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(It(It({}, this), { headers: It({}, this.headers) })); return e.query && (e.query = iF(e.query)), e; }, t; }() ); function iF(t) { return Object.keys(t).reduce(function(e, n) { var r, i = t[n]; return It(It({}, e), (r = {}, r[n] = Array.isArray(i) ? is(i) : i, r)); }, {}); } var La = function(t) { return encodeURIComponent(t).replace(/[!'()*]/g, sF); }, sF = function(t) { return "%" + t.charCodeAt(0).toString(16).toUpperCase(); }; function oF(t) { var e, n, r = []; try { for (var i = Rr(Object.keys(t).sort()), s = i.next(); !s.done; s = i.next()) { var a = s.value, l = t[a]; if (a = La(a), Array.isArray(l)) for (var f = 0, d = l.length; f < d; f++) r.push(a + "=" + La(l[f])); else { var p = a; (l || typeof l == "string") && (p += "=" + La(l)), r.push(p); } } } catch (v) { e = { error: v }; } finally { try { s && !s.done && (n = i.return) && n.call(i); } finally { if (e) throw e.error; } } return r.join("&"); } function aF(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 uF = ( /** @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, s = this.requestTimeout; if (i != null && i.aborted) { var a = new Error("Request aborted"); return a.name = "AbortError", Promise.reject(a); } var l = e.path; if (e.query) { var f = oF(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 E = new Request(v, k), A = [ fetch(E).then(function(T) { var O, R, U = T.headers, j = {}; try { for (var K = Rr(U.entries()), ie = K.next(); !ie.done; ie = K.next()) { var ce = ie.value; j[ce[0]] = ce[1]; } } catch (ye) { O = { error: ye }; } finally { try { ie && !ie.done && (R = K.return) && R.call(K); } finally { if (O) throw O.error; } } var H = T.body !== void 0; return H ? { response: new Cb({ headers: j, statusCode: T.status, body: T.body }) } : T.blob().then(function(ye) { return { response: new Cb({ headers: j, statusCode: T.status, body: ye }) }; }); }), aF(s) ]; return i && A.push(new Promise(function(T, O) { i.onabort = function() { var R = new Error("Request aborted"); R.name = "AbortError", O(R); }; })), Promise.race(A); }, t; }() ), Ya = {}, Nl = new Array(64); for (var Hn = 0, gd = 65, Pw = 90; Hn + gd <= Pw; Hn++) { var Mo = String.fromCharCode(Hn + gd); Ya[Mo] = Hn, Nl[Hn] = Mo; } for (var Hn = 0, gd = 97, Pw = 122; Hn + gd <= Pw; Hn++) { var Mo = String.fromCharCode(Hn + gd), vd = Hn + 26; Ya[Mo] = vd, Nl[vd] = Mo; } for (var Hn = 0; Hn < 10; Hn++) { Ya[Hn.toString(10)] = Hn + 52; var Mo = Hn.toString(10), vd = Hn + 52; Ya[Mo] = vd, Nl[vd] = Mo; } Ya["+"] = 62; Nl[62] = "+"; Ya["/"] = 63; Nl[63] = "/"; var ll = 6, td = 8, lF = 63; function vC(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 s = 0, a = 0, l = i, f = i + 3; l <= f; l++) t[l] !== "=" ? (s |= Ya[t[l]] << (f - l) * ll, a += ll) : s >>= ll; var d = i / 4 * 3; s >>= a % td; for (var p = Math.floor(a / td), v = 0; v < p; v++) { var y = (p - v - 1) * td; r.setUint8(d + v, (s & 255 << y) >> y); } } return new Uint8Array(n); } function cF(t) { for (var e = "", n = 0; n < t.length; n += 3) { for (var r = 0, i = 0, s = n, a = Math.min(n + 3, t.length); s < a; s++) r |= t[s] << (a - s - 1) * td, i += td; 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 & lF << d) >> d]; } e += "==".slice(0, 4 - l); } return e; } var dF = function(t) { return typeof Blob == "function" && t instanceof Blob ? fF(t) : hF(t); }; function fF(t) { return an(this, void 0, void 0, function() { var e, n; return nn(this, function(r) { switch (r.label) { case 0: return [4, pF(t)]; case 1: return e = r.sent(), n = vC(e), [2, new Uint8Array(n)]; } }); }); } function hF(t) { return an(this, void 0, void 0, function() { var e, n, r, i, s, a, l; return nn(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(), s = i.done, a = i.value, a && (l = e, e = new Uint8Array(l.length + a.length), e.set(l), e.set(a, l.length)), r = s, [3, 1]; case 3: return [2, e]; } }); }); } function pF(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 s = (i = r.result) !== null && i !== void 0 ? i : "", a = s.indexOf(","), l = a > -1 ? a + 1 : s.length; e(s.substring(l)); }, r.onabort = function() { return n(new Error("Read aborted")); }, r.onerror = function() { return n(r.error); }, r.readAsDataURL(t); }); } var mF = function(t) { return function() { return Promise.reject(t); }; }, gF = function(t) { return function(e, n) { return function(r) { return an(void 0, void 0, void 0, function() { var i; return nn(this, function(s) { return !((i = t == null ? void 0 : t.retryStrategy) === null || i === void 0) && i.mode && (n.userAgent = is(n.userAgent || [], [["cfg/retry-mode", t.retryStrategy.mode]])), [2, t.retryStrategy.retry(e, r)]; }); }); }; }; }, vF = { name: "retryMiddleware", tags: ["RETRY"], step: "finalizeRequest", priority: "high", override: !0 }, yF = function(t) { return { applyToStack: function(e) { e.add(gF(t), vF); } }; }, wF = 100, _F = 20 * 1e3, SF = 500, bF = 500, kF = 5, EF = 10, AF = 1, CF = "amz-sdk-invocation-id", xF = "amz-sdk-request", NF = [ "AuthFailure", "InvalidSignatureException", "RequestExpired", "RequestInTheFuture", "RequestTimeTooSkewed", "SignatureDoesNotMatch" ], TF = [ "BandwidthLimitExceeded", "EC2ThrottledException", "LimitExceededException", "PriorRequestNotComplete", "ProvisionedThroughputExceededException", "RequestLimitExceeded", "RequestThrottled", "RequestThrottledException", "SlowDown", "ThrottledException", "Throttling", "ThrottlingException", "TooManyRequestsException", "TransactionInProgressException" ], IF = ["AbortError", "TimeoutError", "RequestTimeout", "RequestTimeoutException"], RF = [500, 502, 503, 504], OF = function(t) { return t.$retryable !== void 0; }, PF = function(t) { return NF.includes(t.name); }, yC = function(t) { var e, n; return ((e = t.$metadata) === null || e === void 0 ? void 0 : e.httpStatusCode) === 429 || TF.includes(t.name) || ((n = t.$retryable) === null || n === void 0 ? void 0 : n.throttling) == !0; }, DF = function(t) { var e; return IF.includes(t.name) || RF.includes(((e = t.$metadata) === null || e === void 0 ? void 0 : e.httpStatusCode) || 0); }, rh = { exports: {} }, xb; function wC() { if (xb) return rh.exports; xb = 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); rh.exports = function() { return t(e), e; }; } else { var n = new Array(16); rh.exports = function() { for (var i = 0, s; i < 16; i++) i & 3 || (s = Math.random() * 4294967296), n[i] = s >>> ((i & 3) << 3) & 255; return n; }; } return rh.exports; } var uv, Nb; function _C() { if (Nb) return uv; Nb = 1; for (var t = [], e = 0; e < 256; ++e) t[e] = (e + 256).toString(16).substr(1); function n(r, i) { var s = i || 0, a = t; return [ a[r[s++]], a[r[s++]], a[r[s++]], a[r[s++]], "-", a[r[s++]], a[r[s++]], "-", a[r[s++]], a[r[s++]], "-", a[r[s++]], a[r[s++]], "-", a[r[s++]], a[r[s++]], a[r[s++]], a[r[s++]], a[r[s++]], a[r[s++]] ].join(""); } return uv = n, uv; } var lv, Tb; function FF() { if (Tb) return lv; Tb = 1; var t = wC(), e = _C(), n, r, i = 0, s = 0; function a(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 E = t(); y == null && (y = n = [ E[0] | 1, E[1], E[2], E[3], E[4], E[5] ]), k == null && (k = r = (E[6] << 8 | E[7]) & 16383); } var A = l.msecs !== void 0 ? l.msecs : (/* @__PURE__ */ new Date()).getTime(), T = l.nsecs !== void 0 ? l.nsecs : s + 1, O = A - i + (T - s) / 1e4; if (O < 0 && l.clockseq === void 0 && (k = k + 1 & 16383), (O < 0 || A > i) && l.nsecs === void 0 && (T = 0), T >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); i = A, s = T, r = k, A += 122192928e5; var R = ((A & 268435455) * 1e4 + T) % 4294967296; v[p++] = R >>> 24 & 255, v[p++] = R >>> 16 & 255, v[p++] = R >>> 8 & 255, v[p++] = R & 255; var U = A / 4294967296 * 1e4 & 268435455; v[p++] = U >>> 8 & 255, v[p++] = U & 255, v[p++] = U >>> 24 & 15 | 16, v[p++] = U >>> 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 lv = a, lv; } var cv, Ib; function LF() { if (Ib) return cv; Ib = 1; var t = wC(), e = _C(); function n(r, i, s) { var a = i && s || 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[a + f] = l[f]; return i || e(l); } return cv = n, cv; } var dv, Rb; function UF() { if (Rb) return dv; Rb = 1; var t = FF(), e = LF(), n = e; return n.v1 = t, n.v4 = e, dv = n, dv; } var MF = UF(), BF = function(t) { var e = t, n = t, r = function(l) { return l.name === "TimeoutError" ? EF : kF; }, i = function(l) { return r(l) <= n; }, s = function(l) { if (!i(l)) throw new Error("No retry token available"); var f = r(l); return n -= f, f; }, a = function(l) { n += l ?? AF, n = Math.min(n, e); }; return Object.freeze({ hasRetryTokens: i, retrieveRetryTokens: s, releaseRetryTokens: a }); }, jF = function(t, e) { return Math.floor(Math.min(_F, Math.random() * Math.pow(2, e) * t)); }, $F = function(t) { return t ? OF(t) || PF(t) || yC(t) || DF(t) : !1; }, Dw = 3, VF = "standard", zF = ( /** @class */ function() { function t(e, n) { var r, i, s; this.maxAttemptsProvider = e, this.mode = VF, this.retryDecider = (r = n == null ? void 0 : n.retryDecider) !== null && r !== void 0 ? r : $F, this.delayDecider = (i = n == null ? void 0 : n.delayDecider) !== null && i !== void 0 ? i : jF, this.retryQuota = (s = n == null ? void 0 : n.retryQuota) !== null && s !== void 0 ? s : BF(bF); } return t.prototype.shouldRetry = function(e, n, r) { return n < r && this.retryDecider(e) && this.retryQuota.hasRetryTokens(e); }, t.prototype.getMaxAttempts = function() { return an(this, void 0, void 0, function() { var e; return nn(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 = Dw, [3, 3]; case 3: return [2, e]; } }); }); }, t.prototype.retry = function(e, n) { return an(this, void 0, void 0, function() { var r, i, s, a, l, f, d, p; return nn(this, function(v) { switch (v.label) { case 0: return i = 0, s = 0, [4, this.getMaxAttempts()]; case 1: a = v.sent(), l = n.request, ml.isInstance(l) && (l.headers[CF] = MF.v4()), f = function() { var y, k, E, A, T; return nn(this, function(O) { switch (O.label) { case 0: return O.trys.push([0, 2, , 5]), ml.isInstance(l) && (l.headers[xF] = "attempt=" + (i + 1) + "; max=" + a), [4, e(n)]; case 1: return y = O.sent(), k = y.response, E = y.output, d.retryQuota.releaseRetryTokens(r), E.$metadata.attempts = i + 1, E.$metadata.totalRetryDelay = s, [2, { value: { response: k, output: E } }]; case 2: return A = O.sent(), i++, d.shouldRetry(A, i, a) ? (r = d.retryQuota.retrieveRetryTokens(A), T = d.delayDecider(yC(A) ? SF : wF, i), s += T, [4, new Promise(function(R) { return setTimeout(R, T); })]) : [3, 4]; case 3: return O.sent(), [2, "continue"]; case 4: throw A.$metadata || (A.$metadata = {}), A.$metadata.attempts = i, A.$metadata.totalRetryDelay = s, A; 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; }() ), qF = function(t) { var e = HF(t.maxAttempts); return It(It({}, t), { maxAttempts: e, retryStrategy: t.retryStrategy || new zF(e) }); }, HF = function(t) { if (t === void 0 && (t = Dw), typeof t == "number") { var e = Promise.resolve(t); return function() { return e; }; } return t; }; function KF(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 GF = { "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" }, SC = { 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" }, cr = { 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" }, wo = { EdgeHTML: "EdgeHTML", Blink: "Blink", Trident: "Trident", Presto: "Presto", Gecko: "Gecko", WebKit: "WebKit" }; class De { /** * 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 = De.getVersionPrecision(e), s = De.getVersionPrecision(n); let a = Math.max(i, s), l = 0; const f = De.map([e, n], (d) => { const p = a - De.getVersionPrecision(d), v = d + new Array(p + 1).join(".0"); return De.map(v.split("."), (y) => new Array(20 - y.length).join("0") + y).reverse(); }); for (r && (l = a - Math.min(i, s)), a -= 1; a >= l; ) { if (f[0][a] > f[1][a]) return 1; if (f[0][a] === f[1][a]) { if (a === l) return 0; a -= 1; } else if (f[0][a] < f[1][a]) 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 s = e[r]; if (n(s, r)) return s; } } /** * Object::assign polyfill * * @param {Object} obj * @param {Object} ...objs * @return {Object} */ static assign(e, ...n) { const r = e; let i, s; if (Object.assign) return Object.assign(e, ...n); for (i = 0, s = n.length; i < s; i += 1) { const a = n[i]; typeof a == "object" && a !== null && Object.keys(a).forEach((f) => { r[f] = a[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 GF[e]; } /** * Get short version/alias for a browser name * * @example * getBrowserAlias('edge') // Microsoft Edge * * @param {string} browserAlias * @return {string} */ static getBrowserTypeByAlias(e) { return SC[e] || ""; } } const sn = /version\/(\d+(\.?_?\d+)+)/i, WF = [ /* Googlebot */ { test: [/googlebot/i], describe(t) { const e = { name: "Googlebot" }, n = De.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, /* Opera < 13.0 */ { test: [/opera/i], describe(t) { const e = { name: "Opera" }, n = De.getFirstMatch(sn, t) || De.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 = De.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/SamsungBrowser/i], describe(t) { const e = { name: "Samsung Internet for Android" }, n = De.getFirstMatch(sn, t) || De.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 = De.getFirstMatch(sn, t) || De.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/MZBrowser/i], describe(t) { const e = { name: "MZ Browser" }, n = De.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/focus/i], describe(t) { const e = { name: "Focus" }, n = De.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/swing/i], describe(t) { const e = { name: "Swing" }, n = De.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/coast/i], describe(t) { const e = { name: "Opera Coast" }, n = De.getFirstMatch(sn, t) || De.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 = De.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/yabrowser/i], describe(t) { const e = { name: "Yandex Browser" }, n = De.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/ucbrowser/i], describe(t) { const e = { name: "UC Browser" }, n = De.getFirstMatch(sn, t) || De.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/Maxthon|mxios/i], describe(t) { const e = { name: "Maxthon" }, n = De.getFirstMatch(sn, t) || De.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/epiphany/i], describe(t) { const e = { name: "Epiphany" }, n = De.getFirstMatch(sn, t) || De.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/puffin/i], describe(t) { const e = { name: "Puffin" }, n = De.getFirstMatch(sn, t) || De.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/sleipnir/i], describe(t) { const e = { name: "Sleipnir" }, n = De.getFirstMatch(sn, t) || De.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 = De.getFirstMatch(sn, t) || De.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/micromessenger/i], describe(t) { const e = { name: "WeChat" }, n = De.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, t) || De.getFirstMatch(sn, 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 = De.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/msie|trident/i], describe(t) { const e = { name: "Internet Explorer" }, n = De.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/\sedg\//i], describe(t) { const e = { name: "Microsoft Edge" }, n = De.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 = De.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/vivaldi/i], describe(t) { const e = { name: "Vivaldi" }, n = De.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/seamonkey/i], describe(t) { const e = { name: "SeaMonkey" }, n = De.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/sailfish/i], describe(t) { const e = { name: "Sailfish" }, n = De.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 = De.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/phantom/i], describe(t) { const e = { name: "PhantomJS" }, n = De.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/slimerjs/i], describe(t) { const e = { name: "SlimerJS" }, n = De.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 = De.getFirstMatch(sn, t) || De.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 = De.getFirstMatch(sn, t) || De.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 = De.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/tizen/i], describe(t) { const e = { name: "Tizen" }, n = De.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/qupzilla/i], describe(t) { const e = { name: "QupZilla" }, n = De.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/firefox|iceweasel|fxios/i], describe(t) { const e = { name: "Firefox" }, n = De.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 = De.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/MiuiBrowser/i], describe(t) { const e = { name: "Miui" }, n = De.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, { test: [/chromium/i], describe(t) { const e = { name: "Chromium" }, n = De.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, t) || De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, { test: [/chrome|crios|crmo/i], describe(t) { const e = { name: "Chrome" }, n = De.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 = De.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 = De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, /* PlayStation 4 */ { test: [/playstation 4/i], describe(t) { const e = { name: "PlayStation 4" }, n = De.getFirstMatch(sn, t); return n && (e.version = n), e; } }, /* Safari */ { test: [/safari|applewebkit/i], describe(t) { const e = { name: "Safari" }, n = De.getFirstMatch(sn, 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: De.getFirstMatch(i, t), version: De.getSecondMatch(i, t) }; } } ], YF = [ /* Roku */ { test: [/Roku\/DVP/], describe(t) { const e = De.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, t); return { name: cr.Roku, version: e }; } }, /* Windows Phone */ { test: [/windows phone/i], describe(t) { const e = De.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, t); return { name: cr.WindowsPhone, version: e }; } }, /* Windows */ { test: [/windows /i], describe(t) { const e = De.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, t), n = De.getWindowsVersionName(e); return { name: cr.Windows, version: e, versionName: n }; } }, /* Firefox on iPad */ { test: [/Macintosh(.*?) FxiOS(.*?)\//], describe(t) { const e = { name: cr.iOS }, n = De.getSecondMatch(/(Version\/)(\d[\d.]+)/, t); return n && (e.version = n), e; } }, /* macOS */ { test: [/macintosh/i], describe(t) { const e = De.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, t).replace(/[_\s]/g, "."), n = De.getMacOSVersionName(e), r = { name: cr.MacOS, version: e }; return n && (r.versionName = n), r; } }, /* iOS */ { test: [/(ipod|iphone|ipad)/i], describe(t) { const e = De.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, t).replace(/[_\s]/g, "."); return { name: cr.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 = De.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, t), n = De.getAndroidVersionName(e), r = { name: cr.Android, version: e }; return n && (r.versionName = n), r; } }, /* WebOS */ { test: [/(web|hpw)[o0]s/i], describe(t) { const e = De.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, t), n = { name: cr.WebOS }; return e && e.length && (n.version = e), n; } }, /* BlackBerry */ { test: [/blackberry|\bbb\d+/i, /rim\stablet/i], describe(t) { const e = De.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, t) || De.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, t) || De.getFirstMatch(/\bbb(\d+)/i, t); return { name: cr.BlackBerry, version: e }; } }, /* Bada */ { test: [/bada/i], describe(t) { const e = De.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, t); return { name: cr.Bada, version: e }; } }, /* Tizen */ { test: [/tizen/i], describe(t) { const e = De.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, t); return { name: cr.Tizen, version: e }; } }, /* Linux */ { test: [/linux/i], describe() { return { name: cr.Linux }; } }, /* Chrome OS */ { test: [/CrOS/], describe() { return { name: cr.ChromeOS }; } }, /* Playstation 4 */ { test: [/PlayStation 4/], describe(t) { const e = De.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, t); return { name: cr.PlayStation4, version: e }; } } ], QF = [ /* Googlebot */ { test: [/googlebot/i], describe() { return { type: "bot", vendor: "Google" }; } }, /* Huawei */ { test: [/huawei/i], describe(t) { const e = De.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 = De.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 }; } } ], JF = [ /* EdgeHTML */ { test(t) { return t.getBrowserName(!0) === "microsoft edge"; }, describe(t) { if (/\sedg\//i.test(t)) return { name: wo.Blink }; const n = De.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, t); return { name: wo.EdgeHTML, version: n }; } }, /* Trident */ { test: [/trident/i], describe(t) { const e = { name: wo.Trident }, n = De.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: wo.Presto }, n = De.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: wo.Gecko }, n = De.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } }, /* Blink */ { test: [/(apple)?webkit\/537\.36/i], describe() { return { name: wo.Blink }; } }, /* WebKit */ { test: [/(apple)?webkit/i], describe(t) { const e = { name: wo.WebKit }, n = De.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, t); return n && (e.version = n), e; } } ]; let Ob = 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 = De.find(WF, (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 = De.find(YF, (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 = De.find(QF, (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 = De.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.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 De.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 s = 0; if (Object.keys(e).forEach((l) => { const f = e[l]; typeof f == "string" ? (i[l] = f, s += 1) : typeof f == "object" && (n[l] = f, r += 1); }), r > 0) { const l = Object.keys(n), f = De.find(l, (p) => this.isOS(p)); if (f) { const p = this.satisfies(n[f]); if (p !== void 0) return p; } const d = De.find( l, (p) => this.isPlatform(p) ); if (d) { const p = this.satisfies(n[d]); if (p !== void 0) return p; } } if (s > 0) { const l = Object.keys(i), f = De.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 s = De.getBrowserTypeByAlias(i); return n && s && (i = s.toLowerCase()), i === r; } compareVersion(e) { let n = [0], r = e, i = !1; const s = this.getBrowserVersion(); if (typeof s == "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( De.compareVersions(s, 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 XF { /** * 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 Ob(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 Ob(e).getResult(); } static get BROWSER_MAP() { return SC; } static get ENGINE_MAP() { return wo; } static get OS_MAP() { return cr; } static get PLATFORMS_MAP() { return An; } } var ZF = function(t) { var e = t.serviceId, n = t.clientVersion; return function() { return an(void 0, void 0, void 0, function() { var r, i, s, a, l, f, d, p, v; return nn(this, function(y) { return r = !((s = window == null ? void 0 : window.navigator) === null || s === void 0) && s.userAgent ? XF.parse(window.navigator.userAgent) : void 0, i = [ // sdk-metadata ["aws-sdk-js", n], // os-metadata ["os/" + (((a = r == null ? void 0 : r.os) === null || a === void 0 ? void 0 : a.name) || "other"), (l = r == null ? void 0 : 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 == null ? void 0 : r.browser) === null || f === void 0 ? void 0 : f.name) !== null && d !== void 0 ? d : "unknown") + "_" + ((v = (p = r == null ? void 0 : 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 e2(t) { var e, n, r = {}; if (t = t.replace(/^\?/, ""), t) try { for (var i = Rr(t.split("&")), s = i.next(); !s.done; s = i.next()) { var a = s.value, l = Cl(a.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 { s && !s.done && (n = i.return) && n.call(i); } finally { if (e) throw e.error; } } return r; } var t2 = function(t) { var e = new URL(t), n = e.hostname, r = e.pathname, i = e.port, s = e.protocol, a = e.search, l; return a && (l = e2(a)), { hostname: n, port: i ? parseInt(i) : void 0, protocol: s, path: r, query: l }; }, n2 = function(t) { var e; return It(It({}, t), { tls: (e = t.tls) !== null && e !== void 0 ? e : !0, endpoint: t.endpoint ? r2(t) : function() { return i2(t); }, isCustomEndpoint: !!t.endpoint }); }, r2 = 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; }, i2 = function(t) { return an(void 0, void 0, void 0, function() { var e, n, r, i, s, a; return nn(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 (s = ((a = l.sent()) !== null && a !== void 0 ? a : {}).hostname, !s) throw new Error("Cannot resolve hostname from client config"); return [2, t.urlParser((n ? "https:" : "http:") + "//" + s)]; } }); }); }, s2 = function(t) { if (!t.region) throw new Error("Region is missing"); return It(It({}, t), { region: o2(t.region) }); }, o2 = function(t) { if (typeof t == "string") { var e = Promise.resolve(t); return function() { return e; }; } return t; }, Pb = "content-length"; function a2(t) { var e = this; return function(n) { return function(r) { return an(e, void 0, void 0, function() { var i, s, a, l, f; return nn(this, function(d) { return i = r.request, ml.isInstance(i) && (s = i.body, a = i.headers, s && Object.keys(a).map(function(p) { return p.toLowerCase(); }).indexOf(Pb) === -1 && (l = t(s), l !== void 0 && (i.headers = It(It({}, i.headers), (f = {}, f[Pb] = String(l), f))))), [2, n(It(It({}, r), { request: i }))]; }); }); }; }; } var u2 = { step: "build", tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"], name: "contentLengthMiddleware", override: !0 }, l2 = function(t) { return { applyToStack: function(e) { e.add(a2(t.bodyLengthChecker), u2); } }; }; var c2 = function(t) { return function(e) { return function(n) { return an(void 0, void 0, void 0, function() { var r, i, s; return nn(this, function(a) { return ml.isInstance(n.request) ? (r = n.request, i = (t.requestHandler.metadata || {}).handlerProtocol, s = i === void 0 ? "" : i, s.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)]; }); }); }; }; }, d2 = { name: "hostHeaderMiddleware", step: "build", priority: "low", tags: ["HOST"], override: !0 }, f2 = function(t) { return { applyToStack: function(e) { e.add(c2(t), d2); } }; }, h2 = function() { return function(t, e) { return function(n) { return an(void 0, void 0, void 0, function() { var r, i, s, a, l, f, d, p, v; return nn(this, function(y) { switch (y.label) { case 0: return r = e.clientName, i = e.commandName, s = e.inputFilterSensitiveLog, a = e.logger, l = e.outputFilterSensitiveLog, [4, t(n)]; case 1: return f = y.sent(), a ? (typeof a.info == "function" && (d = f.output, p = d.$metadata, v = Iw(d, ["$metadata"]), a.info({ clientName: r, commandName: i, input: s(n.input), output: l(v), metadata: p })), [2, f]) : [2, f]; } }); }); }; }; }, p2 = { name: "loggerMiddleware", tags: ["LOGGER"], step: "initialize", override: !0 }, m2 = function(t) { return { applyToStack: function(e) { e.add(h2(), p2); } }; }, g2 = "X-Amz-Algorithm", v2 = "X-Amz-Credential", bC = "X-Amz-Date", y2 = "X-Amz-SignedHeaders", w2 = "X-Amz-Expires", kC = "X-Amz-Signature", EC = "X-Amz-Security-Token", AC = "authorization", CC = bC.toLowerCase(), _2 = "date", S2 = [AC, CC, _2], b2 = kC.toLowerCase(), _y = "x-amz-content-sha256", k2 = EC.toLowerCase(), E2 = { 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 }, A2 = /^proxy-/, C2 = /^sec-/, fv = "AWS4-HMAC-SHA256", x2 = "AWS4-HMAC-SHA256-PAYLOAD", N2 = "UNSIGNED-PAYLOAD", T2 = 50, xC = "aws4_request", I2 = 60 * 60 * 24 * 7, ih = {}, hv = []; function pv(t, e, n) { return t + "/" + e + "/" + n + "/" + xC; } var R2 = function(t, e, n, r, i) { return an(void 0, void 0, void 0, function() { var s, a, l, f, d, p, v, y, k; return nn(this, function(E) { switch (E.label) { case 0: return [4, Db(t, e.secretAccessKey, e.accessKeyId)]; case 1: if (s = E.sent(), a = n + ":" + r + ":" + i + ":" + il(s) + ":" + e.sessionToken, a in ih) return [2, ih[a]]; for (hv.push(a); hv.length > T2; ) delete ih[hv.shift()]; l = "AWS4" + e.secretAccessKey, E.label = 2; case 2: E.trys.push([2, 7, 8, 9]), f = Rr([n, r, i, xC]), d = f.next(), E.label = 3; case 3: return d.done ? [3, 6] : (p = d.value, [4, Db(t, l, p)]); case 4: l = E.sent(), E.label = 5; case 5: return d = f.next(), [3, 3]; case 6: return [3, 9]; case 7: return v = E.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, ih[a] = l]; } }); }); }; function Db(t, e, n) { var r = new t(e); return r.update(n), r.digest(); } function Fb(t, e, n) { var r, i, s = t.headers, a = {}; try { for (var l = Rr(Object.keys(s).sort()), f = l.next(); !f.done; f = l.next()) { var d = f.value, p = d.toLowerCase(); (p in E2 || e != null && e.has(p) || A2.test(p) || C2.test(p)) && (!n || n && !n.has(p)) || (a[p] = s[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 a; } function O2(t) { var e, n, r = t.query, i = r === void 0 ? {} : r, s = [], a = {}, l = function(v) { if (v.toLowerCase() === b2) return "continue"; s.push(v); var y = i[v]; typeof y == "string" ? a[v] = La(v) + "=" + La(y) : Array.isArray(y) && (a[v] = y.slice(0).sort().reduce(function(k, E) { return k.concat([La(v) + "=" + La(E)]); }, []).join("&")); }; try { for (var f = Rr(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 s.map(function(v) { return a[v]; }).filter(function(v) { return v; }).join("&"); } var P2 = function(t) { return typeof ArrayBuffer == "function" && t instanceof ArrayBuffer || Object.prototype.toString.call(t) === "[object ArrayBuffer]"; }; function mv(t, e) { var n = t.headers, r = t.body; return an(this, void 0, void 0, function() { var i, s, a, l, f, d, p; return nn(this, function(v) { switch (v.label) { case 0: try { for (i = Rr(Object.keys(n)), s = i.next(); !s.done; s = i.next()) if (a = s.value, a.toLowerCase() === _y) return [2, n[a]]; } catch (y) { d = { error: y }; } finally { try { s && !s.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) || P2(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, N2]; } }); }); } function D2(t, e) { var n, r; t = t.toLowerCase(); try { for (var i = Rr(Object.keys(e)), s = i.next(); !s.done; s = i.next()) { var a = s.value; if (t === a.toLowerCase()) return !0; } } catch (l) { n = { error: l }; } finally { try { s && !s.done && (r = i.return) && r.call(i); } finally { if (n) throw n.error; } } return !1; } function NC(t) { var e = t.headers, n = t.query, r = Iw(t, ["headers", "query"]); return It(It({}, r), { headers: It({}, e), query: n ? F2(n) : void 0 }); } function F2(t) { return Object.keys(t).reduce(function(e, n) { var r, i = t[n]; return It(It({}, e), (r = {}, r[n] = Array.isArray(i) ? is(i) : i, r)); }, {}); } function L2(t, e) { var n, r, i; e === void 0 && (e = {}); var s = typeof t.clone == "function" ? t.clone() : NC(t), a = s.headers, l = s.query, f = l === void 0 ? {} : l; try { for (var d = Rr(Object.keys(a)), 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] = a[v], delete a[v]); } } catch (k) { n = { error: k }; } finally { try { p && !p.done && (r = d.return) && r.call(d); } finally { if (n) throw n.error; } } return It(It({}, t), { headers: a, query: f }); } function Lb(t) { var e, n; t = typeof t.clone == "function" ? t.clone() : NC(t); try { for (var r = Rr(Object.keys(t.headers)), i = r.next(); !i.done; i = r.next()) { var s = i.value; S2.indexOf(s.toLowerCase()) > -1 && delete t.headers[s]; } } catch (a) { e = { error: a }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (e) throw e.error; } } return t; } function U2(t) { return M2(t).toISOString().replace(/\.\d{3}Z$/, "Z"); } function M2(t) { return typeof t == "number" ? new Date(t * 1e3) : typeof t == "string" ? Number(t) ? new Date(Number(t) * 1e3) : new Date(t) : t; } var B2 = ( /** @class */ function() { function t(e) { var n = e.applyChecksum, r = e.credentials, i = e.region, s = e.service, a = e.sha256, l = e.uriEscapePath, f = l === void 0 ? !0 : l; this.service = s, this.sha256 = a, this.uriEscapePath = f, this.applyChecksum = typeof n == "boolean" ? n : !0, this.regionProvider = j2(i), this.credentialProvider = $2(r); } return t.prototype.presign = function(e, n) { return n === void 0 && (n = {}), an(this, void 0, void 0, function() { var r, i, s, a, l, f, d, p, v, y, k, E, A, T, O, R, U, j, K, ie, ce, H, ye, Z; return nn(this, function(_e) { switch (_e.label) { case 0: return r = n.signingDate, i = r === void 0 ? /* @__PURE__ */ new Date() : r, s = n.expiresIn, a = s === void 0 ? 3600 : s, l = n.unsignableHeaders, f = n.unhoistableHeaders, d = n.signableHeaders, p = n.signingRegion, v = n.signingService, [4, this.credentialProvider()]; case 1: return y = _e.sent(), p == null ? [3, 2] : (E = p, [3, 4]); case 2: return [4, this.regionProvider()]; case 3: E = _e.sent(), _e.label = 4; case 4: return k = E, A = sh(i), T = A.longDate, O = A.shortDate, a > I2 ? [2, Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")] : (R = pv(O, k, v ?? this.service), U = L2(Lb(e), { unhoistableHeaders: f }), y.sessionToken && (U.query[EC] = y.sessionToken), U.query[g2] = fv, U.query[v2] = y.accessKeyId + "/" + R, U.query[bC] = T, U.query[w2] = a.toString(10), j = Fb(U, l, d), U.query[y2] = Ub(j), K = U.query, ie = kC, ce = this.getSignature, H = [ T, R, this.getSigningKey(y, k, O, v) ], ye = this.createCanonicalRequest, Z = [U, j], [4, mv(e, this.sha256)]); case 5: return [4, ce.apply(this, H.concat([ye.apply(this, Z.concat([_e.sent()]))]))]; case 6: return K[ie] = _e.sent(), [2, U]; } }); }); }, t.prototype.sign = function(e, n) { return an(this, void 0, void 0, function() { return nn(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, s = n.signingDate, a = s === void 0 ? /* @__PURE__ */ new Date() : s, l = n.priorSignature, f = n.signingRegion, d = n.signingService; return an(this, void 0, void 0, function() { var p, v, y, k, E, A, T, O, R, U, j; return nn(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 = sh(a), k = y.shortDate, E = y.longDate, A = pv(k, p, d ?? this.service), [4, mv({ headers: {}, body: i }, this.sha256)]; case 4: return T = K.sent(), O = new this.sha256(), O.update(r), U = il, [4, O.digest()]; case 5: return R = U.apply(void 0, [K.sent()]), j = [ x2, E, A, l, R, T ].join(` `), [2, this.signString(j, { signingDate: a, signingRegion: p, signingService: d })]; } }); }); }, t.prototype.signString = function(e, n) { var r = n === void 0 ? {} : n, i = r.signingDate, s = i === void 0 ? /* @__PURE__ */ new Date() : i, a = r.signingRegion, l = r.signingService; return an(this, void 0, void 0, function() { var f, d, p, v, y, k, E, A; return nn(this, function(T) { switch (T.label) { case 0: return [4, this.credentialProvider()]; case 1: return f = T.sent(), a == null ? [3, 2] : (p = a, [3, 4]); case 2: return [4, this.regionProvider()]; case 3: p = T.sent(), T.label = 4; case 4: return d = p, v = sh(s).shortDate, E = (k = this.sha256).bind, [4, this.getSigningKey(f, d, v, l)]; case 5: return y = new (E.apply(k, [void 0, T.sent()]))(), y.update(e), A = il, [4, y.digest()]; case 6: return [2, A.apply(void 0, [T.sent()])]; } }); }); }, t.prototype.signRequest = function(e, n) { var r = n === void 0 ? {} : n, i = r.signingDate, s = i === void 0 ? /* @__PURE__ */ new Date() : i, a = r.signableHeaders, l = r.unsignableHeaders, f = r.signingRegion, d = r.signingService; return an(this, void 0, void 0, function() { var p, v, y, k, E, A, T, O, R, U, j; return nn(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 = Lb(e), E = sh(s), A = E.longDate, T = E.shortDate, O = pv(T, v, d ?? this.service), k.headers[CC] = A, p.sessionToken && (k.headers[k2] = p.sessionToken), [4, mv(k, this.sha256)]; case 5: return R = K.sent(), !D2(_y, k.headers) && this.applyChecksum && (k.headers[_y] = R), U = Fb(k, l, a), [4, this.getSignature(A, O, this.getSigningKey(p, v, T, d), this.createCanonicalRequest(k, U, R))]; case 6: return j = K.sent(), k.headers[AC] = fv + " " + ("Credential=" + p.accessKeyId + "/" + O + ", ") + ("SignedHeaders=" + Ub(U) + ", ") + ("Signature=" + j), [2, k]; } }); }); }, t.prototype.createCanonicalRequest = function(e, n, r) { var i = Object.keys(n).sort(); return e.method + ` ` + this.getCanonicalPath(e) + ` ` + O2(e) + ` ` + i.map(function(s) { return s + ":" + n[s]; }).join(` `) + ` ` + i.join(";") + ` ` + r; }, t.prototype.createStringToSign = function(e, n, r) { return an(this, void 0, void 0, function() { var i, s; return nn(this, function(a) { switch (a.label) { case 0: return i = new this.sha256(), i.update(r), [4, i.digest()]; case 1: return s = a.sent(), [2, fv + ` ` + e + ` ` + n + ` ` + il(s)]; } }); }); }, 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 an(this, void 0, void 0, function() { var s, a, l, f, d; return nn(this, function(p) { switch (p.label) { case 0: return [4, this.createStringToSign(e, n, i)]; case 1: return s = p.sent(), f = (l = this.sha256).bind, [4, r]; case 2: return a = new (f.apply(l, [void 0, p.sent()]))(), a.update(s), d = il, [4, a.digest()]; case 3: return [2, d.apply(void 0, [p.sent()])]; } }); }); }, t.prototype.getSigningKey = function(e, n, r, i) { return R2(this.sha256, e, r, n, i || this.service); }, t; }() ), sh = function(t) { var e = U2(t).replace(/[\-:]/g, ""); return { longDate: e, shortDate: e.substr(0, 8) }; }, Ub = function(t) { return Object.keys(t).sort().join(";"); }, j2 = function(t) { if (typeof t == "string") { var e = Promise.resolve(t); return function() { return e; }; } else return t; }, $2 = function(t) { if (typeof t == "object") { var e = Promise.resolve(t); return function() { return e; }; } else return t; }; function V2(t) { var e = this, n = t.credentials || t.credentialDefaultProvider(t), r = gv(n), i = t.signingEscapePath, s = i === void 0 ? !0 : i, a = t.systemClockOffset, l = a === void 0 ? t.systemClockOffset || 0 : a, f = t.sha256, d; return t.signer ? d = gv(t.signer) : d = function() { return gv(t.region)().then(function(p) { return an(e, void 0, void 0, function() { return nn(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], E = y.signingRegion, A = y.signingService; return t.signingRegion = t.signingRegion || E || k, t.signingName = t.signingName || A || t.serviceId, new B2({ credentials: r, region: t.signingRegion, service: t.signingName, sha256: f, uriEscapePath: s }); }); }, It(It({}, t), { systemClockOffset: l, signingEscapePath: s, credentials: r, signer: d }); } function gv(t) { if (typeof t == "object") { var e = Promise.resolve(t); return function() { return e; }; } return t; } function z2(t) { return It(It({}, t), { customUserAgent: typeof t.customUserAgent == "string" ? [[t.customUserAgent]] : t.customUserAgent }); } var vv = "user-agent", q2 = "x-amz-user-agent", Mb = " ", H2 = /[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g, K2 = function(t) { return function(e, n) { return function(r) { return an(void 0, void 0, void 0, function() { var i, s, a, l, f, d, p, v; return nn(this, function(y) { switch (y.label) { case 0: return i = r.request, ml.isInstance(i) ? (s = i.headers, a = ((p = n == null ? void 0 : n.userAgent) === null || p === void 0 ? void 0 : p.map(yv)) || [], [4, t.defaultUserAgentProvider()]) : [2, e(r)]; case 1: return l = y.sent().map(yv), f = ((v = t == null ? void 0 : t.customUserAgent) === null || v === void 0 ? void 0 : v.map(yv)) || [], s[q2] = is(l, a, f).join(Mb), d = is(l.filter(function(k) { return k.startsWith("aws-sdk-"); }), f).join(Mb), t.runtime !== "browser" && d && (s[vv] = s[vv] ? s[vv] + " " + d : d), [2, e(It(It({}, r), { request: i }))]; } }); }); }; }; }, yv = function(t) { var e = Cl(t, 2), n = e[0], r = e[1], i = n.indexOf("/"), s = n.substring(0, i), a = n.substring(i + 1); return s === "api" && (a = a.toLowerCase()), [s, a, r].filter(function(l) { return l && l.length > 0; }).map(function(l) { return l == null ? void 0 : l.replace(H2, "_"); }).join("/"); }, G2 = { name: "getUserAgentMiddleware", step: "build", priority: "low", tags: ["SET_USER_AGENT", "USER_AGENT"], override: !0 }, W2 = function(t) { return { applyToStack: function(e) { e.add(K2(t), G2); } }; }, Yh = function() { var t = [], e = [], n = /* @__PURE__ */ new Set(), r = function(p) { return p.sort(function(v, y) { return Bb[y.step] - Bb[v.step] || jb[y.priority || "normal"] - jb[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; }, s = 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; }, a = function(p) { return t.forEach(function(v) { p.add(v.middleware, It({}, v)); }), e.forEach(function(v) { p.addRelativeTo(v.middleware, It({}, 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, is(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, is(l(y))); }), v; }, f = function() { var p = [], v = [], y = {}; t.forEach(function(E) { var A = It(It({}, E), { before: [], after: [] }); A.name && (y[A.name] = A), p.push(A); }), e.forEach(function(E) { var A = It(It({}, E), { before: [], after: [] }); A.name && (y[A.name] = A), v.push(A); }), v.forEach(function(E) { if (E.toMiddleware) { var A = y[E.toMiddleware]; if (A === void 0) throw new Error(E.toMiddleware + " is not found when adding " + (E.name || "anonymous") + " middleware " + E.relation + " " + E.toMiddleware); E.relation === "after" && A.after.push(E), E.relation === "before" && A.before.push(E); } }); var k = r(p).map(l).reduce(function(E, A) { return E.push.apply(E, is(A)), E; }, []); return k.map(function(E) { return E.middleware; }); }, d = { add: function(p, v) { v === void 0 && (v = {}); var y = v.name, k = v.override, E = It({ step: "initialize", priority: "normal", middleware: p }, v); if (y) { if (n.has(y)) { if (!k) throw new Error("Duplicate middleware name '" + y + "'"); var A = t.findIndex(function(O) { return O.name === y; }), T = t[A]; if (T.step !== E.step || T.priority !== E.priority) throw new Error('"' + y + '" middleware with ' + T.priority + " priority in " + T.step + " step cannot be " + ("overridden by same-name middleware with " + E.priority + " priority in " + E.step + " step.")); t.splice(A, 1); } n.add(y); } t.push(E); }, addRelativeTo: function(p, v) { var y = v.name, k = v.override, E = It({ middleware: p }, v); if (y) { if (n.has(y)) { if (!k) throw new Error("Duplicate middleware name '" + y + "'"); var A = e.findIndex(function(O) { return O.name === y; }), T = e[A]; if (T.toMiddleware !== E.toMiddleware || T.relation !== E.relation) throw new Error('"' + y + '" middleware ' + T.relation + ' "' + T.toMiddleware + '" middleware cannot be overridden ' + ("by same-name middleware " + E.relation + ' "' + E.toMiddleware + '" middleware.')); e.splice(A, 1); } n.add(y); } e.push(E); }, clone: function() { return a(Yh()); }, use: function(p) { p.applyToStack(d); }, remove: function(p) { return typeof p == "string" ? i(p) : s(p); }, removeByTag: function(p) { var v = !1, y = function(k) { var E = k.tags, A = k.name; return E && E.includes(p) ? (A && n.delete(A), v = !0, !1) : !0; }; return t = t.filter(y), e = e.filter(y), v; }, concat: function(p) { var v = a(Yh()); return v.use(p), v; }, applyToStack: a, resolve: function(p, v) { var y, k; try { for (var E = Rr(f().reverse()), A = E.next(); !A.done; A = E.next()) { var T = A.value; p = T(p, v); } } catch (O) { y = { error: O }; } finally { try { A && !A.done && (k = E.return) && k.call(E); } finally { if (y) throw y.error; } } return p; } }; return d; }, Bb = { initialize: 5, serialize: 4, build: 3, finalizeRequest: 2, deserialize: 1 }, jb = { high: 3, normal: 2, low: 1 }, Y2 = ( /** @class */ function() { function t(e) { this.middlewareStack = Yh(), this.config = e; } return t.prototype.send = function(e, n, r) { var i = typeof n != "function" ? n : void 0, s = typeof n == "function" ? n : r, a = e.resolveMiddleware(this.middlewareStack, this.config, i); if (s) a(e).then(function(l) { return s(null, l.output); }, function(l) { return s(l); }).catch( // prevent any errors thrown in the callback from triggering an // unhandled promise rejection function() { } ); else return a(e).then(function(l) { return l.output; }); }, t.prototype.destroy = function() { this.config.requestHandler.destroy && this.config.requestHandler.destroy(); }, t; }() ), TC = ( /** @class */ /* @__PURE__ */ function() { function t() { this.middlewareStack = Yh(); } return t; }() ), Qh = function() { var t = Object.getPrototypeOf(this).constructor, e = Function.bind.apply(String, is([null], arguments)), n = new e(); return Object.setPrototypeOf(n, t.prototype), n; }; Qh.prototype = Object.create(String.prototype, { constructor: { value: Qh, enumerable: !1, writable: !0, configurable: !0 } }); Object.setPrototypeOf(Qh, String); (function(t) { Tw(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; })(Qh); var Q2 = function(t, e) { return function(n, r) { return function(i) { return an(void 0, void 0, void 0, function() { var s, a; return nn(this, function(l) { switch (l.label) { case 0: return [4, n(i)]; case 1: return s = l.sent().response, [4, e(s, t)]; case 2: return a = l.sent(), [2, { response: s, output: a }]; } }); }); }; }; }, J2 = function(t, e) { return function(n, r) { return function(i) { return an(void 0, void 0, void 0, function() { var s; return nn(this, function(a) { switch (a.label) { case 0: return [4, e(i.input, t)]; case 1: return s = a.sent(), [2, n(It(It({}, i), { request: s }))]; } }); }); }; }; }, X2 = { name: "deserializerMiddleware", step: "deserialize", tags: ["DESERIALIZER"], override: !0 }, Z2 = { name: "serializerMiddleware", step: "serialize", tags: ["SERIALIZER"], override: !0 }; function IC(t, e, n) { return { applyToStack: function(r) { r.add(Q2(t, n), X2), r.add(J2(t, e), Z2); } }; } var eL = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(p) { try { d(r.next(p)); } catch (v) { a(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { a(v); } } function d(p) { p.done ? s(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, tL = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; 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 && (s = d[0] & 2 ? i.return : d[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, d[1])).done) return s; switch (i = 0, s && (d = [d[0] & 2, s.value]), d[0]) { case 0: case 1: s = 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 (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!s || d[1] > s[0] && d[1] < s[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < s[1]) { n.label = s[1], s = d; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(d); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = s = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, ko = new Di("CognitoCredentials"), nL = new Promise(function(t, e) { if (!Bs().isBrowser) return ko.debug("not in the browser, directly resolved"), t(); var n = window.gapi && window.gapi.auth2 ? window.gapi.auth2 : null; if (n) return ko.debug("google api already loaded"), t(); setTimeout(function() { return t(); }, 2e3); }), rL = ( /** @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 eL(this, void 0, void 0, function() { return tL(this, function(e) { switch (e.label) { case 0: return this.initialized ? [3, 2] : (ko.debug("need to wait for the Google SDK loaded"), [4, nL]); case 1: e.sent(), this.initialized = !0, ko.debug("finish waiting"), e.label = 2; case 2: return [2, this._refreshGoogleTokenImpl()]; } }); }); }, t.prototype._refreshGoogleTokenImpl = function() { var e = null; return Bs().isBrowser && (e = window.gapi && window.gapi.auth2 ? window.gapi.auth2 : null), e ? new Promise(function(n, r) { e.getAuthInstance().then(function(i) { i || (ko.debug("google Auth undefined"), r(new Fa("google Auth undefined"))); var s = i.currentUser.get(); s.isSignedIn() ? (ko.debug("refreshing the google access token"), s.reloadAuthResponse().then(function(a) { var l = a.id_token, f = a.expires_at; n({ token: l, expires_at: f }); }).catch(function(a) { a && a.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) { ko.debug("Failed to refresh google token", i), r(new Fa("Failed to refresh google token")); }); }) : (ko.debug("no gapi auth2 available"), Promise.reject("no gapi auth2 available")); }, t; }() ), iL = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(p) { try { d(r.next(p)); } catch (v) { a(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { a(v); } } function d(p) { p.done ? s(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, sL = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; 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 && (s = d[0] & 2 ? i.return : d[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, d[1])).done) return s; switch (i = 0, s && (d = [d[0] & 2, s.value]), d[0]) { case 0: case 1: s = 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 (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!s || d[1] > s[0] && d[1] < s[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < s[1]) { n.label = s[1], s = d; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(d); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = s = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, Ra = new Di("CognitoCredentials"), oL = new Promise(function(t, e) { if (!Bs().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); }), aL = ( /** @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 iL(this, void 0, void 0, function() { return sL(this, function(e) { switch (e.label) { case 0: return this.initialized ? [3, 2] : (Ra.debug("need to wait for the Facebook SDK loaded"), [4, oL]); 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 (Bs().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(s) { if (!s || !s.authResponse) { var a = "no response from facebook when refreshing the jwt token"; Ra.debug(a), i(new Fa(a)); } else { var l = s.authResponse, f = l.accessToken, d = l.expiresIn, p = /* @__PURE__ */ new Date(), v = d * 1e3 + p.getTime(); if (!f) { var a = "the jwtToken is undefined"; Ra.debug(a), i(new Fa(a)); } r({ token: f, expires_at: v }); } }, { scope: "public_profile,email" }); }); }, t; }() ), uL = new rL(), lL = new aL(), ka = {}, cL = ( /** @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; }() ), RC = ( /** @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 = cL; } } return t.prototype.getStorage = function() { return this.storageWindow; }, t; }() ); const dL = "3.6.1", fL = { version: dL }; var $b = "cognito-identity.{region}.amazonaws.com", hL = "cognito-identity.{region}.amazonaws.com.cn", pL = "cognito-identity.{region}.c2s.ic.gov", mL = "cognito-identity.{region}.sc2s.sgov.gov", gL = "cognito-identity.{region}.amazonaws.com", vL = /* @__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" ]), yL = /* @__PURE__ */ new Set(["cn-north-1", "cn-northwest-1"]), wL = /* @__PURE__ */ new Set(["us-iso-east-1"]), _L = /* @__PURE__ */ new Set(["us-isob-east-1"]), SL = /* @__PURE__ */ new Set(["us-gov-east-1", "us-gov-west-1"]), bL = 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: vL.has(t) && (n = { hostname: $b.replace("{region}", t), partition: "aws" }), yL.has(t) && (n = { hostname: hL.replace("{region}", t), partition: "aws-cn" }), wL.has(t) && (n = { hostname: pL.replace("{region}", t), partition: "aws-iso" }), _L.has(t) && (n = { hostname: mL.replace("{region}", t), partition: "aws-iso-b" }), SL.has(t) && (n = { hostname: gL.replace("{region}", t), partition: "aws-us-gov" }), n === void 0 && (n = { hostname: $b.replace("{region}", t), partition: "aws" }); } return Promise.resolve(xe({ signingService: "cognito-identity" }, n)); }, Vb = { apiVersion: "2014-06-30", disableHostPrefix: !1, logger: {}, regionInfoProvider: bL, serviceId: "Cognito Identity", urlParser: t2 }, kL = xe(xe({}, Vb), { runtime: "browser", base64Decoder: vC, base64Encoder: cF, bodyLengthChecker: KF, credentialDefaultProvider: function(t) { return function() { return Promise.reject(new Error("Credential is missing")); }; }, defaultUserAgentProvider: ZF({ serviceId: Vb.serviceId, clientVersion: fL.version }), maxAttempts: Dw, region: mF("Region is missing"), requestHandler: new uF(), sha256: rF.Sha256, streamCollector: dF, utf8Decoder: dC, utf8Encoder: fC }), EL = ( /** @class */ function(t) { Rw(e, t); function e(n) { var r = this, i = xe(xe({}, kL), n), s = s2(i), a = n2(s), l = V2(a), f = qF(l), d = f, p = z2(d); return r = t.call(this, p) || this, r.config = p, r.middlewareStack.use(yF(r.config)), r.middlewareStack.use(l2(r.config)), r.middlewareStack.use(f2(r.config)), r.middlewareStack.use(m2(r.config)), r.middlewareStack.use(W2(r.config)), r; } return e.prototype.destroy = function() { t.prototype.destroy.call(this); }, e; }(Y2) ), zb; (function(t) { t.AUTHENTICATED_ROLE = "AuthenticatedRole", t.DENY = "Deny"; })(zb || (zb = {})); var qb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(qb || (qb = {})); var Hb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Hb || (Hb = {})); var Kb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Kb || (Kb = {})); var Gb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Gb || (Gb = {})); var Wb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Wb || (Wb = {})); var Yb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Yb || (Yb = {})); var Qb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Qb || (Qb = {})); var Jb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Jb || (Jb = {})); var Xb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Xb || (Xb = {})); var Zb; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Zb || (Zb = {})); var ek; (function(t) { t.ACCESS_DENIED = "AccessDenied", t.INTERNAL_SERVER_ERROR = "InternalServerError"; })(ek || (ek = {})); var tk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(tk || (tk = {})); var nk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(nk || (nk = {})); var rk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(rk || (rk = {})); var ik; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(ik || (ik = {})); var sk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(sk || (sk = {})); var ok; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(ok || (ok = {})); var ak; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(ak || (ak = {})); var uk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(uk || (uk = {})); var Sy; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Sy || (Sy = {})); var lk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(lk || (lk = {})); var by; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(by || (by = {})); var ck; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(ck || (ck = {})); var ky; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(ky || (ky = {})); var Ey; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Ey || (Ey = {})); var dk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(dk || (dk = {})); var fk; (function(t) { t.CONTAINS = "Contains", t.EQUALS = "Equals", t.NOT_EQUAL = "NotEqual", t.STARTS_WITH = "StartsWith"; })(fk || (fk = {})); var hk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(hk || (hk = {})); var pk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(pk || (pk = {})); var mk; (function(t) { t.RULES = "Rules", t.TOKEN = "Token"; })(mk || (mk = {})); var gk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(gk || (gk = {})); var vk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(vk || (vk = {})); var yk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(yk || (yk = {})); var wk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(wk || (wk = {})); var _k; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(_k || (_k = {})); var Sk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Sk || (Sk = {})); var bk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(bk || (bk = {})); var kk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(kk || (kk = {})); var Ek; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Ek || (Ek = {})); var Ak; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Ak || (Ak = {})); var Ck; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Ck || (Ck = {})); var xk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(xk || (xk = {})); var Nk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Nk || (Nk = {})); var Tk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Tk || (Tk = {})); var Ik; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Ik || (Ik = {})); var Rk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Rk || (Rk = {})); var Ok; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Ok || (Ok = {})); var Pk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Pk || (Pk = {})); var Dk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Dk || (Dk = {})); var Fk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Fk || (Fk = {})); var Lk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Lk || (Lk = {})); var Uk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Uk || (Uk = {})); var Mk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Mk || (Mk = {})); var Bk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(Bk || (Bk = {})); var jk; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })(jk || (jk = {})); var $k; (function(t) { t.filterSensitiveLog = function(e) { return xe({}, e); }; })($k || ($k = {})); var AL = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r; return or(this, function(i) { return n = { "content-type": "application/x-amz-json-1.1", "x-amz-target": "AWSCognitoIdentityService.GetCredentialsForIdentity" }, r = JSON.stringify(PL(t)), [2, jC(e, n, "/", void 0, r)]; }); }); }, CL = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r; return or(this, function(i) { return n = { "content-type": "application/x-amz-json-1.1", "x-amz-target": "AWSCognitoIdentityService.GetId" }, r = JSON.stringify(DL(t)), [2, jC(e, n, "/", void 0, r)]; }); }); }, xL = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { switch (s.label) { case 0: return t.statusCode >= 300 ? [2, NL(t, e)] : [4, Tp(t.body, e)]; case 1: return n = s.sent(), r = {}, r = UL(n), i = xe({ $metadata: Jt(t) }, r), [2, Promise.resolve(i)]; } }); }); }, NL = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i, s, a, l, f, d, p, v, y, k, E, A, T, O; return or(this, function(R) { switch (R.label) { case 0: return r = [xe({}, t)], O = {}, [4, Tp(t.body, e)]; case 1: switch (n = xe.apply(void 0, r.concat([(O.body = R.sent(), O)])), s = "UnknownError", s = $C(t, n.body), a = s, a) { 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, OC(n)]; case 3: return i = xe.apply(void 0, [xe.apply(void 0, l.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 4: return f = [{}], [4, PC(n)]; case 5: return i = xe.apply(void 0, [xe.apply(void 0, f.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 6: return d = [{}], [4, RL(n)]; case 7: return i = xe.apply(void 0, [xe.apply(void 0, d.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 8: return p = [{}], [4, DC(n)]; case 9: return i = xe.apply(void 0, [xe.apply(void 0, p.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 10: return v = [{}], [4, FC(n)]; case 11: return i = xe.apply(void 0, [xe.apply(void 0, v.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 12: return y = [{}], [4, LC(n)]; case 13: return i = xe.apply(void 0, [xe.apply(void 0, y.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 14: return k = [{}], [4, UC(n)]; case 15: return i = xe.apply(void 0, [xe.apply(void 0, k.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 16: return E = [{}], [4, MC(n)]; case 17: return i = xe.apply(void 0, [xe.apply(void 0, E.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 18: A = n.body, s = A.code || A.Code || s, i = xe(xe({}, A), { name: "" + s, message: A.message || A.Message || s, $fault: "client", $metadata: Jt(t) }), R.label = 19; case 19: return T = i.message || i.Message || s, i.message = T, delete i.Message, [2, Promise.reject(Object.assign(new Error(T), i))]; } }); }); }, TL = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { switch (s.label) { case 0: return t.statusCode >= 300 ? [2, IL(t, e)] : [4, Tp(t.body, e)]; case 1: return n = s.sent(), r = {}, r = ML(n), i = xe({ $metadata: Jt(t) }, r), [2, Promise.resolve(i)]; } }); }); }, IL = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i, s, a, l, f, d, p, v, y, k, E, A, T, O; return or(this, function(R) { switch (R.label) { case 0: return r = [xe({}, t)], O = {}, [4, Tp(t.body, e)]; case 1: switch (n = xe.apply(void 0, r.concat([(O.body = R.sent(), O)])), s = "UnknownError", s = $C(t, n.body), a = s, a) { 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, OC(n)]; case 3: return i = xe.apply(void 0, [xe.apply(void 0, l.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 4: return f = [{}], [4, PC(n)]; case 5: return i = xe.apply(void 0, [xe.apply(void 0, f.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 6: return d = [{}], [4, DC(n)]; case 7: return i = xe.apply(void 0, [xe.apply(void 0, d.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 8: return p = [{}], [4, OL(n)]; case 9: return i = xe.apply(void 0, [xe.apply(void 0, p.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 10: return v = [{}], [4, FC(n)]; case 11: return i = xe.apply(void 0, [xe.apply(void 0, v.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 12: return y = [{}], [4, LC(n)]; case 13: return i = xe.apply(void 0, [xe.apply(void 0, y.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 14: return k = [{}], [4, UC(n)]; case 15: return i = xe.apply(void 0, [xe.apply(void 0, k.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 16: return E = [{}], [4, MC(n)]; case 17: return i = xe.apply(void 0, [xe.apply(void 0, E.concat([R.sent()])), { name: s, $metadata: Jt(t) }]), [3, 19]; case 18: A = n.body, s = A.code || A.Code || s, i = xe(xe({}, A), { name: "" + s, message: A.message || A.Message || s, $fault: "client", $metadata: Jt(t) }), R.label = 19; case 19: return T = i.message || i.Message || s, i.message = T, delete i.Message, [2, Promise.reject(Object.assign(new Error(T), i))]; } }); }); }, OC = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { return n = t.body, r = LL(n), i = xe({ name: "ExternalServiceException", $fault: "client", $metadata: Jt(t) }, r), [2, i]; }); }); }, PC = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { return n = t.body, r = BL(n), i = xe({ name: "InternalErrorException", $fault: "server", $metadata: Jt(t) }, r), [2, i]; }); }); }, RL = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { return n = t.body, r = jL(n), i = xe({ name: "InvalidIdentityPoolConfigurationException", $fault: "client", $metadata: Jt(t) }, r), [2, i]; }); }); }, DC = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { return n = t.body, r = $L(n), i = xe({ name: "InvalidParameterException", $fault: "client", $metadata: Jt(t) }, r), [2, i]; }); }); }, OL = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { return n = t.body, r = VL(n), i = xe({ name: "LimitExceededException", $fault: "client", $metadata: Jt(t) }, r), [2, i]; }); }); }, FC = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { return n = t.body, r = zL(n), i = xe({ name: "NotAuthorizedException", $fault: "client", $metadata: Jt(t) }, r), [2, i]; }); }); }, LC = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { return n = t.body, r = qL(n), i = xe({ name: "ResourceConflictException", $fault: "client", $metadata: Jt(t) }, r), [2, i]; }); }); }, UC = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { return n = t.body, r = HL(n), i = xe({ name: "ResourceNotFoundException", $fault: "client", $metadata: Jt(t) }, r), [2, i]; }); }); }, MC = function(t, e) { return sr(void 0, void 0, void 0, function() { var n, r, i; return or(this, function(s) { return n = t.body, r = KL(n), i = xe({ name: "TooManyRequestsException", $fault: "client", $metadata: Jt(t) }, r), [2, i]; }); }); }, PL = function(t, e) { return xe(xe(xe({}, 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: BC(t.Logins) }); }, DL = function(t, e) { return xe(xe(xe({}, 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: BC(t.Logins) }); }, BC = function(t, e) { return Object.entries(t).reduce(function(n, r) { var i, s = SD(r, 2), a = s[0], l = s[1]; return l === null ? n : xe(xe({}, n), (i = {}, i[a] = l, i)); }, {}); }, FL = 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 }; }, LL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, UL = function(t, e) { return { Credentials: t.Credentials !== void 0 && t.Credentials !== null ? FL(t.Credentials) : void 0, IdentityId: t.IdentityId !== void 0 && t.IdentityId !== null ? t.IdentityId : void 0 }; }, ML = function(t, e) { return { IdentityId: t.IdentityId !== void 0 && t.IdentityId !== null ? t.IdentityId : void 0 }; }, BL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, jL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, $L = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, VL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, zL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, qL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, HL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, KL = function(t, e) { return { message: t.message !== void 0 && t.message !== null ? t.message : void 0 }; }, Jt = 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"] }; }, GL = function(t, e) { return t === void 0 && (t = new Uint8Array()), t instanceof Uint8Array ? Promise.resolve(t) : e.streamCollector(t) || Promise.resolve(new Uint8Array()); }, WL = function(t, e) { return GL(t, e).then(function(n) { return e.utf8Encoder(n); }); }, jC = function(t, e, n, r, i) { return sr(void 0, void 0, void 0, function() { var s, a, l, f, d, p; return or(this, function(v) { switch (v.label) { case 0: return [4, t.endpoint()]; case 1: return s = v.sent(), a = s.hostname, l = s.protocol, f = l === void 0 ? "https" : l, d = s.port, p = { protocol: f, hostname: a, port: d, method: "POST", path: n, headers: e }, i !== void 0 && (p.body = i), [2, new ml(p)]; } }); }); }, Tp = function(t, e) { return WL(t, e).then(function(n) { return n.length ? JSON.parse(n) : {}; }); }, $C = function(t, e) { var n = function(s, a) { return Object.keys(s).find(function(l) { return l.toLowerCase() === a.toLowerCase(); }); }, r = function(s) { var a = s; return a.indexOf(":") >= 0 && (a = a.split(":")[0]), a.indexOf("#") >= 0 && (a = a.split("#")[1]), a; }, 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) : ""; }, Ay = ( /** @class */ function(t) { Rw(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(IC(r, this.serialize, this.deserialize)); var s = n.concat(this.middlewareStack), a = r.logger, l = "CognitoIdentityClient", f = "GetCredentialsForIdentityCommand", d = { logger: a, clientName: l, commandName: f, inputFilterSensitiveLog: Sy.filterSensitiveLog, outputFilterSensitiveLog: by.filterSensitiveLog }, p = r.requestHandler; return s.resolve(function(v) { return p.handle(v.request, i || {}); }, d); }, e.prototype.serialize = function(n, r) { return AL(n, r); }, e.prototype.deserialize = function(n, r) { return xL(n, r); }, e; }(TC) ), nd = ( /** @class */ function(t) { Rw(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(IC(r, this.serialize, this.deserialize)); var s = n.concat(this.middlewareStack), a = r.logger, l = "CognitoIdentityClient", f = "GetIdCommand", d = { logger: a, clientName: l, commandName: f, inputFilterSensitiveLog: ky.filterSensitiveLog, outputFilterSensitiveLog: Ey.filterSensitiveLog }, p = r.requestHandler; return s.resolve(function(v) { return p.handle(v.request, i || {}); }, d); }, e.prototype.serialize = function(n, r) { return CL(n, r); }, e.prototype.deserialize = function(n, r) { return TL(n, r); }, e; }(TC) ), Ip = ( /** @class */ function(t) { Tw(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 VC(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), s = i[0], a = i[1]; return n[s] = a, n; }, {}); }); } function Yc(t) { var e = this; return function() { return an(e, void 0, void 0, function() { var n, r, i, s, a, l, f, d, p, v, y, k, E; return nn(this, function(A) { switch (A.label) { case 0: return v = (p = t.client).send, y = Ay.bind, E = { CustomRoleArn: t.customRoleArn, IdentityId: t.identityId }, t.logins ? [4, VC(t.logins)] : [3, 2]; case 1: return k = A.sent(), [3, 3]; case 2: k = void 0, A.label = 3; case 3: return [4, v.apply(p, [new (y.apply(Ay, [void 0, (E.Logins = k, E)]))()])]; case 4: return n = A.sent().Credentials, r = n === void 0 ? QL() : n, i = r.AccessKeyId, s = i === void 0 ? YL() : i, a = r.Expiration, l = r.SecretKey, f = l === void 0 ? JL() : l, d = r.SessionToken, [2, { identityId: t.identityId, accessKeyId: s, secretAccessKey: f, sessionToken: d, expiration: a }]; } }); }); }; } function YL() { throw new Ip("Response from Amazon Cognito contained no access key ID"); } function QL() { throw new Ip("Response from Amazon Cognito contained no credentials"); } function JL() { throw new Ip("Response from Amazon Cognito contained no secret key"); } var wv = "IdentityIds", XL = ( /** @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, s) { r.onerror = function() { return s(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(s, a) { i.onerror = function() { return a(i.error); }, i.onsuccess = function() { return s(); }; }); }); }, 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(wv, { keyPath: "id" }); }; }); }, t.prototype.withObjectStore = function(e, n) { return this.getDb().then(function(r) { var i = r.transaction(wv, e); return i.oncomplete = function() { return r.close(); }, new Promise(function(s, a) { i.onerror = function() { return a(i.error); }, s(n(i.objectStore(wv))); }).catch(function(s) { throw r.close(), s; }); }); }, t; }() ), ZL = ( /** @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; }() ), eU = new ZL(); function tU() { return typeof self == "object" && self.indexedDB ? new XL() : typeof window == "object" && window.localStorage ? window.localStorage : eU; } function nU(t) { var e = this, n = t.accountId, r = t.cache, i = r === void 0 ? tU() : r, s = t.client, a = 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 an(e, void 0, void 0, function() { var k, E, A, T, O, R, U, j, K; return nn(this, function(ie) { switch (ie.label) { case 0: return E = v, E ? [4, i.getItem(v)] : [3, 2]; case 1: E = ie.sent(), ie.label = 2; case 2: return k = E, k ? [3, 7] : (R = (O = s).send, U = nd.bind, K = { AccountId: n, IdentityPoolId: l }, f ? [4, VC(f)] : [3, 4]); case 3: return j = ie.sent(), [3, 5]; case 4: j = void 0, ie.label = 5; case 5: return [4, R.apply(O, [new (U.apply(nd, [void 0, (K.Logins = j, K)]))()])]; case 6: A = ie.sent().IdentityId, T = A === void 0 ? rU() : A, k = T, v && Promise.resolve(i.setItem(v, k)).catch(function() { }), ie.label = 7; case 7: return y = Yc({ client: s, customRoleArn: a, logins: f, identityId: k }), [2, y()]; } }); }); }; return function() { return y().catch(function(k) { return an(e, void 0, void 0, function() { return nn(this, function(E) { throw v && Promise.resolve(i.removeItem(v)).catch(function() { }), k; }); }); }); }; } function rU() { throw new Ip("Response from Amazon Cognito contained no identity ID"); } var Eo = function() { return Eo = 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; }, Eo.apply(this, arguments); }; function _v(t) { var e = new EL({ region: t.region, customUserAgent: UP() }); return e.middlewareStack.add(function(n, r) { return function(i) { return n(iU(i)); }; }, { step: "build", name: "cacheControlMiddleWare" }), e; } function iU(t) { return Eo(Eo({}, t), { request: Eo(Eo({}, t.request), { headers: Eo(Eo({}, t.request.headers), { "cache-control": "no-store" }) }) }); } var Jh = function() { return Jh = 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; }, Jh.apply(this, arguments); }, Sr = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(p) { try { d(r.next(p)); } catch (v) { a(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { a(v); } } function d(p) { p.done ? s(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, br = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; 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 && (s = d[0] & 2 ? i.return : d[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, d[1])).done) return s; switch (i = 0, s && (d = [d[0] & 2, s.value]), d[0]) { case 0: case 1: s = 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 (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!s || d[1] > s[0] && d[1] < s[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < s[1]) { n.label = s[1], s = d; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(d); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = s = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, Dt = new Di("Credentials"), sU = 50 * 60 * 1e3, oU = "CognitoIdentityId-", aU = ( /** @class */ function() { function t(e) { this._gettingCredPromise = null, this._refreshHandlers = {}, this.Auth = void 0, this.configure(e), this._refreshHandlers.google = uL.refreshGoogleToken, this._refreshHandlers.facebook = lL.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 = Jh(Jh({}, this._refreshHandlers), n)), this._storage = this._config.storage, this._storage || (this._storage = new RC().getStorage()), this._storageSync = Promise.resolve(), typeof this._storage.sync == "function" && (this._storageSync = this._storage.sync()), this._config; }, t.prototype.get = function() { return Dt.debug("getting credentials"), this._pickupCredentials(); }, t.prototype._getCognitoIdentityIdStorageKey = function(e) { return "" + oU + e; }, t.prototype._pickupCredentials = function() { return Dt.debug("picking up credentials"), !this._gettingCredPromise || !this._gettingCredPromise.isPending() ? (Dt.debug("getting new cred promise"), this._gettingCredPromise = $P(this._keepAlive())) : Dt.debug("getting old cred promise"), this._gettingCredPromise; }, t.prototype._keepAlive = function() { return Sr(this, void 0, void 0, function() { var e, n, r, i, s, a, l, f; return br(this, function(d) { switch (d.label) { case 0: if (Dt.debug("checking if credentials exists and not expired"), e = this._credentials, e && !this._isExpired(e) && !this._isPastTTL()) return Dt.debug("credentials not changed and not expired, directly return"), [2, Promise.resolve(e)]; if (Dt.debug("need to get a new credential or refresh the existing one"), n = this.Auth, r = n === void 0 ? Nw.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]; Dt.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 s = d.sent(), a = s.refreshToken, l = new Promise(function(p, v) { i.refreshSession(a, function(y, k) { return y ? v(y) : p(k); }); }), [4, l]; case 4: return d.sent(), [3, 6]; case 5: return f = d.sent(), Dt.debug("Error attempting to refreshing the session", f), [3, 6]; case 6: return [2, r.currentUserCredentials()]; } }); }); }, t.prototype.refreshFederatedToken = function(e) { Dt.debug("Getting federated credentials"); var n = e.provider, r = e.user, i = e.token, s = e.identity_id, a = e.expires_at; a = new Date(a).getFullYear() === 1970 ? a * 1e3 : a; var l = this; return Dt.debug("checking if federated jwt token expired"), a > (/* @__PURE__ */ new Date()).getTime() ? (Dt.debug("token not expired"), this._setCredentialsFromFederation({ provider: n, token: i, user: r, identity_id: s, expires_at: a })) : l._refreshHandlers[n] && typeof l._refreshHandlers[n] == "function" ? (Dt.debug("getting refreshed jwt token from federation provider"), this._providerRefreshWithRetry({ refreshHandler: l._refreshHandlers[n], provider: n, user: r })) : (Dt.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, s = e.user, a = 10 * 1e3; return mD(r, [], a).then(function(l) { return Dt.debug("refresh federated token sucessfully", l), n._setCredentialsFromFederation({ provider: i, token: l.token, user: s, 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(), Dt.debug("refresh federated token failed", l), Promise.reject("refreshing federation token failed: " + l); }); }, t.prototype._isExpired = function(e) { if (!e) return Dt.debug("no credentials for expiration check"), !0; Dt.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 Sr(this, void 0, void 0, function() { var e, n, r, i, s, a, l, f, d, p, v = this; return br(this, function(y) { switch (y.label) { case 0: return Dt.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 ? (a = this, [4, this._getGuestIdentityId()]) : (Dt.debug("region is not configured for getting the credentials"), [2, Promise.reject("region is not configured for getting the credentials")]) : (Dt.debug("No Cognito Identity pool provided for unauthenticated access"), [2, Promise.reject("No Cognito Identity pool provided for unauthenticated access")]); case 1: return s = a._identityId = y.sent(), l = _v({ region: r }), f = void 0, s ? (d = { identityId: s, client: l }, f = Yc(d)()) : (p = function() { return Sr(v, void 0, void 0, function() { var k, E, A; return br(this, function(T) { switch (T.label) { case 0: return [4, l.send(new nd({ IdentityPoolId: n }))]; case 1: return k = T.sent().IdentityId, this._identityId = k, E = { client: l, identityId: k }, A = Yc(E), [2, A()]; } }); }); }, f = p().catch(function(k) { return Sr(v, void 0, void 0, function() { return br(this, function(E) { throw k; }); }); })), [2, this._loadCredentials(f, "guest", !1, null).then(function(k) { return k; }).catch(function(k) { return Sr(v, void 0, void 0, function() { var E, A = this; return br(this, function(T) { switch (T.label) { case 0: return k.name === "ResourceNotFoundException" && k.message === "Identity '" + s + "' not found." ? (Dt.debug("Failed to load guest credentials"), [4, this._removeGuestIdentityId()]) : [3, 2]; case 1: return T.sent(), E = function() { return Sr(A, void 0, void 0, function() { var O, R, U; return br(this, function(j) { switch (j.label) { case 0: return [4, l.send(new nd({ IdentityPoolId: n }))]; case 1: return O = j.sent().IdentityId, this._identityId = O, R = { client: l, identityId: O }, U = Yc(R), [2, U()]; } }); }); }, f = E().catch(function(O) { return Sr(A, void 0, void 0, function() { return br(this, function(R) { throw O; }); }); }), [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, s = { google: "accounts.google.com", facebook: "graph.facebook.com", amazon: "www.amazon.com", developer: "cognito-identity.amazonaws.com" }, a = s[n] || n; if (!a) return Promise.reject("You must specify a federated provider"); var l = {}; l[a] = r; var f = this._config, d = f.identityPoolId, p = f.region; if (!d) return Dt.debug("No Cognito Federated Identity pool provided"), Promise.reject("No Cognito Federated Identity pool provided"); if (!p) return Dt.debug("region is not configured for getting the credentials"), Promise.reject("region is not configured for getting the credentials"); var v = _v({ region: p }), y = void 0; if (i) { var k = { identityId: i, logins: l, client: v }; y = Yc(k)(); } else { var k = { logins: l, identityPoolId: d, client: v }; y = nU(k)(); } return this._loadCredentials(y, "federated", !0, e); }, t.prototype._setCredentialsFromSession = function(e) { var n = this; Dt.debug("set credentials from session"); var r = e.getIdToken().getJwtToken(), i = this._config, s = i.region, a = i.userPoolId, l = i.identityPoolId; if (!l) return Dt.debug("No Cognito Federated Identity pool provided"), Promise.reject("No Cognito Federated Identity pool provided"); if (!s) return Dt.debug("region is not configured for getting the credentials"), Promise.reject("region is not configured for getting the credentials"); var f = "cognito-idp." + s + ".amazonaws.com/" + a, d = {}; d[f] = r; var p = _v({ region: s }), v = function() { return Sr(n, void 0, void 0, function() { var k, E, A, T, O, R, U, j, K, ie; return br(this, function(ce) { switch (ce.label) { case 0: return [4, this._getGuestIdentityId()]; case 1: return k = ce.sent(), k ? [3, 3] : [4, p.send(new nd({ IdentityPoolId: l, Logins: d }))]; case 2: A = ce.sent().IdentityId, E = A, ce.label = 3; case 3: return [4, p.send(new Ay({ IdentityId: k || E, Logins: d }))]; case 4: return T = ce.sent(), O = T.Credentials, R = O.AccessKeyId, U = O.Expiration, j = O.SecretKey, K = O.SessionToken, ie = T.IdentityId, this._identityId = ie, k ? (Dt.debug("The guest identity " + k + " has been successfully linked to the logins"), k === ie && Dt.debug("The guest identity " + k + " has become the primary identity"), [4, this._removeGuestIdentityId()]) : [3, 6]; case 5: ce.sent(), ce.label = 6; case 6: return [2, { accessKeyId: R, secretAccessKey: j, sessionToken: K, expiration: U, identityId: ie }]; } }); }); }, y = v().catch(function(k) { return Sr(n, void 0, void 0, function() { return br(this, function(E) { throw k; }); }); }); return this._loadCredentials(y, "userPool", !0, null); }, t.prototype._loadCredentials = function(e, n, r, i) { var s = this, a = this; return new Promise(function(l, f) { e.then(function(d) { return Sr(s, void 0, void 0, function() { var p, v, y, k, E; return br(this, function(A) { switch (A.label) { case 0: if (Dt.debug("Load credentials successfully", d), this._identityId && !d.identityId && (d.identityId = this._identityId), a._credentials = d, a._credentials.authenticated = r, a._credentials_source = n, a._nextCredentialsRefresh = (/* @__PURE__ */ new Date()).getTime() + sU, n === "federated") { p = Object.assign({ id: this._credentials.identityId }, i.user), v = i.provider, y = i.token, k = i.expires_at, E = i.identity_id; try { this._storage.setItem("aws-amplify-federatedInfo", JSON.stringify({ provider: v, token: y, user: p, expires_at: k, identity_id: E })); } catch (T) { Dt.debug("Failed to put federated info into auth storage", T); } } return n !== "guest" ? [3, 2] : [4, this._setGuestIdentityId(d.identityId)]; case 1: A.sent(), A.label = 2; case 2: return l(a._credentials), [ 2 /*return*/ ]; } }); }); }).catch(function(d) { if (d) { Dt.debug("Failed to load credentials", e), Dt.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() : (Dt.debug("no source specified for setting credentials"), Promise.reject("invalid source")); }, t.prototype.clear = function() { return Sr(this, void 0, void 0, function() { return br(this, function(e) { return this._credentials = null, this._credentials_source = null, Dt.debug("removing aws-amplify-federatedInfo from storage"), this._storage.removeItem("aws-amplify-federatedInfo"), [ 2 /*return*/ ]; }); }); }, t.prototype._getGuestIdentityId = function() { return Sr(this, void 0, void 0, function() { var e, n; return br(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(), Dt.debug("Failed to get the cached guest identityId", n), [3, 4]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype._setGuestIdentityId = function(e) { return Sr(this, void 0, void 0, function() { var n, r; return br(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(), Dt.debug("Failed to cache guest identityId", r), [3, 4]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype._removeGuestIdentityId = function() { return Sr(this, void 0, void 0, function() { var e; return br(this, function(n) { return e = this._config.identityPoolId, Dt.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; }() ), zC = new aU(null); Nw.register(zC); var oh = {}; /*! * cookie * Copyright(c) 2012-2014 Roman Shtylman * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed */ var Vk; function uU() { if (Vk) return oh; Vk = 1, oh.parse = r, oh.serialize = i; var t = decodeURIComponent, e = encodeURIComponent, n = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; function r(a, l) { if (typeof a != "string") throw new TypeError("argument str must be a string"); for (var f = {}, d = l || {}, p = a.split(";"), v = d.decode || t, y = 0; y < p.length; y++) { var k = p[y], E = k.indexOf("="); if (!(E < 0)) { var A = k.substring(0, E).trim(); if (f[A] == null) { var T = k.substring(E + 1, k.length).trim(); T[0] === '"' && (T = T.slice(1, -1)), f[A] = s(T, v); } } } return f; } function i(a, l, f) { var d = f || {}, p = d.encode || e; if (typeof p != "function") throw new TypeError("option encode is invalid"); if (!n.test(a)) 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 = a + "=" + 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 E = typeof d.sameSite == "string" ? d.sameSite.toLowerCase() : d.sameSite; switch (E) { 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 s(a, l) { try { return l(a); } catch { return a; } } return oh; } var wh = uU(); function lU() { return typeof document == "object" && typeof document.cookie == "string"; } function cU(t, e) { return typeof t == "string" ? wh.parse(t, e) : typeof t == "object" && t !== null ? t : {}; } function dU(t, e) { return typeof e > "u" && (e = !t || t[0] !== "{" && t[0] !== "[" && t[0] !== '"'), !e; } function zk(t, e) { e === void 0 && (e = {}); var n = fU(t); if (dU(n, e.doNotParse)) try { return JSON.parse(n); } catch { } return t; } function fU(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); }, Sv = ( /** @class */ function() { function t(e, n) { var r = this; this.changeListeners = [], this.HAS_DOCUMENT_COOKIE = !1, this.cookies = cU(e, n), new Promise(function() { r.HAS_DOCUMENT_COOKIE = lU(); }).catch(function() { }); } return t.prototype._updateBrowserValues = function(e) { this.HAS_DOCUMENT_COOKIE && (this.cookies = wh.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), zk(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] = zk(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 = wh.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 = wh.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; }() ), qk = Bs().isBrowser, hU = ( /** @class */ function() { function t(e) { e === void 0 && (e = {}), this.cookies = new Sv(), this.store = qk ? window.localStorage : /* @__PURE__ */ Object.create(null), this.cookies = e.req ? new Sv(e.req.headers.cookie) : new Sv(), 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": qk ? 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; }() ), Xh; (function(t) { t.Cognito = "COGNITO", t.Google = "Google", t.Facebook = "Facebook", t.Amazon = "LoginWithAmazon", t.Apple = "SignInWithApple"; })(Xh || (Xh = {})); function bv(t) { var e = ["provider"]; return t && !!e.find(function(n) { return t.hasOwnProperty(n); }); } function pU(t) { var e = ["customProvider"]; return t && !!e.find(function(n) { return t.hasOwnProperty(n); }); } function mU(t) { var e = ["customState"]; return t && !!e.find(function(n) { return t.hasOwnProperty(n); }); } function Ua(t) { return t.redirectSignIn !== void 0; } var Wt; (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"; })(Wt || (Wt = {})); function gU(t) { return !!t.username; } var Hk; (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"; })(Hk || (Hk = {})); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Kk = /* @__PURE__ */ function() { function t(n) { var r = n || {}, i = r.ValidationData, s = r.Username, a = r.Password, l = r.AuthParameters, f = r.ClientMetadata; this.validationData = i || {}, this.authParameters = l || {}, this.clientMetadata = f || {}, this.username = s, this.password = a; } 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; }(), kv = {}, Bc = {}, Gk; function vU() { if (Gk) return Bc; Gk = 1, Bc.byteLength = l, Bc.toByteArray = d, Bc.fromByteArray = y; for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = 0, s = r.length; i < s; ++i) t[i] = r[i], e[r.charCodeAt(i)] = i; e[45] = 62, e[95] = 63; function a(k) { var E = k.length; if (E % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); var A = k.indexOf("="); A === -1 && (A = E); var T = A === E ? 0 : 4 - A % 4; return [A, T]; } function l(k) { var E = a(k), A = E[0], T = E[1]; return (A + T) * 3 / 4 - T; } function f(k, E, A) { return (E + A) * 3 / 4 - A; } function d(k) { var E, A = a(k), T = A[0], O = A[1], R = new n(f(k, T, O)), U = 0, j = O > 0 ? T - 4 : T, K; for (K = 0; K < j; K += 4) E = e[k.charCodeAt(K)] << 18 | e[k.charCodeAt(K + 1)] << 12 | e[k.charCodeAt(K + 2)] << 6 | e[k.charCodeAt(K + 3)], R[U++] = E >> 16 & 255, R[U++] = E >> 8 & 255, R[U++] = E & 255; return O === 2 && (E = e[k.charCodeAt(K)] << 2 | e[k.charCodeAt(K + 1)] >> 4, R[U++] = E & 255), O === 1 && (E = e[k.charCodeAt(K)] << 10 | e[k.charCodeAt(K + 1)] << 4 | e[k.charCodeAt(K + 2)] >> 2, R[U++] = E >> 8 & 255, R[U++] = E & 255), R; } function p(k) { return t[k >> 18 & 63] + t[k >> 12 & 63] + t[k >> 6 & 63] + t[k & 63]; } function v(k, E, A) { for (var T, O = [], R = E; R < A; R += 3) T = (k[R] << 16 & 16711680) + (k[R + 1] << 8 & 65280) + (k[R + 2] & 255), O.push(p(T)); return O.join(""); } function y(k) { for (var E, A = k.length, T = A % 3, O = [], R = 16383, U = 0, j = A - T; U < j; U += R) O.push(v(k, U, U + R > j ? j : U + R)); return T === 1 ? (E = k[A - 1], O.push( t[E >> 2] + t[E << 4 & 63] + "==" )) : T === 2 && (E = (k[A - 2] << 8) + k[A - 1], O.push( t[E >> 10] + t[E >> 4 & 63] + t[E << 2 & 63] + "=" )), O.join(""); } return Bc; } var ah = {}; /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ var Wk; function yU() { return Wk || (Wk = 1, ah.read = function(t, e, n, r, i) { var s, a, 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, s = k & (1 << -p) - 1, k >>= -p, p += l; p > 0; s = s * 256 + t[e + v], v += y, p -= 8) ; for (a = s & (1 << -p) - 1, s >>= -p, p += r; p > 0; a = a * 256 + t[e + v], v += y, p -= 8) ; if (s === 0) s = 1 - d; else { if (s === f) return a ? NaN : (k ? -1 : 1) * (1 / 0); a = a + Math.pow(2, r), s = s - d; } return (k ? -1 : 1) * a * Math.pow(2, s - r); }, ah.write = function(t, e, n, r, i, s) { var a, l, f, d = s * 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 : s - 1, E = r ? 1 : -1, A = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0; for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, a = p) : (a = Math.floor(Math.log(e) / Math.LN2), e * (f = Math.pow(2, -a)) < 1 && (a--, f *= 2), a + v >= 1 ? e += y / f : e += y * Math.pow(2, 1 - v), e * f >= 2 && (a++, f /= 2), a + v >= p ? (l = 0, a = p) : a + v >= 1 ? (l = (e * f - 1) * Math.pow(2, i), a = a + v) : (l = e * Math.pow(2, v - 1) * Math.pow(2, i), a = 0)); i >= 8; t[n + k] = l & 255, k += E, l /= 256, i -= 8) ; for (a = a << i | l, d += i; d > 0; t[n + k] = a & 255, k += E, a /= 256, d -= 8) ; t[n + k - E] |= A * 128; }), ah; } var Ev, Yk; function wU() { if (Yk) return Ev; Yk = 1; var t = {}.toString; return Ev = Array.isArray || function(e) { return t.call(e) == "[object Array]"; }, Ev; } /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var Qk; function _U() { return Qk || (Qk = 1, function(t) { var e = vU(), n = yU(), r = wU(); t.Buffer = l, t.SlowBuffer = O, t.INSPECT_MAX_BYTES = 50, l.TYPED_ARRAY_SUPPORT = Oo.TYPED_ARRAY_SUPPORT !== void 0 ? Oo.TYPED_ARRAY_SUPPORT : i(), t.kMaxLength = s(); function i() { try { var D = new Uint8Array(1); return D.__proto__ = { __proto__: Uint8Array.prototype, foo: function() { return 42; } }, D.foo() === 42 && // typed array instances can be augmented typeof D.subarray == "function" && // chrome 9-10 lack `subarray` D.subarray(1, 1).byteLength === 0; } catch { return !1; } } function s() { return l.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823; } function a(D, x) { if (s() < x) throw new RangeError("Invalid typed array length"); return l.TYPED_ARRAY_SUPPORT ? (D = new Uint8Array(x), D.__proto__ = l.prototype) : (D === null && (D = new l(x)), D.length = x), D; } function l(D, x, b) { if (!l.TYPED_ARRAY_SUPPORT && !(this instanceof l)) return new l(D, x, b); if (typeof D == "number") { if (typeof x == "string") throw new Error( "If encoding is specified then the first argument must be a string" ); return v(this, D); } return f(this, D, x, b); } l.poolSize = 8192, l._augment = function(D) { return D.__proto__ = l.prototype, D; }; function f(D, x, b, F) { if (typeof x == "number") throw new TypeError('"value" argument must not be a number'); return typeof ArrayBuffer < "u" && x instanceof ArrayBuffer ? E(D, x, b, F) : typeof x == "string" ? y(D, x, b) : A(D, x); } l.from = function(D, x, b) { return f(null, D, 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(D) { if (typeof D != "number") throw new TypeError('"size" argument must be a number'); if (D < 0) throw new RangeError('"size" argument must not be negative'); } function p(D, x, b, F) { return d(x), x <= 0 ? a(D, x) : b !== void 0 ? typeof F == "string" ? a(D, x).fill(b, F) : a(D, x).fill(b) : a(D, x); } l.alloc = function(D, x, b) { return p(null, D, x, b); }; function v(D, x) { if (d(x), D = a(D, x < 0 ? 0 : T(x) | 0), !l.TYPED_ARRAY_SUPPORT) for (var b = 0; b < x; ++b) D[b] = 0; return D; } l.allocUnsafe = function(D) { return v(null, D); }, l.allocUnsafeSlow = function(D) { return v(null, D); }; function y(D, 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; D = a(D, F); var ee = D.write(x, b); return ee !== F && (D = D.slice(0, ee)), D; } function k(D, x) { var b = x.length < 0 ? 0 : T(x.length) | 0; D = a(D, b); for (var F = 0; F < b; F += 1) D[F] = x[F] & 255; return D; } function E(D, 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 ? (D = x, D.__proto__ = l.prototype) : D = k(D, x), D; } function A(D, x) { if (l.isBuffer(x)) { var b = T(x.length) | 0; return D = a(D, b), D.length === 0 || x.copy(D, 0, 0, b), D; } if (x) { if (typeof ArrayBuffer < "u" && x.buffer instanceof ArrayBuffer || "length" in x) return typeof x.length != "number" || Bt(x.length) ? a(D, 0) : k(D, x); if (x.type === "Buffer" && r(x.data)) return k(D, x.data); } throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object."); } function T(D) { if (D >= s()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + s().toString(16) + " bytes"); return D | 0; } function O(D) { return +D != D && (D = 0), l.alloc(+D); } 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, be = 0, Ce = Math.min(F, ee); be < Ce; ++be) if (x[be] !== b[be]) { F = x[be], ee = b[be]; 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), be = 0; for (F = 0; F < x.length; ++F) { var Ce = x[F]; if (!l.isBuffer(Ce)) throw new TypeError('"list" argument must be an Array of Buffers'); Ce.copy(ee, be), be += Ce.length; } return ee; }; function R(D, x) { if (l.isBuffer(D)) return D.length; if (typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" && (ArrayBuffer.isView(D) || D instanceof ArrayBuffer)) return D.byteLength; typeof D != "string" && (D = "" + D); var b = D.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 Xe(D).length; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return b * 2; case "hex": return b >>> 1; case "base64": return et(D).length; default: if (F) return Xe(D).length; x = ("" + x).toLowerCase(), F = !0; } } l.byteLength = R; function U(D, 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 (D || (D = "utf8"); ; ) switch (D) { case "hex": return Ae(this, x, b); case "utf8": case "utf-8": return ft(this, x, b); case "ascii": return pe(this, x, b); case "latin1": case "binary": return de(this, x, b); case "base64": return st(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: " + D); D = (D + "").toLowerCase(), F = !0; } } l.prototype._isBuffer = !0; function j(D, x, b) { var F = D[x]; D[x] = D[b], D[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 ? ft(this, 0, x) : U.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, be) { 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), be === void 0 && (be = this.length), b < 0 || F > x.length || ee < 0 || be > this.length) throw new RangeError("out of range index"); if (ee >= be && b >= F) return 0; if (ee >= be) return -1; if (b >= F) return 1; if (b >>>= 0, F >>>= 0, ee >>>= 0, be >>>= 0, this === x) return 0; for (var Ce = be - ee, bt = F - b, Ct = Math.min(Ce, bt), Lt = this.slice(ee, be), fn = x.slice(b, F), Ht = 0; Ht < Ct; ++Ht) if (Lt[Ht] !== fn[Ht]) { Ce = Lt[Ht], bt = fn[Ht]; break; } return Ce < bt ? -1 : bt < Ce ? 1 : 0; }; function K(D, x, b, F, ee) { if (D.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 : D.length - 1), b < 0 && (b = D.length + b), b >= D.length) { if (ee) return -1; b = D.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 : ie(D, 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(D, x, b) : Uint8Array.prototype.lastIndexOf.call(D, x, b) : ie(D, [x], b, F, ee); throw new TypeError("val must be string, number or Buffer"); } function ie(D, x, b, F, ee) { var be = 1, Ce = D.length, bt = x.length; if (F !== void 0 && (F = String(F).toLowerCase(), F === "ucs2" || F === "ucs-2" || F === "utf16le" || F === "utf-16le")) { if (D.length < 2 || x.length < 2) return -1; be = 2, Ce /= 2, bt /= 2, b /= 2; } function Ct(Or, Gr) { return be === 1 ? Or[Gr] : Or.readUInt16BE(Gr * be); } var Lt; if (ee) { var fn = -1; for (Lt = b; Lt < Ce; Lt++) if (Ct(D, Lt) === Ct(x, fn === -1 ? 0 : Lt - fn)) { if (fn === -1 && (fn = Lt), Lt - fn + 1 === bt) return fn * be; } else fn !== -1 && (Lt -= Lt - fn), fn = -1; } else for (b + bt > Ce && (b = Ce - bt), Lt = b; Lt >= 0; Lt--) { for (var Ht = !0, hr = 0; hr < bt; hr++) if (Ct(D, Lt + hr) !== Ct(x, hr)) { Ht = !1; break; } if (Ht) return Lt; } 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 ce(D, x, b, F) { b = Number(b) || 0; var ee = D.length - b; F ? (F = Number(F), F > ee && (F = ee)) : F = ee; var be = x.length; if (be % 2 !== 0) throw new TypeError("Invalid hex string"); F > be / 2 && (F = be / 2); for (var Ce = 0; Ce < F; ++Ce) { var bt = parseInt(x.substr(Ce * 2, 2), 16); if (isNaN(bt)) return Ce; D[b + Ce] = bt; } return Ce; } function H(D, x, b, F) { return Ft(Xe(x, D.length - b), D, b, F); } function ye(D, x, b, F) { return Ft(Rt(x), D, b, F); } function Z(D, x, b, F) { return ye(D, x, b, F); } function _e(D, x, b, F) { return Ft(et(x), D, b, F); } function qe(D, x, b, F) { return Ft(Ot(x, D.length - b), D, 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 be = this.length - b; if ((F === void 0 || F > be) && (F = be), x.length > 0 && (F < 0 || b < 0) || b > this.length) throw new RangeError("Attempt to write outside buffer bounds"); ee || (ee = "utf8"); for (var Ce = !1; ; ) switch (ee) { case "hex": return ce(this, x, b, F); case "utf8": case "utf-8": return H(this, x, b, F); case "ascii": return ye(this, x, b, F); case "latin1": case "binary": return Z(this, x, b, F); case "base64": return _e(this, x, b, F); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return qe(this, x, b, F); default: if (Ce) throw new TypeError("Unknown encoding: " + ee); ee = ("" + ee).toLowerCase(), Ce = !0; } }, l.prototype.toJSON = function() { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) }; }; function st(D, x, b) { return x === 0 && b === D.length ? e.fromByteArray(D) : e.fromByteArray(D.slice(x, b)); } function ft(D, x, b) { b = Math.min(D.length, b); for (var F = [], ee = x; ee < b; ) { var be = D[ee], Ce = null, bt = be > 239 ? 4 : be > 223 ? 3 : be > 191 ? 2 : 1; if (ee + bt <= b) { var Ct, Lt, fn, Ht; switch (bt) { case 1: be < 128 && (Ce = be); break; case 2: Ct = D[ee + 1], (Ct & 192) === 128 && (Ht = (be & 31) << 6 | Ct & 63, Ht > 127 && (Ce = Ht)); break; case 3: Ct = D[ee + 1], Lt = D[ee + 2], (Ct & 192) === 128 && (Lt & 192) === 128 && (Ht = (be & 15) << 12 | (Ct & 63) << 6 | Lt & 63, Ht > 2047 && (Ht < 55296 || Ht > 57343) && (Ce = Ht)); break; case 4: Ct = D[ee + 1], Lt = D[ee + 2], fn = D[ee + 3], (Ct & 192) === 128 && (Lt & 192) === 128 && (fn & 192) === 128 && (Ht = (be & 15) << 18 | (Ct & 63) << 12 | (Lt & 63) << 6 | fn & 63, Ht > 65535 && Ht < 1114112 && (Ce = Ht)); } } Ce === null ? (Ce = 65533, bt = 1) : Ce > 65535 && (Ce -= 65536, F.push(Ce >>> 10 & 1023 | 55296), Ce = 56320 | Ce & 1023), F.push(Ce), ee += bt; } return ke(F); } var ue = 4096; function ke(D) { var x = D.length; if (x <= ue) return String.fromCharCode.apply(String, D); for (var b = "", F = 0; F < x; ) b += String.fromCharCode.apply( String, D.slice(F, F += ue) ); return b; } function pe(D, x, b) { var F = ""; b = Math.min(D.length, b); for (var ee = x; ee < b; ++ee) F += String.fromCharCode(D[ee] & 127); return F; } function de(D, x, b) { var F = ""; b = Math.min(D.length, b); for (var ee = x; ee < b; ++ee) F += String.fromCharCode(D[ee]); return F; } function Ae(D, x, b) { var F = D.length; (!x || x < 0) && (x = 0), (!b || b < 0 || b > F) && (b = F); for (var ee = "", be = x; be < b; ++be) ee += ht(D[be]); return ee; } function B(D, x, b) { for (var F = D.slice(x, b), ee = "", be = 0; be < F.length; be += 2) ee += String.fromCharCode(F[be] + F[be + 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 be = b - x; ee = new l(be, void 0); for (var Ce = 0; Ce < be; ++Ce) ee[Ce] = this[Ce + x]; } return ee; }; function M(D, x, b) { if (D % 1 !== 0 || D < 0) throw new RangeError("offset is not uint"); if (D + 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], be = 1, Ce = 0; ++Ce < b && (be *= 256); ) ee += this[x + Ce] * be; 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], be = 1; b > 0 && (be *= 256); ) ee += this[x + --b] * be; 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], be = 1, Ce = 0; ++Ce < b && (be *= 256); ) ee += this[x + Ce] * be; return be *= 128, ee >= be && (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, be = 1, Ce = this[x + --ee]; ee > 0 && (be *= 256); ) Ce += this[x + --ee] * be; return be *= 128, Ce >= be && (Ce -= Math.pow(2, 8 * b)), Ce; }, 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(D, x, b, F, ee, be) { if (!l.isBuffer(D)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (x > ee || x < be) throw new RangeError('"value" argument is out of bounds'); if (b + F > D.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 be = Math.pow(2, 8 * F) - 1; te(this, x, b, F, be, 0); } var Ce = 1, bt = 0; for (this[b] = x & 255; ++bt < F && (Ce *= 256); ) this[b + bt] = x / Ce & 255; return b + F; }, l.prototype.writeUIntBE = function(x, b, F, ee) { if (x = +x, b = b | 0, F = F | 0, !ee) { var be = Math.pow(2, 8 * F) - 1; te(this, x, b, F, be, 0); } var Ce = F - 1, bt = 1; for (this[b + Ce] = x & 255; --Ce >= 0 && (bt *= 256); ) this[b + Ce] = x / bt & 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 Ie(D, x, b, F) { x < 0 && (x = 65535 + x + 1); for (var ee = 0, be = Math.min(D.length - b, 2); ee < be; ++ee) D[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) : Ie(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) : Ie(this, x, b, !1), b + 2; }; function $(D, x, b, F) { x < 0 && (x = 4294967295 + x + 1); for (var ee = 0, be = Math.min(D.length - b, 4); ee < be; ++ee) D[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 be = Math.pow(2, 8 * F - 1); te(this, x, b, F, be - 1, -be); } var Ce = 0, bt = 1, Ct = 0; for (this[b] = x & 255; ++Ce < F && (bt *= 256); ) x < 0 && Ct === 0 && this[b + Ce - 1] !== 0 && (Ct = 1), this[b + Ce] = (x / bt >> 0) - Ct & 255; return b + F; }, l.prototype.writeIntBE = function(x, b, F, ee) { if (x = +x, b = b | 0, !ee) { var be = Math.pow(2, 8 * F - 1); te(this, x, b, F, be - 1, -be); } var Ce = F - 1, bt = 1, Ct = 0; for (this[b + Ce] = x & 255; --Ce >= 0 && (bt *= 256); ) x < 0 && Ct === 0 && this[b + Ce + 1] !== 0 && (Ct = 1), this[b + Ce] = (x / bt >> 0) - Ct & 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) : Ie(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) : Ie(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(D, x, b, F, ee, be) { if (b + F > D.length) throw new RangeError("Index out of range"); if (b < 0) throw new RangeError("Index out of range"); } function Qe(D, x, b, F, ee) { return ee || Q(D, x, b, 4), n.write(D, x, b, F, 23, 4), b + 4; } l.prototype.writeFloatLE = function(x, b, F) { return Qe(this, x, b, !0, F); }, l.prototype.writeFloatBE = function(x, b, F) { return Qe(this, x, b, !1, F); }; function Re(D, x, b, F, ee) { return ee || Q(D, x, b, 8), n.write(D, x, b, F, 52, 8), b + 8; } l.prototype.writeDoubleLE = function(x, b, F) { return Re(this, x, b, !0, F); }, l.prototype.writeDoubleBE = function(x, b, F) { return Re(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 be = ee - F, Ce; if (this === x && F < b && b < ee) for (Ce = be - 1; Ce >= 0; --Ce) x[Ce + b] = this[Ce + F]; else if (be < 1e3 || !l.TYPED_ARRAY_SUPPORT) for (Ce = 0; Ce < be; ++Ce) x[Ce + b] = this[Ce + F]; else Uint8Array.prototype.set.call( x, this.subarray(F, F + be), b ); return be; }, 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 be = x.charCodeAt(0); be < 256 && (x = be); } 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 Ce; if (typeof x == "number") for (Ce = b; Ce < F; ++Ce) this[Ce] = x; else { var bt = l.isBuffer(x) ? x : Xe(new l(x, ee).toString()), Ct = bt.length; for (Ce = 0; Ce < F - b; ++Ce) this[Ce + b] = bt[Ce % Ct]; } return this; }; var We = /[^+\/0-9A-Za-z-_]/g; function Oe(D) { if (D = pt(D).replace(We, ""), D.length < 2) return ""; for (; D.length % 4 !== 0; ) D = D + "="; return D; } function pt(D) { return D.trim ? D.trim() : D.replace(/^\s+|\s+$/g, ""); } function ht(D) { return D < 16 ? "0" + D.toString(16) : D.toString(16); } function Xe(D, x) { x = x || 1 / 0; for (var b, F = D.length, ee = null, be = [], Ce = 0; Ce < F; ++Ce) { if (b = D.charCodeAt(Ce), b > 55295 && b < 57344) { if (!ee) { if (b > 56319) { (x -= 3) > -1 && be.push(239, 191, 189); continue; } else if (Ce + 1 === F) { (x -= 3) > -1 && be.push(239, 191, 189); continue; } ee = b; continue; } if (b < 56320) { (x -= 3) > -1 && be.push(239, 191, 189), ee = b; continue; } b = (ee - 55296 << 10 | b - 56320) + 65536; } else ee && (x -= 3) > -1 && be.push(239, 191, 189); if (ee = null, b < 128) { if ((x -= 1) < 0) break; be.push(b); } else if (b < 2048) { if ((x -= 2) < 0) break; be.push( b >> 6 | 192, b & 63 | 128 ); } else if (b < 65536) { if ((x -= 3) < 0) break; be.push( b >> 12 | 224, b >> 6 & 63 | 128, b & 63 | 128 ); } else if (b < 1114112) { if ((x -= 4) < 0) break; be.push( b >> 18 | 240, b >> 12 & 63 | 128, b >> 6 & 63 | 128, b & 63 | 128 ); } else throw new Error("Invalid code point"); } return be; } function Rt(D) { for (var x = [], b = 0; b < D.length; ++b) x.push(D.charCodeAt(b) & 255); return x; } function Ot(D, x) { for (var b, F, ee, be = [], Ce = 0; Ce < D.length && !((x -= 2) < 0); ++Ce) b = D.charCodeAt(Ce), F = b >> 8, ee = b % 256, be.push(ee), be.push(F); return be; } function et(D) { return e.toByteArray(Oe(D)); } function Ft(D, x, b, F) { for (var ee = 0; ee < F && !(ee + b >= x.length || ee >= D.length); ++ee) x[ee + b] = D[ee]; return ee; } function Bt(D) { return D !== D; } }(kv)), kv; } var ln = _U(); function SU(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 _h = { exports: {} }; const bU = {}, kU = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: bU }, Symbol.toStringTag, { value: "Module" })), EU = /* @__PURE__ */ wl(kU); var AU = _h.exports, Jk; function Tl() { return Jk || (Jk = 1, function(t, e) { (function(n, r) { t.exports = r(); })(AU, function() { var n = n || function(r, i) { var s; if (typeof window < "u" && window.crypto && (s = window.crypto), typeof self < "u" && self.crypto && (s = self.crypto), typeof globalThis < "u" && globalThis.crypto && (s = globalThis.crypto), !s && typeof window < "u" && window.msCrypto && (s = window.msCrypto), !s && typeof Oo < "u" && Oo.crypto && (s = Oo.crypto), !s && typeof SU == "function") try { s = EU; } catch { } var a = function() { if (s) { if (typeof s.getRandomValues == "function") try { return s.getRandomValues(new Uint32Array(1))[0]; } catch { } if (typeof s.randomBytes == "function") try { return s.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(U) { var j; return R.prototype = U, 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 U = l(this); return R && U.mixIn(R), (!U.hasOwnProperty("init") || this.init === U.init) && (U.init = function() { U.$super.init.apply(this, arguments); }), U.init.prototype = U, U.$super = this, U; }, /** * 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 U in R) R.hasOwnProperty(U) && (this[U] = R[U]); 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, U) { R = this.words = R || [], U != i ? this.sigBytes = U : 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 U = this.words, j = R.words, K = this.sigBytes, ie = R.sigBytes; if (this.clamp(), K % 4) for (var ce = 0; ce < ie; ce++) { var H = j[ce >>> 2] >>> 24 - ce % 4 * 8 & 255; U[K + ce >>> 2] |= H << 24 - (K + ce) % 4 * 8; } else for (var ye = 0; ye < ie; ye += 4) U[K + ye >>> 2] = j[ye >>> 2]; return this.sigBytes += ie, this; }, /** * Removes insignificant bits. * * @example * * wordArray.clamp(); */ clamp: function() { var R = this.words, U = this.sigBytes; R[U >>> 2] &= 4294967295 << 32 - U % 4 * 8, R.length = r.ceil(U / 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 U = [], j = 0; j < R; j += 4) U.push(a()); return new v.init(U, 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 U = R.words, j = R.sigBytes, K = [], ie = 0; ie < j; ie++) { var ce = U[ie >>> 2] >>> 24 - ie % 4 * 8 & 255; K.push((ce >>> 4).toString(16)), K.push((ce & 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 U = R.length, j = [], K = 0; K < U; K += 2) j[K >>> 3] |= parseInt(R.substr(K, 2), 16) << 24 - K % 8 * 4; return new v.init(j, U / 2); } }, E = 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 U = R.words, j = R.sigBytes, K = [], ie = 0; ie < j; ie++) { var ce = U[ie >>> 2] >>> 24 - ie % 4 * 8 & 255; K.push(String.fromCharCode(ce)); } 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 U = R.length, j = [], K = 0; K < U; K++) j[K >>> 2] |= (R.charCodeAt(K) & 255) << 24 - K % 4 * 8; return new v.init(j, U); } }, A = 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(E.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 E.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 = A.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 U, j = this._data, K = j.words, ie = j.sigBytes, ce = this.blockSize, H = ce * 4, ye = ie / H; R ? ye = r.ceil(ye) : ye = r.max((ye | 0) - this._minBufferSize, 0); var Z = ye * ce, _e = r.min(Z * 4, ie); if (Z) { for (var qe = 0; qe < Z; qe += ce) this._doProcessBlock(K, qe); U = K.splice(0, Z), j.sigBytes -= _e; } return new v.init(U, _e); }, /** * 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 U = this._doFinalize(); return U; }, 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(U, j) { return new R.init(j).finalize(U); }; }, /** * 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(U, j) { return new O.HMAC.init(R, j).finalize(U); }; } }); var O = f.algo = {}; return f; }(Math); return n; }); }(_h)), _h.exports; } var CU = Tl(); const Ro = /* @__PURE__ */ Bo(CU); var Sh = { exports: {} }, xU = Sh.exports, Xk; function NU() { return Xk || (Xk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(xU, function(n) { return function() { if (typeof ArrayBuffer == "function") { var r = n, i = r.lib, s = i.WordArray, a = s.init, l = s.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; a.call(this, p, d); } else a.apply(this, arguments); }; l.prototype = s; } }(), n.lib.WordArray; }); }(Sh)), Sh.exports; } NU(); var bh = { exports: {} }, TU = bh.exports, Zk; function qC() { return Zk || (Zk = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(TU, function(n) { return function(r) { var i = n, s = i.lib, a = s.WordArray, l = s.Hasher, f = i.algo, d = [], p = []; (function() { function k(O) { for (var R = r.sqrt(O), U = 2; U <= R; U++) if (!(O % U)) return !1; return !0; } function E(O) { return (O - (O | 0)) * 4294967296 | 0; } for (var A = 2, T = 0; T < 64; ) k(A) && (T < 8 && (d[T] = E(r.pow(A, 1 / 2))), p[T] = E(r.pow(A, 1 / 3)), T++), A++; })(); var v = [], y = f.SHA256 = l.extend({ _doReset: function() { this._hash = new a.init(d.slice(0)); }, _doProcessBlock: function(k, E) { for (var A = this._hash.words, T = A[0], O = A[1], R = A[2], U = A[3], j = A[4], K = A[5], ie = A[6], ce = A[7], H = 0; H < 64; H++) { if (H < 16) v[H] = k[E + H] | 0; else { var ye = v[H - 15], Z = (ye << 25 | ye >>> 7) ^ (ye << 14 | ye >>> 18) ^ ye >>> 3, _e = v[H - 2], qe = (_e << 15 | _e >>> 17) ^ (_e << 13 | _e >>> 19) ^ _e >>> 10; v[H] = Z + v[H - 7] + qe + v[H - 16]; } var st = j & K ^ ~j & ie, ft = T & O ^ T & R ^ O & R, ue = (T << 30 | T >>> 2) ^ (T << 19 | T >>> 13) ^ (T << 10 | T >>> 22), ke = (j << 26 | j >>> 6) ^ (j << 21 | j >>> 11) ^ (j << 7 | j >>> 25), pe = ce + ke + st + p[H] + v[H], de = ue + ft; ce = ie, ie = K, K = j, j = U + pe | 0, U = R, R = O, O = T, T = pe + de | 0; } A[0] = A[0] + T | 0, A[1] = A[1] + O | 0, A[2] = A[2] + R | 0, A[3] = A[3] + U | 0, A[4] = A[4] + j | 0, A[5] = A[5] + K | 0, A[6] = A[6] + ie | 0, A[7] = A[7] + ce | 0; }, _doFinalize: function() { var k = this._data, E = k.words, A = this._nDataBytes * 8, T = k.sigBytes * 8; return E[T >>> 5] |= 128 << 24 - T % 32, E[(T + 64 >>> 9 << 4) + 14] = r.floor(A / 4294967296), E[(T + 64 >>> 9 << 4) + 15] = A, k.sigBytes = E.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; }); }(bh)), bh.exports; } var IU = qC(); const HC = /* @__PURE__ */ Bo(IU); var kh = { exports: {} }, Eh = { exports: {} }, RU = Eh.exports, eE; function OU() { return eE || (eE = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(RU, function(n) { (function() { var r = n, i = r.lib, s = i.Base, a = r.enc, l = a.Utf8, f = r.algo; f.HMAC = s.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(), E = this._iKey = p.clone(), A = k.words, T = E.words, O = 0; O < v; O++) A[O] ^= 1549556828, T[O] ^= 909522486; k.sigBytes = E.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; } }); })(); }); }(Eh)), Eh.exports; } var PU = kh.exports, tE; function DU() { return tE || (tE = 1, function(t, e) { (function(n, r, i) { t.exports = r(Tl(), qC(), OU()); })(PU, function(n) { return n.HmacSHA256; }); }(kh)), kh.exports; } var FU = DU(); const Zh = /* @__PURE__ */ Bo(FU); var si; typeof window < "u" && window.crypto && (si = window.crypto); !si && typeof window < "u" && window.msCrypto && (si = window.msCrypto); !si && typeof global < "u" && global.crypto && (si = global.crypto); if (!si && typeof require == "function") try { si = require("crypto"); } catch { } function LU() { if (si) { if (typeof si.getRandomValues == "function") try { return si.getRandomValues(new Uint32Array(1))[0]; } catch { } if (typeof si.randomBytes == "function") try { return si.randomBytes(4).readInt32LE(); } catch { } } throw new Error("Native crypto module could not be used to get secure random number."); } function UU(t) { for (var e = t.words, n = t.sigBytes, r = [], i = 0; i < n; i++) { var s = e[i >>> 2] >>> 24 - i % 4 * 8 & 255; r.push((s >>> 4).toString(16)), r.push((s & 15).toString(16)); } return r.join(""); } var MU = /* @__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 = [], s = 0; s < r; s += 4) i.push(LU()); return new t(i, r); }, e.toString = function() { return UU(this); }, t; }(); function ot(t, e) { t != null && this.fromString(t, e); } function fr() { return new ot(null); } var Do, BU = 244837814094590, nE = (BU & 16777215) == 15715070; function jU(t, e, n, r, i, s) { for (; --s >= 0; ) { var a = e * this[t++] + n[r] + i; i = Math.floor(a / 67108864), n[r++] = a & 67108863; } return i; } function $U(t, e, n, r, i, s) { for (var a = e & 32767, l = e >> 15; --s >= 0; ) { var f = this[t] & 32767, d = this[t++] >> 15, p = l * f + d * a; f = a * f + ((p & 32767) << 15) + n[r] + (i & 1073741823), i = (f >>> 30) + (p >>> 15) + l * d + (i >>> 30), n[r++] = f & 1073741823; } return i; } function VU(t, e, n, r, i, s) { for (var a = e & 16383, l = e >> 14; --s >= 0; ) { var f = this[t] & 16383, d = this[t++] >> 14, p = l * f + d * a; f = a * f + ((p & 16383) << 14) + n[r] + i, i = (f >> 28) + (p >> 14) + l * d, n[r++] = f & 268435455; } return i; } var rE = typeof navigator < "u"; rE && nE && navigator.appName == "Microsoft Internet Explorer" ? (ot.prototype.am = $U, Do = 30) : rE && nE && navigator.appName != "Netscape" ? (ot.prototype.am = jU, Do = 26) : (ot.prototype.am = VU, Do = 28); ot.prototype.DB = Do; ot.prototype.DM = (1 << Do) - 1; ot.prototype.DV = 1 << Do; var Fw = 52; ot.prototype.FV = Math.pow(2, Fw); ot.prototype.F1 = Fw - Do; ot.prototype.F2 = 2 * Do - Fw; var zU = "0123456789abcdefghijklmnopqrstuvwxyz", Rp = new Array(), Il, ui; Il = 48; for (ui = 0; ui <= 9; ++ui) Rp[Il++] = ui; Il = 97; for (ui = 10; ui < 36; ++ui) Rp[Il++] = ui; Il = 65; for (ui = 10; ui < 36; ++ui) Rp[Il++] = ui; function iE(t) { return zU.charAt(t); } function qU(t, e) { var n = Rp[t.charCodeAt(e)]; return n ?? -1; } function HU(t) { for (var e = this.t - 1; e >= 0; --e) t[e] = this[e]; t.t = this.t, t.s = this.s; } function KU(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 Lw(t) { var e = fr(); return e.fromInt(t), e; } function GU(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, s = 0; --r >= 0; ) { var a = qU(t, r); if (a < 0) { t.charAt(r) == "-" && (i = !0); continue; } i = !1, s == 0 ? this[this.t++] = a : s + n > this.DB ? (this[this.t - 1] |= (a & (1 << this.DB - s) - 1) << s, this[this.t++] = a >> this.DB - s) : this[this.t - 1] |= a << s, s += n, s >= this.DB && (s -= this.DB); } this.clamp(), i && ot.ZERO.subTo(this, this); } function WU() { for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; ) --this.t; } function YU(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, s = "", a = this.t, l = this.DB - a * this.DB % e; if (a-- > 0) for (l < this.DB && (r = this[a] >> l) > 0 && (i = !0, s = iE(r)); a >= 0; ) l < e ? (r = (this[a] & (1 << l) - 1) << e - l, r |= this[--a] >> (l += this.DB - e)) : (r = this[a] >> (l -= e) & n, l <= 0 && (l += this.DB, --a)), r > 0 && (i = !0), i && (s += iE(r)); return i ? s : "0"; } function QU() { var t = fr(); return ot.ZERO.subTo(this, t), t; } function JU() { return this.s < 0 ? this.negate() : this; } function XU(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 Uw(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 ZU() { return this.t <= 0 ? 0 : this.DB * (this.t - 1) + Uw(this[this.t - 1] ^ this.s & this.DM); } function eM(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 tM(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 nM(t, e) { var n = t % this.DB, r = this.DB - n, i = (1 << r) - 1, s = Math.floor(t / this.DB), a = this.s << n & this.DM, l; for (l = this.t - 1; l >= 0; --l) e[l + s + 1] = this[l] >> r | a, a = (this[l] & i) << n; for (l = s - 1; l >= 0; --l) e[l] = 0; e[s] = a, e.t = this.t + s + 1, e.s = this.s, e.clamp(); } function rM(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, s = (1 << r) - 1; e[0] = this[n] >> r; for (var a = n + 1; a < this.t; ++a) e[a - n - 1] |= (this[a] & s) << i, e[a - n] = this[a] >> r; r > 0 && (e[this.t - n - 1] |= (this.s & s) << i), e.t = this.t - n, e.clamp(); } function iM(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 sM(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 oM(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 aM(t, e, n) { var r = t.abs(); if (!(r.t <= 0)) { var i = this.abs(); if (i.t < r.t) { e != null && e.fromInt(0), n != null && this.copyTo(n); return; } n == null && (n = fr()); var s = fr(), a = this.s, l = t.s, f = this.DB - Uw(r[r.t - 1]); f > 0 ? (r.lShiftTo(f, s), i.lShiftTo(f, n)) : (r.copyTo(s), i.copyTo(n)); var d = s.t, p = s[d - 1]; if (p != 0) { var v = p * (1 << this.F1) + (d > 1 ? s[d - 2] >> this.F2 : 0), y = this.FV / v, k = (1 << this.F1) / v, E = 1 << this.F2, A = n.t, T = A - d, O = e ?? fr(); for (s.dlShiftTo(T, O), n.compareTo(O) >= 0 && (n[n.t++] = 1, n.subTo(O, n)), ot.ONE.dlShiftTo(d, O), O.subTo(s, s); s.t < d; ) s[s.t++] = 0; for (; --T >= 0; ) { var R = n[--A] == p ? this.DM : Math.floor(n[A] * y + (n[A - 1] + E) * k); if ((n[A] += s.am(0, R, n, T, 0, d)) < R) for (s.dlShiftTo(T, O), n.subTo(O, n); n[A] < --R; ) n.subTo(O, n); } e != null && (n.drShiftTo(d, e), a != l && ot.ZERO.subTo(e, e)), n.t = d, n.clamp(), f > 0 && n.rShiftTo(f, n), a < 0 && ot.ZERO.subTo(n, n); } } } function uM(t) { var e = fr(); return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(ot.ZERO) > 0 && t.subTo(e, e), e; } function lM() { if (this.t < 1) return 0; var t = this[0]; if (!(t & 1)) 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 cM(t) { return this.compareTo(t) == 0; } function dM(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 fM(t) { var e = fr(); return this.addTo(t, e), e; } function hM(t) { var e = fr(); return this.subTo(t, e), e; } function pM(t) { var e = fr(); return this.multiplyTo(t, e), e; } function mM(t) { var e = fr(); 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 gM(t) { var e = fr(); 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 vM(t) { var e = fr(); return t.copyTo(e), this.reduce(e), e; } function yM(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 wM(t, e) { t.squareTo(e), this.reduce(e); } function _M(t, e, n) { t.multiplyTo(e, n), this.reduce(n); } Rl.prototype.convert = gM; Rl.prototype.revert = vM; Rl.prototype.reduce = yM; Rl.prototype.mulTo = _M; Rl.prototype.sqrTo = wM; function SM(t, e, n) { var r = t.bitLength(), i, s = Lw(1), a = new Rl(e); if (r <= 0) return s; 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] = a.convert(this), i > 1) { var v = fr(); for (a.sqrTo(l[1], v); f <= p; ) l[f] = fr(), a.mulTo(v, l[f - 2], l[f]), f += 2; } var y = t.t - 1, k, E = !0, A = fr(), T; for (r = Uw(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); ) k >>= 1, --f; if ((r -= f) < 0 && (r += this.DB, --y), E) l[k].copyTo(s), E = !1; else { for (; f > 1; ) a.sqrTo(s, A), a.sqrTo(A, s), f -= 2; f > 0 ? a.sqrTo(s, A) : (T = s, s = A, A = T), a.mulTo(A, l[k], s); } for (; y >= 0 && !(t[y] & 1 << r); ) a.sqrTo(s, A), T = s, s = A, A = T, --r < 0 && (r = this.DB - 1, --y); } var O = a.revert(s); return n(null, O), O; } ot.prototype.copyTo = HU; ot.prototype.fromInt = KU; ot.prototype.fromString = GU; ot.prototype.clamp = WU; ot.prototype.dlShiftTo = eM; ot.prototype.drShiftTo = tM; ot.prototype.lShiftTo = nM; ot.prototype.rShiftTo = rM; ot.prototype.subTo = iM; ot.prototype.multiplyTo = sM; ot.prototype.squareTo = oM; ot.prototype.divRemTo = aM; ot.prototype.invDigit = lM; ot.prototype.addTo = dM; ot.prototype.toString = YU; ot.prototype.negate = QU; ot.prototype.abs = JU; ot.prototype.compareTo = XU; ot.prototype.bitLength = ZU; ot.prototype.mod = uM; ot.prototype.equals = cM; ot.prototype.add = fM; ot.prototype.subtract = hM; ot.prototype.multiply = pM; ot.prototype.divide = mM; ot.prototype.modPow = SM; ot.ZERO = Lw(0); ot.ONE = Lw(1); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ function Av(t) { return ln.Buffer.from(new MU().random(t).toString(), "hex"); } var bM = /^[89a-f]/i, kM = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF", EM = "userAttributes.", Ku = /* @__PURE__ */ function() { function t(n) { this.N = new ot(kM, 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(s, a) { s && r(s, null), i.largeAValue = a, r(null, i.largeAValue); }); }, e.generateRandomSmallA = function() { var r = Av(128).toString("hex"), i = new ot(r, 16); return i; }, e.generateRandomString = function() { return Av(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, s) { var a = this; this.randomPassword = this.generateRandomString(); var l = "" + r + i + ":" + this.randomPassword, f = this.hash(l), d = Av(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 && s(p, null), a.verifierDevices = a.padHex(v), s(null, null); }); }, e.calculateA = function(r, i) { var s = this; this.g.modPow(r, this.N, function(a, l) { a && i(a, null), l.mod(s.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 s = new ot(this.UHexHash, 16); return s; }, e.hash = function(r) { var i = r instanceof ln.Buffer ? Ro.lib.WordArray.create(r) : r, s = HC(i).toString(); return new Array(64 - s.length).join("0") + s; }, e.hexHash = function(r) { return this.hash(ln.Buffer.from(r, "hex")); }, e.computehkdf = function(r, i) { var s = Ro.lib.WordArray.create(ln.Buffer.concat([this.infoBits, ln.Buffer.from("", "utf8")])), a = r instanceof ln.Buffer ? Ro.lib.WordArray.create(r) : r, l = i instanceof ln.Buffer ? Ro.lib.WordArray.create(i) : i, f = Zh(a, l), d = Zh(s, f); return ln.Buffer.from(d.toString(), "hex").slice(0, 16); }, e.getPasswordAuthenticationKey = function(r, i, s, a, l) { var f = this; if (s.mod(this.N).equals(ot.ZERO)) throw new Error("B cannot be zero."); if (this.UValue = this.calculateU(this.largeAValue, s), 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(a) + p), 16); this.calculateS(v, s, function(y, k) { y && l(y, null); var E = f.computehkdf(ln.Buffer.from(f.padHex(k), "hex"), ln.Buffer.from(f.padHex(f.UValue), "hex")); l(null, E); }); }, e.calculateS = function(r, i, s) { var a = this; this.g.modPow(r, this.N, function(l, f) { l && s(l, null); var d = i.subtract(a.k.multiply(f)); d.modPow(a.smallAValue.add(a.UValue.multiply(r)), a.N, function(p, v) { p && s(p, null), s(null, v.mod(a.N)); }); }); }, e.getNewPasswordRequiredChallengeUserAttributePrefix = function() { return EM; }, e.padHex = function(r) { if (!(r instanceof ot)) throw new Error("Not a BigInteger"); var i = r.compareTo(ot.ZERO) < 0, s = r.abs().toString(16); if (s = s.length % 2 !== 0 ? "0" + s : s, s = bM.test(s) ? "00" + s : s, i) { var a = s.split("").map(function(f) { var d = ~parseInt(f, 16) & 15; return "0123456789ABCDEF".charAt(d); }).join(""), l = new ot(a, 16).add(ot.ONE); s = l.toString(16), s.toUpperCase().startsWith("FF8") && (s = s.substring(2)); } return s; }, t; }(); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var KC = /* @__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 AM(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Cy(t, e); } function Cy(t, e) { return Cy = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, Cy(t, e); } var xy = /* @__PURE__ */ function(t) { AM(e, t); function e(n) { var r = n === void 0 ? {} : n, i = r.AccessToken; return t.call(this, i || "") || this; } return e; }(KC); function CM(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Ny(t, e); } function Ny(t, e) { return Ny = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, Ny(t, e); } var Ty = /* @__PURE__ */ function(t) { CM(e, t); function e(n) { var r = n === void 0 ? {} : n, i = r.IdToken; return t.call(this, i || "") || this; } return e; }(KC); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Iy = /* @__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; }(), Ah = { exports: {} }, xM = Ah.exports, sE; function NM() { return sE || (sE = 1, function(t, e) { (function(n, r) { t.exports = r(Tl()); })(xM, function(n) { return function() { var r = n, i = r.lib, s = i.WordArray, a = r.enc; a.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 E = d[k >>> 2] >>> 24 - k % 4 * 8 & 255, A = d[k + 1 >>> 2] >>> 24 - (k + 1) % 4 * 8 & 255, T = d[k + 2 >>> 2] >>> 24 - (k + 2) % 4 * 8 & 255, O = E << 16 | A << 8 | T, R = 0; R < 4 && k + R * 0.75 < p; R++) y.push(v.charAt(O >>> 6 * (3 - R) & 63)); var U = v.charAt(64); if (U) for (; y.length % 4; ) y.push(U); 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 E = f.indexOf(k); E !== -1 && (d = E); } 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 E = p[f.charCodeAt(k - 1)] << k % 4 * 2, A = p[f.charCodeAt(k)] >>> 6 - k % 4 * 2, T = E | A; v[y >>> 2] |= T << 24 - y % 4 * 8, y++; } return s.create(v, y); } }(), n.enc.Base64; }); }(Ah)), Ah.exports; } var TM = NM(); const Ry = /* @__PURE__ */ Bo(TM); /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Oy = /* @__PURE__ */ function() { function t(n) { var r = n === void 0 ? {} : n, i = r.IdToken, s = r.RefreshToken, a = r.AccessToken, l = r.ClockDrift; if (a == null || i == null) throw new Error("Id token and Access Token must be present."); this.idToken = i, this.refreshToken = s, this.accessToken = a, 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 IM = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], RM = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], oE = /* @__PURE__ */ function() { function t() { } var e = t.prototype; return e.getNowString = function() { var r = /* @__PURE__ */ new Date(), i = RM[r.getUTCDay()], s = IM[r.getUTCMonth()], a = 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 + " " + s + " " + a + " " + 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, s = r.Value; this.Name = i || "", this.Value = s || ""; } 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 = {}, OM = /* @__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; }(), GC = /* @__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 = OM; } } 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 PM = typeof navigator < "u", aE = PM ? navigator.userAgent : "nodejs", Py = /* @__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 GC().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 s = this, a = r.getAuthParameters(); a.USERNAME = this.username; var l = Object.keys(r.getValidationData()).length !== 0 ? r.getValidationData() : r.getClientMetadata(), f = { AuthFlow: "CUSTOM_AUTH", ClientId: this.pool.getClientId(), AuthParameters: a, 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" ? (s.Session = p.Session, i.customChallenge(y)) : (s.signInUserSession = s.getCognitoUserSession(p.AuthenticationResult), s.cacheTokens(), i.onSuccess(s.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 s = this, a = new Ku(this.pool.getUserPoolName()), l = new oE(), f, d, p = {}; this.deviceKey != null && (p.DEVICE_KEY = this.deviceKey), p.USERNAME = this.username, a.getLargeAValue(function(v, y) { v && i.onFailure(v), p.SRP_A = y.toString(16), s.authenticationFlowType === "CUSTOM_AUTH" && (p.CHALLENGE_NAME = "SRP_A"); var k = Object.keys(r.getValidationData()).length !== 0 ? r.getValidationData() : r.getClientMetadata(), E = { AuthFlow: s.authenticationFlowType, ClientId: s.pool.getClientId(), AuthParameters: p, ClientMetadata: k }; s.getUserContextData(s.username) && (E.UserContextData = s.getUserContextData(s.username)), s.client.request("InitiateAuth", E, function(A, T) { if (A) return i.onFailure(A); var O = T.ChallengeParameters; s.username = O.USER_ID_FOR_SRP, s.userDataKey = s.keyPrefix + "." + s.username + ".userData", f = new ot(O.SRP_B, 16), d = new ot(O.SALT, 16), s.getCachedDeviceKeyAndPassword(), a.getPasswordAuthenticationKey(s.username, r.getPassword(), f, d, function(R, U) { R && i.onFailure(R); var j = l.getNowString(), K = Ro.lib.WordArray.create(ln.Buffer.concat([ln.Buffer.from(s.pool.getUserPoolName(), "utf8"), ln.Buffer.from(s.username, "utf8"), ln.Buffer.from(O.SECRET_BLOCK, "base64"), ln.Buffer.from(j, "utf8")])), ie = Ro.lib.WordArray.create(U), ce = Ry.stringify(Zh(K, ie)), H = {}; H.USERNAME = s.username, H.PASSWORD_CLAIM_SECRET_BLOCK = O.SECRET_BLOCK, H.TIMESTAMP = j, H.PASSWORD_CLAIM_SIGNATURE = ce, s.deviceKey != null && (H.DEVICE_KEY = s.deviceKey); var ye = function _e(qe, st) { return s.client.request("RespondToAuthChallenge", qe, function(ft, ue) { return ft && ft.code === "ResourceNotFoundException" && ft.message.toLowerCase().indexOf("device") !== -1 ? (H.DEVICE_KEY = null, s.deviceKey = null, s.randomPassword = null, s.deviceGroupKey = null, s.clearCachedDeviceKeyAndPassword(), _e(qe, st)) : st(ft, ue); }); }, Z = { ChallengeName: "PASSWORD_VERIFIER", ClientId: s.pool.getClientId(), ChallengeResponses: H, Session: T.Session, ClientMetadata: k }; s.getUserContextData() && (Z.UserContextData = s.getUserContextData()), ye(Z, function(_e, qe) { return _e ? i.onFailure(_e) : s.authenticateUserInternal(qe, a, i); }); }); }); }); }, e.authenticateUserPlainUsernamePassword = function(r, i) { var s = this, a = {}; if (a.USERNAME = this.username, a.PASSWORD = r.getPassword(), !a.PASSWORD) { i.onFailure(new Error("PASSWORD parameter is required")); return; } var l = new Ku(this.pool.getUserPoolName()); this.getCachedDeviceKeyAndPassword(), this.deviceKey != null && (a.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: a, 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) : s.authenticateUserInternal(v, l, i); }); }, e.authenticateUserInternal = function(r, i, s) { var a = this, l = r.ChallengeName, f = r.ChallengeParameters; if (l === "SMS_MFA") return this.Session = r.Session, s.mfaRequired(l, f); if (l === "SELECT_MFA_TYPE") return this.Session = r.Session, s.selectMFAType(l, f); if (l === "MFA_SETUP") return this.Session = r.Session, s.mfaSetup(l, f); if (l === "SOFTWARE_TOKEN_MFA") return this.Session = r.Session, s.totpRequired(l, f); if (l === "CUSTOM_CHALLENGE") return this.Session = r.Session, s.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 s.newPasswordRequired(d, v); } if (l === "DEVICE_SRP_AUTH") { this.Session = r.Session, this.getDeviceResponse(s); return; } this.signInUserSession = this.getCognitoUserSession(r.AuthenticationResult), this.challengeName = l, this.cacheTokens(); var E = r.AuthenticationResult.NewDeviceMetadata; if (E == null) return s.onSuccess(this.signInUserSession); i.generateHashDevice(r.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, r.AuthenticationResult.NewDeviceMetadata.DeviceKey, function(A) { if (A) return s.onFailure(A); var T = { Salt: ln.Buffer.from(i.getSaltDevices(), "hex").toString("base64"), PasswordVerifier: ln.Buffer.from(i.getVerifierDevices(), "hex").toString("base64") }; a.verifierDevices = T.PasswordVerifier, a.deviceGroupKey = E.DeviceGroupKey, a.randomPassword = i.getRandomPassword(), a.client.request("ConfirmDevice", { DeviceKey: E.DeviceKey, AccessToken: a.signInUserSession.getAccessToken().getJwtToken(), DeviceSecretVerifierConfig: T, DeviceName: aE }, function(O, R) { return O ? s.onFailure(O) : (a.deviceKey = r.AuthenticationResult.NewDeviceMetadata.DeviceKey, a.cacheDeviceKeyAndPassword(), R.UserConfirmationNecessary === !0 ? s.onSuccess(a.signInUserSession, R.UserConfirmationNecessary) : s.onSuccess(a.signInUserSession)); }); }); }, e.completeNewPasswordChallenge = function(r, i, s, a) { var l = this; if (!r) return s.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: a }; this.getUserContextData() && (v.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", v, function(y, k) { return y ? s.onFailure(y) : l.authenticateUserInternal(k, f, s); }); }, e.getDeviceResponse = function(r, i) { var s = this, a = new Ku(this.deviceGroupKey), l = new oE(), f = {}; f.USERNAME = this.username, f.DEVICE_KEY = this.deviceKey, a.getLargeAValue(function(d, p) { d && r.onFailure(d), f.SRP_A = p.toString(16); var v = { ChallengeName: "DEVICE_SRP_AUTH", ClientId: s.pool.getClientId(), ChallengeResponses: f, ClientMetadata: i, Session: s.Session }; s.getUserContextData() && (v.UserContextData = s.getUserContextData()), s.client.request("RespondToAuthChallenge", v, function(y, k) { if (y) return r.onFailure(y); var E = k.ChallengeParameters, A = new ot(E.SRP_B, 16), T = new ot(E.SALT, 16); a.getPasswordAuthenticationKey(s.deviceKey, s.randomPassword, A, T, function(O, R) { if (O) return r.onFailure(O); var U = l.getNowString(), j = Ro.lib.WordArray.create(ln.Buffer.concat([ln.Buffer.from(s.deviceGroupKey, "utf8"), ln.Buffer.from(s.deviceKey, "utf8"), ln.Buffer.from(E.SECRET_BLOCK, "base64"), ln.Buffer.from(U, "utf8")])), K = Ro.lib.WordArray.create(R), ie = Ry.stringify(Zh(j, K)), ce = {}; ce.USERNAME = s.username, ce.PASSWORD_CLAIM_SECRET_BLOCK = E.SECRET_BLOCK, ce.TIMESTAMP = U, ce.PASSWORD_CLAIM_SIGNATURE = ie, ce.DEVICE_KEY = s.deviceKey; var H = { ChallengeName: "DEVICE_PASSWORD_VERIFIER", ClientId: s.pool.getClientId(), ChallengeResponses: ce, Session: k.Session }; s.getUserContextData() && (H.UserContextData = s.getUserContextData()), s.client.request("RespondToAuthChallenge", H, function(ye, Z) { return ye ? r.onFailure(ye) : (s.signInUserSession = s.getCognitoUserSession(Z.AuthenticationResult), s.cacheTokens(), r.onSuccess(s.signInUserSession)); }); }); }); }); }, e.confirmRegistration = function(r, i, s, a) { var l = { ClientId: this.pool.getClientId(), ConfirmationCode: r, Username: this.username, ForceAliasCreation: i, ClientMetadata: a }; this.getUserContextData() && (l.UserContextData = this.getUserContextData()), this.client.request("ConfirmSignUp", l, function(f) { return f ? s(f, null) : s(null, "SUCCESS"); }); }, e.sendCustomChallengeAnswer = function(r, i, s) { var a = 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: s }; this.getUserContextData() && (d.UserContextData = this.getUserContextData()), this.client.request("RespondToAuthChallenge", d, function(p, v) { return p ? i.onFailure(p) : a.authenticateUserInternal(v, f, i); }); }, e.sendMFACode = function(r, i, s, a) { var l = this, f = {}; f.USERNAME = this.username, f.SMS_MFA_CODE = r; var d = s || "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: a }; 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 E = new Ku(l.pool.getUserPoolName()); E.generateHashDevice(y.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, y.AuthenticationResult.NewDeviceMetadata.DeviceKey, function(A) { if (A) return i.onFailure(A); var T = { Salt: ln.Buffer.from(E.getSaltDevices(), "hex").toString("base64"), PasswordVerifier: ln.Buffer.from(E.getVerifierDevices(), "hex").toString("base64") }; l.verifierDevices = T.PasswordVerifier, l.deviceGroupKey = y.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, l.randomPassword = E.getRandomPassword(), l.client.request("ConfirmDevice", { DeviceKey: y.AuthenticationResult.NewDeviceMetadata.DeviceKey, AccessToken: l.signInUserSession.getAccessToken().getJwtToken(), DeviceSecretVerifierConfig: T, DeviceName: aE }, function(O, R) { return O ? i.onFailure(O) : (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, s, a) { if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return s(new Error("User is not authenticated"), null); this.client.request("ChangePassword", { PreviousPassword: r, ProposedPassword: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), ClientMetadata: a }, function(l) { return l ? s(l, null) : s(null, "SUCCESS"); }); }, e.enableMFA = function(r) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return r(new Error("User is not authenticated"), null); var i = [], s = { DeliveryMedium: "SMS", AttributeName: "phone_number" }; i.push(s), this.client.request("SetUserSettings", { MFAOptions: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(a) { return a ? r(a, null) : r(null, "SUCCESS"); }); }, e.setUserMfaPreference = function(r, i, s) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return s(new Error("User is not authenticated"), null); this.client.request("SetUserMFAPreference", { SMSMfaSettings: r, SoftwareTokenMfaSettings: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(a) { return a ? s(a, null) : s(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(s) { return s ? r(s, null) : r(null, "SUCCESS"); }); }, e.deleteUser = function(r, i) { var s = 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(a) { return a ? r(a, null) : (s.clearCachedUser(), r(null, "SUCCESS")); }); }, e.updateAttributes = function(r, i, s) { var a = 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: s }, function(l) { return l ? i(l, null) : a.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, s) { if (i) return r(i, null); for (var a = [], l = 0; l < s.UserAttributes.length; l++) { var f = { Name: s.UserAttributes[l].Name, Value: s.UserAttributes[l].Value }, d = new Ju(f); a.push(d); } return r(null, a); }); }, 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, s) { return i ? r(i, null) : r(null, s.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(s) { var a = i.signInUserSession.getRefreshToken(); a && a.getToken() ? i.refreshSession(a, s, r.clientMetadata) : s(); }); }, e.getUserData = function(r, i) { var s = this; if (!(this.signInUserSession != null && this.signInUserSession.isValid())) return this.clearCachedUserData(), r(new Error("User is not authenticated"), null); var a = this.getUserDataFromCache(); if (!a) { this.fetchUserData().then(function(l) { r(null, l); }).catch(r); return; } if (this.isFetchUserDataAndTokenRequired(i)) { this.fetchUserData().then(function(l) { return s.refreshSessionIfPossible(i).then(function() { return l; }); }).then(function(l) { return r(null, l); }).catch(r); return; } try { r(null, JSON.parse(a)); 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 || {}, s = i.bypassCache, a = s === void 0 ? !1 : s; return a; }, e.fetchUserData = function() { var r = this; return this.createGetUserRequest().then(function(i) { return r.cacheUserData(i), i; }); }, e.deleteAttributes = function(r, i) { var s = 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(a) { return a ? i(a, null) : s.getUserData(function() { return i(null, "SUCCESS"); }, { bypassCache: !0 }); }); }, e.resendConfirmationCode = function(r, i) { var s = { ClientId: this.pool.getClientId(), Username: this.username, ClientMetadata: i }; this.client.request("ResendConfirmationCode", s, function(a, l) { return a ? r(a, 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 s = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, a = s + ".idToken", l = s + ".accessToken", f = s + ".refreshToken", d = s + ".clockDrift"; if (this.storage.getItem(a)) { var p = new Ty({ IdToken: this.storage.getItem(a) }), v = new xy({ AccessToken: this.storage.getItem(l) }), y = new Iy({ RefreshToken: this.storage.getItem(f) }), k = parseInt(this.storage.getItem(d), 0) || 0, E = { IdToken: p, AccessToken: v, RefreshToken: y, ClockDrift: k }, A = new Oy(E); if (A.isValid()) return this.signInUserSession = A, 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, s) { var a = 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: s }; this.getUserContextData() && (y.UserContextData = this.getUserContextData()), this.client.request("InitiateAuth", y, function(k, E) { if (k) return k.code === "NotAuthorizedException" && a.clearCachedUser(), l(k, null); if (E) { var A = E.AuthenticationResult; return Object.prototype.hasOwnProperty.call(A, "RefreshToken") || (A.RefreshToken = r.getToken()), a.signInUserSession = a.getCognitoUserSession(A), a.cacheTokens(), l(null, a.signInUserSession); } }); }, e.cacheTokens = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId(), i = r + "." + this.username + ".idToken", s = r + "." + this.username + ".accessToken", a = r + "." + this.username + ".refreshToken", l = r + "." + this.username + ".clockDrift", f = r + ".LastAuthUser"; this.storage.setItem(i, this.signInUserSession.getIdToken().getJwtToken()), this.storage.setItem(s, this.signInUserSession.getAccessToken().getJwtToken()), this.storage.setItem(a, 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", s = r + ".randomPasswordKey", a = r + ".deviceGroupKey"; this.storage.setItem(i, this.deviceKey), this.storage.setItem(s, this.randomPassword), this.storage.setItem(a, this.deviceGroupKey); }, e.getCachedDeviceKeyAndPassword = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, i = r + ".deviceKey", s = r + ".randomPasswordKey", a = r + ".deviceGroupKey"; this.storage.getItem(i) && (this.deviceKey = this.storage.getItem(i), this.randomPassword = this.storage.getItem(s), this.deviceGroupKey = this.storage.getItem(a)); }, e.clearCachedDeviceKeyAndPassword = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId() + "." + this.username, i = r + ".deviceKey", s = r + ".randomPasswordKey", a = r + ".deviceGroupKey"; this.storage.removeItem(i), this.storage.removeItem(s), this.storage.removeItem(a); }, e.clearCachedTokens = function() { var r = "CognitoIdentityServiceProvider." + this.pool.getClientId(), i = r + "." + this.username + ".idToken", s = r + "." + this.username + ".accessToken", a = r + "." + this.username + ".refreshToken", l = r + ".LastAuthUser", f = r + "." + this.username + ".clockDrift"; this.storage.removeItem(i), this.storage.removeItem(s), this.storage.removeItem(a), this.storage.removeItem(l), this.storage.removeItem(f); }, e.getCognitoUserSession = function(r) { var i = new Ty(r), s = new xy(r), a = new Iy(r), l = { IdToken: i, AccessToken: s, RefreshToken: a }; return new Oy(l); }, e.forgotPassword = function(r, i) { var s = { ClientId: this.pool.getClientId(), Username: this.username, ClientMetadata: i }; this.getUserContextData() && (s.UserContextData = this.getUserContextData()), this.client.request("ForgotPassword", s, function(a, l) { return a ? r.onFailure(a) : typeof r.inputVerificationCode == "function" ? r.inputVerificationCode(l) : r.onSuccess(l); }); }, e.confirmPassword = function(r, i, s, a) { var l = { ClientId: this.pool.getClientId(), Username: this.username, ConfirmationCode: r, Password: i, ClientMetadata: a }; this.getUserContextData() && (l.UserContextData = this.getUserContextData()), this.client.request("ConfirmForgotPassword", l, function(f) { return f ? s.onFailure(f) : s.onSuccess("SUCCESS"); }); }, e.getAttributeVerificationCode = function(r, i, s) { 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: s }, function(a, l) { return a ? i.onFailure(a) : typeof i.inputVerificationCode == "function" ? i.inputVerificationCode(l) : i.onSuccess("SUCCESS"); }); }, e.verifyAttribute = function(r, i, s) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return s.onFailure(new Error("User is not authenticated")); this.client.request("VerifyUserAttribute", { AttributeName: r, Code: i, AccessToken: this.signInUserSession.getAccessToken().getJwtToken() }, function(a) { return a ? s.onFailure(a) : s.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, s) { return i ? r.onFailure(i) : r.onSuccess(s); }); }, 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(s) { return s ? i.onFailure(s) : i.onSuccess("SUCCESS"); }); }, e.forgetDevice = function(r) { var i = this; this.forgetSpecificDevice(this.deviceKey, { onFailure: r.onFailure, onSuccess: function(a) { return i.deviceKey = null, i.deviceGroupKey = null, i.randomPassword = null, i.clearCachedDeviceKeyAndPassword(), r.onSuccess(a); } }); }, 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, s) { if (this.signInUserSession == null || !this.signInUserSession.isValid()) return s.onFailure(new Error("User is not authenticated")); var a = { AccessToken: this.signInUserSession.getAccessToken().getJwtToken(), Limit: r }; i && (a.PaginationToken = i), this.client.request("ListDevices", a, function(l, f) { return l ? s.onFailure(l) : s.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(s) { return s ? r.onFailure(s) : (i.clearCachedUser(), r.onSuccess("SUCCESS")); }); }, e.signOut = function(r) { var i = this; if (!r || typeof r != "function") { this.cleanClientData(); return; } this.getSession(function(s, a) { if (s) return r(s); 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 s = new Error("No Access token available"); return r(s); } var a = this.signInUserSession.getRefreshToken().getToken(), l = this.signInUserSession.getAccessToken(); if (this.isSessionRevocable(l) && a) return this.revokeToken({ token: a, callback: r }); r(); }, e.isSessionRevocable = function(r) { if (r && typeof r.decodePayload == "function") try { var i = r.decodePayload(), s = i.origin_jti; return !!s; } catch { } return !1; }, e.cleanClientData = function() { this.signInUserSession = null, this.clearCachedUser(); }, e.revokeToken = function(r) { var i = r.token, s = r.callback; this.client.requestWithRetry("RevokeToken", { Token: i, ClientId: this.pool.getClientId() }, function(a) { if (a) return s(a); s(); }); }, e.sendMFASelectionAnswer = function(r, i) { var s = this, a = {}; a.USERNAME = this.username, a.ANSWER = r; var l = { ChallengeName: "SELECT_MFA_TYPE", ChallengeResponses: a, 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 (s.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(s, a) { return s ? r.onFailure(s) : r.associateSecretCode(a.SecretCode); }) : this.client.request("AssociateSoftwareToken", { Session: this.Session }, function(s, a) { return s ? r.onFailure(s) : (i.Session = a.Session, r.associateSecretCode(a.SecretCode)); }); }, e.verifySoftwareToken = function(r, i, s) { var a = 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 ? s.onFailure(l) : s.onSuccess(f); }) : this.client.request("VerifySoftwareToken", { Session: this.Session, UserCode: r, FriendlyDeviceName: i }, function(l, f) { if (l) return s.onFailure(l); a.Session = f.Session; var d = {}; d.USERNAME = a.username; var p = { ChallengeName: "MFA_SETUP", ClientId: a.pool.getClientId(), ChallengeResponses: d, Session: a.Session }; a.getUserContextData() && (p.UserContextData = a.getUserContextData()), a.client.request("RespondToAuthChallenge", p, function(v, y) { return v ? s.onFailure(v) : (a.signInUserSession = a.getCognitoUserSession(y.AuthenticationResult), a.cacheTokens(), s.onSuccess(a.signInUserSession)); }); }); }, t; }(); function DM(t, e) { return e = e || {}, new Promise(function(n, r) { var i = new XMLHttpRequest(), s = [], a = [], 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 s; }, entries: function() { return a; }, 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) { s.push(v = v.toLowerCase()), a.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 FM = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: DM }, Symbol.toStringTag, { value: "Module" })), uE = /* @__PURE__ */ wl(FM); var Cv, lE; function LM() { return lE || (lE = 1, Cv = self.fetch || (self.fetch = uE.default || uE)), Cv; } LM(); var UM = "5.0.4"; /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var Dy = "aws-amplify/" + UM, Ta = { userAgent: Dy + " 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 = Dy + " react-native", Ta.isReactNative = !0; break; default: Ta.userAgent = Dy + " js", Ta.isReactNative = !1; break; } var MM = function() { return Ta.userAgent; }; function WC() { } WC.prototype.userAgent = MM(); function BM(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, yd(t, e); } function Fy(t) { var e = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0; return Fy = function(r) { if (r === null || !$M(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 Ch(r, arguments, Ly(this).constructor); } return i.prototype = Object.create(r.prototype, { constructor: { value: i, enumerable: !1, writable: !0, configurable: !0 } }), yd(i, r); }, Fy(t); } function Ch(t, e, n) { return jM() ? Ch = Reflect.construct.bind() : Ch = function(i, s, a) { var l = [null]; l.push.apply(l, s); var f = Function.bind.apply(i, l), d = new f(); return a && yd(d, a.prototype), d; }, Ch.apply(null, arguments); } function jM() { 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 $M(t) { return Function.toString.call(t).indexOf("[native code]") !== -1; } function yd(t, e) { return yd = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, yd(t, e); } function Ly(t) { return Ly = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) { return n.__proto__ || Object.getPrototypeOf(n); }, Ly(t); } var VM = /* @__PURE__ */ function(t) { BM(e, t); function e(n, r, i, s) { var a; return a = t.call(this, n) || this, a.code = r, a.name = i, a.statusCode = s, a; } return e; }(/* @__PURE__ */ Fy(Error)), zM = /* @__PURE__ */ function() { function t(n, r, i) { this.endpoint = r || "https://cognito-idp." + n + ".amazonaws.com/"; var s = i || {}, a = s.credentials; this.fetchOptions = a ? { credentials: a } : {}; } var e = t.prototype; return e.promisifyRequest = function(r, i) { var s = this; return new Promise(function(a, l) { s.request(r, i, function(f, d) { f ? l(new VM(f.message, f.code, f.name, f.statusCode)) : a(d); }); }); }, e.requestWithRetry = function(r, i, s) { var a = this, l = 5 * 1e3; KM(function(f) { return new Promise(function(d, p) { a.request(r, f, function(v, y) { v ? p(v) : d(y); }); }); }, [i], l).then(function(f) { return s(null, f); }).catch(function(f) { return s(f); }); }, e.request = function(r, i, s) { var a = { "Content-Type": "application/x-amz-json-1.1", "X-Amz-Target": "AWSCognitoIdentityProviderService." + r, "X-Amz-User-Agent": WC.prototype.userAgent, "Cache-Control": "no-store" }, l = Object.assign({}, this.fetchOptions, { headers: a, 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 s(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, s(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, s(v); } catch { return s(d); } else d instanceof Error && d.message === "Network error" && (d.code = "NetworkError"); return s(d); }); }, t; }(), uh = { debug: function() { } }, qM = function(e) { var n = "nonRetryable"; return e && e[n]; }; function YC(t, e, n, r) { if (r === void 0 && (r = 1), typeof t != "function") throw Error("functionToRetry must be a function"); return uh.debug(t.name + " attempt #" + r + " with args: " + JSON.stringify(e)), t.apply(void 0, e).catch(function(i) { if (uh.debug("error on " + t.name, i), qM(i)) throw uh.debug(t.name + " non retryable error", i), i; var s = n(r, e, i); if (uh.debug(t.name + " retrying in " + s + " ms"), s !== !1) return new Promise(function(a) { return setTimeout(a, s); }).then(function() { return YC(t, e, n, r + 1); }); throw i; }); } function HM(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 KM(t, e, n) { return YC(t, e, HM(n)); } /*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ var GM = 55, WM = /* @__PURE__ */ function() { function t(n, r) { var i = n || {}, s = i.UserPoolId, a = i.ClientId, l = i.endpoint, f = i.fetchOptions, d = i.AdvancedSecurityDataCollectionFlag; if (!s || !a) throw new Error("Both UserPoolId and ClientId are required."); if (s.length > GM || !/^[\w-]+_[0-9a-zA-Z]+$/.test(s)) throw new Error("Invalid UserPoolId format."); var p = s.split("_")[0]; this.userPoolId = s, this.clientId = a, this.client = new zM(p, l, f), this.advancedSecurityDataCollectionFlag = d !== !1, this.storage = n.Storage || new GC().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, s, a, l, f) { var d = this, p = { ClientId: this.clientId, Username: r, Password: i, UserAttributes: s, ValidationData: a, 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 }, E = { user: new Py(k), userConfirmed: y.UserConfirmed, userSub: y.UserSub, codeDeliveryDetails: y.CodeDeliveryDetails }; return l(null, E); }); }, e.getCurrentUser = function() { var r = "CognitoIdentityServiceProvider." + this.clientId + ".LastAuthUser", i = this.storage.getItem(r); if (i) { var s = { Username: i, Pool: this, Storage: this.storage }; return new Py(s); } return null; }, e.getUserContextData = function(r) { if (!(typeof AmazonCognitoAdvancedSecurityData > "u")) { var i = AmazonCognitoAdvancedSecurityData; if (this.advancedSecurityDataCollectionFlag) { var s = i.getData(r, this.userPoolId, this.clientId); if (s) { var a = { EncodedData: s }; return a; } } return {}; } }, t; }(), xv = { 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 cE; function YM() { return cE || (cE = 1, function(t, e) { (function(n) { var r; if (t.exports = n(), r = !0, !r) { var i = window.Cookies, s = window.Cookies = n(); s.noConflict = function() { return window.Cookies = i, s; }; } })(function() { function n() { for (var s = 0, a = {}; s < arguments.length; s++) { var l = arguments[s]; for (var f in l) a[f] = l[f]; } return a; } function r(s) { return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); } function i(s) { function a() { } function l(d, p, v) { if (!(typeof document > "u")) { v = n({ path: "/" }, a.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 = s.write ? s.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 E in v) v[E] && (k += "; " + E, v[E] !== !0 && (k += "=" + v[E].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 E = y[k].split("="), A = E.slice(1).join("="); !p && A.charAt(0) === '"' && (A = A.slice(1, -1)); try { var T = r(E[0]); if (A = (s.read || s)(A, T) || r(A), p) try { A = JSON.parse(A); } catch { } if (v[T] = A, d === T) break; } catch { } } return d ? v[d] : v; } } return a.set = l, a.get = function(d) { return f( d, !1 /* read as raw */ ); }, a.getJSON = function(d) { return f( d, !0 /* read as json */ ); }, a.remove = function(d, p) { l(d, "", n(p, { expires: -1 })); }, a.defaults = {}, a.withConverter = i, a; } return i(function() { }); }); }(xv)), xv.exports; } var jc = YM(), QM = /* @__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 s = { path: this.path, expires: this.expires, domain: this.domain, secure: this.secure }; return this.sameSite && (s.sameSite = this.sameSite), jc.set(r, i, s), jc.get(r); }, e.getItem = function(r) { return jc.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), jc.remove(r, i); }, e.clear = function() { for (var r = jc.get(), i = Object.keys(r).length, s = 0; s < i; ++s) this.removeItem(Object.keys(r)[s]); return {}; }, t; }(), JM = "_self", XM = function(t) { var e = window.open(t, JM); return e ? Promise.resolve(e) : Promise.reject(); }, ZM = function(t) { window.sessionStorage.setItem("oauth_state", t); }, e3 = function() { var t = window.sessionStorage.getItem("oauth_state"); return window.sessionStorage.removeItem("oauth_state"), t; }, t3 = function(t) { window.sessionStorage.setItem("ouath_pkce_key", t); }, n3 = function() { var t = window.sessionStorage.getItem("ouath_pkce_key"); return window.sessionStorage.removeItem("ouath_pkce_key"), t; }, dr = function() { return dr = 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; }, dr.apply(this, arguments); }, lh = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(p) { try { d(r.next(p)); } catch (v) { a(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { a(v); } } function d(p) { p.done ? s(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, ch = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; 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 && (s = d[0] & 2 ? i.return : d[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, d[1])).done) return s; switch (i = 0, s && (d = [d[0] & 2, s.value]), d[0]) { case 0: case 1: s = 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 (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!s || d[1] > s[0] && d[1] < s[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < s[1]) { n.label = s[1], s = d; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(d); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = s = 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, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, r3 = typeof Symbol < "u" && typeof Symbol.for == "function" ? Symbol.for("amplify_default") : "@@amplify_default", Nv = function(t, e, n) { So.dispatch("auth", { event: t, data: e, message: n }, "Auth", r3); }, Gu = new Di("OAuth"), i3 = ( /** @class */ function() { function t(e) { var n = e.config, r = e.cognitoClientId, i = e.scopes, s = i === void 0 ? [] : i; if (this._urlOpener = n.urlOpener || XM, this._config = n, this._cognitoClientId = r, !this.isValidScopes(s)) throw Error("scopes must be a String Array"); this._scopes = s; } 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, s, a) { e === void 0 && (e = "code"), s === void 0 && (s = Xh.Cognito); var l = this._generateState(32), f = a ? l + "-" + gD(a) : l; ZM(f); var d = this._generateRandom(128); t3(d); var p = this._generateChallenge(d), v = "S256", y = this._scopes.join(" "), k = Object.entries(dr(dr({ redirect_uri: r, response_type: e, client_id: i, identity_provider: s, scope: y, state: f }, e === "code" ? { code_challenge: p } : {}), e === "code" ? { code_challenge_method: v } : {})).map(function(A) { var T = Aa(A, 2), O = T[0], R = T[1]; return encodeURIComponent(O) + "=" + encodeURIComponent(R); }).join("&"), E = "https://" + n + "/oauth2/authorize?" + k; Gu.debug("Redirecting to " + E), this._urlOpener(E, r); }, t.prototype._handleCodeFlow = function(e) { return lh(this, void 0, void 0, function() { var n, r, i, s, a, l, f, d, p, v, y, k, E, A; return ch(this, function(T) { switch (T.label) { case 0: return n = (bo.parse(e).query || "").split("&").map(function(O) { return O.split("="); }).reduce(function(O, R) { var U, j = Aa(R, 2), K = j[0], ie = j[1]; return dr(dr({}, O), (U = {}, U[K] = ie, U)); }, { code: void 0 }).code, r = bo.parse(e).pathname || "/", i = bo.parse(this._config.redirectSignIn).pathname || "/", !n || r !== i ? [ 2 /*return*/ ] : (s = "https://" + this._config.domain + "/oauth2/token", Nv("codeFlow", {}, "Retrieving tokens from " + s), a = Ua(this._config) ? this._cognitoClientId : this._config.clientID, l = Ua(this._config) ? this._config.redirectSignIn : this._config.redirectUri, f = n3(), d = dr({ grant_type: "authorization_code", code: n, client_id: a, redirect_uri: l }, f ? { code_verifier: f } : {}), Gu.debug("Calling token endpoint: " + s + " with", d), p = Object.entries(d).map(function(O) { var R = Aa(O, 2), U = R[0], j = R[1]; return encodeURIComponent(U) + "=" + encodeURIComponent(j); }).join("&"), [4, fetch(s, { 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, E = v.id_token, A = v.error, A) throw new Error(A); return [2, { accessToken: y, refreshToken: k, idToken: E }]; } }); }); }, t.prototype._handleImplicitFlow = function(e) { return lh(this, void 0, void 0, function() { var n, r, i; return ch(this, function(s) { return n = (bo.parse(e).hash || "#").substr(1).split("&").map(function(a) { return a.split("="); }).reduce(function(a, l) { var f, d = Aa(l, 2), p = d[0], v = d[1]; return dr(dr({}, a), (f = {}, f[p] = v, f)); }, { id_token: void 0, access_token: void 0 }), r = n.id_token, i = n.access_token, Nv("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 lh(this, void 0, void 0, function() { var n, r, i, s, a, l, f; return ch(this, function(d) { switch (d.label) { case 0: if (d.trys.push([0, 5, , 6]), n = e ? dr(dr({}, (bo.parse(e).hash || "#").substr(1).split("&").map(function(p) { return p.split("="); }).reduce(function(p, v) { var y = Aa(v, 2), k = y[0], E = y[1]; return p[k] = E, p; }, {})), (bo.parse(e).query || "").split("&").map(function(p) { return p.split("="); }).reduce(function(p, v) { var y = Aa(v, 2), k = y[0], E = y[1]; return p[k] = E, p; }, {})) : {}, r = n.error, i = n.error_description, r) throw new Error(i); return s = this._validateState(n), Gu.debug("Starting " + this._config.responseType + " flow with " + e), this._config.responseType !== "code" ? [3, 2] : (a = [{}], [4, this._handleCodeFlow(e)]); case 1: return [2, dr.apply(void 0, [dr.apply(void 0, a.concat([d.sent()])), { state: s }])]; case 2: return l = [{}], [4, this._handleImplicitFlow(e)]; case 3: return [2, dr.apply(void 0, [dr.apply(void 0, l.concat([d.sent()])), { state: s }])]; 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 = e3(), r = e.state; if (n && n !== r) throw new Error("Invalid state in OAuth flow"); return r; } }, t.prototype.signOut = function() { return lh(this, void 0, void 0, function() { var e, n, r; return ch(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(s) { var a = Aa(s, 2), l = a[0], f = a[1]; return l + "=" + f; }).join("&"), Nv("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(HC(e)); }, t.prototype._base64URL = function(e) { return e.toString(Ry).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 s = e[i] % n.length; r.push(n[s]); } return r.join(""); }, t; }() ); const s3 = function(t) { if (Bs().isBrowser && window.location) { var e = window.location.href; t({ url: e }); } else if (!Bs().isNode) throw new Error("Not supported"); }; var qn; (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"; })(qn || (qn = {})); var QC = /* @__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 s in i) i.hasOwnProperty(s) && (r[s] = i[s]); }, 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()); }; }(), o3 = new Di("AuthError"), _o = ( /** @class */ function(t) { QC(e, t); function e(n) { var r = this, i = u3[n], s = i.message, a = i.log; return r = t.call(this, s) || this, r.constructor = e, Object.setPrototypeOf(r, e.prototype), r.name = "AuthError", r.log = a || s, o3.error(r.log), r; } return e; }(Error) ), a3 = ( /** @class */ function(t) { QC(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; }(_o) ), u3 = { noConfig: { message: qn.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: qn.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: qn.EMPTY_USERNAME }, // TODO: should include a list of valid sign-in types invalidUsername: { message: qn.INVALID_USERNAME }, emptyPassword: { message: qn.EMPTY_PASSWORD }, emptyCode: { message: qn.EMPTY_CODE }, signUpError: { message: qn.SIGN_UP_ERROR, log: "The first parameter should either be non-null string or object" }, noMFA: { message: qn.NO_MFA }, invalidMFA: { message: qn.INVALID_MFA }, emptyChallengeResponse: { message: qn.EMPTY_CHALLENGE }, noUserSession: { message: qn.NO_USER_SESSION }, deviceConfig: { message: qn.DEVICE_CONFIG }, networkError: { message: qn.NETWORK_ERROR }, autoSignInError: { message: qn.AUTOSIGNIN_ERROR }, default: { message: qn.DEFAULT_MSG } }, ep = function() { return ep = 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; }, ep.apply(this, arguments); }, Zt = function(t, e, n, r) { function i(s) { return s instanceof n ? s : new n(function(a) { a(s); }); } return new (n || (n = Promise))(function(s, a) { function l(p) { try { d(r.next(p)); } catch (v) { a(v); } } function f(p) { try { d(r.throw(p)); } catch (v) { a(v); } } function d(p) { p.done ? s(p.value) : i(p.value).then(l, f); } d((r = r.apply(t, e || [])).next()); }); }, en = function(t, e) { var n = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, r, i, s, a; return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; 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 && (s = d[0] & 2 ? i.return : d[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, d[1])).done) return s; switch (i = 0, s && (d = [d[0] & 2, s.value]), d[0]) { case 0: case 1: s = 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 (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (d[0] === 6 || d[0] === 2)) { n = 0; continue; } if (d[0] === 3 && (!s || d[1] > s[0] && d[1] < s[3])) { n.label = d[1]; break; } if (d[0] === 6 && n.label < s[1]) { n.label = s[1], s = d; break; } if (s && n.label < s[2]) { n.label = s[2], n.ops.push(d); break; } s[2] && n.ops.pop(), n.trys.pop(); continue; } d = e.call(t, n); } catch (p) { d = [6, p], i = 0; } finally { r = s = 0; } if (d[0] & 5) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; } }, dE = function(t, e) { var n = typeof Symbol == "function" && t[Symbol.iterator]; if (!n) return t; var r = n.call(t), i, s = [], a; try { for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value); } catch (l) { a = { error: l }; } finally { try { i && !i.done && (n = r.return) && n.call(r); } finally { if (a) throw a.error; } } return s; }, Fe = new Di("AuthClass"), fE = "aws.cognito.signin.user.admin", l3 = 10 * 1e3, c3 = typeof Symbol < "u" && typeof Symbol.for == "function" ? Symbol.for("amplify_default") : "@@amplify_default", Vt = function(t, e, n) { So.dispatch("auth", { event: t, data: e, message: n }, "Auth", c3); }, d3 = 60, f3 = 3 * 60 * 1e3, h3 = ( /** @class */ function() { function t(e) { var n = this; this.userPool = null, this.user = null, this.oAuthFlowInProgress = !1, this.autoSignInInitiated = !1, this.Credentials = zC, this.wrapRefreshSessionCallback = function(r) { var i = function(s, a) { return a ? Vt("tokenRefresh", void 0, "New token retrieved") : Vt("tokenRefresh_failure", s, "Failed to retrieve new token"), r(s, a); }; return i; }, this.configure(e), this.currentCredentials = this.currentCredentials.bind(this), this.currentUserCredentials = this.currentUserCredentials.bind(this), So.listen("auth", function(r) { var i = r.payload, s = i.event; switch (s) { 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 || {}; Fe.debug("configure Auth"); var r = Object.assign({}, this._config, _D.parseMobilehubConfig(e).Auth, e); this._config = r; var i = this._config, s = i.userPoolId, a = i.userPoolWebClientId, l = i.cookieStorage, f = i.oauth, d = i.region, p = i.identityPoolId, v = i.mandatorySignIn, y = i.refreshHandlers, k = i.identityPoolRegion, E = i.clientMetadata, A = i.endpoint; if (!this._config.storage) l ? this._storage = new QM(l) : this._storage = e.ssr ? new hU() : new RC().getStorage(); else { if (!this._isValidAuthStorage(this._config.storage)) throw Fe.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()), s) { var T = { UserPoolId: s, ClientId: a, endpoint: A }; T.Storage = this._storage, this.userPool = new WM(T, this.wrapRefreshSessionCallback); } this.Credentials.configure({ mandatorySignIn: v, region: k || d, userPoolId: s, identityPoolId: p, refreshHandlers: y, storage: this._storage }); var O = f ? Ua(this._config.oauth) ? f : f.awsCognito : void 0; if (O) { var R = Object.assign({ cognitoClientId: a, UserPoolId: s, domain: O.domain, scopes: O.scope, redirectSignIn: O.redirectSignIn, redirectSignOut: O.redirectSignOut, responseType: O.responseType, Storage: this._storage, urlOpener: O.urlOpener, clientMetadata: E }, O.options); this._oAuthHandler = new i3({ scopes: R.scopes, config: R, cognitoClientId: R.cognitoClientId }); var U = {}; s3(function(K) { var ie = K.url; U[ie] || (U[ie] = !0, n._handleAuthResponse(ie)); }); } if (Vt("configured", null, "The Auth category has been configured successfully"), !this.autoSignInInitiated && typeof this._storage.getItem == "function") { var j = this.isTrueStorageValue("amplify-polling-started"); j && (Vt("autoSignIn_failure", null, Wt.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 s, a, l; if (!this.userPool) return this.rejectNoUserPool(); var f = null, d = null, p = [], v = null, y, k = { enabled: !1 }, E = {}, A = {}; if (e && typeof e == "string") { f = e, d = r ? r[0] : null; var T = r ? r[1] : null, O = r ? r[2] : null; T && p.push(new Ju({ Name: "email", Value: T })), O && p.push(new Ju({ Name: "phone_number", Value: O })); } 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 U = e.validationData; U && (v = [], Object.keys(U).map(function(j) { v.push(new Ju({ Name: j, Value: U[j] })); })), k = (s = e.autoSignIn) !== null && s !== void 0 ? s : { enabled: !1 }, k.enabled && (this._storage.setItem("amplify-auto-sign-in", "true"), E = (a = k.validationData) !== null && a !== void 0 ? a : {}, A = (l = k.clientMetaData) !== null && l !== void 0 ? l : {}); } else return this.rejectAuthError(Wt.SignUpError); return f ? d ? (Fe.debug("signUp attrs:", p), Fe.debug("signUp validation data:", v), new Promise(function(j, K) { n.userPool.signUp(f, d, p, v, function(ie, ce) { ie ? (Vt("signUp_failure", ie, f + " failed to signup"), K(ie)) : (Vt("signUp", ce, f + " has signed up successfully"), k.enabled && n.handleAutoSignIn(f, d, E, A, ce), j(ce)); }, y); })) : this.rejectAuthError(Wt.EmptyPassword) : this.rejectAuthError(Wt.EmptyUsername); }, t.prototype.handleAutoSignIn = function(e, n, r, i, s) { this.autoSignInInitiated = !0; var a = new Kk({ Username: e, Password: n, ValidationData: r, ClientMetadata: i }); s.userConfirmed ? this.signInAfterUserConfirmed(a) : this._config.signUpVerificationMethod === "link" ? this.handleLinkAutoSignIn(a) : this.handleCodeAutoSignIn(a); }, t.prototype.handleCodeAutoSignIn = function(e) { var n = this, r = function(i) { var s = i.payload; s.event === "confirmSignUp" && n.signInAfterUserConfirmed(e, r); }; So.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 > f3 ? (clearInterval(i), Vt("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 Zt(this, void 0, void 0, function() { var i, s, a = this; return en(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) { Vt("autoSignIn", f, e.getUsername() + " has signed in successfully"), n && So.remove("auth", n), r && (clearInterval(r), a._storage.removeItem("amplify-polling-started")), a._storage.removeItem("amplify-auto-sign-in"); }, function(f) { Fe.error(f), a._storage.removeItem("amplify-auto-sign-in"); }))]; case 2: return l.sent(), [3, 4]; case 3: return s = l.sent(), Fe.error(s), [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(Wt.EmptyUsername); if (!n) return this.rejectAuthError(Wt.EmptyCode); var s = this.createCognitoUser(e), a = 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) { s.confirmRegistration(n, a, function(p, v) { if (p) d(p); else { Vt("confirmSignUp", v, e + " has been confirmed successfully"); var y = i.isTrueStorageValue("amplify-auto-sign-in"); y && !i.autoSignInInitiated && (Vt("autoSignIn_failure", null, Wt.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(Wt.EmptyUsername); var r = this.createCognitoUser(e); return new Promise(function(i, s) { r.resendConfirmationCode(function(a, l) { a ? s(a) : 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, s = null, a = {}; if (typeof e == "string") i = e, s = n; else if (gU(e)) typeof n < "u" && Fe.warn("The password should be defined under the first parameter object!"), i = e.username, s = e.password, a = e.validationData; else return this.rejectAuthError(Wt.InvalidUsername); if (!i) return this.rejectAuthError(Wt.EmptyUsername); var l = new Kk({ Username: i, Password: s, ValidationData: a, ClientMetadata: r }); return s ? this.signInWithPassword(l) : this.signInWithoutPassword(l); }, t.prototype.authCallbacks = function(e, n, r) { var i = this, s = this; return { onSuccess: function(a) { return Zt(i, void 0, void 0, function() { var l, f, d, p; return en(this, function(v) { switch (v.label) { case 0: Fe.debug(a), 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(a, "session")]; case 3: return l = v.sent(), Fe.debug("succeed to get cognito credentials", l), [3, 9]; case 4: return f = v.sent(), Fe.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(), s.user = d, Vt("signIn", d, "A user " + e.getUsername() + " has been signed in"), n(d), [3, 8]; case 7: return p = v.sent(), Fe.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(a) { Fe.debug("signIn failure", a), Vt("signIn_failure", a, e.getUsername() + " failed to signin"), r(a); }, customChallenge: function(a) { Fe.debug("signIn custom challenge answer required"), e.challengeName = "CUSTOM_CHALLENGE", e.challengeParam = a, n(e); }, mfaRequired: function(a, l) { Fe.debug("signIn MFA required"), e.challengeName = a, e.challengeParam = l, n(e); }, mfaSetup: function(a, l) { Fe.debug("signIn mfa setup", a), e.challengeName = a, e.challengeParam = l, n(e); }, newPasswordRequired: function(a, l) { Fe.debug("signIn new password"), e.challengeName = "NEW_PASSWORD_REQUIRED", e.challengeParam = { userAttributes: a, requiredAttributes: l }, n(e); }, totpRequired: function(a, l) { Fe.debug("signIn totpRequired"), e.challengeName = a, e.challengeParam = l, n(e); }, selectMFAType: function(a, l) { Fe.debug("signIn selectMFAType", a), e.challengeName = a, 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, s) { r.authenticateUser(e, n.authCallbacks(r, function(a) { n.pendingSignIn = null, i(a); }, function(a) { n.pendingSignIn = null, s(a); })); }), this.pendingSignIn; }, t.prototype.signInWithoutPassword = function(e) { var n = this, r = this.createCognitoUser(e.getUsername()); return r.setAuthenticationFlowType("CUSTOM_AUTH"), new Promise(function(i, s) { r.initiateAuth(e, n.authCallbacks(r, i, s)); }); }, t.prototype.getMFAOptions = function(e) { return new Promise(function(n, r) { e.getMFAOptions(function(i, s) { if (i) { Fe.debug("get MFA Options failed", i), r(i); return; } Fe.debug("get MFA options success", s), n(s); }); }); }, t.prototype.getPreferredMFA = function(e, n) { var r = this, i = this; return new Promise(function(s, a) { var l = r._config.clientMetadata, f = n ? n.bypassCache : !1; e.getUserData(function(d, p) { return Zt(r, void 0, void 0, function() { var v, y; return en(this, function(k) { switch (k.label) { case 0: if (!d) return [3, 5]; if (Fe.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(), a(new Error("Session is invalid due to: " + d.message + " and failed to clean up invalid session: " + v.message)), [ 2 /*return*/ ]; case 4: return a(d), [ 2 /*return*/ ]; case 5: return y = i._getMfaTypeFromUserData(p), y ? (s(y), [ 2 /*return*/ ]) : (a("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" : Fe.debug("invalid case for getPreferredMFA", e); else { var s = e.MFAOptions; s ? n = "SMS_MFA" : n = "NOMFA"; } } return n; }, t.prototype._getUserData = function(e, n) { var r = this; return new Promise(function(i, s) { e.getUserData(function(a, l) { return Zt(r, void 0, void 0, function() { var f; return en(this, function(d) { switch (d.label) { case 0: if (!a) return [3, 5]; if (Fe.debug("getting user data failed", a), !this.isSessionInvalid(a)) 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(), s(new Error("Session is invalid due to: " + a.message + " and failed to clean up invalid session: " + f.message)), [ 2 /*return*/ ]; case 4: return s(a), [ 2 /*return*/ ]; case 5: i(l), d.label = 6; case 6: return [ 2 /*return*/ ]; } }); }); }, n); }); }, t.prototype.setPreferredMFA = function(e, n) { return Zt(this, void 0, void 0, function() { var r, i, s, a, l, f, d, p = this; return en(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(), s = null, a = 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 a = { PreferredMfa: !0, Enabled: !0 }, [3, 7]; case 3: return s = { 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") s = { PreferredMfa: !1, Enabled: !1 }; else if (d === "SOFTWARE_TOKEN_MFA") a = { PreferredMfa: !1, Enabled: !1 }; else return [2, this.rejectAuthError(Wt.InvalidMFA)]; return f && f.length !== 0 && f.forEach(function(y) { y === "SMS_MFA" ? s = { PreferredMfa: !1, Enabled: !1 } : y === "SOFTWARE_TOKEN_MFA" && (a = { PreferredMfa: !1, Enabled: !1 }); }), [3, 7]; case 6: return Fe.debug("no validmfa method provided"), [2, this.rejectAuthError(Wt.NoMFA)]; case 7: return [2, new Promise(function(y, k) { e.setUserMfaPreference(s, a, function(E, A) { if (E) return Fe.debug("Set user mfa preference error", E), k(E); Fe.debug("Set user mfa success", A), Fe.debug("Caching the latest user data into local"), e.getUserData(function(T, O) { return Zt(p, void 0, void 0, function() { var R; return en(this, function(U) { switch (U.label) { case 0: if (!T) return [3, 5]; if (Fe.debug("getting user data failed", T), !this.isSessionInvalid(T)) return [3, 4]; U.label = 1; case 1: return U.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(e)]; case 2: return U.sent(), [3, 4]; case 3: return R = U.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(A)]; } }); }); }, { bypassCache: !0, clientMetadata: r }); }); })]; } }); }); }, t.prototype.disableSMS = function(e) { return new Promise(function(n, r) { e.disableMFA(function(i, s) { if (i) { Fe.debug("disable mfa failed", i), r(i); return; } Fe.debug("disable mfa succeed", s), n(s); }); }); }, t.prototype.enableSMS = function(e) { return new Promise(function(n, r) { e.enableMFA(function(i, s) { if (i) { Fe.debug("enable mfa failed", i), r(i); return; } Fe.debug("enable mfa succeed", s), n(s); }); }); }, t.prototype.setupTOTP = function(e) { return new Promise(function(n, r) { e.associateSoftwareToken({ onFailure: function(i) { Fe.debug("associateSoftwareToken failed", i), r(i); }, associateSecretCode: function(i) { Fe.debug("associateSoftwareToken sucess", i), n(i); } }); }); }, t.prototype.verifyTotpToken = function(e, n) { return Fe.debug("verification totp token", e, n), new Promise(function(r, i) { e.verifySoftwareToken(n, "My TOTP device", { onFailure: function(s) { Fe.debug("verifyTotpToken failed", s), i(s); }, onSuccess: function(s) { Vt("signIn", e, "A user " + e.getUsername() + " has been signed in"), Fe.debug("verifyTotpToken success", s), r(s); } }); }); }, t.prototype.confirmSignIn = function(e, n, r, i) { var s = this; if (i === void 0 && (i = this._config.clientMetadata), !n) return this.rejectAuthError(Wt.EmptyCode); var a = this; return new Promise(function(l, f) { e.sendMFACode(n, { onSuccess: function(d) { return Zt(s, void 0, void 0, function() { var p, v; return en(this, function(y) { switch (y.label) { case 0: Fe.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(), Fe.debug("succeed to get cognito credentials", p), [3, 6]; case 4: return v = y.sent(), Fe.debug("cannot get cognito credentials", v), [3, 6]; case 5: return a.user = e, Vt("signIn", e, "A user " + e.getUsername() + " has been signed in"), l(e), [ 7 /*endfinally*/ ]; case 6: return [ 2 /*return*/ ]; } }); }); }, onFailure: function(d) { Fe.debug("confirm signIn failure", d), f(d); } }, r, i); }); }, t.prototype.completeNewPassword = function(e, n, r, i) { var s = this; if (r === void 0 && (r = {}), i === void 0 && (i = this._config.clientMetadata), !n) return this.rejectAuthError(Wt.EmptyPassword); var a = this; return new Promise(function(l, f) { e.completeNewPasswordChallenge(n, r, { onSuccess: function(d) { return Zt(s, void 0, void 0, function() { var p, v; return en(this, function(y) { switch (y.label) { case 0: Fe.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(), Fe.debug("succeed to get cognito credentials", p), [3, 6]; case 4: return v = y.sent(), Fe.debug("cannot get cognito credentials", v), [3, 6]; case 5: return a.user = e, Vt("signIn", e, "A user " + e.getUsername() + " has been signed in"), l(e), [ 7 /*endfinally*/ ]; case 6: return [ 2 /*return*/ ]; } }); }); }, onFailure: function(d) { Fe.debug("completeNewPassword failure", d), Vt("completeNewPassword_failure", d, s.user + " failed to complete the new password flow"), f(d); }, mfaRequired: function(d, p) { Fe.debug("signIn MFA required"), e.challengeName = d, e.challengeParam = p, l(e); }, mfaSetup: function(d, p) { Fe.debug("signIn mfa setup", d), e.challengeName = d, e.challengeParam = p, l(e); }, totpRequired: function(d, p) { Fe.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(s, a) { e.sendCustomChallengeAnswer(n, i.authCallbacks(e, s, a), r); }) : this.rejectAuthError(Wt.EmptyChallengeResponse) : this.rejectNoUserPool(); }, t.prototype.deleteUserAttributes = function(e, n) { var r = this; return new Promise(function(i, s) { r.userSession(e).then(function(a) { e.deleteAttributes(n, function(l, f) { return l ? s(l) : i(f); }); }); }); }, t.prototype.deleteUser = function() { return Zt(this, void 0, void 0, function() { var e, n, r = this; return en(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(), Fe.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(s, a) { return Zt(r, void 0, void 0, function() { var l, f = this; return en(this, function(d) { if (this.userPool) if (l = this.userPool.getCurrentUser(), l) l.getSession(function(p, v) { return Zt(f, void 0, void 0, function() { var y, k = this; return en(this, function(E) { switch (E.label) { case 0: if (!p) return [3, 5]; if (Fe.debug("Failed to get the user session", p), !this.isSessionInvalid(p)) return [3, 4]; E.label = 1; case 1: return E.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(l)]; case 2: return E.sent(), [3, 4]; case 3: return y = E.sent(), a(new Error("Session is invalid due to: " + p.message + " and failed to clean up invalid session: " + y.message)), [ 2 /*return*/ ]; case 4: return [2, a(p)]; case 5: l.deleteUser(function(A, T) { if (A) a(A); else { Vt("userDeleted", T, "The authenticated user has been deleted."), l.signOut(), k.user = null; try { k.cleanCachedItems(); } catch { Fe.debug("failed to clear cached items"); } n ? k.oAuthSignOutRedirect(s, a) : (Vt("signOut", k.user, "A user has been signed out"), s(T)); } }), E.label = 6; case 6: return [ 2 /*return*/ ]; } }); }); }); else return Fe.debug("Failed to get user from user pool"), [2, a(new Error("No current user."))]; else Fe.debug("no Congito User pool"), a(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 = [], s = this; return new Promise(function(a, l) { s.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) : a(y); }, r); }); }); }, t.prototype.userAttributes = function(e) { var n = this; return new Promise(function(r, i) { n.userSession(e).then(function(s) { e.getUserAttributes(function(a, l) { a ? i(a) : r(l); }); }); }); }, t.prototype.verifiedContact = function(e) { var n = this; return this.userAttributes(e).then(function(r) { var i = n.attributesToObject(r), s = {}, a = {}; return i.email && (i.email_verified ? a.email = i.email : s.email = i.email), i.phone_number && (i.phone_number_verified ? a.phone_number = i.phone_number : s.phone_number = i.phone_number), { verified: a, unverified: s }; }); }, 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 Zt(this, void 0, void 0, function() { var n = this; return en(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(), Fe.debug("failed to clear cached items"), [3, 4]; case 4: return this.isSignedInHostedUI() ? [2, new Promise(function(i, s) { n.oAuthSignOutRedirect(i, s); })] : (Vt("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 Zt(n, void 0, void 0, function() { var s, a, l = this; return en(this, function(f) { switch (f.label) { case 0: return this.isOAuthInProgress() ? (Fe.debug("OAuth signIn in progress, waiting for resolution..."), [4, new Promise(function(d) { var p = setTimeout(function() { Fe.debug("OAuth signIn in progress timeout"), So.remove("auth", v), d(); }, l3); So.listen("auth", v); function v(y) { var k = y.payload, E = k.event; (E === "cognitoHostedUI" || E === "cognitoHostedUI_failure") && (Fe.debug("OAuth signIn resolved: " + E), clearTimeout(p), So.remove("auth", v), d()); } })]) : [3, 2]; case 1: f.sent(), f.label = 2; case 2: return s = this.userPool.getCurrentUser(), s ? (a = this._config.clientMetadata, s.getSession(function(d, p) { return Zt(l, void 0, void 0, function() { var v, y, k, E, A, T = this; return en(this, function(O) { switch (O.label) { case 0: if (!d) return [3, 5]; if (Fe.debug("Failed to get the user session", d), !this.isSessionInvalid(d)) return [3, 4]; O.label = 1; case 1: return O.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(s)]; case 2: return O.sent(), [3, 4]; case 3: return v = O.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: O.sent(), O.label = 7; case 7: if (k = this._config.clientMetadata, E = p.getAccessToken().decodePayload().scope, A = E === void 0 ? "" : E, A.split(" ").includes(fE)) s.getUserData(function(R, U) { return Zt(T, void 0, void 0, function() { var j, K, ie, ce, H, ye, Z; return en(this, function(_e) { switch (_e.label) { case 0: if (!R) return [3, 7]; if (Fe.debug("getting user data failed", R), !this.isSessionInvalid(R)) return [3, 5]; _e.label = 1; case 1: return _e.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(s)]; case 2: return _e.sent(), [3, 4]; case 3: return j = _e.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(s), _e.label = 6; case 6: return [ 2 /*return*/ ]; case 7: for (K = U.PreferredMfaSetting || "NOMFA", ie = [], ce = 0; ce < U.UserAttributes.length; ce++) H = { Name: U.UserAttributes[ce].Name, Value: U.UserAttributes[ce].Value }, ye = new Ju(H), ie.push(ye); return Z = this.attributesToObject(ie), Object.assign(s, { attributes: Z, preferredMFA: K }), [2, r(s)]; } }); }); }, { bypassCache: y, clientMetadata: k }); else return Fe.debug("Unable to get the user data because the " + fE + " is not in the scopes of the access token"), [2, r(s)]; return [ 2 /*return*/ ]; } }); }); }, { clientMetadata: a }), [ 2 /*return*/ ]) : (Fe.debug("Failed to get user from user pool"), i("No current user"), [ 2 /*return*/ ]); } }); }); }).catch(function(s) { return Fe.debug("Failed to sync cache info into memory", s), i(s); }); }) : this.rejectNoUserPool(); }, t.prototype.isOAuthInProgress = function() { return this.oAuthFlowInProgress; }, t.prototype.currentAuthenticatedUser = function(e) { return Zt(this, void 0, void 0, function() { var n, r, i, s, a; return en(this, function(l) { switch (l.label) { case 0: Fe.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(), Fe.debug("Failed to sync cache info into memory", r), r; case 4: try { i = JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")), i && (n = ep(ep({}, i.user), { token: i.token })); } catch { Fe.debug("cannot load federated user from auth storage"); } return n ? (this.user = n, Fe.debug("get current authenticated federated user", this.user), [2, this.user]) : [3, 5]; case 5: Fe.debug("get current authenticated userpool user"), s = null, l.label = 6; case 6: return l.trys.push([6, 8, , 9]), [4, this.currentUserPoolUser(e)]; case 7: return s = l.sent(), [3, 9]; case 8: return a = l.sent(), a === "No userPool" && Fe.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"), Fe.debug("The user is not authenticated by the error", a), [2, Promise.reject("The user is not authenticated")]; case 9: return this.user = s, [2, this.user]; } }); }); }, t.prototype.currentSession = function() { var e = this; return Fe.debug("Getting current session"), this.userPool ? new Promise(function(n, r) { e.currentUserPoolUser().then(function(i) { e.userSession(i).then(function(s) { n(s); }).catch(function(s) { Fe.debug("Failed to get the current session", s), r(s); }); }).catch(function(i) { Fe.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 Fe.debug("the user is null"), this.rejectAuthError(Wt.NoUserSession); var r = this._config.clientMetadata; return new Promise(function(i, s) { Fe.debug("Getting the session from this user:", e), e.getSession(function(a, l) { return Zt(n, void 0, void 0, function() { var f; return en(this, function(d) { switch (d.label) { case 0: if (!a) return [3, 5]; if (Fe.debug("Failed to get the session from user", e), !this.isSessionInvalid(a)) 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(), s(new Error("Session is invalid due to: " + a.message + " and failed to clean up invalid session: " + f.message)), [ 2 /*return*/ ]; case 4: return s(a), [ 2 /*return*/ ]; case 5: return Fe.debug("Succeed to get the user session", l), i(l), [ 2 /*return*/ ]; } }); }); }, { clientMetadata: r }); }); }, t.prototype.currentUserCredentials = function() { return Zt(this, void 0, void 0, function() { var e, n, r = this; return en(this, function(i) { switch (i.label) { case 0: Fe.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(), Fe.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 (s) { Fe.debug("failed to get or parse item aws-amplify-federatedInfo", s); } return n ? [2, this.Credentials.refreshFederatedToken(n)] : [2, this.currentSession().then(function(s) { return Fe.debug("getting session success", s), r.Credentials.set(s, "session"); }).catch(function() { return Fe.debug("getting guest credentials"), r.Credentials.set(null, "guest"); })]; } }); }); }, t.prototype.currentCredentials = function() { return Fe.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, s) { e.getAttributeVerificationCode(n, { onSuccess: function(a) { return i(a); }, onFailure: function(a) { return s(a); } }, r); }); }, t.prototype.verifyUserAttributeSubmit = function(e, n, r) { return r ? new Promise(function(i, s) { e.verifyAttribute(n, r, { onSuccess: function(a) { i(a); }, onFailure: function(a) { s(a); } }); }) : this.rejectAuthError(Wt.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 Zt(this, void 0, void 0, function() { var r, i, s = this; return en(this, function(a) { switch (a.label) { case 0: return a.trys.push([0, 2, , 3]), [4, this._storageSync]; case 1: return a.sent(), [3, 3]; case 2: throw r = a.sent(), Fe.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) { Fe.debug("user global sign out", n); var d = s._config.clientMetadata; n.getSession(function(p, v) { return Zt(s, void 0, void 0, function() { var y, k = this; return en(this, function(E) { switch (E.label) { case 0: if (!p) return [3, 5]; if (Fe.debug("failed to get the user session", p), !this.isSessionInvalid(p)) return [3, 4]; E.label = 1; case 1: return E.trys.push([1, 3, , 4]), [4, this.cleanUpInvalidSession(n)]; case 2: return E.sent(), [3, 4]; case 3: return y = E.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(A) { if (Fe.debug("global sign out success"), i) k.oAuthSignOutRedirect(l, f); else return l(); }, onFailure: function(A) { return Fe.debug("global sign out failed", A), f(A); } }), [ 2 /*return*/ ]; } }); }); }, { clientMetadata: d }); } else Fe.debug("user sign out", n), n.signOut(function() { if (i) s.oAuthSignOutRedirect(l, f); else return l(); }); })]; } }); }); }, t.prototype.oAuthSignOutRedirect = function(e, n) { var r = Bs().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 Zt(this, void 0, void 0, function() { var n; return en(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(), Fe.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: Fe.debug("no current Cognito user"), r.label = 6; case 6: return [3, 8]; case 7: Fe.debug("no Cognito User pool"), r.label = 8; case 8: return Vt("signOut", this.user, "A user has been signed out"), this.user = null, [ 2 /*return*/ ]; } }); }); }, t.prototype.cleanCachedItems = function() { return Zt(this, void 0, void 0, function() { return en(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 s = this; return i === void 0 && (i = this._config.clientMetadata), new Promise(function(a, l) { s.userSession(e).then(function(f) { e.changePassword(n, r, function(d, p) { return d ? (Fe.debug("change password failure", d), l(d)) : a(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(Wt.EmptyUsername); var r = this.createCognitoUser(e); return new Promise(function(i, s) { r.forgotPassword({ onSuccess: function() { i(); }, onFailure: function(a) { Fe.debug("forgot password failure", a), Vt("forgotPassword_failure", a, e + " forgotPassword failed"), s(a); }, inputVerificationCode: function(a) { Vt("forgotPassword", r, e + " has initiated forgot password flow"), i(a); } }, 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(Wt.EmptyUsername); if (!n) return this.rejectAuthError(Wt.EmptyCode); if (!r) return this.rejectAuthError(Wt.EmptyPassword); var s = this.createCognitoUser(e); return new Promise(function(a, l) { s.confirmPassword(n, r, { onSuccess: function(f) { Vt("forgotPasswordSubmit", s, e + " forgotPasswordSubmit successful"), a(f); }, onFailure: function(f) { Vt("forgotPasswordSubmit_failure", f, e + " forgotPasswordSubmit failed"), l(f); } }, i); }); }, t.prototype.currentUserInfo = function() { return Zt(this, void 0, void 0, function() { var e, f, n, r, i, s, a, l, f; return en(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 Fe.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 s = d.sent(), Fe.debug("Failed to retrieve credentials while getting current user info", s), [3, 7]; case 7: return a = { id: i ? i.identityId : void 0, username: f.getUsername(), attributes: r }, [2, a]; case 8: return l = d.sent(), Fe.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 Zt(this, void 0, void 0, function() { var i, f, s, a, l, f, d, p, v, y, k, E; return en(this, function(A) { switch (A.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 bv(e) || pU(e) || mU(e) || typeof e > "u" ? (i = e || { provider: Xh.Cognito }, f = bv(i) ? i.provider : i.customProvider, s = (bv(i), i.customState), this._config.userPoolId && (a = 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, a, f, s)), [3, 4]) : [3, 1]; case 1: f = e; try { d = JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user), d && Fe.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 = A.sent(), [4, this.currentAuthenticatedUser()]; case 3: return E = A.sent(), Vt("signIn", E, "A user " + E.username + " has been signed in"), Fe.debug("federated sign in credentials", k), [2, k]; case 4: return [ 2 /*return*/ ]; } }); }); }, t.prototype._handleAuthResponse = function(e) { return Zt(this, void 0, void 0, function() { var n, r, i, s, a, l, f, d, p, v, y, k, E, A; return en(this, function(T) { switch (T.label) { case 0: if (this.oAuthFlowInProgress) return Fe.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 (Vt("parsingCallbackUrl", { url: e }, "The callback url is being parsed"), n = e || (Bs().isBrowser ? window.location.href : ""), r = !!(bo.parse(n).query || "").split("&").map(function(O) { return O.split("="); }).find(function(O) { var R = dE(O, 1), U = R[0]; return U === "code" || U === "error"; }), i = !!(bo.parse(n).hash || "#").substr(1).split("&").map(function(O) { return O.split("="); }).find(function(O) { var R = dE(O, 1), U = R[0]; return U === "access_token" || U === "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 s = T.sent(), a = s.accessToken, l = s.idToken, f = s.refreshToken, d = s.state, p = new Oy({ IdToken: new Ty({ IdToken: l }), RefreshToken: new Iy({ RefreshToken: f }), AccessToken: new xy({ AccessToken: a }) }), v = void 0, this._config.identityPoolId ? [4, this.Credentials.set(p, "session")] : [3, 5]; case 4: v = T.sent(), Fe.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), Vt("signIn", k, "A user " + k.getUsername() + " has been signed in"), Vt("cognitoHostedUI", k, "A user " + k.getUsername() + " has been signed in via Cognito Hosted UI"), y && (E = d.split("-").splice(1).join("-"), Vt("customOAuthState", vD(E), "State for user " + k.getUsername())), [2, v]; case 6: return A = T.sent(), Fe.debug("Error in cognito hosted auth response", A), window && typeof window.history < "u" && window.history.replaceState({}, null, this._config.oauth.redirectSignIn), Vt("signIn_failure", A, "The OAuth response flow failed"), Vt("cognitoHostedUI_failure", A, "A failure occurred when returning to the Cognito Hosted UI"), Vt("customState_failure", A, "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 Py(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) ? Wt.MissingAuthConfig : Wt.NoConfig; }, t.prototype.rejectAuthError = function(e) { return Promise.reject(new _o(e)); }, t.prototype.rejectNoUserPool = function() { var e = this.noUserPoolErrorHandler(this._config); return Promise.reject(new a3(e)); }, t.prototype.rememberDevice = function() { return Zt(this, void 0, void 0, function() { var e, n; return en(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(), Fe.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, s) { e.setDeviceStatusRemembered({ onSuccess: function(a) { i(a); }, onFailure: function(a) { a.code === "InvalidParameterException" ? s(new _o(Wt.DeviceConfig)) : a.code === "NetworkError" ? s(new _o(Wt.NetworkError)) : s(a); } }); })]; } }); }); }, t.prototype.forgetDevice = function() { return Zt(this, void 0, void 0, function() { var e, n; return en(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(), Fe.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, s) { e.forgetDevice({ onSuccess: function(a) { i(a); }, onFailure: function(a) { a.code === "InvalidParameterException" ? s(new _o(Wt.DeviceConfig)) : a.code === "NetworkError" ? s(new _o(Wt.NetworkError)) : s(a); } }); })]; } }); }); }, t.prototype.fetchDevices = function() { return Zt(this, void 0, void 0, function() { var e, n; return en(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(), Fe.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, s) { var a = { 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" ? s(new _o(Wt.DeviceConfig)) : l.code === "NetworkError" ? s(new _o(Wt.NetworkError)) : s(l); } }; e.listDevices(d3, null, a); })]; } }); }); }, t; }() ), JC = new h3(null); Nw.register(JC); const p3 = { NZ_AWS_REGION: "us-east-1" }, { NZ_AWS_REGION: m3, NZ_CORE_SERVICES_GRAPHQL_URL: g3, NZ_CORE_SERVICES_REST_URL: v3 } = p3, wd = { AWS: { region: m3, cognito: { userPoolId: "us-east-1_EZ7wuZ4ig", userPoolWebClientId: "2jok7cst8ebf6ppscrhji57gvr" } }, // Back services apiUrls: { restV2: v3 || "https://core-services-prod.nizza.com/api", graphql: g3 || "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 XC(t, e) { return function() { return t.apply(e, arguments); }; } const { toString: y3 } = Object.prototype, { getPrototypeOf: Mw } = Object, Op = /* @__PURE__ */ ((t) => (e) => { const n = y3.call(e); return t[n] || (t[n] = n.slice(8, -1).toLowerCase()); })(/* @__PURE__ */ Object.create(null)), Fi = (t) => (t = t.toLowerCase(), (e) => Op(e) === t), Pp = (t) => (e) => typeof e === t, { isArray: Ol } = Array, _d = Pp("undefined"); function w3(t) { return t !== null && !_d(t) && t.constructor !== null && !_d(t.constructor) && Hr(t.constructor.isBuffer) && t.constructor.isBuffer(t); } const ZC = Fi("ArrayBuffer"); function _3(t) { let e; return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && ZC(t.buffer), e; } const S3 = Pp("string"), Hr = Pp("function"), ex = Pp("number"), Dp = (t) => t !== null && typeof t == "object", b3 = (t) => t === !0 || t === !1, xh = (t) => { if (Op(t) !== "object") return !1; const e = Mw(t); return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t); }, k3 = Fi("Date"), E3 = Fi("File"), A3 = Fi("Blob"), C3 = Fi("FileList"), x3 = (t) => Dp(t) && Hr(t.pipe), N3 = (t) => { let e; return t && (typeof FormData == "function" && t instanceof FormData || Hr(t.append) && ((e = Op(t)) === "formdata" || // detect form-data instance e === "object" && Hr(t.toString) && t.toString() === "[object FormData]")); }, T3 = Fi("URLSearchParams"), [I3, R3, O3, P3] = ["ReadableStream", "Request", "Response", "Headers"].map(Fi), D3 = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); function Rd(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 s = n ? Object.getOwnPropertyNames(t) : Object.keys(t), a = s.length; let l; for (r = 0; r < a; r++) l = s[r], e.call(null, t[l], l, t); } } function tx(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, nx = (t) => !_d(t) && t !== Ma; function Uy() { const { caseless: t } = nx(this) && this || {}, e = {}, n = (r, i) => { const s = t && tx(e, i) || i; xh(e[s]) && xh(r) ? e[s] = Uy(e[s], r) : xh(r) ? e[s] = Uy({}, r) : Ol(r) ? e[s] = r.slice() : e[s] = r; }; for (let r = 0, i = arguments.length; r < i; r++) arguments[r] && Rd(arguments[r], n); return e; } const F3 = (t, e, n, { allOwnKeys: r } = {}) => (Rd(e, (i, s) => { n && Hr(i) ? t[s] = XC(i, n) : t[s] = i; }, { allOwnKeys: r }), t), L3 = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), U3 = (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); }, M3 = (t, e, n, r) => { let i, s, a; const l = {}; if (e = e || {}, t == null) return e; do { for (i = Object.getOwnPropertyNames(t), s = i.length; s-- > 0; ) a = i[s], (!r || r(a, t, e)) && !l[a] && (e[a] = t[a], l[a] = !0); t = n !== !1 && Mw(t); } while (t && (!n || n(t, e)) && t !== Object.prototype); return e; }, B3 = (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; }, j3 = (t) => { if (!t) return null; if (Ol(t)) return t; let e = t.length; if (!ex(e)) return null; const n = new Array(e); for (; e-- > 0; ) n[e] = t[e]; return n; }, $3 = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Mw(Uint8Array)), V3 = (t, e) => { const r = (t && t[Symbol.iterator]).call(t); let i; for (; (i = r.next()) && !i.done; ) { const s = i.value; e.call(t, s[0], s[1]); } }, z3 = (t, e) => { let n; const r = []; for (; (n = t.exec(e)) !== null; ) r.push(n); return r; }, q3 = Fi("HTMLFormElement"), H3 = (t) => t.toLowerCase().replace( /[-_\s]([a-z\d])(\w*)/g, function(n, r, i) { return r.toUpperCase() + i; } ), hE = (({ hasOwnProperty: t }) => (e, n) => t.call(e, n))(Object.prototype), K3 = Fi("RegExp"), rx = (t, e) => { const n = Object.getOwnPropertyDescriptors(t), r = {}; Rd(n, (i, s) => { let a; (a = e(i, s, t)) !== !1 && (r[s] = a || i); }), Object.defineProperties(t, r); }, G3 = (t) => { rx(t, (e, n) => { if (Hr(t) && ["arguments", "caller", "callee"].indexOf(n) !== -1) return !1; const r = t[n]; if (Hr(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 + "'"); }); } }); }, W3 = (t, e) => { const n = {}, r = (i) => { i.forEach((s) => { n[s] = !0; }); }; return Ol(t) ? r(t) : r(String(t).split(e)), n; }, Y3 = () => { }, Q3 = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, Tv = "abcdefghijklmnopqrstuvwxyz", pE = "0123456789", ix = { DIGIT: pE, ALPHA: Tv, ALPHA_DIGIT: Tv + Tv.toUpperCase() + pE }, J3 = (t = 16, e = ix.ALPHA_DIGIT) => { let n = ""; const { length: r } = e; for (; t--; ) n += e[Math.random() * r | 0]; return n; }; function X3(t) { return !!(t && Hr(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]); } const Z3 = (t) => { const e = new Array(10), n = (r, i) => { if (Dp(r)) { if (e.indexOf(r) >= 0) return; if (!("toJSON" in r)) { e[i] = r; const s = Ol(r) ? [] : {}; return Rd(r, (a, l) => { const f = n(a, i + 1); !_d(f) && (s[l] = f); }), e[i] = void 0, s; } } return r; }; return n(t, 0); }, eB = Fi("AsyncFunction"), tB = (t) => t && (Dp(t) || Hr(t)) && Hr(t.then) && Hr(t.catch), sx = ((t, e) => t ? setImmediate : e ? ((n, r) => (Ma.addEventListener("message", ({ source: i, data: s }) => { i === Ma && s === n && r.length && r.shift()(); }, !1), (i) => { r.push(i), Ma.postMessage(n, "*"); }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))( typeof setImmediate == "function", Hr(Ma.postMessage) ), nB = typeof queueMicrotask < "u" ? queueMicrotask.bind(Ma) : typeof process < "u" && process.nextTick || sx, Se = { isArray: Ol, isArrayBuffer: ZC, isBuffer: w3, isFormData: N3, isArrayBufferView: _3, isString: S3, isNumber: ex, isBoolean: b3, isObject: Dp, isPlainObject: xh, isReadableStream: I3, isRequest: R3, isResponse: O3, isHeaders: P3, isUndefined: _d, isDate: k3, isFile: E3, isBlob: A3, isRegExp: K3, isFunction: Hr, isStream: x3, isURLSearchParams: T3, isTypedArray: $3, isFileList: C3, forEach: Rd, merge: Uy, extend: F3, trim: D3, stripBOM: L3, inherits: U3, toFlatObject: M3, kindOf: Op, kindOfTest: Fi, endsWith: B3, toArray: j3, forEachEntry: V3, matchAll: z3, isHTMLForm: q3, hasOwnProperty: hE, hasOwnProp: hE, // an alias to avoid ESLint no-prototype-builtins detection reduceDescriptors: rx, freezeMethods: G3, toObjectSet: W3, toCamelCase: H3, noop: Y3, toFiniteNumber: Q3, findKey: tx, global: Ma, isContextDefined: nx, ALPHABET: ix, generateString: J3, isSpecCompliantForm: X3, toJSONObject: Z3, isAsyncFn: eB, isThenable: tB, setImmediate: sx, asap: nB }; function Nt(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(Nt, 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 ox = Nt.prototype, ax = {}; [ "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) => { ax[t] = { value: t }; }); Object.defineProperties(Nt, ax); Object.defineProperty(ox, "isAxiosError", { value: !0 }); Nt.from = (t, e, n, r, i, s) => { const a = Object.create(ox); return Se.toFlatObject(t, a, function(f) { return f !== Error.prototype; }, (l) => l !== "isAxiosError"), Nt.call(a, t.message, e, n, r, i), a.cause = t, a.name = t.name, s && Object.assign(a, s), a; }; const rB = null; function My(t) { return Se.isPlainObject(t) || Se.isArray(t); } function ux(t) { return Se.endsWith(t, "[]") ? t.slice(0, -2) : t; } function mE(t, e, n) { return t ? t.concat(e).map(function(i, s) { return i = ux(i), !n && s ? "[" + i + "]" : i; }).join(n ? "." : "") : e; } function iB(t) { return Se.isArray(t) && !t.some(My); } const sB = Se.toFlatObject(Se, {}, null, function(e) { return /^is[A-Z]/.test(e); }); function Fp(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(A, T) { return !Se.isUndefined(T[A]); }); const r = n.metaTokens, i = n.visitor || p, s = n.dots, a = 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(E) { if (E === null) return ""; if (Se.isDate(E)) return E.toISOString(); if (!f && Se.isBlob(E)) throw new Nt("Blob is not supported. Use a Buffer instead."); return Se.isArrayBuffer(E) || Se.isTypedArray(E) ? f && typeof Blob == "function" ? new Blob([E]) : Buffer.from(E) : E; } function p(E, A, T) { let O = E; if (E && !T && typeof E == "object") { if (Se.endsWith(A, "{}")) A = r ? A : A.slice(0, -2), E = JSON.stringify(E); else if (Se.isArray(E) && iB(E) || (Se.isFileList(E) || Se.endsWith(A, "[]")) && (O = Se.toArray(E))) return A = ux(A), O.forEach(function(U, j) { !(Se.isUndefined(U) || U === null) && e.append( // eslint-disable-next-line no-nested-ternary a === !0 ? mE([A], j, s) : a === null ? A : A + "[]", d(U) ); }), !1; } return My(E) ? !0 : (e.append(mE(T, A, s), d(E)), !1); } const v = [], y = Object.assign(sB, { defaultVisitor: p, convertValue: d, isVisitable: My }); function k(E, A) { if (!Se.isUndefined(E)) { if (v.indexOf(E) !== -1) throw Error("Circular reference detected in " + A.join(".")); v.push(E), Se.forEach(E, function(O, R) { (!(Se.isUndefined(O) || O === null) && i.call( e, O, Se.isString(R) ? R.trim() : R, A, y )) === !0 && k(O, A ? A.concat(R) : [R]); }), v.pop(); } } if (!Se.isObject(t)) throw new TypeError("data must be an object"); return k(t), e; } function gE(t) { const e = { "!": "%21", "'": "%27", "(": "%28", ")": "%29", "~": "%7E", "%20": "+", "%00": "\0" }; return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(r) { return e[r]; }); } function Bw(t, e) { this._pairs = [], t && Fp(t, this, e); } const lx = Bw.prototype; lx.append = function(e, n) { this._pairs.push([e, n]); }; lx.toString = function(e) { const n = e ? function(r) { return e.call(this, r, gE); } : gE; return this._pairs.map(function(i) { return n(i[0]) + "=" + n(i[1]); }, "").join("&"); }; function oB(t) { return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } function cx(t, e, n) { if (!e) return t; const r = n && n.encode || oB, i = n && n.serialize; let s; if (i ? s = i(e, n) : s = Se.isURLSearchParams(e) ? e.toString() : new Bw(e, n).toString(r), s) { const a = t.indexOf("#"); a !== -1 && (t = t.slice(0, a)), t += (t.indexOf("?") === -1 ? "?" : "&") + s; } return t; } class vE { 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 dx = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 }, aB = typeof URLSearchParams < "u" ? URLSearchParams : Bw, uB = typeof FormData < "u" ? FormData : null, lB = typeof Blob < "u" ? Blob : null, cB = { isBrowser: !0, classes: { URLSearchParams: aB, FormData: uB, Blob: lB }, protocols: ["http", "https", "file", "blob", "url", "data"] }, jw = typeof window < "u" && typeof document < "u", By = typeof navigator == "object" && navigator || void 0, dB = jw && (!By || ["ReactNative", "NativeScript", "NS"].indexOf(By.product) < 0), fB = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef self instanceof WorkerGlobalScope && typeof self.importScripts == "function", hB = jw && window.location.href || "http://localhost", pB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, hasBrowserEnv: jw, hasStandardBrowserEnv: dB, hasStandardBrowserWebWorkerEnv: fB, navigator: By, origin: hB }, Symbol.toStringTag, { value: "Module" })), Tr = { ...pB, ...cB }; function mB(t, e) { return Fp(t, new Tr.classes.URLSearchParams(), Object.assign({ visitor: function(n, r, i, s) { return Tr.isNode && Se.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments); } }, e)); } function gB(t) { return Se.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]); } function vB(t) { const e = {}, n = Object.keys(t); let r; const i = n.length; let s; for (r = 0; r < i; r++) s = n[r], e[s] = t[s]; return e; } function fx(t) { function e(n, r, i, s) { let a = n[s++]; if (a === "__proto__") return !0; const l = Number.isFinite(+a), f = s >= n.length; return a = !a && Se.isArray(i) ? i.length : a, f ? (Se.hasOwnProp(i, a) ? i[a] = [i[a], r] : i[a] = r, !l) : ((!i[a] || !Se.isObject(i[a])) && (i[a] = []), e(n, r, i[a], s) && Se.isArray(i[a]) && (i[a] = vB(i[a])), !l); } if (Se.isFormData(t) && Se.isFunction(t.entries)) { const n = {}; return Se.forEachEntry(t, (r, i) => { e(gB(r), i, n, 0); }), n; } return null; } function yB(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 Od = { transitional: dx, adapter: ["xhr", "http", "fetch"], transformRequest: [function(e, n) { const r = n.getContentType() || "", i = r.indexOf("application/json") > -1, s = Se.isObject(e); if (s && Se.isHTMLForm(e) && (e = new FormData(e)), Se.isFormData(e)) return i ? JSON.stringify(fx(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 (s) { if (r.indexOf("application/x-www-form-urlencoded") > -1) return mB(e, this.formSerializer).toString(); if ((l = Se.isFileList(e)) || r.indexOf("multipart/form-data") > -1) { const f = this.env && this.env.FormData; return Fp( l ? { "files[]": e } : e, f && new f(), this.formSerializer ); } } return s || i ? (n.setContentType("application/json", !1), yB(e)) : e; }], transformResponse: [function(e) { const n = this.transitional || Od.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 a = !(n && n.silentJSONParsing) && i; try { return JSON.parse(e); } catch (l) { if (a) throw l.name === "SyntaxError" ? Nt.from(l, Nt.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: Tr.classes.FormData, Blob: Tr.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) => { Od.headers[t] = {}; }); const wB = 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" ]), _B = (t) => { const e = {}; let n, r, i; return t && t.split(` `).forEach(function(a) { i = a.indexOf(":"), n = a.substring(0, i).trim().toLowerCase(), r = a.substring(i + 1).trim(), !(!n || e[n] && wB[n]) && (n === "set-cookie" ? e[n] ? e[n].push(r) : e[n] = [r] : e[n] = e[n] ? e[n] + ", " + r : r); }), e; }, yE = Symbol("internals"); function $c(t) { return t && String(t).trim().toLowerCase(); } function Nh(t) { return t === !1 || t == null ? t : Se.isArray(t) ? t.map(Nh) : String(t); } function SB(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 bB = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()); function Iv(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 kB(t) { return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, n, r) => n.toUpperCase() + r); } function EB(t, e) { const n = Se.toCamelCase(" " + e); ["get", "set", "has"].forEach((r) => { Object.defineProperty(t, r + n, { value: function(i, s, a) { return this[r].call(this, e, i, s, a); }, configurable: !0 }); }); } let Ir = class { constructor(e) { e && this.set(e); } set(e, n, r) { const i = this; function s(l, f, d) { const p = $c(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] = Nh(l)); } const a = (l, f) => Se.forEach(l, (d, p) => s(d, p, f)); if (Se.isPlainObject(e) || e instanceof this.constructor) a(e, n); else if (Se.isString(e) && (e = e.trim()) && !bB(e)) a(_B(e), n); else if (Se.isHeaders(e)) for (const [l, f] of e.entries()) s(f, l, r); else e != null && s(n, e, r); return this; } get(e, n) { if (e = $c(e), e) { const r = Se.findKey(this, e); if (r) { const i = this[r]; if (!n) return i; if (n === !0) return SB(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 = $c(e), e) { const r = Se.findKey(this, e); return !!(r && this[r] !== void 0 && (!n || Iv(this, this[r], r, n))); } return !1; } delete(e, n) { const r = this; let i = !1; function s(a) { if (a = $c(a), a) { const l = Se.findKey(r, a); l && (!n || Iv(r, r[l], l, n)) && (delete r[l], i = !0); } } return Se.isArray(e) ? e.forEach(s) : s(e), i; } clear(e) { const n = Object.keys(this); let r = n.length, i = !1; for (; r--; ) { const s = n[r]; (!e || Iv(this, this[s], s, e, !0)) && (delete this[s], i = !0); } return i; } normalize(e) { const n = this, r = {}; return Se.forEach(this, (i, s) => { const a = Se.findKey(r, s); if (a) { n[a] = Nh(i), delete n[s]; return; } const l = e ? kB(s) : String(s).trim(); l !== s && delete n[s], n[l] = Nh(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[yE] = this[yE] = { accessors: {} }).accessors, i = this.prototype; function s(a) { const l = $c(a); r[l] || (EB(i, a), r[l] = !0); } return Se.isArray(e) ? e.forEach(s) : s(e), this; } }; Ir.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); Se.reduceDescriptors(Ir.prototype, ({ value: t }, e) => { let n = e[0].toUpperCase() + e.slice(1); return { get: () => t, set(r) { this[n] = r; } }; }); Se.freezeMethods(Ir); function Rv(t, e) { const n = this || Od, r = e || n, i = Ir.from(r.headers); let s = r.data; return Se.forEach(t, function(l) { s = l.call(n, s, i.normalize(), e ? e.status : void 0); }), i.normalize(), s; } function hx(t) { return !!(t && t.__CANCEL__); } function Pl(t, e, n) { Nt.call(this, t ?? "canceled", Nt.ERR_CANCELED, e, n), this.name = "CanceledError"; } Se.inherits(Pl, Nt, { __CANCEL__: !0 }); function px(t, e, n) { const r = n.config.validateStatus; !n.status || !r || r(n.status) ? t(n) : e(new Nt( "Request failed with status code " + n.status, [Nt.ERR_BAD_REQUEST, Nt.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4], n.config, n.request, n )); } function AB(t) { const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t); return e && e[1] || ""; } function CB(t, e) { t = t || 10; const n = new Array(t), r = new Array(t); let i = 0, s = 0, a; return e = e !== void 0 ? e : 1e3, function(f) { const d = Date.now(), p = r[s]; a || (a = d), n[i] = f, r[i] = d; let v = s, y = 0; for (; v !== i; ) y += n[v++], v = v % t; if (i = (i + 1) % t, i === s && (s = (s + 1) % t), d - a < e) return; const k = p && d - p; return k ? Math.round(y * 1e3 / k) : void 0; }; } function xB(t, e) { let n = 0, r = 1e3 / e, i, s; const a = (d, p = Date.now()) => { n = p, i = null, s && (clearTimeout(s), s = null), t.apply(null, d); }; return [(...d) => { const p = Date.now(), v = p - n; v >= r ? a(d, p) : (i = d, s || (s = setTimeout(() => { s = null, a(i); }, r - v))); }, () => i && a(i)]; } const tp = (t, e, n = 3) => { let r = 0; const i = CB(50, 250); return xB((s) => { const a = s.loaded, l = s.lengthComputable ? s.total : void 0, f = a - r, d = i(f), p = a <= l; r = a; const v = { loaded: a, total: l, progress: l ? a / l : void 0, bytes: f, rate: d || void 0, estimated: d && l && p ? (l - a) / d : void 0, event: s, lengthComputable: l != null, [e ? "download" : "upload"]: !0 }; t(v); }, n); }, wE = (t, e) => { const n = t != null; return [(r) => e[0]({ lengthComputable: n, total: t, loaded: r }), e[1]]; }, _E = (t) => (...e) => Se.asap(() => t(...e)), NB = Tr.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 = Tr.navigator && /(msie|trident)/i.test(Tr.navigator.userAgent), n = document.createElement("a"); let r; function i(s) { let a = s; return e && (n.setAttribute("href", a), a = n.href), n.setAttribute("href", a), { 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(a) { const l = Se.isString(a) ? i(a) : a; 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; }; }() ), TB = Tr.hasStandardBrowserEnv ? ( // Standard browser envs support document.cookie { write(t, e, n, r, i, s) { const a = [t + "=" + encodeURIComponent(e)]; Se.isNumber(n) && a.push("expires=" + new Date(n).toGMTString()), Se.isString(r) && a.push("path=" + r), Se.isString(i) && a.push("domain=" + i), s === !0 && a.push("secure"), document.cookie = a.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 IB(t) { return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t); } function RB(t, e) { return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t; } function mx(t, e) { return t && !IB(e) ? RB(t, e) : e; } const SE = (t) => t instanceof Ir ? { ...t } : t; function Qa(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 s(d, p) { if (!Se.isUndefined(p)) return r(void 0, p); } function a(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: s, method: s, data: s, baseURL: a, transformRequest: a, transformResponse: a, paramsSerializer: a, timeout: a, timeoutMessage: a, withCredentials: a, withXSRFToken: a, adapter: a, responseType: a, xsrfCookieName: a, xsrfHeaderName: a, onUploadProgress: a, onDownloadProgress: a, decompress: a, maxContentLength: a, maxBodyLength: a, beforeRedirect: a, transport: a, httpAgent: a, httpsAgent: a, cancelToken: a, socketPath: a, responseEncoding: a, validateStatus: l, headers: (d, p) => i(SE(d), SE(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 gx = (t) => { const e = Qa({}, t); let { data: n, withXSRFToken: r, xsrfHeaderName: i, xsrfCookieName: s, headers: a, auth: l } = e; e.headers = a = Ir.from(a), e.url = cx(mx(e.baseURL, e.url), t.params, t.paramsSerializer), l && a.set( "Authorization", "Basic " + btoa((l.username || "") + ":" + (l.password ? unescape(encodeURIComponent(l.password)) : "")) ); let f; if (Se.isFormData(n)) { if (Tr.hasStandardBrowserEnv || Tr.hasStandardBrowserWebWorkerEnv) a.setContentType(void 0); else if ((f = a.getContentType()) !== !1) { const [d, ...p] = f ? f.split(";").map((v) => v.trim()).filter(Boolean) : []; a.setContentType([d || "multipart/form-data", ...p].join("; ")); } } if (Tr.hasStandardBrowserEnv && (r && Se.isFunction(r) && (r = r(e)), r || r !== !1 && NB(e.url))) { const d = i && s && TB.read(s); d && a.set(i, d); } return e; }, OB = typeof XMLHttpRequest < "u", PB = OB && function(t) { return new Promise(function(n, r) { const i = gx(t); let s = i.data; const a = Ir.from(i.headers).normalize(); let { responseType: l, onUploadProgress: f, onDownloadProgress: d } = i, p, v, y, k, E; function A() { k && k(), E && E(), 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 O() { if (!T) return; const U = Ir.from( "getAllResponseHeaders" in T && T.getAllResponseHeaders() ), K = { data: !l || l === "text" || l === "json" ? T.responseText : T.response, status: T.status, statusText: T.statusText, headers: U, config: t, request: T }; px(function(ce) { n(ce), A(); }, function(ce) { r(ce), A(); }, K), T = null; } "onloadend" in T ? T.onloadend = O : T.onreadystatechange = function() { !T || T.readyState !== 4 || T.status === 0 && !(T.responseURL && T.responseURL.indexOf("file:") === 0) || setTimeout(O); }, T.onabort = function() { T && (r(new Nt("Request aborted", Nt.ECONNABORTED, t, T)), T = null); }, T.onerror = function() { r(new Nt("Network Error", Nt.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 || dx; i.timeoutErrorMessage && (j = i.timeoutErrorMessage), r(new Nt( j, K.clarifyTimeoutError ? Nt.ETIMEDOUT : Nt.ECONNABORTED, t, T )), T = null; }, s === void 0 && a.setContentType(null), "setRequestHeader" in T && Se.forEach(a.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, E] = tp(d, !0), T.addEventListener("progress", y)), f && T.upload && ([v, k] = tp(f), T.upload.addEventListener("progress", v), T.upload.addEventListener("loadend", k)), (i.cancelToken || i.signal) && (p = (U) => { T && (r(!U || U.type ? new Pl(null, t, T) : U), T.abort(), T = null); }, i.cancelToken && i.cancelToken.subscribe(p), i.signal && (i.signal.aborted ? p() : i.signal.addEventListener("abort", p))); const R = AB(i.url); if (R && Tr.protocols.indexOf(R) === -1) { r(new Nt("Unsupported protocol " + R + ":", Nt.ERR_BAD_REQUEST, t)); return; } T.send(s || null); }); }, DB = (t, e) => { const { length: n } = t = t ? t.filter(Boolean) : []; if (e || n) { let r = new AbortController(), i; const s = function(d) { if (!i) { i = !0, l(); const p = d instanceof Error ? d : this.reason; r.abort(p instanceof Nt ? p : new Pl(p instanceof Error ? p.message : p)); } }; let a = e && setTimeout(() => { a = null, s(new Nt(`timeout ${e} of ms exceeded`, Nt.ETIMEDOUT)); }, e); const l = () => { t && (a && clearTimeout(a), a = null, t.forEach((d) => { d.unsubscribe ? d.unsubscribe(s) : d.removeEventListener("abort", s); }), t = null); }; t.forEach((d) => d.addEventListener("abort", s)); const { signal: f } = r; return f.unsubscribe = () => Se.asap(l), f; } }, FB = 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; }, LB = async function* (t, e) { for await (const n of UB(t)) yield* FB(n, e); }, UB = 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(); } }, bE = (t, e, n, r) => { const i = LB(t, e); let s = 0, a, l = (f) => { a || (a = !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 = s += v; n(y); } f.enqueue(new Uint8Array(p)); } catch (d) { throw l(d), d; } }, cancel(f) { return l(f), i.return(); } }, { highWaterMark: 2 }); }, Lp = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", vx = Lp && typeof ReadableStream == "function", MB = Lp && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), yx = (t, ...e) => { try { return !!t(...e); } catch { return !1; } }, BB = vx && yx(() => { let t = !1; const e = new Request(Tr.origin, { body: new ReadableStream(), method: "POST", get duplex() { return t = !0, "half"; } }).headers.has("Content-Type"); return t && !e; }), kE = 64 * 1024, jy = vx && yx(() => Se.isReadableStream(new Response("").body)), np = { stream: jy && ((t) => t.body) }; Lp && ((t) => { ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => { !np[e] && (np[e] = Se.isFunction(t[e]) ? (n) => n[e]() : (n, r) => { throw new Nt(`Response type '${e}' is not supported`, Nt.ERR_NOT_SUPPORT, r); }); }); })(new Response()); const jB = async (t) => { if (t == null) return 0; if (Se.isBlob(t)) return t.size; if (Se.isSpecCompliantForm(t)) return (await new Request(Tr.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 MB(t)).byteLength; }, $B = async (t, e) => { const n = Se.toFiniteNumber(t.getContentLength()); return n ?? jB(e); }, VB = Lp && (async (t) => { let { url: e, method: n, data: r, signal: i, cancelToken: s, timeout: a, onDownloadProgress: l, onUploadProgress: f, responseType: d, headers: p, withCredentials: v = "same-origin", fetchOptions: y } = gx(t); d = d ? (d + "").toLowerCase() : "text"; let k = DB([i, s && s.toAbortSignal()], a), E; const A = k && k.unsubscribe && (() => { k.unsubscribe(); }); let T; try { if (f && BB && n !== "get" && n !== "head" && (T = await $B(p, r)) !== 0) { let K = new Request(e, { method: "POST", body: r, duplex: "half" }), ie; if (Se.isFormData(r) && (ie = K.headers.get("content-type")) && p.setContentType(ie), K.body) { const [ce, H] = wE( T, tp(_E(f)) ); r = bE(K.body, kE, ce, H); } } Se.isString(v) || (v = v ? "include" : "omit"); const O = "credentials" in Request.prototype; E = new Request(e, { ...y, signal: k, method: n.toUpperCase(), headers: p.normalize().toJSON(), body: r, duplex: "half", credentials: O ? v : void 0 }); let R = await fetch(E); const U = jy && (d === "stream" || d === "response"); if (jy && (l || U && A)) { const K = {}; ["status", "statusText", "headers"].forEach((ye) => { K[ye] = R[ye]; }); const ie = Se.toFiniteNumber(R.headers.get("content-length")), [ce, H] = l && wE( ie, tp(_E(l), !0) ) || []; R = new Response( bE(R.body, kE, ce, () => { H && H(), A && A(); }), K ); } d = d || "text"; let j = await np[Se.findKey(np, d) || "text"](R, t); return !U && A && A(), await new Promise((K, ie) => { px(K, ie, { data: j, headers: Ir.from(R.headers), status: R.status, statusText: R.statusText, config: t, request: E }); }); } catch (O) { throw A && A(), O && O.name === "TypeError" && /fetch/i.test(O.message) ? Object.assign( new Nt("Network Error", Nt.ERR_NETWORK, t, E), { cause: O.cause || O } ) : Nt.from(O, O && O.code, t, E); } }), $y = { http: rB, xhr: PB, fetch: VB }; Se.forEach($y, (t, e) => { if (t) { try { Object.defineProperty(t, "name", { value: e }); } catch { } Object.defineProperty(t, "adapterName", { value: e }); } }); const EE = (t) => `- ${t}`, zB = (t) => Se.isFunction(t) || t === null || t === !1, wx = { getAdapter: (t) => { t = Se.isArray(t) ? t : [t]; const { length: e } = t; let n, r; const i = {}; for (let s = 0; s < e; s++) { n = t[s]; let a; if (r = n, !zB(n) && (r = $y[(a = String(n)).toLowerCase()], r === void 0)) throw new Nt(`Unknown adapter '${a}'`); if (r) break; i[a || "#" + s] = r; } if (!r) { const s = Object.entries(i).map( ([l, f]) => `adapter ${l} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build") ); let a = e ? s.length > 1 ? `since : ` + s.map(EE).join(` `) : " " + EE(s[0]) : "as no adapter specified"; throw new Nt( "There is no suitable adapter to dispatch the request " + a, "ERR_NOT_SUPPORT" ); } return r; }, adapters: $y }; function Ov(t) { if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new Pl(null, t); } function AE(t) { return Ov(t), t.headers = Ir.from(t.headers), t.data = Rv.call( t, t.transformRequest ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), wx.getAdapter(t.adapter || Od.adapter)(t).then(function(r) { return Ov(t), r.data = Rv.call( t, t.transformResponse, r ), r.headers = Ir.from(r.headers), r; }, function(r) { return hx(r) || (Ov(t), r && r.response && (r.response.data = Rv.call( t, t.transformResponse, r.response ), r.response.headers = Ir.from(r.response.headers))), Promise.reject(r); }); } const _x = "1.7.7", $w = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => { $w[t] = function(r) { return typeof r === t || "a" + (e < 1 ? "n " : " ") + t; }; }); const CE = {}; $w.transitional = function(e, n, r) { function i(s, a) { return "[Axios v" + _x + "] Transitional option '" + s + "'" + a + (r ? ". " + r : ""); } return (s, a, l) => { if (e === !1) throw new Nt( i(a, " has been removed" + (n ? " in " + n : "")), Nt.ERR_DEPRECATED ); return n && !CE[a] && (CE[a] = !0, console.warn( i( a, " has been deprecated since v" + n + " and will be removed in the near future" ) )), e ? e(s, a, l) : !0; }; }; function qB(t, e, n) { if (typeof t != "object") throw new Nt("options must be an object", Nt.ERR_BAD_OPTION_VALUE); const r = Object.keys(t); let i = r.length; for (; i-- > 0; ) { const s = r[i], a = e[s]; if (a) { const l = t[s], f = l === void 0 || a(l, s, t); if (f !== !0) throw new Nt("option " + s + " must be " + f, Nt.ERR_BAD_OPTION_VALUE); continue; } if (n !== !0) throw new Nt("Unknown option " + s, Nt.ERR_BAD_OPTION); } } const Vy = { assertOptions: qB, validators: $w }, yo = Vy.validators; let za = class { constructor(e) { this.defaults = e, this.interceptors = { request: new vE(), response: new vE() }; } /** * 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 s = i.stack ? i.stack.replace(/^.+\n/, "") : ""; try { r.stack ? s && !String(r.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (r.stack += ` ` + s) : r.stack = s; } catch { } } throw r; } } _request(e, n) { typeof e == "string" ? (n = n || {}, n.url = e) : n = e || {}, n = Qa(this.defaults, n); const { transitional: r, paramsSerializer: i, headers: s } = n; r !== void 0 && Vy.assertOptions(r, { silentJSONParsing: yo.transitional(yo.boolean), forcedJSONParsing: yo.transitional(yo.boolean), clarifyTimeoutError: yo.transitional(yo.boolean) }, !1), i != null && (Se.isFunction(i) ? n.paramsSerializer = { serialize: i } : Vy.assertOptions(i, { encode: yo.function, serialize: yo.function }, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase(); let a = s && Se.merge( s.common, s[n.method] ); s && Se.forEach( ["delete", "get", "head", "post", "put", "patch", "common"], (E) => { delete s[E]; } ), n.headers = Ir.concat(a, s); const l = []; let f = !0; this.interceptors.request.forEach(function(A) { typeof A.runWhen == "function" && A.runWhen(n) === !1 || (f = f && A.synchronous, l.unshift(A.fulfilled, A.rejected)); }); const d = []; this.interceptors.response.forEach(function(A) { d.push(A.fulfilled, A.rejected); }); let p, v = 0, y; if (!f) { const E = [AE.bind(this), void 0]; for (E.unshift.apply(E, l), E.push.apply(E, d), y = E.length, p = Promise.resolve(n); v < y; ) p = p.then(E[v++], E[v++]); return p; } y = l.length; let k = n; for (v = 0; v < y; ) { const E = l[v++], A = l[v++]; try { k = E(k); } catch (T) { A.call(this, T); break; } } try { p = AE.call(this, k); } catch (E) { return Promise.reject(E); } for (v = 0, y = d.length; v < y; ) p = p.then(d[v++], d[v++]); return p; } getUri(e) { e = Qa(this.defaults, e); const n = mx(e.baseURL, e.url); return cx(n, e.params, e.paramsSerializer); } }; Se.forEach(["delete", "get", "head", "options"], function(e) { za.prototype[e] = function(n, r) { return this.request(Qa(r || {}, { method: e, url: n, data: (r || {}).data })); }; }); Se.forEach(["post", "put", "patch"], function(e) { function n(r) { return function(s, a, l) { return this.request(Qa(l || {}, { method: e, headers: r ? { "Content-Type": "multipart/form-data" } : {}, url: s, data: a })); }; } za.prototype[e] = n(), za.prototype[e + "Form"] = n(!0); }); let HB = class Sx { constructor(e) { if (typeof e != "function") throw new TypeError("executor must be a function."); let n; this.promise = new Promise(function(s) { n = s; }); const r = this; this.promise.then((i) => { if (!r._listeners) return; let s = r._listeners.length; for (; s-- > 0; ) r._listeners[s](i); r._listeners = null; }), this.promise.then = (i) => { let s; const a = new Promise((l) => { r.subscribe(l), s = l; }).then(i); return a.cancel = function() { r.unsubscribe(s); }, a; }, e(function(s, a, l) { r.reason || (r.reason = new Pl(s, a, 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 Sx(function(i) { e = i; }), cancel: e }; } }; function KB(t) { return function(n) { return t.apply(null, n); }; } function GB(t) { return Se.isObject(t) && t.isAxiosError === !0; } const zy = { 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(zy).forEach(([t, e]) => { zy[e] = t; }); function bx(t) { const e = new za(t), n = XC(za.prototype.request, e); return Se.extend(n, za.prototype, e, { allOwnKeys: !0 }), Se.extend(n, e, null, { allOwnKeys: !0 }), n.create = function(i) { return bx(Qa(t, i)); }, n; } const cn = bx(Od); cn.Axios = za; cn.CanceledError = Pl; cn.CancelToken = HB; cn.isCancel = hx; cn.VERSION = _x; cn.toFormData = Fp; cn.AxiosError = Nt; cn.Cancel = cn.CanceledError; cn.all = function(e) { return Promise.all(e); }; cn.spread = KB; cn.isAxiosError = GB; cn.mergeConfig = Qa; cn.AxiosHeaders = Ir; cn.formToJSON = (t) => fx(Se.isHTMLForm(t) ? new FormData(t) : t); cn.getAdapter = wx.getAdapter; cn.HttpStatusCode = zy; cn.default = cn; const { Axios: Tz, AxiosError: Iz, CanceledError: Rz, isCancel: Oz, CancelToken: Pz, VERSION: Dz, all: Fz, Cancel: Lz, isAxiosError: Uz, spread: Mz, toFormData: Bz, AxiosHeaders: jz, HttpStatusCode: $z, formToJSON: Vz, getAdapter: zz, mergeConfig: qz } = cn; class qa extends Error { constructor(n, r) { const i = `${qa.extractMessage(n)}: ${JSON.stringify({ response: n, request: r })}`; super(i); ve(this, "response"); ve(this, "request"); Object.setPrototypeOf(this, qa.prototype), this.response = n, this.request = r, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, qa); } static extractMessage(n) { var r, i; return ((i = (r = n.errors) == null ? void 0 : r[0]) == null ? void 0 : i.message) ?? `GraphQL Error (Code: ${String(n.status)})`; } } const xE = (t) => t.toUpperCase(), Pv = (t) => typeof t == "function" ? t() : t, kx = (t, e) => t.map((n, r) => [n, e[r]]), Wu = (t) => { let e = {}; return t instanceof Headers ? e = WB(t) : Array.isArray(t) ? t.forEach(([n, r]) => { n && r !== void 0 && (e[n] = r); }) : t && (e = t), e; }, WB = (t) => { const e = {}; return t.forEach((n, r) => { e[r] = n; }), e; }, YB = (t) => { try { const e = t(); return QB(e) ? e.catch((n) => NE(n)) : e; } catch (e) { return NE(e); } }, NE = (t) => t instanceof Error ? t : new Error(String(t)), QB = (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", Vw = (t) => { throw new Error(`Unhandled case: ${String(t)}`); }, Th = (t) => typeof t == "object" && t !== null && !Array.isArray(t), JB = (t, e) => t.documents ? t : { documents: t, requestHeaders: e, signal: void 0 }, XB = (t, e, n) => t.query ? t : { query: t, variables: e, requestHeaders: n, signal: void 0 }; function Ih(t, e) { if (!!!t) throw new Error(e); } function ZB(t) { return typeof t == "object" && t !== null; } function ej(t, e) { if (!!!t) throw new Error( "Unexpected invariant triggered." ); } const tj = /\r\n|[\n\r]/g; function qy(t, e) { let n = 0, r = 1; for (const i of t.body.matchAll(tj)) { if (typeof i.index == "number" || ej(!1), i.index >= e) break; n = i.index + i[0].length, r += 1; } return { line: r, column: e + 1 - n }; } function nj(t) { return Ex( t.source, qy(t.source, t.start) ); } function Ex(t, e) { const n = t.locationOffset.column - 1, r = "".padStart(n) + t.body, i = e.line - 1, s = t.locationOffset.line - 1, a = e.line + s, l = e.line === 1 ? n : 0, f = e.column + l, d = `${t.name}:${a}:${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, E = []; for (let A = 0; A < v.length; A += 80) E.push(v.slice(A, A + 80)); return d + TE([ [`${a} |`, E[0]], ...E.slice(1, y + 1).map((A) => ["|", A]), ["|", "^".padStart(k)], ["|", E[y + 1]] ]); } return d + TE([ // Lines specified like this: ["prefix", "string"], [`${a - 1} |`, p[i - 1]], [`${a} |`, v], ["|", "^".padStart(f)], [`${a + 1} |`, p[i + 1]] ]); } function TE(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 rj(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 zw 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, s; const { nodes: a, source: l, positions: f, path: d, originalError: p, extensions: v } = rj(n); super(e), this.name = "GraphQLError", this.path = d ?? void 0, this.originalError = p ?? void 0, this.nodes = IE( Array.isArray(a) ? a : a ? [a] : void 0 ); const y = IE( (r = this.nodes) === null || r === void 0 ? void 0 : r.map((E) => E.loc).filter((E) => E != null) ); this.source = l ?? (y == null || (i = y[0]) === null || i === void 0 ? void 0 : i.source), this.positions = f ?? (y == null ? void 0 : y.map((E) => E.start)), this.locations = f && l ? f.map((E) => qy(l, E)) : y == null ? void 0 : y.map((E) => qy(E.source, E.start)); const k = ZB( p == null ? void 0 : p.extensions ) ? p == null ? void 0 : p.extensions : void 0; this.extensions = (s = v ?? k) !== null && s !== void 0 ? s : /* @__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, zw) : 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 += ` ` + nj(n.loc)); else if (this.source && this.locations) for (const n of this.locations) e += ` ` + Ex(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 IE(t) { return t === void 0 || t.length === 0 ? void 0 : t; } function jn(t, e, n) { return new zw(`Syntax Error: ${n}`, { source: t, positions: [e] }); } class ij { /** * 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 Ax { /** * 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, s, a) { this.kind = e, this.start = n, this.end = r, this.line = i, this.column = s, this.value = a, 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 Cx = { 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"] }, sj = new Set(Object.keys(Cx)); function RE(t) { const e = t == null ? void 0 : t.kind; return typeof e == "string" && sj.has(e); } var sl; (function(t) { t.QUERY = "query", t.MUTATION = "mutation", t.SUBSCRIPTION = "subscription"; })(sl || (sl = {})); var Hy; (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"; })(Hy || (Hy = {})); var yt; (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"; })(yt || (yt = {})); function Ky(t) { return t === 9 || t === 32; } function Sd(t) { return t >= 48 && t <= 57; } function xx(t) { return t >= 97 && t <= 122 || // A-Z t >= 65 && t <= 90; } function Nx(t) { return xx(t) || t === 95; } function oj(t) { return xx(t) || Sd(t) || t === 95; } function aj(t) { var e; let n = Number.MAX_SAFE_INTEGER, r = null, i = -1; for (let a = 0; a < t.length; ++a) { var s; const l = t[a], f = uj(l); f !== l.length && (r = (s = r) !== null && s !== void 0 ? s : a, i = a, a !== 0 && f < n && (n = f)); } return t.map((a, l) => l === 0 ? a : a.slice(n)).slice( (e = r) !== null && e !== void 0 ? e : 0, i + 1 ); } function uj(t) { let e = 0; for (; e < t.length && Ky(t.charCodeAt(e)); ) ++e; return e; } function lj(t, e) { const n = t.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((k) => k.length === 0 || Ky(k.charCodeAt(0))), a = n.endsWith('\\"""'), l = t.endsWith('"') && !a, f = t.endsWith("\\"), d = l || f, p = ( // add leading and trailing new lines only if it improves readability !i || t.length > 70 || d || s || a ); let v = ""; const y = i && Ky(t.charCodeAt(0)); return (p && !y || s) && (v += ` `), v += n, (p || d) && (v += ` `), '"""' + v + '"""'; } var Te; (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"; })(Te || (Te = {})); class cj { /** * 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 Ax(Te.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 !== Te.EOF) do if (e.next) e = e.next; else { const n = fj(this, e.end); e.next = n, n.prev = e, e = n; } while (e.kind === Te.COMMENT); return e; } } function dj(t) { return t === Te.BANG || t === Te.DOLLAR || t === Te.AMP || t === Te.PAREN_L || t === Te.PAREN_R || t === Te.SPREAD || t === Te.COLON || t === Te.EQUALS || t === Te.AT || t === Te.BRACKET_L || t === Te.BRACKET_R || t === Te.BRACE_L || t === Te.PIPE || t === Te.BRACE_R; } function Dl(t) { return t >= 0 && t <= 55295 || t >= 57344 && t <= 1114111; } function Up(t, e) { return Tx(t.charCodeAt(e)) && Ix(t.charCodeAt(e + 1)); } function Tx(t) { return t >= 55296 && t <= 56319; } function Ix(t) { return t >= 56320 && t <= 57343; } function Ja(t, e) { const n = t.source.body.codePointAt(e); if (n === void 0) return Te.EOF; if (n >= 32 && n <= 126) { const r = String.fromCodePoint(n); return r === '"' ? `'"'` : `"${r}"`; } return "U+" + n.toString(16).toUpperCase().padStart(4, "0"); } function In(t, e, n, r, i) { const s = t.line, a = 1 + n - t.lineStart; return new Ax(e, n, r, s, a, i); } function fj(t, e) { const n = t.source.body, r = n.length; let i = e; for (; i < r; ) { const s = n.charCodeAt(i); switch (s) { // 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 hj(t, i); // Token :: // - Punctuator // - Name // - IntValue // - FloatValue // - StringValue // // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } case 33: return In(t, Te.BANG, i, i + 1); case 36: return In(t, Te.DOLLAR, i, i + 1); case 38: return In(t, Te.AMP, i, i + 1); case 40: return In(t, Te.PAREN_L, i, i + 1); case 41: return In(t, Te.PAREN_R, i, i + 1); case 46: if (n.charCodeAt(i + 1) === 46 && n.charCodeAt(i + 2) === 46) return In(t, Te.SPREAD, i, i + 3); break; case 58: return In(t, Te.COLON, i, i + 1); case 61: return In(t, Te.EQUALS, i, i + 1); case 64: return In(t, Te.AT, i, i + 1); case 91: return In(t, Te.BRACKET_L, i, i + 1); case 93: return In(t, Te.BRACKET_R, i, i + 1); case 123: return In(t, Te.BRACE_L, i, i + 1); case 124: return In(t, Te.PIPE, i, i + 1); case 125: return In(t, Te.BRACE_R, i, i + 1); // StringValue case 34: return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ? wj(t, i) : mj(t, i); } if (Sd(s) || s === 45) return pj(t, i, s); if (Nx(s)) return _j(t, i); throw jn( t.source, i, s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : Dl(s) || Up(n, i) ? `Unexpected character: ${Ja(t, i)}.` : `Invalid character: ${Ja(t, i)}.` ); } return In(t, Te.EOF, r, r); } function hj(t, e) { const n = t.source.body, r = n.length; let i = e + 1; for (; i < r; ) { const s = n.charCodeAt(i); if (s === 10 || s === 13) break; if (Dl(s)) ++i; else if (Up(n, i)) i += 2; else break; } return In( t, Te.COMMENT, e, i, n.slice(e + 1, i) ); } function pj(t, e, n) { const r = t.source.body; let i = e, s = n, a = !1; if (s === 45 && (s = r.charCodeAt(++i)), s === 48) { if (s = r.charCodeAt(++i), Sd(s)) throw jn( t.source, i, `Invalid number, unexpected digit after 0: ${Ja( t, i )}.` ); } else i = Dv(t, i, s), s = r.charCodeAt(i); if (s === 46 && (a = !0, s = r.charCodeAt(++i), i = Dv(t, i, s), s = r.charCodeAt(i)), (s === 69 || s === 101) && (a = !0, s = r.charCodeAt(++i), (s === 43 || s === 45) && (s = r.charCodeAt(++i)), i = Dv(t, i, s), s = r.charCodeAt(i)), s === 46 || Nx(s)) throw jn( t.source, i, `Invalid number, expected digit but got: ${Ja( t, i )}.` ); return In( t, a ? Te.FLOAT : Te.INT, e, i, r.slice(e, i) ); } function Dv(t, e, n) { if (!Sd(n)) throw jn( t.source, e, `Invalid number, expected digit but got: ${Ja( t, e )}.` ); const r = t.source.body; let i = e + 1; for (; Sd(r.charCodeAt(i)); ) ++i; return i; } function mj(t, e) { const n = t.source.body, r = n.length; let i = e + 1, s = i, a = ""; for (; i < r; ) { const l = n.charCodeAt(i); if (l === 34) return a += n.slice(s, i), In(t, Te.STRING, e, i + 1, a); if (l === 92) { a += n.slice(s, i); const f = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? gj(t, i) : vj(t, i) : yj(t, i); a += f.value, i += f.size, s = i; continue; } if (l === 10 || l === 13) break; if (Dl(l)) ++i; else if (Up(n, i)) i += 2; else throw jn( t.source, i, `Invalid character within String: ${Ja( t, i )}.` ); } throw jn(t.source, i, "Unterminated string."); } function gj(t, e) { const n = t.source.body; let r = 0, i = 3; for (; i < 12; ) { const s = n.charCodeAt(e + i++); if (s === 125) { if (i < 5 || !Dl(r)) break; return { value: String.fromCodePoint(r), size: i }; } if (r = r << 4 | Qc(s), r < 0) break; } throw jn( t.source, e, `Invalid Unicode escape sequence: "${n.slice( e, e + i )}".` ); } function vj(t, e) { const n = t.source.body, r = OE(n, e + 2); if (Dl(r)) return { value: String.fromCodePoint(r), size: 6 }; if (Tx(r) && n.charCodeAt(e + 6) === 92 && n.charCodeAt(e + 7) === 117) { const i = OE(n, e + 8); if (Ix(i)) return { value: String.fromCodePoint(r, i), size: 12 }; } throw jn( t.source, e, `Invalid Unicode escape sequence: "${n.slice(e, e + 6)}".` ); } function OE(t, e) { return Qc(t.charCodeAt(e)) << 12 | Qc(t.charCodeAt(e + 1)) << 8 | Qc(t.charCodeAt(e + 2)) << 4 | Qc(t.charCodeAt(e + 3)); } function Qc(t) { return t >= 48 && t <= 57 ? t - 48 : t >= 65 && t <= 70 ? t - 55 : t >= 97 && t <= 102 ? t - 87 : -1; } function yj(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 jn( t.source, e, `Invalid character escape sequence: "${n.slice( e, e + 2 )}".` ); } function wj(t, e) { const n = t.source.body, r = n.length; let i = t.lineStart, s = e + 3, a = s, l = ""; const f = []; for (; s < r; ) { const d = n.charCodeAt(s); if (d === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) { l += n.slice(a, s), f.push(l); const p = In( t, Te.BLOCK_STRING, e, s + 3, // Return a string of the lines joined with U+000A. aj(f).join(` `) ); return t.line += f.length - 1, t.lineStart = i, p; } if (d === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) { l += n.slice(a, s), a = s + 1, s += 4; continue; } if (d === 10 || d === 13) { l += n.slice(a, s), f.push(l), d === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, l = "", a = s, i = s; continue; } if (Dl(d)) ++s; else if (Up(n, s)) s += 2; else throw jn( t.source, s, `Invalid character within String: ${Ja( t, s )}.` ); } throw jn(t.source, s, "Unterminated string."); } function _j(t, e) { const n = t.source.body, r = n.length; let i = e + 1; for (; i < r; ) { const s = n.charCodeAt(i); if (oj(s)) ++i; else break; } return In( t, Te.NAME, e, i, n.slice(e, i) ); } const Sj = 10, Rx = 2; function qw(t) { return Mp(t, []); } function Mp(t, e) { switch (typeof t) { case "string": return JSON.stringify(t); case "function": return t.name ? `[function ${t.name}]` : "[function]"; case "object": return bj(t, e); default: return String(t); } } function bj(t, e) { if (t === null) return "null"; if (e.includes(t)) return "[Circular]"; const n = [...e, t]; if (kj(t)) { const r = t.toJSON(); if (r !== t) return typeof r == "string" ? r : Mp(r, n); } else if (Array.isArray(t)) return Aj(t, n); return Ej(t, n); } function kj(t) { return typeof t.toJSON == "function"; } function Ej(t, e) { const n = Object.entries(t); return n.length === 0 ? "{}" : e.length > Rx ? "[" + Cj(t) + "]" : "{ " + n.map( ([i, s]) => i + ": " + Mp(s, e) ).join(", ") + " }"; } function Aj(t, e) { if (t.length === 0) return "[]"; if (e.length > Rx) return "[Array]"; const n = Math.min(Sj, t.length), r = t.length - n, i = []; for (let s = 0; s < n; ++s) i.push(Mp(t[s], e)); return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]"; } function Cj(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 xj = globalThis.process && // eslint-disable-next-line no-undef !0, Nj = ( /* c8 ignore next 6 */ // FIXME: https://github.com/graphql/graphql-js/issues/2317 xj ? 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], s = ( // 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 === s) { const a = qw(e); throw new Error(`Cannot use ${i} "${a}" 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 Ox { constructor(e, n = "GraphQL request", r = { line: 1, column: 1 }) { typeof e == "string" || Ih(!1, `Body must be a string. Received: ${qw(e)}.`), this.body = e, this.name = n, this.locationOffset = r, this.locationOffset.line > 0 || Ih( !1, "line in locationOffset is 1-indexed and must be positive." ), this.locationOffset.column > 0 || Ih( !1, "column in locationOffset is 1-indexed and must be positive." ); } get [Symbol.toStringTag]() { return "Source"; } } function Tj(t) { return Nj(t, Ox); } function Ij(t, e) { return new Rj(t, e).parseDocument(); } class Rj { constructor(e, n = {}) { const r = Tj(e) ? e : new Ox(e); this._lexer = new cj(r), this._options = n, this._tokenCounter = 0; } /** * Converts a name lex token into a name parse node. */ parseName() { const e = this.expectToken(Te.NAME); return this.node(e, { kind: yt.NAME, value: e.value }); } // Implements the parsing rules in the Document section. /** * Document : Definition+ */ parseDocument() { return this.node(this._lexer.token, { kind: yt.DOCUMENT, definitions: this.many( Te.SOF, this.parseDefinition, Te.EOF ) }); } /** * Definition : * - ExecutableDefinition * - TypeSystemDefinition * - TypeSystemExtension * * ExecutableDefinition : * - OperationDefinition * - FragmentDefinition * * TypeSystemDefinition : * - SchemaDefinition * - TypeDefinition * - DirectiveDefinition * * TypeDefinition : * - ScalarTypeDefinition * - ObjectTypeDefinition * - InterfaceTypeDefinition * - UnionTypeDefinition * - EnumTypeDefinition * - InputObjectTypeDefinition */ parseDefinition() { if (this.peek(Te.BRACE_L)) return this.parseOperationDefinition(); const e = this.peekDescription(), n = e ? this._lexer.lookahead() : this._lexer.token; if (n.kind === Te.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 jn( 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(Te.BRACE_L)) return this.node(e, { kind: yt.OPERATION_DEFINITION, operation: sl.QUERY, name: void 0, variableDefinitions: [], directives: [], selectionSet: this.parseSelectionSet() }); const n = this.parseOperationType(); let r; return this.peek(Te.NAME) && (r = this.parseName()), this.node(e, { kind: yt.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(Te.NAME); switch (e.value) { case "query": return sl.QUERY; case "mutation": return sl.MUTATION; case "subscription": return sl.SUBSCRIPTION; } throw this.unexpected(e); } /** * VariableDefinitions : ( VariableDefinition+ ) */ parseVariableDefinitions() { return this.optionalMany( Te.PAREN_L, this.parseVariableDefinition, Te.PAREN_R ); } /** * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? */ parseVariableDefinition() { return this.node(this._lexer.token, { kind: yt.VARIABLE_DEFINITION, variable: this.parseVariable(), type: (this.expectToken(Te.COLON), this.parseTypeReference()), defaultValue: this.expectOptionalToken(Te.EQUALS) ? this.parseConstValueLiteral() : void 0, directives: this.parseConstDirectives() }); } /** * Variable : $ Name */ parseVariable() { const e = this._lexer.token; return this.expectToken(Te.DOLLAR), this.node(e, { kind: yt.VARIABLE, name: this.parseName() }); } /** * ``` * SelectionSet : { Selection+ } * ``` */ parseSelectionSet() { return this.node(this._lexer.token, { kind: yt.SELECTION_SET, selections: this.many( Te.BRACE_L, this.parseSelection, Te.BRACE_R ) }); } /** * Selection : * - Field * - FragmentSpread * - InlineFragment */ parseSelection() { return this.peek(Te.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(Te.COLON) ? (r = n, i = this.parseName()) : i = n, this.node(e, { kind: yt.FIELD, alias: r, name: i, arguments: this.parseArguments(!1), directives: this.parseDirectives(!1), selectionSet: this.peek(Te.BRACE_L) ? this.parseSelectionSet() : void 0 }); } /** * Arguments[Const] : ( Argument[?Const]+ ) */ parseArguments(e) { const n = e ? this.parseConstArgument : this.parseArgument; return this.optionalMany(Te.PAREN_L, n, Te.PAREN_R); } /** * Argument[Const] : Name : Value[?Const] */ parseArgument(e = !1) { const n = this._lexer.token, r = this.parseName(); return this.expectToken(Te.COLON), this.node(n, { kind: yt.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(Te.SPREAD); const n = this.expectOptionalKeyword("on"); return !n && this.peek(Te.NAME) ? this.node(e, { kind: yt.FRAGMENT_SPREAD, name: this.parseFragmentName(), directives: this.parseDirectives(!1) }) : this.node(e, { kind: yt.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: yt.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: yt.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 Te.BRACKET_L: return this.parseList(e); case Te.BRACE_L: return this.parseObject(e); case Te.INT: return this.advanceLexer(), this.node(n, { kind: yt.INT, value: n.value }); case Te.FLOAT: return this.advanceLexer(), this.node(n, { kind: yt.FLOAT, value: n.value }); case Te.STRING: case Te.BLOCK_STRING: return this.parseStringLiteral(); case Te.NAME: switch (this.advanceLexer(), n.value) { case "true": return this.node(n, { kind: yt.BOOLEAN, value: !0 }); case "false": return this.node(n, { kind: yt.BOOLEAN, value: !1 }); case "null": return this.node(n, { kind: yt.NULL }); default: return this.node(n, { kind: yt.ENUM, value: n.value }); } case Te.DOLLAR: if (e) if (this.expectToken(Te.DOLLAR), this._lexer.token.kind === Te.NAME) { const r = this._lexer.token.value; throw jn( 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: yt.STRING, value: e.value, block: e.kind === Te.BLOCK_STRING }); } /** * ListValue[Const] : * - [ ] * - [ Value[?Const]+ ] */ parseList(e) { const n = () => this.parseValueLiteral(e); return this.node(this._lexer.token, { kind: yt.LIST, values: this.any(Te.BRACKET_L, n, Te.BRACKET_R) }); } /** * ``` * ObjectValue[Const] : * - { } * - { ObjectField[?Const]+ } * ``` */ parseObject(e) { const n = () => this.parseObjectField(e); return this.node(this._lexer.token, { kind: yt.OBJECT, fields: this.any(Te.BRACE_L, n, Te.BRACE_R) }); } /** * ObjectField[Const] : Name : Value[?Const] */ parseObjectField(e) { const n = this._lexer.token, r = this.parseName(); return this.expectToken(Te.COLON), this.node(n, { kind: yt.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(Te.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(Te.AT), this.node(n, { kind: yt.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(Te.BRACKET_L)) { const r = this.parseTypeReference(); this.expectToken(Te.BRACKET_R), n = this.node(e, { kind: yt.LIST_TYPE, type: r }); } else n = this.parseNamedType(); return this.expectOptionalToken(Te.BANG) ? this.node(e, { kind: yt.NON_NULL_TYPE, type: n }) : n; } /** * NamedType : Name */ parseNamedType() { return this.node(this._lexer.token, { kind: yt.NAMED_TYPE, name: this.parseName() }); } // Implements the parsing rules in the Type Definition section. peekDescription() { return this.peek(Te.STRING) || this.peek(Te.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( Te.BRACE_L, this.parseOperationTypeDefinition, Te.BRACE_R ); return this.node(e, { kind: yt.SCHEMA_DEFINITION, description: n, directives: r, operationTypes: i }); } /** * OperationTypeDefinition : OperationType : NamedType */ parseOperationTypeDefinition() { const e = this._lexer.token, n = this.parseOperationType(); this.expectToken(Te.COLON); const r = this.parseNamedType(); return this.node(e, { kind: yt.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: yt.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(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition(); return this.node(e, { kind: yt.OBJECT_TYPE_DEFINITION, description: n, name: r, interfaces: i, directives: s, fields: a }); } /** * ImplementsInterfaces : * - implements `&`? NamedType * - ImplementsInterfaces & NamedType */ parseImplementsInterfaces() { return this.expectOptionalKeyword("implements") ? this.delimitedMany(Te.AMP, this.parseNamedType) : []; } /** * ``` * FieldsDefinition : { FieldDefinition+ } * ``` */ parseFieldsDefinition() { return this.optionalMany( Te.BRACE_L, this.parseFieldDefinition, Te.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(Te.COLON); const s = this.parseTypeReference(), a = this.parseConstDirectives(); return this.node(e, { kind: yt.FIELD_DEFINITION, description: n, name: r, arguments: i, type: s, directives: a }); } /** * ArgumentsDefinition : ( InputValueDefinition+ ) */ parseArgumentDefs() { return this.optionalMany( Te.PAREN_L, this.parseInputValueDef, Te.PAREN_R ); } /** * InputValueDefinition : * - Description? Name : Type DefaultValue? Directives[Const]? */ parseInputValueDef() { const e = this._lexer.token, n = this.parseDescription(), r = this.parseName(); this.expectToken(Te.COLON); const i = this.parseTypeReference(); let s; this.expectOptionalToken(Te.EQUALS) && (s = this.parseConstValueLiteral()); const a = this.parseConstDirectives(); return this.node(e, { kind: yt.INPUT_VALUE_DEFINITION, description: n, name: r, type: i, defaultValue: s, directives: a }); } /** * 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(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition(); return this.node(e, { kind: yt.INTERFACE_TYPE_DEFINITION, description: n, name: r, interfaces: i, directives: s, fields: a }); } /** * 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(), s = this.parseUnionMemberTypes(); return this.node(e, { kind: yt.UNION_TYPE_DEFINITION, description: n, name: r, directives: i, types: s }); } /** * UnionMemberTypes : * - = `|`? NamedType * - UnionMemberTypes | NamedType */ parseUnionMemberTypes() { return this.expectOptionalToken(Te.EQUALS) ? this.delimitedMany(Te.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(), s = this.parseEnumValuesDefinition(); return this.node(e, { kind: yt.ENUM_TYPE_DEFINITION, description: n, name: r, directives: i, values: s }); } /** * ``` * EnumValuesDefinition : { EnumValueDefinition+ } * ``` */ parseEnumValuesDefinition() { return this.optionalMany( Te.BRACE_L, this.parseEnumValueDefinition, Te.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: yt.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 jn( this._lexer.source, this._lexer.token.start, `${dh( 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(), s = this.parseInputFieldsDefinition(); return this.node(e, { kind: yt.INPUT_OBJECT_TYPE_DEFINITION, description: n, name: r, directives: i, fields: s }); } /** * ``` * InputFieldsDefinition : { InputValueDefinition+ } * ``` */ parseInputFieldsDefinition() { return this.optionalMany( Te.BRACE_L, this.parseInputValueDef, Te.BRACE_R ); } /** * TypeSystemExtension : * - SchemaExtension * - TypeExtension * * TypeExtension : * - ScalarTypeExtension * - ObjectTypeExtension * - InterfaceTypeExtension * - UnionTypeExtension * - EnumTypeExtension * - InputObjectTypeDefinition */ parseTypeSystemExtension() { const e = this._lexer.lookahead(); if (e.kind === Te.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( Te.BRACE_L, this.parseOperationTypeDefinition, Te.BRACE_R ); if (n.length === 0 && r.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.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: yt.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(), s = this.parseFieldsDefinition(); if (r.length === 0 && i.length === 0 && s.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.OBJECT_TYPE_EXTENSION, name: n, interfaces: r, directives: i, fields: s }); } /** * 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(), s = this.parseFieldsDefinition(); if (r.length === 0 && i.length === 0 && s.length === 0) throw this.unexpected(); return this.node(e, { kind: yt.INTERFACE_TYPE_EXTENSION, name: n, interfaces: r, directives: i, fields: s }); } /** * 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: yt.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: yt.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: yt.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(Te.AT); const r = this.parseName(), i = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable"); this.expectKeyword("on"); const a = this.parseDirectiveLocations(); return this.node(e, { kind: yt.DIRECTIVE_DEFINITION, description: n, name: r, arguments: i, repeatable: s, locations: a }); } /** * DirectiveLocations : * - `|`? DirectiveLocation * - DirectiveLocations | DirectiveLocation */ parseDirectiveLocations() { return this.delimitedMany(Te.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(Hy, 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 ij( 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 jn( this._lexer.source, n.start, `Expected ${Px(e)}, found ${dh(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 === Te.NAME && n.value === e) this.advanceLexer(); else throw jn( this._lexer.source, n.start, `Expected "${e}", found ${dh(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 === Te.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 jn( this._lexer.source, n.start, `Unexpected ${dh(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 !== Te.EOF && (++this._tokenCounter, this._tokenCounter > e)) throw jn( this._lexer.source, n.start, `Document contains more that ${e} tokens. Parsing aborted.` ); } } function dh(t) { const e = t.value; return Px(t.kind) + (e != null ? ` "${e}"` : ""); } function Px(t) { return dj(t) ? `"${t}"` : t; } function Oj(t) { return `"${t.replace(Pj, Dj)}"`; } const Pj = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; function Dj(t) { return Fj[t.charCodeAt(0)]; } const Fj = [ "\\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" ], Lj = Object.freeze({}); function Uj(t, e, n = Cx) { const r = /* @__PURE__ */ new Map(); for (const O of Object.values(yt)) r.set(O, Mj(e, O)); let i, s = Array.isArray(t), a = [t], l = -1, f = [], d = t, p, v; const y = [], k = []; do { l++; const O = l === a.length, R = O && f.length !== 0; if (O) { if (p = k.length === 0 ? void 0 : y[y.length - 1], d = v, v = k.pop(), R) if (s) { d = d.slice(); let j = 0; for (const [K, ie] of f) { const ce = K - j; ie === null ? (d.splice(ce, 1), j++) : d[ce] = ie; } } else { d = Object.defineProperties( {}, Object.getOwnPropertyDescriptors(d) ); for (const [j, K] of f) d[j] = K; } l = i.index, a = i.keys, f = i.edits, s = i.inArray, i = i.prev; } else if (v) { if (p = s ? l : a[l], d = v[p], d == null) continue; y.push(p); } let U; if (!Array.isArray(d)) { var E, A; RE(d) || Ih(!1, `Invalid AST Node: ${qw(d)}.`); const j = O ? (E = r.get(d.kind)) === null || E === void 0 ? void 0 : E.leave : (A = r.get(d.kind)) === null || A === void 0 ? void 0 : A.enter; if (U = j == null ? void 0 : j.call(e, d, p, v, y, k), U === Lj) break; if (U === !1) { if (!O) { y.pop(); continue; } } else if (U !== void 0 && (f.push([p, U]), !O)) if (RE(U)) d = U; else { y.pop(); continue; } } if (U === void 0 && R && f.push([p, d]), O) y.pop(); else { var T; i = { inArray: s, index: l, keys: a, edits: f, prev: i }, s = Array.isArray(d), a = s ? 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 Mj(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 Bj(t) { return Uj(t, $j); } const jj = 80, $j = { Name: { leave: (t) => t.value }, Variable: { leave: (t) => "$" + t.name }, // Document Document: { leave: (t) => ut(t.definitions, ` `) }, OperationDefinition: { leave(t) { const e = Ut("(", ut(t.variableDefinitions, ", "), ")"), n = ut( [ t.operation, ut([t.name, e]), ut(t.directives, " ") ], " " ); return (n === "query" ? "" : n + " ") + t.selectionSet; } }, VariableDefinition: { leave: ({ variable: t, type: e, defaultValue: n, directives: r }) => t + ": " + e + Ut(" = ", n) + Ut(" ", ut(r, " ")) }, SelectionSet: { leave: ({ selections: t }) => ki(t) }, Field: { leave({ alias: t, name: e, arguments: n, directives: r, selectionSet: i }) { const s = Ut("", t, ": ") + e; let a = s + Ut("(", ut(n, ", "), ")"); return a.length > jj && (a = s + Ut(`( `, Rh(ut(n, ` `)), ` )`)), ut([a, ut(r, " "), i], " "); } }, Argument: { leave: ({ name: t, value: e }) => t + ": " + e }, // Fragments FragmentSpread: { leave: ({ name: t, directives: e }) => "..." + t + Ut(" ", ut(e, " ")) }, InlineFragment: { leave: ({ typeCondition: t, directives: e, selectionSet: n }) => ut( [ "...", Ut("on ", t), ut(e, " "), n ], " " ) }, FragmentDefinition: { leave: ({ name: t, typeCondition: e, variableDefinitions: n, directives: r, selectionSet: i }) => ( // or removed in the future. `fragment ${t}${Ut("(", ut(n, ", "), ")")} on ${e} ${Ut("", ut(r, " "), " ")}` + i ) }, // Value IntValue: { leave: ({ value: t }) => t }, FloatValue: { leave: ({ value: t }) => t }, StringValue: { leave: ({ value: t, block: e }) => e ? lj(t) : Oj(t) }, BooleanValue: { leave: ({ value: t }) => t ? "true" : "false" }, NullValue: { leave: () => "null" }, EnumValue: { leave: ({ value: t }) => t }, ListValue: { leave: ({ values: t }) => "[" + ut(t, ", ") + "]" }, ObjectValue: { leave: ({ fields: t }) => "{" + ut(t, ", ") + "}" }, ObjectField: { leave: ({ name: t, value: e }) => t + ": " + e }, // Directive Directive: { leave: ({ name: t, arguments: e }) => "@" + t + Ut("(", ut(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 }) => Ut("", t, ` `) + ut(["schema", ut(e, " "), ki(n)], " ") }, OperationTypeDefinition: { leave: ({ operation: t, type: e }) => t + ": " + e }, ScalarTypeDefinition: { leave: ({ description: t, name: e, directives: n }) => Ut("", t, ` `) + ut(["scalar", e, ut(n, " ")], " ") }, ObjectTypeDefinition: { leave: ({ description: t, name: e, interfaces: n, directives: r, fields: i }) => Ut("", t, ` `) + ut( [ "type", e, Ut("implements ", ut(n, " & ")), ut(r, " "), ki(i) ], " " ) }, FieldDefinition: { leave: ({ description: t, name: e, arguments: n, type: r, directives: i }) => Ut("", t, ` `) + e + (PE(n) ? Ut(`( `, Rh(ut(n, ` `)), ` )`) : Ut("(", ut(n, ", "), ")")) + ": " + r + Ut(" ", ut(i, " ")) }, InputValueDefinition: { leave: ({ description: t, name: e, type: n, defaultValue: r, directives: i }) => Ut("", t, ` `) + ut( [e + ": " + n, Ut("= ", r), ut(i, " ")], " " ) }, InterfaceTypeDefinition: { leave: ({ description: t, name: e, interfaces: n, directives: r, fields: i }) => Ut("", t, ` `) + ut( [ "interface", e, Ut("implements ", ut(n, " & ")), ut(r, " "), ki(i) ], " " ) }, UnionTypeDefinition: { leave: ({ description: t, name: e, directives: n, types: r }) => Ut("", t, ` `) + ut( ["union", e, ut(n, " "), Ut("= ", ut(r, " | "))], " " ) }, EnumTypeDefinition: { leave: ({ description: t, name: e, directives: n, values: r }) => Ut("", t, ` `) + ut(["enum", e, ut(n, " "), ki(r)], " ") }, EnumValueDefinition: { leave: ({ description: t, name: e, directives: n }) => Ut("", t, ` `) + ut([e, ut(n, " ")], " ") }, InputObjectTypeDefinition: { leave: ({ description: t, name: e, directives: n, fields: r }) => Ut("", t, ` `) + ut(["input", e, ut(n, " "), ki(r)], " ") }, DirectiveDefinition: { leave: ({ description: t, name: e, arguments: n, repeatable: r, locations: i }) => Ut("", t, ` `) + "directive @" + e + (PE(n) ? Ut(`( `, Rh(ut(n, ` `)), ` )`) : Ut("(", ut(n, ", "), ")")) + (r ? " repeatable" : "") + " on " + ut(i, " | ") }, SchemaExtension: { leave: ({ directives: t, operationTypes: e }) => ut( ["extend schema", ut(t, " "), ki(e)], " " ) }, ScalarTypeExtension: { leave: ({ name: t, directives: e }) => ut(["extend scalar", t, ut(e, " ")], " ") }, ObjectTypeExtension: { leave: ({ name: t, interfaces: e, directives: n, fields: r }) => ut( [ "extend type", t, Ut("implements ", ut(e, " & ")), ut(n, " "), ki(r) ], " " ) }, InterfaceTypeExtension: { leave: ({ name: t, interfaces: e, directives: n, fields: r }) => ut( [ "extend interface", t, Ut("implements ", ut(e, " & ")), ut(n, " "), ki(r) ], " " ) }, UnionTypeExtension: { leave: ({ name: t, directives: e, types: n }) => ut( [ "extend union", t, ut(e, " "), Ut("= ", ut(n, " | ")) ], " " ) }, EnumTypeExtension: { leave: ({ name: t, directives: e, values: n }) => ut(["extend enum", t, ut(e, " "), ki(n)], " ") }, InputObjectTypeExtension: { leave: ({ name: t, directives: e, fields: n }) => ut(["extend input", t, ut(e, " "), ki(n)], " ") } }; function ut(t, e = "") { var n; return (n = t == null ? void 0 : t.filter((r) => r).join(e)) !== null && n !== void 0 ? n : ""; } function ki(t) { return Ut(`{ `, Rh(ut(t, ` `)), ` }`); } function Ut(t, e, n = "") { return e != null && e !== "" ? t + e + n : ""; } function Rh(t) { return Ut(" ", t.replace(/\n/g, ` `)); } function PE(t) { var e; return (e = t == null ? void 0 : t.some((n) => n.includes(` `))) !== null && e !== void 0 ? e : !1; } const DE = "Accept", Gy = "Content-Type", Wy = "application/json", Dx = "application/graphql-response+json", FE = (t) => t.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Vj = (t) => { const e = t.toLowerCase(); return e.includes(Dx) || e.includes(Wy); }, LE = (t) => { try { if (Array.isArray(t)) return { _tag: "Batch", executionResults: t.map(UE) }; if (Th(t)) return { _tag: "Single", executionResult: UE(t) }; throw new Error(`Invalid execution result: result is not object or array. Got: ${String(t)}`); } catch (e) { return e; } }, UE = (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 (!Th(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 (!Th(t.data) && t.data !== null) throw new Error("Invalid execution result: data is not plain object"); n = t.data; } if ("extensions" in t) { if (!Th(t.extensions)) throw new Error("Invalid execution result: extensions is not plain object"); r = t.extensions; } return { data: n, errors: e, extensions: r }; }, zj = (t) => t._tag === "Batch" ? t.executionResults.some(ME) : ME(t.executionResult), ME = (t) => Array.isArray(t.errors) ? t.errors.length > 0 : !!t.errors, Fx = (t) => typeof t == "object" && t !== null && "kind" in t && t.kind === yt.OPERATION_DEFINITION, qj = (t) => { var r; let e; const n = t.definitions.filter(Fx); return n.length === 1 && (e = (r = n[0].name) == null ? void 0 : r.value), e; }, Hj = (t) => { let e = !1; const n = t.definitions.filter(Fx); return n.length === 1 && (e = n[0].operation === "mutation"), e; }, Fv = (t, e) => { const n = typeof t == "string" ? t : Bj(t); let r = !1, i; if (e) return { expression: n, isMutation: r, operationName: i }; const s = YB(() => typeof t == "string" ? Ij(t) : t); return s instanceof Error ? { expression: n, isMutation: r, operationName: i } : (i = qj(s), r = Hj(s), { expression: n, operationName: i, isMutation: r }); }, Hw = JSON, Lv = async (t) => { const e = { ...t, method: t.request._tag === "Single" ? t.request.document.isMutation ? "POST" : xE(t.method ?? "post") : t.request.hasMutations ? "POST" : xE(t.method ?? "post"), fetchOptions: { ...t.fetchOptions, errorPolicy: t.fetchOptions.errorPolicy ?? "none" } }, r = await Gj(e.method)(e); if (!r.ok) return new qa({ 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 Kj(r, t.fetchOptions.jsonSerializer ?? Hw); if (i instanceof Error) throw i; const s = { status: r.status, headers: r.headers }; if (zj(i) && e.fetchOptions.errorPolicy === "none") { const a = i._tag === "Batch" ? { ...i.executionResults, ...s } : { ...i.executionResult, ...s }; return new qa(a, { query: t.request._tag === "Single" ? t.request.document.expression : t.request.query, variables: t.request.variables }); } switch (i._tag) { case "Single": return { ...s, ...BE(e)(i.executionResult) }; case "Batch": return { ...s, data: i.executionResults.map(BE(e)) }; default: Vw(i); } }, BE = (t) => (e) => ({ extensions: e.extensions, data: e.data, errors: t.fetchOptions.errorPolicy === "all" ? e.errors : void 0 }), Kj = async (t, e) => { const n = t.headers.get(Gy), r = await t.text(); return n && Vj(n) ? LE(e.parse(r)) : LE(r); }, Gj = (t) => async (e) => { const n = new Headers(e.headers); let r = null, i; n.has(DE) || n.set(DE, [Dx, Wy].join(", ")), t === "POST" ? (i = (e.fetchOptions.jsonSerializer ?? Hw).stringify(Wj(e)), typeof i == "string" && !n.has(Gy) && n.set(Gy, Wy)) : r = Yj(e); const s = { method: t, headers: n, body: i, ...e.fetchOptions }; let a = new URL(e.url), l = s; if (e.middleware) { const d = await Promise.resolve(e.middleware({ ...s, url: e.url, operationName: e.request._tag === "Single" ? e.request.document.operationName : void 0, variables: e.request.variables })), { url: p, ...v } = d; a = new URL(p), l = v; } return r && r.forEach((d, p) => { a.searchParams.append(p, d); }), await (e.fetch ?? fetch)(a, l); }, Wj = (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 kx(t.request.query, t.request.variables ?? []).map(([e, n]) => ({ query: e, variables: n })); default: throw Vw(t.request); } }, Yj = (t) => { var r; const e = t.fetchOptions.jsonSerializer ?? Hw, n = new URLSearchParams(); switch (t.request._tag) { case "Single": return n.append("query", FE(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 i = ((r = t.request.variables) == null ? void 0 : r.map((l) => e.stringify(l))) ?? [], s = t.request.query.map(FE), a = kx(s, i).map(([l, f]) => ({ query: l, variables: f })); return n.append("query", e.stringify(a)), n; } default: throw Vw(t.request); } }; class Qj { constructor(e, n = {}) { ve(this, "url"); ve(this, "requestConfig"); /** * Send a GraphQL query to the server. */ ve(this, "rawRequest", async (...e) => { const [n, r, i] = e, s = XB(n, r, i), { headers: a, fetch: l = globalThis.fetch, method: f = "POST", requestMiddleware: d, responseMiddleware: p, excludeOperationName: v, ...y } = this.requestConfig, { url: k } = this; s.signal !== void 0 && (y.signal = s.signal); const E = Fv(s.query, v), A = await Lv({ url: k, request: { _tag: "Single", document: E, variables: s.variables }, headers: { ...Wu(Pv(a)), ...Wu(s.requestHeaders) }, fetch: l, method: f, fetchOptions: y, middleware: d }); if (p && await p(A, { operationName: E.operationName, variables: r, url: this.url }), A instanceof Error) throw A; return A; }); this.url = e, this.requestConfig = n; } async request(e, ...n) { const [r, i] = n, s = Jj(e, r, i), { headers: a, fetch: l = globalThis.fetch, method: f = "POST", requestMiddleware: d, responseMiddleware: p, excludeOperationName: v, ...y } = this.requestConfig, { url: k } = this; s.signal !== void 0 && (y.signal = s.signal); const E = Fv(s.document, v), A = await Lv({ url: k, request: { _tag: "Single", document: E, variables: s.variables }, headers: { ...Wu(Pv(a)), ...Wu(s.requestHeaders) }, fetch: l, method: f, fetchOptions: y, middleware: d }); if (p && await p(A, { operationName: E.operationName, variables: s.variables, url: this.url }), A instanceof Error) throw A; return A.data; } async batchRequests(e, n) { const r = JB(e, n), { headers: i, excludeOperationName: s, ...a } = this.requestConfig; r.signal !== void 0 && (a.signal = r.signal); const l = r.documents.map(({ document: y }) => Fv(y, s)), f = l.map(({ expression: y }) => y), d = l.some(({ isMutation: y }) => y), p = r.documents.map(({ variables: y }) => y), v = await Lv({ url: this.url, request: { _tag: "Batch", operationName: void 0, query: f, hasMutations: d, variables: p }, headers: { ...Wu(Pv(i)), ...Wu(r.requestHeaders) }, fetch: this.requestConfig.fetch ?? globalThis.fetch, method: this.requestConfig.method || "POST", fetchOptions: a, 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 Jj = (t, e, n) => t.document ? t : { document: t, variables: e, requestHeaders: n, signal: void 0 }; class Xa extends Error { constructor(n, r) { super(n); /** The original error object, useful for debugging underlying issues. */ ve(this, "originalError"); /** Discriminator property to easily identify errors from this client. */ ve(this, "isApiClientError", !0); this.name = this.constructor.name, this.originalError = r, Object.setPrototypeOf(this, new.target.prototype); } } class Oh extends Xa { constructor(e = "Request timed out", n) { super(e, n); } } class Yy extends Xa { constructor(e = "A network error occurred", n) { super(e, n); } } class Qy extends Xa { constructor(n, r, i) { super(n, i); ve(this, "response"); this.response = r; } } class Lx extends Xa { constructor(n, r, i) { super(n, i); ve(this, "response"); this.response = r; } } function Xj(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 s = i.target; n.abort( (s == null ? void 0 : s.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 jE(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 Ux { /** * Creates an instance of ApiClient. * @param {ApiClientConfig} config - Configuration for the ApiClient. * `restApiBaseUrl`, `graphqlApiBaseUrl`, and `logger` are required. * @throws {Error} If required configuration properties are missing. */ constructor(e) { ve(this, "logger"); ve(this, "defaultTimeout"); ve(this, "getAuthTokenFn"); ve(this, "axiosInstance"); ve(this, "graphqlClient"); ve(this, "restBaseUrl"); ve(this, "graphqlApiBaseUrl"); if (!e.logger) throw console.error( "ApiClient: A Logger instance is required in the configuration." ), new Error( "ApiClient: A Logger instance is required in the configuration." ); if (this.logger = e.logger.child("ApiClient"), !e.restApiBaseUrl) { const n = "ApiClient: restApiBaseUrl is required in the configuration."; throw this.logger.error(n), new Error(n); } if (this.restBaseUrl = e.restApiBaseUrl, !e.graphqlApiBaseUrl) { const n = "ApiClient: 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( "ApiClient: getAuthTokenFn was not provided. Secure calls will not be authenticated." ), null)), this.axiosInstance = cn.create({ baseURL: this.restBaseUrl }), this.graphqlClient = new Qj(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: s, timeout: a } = e, l = new URL(r, n || this.restBaseUrl).toString(); if (!r && !n) throw new Qy( 'It is assumed that path = "" but it is necessary to provide baseURL' ); const { operationSignal: f, clearInternalTimeout: d } = this.createAbortSignal( s, a ); 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: jE(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 {GraphQLDocument} document The GraphQL query or mutation. * Your `GraphQLDocument` 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 {GraphQLRequestOptions} [options={}] Optional configurations for this GraphQL request. * @returns {Promise} A promise that resolves to the typed data from the GraphQL response. * @throws {GraphQLApiError | TimeoutError | NetworkError | 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: s } = r, { operationSignal: a, clearInternalTimeout: l } = this.createAbortSignal( s, i ); try { const f = await this.prepareAuthHeaders(r), d = { document: e, requestHeaders: f, signal: a }; n !== void 0 && (d.variables = n); const p = d; return await this.executeGraphQLRequest(p); } catch (f) { throw this.handleGraphQLError(f, a); } 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) { var i, s; throw r != null && r.aborted ? new Oh( typeof r.reason == "string" ? r.reason : `REST request to '${n}' aborted.`, e ) : cn.isAxiosError(e) ? e.code === "ECONNABORTED" || e.message.toLowerCase().includes("timeout") || e.code && ["ETIMEDOUT", "ESOCKETTIMEDOUT"].includes(e.code) ? new Oh( `REST request to '${n}' timed out. (${e.message})`, e ) : e.response ? new Qy( ((i = e.response.data) == null ? void 0 : i.message) || ((s = e.response.data) == null ? void 0 : s.error) || e.message || "REST request failed", { status: e.response.status, data: e.response.data, headers: jE(e.response.headers) }, e ) : new Yy( `Network error for REST request to '${n}': ${e.message}`, e ) : new Xa( `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) { var r, i, s, a, l, f; if (n != null && n.aborted) throw new Oh( typeof n.reason == "string" ? n.reason : "GraphQL request aborted.", e ); if (e instanceof qa) { const d = ((s = (i = (r = e.response) == null ? void 0 : r.errors) == null ? void 0 : i[0]) == null ? void 0 : s.message) || e.message || "GraphQL request failed"; throw new Lx( d, { status: (a = e.response) == null ? void 0 : a.status, data: (l = e.response) == null ? void 0 : l.data, errors: (f = e.response) == null ? void 0 : f.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 Yy( `Network error during GraphQL request: ${e.message}`, e ) : new Xa( `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; } } /** * Prepares request headers, primarily for authentication. * It merges existing headers with authentication headers if `secure` is true. * @private * @param options Configuration for header preparation, including security flags and existing headers. * @returns {Promise>} The prepared headers. */ async prepareAuthHeaders(e) { const n = {}; if (e.headers) { if (e.headers instanceof Headers) e.headers.forEach((r, i) => { n[i] = r; }); else for (const r in e.headers) if (Object.prototype.hasOwnProperty.call(e.headers, r)) { const i = e.headers[r]; typeof i == "string" && (n[r] = i); } } if (e.secure) { const r = await this.getAuthToken(); r ? (n.Authorization = `Bearer ${r}`, e.account && (n["ls-account"] = e.account)) : this.logger.warn( "Secure request: Auth token not available or getAuthTokenFn failed." ); } return 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, s; r > 0 && (i = new AbortController(), s = setTimeout(() => { i.abort( "Request timed out by ApiClient internal timeout" ); }, r)); const a = () => { s && clearTimeout(s); }, l = Xj([ e, i == null ? void 0 : i.signal ]); return l != null && l.aborted ? a() : l == null || l.addEventListener("abort", a, { once: !0 }), { operationSignal: l, clearInternalTimeout: a }; } } const Zj = async () => { var t; try { return (await JC.currentSession()).getIdToken().getJwtToken(); } catch { return ((t = ir().config) == null ? void 0 : t.authToken) ?? null; } }, e4 = { restApiBaseUrl: wd.apiUrls.restV2, graphqlApiBaseUrl: wd.apiUrls.graphql, logger: ir().coreLogger, getAuthToken: Zj }, Cn = new Ux(e4); var ol = /* @__PURE__ */ ((t) => (t.VTEX = "VTEX", t.VTEX_IO = "VTEX-IO", t.VTEX_CMS = "PORTAL-VTEX", t.PLATFORM = "PLATFORM", t.UNKNOWN = "UNKNOWN", t))(ol || {}), Mx = /* @__PURE__ */ ((t) => (t.PLATFORM = "platform_module", t.ADENDA = "subscription_module", t.APP_STORE = "app_store", t))(Mx || {}), Bx = /* @__PURE__ */ ((t) => (t.ACTIVE = "active_contract", t.INACTIVE = "inactive_contract", t))(Bx || {}), jx = /* @__PURE__ */ ((t) => (t.LITE = "lite", t.STANDARD = "standard", t.PRO = "pro", t))(jx || {}), $x = /* @__PURE__ */ ((t) => (t.LITE = "PLAN_LITE", t.STANDARD = "PLAN_ESTANDAR", t.PRO = "PLAN_PRO", t.NONE = "NO_PLAN", t))($x || {}), Vx = /* @__PURE__ */ ((t) => (t.PAST = "past", t.LIVE = "live", t.FUTURE = "future", t))(Vx || {}); class Kw extends Oi { constructor(e) { super("NIZZA_ACCOUNT_NOT_FOUND_ERROR", `Error finding account: ${e}`); } } class zx extends Oi { constructor(e) { super("NIZZA_PLAN_NOT_FOUND_ERROR", `Error finding plan: ${e}`); } } class qx extends Oi { constructor(e) { super("NIZZA_CREATE_PLAN_ERROR", `Error creating plan: ${e.plan}`, e); } } class Hx { async get(e, n) { return (await Cn.rest({ path: "/v1/plans/info", queryParams: { planType: e }, account: n })).data; } async create(e) { const { success: n } = await Cn.rest({ path: "/v1/plans/create", method: "POST", body: e }); if (!n) throw new qx(e); } } function t4(t) { const { host: e, account: n, username: r, createdAt: i, subscriptionType: s, installationDateApp: a, ...l } = t; return { ...l, account: n, host: e ?? null, username: r ?? n, createdAt: new Date(i), subscriptionType: s ?? null, installationDateApp: new Date(a) }; } function n4(t) { const { host: e, ...n } = t; return { ...n, host: e ?? null, plan: {} }; } class Kx { async get(e) { const { data: n } = await Cn.rest({ path: `/v1/accounts/${e}/public`, account: e }); return n ? n4(n) : null; } } class r4 { async get(e) { const { data: n } = await Cn.rest({ path: `/v1/accounts/${e}`, secure: !0, account: e }); return n ? t4(n) : null; } } class Gx { 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 Kw(e); const i = await this.accountPlanRepo.get( r.descriptionPlan, r.account ); if (!i) throw new zx(r.descriptionPlan); return { ...r, plan: i }; } catch (r) { throw new xo(r); } } } const i4 = new Kx(), s4 = new r4(), o4 = new Hx(), Wx = new Gx( i4, s4, o4 ), Yx = () => { const { account: t, accountName: e, accountStatus: n, refetchAccount: r, isPvtAccount: i, isPubAccount: s } = sC((d) => ({ account: d.account, accountName: d.accountName, accountStatus: d.accountStatus, refetchAccount: d.refetchAccount, isPvtAccount: d.isPvtAccount, isPubAccount: d.isPubAccount })), a = ["idle", "loading"].includes(n); return { account: t, accountName: e, isLoading: a, isError: n === "error", isSuccess: n === "success", accountStatus: n, refetchAccount: r, isPvtAccount: i, isPubAccount: s }; }; async function Qx(t, e) { return Wx.get(t, e); } var Jx = /* @__PURE__ */ ((t) => (t.Created = "CREATED", t.CreateComplete = "CREATE_COMPLETE", t.Finalized = "FINALIZED", t.Live = "LIVE", t.Starting = "STARTING", t))(Jx || {}), Xx = /* @__PURE__ */ ((t) => (t.Add = "add", t.Remove = "remove", t))(Xx || {}), Zx = /* @__PURE__ */ ((t) => (t.Vtex = "VTEX", t))(Zx || {}), eN = /* @__PURE__ */ ((t) => (t.Active = "active", t.Inactive = "inactive", t))(eN || {}); const tN = { 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" } }] } }] } }] } }] }, nN = { 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" } }] } }] } }] } }] }, rN = { 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" } }] } }] } }] } }] }, iN = { 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" } }] } }] } }] } }] }, sN = { 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" } }] } }] } }] } }] }, oN = { 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" } }] } }] } }] } }] }, aN = { 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" } }] } }] } }] } }] }, a4 = { 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" } }] } }] } }] } }] }, u4 = { 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" } }] } }] } }] } }] }, l4 = { 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" } }] } }] } }] } }] }, c4 = { 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" } }] } }] } }] } }] }, d4 = { 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" } }] } }] } }] } }] }, f4 = { 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" } }] } }] } }] } }] }, h4 = { 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" } }] } }] } }] } }] }, uN = { 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" } }] } }] } }] } }] }, p4 = { 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" } }] } }] } }] } }] }, m4 = { 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" } }] } }] } }] } }] }, g4 = { 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" } }] } }] } }] } }] }, v4 = { 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" } }] } }] } }] } }] }, y4 = { 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" } }] } }] } }] } }] }, w4 = { 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" } }] } }] } }] } }] }, _4 = { 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" } }] } }] } }] } }] }, S4 = { 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" } }] } }] } }] } }] }, b4 = { 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" } }] } }] } }] } }] }, k4 = { 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" } }] } }] } }] } }] }, E4 = { 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" } }] } }] } }] } }] }, A4 = { 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" } }] } }] } }] } }] }, C4 = { 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" } }] } }] } }] } }] }, x4 = { 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" } }] } }] } }] } }] }, N4 = { 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" } }] } }] } }] } }] }, T4 = { 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" } }] } }] } }] } }] } }] }, I4 = { 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" } }] } }] } }] } }] }, R4 = { 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" } }] } }] } }] } }] }, O4 = { 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" } }] } }] } }] } }] }, P4 = { 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" } }] } }] } }] } }] }, D4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, AddCollectionDocument: tN, AppendProductsToSnackVideoDocument: S4, BlockUserDocument: l4, ChangeAccountUsernameDocument: c4, CreatePlayListDocument: b4, CreateSnackVideoBatchDocument: k4, DeleteAllCustomizationDocument: g4, DeleteChatMessageDocument: d4, DeleteCollectionDocument: nN, DeleteRelationshipWithSnackVideoDocument: E4, DeleteSnackVideoDocument: A4, EventStatus: Jx, FindByProductSnackVideoDocument: O4, FindCollectionDocument: rN, FindManySnackVideosDocument: C4, FindMinimalEventDocument: a4, GetAllAdminChatMessagesDocument: f4, GetAllChatMessagesDocument: h4, GetAllCollectionsDocument: iN, GetAllCustomizationDocument: v4, GetAllSnackVideosDocument: x4, GetChatRoomTokenDocument: uN, GetPlayListDocument: P4, GetPlayListsDocument: N4, GetSnackVideoRelationshipsDocument: T4, GetTimeLineDocument: _4, HighlightProductDocument: m4, ManageCollectionProductDocument: sN, Methods: Xx, PinChatMessageDocument: p4, SearchCollectionsDocument: oN, SearchMinimalEventsDocument: u4, SearchSnackVideosDocument: I4, SendAddToCartDocument: w4, SignProvider: Zx, Status: eN, UpdateCollectionDocument: aN, UpdateCustomizationDocument: y4, UpdatePlayListDocument: R4 }, Symbol.toStringTag, { value: "Module" })); var Bp = /* @__PURE__ */ ((t) => (t.OPEN_TAB = "openTab", t.OPEN_VARIATION_SELECTOR = "openVariationSelector", t.ADD_TO_CART = "addToCart", t))(Bp || {}); function F4(t) { return { class: t, _value: null, get value() { return this._value || (this._value = new t(), Object.freeze(this)), this._value; } }; } var qr = /* @__PURE__ */ ((t) => (t.Local = "local", t.VtexLegacy = "vtexlegacy", t.VtexIO = "vtexio", t.VtexFastStore = "faststore", t.Platform = "platform", t.External = "external", t))(qr || {}), Gw = /* @__PURE__ */ ((t) => (t.PROD = "prod", t.DEV = "dev", t.LOCAL = "local", t))(Gw || {}); const { coreLogger: L4 } = ir(), Jy = L4.child("addToCartHooks"), Xy = { // 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 U4(t) { const e = { ...t, action: { type: Bp.ADD_TO_CART, exec: () => Jy.error("action no implemented in validate hook") } }; try { const n = await M4(e), r = await B4(n); await j4(r); } catch (n) { Jy.error("error unhandled", n); } } async function M4(t) { var s; const { context: e, userAddToCartConfig: n } = t, r = (s = n == null ? void 0 : n.hooks) == null ? void 0 : s.transform; let i = t.product; if (r) try { i = await r({ product: { ...i }, data: e.data ?? {} }); } catch (a) { rp("transform", a); } return { ...t, product: i }; } async function B4(t) { var f; const { context: e, hookStrategy: n, userAddToCartConfig: r, product: i } = t, s = lN(t), a = (f = r == null ? void 0 : r.hooks) == null ? void 0 : f.validate; let l = n.validate({ ...t, actionFactory: s }); if (a) try { l = await a({ product: { ...i }, defaultAction: { ...l }, action: s, data: e.data ?? {} }); } catch (d) { rp("validate", d); } return { ...t, action: l, actionFactory: s }; } async function j4(t) { var T; const { eventBus: e } = ir(), { product: n, userAddToCartConfig: r, notifyFactory: i, action: s, actionFactory: a } = t, { isVariationSelectorOpen: l, data: f = {} } = t.context, d = (T = r == null ? void 0 : r.hooks) == null ? void 0 : T.end, p = s.type === Bp.ADD_TO_CART; let v = null, y = !1; const k = () => { !p || !l || a.openVariationSelector(!1).exec(); }, E = () => { !p || y || (v ? i.error(Xy.errorAddingToCart) : i.success(Xy.successAddingToCart)); }, A = () => { const O = { product: n, actionType: s.type, success: !v, error: v }; e.emit(QA.ATCH_ACTION_EXECUTED, O); }; try { if (!s.type || !s.exec) throw new Error("Invalid action object, missing keys 'type' or 'exec'"); await s.exec(); } catch (O) { rp("end", O), v = O; } if (d) try { y = !!await d({ data: f, error: v, notify: i, actionExecuted: s }); } catch (O) { rp("end", O); } k(), E(), A(); } function lN(t) { const { actionFactory: e, userAddToCartConfig: n } = t, r = (i) => Object.entries(i ?? {}).reduce( (s, [a, l]) => ({ ...s, [a]: (f) => ({ type: a, exec: () => l(f) }) }), {} ); return { ...r(e), ...r(n == null ? void 0 : n.actionFactory) }; } function rp(t, e) { Jy.error(`addToCartHooks error running ${t}: `, e); } class cN { constructor(e) { ve(this, "aggregate"); ve(this, "_numSetPropsApplied", 0); 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 jp(t) { return new cN(t); } class $4 { constructor(e) { ve(this, "_value"); 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 V4 = { 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 ip { 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 || V4, 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 ip(this.logger, { prefix: `${this.prefix}:${e}:`, ...this.options }); } clone(e) { return e = e || this.options, e.prefix = e.prefix || this.prefix, new ip(this.logger, e); } } var es = new ip(); class $p { 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((a) => { let [l, f] = a; for (let d = 0; d < f; d++) l(...r); }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((a) => { let [l, f] = a; for (let d = 0; d < f; d++) l.apply(l, [e, ...r]); }); } } const Vc = () => { let t, e; const n = new Promise((r, i) => { t = r, e = i; }); return n.resolve = t, n.reject = e, n; }, $E = (t) => t == null ? "" : "" + t, z4 = (t, e, n) => { t.forEach((r) => { e[r] && (n[r] = e[r]); }); }, q4 = /###/g, VE = (t) => t && t.indexOf("###") > -1 ? t.replace(q4, ".") : t, zE = (t) => !t || typeof t == "string", rd = (t, e, n) => { const r = typeof e != "string" ? e : e.split("."); let i = 0; for (; i < r.length - 1; ) { if (zE(t)) return {}; const s = VE(r[i]); !t[s] && n && (t[s] = new n()), Object.prototype.hasOwnProperty.call(t, s) ? t = t[s] : t = {}, ++i; } return zE(t) ? {} : { obj: t, k: VE(r[i]) }; }, qE = (t, e, n) => { const { obj: r, k: i } = rd(t, e, Object); if (r !== void 0 || e.length === 1) { r[i] = n; return; } let s = e[e.length - 1], a = e.slice(0, e.length - 1), l = rd(t, a, Object); for (; l.obj === void 0 && a.length; ) s = `${a[a.length - 1]}.${s}`, a = a.slice(0, a.length - 1), l = rd(t, a, Object), l && l.obj && typeof l.obj[`${l.k}.${s}`] < "u" && (l.obj = void 0); l.obj[`${l.k}.${s}`] = n; }, H4 = (t, e, n, r) => { const { obj: i, k: s } = rd(t, e, Object); i[s] = i[s] || [], i[s].push(n); }, sp = (t, e) => { const { obj: n, k: r } = rd(t, e); if (n) return n[r]; }, K4 = (t, e, n) => { const r = sp(t, n); return r !== void 0 ? r : sp(e, n); }, dN = (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]) : dN(t[r], e[r], n) : t[r] = e[r]); return t; }, Yu = (t) => t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); var G4 = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", "/": "/" }; const W4 = (t) => typeof t == "string" ? t.replace(/[&<>"'\/]/g, (e) => G4[e]) : t; class Y4 { 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 Q4 = [" ", ",", "?", "!", ";"], J4 = new Y4(20), X4 = (t, e, n) => { e = e || "", n = n || ""; const r = Q4.filter((a) => e.indexOf(a) < 0 && n.indexOf(a) < 0); if (r.length === 0) return !0; const i = J4.getRegExp(`(${r.map((a) => a === "?" ? "\\?" : a).join("|")})`); let s = !i.test(t); if (!s) { const a = t.indexOf(n); a > 0 && !i.test(t.substring(0, a)) && (s = !0); } return s; }, Zy = 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 s = 0; s < r.length; ) { if (!i || typeof i != "object") return; let a, l = ""; for (let f = s; f < r.length; ++f) if (f !== s && (l += n), l += r[f], a = i[l], a !== void 0) { if (["string", "number", "boolean"].indexOf(typeof a) > -1 && f < r.length - 1) continue; s += f - s + 1; break; } i = a; } return i; }, op = (t) => t && t.indexOf("_") > 0 ? t.replace("_", "-") : t; class HE extends $p { 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 s = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, a = 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" && s ? l.push(...r.split(s)) : l.push(r))); const f = sp(this.data, l); return !f && !n && !r && e.indexOf(".") > -1 && (e = l[0], n = l[1], r = l.slice(2).join(".")), f || !a || typeof r != "string" ? f : Zy(this.data && this.data[e] && this.data[e][n], r, s); } addResource(e, n, r, i) { let s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : { silent: !1 }; const a = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator; let l = [e, n]; r && (l = l.concat(a ? r.split(a) : r)), e.indexOf(".") > -1 && (l = e.split("."), i = n, n = l[1]), this.addNamespaces(n), qE(this.data, l, i), s.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 s in r) (typeof r[s] == "string" || Array.isArray(r[s])) && this.addResource(e, n, s, r[s], { silent: !0 }); i.silent || this.emit("added", e, n, r); } addResourceBundle(e, n, r, i, s) { let a = 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 = sp(this.data, l) || {}; a.skipCopy || (r = JSON.parse(JSON.stringify(r))), i ? dN(f, r, s) : f = { ...f, ...r }, qE(this.data, l, f), a.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 fN = { processors: {}, addPostProcessor(t) { this.processors[t.name] = t; }, handle(t, e, n, r, i) { return t.forEach((s) => { this.processors[s] && (e = this.processors[s].process(e, n, r, i)); }), e; } }; const KE = {}; class ap extends $p { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; super(), z4(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = es.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 s = n.ns || this.options.defaultNS || []; const a = r && e.indexOf(r) > -1, l = !this.options.userDefinedKeySeparator && !n.keySeparator && !this.options.userDefinedNsSeparator && !n.nsSeparator && !X4(e, r, i); if (a && !l) { const f = e.match(this.interpolator.nestingRegexp); if (f && f.length > 0) return { key: e, namespaces: s }; const d = e.split(r); (r !== i || r === i && this.options.ns.indexOf(d[0]) > -1) && (s = d.shift()), e = d.join(i); } return typeof s == "string" && (s = [s]), { key: e, namespaces: s }; } 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, s = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, { key: a, 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}${a}`, usedKey: a, exactUsedKey: a, usedLng: d, usedNS: f, usedParams: this.getUsedParamsDetails(n) } : `${f}${j}${a}`; } return i ? { res: a, usedKey: a, exactUsedKey: a, usedLng: d, usedNS: f, usedParams: this.getUsedParamsDetails(n) } : a; } const v = this.resolve(e, n); let y = v && v.res; const k = v && v.usedKey || a, E = v && v.exactUsedKey || a, A = Object.prototype.toString.apply(y), T = ["[object Number]", "[object Function]", "[object RegExp]"], O = 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(A) < 0 && !(typeof O == "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 '${a} (${this.language})' returned an object instead of string.`; return i ? (v.res = j, v.usedParams = this.getUsedParamsDetails(n), v) : j; } if (s) { const j = Array.isArray(y), K = j ? [] : {}, ie = j ? E : k; for (const ce in y) if (Object.prototype.hasOwnProperty.call(y, ce)) { const H = `${ie}${s}${ce}`; K[ce] = this.translate(H, { ...n, joinArrays: !1, ns: l }), K[ce] === H && (K[ce] = y[ce]); } y = K; } } else if (R && typeof O == "string" && Array.isArray(y)) y = y.join(O), y && (y = this.extendTranslation(y, e, n, r)); else { let j = !1, K = !1; const ie = n.count !== void 0 && typeof n.count != "string", ce = ap.hasDefaultValue(n), H = ie ? this.pluralResolver.getSuffix(d, n.count, n) : "", ye = n.ordinal && ie ? this.pluralResolver.getSuffix(d, n.count, { ordinal: !1 }) : "", Z = ie && !n.ordinal && n.count === 0 && this.pluralResolver.shouldUseIntlApi(), _e = Z && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${H}`] || n[`defaultValue${ye}`] || n.defaultValue; !this.isValidLookup(y) && ce && (j = !0, y = _e), this.isValidLookup(y) || (K = !0, y = a); const st = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && K ? void 0 : y, ft = ce && _e !== y && this.options.updateMissing; if (K || j || ft) { if (this.logger.log(ft ? "updateKey" : "missingKey", d, f, a, ft ? _e : y), s) { const de = this.resolve(a, { ...n, keySeparator: !1 }); de && de.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 ue = []; const ke = this.languageUtils.getFallbackCodes(this.options.fallbackLng, n.lng || this.language); if (this.options.saveMissingTo === "fallback" && ke && ke[0]) for (let de = 0; de < ke.length; de++) ue.push(ke[de]); else this.options.saveMissingTo === "all" ? ue = this.languageUtils.toResolveHierarchy(n.lng || this.language) : ue.push(n.lng || this.language); const pe = (de, Ae, B) => { const M = ce && B !== y ? B : st; this.options.missingKeyHandler ? this.options.missingKeyHandler(de, f, Ae, M, ft, n) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(de, f, Ae, M, ft, n), this.emit("missingKey", de, f, Ae, y); }; this.options.saveMissing && (this.options.saveMissingPlurals && ie ? ue.forEach((de) => { const Ae = this.pluralResolver.getSuffixes(de, n); Z && n[`defaultValue${this.options.pluralSeparator}zero`] && Ae.indexOf(`${this.options.pluralSeparator}zero`) < 0 && Ae.push(`${this.options.pluralSeparator}zero`), Ae.forEach((B) => { pe([de], a + B, n[`defaultValue${B}`] || _e); }); }) : pe(ue, a, _e)); } y = this.extendTranslation(y, e, n, v, r), K && y === a && this.options.appendNamespaceToMissingKey && (y = `${f}:${a}`), (K || j) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? y = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${f}:${a}` : a, 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, s) { var a = 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), E = 0; E < y; E++) k[E] = arguments[E]; return s && s[0] === k[0] && !r.context ? (a.logger.warn(`It seems you are nesting recursively key: ${k[0]} in key: ${n[0]}`), null) : a.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 = fN.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, s, a, 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(), E = n.context !== void 0 && (typeof n.context == "string" || typeof n.context == "number") && n.context !== "", A = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng); v.forEach((T) => { this.isValidLookup(r) || (l = T, !KE[`${A[0]}-${T}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(l) && (KE[`${A[0]}-${T}`] = !0, this.logger.warn(`key "${i}" for languages "${A.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!!!")), A.forEach((O) => { if (this.isValidLookup(r)) return; a = O; const R = [p]; if (this.i18nFormat && this.i18nFormat.addLookupKeys) this.i18nFormat.addLookupKeys(R, p, O, T, n); else { let j; y && (j = this.pluralResolver.getSuffix(O, n.count, n)); const K = `${this.options.pluralSeparator}zero`, ie = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`; if (y && (R.push(p + j), n.ordinal && j.indexOf(ie) === 0 && R.push(p + j.replace(ie, this.options.pluralSeparator)), k && R.push(p + K)), E) { const ce = `${p}${this.options.contextSeparator}${n.context}`; R.push(ce), y && (R.push(ce + j), n.ordinal && j.indexOf(ie) === 0 && R.push(ce + j.replace(ie, this.options.pluralSeparator)), k && R.push(ce + K)); } } let U; for (; U = R.pop(); ) this.isValidLookup(r) || (s = U, r = this.getResource(O, T, U, n)); })); }); }), { res: r, usedKey: i, exactUsedKey: s, usedLng: a, 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 s of n) delete i[s]; } 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 Uv = (t) => t.charAt(0).toUpperCase() + t.slice(1); class GE { constructor(e) { this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = es.create("languageUtils"); } getScriptPartFromCode(e) { if (e = op(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 = op(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] = Uv(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] = Uv(r[1].toLowerCase())), n.indexOf(r[2].toLowerCase()) > -1 && (r[2] = Uv(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((s) => { if (s === i) return s; if (!(s.indexOf("-") < 0 && i.indexOf("-") < 0) && (s.indexOf("-") > 0 && i.indexOf("-") < 0 && s.substring(0, s.indexOf("-")) === i || s.indexOf(i) === 0 && i.length > 1)) return s; }); }), 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 = [], s = (a) => { a && (this.isSupportedCode(a) ? i.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`)); }; return typeof e == "string" && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && s(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && s(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && s(this.getLanguagePartFromCode(e))) : typeof e == "string" && s(this.formatLanguageCode(e)), r.forEach((a) => { i.indexOf(a) < 0 && s(this.formatLanguageCode(a)); }), i; } } let Z4 = [{ 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 }], e$ = { 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 t$ = ["v1", "v2", "v3"], n$ = ["v4"], WE = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }, r$ = () => { const t = {}; return Z4.forEach((e) => { e.lngs.forEach((n) => { t[n] = { numbers: e.nr, plurals: e$[e.fc] }; }); }), t; }; class i$ { constructor(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.languageUtils = e, this.options = n, this.logger = es.create("pluralResolver"), (!this.options.compatibilityJSON || n$.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 = r$(), 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 = op(e === "dev" ? "en" : e), i = n.ordinal ? "ordinal" : "cardinal", s = JSON.stringify({ cleanedCode: r, type: i }); if (s in this.pluralRulesCache) return this.pluralRulesCache[s]; const a = new Intl.PluralRules(r, { type: i }); return this.pluralRulesCache[s] = a, a; } 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, s) => WE[i] - WE[s]).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 s = () => 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()}` : s() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 ? s() : this.options.prepend && r.toString() ? this.options.prepend + r.toString() : r.toString(); } shouldUseIntlApi() { return !t$.includes(this.options.compatibilityJSON); } } const YE = 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, s = K4(t, e, n); return !s && i && typeof n == "string" && (s = Zy(t, n, r), s === void 0 && (s = Zy(e, n, r))), s; }, Mv = (t) => t.replace(/\$/g, "$$$$"); class s$ { constructor() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.logger = es.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: s, prefixEscaped: a, suffix: l, suffixEscaped: f, formatSeparator: d, unescapeSuffix: p, unescapePrefix: v, nestingPrefix: y, nestingPrefixEscaped: k, nestingSuffix: E, nestingSuffixEscaped: A, nestingOptionsSeparator: T, maxReplaces: O, alwaysFormat: R } = e.interpolation; this.escape = n !== void 0 ? n : W4, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? Yu(s) : a || "{{", 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 = E ? Yu(E) : A || Yu(")"), this.nestingOptionsSeparator = T || ",", this.maxReplaces = O || 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 s, a, l; const f = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, d = (k) => { if (k.indexOf(this.formatSeparator) < 0) { const O = YE(n, f, k, this.options.keySeparator, this.options.ignoreJSONStructure); return this.alwaysFormat ? this.format(O, void 0, r, { ...i, ...n, interpolationkey: k }) : O; } const E = k.split(this.formatSeparator), A = E.shift().trim(), T = E.join(this.formatSeparator).trim(); return this.format(YE(n, f, A, this.options.keySeparator, this.options.ignoreJSONStructure), T, r, { ...i, ...n, interpolationkey: A }); }; 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) => Mv(k) }, { regex: this.regexp, safeValue: (k) => this.escapeValue ? Mv(this.escape(k)) : Mv(k) }].forEach((k) => { for (l = 0; s = k.regex.exec(e); ) { const E = s[1].trim(); if (a = d(E), a === void 0) if (typeof p == "function") { const T = p(e, s, i); a = typeof T == "string" ? T : ""; } else if (i && Object.prototype.hasOwnProperty.call(i, E)) a = ""; else if (v) { a = s[0]; continue; } else this.logger.warn(`missed to pass in variable ${E} for interpolating ${e}`), a = ""; else typeof a != "string" && !this.useRawValueToEscape && (a = $E(a)); const A = k.safeValue(a); if (e = e.replace(s[0], A), v ? (k.regex.lastIndex += a.length, k.regex.lastIndex -= s[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, s, a; 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, a); const k = y.match(/'/g), E = y.match(/"/g); (k && k.length % 2 === 0 && !E || E.length % 2 !== 0) && (y = y.replace(/'/g, '"')); try { a = JSON.parse(y), d && (a = { ...d, ...a }); } catch (A) { return this.logger.warn(`failed parsing options string in nesting for key ${f}`, A), `${f}${p}${y}`; } return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, f; }; for (; i = this.nestingRegexp.exec(e); ) { let f = []; a = { ...r }, a = a.replace && typeof a.replace != "string" ? a.replace : a, a.applyPostProcessor = !1, delete a.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 (s = n(l.call(this, i[1].trim(), a), a), s && i[0] === e && typeof s != "string") return s; typeof s != "string" && (s = $E(s)), s || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), s = ""), d && (s = f.reduce((p, v) => this.format(p, v, r.lng, { ...r, interpolationkey: i[1].trim() }), s.trim())), e = e.replace(i[0], s), this.regexp.lastIndex = 0; } return e; } } const o$ = (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((a) => { if (a) { const [l, ...f] = a.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 s = i; i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (s = { ...s, [i.interpolationkey]: void 0 }); const a = r + JSON.stringify(s); let l = e[a]; return l || (l = t(op(r), i), e[a] = l), l(n); }; }; class a$ { constructor() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.logger = es.create("formatter"), this.options = e, this.formats = { number: Qu((n, r) => { const i = new Intl.NumberFormat(n, { ...r }); return (s) => i.format(s); }), currency: Qu((n, r) => { const i = new Intl.NumberFormat(n, { ...r, style: "currency" }); return (s) => i.format(s); }), datetime: Qu((n, r) => { const i = new Intl.DateTimeFormat(n, { ...r }); return (s) => i.format(s); }), relativetime: Qu((n, r) => { const i = new Intl.RelativeTimeFormat(n, { ...r }); return (s) => i.format(s, r.range || "day"); }), list: Qu((n, r) => { const i = new Intl.ListFormat(n, { ...r }); return (s) => i.format(s); }) }, 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 s = n.split(this.formatSeparator); if (s.length > 1 && s[0].indexOf("(") > 1 && s[0].indexOf(")") < 0 && s.find((l) => l.indexOf(")") > -1)) { const l = s.findIndex((f) => f.indexOf(")") > -1); s[0] = [s[0], ...s.splice(1, l)].join(this.formatSeparator); } return s.reduce((l, f) => { const { formatName: d, formatOptions: p } = o$(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 u$ = (t, e) => { t.pending[e] !== void 0 && (delete t.pending[e], t.pendingCount--); }; class l$ extends $p { 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 = es.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 s = {}, a = {}, 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 ? a[y] === void 0 && (a[y] = !0) : (this.state[y] = 1, p = !1, a[y] === void 0 && (a[y] = !0), s[y] === void 0 && (s[y] = !0), f[v] === void 0 && (f[v] = !0))); }), p || (l[d] = !0); }), (Object.keys(s).length || Object.keys(a).length) && this.queue.push({ pending: a, pendingCount: Object.keys(a).length, loaded: {}, errors: [], callback: i }), { toLoad: Object.keys(s), pending: Object.keys(a), toLoadLanguages: Object.keys(l), toLoadNamespaces: Object.keys(f) }; } loaded(e, n, r) { const i = e.split("|"), s = i[0], a = i[1]; n && this.emit("failedLoading", s, a, n), !n && r && this.store.addResourceBundle(s, a, 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) => { H4(f.loaded, [s], a), u$(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, s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, a = arguments.length > 5 ? arguments[5] : void 0; if (!e.length) return a(null, {}); if (this.readingCalls >= this.maxParallelReads) { this.waitingReads.push({ lng: e, ns: n, fcName: r, tried: i, wait: s, callback: a }); 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, s * 2, a); }, s); return; } a(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 s = this.queueLoad(e, n, r, i); if (!s.toLoad.length) return s.pending.length || i(), null; s.toLoad.forEach((a) => { this.loadOne(a); }); } 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], s = r[1]; this.read(i, s, "read", void 0, void 0, (a, l) => { a && this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`, a), !a && l && this.logger.log(`${n}loaded namespace ${s} for language ${i}`, l), this.loaded(e, a, l); }); } saveMissing(e, n, r, i, s) { let a = 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 = { ...a, isUpdate: s }, 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 QE = () => ({ 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 } }), JE = (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), fh = () => { }, c$ = (t) => { Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach((n) => { typeof t[n] == "function" && (t[n] = t[n].bind(t)); }); }; class bd extends $p { constructor() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 ? arguments[1] : void 0; if (super(), this.options = JE(e), this.services = {}, this.logger = es, this.modules = { external: [] }, c$(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 = QE(); this.options = { ...i, ...this.options, ...JE(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 s = (p) => p ? typeof p == "function" ? new p() : p : null; if (!this.options.isClone) { this.modules.logger ? es.init(s(this.modules.logger), this.options) : es.init(null, this.options); let p; this.modules.formatter ? p = this.modules.formatter : typeof Intl < "u" && (p = a$); const v = new GE(this.options); this.store = new HE(this.options.resources, this.options); const y = this.services; y.logger = es, y.resourceStore = this.store, y.languageUtils = v, y.pluralResolver = new i$(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 = s(p), y.formatter.init(y, this.options), this.options.interpolation.format = y.formatter.format.bind(y.formatter)), y.interpolator = new s$(this.options), y.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, y.backendConnector = new l$(s(this.modules.backend), y.resourceStore, y, this.options), y.backendConnector.on("*", function(k) { for (var E = arguments.length, A = new Array(E > 1 ? E - 1 : 0), T = 1; T < E; T++) A[T - 1] = arguments[T]; e.emit(k, ...A); }), this.modules.languageDetector && (y.languageDetector = s(this.modules.languageDetector), y.languageDetector.init && y.languageDetector.init(y, this.options.detection, this.options)), this.modules.i18nFormat && (y.i18nFormat = s(this.modules.i18nFormat), y.i18nFormat.init && y.i18nFormat.init(this)), this.translator = new ap(this.services, this.options), this.translator.on("*", function(k) { for (var E = arguments.length, A = new Array(E > 1 ? E - 1 : 0), T = 1; T < E; T++) A[T - 1] = arguments[T]; e.emit(k, ...A); }), this.modules.external.forEach((k) => { k.init && k.init(this); }); } if (this.format = this.options.interpolation.format, r || (r = fh), 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 = Vc(), 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] : fh; 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 s = [], a = (l) => { if (!l || l === "cimode") return; this.services.languageUtils.toResolveHierarchy(l).forEach((d) => { d !== "cimode" && s.indexOf(d) < 0 && s.push(d); }); }; i ? a(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((f) => a(f)), this.options.preload && this.options.preload.forEach((l) => a(l)), this.services.backendConnector.load(s, this.options.ns, (l) => { !l && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), r(l); }); } else r(null); } reloadResources(e, n, r) { const i = Vc(); 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 = fh), this.services.backendConnector.reload(e, n, (s) => { i.resolve(), r(s); }), 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" && fN.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 = Vc(); this.emit("languageChanging", e); const s = (f) => { this.language = f, this.languages = this.services.languageUtils.toResolveHierarchy(f), this.resolvedLanguage = void 0, this.setResolvedLanguage(f); }, a = (f, d) => { d ? (s(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 || s(d), this.translator.language || this.translator.changeLanguage(d), this.services.languageDetector && this.services.languageDetector.cacheUserLanguage && this.services.languageDetector.cacheUserLanguage(d)), this.loadResources(d, (p) => { a(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 s = function(a, 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([a, l].concat(p)); } else f = { ...l }; f.lng = f.lng || s.lng, f.lngs = f.lngs || s.lngs, f.ns = f.ns || s.ns, f.keyPrefix !== "" && (f.keyPrefix = f.keyPrefix || r || s.keyPrefix); const y = i.options.keySeparator || "."; let k; return f.keyPrefix && Array.isArray(a) ? k = a.map((E) => `${f.keyPrefix}${y}${E}`) : k = f.keyPrefix ? `${f.keyPrefix}${y}${a}` : a, i.t(k, f); }; return typeof e == "string" ? s.lng = e : s.lngs = e, s.ns = n, s.keyPrefix = r, s; } 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, s = this.languages[this.languages.length - 1]; if (r.toLowerCase() === "cimode") return !0; const a = (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, a); if (l !== void 0) return l; } return !!(this.hasResourceBundle(r, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(r, e) && (!i || a(s, e))); } loadNamespaces(e, n) { const r = Vc(); 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 = Vc(); typeof e == "string" && (e = [e]); const i = this.options.preload || [], s = e.filter((a) => i.indexOf(a) < 0 && this.services.languageUtils.isSupportedCode(a)); return s.length ? (this.options.preload = i.concat(s), this.loadResources((a) => { r.resolve(), n && n(a); }), 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 GE(QE()); 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 bd(e, n); } cloneInstance() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : fh; const r = e.forkResourceStore; r && delete e.forkResourceStore; const i = { ...this.options, ...e, isClone: !0 }, s = new bd(i); return (e.debug !== void 0 || e.prefix !== void 0) && (s.logger = s.logger.clone(e)), ["store", "services", "language"].forEach((l) => { s[l] = this[l]; }), s.services = { ...this.services }, s.services.utils = { hasLoadedNamespace: s.hasLoadedNamespace.bind(s) }, r && (s.store = new HE(this.store.data, i), s.services.resourceStore = s.store), s.translator = new ap(s.services, i), s.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]; s.emit(l, ...d); }), s.init(i, n), s.translator.options = i, s.translator.backendConnector.services.utils = { hasLoadedNamespace: s.hasLoadedNamespace.bind(s) }, s; } toJSON() { return { options: this.options, store: this.store, language: this.language, languages: this.languages, resolvedLanguage: this.resolvedLanguage }; } } const Gn = bd.createInstance(); Gn.createInstance = bd.createInstance; Gn.createInstance; Gn.dir; Gn.init; Gn.loadResources; Gn.reloadResources; Gn.use; Gn.changeLanguage; Gn.getFixedT; const XE = Gn.t; Gn.exists; Gn.setDefaultNamespace; Gn.hasLoadedNamespace; Gn.loadNamespaces; Gn.loadLanguages; const hN = (t) => XE(t ? `errorCodes.${t}` : "errorCodes.DEFAULT"); class d$ { constructor(e) { ve(this, "logger"); ve(this, "axiosInstance"); this.logger = e.logger, this.axiosInstance = cn.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) { var s; const { data: r = {}, ignoreError: i = !1 } = n; try { return (await this.axiosInstance.post( e, r )).data; } catch (a) { if (i && cn.isAxiosError(a)) return (s = a.response) == null ? void 0 : s.data; throw this.handleError(a); } } /** * 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) { var s; const { data: r = {}, ignoreError: i = !1 } = n; try { return (await this.axiosInstance.put( e, r )).data; } catch (a) { if (i && cn.isAxiosError(a)) return (s = a.response) == null ? void 0 : s.data; throw this.handleError(a); } } /** * 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) { var i; let n = nr.GENERAL_ERROR; if (cn.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 = hN(n); return this.logger.error("Error Code:", n, "Message:", r), this.logger.error("Result Data:", (i = e.response) == null ? void 0 : i.data), new Error(r); } } function f$(t) { return Symbol(t); } function h$(t) { return Symbol(t); } function p$(t) { return { key: t, isOptional: !0 }; } function m$(t, e) { return Object.entries(e).reduce((n, [r, i]) => (n[r] = t.token(i), n), {}); } var Bv = /* @__PURE__ */ new WeakMap(), pN = /* @__PURE__ */ new Map(), g$ = /* @__PURE__ */ new Map(), Za; (function(t) { t[t.Constant = 0] = "Constant", t[t.Instance = 1] = "Instance", t[t.Factory = 2] = "Factory"; })(Za || (Za = {})); var js; (function(t) { t[t.Container = 0] = "Container", t[t.Resolution = 1] = "Resolution", t[t.Singleton = 2] = "Singleton", t[t.Transient = 3] = "Transient"; })(js || (js = {})); var v$ = class { constructor(t) { this.impl = t, this.type = Za.Constant; } }, y$ = class { constructor(t) { this.impl = t, this.type = Za.Factory; } }, w$ = (t) => t.type === Za.Factory, Vp = class { constructor(t) { this.impl = t, this.type = Za.Instance; } }, _$ = class extends Vp { constructor() { super(...arguments), this.scope = js.Container, this.cache = /* @__PURE__ */ new WeakMap(); } }, S$ = class extends Vp { constructor() { super(...arguments), this.scope = js.Resolution; } }, b$ = class extends Vp { constructor(t) { super(t), this.impl = t, this.scope = js.Singleton; } }, k$ = class extends Vp { constructor() { super(...arguments), this.scope = js.Transient; } }, E$ = (t) => t.type === Za.Instance, A$ = (t) => t.scope === js.Container, C$ = (t) => t.scope === js.Resolution, x$ = (t) => t.scope === js.Singleton, mN = (t) => Symbol(t), N$ = (t) => { const e = Symbol(t); return { __t: null, __d: t, __s: e, __o: !1, optional: { __t: null, __d: t, __s: e, __o: !0 } }; }, Jc = class { constructor() { this.parent = null, this.map = /* @__PURE__ */ new Map(); } set(t, e, n = Jc.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, s = e.length; i < s; i += 1) { const a = r.get(e[i]); if (a) return a; } return r.get(Jc.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 Jc ? (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 s = 0, a = e.vaults, l = a.length; s < l; s += 1) { const f = a[s].resolve(t, e, n, r); if (f) return f; } return null; } from(t) { const e = new Jc(); 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)); } }, gN = Jc; gN.notag = mN("NO_TAG"); var T$ = 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); } }, I$ = class { constructor(t, e, n, r) { this.vault = t, this.impl = e, this.token = n, this.condition = r; } inContainerScope() { this.set(_$); } inResolutionScope() { this.set(S$); } inSingletonScope() { this.set(b$); } inTransientScope() { this.set(k$); } set(t) { this.vault.set(new t(this.impl), this.token, this.condition); } }, R$ = class { constructor(t, e, n) { this.vault = t, this.token = e, this.condition = n; } toConstant(t) { this.vault.set(new v$(t), this.token, this.condition); } toFactory(t, e) { this.vault.set(new y$({ creator: t, initializer: e }), this.token, this.condition); } toInstance(t) { return new I$(this.vault, t, this.token, this.condition); } }, ew = class { constructor(t, e) { this.vault = t, this.condition = e; } static vault(t) { return t.vault; } bind(t) { return new R$(this.vault, t, this.condition); } use(...t) { return new T$(this.vault, t, ew.vault, this.condition); } }, O$ = class extends ew { when(t) { return new ew(this.vault, t); } }, P$ = class extends O$ { constructor() { super(new gN()); } }, vN = class { constructor(t = /* @__PURE__ */ new Map(), e = []) { this.instances = t, this.vaults = e; } split() { return new vN(this.instances, this.vaults.slice()); } }, Ph = class extends P$ { constructor() { super(), this.snapshot = null; } extend(t) { return this.vault.parent = t === null ? null : t.vault, this; } clone() { const t = new Ph(); 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 vN()) { 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 E$(t) ? x$(t) ? this.resolveCache(t, e, () => t.cache, (n) => { t.cache = n; }) : A$(t) ? this.resolveCache(t, e, () => t.cache.get(this.vault), (n) => { t.cache.set(this.vault, n); }) : C$(t) ? this.resolveCache(t, e, () => e.instances.get(t), (n) => { e.instances.set(t, n); }) : this.createInstance(t.impl, e) : w$(t) ? (...n) => { const r = this.createInstance(t.impl.creator, e); return r instanceof Promise ? r.then((i) => Ph.resolveInitialization(i, n, t.impl.initializer)) : Ph.resolveInitialization(r, n, t.impl.initializer); } : t.impl; } resolveCache(t, e, n, r) { const i = n(); if (i !== void 0) return i; const s = this.createInstance(t.impl, e); return r(s), s; } createInstance(t, e) { const n = this.getParameters(t, e), r = Bv.get(t); if (r !== void 0) return r ? t(...n) : new t(...n); try { const i = t(...n); return Bv.set(t, !0), i; } catch { const s = new t(...n); return Bv.set(t, !1), s; } } getParameters(t, e) { const n = pN.get(t); if (n) return this.resolveTokens(n, e, g$.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 == null ? void 0 : n(t, ...e); return r instanceof Promise ? r.then(() => t) : t; } }, ZE = (t, ...e) => (pN.set(t, e), t); function Ww(t) { return typeof t == "object" && t !== null && t.isOptional === !0; } function yN(t) { return "useClass" in t; } function wN(t) { return "useValue" in t; } function _N(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, N$(e.description ?? "unknown_key")), t.get(e); } function Yw(t, e) { return t.has(e) || t.set(e, mN(e.description ?? "unknown_tag")), t.get(e); } function SN(t, e) { return typeof e == "symbol" ? Yw(t, e) : e; } function tw(t, e, n) { return e.map((r) => { const i = Ww(r), s = i ? r.key : r, a = t.get(s); if (!a) throw new Error( `DI Error: Dependency key "${String( s.description )}" required by "${String(n.description)}" not found.` ); return i ? a.optional : a; }); } function bN(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 Qw { /** * Private constructor to enforce creation through static create method. * Initializes the Brandi container. */ constructor() { /** * Brandi container instance used for dependency resolution. * This is exposed to allow direct access to Brandi's features if needed. */ ve(this, "container"); /** * Internal mapping of dependency keys to Brandi tokens. * Used for type-safe token resolution. */ ve(this, "keyToTokenMap", /* @__PURE__ */ new Map()); /** * Internal mapping of custom tags to Brandi tags. * Used for conditional binding resolution. */ ve(this, "tagToBrandiTagMap", /* @__PURE__ */ new Map()); this.container = new Ph(); } /** * 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 Qw(); return n.initializeTokensAndTags(e), n.bindProviders(e), n; } /** * 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" && Yw(this.tagToBrandiTagMap, n.when), "deps" in n && n.deps && n.deps.forEach((r) => { const i = Ww(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 ? SN(this.tagToBrandiTagMap, n.when) : void 0, i = r ? this.container.when(r) : this.container; yN(n) ? this.bindClassProvider(i, n) : wN(n) ? this.bindValueProvider(i, n) : _N(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: s = [], scope: a = Ba.Transient } = n, l = Xu(this.keyToTokenMap, r), f = tw( this.keyToTokenMap, s, r ); f.length > 0 && ZE(i, ...f); const d = e.bind(l).toInstance(i); bN(d, a); } /** * 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) { var f; const { key: r, useFactory: i, deps: s = [], initializer: a } = n, l = Xu(this.keyToTokenMap, r); if (typeof i == "function" && ((f = i.prototype) == null ? void 0 : f.constructor) === i && s.length > 0) { const d = tw( this.keyToTokenMap, s, r ); d.length > 0 && ZE(i, ...d); } e.bind(l).toFactory(i, a); } } function kN(t) { const e = Object.values(t); return Object.assign({}, ...e); } function EN(t) { return Object.entries(t).reduce( (e, [n, r]) => { const i = kN(r); return { ...e, [n]: i }; }, {} ); } function AN(t, e) { const n = EN(e); Object.entries(n).forEach(([r, i]) => { t.addResourceBundle(r, "translation", i, !0); }); } const { slice: D$, forEach: F$ } = []; function L$(t) { return F$.call(D$.call(arguments, 1), (e) => { if (e) for (const n in e) t[n] === void 0 && (t[n] = e[n]); }), t; } const e1 = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, U$ = (t, e, n) => { const r = n || {}; r.path = r.path || "/"; const i = encodeURIComponent(e); let s = `${t}=${i}`; if (r.maxAge > 0) { const a = r.maxAge - 0; if (Number.isNaN(a)) throw new Error("maxAge should be a Number"); s += `; Max-Age=${Math.floor(a)}`; } if (r.domain) { if (!e1.test(r.domain)) throw new TypeError("option domain is invalid"); s += `; Domain=${r.domain}`; } if (r.path) { if (!e1.test(r.path)) throw new TypeError("option path is invalid"); s += `; Path=${r.path}`; } if (r.expires) { if (typeof r.expires.toUTCString != "function") throw new TypeError("option expires is invalid"); s += `; Expires=${r.expires.toUTCString()}`; } if (r.httpOnly && (s += "; HttpOnly"), r.secure && (s += "; Secure"), r.sameSite) switch (typeof r.sameSite == "string" ? r.sameSite.toLowerCase() : r.sameSite) { case !0: s += "; SameSite=Strict"; break; case "lax": s += "; SameSite=Lax"; break; case "strict": s += "; SameSite=Strict"; break; case "none": s += "; SameSite=None"; break; default: throw new TypeError("option sameSite is invalid"); } return s; }, t1 = { 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 = U$(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 M$ = { name: "cookie", // Deconstruct the options object and extract the lookupCookie property lookup(t) { let { lookupCookie: e } = t; if (e && typeof document < "u") return t1.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: s } = e; n && typeof document < "u" && t1.create(n, t, r, i, s); } }, B$ = { name: "querystring", // Deconstruct the options object and extract the lookupQuerystring property lookup(t) { var r; let { lookupQuerystring: e } = t, n; if (typeof window < "u") { let { search: i } = window.location; !window.location.search && ((r = window.location.hash) == null ? void 0 : r.indexOf("?")) > -1 && (i = window.location.hash.substring(window.location.hash.indexOf("?"))); const a = i.substring(1).split("&"); for (let l = 0; l < a.length; l++) { const f = a[l].indexOf("="); f > 0 && a[l].substring(0, f) === e && (n = a[l].substring(f + 1)); } } return n; } }; let zc = null; const n1 = () => { if (zc !== null) return zc; try { zc = window !== "undefined" && window.localStorage !== null; const t = "i18next.translate.boo"; window.localStorage.setItem(t, "foo"), window.localStorage.removeItem(t); } catch { zc = !1; } return zc; }; var j$ = { name: "localStorage", // Deconstruct the options object and extract the lookupLocalStorage property lookup(t) { let { lookupLocalStorage: e } = t; if (e && n1()) return window.localStorage.getItem(e) || void 0; }, // Deconstruct the options object and extract the lookupLocalStorage property cacheUserLanguage(t, e) { let { lookupLocalStorage: n } = e; n && n1() && window.localStorage.setItem(n, t); } }; let qc = null; const r1 = () => { if (qc !== null) return qc; try { qc = window !== "undefined" && window.sessionStorage !== null; const t = "i18next.translate.boo"; window.sessionStorage.setItem(t, "foo"), window.sessionStorage.removeItem(t); } catch { qc = !1; } return qc; }; var $$ = { name: "sessionStorage", lookup(t) { let { lookupSessionStorage: e } = t; if (e && r1()) return window.sessionStorage.getItem(e) || void 0; }, cacheUserLanguage(t, e) { let { lookupSessionStorage: n } = e; n && r1() && window.sessionStorage.setItem(n, t); } }, V$ = { name: "navigator", lookup(t) { const e = []; if (typeof navigator < "u") { const { languages: n, userLanguage: r, language: i } = navigator; if (n) for (let s = 0; s < n.length; s++) e.push(n[s]); r && e.push(r), i && e.push(i); } return e.length > 0 ? e : void 0; } }, z$ = { 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; } }, q$ = { name: "path", // Deconstruct the options object and extract the lookupFromPathIndex property lookup(t) { var i; let { lookupFromPathIndex: e } = t; if (typeof window > "u") return; const n = window.location.pathname.match(/\/([a-zA-Z-]*)/g); return Array.isArray(n) ? (i = n[typeof e == "number" ? e : 0]) == null ? void 0 : i.replace("/", "") : void 0; } }, H$ = { name: "subdomain", lookup(t) { var i, s; let { lookupFromSubdomainIndex: e } = t; const n = typeof e == "number" ? e + 1 : 1, r = typeof window < "u" && ((s = (i = window.location) == null ? void 0 : i.hostname) == null ? void 0 : s.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i)); if (r) return r[n]; } }; function K$() { 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 CN { 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 = L$(n, this.options || {}, K$()), 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(M$), this.addDetector(B$), this.addDetector(j$), this.addDetector($$), this.addDetector(V$), this.addDetector(z$), this.addDetector(q$), this.addDetector(H$); } 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); })); } } CN.type = "languageDetector"; function xN(t, e) { t.use(e).use(CN).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 [s, ...a] = r.split(",").map((l) => l.trim()); if (s === "number") return new Intl.NumberFormat(i).format(n); if (s === "date") return new Intl.DateTimeFormat(i).format(n); if (s === "currency") return new Intl.NumberFormat(i, { style: "currency", currency: a[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 G$ = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, W$ = { "&": "&", "&": "&", "<": "<", "<": "<", ">": ">", ">": ">", "'": "'", "'": "'", """: '"', """: '"', " ": " ", " ": " ", "©": "©", "©": "©", "®": "®", "®": "®", "…": "…", "…": "…", "/": "/", "/": "/" }, Y$ = (t) => W$[t], Q$ = (t) => t.replace(G$, Y$); let i1 = { bindI18n: "languageChanged", bindI18nStore: "", transEmptyNodeValue: "", transSupportBasicHtmlNodes: !0, transWrapTextNodes: "", transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"], useSuspense: !0, unescape: Q$ }; function J$() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; i1 = { ...i1, ...t }; } const X$ = { type: "3rdParty", init(t) { J$(t.options.react); } }; xN(Gn, X$); const Z$ = (t) => AN(Gn, t), s1 = { startTime: "UNKNOWN", viewerCount: 0, status: "UNKNOWN" }, e6 = () => { const [t, e] = vt.useState([]), [n, r] = vt.useState(s1); return { realTimeStreamInfo: n, productsInCart: t, onTextMetadataCue: (a) => { const { action: l, data: f, startTime: d, viewerCount: p, status: v } = JSON.parse( a == null ? void 0 : a.text ); switch (l) { case "sendivsdatarealtime": { r({ startTime: d, viewerCount: p, status: v }); break; } case "sendaddtocart": { const { id: y, sessionId: k, productId: E, productImageUrl: A, productName: T } = f; e((O) => [ ...O, { id: y, sessionId: k, productId: E, productImageUrl: A, productName: T } ]); } break; } }, resetRealTimeStreamInfo: () => { r(s1); }, setProductsInCart: e }; }; class NN extends Oi { constructor() { super( "EVENT_CHAT_ROOM_TOKEN_ERROR", "Error getting chat room connection token" ); } } class zp { constructor(e) { ve(this, "root", jp(this)); ve(this, "token"); this.root.setProps(e); } static toDomain(e) { const n = { token: e.token }; return new zp(n); } toPrimitives() { const { root: e, ...n } = this; return { ...n }; } } class TN { async getChatRoom(e) { var i; const { getChatRoomToken: n } = await Cn.graphql( uN, { data: { account: e.account, idEvent: e.eventId, userName: e.userName } } ); this.propagateGraphqlErrorIfExists( n ); const r = (i = n.data) == null ? void 0 : i.token; if (!r) throw new NN(); return zp.toDomain({ token: r }); } propagateGraphqlErrorIfExists(e) { if (e.__typename === "ErrorGeneral") throw new Error(e.message); } } class IN { constructor(e) { ve(this, "account"); this.eventChatRoomRepository = e; } async get(e) { this.validateAccount(); try { return await this.eventChatRoomRepository.getChatRoom({ ...e, account: this.account }); } catch (n) { throw new xo(n); } } setAccount(e) { this.account = e; } validateAccount() { if (!this.account) throw new pw(); } } const t6 = new TN(), nw = new IN( t6 ), qp = Ts(void 0); qp.debugLabel = "chatSocketAtom"; const Hp = Ts(!1); Hp.debugLabel = "chatIsConnectedAtom"; const Pd = Ts([]); Pd.debugLabel = "chatMessageListAtom"; const RN = (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("::") || ["none", "none"], i = r.split("question__")[1], s = { response: n.replace("response__", ""), question: JSON.parse(i) }; return { ...t, data: s.response, isResponse: e, responseData: t.data, question: e ? s.question : null }; } return t; }, ON = (t) => { const { url: e, token: n, onOpen: r, onClose: i, onMessage: s, onError: a } = t, l = new WebSocket(e, n); return l.onopen = (f) => r(f), l.onclose = (f) => i(f), l.onerror = (f) => a(f), l.onmessage = (f) => s(f), l; }, PN = () => { const t = "0123456789ABCDEF"; let e = "#"; for (let n = 0; n < 6; n += 1) e += t[Math.floor(Math.random() * 16)]; return e; }, Jw = (t, e) => { var y; const { Content: n, Attributes: r, Sender: { Attributes: i } } = e, { username: s, type: a, email: l } = r, { isAdmin: f } = i, d = (r == null ? void 0 : r.id) ?? Uo(8), p = ((y = t.find((k) => k.username === s)) == null ? void 0 : y.color) || PN(), v = { id: d, type: a, color: p, username: s, 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 RN(v); }, DN = (t) => { const { eventId: e, userName: n, enabled: r = !0 } = t, { accountName: i } = Yx(), [s, a] = vt.useState(""), l = () => { r && i && (nw.setAccount(i), nw.get({ eventId: e, userName: n }).then((f) => { a(f.token); })); }; return vt.useEffect(() => { l(); }, [i, r]), { getQuery: { refetch: l }, token: s }; }, { coreLogger: n6 } = ir(), Er = n6.child("useConnectChatSocket"), r6 = wd.publicUrls.wssIVSChat, i6 = 10, s6 = (t) => Math.min(1e4, 1e3 * Math.pow(2, t)), o6 = (t, e, n) => { const r = JSON.parse(t.data); switch (r.Type) { case "EVENT": e == null || e(r); break; case "MESSAGE": n == null || n(r); break; case "ERROR": Er.error("Chat room error:", r); break; default: Er.error("Unknown chat room event:", t); } }, FN = (t) => { const { onMessage: e, eventId: n, enabled: r = !0, userName: i, onEvent: s } = t, { token: a, getQuery: l } = DN({ eventId: n, userName: i, enabled: r }), [f, d] = Sg(qp), [p, v] = Sg(Hp), [y, k] = Sg(Pd), E = vt.useRef(0), A = vt.useCallback( (j) => Er.error("Chat room socket error:", j), [] ), T = vt.useCallback(() => { v(!0), E.current = 0, Er.debug("Successfully connected to the chat room"); }, [v]), O = vt.useCallback(() => { if (E.current >= i6) { Er.error( "Max reconnection attempts reached. No further attempts will be made." ); return; } v(!1), E.current += 1; const j = s6(E.current); Er.debug( `Disconnected from chat room. Reconnecting in ${j / 1e3} seconds... (Attempt ${E.current})` ), setTimeout(() => l.refetch(), j); }, [l, v]), R = vt.useCallback(() => { if (!a) { Er.debug("No token available. Connection aborted."); return; } if ((f == null ? void 0 : f.readyState) === WebSocket.OPEN) { Er.debug("WebSocket is already open. No need to reconnect."); return; } Er.debug("Connecting to the chat room..."); const j = ON({ token: a, url: r6, onOpen: T, onClose: O, onError: A, onMessage: (K) => o6(K, s, e) }); d(j); }, [ a, f, s, e, T, O, A, d ]), U = vt.useCallback(() => { if (!f || f.readyState !== WebSocket.OPEN) { Er.debug("No open socket to close."); return; } Er.debug("Closing chat room socket..."), f.close(); }, [f]); return vt.useEffect(() => { if (!r) { Er.debug("Chat is disabled, skipping connection."); return; } if (!a) { Er.debug("Token not available, skipping connection."); return; } return Er.debug("Initializing connection with token:", a), U(), R(), U; }, [a, r]), { socket: f, chatIsConnected: p, chatMessageList: y, setChatMessageList: k }; }, a6 = () => { const t = Lh(qp), e = Lh(Hp); return { sendMessage: vt.useCallback( (r, i) => { if (!t || !e) return; const s = { id: i.id, sendDate: /* @__PURE__ */ new Date(), content: r, action: "SEND_MESSAGE", attributes: i }, a = JSON.stringify(s); t.send(a); }, [e, t] ) }; }, LN = () => { const t = lw(Pd); return { handleEvent: (r) => { var i; if (r.EventName === "senddeletemessage") { const s = JSON.parse((i = r.Attributes) == null ? void 0 : i.data); t((a) => a.filter((l) => l.id !== s.id)); } }, handleMessage: (r) => { t((i) => [...i, Jw(i, r)]); } }; }, u6 = (t) => { const { eventId: e, userName: n } = t, [r, i] = vt.useState(!1), [s, a] = vt.useState(), [l, f] = vt.useState(), [d, p] = vt.useState([]), { handleEvent: v } = LN(), y = lw(Pd), k = (R) => { y((U) => [Jw(U, R), ...U]), i(!1); }, E = (R) => { var U, j, K; if (v(R), R.EventName === "sendpinmessage") { const ie = JSON.parse((U = R.Attributes) == null ? void 0 : U.data); a({ data: ie.data, id: ie.id, username: ie.username }); } if (R.EventName === "sendunpinmessage" && a(void 0), R.EventName === "sendhighlightproduct") { const ie = JSON.parse((j = R.Attributes) == null ? void 0 : j.data); f({ products: ie.productIds, collection: ie.collection, livestreamingId: ie.idEvent }); } if (R.EventName === "sendaddtocart") { const ie = JSON.parse((K = R.Attributes) == null ? void 0 : K.data); p((ce) => [ ...ce, { id: ie.id, sessionId: ie.sessionId, productId: ie.productId, productImageUrl: ie.productImageUrl, productName: ie.productName } ]); } }, { socket: A, chatMessageList: T, setChatMessageList: O } = FN({ onMessage: k, onEvent: E, eventId: e, userName: n }); return { socket: A, chat: T, showLoader: r, pinnedMessage: s, highlightProduct: l, productsInCart: d, setChat: O, setShowLoader: i, setPinnedMessage: a, setProductsInCart: p }; }; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const Dh = globalThis, Xw = Dh.ShadowRoot && (Dh.ShadyCSS === void 0 || Dh.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Zw = Symbol(), o1 = /* @__PURE__ */ new WeakMap(); let UN = class { constructor(e, n, r) { if (this._$cssResult$ = !0, r !== Zw) 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 (Xw && e === void 0) { const r = n !== void 0 && n.length === 1; r && (e = o1.get(n)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), r && o1.set(n, e)); } return e; } toString() { return this.cssText; } }; const l6 = (t) => new UN(typeof t == "string" ? t : t + "", void 0, Zw), c6 = (t, ...e) => { const n = t.length === 1 ? t[0] : e.reduce((r, i, s) => r + ((a) => { if (a._$cssResult$ === !0) return a.cssText; if (typeof a == "number") return a; throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); })(i) + t[s + 1], t[0]); return new UN(n, t, Zw); }, d6 = (t, e) => { if (Xw) t.adoptedStyleSheets = e.map((n) => n instanceof CSSStyleSheet ? n : n.styleSheet); else for (const n of e) { const r = document.createElement("style"), i = Dh.litNonce; i !== void 0 && r.setAttribute("nonce", i), r.textContent = n.cssText, t.appendChild(r); } }, a1 = Xw ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => { let n = ""; for (const r of e.cssRules) n += r.cssText; return l6(n); })(t) : t; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const { is: f6, defineProperty: h6, getOwnPropertyDescriptor: p6, getOwnPropertyNames: m6, getOwnPropertySymbols: g6, getPrototypeOf: v6 } = Object, Fo = globalThis, u1 = Fo.trustedTypes, y6 = u1 ? u1.emptyScript : "", jv = Fo.reactiveElementPolyfillSupport, id = (t, e) => t, rw = { toAttribute(t, e) { switch (e) { case Boolean: t = t ? y6 : 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; } }, MN = (t, e) => !f6(t, e), l1 = { attribute: !0, type: String, converter: rw, reflect: !1, hasChanged: MN }; Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), Fo.litPropertyMetadata ?? (Fo.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); class Zu extends HTMLElement { static addInitializer(e) { this._$Ei(), (this.l ?? (this.l = [])).push(e); } static get observedAttributes() { return this.finalize(), this._$Eh && [...this._$Eh.keys()]; } static createProperty(e, n = l1) { 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 && h6(this.prototype, e, i); } } static getPropertyDescriptor(e, n, r) { const { get: i, set: s } = p6(this.prototype, e) ?? { get() { return this[n]; }, set(a) { this[n] = a; } }; return { get() { return i == null ? void 0 : i.call(this); }, set(a) { const l = i == null ? void 0 : i.call(this); s.call(this, a), this.requestUpdate(e, l, r); }, configurable: !0, enumerable: !0 }; } static getPropertyOptions(e) { return this.elementProperties.get(e) ?? l1; } static _$Ei() { if (this.hasOwnProperty(id("elementProperties"))) return; const e = v6(this); e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties); } static finalize() { if (this.hasOwnProperty(id("finalized"))) return; if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(id("properties"))) { const n = this.properties, r = [...m6(n), ...g6(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(a1(i)); } else e !== void 0 && n.push(a1(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() { var e; this._$ES = new Promise((n) => this.enableUpdating = n), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (e = this.constructor.l) == null || e.forEach((n) => n(this)); } addController(e) { var n; (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(e), this.renderRoot !== void 0 && this.isConnected && ((n = e.hostConnected) == null || n.call(e)); } removeController(e) { var n; (n = this._$EO) == null || n.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 d6(e, this.constructor.elementStyles), e; } connectedCallback() { var e; this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((n) => { var r; return (r = n.hostConnected) == null ? void 0 : r.call(n); }); } enableUpdating(e) { } disconnectedCallback() { var e; (e = this._$EO) == null || e.forEach((n) => { var r; return (r = n.hostDisconnected) == null ? void 0 : r.call(n); }); } attributeChangedCallback(e, n, r) { this._$AK(e, r); } _$EC(e, n) { var s; const r = this.constructor.elementProperties.get(e), i = this.constructor._$Eu(e, r); if (i !== void 0 && r.reflect === !0) { const a = (((s = r.converter) == null ? void 0 : s.toAttribute) !== void 0 ? r.converter : rw).toAttribute(n, r.type); this._$Em = e, a == null ? this.removeAttribute(i) : this.setAttribute(i, a), this._$Em = null; } } _$AK(e, n) { var s; const r = this.constructor, i = r._$Eh.get(e); if (i !== void 0 && this._$Em !== i) { const a = r.getPropertyOptions(i), l = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((s = a.converter) == null ? void 0 : s.fromAttribute) !== void 0 ? a.converter : rw; this._$Em = i, this[i] = l.fromAttribute(n, a.type), this._$Em = null; } } requestUpdate(e, n, r) { if (e !== void 0) { if (r ?? (r = this.constructor.getPropertyOptions(e)), !(r.hasChanged ?? MN)(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 ?? (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() { var r; if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) { for (const [s, a] of this._$Ep) this[s] = a; this._$Ep = void 0; } const i = this.constructor.elementProperties; if (i.size > 0) for (const [s, a] of i) a.wrapped !== !0 || this._$AL.has(s) || this[s] === void 0 || this.P(s, this[s], a); } let e = !1; const n = this._$AL; try { e = this.shouldUpdate(n), e ? (this.willUpdate(n), (r = this._$EO) == null || r.forEach((i) => { var s; return (s = i.hostUpdate) == null ? void 0 : s.call(i); }), this.update(n)) : this._$EU(); } catch (i) { throw e = !1, this._$EU(), i; } e && this._$AE(n); } willUpdate(e) { } _$AE(e) { var n; (n = this._$EO) == null || n.forEach((r) => { var i; return (i = r.hostUpdated) == null ? void 0 : i.call(r); }), 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 = this._$Ej.forEach((n) => this._$EC(n, this[n]))), this._$EU(); } updated(e) { } firstUpdated(e) { } } Zu.elementStyles = [], Zu.shadowRootOptions = { mode: "open" }, Zu[id("elementProperties")] = /* @__PURE__ */ new Map(), Zu[id("finalized")] = /* @__PURE__ */ new Map(), jv == null || jv({ ReactiveElement: Zu }), (Fo.reactiveElementVersions ?? (Fo.reactiveElementVersions = [])).push("2.0.4"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const sd = globalThis, up = sd.trustedTypes, c1 = up ? up.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, BN = "$lit$", No = `lit$${Math.random().toFixed(9).slice(2)}$`, jN = "?" + No, w6 = `<${jN}>`, eu = document, kd = () => eu.createComment(""), Ed = (t) => t === null || typeof t != "object" && typeof t != "function", e0 = Array.isArray, _6 = (t) => e0(t) || typeof (t == null ? void 0 : t[Symbol.iterator]) == "function", $v = `[ \f\r]`, Hc = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, d1 = /-->/g, f1 = />/g, Ca = RegExp(`>|${$v}(?:([^\\s"'>=/]+)(${$v}*=${$v}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`, "g"), h1 = /'/g, p1 = /"/g, $N = /^(?:script|style|textarea|title)$/i, S6 = (t) => (e, ...n) => ({ _$litType$: t, strings: e, values: n }), b6 = S6(1), gl = Symbol.for("lit-noChange"), Rn = Symbol.for("lit-nothing"), m1 = /* @__PURE__ */ new WeakMap(), ja = eu.createTreeWalker(eu, 129); function VN(t, e) { if (!e0(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array"); return c1 !== void 0 ? c1.createHTML(e) : e; } const k6 = (t, e) => { const n = t.length - 1, r = []; let i, s = e === 2 ? "" : e === 3 ? "" : "", a = Hc; for (let l = 0; l < n; l++) { const f = t[l]; let d, p, v = -1, y = 0; for (; y < f.length && (a.lastIndex = y, p = a.exec(f), p !== null); ) y = a.lastIndex, a === Hc ? p[1] === "!--" ? a = d1 : p[1] !== void 0 ? a = f1 : p[2] !== void 0 ? ($N.test(p[2]) && (i = RegExp("" ? (a = i ?? Hc, v = -1) : p[1] === void 0 ? v = -2 : (v = a.lastIndex - p[2].length, d = p[1], a = p[3] === void 0 ? Ca : p[3] === '"' ? p1 : h1) : a === p1 || a === h1 ? a = Ca : a === d1 || a === f1 ? a = Hc : (a = Ca, i = void 0); const k = a === Ca && t[l + 1].startsWith("/>") ? " " : ""; s += a === Hc ? f + w6 : v >= 0 ? (r.push(d), f.slice(0, v) + BN + f.slice(v) + No + k) : f + No + (v === -2 ? l : k); } return [VN(t, s + (t[n] || "") + (e === 2 ? "" : e === 3 ? "" : "")), r]; }; class Ad { constructor({ strings: e, _$litType$: n }, r) { let i; this.parts = []; let s = 0, a = 0; const l = e.length - 1, f = this.parts, [d, p] = k6(e, n); if (this.el = Ad.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(BN)) { const y = p[a++], k = i.getAttribute(v).split(No), E = /([.?@])?(.*)/.exec(y); f.push({ type: 1, index: s, name: E[2], strings: k, ctor: E[1] === "." ? A6 : E[1] === "?" ? C6 : E[1] === "@" ? x6 : Kp }), i.removeAttribute(v); } else v.startsWith(No) && (f.push({ type: 6, index: s }), i.removeAttribute(v)); if ($N.test(i.tagName)) { const v = i.textContent.split(No), y = v.length - 1; if (y > 0) { i.textContent = up ? up.emptyScript : ""; for (let k = 0; k < y; k++) i.append(v[k], kd()), ja.nextNode(), f.push({ type: 2, index: ++s }); i.append(v[y], kd()); } } } else if (i.nodeType === 8) if (i.data === jN) f.push({ type: 2, index: s }); else { let v = -1; for (; (v = i.data.indexOf(No, v + 1)) !== -1; ) f.push({ type: 7, index: s }), v += No.length - 1; } s++; } } static createElement(e, n) { const r = eu.createElement("template"); return r.innerHTML = e, r; } } function vl(t, e, n = t, r) { var a, l; if (e === gl) return e; let i = r !== void 0 ? (a = n.o) == null ? void 0 : a[r] : n.l; const s = Ed(e) ? void 0 : e._$litDirective$; return (i == null ? void 0 : i.constructor) !== s && ((l = i == null ? void 0 : i._$AO) == null || l.call(i, !1), s === void 0 ? i = void 0 : (i = new s(t), i._$AT(t, n, r)), r !== void 0 ? (n.o ?? (n.o = []))[r] = i : n.l = i), i !== void 0 && (e = vl(t, i._$AS(t, e.values), i, r)), e; } class E6 { 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 == null ? void 0 : e.creationScope) ?? eu).importNode(n, !0); ja.currentNode = i; let s = ja.nextNode(), a = 0, l = 0, f = r[0]; for (; f !== void 0; ) { if (a === f.index) { let d; f.type === 2 ? d = new Dd(s, s.nextSibling, this, e) : f.type === 1 ? d = new f.ctor(s, f.name, f.strings, this, e) : f.type === 6 && (d = new N6(s, this, e)), this._$AV.push(d), f = r[++l]; } a !== (f == null ? void 0 : f.index) && (s = ja.nextNode(), a++); } 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 Dd { get _$AU() { var e; return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this.v; } constructor(e, n, r, i) { this.type = 2, this._$AH = Rn, this._$AN = void 0, this._$AA = e, this._$AB = n, this._$AM = r, this.options = i, this.v = (i == null ? void 0 : i.isConnected) ?? !0; } get parentNode() { let e = this._$AA.parentNode; const n = this._$AM; return n !== void 0 && (e == null ? 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), Ed(e) ? e === Rn || e == null || e === "" ? (this._$AH !== Rn && this._$AR(), this._$AH = Rn) : e !== this._$AH && e !== gl && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : _6(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 !== Rn && Ed(this._$AH) ? this._$AA.nextSibling.data = e : this.T(eu.createTextNode(e)), this._$AH = e; } $(e) { var s; const { values: n, _$litType$: r } = e, i = typeof r == "number" ? this._$AC(e) : (r.el === void 0 && (r.el = Ad.createElement(VN(r.h, r.h[0]), this.options)), r); if (((s = this._$AH) == null ? void 0 : s._$AD) === i) this._$AH.p(n); else { const a = new E6(i, this), l = a.u(this.options); a.p(n), this.T(l), this._$AH = a; } } _$AC(e) { let n = m1.get(e.strings); return n === void 0 && m1.set(e.strings, n = new Ad(e)), n; } k(e) { e0(this._$AH) || (this._$AH = [], this._$AR()); const n = this._$AH; let r, i = 0; for (const s of e) i === n.length ? n.push(r = new Dd(this.O(kd()), this.O(kd()), this, this.options)) : r = n[i], r._$AI(s), i++; i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i); } _$AR(e = this._$AA.nextSibling, n) { var r; for ((r = this._$AP) == null ? void 0 : r.call(this, !1, !0, n); e && e !== this._$AB; ) { const i = e.nextSibling; e.remove(), e = i; } } setConnected(e) { var n; this._$AM === void 0 && (this.v = e, (n = this._$AP) == null || n.call(this, e)); } } class Kp { get tagName() { return this.element.tagName; } get _$AU() { return this._$AM._$AU; } constructor(e, n, r, i, s) { this.type = 1, this._$AH = Rn, this._$AN = void 0, this.element = e, this.name = n, this._$AM = i, this.options = s, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = Rn; } _$AI(e, n = this, r, i) { const s = this.strings; let a = !1; if (s === void 0) e = vl(this, e, n, 0), a = !Ed(e) || e !== this._$AH && e !== gl, a && (this._$AH = e); else { const l = e; let f, d; for (e = s[0], f = 0; f < s.length - 1; f++) d = vl(this, l[r + f], n, f), d === gl && (d = this._$AH[f]), a || (a = !Ed(d) || d !== this._$AH[f]), d === Rn ? e = Rn : e !== Rn && (e += (d ?? "") + s[f + 1]), this._$AH[f] = d; } a && !i && this.j(e); } j(e) { e === Rn ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? ""); } } class A6 extends Kp { constructor() { super(...arguments), this.type = 3; } j(e) { this.element[this.name] = e === Rn ? void 0 : e; } } class C6 extends Kp { constructor() { super(...arguments), this.type = 4; } j(e) { this.element.toggleAttribute(this.name, !!e && e !== Rn); } } class x6 extends Kp { constructor(e, n, r, i, s) { super(e, n, r, i, s), this.type = 5; } _$AI(e, n = this) { if ((e = vl(this, e, n, 0) ?? Rn) === gl) return; const r = this._$AH, i = e === Rn && r !== Rn || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, s = e !== Rn && (r === Rn || i); i && this.element.removeEventListener(this.name, this, r), s && this.element.addEventListener(this.name, this, e), this._$AH = e; } handleEvent(e) { var n; typeof this._$AH == "function" ? this._$AH.call(((n = this.options) == null ? void 0 : n.host) ?? this.element, e) : this._$AH.handleEvent(e); } } class N6 { 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 Vv = sd.litHtmlPolyfillSupport; Vv == null || Vv(Ad, Dd), (sd.litHtmlVersions ?? (sd.litHtmlVersions = [])).push("3.2.0"); const t0 = (t, e, n) => { const r = (n == null ? void 0 : n.renderBefore) ?? e; let i = r._$litPart$; if (i === void 0) { const s = (n == null ? void 0 : n.renderBefore) ?? null; r._$litPart$ = i = new Dd(e.insertBefore(kd(), s), s, void 0, n ?? {}); } return i._$AI(t), i; }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class od extends Zu { constructor() { super(...arguments), this.renderOptions = { host: this }, this.o = void 0; } createRenderRoot() { var n; const e = super.createRenderRoot(); return (n = this.renderOptions).renderBefore ?? (n.renderBefore = e.firstChild), e; } update(e) { const n = this.render(); this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this.o = t0(n, this.renderRoot, this.renderOptions); } connectedCallback() { var e; super.connectedCallback(), (e = this.o) == null || e.setConnected(!0); } disconnectedCallback() { var e; super.disconnectedCallback(), (e = this.o) == null || e.setConnected(!1); } render() { return gl; } } var D1; od._$litElement$ = !0, od.finalized = !0, (D1 = globalThis.litElementHydrateSupport) == null || D1.call(globalThis, { LitElement: od }); const zv = globalThis.litElementPolyfillSupport; zv == null || zv({ LitElement: od }); (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.0"); /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const T6 = (t) => t.strings === void 0; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const I6 = { CHILD: 2 }, R6 = (t) => (...e) => ({ _$litDirective$: t, values: e }); class O6 { 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 ad = (t, e) => { var r; const n = t._$AN; if (n === void 0) return !1; for (const i of n) (r = i._$AO) == null || r.call(i, e, !1), ad(i, e); return !0; }, lp = (t) => { let e, n; do { if ((e = t._$AM) === void 0) break; n = e._$AN, n.delete(t), t = e; } while ((n == null ? void 0 : n.size) === 0); }, zN = (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), F6(e); } }; function P6(t) { this._$AN !== void 0 ? (lp(this), this._$AM = t, zN(this)) : this._$AM = t; } function D6(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 s = n; s < r.length; s++) ad(r[s], !1), lp(r[s]); else r != null && (ad(r, !1), lp(r)); else ad(this, t); } const F6 = (t) => { t.type == I6.CHILD && (t._$AP ?? (t._$AP = D6), t._$AQ ?? (t._$AQ = P6)); }; class L6 extends O6 { constructor() { super(...arguments), this._$AN = void 0; } _$AT(e, n, r) { super._$AT(e, n, r), zN(this), this.isConnected = e._$AU; } _$AO(e, n = !0) { var r, i; e !== this.isConnected && (this.isConnected = e, e ? (r = this.reconnected) == null || r.call(this) : (i = this.disconnected) == null || i.call(this)), n && (ad(this, e), lp(this)); } setValue(e) { if (T6(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 U6 = () => new M6(); class M6 { } const qv = /* @__PURE__ */ new WeakMap(), B6 = R6(class extends L6 { render(t) { return Rn; } update(t, [e]) { var r; 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 = (r = t.options) == null ? void 0 : r.host, this.rt(this.ct = t.element)), Rn; } rt(t) { if (this.isConnected || (t = void 0), typeof this.Y == "function") { const e = this.ht ?? globalThis; let n = qv.get(e); n === void 0 && (n = /* @__PURE__ */ new WeakMap(), qv.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() { var t, e; return typeof this.Y == "function" ? (t = qv.get(this.ht ?? globalThis)) == null ? void 0 : t.get(this.Y) : (e = this.Y) == null ? void 0 : e.value; } disconnected() { this.lt === this.ct && this.rt(void 0); } reconnected() { this.rt(this.ct); } }); var hh = {}, Hv = { exports: {} }, kr = {}, Kv = { exports: {} }, Gv = {}; /** * @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 g1; function j6() { return g1 || (g1 = 1, function(t) { function e(de, Ae) { var B = de.length; de.push(Ae); e: for (; 0 < B; ) { var M = B - 1 >>> 1, te = de[M]; if (0 < i(te, Ae)) de[M] = Ae, de[B] = te, B = M; else break e; } } function n(de) { return de.length === 0 ? null : de[0]; } function r(de) { if (de.length === 0) return null; var Ae = de[0], B = de.pop(); if (B !== Ae) { de[0] = B; e: for (var M = 0, te = de.length, Ie = te >>> 1; M < Ie; ) { var $ = 2 * (M + 1) - 1, Q = de[$], Qe = $ + 1, Re = de[Qe]; if (0 > i(Q, B)) Qe < te && 0 > i(Re, Q) ? (de[M] = Re, de[Qe] = B, M = Qe) : (de[M] = Q, de[$] = B, M = $); else if (Qe < te && 0 > i(Re, B)) de[M] = Re, de[Qe] = B, M = Qe; else break e; } } return Ae; } function i(de, Ae) { var B = de.sortIndex - Ae.sortIndex; return B !== 0 ? B : de.id - Ae.id; } if (typeof performance == "object" && typeof performance.now == "function") { var s = performance; t.unstable_now = function() { return s.now(); }; } else { var a = Date, l = a.now(); t.unstable_now = function() { return a.now() - l; }; } var f = [], d = [], p = 1, v = null, y = 3, k = !1, E = !1, A = !1, T = typeof setTimeout == "function" ? setTimeout : null, O = 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 U(de) { for (var Ae = n(d); Ae !== null; ) { if (Ae.callback === null) r(d); else if (Ae.startTime <= de) r(d), Ae.sortIndex = Ae.expirationTime, e(f, Ae); else break; Ae = n(d); } } function j(de) { if (A = !1, U(de), !E) if (n(f) !== null) E = !0, ke(K); else { var Ae = n(d); Ae !== null && pe(j, Ae.startTime - de); } } function K(de, Ae) { E = !1, A && (A = !1, O(H), H = -1), k = !0; var B = y; try { for (U(Ae), v = n(f); v !== null && (!(v.expirationTime > Ae) || de && !_e()); ) { var M = v.callback; if (typeof M == "function") { v.callback = null, y = v.priorityLevel; var te = M(v.expirationTime <= Ae); Ae = t.unstable_now(), typeof te == "function" ? v.callback = te : v === n(f) && r(f), U(Ae); } else r(f); v = n(f); } if (v !== null) var Ie = !0; else { var $ = n(d); $ !== null && pe(j, $.startTime - Ae), Ie = !1; } return Ie; } finally { v = null, y = B, k = !1; } } var ie = !1, ce = null, H = -1, ye = 5, Z = -1; function _e() { return !(t.unstable_now() - Z < ye); } function qe() { if (ce !== null) { var de = t.unstable_now(); Z = de; var Ae = !0; try { Ae = ce(!0, de); } finally { Ae ? st() : (ie = !1, ce = null); } } else ie = !1; } var st; if (typeof R == "function") st = function() { R(qe); }; else if (typeof MessageChannel < "u") { var ft = new MessageChannel(), ue = ft.port2; ft.port1.onmessage = qe, st = function() { ue.postMessage(null); }; } else st = function() { T(qe, 0); }; function ke(de) { ce = de, ie || (ie = !0, st()); } function pe(de, Ae) { H = T(function() { de(t.unstable_now()); }, Ae); } 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(de) { de.callback = null; }, t.unstable_continueExecution = function() { E || k || (E = !0, ke(K)); }, t.unstable_forceFrameRate = function(de) { 0 > de || 125 < de ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : ye = 0 < de ? Math.floor(1e3 / de) : 5; }, t.unstable_getCurrentPriorityLevel = function() { return y; }, t.unstable_getFirstCallbackNode = function() { return n(f); }, t.unstable_next = function(de) { switch (y) { case 1: case 2: case 3: var Ae = 3; break; default: Ae = y; } var B = y; y = Ae; try { return de(); } finally { y = B; } }, t.unstable_pauseExecution = function() { }, t.unstable_requestPaint = function() { }, t.unstable_runWithPriority = function(de, Ae) { switch (de) { case 1: case 2: case 3: case 4: case 5: break; default: de = 3; } var B = y; y = de; try { return Ae(); } finally { y = B; } }, t.unstable_scheduleCallback = function(de, Ae, 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, de) { 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, de = { id: p++, callback: Ae, priorityLevel: de, startTime: B, expirationTime: te, sortIndex: -1 }, B > M ? (de.sortIndex = B, e(d, de), n(f) === null && de === n(d) && (A ? (O(H), H = -1) : A = !0, pe(j, B - M))) : (de.sortIndex = te, e(f, de), E || k || (E = !0, ke(K))), de; }, t.unstable_shouldYield = _e, t.unstable_wrapCallback = function(de) { var Ae = y; return function() { var B = y; y = Ae; try { return de.apply(this, arguments); } finally { y = B; } }; }; }(Gv)), Gv; } var v1; function $6() { return v1 || (v1 = 1, Kv.exports = j6()), Kv.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 y1; function V6() { if (y1) return kr; y1 = 1; var t = uw(), e = $6(); function n(o) { for (var u = "https://reactjs.org/docs/error-decoder.html?invariant=" + o, c = 1; c < arguments.length; c++) u += "&args[]=" + encodeURIComponent(arguments[c]); return "Minified React error #" + o + "; visit " + u + " 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 s(o, u) { a(o, u), a(o + "Capture", u); } function a(o, u) { for (i[o] = u, o = 0; o < u.length; o++) r.add(u[o]); } 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(o) { return f.call(v, o) ? !0 : f.call(p, o) ? !1 : d.test(o) ? v[o] = !0 : (p[o] = !0, !1); } function k(o, u, c, m) { if (c !== null && c.type === 0) return !1; switch (typeof u) { case "function": case "symbol": return !0; case "boolean": return m ? !1 : c !== null ? !c.acceptsBooleans : (o = o.toLowerCase().slice(0, 5), o !== "data-" && o !== "aria-"); default: return !1; } } function E(o, u, c, m) { if (u === null || typeof u > "u" || k(o, u, c, m)) return !0; if (m) return !1; if (c !== null) switch (c.type) { case 3: return !u; case 4: return u === !1; case 5: return isNaN(u); case 6: return isNaN(u) || 1 > u; } return !1; } function A(o, u, c, m, w, S, I) { this.acceptsBooleans = u === 2 || u === 3 || u === 4, this.attributeName = m, this.attributeNamespace = w, this.mustUseProperty = c, this.propertyName = o, this.type = u, this.sanitizeURL = S, this.removeEmptyString = I; } var T = {}; "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o) { T[o] = new A(o, 0, !1, o, null, !1, !1); }), [["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(o) { var u = o[0]; T[u] = new A(u, 1, !1, o[1], null, !1, !1); }), ["contentEditable", "draggable", "spellCheck", "value"].forEach(function(o) { T[o] = new A(o, 2, !1, o.toLowerCase(), null, !1, !1); }), ["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(o) { T[o] = new A(o, 2, !1, o, 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(o) { T[o] = new A(o, 3, !1, o.toLowerCase(), null, !1, !1); }), ["checked", "multiple", "muted", "selected"].forEach(function(o) { T[o] = new A(o, 3, !0, o, null, !1, !1); }), ["capture", "download"].forEach(function(o) { T[o] = new A(o, 4, !1, o, null, !1, !1); }), ["cols", "rows", "size", "span"].forEach(function(o) { T[o] = new A(o, 6, !1, o, null, !1, !1); }), ["rowSpan", "start"].forEach(function(o) { T[o] = new A(o, 5, !1, o.toLowerCase(), null, !1, !1); }); var O = /[\-:]([a-z])/g; function R(o) { return o[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(o) { var u = o.replace( O, R ); T[u] = new A(u, 1, !1, o, null, !1, !1); }), "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o) { var u = o.replace(O, R); T[u] = new A(u, 1, !1, o, "http://www.w3.org/1999/xlink", !1, !1); }), ["xml:base", "xml:lang", "xml:space"].forEach(function(o) { var u = o.replace(O, R); T[u] = new A(u, 1, !1, o, "http://www.w3.org/XML/1998/namespace", !1, !1); }), ["tabIndex", "crossOrigin"].forEach(function(o) { T[o] = new A(o, 1, !1, o.toLowerCase(), null, !1, !1); }), T.xlinkHref = new A("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1), ["src", "href", "action", "formAction"].forEach(function(o) { T[o] = new A(o, 1, !1, o.toLowerCase(), null, !0, !0); }); function U(o, u, c, m) { var w = T.hasOwnProperty(u) ? T[u] : null; (w !== null ? w.type !== 0 : m || !(2 < u.length) || u[0] !== "o" && u[0] !== "O" || u[1] !== "n" && u[1] !== "N") && (E(u, c, w, m) && (c = null), m || w === null ? y(u) && (c === null ? o.removeAttribute(u) : o.setAttribute(u, "" + c)) : w.mustUseProperty ? o[w.propertyName] = c === null ? w.type === 3 ? !1 : "" : c : (u = w.attributeName, m = w.attributeNamespace, c === null ? o.removeAttribute(u) : (w = w.type, c = w === 3 || w === 4 && c === !0 ? "" : "" + c, m ? o.setAttributeNS(m, u, c) : o.setAttribute(u, c)))); } var j = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, K = Symbol.for("react.element"), ie = Symbol.for("react.portal"), ce = Symbol.for("react.fragment"), H = Symbol.for("react.strict_mode"), ye = Symbol.for("react.profiler"), Z = Symbol.for("react.provider"), _e = Symbol.for("react.context"), qe = Symbol.for("react.forward_ref"), st = Symbol.for("react.suspense"), ft = Symbol.for("react.suspense_list"), ue = Symbol.for("react.memo"), ke = Symbol.for("react.lazy"), pe = Symbol.for("react.offscreen"), de = Symbol.iterator; function Ae(o) { return o === null || typeof o != "object" ? null : (o = de && o[de] || o["@@iterator"], typeof o == "function" ? o : null); } var B = Object.assign, M; function te(o) { if (M === void 0) try { throw Error(); } catch (c) { var u = c.stack.trim().match(/\n( *(at )?)/); M = u && u[1] || ""; } return ` ` + M + o; } var Ie = !1; function $(o, u) { if (!o || Ie) return ""; Ie = !0; var c = Error.prepareStackTrace; Error.prepareStackTrace = void 0; try { if (u) if (u = function() { throw Error(); }, Object.defineProperty(u.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(u, []); } catch (me) { var m = me; } Reflect.construct(o, [], u); } else { try { u.call(); } catch (me) { m = me; } o.call(u.prototype); } else { try { throw Error(); } catch (me) { m = me; } o(); } } catch (me) { if (me && m && typeof me.stack == "string") { for (var w = me.stack.split(` `), S = m.stack.split(` `), I = w.length - 1, V = S.length - 1; 1 <= I && 0 <= V && w[I] !== S[V]; ) V--; for (; 1 <= I && 0 <= V; I--, V--) if (w[I] !== S[V]) { if (I !== 1 || V !== 1) do if (I--, V--, 0 > V || w[I] !== S[V]) { var G = ` ` + w[I].replace(" at new ", " at "); return o.displayName && G.includes("") && (G = G.replace("", o.displayName)), G; } while (1 <= I && 0 <= V); break; } } } finally { Ie = !1, Error.prepareStackTrace = c; } return (o = o ? o.displayName || o.name : "") ? te(o) : ""; } function Q(o) { switch (o.tag) { case 5: return te(o.type); case 16: return te("Lazy"); case 13: return te("Suspense"); case 19: return te("SuspenseList"); case 0: case 2: case 15: return o = $(o.type, !1), o; case 11: return o = $(o.type.render, !1), o; case 1: return o = $(o.type, !0), o; default: return ""; } } function Qe(o) { if (o == null) return null; if (typeof o == "function") return o.displayName || o.name || null; if (typeof o == "string") return o; switch (o) { case ce: return "Fragment"; case ie: return "Portal"; case ye: return "Profiler"; case H: return "StrictMode"; case st: return "Suspense"; case ft: return "SuspenseList"; } if (typeof o == "object") switch (o.$$typeof) { case _e: return (o.displayName || "Context") + ".Consumer"; case Z: return (o._context.displayName || "Context") + ".Provider"; case qe: var u = o.render; return o = o.displayName, o || (o = u.displayName || u.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o; case ue: return u = o.displayName || null, u !== null ? u : Qe(o.type) || "Memo"; case ke: u = o._payload, o = o._init; try { return Qe(o(u)); } catch { } } return null; } function Re(o) { var u = o.type; switch (o.tag) { case 24: return "Cache"; case 9: return (u.displayName || "Context") + ".Consumer"; case 10: return (u._context.displayName || "Context") + ".Provider"; case 18: return "DehydratedFragment"; case 11: return o = u.render, o = o.displayName || o.name || "", u.displayName || (o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"); case 7: return "Fragment"; case 5: return u; case 4: return "Portal"; case 3: return "Root"; case 6: return "Text"; case 16: return Qe(u); case 8: return u === 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 u == "function") return u.displayName || u.name || null; if (typeof u == "string") return u; } return null; } function We(o) { switch (typeof o) { case "boolean": case "number": case "string": case "undefined": return o; case "object": return o; default: return ""; } } function Oe(o) { var u = o.type; return (o = o.nodeName) && o.toLowerCase() === "input" && (u === "checkbox" || u === "radio"); } function pt(o) { var u = Oe(o) ? "checked" : "value", c = Object.getOwnPropertyDescriptor(o.constructor.prototype, u), m = "" + o[u]; if (!o.hasOwnProperty(u) && typeof c < "u" && typeof c.get == "function" && typeof c.set == "function") { var w = c.get, S = c.set; return Object.defineProperty(o, u, { configurable: !0, get: function() { return w.call(this); }, set: function(I) { m = "" + I, S.call(this, I); } }), Object.defineProperty(o, u, { enumerable: c.enumerable }), { getValue: function() { return m; }, setValue: function(I) { m = "" + I; }, stopTracking: function() { o._valueTracker = null, delete o[u]; } }; } } function ht(o) { o._valueTracker || (o._valueTracker = pt(o)); } function Xe(o) { if (!o) return !1; var u = o._valueTracker; if (!u) return !0; var c = u.getValue(), m = ""; return o && (m = Oe(o) ? o.checked ? "true" : "false" : o.value), o = m, o !== c ? (u.setValue(o), !0) : !1; } function Rt(o) { if (o = o || (typeof document < "u" ? document : void 0), typeof o > "u") return null; try { return o.activeElement || o.body; } catch { return o.body; } } function Ot(o, u) { var c = u.checked; return B({}, u, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: c ?? o._wrapperState.initialChecked }); } function et(o, u) { var c = u.defaultValue == null ? "" : u.defaultValue, m = u.checked != null ? u.checked : u.defaultChecked; c = We(u.value != null ? u.value : c), o._wrapperState = { initialChecked: m, initialValue: c, controlled: u.type === "checkbox" || u.type === "radio" ? u.checked != null : u.value != null }; } function Ft(o, u) { u = u.checked, u != null && U(o, "checked", u, !1); } function Bt(o, u) { Ft(o, u); var c = We(u.value), m = u.type; if (c != null) m === "number" ? (c === 0 && o.value === "" || o.value != c) && (o.value = "" + c) : o.value !== "" + c && (o.value = "" + c); else if (m === "submit" || m === "reset") { o.removeAttribute("value"); return; } u.hasOwnProperty("value") ? x(o, u.type, c) : u.hasOwnProperty("defaultValue") && x(o, u.type, We(u.defaultValue)), u.checked == null && u.defaultChecked != null && (o.defaultChecked = !!u.defaultChecked); } function D(o, u, c) { if (u.hasOwnProperty("value") || u.hasOwnProperty("defaultValue")) { var m = u.type; if (!(m !== "submit" && m !== "reset" || u.value !== void 0 && u.value !== null)) return; u = "" + o._wrapperState.initialValue, c || u === o.value || (o.value = u), o.defaultValue = u; } c = o.name, c !== "" && (o.name = ""), o.defaultChecked = !!o._wrapperState.initialChecked, c !== "" && (o.name = c); } function x(o, u, c) { (u !== "number" || Rt(o.ownerDocument) !== o) && (c == null ? o.defaultValue = "" + o._wrapperState.initialValue : o.defaultValue !== "" + c && (o.defaultValue = "" + c)); } var b = Array.isArray; function F(o, u, c, m) { if (o = o.options, u) { u = {}; for (var w = 0; w < c.length; w++) u["$" + c[w]] = !0; for (c = 0; c < o.length; c++) w = u.hasOwnProperty("$" + o[c].value), o[c].selected !== w && (o[c].selected = w), w && m && (o[c].defaultSelected = !0); } else { for (c = "" + We(c), u = null, w = 0; w < o.length; w++) { if (o[w].value === c) { o[w].selected = !0, m && (o[w].defaultSelected = !0); return; } u !== null || o[w].disabled || (u = o[w]); } u !== null && (u.selected = !0); } } function ee(o, u) { if (u.dangerouslySetInnerHTML != null) throw Error(n(91)); return B({}, u, { value: void 0, defaultValue: void 0, children: "" + o._wrapperState.initialValue }); } function be(o, u) { var c = u.value; if (c == null) { if (c = u.children, u = u.defaultValue, c != null) { if (u != null) throw Error(n(92)); if (b(c)) { if (1 < c.length) throw Error(n(93)); c = c[0]; } u = c; } u == null && (u = ""), c = u; } o._wrapperState = { initialValue: We(c) }; } function Ce(o, u) { var c = We(u.value), m = We(u.defaultValue); c != null && (c = "" + c, c !== o.value && (o.value = c), u.defaultValue == null && o.defaultValue !== c && (o.defaultValue = c)), m != null && (o.defaultValue = "" + m); } function bt(o) { var u = o.textContent; u === o._wrapperState.initialValue && u !== "" && u !== null && (o.value = u); } function Ct(o) { switch (o) { 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 Lt(o, u) { return o == null || o === "http://www.w3.org/1999/xhtml" ? Ct(u) : o === "http://www.w3.org/2000/svg" && u === "foreignObject" ? "http://www.w3.org/1999/xhtml" : o; } var fn, Ht = function(o) { return typeof MSApp < "u" && MSApp.execUnsafeLocalFunction ? function(u, c, m, w) { MSApp.execUnsafeLocalFunction(function() { return o(u, c, m, w); }); } : o; }(function(o, u) { if (o.namespaceURI !== "http://www.w3.org/2000/svg" || "innerHTML" in o) o.innerHTML = u; else { for (fn = fn || document.createElement("div"), fn.innerHTML = "" + u.valueOf().toString() + "", u = fn.firstChild; o.firstChild; ) o.removeChild(o.firstChild); for (; u.firstChild; ) o.appendChild(u.firstChild); } }); function hr(o, u) { if (u) { var c = o.firstChild; if (c && c === o.lastChild && c.nodeType === 3) { c.nodeValue = u; return; } } o.textContent = u; } var Or = { 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 }, Gr = ["Webkit", "ms", "Moz", "O"]; Object.keys(Or).forEach(function(o) { Gr.forEach(function(u) { u = u + o.charAt(0).toUpperCase() + o.substring(1), Or[u] = Or[o]; }); }); function Vo(o, u, c) { return u == null || typeof u == "boolean" || u === "" ? "" : c || typeof u != "number" || u === 0 || Or.hasOwnProperty(o) && Or[o] ? ("" + u).trim() : u + "px"; } function su(o, u) { o = o.style; for (var c in u) if (u.hasOwnProperty(c)) { var m = c.indexOf("--") === 0, w = Vo(c, u[c], m); c === "float" && (c = "cssFloat"), m ? o.setProperty(c, w) : o[c] = w; } } var Li = 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 lt(o, u) { if (u) { if (Li[o] && (u.children != null || u.dangerouslySetInnerHTML != null)) throw Error(n(137, o)); if (u.dangerouslySetInnerHTML != null) { if (u.children != null) throw Error(n(60)); if (typeof u.dangerouslySetInnerHTML != "object" || !("__html" in u.dangerouslySetInnerHTML)) throw Error(n(61)); } if (u.style != null && typeof u.style != "object") throw Error(n(62)); } } function ss(o, u) { if (o.indexOf("-") === -1) return typeof u.is == "string"; switch (o) { 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 $s(o) { return o = o.target || o.srcElement || window, o.correspondingUseElement && (o = o.correspondingUseElement), o.nodeType === 3 ? o.parentNode : o; } var Ze = null, Ui = null, os = null; function ou(o) { if (o = rc(o)) { if (typeof Ze != "function") throw Error(n(280)); var u = o.stateNode; u && (u = uf(u), Ze(o.stateNode, o.type, u)); } } function Ll(o) { Ui ? os ? os.push(o) : os = [o] : Ui = o; } function au() { if (Ui) { var o = Ui, u = os; if (os = Ui = null, ou(o), u) for (o = 0; o < u.length; o++) ou(u[o]); } } function Fd(o, u) { return o(u); } function Ld() { } var Mi = !1; function as(o, u, c) { if (Mi) return o(u, c); Mi = !0; try { return Fd(o, u, c); } finally { Mi = !1, (Ui !== null || os !== null) && (Ld(), au()); } } function us(o, u) { var c = o.stateNode; if (c === null) return null; var m = uf(c); if (m === null) return null; c = m[u]; e: switch (u) { 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) || (o = o.type, m = !(o === "button" || o === "input" || o === "select" || o === "textarea")), o = !m; break e; default: o = !1; } if (o) return null; if (c && typeof c != "function") throw Error(n(231, u, typeof c)); return c; } var Vs = !1; if (l) try { var Yt = {}; Object.defineProperty(Yt, "passive", { get: function() { Vs = !0; } }), window.addEventListener("test", Yt, Yt), window.removeEventListener("test", Yt, Yt); } catch { Vs = !1; } function xn(o, u, c, m, w, S, I, V, G) { var me = Array.prototype.slice.call(arguments, 3); try { u.apply(c, me); } catch (Me) { this.onError(Me); } } var zo = !1, ls = null, cs = !1, zs = null, Qp = { onError: function(o) { zo = !0, ls = o; } }; function Bi(o, u, c, m, w, S, I, V, G) { zo = !1, ls = null, xn.apply(Qp, arguments); } function qs(o, u, c, m, w, S, I, V, G) { if (Bi.apply(this, arguments), zo) { if (zo) { var me = ls; zo = !1, ls = null; } else throw Error(n(198)); cs || (cs = !0, zs = me); } } function Wn(o) { var u = o, c = o; if (o.alternate) for (; u.return; ) u = u.return; else { o = u; do u = o, u.flags & 4098 && (c = u.return), o = u.return; while (o); } return u.tag === 3 ? c : null; } function qo(o) { if (o.tag === 13) { var u = o.memoizedState; if (u === null && (o = o.alternate, o !== null && (u = o.memoizedState)), u !== null) return u.dehydrated; } return null; } function Ud(o) { if (Wn(o) !== o) throw Error(n(188)); } function ji(o) { var u = o.alternate; if (!u) { if (u = Wn(o), u === null) throw Error(n(188)); return u !== o ? null : o; } for (var c = o, m = u; ; ) { var w = c.return; if (w === null) break; var S = w.alternate; if (S === null) { if (m = w.return, m !== null) { c = m; continue; } break; } if (w.child === S.child) { for (S = w.child; S; ) { if (S === c) return Ud(w), o; if (S === m) return Ud(w), u; S = S.sibling; } throw Error(n(188)); } if (c.return !== m.return) c = w, m = S; else { for (var I = !1, V = w.child; V; ) { if (V === c) { I = !0, c = w, m = S; break; } if (V === m) { I = !0, m = w, c = S; break; } V = V.sibling; } if (!I) { for (V = S.child; V; ) { if (V === c) { I = !0, c = S, m = w; break; } if (V === m) { I = !0, m = S, 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 ? o : u; } function Ul(o) { return o = ji(o), o !== null ? $i(o) : null; } function $i(o) { if (o.tag === 5 || o.tag === 6) return o; for (o = o.child; o !== null; ) { var u = $i(o); if (u !== null) return u; o = o.sibling; } return null; } var Ml = e.unstable_scheduleCallback, uu = e.unstable_cancelCallback, yn = e.unstable_shouldYield, ds = e.unstable_requestPaint, Kt = e.unstable_now, Md = e.unstable_getCurrentPriorityLevel, Vi = e.unstable_ImmediatePriority, Ho = e.unstable_UserBlockingPriority, Hs = e.unstable_NormalPriority, Bl = e.unstable_LowPriority, zi = e.unstable_IdlePriority, Ko = null, ar = null; function Bd(o) { if (ar && typeof ar.onCommitFiberRoot == "function") try { ar.onCommitFiberRoot(Ko, o, void 0, (o.current.flags & 128) === 128); } catch { } } var _t = Math.clz32 ? Math.clz32 : Vd, jd = Math.log, $d = Math.LN2; function Vd(o) { return o >>>= 0, o === 0 ? 32 : 31 - (jd(o) / $d | 0) | 0; } var Qt = 64, qi = 4194304; function ci(o) { switch (o & -o) { 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 o & 4194240; case 4194304: case 8388608: case 16777216: case 33554432: case 67108864: return o & 130023424; case 134217728: return 134217728; case 268435456: return 268435456; case 536870912: return 536870912; case 1073741824: return 1073741824; default: return o; } } function di(o, u) { var c = o.pendingLanes; if (c === 0) return 0; var m = 0, w = o.suspendedLanes, S = o.pingedLanes, I = c & 268435455; if (I !== 0) { var V = I & ~w; V !== 0 ? m = ci(V) : (S &= I, S !== 0 && (m = ci(S))); } else I = c & ~w, I !== 0 ? m = ci(I) : S !== 0 && (m = ci(S)); if (m === 0) return 0; if (u !== 0 && u !== m && !(u & w) && (w = m & -m, S = u & -u, w >= S || w === 16 && (S & 4194240) !== 0)) return u; if (m & 4 && (m |= c & 16), u = o.entangledLanes, u !== 0) for (o = o.entanglements, u &= m; 0 < u; ) c = 31 - _t(u), w = 1 << c, m |= o[c], u &= ~w; return m; } function jl(o, u) { switch (o) { case 1: case 2: case 4: return u + 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 u + 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 $l(o, u) { for (var c = o.suspendedLanes, m = o.pingedLanes, w = o.expirationTimes, S = o.pendingLanes; 0 < S; ) { var I = 31 - _t(S), V = 1 << I, G = w[I]; G === -1 ? (!(V & c) || V & m) && (w[I] = jl(V, u)) : G <= u && (o.expiredLanes |= V), S &= ~V; } } function Ks(o) { return o = o.pendingLanes & -1073741825, o !== 0 ? o : o & 1073741824 ? 1073741824 : 0; } function Vl() { var o = Qt; return Qt <<= 1, !(Qt & 4194240) && (Qt = 64), o; } function Gs(o) { for (var u = [], c = 0; 31 > c; c++) u.push(o); return u; } function Ws(o, u, c) { o.pendingLanes |= u, u !== 536870912 && (o.suspendedLanes = 0, o.pingedLanes = 0), o = o.eventTimes, u = 31 - _t(u), o[u] = c; } function Go(o, u) { var c = o.pendingLanes & ~u; o.pendingLanes = u, o.suspendedLanes = 0, o.pingedLanes = 0, o.expiredLanes &= u, o.mutableReadLanes &= u, o.entangledLanes &= u, u = o.entanglements; var m = o.eventTimes; for (o = o.expirationTimes; 0 < c; ) { var w = 31 - _t(c), S = 1 << w; u[w] = 0, m[w] = -1, o[w] = -1, c &= ~S; } } function lu(o, u) { var c = o.entangledLanes |= u; for (o = o.entanglements; c; ) { var m = 31 - _t(c), w = 1 << m; w & u | o[m] & u && (o[m] |= u), c &= ~w; } } var Gt = 0; function Mt(o) { return o &= -o, 1 < o ? 4 < o ? o & 268435455 ? 16 : 536870912 : 4 : 1; } var cu, zl, zd, Yn, fs, Ys = !1, Pr = [], fi = null, hi = null, rn = null, Qn = /* @__PURE__ */ new Map(), pi = /* @__PURE__ */ new Map(), pr = [], ql = "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(o, u) { switch (o) { case "focusin": case "focusout": fi = null; break; case "dragenter": case "dragleave": hi = null; break; case "mouseover": case "mouseout": rn = null; break; case "pointerover": case "pointerout": Qn.delete(u.pointerId); break; case "gotpointercapture": case "lostpointercapture": pi.delete(u.pointerId); } } function Wo(o, u, c, m, w, S) { return o === null || o.nativeEvent !== S ? (o = { blockedOn: u, domEventName: c, eventSystemFlags: m, nativeEvent: S, targetContainers: [w] }, u !== null && (u = rc(u), u !== null && zl(u)), o) : (o.eventSystemFlags |= m, u = o.targetContainers, w !== null && u.indexOf(w) === -1 && u.push(w), o); } function Wr(o, u, c, m, w) { switch (u) { case "focusin": return fi = Wo(fi, o, u, c, m, w), !0; case "dragenter": return hi = Wo(hi, o, u, c, m, w), !0; case "mouseover": return rn = Wo(rn, o, u, c, m, w), !0; case "pointerover": var S = w.pointerId; return Qn.set(S, Wo(Qn.get(S) || null, o, u, c, m, w)), !0; case "gotpointercapture": return S = w.pointerId, pi.set(S, Wo(pi.get(S) || null, o, u, c, m, w)), !0; } return !1; } function du(o) { var u = ua(o.target); if (u !== null) { var c = Wn(u); if (c !== null) { if (u = c.tag, u === 13) { if (u = qo(c), u !== null) { o.blockedOn = u, fs(o.priority, function() { zd(c); }); return; } } else if (u === 3 && c.stateNode.current.memoizedState.isDehydrated) { o.blockedOn = c.tag === 3 ? c.stateNode.containerInfo : null; return; } } } o.blockedOn = null; } function Yo(o) { if (o.blockedOn !== null) return !1; for (var u = o.targetContainers; 0 < u.length; ) { var c = Jo(o.domEventName, o.eventSystemFlags, u[0], o.nativeEvent); if (c === null) { c = o.nativeEvent; var m = new c.constructor(c.type, c); li = m, c.target.dispatchEvent(m), li = null; } else return u = rc(c), u !== null && zl(u), o.blockedOn = c, !1; u.shift(); } return !0; } function fu(o, u, c) { Yo(o) && c.delete(u); } function Qo() { Ys = !1, fi !== null && Yo(fi) && (fi = null), hi !== null && Yo(hi) && (hi = null), rn !== null && Yo(rn) && (rn = null), Qn.forEach(fu), pi.forEach(fu); } function hs(o, u) { o.blockedOn === u && (o.blockedOn = null, Ys || (Ys = !0, e.unstable_scheduleCallback(e.unstable_NormalPriority, Qo))); } function Qs(o) { function u(w) { return hs(w, o); } if (0 < Pr.length) { hs(Pr[0], o); for (var c = 1; c < Pr.length; c++) { var m = Pr[c]; m.blockedOn === o && (m.blockedOn = null); } } for (fi !== null && hs(fi, o), hi !== null && hs(hi, o), rn !== null && hs(rn, o), Qn.forEach(u), pi.forEach(u), c = 0; c < pr.length; c++) m = pr[c], m.blockedOn === o && (m.blockedOn = null); for (; 0 < pr.length && (c = pr[0], c.blockedOn === null); ) du(c), c.blockedOn === null && pr.shift(); } var Js = j.ReactCurrentBatchConfig, Hi = !0; function Jp(o, u, c, m) { var w = Gt, S = Js.transition; Js.transition = null; try { Gt = 1, Xs(o, u, c, m); } finally { Gt = w, Js.transition = S; } } function Xp(o, u, c, m) { var w = Gt, S = Js.transition; Js.transition = null; try { Gt = 4, Xs(o, u, c, m); } finally { Gt = w, Js.transition = S; } } function Xs(o, u, c, m) { if (Hi) { var w = Jo(o, u, c, m); if (w === null) om(o, u, m, ps, c), mi(o, m); else if (Wr(w, o, u, c, m)) m.stopPropagation(); else if (mi(o, m), u & 4 && -1 < ql.indexOf(o)) { for (; w !== null; ) { var S = rc(w); if (S !== null && cu(S), S = Jo(o, u, c, m), S === null && om(o, u, m, ps, c), S === w) break; w = S; } w !== null && m.stopPropagation(); } else om(o, u, m, null, c); } } var ps = null; function Jo(o, u, c, m) { if (ps = null, o = $s(m), o = ua(o), o !== null) if (u = Wn(o), u === null) o = null; else if (c = u.tag, c === 13) { if (o = qo(u), o !== null) return o; o = null; } else if (c === 3) { if (u.stateNode.current.memoizedState.isDehydrated) return u.tag === 3 ? u.stateNode.containerInfo : null; o = null; } else u !== o && (o = null); return ps = o, null; } function qd(o) { switch (o) { 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 (Md()) { case Vi: return 1; case Ho: return 4; case Hs: case Bl: return 16; case zi: return 536870912; default: return 16; } default: return 16; } } var Ki = null, Hl = null, Zs = null; function hu() { if (Zs) return Zs; var o, u = Hl, c = u.length, m, w = "value" in Ki ? Ki.value : Ki.textContent, S = w.length; for (o = 0; o < c && u[o] === w[o]; o++) ; var I = c - o; for (m = 1; m <= I && u[c - m] === w[S - m]; m++) ; return Zs = w.slice(o, 1 < m ? 1 - m : void 0); } function Xo(o) { var u = o.keyCode; return "charCode" in o ? (o = o.charCode, o === 0 && u === 13 && (o = 13)) : o = u, o === 10 && (o = 13), 32 <= o || o === 13 ? o : 0; } function ms() { return !0; } function Zo() { return !1; } function Ln(o) { function u(c, m, w, S, I) { this._reactName = c, this._targetInst = w, this.type = m, this.nativeEvent = S, this.target = I, this.currentTarget = null; for (var V in o) o.hasOwnProperty(V) && (c = o[V], this[V] = c ? c(S) : S[V]); return this.isDefaultPrevented = (S.defaultPrevented != null ? S.defaultPrevented : S.returnValue === !1) ? ms : Zo, this.isPropagationStopped = Zo, this; } return B(u.prototype, { preventDefault: function() { this.defaultPrevented = !0; var c = this.nativeEvent; c && (c.preventDefault ? c.preventDefault() : typeof c.returnValue != "unknown" && (c.returnValue = !1), this.isDefaultPrevented = ms); }, stopPropagation: function() { var c = this.nativeEvent; c && (c.stopPropagation ? c.stopPropagation() : typeof c.cancelBubble != "unknown" && (c.cancelBubble = !0), this.isPropagationStopped = ms); }, persist: function() { }, isPersistent: ms }), u; } var gs = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function(o) { return o.timeStamp || Date.now(); }, defaultPrevented: 0, isTrusted: 0 }, Kl = Ln(gs), Gi = B({}, gs, { view: 0, detail: 0 }), Gl = Ln(Gi), ea, ta, vs, kn = B({}, Gi, { 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(o) { return o.relatedTarget === void 0 ? o.fromElement === o.srcElement ? o.toElement : o.fromElement : o.relatedTarget; }, movementX: function(o) { return "movementX" in o ? o.movementX : (o !== vs && (vs && o.type === "mousemove" ? (ea = o.screenX - vs.screenX, ta = o.screenY - vs.screenY) : ta = ea = 0, vs = o), ea); }, movementY: function(o) { return "movementY" in o ? o.movementY : ta; } }), eo = Ln(kn), na = B({}, kn, { dataTransfer: 0 }), Hd = Ln(na), pu = B({}, Gi, { relatedTarget: 0 }), mu = Ln(pu), Kd = B({}, gs, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }), gu = Ln(Kd), Wl = B({}, gs, { clipboardData: function(o) { return "clipboardData" in o ? o.clipboardData : window.clipboardData; } }), ys = Ln(Wl), Yl = B({}, gs, { data: 0 }), vu = Ln(Yl), yu = { Esc: "Escape", Spacebar: " ", Left: "ArrowLeft", Up: "ArrowUp", Right: "ArrowRight", Down: "ArrowDown", Del: "Delete", Win: "OS", Menu: "ContextMenu", Apps: "ContextMenu", Scroll: "ScrollLock", MozPrintableKey: "Unidentified" }, Ql = { 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" }, Gd = { Alt: "altKey", Control: "ctrlKey", Meta: "metaKey", Shift: "shiftKey" }; function Zp(o) { var u = this.nativeEvent; return u.getModifierState ? u.getModifierState(o) : (o = Gd[o]) ? !!u[o] : !1; } function ra() { return Zp; } var wu = B({}, Gi, { key: function(o) { if (o.key) { var u = yu[o.key] || o.key; if (u !== "Unidentified") return u; } return o.type === "keypress" ? (o = Xo(o), o === 13 ? "Enter" : String.fromCharCode(o)) : o.type === "keydown" || o.type === "keyup" ? Ql[o.keyCode] || "Unidentified" : ""; }, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: ra, charCode: function(o) { return o.type === "keypress" ? Xo(o) : 0; }, keyCode: function(o) { return o.type === "keydown" || o.type === "keyup" ? o.keyCode : 0; }, which: function(o) { return o.type === "keypress" ? Xo(o) : o.type === "keydown" || o.type === "keyup" ? o.keyCode : 0; } }), em = Ln(wu), Jl = B({}, kn, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }), _u = Ln(Jl), tm = B({}, Gi, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: ra }), Wd = Ln(tm), nm = B({}, gs, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }), Yd = Ln(nm), Qd = B({}, kn, { deltaX: function(o) { return "deltaX" in o ? o.deltaX : "wheelDeltaX" in o ? -o.wheelDeltaX : 0; }, deltaY: function(o) { return "deltaY" in o ? o.deltaY : "wheelDeltaY" in o ? -o.wheelDeltaY : "wheelDelta" in o ? -o.wheelDelta : 0; }, deltaZ: 0, deltaMode: 0 }), rm = Ln(Qd), Jd = [9, 13, 27, 32], ia = l && "CompositionEvent" in window, to = null; l && "documentMode" in document && (to = document.documentMode); var Xd = l && "TextEvent" in window && !to, Zd = l && (!ia || to && 8 < to && 11 >= to), ef = " ", tf = !1; function sa(o, u) { switch (o) { case "keyup": return Jd.indexOf(u.keyCode) !== -1; case "keydown": return u.keyCode !== 229; case "keypress": case "mousedown": case "focusout": return !0; default: return !1; } } function Yr(o) { return o = o.detail, typeof o == "object" && "data" in o ? o.data : null; } var Xt = !1; function Su(o, u) { switch (o) { case "compositionend": return Yr(u); case "keypress": return u.which !== 32 ? null : (tf = !0, ef); case "textInput": return o = u.data, o === ef && tf ? null : o; default: return null; } } function mr(o, u) { if (Xt) return o === "compositionend" || !ia && sa(o, u) ? (o = hu(), Zs = Hl = Ki = null, Xt = !1, o) : null; switch (o) { case "paste": return null; case "keypress": if (!(u.ctrlKey || u.altKey || u.metaKey) || u.ctrlKey && u.altKey) { if (u.char && 1 < u.char.length) return u.char; if (u.which) return String.fromCharCode(u.which); } return null; case "compositionend": return Zd && u.locale !== "ko" ? null : u.data; default: return null; } } var im = { 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(o) { var u = o && o.nodeName && o.nodeName.toLowerCase(); return u === "input" ? !!im[o.type] : u === "textarea"; } function Xl(o, u, c, m) { Ll(m), u = sf(u, "onChange"), 0 < u.length && (c = new Kl("onChange", "change", null, c, m), o.push({ event: c, listeners: u })); } var Dr = null, ws = null; function no(o) { f0(o, 0); } function Fr(o) { var u = Au(o); if (Xe(u)) return o; } function nf(o, u) { if (o === "change") return u; } var h = !1; if (l) { var g; if (l) { var _ = "oninput" in document; if (!_) { var C = document.createElement("div"); C.setAttribute("oninput", "return;"), _ = typeof C.oninput == "function"; } g = _; } else g = !1; h = g && (!document.documentMode || 9 < document.documentMode); } function N() { Dr && (Dr.detachEvent("onpropertychange", P), ws = Dr = null); } function P(o) { if (o.propertyName === "value" && Fr(ws)) { var u = []; Xl(u, ws, o, $s(o)), as(no, u); } } function L(o, u, c) { o === "focusin" ? (N(), Dr = u, ws = c, Dr.attachEvent("onpropertychange", P)) : o === "focusout" && N(); } function z(o) { if (o === "selectionchange" || o === "keyup" || o === "keydown") return Fr(ws); } function W(o, u) { if (o === "click") return Fr(u); } function J(o, u) { if (o === "input" || o === "change") return Fr(u); } function se(o, u) { return o === u && (o !== 0 || 1 / o === 1 / u) || o !== o && u !== u; } var q = typeof Object.is == "function" ? Object.is : se; function oe(o, u) { if (q(o, u)) return !0; if (typeof o != "object" || o === null || typeof u != "object" || u === null) return !1; var c = Object.keys(o), m = Object.keys(u); if (c.length !== m.length) return !1; for (m = 0; m < c.length; m++) { var w = c[m]; if (!f.call(u, w) || !q(o[w], u[w])) return !1; } return !0; } function Y(o) { for (; o && o.firstChild; ) o = o.firstChild; return o; } function re(o, u) { var c = Y(o); o = 0; for (var m; c; ) { if (c.nodeType === 3) { if (m = o + c.textContent.length, o <= u && m >= u) return { node: c, offset: u - o }; o = m; } e: { for (; c; ) { if (c.nextSibling) { c = c.nextSibling; break e; } c = c.parentNode; } c = void 0; } c = Y(c); } } function ae(o, u) { return o && u ? o === u ? !0 : o && o.nodeType === 3 ? !1 : u && u.nodeType === 3 ? ae(o, u.parentNode) : "contains" in o ? o.contains(u) : o.compareDocumentPosition ? !!(o.compareDocumentPosition(u) & 16) : !1 : !1; } function ne() { for (var o = window, u = Rt(); u instanceof o.HTMLIFrameElement; ) { try { var c = typeof u.contentWindow.location.href == "string"; } catch { c = !1; } if (c) o = u.contentWindow; else break; u = Rt(o.document); } return u; } function fe(o) { var u = o && o.nodeName && o.nodeName.toLowerCase(); return u && (u === "input" && (o.type === "text" || o.type === "search" || o.type === "tel" || o.type === "url" || o.type === "password") || u === "textarea" || o.contentEditable === "true"); } function ge(o) { var u = ne(), c = o.focusedElem, m = o.selectionRange; if (u !== c && c && c.ownerDocument && ae(c.ownerDocument.documentElement, c)) { if (m !== null && fe(c)) { if (u = m.start, o = m.end, o === void 0 && (o = u), "selectionStart" in c) c.selectionStart = u, c.selectionEnd = Math.min(o, c.value.length); else if (o = (u = c.ownerDocument || document) && u.defaultView || window, o.getSelection) { o = o.getSelection(); var w = c.textContent.length, S = Math.min(m.start, w); m = m.end === void 0 ? S : Math.min(m.end, w), !o.extend && S > m && (w = m, m = S, S = w), w = re(c, S); var I = re( c, m ); w && I && (o.rangeCount !== 1 || o.anchorNode !== w.node || o.anchorOffset !== w.offset || o.focusNode !== I.node || o.focusOffset !== I.offset) && (u = u.createRange(), u.setStart(w.node, w.offset), o.removeAllRanges(), S > m ? (o.addRange(u), o.extend(I.node, I.offset)) : (u.setEnd(I.node, I.offset), o.addRange(u))); } } for (u = [], o = c; o = o.parentNode; ) o.nodeType === 1 && u.push({ element: o, left: o.scrollLeft, top: o.scrollTop }); for (typeof c.focus == "function" && c.focus(), c = 0; c < u.length; c++) o = u[c], o.element.scrollLeft = o.left, o.element.scrollTop = o.top; } } var we = l && "documentMode" in document && 11 >= document.documentMode, Ee = null, Ve = null, Ye = null, ze = !1; function He(o, u, c) { var m = c.window === c ? c.document : c.nodeType === 9 ? c : c.ownerDocument; ze || Ee == null || Ee !== Rt(m) || (m = Ee, "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 }), Ye && oe(Ye, m) || (Ye = m, m = sf(Ve, "onSelect"), 0 < m.length && (u = new Kl("onSelect", "select", null, u, c), o.push({ event: u, listeners: m }), u.target = Ee))); } function Je(o, u) { var c = {}; return c[o.toLowerCase()] = u.toLowerCase(), c["Webkit" + o] = "webkit" + u, c["Moz" + o] = "moz" + u, c; } var Ke = { animationend: Je("Animation", "AnimationEnd"), animationiteration: Je("Animation", "AnimationIteration"), animationstart: Je("Animation", "AnimationStart"), transitionend: Je("Transition", "TransitionEnd") }, tt = {}, Et = {}; l && (Et = document.createElement("div").style, "AnimationEvent" in window || (delete Ke.animationend.animation, delete Ke.animationiteration.animation, delete Ke.animationstart.animation), "TransitionEvent" in window || delete Ke.transitionend.transition); function At(o) { if (tt[o]) return tt[o]; if (!Ke[o]) return o; var u = Ke[o], c; for (c in u) if (u.hasOwnProperty(c) && c in Et) return tt[o] = u[c]; return o; } var Tt = At("animationend"), Jn = At("animationiteration"), kt = At("animationstart"), On = At("transitionend"), Pn = /* @__PURE__ */ new Map(), oa = "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 gn(o, u) { Pn.set(o, u), s(u, [o]); } for (var gi = 0; gi < oa.length; gi++) { var aa = oa[gi], hT = aa.toLowerCase(), pT = aa[0].toUpperCase() + aa.slice(1); gn(hT, "on" + pT); } gn(Tt, "onAnimationEnd"), gn(Jn, "onAnimationIteration"), gn(kt, "onAnimationStart"), gn("dblclick", "onDoubleClick"), gn("focusin", "onFocus"), gn("focusout", "onBlur"), gn(On, "onTransitionEnd"), a("onMouseEnter", ["mouseout", "mouseover"]), a("onMouseLeave", ["mouseout", "mouseover"]), a("onPointerEnter", ["pointerout", "pointerover"]), a("onPointerLeave", ["pointerout", "pointerover"]), s("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" ")), s("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")), s("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]), s("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" ")), s("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" ")), s("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" ")); var Zl = "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(" "), mT = new Set("cancel close invalid load scroll toggle".split(" ").concat(Zl)); function d0(o, u, c) { var m = o.type || "unknown-event"; o.currentTarget = c, qs(m, u, void 0, o), o.currentTarget = null; } function f0(o, u) { u = (u & 4) !== 0; for (var c = 0; c < o.length; c++) { var m = o[c], w = m.event; m = m.listeners; e: { var S = void 0; if (u) for (var I = m.length - 1; 0 <= I; I--) { var V = m[I], G = V.instance, me = V.currentTarget; if (V = V.listener, G !== S && w.isPropagationStopped()) break e; d0(w, V, me), S = G; } else for (I = 0; I < m.length; I++) { if (V = m[I], G = V.instance, me = V.currentTarget, V = V.listener, G !== S && w.isPropagationStopped()) break e; d0(w, V, me), S = G; } } } if (cs) throw o = zs, cs = !1, zs = null, o; } function hn(o, u) { var c = u[fm]; c === void 0 && (c = u[fm] = /* @__PURE__ */ new Set()); var m = o + "__bubble"; c.has(m) || (h0(u, o, 2, !1), c.add(m)); } function sm(o, u, c) { var m = 0; u && (m |= 4), h0(c, o, m, u); } var rf = "_reactListening" + Math.random().toString(36).slice(2); function ec(o) { if (!o[rf]) { o[rf] = !0, r.forEach(function(c) { c !== "selectionchange" && (mT.has(c) || sm(c, !1, o), sm(c, !0, o)); }); var u = o.nodeType === 9 ? o : o.ownerDocument; u === null || u[rf] || (u[rf] = !0, sm("selectionchange", !1, u)); } } function h0(o, u, c, m) { switch (qd(u)) { case 1: var w = Jp; break; case 4: w = Xp; break; default: w = Xs; } c = w.bind(null, u, c, o), w = void 0, !Vs || u !== "touchstart" && u !== "touchmove" && u !== "wheel" || (w = !0), m ? w !== void 0 ? o.addEventListener(u, c, { capture: !0, passive: w }) : o.addEventListener(u, c, !0) : w !== void 0 ? o.addEventListener(u, c, { passive: w }) : o.addEventListener(u, c, !1); } function om(o, u, c, m, w) { var S = m; if (!(u & 1) && !(u & 2) && 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 = S = I; continue e; } V = V.parentNode; } } m = m.return; } as(function() { var me = S, Me = $s(c), je = []; e: { var Le = Pn.get(o); if (Le !== void 0) { var nt = Kl, at = o; switch (o) { case "keypress": if (Xo(c) === 0) break e; case "keydown": case "keyup": nt = em; break; case "focusin": at = "focus", nt = mu; break; case "focusout": at = "blur", nt = mu; break; case "beforeblur": case "afterblur": nt = 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": nt = eo; break; case "drag": case "dragend": case "dragenter": case "dragexit": case "dragleave": case "dragover": case "dragstart": case "drop": nt = Hd; break; case "touchcancel": case "touchend": case "touchmove": case "touchstart": nt = Wd; break; case Tt: case Jn: case kt: nt = gu; break; case On: nt = Yd; break; case "scroll": nt = Gl; break; case "wheel": nt = rm; break; case "copy": case "cut": case "paste": nt = ys; break; case "gotpointercapture": case "lostpointercapture": case "pointercancel": case "pointerdown": case "pointermove": case "pointerout": case "pointerover": case "pointerup": nt = _u; } var ct = (u & 4) !== 0, En = !ct && o === "scroll", le = ct ? Le !== null ? Le + "Capture" : null : Le; ct = []; for (var X = me, he; X !== null; ) { he = X; var Ge = he.stateNode; if (he.tag === 5 && Ge !== null && (he = Ge, le !== null && (Ge = us(X, le), Ge != null && ct.push(tc(X, Ge, he)))), En) break; X = X.return; } 0 < ct.length && (Le = new nt(Le, at, null, c, Me), je.push({ event: Le, listeners: ct })); } } if (!(u & 7)) { e: { if (Le = o === "mouseover" || o === "pointerover", nt = o === "mouseout" || o === "pointerout", Le && c !== li && (at = c.relatedTarget || c.fromElement) && (ua(at) || at[_s])) break e; if ((nt || Le) && (Le = Me.window === Me ? Me : (Le = Me.ownerDocument) ? Le.defaultView || Le.parentWindow : window, nt ? (at = c.relatedTarget || c.toElement, nt = me, at = at ? ua(at) : null, at !== null && (En = Wn(at), at !== En || at.tag !== 5 && at.tag !== 6) && (at = null)) : (nt = null, at = me), nt !== at)) { if (ct = eo, Ge = "onMouseLeave", le = "onMouseEnter", X = "mouse", (o === "pointerout" || o === "pointerover") && (ct = _u, Ge = "onPointerLeave", le = "onPointerEnter", X = "pointer"), En = nt == null ? Le : Au(nt), he = at == null ? Le : Au(at), Le = new ct(Ge, X + "leave", nt, c, Me), Le.target = En, Le.relatedTarget = he, Ge = null, ua(Me) === me && (ct = new ct(le, X + "enter", at, c, Me), ct.target = he, ct.relatedTarget = En, Ge = ct), En = Ge, nt && at) t: { for (ct = nt, le = at, X = 0, he = ct; he; he = ku(he)) X++; for (he = 0, Ge = le; Ge; Ge = ku(Ge)) he++; for (; 0 < X - he; ) ct = ku(ct), X--; for (; 0 < he - X; ) le = ku(le), he--; for (; X--; ) { if (ct === le || le !== null && ct === le.alternate) break t; ct = ku(ct), le = ku(le); } ct = null; } else ct = null; nt !== null && p0(je, Le, nt, ct, !1), at !== null && En !== null && p0(je, En, at, ct, !0); } } e: { if (Le = me ? Au(me) : window, nt = Le.nodeName && Le.nodeName.toLowerCase(), nt === "select" || nt === "input" && Le.type === "file") var dt = nf; else if (bu(Le)) if (h) dt = J; else { dt = z; var mt = L; } else (nt = Le.nodeName) && nt.toLowerCase() === "input" && (Le.type === "checkbox" || Le.type === "radio") && (dt = W); if (dt && (dt = dt(o, me))) { Xl(je, dt, c, Me); break e; } mt && mt(o, Le, me), o === "focusout" && (mt = Le._wrapperState) && mt.controlled && Le.type === "number" && x(Le, "number", Le.value); } switch (mt = me ? Au(me) : window, o) { case "focusin": (bu(mt) || mt.contentEditable === "true") && (Ee = mt, Ve = me, Ye = null); break; case "focusout": Ye = Ve = Ee = null; break; case "mousedown": ze = !0; break; case "contextmenu": case "mouseup": case "dragend": ze = !1, He(je, c, Me); break; case "selectionchange": if (we) break; case "keydown": case "keyup": He(je, c, Me); } var gt; if (ia) e: { switch (o) { case "compositionstart": var St = "onCompositionStart"; break e; case "compositionend": St = "onCompositionEnd"; break e; case "compositionupdate": St = "onCompositionUpdate"; break e; } St = void 0; } else Xt ? sa(o, c) && (St = "onCompositionEnd") : o === "keydown" && c.keyCode === 229 && (St = "onCompositionStart"); St && (Zd && c.locale !== "ko" && (Xt || St !== "onCompositionStart" ? St === "onCompositionEnd" && Xt && (gt = hu()) : (Ki = Me, Hl = "value" in Ki ? Ki.value : Ki.textContent, Xt = !0)), mt = sf(me, St), 0 < mt.length && (St = new vu(St, o, null, c, Me), je.push({ event: St, listeners: mt }), gt ? St.data = gt : (gt = Yr(c), gt !== null && (St.data = gt)))), (gt = Xd ? Su(o, c) : mr(o, c)) && (me = sf(me, "onBeforeInput"), 0 < me.length && (Me = new vu("onBeforeInput", "beforeinput", null, c, Me), je.push({ event: Me, listeners: me }), Me.data = gt)); } f0(je, u); }); } function tc(o, u, c) { return { instance: o, listener: u, currentTarget: c }; } function sf(o, u) { for (var c = u + "Capture", m = []; o !== null; ) { var w = o, S = w.stateNode; w.tag === 5 && S !== null && (w = S, S = us(o, c), S != null && m.unshift(tc(o, S, w)), S = us(o, u), S != null && m.push(tc(o, S, w))), o = o.return; } return m; } function ku(o) { if (o === null) return null; do o = o.return; while (o && o.tag !== 5); return o || null; } function p0(o, u, c, m, w) { for (var S = u._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 = us(c, S), G != null && I.unshift(tc(c, G, V))) : w || (G = us(c, S), G != null && I.push(tc(c, G, V)))), c = c.return; } I.length !== 0 && o.push({ event: u, listeners: I }); } var gT = /\r\n?/g, vT = /\u0000|\uFFFD/g; function m0(o) { return (typeof o == "string" ? o : "" + o).replace(gT, ` `).replace(vT, ""); } function of(o, u, c) { if (u = m0(u), m0(o) !== u && c) throw Error(n(425)); } function af() { } var am = null, um = null; function lm(o, u) { return o === "textarea" || o === "noscript" || typeof u.children == "string" || typeof u.children == "number" || typeof u.dangerouslySetInnerHTML == "object" && u.dangerouslySetInnerHTML !== null && u.dangerouslySetInnerHTML.__html != null; } var cm = typeof setTimeout == "function" ? setTimeout : void 0, yT = typeof clearTimeout == "function" ? clearTimeout : void 0, g0 = typeof Promise == "function" ? Promise : void 0, wT = typeof queueMicrotask == "function" ? queueMicrotask : typeof g0 < "u" ? function(o) { return g0.resolve(null).then(o).catch(_T); } : cm; function _T(o) { setTimeout(function() { throw o; }); } function dm(o, u) { var c = u, m = 0; do { var w = c.nextSibling; if (o.removeChild(c), w && w.nodeType === 8) if (c = w.data, c === "/$") { if (m === 0) { o.removeChild(w), Qs(u); return; } m--; } else c !== "$" && c !== "$?" && c !== "$!" || m++; c = w; } while (c); Qs(u); } function ro(o) { for (; o != null; o = o.nextSibling) { var u = o.nodeType; if (u === 1 || u === 3) break; if (u === 8) { if (u = o.data, u === "$" || u === "$!" || u === "$?") break; if (u === "/$") return null; } } return o; } function v0(o) { o = o.previousSibling; for (var u = 0; o; ) { if (o.nodeType === 8) { var c = o.data; if (c === "$" || c === "$!" || c === "$?") { if (u === 0) return o; u--; } else c === "/$" && u++; } o = o.previousSibling; } return null; } var Eu = Math.random().toString(36).slice(2), Wi = "__reactFiber$" + Eu, nc = "__reactProps$" + Eu, _s = "__reactContainer$" + Eu, fm = "__reactEvents$" + Eu, ST = "__reactListeners$" + Eu, bT = "__reactHandles$" + Eu; function ua(o) { var u = o[Wi]; if (u) return u; for (var c = o.parentNode; c; ) { if (u = c[_s] || c[Wi]) { if (c = u.alternate, u.child !== null || c !== null && c.child !== null) for (o = v0(o); o !== null; ) { if (c = o[Wi]) return c; o = v0(o); } return u; } o = c, c = o.parentNode; } return null; } function rc(o) { return o = o[Wi] || o[_s], !o || o.tag !== 5 && o.tag !== 6 && o.tag !== 13 && o.tag !== 3 ? null : o; } function Au(o) { if (o.tag === 5 || o.tag === 6) return o.stateNode; throw Error(n(33)); } function uf(o) { return o[nc] || null; } var hm = [], Cu = -1; function io(o) { return { current: o }; } function pn(o) { 0 > Cu || (o.current = hm[Cu], hm[Cu] = null, Cu--); } function un(o, u) { Cu++, hm[Cu] = o.current, o.current = u; } var so = {}, Xn = io(so), gr = io(!1), la = so; function xu(o, u) { var c = o.type.contextTypes; if (!c) return so; var m = o.stateNode; if (m && m.__reactInternalMemoizedUnmaskedChildContext === u) return m.__reactInternalMemoizedMaskedChildContext; var w = {}, S; for (S in c) w[S] = u[S]; return m && (o = o.stateNode, o.__reactInternalMemoizedUnmaskedChildContext = u, o.__reactInternalMemoizedMaskedChildContext = w), w; } function vr(o) { return o = o.childContextTypes, o != null; } function lf() { pn(gr), pn(Xn); } function y0(o, u, c) { if (Xn.current !== so) throw Error(n(168)); un(Xn, u), un(gr, c); } function w0(o, u, c) { var m = o.stateNode; if (u = u.childContextTypes, typeof m.getChildContext != "function") return c; m = m.getChildContext(); for (var w in m) if (!(w in u)) throw Error(n(108, Re(o) || "Unknown", w)); return B({}, c, m); } function cf(o) { return o = (o = o.stateNode) && o.__reactInternalMemoizedMergedChildContext || so, la = Xn.current, un(Xn, o), un(gr, gr.current), !0; } function _0(o, u, c) { var m = o.stateNode; if (!m) throw Error(n(169)); c ? (o = w0(o, u, la), m.__reactInternalMemoizedMergedChildContext = o, pn(gr), pn(Xn), un(Xn, o)) : pn(gr), un(gr, c); } var Ss = null, df = !1, pm = !1; function S0(o) { Ss === null ? Ss = [o] : Ss.push(o); } function kT(o) { df = !0, S0(o); } function oo() { if (!pm && Ss !== null) { pm = !0; var o = 0, u = Gt; try { var c = Ss; for (Gt = 1; o < c.length; o++) { var m = c[o]; do m = m(!0); while (m !== null); } Ss = null, df = !1; } catch (w) { throw Ss !== null && (Ss = Ss.slice(o + 1)), Ml(Vi, oo), w; } finally { Gt = u, pm = !1; } } return null; } var Nu = [], Tu = 0, ff = null, hf = 0, Qr = [], Jr = 0, ca = null, bs = 1, ks = ""; function da(o, u) { Nu[Tu++] = hf, Nu[Tu++] = ff, ff = o, hf = u; } function b0(o, u, c) { Qr[Jr++] = bs, Qr[Jr++] = ks, Qr[Jr++] = ca, ca = o; var m = bs; o = ks; var w = 32 - _t(m) - 1; m &= ~(1 << w), c += 1; var S = 32 - _t(u) + w; if (30 < S) { var I = w - w % 5; S = (m & (1 << I) - 1).toString(32), m >>= I, w -= I, bs = 1 << 32 - _t(u) + w | c << w | m, ks = S + o; } else bs = 1 << S | c << w | m, ks = o; } function mm(o) { o.return !== null && (da(o, 1), b0(o, 1, 0)); } function gm(o) { for (; o === ff; ) ff = Nu[--Tu], Nu[Tu] = null, hf = Nu[--Tu], Nu[Tu] = null; for (; o === ca; ) ca = Qr[--Jr], Qr[Jr] = null, ks = Qr[--Jr], Qr[Jr] = null, bs = Qr[--Jr], Qr[Jr] = null; } var Lr = null, Ur = null, vn = !1, vi = null; function k0(o, u) { var c = ti(5, null, null, 0); c.elementType = "DELETED", c.stateNode = u, c.return = o, u = o.deletions, u === null ? (o.deletions = [c], o.flags |= 16) : u.push(c); } function E0(o, u) { switch (o.tag) { case 5: var c = o.type; return u = u.nodeType !== 1 || c.toLowerCase() !== u.nodeName.toLowerCase() ? null : u, u !== null ? (o.stateNode = u, Lr = o, Ur = ro(u.firstChild), !0) : !1; case 6: return u = o.pendingProps === "" || u.nodeType !== 3 ? null : u, u !== null ? (o.stateNode = u, Lr = o, Ur = null, !0) : !1; case 13: return u = u.nodeType !== 8 ? null : u, u !== null ? (c = ca !== null ? { id: bs, overflow: ks } : null, o.memoizedState = { dehydrated: u, treeContext: c, retryLane: 1073741824 }, c = ti(18, null, null, 0), c.stateNode = u, c.return = o, o.child = c, Lr = o, Ur = null, !0) : !1; default: return !1; } } function vm(o) { return (o.mode & 1) !== 0 && (o.flags & 128) === 0; } function ym(o) { if (vn) { var u = Ur; if (u) { var c = u; if (!E0(o, u)) { if (vm(o)) throw Error(n(418)); u = ro(c.nextSibling); var m = Lr; u && E0(o, u) ? k0(m, c) : (o.flags = o.flags & -4097 | 2, vn = !1, Lr = o); } } else { if (vm(o)) throw Error(n(418)); o.flags = o.flags & -4097 | 2, vn = !1, Lr = o; } } } function A0(o) { for (o = o.return; o !== null && o.tag !== 5 && o.tag !== 3 && o.tag !== 13; ) o = o.return; Lr = o; } function pf(o) { if (o !== Lr) return !1; if (!vn) return A0(o), vn = !0, !1; var u; if ((u = o.tag !== 3) && !(u = o.tag !== 5) && (u = o.type, u = u !== "head" && u !== "body" && !lm(o.type, o.memoizedProps)), u && (u = Ur)) { if (vm(o)) throw C0(), Error(n(418)); for (; u; ) k0(o, u), u = ro(u.nextSibling); } if (A0(o), o.tag === 13) { if (o = o.memoizedState, o = o !== null ? o.dehydrated : null, !o) throw Error(n(317)); e: { for (o = o.nextSibling, u = 0; o; ) { if (o.nodeType === 8) { var c = o.data; if (c === "/$") { if (u === 0) { Ur = ro(o.nextSibling); break e; } u--; } else c !== "$" && c !== "$!" && c !== "$?" || u++; } o = o.nextSibling; } Ur = null; } } else Ur = Lr ? ro(o.stateNode.nextSibling) : null; return !0; } function C0() { for (var o = Ur; o; ) o = ro(o.nextSibling); } function Iu() { Ur = Lr = null, vn = !1; } function wm(o) { vi === null ? vi = [o] : vi.push(o); } var ET = j.ReactCurrentBatchConfig; function ic(o, u, c) { if (o = c.ref, o !== null && typeof o != "function" && typeof o != "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, o)); var w = m, S = "" + o; return u !== null && u.ref !== null && typeof u.ref == "function" && u.ref._stringRef === S ? u.ref : (u = function(I) { var V = w.refs; I === null ? delete V[S] : V[S] = I; }, u._stringRef = S, u); } if (typeof o != "string") throw Error(n(284)); if (!c._owner) throw Error(n(290, o)); } return o; } function mf(o, u) { throw o = Object.prototype.toString.call(u), Error(n(31, o === "[object Object]" ? "object with keys {" + Object.keys(u).join(", ") + "}" : o)); } function x0(o) { var u = o._init; return u(o._payload); } function N0(o) { function u(le, X) { if (o) { var he = le.deletions; he === null ? (le.deletions = [X], le.flags |= 16) : he.push(X); } } function c(le, X) { if (!o) return null; for (; X !== null; ) u(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 = mo(le, X), le.index = 0, le.sibling = null, le; } function S(le, X, he) { return le.index = he, o ? (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 o && le.alternate === null && (le.flags |= 2), le; } function V(le, X, he, Ge) { return X === null || X.tag !== 6 ? (X = cg(he, le.mode, Ge), X.return = le, X) : (X = w(X, he), X.return = le, X); } function G(le, X, he, Ge) { var dt = he.type; return dt === ce ? Me(le, X, he.props.children, Ge, he.key) : X !== null && (X.elementType === dt || typeof dt == "object" && dt !== null && dt.$$typeof === ke && x0(dt) === X.type) ? (Ge = w(X, he.props), Ge.ref = ic(le, X, he), Ge.return = le, Ge) : (Ge = Bf(he.type, he.key, he.props, null, le.mode, Ge), Ge.ref = ic(le, X, he), Ge.return = le, Ge); } function me(le, X, he, Ge) { return X === null || X.tag !== 4 || X.stateNode.containerInfo !== he.containerInfo || X.stateNode.implementation !== he.implementation ? (X = dg(he, le.mode, Ge), X.return = le, X) : (X = w(X, he.children || []), X.return = le, X); } function Me(le, X, he, Ge, dt) { return X === null || X.tag !== 7 ? (X = wa(he, le.mode, Ge, dt), X.return = le, X) : (X = w(X, he), X.return = le, X); } function je(le, X, he) { if (typeof X == "string" && X !== "" || typeof X == "number") return X = cg("" + X, le.mode, he), X.return = le, X; if (typeof X == "object" && X !== null) { switch (X.$$typeof) { case K: return he = Bf(X.type, X.key, X.props, null, le.mode, he), he.ref = ic(le, null, X), he.return = le, he; case ie: return X = dg(X, le.mode, he), X.return = le, X; case ke: var Ge = X._init; return je(le, Ge(X._payload), he); } if (b(X) || Ae(X)) return X = wa(X, le.mode, he, null), X.return = le, X; mf(le, X); } return null; } function Le(le, X, he, Ge) { var dt = X !== null ? X.key : null; if (typeof he == "string" && he !== "" || typeof he == "number") return dt !== null ? null : V(le, X, "" + he, Ge); if (typeof he == "object" && he !== null) { switch (he.$$typeof) { case K: return he.key === dt ? G(le, X, he, Ge) : null; case ie: return he.key === dt ? me(le, X, he, Ge) : null; case ke: return dt = he._init, Le( le, X, dt(he._payload), Ge ); } if (b(he) || Ae(he)) return dt !== null ? null : Me(le, X, he, Ge, null); mf(le, he); } return null; } function nt(le, X, he, Ge, dt) { if (typeof Ge == "string" && Ge !== "" || typeof Ge == "number") return le = le.get(he) || null, V(X, le, "" + Ge, dt); if (typeof Ge == "object" && Ge !== null) { switch (Ge.$$typeof) { case K: return le = le.get(Ge.key === null ? he : Ge.key) || null, G(X, le, Ge, dt); case ie: return le = le.get(Ge.key === null ? he : Ge.key) || null, me(X, le, Ge, dt); case ke: var mt = Ge._init; return nt(le, X, he, mt(Ge._payload), dt); } if (b(Ge) || Ae(Ge)) return le = le.get(he) || null, Me(X, le, Ge, dt, null); mf(X, Ge); } return null; } function at(le, X, he, Ge) { for (var dt = null, mt = null, gt = X, St = X = 0, Bn = null; gt !== null && St < he.length; St++) { gt.index > St ? (Bn = gt, gt = null) : Bn = gt.sibling; var $t = Le(le, gt, he[St], Ge); if ($t === null) { gt === null && (gt = Bn); break; } o && gt && $t.alternate === null && u(le, gt), X = S($t, X, St), mt === null ? dt = $t : mt.sibling = $t, mt = $t, gt = Bn; } if (St === he.length) return c(le, gt), vn && da(le, St), dt; if (gt === null) { for (; St < he.length; St++) gt = je(le, he[St], Ge), gt !== null && (X = S(gt, X, St), mt === null ? dt = gt : mt.sibling = gt, mt = gt); return vn && da(le, St), dt; } for (gt = m(le, gt); St < he.length; St++) Bn = nt(gt, le, St, he[St], Ge), Bn !== null && (o && Bn.alternate !== null && gt.delete(Bn.key === null ? St : Bn.key), X = S(Bn, X, St), mt === null ? dt = Bn : mt.sibling = Bn, mt = Bn); return o && gt.forEach(function(go) { return u(le, go); }), vn && da(le, St), dt; } function ct(le, X, he, Ge) { var dt = Ae(he); if (typeof dt != "function") throw Error(n(150)); if (he = dt.call(he), he == null) throw Error(n(151)); for (var mt = dt = null, gt = X, St = X = 0, Bn = null, $t = he.next(); gt !== null && !$t.done; St++, $t = he.next()) { gt.index > St ? (Bn = gt, gt = null) : Bn = gt.sibling; var go = Le(le, gt, $t.value, Ge); if (go === null) { gt === null && (gt = Bn); break; } o && gt && go.alternate === null && u(le, gt), X = S(go, X, St), mt === null ? dt = go : mt.sibling = go, mt = go, gt = Bn; } if ($t.done) return c( le, gt ), vn && da(le, St), dt; if (gt === null) { for (; !$t.done; St++, $t = he.next()) $t = je(le, $t.value, Ge), $t !== null && (X = S($t, X, St), mt === null ? dt = $t : mt.sibling = $t, mt = $t); return vn && da(le, St), dt; } for (gt = m(le, gt); !$t.done; St++, $t = he.next()) $t = nt(gt, le, St, $t.value, Ge), $t !== null && (o && $t.alternate !== null && gt.delete($t.key === null ? St : $t.key), X = S($t, X, St), mt === null ? dt = $t : mt.sibling = $t, mt = $t); return o && gt.forEach(function(rI) { return u(le, rI); }), vn && da(le, St), dt; } function En(le, X, he, Ge) { if (typeof he == "object" && he !== null && he.type === ce && he.key === null && (he = he.props.children), typeof he == "object" && he !== null) { switch (he.$$typeof) { case K: e: { for (var dt = he.key, mt = X; mt !== null; ) { if (mt.key === dt) { if (dt = he.type, dt === ce) { if (mt.tag === 7) { c(le, mt.sibling), X = w(mt, he.props.children), X.return = le, le = X; break e; } } else if (mt.elementType === dt || typeof dt == "object" && dt !== null && dt.$$typeof === ke && x0(dt) === mt.type) { c(le, mt.sibling), X = w(mt, he.props), X.ref = ic(le, mt, he), X.return = le, le = X; break e; } c(le, mt); break; } else u(le, mt); mt = mt.sibling; } he.type === ce ? (X = wa(he.props.children, le.mode, Ge, he.key), X.return = le, le = X) : (Ge = Bf(he.type, he.key, he.props, null, le.mode, Ge), Ge.ref = ic(le, X, he), Ge.return = le, le = Ge); } return I(le); case ie: e: { for (mt = he.key; X !== null; ) { if (X.key === mt) 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 u(le, X); X = X.sibling; } X = dg(he, le.mode, Ge), X.return = le, le = X; } return I(le); case ke: return mt = he._init, En(le, X, mt(he._payload), Ge); } if (b(he)) return at(le, X, he, Ge); if (Ae(he)) return ct(le, X, he, Ge); mf(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 = cg(he, le.mode, Ge), X.return = le, le = X), I(le)) : c(le, X); } return En; } var Ru = N0(!0), T0 = N0(!1), gf = io(null), vf = null, Ou = null, _m = null; function Sm() { _m = Ou = vf = null; } function bm(o) { var u = gf.current; pn(gf), o._currentValue = u; } function km(o, u, c) { for (; o !== null; ) { var m = o.alternate; if ((o.childLanes & u) !== u ? (o.childLanes |= u, m !== null && (m.childLanes |= u)) : m !== null && (m.childLanes & u) !== u && (m.childLanes |= u), o === c) break; o = o.return; } } function Pu(o, u) { vf = o, _m = Ou = null, o = o.dependencies, o !== null && o.firstContext !== null && (o.lanes & u && (yr = !0), o.firstContext = null); } function Xr(o) { var u = o._currentValue; if (_m !== o) if (o = { context: o, memoizedValue: u, next: null }, Ou === null) { if (vf === null) throw Error(n(308)); Ou = o, vf.dependencies = { lanes: 0, firstContext: o }; } else Ou = Ou.next = o; return u; } var fa = null; function Em(o) { fa === null ? fa = [o] : fa.push(o); } function I0(o, u, c, m) { var w = u.interleaved; return w === null ? (c.next = c, Em(u)) : (c.next = w.next, w.next = c), u.interleaved = c, Es(o, m); } function Es(o, u) { o.lanes |= u; var c = o.alternate; for (c !== null && (c.lanes |= u), c = o, o = o.return; o !== null; ) o.childLanes |= u, c = o.alternate, c !== null && (c.childLanes |= u), c = o, o = o.return; return c.tag === 3 ? c.stateNode : null; } var ao = !1; function Am(o) { o.updateQueue = { baseState: o.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: 0 }, effects: null }; } function R0(o, u) { o = o.updateQueue, u.updateQueue === o && (u.updateQueue = { baseState: o.baseState, firstBaseUpdate: o.firstBaseUpdate, lastBaseUpdate: o.lastBaseUpdate, shared: o.shared, effects: o.effects }); } function As(o, u) { return { eventTime: o, lane: u, tag: 0, payload: null, callback: null, next: null }; } function uo(o, u, c) { var m = o.updateQueue; if (m === null) return null; if (m = m.shared, jt & 2) { var w = m.pending; return w === null ? u.next = u : (u.next = w.next, w.next = u), m.pending = u, Es(o, c); } return w = m.interleaved, w === null ? (u.next = u, Em(m)) : (u.next = w.next, w.next = u), m.interleaved = u, Es(o, c); } function yf(o, u, c) { if (u = u.updateQueue, u !== null && (u = u.shared, (c & 4194240) !== 0)) { var m = u.lanes; m &= o.pendingLanes, c |= m, u.lanes = c, lu(o, c); } } function O0(o, u) { var c = o.updateQueue, m = o.alternate; if (m !== null && (m = m.updateQueue, c === m)) { var w = null, S = 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 }; S === null ? w = S = I : S = S.next = I, c = c.next; } while (c !== null); S === null ? w = S = u : S = S.next = u; } else w = S = u; c = { baseState: m.baseState, firstBaseUpdate: w, lastBaseUpdate: S, shared: m.shared, effects: m.effects }, o.updateQueue = c; return; } o = c.lastBaseUpdate, o === null ? c.firstBaseUpdate = u : o.next = u, c.lastBaseUpdate = u; } function wf(o, u, c, m) { var w = o.updateQueue; ao = !1; var S = 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 ? S = me : I.next = me, I = G; var Me = o.alternate; Me !== null && (Me = Me.updateQueue, V = Me.lastBaseUpdate, V !== I && (V === null ? Me.firstBaseUpdate = me : V.next = me, Me.lastBaseUpdate = G)); } if (S !== null) { var je = w.baseState; I = 0, Me = me = G = null, V = S; do { var Le = V.lane, nt = V.eventTime; if ((m & Le) === Le) { Me !== null && (Me = Me.next = { eventTime: nt, lane: 0, tag: V.tag, payload: V.payload, callback: V.callback, next: null }); e: { var at = o, ct = V; switch (Le = u, nt = c, ct.tag) { case 1: if (at = ct.payload, typeof at == "function") { je = at.call(nt, je, Le); break e; } je = at; break e; case 3: at.flags = at.flags & -65537 | 128; case 0: if (at = ct.payload, Le = typeof at == "function" ? at.call(nt, je, Le) : at, Le == null) break e; je = B({}, je, Le); break e; case 2: ao = !0; } } V.callback !== null && V.lane !== 0 && (o.flags |= 64, Le = w.effects, Le === null ? w.effects = [V] : Le.push(V)); } else nt = { eventTime: nt, lane: Le, tag: V.tag, payload: V.payload, callback: V.callback, next: null }, Me === null ? (me = Me = nt, G = je) : Me = Me.next = nt, I |= Le; if (V = V.next, V === null) { if (V = w.shared.pending, V === null) break; Le = V, V = Le.next, Le.next = null, w.lastBaseUpdate = Le, w.shared.pending = null; } } while (!0); if (Me === null && (G = je), w.baseState = G, w.firstBaseUpdate = me, w.lastBaseUpdate = Me, u = w.shared.interleaved, u !== null) { w = u; do I |= w.lane, w = w.next; while (w !== u); } else S === null && (w.shared.lanes = 0); ma |= I, o.lanes = I, o.memoizedState = je; } } function P0(o, u, c) { if (o = u.effects, u.effects = null, o !== null) for (u = 0; u < o.length; u++) { var m = o[u], w = m.callback; if (w !== null) { if (m.callback = null, m = c, typeof w != "function") throw Error(n(191, w)); w.call(m); } } } var sc = {}, Yi = io(sc), oc = io(sc), ac = io(sc); function ha(o) { if (o === sc) throw Error(n(174)); return o; } function Cm(o, u) { switch (un(ac, u), un(oc, o), un(Yi, sc), o = u.nodeType, o) { case 9: case 11: u = (u = u.documentElement) ? u.namespaceURI : Lt(null, ""); break; default: o = o === 8 ? u.parentNode : u, u = o.namespaceURI || null, o = o.tagName, u = Lt(u, o); } pn(Yi), un(Yi, u); } function Du() { pn(Yi), pn(oc), pn(ac); } function D0(o) { ha(ac.current); var u = ha(Yi.current), c = Lt(u, o.type); u !== c && (un(oc, o), un(Yi, c)); } function xm(o) { oc.current === o && (pn(Yi), pn(oc)); } var wn = io(0); function _f(o) { for (var u = o; u !== null; ) { if (u.tag === 13) { var c = u.memoizedState; if (c !== null && (c = c.dehydrated, c === null || c.data === "$?" || c.data === "$!")) return u; } else if (u.tag === 19 && u.memoizedProps.revealOrder !== void 0) { if (u.flags & 128) return u; } else if (u.child !== null) { u.child.return = u, u = u.child; continue; } if (u === o) break; for (; u.sibling === null; ) { if (u.return === null || u.return === o) return null; u = u.return; } u.sibling.return = u.return, u = u.sibling; } return null; } var Nm = []; function Tm() { for (var o = 0; o < Nm.length; o++) Nm[o]._workInProgressVersionPrimary = null; Nm.length = 0; } var Sf = j.ReactCurrentDispatcher, Im = j.ReactCurrentBatchConfig, pa = 0, _n = null, Dn = null, Un = null, bf = !1, uc = !1, lc = 0, AT = 0; function Zn() { throw Error(n(321)); } function Rm(o, u) { if (u === null) return !1; for (var c = 0; c < u.length && c < o.length; c++) if (!q(o[c], u[c])) return !1; return !0; } function Om(o, u, c, m, w, S) { if (pa = S, _n = u, u.memoizedState = null, u.updateQueue = null, u.lanes = 0, Sf.current = o === null || o.memoizedState === null ? TT : IT, o = c(m, w), uc) { S = 0; do { if (uc = !1, lc = 0, 25 <= S) throw Error(n(301)); S += 1, Un = Dn = null, u.updateQueue = null, Sf.current = RT, o = c(m, w); } while (uc); } if (Sf.current = Af, u = Dn !== null && Dn.next !== null, pa = 0, Un = Dn = _n = null, bf = !1, u) throw Error(n(300)); return o; } function Pm() { var o = lc !== 0; return lc = 0, o; } function Qi() { var o = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null }; return Un === null ? _n.memoizedState = Un = o : Un = Un.next = o, Un; } function Zr() { if (Dn === null) { var o = _n.alternate; o = o !== null ? o.memoizedState : null; } else o = Dn.next; var u = Un === null ? _n.memoizedState : Un.next; if (u !== null) Un = u, Dn = o; else { if (o === null) throw Error(n(310)); Dn = o, o = { memoizedState: Dn.memoizedState, baseState: Dn.baseState, baseQueue: Dn.baseQueue, queue: Dn.queue, next: null }, Un === null ? _n.memoizedState = Un = o : Un = Un.next = o; } return Un; } function cc(o, u) { return typeof u == "function" ? u(o) : u; } function Dm(o) { var u = Zr(), c = u.queue; if (c === null) throw Error(n(311)); c.lastRenderedReducer = o; var m = Dn, w = m.baseQueue, S = c.pending; if (S !== null) { if (w !== null) { var I = w.next; w.next = S.next, S.next = I; } m.baseQueue = w = S, c.pending = null; } if (w !== null) { S = w.next, m = m.baseState; var V = I = null, G = null, me = S; do { var Me = me.lane; if ((pa & Me) === Me) G !== null && (G = G.next = { lane: 0, action: me.action, hasEagerState: me.hasEagerState, eagerState: me.eagerState, next: null }), m = me.hasEagerState ? me.eagerState : o(m, me.action); else { var je = { lane: Me, action: me.action, hasEagerState: me.hasEagerState, eagerState: me.eagerState, next: null }; G === null ? (V = G = je, I = m) : G = G.next = je, _n.lanes |= Me, ma |= Me; } me = me.next; } while (me !== null && me !== S); G === null ? I = m : G.next = V, q(m, u.memoizedState) || (yr = !0), u.memoizedState = m, u.baseState = I, u.baseQueue = G, c.lastRenderedState = m; } if (o = c.interleaved, o !== null) { w = o; do S = w.lane, _n.lanes |= S, ma |= S, w = w.next; while (w !== o); } else w === null && (c.lanes = 0); return [u.memoizedState, c.dispatch]; } function Fm(o) { var u = Zr(), c = u.queue; if (c === null) throw Error(n(311)); c.lastRenderedReducer = o; var m = c.dispatch, w = c.pending, S = u.memoizedState; if (w !== null) { c.pending = null; var I = w = w.next; do S = o(S, I.action), I = I.next; while (I !== w); q(S, u.memoizedState) || (yr = !0), u.memoizedState = S, u.baseQueue === null && (u.baseState = S), c.lastRenderedState = S; } return [S, m]; } function F0() { } function L0(o, u) { var c = _n, m = Zr(), w = u(), S = !q(m.memoizedState, w); if (S && (m.memoizedState = w, yr = !0), m = m.queue, Lm(B0.bind(null, c, m, o), [o]), m.getSnapshot !== u || S || Un !== null && Un.memoizedState.tag & 1) { if (c.flags |= 2048, dc(9, M0.bind(null, c, m, w, u), void 0, null), Mn === null) throw Error(n(349)); pa & 30 || U0(c, u, w); } return w; } function U0(o, u, c) { o.flags |= 16384, o = { getSnapshot: u, value: c }, u = _n.updateQueue, u === null ? (u = { lastEffect: null, stores: null }, _n.updateQueue = u, u.stores = [o]) : (c = u.stores, c === null ? u.stores = [o] : c.push(o)); } function M0(o, u, c, m) { u.value = c, u.getSnapshot = m, j0(u) && $0(o); } function B0(o, u, c) { return c(function() { j0(u) && $0(o); }); } function j0(o) { var u = o.getSnapshot; o = o.value; try { var c = u(); return !q(o, c); } catch { return !0; } } function $0(o) { var u = Es(o, 1); u !== null && Si(u, o, 1, -1); } function V0(o) { var u = Qi(); return typeof o == "function" && (o = o()), u.memoizedState = u.baseState = o, o = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: cc, lastRenderedState: o }, u.queue = o, o = o.dispatch = NT.bind(null, _n, o), [u.memoizedState, o]; } function dc(o, u, c, m) { return o = { tag: o, create: u, destroy: c, deps: m, next: null }, u = _n.updateQueue, u === null ? (u = { lastEffect: null, stores: null }, _n.updateQueue = u, u.lastEffect = o.next = o) : (c = u.lastEffect, c === null ? u.lastEffect = o.next = o : (m = c.next, c.next = o, o.next = m, u.lastEffect = o)), o; } function z0() { return Zr().memoizedState; } function kf(o, u, c, m) { var w = Qi(); _n.flags |= o, w.memoizedState = dc(1 | u, c, void 0, m === void 0 ? null : m); } function Ef(o, u, c, m) { var w = Zr(); m = m === void 0 ? null : m; var S = void 0; if (Dn !== null) { var I = Dn.memoizedState; if (S = I.destroy, m !== null && Rm(m, I.deps)) { w.memoizedState = dc(u, c, S, m); return; } } _n.flags |= o, w.memoizedState = dc(1 | u, c, S, m); } function q0(o, u) { return kf(8390656, 8, o, u); } function Lm(o, u) { return Ef(2048, 8, o, u); } function H0(o, u) { return Ef(4, 2, o, u); } function K0(o, u) { return Ef(4, 4, o, u); } function G0(o, u) { if (typeof u == "function") return o = o(), u(o), function() { u(null); }; if (u != null) return o = o(), u.current = o, function() { u.current = null; }; } function W0(o, u, c) { return c = c != null ? c.concat([o]) : null, Ef(4, 4, G0.bind(null, u, o), c); } function Um() { } function Y0(o, u) { var c = Zr(); u = u === void 0 ? null : u; var m = c.memoizedState; return m !== null && u !== null && Rm(u, m[1]) ? m[0] : (c.memoizedState = [o, u], o); } function Q0(o, u) { var c = Zr(); u = u === void 0 ? null : u; var m = c.memoizedState; return m !== null && u !== null && Rm(u, m[1]) ? m[0] : (o = o(), c.memoizedState = [o, u], o); } function J0(o, u, c) { return pa & 21 ? (q(c, u) || (c = Vl(), _n.lanes |= c, ma |= c, o.baseState = !0), u) : (o.baseState && (o.baseState = !1, yr = !0), o.memoizedState = c); } function CT(o, u) { var c = Gt; Gt = c !== 0 && 4 > c ? c : 4, o(!0); var m = Im.transition; Im.transition = {}; try { o(!1), u(); } finally { Gt = c, Im.transition = m; } } function X0() { return Zr().memoizedState; } function xT(o, u, c) { var m = ho(o); if (c = { lane: m, action: c, hasEagerState: !1, eagerState: null, next: null }, Z0(o)) e_(u, c); else if (c = I0(o, u, c, m), c !== null) { var w = lr(); Si(c, o, m, w), t_(c, u, m); } } function NT(o, u, c) { var m = ho(o), w = { lane: m, action: c, hasEagerState: !1, eagerState: null, next: null }; if (Z0(o)) e_(u, w); else { var S = o.alternate; if (o.lanes === 0 && (S === null || S.lanes === 0) && (S = u.lastRenderedReducer, S !== null)) try { var I = u.lastRenderedState, V = S(I, c); if (w.hasEagerState = !0, w.eagerState = V, q(V, I)) { var G = u.interleaved; G === null ? (w.next = w, Em(u)) : (w.next = G.next, G.next = w), u.interleaved = w; return; } } catch { } finally { } c = I0(o, u, w, m), c !== null && (w = lr(), Si(c, o, m, w), t_(c, u, m)); } } function Z0(o) { var u = o.alternate; return o === _n || u !== null && u === _n; } function e_(o, u) { uc = bf = !0; var c = o.pending; c === null ? u.next = u : (u.next = c.next, c.next = u), o.pending = u; } function t_(o, u, c) { if (c & 4194240) { var m = u.lanes; m &= o.pendingLanes, c |= m, u.lanes = c, lu(o, c); } } var Af = { readContext: Xr, 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 }, TT = { readContext: Xr, useCallback: function(o, u) { return Qi().memoizedState = [o, u === void 0 ? null : u], o; }, useContext: Xr, useEffect: q0, useImperativeHandle: function(o, u, c) { return c = c != null ? c.concat([o]) : null, kf( 4194308, 4, G0.bind(null, u, o), c ); }, useLayoutEffect: function(o, u) { return kf(4194308, 4, o, u); }, useInsertionEffect: function(o, u) { return kf(4, 2, o, u); }, useMemo: function(o, u) { var c = Qi(); return u = u === void 0 ? null : u, o = o(), c.memoizedState = [o, u], o; }, useReducer: function(o, u, c) { var m = Qi(); return u = c !== void 0 ? c(u) : u, m.memoizedState = m.baseState = u, o = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: o, lastRenderedState: u }, m.queue = o, o = o.dispatch = xT.bind(null, _n, o), [m.memoizedState, o]; }, useRef: function(o) { var u = Qi(); return o = { current: o }, u.memoizedState = o; }, useState: V0, useDebugValue: Um, useDeferredValue: function(o) { return Qi().memoizedState = o; }, useTransition: function() { var o = V0(!1), u = o[0]; return o = CT.bind(null, o[1]), Qi().memoizedState = o, [u, o]; }, useMutableSource: function() { }, useSyncExternalStore: function(o, u, c) { var m = _n, w = Qi(); if (vn) { if (c === void 0) throw Error(n(407)); c = c(); } else { if (c = u(), Mn === null) throw Error(n(349)); pa & 30 || U0(m, u, c); } w.memoizedState = c; var S = { value: c, getSnapshot: u }; return w.queue = S, q0(B0.bind( null, m, S, o ), [o]), m.flags |= 2048, dc(9, M0.bind(null, m, S, c, u), void 0, null), c; }, useId: function() { var o = Qi(), u = Mn.identifierPrefix; if (vn) { var c = ks, m = bs; c = (m & ~(1 << 32 - _t(m) - 1)).toString(32) + c, u = ":" + u + "R" + c, c = lc++, 0 < c && (u += "H" + c.toString(32)), u += ":"; } else c = AT++, u = ":" + u + "r" + c.toString(32) + ":"; return o.memoizedState = u; }, unstable_isNewReconciler: !1 }, IT = { readContext: Xr, useCallback: Y0, useContext: Xr, useEffect: Lm, useImperativeHandle: W0, useInsertionEffect: H0, useLayoutEffect: K0, useMemo: Q0, useReducer: Dm, useRef: z0, useState: function() { return Dm(cc); }, useDebugValue: Um, useDeferredValue: function(o) { var u = Zr(); return J0(u, Dn.memoizedState, o); }, useTransition: function() { var o = Dm(cc)[0], u = Zr().memoizedState; return [o, u]; }, useMutableSource: F0, useSyncExternalStore: L0, useId: X0, unstable_isNewReconciler: !1 }, RT = { readContext: Xr, useCallback: Y0, useContext: Xr, useEffect: Lm, useImperativeHandle: W0, useInsertionEffect: H0, useLayoutEffect: K0, useMemo: Q0, useReducer: Fm, useRef: z0, useState: function() { return Fm(cc); }, useDebugValue: Um, useDeferredValue: function(o) { var u = Zr(); return Dn === null ? u.memoizedState = o : J0(u, Dn.memoizedState, o); }, useTransition: function() { var o = Fm(cc)[0], u = Zr().memoizedState; return [o, u]; }, useMutableSource: F0, useSyncExternalStore: L0, useId: X0, unstable_isNewReconciler: !1 }; function yi(o, u) { if (o && o.defaultProps) { u = B({}, u), o = o.defaultProps; for (var c in o) u[c] === void 0 && (u[c] = o[c]); return u; } return u; } function Mm(o, u, c, m) { u = o.memoizedState, c = c(m, u), c = c == null ? u : B({}, u, c), o.memoizedState = c, o.lanes === 0 && (o.updateQueue.baseState = c); } var Cf = { isMounted: function(o) { return (o = o._reactInternals) ? Wn(o) === o : !1; }, enqueueSetState: function(o, u, c) { o = o._reactInternals; var m = lr(), w = ho(o), S = As(m, w); S.payload = u, c != null && (S.callback = c), u = uo(o, S, w), u !== null && (Si(u, o, w, m), yf(u, o, w)); }, enqueueReplaceState: function(o, u, c) { o = o._reactInternals; var m = lr(), w = ho(o), S = As(m, w); S.tag = 1, S.payload = u, c != null && (S.callback = c), u = uo(o, S, w), u !== null && (Si(u, o, w, m), yf(u, o, w)); }, enqueueForceUpdate: function(o, u) { o = o._reactInternals; var c = lr(), m = ho(o), w = As(c, m); w.tag = 2, u != null && (w.callback = u), u = uo(o, w, m), u !== null && (Si(u, o, m, c), yf(u, o, m)); } }; function n_(o, u, c, m, w, S, I) { return o = o.stateNode, typeof o.shouldComponentUpdate == "function" ? o.shouldComponentUpdate(m, S, I) : u.prototype && u.prototype.isPureReactComponent ? !oe(c, m) || !oe(w, S) : !0; } function r_(o, u, c) { var m = !1, w = so, S = u.contextType; return typeof S == "object" && S !== null ? S = Xr(S) : (w = vr(u) ? la : Xn.current, m = u.contextTypes, S = (m = m != null) ? xu(o, w) : so), u = new u(c, S), o.memoizedState = u.state !== null && u.state !== void 0 ? u.state : null, u.updater = Cf, o.stateNode = u, u._reactInternals = o, m && (o = o.stateNode, o.__reactInternalMemoizedUnmaskedChildContext = w, o.__reactInternalMemoizedMaskedChildContext = S), u; } function i_(o, u, c, m) { o = u.state, typeof u.componentWillReceiveProps == "function" && u.componentWillReceiveProps(c, m), typeof u.UNSAFE_componentWillReceiveProps == "function" && u.UNSAFE_componentWillReceiveProps(c, m), u.state !== o && Cf.enqueueReplaceState(u, u.state, null); } function Bm(o, u, c, m) { var w = o.stateNode; w.props = c, w.state = o.memoizedState, w.refs = {}, Am(o); var S = u.contextType; typeof S == "object" && S !== null ? w.context = Xr(S) : (S = vr(u) ? la : Xn.current, w.context = xu(o, S)), w.state = o.memoizedState, S = u.getDerivedStateFromProps, typeof S == "function" && (Mm(o, u, S, c), w.state = o.memoizedState), typeof u.getDerivedStateFromProps == "function" || typeof w.getSnapshotBeforeUpdate == "function" || typeof w.UNSAFE_componentWillMount != "function" && typeof w.componentWillMount != "function" || (u = w.state, typeof w.componentWillMount == "function" && w.componentWillMount(), typeof w.UNSAFE_componentWillMount == "function" && w.UNSAFE_componentWillMount(), u !== w.state && Cf.enqueueReplaceState(w, w.state, null), wf(o, c, w, m), w.state = o.memoizedState), typeof w.componentDidMount == "function" && (o.flags |= 4194308); } function Fu(o, u) { try { var c = "", m = u; do c += Q(m), m = m.return; while (m); var w = c; } catch (S) { w = ` Error generating stack: ` + S.message + ` ` + S.stack; } return { value: o, source: u, stack: w, digest: null }; } function jm(o, u, c) { return { value: o, source: null, stack: c ?? null, digest: u ?? null }; } function $m(o, u) { try { console.error(u.value); } catch (c) { setTimeout(function() { throw c; }); } } var OT = typeof WeakMap == "function" ? WeakMap : Map; function s_(o, u, c) { c = As(-1, c), c.tag = 3, c.payload = { element: null }; var m = u.value; return c.callback = function() { Pf || (Pf = !0, ng = m), $m(o, u); }, c; } function o_(o, u, c) { c = As(-1, c), c.tag = 3; var m = o.type.getDerivedStateFromError; if (typeof m == "function") { var w = u.value; c.payload = function() { return m(w); }, c.callback = function() { $m(o, u); }; } var S = o.stateNode; return S !== null && typeof S.componentDidCatch == "function" && (c.callback = function() { $m(o, u), typeof m != "function" && (co === null ? co = /* @__PURE__ */ new Set([this]) : co.add(this)); var I = u.stack; this.componentDidCatch(u.value, { componentStack: I !== null ? I : "" }); }), c; } function a_(o, u, c) { var m = o.pingCache; if (m === null) { m = o.pingCache = new OT(); var w = /* @__PURE__ */ new Set(); m.set(u, w); } else w = m.get(u), w === void 0 && (w = /* @__PURE__ */ new Set(), m.set(u, w)); w.has(c) || (w.add(c), o = KT.bind(null, o, u, c), u.then(o, o)); } function u_(o) { do { var u; if ((u = o.tag === 13) && (u = o.memoizedState, u = u !== null ? u.dehydrated !== null : !0), u) return o; o = o.return; } while (o !== null); return null; } function l_(o, u, c, m, w) { return o.mode & 1 ? (o.flags |= 65536, o.lanes = w, o) : (o === u ? o.flags |= 65536 : (o.flags |= 128, c.flags |= 131072, c.flags &= -52805, c.tag === 1 && (c.alternate === null ? c.tag = 17 : (u = As(-1, 1), u.tag = 2, uo(c, u, 1))), c.lanes |= 1), o); } var PT = j.ReactCurrentOwner, yr = !1; function ur(o, u, c, m) { u.child = o === null ? T0(u, null, c, m) : Ru(u, o.child, c, m); } function c_(o, u, c, m, w) { c = c.render; var S = u.ref; return Pu(u, w), m = Om(o, u, c, m, S, w), c = Pm(), o !== null && !yr ? (u.updateQueue = o.updateQueue, u.flags &= -2053, o.lanes &= ~w, Cs(o, u, w)) : (vn && c && mm(u), u.flags |= 1, ur(o, u, m, w), u.child); } function d_(o, u, c, m, w) { if (o === null) { var S = c.type; return typeof S == "function" && !lg(S) && S.defaultProps === void 0 && c.compare === null && c.defaultProps === void 0 ? (u.tag = 15, u.type = S, f_(o, u, S, m, w)) : (o = Bf(c.type, null, m, u, u.mode, w), o.ref = u.ref, o.return = u, u.child = o); } if (S = o.child, !(o.lanes & w)) { var I = S.memoizedProps; if (c = c.compare, c = c !== null ? c : oe, c(I, m) && o.ref === u.ref) return Cs(o, u, w); } return u.flags |= 1, o = mo(S, m), o.ref = u.ref, o.return = u, u.child = o; } function f_(o, u, c, m, w) { if (o !== null) { var S = o.memoizedProps; if (oe(S, m) && o.ref === u.ref) if (yr = !1, u.pendingProps = m = S, (o.lanes & w) !== 0) o.flags & 131072 && (yr = !0); else return u.lanes = o.lanes, Cs(o, u, w); } return Vm(o, u, c, m, w); } function h_(o, u, c) { var m = u.pendingProps, w = m.children, S = o !== null ? o.memoizedState : null; if (m.mode === "hidden") if (!(u.mode & 1)) u.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, un(Uu, Mr), Mr |= c; else { if (!(c & 1073741824)) return o = S !== null ? S.baseLanes | c : c, u.lanes = u.childLanes = 1073741824, u.memoizedState = { baseLanes: o, cachePool: null, transitions: null }, u.updateQueue = null, un(Uu, Mr), Mr |= o, null; u.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, m = S !== null ? S.baseLanes : c, un(Uu, Mr), Mr |= m; } else S !== null ? (m = S.baseLanes | c, u.memoizedState = null) : m = c, un(Uu, Mr), Mr |= m; return ur(o, u, w, c), u.child; } function p_(o, u) { var c = u.ref; (o === null && c !== null || o !== null && o.ref !== c) && (u.flags |= 512, u.flags |= 2097152); } function Vm(o, u, c, m, w) { var S = vr(c) ? la : Xn.current; return S = xu(u, S), Pu(u, w), c = Om(o, u, c, m, S, w), m = Pm(), o !== null && !yr ? (u.updateQueue = o.updateQueue, u.flags &= -2053, o.lanes &= ~w, Cs(o, u, w)) : (vn && m && mm(u), u.flags |= 1, ur(o, u, c, w), u.child); } function m_(o, u, c, m, w) { if (vr(c)) { var S = !0; cf(u); } else S = !1; if (Pu(u, w), u.stateNode === null) Nf(o, u), r_(u, c, m), Bm(u, c, m, w), m = !0; else if (o === null) { var I = u.stateNode, V = u.memoizedProps; I.props = V; var G = I.context, me = c.contextType; typeof me == "object" && me !== null ? me = Xr(me) : (me = vr(c) ? la : Xn.current, me = xu(u, me)); var Me = c.getDerivedStateFromProps, je = typeof Me == "function" || typeof I.getSnapshotBeforeUpdate == "function"; je || typeof I.UNSAFE_componentWillReceiveProps != "function" && typeof I.componentWillReceiveProps != "function" || (V !== m || G !== me) && i_(u, I, m, me), ao = !1; var Le = u.memoizedState; I.state = Le, wf(u, m, I, w), G = u.memoizedState, V !== m || Le !== G || gr.current || ao ? (typeof Me == "function" && (Mm(u, c, Me, m), G = u.memoizedState), (V = ao || n_(u, c, V, m, Le, G, me)) ? (je || 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" && (u.flags |= 4194308)) : (typeof I.componentDidMount == "function" && (u.flags |= 4194308), u.memoizedProps = m, u.memoizedState = G), I.props = m, I.state = G, I.context = me, m = V) : (typeof I.componentDidMount == "function" && (u.flags |= 4194308), m = !1); } else { I = u.stateNode, R0(o, u), V = u.memoizedProps, me = u.type === u.elementType ? V : yi(u.type, V), I.props = me, je = u.pendingProps, Le = I.context, G = c.contextType, typeof G == "object" && G !== null ? G = Xr(G) : (G = vr(c) ? la : Xn.current, G = xu(u, G)); var nt = c.getDerivedStateFromProps; (Me = typeof nt == "function" || typeof I.getSnapshotBeforeUpdate == "function") || typeof I.UNSAFE_componentWillReceiveProps != "function" && typeof I.componentWillReceiveProps != "function" || (V !== je || Le !== G) && i_(u, I, m, G), ao = !1, Le = u.memoizedState, I.state = Le, wf(u, m, I, w); var at = u.memoizedState; V !== je || Le !== at || gr.current || ao ? (typeof nt == "function" && (Mm(u, c, nt, m), at = u.memoizedState), (me = ao || n_(u, c, me, m, Le, at, G) || !1) ? (Me || typeof I.UNSAFE_componentWillUpdate != "function" && typeof I.componentWillUpdate != "function" || (typeof I.componentWillUpdate == "function" && I.componentWillUpdate(m, at, G), typeof I.UNSAFE_componentWillUpdate == "function" && I.UNSAFE_componentWillUpdate(m, at, G)), typeof I.componentDidUpdate == "function" && (u.flags |= 4), typeof I.getSnapshotBeforeUpdate == "function" && (u.flags |= 1024)) : (typeof I.componentDidUpdate != "function" || V === o.memoizedProps && Le === o.memoizedState || (u.flags |= 4), typeof I.getSnapshotBeforeUpdate != "function" || V === o.memoizedProps && Le === o.memoizedState || (u.flags |= 1024), u.memoizedProps = m, u.memoizedState = at), I.props = m, I.state = at, I.context = G, m = me) : (typeof I.componentDidUpdate != "function" || V === o.memoizedProps && Le === o.memoizedState || (u.flags |= 4), typeof I.getSnapshotBeforeUpdate != "function" || V === o.memoizedProps && Le === o.memoizedState || (u.flags |= 1024), m = !1); } return zm(o, u, c, m, S, w); } function zm(o, u, c, m, w, S) { p_(o, u); var I = (u.flags & 128) !== 0; if (!m && !I) return w && _0(u, c, !1), Cs(o, u, S); m = u.stateNode, PT.current = u; var V = I && typeof c.getDerivedStateFromError != "function" ? null : m.render(); return u.flags |= 1, o !== null && I ? (u.child = Ru(u, o.child, null, S), u.child = Ru(u, null, V, S)) : ur(o, u, V, S), u.memoizedState = m.state, w && _0(u, c, !0), u.child; } function g_(o) { var u = o.stateNode; u.pendingContext ? y0(o, u.pendingContext, u.pendingContext !== u.context) : u.context && y0(o, u.context, !1), Cm(o, u.containerInfo); } function v_(o, u, c, m, w) { return Iu(), wm(w), u.flags |= 256, ur(o, u, c, m), u.child; } var qm = { dehydrated: null, treeContext: null, retryLane: 0 }; function Hm(o) { return { baseLanes: o, cachePool: null, transitions: null }; } function y_(o, u, c) { var m = u.pendingProps, w = wn.current, S = !1, I = (u.flags & 128) !== 0, V; if ((V = I) || (V = o !== null && o.memoizedState === null ? !1 : (w & 2) !== 0), V ? (S = !0, u.flags &= -129) : (o === null || o.memoizedState !== null) && (w |= 1), un(wn, w & 1), o === null) return ym(u), o = u.memoizedState, o !== null && (o = o.dehydrated, o !== null) ? (u.mode & 1 ? o.data === "$!" ? u.lanes = 8 : u.lanes = 1073741824 : u.lanes = 1, null) : (I = m.children, o = m.fallback, S ? (m = u.mode, S = u.child, I = { mode: "hidden", children: I }, !(m & 1) && S !== null ? (S.childLanes = 0, S.pendingProps = I) : S = jf(I, m, 0, null), o = wa(o, m, c, null), S.return = u, o.return = u, S.sibling = o, u.child = S, u.child.memoizedState = Hm(c), u.memoizedState = qm, o) : Km(u, I)); if (w = o.memoizedState, w !== null && (V = w.dehydrated, V !== null)) return DT(o, u, I, m, V, w, c); if (S) { S = m.fallback, I = u.mode, w = o.child, V = w.sibling; var G = { mode: "hidden", children: m.children }; return !(I & 1) && u.child !== w ? (m = u.child, m.childLanes = 0, m.pendingProps = G, u.deletions = null) : (m = mo(w, G), m.subtreeFlags = w.subtreeFlags & 14680064), V !== null ? S = mo(V, S) : (S = wa(S, I, c, null), S.flags |= 2), S.return = u, m.return = u, m.sibling = S, u.child = m, m = S, S = u.child, I = o.child.memoizedState, I = I === null ? Hm(c) : { baseLanes: I.baseLanes | c, cachePool: null, transitions: I.transitions }, S.memoizedState = I, S.childLanes = o.childLanes & ~c, u.memoizedState = qm, m; } return S = o.child, o = S.sibling, m = mo(S, { mode: "visible", children: m.children }), !(u.mode & 1) && (m.lanes = c), m.return = u, m.sibling = null, o !== null && (c = u.deletions, c === null ? (u.deletions = [o], u.flags |= 16) : c.push(o)), u.child = m, u.memoizedState = null, m; } function Km(o, u) { return u = jf({ mode: "visible", children: u }, o.mode, 0, null), u.return = o, o.child = u; } function xf(o, u, c, m) { return m !== null && wm(m), Ru(u, o.child, null, c), o = Km(u, u.pendingProps.children), o.flags |= 2, u.memoizedState = null, o; } function DT(o, u, c, m, w, S, I) { if (c) return u.flags & 256 ? (u.flags &= -257, m = jm(Error(n(422))), xf(o, u, I, m)) : u.memoizedState !== null ? (u.child = o.child, u.flags |= 128, null) : (S = m.fallback, w = u.mode, m = jf({ mode: "visible", children: m.children }, w, 0, null), S = wa(S, w, I, null), S.flags |= 2, m.return = u, S.return = u, m.sibling = S, u.child = m, u.mode & 1 && Ru(u, o.child, null, I), u.child.memoizedState = Hm(I), u.memoizedState = qm, S); if (!(u.mode & 1)) return xf(o, u, I, null); if (w.data === "$!") { if (m = w.nextSibling && w.nextSibling.dataset, m) var V = m.dgst; return m = V, S = Error(n(419)), m = jm(S, m, void 0), xf(o, u, I, m); } if (V = (I & o.childLanes) !== 0, yr || V) { if (m = Mn, 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 : w, w !== 0 && w !== S.retryLane && (S.retryLane = w, Es(o, w), Si(m, o, w, -1)); } return ug(), m = jm(Error(n(421))), xf(o, u, I, m); } return w.data === "$?" ? (u.flags |= 128, u.child = o.child, u = GT.bind(null, o), w._reactRetry = u, null) : (o = S.treeContext, Ur = ro(w.nextSibling), Lr = u, vn = !0, vi = null, o !== null && (Qr[Jr++] = bs, Qr[Jr++] = ks, Qr[Jr++] = ca, bs = o.id, ks = o.overflow, ca = u), u = Km(u, m.children), u.flags |= 4096, u); } function w_(o, u, c) { o.lanes |= u; var m = o.alternate; m !== null && (m.lanes |= u), km(o.return, u, c); } function Gm(o, u, c, m, w) { var S = o.memoizedState; S === null ? o.memoizedState = { isBackwards: u, rendering: null, renderingStartTime: 0, last: m, tail: c, tailMode: w } : (S.isBackwards = u, S.rendering = null, S.renderingStartTime = 0, S.last = m, S.tail = c, S.tailMode = w); } function __(o, u, c) { var m = u.pendingProps, w = m.revealOrder, S = m.tail; if (ur(o, u, m.children, c), m = wn.current, m & 2) m = m & 1 | 2, u.flags |= 128; else { if (o !== null && o.flags & 128) e: for (o = u.child; o !== null; ) { if (o.tag === 13) o.memoizedState !== null && w_(o, c, u); else if (o.tag === 19) w_(o, c, u); else if (o.child !== null) { o.child.return = o, o = o.child; continue; } if (o === u) break e; for (; o.sibling === null; ) { if (o.return === null || o.return === u) break e; o = o.return; } o.sibling.return = o.return, o = o.sibling; } m &= 1; } if (un(wn, m), !(u.mode & 1)) u.memoizedState = null; else switch (w) { case "forwards": for (c = u.child, w = null; c !== null; ) o = c.alternate, o !== null && _f(o) === null && (w = c), c = c.sibling; c = w, c === null ? (w = u.child, u.child = null) : (w = c.sibling, c.sibling = null), Gm(u, !1, w, c, S); break; case "backwards": for (c = null, w = u.child, u.child = null; w !== null; ) { if (o = w.alternate, o !== null && _f(o) === null) { u.child = w; break; } o = w.sibling, w.sibling = c, c = w, w = o; } Gm(u, !0, c, null, S); break; case "together": Gm(u, !1, null, null, void 0); break; default: u.memoizedState = null; } return u.child; } function Nf(o, u) { !(u.mode & 1) && o !== null && (o.alternate = null, u.alternate = null, u.flags |= 2); } function Cs(o, u, c) { if (o !== null && (u.dependencies = o.dependencies), ma |= u.lanes, !(c & u.childLanes)) return null; if (o !== null && u.child !== o.child) throw Error(n(153)); if (u.child !== null) { for (o = u.child, c = mo(o, o.pendingProps), u.child = c, c.return = u; o.sibling !== null; ) o = o.sibling, c = c.sibling = mo(o, o.pendingProps), c.return = u; c.sibling = null; } return u.child; } function FT(o, u, c) { switch (u.tag) { case 3: g_(u), Iu(); break; case 5: D0(u); break; case 1: vr(u.type) && cf(u); break; case 4: Cm(u, u.stateNode.containerInfo); break; case 10: var m = u.type._context, w = u.memoizedProps.value; un(gf, m._currentValue), m._currentValue = w; break; case 13: if (m = u.memoizedState, m !== null) return m.dehydrated !== null ? (un(wn, wn.current & 1), u.flags |= 128, null) : c & u.child.childLanes ? y_(o, u, c) : (un(wn, wn.current & 1), o = Cs(o, u, c), o !== null ? o.sibling : null); un(wn, wn.current & 1); break; case 19: if (m = (c & u.childLanes) !== 0, o.flags & 128) { if (m) return __(o, u, c); u.flags |= 128; } if (w = u.memoizedState, w !== null && (w.rendering = null, w.tail = null, w.lastEffect = null), un(wn, wn.current), m) break; return null; case 22: case 23: return u.lanes = 0, h_(o, u, c); } return Cs(o, u, c); } var S_, Wm, b_, k_; S_ = function(o, u) { for (var c = u.child; c !== null; ) { if (c.tag === 5 || c.tag === 6) o.appendChild(c.stateNode); else if (c.tag !== 4 && c.child !== null) { c.child.return = c, c = c.child; continue; } if (c === u) break; for (; c.sibling === null; ) { if (c.return === null || c.return === u) return; c = c.return; } c.sibling.return = c.return, c = c.sibling; } }, Wm = function() { }, b_ = function(o, u, c, m) { var w = o.memoizedProps; if (w !== m) { o = u.stateNode, ha(Yi.current); var S = null; switch (c) { case "input": w = Ot(o, w), m = Ot(o, m), S = []; break; case "select": w = B({}, w, { value: void 0 }), m = B({}, m, { value: void 0 }), S = []; break; case "textarea": w = ee(o, w), m = ee(o, m), S = []; break; default: typeof w.onClick != "function" && typeof m.onClick == "function" && (o.onclick = af); } lt(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) ? S || (S = []) : (S = S || []).push(me, null)); for (me in m) { var G = m[me]; if (V = w != null ? w[me] : void 0, 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 || (S || (S = []), S.push( me, c )), c = G; else me === "dangerouslySetInnerHTML" ? (G = G ? G.__html : void 0, V = V ? V.__html : void 0, G != null && V !== G && (S = S || []).push(me, G)) : me === "children" ? typeof G != "string" && typeof G != "number" || (S = S || []).push(me, "" + G) : me !== "suppressContentEditableWarning" && me !== "suppressHydrationWarning" && (i.hasOwnProperty(me) ? (G != null && me === "onScroll" && hn("scroll", o), S || V === G || (S = [])) : (S = S || []).push(me, G)); } c && (S = S || []).push("style", c); var me = S; (u.updateQueue = me) && (u.flags |= 4); } }, k_ = function(o, u, c, m) { c !== m && (u.flags |= 4); }; function fc(o, u) { if (!vn) switch (o.tailMode) { case "hidden": u = o.tail; for (var c = null; u !== null; ) u.alternate !== null && (c = u), u = u.sibling; c === null ? o.tail = null : c.sibling = null; break; case "collapsed": c = o.tail; for (var m = null; c !== null; ) c.alternate !== null && (m = c), c = c.sibling; m === null ? u || o.tail === null ? o.tail = null : o.tail.sibling = null : m.sibling = null; } } function er(o) { var u = o.alternate !== null && o.alternate.child === o.child, c = 0, m = 0; if (u) for (var w = o.child; w !== null; ) c |= w.lanes | w.childLanes, m |= w.subtreeFlags & 14680064, m |= w.flags & 14680064, w.return = o, w = w.sibling; else for (w = o.child; w !== null; ) c |= w.lanes | w.childLanes, m |= w.subtreeFlags, m |= w.flags, w.return = o, w = w.sibling; return o.subtreeFlags |= m, o.childLanes = c, u; } function LT(o, u, c) { var m = u.pendingProps; switch (gm(u), u.tag) { case 2: case 16: case 15: case 0: case 11: case 7: case 8: case 12: case 9: case 14: return er(u), null; case 1: return vr(u.type) && lf(), er(u), null; case 3: return m = u.stateNode, Du(), pn(gr), pn(Xn), Tm(), m.pendingContext && (m.context = m.pendingContext, m.pendingContext = null), (o === null || o.child === null) && (pf(u) ? u.flags |= 4 : o === null || o.memoizedState.isDehydrated && !(u.flags & 256) || (u.flags |= 1024, vi !== null && (sg(vi), vi = null))), Wm(o, u), er(u), null; case 5: xm(u); var w = ha(ac.current); if (c = u.type, o !== null && u.stateNode != null) b_(o, u, c, m, w), o.ref !== u.ref && (u.flags |= 512, u.flags |= 2097152); else { if (!m) { if (u.stateNode === null) throw Error(n(166)); return er(u), null; } if (o = ha(Yi.current), pf(u)) { m = u.stateNode, c = u.type; var S = u.memoizedProps; switch (m[Wi] = u, m[nc] = S, o = (u.mode & 1) !== 0, c) { case "dialog": hn("cancel", m), hn("close", m); break; case "iframe": case "object": case "embed": hn("load", m); break; case "video": case "audio": for (w = 0; w < Zl.length; w++) hn(Zl[w], m); break; case "source": hn("error", m); break; case "img": case "image": case "link": hn( "error", m ), hn("load", m); break; case "details": hn("toggle", m); break; case "input": et(m, S), hn("invalid", m); break; case "select": m._wrapperState = { wasMultiple: !!S.multiple }, hn("invalid", m); break; case "textarea": be(m, S), hn("invalid", m); } lt(c, S), w = null; for (var I in S) if (S.hasOwnProperty(I)) { var V = S[I]; I === "children" ? typeof V == "string" ? m.textContent !== V && (S.suppressHydrationWarning !== !0 && of(m.textContent, V, o), w = ["children", V]) : typeof V == "number" && m.textContent !== "" + V && (S.suppressHydrationWarning !== !0 && of( m.textContent, V, o ), w = ["children", "" + V]) : i.hasOwnProperty(I) && V != null && I === "onScroll" && hn("scroll", m); } switch (c) { case "input": ht(m), D(m, S, !0); break; case "textarea": ht(m), bt(m); break; case "select": case "option": break; default: typeof S.onClick == "function" && (m.onclick = af); } m = w, u.updateQueue = m, m !== null && (u.flags |= 4); } else { I = w.nodeType === 9 ? w : w.ownerDocument, o === "http://www.w3.org/1999/xhtml" && (o = Ct(c)), o === "http://www.w3.org/1999/xhtml" ? c === "script" ? (o = I.createElement("div"), o.innerHTML = "