From 2d079b0cd126f6b6ed75ad24daf8a0263be8ab23 Mon Sep 17 00:00:00 2001 From: Mansoo Kim Date: Thu, 19 Sep 2024 18:12:39 +0900 Subject: [PATCH 1/2] feat: improve healthcare widget according to Figma --- ...ck-b12db20a.mjs => CodeBlock-db37a122.mjs} | 2 +- ...7e1.mjs => __bundle-2aa1a987-3bdc2be0.mjs} | 2 +- ...b11.mjs => __bundle-aece11ae-2f28d267.mjs} | 2 +- ...cae.mjs => __bundle-ba2b9764-739f3c15.mjs} | 2 +- ...fe811.mjs => bundle-f5U_VL0z-3d033522.mjs} | 2 +- dist/index-44b54645.mjs | 52013 --------------- dist/index-ddf5b5ad.mjs | 52048 ++++++++++++++++ dist/index.es.js | 2 +- dist/index.umd.js | 635 +- .../CustomHealthcareMessageInput.tsx | 293 +- src/icons/modal-background.svg | 14 + src/utils/category.ts | 2 +- 12 files changed, 52568 insertions(+), 52449 deletions(-) rename dist/{CodeBlock-b12db20a.mjs => CodeBlock-db37a122.mjs} (87%) rename dist/{__bundle-2aa1a987-887417e1.mjs => __bundle-2aa1a987-3bdc2be0.mjs} (99%) rename dist/{__bundle-aece11ae-f5e6bb11.mjs => __bundle-aece11ae-2f28d267.mjs} (98%) rename dist/{__bundle-ba2b9764-6b781cae.mjs => __bundle-ba2b9764-739f3c15.mjs} (99%) rename dist/{bundle-f5U_VL0z-812fe811.mjs => bundle-f5U_VL0z-3d033522.mjs} (99%) delete mode 100644 dist/index-44b54645.mjs create mode 100644 dist/index-ddf5b5ad.mjs create mode 100644 src/icons/modal-background.svg diff --git a/dist/CodeBlock-b12db20a.mjs b/dist/CodeBlock-db37a122.mjs similarity index 87% rename from dist/CodeBlock-b12db20a.mjs rename to dist/CodeBlock-db37a122.mjs index 3a9e4498f..ceaeb945e 100644 --- a/dist/CodeBlock-b12db20a.mjs +++ b/dist/CodeBlock-db37a122.mjs @@ -1,4 +1,4 @@ -import { j as e } from "./index-44b54645.mjs"; +import { j as e } from "./index-ddf5b5ad.mjs"; import { CopyBlock as r, irBlack as t } from "react-code-blocks"; import "react"; import "react-dom"; diff --git a/dist/__bundle-2aa1a987-887417e1.mjs b/dist/__bundle-2aa1a987-3bdc2be0.mjs similarity index 99% rename from dist/__bundle-2aa1a987-887417e1.mjs rename to dist/__bundle-2aa1a987-3bdc2be0.mjs index 47b04c37d..36a55e4b8 100644 --- a/dist/__bundle-2aa1a987-887417e1.mjs +++ b/dist/__bundle-2aa1a987-3bdc2be0.mjs @@ -1,4 +1,4 @@ -import { c as F } from "./index-44b54645.mjs"; +import { c as F } from "./index-ddf5b5ad.mjs"; function I(s, h) { for (var b = 0; b < h.length; b++) { const c = h[b]; diff --git a/dist/__bundle-aece11ae-f5e6bb11.mjs b/dist/__bundle-aece11ae-2f28d267.mjs similarity index 98% rename from dist/__bundle-aece11ae-f5e6bb11.mjs rename to dist/__bundle-aece11ae-2f28d267.mjs index 038d892ce..f55c34a59 100644 --- a/dist/__bundle-aece11ae-f5e6bb11.mjs +++ b/dist/__bundle-aece11ae-2f28d267.mjs @@ -1,4 +1,4 @@ -import { L as S, g as s, R as X, a as m, P as y, Y as I, H as N, X as b } from "./index-44b54645.mjs"; +import { L as S, g as s, R as X, a as m, P as y, Y as I, H as N, X as b } from "./index-ddf5b5ad.mjs"; import "react"; import "react-dom"; var k = function(i, o) { diff --git a/dist/__bundle-ba2b9764-6b781cae.mjs b/dist/__bundle-ba2b9764-739f3c15.mjs similarity index 99% rename from dist/__bundle-ba2b9764-6b781cae.mjs rename to dist/__bundle-ba2b9764-739f3c15.mjs index baf1e7a54..7c239ba4e 100644 --- a/dist/__bundle-ba2b9764-6b781cae.mjs +++ b/dist/__bundle-ba2b9764-739f3c15.mjs @@ -1,4 +1,4 @@ -import { c as g } from "./index-44b54645.mjs"; +import { c as g } from "./index-ddf5b5ad.mjs"; function H(e, t) { for (var o = 0; o < t.length; o++) { const s = t[o]; diff --git a/dist/bundle-f5U_VL0z-812fe811.mjs b/dist/bundle-f5U_VL0z-3d033522.mjs similarity index 99% rename from dist/bundle-f5U_VL0z-812fe811.mjs rename to dist/bundle-f5U_VL0z-3d033522.mjs index 142121ed9..bbfa3970e 100644 --- a/dist/bundle-f5U_VL0z-812fe811.mjs +++ b/dist/bundle-f5U_VL0z-3d033522.mjs @@ -1,4 +1,4 @@ -import { V as g2 } from "./index-44b54645.mjs"; +import { V as g2 } from "./index-ddf5b5ad.mjs"; import "react"; import "react-dom"; function Mt(H) { diff --git a/dist/index-44b54645.mjs b/dist/index-44b54645.mjs deleted file mode 100644 index 88bd6510e..000000000 --- a/dist/index-44b54645.mjs +++ /dev/null @@ -1,52013 +0,0 @@ -var Kv = (e, n, t) => { - if (!n.has(e)) - throw TypeError("Cannot " + t); -}; -var Z = (e, n, t) => (Kv(e, n, "read from private field"), t ? t.call(e) : n.get(e)), It = (e, n, t) => { - if (n.has(e)) - throw TypeError("Cannot add the same private member more than once"); - n instanceof WeakSet ? n.add(e) : n.set(e, t); -}, gt = (e, n, t, r) => (Kv(e, n, "write to private field"), r ? r.call(e, t) : n.set(e, t), t), Rh = (e, n, t, r) => ({ - set _(i) { - gt(e, n, i, t); - }, - get _() { - return Z(e, n, r); - } -}), hn = (e, n, t) => (Kv(e, n, "access private method"), t); -import * as R from "react"; -import g, { useRef as yt, useContext as Lt, createElement as ni, useCallback as Qt, createContext as Zr, useState as Ee, useEffect as Ye, useLayoutEffect as ba, useMemo as nn, useReducer as Lu, Component as f1, useInsertionEffect as J3, forwardRef as Rl, useId as p1, cloneElement as $3, Children as ew, isValidElement as Zx, useImperativeHandle as Qx, lazy as Xx, Suspense as Jx, Fragment as $x } from "react"; -import * as tw from "react-dom"; -import { createPortal as Ms } from "react-dom"; -var Are = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function nw(e) { - return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; -} -var bm = { exports: {} }, $c = {}; -/** - * @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 h_; -function e4() { - if (h_) - return $c; - h_ = 1; - var e = g, n = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 }; - function o(s, c, l) { - var u, d = {}, h = null, f = null; - l !== void 0 && (h = "" + l), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (f = c.ref); - for (u in c) - r.call(c, u) && !a.hasOwnProperty(u) && (d[u] = c[u]); - if (s && s.defaultProps) - for (u in c = s.defaultProps, c) - d[u] === void 0 && (d[u] = c[u]); - return { $$typeof: n, type: s, key: h, ref: f, props: d, _owner: i.current }; - } - return $c.Fragment = t, $c.jsx = o, $c.jsxs = o, $c; -} -var eu = {}; -/** - * @license React - * react-jsx-runtime.development.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 f_; -function t4() { - return f_ || (f_ = 1, process.env.NODE_ENV !== "production" && function() { - var e = g, n = Symbol.for("react.element"), t = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), s = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), f = Symbol.for("react.offscreen"), p = Symbol.iterator, v = "@@iterator"; - function m(F) { - if (F === null || typeof F != "object") - return null; - var he = p && F[p] || F[v]; - return typeof he == "function" ? he : null; - } - var E = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - function y(F) { - { - for (var he = arguments.length, be = new Array(he > 1 ? he - 1 : 0), je = 1; je < he; je++) - be[je - 1] = arguments[je]; - _("error", F, be); - } - } - function _(F, he, be) { - { - var je = E.ReactDebugCurrentFrame, ft = je.getStackAddendum(); - ft !== "" && (he += "%s", be = be.concat([ft])); - var Se = be.map(function(V) { - return String(V); - }); - Se.unshift("Warning: " + he), Function.prototype.apply.call(console[F], console, Se); - } - } - var S = !1, b = !1, A = !1, w = !1, M = !1, N; - N = Symbol.for("react.module.reference"); - function x(F) { - return !!(typeof F == "string" || typeof F == "function" || F === r || F === a || M || F === i || F === l || F === u || w || F === f || S || b || A || typeof F == "object" && F !== null && (F.$$typeof === h || F.$$typeof === d || F.$$typeof === o || F.$$typeof === s || F.$$typeof === c || // This needs to include all possible module reference object - // types supported by any Flight configuration anywhere since - // we don't know which Flight build this will end up being used - // with. - F.$$typeof === N || F.getModuleId !== void 0)); - } - function D(F, he, be) { - var je = F.displayName; - if (je) - return je; - var ft = he.displayName || he.name || ""; - return ft !== "" ? be + "(" + ft + ")" : be; - } - function j(F) { - return F.displayName || "Context"; - } - function P(F) { - if (F == null) - return null; - if (typeof F.tag == "number" && y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof F == "function") - return F.displayName || F.name || null; - if (typeof F == "string") - return F; - switch (F) { - case r: - return "Fragment"; - case t: - return "Portal"; - case a: - return "Profiler"; - case i: - return "StrictMode"; - case l: - return "Suspense"; - case u: - return "SuspenseList"; - } - if (typeof F == "object") - switch (F.$$typeof) { - case s: - var he = F; - return j(he) + ".Consumer"; - case o: - var be = F; - return j(be._context) + ".Provider"; - case c: - return D(F, F.render, "ForwardRef"); - case d: - var je = F.displayName || null; - return je !== null ? je : P(F.type) || "Memo"; - case h: { - var ft = F, Se = ft._payload, V = ft._init; - try { - return P(V(Se)); - } catch { - return null; - } - } - } - return null; - } - var G = Object.assign, z = 0, q, Y, ye, $, ae, de, re; - function K() { - } - K.__reactDisabledLog = !0; - function ee() { - { - if (z === 0) { - q = console.log, Y = console.info, ye = console.warn, $ = console.error, ae = console.group, de = console.groupCollapsed, re = console.groupEnd; - var F = { - configurable: !0, - enumerable: !0, - value: K, - writable: !0 - }; - Object.defineProperties(console, { - info: F, - log: F, - warn: F, - error: F, - group: F, - groupCollapsed: F, - groupEnd: F - }); - } - z++; - } - } - function J() { - { - if (z--, z === 0) { - var F = { - configurable: !0, - enumerable: !0, - writable: !0 - }; - Object.defineProperties(console, { - log: G({}, F, { - value: q - }), - info: G({}, F, { - value: Y - }), - warn: G({}, F, { - value: ye - }), - error: G({}, F, { - value: $ - }), - group: G({}, F, { - value: ae - }), - groupCollapsed: G({}, F, { - value: de - }), - groupEnd: G({}, F, { - value: re - }) - }); - } - z < 0 && y("disabledDepth fell below zero. This is a bug in React. Please file an issue."); - } - } - var B = E.ReactCurrentDispatcher, se; - function te(F, he, be) { - { - if (se === void 0) - try { - throw Error(); - } catch (ft) { - var je = ft.stack.trim().match(/\n( *(at )?)/); - se = je && je[1] || ""; - } - return ` -` + se + F; - } - } - var Me = !1, Ie; - { - var we = typeof WeakMap == "function" ? WeakMap : Map; - Ie = new we(); - } - function Q(F, he) { - if (!F || Me) - return ""; - { - var be = Ie.get(F); - if (be !== void 0) - return be; - } - var je; - Me = !0; - var ft = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - var Se; - Se = B.current, B.current = null, ee(); - try { - if (he) { - var V = function() { - throw Error(); - }; - if (Object.defineProperty(V.prototype, "props", { - set: function() { - throw Error(); - } - }), typeof Reflect == "object" && Reflect.construct) { - try { - Reflect.construct(V, []); - } catch (Nt) { - je = Nt; - } - Reflect.construct(F, [], V); - } else { - try { - V.call(); - } catch (Nt) { - je = Nt; - } - F.call(V.prototype); - } - } else { - try { - throw Error(); - } catch (Nt) { - je = Nt; - } - F(); - } - } catch (Nt) { - if (Nt && je && typeof Nt.stack == "string") { - for (var le = Nt.stack.split(` -`), Ue = je.stack.split(` -`), mt = le.length - 1, Tt = Ue.length - 1; mt >= 1 && Tt >= 0 && le[mt] !== Ue[Tt]; ) - Tt--; - for (; mt >= 1 && Tt >= 0; mt--, Tt--) - if (le[mt] !== Ue[Tt]) { - if (mt !== 1 || Tt !== 1) - do - if (mt--, Tt--, Tt < 0 || le[mt] !== Ue[Tt]) { - var Wt = ` -` + le[mt].replace(" at new ", " at "); - return F.displayName && Wt.includes("") && (Wt = Wt.replace("", F.displayName)), typeof F == "function" && Ie.set(F, Wt), Wt; - } - while (mt >= 1 && Tt >= 0); - break; - } - } - } finally { - Me = !1, B.current = Se, J(), Error.prepareStackTrace = ft; - } - var jt = F ? F.displayName || F.name : "", wn = jt ? te(jt) : ""; - return typeof F == "function" && Ie.set(F, wn), wn; - } - function ze(F, he, be) { - return Q(F, !1); - } - function Ce(F) { - var he = F.prototype; - return !!(he && he.isReactComponent); - } - function ke(F, he, be) { - if (F == null) - return ""; - if (typeof F == "function") - return Q(F, Ce(F)); - if (typeof F == "string") - return te(F); - switch (F) { - case l: - return te("Suspense"); - case u: - return te("SuspenseList"); - } - if (typeof F == "object") - switch (F.$$typeof) { - case c: - return ze(F.render); - case d: - return ke(F.type, he, be); - case h: { - var je = F, ft = je._payload, Se = je._init; - try { - return ke(Se(ft), he, be); - } catch { - } - } - } - return ""; - } - var et = Object.prototype.hasOwnProperty, Je = {}, ot = E.ReactDebugCurrentFrame; - function Te(F) { - if (F) { - var he = F._owner, be = ke(F.type, F._source, he ? he.type : null); - ot.setExtraStackFrame(be); - } else - ot.setExtraStackFrame(null); - } - function De(F, he, be, je, ft) { - { - var Se = Function.call.bind(et); - for (var V in F) - if (Se(F, V)) { - var le = void 0; - try { - if (typeof F[V] != "function") { - var Ue = Error((je || "React class") + ": " + be + " type `" + V + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof F[V] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); - throw Ue.name = "Invariant Violation", Ue; - } - le = F[V](he, V, je, be, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); - } catch (mt) { - le = mt; - } - le && !(le instanceof Error) && (Te(ft), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", je || "React class", be, V, typeof le), Te(null)), le instanceof Error && !(le.message in Je) && (Je[le.message] = !0, Te(ft), y("Failed %s type: %s", be, le.message), Te(null)); - } - } - } - var Ze = Array.isArray; - function Le(F) { - return Ze(F); - } - function qe(F) { - { - var he = typeof Symbol == "function" && Symbol.toStringTag, be = he && F[Symbol.toStringTag] || F.constructor.name || "Object"; - return be; - } - } - function He(F) { - try { - return Fe(F), !1; - } catch { - return !0; - } - } - function Fe(F) { - return "" + F; - } - function Ct(F) { - if (He(F)) - return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", qe(F)), Fe(F); - } - var lt = E.ReactCurrentOwner, Pt = { - key: !0, - ref: !0, - __self: !0, - __source: !0 - }, Pe, Xt, At; - At = {}; - function Yt(F) { - if (et.call(F, "ref")) { - var he = Object.getOwnPropertyDescriptor(F, "ref").get; - if (he && he.isReactWarning) - return !1; - } - return F.ref !== void 0; - } - function rn(F) { - if (et.call(F, "key")) { - var he = Object.getOwnPropertyDescriptor(F, "key").get; - if (he && he.isReactWarning) - return !1; - } - return F.key !== void 0; - } - function xt(F, he) { - if (typeof F.ref == "string" && lt.current && he && lt.current.stateNode !== he) { - var be = P(lt.current.type); - At[be] || (y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', P(lt.current.type), F.ref), At[be] = !0); - } - } - function pt(F, he) { - { - var be = function() { - Pe || (Pe = !0, y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", he)); - }; - be.isReactWarning = !0, Object.defineProperty(F, "key", { - get: be, - configurable: !0 - }); - } - } - function We(F, he) { - { - var be = function() { - Xt || (Xt = !0, y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", he)); - }; - be.isReactWarning = !0, Object.defineProperty(F, "ref", { - get: be, - configurable: !0 - }); - } - } - var Oe = function(F, he, be, je, ft, Se, V) { - var le = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: n, - // Built-in properties that belong on the element - type: F, - key: he, - ref: be, - props: V, - // Record the component responsible for creating this element. - _owner: Se - }; - return le._store = {}, Object.defineProperty(le._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: !1 - }), Object.defineProperty(le, "_self", { - configurable: !1, - enumerable: !1, - writable: !1, - value: je - }), Object.defineProperty(le, "_source", { - configurable: !1, - enumerable: !1, - writable: !1, - value: ft - }), Object.freeze && (Object.freeze(le.props), Object.freeze(le)), le; - }; - function oe(F, he, be, je, ft) { - { - var Se, V = {}, le = null, Ue = null; - be !== void 0 && (Ct(be), le = "" + be), rn(he) && (Ct(he.key), le = "" + he.key), Yt(he) && (Ue = he.ref, xt(he, ft)); - for (Se in he) - et.call(he, Se) && !Pt.hasOwnProperty(Se) && (V[Se] = he[Se]); - if (F && F.defaultProps) { - var mt = F.defaultProps; - for (Se in mt) - V[Se] === void 0 && (V[Se] = mt[Se]); - } - if (le || Ue) { - var Tt = typeof F == "function" ? F.displayName || F.name || "Unknown" : F; - le && pt(V, Tt), Ue && We(V, Tt); - } - return Oe(F, le, Ue, ft, je, lt.current, V); - } - } - var $e = E.ReactCurrentOwner, rt = E.ReactDebugCurrentFrame; - function ct(F) { - if (F) { - var he = F._owner, be = ke(F.type, F._source, he ? he.type : null); - rt.setExtraStackFrame(be); - } else - rt.setExtraStackFrame(null); - } - var Bt; - Bt = !1; - function Rt(F) { - return typeof F == "object" && F !== null && F.$$typeof === n; - } - function cn() { - { - if ($e.current) { - var F = P($e.current.type); - if (F) - return ` - -Check the render method of \`` + F + "`."; - } - return ""; - } - } - function _t(F) { - { - if (F !== void 0) { - var he = F.fileName.replace(/^.*[\\\/]/, ""), be = F.lineNumber; - return ` - -Check your code at ` + he + ":" + be + "."; - } - return ""; - } - } - var un = {}; - function vn(F) { - { - var he = cn(); - if (!he) { - var be = typeof F == "string" ? F : F.displayName || F.name; - be && (he = ` - -Check the top-level render call using <` + be + ">."); - } - return he; - } - } - function Vt(F, he) { - { - if (!F._store || F._store.validated || F.key != null) - return; - F._store.validated = !0; - var be = vn(he); - if (un[be]) - return; - un[be] = !0; - var je = ""; - F && F._owner && F._owner !== $e.current && (je = " It was passed a child from " + P(F._owner.type) + "."), ct(F), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', be, je), ct(null); - } - } - function Jt(F, he) { - { - if (typeof F != "object") - return; - if (Le(F)) - for (var be = 0; be < F.length; be++) { - var je = F[be]; - Rt(je) && Vt(je, he); - } - else if (Rt(F)) - F._store && (F._store.validated = !0); - else if (F) { - var ft = m(F); - if (typeof ft == "function" && ft !== F.entries) - for (var Se = ft.call(F), V; !(V = Se.next()).done; ) - Rt(V.value) && Vt(V.value, he); - } - } - } - function Ht(F) { - { - var he = F.type; - if (he == null || typeof he == "string") - return; - var be; - if (typeof he == "function") - be = he.propTypes; - else if (typeof he == "object" && (he.$$typeof === c || // Note: Memo only checks outer props here. - // Inner props are checked in the reconciler. - he.$$typeof === d)) - be = he.propTypes; - else - return; - if (be) { - var je = P(he); - De(be, F.props, "prop", je, F); - } else if (he.PropTypes !== void 0 && !Bt) { - Bt = !0; - var ft = P(he); - y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", ft || "Unknown"); - } - typeof he.getDefaultProps == "function" && !he.getDefaultProps.isReactClassApproved && y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); - } - } - function kt(F) { - { - for (var he = Object.keys(F.props), be = 0; be < he.length; be++) { - var je = he[be]; - if (je !== "children" && je !== "key") { - ct(F), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", je), ct(null); - break; - } - } - F.ref !== null && (ct(F), y("Invalid attribute `ref` supplied to `React.Fragment`."), ct(null)); - } - } - function Ve(F, he, be, je, ft, Se) { - { - var V = x(F); - if (!V) { - var le = ""; - (F === void 0 || typeof F == "object" && F !== null && Object.keys(F).length === 0) && (le += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); - var Ue = _t(ft); - Ue ? le += Ue : le += cn(); - var mt; - F === null ? mt = "null" : Le(F) ? mt = "array" : F !== void 0 && F.$$typeof === n ? (mt = "<" + (P(F.type) || "Unknown") + " />", le = " Did you accidentally export a JSX literal instead of a component?") : mt = typeof F, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", mt, le); - } - var Tt = oe(F, he, be, ft, Se); - if (Tt == null) - return Tt; - if (V) { - var Wt = he.children; - if (Wt !== void 0) - if (je) - if (Le(Wt)) { - for (var jt = 0; jt < Wt.length; jt++) - Jt(Wt[jt], F); - Object.freeze && Object.freeze(Wt); - } else - y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); - else - Jt(Wt, F); - } - return F === r ? kt(Tt) : Ht(Tt), Tt; - } - } - function st(F, he, be) { - return Ve(F, he, be, !0); - } - function Re(F, he, be) { - return Ve(F, he, be, !1); - } - var vt = Re, Et = st; - eu.Fragment = r, eu.jsx = vt, eu.jsxs = Et; - }()), eu; -} -process.env.NODE_ENV === "production" ? bm.exports = e4() : bm.exports = t4(); -var I = bm.exports; -var Cm = { exports: {} }, An = {}; -/** - * @license React - * react-is.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 p_; -function n4() { - if (p_) - return An; - p_ = 1; - var e = Symbol.for("react.element"), n = Symbol.for("react.portal"), t = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), o = Symbol.for("react.context"), s = Symbol.for("react.server_context"), c = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), f = Symbol.for("react.offscreen"), p; - p = Symbol.for("react.module.reference"); - function v(m) { - if (typeof m == "object" && m !== null) { - var E = m.$$typeof; - switch (E) { - case e: - switch (m = m.type, m) { - case t: - case i: - case r: - case l: - case u: - return m; - default: - switch (m = m && m.$$typeof, m) { - case s: - case o: - case c: - case h: - case d: - case a: - return m; - default: - return E; - } - } - case n: - return E; - } - } - } - return An.ContextConsumer = o, An.ContextProvider = a, An.Element = e, An.ForwardRef = c, An.Fragment = t, An.Lazy = h, An.Memo = d, An.Portal = n, An.Profiler = i, An.StrictMode = r, An.Suspense = l, An.SuspenseList = u, An.isAsyncMode = function() { - return !1; - }, An.isConcurrentMode = function() { - return !1; - }, An.isContextConsumer = function(m) { - return v(m) === o; - }, An.isContextProvider = function(m) { - return v(m) === a; - }, An.isElement = function(m) { - return typeof m == "object" && m !== null && m.$$typeof === e; - }, An.isForwardRef = function(m) { - return v(m) === c; - }, An.isFragment = function(m) { - return v(m) === t; - }, An.isLazy = function(m) { - return v(m) === h; - }, An.isMemo = function(m) { - return v(m) === d; - }, An.isPortal = function(m) { - return v(m) === n; - }, An.isProfiler = function(m) { - return v(m) === i; - }, An.isStrictMode = function(m) { - return v(m) === r; - }, An.isSuspense = function(m) { - return v(m) === l; - }, An.isSuspenseList = function(m) { - return v(m) === u; - }, An.isValidElementType = function(m) { - return typeof m == "string" || typeof m == "function" || m === t || m === i || m === r || m === l || m === u || m === f || typeof m == "object" && m !== null && (m.$$typeof === h || m.$$typeof === d || m.$$typeof === a || m.$$typeof === o || m.$$typeof === c || m.$$typeof === p || m.getModuleId !== void 0); - }, An.typeOf = v, An; -} -var Nn = {}; -/** - * @license React - * react-is.development.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 v_; -function r4() { - return v_ || (v_ = 1, process.env.NODE_ENV !== "production" && function() { - var e = Symbol.for("react.element"), n = Symbol.for("react.portal"), t = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), o = Symbol.for("react.context"), s = Symbol.for("react.server_context"), c = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), f = Symbol.for("react.offscreen"), p = !1, v = !1, m = !1, E = !1, y = !1, _; - _ = Symbol.for("react.module.reference"); - function S(Ce) { - return !!(typeof Ce == "string" || typeof Ce == "function" || Ce === t || Ce === i || y || Ce === r || Ce === l || Ce === u || E || Ce === f || p || v || m || typeof Ce == "object" && Ce !== null && (Ce.$$typeof === h || Ce.$$typeof === d || Ce.$$typeof === a || Ce.$$typeof === o || Ce.$$typeof === c || // This needs to include all possible module reference object - // types supported by any Flight configuration anywhere since - // we don't know which Flight build this will end up being used - // with. - Ce.$$typeof === _ || Ce.getModuleId !== void 0)); - } - function b(Ce) { - if (typeof Ce == "object" && Ce !== null) { - var ke = Ce.$$typeof; - switch (ke) { - case e: - var et = Ce.type; - switch (et) { - case t: - case i: - case r: - case l: - case u: - return et; - default: - var Je = et && et.$$typeof; - switch (Je) { - case s: - case o: - case c: - case h: - case d: - case a: - return Je; - default: - return ke; - } - } - case n: - return ke; - } - } - } - var A = o, w = a, M = e, N = c, x = t, D = h, j = d, P = n, G = i, z = r, q = l, Y = u, ye = !1, $ = !1; - function ae(Ce) { - return ye || (ye = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")), !1; - } - function de(Ce) { - return $ || ($ = !0, console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")), !1; - } - function re(Ce) { - return b(Ce) === o; - } - function K(Ce) { - return b(Ce) === a; - } - function ee(Ce) { - return typeof Ce == "object" && Ce !== null && Ce.$$typeof === e; - } - function J(Ce) { - return b(Ce) === c; - } - function B(Ce) { - return b(Ce) === t; - } - function se(Ce) { - return b(Ce) === h; - } - function te(Ce) { - return b(Ce) === d; - } - function Me(Ce) { - return b(Ce) === n; - } - function Ie(Ce) { - return b(Ce) === i; - } - function we(Ce) { - return b(Ce) === r; - } - function Q(Ce) { - return b(Ce) === l; - } - function ze(Ce) { - return b(Ce) === u; - } - Nn.ContextConsumer = A, Nn.ContextProvider = w, Nn.Element = M, Nn.ForwardRef = N, Nn.Fragment = x, Nn.Lazy = D, Nn.Memo = j, Nn.Portal = P, Nn.Profiler = G, Nn.StrictMode = z, Nn.Suspense = q, Nn.SuspenseList = Y, Nn.isAsyncMode = ae, Nn.isConcurrentMode = de, Nn.isContextConsumer = re, Nn.isContextProvider = K, Nn.isElement = ee, Nn.isForwardRef = J, Nn.isFragment = B, Nn.isLazy = se, Nn.isMemo = te, Nn.isPortal = Me, Nn.isProfiler = Ie, Nn.isStrictMode = we, Nn.isSuspense = Q, Nn.isSuspenseList = ze, Nn.isValidElementType = S, Nn.typeOf = b; - }()), Nn; -} -process.env.NODE_ENV === "production" ? Cm.exports = n4() : Cm.exports = r4(); -var v1 = Cm.exports; -function i4(e) { - function n(re, K, ee, J, B) { - for (var se = 0, te = 0, Me = 0, Ie = 0, we, Q, ze = 0, Ce = 0, ke, et = ke = we = 0, Je = 0, ot = 0, Te = 0, De = 0, Ze = ee.length, Le = Ze - 1, qe, He = "", Fe = "", Ct = "", lt = "", Pt; Je < Ze; ) { - if (Q = ee.charCodeAt(Je), Je === Le && te + Ie + Me + se !== 0 && (te !== 0 && (Q = te === 47 ? 10 : 47), Ie = Me = se = 0, Ze++, Le++), te + Ie + Me + se === 0) { - if (Je === Le && (0 < ot && (He = He.replace(h, "")), 0 < He.trim().length)) { - switch (Q) { - case 32: - case 9: - case 59: - case 13: - case 10: - break; - default: - He += ee.charAt(Je); - } - Q = 59; - } - switch (Q) { - case 123: - for (He = He.trim(), we = He.charCodeAt(0), ke = 1, De = ++Je; Je < Ze; ) { - switch (Q = ee.charCodeAt(Je)) { - case 123: - ke++; - break; - case 125: - ke--; - break; - case 47: - switch (Q = ee.charCodeAt(Je + 1)) { - case 42: - case 47: - e: { - for (et = Je + 1; et < Le; ++et) - switch (ee.charCodeAt(et)) { - case 47: - if (Q === 42 && ee.charCodeAt(et - 1) === 42 && Je + 2 !== et) { - Je = et + 1; - break e; - } - break; - case 10: - if (Q === 47) { - Je = et + 1; - break e; - } - } - Je = et; - } - } - break; - case 91: - Q++; - case 40: - Q++; - case 34: - case 39: - for (; Je++ < Le && ee.charCodeAt(Je) !== Q; ) - ; - } - if (ke === 0) - break; - Je++; - } - switch (ke = ee.substring(De, Je), we === 0 && (we = (He = He.replace(d, "").trim()).charCodeAt(0)), we) { - case 64: - switch (0 < ot && (He = He.replace(h, "")), Q = He.charCodeAt(1), Q) { - case 100: - case 109: - case 115: - case 45: - ot = K; - break; - default: - ot = q; - } - if (ke = n(K, ot, ke, Q, B + 1), De = ke.length, 0 < ye && (ot = t(q, He, Te), Pt = s(3, ke, ot, K, P, j, De, Q, B, J), He = ot.join(""), Pt !== void 0 && (De = (ke = Pt.trim()).length) === 0 && (Q = 0, ke = "")), 0 < De) - switch (Q) { - case 115: - He = He.replace(A, o); - case 100: - case 109: - case 45: - ke = He + "{" + ke + "}"; - break; - case 107: - He = He.replace(y, "$1 $2"), ke = He + "{" + ke + "}", ke = z === 1 || z === 2 && a("@" + ke, 3) ? "@-webkit-" + ke + "@" + ke : "@" + ke; - break; - default: - ke = He + ke, J === 112 && (ke = (Fe += ke, "")); - } - else - ke = ""; - break; - default: - ke = n(K, t(K, He, Te), ke, J, B + 1); - } - Ct += ke, ke = Te = ot = et = we = 0, He = "", Q = ee.charCodeAt(++Je); - break; - case 125: - case 59: - if (He = (0 < ot ? He.replace(h, "") : He).trim(), 1 < (De = He.length)) - switch (et === 0 && (we = He.charCodeAt(0), we === 45 || 96 < we && 123 > we) && (De = (He = He.replace(" ", ":")).length), 0 < ye && (Pt = s(1, He, K, re, P, j, Fe.length, J, B, J)) !== void 0 && (De = (He = Pt.trim()).length) === 0 && (He = "\0\0"), we = He.charCodeAt(0), Q = He.charCodeAt(1), we) { - case 0: - break; - case 64: - if (Q === 105 || Q === 99) { - lt += He + ee.charAt(Je); - break; - } - default: - He.charCodeAt(De - 1) !== 58 && (Fe += i(He, we, Q, He.charCodeAt(2))); - } - Te = ot = et = we = 0, He = "", Q = ee.charCodeAt(++Je); - } - } - switch (Q) { - case 13: - case 10: - te === 47 ? te = 0 : 1 + we === 0 && J !== 107 && 0 < He.length && (ot = 1, He += "\0"), 0 < ye * ae && s(0, He, K, re, P, j, Fe.length, J, B, J), j = 1, P++; - break; - case 59: - case 125: - if (te + Ie + Me + se === 0) { - j++; - break; - } - default: - switch (j++, qe = ee.charAt(Je), Q) { - case 9: - case 32: - if (Ie + se + te === 0) - switch (ze) { - case 44: - case 58: - case 9: - case 32: - qe = ""; - break; - default: - Q !== 32 && (qe = " "); - } - break; - case 0: - qe = "\\0"; - break; - case 12: - qe = "\\f"; - break; - case 11: - qe = "\\v"; - break; - case 38: - Ie + te + se === 0 && (ot = Te = 1, qe = "\f" + qe); - break; - case 108: - if (Ie + te + se + G === 0 && 0 < et) - switch (Je - et) { - case 2: - ze === 112 && ee.charCodeAt(Je - 3) === 58 && (G = ze); - case 8: - Ce === 111 && (G = Ce); - } - break; - case 58: - Ie + te + se === 0 && (et = Je); - break; - case 44: - te + Me + Ie + se === 0 && (ot = 1, qe += "\r"); - break; - case 34: - case 39: - te === 0 && (Ie = Ie === Q ? 0 : Ie === 0 ? Q : Ie); - break; - case 91: - Ie + te + Me === 0 && se++; - break; - case 93: - Ie + te + Me === 0 && se--; - break; - case 41: - Ie + te + se === 0 && Me--; - break; - case 40: - if (Ie + te + se === 0) { - if (we === 0) - switch (2 * ze + 3 * Ce) { - case 533: - break; - default: - we = 1; - } - Me++; - } - break; - case 64: - te + Me + Ie + se + et + ke === 0 && (ke = 1); - break; - case 42: - case 47: - if (!(0 < Ie + se + Me)) - switch (te) { - case 0: - switch (2 * Q + 3 * ee.charCodeAt(Je + 1)) { - case 235: - te = 47; - break; - case 220: - De = Je, te = 42; - } - break; - case 42: - Q === 47 && ze === 42 && De + 2 !== Je && (ee.charCodeAt(De + 2) === 33 && (Fe += ee.substring(De, Je + 1)), qe = "", te = 0); - } - } - te === 0 && (He += qe); - } - Ce = ze, ze = Q, Je++; - } - if (De = Fe.length, 0 < De) { - if (ot = K, 0 < ye && (Pt = s(2, Fe, ot, re, P, j, De, J, B, J), Pt !== void 0 && (Fe = Pt).length === 0)) - return lt + Fe + Ct; - if (Fe = ot.join(",") + "{" + Fe + "}", z * G !== 0) { - switch (z !== 2 || a(Fe, 2) || (G = 0), G) { - case 111: - Fe = Fe.replace(S, ":-moz-$1") + Fe; - break; - case 112: - Fe = Fe.replace(_, "::-webkit-input-$1") + Fe.replace(_, "::-moz-$1") + Fe.replace(_, ":-ms-input-$1") + Fe; - } - G = 0; - } - } - return lt + Fe + Ct; - } - function t(re, K, ee) { - var J = K.trim().split(m); - K = J; - var B = J.length, se = re.length; - switch (se) { - case 0: - case 1: - var te = 0; - for (re = se === 0 ? "" : re[0] + " "; te < B; ++te) - K[te] = r(re, K[te], ee).trim(); - break; - default: - var Me = te = 0; - for (K = []; te < B; ++te) - for (var Ie = 0; Ie < se; ++Ie) - K[Me++] = r(re[Ie] + " ", J[te], ee).trim(); - } - return K; - } - function r(re, K, ee) { - var J = K.charCodeAt(0); - switch (33 > J && (J = (K = K.trim()).charCodeAt(0)), J) { - case 38: - return K.replace(E, "$1" + re.trim()); - case 58: - return re.trim() + K.replace(E, "$1" + re.trim()); - default: - if (0 < 1 * ee && 0 < K.indexOf("\f")) - return K.replace(E, (re.charCodeAt(0) === 58 ? "" : "$1") + re.trim()); - } - return re + K; - } - function i(re, K, ee, J) { - var B = re + ";", se = 2 * K + 3 * ee + 4 * J; - if (se === 944) { - re = B.indexOf(":", 9) + 1; - var te = B.substring(re, B.length - 1).trim(); - return te = B.substring(0, re).trim() + te + ";", z === 1 || z === 2 && a(te, 1) ? "-webkit-" + te + te : te; - } - if (z === 0 || z === 2 && !a(B, 1)) - return B; - switch (se) { - case 1015: - return B.charCodeAt(10) === 97 ? "-webkit-" + B + B : B; - case 951: - return B.charCodeAt(3) === 116 ? "-webkit-" + B + B : B; - case 963: - return B.charCodeAt(5) === 110 ? "-webkit-" + B + B : B; - case 1009: - if (B.charCodeAt(4) !== 100) - break; - case 969: - case 942: - return "-webkit-" + B + B; - case 978: - return "-webkit-" + B + "-moz-" + B + B; - case 1019: - case 983: - return "-webkit-" + B + "-moz-" + B + "-ms-" + B + B; - case 883: - if (B.charCodeAt(8) === 45) - return "-webkit-" + B + B; - if (0 < B.indexOf("image-set(", 11)) - return B.replace(D, "$1-webkit-$2") + B; - break; - case 932: - if (B.charCodeAt(4) === 45) - switch (B.charCodeAt(5)) { - case 103: - return "-webkit-box-" + B.replace("-grow", "") + "-webkit-" + B + "-ms-" + B.replace("grow", "positive") + B; - case 115: - return "-webkit-" + B + "-ms-" + B.replace("shrink", "negative") + B; - case 98: - return "-webkit-" + B + "-ms-" + B.replace("basis", "preferred-size") + B; - } - return "-webkit-" + B + "-ms-" + B + B; - case 964: - return "-webkit-" + B + "-ms-flex-" + B + B; - case 1023: - if (B.charCodeAt(8) !== 99) - break; - return te = B.substring(B.indexOf(":", 15)).replace("flex-", "").replace("space-between", "justify"), "-webkit-box-pack" + te + "-webkit-" + B + "-ms-flex-pack" + te + B; - case 1005: - return p.test(B) ? B.replace(f, ":-webkit-") + B.replace(f, ":-moz-") + B : B; - case 1e3: - switch (te = B.substring(13).trim(), K = te.indexOf("-") + 1, te.charCodeAt(0) + te.charCodeAt(K)) { - case 226: - te = B.replace(b, "tb"); - break; - case 232: - te = B.replace(b, "tb-rl"); - break; - case 220: - te = B.replace(b, "lr"); - break; - default: - return B; - } - return "-webkit-" + B + "-ms-" + te + B; - case 1017: - if (B.indexOf("sticky", 9) === -1) - break; - case 975: - switch (K = (B = re).length - 10, te = (B.charCodeAt(K) === 33 ? B.substring(0, K) : B).substring(re.indexOf(":", 7) + 1).trim(), se = te.charCodeAt(0) + (te.charCodeAt(7) | 0)) { - case 203: - if (111 > te.charCodeAt(8)) - break; - case 115: - B = B.replace(te, "-webkit-" + te) + ";" + B; - break; - case 207: - case 102: - B = B.replace(te, "-webkit-" + (102 < se ? "inline-" : "") + "box") + ";" + B.replace(te, "-webkit-" + te) + ";" + B.replace(te, "-ms-" + te + "box") + ";" + B; - } - return B + ";"; - case 938: - if (B.charCodeAt(5) === 45) - switch (B.charCodeAt(6)) { - case 105: - return te = B.replace("-items", ""), "-webkit-" + B + "-webkit-box-" + te + "-ms-flex-" + te + B; - case 115: - return "-webkit-" + B + "-ms-flex-item-" + B.replace(M, "") + B; - default: - return "-webkit-" + B + "-ms-flex-line-pack" + B.replace("align-content", "").replace(M, "") + B; - } - break; - case 973: - case 989: - if (B.charCodeAt(3) !== 45 || B.charCodeAt(4) === 122) - break; - case 931: - case 953: - if (x.test(re) === !0) - return (te = re.substring(re.indexOf(":") + 1)).charCodeAt(0) === 115 ? i(re.replace("stretch", "fill-available"), K, ee, J).replace(":fill-available", ":stretch") : B.replace(te, "-webkit-" + te) + B.replace(te, "-moz-" + te.replace("fill-", "")) + B; - break; - case 962: - if (B = "-webkit-" + B + (B.charCodeAt(5) === 102 ? "-ms-" + B : "") + B, ee + J === 211 && B.charCodeAt(13) === 105 && 0 < B.indexOf("transform", 10)) - return B.substring(0, B.indexOf(";", 27) + 1).replace(v, "$1-webkit-$2") + B; - } - return B; - } - function a(re, K) { - var ee = re.indexOf(K === 1 ? ":" : "{"), J = re.substring(0, K !== 3 ? ee : 10); - return ee = re.substring(ee + 1, re.length - 1), $(K !== 2 ? J : J.replace(N, "$1"), ee, K); - } - function o(re, K) { - var ee = i(K, K.charCodeAt(0), K.charCodeAt(1), K.charCodeAt(2)); - return ee !== K + ";" ? ee.replace(w, " or ($1)").substring(4) : "(" + K + ")"; - } - function s(re, K, ee, J, B, se, te, Me, Ie, we) { - for (var Q = 0, ze = K, Ce; Q < ye; ++Q) - switch (Ce = Y[Q].call(u, re, ze, ee, J, B, se, te, Me, Ie, we)) { - case void 0: - case !1: - case !0: - case null: - break; - default: - ze = Ce; - } - if (ze !== K) - return ze; - } - function c(re) { - switch (re) { - case void 0: - case null: - ye = Y.length = 0; - break; - default: - if (typeof re == "function") - Y[ye++] = re; - else if (typeof re == "object") - for (var K = 0, ee = re.length; K < ee; ++K) - c(re[K]); - else - ae = !!re | 0; - } - return c; - } - function l(re) { - return re = re.prefix, re !== void 0 && ($ = null, re ? typeof re != "function" ? z = 1 : (z = 2, $ = re) : z = 0), l; - } - function u(re, K) { - var ee = re; - if (33 > ee.charCodeAt(0) && (ee = ee.trim()), de = ee, ee = [de], 0 < ye) { - var J = s(-1, K, ee, ee, P, j, 0, 0, 0, 0); - J !== void 0 && typeof J == "string" && (K = J); - } - var B = n(q, ee, K, 0, 0); - return 0 < ye && (J = s(-2, B, ee, ee, P, j, B.length, 0, 0, 0), J !== void 0 && (B = J)), de = "", G = 0, j = P = 1, B; - } - var d = /^\0+/g, h = /[\0\r\f]/g, f = /: */g, p = /zoo|gra/, v = /([,: ])(transform)/g, m = /,\r+?/g, E = /([\t\r\n ])*\f?&/g, y = /@(k\w+)\s*(\S*)\s*/, _ = /::(place)/g, S = /:(read-only)/g, b = /[svh]\w+-[tblr]{2}/, A = /\(\s*(.*)\s*\)/g, w = /([\s\S]*?);/g, M = /-self|flex-/g, N = /[^]*?(:[rp][el]a[\w-]+)[^]*/, x = /stretch|:\s*\w+\-(?:conte|avail)/, D = /([^-])(image-set\()/, j = 1, P = 1, G = 0, z = 1, q = [], Y = [], ye = 0, $ = null, ae = 0, de = ""; - return u.use = c, u.set = l, e !== void 0 && l(e), u; -} -var a4 = { - animationIterationCount: 1, - borderImageOutset: 1, - borderImageSlice: 1, - borderImageWidth: 1, - boxFlex: 1, - boxFlexGroup: 1, - boxOrdinalGroup: 1, - columnCount: 1, - columns: 1, - flex: 1, - flexGrow: 1, - flexPositive: 1, - flexShrink: 1, - flexNegative: 1, - flexOrder: 1, - gridRow: 1, - gridRowEnd: 1, - gridRowSpan: 1, - gridRowStart: 1, - gridColumn: 1, - gridColumnEnd: 1, - gridColumnSpan: 1, - gridColumnStart: 1, - msGridRow: 1, - msGridRowSpan: 1, - msGridColumn: 1, - msGridColumnSpan: 1, - fontWeight: 1, - lineHeight: 1, - opacity: 1, - order: 1, - orphans: 1, - tabSize: 1, - widows: 1, - zIndex: 1, - zoom: 1, - WebkitLineClamp: 1, - // SVG-related properties - fillOpacity: 1, - floodOpacity: 1, - stopOpacity: 1, - strokeDasharray: 1, - strokeDashoffset: 1, - strokeMiterlimit: 1, - strokeOpacity: 1, - strokeWidth: 1 -}; -function o4(e) { - var n = /* @__PURE__ */ Object.create(null); - return function(t) { - return n[t] === void 0 && (n[t] = e(t)), n[t]; - }; -} -var s4 = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, m_ = /* @__PURE__ */ o4( - function(e) { - return s4.test(e) || e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && e.charCodeAt(2) < 91; - } - /* Z+1 */ -), Tm = { exports: {} }, In = {}; -/** @license React v16.13.1 - * react-is.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 g_; -function l4() { - if (g_) - return In; - g_ = 1; - var e = typeof Symbol == "function" && Symbol.for, n = e ? Symbol.for("react.element") : 60103, t = e ? Symbol.for("react.portal") : 60106, r = e ? Symbol.for("react.fragment") : 60107, i = e ? Symbol.for("react.strict_mode") : 60108, a = e ? Symbol.for("react.profiler") : 60114, o = e ? Symbol.for("react.provider") : 60109, s = e ? Symbol.for("react.context") : 60110, c = e ? Symbol.for("react.async_mode") : 60111, l = e ? Symbol.for("react.concurrent_mode") : 60111, u = e ? Symbol.for("react.forward_ref") : 60112, d = e ? Symbol.for("react.suspense") : 60113, h = e ? Symbol.for("react.suspense_list") : 60120, f = e ? Symbol.for("react.memo") : 60115, p = e ? Symbol.for("react.lazy") : 60116, v = e ? Symbol.for("react.block") : 60121, m = e ? Symbol.for("react.fundamental") : 60117, E = e ? Symbol.for("react.responder") : 60118, y = e ? Symbol.for("react.scope") : 60119; - function _(b) { - if (typeof b == "object" && b !== null) { - var A = b.$$typeof; - switch (A) { - case n: - switch (b = b.type, b) { - case c: - case l: - case r: - case a: - case i: - case d: - return b; - default: - switch (b = b && b.$$typeof, b) { - case s: - case u: - case p: - case f: - case o: - return b; - default: - return A; - } - } - case t: - return A; - } - } - } - function S(b) { - return _(b) === l; - } - return In.AsyncMode = c, In.ConcurrentMode = l, In.ContextConsumer = s, In.ContextProvider = o, In.Element = n, In.ForwardRef = u, In.Fragment = r, In.Lazy = p, In.Memo = f, In.Portal = t, In.Profiler = a, In.StrictMode = i, In.Suspense = d, In.isAsyncMode = function(b) { - return S(b) || _(b) === c; - }, In.isConcurrentMode = S, In.isContextConsumer = function(b) { - return _(b) === s; - }, In.isContextProvider = function(b) { - return _(b) === o; - }, In.isElement = function(b) { - return typeof b == "object" && b !== null && b.$$typeof === n; - }, In.isForwardRef = function(b) { - return _(b) === u; - }, In.isFragment = function(b) { - return _(b) === r; - }, In.isLazy = function(b) { - return _(b) === p; - }, In.isMemo = function(b) { - return _(b) === f; - }, In.isPortal = function(b) { - return _(b) === t; - }, In.isProfiler = function(b) { - return _(b) === a; - }, In.isStrictMode = function(b) { - return _(b) === i; - }, In.isSuspense = function(b) { - return _(b) === d; - }, In.isValidElementType = function(b) { - return typeof b == "string" || typeof b == "function" || b === r || b === l || b === a || b === i || b === d || b === h || typeof b == "object" && b !== null && (b.$$typeof === p || b.$$typeof === f || b.$$typeof === o || b.$$typeof === s || b.$$typeof === u || b.$$typeof === m || b.$$typeof === E || b.$$typeof === y || b.$$typeof === v); - }, In.typeOf = _, In; -} -var Mn = {}; -/** @license React v16.13.1 - * react-is.development.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 y_; -function c4() { - return y_ || (y_ = 1, process.env.NODE_ENV !== "production" && function() { - var e = typeof Symbol == "function" && Symbol.for, n = e ? Symbol.for("react.element") : 60103, t = e ? Symbol.for("react.portal") : 60106, r = e ? Symbol.for("react.fragment") : 60107, i = e ? Symbol.for("react.strict_mode") : 60108, a = e ? Symbol.for("react.profiler") : 60114, o = e ? Symbol.for("react.provider") : 60109, s = e ? Symbol.for("react.context") : 60110, c = e ? Symbol.for("react.async_mode") : 60111, l = e ? Symbol.for("react.concurrent_mode") : 60111, u = e ? Symbol.for("react.forward_ref") : 60112, d = e ? Symbol.for("react.suspense") : 60113, h = e ? Symbol.for("react.suspense_list") : 60120, f = e ? Symbol.for("react.memo") : 60115, p = e ? Symbol.for("react.lazy") : 60116, v = e ? Symbol.for("react.block") : 60121, m = e ? Symbol.for("react.fundamental") : 60117, E = e ? Symbol.for("react.responder") : 60118, y = e ? Symbol.for("react.scope") : 60119; - function _(Q) { - return typeof Q == "string" || typeof Q == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. - Q === r || Q === l || Q === a || Q === i || Q === d || Q === h || typeof Q == "object" && Q !== null && (Q.$$typeof === p || Q.$$typeof === f || Q.$$typeof === o || Q.$$typeof === s || Q.$$typeof === u || Q.$$typeof === m || Q.$$typeof === E || Q.$$typeof === y || Q.$$typeof === v); - } - function S(Q) { - if (typeof Q == "object" && Q !== null) { - var ze = Q.$$typeof; - switch (ze) { - case n: - var Ce = Q.type; - switch (Ce) { - case c: - case l: - case r: - case a: - case i: - case d: - return Ce; - default: - var ke = Ce && Ce.$$typeof; - switch (ke) { - case s: - case u: - case p: - case f: - case o: - return ke; - default: - return ze; - } - } - case t: - return ze; - } - } - } - var b = c, A = l, w = s, M = o, N = n, x = u, D = r, j = p, P = f, G = t, z = a, q = i, Y = d, ye = !1; - function $(Q) { - return ye || (ye = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), ae(Q) || S(Q) === c; - } - function ae(Q) { - return S(Q) === l; - } - function de(Q) { - return S(Q) === s; - } - function re(Q) { - return S(Q) === o; - } - function K(Q) { - return typeof Q == "object" && Q !== null && Q.$$typeof === n; - } - function ee(Q) { - return S(Q) === u; - } - function J(Q) { - return S(Q) === r; - } - function B(Q) { - return S(Q) === p; - } - function se(Q) { - return S(Q) === f; - } - function te(Q) { - return S(Q) === t; - } - function Me(Q) { - return S(Q) === a; - } - function Ie(Q) { - return S(Q) === i; - } - function we(Q) { - return S(Q) === d; - } - Mn.AsyncMode = b, Mn.ConcurrentMode = A, Mn.ContextConsumer = w, Mn.ContextProvider = M, Mn.Element = N, Mn.ForwardRef = x, Mn.Fragment = D, Mn.Lazy = j, Mn.Memo = P, Mn.Portal = G, Mn.Profiler = z, Mn.StrictMode = q, Mn.Suspense = Y, Mn.isAsyncMode = $, Mn.isConcurrentMode = ae, Mn.isContextConsumer = de, Mn.isContextProvider = re, Mn.isElement = K, Mn.isForwardRef = ee, Mn.isFragment = J, Mn.isLazy = B, Mn.isMemo = se, Mn.isPortal = te, Mn.isProfiler = Me, Mn.isStrictMode = Ie, Mn.isSuspense = we, Mn.isValidElementType = _, Mn.typeOf = S; - }()), Mn; -} -process.env.NODE_ENV === "production" ? Tm.exports = l4() : Tm.exports = c4(); -var u4 = Tm.exports, m1 = u4, d4 = { - childContextTypes: !0, - contextType: !0, - contextTypes: !0, - defaultProps: !0, - displayName: !0, - getDefaultProps: !0, - getDerivedStateFromError: !0, - getDerivedStateFromProps: !0, - mixins: !0, - propTypes: !0, - type: !0 -}, h4 = { - name: !0, - length: !0, - prototype: !0, - caller: !0, - callee: !0, - arguments: !0, - arity: !0 -}, f4 = { - $$typeof: !0, - render: !0, - defaultProps: !0, - displayName: !0, - propTypes: !0 -}, rw = { - $$typeof: !0, - compare: !0, - defaultProps: !0, - displayName: !0, - propTypes: !0, - type: !0 -}, g1 = {}; -g1[m1.ForwardRef] = f4; -g1[m1.Memo] = rw; -function E_(e) { - return m1.isMemo(e) ? rw : g1[e.$$typeof] || d4; -} -var p4 = Object.defineProperty, v4 = Object.getOwnPropertyNames, __ = Object.getOwnPropertySymbols, m4 = Object.getOwnPropertyDescriptor, g4 = Object.getPrototypeOf, b_ = Object.prototype; -function iw(e, n, t) { - if (typeof n != "string") { - if (b_) { - var r = g4(n); - r && r !== b_ && iw(e, r, t); - } - var i = v4(n); - __ && (i = i.concat(__(n))); - for (var a = E_(e), o = E_(n), s = 0; s < i.length; ++s) { - var c = i[s]; - if (!h4[c] && !(t && t[c]) && !(o && o[c]) && !(a && a[c])) { - var l = m4(n, c); - try { - p4(e, c, l); - } catch { - } - } - } - } - return e; -} -var y4 = iw; -const E4 = /* @__PURE__ */ nw(y4); -function _o() { - return (_o = Object.assign || function(e) { - for (var n = 1; n < arguments.length; n++) { - var t = arguments[n]; - for (var r in t) - Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); - } - return e; - }).apply(this, arguments); -} -var C_ = function(e, n) { - for (var t = [e[0]], r = 0, i = n.length; r < i; r += 1) - t.push(n[r], e[r + 1]); - return t; -}, Sm = function(e) { - return e !== null && typeof e == "object" && (e.toString ? e.toString() : Object.prototype.toString.call(e)) === "[object Object]" && !v1.typeOf(e); -}, Kf = Object.freeze([]), ds = Object.freeze({}); -function vd(e) { - return typeof e == "function"; -} -function wm(e) { - return process.env.NODE_ENV !== "production" && typeof e == "string" && e || e.displayName || e.name || "Component"; -} -function y1(e) { - return e && typeof e.styledComponentId == "string"; -} -var Cc = typeof process < "u" && process.env !== void 0 && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", E1 = typeof window < "u" && "HTMLElement" in window, _4 = !!(typeof SC_DISABLE_SPEEDY == "boolean" ? SC_DISABLE_SPEEDY : typeof process < "u" && process.env !== void 0 && (process.env.REACT_APP_SC_DISABLE_SPEEDY !== void 0 && process.env.REACT_APP_SC_DISABLE_SPEEDY !== "" ? process.env.REACT_APP_SC_DISABLE_SPEEDY !== "false" && process.env.REACT_APP_SC_DISABLE_SPEEDY : process.env.SC_DISABLE_SPEEDY !== void 0 && process.env.SC_DISABLE_SPEEDY !== "" ? process.env.SC_DISABLE_SPEEDY !== "false" && process.env.SC_DISABLE_SPEEDY : process.env.NODE_ENV !== "production")), b4 = process.env.NODE_ENV !== "production" ? { 1: `Cannot create styled-component for component: %s. - -`, 2: `Can't collect styles once you've consumed a \`ServerStyleSheet\`'s styles! \`ServerStyleSheet\` is a one off instance for each server-side render cycle. - -- Are you trying to reuse it across renders? -- Are you accidentally calling collectStyles twice? - -`, 3: `Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser. - -`, 4: `The \`StyleSheetManager\` expects a valid target or sheet prop! - -- Does this error occur on the client and is your target falsy? -- Does this error occur on the server and is the sheet falsy? - -`, 5: `The clone method cannot be used on the client! - -- Are you running in a client-like environment on the server? -- Are you trying to run SSR on the client? - -`, 6: `Trying to insert a new style tag, but the given Node is unmounted! - -- Are you using a custom target that isn't mounted? -- Does your document not have a valid head element? -- Have you accidentally removed a style tag manually? - -`, 7: 'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n', 8: `ThemeProvider: Please make your "theme" prop an object. - -`, 9: "Missing document ``\n\n", 10: `Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021 - -`, 11: `_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements. - -`, 12: "It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n", 13: `%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details. - -`, 14: `ThemeProvider: "theme" prop is required. - -`, 15: "A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to ``, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n", 16: `Reached the limit of how many styled components may be created at group %s. -You may only create up to 1,073,741,824 components. If you're creating components dynamically, -as for instance in your render method then you may be running into this limitation. - -`, 17: `CSSStyleSheet could not be found on HTMLStyleElement. -Has styled-components' style tag been unmounted or altered by another script? -` } : {}; -function C4() { - for (var e = arguments.length <= 0 ? void 0 : arguments[0], n = [], t = 1, r = arguments.length; t < r; t += 1) - n.push(t < 0 || arguments.length <= t ? void 0 : arguments[t]); - return n.forEach(function(i) { - e = e.replace(/%[a-z]/, i); - }), e; -} -function Gc(e) { - for (var n = arguments.length, t = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++) - t[r - 1] = arguments[r]; - throw process.env.NODE_ENV === "production" ? new Error("An error occurred. See https://git.io/JUIaE#" + e + " for more information." + (t.length > 0 ? " Args: " + t.join(", ") : "")) : new Error(C4.apply(void 0, [b4[e]].concat(t)).trim()); -} -var T4 = function() { - function e(t) { - this.groupSizes = new Uint32Array(512), this.length = 512, this.tag = t; - } - var n = e.prototype; - return n.indexOfGroup = function(t) { - for (var r = 0, i = 0; i < t; i++) - r += this.groupSizes[i]; - return r; - }, n.insertRules = function(t, r) { - if (t >= this.groupSizes.length) { - for (var i = this.groupSizes, a = i.length, o = a; t >= o; ) - (o <<= 1) < 0 && Gc(16, "" + t); - this.groupSizes = new Uint32Array(o), this.groupSizes.set(i), this.length = o; - for (var s = a; s < o; s++) - this.groupSizes[s] = 0; - } - for (var c = this.indexOfGroup(t + 1), l = 0, u = r.length; l < u; l++) - this.tag.insertRule(c, r[l]) && (this.groupSizes[t]++, c++); - }, n.clearGroup = function(t) { - if (t < this.length) { - var r = this.groupSizes[t], i = this.indexOfGroup(t), a = i + r; - this.groupSizes[t] = 0; - for (var o = i; o < a; o++) - this.tag.deleteRule(i); - } - }, n.getGroup = function(t) { - var r = ""; - if (t >= this.length || this.groupSizes[t] === 0) - return r; - for (var i = this.groupSizes[t], a = this.indexOfGroup(t), o = a + i, s = a; s < o; s++) - r += this.tag.getRule(s) + `/*!sc*/ -`; - return r; - }, e; -}(), Cf = /* @__PURE__ */ new Map(), Wf = /* @__PURE__ */ new Map(), Pu = 1, Dh = function(e) { - if (Cf.has(e)) - return Cf.get(e); - for (; Wf.has(Pu); ) - Pu++; - var n = Pu++; - return process.env.NODE_ENV !== "production" && ((0 | n) < 0 || n > 1 << 30) && Gc(16, "" + n), Cf.set(e, n), Wf.set(n, e), n; -}, S4 = function(e) { - return Wf.get(e); -}, w4 = function(e, n) { - n >= Pu && (Pu = n + 1), Cf.set(e, n), Wf.set(n, e); -}, A4 = "style[" + Cc + '][data-styled-version="5.3.11"]', N4 = new RegExp("^" + Cc + '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'), I4 = function(e, n, t) { - for (var r, i = t.split(","), a = 0, o = i.length; a < o; a++) - (r = i[a]) && e.registerName(n, r); -}, M4 = function(e, n) { - for (var t = (n.textContent || "").split(`/*!sc*/ -`), r = [], i = 0, a = t.length; i < a; i++) { - var o = t[i].trim(); - if (o) { - var s = o.match(N4); - if (s) { - var c = 0 | parseInt(s[1], 10), l = s[2]; - c !== 0 && (w4(l, c), I4(e, l, s[3]), e.getTag().insertRules(c, r)), r.length = 0; - } else - r.push(o); - } - } -}, O4 = function() { - return typeof __webpack_nonce__ < "u" ? __webpack_nonce__ : null; -}, aw = function(e) { - var n = document.head, t = e || n, r = document.createElement("style"), i = function(s) { - for (var c = s.childNodes, l = c.length; l >= 0; l--) { - var u = c[l]; - if (u && u.nodeType === 1 && u.hasAttribute(Cc)) - return u; - } - }(t), a = i !== void 0 ? i.nextSibling : null; - r.setAttribute(Cc, "active"), r.setAttribute("data-styled-version", "5.3.11"); - var o = O4(); - return o && r.setAttribute("nonce", o), t.insertBefore(r, a), r; -}, x4 = function() { - function e(t) { - var r = this.element = aw(t); - r.appendChild(document.createTextNode("")), this.sheet = function(i) { - if (i.sheet) - return i.sheet; - for (var a = document.styleSheets, o = 0, s = a.length; o < s; o++) { - var c = a[o]; - if (c.ownerNode === i) - return c; - } - Gc(17); - }(r), this.length = 0; - } - var n = e.prototype; - return n.insertRule = function(t, r) { - try { - return this.sheet.insertRule(r, t), this.length++, !0; - } catch { - return !1; - } - }, n.deleteRule = function(t) { - this.sheet.deleteRule(t), this.length--; - }, n.getRule = function(t) { - var r = this.sheet.cssRules[t]; - return r !== void 0 && typeof r.cssText == "string" ? r.cssText : ""; - }, e; -}(), R4 = function() { - function e(t) { - var r = this.element = aw(t); - this.nodes = r.childNodes, this.length = 0; - } - var n = e.prototype; - return n.insertRule = function(t, r) { - if (t <= this.length && t >= 0) { - var i = document.createTextNode(r), a = this.nodes[t]; - return this.element.insertBefore(i, a || null), this.length++, !0; - } - return !1; - }, n.deleteRule = function(t) { - this.element.removeChild(this.nodes[t]), this.length--; - }, n.getRule = function(t) { - return t < this.length ? this.nodes[t].textContent : ""; - }, e; -}(), D4 = function() { - function e(t) { - this.rules = [], this.length = 0; - } - var n = e.prototype; - return n.insertRule = function(t, r) { - return t <= this.length && (this.rules.splice(t, 0, r), this.length++, !0); - }, n.deleteRule = function(t) { - this.rules.splice(t, 1), this.length--; - }, n.getRule = function(t) { - return t < this.length ? this.rules[t] : ""; - }, e; -}(), T_ = E1, L4 = { isServer: !E1, useCSSOMInjection: !_4 }, ow = function() { - function e(t, r, i) { - t === void 0 && (t = ds), r === void 0 && (r = {}), this.options = _o({}, L4, {}, t), this.gs = r, this.names = new Map(i), this.server = !!t.isServer, !this.server && E1 && T_ && (T_ = !1, function(a) { - for (var o = document.querySelectorAll(A4), s = 0, c = o.length; s < c; s++) { - var l = o[s]; - l && l.getAttribute(Cc) !== "active" && (M4(a, l), l.parentNode && l.parentNode.removeChild(l)); - } - }(this)); - } - e.registerId = function(t) { - return Dh(t); - }; - var n = e.prototype; - return n.reconstructWithOptions = function(t, r) { - return r === void 0 && (r = !0), new e(_o({}, this.options, {}, t), this.gs, r && this.names || void 0); - }, n.allocateGSInstance = function(t) { - return this.gs[t] = (this.gs[t] || 0) + 1; - }, n.getTag = function() { - return this.tag || (this.tag = (i = (r = this.options).isServer, a = r.useCSSOMInjection, o = r.target, t = i ? new D4(o) : a ? new x4(o) : new R4(o), new T4(t))); - var t, r, i, a, o; - }, n.hasNameForId = function(t, r) { - return this.names.has(t) && this.names.get(t).has(r); - }, n.registerName = function(t, r) { - if (Dh(t), this.names.has(t)) - this.names.get(t).add(r); - else { - var i = /* @__PURE__ */ new Set(); - i.add(r), this.names.set(t, i); - } - }, n.insertRules = function(t, r, i) { - this.registerName(t, r), this.getTag().insertRules(Dh(t), i); - }, n.clearNames = function(t) { - this.names.has(t) && this.names.get(t).clear(); - }, n.clearRules = function(t) { - this.getTag().clearGroup(Dh(t)), this.clearNames(t); - }, n.clearTag = function() { - this.tag = void 0; - }, n.toString = function() { - return function(t) { - for (var r = t.getTag(), i = r.length, a = "", o = 0; o < i; o++) { - var s = S4(o); - if (s !== void 0) { - var c = t.names.get(s), l = r.getGroup(o); - if (c && l && c.size) { - var u = Cc + ".g" + o + '[id="' + s + '"]', d = ""; - c !== void 0 && c.forEach(function(h) { - h.length > 0 && (d += h + ","); - }), a += "" + l + u + '{content:"' + d + `"}/*!sc*/ -`; - } - } - } - return a; - }(this); - }, e; -}(), P4 = /(a)(d)/gi, S_ = function(e) { - return String.fromCharCode(e + (e > 25 ? 39 : 97)); -}; -function Am(e) { - var n, t = ""; - for (n = Math.abs(e); n > 52; n = n / 52 | 0) - t = S_(n % 52) + t; - return (S_(n % 52) + t).replace(P4, "$1-$2"); -} -var qs = function(e, n) { - for (var t = n.length; t; ) - e = 33 * e ^ n.charCodeAt(--t); - return e; -}, sw = function(e) { - return qs(5381, e); -}; -function k4(e) { - for (var n = 0; n < e.length; n += 1) { - var t = e[n]; - if (vd(t) && !y1(t)) - return !1; - } - return !0; -} -var U4 = sw("5.3.11"), F4 = function() { - function e(n, t, r) { - this.rules = n, this.staticRulesId = "", this.isStatic = process.env.NODE_ENV === "production" && (r === void 0 || r.isStatic) && k4(n), this.componentId = t, this.baseHash = qs(U4, t), this.baseStyle = r, ow.registerId(t); - } - return e.prototype.generateAndInjectStyles = function(n, t, r) { - var i = this.componentId, a = []; - if (this.baseStyle && a.push(this.baseStyle.generateAndInjectStyles(n, t, r)), this.isStatic && !r.hash) - if (this.staticRulesId && t.hasNameForId(i, this.staticRulesId)) - a.push(this.staticRulesId); - else { - var o = Tc(this.rules, n, t, r).join(""), s = Am(qs(this.baseHash, o) >>> 0); - if (!t.hasNameForId(i, s)) { - var c = r(o, "." + s, void 0, i); - t.insertRules(i, s, c); - } - a.push(s), this.staticRulesId = s; - } - else { - for (var l = this.rules.length, u = qs(this.baseHash, r.hash), d = "", h = 0; h < l; h++) { - var f = this.rules[h]; - if (typeof f == "string") - d += f, process.env.NODE_ENV !== "production" && (u = qs(u, f + h)); - else if (f) { - var p = Tc(f, n, t, r), v = Array.isArray(p) ? p.join("") : p; - u = qs(u, v + h), d += v; - } - } - if (d) { - var m = Am(u >>> 0); - if (!t.hasNameForId(i, m)) { - var E = r(d, "." + m, void 0, i); - t.insertRules(i, m, E); - } - a.push(m); - } - } - return a.join(" "); - }, e; -}(), B4 = /^\s*\/\/.*$/gm, H4 = [":", "[", ".", "#"]; -function j4(e) { - var n, t, r, i, a = e === void 0 ? ds : e, o = a.options, s = o === void 0 ? ds : o, c = a.plugins, l = c === void 0 ? Kf : c, u = new i4(s), d = [], h = function(v) { - function m(E) { - if (E) - try { - v(E + "}"); - } catch { - } - } - return function(E, y, _, S, b, A, w, M, N, x) { - switch (E) { - case 1: - if (N === 0 && y.charCodeAt(0) === 64) - return v(y + ";"), ""; - break; - case 2: - if (M === 0) - return y + "/*|*/"; - break; - case 3: - switch (M) { - case 102: - case 112: - return v(_[0] + y), ""; - default: - return y + (x === 0 ? "/*|*/" : ""); - } - case -2: - y.split("/*|*/}").forEach(m); - } - }; - }(function(v) { - d.push(v); - }), f = function(v, m, E) { - return m === 0 && H4.indexOf(E[t.length]) !== -1 || E.match(i) ? v : "." + n; - }; - function p(v, m, E, y) { - y === void 0 && (y = "&"); - var _ = v.replace(B4, ""), S = m && E ? E + " " + m + " { " + _ + " }" : _; - return n = y, t = m, r = new RegExp("\\" + t + "\\b", "g"), i = new RegExp("(\\" + t + "\\b){2,}"), u(E || !m ? "" : m, S); - } - return u.use([].concat(l, [function(v, m, E) { - v === 2 && E.length && E[0].lastIndexOf(t) > 0 && (E[0] = E[0].replace(r, f)); - }, h, function(v) { - if (v === -2) { - var m = d; - return d = [], m; - } - }])), p.hash = l.length ? l.reduce(function(v, m) { - return m.name || Gc(15), qs(v, m.name); - }, 5381).toString() : "", p; -} -var lw = g.createContext(); -lw.Consumer; -var cw = g.createContext(), V4 = (cw.Consumer, new ow()), Nm = j4(); -function G4() { - return Lt(lw) || V4; -} -function z4() { - return Lt(cw) || Nm; -} -var uw = function() { - function e(n, t) { - var r = this; - this.inject = function(i, a) { - a === void 0 && (a = Nm); - var o = r.name + a.hash; - i.hasNameForId(r.id, o) || i.insertRules(r.id, o, a(r.rules, o, "@keyframes")); - }, this.toString = function() { - return Gc(12, String(r.name)); - }, this.name = n, this.id = "sc-keyframes-" + n, this.rules = t; - } - return e.prototype.getName = function(n) { - return n === void 0 && (n = Nm), this.name + n.hash; - }, e; -}(), q4 = /([A-Z])/, K4 = /([A-Z])/g, W4 = /^ms-/, Y4 = function(e) { - return "-" + e.toLowerCase(); -}; -function w_(e) { - return q4.test(e) ? e.replace(K4, Y4).replace(W4, "-ms-") : e; -} -var A_ = function(e) { - return e == null || e === !1 || e === ""; -}; -function Tc(e, n, t, r) { - if (Array.isArray(e)) { - for (var i, a = [], o = 0, s = e.length; o < s; o += 1) - (i = Tc(e[o], n, t, r)) !== "" && (Array.isArray(i) ? a.push.apply(a, i) : a.push(i)); - return a; - } - if (A_(e)) - return ""; - if (y1(e)) - return "." + e.styledComponentId; - if (vd(e)) { - if (typeof (l = e) != "function" || l.prototype && l.prototype.isReactComponent || !n) - return e; - var c = e(n); - return process.env.NODE_ENV !== "production" && v1.isElement(c) && console.warn(wm(e) + " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details."), Tc(c, n, t, r); - } - var l; - return e instanceof uw ? t ? (e.inject(t, r), e.getName(r)) : e : Sm(e) ? function u(d, h) { - var f, p, v = []; - for (var m in d) - d.hasOwnProperty(m) && !A_(d[m]) && (Array.isArray(d[m]) && d[m].isCss || vd(d[m]) ? v.push(w_(m) + ":", d[m], ";") : Sm(d[m]) ? v.push.apply(v, u(d[m], m)) : v.push(w_(m) + ": " + (f = m, (p = d[m]) == null || typeof p == "boolean" || p === "" ? "" : typeof p != "number" || p === 0 || f in a4 || f.startsWith("--") ? String(p).trim() : p + "px") + ";")); - return h ? [h + " {"].concat(v, ["}"]) : v; - }(e) : e.toString(); -} -var N_ = function(e) { - return Array.isArray(e) && (e.isCss = !0), e; -}; -function ii(e) { - for (var n = arguments.length, t = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++) - t[r - 1] = arguments[r]; - return vd(e) || Sm(e) ? N_(Tc(C_(Kf, [e].concat(t)))) : t.length === 0 && e.length === 1 && typeof e[0] == "string" ? e : N_(Tc(C_(e, t))); -} -var I_ = /invalid hook call/i, Lh = /* @__PURE__ */ new Set(), Z4 = function(e, n) { - if (process.env.NODE_ENV !== "production") { - var t = "The component " + e + (n ? ' with the id of "' + n + '"' : "") + ` has been created dynamically. -You may see this warning because you've called styled inside another component. -To resolve this only create new StyledComponents outside of any render method and function component.`, r = console.error; - try { - var i = !0; - console.error = function(a) { - if (I_.test(a)) - i = !1, Lh.delete(t); - else { - for (var o = arguments.length, s = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++) - s[c - 1] = arguments[c]; - r.apply(void 0, [a].concat(s)); - } - }, yt(), i && !Lh.has(t) && (console.warn(t), Lh.add(t)); - } catch (a) { - I_.test(a.message) && Lh.delete(t); - } finally { - console.error = r; - } - } -}, Q4 = function(e, n, t) { - return t === void 0 && (t = ds), e.theme !== t.theme && e.theme || n || t.theme; -}, X4 = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g, J4 = /(^-|-$)/g; -function Wv(e) { - return e.replace(X4, "-").replace(J4, ""); -} -var dw = function(e) { - return Am(sw(e) >>> 0); -}; -function Ph(e) { - return typeof e == "string" && (process.env.NODE_ENV === "production" || e.charAt(0) === e.charAt(0).toLowerCase()); -} -var Im = function(e) { - return typeof e == "function" || typeof e == "object" && e !== null && !Array.isArray(e); -}, $4 = function(e) { - return e !== "__proto__" && e !== "constructor" && e !== "prototype"; -}; -function e6(e, n, t) { - var r = e[t]; - Im(n) && Im(r) ? hw(r, n) : e[t] = n; -} -function hw(e) { - for (var n = arguments.length, t = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++) - t[r - 1] = arguments[r]; - for (var i = 0, a = t; i < a.length; i++) { - var o = a[i]; - if (Im(o)) - for (var s in o) - $4(s) && e6(e, o[s], s); - } - return e; -} -var fw = g.createContext(); -fw.Consumer; -var Yv = {}; -function pw(e, n, t) { - var r = y1(e), i = !Ph(e), a = n.attrs, o = a === void 0 ? Kf : a, s = n.componentId, c = s === void 0 ? function(y, _) { - var S = typeof y != "string" ? "sc" : Wv(y); - Yv[S] = (Yv[S] || 0) + 1; - var b = S + "-" + dw("5.3.11" + S + Yv[S]); - return _ ? _ + "-" + b : b; - }(n.displayName, n.parentComponentId) : s, l = n.displayName, u = l === void 0 ? function(y) { - return Ph(y) ? "styled." + y : "Styled(" + wm(y) + ")"; - }(e) : l, d = n.displayName && n.componentId ? Wv(n.displayName) + "-" + n.componentId : n.componentId || c, h = r && e.attrs ? Array.prototype.concat(e.attrs, o).filter(Boolean) : o, f = n.shouldForwardProp; - r && e.shouldForwardProp && (f = n.shouldForwardProp ? function(y, _, S) { - return e.shouldForwardProp(y, _, S) && n.shouldForwardProp(y, _, S); - } : e.shouldForwardProp); - var p, v = new F4(t, d, r ? e.componentStyle : void 0), m = v.isStatic && o.length === 0, E = function(y, _) { - return function(S, b, A, w) { - var M = S.attrs, N = S.componentStyle, x = S.defaultProps, D = S.foldedComponentIds, j = S.shouldForwardProp, P = S.styledComponentId, G = S.target, z = function(J, B, se) { - J === void 0 && (J = ds); - var te = _o({}, B, { theme: J }), Me = {}; - return se.forEach(function(Ie) { - var we, Q, ze, Ce = Ie; - for (we in vd(Ce) && (Ce = Ce(te)), Ce) - te[we] = Me[we] = we === "className" ? (Q = Me[we], ze = Ce[we], Q && ze ? Q + " " + ze : Q || ze) : Ce[we]; - }), [te, Me]; - }(Q4(b, Lt(fw), x) || ds, b, M), q = z[0], Y = z[1], ye = function(J, B, se, te) { - var Me = G4(), Ie = z4(), we = B ? J.generateAndInjectStyles(ds, Me, Ie) : J.generateAndInjectStyles(se, Me, Ie); - return process.env.NODE_ENV !== "production" && !B && te && te(we), we; - }(N, w, q, process.env.NODE_ENV !== "production" ? S.warnTooManyClasses : void 0), $ = A, ae = Y.$as || b.$as || Y.as || b.as || G, de = Ph(ae), re = Y !== b ? _o({}, b, {}, Y) : b, K = {}; - for (var ee in re) - ee[0] !== "$" && ee !== "as" && (ee === "forwardedAs" ? K.as = re[ee] : (j ? j(ee, m_, ae) : !de || m_(ee)) && (K[ee] = re[ee])); - return b.style && Y.style !== b.style && (K.style = _o({}, b.style, {}, Y.style)), K.className = Array.prototype.concat(D, P, ye !== P ? ye : null, b.className, Y.className).filter(Boolean).join(" "), K.ref = $, ni(ae, K); - }(p, y, _, m); - }; - return E.displayName = u, (p = g.forwardRef(E)).attrs = h, p.componentStyle = v, p.displayName = u, p.shouldForwardProp = f, p.foldedComponentIds = r ? Array.prototype.concat(e.foldedComponentIds, e.styledComponentId) : Kf, p.styledComponentId = d, p.target = r ? e.target : e, p.withComponent = function(y) { - var _ = n.componentId, S = function(A, w) { - if (A == null) - return {}; - var M, N, x = {}, D = Object.keys(A); - for (N = 0; N < D.length; N++) - M = D[N], w.indexOf(M) >= 0 || (x[M] = A[M]); - return x; - }(n, ["componentId"]), b = _ && _ + "-" + (Ph(y) ? y : Wv(wm(y))); - return pw(y, _o({}, S, { attrs: h, componentId: b }), t); - }, Object.defineProperty(p, "defaultProps", { get: function() { - return this._foldedDefaultProps; - }, set: function(y) { - this._foldedDefaultProps = r ? hw({}, e.defaultProps, y) : y; - } }), process.env.NODE_ENV !== "production" && (Z4(u, d), p.warnTooManyClasses = function(y, _) { - var S = {}, b = !1; - return function(A) { - if (!b && (S[A] = !0, Object.keys(S).length >= 200)) { - var w = _ ? ' with the id of "' + _ + '"' : ""; - console.warn("Over 200 classes were generated for component " + y + w + `. -Consider using the attrs method, together with a style object for frequently changed styles. -Example: - const Component = styled.div.attrs(props => ({ - style: { - background: props.background, - }, - }))\`width: 100%;\` - - `), b = !0, S = {}; - } - }; - }(u, d)), Object.defineProperty(p, "toString", { value: function() { - return "." + p.styledComponentId; - } }), i && E4(p, e, { attrs: !0, componentStyle: !0, displayName: !0, foldedComponentIds: !0, shouldForwardProp: !0, styledComponentId: !0, target: !0, withComponent: !0 }), p; -} -var Mm = function(e) { - return function n(t, r, i) { - if (i === void 0 && (i = ds), !v1.isValidElementType(r)) - return Gc(1, String(r)); - var a = function() { - return t(r, i, ii.apply(void 0, arguments)); - }; - return a.withConfig = function(o) { - return n(t, r, _o({}, i, {}, o)); - }, a.attrs = function(o) { - return n(t, r, _o({}, i, { attrs: Array.prototype.concat(i.attrs, o).filter(Boolean) })); - }, a; - }(pw, e); -}; -["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "textPath", "tspan"].forEach(function(e) { - Mm[e] = Mm(e); -}); -function vw(e) { - process.env.NODE_ENV !== "production" && typeof navigator < "u" && navigator.product === "ReactNative" && console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated."); - for (var n = arguments.length, t = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++) - t[r - 1] = arguments[r]; - var i = ii.apply(void 0, [e].concat(t)).join(""), a = dw(i); - return new uw(a, i); -} -process.env.NODE_ENV !== "production" && typeof navigator < "u" && navigator.product === "ReactNative" && console.warn(`It looks like you've imported 'styled-components' on React Native. -Perhaps you're looking to import 'styled-components/native'? -Read more about this at https://www.styled-components.com/docs/basics#react-native`), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && typeof window < "u" && (window["__styled-components-init__"] = window["__styled-components-init__"] || 0, window["__styled-components-init__"] === 1 && console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason. - -See https://s-c.sh/2BAXzed for more info.`), window["__styled-components-init__"] += 1); -const X = Mm; -var Om = function(e, n) { - return Om = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, r) { - t.__proto__ = r; - } || function(t, r) { - for (var i in r) - Object.prototype.hasOwnProperty.call(r, i) && (t[i] = r[i]); - }, Om(e, n); -}; -function t6(e, n) { - if (typeof n != "function" && n !== null) - throw new TypeError("Class extends value " + String(n) + " is not a constructor or null"); - Om(e, n); - function t() { - this.constructor = e; - } - e.prototype = n === null ? Object.create(n) : (t.prototype = n.prototype, new t()); -} -var ce = function() { - return ce = Object.assign || function(n) { - for (var t, r = 1, i = arguments.length; r < i; r++) { - t = arguments[r]; - for (var a in t) - Object.prototype.hasOwnProperty.call(t, a) && (n[a] = t[a]); - } - return n; - }, ce.apply(this, arguments); -}; -function dr(e, n, t, r) { - function i(a) { - return a instanceof t ? a : new t(function(o) { - o(a); - }); - } - return new (t || (t = Promise))(function(a, o) { - function s(u) { - try { - l(r.next(u)); - } catch (d) { - o(d); - } - } - function c(u) { - try { - l(r.throw(u)); - } catch (d) { - o(d); - } - } - function l(u) { - u.done ? a(u.value) : i(u.value).then(s, c); - } - l((r = r.apply(e, n || [])).next()); - }); -} -function hr(e, n) { - var t = { label: 0, sent: function() { - if (a[0] & 1) - throw a[1]; - return a[1]; - }, trys: [], ops: [] }, r, i, a, o; - return o = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() { - return this; - }), o; - function s(l) { - return function(u) { - return c([l, u]); - }; - } - function c(l) { - if (r) - throw new TypeError("Generator is already executing."); - for (; o && (o = 0, l[0] && (t = 0)), t; ) - try { - if (r = 1, i && (a = l[0] & 2 ? i.return : l[0] ? i.throw || ((a = i.return) && a.call(i), 0) : i.next) && !(a = a.call(i, l[1])).done) - return a; - switch (i = 0, a && (l = [l[0] & 2, a.value]), l[0]) { - case 0: - case 1: - a = l; - break; - case 4: - return t.label++, { value: l[1], done: !1 }; - case 5: - t.label++, i = l[1], l = [0]; - continue; - case 7: - l = t.ops.pop(), t.trys.pop(); - continue; - default: - if (a = t.trys, !(a = a.length > 0 && a[a.length - 1]) && (l[0] === 6 || l[0] === 2)) { - t = 0; - continue; - } - if (l[0] === 3 && (!a || l[1] > a[0] && l[1] < a[3])) { - t.label = l[1]; - break; - } - if (l[0] === 6 && t.label < a[1]) { - t.label = a[1], a = l; - break; - } - if (a && t.label < a[2]) { - t.label = a[2], t.ops.push(l); - break; - } - a[2] && t.ops.pop(), t.trys.pop(); - continue; - } - l = n.call(e, t); - } catch (u) { - l = [6, u], i = 0; - } finally { - r = a = 0; - } - if (l[0] & 5) - throw l[1]; - return { value: l[0] ? l[1] : void 0, done: !0 }; - } -} -function ht(e, n, t) { - if (t || arguments.length === 2) - for (var r = 0, i = n.length, a; r < i; r++) - (a || !(r in n)) && (a || (a = Array.prototype.slice.call(n, 0, r)), a[r] = n[r]); - return e.concat(a || Array.prototype.slice.call(n)); -} -const tu = { - reactions: "reactions", - message_search_v3: "message_search_v3", - enable_og_tag: "enable_og_tag", - enable_message_threading: "enable_message_threading", - allow_broadcast_channel: "allow_broadcast_channel", - allow_super_group_channel: "allow_super_group_channel" -}; -var xm = function(e, n) { - return xm = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, r) { - t.__proto__ = r; - } || function(t, r) { - for (var i in r) - Object.prototype.hasOwnProperty.call(r, i) && (t[i] = r[i]); - }, xm(e, n); -}; -function O(e, n) { - if (typeof n != "function" && n !== null) - throw new TypeError("Class extends value " + String(n) + " is not a constructor or null"); - function t() { - this.constructor = e; - } - xm(e, n), e.prototype = n === null ? Object.create(n) : (t.prototype = n.prototype, new t()); -} -var L = function() { - return L = Object.assign || function(e) { - for (var n, t = 1, r = arguments.length; t < r; t++) - for (var i in n = arguments[t]) - Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]); - return e; - }, L.apply(this, arguments); -}; -function n6(e, n) { - var t = {}; - for (var r in e) - Object.prototype.hasOwnProperty.call(e, r) && n.indexOf(r) < 0 && (t[r] = e[r]); - if (e != null && typeof Object.getOwnPropertySymbols == "function") { - var i = 0; - for (r = Object.getOwnPropertySymbols(e); i < r.length; i++) - n.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (t[r[i]] = e[r[i]]); - } - return t; -} -function T(e, n, t, r) { - return new (t || (t = Promise))(function(i, a) { - function o(l) { - try { - c(r.next(l)); - } catch (u) { - a(u); - } - } - function s(l) { - try { - c(r.throw(l)); - } catch (u) { - a(u); - } - } - function c(l) { - var u; - l.done ? i(l.value) : (u = l.value, u instanceof t ? u : new t(function(d) { - d(u); - })).then(o, s); - } - c((r = r.apply(e, n || [])).next()); - }); -} -function C(e, n) { - var t, r, i, a, o = { label: 0, sent: function() { - if (1 & i[0]) - throw i[1]; - return i[1]; - }, trys: [], ops: [] }; - return a = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { - return this; - }), a; - function s(c) { - return function(l) { - return function(u) { - if (t) - throw new TypeError("Generator is already executing."); - for (; a && (a = 0, u[0] && (o = 0)), o; ) - try { - if (t = 1, r && (i = 2 & u[0] ? r.return : u[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, u[1])).done) - return i; - switch (r = 0, i && (u = [2 & u[0], i.value]), u[0]) { - case 0: - case 1: - i = u; - break; - case 4: - return o.label++, { value: u[1], done: !1 }; - case 5: - o.label++, r = u[1], u = [0]; - continue; - case 7: - u = o.ops.pop(), o.trys.pop(); - continue; - default: - if (i = o.trys, !((i = i.length > 0 && i[i.length - 1]) || u[0] !== 6 && u[0] !== 2)) { - o = 0; - continue; - } - if (u[0] === 3 && (!i || u[1] > i[0] && u[1] < i[3])) { - o.label = u[1]; - break; - } - if (u[0] === 6 && o.label < i[1]) { - o.label = i[1], i = u; - break; - } - if (i && o.label < i[2]) { - o.label = i[2], o.ops.push(u); - break; - } - i[2] && o.ops.pop(), o.trys.pop(); - continue; - } - u = n.call(e, o); - } catch (d) { - u = [6, d], r = 0; - } finally { - t = i = 0; - } - if (5 & u[0]) - throw u[1]; - return { value: u[0] ? u[1] : void 0, done: !0 }; - }([c, l]); - }; - } -} -function Ne(e) { - var n = typeof Symbol == "function" && Symbol.iterator, t = n && e[n], r = 0; - if (t) - return t.call(e); - if (e && typeof e.length == "number") - return { next: function() { - return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; - } }; - throw new TypeError(n ? "Object is not iterable." : "Symbol.iterator is not defined."); -} -function tt(e, n) { - var t = typeof Symbol == "function" && e[Symbol.iterator]; - if (!t) - return e; - var r, i, a = t.call(e), o = []; - try { - for (; (n === void 0 || n-- > 0) && !(r = a.next()).done; ) - o.push(r.value); - } catch (s) { - i = { error: s }; - } finally { - try { - r && !r.done && (t = a.return) && t.call(a); - } finally { - if (i) - throw i.error; - } - } - return o; -} -function dt(e, n, t) { - if (t || arguments.length === 2) - for (var r, i = 0, a = n.length; i < a; i++) - !r && i in n || (r || (r = Array.prototype.slice.call(n, 0, i)), r[i] = n[i]); - return e.concat(r || Array.prototype.slice.call(n)); -} -var nt, mw = "4.11.2", hs = function() { - function e() { - } - return Object.defineProperty(e, "OS_VERSION", { get: function() { - return typeof navigator < "u" && navigator.userAgent ? navigator.userAgent.replace(/,/g, ".") : "noAgent"; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "SDK_VERSION", { get: function() { - return mw; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "SDK_MAJOR_VERSION", { get: function() { - return e.SDK_VERSION.split(".")[0]; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL", { get: function() { - return 100; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "INTERNAL_CALL", { get: function() { - return "ic"; - }, enumerable: !1, configurable: !0 }), e; -}(); -(function(e) { - e[e.NON_AUTHORIZED = 400108] = "NON_AUTHORIZED", e[e.INVALID_TOKEN = 400111] = "INVALID_TOKEN", e[e.NOT_FOUND_IN_DATABASE = 400201] = "NOT_FOUND_IN_DATABASE", e[e.USER_AUTH_DEACTIVATED = 400300] = "USER_AUTH_DEACTIVATED", e[e.USER_AUTH_DELETED_OR_NOT_FOUND = 400301] = "USER_AUTH_DELETED_OR_NOT_FOUND", e[e.SESSION_TOKEN_EXPIRED = 400302] = "SESSION_TOKEN_EXPIRED", e[e.APPLICATION_NOT_FOUND = 400304] = "APPLICATION_NOT_FOUND", e[e.SESSION_KEY_EXPIRED = 400309] = "SESSION_KEY_EXPIRED", e[e.SESSION_REVOKED = 400310] = "SESSION_REVOKED", e[e.INVALID_SESSION_TYPE = 400312] = "INVALID_SESSION_TYPE", e[e.STAT_UPLOAD_NOT_ALLOWED = 403200] = "STAT_UPLOAD_NOT_ALLOWED", e[e.NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE = 400940] = "NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE", e[e.INTERNAL_SERVER_ERROR = 500901] = "INTERNAL_SERVER_ERROR", e[e.RATE_LIMIT_EXCEEDED = 500910] = "RATE_LIMIT_EXCEEDED", e[e.INVALID_FORM_KEY = 400111] = "INVALID_FORM_KEY", e[e.INVALID_REQUIRED_FORM_VALUE = 400105] = "INVALID_REQUIRED_FORM_VALUE", e[e.UNKNOWN_SERVER_ERROR = 900200] = "UNKNOWN_SERVER_ERROR", e[e.NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE = 901500] = "NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE", e[e.ERR_DUPLICATED_DATA = 400202] = "ERR_DUPLICATED_DATA", e[e.DEBUG_MODE_REQUIRED = 7e5] = "DEBUG_MODE_REQUIRED", e[e.LOST_INSTANCE = 700100] = "LOST_INSTANCE", e[e.CONNECTION_RENEW = 700102] = "CONNECTION_RENEW", e[e.INVALID_CONNECTION_STATE_TRANSITION = 700200] = "INVALID_CONNECTION_STATE_TRANSITION", e[e.INVALID_COMMAND = 700700] = "INVALID_COMMAND", e[e.XMLHTTPREQUEST_NOT_SUPPORTED = 700800] = "XMLHTTPREQUEST_NOT_SUPPORTED", e[e.UNKNOWN_ERROR = 77e4] = "UNKNOWN_ERROR", e[e.INVALID_INITIALIZATION = 800100] = "INVALID_INITIALIZATION", e[e.CONNECTION_REQUIRED = 800101] = "CONNECTION_REQUIRED", e[e.CONNECTION_CANCELED = 800102] = "CONNECTION_CANCELED", e[e.INVALID_PARAMETER = 800110] = "INVALID_PARAMETER", e[e.NOT_SUPPORTED_ERROR = 800111] = "NOT_SUPPORTED_ERROR", e[e.NETWORK_ERROR = 800120] = "NETWORK_ERROR", e[e.NETWORK_ROUTING_ERROR = 800121] = "NETWORK_ROUTING_ERROR", e[e.MALFORMED_DATA = 800130] = "MALFORMED_DATA", e[e.MALFORMED_ERROR_DATA = 800140] = "MALFORMED_ERROR_DATA", e[e.WRONG_CHANNEL_TYPE = 800150] = "WRONG_CHANNEL_TYPE", e[e.MARK_AS_READ_RATE_LIMIT_EXCEEDED = 800160] = "MARK_AS_READ_RATE_LIMIT_EXCEEDED", e[e.QUERY_IN_PROGRESS = 800170] = "QUERY_IN_PROGRESS", e[e.ACK_TIMEOUT = 800180] = "ACK_TIMEOUT", e[e.LOGIN_TIMEOUT = 800190] = "LOGIN_TIMEOUT", e[e.WEBSOCKET_CONNECTION_CLOSED = 800200] = "WEBSOCKET_CONNECTION_CLOSED", e[e.WEBSOCKET_CONNECTION_FAILED = 800210] = "WEBSOCKET_CONNECTION_FAILED", e[e.REQUEST_FAILED = 800220] = "REQUEST_FAILED", e[e.FILE_UPLOAD_CANCEL_FAILED = 800230] = "FILE_UPLOAD_CANCEL_FAILED", e[e.REQUEST_CANCELED = 800240] = "REQUEST_CANCELED", e[e.REQUEST_DUPLICATED = 800250] = "REQUEST_DUPLICATED", e[e.FILE_SIZE_LIMIT_EXCEEDED = 800260] = "FILE_SIZE_LIMIT_EXCEEDED", e[e.SESSION_TOKEN_REQUEST_FAILED = 800500] = "SESSION_TOKEN_REQUEST_FAILED", e[e.SESSION_TOKEN_REFRESHED = 800501] = "SESSION_TOKEN_REFRESHED", e[e.SESSION_TOKEN_REFRESH_FAILED = 800502] = "SESSION_TOKEN_REFRESH_FAILED", e[e.COLLECTION_DISPOSED = 800600] = "COLLECTION_DISPOSED", e[e.DATABASE_ERROR = 800700] = "DATABASE_ERROR"; -})(nt || (nt = {})); -var Gr, el, ur, Rm, ku, qr = function(e) { - return !(e instanceof H && !e.shouldThrowOutside); -}, H = function(e) { - function n(t) { - var r = t.code, i = r === void 0 ? 0 : r, a = t.message, o = a === void 0 ? "" : a, s = e.call(this, o) || this; - return s.shouldThrowOutside = !1, s._detail = "", s.name = "SendbirdError", s.code = i, Object.setPrototypeOf(s, n.prototype), s; - } - return O(n, e), Object.defineProperty(n.prototype, "detail", { get: function() { - return this._detail; - }, enumerable: !1, configurable: !0 }), n.prototype.setDetail = function(t) { - this._detail = t; - }, Object.defineProperty(n.prototype, "isInvalidTokenError", { get: function() { - return this.code === nt.INVALID_TOKEN; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isSessionExpiredError", { get: function() { - return this.isSessionTokenExpiredError || this.isSessionKeyExpiredError; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isSessionTokenExpiredError", { get: function() { - return this.code === nt.SESSION_TOKEN_EXPIRED; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isSessionKeyExpiredError", { get: function() { - return this.code === nt.SESSION_KEY_EXPIRED; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isSessionInvalidatedError", { get: function() { - return this.isSessionRevokedError || this.isUserAuthDeactivedError || this.isUserAuthDeletedOrNotFoundError; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isSessionRevokedError", { get: function() { - return this.code === nt.SESSION_REVOKED; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isUserAuthDeactivedError", { get: function() { - return this.code === nt.USER_AUTH_DEACTIVATED; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isUserAuthDeletedOrNotFoundError", { get: function() { - return this.code === nt.USER_AUTH_DELETED_OR_NOT_FOUND; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isNetworkError", { get: function() { - return this.code === nt.NETWORK_ERROR || this.code === nt.NETWORK_ROUTING_ERROR; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "debugModeRequired", { get: function() { - return new n({ code: nt.DEBUG_MODE_REQUIRED, message: "Cannot run this operation in production mode." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "lostInstance", { get: function() { - return new n({ code: nt.LOST_INSTANCE, message: "Instance ID is missing. It should belong to an instance." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "invalidCommand", { get: function() { - return new n({ code: nt.INVALID_COMMAND, message: "Cannot send invalid command." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "unknown", { get: function() { - return new n({ code: nt.UNKNOWN_ERROR, message: "Unknown error occurred." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "connectionRenew", { get: function() { - return new n({ code: nt.CONNECTION_RENEW, message: "Connection restarts." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "invalidConnectionStateTransition", { get: function() { - return new n({ code: nt.INVALID_CONNECTION_STATE_TRANSITION, message: "Invalid connection state transition." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "xmlHttpRequestNotSupported", { get: function() { - return new n({ code: nt.XMLHTTPREQUEST_NOT_SUPPORTED, message: "Cannot upload file. XMLHttpRequest is not defined in this environment." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "connectionRequired", { get: function() { - return new n({ code: nt.CONNECTION_REQUIRED, message: "Connection is required." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "connectionCanceled", { get: function() { - return new n({ code: nt.CONNECTION_CANCELED, message: "Connection is canceled." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "invalidParameters", { get: function() { - return new n({ code: nt.INVALID_PARAMETER, message: "Invalid parameters." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "notSupportedError", { get: function() { - return new n({ code: nt.NOT_SUPPORTED_ERROR, message: "Given parameters are not supported." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "channelTypeNotSupportedError", { get: function() { - return new n({ code: nt.NOT_SUPPORTED_ERROR, message: "Called method is not supported in the current channel's channel type." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "networkError", { get: function() { - return new n({ code: nt.NETWORK_ERROR, message: "There was a network error." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "markAsReadAllRateLimitExceeded", { get: function() { - return new n({ code: nt.MARK_AS_READ_RATE_LIMIT_EXCEEDED, message: "markAsRead rate limit exceeded." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "queryInProgress", { get: function() { - return new n({ code: nt.QUERY_IN_PROGRESS, message: "Query in progress." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "noAckTimeout", { get: function() { - return new n({ code: nt.ACK_TIMEOUT, message: "Command received no ack." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "loginTimeout", { get: function() { - return new n({ code: nt.LOGIN_TIMEOUT, message: "Connection timeout." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "connectionClosed", { get: function() { - return new n({ code: nt.WEBSOCKET_CONNECTION_CLOSED, message: "Connection is closed. Please reconnect." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "requestFailed", { get: function() { - return new n({ code: nt.REQUEST_FAILED, message: "Request failed." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "alreadyConnectedAsAnotherUser", { get: function() { - return new n({ code: nt.REQUEST_FAILED, message: "Already logged in as a different user. Call disconnect() first." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "fileUploadCanceled", { get: function() { - return new n({ code: nt.FILE_UPLOAD_CANCEL_FAILED, message: "File upload has been canceled." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "requestCanceled", { get: function() { - return new n({ code: nt.REQUEST_CANCELED, message: "Request has been canceled." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "sessionTokenRefreshFailed", { get: function() { - return new n({ code: nt.SESSION_TOKEN_REFRESH_FAILED, message: "Failed to refresh the session key." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "sessionTokenRequestFailed", { get: function() { - return new n({ code: nt.SESSION_TOKEN_REQUEST_FAILED, message: "Failed to get the session token." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "databaseError", { get: function() { - return new n({ code: nt.DATABASE_ERROR, message: "Database error." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "fileSizeLimitExceededError", { get: function() { - return new n({ code: nt.FILE_SIZE_LIMIT_EXCEEDED, message: "File size exceeds the file size limit." }); - }, enumerable: !1, configurable: !0 }), n.prototype.throwOutside = function() { - throw this.shouldThrowOutside = !0, this; - }, n; -}(Error), r6 = [nt.CONNECTION_REQUIRED, nt.NETWORK_ERROR, nt.ACK_TIMEOUT, nt.WEBSOCKET_CONNECTION_CLOSED, nt.WEBSOCKET_CONNECTION_FAILED, nt.FILE_UPLOAD_CANCEL_FAILED, nt.REQUEST_CANCELED, nt.INTERNAL_SERVER_ERROR, nt.RATE_LIMIT_EXCEEDED, nt.UNKNOWN_SERVER_ERROR], i6 = [nt.WEBSOCKET_CONNECTION_CLOSED, nt.WEBSOCKET_CONNECTION_FAILED, nt.CONNECTION_REQUIRED], gw = function(e, n) { - if (e !== n) { - var t = L({}, e), r = L({}, n); - return (!t.hasOwnProperty("messageId") || !r.hasOwnProperty("messageId") || t.messageId === r.messageId) && (!t.hasOwnProperty("reqId") || !r.hasOwnProperty("reqId") || t.reqId === r.reqId) && (t.hasOwnProperty("messageId") && delete t.messageId, t.hasOwnProperty("reqId") && delete t.reqId, r.hasOwnProperty("messageId") && delete r.messageId, r.hasOwnProperty("reqId") && delete r.reqId, JSON.stringify(t) === JSON.stringify(r)); - } - return !0; -}, k = function(e, n, t) { - return t === void 0 && (t = !1), !(!t || !th(n)) || (typeof e != "string" ? typeof e == "object" ? Mt(e, n) : a6(e, n) : typeof n === e); -}, Mt = function(e, n, t) { - return t === void 0 && (t = !1), !(!t || !th(n)) || Object.values(e).includes(n); -}, a6 = function(e, n) { - return n instanceof e; -}, Ot = function(e, n, t) { - return t === void 0 && (t = !1), !(!t || !th(n)) || Array.isArray(n) && n.every(function(r) { - return k(e, r); - }); -}, M_ = function(e, n) { - return n === void 0 && (n = !1), !(!n || !th(e)) || typeof e == "number" && e.toString().length === 13; -}, o6 = function(e) { - return e > 0 && r6.indexOf(e) >= 0; -}, Yf = function(e) { - return e > 0 && i6.indexOf(e) >= 0; -}, fr = function(e, n) { - if (n === void 0 && (n = !1), n && th(e)) - return !0; - var t = typeof e == "object" && e !== null && e.hasOwnProperty("name") && typeof e.name == "string" && e.hasOwnProperty("uri") && typeof e.uri == "string" && e.hasOwnProperty("type") && typeof e.type == "string"; - if (!t) { - if (typeof Blob < "u") - return e instanceof Blob; - if (typeof File < "u") - return e instanceof File; - } - return t; -}, s6 = function(e, n) { - if (e === n) - return !0; - if (e == null || n == null || e.length !== n.length) - return !1; - for (var t = dt([], tt(e), !1).sort(), r = dt([], tt(n), !1).sort(), i = 0; i < t.length; ++i) - if (t[i] !== r[i]) - return !1; - return !0; -}, th = function(e) { - return e == null; -}, yw = function() { - function e(n) { - var t = n === void 0 ? {} : n, r = t.useMemberInfoInMessage, i = r === void 0 || r, a = t.typingIndicatorInvalidateTime, o = a === void 0 ? 1e4 : a, s = t.typingIndicatorThrottle, c = s === void 0 ? 1e3 : s, l = t.websocketResponseTimeout, u = l === void 0 ? 1e4 : l, d = t.websocketPayloadDecompression, h = d === void 0 || d, f = t.sessionTokenRefreshTimeout, p = f === void 0 ? 60 : f; - this._useMemberInfoInMessage = !0, this._typingIndicatorInvalidateTime = 1e4, this._typingIndicatorThrottle = 1e3, this._websocketResponseTimeout = 1e4, this._sessionTokenRefreshTimeout = 60, this._useMemberInfoInMessage = i, this._typingIndicatorInvalidateTime = o, this._typingIndicatorThrottle = c, this._websocketResponseTimeout = u, this._sessionTokenRefreshTimeout = p, this.websocketPayloadDecompression = h; - } - return Object.defineProperty(e.prototype, "useMemberInfoInMessage", { get: function() { - return this._useMemberInfoInMessage; - }, set: function(n) { - k("boolean", n) && (this._useMemberInfoInMessage = n); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "typingIndicatorInvalidateTime", { get: function() { - return this._typingIndicatorInvalidateTime; - }, set: function(n) { - k("number", n) && (this._typingIndicatorInvalidateTime = n); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "typingIndicatorThrottle", { get: function() { - return this._typingIndicatorThrottle; - }, set: function(n) { - k("number", n) && n >= 1e3 && n <= 9e3 && (this._typingIndicatorThrottle = n); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "websocketResponseTimeout", { get: function() { - return this._websocketResponseTimeout; - }, set: function(n) { - k("number", n) && n >= 5e3 && n <= 3e4 && (this._websocketResponseTimeout = n); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "sessionTokenRefreshTimeout", { get: function() { - return this._sessionTokenRefreshTimeout; - }, set: function(n) { - k("number", n) && (n < 60 ? n = 60 : n > 1800 && (n = 1800), this._sessionTokenRefreshTimeout = n); - }, enumerable: !1, configurable: !0 }), e; -}(), Ew = { encrypt: function(e) { - return e; -}, decrypt: function(e) { - return e; -} }, O_ = function() { - function e(n) { - var t = n.store; - this._preference = /* @__PURE__ */ new Map(), this._store = t; - } - return e.prototype._savePreferenceKeys = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, this._store.set({ key: this._keysAddress, value: dt([], tt(this._preference.keys()), !1) })]; - case 1: - return n.sent(), [2]; - } - }); - }); - }, e.prototype.init = function(n, t) { - var r; - return t === void 0 && (t = 1), T(this, void 0, void 0, function() { - var i, a, o, s, c, l, u, d, h, f; - return C(this, function(p) { - switch (p.label) { - case 0: - return this._version = t, this._keysAddress = n, i = "".concat(n, ".metadata.version"), [4, this._store.get(i)]; - case 1: - return a = p.sent(), [4, this._store.get(n)]; - case 2: - return o = (r = p.sent()) !== null && r !== void 0 ? r : [], !a || a.version < this._version ? [4, this._resetPreferenceData(o, i)] : [3, 4]; - case 3: - return p.sent(), [3, 11]; - case 4: - p.trys.push([4, 9, 10, 11]), s = Ne(o), c = s.next(), p.label = 5; - case 5: - return c.done ? [3, 8] : (l = c.value, [4, this._store.get(l)]); - case 6: - (u = p.sent()) && this._preference.set(l, u), p.label = 7; - case 7: - return c = s.next(), [3, 5]; - case 8: - return [3, 11]; - case 9: - return d = p.sent(), h = { error: d }, [3, 11]; - case 10: - try { - c && !c.done && (f = s.return) && f.call(s); - } finally { - if (h) - throw h.error; - } - return [7]; - case 11: - return [2]; - } - }); - }); - }, e.prototype._resetPreferenceData = function(n, t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return this._preference = /* @__PURE__ */ new Map(), [4, this._store.removeMany(n)]; - case 1: - return r.sent(), [4, this._store.set({ key: t, value: { version: this._version } })]; - case 2: - return r.sent(), [2]; - } - }); - }); - }, e.prototype.get = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return [2, this._preference.get(n)]; - }); - }); - }, e.prototype.set = function(n, t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = !this._preference.has(n), [4, this._store.set({ key: n, value: t })]; - case 1: - return i.sent(), this._preference.set(n, t), r ? [4, this._savePreferenceKeys()] : [3, 3]; - case 2: - i.sent(), i.label = 3; - case 3: - return [2]; - } - }); - }); - }, e.prototype.remove = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this._store.remove(n)]; - case 1: - return t.sent(), this._preference.delete(n), [4, this._savePreferenceKeys()]; - case 2: - return t.sent(), [2]; - } - }); - }); - }, e.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, this._store.removeMany(dt([], tt(this._preference.keys()), !1))]; - case 1: - return n.sent(), this._preference.clear(), [4, this._savePreferenceKeys()]; - case 2: - return n.sent(), [2]; - } - }); - }); - }, e; -}(), l6 = function() { - function e(n) { - var t = n.encryption, r = n.store, i = n.localCacheEnabled, a = n.localCacheConfig; - this.store = r, this.preference = new O_({ store: r }), this.encryption = t ?? Ew, this.localCacheEnabled = i, this.localCacheConfig = a; - } - return e.prototype.replaceStore = function(n) { - this.store = n, this.preference = new O_({ store: n }); - }, e; -}(); -(function(e) { - e.SUCCESS = "success", e.PENDING = "pending", e.ERROR = "error"; -})(Gr || (Gr = {})), function(e) { - e.DEFAULT = "default", e.ALL = "all", e.MENTION_ONLY = "mention_only", e.OFF = "off"; -}(el || (el = {})), function(e) { - e.FCM = "gcm", e.APNS = "apns", e.UNKNOWN = "unknown"; -}(ur || (ur = {})), function(e) { - e.ALTERNATIVE = "alternative", e.DEFAULT = "default"; -}(Rm || (Rm = {})), function(e) { - e.CUSTOM = "custom", e.MESSAGE_COLLECTION_ACCESSED_AT = "messagecollection_accessed_at"; -}(ku || (ku = {})); -var md, c6 = function() { - function e(n) { - var t = n.channel, r = n.cachedMessageCount; - this._cachedMessageCount = 0, this._channel = t, this._cachedMessageCount = r; - } - return Object.defineProperty(e.prototype, "channel", { get: function() { - return this._channel; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "cachedMessageCount", { get: function() { - return this._cachedMessageCount; - }, enumerable: !1, configurable: !0 }), e; -}(), _w = function() { - function e(n) { - var t = n === void 0 ? {} : n, r = t.maxSize, i = r === void 0 ? 256 : r, a = t.clearOrder, o = a === void 0 ? ku.MESSAGE_COLLECTION_ACCESSED_AT : a, s = t.customClearOrderComparator, c = t.enableAutoResend, l = c === void 0 || c; - this._clearOrderComparatorUseMessageCollectionAccessedAt = function(u, d) { - return u.channel.messageCollectionLastAccessedAt === d.channel.messageCollectionLastAccessedAt ? u.channel.lastMessage && !d.channel.lastMessage ? 1 : !u.channel.lastMessage && d.channel.lastMessage ? -1 : u.channel.lastMessage || d.channel.lastMessage ? u.channel.lastMessage.createdAt - d.channel.lastMessage.createdAt : 0 : u.channel.messageCollectionLastAccessedAt > d.channel.messageCollectionLastAccessedAt ? 1 : -1; - }, this._maxSize = Math.max(i, 64), s ? (this._clearOrder = o, this._customClearOrderComparator = s) : this._clearOrder = ku.MESSAGE_COLLECTION_ACCESSED_AT, this._enableAutoResend = l; - } - return Object.defineProperty(e.prototype, "maxSize", { get: function() { - return this._maxSize; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "clearOrder", { get: function() { - return this._clearOrder; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "clearOrderComparator", { get: function() { - var n; - return this._clearOrder === ku.MESSAGE_COLLECTION_ACCESSED_AT ? this._clearOrderComparatorUseMessageCollectionAccessedAt : (n = this._customClearOrderComparator) !== null && n !== void 0 ? n : this._clearOrderComparatorUseMessageCollectionAccessedAt; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "enableAutoResend", { get: function() { - return this._enableAutoResend; - }, enumerable: !1, configurable: !0 }), e; -}(); -(function(e) { - e.FEED = "feed", e.CHAT = "chat"; -})(md || (md = {})); -var Ft, ea, Ba, Ln, Nr, Sc, Or, ir, Ca, $t, x_, Dm, Lm, u6 = function() { - function e() { - this.isRefreshing = !1; - } - return Object.defineProperty(e.prototype, "hasSession", { get: function() { - return !!this.sessionKey; - }, enumerable: !1, configurable: !0 }), e.prototype.clear = function() { - this.authToken = void 0, this.sessionKey = void 0, this.services = []; - }, e; -}(), Ro = function() { - var e = (/* @__PURE__ */ new Date()).getTime(); - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(n) { - var t = (e + 16 * Math.random()) % 16 | 0; - return e = Math.floor(e / 16), (n === "x" ? t : 3 & t | 8).toString(16); - }); -}, R_ = function() { - function e(n) { - var t = n.container; - this._container = {}, this._container = t, this.key = Ro(); - } - return e.prototype._register = function(n, t, r) { - var i; - return n in this._container || (this._container[n] = /* @__PURE__ */ new Map()), (i = this._container[n]) === null || i === void 0 || i.set(this.key, { occurence: t, handler: r }), this; - }, e.prototype.on = function(n, t) { - return this._register(n, -1, t); - }, e.prototype.once = function(n, t) { - return this._register(n, 1, t); - }, e.prototype.close = function() { - var n; - for (var t in this._container) - (n = this._container[t]) === null || n === void 0 || n.delete(this.key); - }, e; -}(), Dl = function() { - function e() { - this._container = {}; - } - return e.prototype.on = function(n, t) { - return new R_({ container: this._container }).on(n, t); - }, e.prototype.once = function(n, t) { - return new R_({ container: this._container }).once(n, t); - }, e.prototype.dispatch = function(n, t) { - var r, i, a = this._container[n]; - if (a) { - var o = []; - try { - for (var s = Ne(a.keys()), c = s.next(); !c.done; c = s.next()) { - var l = c.value, u = a.get(l); - u.handler(t), u.occurence > 0 && (u.occurence--, u.occurence === 0 && o.push(l)); - } - } catch (d) { - r = { error: d }; - } finally { - try { - c && !c.done && (i = s.return) && i.call(s); - } finally { - if (r) - throw r.error; - } - } - o.forEach(function(d) { - return a.delete(d); - }); - } - }, e; -}(), d6 = function() { - function e() { - this._dispatcher = new Dl(); - } - return e.prototype.on = function(n) { - return this._dispatcher.on("event", n); - }, e.prototype.once = function(n) { - return this._dispatcher.once("event", n); - }, e.prototype.dispatch = function(n) { - this._dispatcher.dispatch("event", n); - }, e; -}(), bn = function() { -}, Be = function(e) { - var n = {}; - return e && Object.keys(e).forEach(function(t) { - e[t] === void 0 || Number.isNaN(e[t]) || e[t] === null || (n[t] = e[t]); - }), n; -}, Xe = function(e) { - if (e != null) { - if (typeof e == "object") { - if (Array.isArray(e)) { - var n = dt([], tt(e), !1); - for (var t in n) - n[t] = Xe(n[t]); - return n; - } - for (var r in e) - e[r] === null && delete e[r]; - return e; - } - return e; - } -}; -(function(e) { - e.BASE = "base", e.GROUP = "group", e.OPEN = "open", e.FEED = "feed"; -})(Ft || (Ft = {})), function(e) { - e.OPERATOR = "operator", e.NONE = "none"; -}(ea || (ea = {})), function(e) { - e.MUTED = "muted", e.UNMUTED = "unmuted"; -}(Ba || (Ba = {})), function(e) { - e.BASE = "base", e.USER = "user", e.FILE = "file", e.ADMIN = "admin"; -}(Ln || (Ln = {})), function(e) { - e.ALL = "", e.USER = "MESG", e.FILE = "FILE", e.ADMIN = "ADMM"; -}(Nr || (Nr = {})), function(e) { - e.USER = "MESG", e.FILE = "FILE", e.ADMIN = "ADMM"; -}(Sc || (Sc = {})), function(e) { - e.USERS = "users", e.CHANNEL = "channel"; -}(Or || (Or = {})), function(e) { - e.ALL = "all", e.NONE = "none", e.ONLY_REPLY_TO_CHANNEL = "only_reply_to_channel"; -}(ir || (ir = {})), function(e) { - e.DEFAULT = "default", e.SUPPRESS = "suppress"; -}(Ca || (Ca = {})), function(e) { - e.PENDING = "pending", e.SCHEDULED = "scheduled", e.SUCCEEDED = "succeeded", e.FAILED = "failed", e.CANCELED = "canceled"; -}($t || ($t = {})), function(e) { - e.INREVIEW = "InReview", e.APPROVED = "Approved"; -}(x_ || (x_ = {})), function(e) { - e.HIGH = "high", e.NORMAL = "normal", e.LOW = "low"; -}(Dm || (Dm = {})), function(e) { - e.CREATED_AT = "created_at", e.UPDATED_AT = "updated_at"; -}(Lm || (Lm = {})); -var pe, si = "v3", qt = "/".concat(si, "/users"), h6 = "/".concat(si, "/storage/file"), xr = "/".concat(si, "/group_channels"), f6 = "/".concat(si, "/sdk/group_channels"), Ll = "/".concat(si, "/open_channels"), p6 = "/".concat(si, "/sdk/open_channels"), v6 = "/".concat(si, "/search"), Pm = "/".concat(si, "/report"), m6 = "/".concat(si, "/emojis"), bw = "/".concat(si, "/emoji_categories"), Aa = "/".concat(si, "/polls"), Cw = "/".concat(si, "/scheduled_messages"), g6 = "/".concat(si, "/sdk/ui_kit/configuration"), y6 = "/".concat(si, "/sdk/statistics"), Tw = "/".concat(si, "/message_templates"), Kt = function(e) { - switch (e) { - case Ft.FEED: - case Ft.GROUP: - return xr; - case Ft.OPEN: - return Ll; - default: - return null; - } -}, Sw = function(e) { - switch (e) { - case Ft.GROUP: - return "".concat(Pm, "/group_channels"); - case Ft.OPEN: - return "".concat(Pm, "/open_channels"); - default: - return null; - } -}, wc = function(e, n, t) { - var r, i; - switch (e) { - case Or.CHANNEL: - return !0; - case Or.USERS: - if (n) - try { - for (var a = Ne(n), o = a.next(); !o.done; o = a.next()) - if (o.value === t) - return !0; - } catch (s) { - r = { error: s }; - } finally { - try { - o && !o.done && (i = a.return) && i.call(a); - } finally { - if (r) - throw r.error; - } - } - } - return !1; -}, _1 = function(e, n, t) { - var r, i, a, o, s = wc((r = e.mentionType) !== null && r !== void 0 ? r : null, (i = e.mentionedUserIds) !== null && i !== void 0 ? i : [], t), c = wc((a = n.mentionType) !== null && a !== void 0 ? a : null, (o = n.mentionedUserIds) !== null && o !== void 0 ? o : [], t); - return !s && c ? 1 : s && !c ? -1 : 0; -}, ww = function(e, n, t) { - var r, i = n || new FormData(); - for (var a in e) - if (e.hasOwnProperty(a)) { - var o = e[a], s = t ? "".concat(t, "[").concat(a, "]") : a; - fr(o) ? i.append(s, o, (r = o.name) !== null && r !== void 0 ? r : "filename") : typeof o != "object" || o === null || Array.isArray(o) || o instanceof Blob ? i.append(s, String(o)) : i = ww(o, i, s); - } - return i; -}; -(function(e) { - e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.DELETE = "DELETE"; -})(pe || (pe = {})); -var Tn, ge = function(e) { - function n() { - var t = e !== null && e.apply(this, arguments) || this; - return t.params = {}, t.requireAuth = !0, t.headers = {}, t.requestId = Ro(), t; - } - return O(n, e), n.prototype.encodeParams = function(t) { - var r = this; - return t == null || t === "" ? encodeURIComponent("") : Array.isArray(t) ? t.map(function(i) { - return r.encodeParams(i); - }).join(",") : encodeURIComponent(typeof t == "object" ? JSON.stringify(t) : String(t)); - }, Object.defineProperty(n.prototype, "query", { get: function() { - var t = this, r = Be(this.params); - return "?".concat(Object.keys(r).map(function(i) { - return "".concat(encodeURIComponent(i), "=").concat(t.encodeParams(r[i])); - }).join("&")); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "payload", { get: function() { - var t = Be(this.params); - return Object.keys(t).some(function(r) { - return fr(t[r]); - }) ? ww(t) : JSON.stringify(t); - }, enumerable: !1, configurable: !0 }), n; -}(bn), _e = function(e) { - function n(t, r) { - var i = e.call(this) || this; - return i._iid = t, i._payload = r, i; - } - return O(n, e), Object.defineProperty(n.prototype, "payload", { get: function() { - return L({}, this._payload); - }, enumerable: !1, configurable: !0 }), n.prototype.as = function(t) { - return new t(this._iid, this.payload); - }, n; -}(bn), E6 = function(e) { - function n(t) { - var r = e.call(this) || this; - return r.requestId = t, r; - } - return O(n, e), n; -}(bn), Ac = function(e) { - function n(t) { - var r = t.expires_in, i = t.reason, a = i === void 0 ? nt.SESSION_KEY_EXPIRED : i, o = e.call(this) || this; - switch (o.expiresIn = r ?? 0, a) { - case nt.SESSION_KEY_EXPIRED: - case nt.SESSION_TOKEN_EXPIRED: - case nt.SESSION_REVOKED: - case nt.USER_AUTH_DEACTIVATED: - case nt.USER_AUTH_DELETED_OR_NOT_FOUND: - o.error = new H({ code: a }); - } - return o; - } - return O(n, e), Object.defineProperty(n.prototype, "invalidateSessionToken", { get: function() { - var t; - return !!(!((t = this.error) === null || t === void 0) && t.isSessionTokenExpiredError); - }, enumerable: !1, configurable: !0 }), n; -}(bn), En = function(e) { - function n(t, r, i, a) { - a === void 0 && (a = ""); - var o, s = this; - return (s = e.call(this) || this)._iid = t, s.code = r, s.payload = i, s.requestId = (o = i.req_id) !== null && o !== void 0 ? o : a, s; - } - return O(n, e), n.createFromRawMessage = function(t, r) { - var i = r.substring(0, 4), a = {}; - try { - a = JSON.parse(r.substring(4)); - } catch { - i = "NOOP"; - } finally { - return new n(t, i, a); - } - }, n.prototype.convertToMessage = function() { - return "".concat(this.code).concat(JSON.stringify(this.payload), ` -`); - }, n.prototype.as = function(t) { - return new t(this._iid, this.code, this.payload); - }, n; -}(bn), Ir = function(e) { - function n(t) { - var r, i = t.code, a = t.ackRequired, o = t.payload, s = o === void 0 ? {} : o, c = this; - return (c = e.call(this) || this).code = i, c.payload = s, c.requestId = (r = c.payload.req_id) !== null && r !== void 0 ? r : Ro(), c.ackRequired = a, c.payload.req_id = c.requestId, c; - } - return O(n, e), n.prototype.convertToMessage = function() { - return "".concat(this.code).concat(JSON.stringify(this.payload), ` -`); - }, n; -}(bn), b1 = function(e) { - function n(t) { - var r = t.userId, i = t.authToken, a = t.services, o = t.expiringSession, s = o === void 0 || o, c = e.call(this) || this; - return c.path = "".concat(qt, "/").concat(r, "/session_key"), c.method = pe.POST, c.params = Be({ token: i, services: a, expiring_session: !!s }), c.requireAuth = !1, c; - } - return O(n, e), n; -}(ge), _6 = function(e) { - function n(t) { - var r = t.authToken, i = t.expiringSession, a = i === void 0 || i, o = t.requestId, s = o === void 0 ? void 0 : o; - return e.call(this, { code: "LOGI", payload: { token: r, expiring_session: a ? 1 : 0, req_id: s }, ackRequired: !0 }) || this; - } - return O(n, e), n; -}(Ir), b6 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this, a = r.key, o = r.expires_at, s = r.services; - return i.key = a, i.expiresAt = o, i.services = s, i; - } - return O(n, e), n; -}(_e), C6 = function(e) { - function n(t, r, i) { - var a, o = this; - return (o = e.call(this, t, "LOGI", i) || this).error = null, o.newKey = null, o.newKey = (a = i.new_key) !== null && a !== void 0 ? a : null, o.error = i.error ? new H(i) : null, o; - } - return O(n, e), n; -}(En), C1 = function(e) { - function n(t) { - var r = e.call(this) || this; - return r.statLog = t, r; - } - return O(n, e), n; -}(bn), Aw = function(e) { - function n(t) { - var r = t.request, i = t.deferred, a = t.error, o = a === void 0 ? H.requestFailed : a, s = e.call(this) || this; - return s.request = r, s.deferred = i, s.error = o, s; - } - return O(n, e), n; -}(bn); -(function(e) { - e.FEATURE_LOCALCACHE = "feature:local_cache", e.FEATURE_LOCALCACHE_EVENT = "feature:local_cache_event", e.NOTIFICATION = "noti:stats", e.WEBSOCKET_CONNECT = "ws:connect", e.API_RESULT = "api:result"; -})(Tn || (Tn = {})); -var Uu, gl, Yo, Sr = function() { - function e(n) { - var t = n.type, r = n.data, i = n.ts, a = i === void 0 ? Date.now() : i; - this.type = t, this.createdAt = a, this.data = r; - } - return e.payloadify = function(n) { - return Be({ stat_type: n.type, ts: n.createdAt, data: Be(n.data) }); - }, e; -}(), km = function() { - return typeof document > "u" && typeof navigator < "u" && navigator.product == "ReactNative"; -}, D_ = function() { - return !(typeof navigator > "u" || !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent)); -}; -(function(e) { - e.CHAT = "chat", e.CALLS = "calls", e.DESK = "desk", e.LIVE = "live", e.UIKIT_CHAT = "uikit-chat", e.UIKIT_LIVE = "uikit-live"; -})(Uu || (Uu = {})), function(e) { - e.ANDROID = "android", e.IOS = "ios", e.JS = "js", e.UNREAL = "unreal", e.UNITY = "unity", e.REACT_NATIVE = "react-native", e.FLUTTER = "flutter"; -}(gl || (gl = {})), function(e) { - e.ANDROID = "android", e.IOS = "ios", e.WEB = "web", e.MOBILE_WEB = "mobile_web", e.WINDOWS = "windows"; -}(Yo || (Yo = {})); -var T6 = "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", Zf = function() { - function e() { - } - return e.sendbirdSdkUserAgentWithExtension = function(n) { - var t = km() ? gl.REACT_NATIVE : gl.JS, r = { main_sdk_info: "chat/".concat(t, "/").concat(hs.SDK_VERSION), device_os_platform: D_() ? "mobile-web" : "web", os_version: hs.OS_VERSION }; - if (n) { - var i = n.sendbirdExtensions, a = n.deviceOS, o = n.customData, s = o === void 0 ? {} : o; - a.version && (r.os_version = a.version), a.platform && (r.device_os_platform = a.platform), i.length > 0 && (r.extension_sdk_info = i.map(function(c) { - var l = c.product, u = c.platform, d = c.version; - return "".concat(l, "/").concat(u, "/").concat(d); - }).join(",")), Object.keys(r).forEach(function(c) { - return delete s[c]; - }), Object.keys(s).length > 0 && (r = L(L({}, r), s)); - } - return Object.entries(r).map(function(c) { - var l = tt(c, 2), u = l[0], d = l[1]; - return "".concat(u, "=").concat(d); - }).join("&"); - }, e.userAgentWithExtension = function(n) { - var t = km() ? "reactnative" : "JS", r = n.sb_syncmanager ? "s".concat(n.sb_syncmanager) : "", i = n.sb_uikit ? "u".concat(n.sb_uikit) : "", a = n["device-os-platform"] ? "o".concat(n["device-os-platform"]) : D_() ? "omobile-web" : "oweb"; - return "".concat(t, "/c").concat(hs.SDK_VERSION, "/").concat(r, "/").concat(i, "/").concat(a); - }, e; -}(), Kr = function() { - var e = this; - this.promise = new Promise(function(n, t) { - e.resolve = n, e.reject = function(r) { - t(r); - }; - }); -}, Qf = function(e) { - function n(t) { - var r = e.call(this) || this; - return r.requestId = t.requestId, r; - } - return O(n, e), n; -}(bn), S6 = function() { - function e(n, t) { - var r = t.session, i = t.sdkState, a = t.dispatcher, o = t.logger, s = t.useFetchCompat, c = s !== void 0 && s, l = this; - this._abortControl = /* @__PURE__ */ new Map(), this._shouldImportFetchCompat = !1, this._iid = n, this._session = r, this._sdkState = i, this._dispatcher = a, this._dispatcher.on(function(u) { - u instanceof E6 && l.cancel(u.requestId); - }), this._logger = o, this._shouldImportFetchCompat = c; - } - return e.prototype._createHeader = function(n, t) { - var r = this._sdkState, i = r.appId, a = r.appVersion, o = r.sendbirdRuntimeEnvironment, s = L(L({}, n.headers), { SendBird: "JS,".concat(hs.OS_VERSION, ",").concat(hs.SDK_VERSION, ",").concat(i).concat(a ? ",".concat(a) : ""), "SB-User-Agent": Zf.userAgentWithExtension(this._sdkState.extensions), "Request-Sent-Timestamp": Date.now().toString(), "SB-SDK-User-Agent": Zf.sendbirdSdkUserAgentWithExtension(o) }); - return t || (s["Content-Type"] = "application/json; charset=utf-8"), n.requireAuth && this._session.hasSession && (s["Session-Key"] = this._session.sessionKey), this._session && this._session.authToken && (s["App-Id"] = i, s["Access-Token"] = this._session.authToken), s; - }, e.prototype._statLogApiResult = function(n, t, r) { - this._dispatcher.dispatch(new C1(new Sr({ type: Tn.API_RESULT, data: { endpoint: n.path, method: n.method, success: !r, latency: Date.now() - t, error_code: r == null ? void 0 : r.code, error_description: r == null ? void 0 : r.message } }))); - }, e.prototype.send = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b; - return C(this, function(A) { - switch (A.label) { - case 0: - t = n.path, r = n.method, i = n.uploadProgressHandler, a = ![pe.GET, pe.DELETE].includes(r), o = this._sdkState.api, s = "".concat(o.host).concat(t).concat(a ? "" : n.query), c = a ? n.payload : null, l = this._createHeader(n, c instanceof FormData ? c : void 0), u = new AbortController(), d = u.signal, this._abortControl.set(n.requestId, u), h = Date.now(), A.label = 1; - case 1: - return A.trys.push([1, 13, , 14]), i ? [4, import("./__bundle-aece11ae-f5e6bb11.mjs")] : [3, 6]; - case 2: - f = A.sent().xmlHttpRequest, A.label = 3; - case 3: - return A.trys.push([3, 5, , 6]), [4, f(this._iid, { requestId: n.requestId, method: n.method, url: s, headers: l, data: c ?? void 0, uploadProgressHandler: i })]; - case 4: - return p = A.sent(), this._logger.debug("receive api response", n.requestId), this._statLogApiResult(n, h), [2, p]; - case 5: - if (!((v = A.sent()) instanceof H && v.code === nt.XMLHTTPREQUEST_NOT_SUPPORTED)) - throw v; - return this._logger.debug("XMLHttpRequest is not available in this environment. progressHandler is ignored."), [3, 6]; - case 6: - return this._shouldImportFetchCompat && (this._shouldImportFetchCompat = !1, (typeof globalThis < "u" && globalThis || typeof self < "u" && self || typeof global < "u" && global || { fetch: null }).fetch = null), typeof AbortController < "u" ? [3, 8] : [4, import("./__bundle-2aa1a987-887417e1.mjs").then((w) => w._)]; - case 7: - A.sent(), A.label = 8; - case 8: - return typeof fetch == "function" ? [3, 10] : [4, import("./__bundle-ba2b9764-6b781cae.mjs").then((w) => w._)]; - case 9: - A.sent(), A.label = 10; - case 10: - return [4, fetch(s, { method: r, body: c, headers: l, signal: d })]; - case 11: - return [4, (m = A.sent()).json()]; - case 12: - if (E = A.sent(), m.ok || m.redirected) - return this._logger.debug("receive api response", n.requestId), this._statLogApiResult(n, h), [2, new _e(this._iid, E)]; - if (E) { - if ((y = new H(E)).isSessionExpiredError) { - if (this._dispatcher.dispatch(new Ac({ reason: y.code })), !(n instanceof b1)) - return _ = new Kr(), this._dispatcher.dispatch(new Aw({ request: n, deferred: _, error: y })), [2, _.promise]; - throw y; - } - throw y.isSessionInvalidatedError && this._dispatcher.dispatch(new Ac({ reason: y.code })), y; - } - throw H.requestFailed; - case 13: - throw S = A.sent(), this._statLogApiResult(n, h, S), S instanceof H ? (this._logger.debug("fail api request", S), S) : (S == null ? void 0 : S.name) === "AbortError" ? H.requestCanceled : (b = H.networkError, this._logger.debug("fail api request", b), b); - case 14: - return [2]; - } - }); - }); - }, e.prototype.cancel = function(n) { - this._abortControl.has(n) && (this._abortControl.get(n).abort(), this._abortControl.delete(n)), this._dispatcher.dispatch(new Qf({ requestId: n })); - }, e.prototype.cancelAll = function() { - var n, t; - try { - for (var r = Ne(this._abortControl.values()), i = r.next(); !i.done; i = r.next()) - i.value.abort(); - } catch (a) { - n = { error: a }; - } finally { - try { - i && !i.done && (t = r.return) && t.call(r); - } finally { - if (n) - throw n.error; - } - } - this._abortControl.clear(), this._dispatcher.dispatch(new Qf({})); - }, e; -}(), bt = function() { -}; -function zc(e) { - let n = e.length; - for (; --n >= 0; ) - e[n] = 0; -} -const T1 = 256, Nw = 286, Fu = 30, Bu = 15, Um = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]), Tf = new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]), w6 = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]), L_ = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), fo = new Array(576); -zc(fo); -const Hu = new Array(60); -zc(Hu); -const gd = new Array(512); -zc(gd); -const ju = new Array(256); -zc(ju); -const S1 = new Array(29); -zc(S1); -const Xf = new Array(Fu); -function Zv(e, n, t, r, i) { - this.static_tree = e, this.extra_bits = n, this.extra_base = t, this.elems = r, this.max_length = i, this.has_stree = e && e.length; -} -let P_, k_, U_; -function Qv(e, n) { - this.dyn_tree = e, this.max_code = 0, this.stat_desc = n; -} -zc(Xf); -const Iw = (e) => e < 256 ? gd[e] : gd[256 + (e >>> 7)], yd = (e, n) => { - e.pending_buf[e.pending++] = 255 & n, e.pending_buf[e.pending++] = n >>> 8 & 255; -}, pi = (e, n, t) => { - e.bi_valid > 16 - t ? (e.bi_buf |= n << e.bi_valid & 65535, yd(e, e.bi_buf), e.bi_buf = n >> 16 - e.bi_valid, e.bi_valid += t - 16) : (e.bi_buf |= n << e.bi_valid & 65535, e.bi_valid += t); -}, Ha = (e, n, t) => { - pi(e, t[2 * n], t[2 * n + 1]); -}, Mw = (e, n) => { - let t = 0; - do - t |= 1 & e, e >>>= 1, t <<= 1; - while (--n > 0); - return t >>> 1; -}, Ow = (e, n, t) => { - const r = new Array(16); - let i, a, o = 0; - for (i = 1; i <= Bu; i++) - o = o + t[i - 1] << 1, r[i] = o; - for (a = 0; a <= n; a++) { - let s = e[2 * a + 1]; - s !== 0 && (e[2 * a] = Mw(r[s]++, s)); - } -}, xw = (e) => { - let n; - for (n = 0; n < Nw; n++) - e.dyn_ltree[2 * n] = 0; - for (n = 0; n < Fu; n++) - e.dyn_dtree[2 * n] = 0; - for (n = 0; n < 19; n++) - e.bl_tree[2 * n] = 0; - e.dyn_ltree[512] = 1, e.opt_len = e.static_len = 0, e.sym_next = e.matches = 0; -}, Rw = (e) => { - e.bi_valid > 8 ? yd(e, e.bi_buf) : e.bi_valid > 0 && (e.pending_buf[e.pending++] = e.bi_buf), e.bi_buf = 0, e.bi_valid = 0; -}, F_ = (e, n, t, r) => { - const i = 2 * n, a = 2 * t; - return e[i] < e[a] || e[i] === e[a] && r[n] <= r[t]; -}, Xv = (e, n, t) => { - const r = e.heap[t]; - let i = t << 1; - for (; i <= e.heap_len && (i < e.heap_len && F_(n, e.heap[i + 1], e.heap[i], e.depth) && i++, !F_(n, r, e.heap[i], e.depth)); ) - e.heap[t] = e.heap[i], t = i, i <<= 1; - e.heap[t] = r; -}, B_ = (e, n, t) => { - let r, i, a, o, s = 0; - if (e.sym_next !== 0) - do - r = 255 & e.pending_buf[e.sym_buf + s++], r += (255 & e.pending_buf[e.sym_buf + s++]) << 8, i = e.pending_buf[e.sym_buf + s++], r === 0 ? Ha(e, i, n) : (a = ju[i], Ha(e, a + T1 + 1, n), o = Um[a], o !== 0 && (i -= S1[a], pi(e, i, o)), r--, a = Iw(r), Ha(e, a, t), o = Tf[a], o !== 0 && (r -= Xf[a], pi(e, r, o))); - while (s < e.sym_next); - Ha(e, 256, n); -}, Jv = (e, n) => { - const t = n.dyn_tree, r = n.stat_desc.static_tree, i = n.stat_desc.has_stree, a = n.stat_desc.elems; - let o, s, c, l = -1; - for (e.heap_len = 0, e.heap_max = 573, o = 0; o < a; o++) - t[2 * o] !== 0 ? (e.heap[++e.heap_len] = l = o, e.depth[o] = 0) : t[2 * o + 1] = 0; - for (; e.heap_len < 2; ) - c = e.heap[++e.heap_len] = l < 2 ? ++l : 0, t[2 * c] = 1, e.depth[c] = 0, e.opt_len--, i && (e.static_len -= r[2 * c + 1]); - for (n.max_code = l, o = e.heap_len >> 1; o >= 1; o--) - Xv(e, t, o); - c = a; - do - o = e.heap[1], e.heap[1] = e.heap[e.heap_len--], Xv(e, t, 1), s = e.heap[1], e.heap[--e.heap_max] = o, e.heap[--e.heap_max] = s, t[2 * c] = t[2 * o] + t[2 * s], e.depth[c] = (e.depth[o] >= e.depth[s] ? e.depth[o] : e.depth[s]) + 1, t[2 * o + 1] = t[2 * s + 1] = c, e.heap[1] = c++, Xv(e, t, 1); - while (e.heap_len >= 2); - e.heap[--e.heap_max] = e.heap[1], ((u, d) => { - const h = d.dyn_tree, f = d.max_code, p = d.stat_desc.static_tree, v = d.stat_desc.has_stree, m = d.stat_desc.extra_bits, E = d.stat_desc.extra_base, y = d.stat_desc.max_length; - let _, S, b, A, w, M, N = 0; - for (A = 0; A <= Bu; A++) - u.bl_count[A] = 0; - for (h[2 * u.heap[u.heap_max] + 1] = 0, _ = u.heap_max + 1; _ < 573; _++) - S = u.heap[_], A = h[2 * h[2 * S + 1] + 1] + 1, A > y && (A = y, N++), h[2 * S + 1] = A, S > f || (u.bl_count[A]++, w = 0, S >= E && (w = m[S - E]), M = h[2 * S], u.opt_len += M * (A + w), v && (u.static_len += M * (p[2 * S + 1] + w))); - if (N !== 0) { - do { - for (A = y - 1; u.bl_count[A] === 0; ) - A--; - u.bl_count[A]--, u.bl_count[A + 1] += 2, u.bl_count[y]--, N -= 2; - } while (N > 0); - for (A = y; A !== 0; A--) - for (S = u.bl_count[A]; S !== 0; ) - b = u.heap[--_], b > f || (h[2 * b + 1] !== A && (u.opt_len += (A - h[2 * b + 1]) * h[2 * b], h[2 * b + 1] = A), S--); - } - })(e, n), Ow(t, l, e.bl_count); -}, H_ = (e, n, t) => { - let r, i, a = -1, o = n[1], s = 0, c = 7, l = 4; - for (o === 0 && (c = 138, l = 3), n[2 * (t + 1) + 1] = 65535, r = 0; r <= t; r++) - i = o, o = n[2 * (r + 1) + 1], ++s < c && i === o || (s < l ? e.bl_tree[2 * i] += s : i !== 0 ? (i !== a && e.bl_tree[2 * i]++, e.bl_tree[32]++) : s <= 10 ? e.bl_tree[34]++ : e.bl_tree[36]++, s = 0, a = i, o === 0 ? (c = 138, l = 3) : i === o ? (c = 6, l = 3) : (c = 7, l = 4)); -}, j_ = (e, n, t) => { - let r, i, a = -1, o = n[1], s = 0, c = 7, l = 4; - for (o === 0 && (c = 138, l = 3), r = 0; r <= t; r++) - if (i = o, o = n[2 * (r + 1) + 1], !(++s < c && i === o)) { - if (s < l) - do - Ha(e, i, e.bl_tree); - while (--s != 0); - else - i !== 0 ? (i !== a && (Ha(e, i, e.bl_tree), s--), Ha(e, 16, e.bl_tree), pi(e, s - 3, 2)) : s <= 10 ? (Ha(e, 17, e.bl_tree), pi(e, s - 3, 3)) : (Ha(e, 18, e.bl_tree), pi(e, s - 11, 7)); - s = 0, a = i, o === 0 ? (c = 138, l = 3) : i === o ? (c = 6, l = 3) : (c = 7, l = 4); - } -}; -let V_ = !1; -const Dw = (e, n, t, r) => { - pi(e, 0 + (r ? 1 : 0), 3), Rw(e), yd(e, t), yd(e, ~t), t && e.pending_buf.set(e.window.subarray(n, n + t), e.pending), e.pending += t; -}; -var A6 = (e, n, t, r) => { - let i, a, o = 0; - e.level > 0 ? (e.strm.data_type === 2 && (e.strm.data_type = ((s) => { - let c, l = 4093624447; - for (c = 0; c <= 31; c++, l >>>= 1) - if (1 & l && s.dyn_ltree[2 * c] !== 0) - return 0; - if (s.dyn_ltree[18] !== 0 || s.dyn_ltree[20] !== 0 || s.dyn_ltree[26] !== 0) - return 1; - for (c = 32; c < T1; c++) - if (s.dyn_ltree[2 * c] !== 0) - return 1; - return 0; - })(e)), Jv(e, e.l_desc), Jv(e, e.d_desc), o = ((s) => { - let c; - for (H_(s, s.dyn_ltree, s.l_desc.max_code), H_(s, s.dyn_dtree, s.d_desc.max_code), Jv(s, s.bl_desc), c = 18; c >= 3 && s.bl_tree[2 * L_[c] + 1] === 0; c--) - ; - return s.opt_len += 3 * (c + 1) + 5 + 5 + 4, c; - })(e), i = e.opt_len + 3 + 7 >>> 3, a = e.static_len + 3 + 7 >>> 3, a <= i && (i = a)) : i = a = t + 5, t + 4 <= i && n !== -1 ? Dw(e, n, t, r) : e.strategy === 4 || a === i ? (pi(e, 2 + (r ? 1 : 0), 3), B_(e, fo, Hu)) : (pi(e, 4 + (r ? 1 : 0), 3), ((s, c, l, u) => { - let d; - for (pi(s, c - 257, 5), pi(s, l - 1, 5), pi(s, u - 4, 4), d = 0; d < u; d++) - pi(s, s.bl_tree[2 * L_[d] + 1], 3); - j_(s, s.dyn_ltree, c - 1), j_(s, s.dyn_dtree, l - 1); - })(e, e.l_desc.max_code + 1, e.d_desc.max_code + 1, o + 1), B_(e, e.dyn_ltree, e.dyn_dtree)), xw(e), r && Rw(e); -}, N6 = { _tr_init: (e) => { - V_ || ((() => { - let n, t, r, i, a; - const o = new Array(16); - for (r = 0, i = 0; i < 28; i++) - for (S1[i] = r, n = 0; n < 1 << Um[i]; n++) - ju[r++] = i; - for (ju[r - 1] = i, a = 0, i = 0; i < 16; i++) - for (Xf[i] = a, n = 0; n < 1 << Tf[i]; n++) - gd[a++] = i; - for (a >>= 7; i < Fu; i++) - for (Xf[i] = a << 7, n = 0; n < 1 << Tf[i] - 7; n++) - gd[256 + a++] = i; - for (t = 0; t <= Bu; t++) - o[t] = 0; - for (n = 0; n <= 143; ) - fo[2 * n + 1] = 8, n++, o[8]++; - for (; n <= 255; ) - fo[2 * n + 1] = 9, n++, o[9]++; - for (; n <= 279; ) - fo[2 * n + 1] = 7, n++, o[7]++; - for (; n <= 287; ) - fo[2 * n + 1] = 8, n++, o[8]++; - for (Ow(fo, 287, o), n = 0; n < Fu; n++) - Hu[2 * n + 1] = 5, Hu[2 * n] = Mw(n, 5); - P_ = new Zv(fo, Um, 257, Nw, Bu), k_ = new Zv(Hu, Tf, 0, Fu, Bu), U_ = new Zv(new Array(0), w6, 0, 19, 7); - })(), V_ = !0), e.l_desc = new Qv(e.dyn_ltree, P_), e.d_desc = new Qv(e.dyn_dtree, k_), e.bl_desc = new Qv(e.bl_tree, U_), e.bi_buf = 0, e.bi_valid = 0, xw(e); -}, _tr_stored_block: Dw, _tr_flush_block: A6, _tr_tally: (e, n, t) => (e.pending_buf[e.sym_buf + e.sym_next++] = n, e.pending_buf[e.sym_buf + e.sym_next++] = n >> 8, e.pending_buf[e.sym_buf + e.sym_next++] = t, n === 0 ? e.dyn_ltree[2 * t]++ : (e.matches++, n--, e.dyn_ltree[2 * (ju[t] + T1 + 1)]++, e.dyn_dtree[2 * Iw(n)]++), e.sym_next === e.sym_end), _tr_align: (e) => { - pi(e, 2, 3), Ha(e, 256, fo), ((n) => { - n.bi_valid === 16 ? (yd(n, n.bi_buf), n.bi_buf = 0, n.bi_valid = 0) : n.bi_valid >= 8 && (n.pending_buf[n.pending++] = 255 & n.bi_buf, n.bi_buf >>= 8, n.bi_valid -= 8); - })(e); -} }, Vu = (e, n, t, r) => { - let i = 65535 & e | 0, a = e >>> 16 & 65535 | 0, o = 0; - for (; t !== 0; ) { - o = t > 2e3 ? 2e3 : t, t -= o; - do - i = i + n[r++] | 0, a = a + i | 0; - while (--o); - i %= 65521, a %= 65521; - } - return i | a << 16 | 0; -}; -const I6 = new Uint32Array((() => { - let e, n = []; - for (var t = 0; t < 256; t++) { - e = t; - for (var r = 0; r < 8; r++) - e = 1 & e ? 3988292384 ^ e >>> 1 : e >>> 1; - n[t] = e; - } - return n; -})()); -var wr = (e, n, t, r) => { - const i = I6, a = r + t; - e ^= -1; - for (let o = r; o < a; o++) - e = e >>> 8 ^ i[255 & (e ^ n[o])]; - return -1 ^ e; -}, wl = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" }, Pl = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_MEM_ERROR: -4, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 }; -const { _tr_init: M6, _tr_stored_block: Fm, _tr_flush_block: O6, _tr_tally: fs, _tr_align: x6 } = N6, { Z_NO_FLUSH: ps, Z_PARTIAL_FLUSH: R6, Z_FULL_FLUSH: D6, Z_FINISH: Ji, Z_BLOCK: G_, Z_OK: Rr, Z_STREAM_END: z_, Z_STREAM_ERROR: Oa, Z_DATA_ERROR: L6, Z_BUF_ERROR: $v, Z_DEFAULT_COMPRESSION: P6, Z_FILTERED: k6, Z_HUFFMAN_ONLY: kh, Z_RLE: U6, Z_FIXED: F6, Z_DEFAULT_STRATEGY: B6, Z_UNKNOWN: H6, Z_DEFLATED: Jf } = Pl, tl = 258, Ka = 262, ic = 42, Ks = 113, wu = 666, Ws = (e, n) => (e.msg = wl[n], n), q_ = (e) => 2 * e - (e > 4 ? 9 : 0), $o = (e) => { - let n = e.length; - for (; --n >= 0; ) - e[n] = 0; -}, j6 = (e) => { - let n, t, r, i = e.w_size; - n = e.hash_size, r = n; - do - t = e.head[--r], e.head[r] = t >= i ? t - i : 0; - while (--n); - n = i, r = n; - do - t = e.prev[--r], e.prev[r] = t >= i ? t - i : 0; - while (--n); -}; -let vs = (e, n, t) => (n << e.hash_shift ^ t) & e.hash_mask; -const Ai = (e) => { - const n = e.state; - let t = n.pending; - t > e.avail_out && (t = e.avail_out), t !== 0 && (e.output.set(n.pending_buf.subarray(n.pending_out, n.pending_out + t), e.next_out), e.next_out += t, n.pending_out += t, e.total_out += t, e.avail_out -= t, n.pending -= t, n.pending === 0 && (n.pending_out = 0)); -}, Ri = (e, n) => { - O6(e, e.block_start >= 0 ? e.block_start : -1, e.strstart - e.block_start, n), e.block_start = e.strstart, Ai(e.strm); -}, Cn = (e, n) => { - e.pending_buf[e.pending++] = n; -}, nu = (e, n) => { - e.pending_buf[e.pending++] = n >>> 8 & 255, e.pending_buf[e.pending++] = 255 & n; -}, Bm = (e, n, t, r) => { - let i = e.avail_in; - return i > r && (i = r), i === 0 ? 0 : (e.avail_in -= i, n.set(e.input.subarray(e.next_in, e.next_in + i), t), e.state.wrap === 1 ? e.adler = Vu(e.adler, n, i, t) : e.state.wrap === 2 && (e.adler = wr(e.adler, n, i, t)), e.next_in += i, e.total_in += i, i); -}, Lw = (e, n) => { - let t, r, i = e.max_chain_length, a = e.strstart, o = e.prev_length, s = e.nice_match; - const c = e.strstart > e.w_size - Ka ? e.strstart - (e.w_size - Ka) : 0, l = e.window, u = e.w_mask, d = e.prev, h = e.strstart + tl; - let f = l[a + o - 1], p = l[a + o]; - e.prev_length >= e.good_match && (i >>= 2), s > e.lookahead && (s = e.lookahead); - do - if (t = n, l[t + o] === p && l[t + o - 1] === f && l[t] === l[a] && l[++t] === l[a + 1]) { - a += 2, t++; - do - ; - while (l[++a] === l[++t] && l[++a] === l[++t] && l[++a] === l[++t] && l[++a] === l[++t] && l[++a] === l[++t] && l[++a] === l[++t] && l[++a] === l[++t] && l[++a] === l[++t] && a < h); - if (r = tl - (h - a), a = h - tl, r > o) { - if (e.match_start = n, o = r, r >= s) - break; - f = l[a + o - 1], p = l[a + o]; - } - } - while ((n = d[n & u]) > c && --i != 0); - return o <= e.lookahead ? o : e.lookahead; -}, Jl = (e) => { - const n = e.w_size; - let t, r, i; - do { - if (r = e.window_size - e.lookahead - e.strstart, e.strstart >= n + (n - Ka) && (e.window.set(e.window.subarray(n, n + n - r), 0), e.match_start -= n, e.strstart -= n, e.block_start -= n, e.insert > e.strstart && (e.insert = e.strstart), j6(e), r += n), e.strm.avail_in === 0) - break; - if (t = Bm(e.strm, e.window, e.strstart + e.lookahead, r), e.lookahead += t, e.lookahead + e.insert >= 3) - for (i = e.strstart - e.insert, e.ins_h = e.window[i], e.ins_h = vs(e, e.ins_h, e.window[i + 1]); e.insert && (e.ins_h = vs(e, e.ins_h, e.window[i + 3 - 1]), e.prev[i & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = i, i++, e.insert--, !(e.lookahead + e.insert < 3)); ) - ; - } while (e.lookahead < Ka && e.strm.avail_in !== 0); -}, Pw = (e, n) => { - let t, r, i, a = e.pending_buf_size - 5 > e.w_size ? e.w_size : e.pending_buf_size - 5, o = 0, s = e.strm.avail_in; - do { - if (t = 65535, i = e.bi_valid + 42 >> 3, e.strm.avail_out < i || (i = e.strm.avail_out - i, r = e.strstart - e.block_start, t > r + e.strm.avail_in && (t = r + e.strm.avail_in), t > i && (t = i), t < a && (t === 0 && n !== Ji || n === ps || t !== r + e.strm.avail_in))) - break; - o = n === Ji && t === r + e.strm.avail_in ? 1 : 0, Fm(e, 0, 0, o), e.pending_buf[e.pending - 4] = t, e.pending_buf[e.pending - 3] = t >> 8, e.pending_buf[e.pending - 2] = ~t, e.pending_buf[e.pending - 1] = ~t >> 8, Ai(e.strm), r && (r > t && (r = t), e.strm.output.set(e.window.subarray(e.block_start, e.block_start + r), e.strm.next_out), e.strm.next_out += r, e.strm.avail_out -= r, e.strm.total_out += r, e.block_start += r, t -= r), t && (Bm(e.strm, e.strm.output, e.strm.next_out, t), e.strm.next_out += t, e.strm.avail_out -= t, e.strm.total_out += t); - } while (o === 0); - return s -= e.strm.avail_in, s && (s >= e.w_size ? (e.matches = 2, e.window.set(e.strm.input.subarray(e.strm.next_in - e.w_size, e.strm.next_in), 0), e.strstart = e.w_size, e.insert = e.strstart) : (e.window_size - e.strstart <= s && (e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, e.insert > e.strstart && (e.insert = e.strstart)), e.window.set(e.strm.input.subarray(e.strm.next_in - s, e.strm.next_in), e.strstart), e.strstart += s, e.insert += s > e.w_size - e.insert ? e.w_size - e.insert : s), e.block_start = e.strstart), e.high_water < e.strstart && (e.high_water = e.strstart), o ? 4 : n !== ps && n !== Ji && e.strm.avail_in === 0 && e.strstart === e.block_start ? 2 : (i = e.window_size - e.strstart, e.strm.avail_in > i && e.block_start >= e.w_size && (e.block_start -= e.w_size, e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, i += e.w_size, e.insert > e.strstart && (e.insert = e.strstart)), i > e.strm.avail_in && (i = e.strm.avail_in), i && (Bm(e.strm, e.window, e.strstart, i), e.strstart += i, e.insert += i > e.w_size - e.insert ? e.w_size - e.insert : i), e.high_water < e.strstart && (e.high_water = e.strstart), i = e.bi_valid + 42 >> 3, i = e.pending_buf_size - i > 65535 ? 65535 : e.pending_buf_size - i, a = i > e.w_size ? e.w_size : i, r = e.strstart - e.block_start, (r >= a || (r || n === Ji) && n !== ps && e.strm.avail_in === 0 && r <= i) && (t = r > i ? i : r, o = n === Ji && e.strm.avail_in === 0 && t === r ? 1 : 0, Fm(e, e.block_start, t, o), e.block_start += t, Ai(e.strm)), o ? 3 : 1); -}, e0 = (e, n) => { - let t, r; - for (; ; ) { - if (e.lookahead < Ka) { - if (Jl(e), e.lookahead < Ka && n === ps) - return 1; - if (e.lookahead === 0) - break; - } - if (t = 0, e.lookahead >= 3 && (e.ins_h = vs(e, e.ins_h, e.window[e.strstart + 3 - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), t !== 0 && e.strstart - t <= e.w_size - Ka && (e.match_length = Lw(e, t)), e.match_length >= 3) - if (r = fs(e, e.strstart - e.match_start, e.match_length - 3), e.lookahead -= e.match_length, e.match_length <= e.max_lazy_match && e.lookahead >= 3) { - e.match_length--; - do - e.strstart++, e.ins_h = vs(e, e.ins_h, e.window[e.strstart + 3 - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart; - while (--e.match_length != 0); - e.strstart++; - } else - e.strstart += e.match_length, e.match_length = 0, e.ins_h = e.window[e.strstart], e.ins_h = vs(e, e.ins_h, e.window[e.strstart + 1]); - else - r = fs(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++; - if (r && (Ri(e, !1), e.strm.avail_out === 0)) - return 1; - } - return e.insert = e.strstart < 2 ? e.strstart : 2, n === Ji ? (Ri(e, !0), e.strm.avail_out === 0 ? 3 : 4) : e.sym_next && (Ri(e, !1), e.strm.avail_out === 0) ? 1 : 2; -}, Gl = (e, n) => { - let t, r, i; - for (; ; ) { - if (e.lookahead < Ka) { - if (Jl(e), e.lookahead < Ka && n === ps) - return 1; - if (e.lookahead === 0) - break; - } - if (t = 0, e.lookahead >= 3 && (e.ins_h = vs(e, e.ins_h, e.window[e.strstart + 3 - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), e.prev_length = e.match_length, e.prev_match = e.match_start, e.match_length = 2, t !== 0 && e.prev_length < e.max_lazy_match && e.strstart - t <= e.w_size - Ka && (e.match_length = Lw(e, t), e.match_length <= 5 && (e.strategy === k6 || e.match_length === 3 && e.strstart - e.match_start > 4096) && (e.match_length = 2)), e.prev_length >= 3 && e.match_length <= e.prev_length) { - i = e.strstart + e.lookahead - 3, r = fs(e, e.strstart - 1 - e.prev_match, e.prev_length - 3), e.lookahead -= e.prev_length - 1, e.prev_length -= 2; - do - ++e.strstart <= i && (e.ins_h = vs(e, e.ins_h, e.window[e.strstart + 3 - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart); - while (--e.prev_length != 0); - if (e.match_available = 0, e.match_length = 2, e.strstart++, r && (Ri(e, !1), e.strm.avail_out === 0)) - return 1; - } else if (e.match_available) { - if (r = fs(e, 0, e.window[e.strstart - 1]), r && Ri(e, !1), e.strstart++, e.lookahead--, e.strm.avail_out === 0) - return 1; - } else - e.match_available = 1, e.strstart++, e.lookahead--; - } - return e.match_available && (r = fs(e, 0, e.window[e.strstart - 1]), e.match_available = 0), e.insert = e.strstart < 2 ? e.strstart : 2, n === Ji ? (Ri(e, !0), e.strm.avail_out === 0 ? 3 : 4) : e.sym_next && (Ri(e, !1), e.strm.avail_out === 0) ? 1 : 2; -}; -function Ia(e, n, t, r, i) { - this.good_length = e, this.max_lazy = n, this.nice_length = t, this.max_chain = r, this.func = i; -} -const Au = [new Ia(0, 0, 0, 0, Pw), new Ia(4, 4, 8, 4, e0), new Ia(4, 5, 16, 8, e0), new Ia(4, 6, 32, 32, e0), new Ia(4, 4, 16, 16, Gl), new Ia(8, 16, 32, 32, Gl), new Ia(8, 16, 128, 128, Gl), new Ia(8, 32, 128, 256, Gl), new Ia(32, 128, 258, 1024, Gl), new Ia(32, 258, 258, 4096, Gl)]; -function V6() { - this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = Jf, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new Uint16Array(1146), this.dyn_dtree = new Uint16Array(122), this.bl_tree = new Uint16Array(78), $o(this.dyn_ltree), $o(this.dyn_dtree), $o(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(16), this.heap = new Uint16Array(573), $o(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(573), $o(this.depth), this.sym_buf = 0, this.lit_bufsize = 0, this.sym_next = 0, this.sym_end = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; -} -const Nu = (e) => { - if (!e) - return 1; - const n = e.state; - return !n || n.strm !== e || n.status !== ic && n.status !== 57 && n.status !== 69 && n.status !== 73 && n.status !== 91 && n.status !== 103 && n.status !== Ks && n.status !== wu ? 1 : 0; -}, kw = (e) => { - if (Nu(e)) - return Ws(e, Oa); - e.total_in = e.total_out = 0, e.data_type = H6; - const n = e.state; - return n.pending = 0, n.pending_out = 0, n.wrap < 0 && (n.wrap = -n.wrap), n.status = n.wrap === 2 ? 57 : n.wrap ? ic : Ks, e.adler = n.wrap === 2 ? 0 : 1, n.last_flush = -2, M6(n), Rr; -}, Uw = (e) => { - const n = kw(e); - var t; - return n === Rr && ((t = e.state).window_size = 2 * t.w_size, $o(t.head), t.max_lazy_match = Au[t.level].max_lazy, t.good_match = Au[t.level].good_length, t.nice_match = Au[t.level].nice_length, t.max_chain_length = Au[t.level].max_chain, t.strstart = 0, t.block_start = 0, t.lookahead = 0, t.insert = 0, t.match_length = t.prev_length = 2, t.match_available = 0, t.ins_h = 0), n; -}, K_ = (e, n, t, r, i, a) => { - if (!e) - return Oa; - let o = 1; - if (n === P6 && (n = 6), r < 0 ? (o = 0, r = -r) : r > 15 && (o = 2, r -= 16), i < 1 || i > 9 || t !== Jf || r < 8 || r > 15 || n < 0 || n > 9 || a < 0 || a > F6 || r === 8 && o !== 1) - return Ws(e, Oa); - r === 8 && (r = 9); - const s = new V6(); - return e.state = s, s.strm = e, s.status = ic, s.wrap = o, s.gzhead = null, s.w_bits = r, s.w_size = 1 << s.w_bits, s.w_mask = s.w_size - 1, s.hash_bits = i + 7, s.hash_size = 1 << s.hash_bits, s.hash_mask = s.hash_size - 1, s.hash_shift = ~~((s.hash_bits + 3 - 1) / 3), s.window = new Uint8Array(2 * s.w_size), s.head = new Uint16Array(s.hash_size), s.prev = new Uint16Array(s.w_size), s.lit_bufsize = 1 << i + 6, s.pending_buf_size = 4 * s.lit_bufsize, s.pending_buf = new Uint8Array(s.pending_buf_size), s.sym_buf = s.lit_bufsize, s.sym_end = 3 * (s.lit_bufsize - 1), s.level = n, s.strategy = a, s.method = t, Uw(e); -}; -var Gu = { deflateInit: (e, n) => K_(e, n, Jf, 15, 8, B6), deflateInit2: K_, deflateReset: Uw, deflateResetKeep: kw, deflateSetHeader: (e, n) => Nu(e) || e.state.wrap !== 2 ? Oa : (e.state.gzhead = n, Rr), deflate: (e, n) => { - if (Nu(e) || n > G_ || n < 0) - return e ? Ws(e, Oa) : Oa; - const t = e.state; - if (!e.output || e.avail_in !== 0 && !e.input || t.status === wu && n !== Ji) - return Ws(e, e.avail_out === 0 ? $v : Oa); - const r = t.last_flush; - if (t.last_flush = n, t.pending !== 0) { - if (Ai(e), e.avail_out === 0) - return t.last_flush = -1, Rr; - } else if (e.avail_in === 0 && q_(n) <= q_(r) && n !== Ji) - return Ws(e, $v); - if (t.status === wu && e.avail_in !== 0) - return Ws(e, $v); - if (t.status === ic && t.wrap === 0 && (t.status = Ks), t.status === ic) { - let i = Jf + (t.w_bits - 8 << 4) << 8, a = -1; - if (a = t.strategy >= kh || t.level < 2 ? 0 : t.level < 6 ? 1 : t.level === 6 ? 2 : 3, i |= a << 6, t.strstart !== 0 && (i |= 32), i += 31 - i % 31, nu(t, i), t.strstart !== 0 && (nu(t, e.adler >>> 16), nu(t, 65535 & e.adler)), e.adler = 1, t.status = Ks, Ai(e), t.pending !== 0) - return t.last_flush = -1, Rr; - } - if (t.status === 57) { - if (e.adler = 0, Cn(t, 31), Cn(t, 139), Cn(t, 8), t.gzhead) - Cn(t, (t.gzhead.text ? 1 : 0) + (t.gzhead.hcrc ? 2 : 0) + (t.gzhead.extra ? 4 : 0) + (t.gzhead.name ? 8 : 0) + (t.gzhead.comment ? 16 : 0)), Cn(t, 255 & t.gzhead.time), Cn(t, t.gzhead.time >> 8 & 255), Cn(t, t.gzhead.time >> 16 & 255), Cn(t, t.gzhead.time >> 24 & 255), Cn(t, t.level === 9 ? 2 : t.strategy >= kh || t.level < 2 ? 4 : 0), Cn(t, 255 & t.gzhead.os), t.gzhead.extra && t.gzhead.extra.length && (Cn(t, 255 & t.gzhead.extra.length), Cn(t, t.gzhead.extra.length >> 8 & 255)), t.gzhead.hcrc && (e.adler = wr(e.adler, t.pending_buf, t.pending, 0)), t.gzindex = 0, t.status = 69; - else if (Cn(t, 0), Cn(t, 0), Cn(t, 0), Cn(t, 0), Cn(t, 0), Cn(t, t.level === 9 ? 2 : t.strategy >= kh || t.level < 2 ? 4 : 0), Cn(t, 3), t.status = Ks, Ai(e), t.pending !== 0) - return t.last_flush = -1, Rr; - } - if (t.status === 69) { - if (t.gzhead.extra) { - let i = t.pending, a = (65535 & t.gzhead.extra.length) - t.gzindex; - for (; t.pending + a > t.pending_buf_size; ) { - let s = t.pending_buf_size - t.pending; - if (t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex, t.gzindex + s), t.pending), t.pending = t.pending_buf_size, t.gzhead.hcrc && t.pending > i && (e.adler = wr(e.adler, t.pending_buf, t.pending - i, i)), t.gzindex += s, Ai(e), t.pending !== 0) - return t.last_flush = -1, Rr; - i = 0, a -= s; - } - let o = new Uint8Array(t.gzhead.extra); - t.pending_buf.set(o.subarray(t.gzindex, t.gzindex + a), t.pending), t.pending += a, t.gzhead.hcrc && t.pending > i && (e.adler = wr(e.adler, t.pending_buf, t.pending - i, i)), t.gzindex = 0; - } - t.status = 73; - } - if (t.status === 73) { - if (t.gzhead.name) { - let i, a = t.pending; - do { - if (t.pending === t.pending_buf_size) { - if (t.gzhead.hcrc && t.pending > a && (e.adler = wr(e.adler, t.pending_buf, t.pending - a, a)), Ai(e), t.pending !== 0) - return t.last_flush = -1, Rr; - a = 0; - } - i = t.gzindex < t.gzhead.name.length ? 255 & t.gzhead.name.charCodeAt(t.gzindex++) : 0, Cn(t, i); - } while (i !== 0); - t.gzhead.hcrc && t.pending > a && (e.adler = wr(e.adler, t.pending_buf, t.pending - a, a)), t.gzindex = 0; - } - t.status = 91; - } - if (t.status === 91) { - if (t.gzhead.comment) { - let i, a = t.pending; - do { - if (t.pending === t.pending_buf_size) { - if (t.gzhead.hcrc && t.pending > a && (e.adler = wr(e.adler, t.pending_buf, t.pending - a, a)), Ai(e), t.pending !== 0) - return t.last_flush = -1, Rr; - a = 0; - } - i = t.gzindex < t.gzhead.comment.length ? 255 & t.gzhead.comment.charCodeAt(t.gzindex++) : 0, Cn(t, i); - } while (i !== 0); - t.gzhead.hcrc && t.pending > a && (e.adler = wr(e.adler, t.pending_buf, t.pending - a, a)); - } - t.status = 103; - } - if (t.status === 103) { - if (t.gzhead.hcrc) { - if (t.pending + 2 > t.pending_buf_size && (Ai(e), t.pending !== 0)) - return t.last_flush = -1, Rr; - Cn(t, 255 & e.adler), Cn(t, e.adler >> 8 & 255), e.adler = 0; - } - if (t.status = Ks, Ai(e), t.pending !== 0) - return t.last_flush = -1, Rr; - } - if (e.avail_in !== 0 || t.lookahead !== 0 || n !== ps && t.status !== wu) { - let i = t.level === 0 ? Pw(t, n) : t.strategy === kh ? ((a, o) => { - let s; - for (; ; ) { - if (a.lookahead === 0 && (Jl(a), a.lookahead === 0)) { - if (o === ps) - return 1; - break; - } - if (a.match_length = 0, s = fs(a, 0, a.window[a.strstart]), a.lookahead--, a.strstart++, s && (Ri(a, !1), a.strm.avail_out === 0)) - return 1; - } - return a.insert = 0, o === Ji ? (Ri(a, !0), a.strm.avail_out === 0 ? 3 : 4) : a.sym_next && (Ri(a, !1), a.strm.avail_out === 0) ? 1 : 2; - })(t, n) : t.strategy === U6 ? ((a, o) => { - let s, c, l, u; - const d = a.window; - for (; ; ) { - if (a.lookahead <= tl) { - if (Jl(a), a.lookahead <= tl && o === ps) - return 1; - if (a.lookahead === 0) - break; - } - if (a.match_length = 0, a.lookahead >= 3 && a.strstart > 0 && (l = a.strstart - 1, c = d[l], c === d[++l] && c === d[++l] && c === d[++l])) { - u = a.strstart + tl; - do - ; - while (c === d[++l] && c === d[++l] && c === d[++l] && c === d[++l] && c === d[++l] && c === d[++l] && c === d[++l] && c === d[++l] && l < u); - a.match_length = tl - (u - l), a.match_length > a.lookahead && (a.match_length = a.lookahead); - } - if (a.match_length >= 3 ? (s = fs(a, 1, a.match_length - 3), a.lookahead -= a.match_length, a.strstart += a.match_length, a.match_length = 0) : (s = fs(a, 0, a.window[a.strstart]), a.lookahead--, a.strstart++), s && (Ri(a, !1), a.strm.avail_out === 0)) - return 1; - } - return a.insert = 0, o === Ji ? (Ri(a, !0), a.strm.avail_out === 0 ? 3 : 4) : a.sym_next && (Ri(a, !1), a.strm.avail_out === 0) ? 1 : 2; - })(t, n) : Au[t.level].func(t, n); - if (i !== 3 && i !== 4 || (t.status = wu), i === 1 || i === 3) - return e.avail_out === 0 && (t.last_flush = -1), Rr; - if (i === 2 && (n === R6 ? x6(t) : n !== G_ && (Fm(t, 0, 0, !1), n === D6 && ($o(t.head), t.lookahead === 0 && (t.strstart = 0, t.block_start = 0, t.insert = 0))), Ai(e), e.avail_out === 0)) - return t.last_flush = -1, Rr; - } - return n !== Ji ? Rr : t.wrap <= 0 ? z_ : (t.wrap === 2 ? (Cn(t, 255 & e.adler), Cn(t, e.adler >> 8 & 255), Cn(t, e.adler >> 16 & 255), Cn(t, e.adler >> 24 & 255), Cn(t, 255 & e.total_in), Cn(t, e.total_in >> 8 & 255), Cn(t, e.total_in >> 16 & 255), Cn(t, e.total_in >> 24 & 255)) : (nu(t, e.adler >>> 16), nu(t, 65535 & e.adler)), Ai(e), t.wrap > 0 && (t.wrap = -t.wrap), t.pending !== 0 ? Rr : z_); -}, deflateEnd: (e) => { - if (Nu(e)) - return Oa; - const n = e.state.status; - return e.state = null, n === Ks ? Ws(e, L6) : Rr; -}, deflateSetDictionary: (e, n) => { - let t = n.length; - if (Nu(e)) - return Oa; - const r = e.state, i = r.wrap; - if (i === 2 || i === 1 && r.status !== ic || r.lookahead) - return Oa; - if (i === 1 && (e.adler = Vu(e.adler, n, t, 0)), r.wrap = 0, t >= r.w_size) { - i === 0 && ($o(r.head), r.strstart = 0, r.block_start = 0, r.insert = 0); - let c = new Uint8Array(r.w_size); - c.set(n.subarray(t - r.w_size, t), 0), n = c, t = r.w_size; - } - const a = e.avail_in, o = e.next_in, s = e.input; - for (e.avail_in = t, e.next_in = 0, e.input = n, Jl(r); r.lookahead >= 3; ) { - let c = r.strstart, l = r.lookahead - 2; - do - r.ins_h = vs(r, r.ins_h, r.window[c + 3 - 1]), r.prev[c & r.w_mask] = r.head[r.ins_h], r.head[r.ins_h] = c, c++; - while (--l); - r.strstart = c, r.lookahead = 2, Jl(r); - } - return r.strstart += r.lookahead, r.block_start = r.strstart, r.insert = r.lookahead, r.lookahead = 0, r.match_length = r.prev_length = 2, r.match_available = 0, e.next_in = o, e.input = s, e.avail_in = a, r.wrap = i, Rr; -}, deflateInfo: "pako deflate (from Nodeca project)" }; -const G6 = (e, n) => Object.prototype.hasOwnProperty.call(e, n); -var Gp = { assign: function(e) { - const n = Array.prototype.slice.call(arguments, 1); - for (; n.length; ) { - const t = n.shift(); - if (t) { - if (typeof t != "object") - throw new TypeError(t + "must be non-object"); - for (const r in t) - G6(t, r) && (e[r] = t[r]); - } - } - return e; -}, flattenChunks: (e) => { - let n = 0; - for (let r = 0, i = e.length; r < i; r++) - n += e[r].length; - const t = new Uint8Array(n); - for (let r = 0, i = 0, a = e.length; r < a; r++) { - let o = e[r]; - t.set(o, i), i += o.length; - } - return t; -} }; -let Fw = !0; -try { - String.fromCharCode.apply(null, new Uint8Array(1)); -} catch { - Fw = !1; -} -const Ed = new Uint8Array(256); -for (let e = 0; e < 256; e++) - Ed[e] = e >= 252 ? 6 : e >= 248 ? 5 : e >= 240 ? 4 : e >= 224 ? 3 : e >= 192 ? 2 : 1; -Ed[254] = Ed[254] = 1; -var _d = { string2buf: (e) => { - if (typeof TextEncoder == "function" && TextEncoder.prototype.encode) - return new TextEncoder().encode(e); - let n, t, r, i, a, o = e.length, s = 0; - for (i = 0; i < o; i++) - t = e.charCodeAt(i), (64512 & t) == 55296 && i + 1 < o && (r = e.charCodeAt(i + 1), (64512 & r) == 56320 && (t = 65536 + (t - 55296 << 10) + (r - 56320), i++)), s += t < 128 ? 1 : t < 2048 ? 2 : t < 65536 ? 3 : 4; - for (n = new Uint8Array(s), a = 0, i = 0; a < s; i++) - t = e.charCodeAt(i), (64512 & t) == 55296 && i + 1 < o && (r = e.charCodeAt(i + 1), (64512 & r) == 56320 && (t = 65536 + (t - 55296 << 10) + (r - 56320), i++)), t < 128 ? n[a++] = t : t < 2048 ? (n[a++] = 192 | t >>> 6, n[a++] = 128 | 63 & t) : t < 65536 ? (n[a++] = 224 | t >>> 12, n[a++] = 128 | t >>> 6 & 63, n[a++] = 128 | 63 & t) : (n[a++] = 240 | t >>> 18, n[a++] = 128 | t >>> 12 & 63, n[a++] = 128 | t >>> 6 & 63, n[a++] = 128 | 63 & t); - return n; -}, buf2string: (e, n) => { - const t = n || e.length; - if (typeof TextDecoder == "function" && TextDecoder.prototype.decode) - return new TextDecoder().decode(e.subarray(0, n)); - let r, i; - const a = new Array(2 * t); - for (i = 0, r = 0; r < t; ) { - let o = e[r++]; - if (o < 128) { - a[i++] = o; - continue; - } - let s = Ed[o]; - if (s > 4) - a[i++] = 65533, r += s - 1; - else { - for (o &= s === 2 ? 31 : s === 3 ? 15 : 7; s > 1 && r < t; ) - o = o << 6 | 63 & e[r++], s--; - s > 1 ? a[i++] = 65533 : o < 65536 ? a[i++] = o : (o -= 65536, a[i++] = 55296 | o >> 10 & 1023, a[i++] = 56320 | 1023 & o); - } - } - return ((o, s) => { - if (s < 65534 && o.subarray && Fw) - return String.fromCharCode.apply(null, o.length === s ? o : o.subarray(0, s)); - let c = ""; - for (let l = 0; l < s; l++) - c += String.fromCharCode(o[l]); - return c; - })(a, i); -}, utf8border: (e, n) => { - (n = n || e.length) > e.length && (n = e.length); - let t = n - 1; - for (; t >= 0 && (192 & e[t]) == 128; ) - t--; - return t < 0 || t === 0 ? n : t + Ed[e[t]] > n ? t : n; -} }, Bw = function() { - this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; -}; -const Hw = Object.prototype.toString, { Z_NO_FLUSH: z6, Z_SYNC_FLUSH: q6, Z_FULL_FLUSH: K6, Z_FINISH: W6, Z_OK: $f, Z_STREAM_END: Y6, Z_DEFAULT_COMPRESSION: Z6, Z_DEFAULT_STRATEGY: Q6, Z_DEFLATED: X6 } = Pl; -function zu(e) { - this.options = Gp.assign({ level: Z6, method: X6, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: Q6 }, e || {}); - let n = this.options; - n.raw && n.windowBits > 0 ? n.windowBits = -n.windowBits : n.gzip && n.windowBits > 0 && n.windowBits < 16 && (n.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Bw(), this.strm.avail_out = 0; - let t = Gu.deflateInit2(this.strm, n.level, n.method, n.windowBits, n.memLevel, n.strategy); - if (t !== $f) - throw new Error(wl[t]); - if (n.header && Gu.deflateSetHeader(this.strm, n.header), n.dictionary) { - let r; - if (r = typeof n.dictionary == "string" ? _d.string2buf(n.dictionary) : Hw.call(n.dictionary) === "[object ArrayBuffer]" ? new Uint8Array(n.dictionary) : n.dictionary, t = Gu.deflateSetDictionary(this.strm, r), t !== $f) - throw new Error(wl[t]); - this._dict_set = !0; - } -} -function t0(e, n) { - const t = new zu(n); - if (t.push(e, !0), t.err) - throw t.msg || wl[t.err]; - return t.result; -} -zu.prototype.push = function(e, n) { - const t = this.strm, r = this.options.chunkSize; - let i, a; - if (this.ended) - return !1; - for (a = n === ~~n ? n : n === !0 ? W6 : z6, typeof e == "string" ? t.input = _d.string2buf(e) : Hw.call(e) === "[object ArrayBuffer]" ? t.input = new Uint8Array(e) : t.input = e, t.next_in = 0, t.avail_in = t.input.length; ; ) - if (t.avail_out === 0 && (t.output = new Uint8Array(r), t.next_out = 0, t.avail_out = r), (a === q6 || a === K6) && t.avail_out <= 6) - this.onData(t.output.subarray(0, t.next_out)), t.avail_out = 0; - else { - if (i = Gu.deflate(t, a), i === Y6) - return t.next_out > 0 && this.onData(t.output.subarray(0, t.next_out)), i = Gu.deflateEnd(this.strm), this.onEnd(i), this.ended = !0, i === $f; - if (t.avail_out !== 0) { - if (a > 0 && t.next_out > 0) - this.onData(t.output.subarray(0, t.next_out)), t.avail_out = 0; - else if (t.avail_in === 0) - break; - } else - this.onData(t.output); - } - return !0; -}, zu.prototype.onData = function(e) { - this.chunks.push(e); -}, zu.prototype.onEnd = function(e) { - e === $f && (this.result = Gp.flattenChunks(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg; -}; -var J6 = { Deflate: zu, deflate: t0, deflateRaw: function(e, n) { - return (n = n || {}).raw = !0, t0(e, n); -}, gzip: function(e, n) { - return (n = n || {}).gzip = !0, t0(e, n); -}, constants: Pl }; -const Uh = 16209; -var $6 = function(e, n) { - let t, r, i, a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M, N; - const x = e.state; - t = e.next_in, M = e.input, r = t + (e.avail_in - 5), i = e.next_out, N = e.output, a = i - (n - e.avail_out), o = i + (e.avail_out - 257), s = x.dmax, c = x.wsize, l = x.whave, u = x.wnext, d = x.window, h = x.hold, f = x.bits, p = x.lencode, v = x.distcode, m = (1 << x.lenbits) - 1, E = (1 << x.distbits) - 1; - e: - do { - f < 15 && (h += M[t++] << f, f += 8, h += M[t++] << f, f += 8), y = p[h & m]; - t: - for (; ; ) { - if (_ = y >>> 24, h >>>= _, f -= _, _ = y >>> 16 & 255, _ === 0) - N[i++] = 65535 & y; - else { - if (!(16 & _)) { - if (!(64 & _)) { - y = p[(65535 & y) + (h & (1 << _) - 1)]; - continue t; - } - if (32 & _) { - x.mode = 16191; - break e; - } - e.msg = "invalid literal/length code", x.mode = Uh; - break e; - } - S = 65535 & y, _ &= 15, _ && (f < _ && (h += M[t++] << f, f += 8), S += h & (1 << _) - 1, h >>>= _, f -= _), f < 15 && (h += M[t++] << f, f += 8, h += M[t++] << f, f += 8), y = v[h & E]; - n: - for (; ; ) { - if (_ = y >>> 24, h >>>= _, f -= _, _ = y >>> 16 & 255, !(16 & _)) { - if (!(64 & _)) { - y = v[(65535 & y) + (h & (1 << _) - 1)]; - continue n; - } - e.msg = "invalid distance code", x.mode = Uh; - break e; - } - if (b = 65535 & y, _ &= 15, f < _ && (h += M[t++] << f, f += 8, f < _ && (h += M[t++] << f, f += 8)), b += h & (1 << _) - 1, b > s) { - e.msg = "invalid distance too far back", x.mode = Uh; - break e; - } - if (h >>>= _, f -= _, _ = i - a, b > _) { - if (_ = b - _, _ > l && x.sane) { - e.msg = "invalid distance too far back", x.mode = Uh; - break e; - } - if (A = 0, w = d, u === 0) { - if (A += c - _, _ < S) { - S -= _; - do - N[i++] = d[A++]; - while (--_); - A = i - b, w = N; - } - } else if (u < _) { - if (A += c + u - _, _ -= u, _ < S) { - S -= _; - do - N[i++] = d[A++]; - while (--_); - if (A = 0, u < S) { - _ = u, S -= _; - do - N[i++] = d[A++]; - while (--_); - A = i - b, w = N; - } - } - } else if (A += u - _, _ < S) { - S -= _; - do - N[i++] = d[A++]; - while (--_); - A = i - b, w = N; - } - for (; S > 2; ) - N[i++] = w[A++], N[i++] = w[A++], N[i++] = w[A++], S -= 3; - S && (N[i++] = w[A++], S > 1 && (N[i++] = w[A++])); - } else { - A = i - b; - do - N[i++] = N[A++], N[i++] = N[A++], N[i++] = N[A++], S -= 3; - while (S > 2); - S && (N[i++] = N[A++], S > 1 && (N[i++] = N[A++])); - } - break; - } - } - break; - } - } while (t < r && i < o); - S = f >> 3, t -= S, f -= S << 3, h &= (1 << f) - 1, e.next_in = t, e.next_out = i, e.avail_in = t < r ? r - t + 5 : 5 - (t - r), e.avail_out = i < o ? o - i + 257 : 257 - (i - o), x.hold = h, x.bits = f; -}; -const Fh = 15, eR = new Uint16Array([3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0]), tR = new Uint8Array([16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78]), nR = new Uint16Array([1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0]), rR = new Uint8Array([16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]); -var qu = (e, n, t, r, i, a, o, s) => { - const c = s.bits; - let l, u, d, h, f, p, v = 0, m = 0, E = 0, y = 0, _ = 0, S = 0, b = 0, A = 0, w = 0, M = 0, N = null; - const x = new Uint16Array(16), D = new Uint16Array(16); - let j, P, G, z = null; - for (v = 0; v <= Fh; v++) - x[v] = 0; - for (m = 0; m < r; m++) - x[n[t + m]]++; - for (_ = c, y = Fh; y >= 1 && x[y] === 0; y--) - ; - if (_ > y && (_ = y), y === 0) - return i[a++] = 20971520, i[a++] = 20971520, s.bits = 1, 0; - for (E = 1; E < y && x[E] === 0; E++) - ; - for (_ < E && (_ = E), A = 1, v = 1; v <= Fh; v++) - if (A <<= 1, A -= x[v], A < 0) - return -1; - if (A > 0 && (e === 0 || y !== 1)) - return -1; - for (D[1] = 0, v = 1; v < Fh; v++) - D[v + 1] = D[v] + x[v]; - for (m = 0; m < r; m++) - n[t + m] !== 0 && (o[D[n[t + m]]++] = m); - if (e === 0 ? (N = z = o, p = 20) : e === 1 ? (N = eR, z = tR, p = 257) : (N = nR, z = rR, p = 0), M = 0, m = 0, v = E, f = a, S = _, b = 0, d = -1, w = 1 << _, h = w - 1, e === 1 && w > 852 || e === 2 && w > 592) - return 1; - for (; ; ) { - j = v - b, o[m] + 1 < p ? (P = 0, G = o[m]) : o[m] >= p ? (P = z[o[m] - p], G = N[o[m] - p]) : (P = 96, G = 0), l = 1 << v - b, u = 1 << S, E = u; - do - u -= l, i[f + (M >> b) + u] = j << 24 | P << 16 | G | 0; - while (u !== 0); - for (l = 1 << v - 1; M & l; ) - l >>= 1; - if (l !== 0 ? (M &= l - 1, M += l) : M = 0, m++, --x[v] == 0) { - if (v === y) - break; - v = n[t + o[m]]; - } - if (v > _ && (M & h) !== d) { - for (b === 0 && (b = _), f += E, S = v - b, A = 1 << S; S + b < y && (A -= x[S + b], !(A <= 0)); ) - S++, A <<= 1; - if (w += 1 << S, e === 1 && w > 852 || e === 2 && w > 592) - return 1; - d = M & h, i[d] = _ << 24 | S << 16 | f - a | 0; - } - } - return M !== 0 && (i[f + M] = v - b << 24 | 64 << 16 | 0), s.bits = _, 0; -}; -const { Z_FINISH: W_, Z_BLOCK: iR, Z_TREES: Bh, Z_OK: Ys, Z_STREAM_END: aR, Z_NEED_DICT: oR, Z_STREAM_ERROR: Xi, Z_DATA_ERROR: Y_, Z_MEM_ERROR: Z_, Z_BUF_ERROR: sR, Z_DEFLATED: Q_ } = Pl, zp = 16180, Hh = 16190, lo = 16191, n0 = 16192, r0 = 16194, jh = 16199, Vh = 16200, i0 = 16206, zn = 16209, X_ = (e) => (e >>> 24 & 255) + (e >>> 8 & 65280) + ((65280 & e) << 8) + ((255 & e) << 24); -function lR() { - this.strm = null, this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new Uint16Array(320), this.work = new Uint16Array(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; -} -const nl = (e) => { - if (!e) - return 1; - const n = e.state; - return !n || n.strm !== e || n.mode < zp || n.mode > 16211 ? 1 : 0; -}, jw = (e) => { - if (nl(e)) - return Xi; - const n = e.state; - return e.total_in = e.total_out = n.total = 0, e.msg = "", n.wrap && (e.adler = 1 & n.wrap), n.mode = zp, n.last = 0, n.havedict = 0, n.flags = -1, n.dmax = 32768, n.head = null, n.hold = 0, n.bits = 0, n.lencode = n.lendyn = new Int32Array(852), n.distcode = n.distdyn = new Int32Array(592), n.sane = 1, n.back = -1, Ys; -}, Vw = (e) => { - if (nl(e)) - return Xi; - const n = e.state; - return n.wsize = 0, n.whave = 0, n.wnext = 0, jw(e); -}, Gw = (e, n) => { - let t; - if (nl(e)) - return Xi; - const r = e.state; - return n < 0 ? (t = 0, n = -n) : (t = 5 + (n >> 4), n < 48 && (n &= 15)), n && (n < 8 || n > 15) ? Xi : (r.window !== null && r.wbits !== n && (r.window = null), r.wrap = t, r.wbits = n, Vw(e)); -}, J_ = (e, n) => { - if (!e) - return Xi; - const t = new lR(); - e.state = t, t.strm = e, t.window = null, t.mode = zp; - const r = Gw(e, n); - return r !== Ys && (e.state = null), r; -}; -let a0, o0, $_ = !0; -const cR = (e) => { - if ($_) { - a0 = new Int32Array(512), o0 = new Int32Array(32); - let n = 0; - for (; n < 144; ) - e.lens[n++] = 8; - for (; n < 256; ) - e.lens[n++] = 9; - for (; n < 280; ) - e.lens[n++] = 7; - for (; n < 288; ) - e.lens[n++] = 8; - for (qu(1, e.lens, 0, 288, a0, 0, e.work, { bits: 9 }), n = 0; n < 32; ) - e.lens[n++] = 5; - qu(2, e.lens, 0, 32, o0, 0, e.work, { bits: 5 }), $_ = !1; - } - e.lencode = a0, e.lenbits = 9, e.distcode = o0, e.distbits = 5; -}, eb = (e, n, t, r) => { - let i; - const a = e.state; - return a.window === null && (a.wsize = 1 << a.wbits, a.wnext = 0, a.whave = 0, a.window = new Uint8Array(a.wsize)), r >= a.wsize ? (a.window.set(n.subarray(t - a.wsize, t), 0), a.wnext = 0, a.whave = a.wsize) : (i = a.wsize - a.wnext, i > r && (i = r), a.window.set(n.subarray(t - r, t - r + i), a.wnext), (r -= i) ? (a.window.set(n.subarray(t - r, t), 0), a.wnext = r, a.whave = a.wsize) : (a.wnext += i, a.wnext === a.wsize && (a.wnext = 0), a.whave < a.wsize && (a.whave += i))), 0; -}; -var go = { inflateReset: Vw, inflateReset2: Gw, inflateResetKeep: jw, inflateInit: (e) => J_(e, 15), inflateInit2: J_, inflate: (e, n) => { - let t, r, i, a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M = 0; - const N = new Uint8Array(4); - let x, D; - const j = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); - if (nl(e) || !e.output || !e.input && e.avail_in !== 0) - return Xi; - t = e.state, t.mode === lo && (t.mode = n0), o = e.next_out, i = e.output, c = e.avail_out, a = e.next_in, r = e.input, s = e.avail_in, l = t.hold, u = t.bits, d = s, h = c, w = Ys; - e: - for (; ; ) - switch (t.mode) { - case zp: - if (t.wrap === 0) { - t.mode = n0; - break; - } - for (; u < 16; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if (2 & t.wrap && l === 35615) { - t.wbits === 0 && (t.wbits = 15), t.check = 0, N[0] = 255 & l, N[1] = l >>> 8 & 255, t.check = wr(t.check, N, 2, 0), l = 0, u = 0, t.mode = 16181; - break; - } - if (t.head && (t.head.done = !1), !(1 & t.wrap) || (((255 & l) << 8) + (l >> 8)) % 31) { - e.msg = "incorrect header check", t.mode = zn; - break; - } - if ((15 & l) !== Q_) { - e.msg = "unknown compression method", t.mode = zn; - break; - } - if (l >>>= 4, u -= 4, A = 8 + (15 & l), t.wbits === 0 && (t.wbits = A), A > 15 || A > t.wbits) { - e.msg = "invalid window size", t.mode = zn; - break; - } - t.dmax = 1 << t.wbits, t.flags = 0, e.adler = t.check = 1, t.mode = 512 & l ? 16189 : lo, l = 0, u = 0; - break; - case 16181: - for (; u < 16; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if (t.flags = l, (255 & t.flags) !== Q_) { - e.msg = "unknown compression method", t.mode = zn; - break; - } - if (57344 & t.flags) { - e.msg = "unknown header flags set", t.mode = zn; - break; - } - t.head && (t.head.text = l >> 8 & 1), 512 & t.flags && 4 & t.wrap && (N[0] = 255 & l, N[1] = l >>> 8 & 255, t.check = wr(t.check, N, 2, 0)), l = 0, u = 0, t.mode = 16182; - case 16182: - for (; u < 32; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - t.head && (t.head.time = l), 512 & t.flags && 4 & t.wrap && (N[0] = 255 & l, N[1] = l >>> 8 & 255, N[2] = l >>> 16 & 255, N[3] = l >>> 24 & 255, t.check = wr(t.check, N, 4, 0)), l = 0, u = 0, t.mode = 16183; - case 16183: - for (; u < 16; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - t.head && (t.head.xflags = 255 & l, t.head.os = l >> 8), 512 & t.flags && 4 & t.wrap && (N[0] = 255 & l, N[1] = l >>> 8 & 255, t.check = wr(t.check, N, 2, 0)), l = 0, u = 0, t.mode = 16184; - case 16184: - if (1024 & t.flags) { - for (; u < 16; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - t.length = l, t.head && (t.head.extra_len = l), 512 & t.flags && 4 & t.wrap && (N[0] = 255 & l, N[1] = l >>> 8 & 255, t.check = wr(t.check, N, 2, 0)), l = 0, u = 0; - } else - t.head && (t.head.extra = null); - t.mode = 16185; - case 16185: - if (1024 & t.flags && (f = t.length, f > s && (f = s), f && (t.head && (A = t.head.extra_len - t.length, t.head.extra || (t.head.extra = new Uint8Array(t.head.extra_len)), t.head.extra.set(r.subarray(a, a + f), A)), 512 & t.flags && 4 & t.wrap && (t.check = wr(t.check, r, f, a)), s -= f, a += f, t.length -= f), t.length)) - break e; - t.length = 0, t.mode = 16186; - case 16186: - if (2048 & t.flags) { - if (s === 0) - break e; - f = 0; - do - A = r[a + f++], t.head && A && t.length < 65536 && (t.head.name += String.fromCharCode(A)); - while (A && f < s); - if (512 & t.flags && 4 & t.wrap && (t.check = wr(t.check, r, f, a)), s -= f, a += f, A) - break e; - } else - t.head && (t.head.name = null); - t.length = 0, t.mode = 16187; - case 16187: - if (4096 & t.flags) { - if (s === 0) - break e; - f = 0; - do - A = r[a + f++], t.head && A && t.length < 65536 && (t.head.comment += String.fromCharCode(A)); - while (A && f < s); - if (512 & t.flags && 4 & t.wrap && (t.check = wr(t.check, r, f, a)), s -= f, a += f, A) - break e; - } else - t.head && (t.head.comment = null); - t.mode = 16188; - case 16188: - if (512 & t.flags) { - for (; u < 16; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if (4 & t.wrap && l !== (65535 & t.check)) { - e.msg = "header crc mismatch", t.mode = zn; - break; - } - l = 0, u = 0; - } - t.head && (t.head.hcrc = t.flags >> 9 & 1, t.head.done = !0), e.adler = t.check = 0, t.mode = lo; - break; - case 16189: - for (; u < 32; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - e.adler = t.check = X_(l), l = 0, u = 0, t.mode = Hh; - case Hh: - if (t.havedict === 0) - return e.next_out = o, e.avail_out = c, e.next_in = a, e.avail_in = s, t.hold = l, t.bits = u, oR; - e.adler = t.check = 1, t.mode = lo; - case lo: - if (n === iR || n === Bh) - break e; - case n0: - if (t.last) { - l >>>= 7 & u, u -= 7 & u, t.mode = i0; - break; - } - for (; u < 3; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - switch (t.last = 1 & l, l >>>= 1, u -= 1, 3 & l) { - case 0: - t.mode = 16193; - break; - case 1: - if (cR(t), t.mode = jh, n === Bh) { - l >>>= 2, u -= 2; - break e; - } - break; - case 2: - t.mode = 16196; - break; - case 3: - e.msg = "invalid block type", t.mode = zn; - } - l >>>= 2, u -= 2; - break; - case 16193: - for (l >>>= 7 & u, u -= 7 & u; u < 32; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if ((65535 & l) != (l >>> 16 ^ 65535)) { - e.msg = "invalid stored block lengths", t.mode = zn; - break; - } - if (t.length = 65535 & l, l = 0, u = 0, t.mode = r0, n === Bh) - break e; - case r0: - t.mode = 16195; - case 16195: - if (f = t.length, f) { - if (f > s && (f = s), f > c && (f = c), f === 0) - break e; - i.set(r.subarray(a, a + f), o), s -= f, a += f, c -= f, o += f, t.length -= f; - break; - } - t.mode = lo; - break; - case 16196: - for (; u < 14; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if (t.nlen = 257 + (31 & l), l >>>= 5, u -= 5, t.ndist = 1 + (31 & l), l >>>= 5, u -= 5, t.ncode = 4 + (15 & l), l >>>= 4, u -= 4, t.nlen > 286 || t.ndist > 30) { - e.msg = "too many length or distance symbols", t.mode = zn; - break; - } - t.have = 0, t.mode = 16197; - case 16197: - for (; t.have < t.ncode; ) { - for (; u < 3; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - t.lens[j[t.have++]] = 7 & l, l >>>= 3, u -= 3; - } - for (; t.have < 19; ) - t.lens[j[t.have++]] = 0; - if (t.lencode = t.lendyn, t.lenbits = 7, x = { bits: t.lenbits }, w = qu(0, t.lens, 0, 19, t.lencode, 0, t.work, x), t.lenbits = x.bits, w) { - e.msg = "invalid code lengths set", t.mode = zn; - break; - } - t.have = 0, t.mode = 16198; - case 16198: - for (; t.have < t.nlen + t.ndist; ) { - for (; M = t.lencode[l & (1 << t.lenbits) - 1], m = M >>> 24, E = M >>> 16 & 255, y = 65535 & M, !(m <= u); ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if (y < 16) - l >>>= m, u -= m, t.lens[t.have++] = y; - else { - if (y === 16) { - for (D = m + 2; u < D; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if (l >>>= m, u -= m, t.have === 0) { - e.msg = "invalid bit length repeat", t.mode = zn; - break; - } - A = t.lens[t.have - 1], f = 3 + (3 & l), l >>>= 2, u -= 2; - } else if (y === 17) { - for (D = m + 3; u < D; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - l >>>= m, u -= m, A = 0, f = 3 + (7 & l), l >>>= 3, u -= 3; - } else { - for (D = m + 7; u < D; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - l >>>= m, u -= m, A = 0, f = 11 + (127 & l), l >>>= 7, u -= 7; - } - if (t.have + f > t.nlen + t.ndist) { - e.msg = "invalid bit length repeat", t.mode = zn; - break; - } - for (; f--; ) - t.lens[t.have++] = A; - } - } - if (t.mode === zn) - break; - if (t.lens[256] === 0) { - e.msg = "invalid code -- missing end-of-block", t.mode = zn; - break; - } - if (t.lenbits = 9, x = { bits: t.lenbits }, w = qu(1, t.lens, 0, t.nlen, t.lencode, 0, t.work, x), t.lenbits = x.bits, w) { - e.msg = "invalid literal/lengths set", t.mode = zn; - break; - } - if (t.distbits = 6, t.distcode = t.distdyn, x = { bits: t.distbits }, w = qu(2, t.lens, t.nlen, t.ndist, t.distcode, 0, t.work, x), t.distbits = x.bits, w) { - e.msg = "invalid distances set", t.mode = zn; - break; - } - if (t.mode = jh, n === Bh) - break e; - case jh: - t.mode = Vh; - case Vh: - if (s >= 6 && c >= 258) { - e.next_out = o, e.avail_out = c, e.next_in = a, e.avail_in = s, t.hold = l, t.bits = u, $6(e, h), o = e.next_out, i = e.output, c = e.avail_out, a = e.next_in, r = e.input, s = e.avail_in, l = t.hold, u = t.bits, t.mode === lo && (t.back = -1); - break; - } - for (t.back = 0; M = t.lencode[l & (1 << t.lenbits) - 1], m = M >>> 24, E = M >>> 16 & 255, y = 65535 & M, !(m <= u); ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if (E && !(240 & E)) { - for (_ = m, S = E, b = y; M = t.lencode[b + ((l & (1 << _ + S) - 1) >> _)], m = M >>> 24, E = M >>> 16 & 255, y = 65535 & M, !(_ + m <= u); ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - l >>>= _, u -= _, t.back += _; - } - if (l >>>= m, u -= m, t.back += m, t.length = y, E === 0) { - t.mode = 16205; - break; - } - if (32 & E) { - t.back = -1, t.mode = lo; - break; - } - if (64 & E) { - e.msg = "invalid literal/length code", t.mode = zn; - break; - } - t.extra = 15 & E, t.mode = 16201; - case 16201: - if (t.extra) { - for (D = t.extra; u < D; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - t.length += l & (1 << t.extra) - 1, l >>>= t.extra, u -= t.extra, t.back += t.extra; - } - t.was = t.length, t.mode = 16202; - case 16202: - for (; M = t.distcode[l & (1 << t.distbits) - 1], m = M >>> 24, E = M >>> 16 & 255, y = 65535 & M, !(m <= u); ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if (!(240 & E)) { - for (_ = m, S = E, b = y; M = t.distcode[b + ((l & (1 << _ + S) - 1) >> _)], m = M >>> 24, E = M >>> 16 & 255, y = 65535 & M, !(_ + m <= u); ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - l >>>= _, u -= _, t.back += _; - } - if (l >>>= m, u -= m, t.back += m, 64 & E) { - e.msg = "invalid distance code", t.mode = zn; - break; - } - t.offset = y, t.extra = 15 & E, t.mode = 16203; - case 16203: - if (t.extra) { - for (D = t.extra; u < D; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - t.offset += l & (1 << t.extra) - 1, l >>>= t.extra, u -= t.extra, t.back += t.extra; - } - if (t.offset > t.dmax) { - e.msg = "invalid distance too far back", t.mode = zn; - break; - } - t.mode = 16204; - case 16204: - if (c === 0) - break e; - if (f = h - c, t.offset > f) { - if (f = t.offset - f, f > t.whave && t.sane) { - e.msg = "invalid distance too far back", t.mode = zn; - break; - } - f > t.wnext ? (f -= t.wnext, p = t.wsize - f) : p = t.wnext - f, f > t.length && (f = t.length), v = t.window; - } else - v = i, p = o - t.offset, f = t.length; - f > c && (f = c), c -= f, t.length -= f; - do - i[o++] = v[p++]; - while (--f); - t.length === 0 && (t.mode = Vh); - break; - case 16205: - if (c === 0) - break e; - i[o++] = t.length, c--, t.mode = Vh; - break; - case i0: - if (t.wrap) { - for (; u < 32; ) { - if (s === 0) - break e; - s--, l |= r[a++] << u, u += 8; - } - if (h -= c, e.total_out += h, t.total += h, 4 & t.wrap && h && (e.adler = t.check = t.flags ? wr(t.check, i, h, o - h) : Vu(t.check, i, h, o - h)), h = c, 4 & t.wrap && (t.flags ? l : X_(l)) !== t.check) { - e.msg = "incorrect data check", t.mode = zn; - break; - } - l = 0, u = 0; - } - t.mode = 16207; - case 16207: - if (t.wrap && t.flags) { - for (; u < 32; ) { - if (s === 0) - break e; - s--, l += r[a++] << u, u += 8; - } - if (4 & t.wrap && l !== (4294967295 & t.total)) { - e.msg = "incorrect length check", t.mode = zn; - break; - } - l = 0, u = 0; - } - t.mode = 16208; - case 16208: - w = aR; - break e; - case zn: - w = Y_; - break e; - case 16210: - return Z_; - default: - return Xi; - } - return e.next_out = o, e.avail_out = c, e.next_in = a, e.avail_in = s, t.hold = l, t.bits = u, (t.wsize || h !== e.avail_out && t.mode < zn && (t.mode < i0 || n !== W_)) && eb(e, e.output, e.next_out, h - e.avail_out), d -= e.avail_in, h -= e.avail_out, e.total_in += d, e.total_out += h, t.total += h, 4 & t.wrap && h && (e.adler = t.check = t.flags ? wr(t.check, i, h, e.next_out - h) : Vu(t.check, i, h, e.next_out - h)), e.data_type = t.bits + (t.last ? 64 : 0) + (t.mode === lo ? 128 : 0) + (t.mode === jh || t.mode === r0 ? 256 : 0), (d === 0 && h === 0 || n === W_) && w === Ys && (w = sR), w; -}, inflateEnd: (e) => { - if (nl(e)) - return Xi; - let n = e.state; - return n.window && (n.window = null), e.state = null, Ys; -}, inflateGetHeader: (e, n) => { - if (nl(e)) - return Xi; - const t = e.state; - return 2 & t.wrap ? (t.head = n, n.done = !1, Ys) : Xi; -}, inflateSetDictionary: (e, n) => { - const t = n.length; - let r, i, a; - return nl(e) ? Xi : (r = e.state, r.wrap !== 0 && r.mode !== Hh ? Xi : r.mode === Hh && (i = 1, i = Vu(i, n, t, 0), i !== r.check) ? Y_ : (a = eb(e, n, t, t), a ? (r.mode = 16210, Z_) : (r.havedict = 1, Ys))); -}, inflateInfo: "pako inflate (from Nodeca project)" }, uR = function() { - this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1; -}; -const zw = Object.prototype.toString, { Z_NO_FLUSH: dR, Z_FINISH: hR, Z_OK: Ku, Z_STREAM_END: s0, Z_NEED_DICT: l0, Z_STREAM_ERROR: fR, Z_DATA_ERROR: tb, Z_MEM_ERROR: pR } = Pl; -function Wu(e) { - this.options = Gp.assign({ chunkSize: 65536, windowBits: 15, to: "" }, e || {}); - const n = this.options; - n.raw && n.windowBits >= 0 && n.windowBits < 16 && (n.windowBits = -n.windowBits, n.windowBits === 0 && (n.windowBits = -15)), !(n.windowBits >= 0 && n.windowBits < 16) || e && e.windowBits || (n.windowBits += 32), n.windowBits > 15 && n.windowBits < 48 && !(15 & n.windowBits) && (n.windowBits |= 15), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Bw(), this.strm.avail_out = 0; - let t = go.inflateInit2(this.strm, n.windowBits); - if (t !== Ku) - throw new Error(wl[t]); - if (this.header = new uR(), go.inflateGetHeader(this.strm, this.header), n.dictionary && (typeof n.dictionary == "string" ? n.dictionary = _d.string2buf(n.dictionary) : zw.call(n.dictionary) === "[object ArrayBuffer]" && (n.dictionary = new Uint8Array(n.dictionary)), n.raw && (t = go.inflateSetDictionary(this.strm, n.dictionary), t !== Ku))) - throw new Error(wl[t]); -} -function c0(e, n) { - const t = new Wu(n); - if (t.push(e), t.err) - throw t.msg || wl[t.err]; - return t.result; -} -Wu.prototype.push = function(e, n) { - const t = this.strm, r = this.options.chunkSize, i = this.options.dictionary; - let a, o, s; - if (this.ended) - return !1; - for (o = n === ~~n ? n : n === !0 ? hR : dR, zw.call(e) === "[object ArrayBuffer]" ? t.input = new Uint8Array(e) : t.input = e, t.next_in = 0, t.avail_in = t.input.length; ; ) { - for (t.avail_out === 0 && (t.output = new Uint8Array(r), t.next_out = 0, t.avail_out = r), a = go.inflate(t, o), a === l0 && i && (a = go.inflateSetDictionary(t, i), a === Ku ? a = go.inflate(t, o) : a === tb && (a = l0)); t.avail_in > 0 && a === s0 && t.state.wrap > 0 && e[t.next_in] !== 0; ) - go.inflateReset(t), a = go.inflate(t, o); - switch (a) { - case fR: - case tb: - case l0: - case pR: - return this.onEnd(a), this.ended = !0, !1; - } - if (s = t.avail_out, t.next_out && (t.avail_out === 0 || a === s0)) - if (this.options.to === "string") { - let c = _d.utf8border(t.output, t.next_out), l = t.next_out - c, u = _d.buf2string(t.output, c); - t.next_out = l, t.avail_out = r - l, l && t.output.set(t.output.subarray(c, c + l), 0), this.onData(u); - } else - this.onData(t.output.length === t.next_out ? t.output : t.output.subarray(0, t.next_out)); - if (a !== Ku || s !== 0) { - if (a === s0) - return a = go.inflateEnd(this.strm), this.onEnd(a), this.ended = !0, !0; - if (t.avail_in === 0) - break; - } - } - return !0; -}, Wu.prototype.onData = function(e) { - this.chunks.push(e); -}, Wu.prototype.onEnd = function(e) { - e === Ku && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = Gp.flattenChunks(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg; -}; -var vR = { Inflate: Wu, inflate: c0, inflateRaw: function(e, n) { - return (n = n || {}).raw = !0, c0(e, n); -}, ungzip: c0, constants: Pl }; -const { Deflate: mR, deflate: gR, deflateRaw: yR, gzip: ER } = J6, { Inflate: _R, inflate: bR, inflateRaw: CR, ungzip: TR } = vR; -var ja, SR = { Deflate: mR, deflate: gR, deflateRaw: yR, gzip: ER, Inflate: _R, inflate: bR, inflateRaw: CR, ungzip: TR, constants: Pl }, nb = function(e) { - return T(void 0, void 0, void 0, function() { - var n; - return C(this, function(t) { - return n = SR.ungzip(e), [2, String.fromCharCode.apply(null, n)]; - }); - }); -}; -(function(e) { - e.CONNECTING = "CONNECTING", e.OPEN = "OPEN", e.CLOSED = "CLOSED"; -})(ja || (ja = {})); -var tn, wR = function(e) { - function n(t, r) { - var i = r.sdkState, a = r.dispatcher, o = r.logger, s = e.call(this) || this; - return s.lastActive = 0, s._iid = t, s._sdkState = i, s._dispatcher = a, s._logger = o, s; - } - return O(n, e), Object.defineProperty(n.prototype, "isOpen", { get: function() { - return this.connectionState === ja.OPEN; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "connectionState", { get: function() { - if (this._ws) - switch (this._ws.readyState) { - case 0: - return ja.CONNECTING; - case 1: - return ja.OPEN; - } - return ja.CLOSED; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "ws", { get: function() { - var t; - return (t = this._ws) !== null && t !== void 0 ? t : null; - }, enumerable: !1, configurable: !0 }), n.prototype._handleMessage = function(t) { - var r = this; - t.split(` -`).forEach(function(i) { - if (i) { - var a = En.createFromRawMessage(r._iid, i); - if (r._logger.debug("receive websocket event", a), a.code === "LOGI") - r.dispatch("message", a); - else if (a.code === "PONG") - r.dispatch("pong"); - else if (a.code === "EXPR") { - if (a.payload) { - var o = new Ac(a.payload); - o.expiresIn >= 0 && r._dispatcher.dispatch(o); - } - } else - a.code === "NOOP" || r.dispatch("message", a); - } - }); - }, n.prototype.connect = function(t, r) { - var i = this; - r === void 0 && (r = ""), this._ws = new WebSocket(t, encodeURIComponent(r)), this._ws.onopen = function() { - i._logger.debug("websocket open"), i.dispatch("open"); - }, this._ws.onmessage = function(a) { - return T(i, void 0, void 0, function() { - var o, s, c, l, u = this; - return C(this, function(d) { - switch (d.label) { - case 0: - return !((l = this._sdkState.websocket) === null || l === void 0) && l.compression ? a.data instanceof Blob ? ((o = new FileReader()).readAsArrayBuffer(a.data), o.onloadend = function() { - return T(u, void 0, void 0, function() { - var h, f; - return C(this, function(p) { - switch (p.label) { - case 0: - return p.trys.push([0, 2, , 3]), [4, nb(o.result)]; - case 1: - return h = p.sent(), this._handleMessage(h), [3, 3]; - case 2: - return f = p.sent(), this.error(f), [3, 3]; - case 3: - return [2]; - } - }); - }); - }, [3, 7]) : [3, 1] : [3, 8]; - case 1: - if (!(a.data instanceof ArrayBuffer)) - return [3, 6]; - d.label = 2; - case 2: - return d.trys.push([2, 4, , 5]), [4, nb(new Uint8Array(a.data))]; - case 3: - return s = d.sent(), this._handleMessage(s), [3, 5]; - case 4: - return c = d.sent(), this.error(c), [3, 5]; - case 5: - return [3, 7]; - case 6: - typeof a.data == "string" && this._handleMessage(a.data), d.label = 7; - case 7: - return [3, 9]; - case 8: - this._handleMessage(a.data), d.label = 9; - case 9: - return [2]; - } - }); - }); - }, this._ws.onerror = function() { - i._logger.debug("websocket error"), i.dispatch("error", H.networkError); - }, this._ws.onclose = function() { - i._logger.debug("websocket close"), i.dispatch("close"); - }, this.lastActive = Date.now(); - }, n.prototype.disconnect = function() { - var t = this; - return new Promise(function(r) { - t._logger.debug("websocket disconnect"), t._ws ? (t._ws.onopen = bt, t._ws.onmessage = bt, t._ws.onerror = bt, t.connectionState !== ja.CLOSED ? (t._ws.onclose = function() { - t.dispatch("close"), r(); - }, t._ws.close(), t._ws = void 0) : r()) : r(); - }); - }, n.prototype.send = function(t) { - if (!this._ws) - throw H.connectionClosed; - t.code !== "PING" ? this.dispatch("ping-refresh") : this._logger.debug("send ping", t), this._ws.send(t.convertToMessage()); - }, n.prototype.error = function(t) { - this._logger.debug("websocket error", t), this.dispatch("error", t); - }, n; -}(Dl), qw = function(e) { - function n(t) { - var r = t.all, i = t.feed, a = t.custom_types, o = t.ts, s = e.call(this) || this; - return s.all = r, s.feed = i, s.customTypes = a, s.ts = o, s; - } - return O(n, e), n; -}(bn), AR = function() { - function e(n, t) { - var r = t.session, i = t.sdkState, a = t.dispatcher, o = t.logger, s = t.useFetchCompat, c = s !== void 0 && s, l = this; - this._ackStateMap = /* @__PURE__ */ new Map(), this._sdkState = i, this._dispatcher = a, this._logger = o, this.apiClient = new S6(n, { session: r, sdkState: i, dispatcher: a, logger: o, useFetchCompat: c }), this.websocketClient = new wR(n, { sdkState: i, dispatcher: a, logger: o }), this.websocketClient.on("message", function(u) { - if (u.payload.unread_cnt && l._dispatcher.dispatch(new qw(u.payload.unread_cnt)), u.requestId) { - if (l._ackStateMap.has(u.requestId)) { - var d = l._ackStateMap.get(u.requestId); - u.code !== "EROR" ? d.resolve(u) : d.reject(new H({ code: u.payload.code, message: u.payload.message })); - } - } else - l._dispatcher.dispatch(u); - }).on("close", function() { - l._ackStateMap.forEach(function(u) { - u.reject(H.connectionClosed); - }), l._ackStateMap.clear(); - }); - } - return e.prototype._sendApiRequest = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this.apiClient.send(n)]; - case 1: - return [2, t.sent()]; - } - }); - }); - }, e.prototype._sendWebsocketRequest = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a = this; - return C(this, function(o) { - if (!this._sdkState.websocket) - throw H.connectionRequired; - if (t = new Kr(), n.ackRequired) { - i = function(s, c) { - a._ackStateMap.has(n.requestId) && (a._ackStateMap.delete(n.requestId), r && (clearTimeout(r), r = null), s ? (a._logger.debug("fail websocket request", n.requestId, s), t.reject(s)) : (a._logger.debug("receive websocket ack", n.requestId, n), a._logger.debug("receive websocket ack", c), t.resolve(c))); - }; - try { - r = setTimeout(function() { - return i(H.noAckTimeout); - }, this._sdkState.websocket.responseTimeout), this._ackStateMap.set(n.requestId, { resolve: function(s) { - return i(void 0, s); - }, reject: function(s) { - return i(s); - } }), this.websocketClient.send(n); - } catch (s) { - i(s); - } - } else - try { - this.websocketClient.send(n), t.resolve(); - } catch (s) { - t.reject(s); - } - return [2, t.promise]; - }); - }); - }, e.prototype.send = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return n instanceof ge ? [4, this._sendApiRequest(n)] : [3, 2]; - case 1: - case 3: - return [2, t.sent()]; - case 2: - return n instanceof Ir ? [4, this._sendWebsocketRequest(n)] : [3, 4]; - case 4: - throw H.invalidParameters; - } - }); - }); - }, e.prototype.cancel = function(n) { - this.apiClient.cancel(n); - }, e.prototype.cancelAll = function() { - this.apiClient.cancelAll(); - }, e; -}(); -(function(e) { - e[e.NONE = 0] = "NONE", e[e.INITIALIZED = 1] = "INITIALIZED", e[e.CONNECTING = 2] = "CONNECTING", e[e.CONNECTED = 3] = "CONNECTED", e[e.RECONNECTING = 4] = "RECONNECTING", e[e.INTERNAL_DISCONNECTED = 5] = "INTERNAL_DISCONNECTED", e[e.EXTERNAL_DISCONNECTED = 6] = "EXTERNAL_DISCONNECTED", e[e.LOGOUT = 7] = "LOGOUT"; -})(tn || (tn = {})); -var bi = function(e) { - function n(t) { - var r = t.stateType, i = e.call(this) || this; - return i.stateType = r, i; - } - return O(n, e), n; -}(bn), Kw = function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - return O(n, e), n; -}(bn), Hm = function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - return O(n, e), n; -}(bn), Ww = function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - return O(n, e), n; -}(bn), rb = function() { - function e(n) { - var t, r, i, a; - this.isEnabled = (t = n.enabled) !== null && t !== void 0 && t, this.feedChannels = (r = n.feed_channels) !== null && r !== void 0 ? r : {}, this.templateListToken = (i = n.template_list_token) !== null && i !== void 0 ? i : null, this.settingsUpdatedAt = (a = n.settings_updated_at) !== null && a !== void 0 ? a : 0; - } - return e.payloadify = function(n) { - return Be(Xe({ enabled: n.isEnabled, feed_channels: n.feedChannels, template_list_token: n.templateListToken, settings_updated_at: n.settingsUpdatedAt })); - }, e; -}(), w1 = function(e) { - return "sendbird@".concat(e, "/changelog_include_chat_notifications"); -}, ib = function() { - function e(n) { - var t; - this.lastUpdatedAt = (t = n.last_updated_at) !== null && t !== void 0 ? t : 0; - } - return e.payloadify = function(n) { - return Be(Xe({ last_updated_at: n.lastUpdatedAt })); - }, e; -}(), ab = function() { - function e(n) { - var t; - this.token = (t = n.template_list_token) !== null && t !== void 0 ? t : ""; - } - return e.payloadify = function(n) { - return Be(Xe({ template_list_token: n.token })); - }, e; -}(), ob = 1048576, NR = 5, sb = function() { - function e(n) { - var t, r, i, a, o; - n === void 0 && (n = {}), this.emojiHash = n.emoji_hash || "", this.uploadSizeLimit = n.file_upload_size_limit ? n.file_upload_size_limit * ob : Number.MAX_SAFE_INTEGER, this.useReaction = !!n.use_reaction, this.applicationAttributes = (t = n.application_attributes) !== null && t !== void 0 ? t : [], this.premiumFeatureList = (r = n.premium_feature_list) !== null && r !== void 0 ? r : [], this.deviceTokenCache = this.applicationAttributes.includes("sdk_device_token_cache"), this.enabledChannelMemberShipHistory = this.applicationAttributes.includes("channel_membership_history"), this.multipleFilesMessageFileCountLimit = (i = n.multiple_file_send_max_size) !== null && i !== void 0 ? i : 5, this.allowSdkStatsUpload = (a = n.allow_sdk_log_ingestion) === null || a === void 0 || a, this.uikitConfigInfo = new ib((o = n.uikit_config) !== null && o !== void 0 ? o : {}), this.notificationInfo = n.notifications ? new rb(n.notifications) : null, this.messageTemplateInfo = n.message_template ? new ab(n.message_template) : null; - } - return e.payloadify = function(n) { - return Be(Xe({ emoji_hash: n.emojiHash, file_upload_size_limit: n.uploadSizeLimit / ob, application_attributes: n.applicationAttributes, premium_feature_list: n.premiumFeatureList, use_reaction: n.useReaction, allow_sdk_log_ingestion: n.allowSdkStatsUpload, uikit_config: n.uikitConfigInfo ? ib.payloadify(n.uikitConfigInfo) : null, notifications: n.notificationInfo ? rb.payloadify(n.notificationInfo) : null, message_template: n.messageTemplateInfo ? ab.payloadify(n.messageTemplateInfo) : null })); - }, e; -}(), br = function() { - function e(n) { - this._iid = "", this._iid = n; - } - return e.payloadify = function(n) { - return {}; - }, e; -}(), IR = function(e) { - function n(t) { - var r = t.userId, i = t.metadata, a = e.call(this) || this; - return a.method = pe.POST, a.path = "".concat(qt, "/").concat(r, "/metadata"), a.params = { metadata: i }, a; - } - return O(n, e), n; -}(ge), MR = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.metaData = r, i; - } - return O(n, e), n; -}(_e), OR = function(e) { - function n(t) { - var r = t.userId, i = t.metadata, a = t.upsert, o = e.call(this) || this; - return o.method = pe.PUT, o.path = "".concat(qt, "/").concat(r, "/metadata"), o.params = { metadata: i, upsert: a }, o; - } - return O(n, e), n; -}(ge), xR = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.metadata = r, i; - } - return O(n, e), n; -}(_e), RR = function(e) { - function n(t) { - var r = t.userId, i = t.metadataKey, a = e.call(this) || this; - return a.method = pe.DELETE, a.path = "".concat(qt, "/").concat(r, "/metadata/").concat(i), a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var DR = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.DELETE, i.path = "".concat(qt, "/").concat(r, "/metadata"), i; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var $l, qc = function(e, n) { - var t = JSON.parse(JSON.stringify(e)); - return t._iid && delete t._iid, n && n(t), t; -}, ms = function(e, n) { - var t = JSON.parse(JSON.stringify(e)); - return n && n(t), t; -}, ve = function(e) { - return { do: function(n) { - e || n(); - }, throw: function(n) { - if (!e) - throw n; - } }; -}; -(function(e) { - e.ONLINE = "online", e.OFFLINE = "offline", e.NON_AVAILABLE = "nonavailable"; -})($l || ($l = {})); -var Nc, Dt = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d, h, f, p, v, m = this; - return (m = e.call(this, t) || this).userId = (a = (i = r.guest_id) !== null && i !== void 0 ? i : r.user_id) !== null && a !== void 0 ? a : "", m.nickname = (s = (o = r.nickname) !== null && o !== void 0 ? o : r.name) !== null && s !== void 0 ? s : "", m.plainProfileUrl = (l = (c = r.profile_url) !== null && c !== void 0 ? c : r.image) !== null && l !== void 0 ? l : "", m.requireAuth = (u = r.require_auth_for_profile_image) !== null && u !== void 0 && u, m.metaData = (d = r.metadata) !== null && d !== void 0 ? d : {}, m.connectionStatus = $l.NON_AVAILABLE, Mt($l, r.is_online) ? m.connectionStatus = r.is_online : k("boolean", r.is_online) && (m.connectionStatus = r.is_online ? $l.ONLINE : $l.OFFLINE), m.isActive = (h = r.is_active) === null || h === void 0 || h, m.lastSeenAt = (f = r.last_seen_at) !== null && f !== void 0 ? f : null, m.preferredLanguages = r.preferred_languages ? dt([], tt(r.preferred_languages), !1) : null, m.friendDiscoveryKey = (p = r.friend_discovery_key) !== null && p !== void 0 ? p : null, m.friendName = (v = r.friend_name) !== null && v !== void 0 ? v : null, m; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { user_id: t.userId, nickname: t.nickname, profile_url: t.plainProfileUrl, require_auth_for_profile_image: t.requireAuth, metadata: t.metaData, is_online: t.connectionStatus, is_active: t.isActive, last_seen_at: t.lastSeenAt, preferred_languages: t.preferredLanguages, friend_discovery_key: t.friendDiscoveryKey, friend_name: t.friendName }))); - }, Object.defineProperty(n.prototype, "profileUrl", { get: function() { - var t = U.of(this._iid).sessionManager; - return this.requireAuth && t.ekey ? "".concat(this.plainProfileUrl, "?auth=").concat(t.ekey) : this.plainProfileUrl; - }, enumerable: !1, configurable: !0 }), n.prototype.serialize = function() { - return qc(this); - }, n.prototype._isValidMetaData = function(t) { - return !Array.isArray(t) && Object.keys(t).length > 0 && Object.keys(t).map(function(r) { - return t[r]; - }).every(function(r) { - return k("string", r); - }); - }, n.prototype._applyMetaData = function(t, r) { - var i = this; - r === void 0 && (r = !1), Object.keys(t).forEach(function(a) { - r ? delete i.metaData[a] : i.metaData[a] = t[a]; - }); - }, n.prototype.createMetaData = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return ve(this._isValidMetaData(t)).throw(H.invalidParameters), r = U.of(this._iid), i = r.sdkState, a = r.requestQueue, o = new IR({ userId: i.userId, metadata: t }), [4, a.send(o)]; - case 1: - return s = l.sent(), c = s.as(MR).metaData, this._applyMetaData(c), [2, this.metaData]; - } - }); - }); - }, n.prototype.updateMetaData = function(t, r) { - return r === void 0 && (r = !1), T(this, void 0, void 0, function() { - var i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return ve(this._isValidMetaData(t)).throw(H.invalidParameters), i = U.of(this._iid), a = i.sdkState, o = i.requestQueue, s = new OR({ userId: a.userId, metadata: t, upsert: r }), [4, o.send(s)]; - case 1: - return c = u.sent(), l = c.as(xR).metadata, this._applyMetaData(l), [2, this.metaData]; - } - }); - }); - }, n.prototype.deleteMetaData = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return ve(k("string", t)).throw(H.invalidParameters), r = U.of(this._iid), i = r.sdkState, a = r.requestQueue, o = new RR({ userId: i.userId, metadataKey: t }), [4, a.send(o)]; - case 1: - return c.sent(), this._applyMetaData(((s = {})[t] = !0, s), !0), [2, this.metaData]; - } - }); - }); - }, n.prototype.deleteAllMetaData = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new DR({ userId: r.userId }), [4, i.send(a)]; - case 1: - return o.sent(), this.metaData = {}, [2]; - } - }); - }); - }, n; -}(br), Yw = function(e) { - function n(t) { - var r = t.userProfile, i = e.call(this) || this; - return i.userProfile = r, i; - } - return O(n, e), n; -}(bn), jm = function() { - function e(n, t) { - var r, i, a, o, s, c, l, u, d, h, f, p, v, m; - this._iid = n, this.appInfo = new sb(t), this.user = new Dt(n, t), this.connectedAt = (r = t.login_ts) !== null && r !== void 0 ? r : 0, this.firstConnectedAt = 0, this.pingInterval = (i = t.ping_interval) !== null && i !== void 0 ? i : 15e3, this.pongTimeout = (a = t.pong_timeout) !== null && a !== void 0 ? a : 5e3, this.reconnectInterval = (s = (o = t.reconnect) === null || o === void 0 ? void 0 : o.interval) !== null && s !== void 0 ? s : 3e3, this.reconnectMaxInterval = (l = (c = t.reconnect) === null || c === void 0 ? void 0 : c.max_interval) !== null && l !== void 0 ? l : 6e4, this.reconnectRetryCount = (d = (u = t.reconnect) === null || u === void 0 ? void 0 : u.retry_cnt) !== null && d !== void 0 ? d : 5, this.reconnectIntervalMultiple = (f = (h = t.reconnect) === null || h === void 0 ? void 0 : h.mul) !== null && f !== void 0 ? f : 2, this.maxUnreadCountOnSuperGroup = (p = t.max_unread_cnt_on_super_group) !== null && p !== void 0 ? p : 100, this.profileImageEncryption = !!t.profile_image_encryption, this.concurrentCallLimit = (v = t.concurrent_call_limit) !== null && v !== void 0 ? v : 5, this.backOffDelay = (m = t.back_off_delay) !== null && m !== void 0 ? m : 100; - } - return e.payloadify = function(n) { - return Be(Xe(L(L(L({}, Dt.payloadify(n.user)), sb.payloadify(n.appInfo)), { login_ts: n.connectedAt, ping_interval: n.pingInterval, pong_timeout: n.pongTimeout, reconnect: { interval: n.reconnectInterval, max_interval: n.reconnectMaxInterval, retry_cnt: n.reconnectRetryCount, mul: n.reconnectIntervalMultiple }, max_unread_cnt_on_super_group: n.maxUnreadCountOnSuperGroup, profile_image_encryption: n.profileImageEncryption, concurrent_call_limit: n.concurrentCallLimit, back_off_delay: n.backOffDelay }))); - }, e.prototype.apply = function() { - var n = this.reconnectInterval, t = this.reconnectMaxInterval, r = this.reconnectIntervalMultiple, i = U.of(this._iid); - i.sdkState.websocket && (i.sdkState.websocket.pingInterval = 1e3 * this.pingInterval, i.sdkState.websocket.pongTimeout = 1e3 * this.pongTimeout, i.sdkState.websocket.reconnectMaxRetry = this.reconnectRetryCount, i.sdkState.websocket.reconnectRetryStrategy = { calcTimeout: function(a) { - return a > 0 ? 1e3 * Math.min(n * Math.pow(r, a - 1), t) : 10; - } }), i.appInfo = this.appInfo, i.sessionManager.currentUser = this.user, i.connectedAt = this.connectedAt, this.firstConnectedAt || (i.firstConnectedAt = this.connectedAt), i.maxSuperGroupChannelUnreadCount = this.maxUnreadCountOnSuperGroup, i.concurrentCallLimit = this.concurrentCallLimit, i.backOffDelay = this.backOffDelay, i.dispatcher.dispatch(new Yw({ userProfile: this })); - }, e; -}(), Zw = function(e) { - function n(t) { - var r = t.request, i = r === void 0 || r, a = t.features, o = a === void 0 ? {} : a, s = t.options, c = s === void 0 ? {} : s, l = e.call(this) || this; - return l.request = i, l.features = L({ localCache: !0, notification: !0 }, o), l.options = L({ ingestion: !0 }, c), l; - } - return O(n, e), n; -}(bn), Sf = function(e) { - function n(t, r, i) { - var a, o, s, c, l = this; - return (l = e.call(this, t, r, i) || this).error = null, l.services = [], l.userProfile = new jm(t, i), l.deviceTokenLastDeletedAt = (a = i.device_token_last_deleted_at) !== null && a !== void 0 ? a : 0, l.key = (o = i.key) !== null && o !== void 0 ? o : "", l.ekey = (s = i.ekey) !== null && s !== void 0 ? s : "", l.error = i.error ? new H(i) : null, l.services = (c = i.services) !== null && c !== void 0 ? c : [], l; - } - return O(n, e), n.asError = function(t) { - return new n("", "LOGI", L({ user_id: "", error: !0 }, t)); - }, n.prototype.applyTo = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return this.error ? [3, 4] : (r = U.of(t)) ? (i = r.sessionManager, a = r.dispatcher, [4, i.login(this)]) : [3, 2]; - case 1: - return o.sent(), this.userProfile.apply(), a.dispatch(new Zw({ request: this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_request_log_publish"), features: { localCache: this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_feature_local_cache_log_publish"), notification: this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_noti_stats_log_publish") }, options: { ingestion: this.userProfile.appInfo.allowSdkStatsUpload } })), [3, 3]; - case 2: - throw H.lostInstance; - case 3: - return [3, 5]; - case 4: - throw this.error; - case 5: - return [2]; - } - }); - }); - }, n; -}(En), kl = function() { - function e() { - this.type = tn.NONE, this.name = "none"; - } - return e.prototype.run = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return [2]; - }); - }); - }, e.prototype.onConnect = function(n, t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return [2]; - }); - }); - }, e.prototype.onReconnect = function(n, t) { - return t.resetReconnectCount, T(this, void 0, void 0, function() { - return C(this, function(r) { - return [2]; - }); - }); - }, e.prototype.onDisconnect = function(n, t) { - return t.error, t.autoReconnect, t.cause, T(this, void 0, void 0, function() { - return C(this, function(r) { - return [2]; - }); - }); - }, e.prototype.onDisconnectWebSocket = function(n, t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return [2]; - }); - }); - }, e.prototype.onLogout = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return [2]; - }); - }); - }, e; -}(), Ke = function(e) { - return T(void 0, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return t.trys.push([0, 2, , 3]), [4, e()]; - case 1: - return t.sent(), [3, 3]; - case 2: - if (!((n = t.sent()) instanceof H)) - throw n; - return n.throwOutside(), [3, 3]; - case 3: - return [2]; - } - }); - }); -}, Pn = function(e) { - return T(void 0, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return n.trys.push([0, 2, , 3]), [4, e()]; - case 1: - case 2: - return n.sent(), [3, 3]; - case 3: - return [2]; - } - }); - }); -}, gs = function(e) { - function n(t) { - t === void 0 && (t = {}); - var r, i = this; - return (i = e.call(this) || this).type = tn.LOGOUT, i.name = "logout", i._wasPreviouslyConnected = (r = t.wasPreviouslyConnected) === null || r === void 0 || r, i; - } - return O(n, e), n.prototype.run = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a = this; - return C(this, function(o) { - switch (o.label) { - case 0: - return r = Date.now(), i = t.sdkState.userId, [4, t.logout()]; - case 1: - return o.sent(), [4, t.changeState(new A1(), r)]; - case 2: - return o.sent(), this._wasPreviouslyConnected && Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(s) { - return t.connectionHandlers.forEach(function(c) { - c.onDisconnected && c.onDisconnected(i); - }), [2]; - }); - }); - }), [2]; - } - }); - }); - }, n; -}(kl), qp = function(e) { - function n() { - var t = e.call(this) || this; - return t.type = tn.EXTERNAL_DISCONNECTED, t.name = "externaldisconnected", t; - } - return O(n, e), n.prototype.run = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, t.disconnect()]; - case 1: - return r.sent(), [2]; - } - }); - }); - }, n.prototype.onConnect = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = Date.now(), [4, t.disconnect()]; - case 1: - return a.sent(), [4, t.changeState(new Wp({ authToken: r }), i)]; - case 2: - return a.sent(), [2]; - } - }); - }); - }, n.prototype.onReconnect = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.changeState(new tp(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.onLogout = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.changeState(new gs(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n; -}(kl), ep = function(e) { - function n(t) { - var r = t.autoReconnect, i = e.call(this) || this; - return i.type = tn.INTERNAL_DISCONNECTED, i.name = "internaldisconnected", i._autoReconnect = !1, i._autoReconnect = r, i; - } - return O(n, e), n.prototype.run = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.disconnect()]; - case 1: - return i.sent(), this._autoReconnect ? [4, t.changeState(new tp(), r)] : [3, 3]; - case 2: - i.sent(), i.label = 3; - case 3: - return [2]; - } - }); - }); - }, n.prototype.onConnect = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = Date.now(), [4, t.disconnect()]; - case 1: - return a.sent(), [4, t.changeState(new Wp({ authToken: r }), i)]; - case 2: - return a.sent(), [2]; - } - }); - }); - }, n.prototype.onReconnect = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.changeState(new tp(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.onDisconnectWebSocket = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.changeState(new qp(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.onLogout = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.changeState(new gs(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n; -}(kl), Mi = function(e) { - return T(void 0, void 0, void 0, function() { - return C(this, function(n) { - return [2, new Promise(function(t) { - return setTimeout(t, e); - })]; - }); - }); -}, Qw = function() { - function e() { - } - return e.prototype.calcTimeout = function() { - return 0; - }, e; -}(), Kp = function(e, n, t) { - return t === void 0 && (t = new Qw()), T(void 0, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - r = 0, i = null, a = function(u) { - return i = u ?? new Error("Halted"); - }, o = function() { - r = 0; - }, l.label = 1; - case 1: - if (!(n === -1 || r < n)) - return [3, 9]; - l.label = 2; - case 2: - return l.trys.push([2, 4, , 8]), [4, e(a, o)]; - case 3: - if (s = l.sent(), i) - throw i; - return [2, s]; - case 4: - if (c = l.sent(), i) - return [3, 6]; - if (++r === n) - throw c; - return [4, Mi(t.calcTimeout(r))]; - case 5: - return l.sent(), [3, 7]; - case 6: - throw i; - case 7: - return [3, 8]; - case 8: - return [3, 1]; - case 9: - throw "It should not happen."; - } - }); - }); -}, tp = function(e) { - function n() { - var t = e !== null && e.apply(this, arguments) || this; - return t.type = tn.RECONNECTING, t.name = "reconnecting", t._callbacks = [], t; - } - return O(n, e), n.prototype._halt = function(t) { - this._haltConnect && (this._haltConnect(t), this._haltConnect = void 0); - }, n.prototype._flushCallbacks = function(t) { - this._haltConnect = void 0, this._resetConnect = void 0, this._callbacks.forEach(function(r) { - return r(t); - }); - }, n.prototype.run = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l = this; - return C(this, function(u) { - switch (u.label) { - case 0: - r = Date.now(), i = new Kr(), this._callbacks.push(function(d) { - return d ? i.reject(d) : i.resolve(); - }), Ke(function() { - return T(l, void 0, void 0, function() { - return C(this, function(d) { - return t.connectionHandlers.forEach(function(h) { - h.onReconnectStarted && h.onReconnectStarted(); - }), [2]; - }); - }); - }), u.label = 1; - case 1: - return u.trys.push([1, 4, , 9]), a = t.sdkState.websocket, o = a.reconnectMaxRetry, s = a.reconnectRetryStrategy, [4, Kp(function(d, h) { - return T(l, void 0, void 0, function() { - var f; - return C(this, function(p) { - switch (p.label) { - case 0: - this._haltConnect = d, this._resetConnect = h, p.label = 1; - case 1: - return p.trys.push([1, 3, , 4]), [4, t.connect()]; - case 2: - return p.sent(), [3, 4]; - case 3: - if (f = p.sent(), t.clearLoginTimer(), f instanceof H) { - if (f.code === nt.CONNECTION_CANCELED) - return d(f), [2]; - if (f.isSessionExpiredError || f.isSessionInvalidatedError) - return d(f), [2]; - } - throw f; - case 4: - return [2]; - } - }); - }); - }, o, s)]; - case 2: - return u.sent(), [4, t.changeState(new Xw(), r)]; - case 3: - return u.sent(), this._flushCallbacks(), Ke(function() { - return T(l, void 0, void 0, function() { - return C(this, function(d) { - return t.connectionHandlers.forEach(function(h) { - h.onReconnectSucceeded && h.onReconnectSucceeded(); - }), [2]; - }); - }); - }), [3, 9]; - case 4: - return c = u.sent(), qr(c) ? [3, 7] : c instanceof H ? c.code === nt.CONNECTION_CANCELED ? [3, 6] : [4, t.changeState(new ep({ autoReconnect: !1 }), r)] : [3, 6]; - case 5: - u.sent(), u.label = 6; - case 6: - return this._flushCallbacks(c), Ke(function() { - return T(l, void 0, void 0, function() { - return C(this, function(d) { - return t.connectionHandlers.forEach(function(h) { - h.onReconnectFailed && h.onReconnectFailed(); - }), [2]; - }); - }); - }), [3, 8]; - case 7: - throw c; - case 8: - return [3, 9]; - case 9: - return [2, i.promise]; - } - }); - }); - }, n.prototype.onConnect = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - return i = new Kr(), this._halt(H.connectionCanceled), t.cancelConnectForRetry(), this._callbacks.push(function() { - var o = Date.now(); - t.changeState(new Wp({ authToken: r }), o).then(function() { - i.resolve(); - }).catch(function(s) { - i.reject(s); - }); - }), [2, i.promise]; - }); - }); - }, n.prototype.onReconnect = function(t, r) { - var i = r.resetReconnectCount, a = i !== void 0 && i; - return T(this, void 0, void 0, function() { - var o; - return C(this, function(s) { - return o = new Kr(), this._resetConnect && a && this._resetConnect(), this._callbacks.push(function(c) { - return c ? o.reject(c) : o.resolve(); - }), [2, o.promise]; - }); - }); - }, n.prototype.onDisconnect = function(t, r) { - r.error; - var i = r.autoReconnect, a = i === void 0 || i; - return T(this, void 0, void 0, function() { - var o; - return C(this, function(s) { - switch (s.label) { - case 0: - return o = Date.now(), this._halt(H.connectionCanceled), [4, t.changeState(new ep({ autoReconnect: a }), o)]; - case 1: - return s.sent(), [2]; - } - }); - }); - }, n.prototype.onDisconnectWebSocket = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), this._halt(H.connectionCanceled), [4, t.changeState(new qp(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.onLogout = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), this._halt(H.connectionCanceled), [4, t.changeState(new gs(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n; -}(kl), Xw = function(e) { - function n() { - var t = e !== null && e.apply(this, arguments) || this; - return t.type = tn.CONNECTED, t.name = "connected", t; - } - return O(n, e), n.prototype.onReconnect = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.disconnect()]; - case 1: - return i.sent(), [4, t.changeState(new tp(), r)]; - case 2: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.onDisconnect = function(t, r) { - var i = r.autoReconnect; - return T(this, void 0, void 0, function() { - var a; - return C(this, function(o) { - switch (o.label) { - case 0: - return a = Date.now(), [4, t.changeState(new ep({ autoReconnect: i }), a)]; - case 1: - return o.sent(), [2]; - } - }); - }); - }, n.prototype.onDisconnectWebSocket = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.changeState(new qp(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.onLogout = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.changeState(new gs(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n; -}(kl); -(function(e) { - e.ExternalSetBackground = "ExternalSetBackground", e.ExternalDisconnectWebSocket = "ExternalDisconnectWebSocket"; -})(Nc || (Nc = {})); -var LR = function() { - function e(n, t) { - var r = t.sdkState, i = t.cacheContext, a = t.connectionHandlers, o = t.sessionManager, s = t.websocketClient, c = t.dispatcher, l = t.logger, u = t.disableWebSocketCloseEventHandling, d = u !== void 0 && u; - this._disableWebSocketCloseEventHandling = !1, this._webSocketClosedCause = null, this._logger = l, this._disableWebSocketCloseEventHandling = d, this._context = new UR(n, { sdkState: r, cacheContext: i, connectionHandlers: a, sessionManager: o, websocketClient: s, dispatcher: c, logger: l }), this._sdkState = r, this._sessionManager = o, this._websocketClient = s; - } - return e.prototype._registerEventDispatcher = function() { - var n = this; - this._disableWebSocketCloseEventHandling || (this._clearEventDispatcher(), this._sessionEventDispatcherContext = this._sessionManager.on("refresh", function() { - n.isConnecting || n.isConnected || (n._logger.debug("try reconnect by session key refresh"), Pn(function() { - return T(n, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this.reconnect()]; - case 1: - return t.sent(), [2]; - } - }); - }); - })); - }), this._websocketEventDispatcherContext = this._websocketClient.on("close", function() { - n._sdkState.appState !== "foreground" || n._webSocketClosedCause || Pn(function() { - return T(n, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this._sessionManager.isSessionKeyRefreshing ? [3, 2] : (this._logger.debug("try reconnect by websocket connection closed"), [4, this.reconnect()]); - case 1: - return t.sent(), [3, 4]; - case 2: - return [4, this.disconnectWebSocket()]; - case 3: - t.sent(), t.label = 4; - case 4: - return [2]; - } - }); - }); - }); - })); - }, e.prototype._clearEventDispatcher = function() { - this._sessionEventDispatcherContext && (this._sessionEventDispatcherContext.close(), this._sessionEventDispatcherContext = void 0), this._websocketEventDispatcherContext && (this._websocketEventDispatcherContext.close(), this._websocketEventDispatcherContext = void 0); - }, Object.defineProperty(e.prototype, "isConnected", { get: function() { - return this._context.currentState.type === tn.CONNECTED; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isConnecting", { get: function() { - var n = this._context.currentState; - return n.type === tn.CONNECTING || n.type === tn.RECONNECTING; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "websocketClient", { get: function() { - return this._websocketClient; - }, enumerable: !1, configurable: !0 }), e.prototype.connect = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return t = this._context.currentState, this._webSocketClosedCause = null, [4, t.onConnect(this._context, n)]; - case 1: - return r.sent(), this._registerEventDispatcher(), [2]; - } - }); - }); - }, e.prototype.reconnect = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return n = this._context.currentState, this._webSocketClosedCause = null, [4, n.onReconnect(this._context, {})]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, e.prototype.resetAndReconnect = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return n = this._context.currentState, this._webSocketClosedCause = null, [4, n.onReconnect(this._context, { resetReconnectCount: !0 })]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, e.prototype.background = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return n = this._context.currentState, this._webSocketClosedCause = Nc.ExternalSetBackground, [4, n.onDisconnect(this._context, { autoReconnect: !1, cause: this._webSocketClosedCause })]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, e.prototype.disconnect = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this._context.currentState.onDisconnect(this._context, { error: n, autoReconnect: !0, cause: this._webSocketClosedCause })]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, e.prototype.disconnectWebSocket = function(n) { - return n === void 0 && (n = !1), T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return t = this._context.currentState, n && (this._webSocketClosedCause = Nc.ExternalDisconnectWebSocket), [4, t.onDisconnectWebSocket(this._context, { cause: this._webSocketClosedCause })]; - case 1: - return r.sent(), [2]; - } - }); - }); - }, e.prototype.logout = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return n = this._context.currentState, this._clearEventDispatcher(), [4, n.onLogout(this._context)]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, e; -}(), Wp = function(e) { - function n(t) { - var r = t.authToken, i = e.call(this) || this; - return i.type = tn.CONNECTING, i.name = "connecting", i._authToken = "", i._callbacks = [], i._authToken = r, i; - } - return O(n, e), n.prototype._halt = function(t) { - this._haltConnect && (this._haltConnect(t), this._haltConnect = void 0); - }, n.prototype._flushCallbacks = function(t) { - this._haltConnect = void 0, this._callbacks.forEach(function(r) { - return r(t); - }); - }, n.prototype.run = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o = this; - return C(this, function(s) { - switch (s.label) { - case 0: - r = Date.now(), i = new Kr(), this._callbacks.push(function(c) { - return c ? i.reject(c) : i.resolve(); - }), s.label = 1; - case 1: - return s.trys.push([1, 4, , 10]), [4, Kp(function(c) { - return T(o, void 0, void 0, function() { - var l; - return C(this, function(u) { - switch (u.label) { - case 0: - this._haltConnect = c, u.label = 1; - case 1: - return u.trys.push([1, 3, , 4]), [4, t.connect(this._authToken)]; - case 2: - return u.sent(), [3, 4]; - case 3: - if (l = u.sent(), t.clearLoginTimer(), l instanceof H && l.code === nt.CONNECTION_CANCELED) - return c(l), [2]; - throw l; - case 4: - return [2]; - } - }); - }); - }, t.sdkState.websocket.connectMaxRetry)]; - case 2: - return s.sent(), [4, t.changeState(new Xw(), r)]; - case 3: - return s.sent(), Ke(function() { - return T(o, void 0, void 0, function() { - return C(this, function(c) { - return this._flushCallbacks(), t.connectionHandlers.forEach(function(l) { - l.onConnected && l.onConnected(t.sdkState.userId); - }), [2]; - }); - }); - }), [3, 10]; - case 4: - return a = s.sent(), qr(a) ? [3, 8] : [4, t.disconnect()]; - case 5: - return s.sent(), a instanceof H ? a.code === nt.CONNECTION_CANCELED ? [3, 7] : [4, t.changeState(new A1(), r)] : [3, 7]; - case 6: - s.sent(), s.label = 7; - case 7: - return Ke(function() { - return T(o, void 0, void 0, function() { - return C(this, function(c) { - return this._flushCallbacks(a), [2]; - }); - }); - }), [3, 9]; - case 8: - throw a; - case 9: - return [3, 10]; - case 10: - return [2, i.promise]; - } - }); - }); - }, n.prototype.onConnect = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - return r = new Kr(), this._callbacks.push(function(a) { - return a ? r.reject(a) : r.resolve(); - }), [2, r.promise]; - }); - }); - }, n.prototype.onDisconnect = function(t, r) { - var i = r.error, a = i === void 0 ? null : i, o = r.autoReconnect, s = o !== void 0 && o, c = r.cause, l = c === void 0 ? null : c; - return T(this, void 0, void 0, function() { - var u; - return C(this, function(d) { - switch (d.label) { - case 0: - return u = Date.now(), this._halt(a ?? lb(l)), t.hasSession ? [4, t.changeState(new ep({ autoReconnect: s }), u)] : [3, 2]; - case 1: - return d.sent(), [3, 4]; - case 2: - return [4, t.changeState(new gs(), u)]; - case 3: - d.sent(), d.label = 4; - case 4: - return [2]; - } - }); - }); - }, n.prototype.onDisconnectWebSocket = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return this._halt(lb((r == null ? void 0 : r.cause) || null)), i = Date.now(), t.hasSession ? [4, t.changeState(new qp(), i)] : [3, 2]; - case 1: - return a.sent(), [3, 4]; - case 2: - return [4, t.changeState(new gs(), i)]; - case 3: - a.sent(), a.label = 4; - case 4: - return [2]; - } - }); - }); - }, n.prototype.onLogout = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), this._halt(H.connectionCanceled), [4, t.changeState(new gs(), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n; -}(kl); -function lb(e) { - var n = H.connectionCanceled; - if (e) { - var t = null; - switch (e) { - case Nc.ExternalSetBackground: - t = "Connection has been canceled due to the application having externally moved to background while in ConnectingState."; - break; - case Nc.ExternalDisconnectWebSocket: - t = "Connection has been canceled because sb.disconnectWebSocket() was called while in ConnectingState."; - } - t && n.setDetail(t); - } - return n; -} -var Zo, A1 = function(e) { - function n() { - var t = e !== null && e.apply(this, arguments) || this; - return t.type = tn.INITIALIZED, t.name = "initialized", t; - } - return O(n, e), n.prototype.onConnect = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = Date.now(), [4, t.changeState(new Wp({ authToken: r }), i)]; - case 1: - return a.sent(), [2]; - } - }); - }); - }, n.prototype.onLogout = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = Date.now(), [4, t.changeState(new gs({ wasPreviouslyConnected: !1 }), r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n; -}(kl), PR = function(e) { - function n() { - return e.call(this, { code: "PING", payload: { id: Date.now(), active: 1 }, ackRequired: !1 }) || this; - } - return O(n, e), n; -}(Ir), kR = function() { - function e(n) { - var t = n.pingDelegate, r = n.sdkState, i = n.logger; - this.pingDelegate = t, this.sdkState = r, this._logger = i; - } - return Object.defineProperty(e.prototype, "isWaiting", { get: function() { - return !!this._pingTimeoutTimer; - }, enumerable: !1, configurable: !0 }), e.prototype.ping = function() { - var n, t = this; - if (!this.sdkState.websocket) - throw H.connectionRequired; - var r = new PR(); - try { - var i = (n = this.sdkState.websocket.pongTimeout) !== null && n !== void 0 ? n : 5e3; - this._pingTimeoutTimer = setTimeout(function() { - t._logger.debug("pinger.ping() timeout"), t.pingDelegate.error(); - }, i), this.pingDelegate.send(r), this._logger.debug("pinger.ping()"); - } catch (a) { - this._logger.debug("pinger.ping() error", a), this._pingTimeoutTimer && (clearTimeout(this._pingTimeoutTimer), this._pingTimeoutTimer = void 0), this.pingDelegate.error(); - } - return r; - }, e.prototype.pong = function() { - this._logger.debug("pinger.pong()"), this._pingTimeoutTimer && (clearTimeout(this._pingTimeoutTimer), this._pingTimeoutTimer = void 0); - }, e.prototype.refreshTimer = function() { - var n, t = this; - if (!this.sdkState.websocket) - throw H.connectionRequired; - this._logger.debug("pinger.refreshTimer()"); - var r = (n = this.sdkState.websocket.pingInterval) !== null && n !== void 0 ? n : 15e3; - this.stop(), this._pingTimer = setInterval(function() { - t.ping(); - }, r); - }, e.prototype.start = function() { - this._logger.debug("pinger.start()"), this.refreshTimer(), this.ping(); - }, e.prototype.stop = function() { - this._logger.debug("pinger.stop()"), this._pingTimer && (clearInterval(this._pingTimer), this._pingTimer = void 0), this._pingTimeoutTimer && (clearTimeout(this._pingTimeoutTimer), this._pingTimeoutTimer = void 0); - }, e; -}(), Jw = ["premium_feature_list", "file_upload_size_limit", "application_attributes", "emoji_hash", "multiple_file_send_max_size", "notifications", "message_template"], UR = function(e) { - function n(t, r) { - var i, a = r.sdkState, o = r.cacheContext, s = r.connectionHandlers, c = r.sessionManager, l = r.websocketClient, u = r.dispatcher, d = r.logger, h = r.entryState, f = h === void 0 ? new A1() : h, p = this; - return (p = e.call(this) || this)._stateUpdatedAt = 0, p._connectingAt = 0, p._connectionRequestQueue = [], p._iid = t, p.sdkState = a, p.cacheContext = o, p.connectionHandlers = s, p._sessionManager = c, p._websocketClient = l, p._dispatcher = u, p._logger = d, p._currentState = f, !((i = p.sdkState.websocket) === null || i === void 0) && i.pingerDisabled || (p._pinger = new kR({ pingDelegate: { send: function(v) { - return p._websocketClient.send(v); - }, error: function(v) { - return p._websocketClient.error(v); - } }, sdkState: p.sdkState, logger: d })), p._websocketClient.on("open", function() { - p._tryResolveConnectionRequest(); - }).on("message", function(v) { - v.code === "LOGI" && (p.clearLoginTimer(), p._dispatcher.dispatch(v.as(Sf))); - }).on("ping-refresh", function() { - var v; - return (v = p._pinger) === null || v === void 0 ? void 0 : v.refreshTimer(); - }).on("pong", function() { - var v; - return (v = p._pinger) === null || v === void 0 ? void 0 : v.pong(); - }).on("error", function() { - var v; - return (v = p._pinger) === null || v === void 0 ? void 0 : v.stop(); - }).on("close", function() { - p._logiProcessingTimer = setTimeout(function() { - p._logiProcessingTimer = void 0, p._unresolvedLogi || p._rejectConnectionRequest(H.networkError); - }, 500); - }), p._dispatcher.on(function(v) { - v instanceof Sf && (p._unresolvedLogi = v, p._tryResolveConnectionRequest()); - }), p; - } - return O(n, e), Object.defineProperty(n.prototype, "currentState", { get: function() { - return this._currentState; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "hasSession", { get: function() { - return this._sessionManager.session.hasSession; - }, enumerable: !1, configurable: !0 }), n.prototype.changeState = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return r >= this._stateUpdatedAt ? (this._currentState = t, this._stateUpdatedAt = r, this._dispatcher.dispatch(new bi({ stateType: t.type })), this._logger.debug("connection state changes to ".concat(t.name)), [4, this._currentState.run(this)]) : [3, 2]; - case 1: - return i.sent(), [2, !0]; - case 2: - return [2, !1]; - } - }); - }); - }, n.prototype._tryResolveConnectionRequest = function() { - var t; - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = this._unresolvedLogi, this._websocketClient.isOpen && r ? (this._unresolvedLogi = void 0, r.error ? [3, 2] : [4, r.applyTo(this._iid)]) : [3, 3]; - case 1: - return i.sent(), this._statLogConnection(), (t = this._pinger) === null || t === void 0 || t.start(), this._connectionRequestQueue.forEach(function(a) { - return a.resolve(); - }), this._connectionRequestQueue = [], this.sdkState.appState = "foreground", [3, 3]; - case 2: - this._sessionManager.session.authToken = void 0, (r.error.isSessionExpiredError || r.error.isSessionInvalidatedError) && this._dispatcher.dispatch(new Ac({ reason: r.error.code })), this._rejectConnectionRequest(r.error), i.label = 3; - case 3: - return [2]; - } - }); - }); - }, n.prototype._rejectConnectionRequest = function(t) { - var r; - if ((r = this._pinger) === null || r === void 0 || r.stop(), this.clearLoginTimer(), this._connectionRequestQueue.length > 0) { - var i = this._connectionRequestQueue; - this._connectionRequestQueue = [], i.forEach(function(a) { - return a.reject(t); - }), this._statLogConnection(t); - } - }, n.prototype._url = function() { - var t, r = this.sdkState, i = r.appId, a = r.appVersion, o = r.userId, s = r.extensions, c = r.sendbirdRuntimeEnvironment, l = this.cacheContext.localCacheEnabled, u = this._sessionManager.session, d = (t = this.sdkState.websocket) === null || t === void 0 ? void 0 : t.compression, h = !!(s ?? {}).sb_uikit, f = Zf.userAgentWithExtension(s); - return "".concat(this.sdkState.websocket.host, "/?p=JS&pv=").concat(encodeURIComponent(hs.OS_VERSION), "&sv=").concat(encodeURIComponent(hs.SDK_VERSION), "&ai=").concat(i).concat(a ? "&av=".concat(a) : "").concat(u.hasSession ? "" : "&user_id=".concat(encodeURIComponent(o)), "&pmce=").concat(d ? 1 : 0, "&active=1&device_token_types=").concat(encodeURIComponent(["gcm", "huawei", "apns"].join(",")), "&SB-User-Agent=").concat(f, "&SB-SDK-User-Agent=").concat(encodeURIComponent(Zf.sendbirdSdkUserAgentWithExtension(c)), "&Request-Sent-Timestamp=").concat(Date.now().toString(), "&include_extra_data=").concat(encodeURIComponent(String(Jw))).concat(this._sessionManager.handler ? "&expiring_session=1" : "", "&use_local_cache=").concat(l ? 1 : 0, "&include_poll_details=1").concat(h ? "&uikit_config=1" : ""); - }, n.prototype._statLogConnection = function(t) { - var r; - this._dispatcher.dispatch(new C1(new Sr({ type: Tn.WEBSOCKET_CONNECT, data: { host_url: (r = this.sdkState.websocket) === null || r === void 0 ? void 0 : r.host, success: !t, latency: Date.now() - this._connectingAt, error_code: t == null ? void 0 : t.code, error_description: t == null ? void 0 : t.message } }))); - }, n.prototype.connect = function(t) { - var r; - return t === void 0 && (t = ""), T(this, void 0, void 0, function() { - var i, a, o, s = this; - return C(this, function(c) { - return this._logiProcessingTimer && (clearTimeout(this._logiProcessingTimer), this._logiProcessingTimer = void 0, this._rejectConnectionRequest(H.connectionCanceled)), i = this._url(), a = new Kr(), this._connectionRequestQueue.push(a), this._connectionRequestQueue.length === 1 && (this._connectingAt = Date.now(), this._loginTimer = setTimeout(function() { - s._loginTimer = void 0, s._rejectConnectionRequest(H.loginTimeout); - }, (r = this.sdkState.websocket) === null || r === void 0 ? void 0 : r.responseTimeout), o = this._sessionManager.session, t && (o.authToken = t), this._websocketClient.connect(i, JSON.stringify(o.hasSession ? { auth: o.sessionKey } : { token: t }))), [2, a.promise]; - }); - }); - }, n.prototype.cancelConnectForRetry = function() { - this._dispatcher.dispatch(Sf.asError(H.connectionRenew)); - }, n.prototype.disconnect = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this._websocketClient.disconnect()]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, n.prototype.logout = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this.sdkState.userId = void 0, this._unresolvedLogi = void 0, [4, this.disconnect()]; - case 1: - return t.sent(), [4, this._sessionManager.clear()]; - case 2: - return t.sent(), [2]; - } - }); - }); - }, n.prototype.clearLoginTimer = function() { - this._loginTimer && (clearTimeout(this._loginTimer), this._loginTimer = void 0); - }, n; -}(Dl), $w = function(e) { - function n(t) { - var r = t.appId, i = t.userId, a = t.services, o = t.includeUIKitConfig, s = o !== void 0 && o, c = t.localCacheEnabled, l = c === void 0 || c, u = t.expiringSession, d = u === void 0 || u, h = e.call(this) || this; - return h.path = "".concat(qt, "/").concat(i, "/login"), h.method = pe.POST, h.params = Be({ expiring_session: !!d, services: a, include_logi: !0, include_extra_data: String(Jw), uikit_config: s, use_local_cache: l, app_id: r }), h.requireAuth = !1, h; - } - return O(n, e), n; -}(ge), FR = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.logi = new Sf(t, "LOGI", r), i; - } - return O(n, e), n; -}(_e); -(function(e) { - e[e.ALL = 0] = "ALL", e[e.WEBSOCKET = 1] = "WEBSOCKET", e[e.API = 2] = "API"; -})(Zo || (Zo = {})); -var Ma, BR = [b1, $w], HR = function() { - function e(n, t) { - var r = t.session, i = t.sdkState, a = t.dispatcher, o = t.logger, s = t.useFetchCompat, c = s !== void 0 && s, l = this; - this._currentConnectionStateType = tn.INITIALIZED, this._lazyCallQueue = [], this.commandRouter = new AR(n, { session: r, sdkState: i, dispatcher: a, logger: o, useFetchCompat: c }), this._session = r, this._logger = o, this._dispatcher = a, this._dispatcher.on(function(u) { - var d, h, f, p; - if (u instanceof bi) { - var v = u.stateType; - switch (l._currentConnectionStateType = v, v) { - case tn.CONNECTED: - l._resolveLazyCallQueue(); - break; - case tn.INITIALIZED: - case tn.INTERNAL_DISCONNECTED: - case tn.EXTERNAL_DISCONNECTED: - case tn.LOGOUT: - l._rejectLazyCallQueue(!((f = l._session) === null || f === void 0) && f.hasSession ? H.connectionClosed : H.connectionRequired); - } - } else if (u instanceof Kw) - !((p = l._session.services) === null || p === void 0) && p.includes(md.CHAT) || l._resolveLazyCallQueue(Zo.API); - else if (u instanceof Hm || u instanceof Ww) - l._rejectLazyCallQueue(H.connectionClosed); - else if (u instanceof Aw) { - var m = u.request, E = u.deferred, y = u.error; - try { - for (var _ = Ne(BR), S = _.next(); !S.done; S = _.next()) - if (m instanceof S.value) - return void E.reject(y); - } catch (b) { - d = { error: b }; - } finally { - try { - S && !S.done && (h = _.return) && h.call(_); - } finally { - if (d) - throw d.error; - } - } - l._lazyCallQueue.push({ command: m, deferred: E }); - } - }); - } - return Object.defineProperty(e.prototype, "isReady", { get: function() { - return this._currentConnectionStateType === tn.CONNECTED; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isLazyCallActivated", { get: function() { - return this._currentConnectionStateType === tn.CONNECTING || this._currentConnectionStateType === tn.RECONNECTING || this._session.isRefreshing; - }, enumerable: !1, configurable: !0 }), e.prototype._classifyLazyCallQueueByScope = function(n) { - var t, r = [], i = []; - switch (n) { - case Zo.ALL: - t = null; - break; - case Zo.WEBSOCKET: - t = Ir; - break; - case Zo.API: - t = ge; - } - var a = !1; - return this._lazyCallQueue.forEach(function(o) { - !t || o.command instanceof t || (a = !0), a ? i.push(o) : r.push(o); - }), [r, i]; - }, e.prototype._resolveLazyCallQueue = function(n) { - var t = this; - n === void 0 && (n = Zo.ALL); - var r = tt(this._classifyLazyCallQueueByScope(n), 2), i = r[0], a = r[1]; - this._lazyCallQueue = a, i.forEach(function(o) { - return T(t, void 0, void 0, function() { - var s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - s = o.command, c = o.deferred, (l = o.timeout) && clearTimeout(l), h.label = 1; - case 1: - return h.trys.push([1, 3, , 4]), [4, this.send(s)]; - case 2: - return u = h.sent(), c.resolve(u), [3, 4]; - case 3: - return d = h.sent(), c.reject(d), [3, 4]; - case 4: - return [2]; - } - }); - }); - }); - }, e.prototype._rejectLazyCallQueue = function(n, t) { - var r = this; - t === void 0 && (t = Zo.ALL); - var i = tt(this._classifyLazyCallQueueByScope(t), 2), a = i[0], o = i[1]; - this._lazyCallQueue = o, a.forEach(function(s) { - return T(r, void 0, void 0, function() { - var c, l; - return C(this, function(u) { - return c = s.deferred, l = s.timeout, clearTimeout(l), c.reject(n), [2]; - }); - }); - }); - }, e.prototype.send = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i = this; - return C(this, function(a) { - switch (a.label) { - case 0: - return n instanceof Ir ? this.isReady ? (this._logger.debug("send websocket request", n), [4, this.commandRouter.send(n)]) : [3, 2] : [3, 4]; - case 1: - case 5: - return [2, a.sent()]; - case 2: - if (this.isLazyCallActivated) - return this._logger.debug("wait websocket request", n), t = new Kr(), this._lazyCallQueue.push({ command: n, deferred: t, timeout: setTimeout(function() { - return i.timeout(n.requestId); - }, 1e4) }), [2, t.promise]; - throw this._logger.debug("fail websocket request"), H.connectionRequired; - case 3: - case 7: - return [3, 9]; - case 4: - return n instanceof ge ? this._session.hasSession ? (this._logger.debug("send api request", n), [4, this.commandRouter.send(n)]) : [3, 6] : [3, 8]; - case 6: - if (this.isLazyCallActivated) - return this._logger.debug("wait api request", n), t = new Kr(), this._lazyCallQueue.push({ command: n, deferred: t, timeout: setTimeout(function() { - return i.timeout(n.requestId); - }, 1e4) }), [2, t.promise]; - throw r = H.connectionRequired, this._logger.debug("fail api request", r), r; - case 8: - throw H.invalidCommand; - case 9: - return [2]; - } - }); - }); - }, e.prototype.forceSend = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this._logger.debug("send forced request", n), n instanceof Ir || n instanceof ge ? [4, this.commandRouter.send(n)] : [3, 2]; - case 1: - return [2, t.sent()]; - case 2: - throw H.invalidCommand; - } - }); - }); - }, e.prototype.timeout = function(n) { - this._logger.debug("timeout request", n); - var t = this._lazyCallQueue.findIndex(function(r) { - return r.command.requestId === n; - }); - t > -1 && (this._lazyCallQueue[t].deferred.reject(H.connectionRequired), this._lazyCallQueue.splice(t, 1)); - }, e.prototype.cancel = function(n) { - this._logger.debug("cancel api request", n), this.commandRouter.cancel(n); - }, e.prototype.cancelAll = function() { - this._logger.debug("cancel all api requests"), this.commandRouter.cancelAll(); - }, e; -}(), u0 = "sendbird@devicetokens", d0 = function() { - function e(n) { - var t = n.type, r = n.token; - this.type = t, this.token = r; - } - return e.payloadify = function(n) { - return Be(Xe({ type: n.type, token: n.token })); - }, e; -}(), h0 = /* @__PURE__ */ new WeakMap(), jR = function(e) { - function n(t) { - var r = t._iid, i = t.session, a = t.cacheContext, o = t.sdkState, s = t.dispatcher, c = t.requestQueue, l = t.logger, u = e.call(this) || this; - return u._currentConnectionStateType = tn.INITIALIZED, u._isRefreshingAuthToken = !1, u.currentUser = null, u.session = i, u._iid = r, u._cacheContext = a, u._sdkState = o, u._dispatcher = s, u._requestQueue = c, u._logger = l, u._deviceTokens = [], u._dispatcher.on(function(d) { - var h, f; - if (d instanceof bi) { - var p = d.stateType; - u._currentConnectionStateType = p; - } else - d instanceof Ac && u.handler && !u.isSessionKeyRefreshing && (d.invalidateSessionToken && (u.session.authToken = void 0), !((h = d.error) === null || h === void 0) && h.isSessionInvalidatedError ? u.handler.onSessionClosed && u.handler.onSessionClosed() : !((f = d.error) === null || f === void 0) && f.isSessionExpiredError && (u._logger.debug("session expired"), u.handler.onSessionExpired && u.handler.onSessionExpired(), u.refresh().catch(function(v) { - if (qr(v) && u._sdkState.appState === "foreground") - throw v; - }))); - }), u; - } - return O(n, e), Object.defineProperty(n.prototype, "ekey", { get: function() { - return h0.get(this); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "deviceTokens", { get: function() { - return this._deviceTokens; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "deviceTokenLastDeletedAt", { get: function() { - return this._deviceTokenLastDeletedAt; - }, enumerable: !1, configurable: !0 }), n.prototype.indexOfDeviceToken = function(t, r) { - return this._deviceTokens.findIndex(function(i) { - return i.type === t && i.token === r; - }); - }, n.prototype.hasDeviceToken = function(t, r) { - return this.indexOfDeviceToken(t, r) >= 0; - }, n.prototype.createRefreshWebsocketCommand = function(t, r) { - return new _6({ authToken: t, expiringSession: !0, requestId: r }); - }, n.prototype._refreshSessionKeyByWebSocket = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return r = this.createRefreshWebsocketCommand(t), [4, this._requestQueue.forceSend(r)]; - case 1: - if (i = c.sent(), a = i.as(C6), o = a.newKey, s = a.error) - throw s; - return this.session.sessionKey = o ?? this.session.sessionKey, [2]; - } - }); - }); - }, n.prototype._refreshSessionKeyByApi = function(t) { - return T(this, void 0, void 0, function() { - var r, i = this; - return C(this, function(a) { - switch (a.label) { - case 0: - return r = new b1({ userId: this._sdkState.userId, authToken: t, services: this.session.services && this.session.services.length > 0 ? this.session.services : void 0, expiringSession: !0 }), [4, Kp(function(o) { - return T(i, void 0, void 0, function() { - var s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - return h.trys.push([0, 2, , 3]), [4, this._requestQueue.forceSend(r)]; - case 1: - return s = h.sent(), c = s.as(b6), l = c.key, u = c.services, this.session.sessionKey = l, this.session.services = u, [3, 3]; - case 2: - if (d = h.sent(), !this._isSessionRelatedError(d)) - throw d; - return o(d), [3, 3]; - case 3: - return [2]; - } - }); - }); - }, 3)]; - case 1: - return a.sent(), [2]; - } - }); - }); - }, n.prototype._refreshSessionKey = function(t, r) { - return r === void 0 && (r = !0), T(this, void 0, void 0, function() { - var i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - if (this._currentConnectionStateType !== tn.CONNECTED) - return [3, 8]; - o.label = 1; - case 1: - return o.trys.push([1, 3, , 8]), [4, this._refreshSessionKeyByWebSocket(t)]; - case 2: - return o.sent(), this.complete(), [2]; - case 3: - i = o.sent(), o.label = 4; - case 4: - return o.trys.push([4, 6, , 7]), [4, this._handleSessionRefreshError(i, r)]; - case 5: - return o.sent(), [2]; - case 6: - return o.sent(), [3, 7]; - case 7: - return [3, 8]; - case 8: - return o.trys.push([8, 10, , 12]), [4, this._refreshSessionKeyByApi(t)]; - case 9: - return o.sent(), this.complete(), [3, 12]; - case 10: - return a = o.sent(), [4, this._handleSessionRefreshError(a, r)]; - case 11: - return o.sent(), [3, 12]; - case 12: - return [2]; - } - }); - }); - }, n.prototype._receiveNewAuthToken = function() { - var t, r = this, i = new Kr(); - if (this._isRefreshingAuthToken = !0, this.session.sessionKey = void 0, this.session.authToken = void 0, (t = this.handler) === null || t === void 0 ? void 0 : t.onSessionTokenRequired) { - var a = null, o = function() { - a && (clearTimeout(a), a = null); - }, s = function(l) { - o(), r._isRefreshingAuthToken && (r._isRefreshingAuthToken = !1, i.resolve(l)); - }, c = function(l) { - o(), r._isRefreshingAuthToken && (r._isRefreshingAuthToken = !1, i.reject(l)); - }; - a = setTimeout(function() { - return c(); - }, 1e3 * this._sdkState.sessionTokenRefreshTimeout), Ke(function() { - return T(r, void 0, void 0, function() { - var l; - return C(this, function(u) { - return !((l = this.handler) === null || l === void 0) && l.onSessionTokenRequired && this.handler.onSessionTokenRequired(s, c), [2]; - }); - }); - }); - } else - i.resolve(null); - return i.promise; - }, n.prototype._handleSessionRefreshError = function(t, r) { - return r === void 0 && (r = !1), T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return t instanceof H && (t.isSessionTokenExpiredError || t.code === nt.APPLICATION_NOT_FOUND) ? (this.session.authToken = void 0, r ? [4, this._receiveNewAuthToken()] : [3, 6]) : [3, 6]; - case 1: - return (i = a.sent()) ? (this.session.authToken = i, [4, this._refreshSessionKey(this.session.authToken, !1)]) : [3, 3]; - case 2: - return a.sent(), this.complete(), [3, 5]; - case 3: - return [4, this.clear()]; - case 4: - a.sent(), a.label = 5; - case 5: - return [2]; - case 6: - throw t; - } - }); - }); - }, n.prototype._isSessionRelatedError = function(t) { - return t instanceof H && (t.isSessionExpiredError || t.isSessionInvalidatedError); - }, Object.defineProperty(n.prototype, "isSessionKeyRefreshing", { get: function() { - return this.session.isRefreshing; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isRefreshingAuthToken", { get: function() { - return this._isRefreshingAuthToken; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isSessionExpiring", { get: function() { - return !!this.handler; - }, enumerable: !1, configurable: !0 }), n.prototype.authenticateFeed = function(t, r) { - var i; - return T(this, void 0, void 0, function() { - var a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return this.session.authToken = r, a = new $w({ appId: this._sdkState.appId, userId: t, services: [md.FEED], includeUIKitConfig: !!((i = this._sdkState.extensions) !== null && i !== void 0 ? i : {}).sb_uikit, localCacheEnabled: this._cacheContext.localCacheEnabled, expiringSession: !r || this.isSessionExpiring }), [4, this._requestQueue.commandRouter.send(a)]; - case 1: - return o = c.sent(), (s = o.as(FR).logi).error ? [3, 3] : [4, s.applyTo(this._iid)]; - case 2: - return c.sent(), [3, 4]; - case 3: - throw s.error; - case 4: - return [2]; - } - }); - }); - }, n.prototype.login = function(t) { - var r; - return T(this, void 0, void 0, function() { - var i, a, o, s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - return i = t.key, a = t.ekey, o = t.services, s = t.userProfile, c = t.deviceTokenLastDeletedAt, l = c === void 0 ? 0 : c, this.session.sessionKey = i, this.session.services = o, h0.set(this, a), this._deviceTokenCacheEnabled = (r = s == null ? void 0 : s.appInfo) === null || r === void 0 ? void 0 : r.deviceTokenCache, u = this._cacheContext.preference, this._deviceTokenCacheEnabled ? [4, u.get(u0)] : [3, 5]; - case 1: - return !(d = h.sent()) || d.lastDeletedAt < l ? (this._deviceTokens = [], this._deviceTokenLastDeletedAt = l, [4, this.saveDeviceToken()]) : [3, 3]; - case 2: - return h.sent(), [3, 4]; - case 3: - this._deviceTokens = d.tokens.map(function(f) { - return new d0(d0.payloadify(f)); - }), this._deviceTokenLastDeletedAt = d.lastDeletedAt, h.label = 4; - case 4: - return [3, 7]; - case 5: - return [4, u.remove(u0)]; - case 6: - h.sent(), h.label = 7; - case 7: - return [2]; - } - }); - }); - }, n.prototype.complete = function() { - var t = this; - this.dispatch("refresh"), this._dispatcher.dispatch(new Kw()), Ke(function() { - return T(t, void 0, void 0, function() { - var r; - return C(this, function(i) { - return this._logger.debug("session refreshed"), !((r = this.handler) === null || r === void 0) && r.onSessionRefreshed && this.handler.onSessionRefreshed(), [2]; - }); - }); - }); - }, n.prototype.error = function(t) { - var r = this; - Ke(function() { - return T(r, void 0, void 0, function() { - var i; - return C(this, function(a) { - return !((i = this.handler) === null || i === void 0) && i.onSessionError && this.handler.onSessionError(t), [2]; - }); - }); - }); - }, n.prototype.close = function() { - var t = this; - this.dispatch("close"), this._dispatcher.dispatch(new Ww()), Ke(function() { - return T(t, void 0, void 0, function() { - var r; - return C(this, function(i) { - return this._logger.debug("session closed"), !((r = this.handler) === null || r === void 0) && r.onSessionClosed && this.handler.onSessionClosed(), [2]; - }); - }); - }); - }, n.prototype.refresh = function() { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - if (!this.isSessionExpiring) - return [3, 10]; - if (this.session.isRefreshing) - return [3, 10]; - if (this.session.isRefreshing = !0, this.session.authToken) - return [3, 7]; - i.label = 1; - case 1: - return i.trys.push([1, 6, , 7]), [4, this._receiveNewAuthToken()]; - case 2: - return (t = i.sent()) ? (this._logger.debug("session refreshing.."), this.session.authToken = t, [3, 5]) : [3, 3]; - case 3: - return [4, this.clear()]; - case 4: - return i.sent(), this.session.isRefreshing = !1, [2]; - case 5: - return [3, 7]; - case 6: - throw i.sent(), r = H.sessionTokenRequestFailed, this._dispatcher.dispatch(new Hm()), this.error(r), this.session.isRefreshing = !1, this._logger.debug("refresh auth token error = ", r), r; - case 7: - return i.trys.push([7, 9, , 10]), [4, this._refreshSessionKey(this.session.authToken)]; - case 8: - return i.sent(), this.session.isRefreshing = !1, [3, 10]; - case 9: - throw i.sent(), this.session.isRefreshing = !1, r = H.sessionTokenRefreshFailed, this._dispatcher.dispatch(new Hm()), this.error(r), r; - case 10: - return [2]; - } - }); - }); - }, n.prototype.setDeviceToken = function(t, r) { - return this._deviceTokenCacheEnabled && this.indexOfDeviceToken(t, r) < 0 ? (this._deviceTokens.push(new d0({ type: t, token: r })), !0) : !1; - }, n.prototype.unsetDeviceToken = function(t, r) { - if (this._deviceTokenCacheEnabled) { - var i = this.indexOfDeviceToken(t, r); - i >= 0 && this._deviceTokens.splice(i, 1); - } - }, n.prototype.unsetDeviceTokens = function(t) { - this._deviceTokenCacheEnabled && (this._deviceTokens = t ? this._deviceTokens.filter(function(r) { - return r.type !== t; - }) : []); - }, n.prototype.setDeviceTokenDeletedAt = function(t) { - t > 0 && (this._deviceTokenLastDeletedAt = t); - }, n.prototype.saveDeviceToken = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this._deviceTokenCacheEnabled ? [4, this._cacheContext.preference.set(u0, { tokens: this._deviceTokens, lastDeletedAt: this._deviceTokenLastDeletedAt })] : [3, 2]; - case 1: - t.sent(), t.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this.currentUser = null, this.session.clear(), this.close(), h0.delete(this), this._deviceTokens = [], this._deviceTokenLastDeletedAt = 0, [4, this.saveDeviceToken()]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, n; -}(Dl), rl = function(e) { - function n(t) { - var r, i, a, o, s = t.type, c = t.data, l = t.ts, u = l === void 0 ? Date.now() : l, d = e.call(this, { type: s, data: c, ts: u }) || this; - return d.date = new Date(u), d.key = "".concat((r = d.date, i = r.getFullYear(), a = String(r.getMonth() + 1).padStart(2, "0"), o = String(r.getDate()).padStart(2, "0"), "".concat(i).concat(a).concat(o)), "_").concat(s), d; - } - return O(n, e), n; -}(Sr), VR = function(e) { - function n(t) { - var r = t.deviceId, i = t.statLogs, a = e.call(this) || this; - return a.method = pe.POST, a.path = "".concat(y6), a.params = { device_id: r, log_entries: i.map(function(o) { - return Sr.payloadify(o); - }) }, a; - } - return O(n, e), n; -}(ge), eA = function(e, n) { - var t, r; - if (e !== null && n !== null) { - var i = Object.keys(e), a = Object.keys(n), o = dt([], tt(new Set(dt(dt([], tt(i), !1), tt(a), !1))), !1), s = {}; - try { - for (var c = Ne(o), l = c.next(); !l.done; l = c.next()) { - var u = l.value, d = typeof e[u], h = typeof n[u]; - d === "undefined" ? s[u] = n[u] : h === "undefined" ? s[u] = e[u] : d !== h ? s[u] = n[u] : d === "object" && e[u] && n[u] ? s[u] = eA(e[u], n[u]) : s[u] = n[u]; - } - } catch (f) { - t = { error: f }; - } finally { - try { - l && !l.done && (r = c.return) && r.call(c); - } finally { - if (t) - throw t.error; - } - } - return s; - } - return n; -}; -(function(e) { - e[e.PENDING = 0] = "PENDING", e[e.COLLECT_ONLY = 1] = "COLLECT_ONLY", e[e.ENABLED = 2] = "ENABLED", e[e.DISABLED = 3] = "DISABLED"; -})(Ma || (Ma = {})); -var yo, GR = function(e) { - function n(t) { - var r = t.cacheContext, i = t.requestQueue, a = t.dispatcher, o = t.baseLimit, s = o === void 0 ? 100 : o, c = t.maxLimit, l = c === void 0 ? 1e3 : c, u = t.minLimit, d = u === void 0 ? 10 : u, h = e.call(this) || this; - return h.queue = [], h.flushWaitQueue = [], h.enabledState = Ma.PENDING, h.isFlushing = !1, h.generation = 1, h.lastFlushedAt = Date.now(), h._collectRequestStat = !0, h._collectFeatureLocalCacheStat = !0, h._collectionNotificationStat = !0, h.deviceId = Ro(), h.cacheContext = r, h.requestQueue = i, h.dispatcher = a, h.baseLimit = s, h.limit = s, h.maxLimit = l, h.minLimit = d, h; - } - return O(n, e), Object.defineProperty(n.prototype, "isEnabled", { get: function() { - return this.enabledState === Ma.ENABLED; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isReadyToFlush", { get: function() { - return this.queue.length >= this.limit || Date.now() - this.lastFlushedAt >= 108e5 && this.queue.length >= this.minLimit; - }, enumerable: !1, configurable: !0 }), n.prototype._arrangeStat = function() { - var t = dt([], tt(this.queue), !1); - this._collectRequestStat || (t = t.filter(function(r) { - return r.type !== Tn.API_RESULT && r.type !== Tn.WEBSOCKET_CONNECT; - })), this._collectFeatureLocalCacheStat || (t = t.filter(function(r) { - return r.type !== Tn.FEATURE_LOCALCACHE && r.type !== Tn.FEATURE_LOCALCACHE_EVENT; - })), this._collectionNotificationStat || (t = t.filter(function(r) { - return r.type !== Tn.NOTIFICATION; - })), this.queue = t; - }, n.prototype._save = function() { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return this.isEnabled ? (t = dt(dt([], tt(this.queue), !1), tt(this.flushWaitQueue), !1), [4, this.cacheContext.preference.set(this.key, { deviceId: this.deviceId, statLogs: t.map(function(i) { - return Sr.payloadify(i); - }), generation: this.generation++, lastFlushedAt: this.lastFlushedAt })]) : [3, 2]; - case 1: - r.sent(), this.dispatch("save", t), r.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype._flush = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - if (!this.isEnabled) - return [3, 10]; - if (this.isFlushing) - return [3, 10]; - this.isFlushing = !0, s.label = 1; - case 1: - return s.trys.push([1, 5, 9, 10]), this._arrangeStat(), t = this.queue.filter(function(c) { - if (c instanceof rl) { - var l = /* @__PURE__ */ new Date(), u = tt([c.date.getFullYear(), l.getFullYear()], 2), d = u[0], h = u[1]; - if (d < h) - return !0; - if (d === h) { - var f = tt([c.date.getMonth(), l.getMonth()], 2), p = f[0], v = f[1]; - if (p < v) - return !0; - if (p === v) { - var m = tt([c.date.getDate(), l.getDate()], 2); - return m[0] < m[1]; - } - } - } - return !1; - }), r = this.queue.filter(function(c) { - return !(c instanceof rl); - }), (i = dt(dt([], tt(t), !1), tt(r), !1).slice(0, Math.min(this.limit, this.maxLimit))).length > 0 ? (a = new VR({ deviceId: this.deviceId, statLogs: i }), [4, this.requestQueue.send(a)]) : [3, 4]; - case 2: - return s.sent(), this.dispatch("flush", i), this.queue = dt(dt([], tt(t), !1), tt(r), !1).slice(i.length).concat(this.flushWaitQueue), this.flushWaitQueue = [], this.limit = this.baseLimit, this.lastFlushedAt = Date.now(), [4, this._save()]; - case 3: - s.sent(), s.label = 4; - case 4: - return [3, 10]; - case 5: - return (o = s.sent()) instanceof H ? o.code !== nt.NON_AUTHORIZED ? [3, 7] : [4, this.clear()] : [3, 8]; - case 6: - return s.sent(), this.enabledState = Ma.DISABLED, [3, 8]; - case 7: - o.code === nt.STAT_UPLOAD_NOT_ALLOWED && (this.enabledState = Ma.COLLECT_ONLY), s.label = 8; - case 8: - return this.limit = this.limit + 20, [3, 10]; - case 9: - return this.isFlushing = !1, [7]; - case 10: - return [2]; - } - }); - }); - }, n.prototype.init = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a = this; - return C(this, function(o) { - switch (o.label) { - case 0: - return this.key = t, [4, this.cacheContext.preference.get(this.key)]; - case 1: - return (r = o.sent()) ? (this.deviceId = r.deviceId, this.queue = r.statLogs.map(function(s) { - var c; - return s.stat_type === Tn.FEATURE_LOCALCACHE_EVENT && (s.data = L({ message_init_policy: "", starting_point: 0 }, s.data)), s.stat_type === Tn.NOTIFICATION && (s.data = Be(L(L({}, s.data), { message_id: (c = s.data.notificationId) !== null && c !== void 0 ? c : s.data.message_id, notificationId: void 0 }))), new Sr({ type: s.stat_type, ts: s.ts, data: s.data }); - }), this.generation = r.generation, this.lastFlushedAt = r.lastFlushedAt, this.isReadyToFlush ? (i = Math.min(Math.floor(18e4 * Math.random()), 100), [4, Mi(i)]) : [3, 4]) : [3, 4]; - case 2: - return o.sent(), [4, this._flush()]; - case 3: - o.sent(), o.label = 4; - case 4: - return this.commandEventContext || (this.commandEventContext = this.dispatcher.on(function(s) { - if (s instanceof C1) { - var c = s.statLog; - a.put(c); - } else if (s instanceof Zw) { - var l = s.request, u = s.features, d = s.options; - a._collectRequestStat = l, a._collectFeatureLocalCacheStat = u == null ? void 0 : u.localCache, a._collectionNotificationStat = u == null ? void 0 : u.notification, a._arrangeStat(), a._collectRequestStat || a._collectFeatureLocalCacheStat || a._collectionNotificationStat ? a.enabledState = d.ingestion ? Ma.ENABLED : Ma.COLLECT_ONLY : a.enabledState = Ma.DISABLED, a.isEnabled ? a.isReadyToFlush && a._flush() : a.clear(); - } - })), [2]; - } - }); - }); - }, n.prototype.put = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - if (this.enabledState === Ma.DISABLED) - return [3, 3]; - if (r = this.isFlushing ? this.flushWaitQueue : this.queue, t instanceof rl) - this._collectFeatureLocalCacheStat && (i = tt(this.queue.filter(function(s) { - return s instanceof rl && s.key === t.key; - }), 1), (a = i[0]) ? a.data = eA(a.data, t.data) : r.push(t)); - else - switch (t.type) { - case Tn.API_RESULT: - case Tn.WEBSOCKET_CONNECT: - this._collectRequestStat && r.push(t); - break; - case Tn.FEATURE_LOCALCACHE: - case Tn.FEATURE_LOCALCACHE_EVENT: - this._collectFeatureLocalCacheStat && r.push(t); - break; - case Tn.NOTIFICATION: - this._collectionNotificationStat && r.push(t); - } - return [4, this._save()]; - case 1: - return o.sent(), this.isReadyToFlush ? [4, this._flush()] : [3, 3]; - case 2: - o.sent(), o.label = 3; - case 3: - return [2]; - } - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this.queue = [], this.flushWaitQueue = [], this.generation = 1, [4, this._save()]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, n.prototype.close = function() { - this.commandEventContext && (this.commandEventContext.close(), this.commandEventContext = void 0); - }, n; -}(Dl); -(function(e) { - e[e.VERBOSE = 0] = "VERBOSE", e[e.DEBUG = 1] = "DEBUG", e[e.INFO = 2] = "INFO", e[e.WARN = 3] = "WARN", e[e.ERROR = 4] = "ERROR", e[e.NONE = 5] = "NONE"; -})(yo || (yo = {})); -var ne, zR = function() { - function e() { - this.level = yo.WARN; - } - return e.prototype.verbose = function() { - for (var n = [], t = 0; t < arguments.length; t++) - n[t] = arguments[t]; - this.level <= yo.VERBOSE && console.log.apply(console, dt(["[verbose]"], tt(n), !1)); - }, e.prototype.debug = function() { - for (var n = [], t = 0; t < arguments.length; t++) - n[t] = arguments[t]; - this.level <= yo.DEBUG && console.log.apply(console, dt(["[debug]"], tt(n), !1)); - }, e.prototype.info = function() { - for (var n = [], t = 0; t < arguments.length; t++) - n[t] = arguments[t]; - this.level <= yo.INFO && console.log.apply(console, dt(["[info]"], tt(n), !1)); - }, e.prototype.warn = function() { - for (var n = [], t = 0; t < arguments.length; t++) - n[t] = arguments[t]; - this.level <= yo.WARN && console.warn.apply(console, dt(["[warn]"], tt(n), !1)); - }, e.prototype.error = function() { - for (var n = [], t = 0; t < arguments.length; t++) - n[t] = arguments[t]; - this.level <= yo.ERROR && console.error.apply(console, dt(["[error]"], tt(n), !1)); - }, e; -}(), ks = {}, U = function() { - function e(n, t) { - var r, i, a, o, s, c, l, u, d, h; - if (this.connectedAt = 0, this.firstConnectedAt = 0, this.connectionHandlers = /* @__PURE__ */ new Map(), this.userEventHandlers = /* @__PURE__ */ new Map(), !ks[n]) { - ks[n] = this; - var f = (r = t.options) !== null && r !== void 0 ? r : new yw(), p = this.sdkState = { appId: t.appId, appVersion: (i = t.appVersion) !== null && i !== void 0 ? i : "", appState: "foreground", userId: void 0, extensions: {}, api: { host: (a = t.apiHost) !== null && a !== void 0 ? a : "https://api-".concat(t.appId, ".sendbird.com") }, websocket: { host: (o = t.websocketHost) !== null && o !== void 0 ? o : "wss://ws-".concat(t.appId, ".sendbird.com"), pingerDisabled: !!t.noPingpong, pingInterval: void 0, pongTimeout: void 0, connectMaxRetry: 2, compression: !0, reconnectMaxRetry: -1, reconnectRetryStrategy: new Qw(), responseTimeout: f.websocketResponseTimeout }, sessionTokenRefreshTimeout: f.sessionTokenRefreshTimeout }; - this.appInfo = void 0, this.subscribedUnreadMessageCount = { all: 0, feed: 0, customTypes: {}, ts: 0 }; - var v = this.logger = new zR(); - this.logger.level = (s = t.logLevel) !== null && s !== void 0 ? s : yo.WARN, this.connectedAt = 0, this.firstConnectedAt = 0, this.connectionHandlers = /* @__PURE__ */ new Map(), this.userEventHandlers = /* @__PURE__ */ new Map(); - var m = this.cacheContext = new l6({ encryption: t.encryption, store: t.store, localCacheEnabled: (c = t.localCacheEnabled) !== null && c !== void 0 && c, localCacheConfig: (l = t.localCacheConfig) !== null && l !== void 0 ? l : new _w() }); - this.debugMode = (u = t.debugMode) !== null && u !== void 0 && u, this.maxSuperGroupChannelUnreadCount = hs.DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL, this.useMemberInfoInMessage = f.useMemberInfoInMessage, this.typingIndicatorInvalidateTime = f.typingIndicatorInvalidateTime, this.typingIndicatorThrottle = f.typingIndicatorThrottle, this.concurrentCallLimit = void 0, this.backOffDelay = void 0; - var E = this.dispatcher = new d6(), y = new u6(); - this.requestQueue = new HR(n, { session: y, sdkState: p, dispatcher: E, logger: v, useFetchCompat: t.useFetchCompat }), this.sessionManager = new jR({ _iid: n, session: y, cacheContext: m, sdkState: p, dispatcher: E, requestQueue: this.requestQueue, logger: v }), this.connectionManager = new LR(n, { sdkState: p, cacheContext: this.cacheContext, connectionHandlers: this.connectionHandlers, dispatcher: E, sessionManager: this.sessionManager, websocketClient: this.requestQueue.commandRouter.websocketClient, disableWebSocketCloseEventHandling: (d = t.disableWebSocketCloseEventHandling) !== null && d !== void 0 && d, logger: v }), this.statLogCollector = new GR({ cacheContext: this.cacheContext, requestQueue: this.requestQueue, dispatcher: E }), this.appStateToggleEnabled = (h = t.appStateToggleEnabled) === null || h === void 0 || h; - } - return ks[n]; - } - return e.of = function(n) { - if (ks[n]) - return ks[n]; - throw H.lostInstance; - }, e.clear = function(n) { - ks[n] && delete ks[n]; - }, e.prototype.hasExtension = function(n) { - return this.sdkState.extensions && this.sdkState.extensions[n]; - }, e; -}(), Yp = function() { - function e() { - } - return e.prototype.init = function(n, t) { - var r = t.sdkState, i = t.dispatcher, a = t.sessionManager, o = t.requestQueue, s = t.logger; - t.onlineDetector; - var c = t.cacheContext; - this._iid = n, this._cacheContext = c, this._sdkState = r, this._dispatcher = i, this._sessionManager = a, this._requestQueue = o, this._logger = s; - }, e; -}(); -(function(e) { - e.UNKNOWN = "UNKNOWN", e.EVENT_CHANNEL_CREATED = "EVENT_CHANNEL_CREATED", e.EVENT_CHANNEL_UPDATED = "EVENT_CHANNEL_UPDATED", e.EVENT_CHANNEL_DELETED = "EVENT_CHANNEL_DELETED", e.EVENT_CHANNEL_READ = "EVENT_CHANNEL_READ", e.EVENT_CHANNEL_DELIVERED = "EVENT_CHANNEL_DELIVERED", e.EVENT_CHANNEL_INVITED = "EVENT_CHANNEL_INVITED", e.EVENT_CHANNEL_JOINED = "EVENT_CHANNEL_JOINED", e.EVENT_CHANNEL_LEFT = "EVENT_CHANNEL_LEFT", e.EVENT_CHANNEL_ACCEPTED_INVITE = "EVENT_CHANNEL_ACCEPTED_INVITE", e.EVENT_CHANNEL_DECLINED_INVITE = "EVENT_CHANNEL_DECLINED_INVITE", e.EVENT_CHANNEL_OPERATOR_UPDATED = "EVENT_CHANNEL_OPERATOR_UPDATED", e.EVENT_CHANNEL_BANNED = "EVENT_CHANNEL_BANNED", e.EVENT_CHANNEL_UNBANNED = "EVENT_CHANNEL_UNBANNED", e.EVENT_CHANNEL_MUTED = "EVENT_CHANNEL_MUTED", e.EVENT_CHANNEL_UNMUTED = "EVENT_CHANNEL_UNMUTED", e.EVENT_CHANNEL_FROZEN = "EVENT_CHANNEL_FROZEN", e.EVENT_CHANNEL_UNFROZEN = "EVENT_CHANNEL_UNFROZEN", e.EVENT_CHANNEL_HIDDEN = "EVENT_CHANNEL_HIDDEN", e.EVENT_CHANNEL_UNHIDDEN = "EVENT_CHANNEL_UNHIDDEN", e.EVENT_CHANNEL_RESET_HISTORY = "EVENT_CHANNEL_RESET_HISTORY", e.EVENT_CHANNEL_TYPING_STATUS_UPDATE = "EVENT_CHANNEL_TYPING_STATUS_UPDATE", e.EVENT_CHANNEL_MEMBER_COUNT_UPDATED = "EVENT_CHANNEL_MEMBER_COUNT_UPDATED", e.EVENT_CHANNEL_METADATA_CREATED = "EVENT_CHANNEL_METADATA_CREATED", e.EVENT_CHANNEL_METADATA_UPDATED = "EVENT_CHANNEL_METADATA_UPDATED", e.EVENT_CHANNEL_METADATA_DELETED = "EVENT_CHANNEL_METADATA_DELETED", e.EVENT_CHANNEL_METACOUNTER_CREATED = "EVENT_CHANNEL_METACOUNTER_CREATED", e.EVENT_CHANNEL_METACOUNTER_UPDATED = "EVENT_CHANNEL_METACOUNTER_UPDATED", e.EVENT_CHANNEL_METACOUNTER_DELETED = "EVENT_CHANNEL_METACOUNTER_DELETED", e.EVENT_THREAD_INFO_UPDATED = "EVENT_THREAD_INFO_UPDATED", e.EVENT_MESSAGE_SENT = "EVENT_MESSAGE_SENT", e.EVENT_MESSAGE_RECEIVED = "EVENT_MESSAGE_RECEIVED", e.EVENT_MESSAGE_UPDATED = "EVENT_MESSAGE_UPDATED", e.EVENT_PINNED_MESSAGE_UPDATED = "EVENT_PINNED_MESSAGE_UPDATED", e.REQUEST_CHANNEL = "REQUEST_CHANNEL", e.REQUEST_CHANNEL_CHANGELOGS = "REQUEST_CHANNEL_CHANGELOGS", e.REFRESH_CHANNEL = "REFRESH_CHANNEL", e.CHANNEL_LASTACCESSEDAT_UPDATED = "CHANNEL_LASTACCESSEDAT_UPDATED", e.SYNC_CHANNEL_BACKGROUND = "SYNC_CHANNEL_BACKGROUND", e.SYNC_CHANNEL_CHANGELOGS = "SYNC_CHANNEL_CHANGELOGS", e.EVENT_MESSAGE_SENT_SUCCESS = "EVENT_MESSAGE_SENT_SUCCESS", e.EVENT_MESSAGE_SENT_FAILED = "EVENT_MESSAGE_SENT_FAILED", e.EVENT_MESSAGE_SENT_PENDING = "EVENT_MESSAGE_SENT_PENDING", e.EVENT_MESSAGE_DELETED = "EVENT_MESSAGE_DELETED", e.EVENT_MESSAGE_FEEDBACK_ADDED = "EVENT_MESSAGE_FEEDBACK_ADDED", e.EVENT_MESSAGE_FEEDBACK_UPDATED = "EVENT_MESSAGE_FEEDBACK_UPDATED", e.EVENT_MESSAGE_FEEDBACK_DELETED = "EVENT_MESSAGE_FEEDBACK_DELETED", e.EVENT_MESSAGE_READ = "EVENT_MESSAGE_READ", e.EVENT_MESSAGE_DELIVERED = "EVENT_MESSAGE_DELIVERED", e.EVENT_MESSAGE_REACTION_UPDATED = "EVENT_MESSAGE_REACTION_UPDATED", e.EVENT_MESSAGE_THREADINFO_UPDATED = "EVENT_MESSAGE_THREADINFO_UPDATED", e.EVENT_MESSAGE_OFFSET_UPDATED = "EVENT_MESSAGE_OFFSET_UPDATED", e.REQUEST_MESSAGE = "REQUEST_MESSAGE", e.EVENT_POLL_UPDATED = "EVENT_POLL_UPDATED", e.EVENT_POLL_VOTED = "EVENT_POLL_VOTED", e.SYNC_POLL_CHANGELOGS = "SYNC_POLL_CHANGELOGS", e.REQUEST_RESEND_MESSAGE = "REQUEST_RESEND_MESSAGE", e.REQUEST_THREADED_MESSAGE = "REQUEST_THREADED_MESSAGE", e.REQUEST_MESSAGE_CHANGELOGS = "REQUEST_MESSAGE_CHANGELOGS", e.SYNC_MESSAGE_FILL = "SYNC_MESSAGE_FILL", e.SYNC_MESSAGE_BACKGROUND = "SYNC_MESSAGE_BACKGROUND", e.SYNC_MESSAGE_CHANGELOGS = "SYNC_MESSAGE_CHANGELOGS", e.LOCAL_MESSAGE_PENDING_CREATED = "LOCAL_MESSAGE_PENDING_CREATED", e.LOCAL_MESSAGE_FAILED = "LOCAL_MESSAGE_FAILED", e.LOCAL_MESSAGE_CANCELED = "LOCAL_MESSAGE_CANCELED", e.LOCAL_MESSAGE_RESEND_STARTED = "LOCAL_MESSAGE_RESEND_STARTED"; -})(ne || (ne = {})); -var Ic; -L({}, ne); -var po = function(e) { - return e.startsWith("EVENT_") || e.startsWith("LOCAL_MESSAGE_") || e === ne.SYNC_MESSAGE_FILL || e === ne.SYNC_MESSAGE_CHANGELOGS || e === ne.SYNC_POLL_CHANGELOGS; -}, Sn = function(e) { - function n(t) { - var r = t.messages, i = t.source, a = t.isWebSocketEventComing, o = a !== void 0 && a, s = e.call(this) || this; - return s.messages = r, s.source = i, s.isWebSocketEventComing = o, s; - } - return O(n, e), n; -}(bn), N1 = function(e) { - function n(t) { - var r = t.messageIds, i = t.source, a = t.isWebSocketEventComing, o = a !== void 0 && a, s = e.call(this) || this; - return s.messageIds = r, s.source = i, s.isWebSocketEventComing = o, s; - } - return O(n, e), n; -}(bn), tA = function(e) { - function n(t) { - var r = t.event, i = t.source, a = t.isWebSocketEventComing, o = a !== void 0 && a, s = e.call(this) || this; - return s.event = r, s.source = i, s.isWebSocketEventComing = o, s; - } - return O(n, e), n; -}(bn), nA = function(e) { - function n(t) { - var r = t.event, i = t.source, a = t.isWebSocketEventComing, o = a !== void 0 && a, s = e.call(this) || this; - return s.event = r, s.source = i, s.isWebSocketEventComing = o, s; - } - return O(n, e), n; -}(bn), rA = function(e) { - function n(t) { - var r = t.reqId, i = t.source, a = e.call(this) || this; - return a.reqId = r, a.source = i, a; - } - return O(n, e), n; -}(bn), iA = function(e) { - function n(t) { - var r = t.polls, i = t.source, a = e.call(this) || this; - return a.polls = r, a.source = i, a; - } - return O(n, e), n; -}(bn), I1 = function(e) { - function n(t) { - var r = t.event, i = t.source, a = e.call(this) || this; - return a.event = r, a.source = i, a; - } - return O(n, e), n; -}(bn), Zp = function(e) { - function n(t) { - var r = t.event, i = t.source, a = e.call(this) || this; - return a.event = r, a.source = i, a; - } - return O(n, e), n; -}(bn); -(function(e) { - e.OPEN = "open", e.CLOSED = "closed"; -})(Ic || (Ic = {})); -var aA = "removed", Vm = function(e) { - switch (e) { - case "open": - return Ic.OPEN; - case "closed": - return Ic.CLOSED; - default: - return null; - } -}, oA = function(e) { - return !e || !!e.text && k("string", e.text); -}, wf = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d = this; - return (d = e.call(this, t) || this).pollId = 0, d.id = 0, d.text = null, d.voteCount = 0, d.createdBy = null, d.createdAt = 0, d.updatedAt = 0, d._lastVotedAt = 0, d.pollId = (i = r.poll_id) !== null && i !== void 0 ? i : 0, d.id = (a = r.id) !== null && a !== void 0 ? a : 0, d.text = (o = r.text) !== null && o !== void 0 ? o : null, d.voteCount = (s = r.vote_count) !== null && s !== void 0 ? s : 0, d.createdBy = (c = r.created_by) !== null && c !== void 0 ? c : null, d.createdAt = (l = r.created_at) !== null && l !== void 0 ? l : 0, d.updatedAt = (u = r.updated_at) !== null && u !== void 0 ? u : 0, d; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { vote_count: t.voteCount, poll_id: t.pollId, text: t.text, created_at: t.createdAt, id: t.id, created_by: t.createdBy, updated_at: t.updatedAt }))); - }, n; -}(br), ra = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d, h, f, p, v, m, E = this; - return (E = e.call(this, t) || this).id = 0, E.title = null, E.createdAt = 0, E.updatedAt = 0, E.closeAt = -1, E.status = Ic.CLOSED, E.messageId = 0, E.data = null, E.voterCount = -1, E.options = [], E.createdBy = null, E.allowUserSuggestion = !1, E.allowMultipleVotes = !1, E.votedPollOptionIds = [], E.id = (i = r.id) !== null && i !== void 0 ? i : 0, E.title = (a = r.title) !== null && a !== void 0 ? a : null, E.createdAt = (o = r.created_at) !== null && o !== void 0 ? o : 0, E.updatedAt = (s = r.updated_at) !== null && s !== void 0 ? s : 0, E.closeAt = (c = r.close_at) !== null && c !== void 0 ? c : -1, E.status = (l = Vm(r.status)) !== null && l !== void 0 ? l : Ic.CLOSED, E.messageId = (u = r.message_id) !== null && u !== void 0 ? u : 0, E.data = (d = r.data) !== null && d !== void 0 ? d : null, E.voterCount = (h = r.voter_count) !== null && h !== void 0 ? h : -1, E.options = r.options ? r.options.map(function(y) { - return new wf(E._iid, y); - }) : [], E.createdBy = (f = r.created_by) !== null && f !== void 0 ? f : null, E.allowUserSuggestion = (p = r.allow_user_suggestion) !== null && p !== void 0 && p, E.allowMultipleVotes = (v = r.allow_multiple_votes) !== null && v !== void 0 && v, E.votedPollOptionIds = (m = r.voted_option_ids) !== null && m !== void 0 ? m : [], E; - } - return O(n, e), n.prototype._applyPollUpdatePayload = function(t) { - var r, i, a, o, s, c, l, u, d = this; - this.title = (r = t.title) !== null && r !== void 0 ? r : this.title, this.updatedAt = (i = t.updated_at) !== null && i !== void 0 ? i : this.updatedAt, this.closeAt = (a = t.close_at) !== null && a !== void 0 ? a : this.closeAt, this.status = (o = Vm(t.status)) !== null && o !== void 0 ? o : this.status, this.data = (s = t.data) !== null && s !== void 0 ? s : this.data, this.voterCount = (c = t.voter_count) !== null && c !== void 0 ? c : this.voterCount, t.options && (this.options = t.options.map(function(h) { - return new wf(d._iid, h); - }), this.votedPollOptionIds = t.options.filter(function(h) { - return h.vote_count > 0; - }).map(function(h) { - return h.id; - })), this.allowUserSuggestion = (l = t.allow_user_suggestion) !== null && l !== void 0 ? l : this.allowUserSuggestion, this.allowMultipleVotes = (u = t.allow_multiple_votes) !== null && u !== void 0 ? u : this.allowMultipleVotes; - }, n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { id: t.id, title: t.title, created_at: t.createdAt, updated_at: t.updatedAt, close_at: t.closeAt, status: t.status, message_id: t.messageId, data: t.data, voter_count: t.voterCount, options: t.options.map(function(r) { - return wf.payloadify(r); - }), created_by: t.createdBy, allow_user_suggestion: t.allowUserSuggestion, allow_multiple_votes: t.allowMultipleVotes, voted_option_ids: t.votedPollOptionIds }))); - }, n.prototype.applyPollUpdateEvent = function(t) { - var r = t._payload.poll; - return !(!r || this.id !== r.id || r.updated_at < this.updatedAt) && (this._applyPollUpdatePayload(r), !0); - }, n.prototype.applyPollVoteEvent = function(t) { - if (this.id !== t.pollId) - return !1; - var r = this.options, i = r.map(function(s) { - return s.id; - }), a = t._payload, o = Math.floor(a.ts / 1e3); - return a.updated_vote_counts.forEach(function(s) { - var c = i.indexOf(s.option_id); - if (c > -1) { - var l = r[c]; - o >= l._lastVotedAt && (l.voteCount = s.vote_count, l._lastVotedAt = o); - } - }), a.req_id && a.voted_option_ids && (this.votedPollOptionIds = a.voted_option_ids), typeof a.voter_count == "number" && (this.voterCount = a.voter_count), !0; - }, n.prototype.serialize = function() { - return qc(this); - }, n; -}(br), ko = function() { - function e(n, t) { - var r; - this.limit = 20, this._isLoading = !1, this._hasNext = !0, this._token = "", this._iid = n, this.limit = (r = t.limit) !== null && r !== void 0 ? r : 20; - } - return Object.defineProperty(e.prototype, "hasNext", { get: function() { - return this._hasNext; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isLoading", { get: function() { - return this._isLoading; - }, enumerable: !1, configurable: !0 }), e.prototype._validate = function() { - return k("number", this.limit) && this.limit > 0; - }, e; -}(), io = function(e) { - function n(t, r, i, a) { - var o = e.call(this, t, a) || this; - return o.channelUrl = r, o.channelType = i, o; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && k("string", this.channelUrl) && Mt(Ft, this.channelType); - }, n; -}(ko), qR = function(e) { - this.pollId = 0, this.messageId = 0, this.pollId = e.poll_id, this.messageId = e.message_id, this._payload = e; -}, KR = function(e) { - function n(t) { - var r = t.title, i = t.optionTexts, a = t.data, o = t.allowUserSuggestion, s = t.allowMultipleVotes, c = t.closeAt, l = e.call(this) || this; - return l.method = pe.POST, l.path = Aa, l.params = { title: r, options: i, data: a, allow_user_suggestion: o, allow_multiple_votes: s, close_at: c }, l; - } - return O(n, e), n; -}(ge), WR = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.poll = new ra(t, r), i; - } - return O(n, e), n; -}(_e), YR = function(e) { - function n(t) { - var r = t.channelUrl, i = t.channelType, a = t.pollId, o = e.call(this) || this; - return o.method = pe.GET, o.path = "".concat(Aa, "/").concat(encodeURIComponent(a)), o.params = { channel_url: r, channel_type: i }, o; - } - return O(n, e), n; -}(ge), ZR = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.poll = new ra(t, r), i; - } - return O(n, e), n; -}(_e), QR = function(e) { - function n(t) { - var r = t.channelUrl, i = t.channelType, a = t.pollId, o = t.pollOptionId, s = e.call(this) || this; - return s.method = pe.GET, s.path = "".concat(Aa, "/").concat(encodeURIComponent(a), "/options/").concat(encodeURIComponent(o)), s.params = { channel_url: r, channel_type: i }, s; - } - return O(n, e), n; -}(ge), XR = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.pollOption = new wf(t, r), i; - } - return O(n, e), n; -}(_e), JR = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.timestamp, o = t.token, s = e.call(this) || this; - return s.method = pe.GET, s.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/polls/changelogs"), s.params = Be({ change_ts: a, token: o }), s; - } - return O(n, e), n; -}(ge), $R = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.updatedPolls = r.updated.map(function(a) { - return function(o, s) { - return new ra(o, s); - }(t, a); - }), i.deletedPollIds = r.deleted.map(function(a) { - return a; - }), i.hasMore = r.has_more, i.nextToken = r.next, i; - } - return O(n, e), n; -}(_e), eD = { title: "", optionTexts: [], data: void 0, allowUserSuggestion: void 0, allowMultipleVotes: void 0, closeAt: -1 }, sA = function(e) { - return k("string", e.title) && (n = e.optionTexts, Ot("string", n) && n.every(function(t) { - return t.trim() !== ""; - })) && oA(e.data) && k("boolean", e.allowUserSuggestion, !0) && k("boolean", e.allowMultipleVotes, !0) && k("number", e.closeAt, !0); - var n; -}, tD = { channelUrl: "", channelType: Ft.BASE, pollId: 0, pollOptionId: 0 }, lA = function(e) { - return k("string", e.channelUrl) && e.channelUrl !== "" && Mt(Ft, e.channelType) && k("number", e.pollId) && e.pollId > 0 && k("number", e.pollOptionId) && e.pollOptionId > 0; -}, nD = { channelUrl: "", channelType: Ft.BASE, pollId: 0 }, cA = function(e) { - return k("string", e.channelUrl) && e.channelUrl !== "" && Mt(Ft, e.channelType) && k("number", e.pollId); -}, cb = {}, np = function() { - function e(n, t) { - var r = t.sdkState, i = t.dispatcher, a = t.sessionManager, o = t.requestQueue, s = t.logger; - this._iid = n, this._sdkState = r, this._sessionManager = a, this._requestQueue = o, this._dispatcher = i, this._logger = s, cb[n] = this; - } - return e.of = function(n) { - return cb[n]; - }, e.prototype.buildPollFromSerializedData = function(n) { - var t = ms(n); - return new ra(this._iid, ra.payloadify(t)); - }, e.prototype.get = function(n) { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return ve(cA(n)).throw(H.invalidParameters), t = new YR(L({}, n)), [4, this._requestQueue.send(t)]; - case 1: - return r = i.sent(), [2, r.as(ZR).poll]; - } - }); - }); - }, e.prototype.create = function(n) { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return ve(sA(n)).throw(H.invalidParameters), t = new KR(L({}, n)), [4, this._requestQueue.send(t)]; - case 1: - return r = i.sent(), [2, r.as(WR).poll]; - } - }); - }); - }, e.prototype.getOption = function(n) { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return ve(lA(n)).throw(H.invalidParameters), t = new QR(L({}, n)), [4, this._requestQueue.send(t)]; - case 1: - return r = i.sent(), [2, r.as(XR).pollOption]; - } - }); - }); - }, e.prototype.getPollChangeLogs = function(n, t, r, i) { - return i === void 0 && (i = ne.SYNC_POLL_CHANGELOGS), T(this, void 0, void 0, function() { - var a, o, s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - return a = new JR(Xe({ channelType: t, channelUrl: n, timestamp: typeof r == "number" ? r : null, token: typeof r == "string" ? r : null })), [4, this._requestQueue.send(a)]; - case 1: - return o = h.sent(), s = o.as($R), c = s.updatedPolls, l = s.deletedPollIds, u = s.hasMore, d = s.nextToken, c.length > 0 && this._dispatcher.dispatch(new iA({ polls: c, source: i })), [2, { updatedPolls: c, deletedPollIds: l, hasMore: u, token: d }]; - } - }); - }); - }, e; -}(), rD = function(e) { - function n(t) { - var r = t.channelUrl, i = t.channelType, a = t.token, o = t.limit, s = e.call(this) || this; - return s.method = pe.GET, s.path = Aa, s.params = { channel_url: r, channel_type: i, token: a, limit: o }, s; - } - return O(n, e), n; -}(ge), iD = function(e) { - function n(t, r) { - var i, a = this; - return (a = e.call(this, t, r) || this).polls = ((i = r.polls) !== null && i !== void 0 ? i : []).map(function(o) { - return new ra(t, o); - }), a.token = r.next, a; - } - return O(n, e), n; -}(_e), uA = function(e) { - function n(t, r) { - return e.call(this, t, r.channelUrl, r.channelType, r) || this; - } - return O(n, e), n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new rD(L(L({}, this), { token: this._token })), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = c.sent(), a = i.as(iD), o = a.polls, s = a.token, this._token = s, this._hasNext = !!s, this._isLoading = !1, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(io), aD = function(e) { - function n(t) { - var r = t.channelUrl, i = t.channelType, a = t.pollId, o = t.pollOptionId, s = t.token, c = t.limit, l = e.call(this) || this; - return l.method = pe.GET, l.path = "".concat(Aa, "/").concat(encodeURIComponent(a), "/options/").concat(encodeURIComponent(o), "/voters"), l.params = { channel_url: r, channel_type: i, token: s, limit: c }, l; - } - return O(n, e), n; -}(ge), oD = function(e) { - function n(t, r) { - var i, a = this; - return (a = e.call(this, t, r) || this).voters = ((i = r.voters) !== null && i !== void 0 ? i : []).map(function(o) { - return new Dt(t, o); - }), a.token = r.next, a; - } - return O(n, e), n; -}(_e), dA = function(e) { - function n(t, r) { - var i = e.call(this, t, r.channelUrl, r.channelType, r) || this; - return i.pollId = r.pollId, i.pollOptionId = r.pollOptionId, i; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && k("number", this.pollId) && k("number", this.pollOptionId); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new aD(L(L({}, this), { pollId: this.pollId, pollOptionId: this.pollOptionId, token: this._token })), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = c.sent(), a = i.as(oD), o = a.voters, s = a.token, this._token = s, this._hasNext = !!s, this._isLoading = !1, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(io), bd, Uo = function() { - function e(n, t, r) { - var i, a; - this.width = 0, this.height = 0, this.realWidth = 0, this.realHeight = 0, this._requireAuth = !1, this._iid = n, this.plainUrl = t.url, this.width = t.width, this.height = t.height, this.realWidth = (i = t.real_width) !== null && i !== void 0 ? i : t.width, this.realHeight = (a = t.real_height) !== null && a !== void 0 ? a : t.height, this._requireAuth = r; - } - return e.payloadify = function(n) { - return Be(Xe(n instanceof e ? { url: n.plainUrl, width: n.width, height: n.height, real_width: n.realWidth, real_height: n.realHeight } : { url: "", width: n.maxWidth, height: n.maxHeight, real_width: 0, real_height: 0 })); - }, Object.defineProperty(e.prototype, "url", { get: function() { - var n = U.of(this._iid).sessionManager; - return this._requireAuth && n.ekey ? "".concat(this.plainUrl, "?auth=").concat(n.ekey) : this.plainUrl; - }, enumerable: !1, configurable: !0 }), e; -}(), rp = function(e) { - function n(t) { - var r = e.call(this) || this; - if (r.method = pe.POST, r.path = "".concat(h6), r.params = Be({ file: t.file, channel_url: t.channelUrl }), t.thumbnailSizes) - for (var i = 0; i < t.thumbnailSizes.length; i++) { - var a = t.thumbnailSizes[i], o = a.maxWidth, s = a.maxHeight; - r.params["thumbnail".concat(i + 1)] = "".concat(o, ",").concat(s); - } - return r.requestId = t.requestId, r; - } - return O(n, e), n; -}(ge), ip = function(e) { - function n(t, r) { - var i, a, o, s, c = this; - return (c = e.call(this, t, r) || this).url = r.url, c.fileSize = (i = r.file_size) !== null && i !== void 0 ? i : 0, c.thumbnails = (o = (a = r.thumbnails) === null || a === void 0 ? void 0 : a.map(function(l) { - return new Uo(t, l, !1); - })) !== null && o !== void 0 ? o : [], c.requireAuth = (s = r.require_auth) !== null && s !== void 0 && s, c; - } - return O(n, e), n; -}(_e), ap = function(e) { - function n(t, r) { - var i, a, o, s, c, l = this; - return (l = e.call(this, t) || this).replyCount = 0, l.memberCount = 0, l.lastRepliedAt = 0, l.updatedAt = 0, l.replyCount = (i = r.reply_count) !== null && i !== void 0 ? i : 0, l.memberCount = (a = r.member_count) !== null && a !== void 0 ? a : 0, l.mostRepliedUsers = r.most_replies && Ot("object", r.most_replies) ? r.most_replies.map(function(u) { - return new Dt(l._iid, u); - }) : [], l.unreadReplyCount = (o = r.unread_message_count) !== null && o !== void 0 ? o : 0, l.isPushNotificationEnabled = typeof r.push_enabled == "number" ? r.push_enabled > 0 : void 0, l.lastRepliedAt = (s = r.last_replied_at) !== null && s !== void 0 ? s : 0, l.updatedAt = (c = r.updated_at) !== null && c !== void 0 ? c : 0, l; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { reply_count: t.replyCount, unread_message_count: t.unreadReplyCount, member_count: t.memberCount, most_replies: Array.isArray(t.mostRepliedUsers) ? t.mostRepliedUsers.map(function(r) { - return Dt.payloadify(r); - }) : [], push_enabled: typeof t.isPushNotificationEnabled == "boolean" ? t.isPushNotificationEnabled ? 1 : 0 : void 0, last_replied_at: t.lastRepliedAt, updated_at: t.updatedAt }))); - }, Object.defineProperty(n.prototype, "_isUpdateRequired", { get: function() { - return this.unreadReplyCount === void 0 || this.isPushNotificationEnabled === void 0; - }, enumerable: !1, configurable: !0 }), n.prototype._updateFrom = function(t) { - var r, i; - this.unreadReplyCount = (r = t.unreadReplyCount) !== null && r !== void 0 ? r : this.unreadReplyCount, this.isPushNotificationEnabled = (i = t.isPushNotificationEnabled) !== null && i !== void 0 ? i : this.isPushNotificationEnabled; - }, n; -}(br); -(function(e) { - e.ADD = "add", e.DELETE = "delete"; -})(bd || (bd = {})); -var Qo, M1 = function(e) { - this.messageId = 0, this.operation = null, this.updatedAt = 0; - var n = k("string", e.msg_id) ? parseInt(e.msg_id) : e.msg_id, t = e.user_id, r = e.operation ? e.operation.toLowerCase() : null, i = e.reaction, a = e.updated_at; - n && k("string", t) && k("string", r) && Mt(bd, r) && k("string", i) && i && k("number", a) && (this.messageId = n, this.userId = t, this.key = i, this.operation = r, this.updatedAt = a); -}, Gh = function() { - function e(n) { - var t, r, i, a = n.key, o = (i = dt([], tt(n.user_ids), !1)) !== null && i !== void 0 ? i : [], s = n.updated_at; - k("string", a) && a && Ot("string", o) && o.length > 0 && k("number", s) && (this.key = a, this.userIds = o, this.updatedAt = s); - var c = {}; - try { - for (var l = Ne(this.userIds), u = l.next(); !u.done; u = l.next()) - c[u.value] = this.updatedAt; - } catch (d) { - t = { error: d }; - } finally { - try { - u && !u.done && (r = l.return) && r.call(l); - } finally { - if (t) - throw t.error; - } - } - this._version = c; - } - return Object.defineProperty(e.prototype, "isEmpty", { get: function() { - return this.userIds.length === 0; - }, enumerable: !1, configurable: !0 }), e.payloadify = function(n) { - return Be(Xe({ key: n.key, user_ids: n.userIds, updated_at: n.updatedAt })); - }, e.prototype.applyEvent = function(n) { - if (n.key === this.key && this.updatedAt <= n.updatedAt) { - if (!this._version[n.userId] || this._version[n.userId] <= n.updatedAt) { - var t = this.userIds.indexOf(n.userId); - switch (n.operation) { - case bd.ADD: - t < 0 && this.userIds.push(n.userId); - break; - case bd.DELETE: - t >= 0 && this.userIds.splice(t, 1); - } - this._version[n.userId] = n.updatedAt; - } - this.updatedAt = Math.max(this.updatedAt, n.updatedAt); - } - }, e; -}(), ub = function() { - function e(n) { - this.secureUrl = null, this.type = null, this.width = 0, this.height = 0, this.alt = null, this.url = n.url, n.secure_url && (this.secureUrl = n.secure_url), n.type && (this.type = n.type), n.width && (this.width = n.width), n.height && (this.height = n.height), n.alt && (this.alt = n.alt); - } - return e.payloadify = function(n) { - var t, r; - return Be(Xe({ url: n.url, secure_url: n.secureUrl, type: n.type, width: (t = n.width) !== null && t !== void 0 ? t : 0, height: (r = n.height) !== null && r !== void 0 ? r : 0, alt: n.alt })); - }, e; -}(), db = function() { - function e(n) { - this.title = null, this.url = null, this.description = null, this.defaultImage = null, n["og:title"] && (this.title = n["og:title"]), n["og:url"] && (this.url = n["og:url"]), n["og:description"] && (this.description = n["og:description"]), n["og:image"] && (this.defaultImage = new ub(n["og:image"])); - } - return e.payloadify = function(n) { - return Be(Xe({ "og:title": n.title, "og:url": n.url, "og:description": n.description, "og:image": n.defaultImage ? ub.payloadify(n.defaultImage) : null })); - }, e; -}(), ia = function() { - function e(n) { - var t, r; - this.volume = 0, this.name = (t = n.name) !== null && t !== void 0 ? t : "default", this.volume = (r = n.volume) !== null && r !== void 0 ? r : 1; - } - return e.prototype.serialize = function() { - return { name: this.name, volume: this.volume }; - }, e.payloadify = function(n) { - return Be(Xe({ name: n.name, volume: n.volume })); - }, e; -}(); -(function(e) { - e.GOOD = "good", e.BAD = "bad"; -})(Qo || (Qo = {})); -var hb, yl = function() { - function e(n) { - this.id = n.id, this.rating = n.rating, this.comment = n.comment; - } - return e.parseFeedbackStatusFromPayload = function(n) { - return n && n.id !== null && n.rating !== null ? "SUBMITTED" : "NOT_APPLICABLE"; - }, e.payloadify = function(n) { - return Be(Xe({ id: n.id, rating: n.rating, comment: n.comment })); - }, e; -}(), Mc = function(e) { - function n(t, r) { - var i, a = this; - return (a = e.call(this, t, r) || this).isBlockedByMe = !1, a.role = Mt(ea, r.role) ? r.role : ea.NONE, a.isBlockedByMe = (i = r.is_blocked_by_me) !== null && i !== void 0 && i, a; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { role: t.role, is_blocked_by_me: t.isBlockedByMe }))); - }, n; -}(Dt), Br = function() { - function e(n) { - this.key = n.key, this.value = Ot("string", n.value) ? dt([], tt(n.value), !1) : []; - } - return e.payloadify = function(n) { - var t; - return Be(Xe({ key: n.key, value: (t = n.value) !== null && t !== void 0 ? t : [] })); - }, e; -}(), hA = function(e) { - switch (e) { - case Ln.BASE: - return ""; - case Ln.USER: - return "MESG"; - case Ln.FILE: - return "FILE"; - case Ln.ADMIN: - return "ADMM"; - } -}, fA = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d, h, f, p = this; - (p = e.call(this, t) || this).channelType = Ft.BASE, p.messageType = Ln.BASE, p.mentionType = null, p.mentionedUsers = null, p.mentionedUserIds = null, p.metaArrays = [], p.extendedMessage = {}, p.createdAt = 0, p.updatedAt = 0, p.channelUrl = r.channel_url, p.channelType = Mt(Ft, r.channel_type) ? r.channel_type : Ft.GROUP, r.channel && (r.channel.channel_url && (p.channelUrl = r.channel.channel_url), r.channel.channel_type && (p.channelType = r.channel.channel_type)), p.data = (i = r.data) !== null && i !== void 0 ? i : "", p.customType = (a = r.custom_type) !== null && a !== void 0 ? a : "", p.mentionType = Mt(Or, r.mention_type) ? r.mention_type : null, p.mentionedUsers = r.mentioned_users ? r.mentioned_users.map(function(_) { - return new Dt(p._iid, _); - }) : null, p.mentionedUserIds = (o = r.mentioned_user_ids) !== null && o !== void 0 ? o : null, p.mentionedUsers && !p.mentionedUserIds && (p.mentionedUserIds = p.mentionedUsers.map(function(_) { - return _.userId; - })), p.mentionedMessageTemplate = (s = r.mentioned_message_template) !== null && s !== void 0 ? s : ""; - var v = (c = r.metaarray) !== null && c !== void 0 ? c : {}, m = (l = r.metaarray_key_order) !== null && l !== void 0 ? l : Object.keys(v).sort(function(_, S) { - return _.localeCompare(S); - }); - p.metaArrays = []; - for (var E = 0; E < m.length; E++) { - var y = m[E]; - p.metaArrays.push(new Br({ key: y, value: v[y] || [] })); - } - return r.sorted_metaarray && (p.metaArrays = r.sorted_metaarray.map(function(_) { - return new Br(_); - })), p.extendedMessage = (u = r.extended_message) !== null && u !== void 0 ? u : {}, p.extendedMessagePayload = r.extended_message_payload, p.createdAt = (h = (d = r.created_at) !== null && d !== void 0 ? d : r.ts) !== null && h !== void 0 ? h : 0, p.updatedAt = (f = r.updated_at) !== null && f !== void 0 ? f : 0, p; - } - return O(n, e), n.payloadify = function(t) { - var r, i; - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { channel_url: t.channelUrl, channel_type: t.channelType, type: hA(t.messageType), data: t.data, custom_type: t.customType, mention_type: t.mentionType, mentioned_user_ids: t.mentionedUserIds, mentioned_users: (r = t.mentionedUsers) === null || r === void 0 ? void 0 : r.map(function(a) { - return Dt.payloadify(a); - }), mentioned_message_template: t.mentionedMessageTemplate, sorted_metaarray: (i = t.metaArrays) === null || i === void 0 ? void 0 : i.map(function(a) { - return Br.payloadify(a); - }), extended_message: t.extendedMessage, extended_message_payload: t.extendedMessagePayload, created_at: t.createdAt, updated_at: t.updatedAt }))); - }, n.prototype.isIdentical = function(t) { - return !0; - }, n.prototype.isEqual = function(t) { - return gw(this, t); - }, n.prototype.isUserMessage = function() { - return this.messageType === Ln.USER; - }, n.prototype.isFileMessage = function() { - return this.messageType === Ln.FILE && !Object.prototype.hasOwnProperty.call(this, "fileInfoList"); - }, n.prototype.isMultipleFilesMessage = function() { - return this.messageType === Ln.FILE && Object.prototype.hasOwnProperty.call(this, "fileInfoList"); - }, n.prototype.isAdminMessage = function() { - return this.messageType === Ln.ADMIN; - }, n.prototype.hasForm = function() { - var t, r; - return !!(!((r = (t = this.extendedMessagePayload) === null || t === void 0 ? void 0 : t.forms) === null || r === void 0) && r[0]); - }, n.prototype.serialize = function() { - return qc(this); - }, n.prototype.getMetaArraysByKeys = function(t) { - return this.metaArrays.filter(function(r) { - return t.includes(r.key); - }); - }, n; -}(br); -(function(e) { - e.Text = "text", e.Phone = "phone", e.Email = "email", e.Password = "password"; -})(hb || (hb = {})); -var zh = function() { - function e(n, t, r) { - this.messageId = n, this.key = t, this.fields = r, this.formKey = t; - } - return Object.defineProperty(e.prototype, "isSubmitted", { get: function() { - return this.answers !== void 0 && Object.keys(this.answers).length > 0; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isSubmittable", { get: function() { - return this.fields.every(function(n) { - return n.isSubmittable; - }); - }, enumerable: !1, configurable: !0 }), e.prototype.getFieldAnswer = function(n) { - var t; - return (t = this.answers) === null || t === void 0 ? void 0 : t[n]; - }, e.payloadify = function(n) { - var t; - return Be(Xe({ key: (t = n.formKey) !== null && t !== void 0 ? t : n.key, fields: n.fields.map(function(r) { - return pA.payloadify(r); - }) })); - }, e.isFormPayload = function(n) { - var t; - return !!(!((t = n == null ? void 0 : n.forms) === null || t === void 0) && t[0]); - }, e; -}(), pA = function() { - function e(n) { - this.key = n.key, this.inputType = n.input_type, this.title = n.title, this.required = n.required, this.regex = n.regex, this.placeholder = n.placeholder, this.fieldKey = n.key; - } - return e.prototype.isValid = function(n) { - if (!this.regex) - return !0; - try { - return new RegExp(this.regex).test(n); - } catch { - return !0; - } - }, Object.defineProperty(e.prototype, "isSubmittable", { get: function() { - return !(this.temporaryAnswer != null && !this.isValid(this.temporaryAnswer) || this.required && this.temporaryAnswer == null); - }, enumerable: !1, configurable: !0 }), e.payloadify = function(n) { - var t; - return Be(Xe({ key: (t = n.fieldKey) !== null && t !== void 0 ? t : n.key, input_type: n.inputType, title: n.title, required: n.required, regex: n.regex, placeholder: n.placeholder })); - }, e; -}(), vA = function(e) { - function n(t, r) { - var i, a, o = this; - return (o = e.call(this, t) || this).channelUrl = (i = r.channel_url) !== null && i !== void 0 ? i : "", o.channelType = (a = r.channel_type) !== null && a !== void 0 ? a : Ft.GROUP, o.reader = new Dt(o._iid, r.user), o.readAt = r.ts, o; - } - return O(n, e), n; -}(br), sD = function(e) { - function n(t) { - var r = t.channelUrl; - return e.call(this, { code: "READ", ackRequired: !0, payload: { channel_url: r } }) || this; - } - return O(n, e), n; -}(Ir); -(function(e) { - function n(t) { - var r = e.call(this) || this, i = t.channelUrl, a = t.channelType, o = t.userId, s = t.notificationIds; - return r.method = pe.PUT, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/messages/mark_as_read"), r.params = Be(Xe({ user_id: o, message_ids: s })), r; - } - return O(n, e), n; -})(ge); -var mA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "READ", i) || this; - return a.readStatus = new vA(t, i), a; - } - return O(n, e), n; -}(En); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.readAt = r.ts, i.unreadMessageCount = r.unread_message_count, i; - } - return O(n, e), n; -})(_e); -var lD = function(e) { - function n(t) { - var r = t.channelUrl, i = t.messageId; - return e.call(this, { code: "READ", ackRequired: !0, payload: { channel_url: r, parent_message_id: i } }) || this; - } - return O(n, e), n; -}(Ir), cD = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = t.pushEnabled, s = e.call(this) || this; - return s.method = pe.PUT, s.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(a, "/thread_push"), s.params = { push_enabled: o }, s; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - return e.call(this, t, r) || this; - } - O(n, e); -})(_e); -var fb = function(e) { - function n(t) { - var r = e.call(this) || this; - return r.method = pe.POST, r.path = "".concat(xr, "/").concat(encodeURIComponent(t.channelUrl), "/messages/").concat(t.messageId, "/submit_forms"), r.params = Be({ forms: t.forms }), r; - } - return O(n, e), n; -}(ge), uD = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = t.rating, s = t.comment, c = e.call(this) || this; - return c.method = pe.POST, c.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(a, "/feedbacks"), c.params = { rating: o, comment: s }, c; - } - return O(n, e), n; -}(ge), dD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.feedback = new yl(r), i; - } - return O(n, e), n; -}(_e), hD = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = t.feedbackId, s = t.rating, c = t.comment, l = e.call(this) || this; - return l.method = pe.PUT, l.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(a, "/feedbacks/").concat(o), l.params = { rating: s, comment: c }, l; - } - return O(n, e), n; -}(ge), fD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.feedback = new yl(r), i; - } - return O(n, e), n; -}(_e), pD = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = t.feedbackId, s = e.call(this) || this; - return s.method = pe.DELETE, s.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(a, "/feedbacks/").concat(o), s; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.feedback = new yl(r), i; - } - O(n, e); -})(_e); -var ls, Di, Gm = function(e) { - function n(t, r) { - var i, a, o, s, c, l = this; - return (l = e.call(this, t) || this).plainUrl = "", l.fileName = null, l.mimeType = null, l.fileSize = 0, l.thumbnails = [], l._requireAuth = !1, l.plainUrl = (i = r.url) !== null && i !== void 0 ? i : "", l.fileName = (a = r.file_name) !== null && a !== void 0 ? a : null, l.mimeType = (o = r.file_type) !== null && o !== void 0 ? o : null, l.fileSize = (s = r.file_size) !== null && s !== void 0 ? s : 0, l._requireAuth = (c = r.require_auth) !== null && c !== void 0 && c, l.thumbnails = r.thumbnails ? r.thumbnails.map(function(u) { - var d; - return new Uo(l._iid, typeof u == "string" ? { url: u, width: 0, height: 0 } : L(L({}, u), { url: ((d = u.url) !== null && d !== void 0 ? d : "").split("auth=")[0] }), l._requireAuth); - }) : [], l; - } - return O(n, e), n.payloadify = function(t) { - var r; - return Be(Xe({ url: t.plainUrl, file_name: t.fileName, file_type: t.mimeType, file_size: t.fileSize, thumbnails: (r = t.thumbnails) === null || r === void 0 ? void 0 : r.map(function(i) { - var a; - return { url: ((a = i.plainUrl) !== null && a !== void 0 ? a : "").split("auth=")[0], width: i.width, height: i.height, real_width: i.realWidth, real_height: i.realHeight }; - }), require_auth: t._requireAuth })); - }, Object.defineProperty(n.prototype, "url", { get: function() { - var t = U.of(this._iid).sessionManager; - return this._requireAuth && t.ekey ? "".concat(this.plainUrl, "?auth=").concat(t.ekey) : this.plainUrl; - }, enumerable: !1, configurable: !0 }), n; -}(br), gA = function(e) { - var n = e.channelUrl, t = e.channelType, r = e.parentMessage; - this.channelUrl = n, this.channelType = t, this.parentMessage = r; -}; -(function(e) { - e.PENDING = "pending", e.SENT = "sent", e.FAILED = "failed", e.CANCELED = "canceled"; -})(ls || (ls = {})), function(e) { - e.PENDING = "pending", e.IN_QUEUE = "in_queue", e.SENT = "sent", e.FAILED = "failed", e.CANCELED = "canceled", e.REMOVED = "removed"; -}(Di || (Di = {})); -var il, kr = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d, h, f, p = this; - return (p = e.call(this, t, r) || this).parentMessage = null, p.silent = !1, p.isOperatorMessage = !1, p.threadInfo = null, p.reactions = [], p.appleCriticalAlertOptions = null, p.scheduledInfo = null, p.suggestedReplies = null, p.myFeedback = null, p.myFeedbackStatus = "NOT_APPLICABLE", p.forms = null, p._isContinuousMessages = !1, p._scheduledStatus = null, p.messageId = (a = (i = r.msg_id) !== null && i !== void 0 ? i : r.message_id) !== null && a !== void 0 ? a : 0, p.parentMessageId = (o = typeof r.parent_message_id == "string" ? parseInt(r.parent_message_id) : r.parent_message_id) !== null && o !== void 0 ? o : 0, p.threadInfo = r.thread_info ? new ap(p._iid, r.thread_info) : null, p.reactions = r.reactions ? r.reactions.map(function(v) { - return new Gh(v); - }) : [], p.ogMetaData = r.og_tag ? new db(r.og_tag) : null, p.silent = (s = r.silent) !== null && s !== void 0 && s, p.isOperatorMessage = (c = r.is_op_msg) !== null && c !== void 0 && c, p.appleCriticalAlertOptions = r.apple_critical_alert_options ? new ia(r.apple_critical_alert_options) : null, typeof r.scheduled_message_id == "number" && typeof r.scheduled_at == "number" && r.scheduled_status && (p.scheduledInfo = { scheduledMessageId: r.scheduled_message_id, scheduledAt: r.scheduled_at }, p._scheduledStatus = r.scheduled_status), p._isContinuousMessages = (l = r.is_continuous_messages) !== null && l !== void 0 && l, p.myFeedback = !((u = r.feedback) === null || u === void 0) && u.id ? new yl(r.feedback) : null, p.myFeedbackStatus = (d = r.my_feedback_status) !== null && d !== void 0 ? d : yl.parseFeedbackStatusFromPayload(r.feedback), p.suggestedReplies = (f = (h = r.extended_message_payload) === null || h === void 0 ? void 0 : h.suggested_replies) !== null && f !== void 0 ? f : null, p.forms = zh.isFormPayload(r.extended_message_payload) ? r.extended_message_payload.forms.map(function(v) { - return new zh(p.messageId, v.key, v.fields.map(function(m) { - return new pA(m); - })); - }) : null, p; - } - return O(n, e), n.payloadify = function(t) { - var r, i; - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { message_id: t.messageId, parent_message_id: t.parentMessageId, thread_info: t.threadInfo ? ap.payloadify(t.threadInfo) : null, reactions: t.reactions.map(function(a) { - return Gh.payloadify(a); - }), og_tag: t.ogMetaData ? db.payloadify(t.ogMetaData) : null, silent: t.silent, is_op_msg: t.isOperatorMessage, apple_critical_alert_options: t.appleCriticalAlertOptions ? ia.payloadify(t.appleCriticalAlertOptions) : null, scheduled_message_id: (r = t.scheduledInfo) === null || r === void 0 ? void 0 : r.scheduledMessageId, scheduled_at: (i = t.scheduledInfo) === null || i === void 0 ? void 0 : i.scheduledAt, scheduled_status: t._scheduledStatus, feedback: t.myFeedback ? yl.payloadify(t.myFeedback) : null, my_feedback_status: t.myFeedbackStatus, forms: t.forms ? t.forms.map(function(a) { - return zh.payloadify(a); - }) : null }))); - }, n._getParentMessageInfoPayload = function(t) { - return Be(Xe({ type: hA(t.messageType), ts: t.createdAt, user: t.sender ? Mc.payloadify(t.sender) : null, message: t.message, file: { url: t.plainUrl, name: t.name, type: t.type, require_auth: t.requireAuth }, files: Array.isArray(t.fileInfoList) ? t.fileInfoList.map(function(r) { - return Gm.payloadify(r); - }) : null })); - }, n.prototype.isIdentical = function(t) { - return this.messageId === t.messageId; - }, n.prototype.applyThreadInfoUpdateEvent = function(t) { - return this.messageId === t.targetMessageId && (t.threadInfo._isUpdateRequired && this.threadInfo && t.threadInfo._updateFrom(this.threadInfo), this.threadInfo = t.threadInfo, !0); - }, n.prototype.applyReactionEvent = function(t) { - if (this.messageId === t.messageId) { - for (var r = !1, i = 0; i < this.reactions.length; i++) - if (this.reactions[i].key === t.key) { - this.reactions[i].applyEvent(t), this.reactions[i].isEmpty && this.reactions.splice(i, 1), r = !0; - break; - } - r || t.operation !== "add" || this.reactions.push(new Gh(Gh.payloadify({ key: t.key, userIds: [t.userId], updatedAt: t.updatedAt }))); - } - }, n.prototype.applyParentMessage = function(t) { - if (!this.parentMessage) - return this.parentMessage = t, !0; - if (this.parentMessageId === t.messageId) { - var r = this.parentMessage.updatedAt; - if (t.updatedAt >= r) - return this.parentMessage = t, !0; - } - return !1; - }, n.prototype._triggerThreadInfoUpdatedEvent = function() { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - return (t = U.of(this._iid).dispatcher).dispatch(new gA({ channelType: Ft.GROUP, channelUrl: this.channelUrl, parentMessage: this })), t.dispatch(new Sn({ messages: [this], source: ne.EVENT_THREAD_INFO_UPDATED })), [2]; - }); - }); - }, n.prototype.markThreadAsRead = function() { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new lD({ channelUrl: this.channelUrl, messageId: this.messageId }), [4, t.send(r)]; - case 1: - return i.sent(), this.threadInfo && this.threadInfo.unreadReplyCount !== 0 ? (this.threadInfo.unreadReplyCount = 0, [4, this._triggerThreadInfoUpdatedEvent()]) : [3, 3]; - case 2: - i.sent(), i.label = 3; - case 3: - return [2]; - } - }); - }); - }, n.prototype.setPushNotificationEnabled = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return r = U.of(this._iid).requestQueue, i = new cD({ channelUrl: this.channelUrl, channelType: this.channelType, messageId: this.messageId, pushEnabled: t }), [4, r.send(i)]; - case 1: - return a.sent(), this.threadInfo && this.threadInfo.isPushNotificationEnabled !== t && (this.threadInfo.isPushNotificationEnabled = t), [2]; - } - }); - }); - }, n.prototype.submitForm = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - if (ve(t.form && t.form instanceof zh || k("string", t.formId) && k("object", t.answers)).throw(H.invalidParameters), r = U.of(this._iid), i = r.requestQueue, a = r.sdkState, o = r.logger, !t.form) - return [3, 2]; - if (!(s = t.form).isSubmittable) - throw new H({ code: nt.INVALID_PARAMETER, message: "The given form is not submittable." }); - if (s.isSubmitted) - throw new H({ code: nt.INVALID_PARAMETER, message: "The given form is already submitted." }); - if (s.messageId != this.messageId) - throw new H({ code: nt.INVALID_PARAMETER, message: "This form does not belong to the message." }); - return c = s.fields.reduce(function(d, h) { - return d[h.key] = h.temporaryAnswer, d; - }, {}), l = new fb({ userId: a.userId, channelUrl: this.channelUrl, channelType: this.channelType, messageId: this.messageId, forms: [{ form_key: s.key, data: c }] }), [4, i.send(l)]; - case 1: - return u.sent(), [3, 4]; - case 2: - return t.formId && t.answers ? (o.warn("The submitForm method with formId and answers is deprecated. Use submitForm({ form: Form }) instead."), l = new fb({ userId: a.userId, channelUrl: this.channelUrl, channelType: this.channelType, messageId: this.messageId, forms: [{ form_key: t.formId, data: t.answers }] }), [4, i.send(l)]) : [3, 4]; - case 3: - u.sent(), u.label = 4; - case 4: - return [2]; - } - }); - }); - }, n.prototype.submitFeedback = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return r = U.of(this._iid), i = r.requestQueue, a = r.dispatcher, o = new uD({ channelUrl: this.channelUrl, channelType: this.channelType, messageId: this.messageId, rating: t.rating, comment: t.comment }), [4, i.send(o)]; - case 1: - return s = l.sent(), c = s.as(dD), this.myFeedback = c.feedback, this.myFeedbackStatus = "SUBMITTED", a.dispatch(new Sn({ messages: [this], source: ne.EVENT_MESSAGE_FEEDBACK_ADDED })), [2]; - } - }); - }); - }, n.prototype.updateFeedback = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return r = U.of(this._iid), i = r.requestQueue, a = r.dispatcher, o = new hD({ channelUrl: this.channelUrl, channelType: this.channelType, messageId: this.messageId, feedbackId: t.id, rating: t.rating, comment: t.comment }), [4, i.send(o)]; - case 1: - return s = l.sent(), c = s.as(fD), this.myFeedback = c.feedback, this.myFeedbackStatus = "SUBMITTED", a.dispatch(new Sn({ messages: [this], source: ne.EVENT_MESSAGE_FEEDBACK_UPDATED })), [2]; - } - }); - }); - }, n.prototype.deleteFeedback = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return r = U.of(this._iid), i = r.requestQueue, a = r.dispatcher, o = new pD({ channelUrl: this.channelUrl, channelType: this.channelType, messageId: this.messageId, feedbackId: t }), [4, i.send(o)]; - case 1: - return s.sent(), this.myFeedback = null, this.myFeedbackStatus = "NO_FEEDBACK", a.dispatch(new Sn({ messages: [this], source: ne.EVENT_MESSAGE_FEEDBACK_DELETED })), [2]; - } - }); - }); - }, n; -}(fA), Vn = function(e) { - function n(t, r) { - var i, a, o, s, c = this; - if ((c = e.call(this, t, r) || this).reqId = "", c.replyToChannel = !1, c.errorCode = 0, c.sender = r.user ? new Mc(c._iid, r.user) : r.sender_id, c.reqId = (a = (i = r.req_id) !== null && i !== void 0 ? i : r.request_id) !== null && a !== void 0 ? a : "", c.replyToChannel = (o = r.is_reply_to_channel) !== null && o !== void 0 && o, r.request_state && Mt($t, r.request_state) && (c.sendingStatus = r.request_state), !c.sendingStatus) - if (c.messageId > 0) - c.sendingStatus = $t.SUCCEEDED; - else if (c.scheduledInfo) - switch (r.scheduled_status && (c._scheduledStatus = r.scheduled_status), r.scheduled_status) { - case Di.SENT: - case Di.IN_QUEUE: - c.sendingStatus = $t.SUCCEEDED; - break; - case Di.PENDING: - c.sendingStatus = $t.SCHEDULED; - break; - case Di.FAILED: - case Di.REMOVED: - c.sendingStatus = $t.FAILED; - break; - case Di.CANCELED: - c.sendingStatus = $t.CANCELED; - } - else - c.sendingStatus = $t.PENDING; - return c.errorCode = (s = r.error_code) !== null && s !== void 0 ? s : 0, c; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { user: Mc.payloadify(t.sender), req_id: t.reqId, is_reply_to_channel: t.replyToChannel, request_state: t.sendingStatus, error_code: t.errorCode }))); - }, Object.defineProperty(n.prototype, "isResendable", { get: function() { - return (this.sendingStatus === $t.FAILED || this.sendingStatus === $t.CANCELED) && o6(this.errorCode); - }, enumerable: !1, configurable: !0 }), n.prototype.isIdentical = function(t) { - return this.messageId > 0 && t.messageId > 0 ? this.messageId === t.messageId : this.reqId === t.reqId; - }, n; -}(kr), nh = { prevResultSize: 0, nextResultSize: 0, isInclusive: !1, reverse: !1, messageTypeFilter: Nr.ALL, customTypesFilter: void 0, senderUserIdsFilter: void 0, includeReactions: !1, includeMetaArray: !1, includeParentMessageInfo: !1 }, Qp = function(e) { - return k("number", e.prevResultSize) && k("number", e.nextResultSize) && k("boolean", e.isInclusive) && k("boolean", e.reverse) && k("string", e.messageTypeFilter) && Mt(Nr, e.messageTypeFilter) && Ot("string", e.customTypesFilter, !0) && Ot("string", e.senderUserIdsFilter, !0) && k("boolean", e.includeMetaArray) && k("boolean", e.includeReactions) && k("boolean", e.includeParentMessageInfo); -}, Oc = function(e) { - function n(t, r) { - var i, a, o, s, c = this; - if ((c = e.call(this, t, r) || this).translations = {}, c.message = (i = r.message) !== null && i !== void 0 ? i : "", c.messageType = Ln.ADMIN, c.translations = (a = r.translations) !== null && a !== void 0 ? a : {}, r.parent_message_info) { - var l = r.parent_message_info; - c.parentMessage = jr(t, Be(Xe(L(L({}, l), { message_id: c.parentMessageId, channel_url: c.channelUrl, channel_type: c.channelType, file: l.file, url: (o = l.file) === null || o === void 0 ? void 0 : o.url, require_auth: (s = l.file) === null || s === void 0 ? void 0 : s.require_auth })))); - } - return c; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { message: t.message, translations: t.translations, parent_message_info: t.parentMessage ? e._getParentMessageInfoPayload.call(this, t.parentMessage) : null }))); - }, n.prototype.getThreadedMessagesByTimestamp = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, nh), r), ve(this.messageId > 0 && k("number", t) && Qp(i)).throw(H.invalidParameters), [4, tr.of(this._iid).getThreadedMessagesByTimestamp(this, t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n; -}(kr), pb = function() { - function e(n) { - var t, r; - this.detail = {}, this.type = (t = n.type) !== null && t !== void 0 ? t : "", this.vendor = (r = n.vendor) !== null && r !== void 0 ? r : "", n.detail && k("object", n.detail) && !Array.isArray(n.detail) && (this.detail = n.detail); - } - return e.payloadify = function(n) { - return Be(Xe({ type: n.type, vendor: n.vendor, detail: n.detail })); - }, e; -}(), vb = function() { - function e(n) { - this.status = n.status, n.original_message_info && (this.originalMessageInfo = { createdAt: n.original_message_info.ts, messageId: n.original_message_info.id }); - } - return e.payloadify = function(n) { - return Be({ status: n.status, original_message_info: n.originalMessageInfo ? { id: n.originalMessageInfo.messageId, ts: n.originalMessageInfo.createdAt } : void 0 }); - }, e; -}(), Ar = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d = this; - if ((d = e.call(this, t, r) || this).message = "", d.messageParams = null, d.translations = {}, d.translationTargetLanguages = [], d.messageSurvivalSeconds = -1, d.plugins = [], d._poll = null, d.message = r.message, d.messageType = Ln.USER, d.translations = (o = r.translations) !== null && o !== void 0 ? o : {}, d.translationTargetLanguages = (s = r.target_langs) !== null && s !== void 0 ? s : [], Object.keys(d.translations).length === 0 && d.translationTargetLanguages.length > 0) - try { - for (var h = Ne(d.translationTargetLanguages), f = h.next(); !f.done; f = h.next()) { - var p = f.value; - d.translations[p] = ""; - } - } catch (m) { - i = { error: m }; - } finally { - try { - f && !f.done && (a = h.return) && a.call(h); - } finally { - if (i) - throw i.error; - } - } - if (d.messageSurvivalSeconds = (c = r.message_survival_seconds) !== null && c !== void 0 ? c : -1, d.plugins = r.plugins ? r.plugins.map(function(m) { - return new pb(m); - }) : [], d._poll = r.poll ? new ra(d._iid, r.poll) : null, r.parent_message_info) { - var v = r.parent_message_info; - d.parentMessage = jr(t, Be(Xe(L(L({}, v), { created_at: v.ts, message_id: d.parentMessageId, channel_url: d.channelUrl, channel_type: d.channelType, file: v.file, url: (l = v.file) === null || l === void 0 ? void 0 : l.url, require_auth: (u = v.file) === null || u === void 0 ? void 0 : u.require_auth })))); - } - return r.review_info && (d.messageReviewInfo = new vb(r.review_info)), d; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { message: t.message, translations: t.translations, message_survival_seconds: t.messageSurvivalSeconds, plugins: t.plugins.map(function(r) { - return pb.payloadify(r); - }), poll: t._poll ? ra.payloadify(t._poll) : null, parent_message_info: t.parentMessage ? e._getParentMessageInfoPayload.call(this, t.parentMessage) : null, review_info: t.messageReviewInfo ? vb.payloadify(t.messageReviewInfo) : void 0 }))); - }, n.prototype.getThreadedMessagesByTimestamp = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, nh), r), ve(this.messageId > 0 && k("number", t) && Qp(i)).throw(H.invalidParameters), [4, tr.of(this._iid).getThreadedMessagesByTimestamp(this, t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n.prototype.applyPoll = function(t) { - return !(this._poll && this._poll.id === t.id && this._poll.updatedAt > t.updatedAt) && (this._poll = t, !0); - }, Object.defineProperty(n.prototype, "poll", { get: function() { - return this._poll; - }, enumerable: !1, configurable: !0 }), n; -}(Vn), Ui = function(e) { - function n(t, r) { - var i, a, o, s, c, l = this; - if ((l = e.call(this, t, r) || this).messageParams = null, l.fileInfoList = [], l.messageSurvivalSeconds = -1, l.messageType = Ln.FILE, l.fileInfoList = (a = (i = r.files) === null || i === void 0 ? void 0 : i.map(function(d) { - return new Gm(t, d); - })) !== null && a !== void 0 ? a : [], l.messageSurvivalSeconds = (o = r.message_survival_seconds) !== null && o !== void 0 ? o : -1, r.parent_message_info) { - var u = r.parent_message_info; - l.parentMessage = jr(t, Be(Xe(L(L({}, u), { created_at: u.ts, message_id: l.parentMessageId, channel_url: l.channelUrl, channel_type: l.channelType, file: u.file, url: (s = u.file) === null || s === void 0 ? void 0 : s.url, require_auth: (c = u.file) === null || c === void 0 ? void 0 : c.require_auth })))); - } - return l; - } - return O(n, e), n.prototype.getThreadedMessagesByTimestamp = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, nh), r), ve(this.messageId > 0 && k("number", t) && Qp(i)).throw(H.invalidParameters), [4, tr.of(this._iid).getThreadedMessagesByTimestamp(this, t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { files: Array.isArray(t.fileInfoList) ? t.fileInfoList.map(function(r) { - return Gm.payloadify(r); - }) : null, message_survival_seconds: t.messageSurvivalSeconds, parent_message_info: t.parentMessage ? e._getParentMessageInfoPayload.call(this, t.parentMessage) : null }))); - }, n._isMultipleFilesMessagePayload = function(t) { - var r = t.files; - return Array.isArray(r) && r.length >= 2; - }, n._isMultipleFilesMessageSerializedData = function(t) { - var r = t.fileInfoList; - return Array.isArray(r); - }, n; -}(Vn); -(function(e) { - e.SENT = "SENT", e.READ = "READ"; -})(il || (il = {})); -var Al = function(e) { - function n(t, r) { - var i, a, o = this; - if ((o = e.call(this, t, r) || this).notificationData = null, o.notificationId = r.notification_message_id, o.messageType = Ln.ADMIN, o.messageStatus = (i = r.message_status) !== null && i !== void 0 ? i : il.SENT, o.priority = (a = r.priority) !== null && a !== void 0 ? a : Dm.NORMAL, o.extendedMessage.sub_type === 0) - try { - var s = JSON.parse(o.extendedMessage.sub_data), c = s.label, l = s.tags, u = l === void 0 ? [] : l, d = s.template_key, h = s.template_variables; - o.notificationData = { label: c, tags: u, templateKey: d, templateVariables: h }; - } catch { - } - return o; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { notification_message_id: t.notificationId, message_status: t.messageStatus, priority: t.priority }))); - }, n.prototype.isIdentical = function(t) { - return this.notificationId === t.notificationId; - }, n; -}(fA), mb = function(e) { - if (e.notificationId) - return Al.payloadify(e); - switch (e.messageType) { - case Ln.USER: - return Ar.payloadify(e); - case Ln.FILE: - return e.fileInfoList ? Ui.payloadify(e) : qn.payloadify(e); - case Ln.ADMIN: - return Oc.payloadify(e); - default: - throw H.unknown; - } -}, jr = function(e, n) { - if (n.notification_message_id) - return new Al(e, n); - switch (n.type) { - case "MESG": - return new Ar(e, n); - case "FILE": - return Ui._isMultipleFilesMessagePayload(n) ? new Ui(e, n) : new qn(e, n); - case "ADMM": - case "BRDM": - return new Oc(e, n); - default: - return null; - } -}, qn = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d, h, f, p, v, m, E, y = this; - (y = e.call(this, t, r) || this).messageParams = null, y.plainUrl = "", y.requireAuth = !1, y.thumbnails = [], y.messageSurvivalSeconds = -1, y.messageType = Ln.FILE; - var _ = r.file; - if (y.plainUrl = ((a = (i = _ == null ? void 0 : _.url) !== null && i !== void 0 ? i : r.url) !== null && a !== void 0 ? a : "").split("?auth=")[0], y.name = (s = (o = _ == null ? void 0 : _.name) !== null && o !== void 0 ? o : r.name) !== null && s !== void 0 ? s : "File", y.size = (l = (c = _ == null ? void 0 : _.size) !== null && c !== void 0 ? c : r.size) !== null && l !== void 0 ? l : 0, y.data = (d = (u = _ == null ? void 0 : _.data) !== null && u !== void 0 ? u : r.custom) !== null && d !== void 0 ? d : "", y.type = _ ? (h = _.type) !== null && h !== void 0 ? h : "" : (f = r.type) !== null && f !== void 0 ? f : "", y.requireAuth = (p = r.require_auth) !== null && p !== void 0 && p, y.thumbnails = r.thumbnails ? r.thumbnails.map(function(b) { - var A; - return new Uo(y._iid, typeof b == "string" ? { url: b, width: 0, height: 0 } : L(L({}, b), { url: ((A = b.url) !== null && A !== void 0 ? A : "").split("auth=")[0] }), y.requireAuth); - }) : [], y.messageSurvivalSeconds = (v = r.message_survival_seconds) !== null && v !== void 0 ? v : -1, r.parent_message_info) { - var S = r.parent_message_info; - y.parentMessage = jr(t, Be(Xe(L(L({}, S), { created_at: S.ts, message_id: y.parentMessageId, channel_url: y.channelUrl, channel_type: y.channelType, file: S.file, url: (m = S.file) === null || m === void 0 ? void 0 : m.url, require_auth: (E = S.file) === null || E === void 0 ? void 0 : E.require_auth })))); - } - return y; - } - return O(n, e), n.payloadify = function(t) { - var r; - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { url: t.plainUrl, require_auth: t.requireAuth, file: { name: t.name, size: t.size, type: t.type, data: t.data }, thumbnails: (r = t.thumbnails) === null || r === void 0 ? void 0 : r.map(function(i) { - return { url: i.plainUrl, width: i.width, height: i.height, real_width: i.realWidth, real_height: i.realHeight }; - }), message_survival_seconds: t.messageSurvivalSeconds, parent_message_info: t.parentMessage ? e._getParentMessageInfoPayload.call(this, t.parentMessage) : null }))); - }, Object.defineProperty(n.prototype, "url", { get: function() { - var t = U.of(this._iid).sessionManager; - return this.requireAuth && t.ekey ? "".concat(this.plainUrl, "?auth=").concat(t.ekey) : this.plainUrl; - }, enumerable: !1, configurable: !0 }), n.prototype.getThreadedMessagesByTimestamp = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, nh), r), ve(this.messageId > 0 && k("number", t) && Qp(i)).throw(H.invalidParameters), [4, tr.of(this._iid).getThreadedMessagesByTimestamp(this, t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n; -}(Vn), op = function(e) { - function n(t, r) { - var i = r.file, a = r.fileUrl, o = r.fileName, s = r.fileSize, c = r.mimeType, l = r.thumbnailSizes, u = r._uploadedMetaData, d = r._thumbnails, h = e.call(this, t) || this; - return h._plainUrl = a, h.file = i, h.fileName = o, h.fileSize = s, h.mimeType = c, h.thumbnailSizes = l, h._uploadedMetaData = u, h._thumbnails = d, h; - } - return O(n, e), n.getPlainUrl = function(t) { - return t instanceof n ? t._plainUrl : t.fileUrl; - }, Object.defineProperty(n.prototype, "fileUrl", { get: function() { - var t, r = U.of(this._iid).sessionManager; - return this._plainUrl && (!((t = this._uploadedMetaData) === null || t === void 0) && t.requireAuth) && r.ekey ? "".concat(this._plainUrl, "?auth=").concat(r.ekey) : this._plainUrl; - }, set: function(t) { - this._plainUrl = t; - }, enumerable: !1, configurable: !0 }), n.prototype.toJSON = function() { - return { file: this.file, fileUrl: this._plainUrl, fileName: this.fileName, fileSize: this.fileSize, mimeType: this.mimeType, thumbnailSizes: this.thumbnailSizes, _thumbnails: this._thumbnails, _uploadedMetaData: this._uploadedMetaData }; - }, n; -}(br), vD = function(e) { - function n(t) { - var r, i, a, o, s = []; - return t.mentionType === Or.USERS && (t.mentionedUserIds ? s = t.mentionedUserIds : t.mentionedUsers && (s = t.mentionedUsers.map(function(c) { - return c.userId; - }))), e.call(this, { code: "FILE", ackRequired: !0, payload: Be(Xe({ channel_url: t.channelUrl, files: t.files ? yA(t.files) : null, url: t.url, name: (r = t.fileName) !== null && r !== void 0 ? r : "", type: (i = t.mimeType) !== null && i !== void 0 ? i : "", size: (a = t.fileSize) !== null && a !== void 0 ? a : 0, custom: t.data, custom_type: t.customType, thumbnails: (o = t._thumbnails) === null || o === void 0 ? void 0 : o.map(function(c) { - return Uo.payloadify(c); - }), require_auth: t.requireAuth, metaarray: t.metaArrays, mention_type: t.mentionType, mentioned_user_ids: s, push_option: t.pushNotificationDeliveryOption && t.pushNotificationDeliveryOption !== Ca.DEFAULT ? t.pushNotificationDeliveryOption : void 0, apple_critical_alert_options: t.appleCriticalAlertOptions ? ia.payloadify(t.appleCriticalAlertOptions) : null, silent: t.silent, reply_to_channel: t.isReplyToChannel, parent_message_id: t.parentMessageId ? t.parentMessageId : null, req_id: t.reqId, pin_message: t.isPinnedMessage })) }) || this; - } - return O(n, e), n; -}(Ir), mD = function(e) { - function n(t) { - var r, i, a = this; - a = e.call(this) || this; - var o = []; - return t.mentionType === Or.USERS && (t.mentionedUserIds ? o = t.mentionedUserIds : t.mentionedUsers && (o = t.mentionedUsers.map(function(s) { - return s.userId; - }))), a.method = pe.POST, a.path = "".concat(Kt(t.channelType), "/").concat(encodeURIComponent(t.channelUrl), "/messages"), a.params = Be(Xe({ message_type: Ln.FILE, user_id: t.userId, files: t.files ? yA(t.files) : null, url: t.fileUrl, mention_type: t.mentionType, mentioned_user_ids: o, file_name: t.fileName, file_size: t.fileSize, file_type: t.mimeType, data: t.data, custom_type: t.customType, thumbnails: (r = t._thumbnails) === null || r === void 0 ? void 0 : r.map(function(s) { - return Uo.payloadify(s); - }), require_auth: t.requireAuth, sorted_metaarray: (i = t.metaArrays) === null || i === void 0 ? void 0 : i.map(function(s) { - return Br.payloadify(s); - }), push_option: t.pushNotificationDeliveryOption, parent_message_id: t.parentMessageId ? t.parentMessageId : null, apple_critical_alert_options: t.appleCriticalAlertOptions ? ia.payloadify(t.appleCriticalAlertOptions) : null, reply_to_channel: t.isReplyToChannel, req_id: t.reqId, pin_message: t.isPinnedMessage })), a; - } - return O(n, e), n; -}(ge), O1 = function(e) { - function n(t, r, i) { - var a, o, s, c, l = this; - (l = e.call(this, t, "FILE", i) || this).message = i.files && i.files.length >= 2 ? new Ui(t, i) : new qn(t, i); - var u = U.of(t).sdkState; - return l.isMentioned = wc(l.message.mentionType, (s = (a = l.message.mentionedUserIds) !== null && a !== void 0 ? a : (o = l.message.mentionedUsers) === null || o === void 0 ? void 0 : o.map(function(d) { - return d.userId; - })) !== null && s !== void 0 ? s : [], u.userId), l.forceUpdateLastMessage = (c = i.force_update_last_message) !== null && c !== void 0 && c, l; - } - return O(n, e), n; -}(En), gD = function(e) { - function n(t, r) { - var i, a, o, s, c = this; - (c = e.call(this, t, r) || this).message = r.files && r.files.length >= 2 ? new Ui(t, r) : new qn(t, r); - var l = U.of(t).sdkState; - return c.isMentioned = wc(c.message.mentionType, (o = (i = c.message.mentionedUserIds) !== null && i !== void 0 ? i : (a = c.message.mentionedUsers) === null || a === void 0 ? void 0 : a.map(function(u) { - return u.userId; - })) !== null && o !== void 0 ? o : [], l.userId), c.forceUpdateLastMessage = (s = r.force_update_last_message) !== null && s !== void 0 && s, c; - } - return O(n, e), n; -}(_e); -function yA(e) { - return e.map(function(n) { - var t, r; - return Be(Xe({ url: op.getPlainUrl(n), file_name: n.fileName, file_type: n.mimeType, file_size: n.fileSize, thumbnails: (t = n._thumbnails) === null || t === void 0 ? void 0 : t.map(function(i) { - return Uo.payloadify(i); - }), require_auth: (r = n._uploadedMetaData) === null || r === void 0 ? void 0 : r.requireAuth })); - }); -} -var or; -(function(e) { - e[e.PENDING = 0] = "PENDING", e[e.UPLOADING = 1] = "UPLOADING", e[e.UPLOADED = 2] = "UPLOADED", e[e.SENDING = 3] = "SENDING", e[e.FAILED = 4] = "FAILED"; -})(or || (or = {})); -var yD = function() { - function e(n, t) { - var r = t.sdkState, i = t.dispatcher, a = t.requestQueue, o = t.onlineDetector, s = t.cacheContext, c = this; - this._queueMap = /* @__PURE__ */ new Map(), this._iid = n, this._sdkState = r, this._requestQueue = a, this._cacheContext = s, this._dispatcher = i, this._dispatcher.on(function(l) { - l instanceof bi && (c._connectionState = l.stateType); - }), this._onlineDetector = o; - } - return Object.defineProperty(e.prototype, "_shouldSendThroughWebSocket", { get: function() { - return this._connectionState === tn.CONNECTED || this._connectionState === tn.CONNECTING || this._connectionState === tn.RECONNECTING; - }, enumerable: !1, configurable: !0 }), e.prototype._sendFileMessage = function(n, t) { - return T(this, void 0, void 0, function() { - var r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return r = this._createSendFileMessageRequestParams(n, t), this._shouldSendThroughWebSocket ? (i = new vD(r), [4, this._requestQueue.send(i)]) : [3, 2]; - case 1: - return a = o.sent(), [2, a.as(O1).message]; - case 2: - return i = new mD(L(L({}, r), { userId: this._sdkState.userId })), [4, this._requestQueue.send(i)]; - case 3: - return a = o.sent(), [2, a.as(gD).message]; - } - }); - }); - }, e.prototype._createSendFileMessageRequestParams = function(n, t) { - var r = L(L({}, t.params), { channelUrl: n.url, channelType: n.channelType, reqId: t.requestId, url: "" }); - if (t.multipleFileUploadInfo) { - var i = t.params; - r.files = i.fileInfoList; - } else - i = t.params, r.url = i.fileUrl, r.requireAuth = i.requireAuth; - return r; - }, e.prototype._resolveMessageQueue = function(n) { - var t; - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u, d, h, f, p, v; - return C(this, function(m) { - switch (m.label) { - case 0: - if (!(r = this._queueMap.get(n.url))) - return [3, 21]; - if (r.isResolving) - return [3, 20]; - r.isResolving = !0, i = [], a = !0, m.label = 1; - case 1: - m.trys.push([1, 15, 16, 17]), o = Ne(r.messageQueue), s = o.next(), m.label = 2; - case 2: - if (s.done) - return [3, 14]; - switch (c = s.value, c.state) { - case or.PENDING: - case or.UPLOADING: - return [3, 3]; - case or.UPLOADED: - return [3, 4]; - case or.FAILED: - return [3, 12]; - } - return [3, 13]; - case 3: - return a = !1, i.push(c), [3, 13]; - case 4: - if (!a) - return [3, 10]; - m.label = 5; - case 5: - return m.trys.push([5, 8, , 9]), c.state = or.SENDING, [4, this._sendFileMessage(n, c)]; - case 6: - return l = m.sent(), c.deferred.resolve(l), [4, Mi(100)]; - case 7: - return m.sent(), [3, 9]; - case 8: - return u = m.sent(), c.deferred.reject(u), [3, 9]; - case 9: - return [3, 11]; - case 10: - i.push(c), m.label = 11; - case 11: - return [3, 13]; - case 12: - return d = (t = c.error) !== null && t !== void 0 ? t : H.unknown, c.deferred.reject(d.code === nt.REQUEST_CANCELED ? H.fileUploadCanceled : d), [3, 13]; - case 13: - return s = o.next(), [3, 2]; - case 14: - return [3, 17]; - case 15: - return h = m.sent(), p = { error: h }, [3, 17]; - case 16: - try { - s && !s.done && (v = o.return) && v.call(o); - } finally { - if (p) - throw p.error; - } - return [7]; - case 17: - return f = r.isResolveRequestPending, r.messageQueue = i, r.isResolving = !1, r.isResolveRequestPending = !1, f ? [4, this._resolveMessageQueue(n)] : [3, 19]; - case 18: - m.sent(), m.label = 19; - case 19: - return [3, 21]; - case 20: - r.isResolveRequestPending = !0, m.label = 21; - case 21: - return [2]; - } - }); - }); - }, e.prototype._uploadNextPendingItem = function(n) { - var t; - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u, d, h; - return C(this, function(f) { - switch (f.label) { - case 0: - return (r = this._queueMap.get(n.url)) && (i = r.messageQueue.find(function(p) { - return p.state === or.PENDING; - })) ? i.multipleFileUploadInfo ? (a = i.multipleFileUploadInfo, o = a.uploadIndex, s = a.uploadCount, c = a.requestHandler, h = i.params, l = h.fileInfoList[o], !fr(l.file) || !((t = l._uploadedMetaData) === null || t === void 0) && t.isUploaded ? [3, 2] : [4, this._tryUploadNextItemAndUpdateItemState(n, r, i)]) : [3, 4] : [3, 9]; - case 1: - return f.sent(), [3, 3]; - case 2: - i.state = o < s - 1 ? or.PENDING : or.UPLOADED, f.label = 3; - case 3: - return u = h.fileInfoList[o], d = i.multipleFileUploadInfo.uploadIndex++, i.multipleFileUploadInfo.isCopy || c == null || c._triggerOnFileUploaded(i.requestId, d, u, i.error), [3, 7]; - case 4: - return h = i.params, fr(h.file) ? [4, this._tryUploadNextItemAndUpdateItemState(n, r, i)] : [3, 6]; - case 5: - return f.sent(), [3, 7]; - case 6: - h.thumbnailSizes = [], i.state = or.UPLOADED, f.label = 7; - case 7: - return this._uploadNextPendingItem(n), [4, this._resolveMessageQueue(n)]; - case 8: - f.sent(), f.label = 9; - case 9: - return [2]; - } - }); - }); - }, e.prototype._tryUploadNextItemAndUpdateItemState = function(n, t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return [4, this._onlineDetector.isOnline()]; - case 1: - if (i = u.sent(), !U.of(this._iid).sessionManager.currentUser || !i) - return r.error = H.connectionRequired, r.state = or.FAILED, [2]; - if (!(t.uploadQueue.length < 6)) - return [3, 9]; - r.state = or.UPLOADING, t.uploadQueue.push(r), u.label = 2; - case 2: - return u.trys.push([2, 7, , 8]), r.multipleFileUploadInfo ? (a = r.multipleFileUploadInfo, o = a.uploadIndex, s = a.uploadCount, c = r.params, [4, this._uploadNextFileForMultipleFilesItemAndUpdateParams(n, r, c)]) : [3, 4]; - case 3: - return u.sent(), r.state = o < s - 1 ? or.PENDING : or.UPLOADED, [3, 6]; - case 4: - return c = r.params, [4, this._uploadNextFileForSingleFileItemAndUpdateParams(n, r, c)]; - case 5: - u.sent(), r.state = or.UPLOADED, u.label = 6; - case 6: - return [3, 8]; - case 7: - switch ((l = u.sent()).code) { - case nt.REQUEST_FAILED: - r.error = new H({ code: nt.NETWORK_ERROR, message: "Failed to upload a file." }); - break; - case nt.REQUEST_CANCELED: - r.error = H.fileUploadCanceled; - break; - default: - r.error = l; - } - return r.state = or.FAILED, [3, 8]; - case 8: - this._dequeueUploadItem(t, r), u.label = 9; - case 9: - return [2]; - } - }); - }); - }, e.prototype._dequeueUploadItem = function(n, t) { - var r = n.uploadQueue.findIndex(function(i) { - return i.requestId === t.requestId; - }); - r >= 0 && n.uploadQueue.splice(r, 1); - }, e.prototype._uploadNextFileForSingleFileItemAndUpdateParams = function(n, t, r) { - var i, a, o; - return T(this, void 0, void 0, function() { - var s, c, l, u, d, h, f, p, v, m; - return C(this, function(E) { - switch (E.label) { - case 0: - return s = new rp({ file: r.file, channelUrl: n.url, thumbnailSizes: r.thumbnailSizes, requestId: t.requestId }), [4, this._requestQueue.send(s)]; - case 1: - return c = E.sent(), l = c.as(ip), u = l.url, d = l.fileSize, h = d === void 0 ? r.fileSize : d, f = l.thumbnails, p = f === void 0 ? [] : f, v = l.requireAuth, m = v !== void 0 && v, r.fileName = (i = r.fileName) !== null && i !== void 0 ? i : r.file.name, r.mimeType = (a = r.mimeType) !== null && a !== void 0 ? a : r.file.type, r.fileSize = (o = r.fileSize) !== null && o !== void 0 ? o : r.file.size, r.fileUrl = u, r.fileSize = h, r.requireAuth = m, r._thumbnails = p, [2]; - } - }); - }); - }, e.prototype._uploadNextFileForMultipleFilesItemAndUpdateParams = function(n, t, r) { - var i, a, o; - return T(this, void 0, void 0, function() { - var s, c, l, u, d, h, f, p, v, m, E; - return C(this, function(y) { - switch (y.label) { - case 0: - return s = t.multipleFileUploadInfo.uploadIndex, c = r.fileInfoList[s], l = new rp({ file: c.file, channelUrl: n.url, thumbnailSizes: c.thumbnailSizes, requestId: t.requestId }), [4, this._requestQueue.send(l)]; - case 1: - return u = y.sent(), d = u.as(ip), h = d.url, f = d.fileSize, p = f === void 0 ? c.fileSize : f, v = d.thumbnails, m = d.requireAuth, E = m !== void 0 && m, c.fileName = (i = c.fileName) !== null && i !== void 0 ? i : c.file.name, c.mimeType = (a = c.mimeType) !== null && a !== void 0 ? a : c.file.type, c.fileSize = (o = c.fileSize) !== null && o !== void 0 ? o : c.file.size, c.file = void 0, c.fileUrl = h, c.fileSize = p, c._thumbnails = v, c._uploadedMetaData = L(L({}, c._uploadedMetaData), { requireAuth: E, isUploaded: !0 }), c instanceof op || (r.fileInfoList[s] = new op(this._iid, c)), [2]; - } - }); - }); - }, e.prototype.request = function(n, t, r, i) { - return i === void 0 && (i = {}), T(this, void 0, void 0, function() { - var a, o, s, c, l; - return C(this, function(u) { - return this._queueMap.has(n.url) || (a = { messageQueue: [], uploadQueue: [], isResolving: !1, isResolveRequestPending: !1 }, this._queueMap.set(n.url, a)), o = this._queueMap.get(n.url), s = new Kr(), c = { requestId: t, params: r, state: or.PENDING, deferred: s }, function(d) { - return "fileInfoList" in d; - }(r) && (l = L({ uploadIndex: 0, uploadCount: r.fileInfoList.length }, i), c.multipleFileUploadInfo = l), o.messageQueue.push(c), this._uploadNextPendingItem(n), [2, s.promise]; - }); - }); - }, e.prototype.cancel = function(n, t) { - var r, i, a = this._queueMap.get(n.url); - if (a) { - var o = t ? [a.messageQueue.find(function(p) { - return p.requestId === t; - })] : dt([], tt(a.messageQueue), !1); - try { - for (var s = Ne(o), c = s.next(); !c.done; c = s.next()) { - var l = c.value; - if (l) - switch (l.state) { - case or.PENDING: - if (l.state = or.FAILED, l.error = H.requestCanceled, l.multipleFileUploadInfo && !l.multipleFileUploadInfo.isCopy) { - var u = l.multipleFileUploadInfo, d = u.uploadIndex, h = u.requestHandler, f = l.params.fileInfoList[d]; - h == null || h._triggerOnFileUploaded(l.requestId, d, f, H.fileUploadCanceled); - } - this._resolveMessageQueue(n); - break; - case or.UPLOADING: - this._requestQueue.cancel(l.requestId), this._dispatcher.dispatch(new Qf({ requestId: l.requestId })); - } - } - } catch (p) { - r = { error: p }; - } finally { - try { - c && !c.done && (i = s.return) && i.call(s); - } finally { - if (r) - throw r.error; - } - } - } else - t && (this._requestQueue.cancel(t), this._dispatcher.dispatch(new Qf({ requestId: t }))); - }, e; -}(), zm, Yu = { prevResultSize: 0, nextResultSize: 0, isInclusive: !1, reverse: !1, messageTypeFilter: Nr.ALL, customTypesFilter: void 0, senderUserIdsFilter: void 0, replyType: ir.NONE, includeReactions: !1, includeMetaArray: !1, includeParentMessageInfo: !1, includeThreadInfo: !1, showSubchannelMessagesOnly: !1 }, gb = function(e) { - return k("number", e.prevResultSize) && k("number", e.nextResultSize) && k("boolean", e.isInclusive) && k("boolean", e.reverse) && k("string", e.messageTypeFilter) && Mt(Nr, e.messageTypeFilter) && Ot("string", e.customTypesFilter, !0) && Ot("string", e.senderUserIdsFilter, !0) && Mt(ir, e.replyType) && k("boolean", e.includeMetaArray) && k("boolean", e.includeReactions) && k("boolean", e.includeParentMessageInfo) && k("boolean", e.includeThreadInfo) && k("boolean", e.showSubchannelMessagesOnly); -}, qm = { replyType: ir.NONE, includeReactions: !1, includeThreadInfo: !1, includeMetaArray: !1, includeParentMessageInfo: !1 }, yb = function(e) { - return Mt(ir, e.replyType) && k("boolean", e.includeReactions) && k("boolean", e.includeMetaArray) && k("boolean", e.includeParentMessageInfo) && k("boolean", e.includeThreadInfo); -}, ED = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = t.includeMetaArray, s = t.includeReactions, c = t.includeThreadInfo, l = t.includeParentMessageInfo, u = e.call(this) || this; - return u.method = pe.GET, u.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(encodeURIComponent(a)), u.params = { is_sdk: !0, with_sorted_meta_array: o, include_reactions: s, include_thread_info: c, include_parent_message_info: l, include_poll_details: !0 }, u; - } - return O(n, e), n; -}(ge), _D = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.message = r ? jr(t, L({}, r)) : null, i; - } - return O(n, e), n; -}(_e), qh = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.timestamp, o = t.token, s = t.prevResultSize, c = t.nextResultSize, l = t.isInclusive, u = t.reverse, d = t.messageTypeFilter, h = t.customTypesFilter, f = t.senderUserIdsFilter, p = t.replyType, v = t.includeMetaArray, m = t.includeReactions, E = t.parentMessageId, y = t.includeThreadInfo, _ = t.includeParentMessageInfo, S = t.showSubchannelMessagesOnly, b = t.checkingHasNext, A = t.checkingContinuousMessages, w = e.call(this) || this; - return w.method = pe.GET, w.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages"), w.params = Be(Xe({ is_sdk: !0, prev_limit: s, next_limit: c, include: l, reverse: u, message_ts: a, message_id: o, message_type: d ?? null, custom_types: h, sender_ids: f, include_reply_type: p, with_sorted_meta_array: v, include_reactions: m, parent_message_id: E, include_thread_info: y, include_parent_message_info: _, show_subchannel_message_only: S, include_poll_details: !0, checking_has_next: b, checking_continuous_messages: A })), w; - } - return O(n, e), n; -}(ge), Kh = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return r.is_continuous_messages !== void 0 && (i.isContinuousMessages = r.is_continuous_messages), r.has_next !== void 0 && (i.hasNext = r.has_next), i.messages = r.messages.map(function(a) { - return jr(t, a); - }), i; - } - return O(n, e), n; -}(_e), bD = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.timestamp, o = t.token, s = t.replyType, c = t.includeMetaArray, l = t.includeReactions, u = t.includeThreadInfo, d = t.includeParentMessageInfo, h = e.call(this) || this; - return h.method = pe.GET, h.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/changelogs"), h.params = { change_ts: a, token: o, with_sorted_meta_array: c, include_reactions: l, include_thread_info: u, include_reply_type: s, include_parent_message_info: d, include_poll_details: !0 }, h; - } - return O(n, e), n; -}(ge), CD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.updatedMessages = r.updated.map(function(a) { - return jr(t, a); - }), i.deletedMessagesInfo = r.deleted.map(function(a) { - return { messageId: a.message_id, deletedAt: a.deleted_at }; - }), i.hasMore = r.has_more, i.nextToken = r.next, i; - } - return O(n, e), n; -}(_e), TD = function(e) { - function n(t) { - var r = t.channelUrl, i = t.scheduledMessageId, a = e.call(this) || this; - return a.method = pe.GET, a.path = "".concat(xr, "/").concat(encodeURIComponent(r), "/scheduled_messages/").concat(encodeURIComponent(i)), a.params = {}, a; - } - return O(n, e), n; -}(ge), SD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.message = r ? jr(t, L({}, r)) : null, i; - } - return O(n, e), n; -}(_e); -(function(e) { - e.MUTED = "muted", e.BANNED = "banned"; -})(zm || (zm = {})); -var Eb = function() { - function e(n) { - var t, r, i, a; - this.restrictionType = null, Mt(zm, n.restriction_type) && (this.restrictionType = n.restriction_type), this.description = (t = n.description) !== null && t !== void 0 ? t : null, this.endAt = (i = (r = n.end_at) !== null && r !== void 0 ? r : n.muted_end_at) !== null && i !== void 0 ? i : -1, this.remainingDuration = (a = n.remaining_duration) !== null && a !== void 0 ? a : -1; - } - return e.payloadify = function(n) { - return Be(Xe({ restriction_type: n.restrictionType, description: n.description, end_at: n.endAt, remaining_duration: n.remainingDuration })); - }, e; -}(), Ul = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.restrictionInfo = new Eb(r), i; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), Eb.payloadify(t.restrictionInfo)))); - }, n; -}(Dt), wD = function(e) { - function n(t, r) { - var i, a = this; - return (a = e.call(this, t, r) || this).isMuted = !1, a.isMuted = (i = r.is_muted) !== null && i !== void 0 && i, a; - } - return O(n, e), n; -}(Dt), di = function() { - function e() { - this._onPending = bt, this._onFailed = bt, this._onSucceeded = bt; - } - return e.prototype._trigger = function(n) { - switch (n == null ? void 0 : n.sendingStatus) { - case $t.PENDING: - n.errorCode === 0 && this._onPending(n); - break; - case $t.SCHEDULED: - case $t.SUCCEEDED: - this._onSucceeded(n); - } - }, e.prototype._triggerFailed = function(n, t) { - switch (t == null ? void 0 : t.sendingStatus) { - case $t.FAILED: - case $t.CANCELED: - this._onFailed(n, t.scheduledInfo ? null : t); - } - }, e.prototype.onPending = function(n) { - return this._onPending = n, this; - }, e.prototype.onFailed = function(n) { - return this._onFailed = n, this; - }, e.prototype.onSucceeded = function(n) { - return this._onSucceeded = n, this; - }, e; -}(), Xp = { data: void 0, customType: void 0, mentionType: Or.USERS, mentionedUserIds: void 0, mentionedUsers: void 0, mentionedMessageTemplate: void 0, metaArrays: void 0, parentMessageId: void 0, isReplyToChannel: !1, pushNotificationDeliveryOption: void 0, appleCriticalAlertOptions: void 0, isPinnedMessage: !1 }, Jp = function(e) { - return k("string", e.data, !0) && k("string", e.customType, !0) && Mt(Or, e.mentionType) && Ot("string", e.mentionedUserIds, !0) && Ot(Dt, e.mentionedUsers, !0) && k("string", e.mentionedMessageTemplate, !0) && Ot(Br, e.metaArrays, !0) && k("number", e.parentMessageId, !0) && k("boolean", e.isReplyToChannel) && Mt(Ca, e.pushNotificationDeliveryOption, !0) && k(ia, e.appleCriticalAlertOptions, !0) && k("boolean", e.isPinnedMessage, !0); -}, _b = function(e) { - return { isReplyToChannel: e.isReplyToChannel, pushNotificationDeliveryOption: e.pushNotificationDeliveryOption, pollId: e.pollId }; -}, EA = L(L({}, Xp), { message: "", translationTargetLanguages: void 0, pollId: void 0, extendedMessagePayload: void 0 }); -function _A(e) { - var n, t, r; - return (n = e.messageParams) !== null && n !== void 0 ? n : Xe(L(L({}, e), { mentionType: e.mentionType, mentionedUserIds: (t = e.mentionedUserIds) !== null && t !== void 0 ? t : (r = e.mentionedUsers) === null || r === void 0 ? void 0 : r.map(function(i) { - return i.userId; - }), translationTargetLanguages: Object.keys(e.translations), pushNotificationDeliveryOption: Ca.DEFAULT, parentMessageId: null, isReplyToChannel: !1, isPinnedMessage: !1 })); -} -var El, Km = function(e) { - var n; - return Be(Xe({ data: e.data, customType: e.customType, mentionType: e.mentionType, mentionedUsers: e.mentionedUsers, mentionedUserIds: e.mentionedUserIds, mentionedMessageTemplate: e.mentionedMessageTemplate, metaArrays: e.metaArrays, pollId: (n = e.poll) === null || n === void 0 ? void 0 : n.id, parentMessageId: e.parentMessageId, appleCriticalAlertOptions: e.appleCriticalAlertOptions, message: e.message, translationTargetLanguages: Object.keys(e.translations), extendedMessagePayload: e.extendedMessagePayload })); -}, bA = function(e) { - return Jp(e) && k("string", e.message) && Ot("string", e.translationTargetLanguages, !0) && k("number", e.pollId, !0) && k("object", e.extendedMessagePayload, !0); -}; -(function(e) { - e.FILE = "file", e.BLOB = "blob", e.BLOB_LIKE_OBJECT = "blobLikeObject", e.URL = "url"; -})(El || (El = {})); -var Af = function(e) { - return typeof window < "u" && "Blob" in window && typeof Blob < "u" && e instanceof Blob; -}, f0 = function(e) { - return e === El.BLOB || e === El.FILE; -}, bb = function(e) { - return { file: e.file, fileKey: e.fileKey, fileType: e.fileType, isReplyToChannel: e.isReplyToChannel, pushNotificationDeliveryOption: e.pushNotificationDeliveryOption }; -}, Cb = L(L({}, Xp), { file: void 0, fileKey: void 0, fileUrl: void 0, fileName: void 0, fileType: void 0, fileSize: void 0, mimeType: void 0, thumbnailSizes: void 0, requireAuth: !1 }); -function CA(e) { - var n, t, r, i; - return (n = e.messageParams) !== null && n !== void 0 ? n : Xe(L(L({}, e), { fileUrl: e.plainUrl, fileName: e.name, fileSize: e.size, mimeType: e.type, mentionType: e.mentionType, mentionedUserIds: (t = e.mentionedUserIds) !== null && t !== void 0 ? t : (r = e.mentionedUsers) === null || r === void 0 ? void 0 : r.map(function(a) { - return a.userId; - }), pushNotificationDeliveryOption: Ca.DEFAULT, parentMessageId: null, isReplyToChannel: !1, thumbnailSizes: (i = e.thumbnails) === null || i === void 0 ? void 0 : i.map(function(a) { - return { maxWidth: a.width, maxHeight: a.height }; - }), requireAuth: e.requireAuth, isPinnedMessage: !1, _thumbnails: e.thumbnails })); -} -var Zu, Wm = function(e, n) { - var t; - return e.messageParams ? (!e.url && fr(n) && (e.messageParams.file = n), e.messageParams) : Be(Xe({ data: e.data, customType: e.customType, mentionType: e.mentionType, mentionedUsers: e.mentionedUsers, mentionedUserIds: e.mentionedUserIds, metaArrays: e.metaArrays, parentMessageId: e.parentMessageId, appleCriticalAlertOptions: e.appleCriticalAlertOptions, file: n, fileUrl: e.url, fileName: e.name, fileSize: e.size, mimeType: e.type, thumbnailSizes: (t = e.thumbnails) === null || t === void 0 ? void 0 : t.map(function(r) { - return { maxWidth: r.width, maxHeight: r.height }; - }) })); -}, Tb = function(e) { - return Jp(e) && (fr(e.file) || k("string", e.fileUrl)) && k("string", e.fileName, !0) && k("string", e.mimeType, !0) && k("number", e.fileSize, !0) && (e.thumbnailSizes === null || e.thumbnailSizes === void 0 || Array.isArray(e.thumbnailSizes) && e.thumbnailSizes.every(function(n) { - return k("object", n) && n.maxWidth > 0 && n.maxHeight > 0; - })); -}, x1 = { data: void 0, customType: void 0, mentionType: Or.USERS, mentionedUserIds: void 0, mentionedUsers: void 0, mentionedMessageTemplate: void 0, metaArrays: void 0, pushNotificationDeliveryOption: void 0, appleCriticalAlertOptions: void 0 }, R1 = function(e) { - return k("string", e.data, !0) && k("string", e.customType, !0) && Mt(Or, e.mentionType) && Ot("string", e.mentionedUserIds, !0) && Ot(Dt, e.mentionedUsers, !0) && k("string", e.mentionedMessageTemplate, !0) && Ot(Br, e.metaArrays, !0) && Mt(Ca, e.pushNotificationDeliveryOption, !0) && k(ia, e.appleCriticalAlertOptions, !0); -}, TA = L(L({}, x1), { message: void 0, translationTargetLanguages: void 0, pollId: void 0 }), SA = function(e) { - return R1(e) && k("string", e.message, !0) && Ot("string", e.translationTargetLanguages, !0) && k("number", e.pollId, !0); -}, AD = L({}, x1), ND = function(e) { - function n(t) { - var r = t.channelUrl, i = t.channelType, a = t.token, o = t.limit, s = e.call(this) || this; - return s.method = pe.GET, s.path = "".concat(Kt(i), "/").concat(encodeURIComponent(r), "/operators"), s.params = { token: a, limit: o }, s; - } - return O(n, e), n; -}(ge), ID = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.operators = r.operators.map(function(a) { - return new Dt(t, a); - }), i.token = r.next, i; - } - return O(n, e), n; -}(_e), MD = function(e) { - function n(t, r, i, a) { - return e.call(this, t, r, i, a) || this; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : (t = [], this._hasNext ? (this._isLoading = !0, r = U.of(this._iid).requestQueue, i = new ND(L(L({}, this), { channelUrl: this.channelUrl, token: this._token })), [4, r.send(i)]) : [3, 2]) : [3, 5]; - case 1: - return a = l.sent(), o = a.as(ID), s = o.operators, c = o.token, this._token = c, this._hasNext = !!c, this._isLoading = !1, [2, s]; - case 2: - return [2, t]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(io), OD = function(e) { - function n(t, r, i, a) { - var o, s, c, l, u, d, h, f, p, v, m = this; - return (m = e.call(this, t, r, i, a) || this).reverse = !1, m.messageTypeFilter = Nr.ALL, m.customTypesFilter = null, m.senderUserIdsFilter = null, m.replyType = ir.NONE, m.includeMetaArray = !1, m.includeReactions = !1, m.includeParentMessageInfo = !1, m.includeThreadInfo = !1, m.showSubchannelMessagesOnly = !1, m._edge = Number.MAX_SAFE_INTEGER, m.reverse = (o = a.reverse) !== null && o !== void 0 && o, m.messageTypeFilter = (s = a.messageTypeFilter) !== null && s !== void 0 ? s : Nr.ALL, m.customTypesFilter = (c = a.customTypesFilter) !== null && c !== void 0 ? c : null, m.senderUserIdsFilter = (l = a.senderUserIdsFilter) !== null && l !== void 0 ? l : null, m.replyType = (u = a.replyType) !== null && u !== void 0 ? u : ir.NONE, m.includeMetaArray = (d = a.includeMetaArray) !== null && d !== void 0 && d, m.includeReactions = (h = a.includeReactions) !== null && h !== void 0 && h, m.includeParentMessageInfo = (f = a.includeParentMessageInfo) !== null && f !== void 0 && f, m.includeThreadInfo = (p = a.includeThreadInfo) !== null && p !== void 0 && p, m.showSubchannelMessagesOnly = (v = a.showSubchannelMessagesOnly) !== null && v !== void 0 && v, m; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && k("boolean", this.reverse) && Mt(Nr, this.messageTypeFilter) && Mt(ir, this.replyType) && Ot("string", this.customTypesFilter, !0) && Ot("string", this.senderUserIdsFilter, !0) && k("boolean", this.includeMetaArray) && k("boolean", this.includeReactions) && k("boolean", this.includeParentMessageInfo) && k("boolean", this.includeThreadInfo) && k("boolean", this.showSubchannelMessagesOnly); - }, n.prototype.load = function() { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, [4, tr.of(this._iid).getMessagesByTimestamp(this.channelUrl, this.channelType, this._edge, Xe({ prevResultSize: this.limit, nextResultSize: 0, isInclusive: !1, reverse: this.reverse, messageTypeFilter: this.messageTypeFilter, customTypesFilter: this.customTypesFilter, replyType: this.replyType, senderUserIdsFilter: this.senderUserIdsFilter, includeReactions: this.includeReactions, includeMetaArray: this.includeMetaArray, includeParentMessageInfo: this.includeParentMessageInfo, includeThreadInfo: this.includeThreadInfo, showSubchannelMessagesOnly: this.showSubchannelMessagesOnly }))]) : [3, 2] : [3, 5]; - case 1: - return t = r.sent(), this._edge = Math.min.apply(Math, dt([Number.MAX_SAFE_INTEGER], tt(t.map(function(i) { - return i.createdAt; - })), !1)), this._hasNext = t.length >= this.limit, this._isLoading = !1, [2, t]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(io), xD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.limit, s = t.token; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/mute"), r.params = { limit: o, token: s }, r; - } - return O(n, e), n; -}(ge), RD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - i.mutedUsers = []; - var a = r.next, o = r.muted_list; - return i.token = a, o && o.length > 0 && (i.mutedUsers = o.map(function(s) { - return new Ul(t, s); - })), i; - } - return O(n, e), n; -}(_e), DD = function(e) { - function n(t, r, i, a) { - return e.call(this, t, r, i, a) || this; - } - return O(n, e), n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new xD(L(L({}, this), { token: this._token })), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = c.sent(), a = i.as(RD), o = a.mutedUsers, s = a.token, this._token = s, this._hasNext = !!s, this._isLoading = !1, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(io), LD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.limit, s = t.token; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/ban"), r.params = Be({ limit: o, token: s }), r; - } - return O(n, e), n; -}(ge), PD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - i.bannedUsers = []; - var a = r.next, o = r.banned_list; - return i.token = a, o && o.length > 0 && (i.bannedUsers = o.map(function(s) { - return new Ul(t, s.user); - })), i; - } - return O(n, e), n; -}(_e), kD = function(e) { - function n(t, r, i, a) { - return e.call(this, t, r, i, a) || this; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new LD(L(L({}, this), { token: this._token })), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = c.sent(), a = i.as(PD), o = a.bannedUsers, s = a.token, this._token = s, this._hasNext = !!s, this._isLoading = !1, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(io); -(function(e) { - e.SPAM = "spam", e.HARASSING = "harassing", e.SUSPICIOUS = "suspicious", e.INAPPROPRIATE = "inappropriate"; -})(Zu || (Zu = {})); -var UD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.operatorUserIds; - return (r = e.call(this) || this).method = pe.POST, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/operators"), r.params = { operator_ids: o }, r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var FD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.operatorUserIds; - return (r = e.call(this) || this).method = pe.DELETE, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/operators"), r.params = { operator_ids: o }, r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - return e.call(this, t, r) || this; - } - O(n, e); -})(_e); -var BD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.userId; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/mute/").concat(o), r; - } - return O(n, e), n; -}(ge), HD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - i.isMuted = !1, i.startAt = 0, i.endAt = 0; - var a = r.is_muted, o = r.start_at, s = r.end_at, c = r.remaining_duration, l = r.description; - return i.isMuted = a, i.startAt = o, i.endAt = s, i.remainingDuration = c, i.description = l, i; - } - return O(n, e), n; -}(_e), Sb = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.keys; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metadata"), r.params = { keys: o, include_ts: !0 }, r; - } - return O(n, e), n; -}(ge), wb = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this, a = r.metadata, o = r.ts; - return i.metadata = a, i.ts = o, i; - } - return O(n, e), n; -}(_e), jD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.metadata; - return (r = e.call(this) || this).method = pe.POST, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metadata"), r.params = { metadata: o, include_ts: !0 }, r; - } - return O(n, e), n; -}(ge), VD = function(e) { - function n(t, r) { - var i, a, o = this; - return (o = e.call(this, t, r) || this).metaData = (i = r.metadata) !== null && i !== void 0 ? i : {}, o.ts = (a = r.ts) !== null && a !== void 0 ? a : null, o; - } - return O(n, e), n; -}(_e), GD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.metadata, s = t.upsert; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metadata"), r.params = { metadata: o, include_ts: !0, upsert: s != null && s }, r; - } - return O(n, e), n; -}(ge), zD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this, a = r.metadata, o = r.ts; - return i.metadata = a, i.ts = o, i; - } - return O(n, e), n; -}(_e), wA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return i.data && (a.created = i.data.created, a.updated = i.data.updated, a.deleted = i.data.deleted), a; - } - return O(n, e), n; -}(En), qD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.key; - return (r = e.call(this) || this).method = pe.DELETE, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metadata/").concat(o), r.params = { include_ts: !0 }, r; - } - return O(n, e), n; -}(ge), KD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this, a = r.ts; - return i.ts = a, i; - } - return O(n, e), n; -}(_e), WD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType; - return (r = e.call(this) || this).method = pe.DELETE, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metadata"), r.params = { include_ts: !0 }, r; - } - return O(n, e), n; -}(ge), YD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this, a = r.ts; - return i.ts = a, i; - } - return O(n, e), n; -}(_e), Ab = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.keys; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metacounter"), r.params = { keys: o }, r; - } - return O(n, e), n; -}(ge), Nb = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.metaCounter = r, i; - } - return O(n, e), n; -}(_e), ZD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.metaCounter; - return (r = e.call(this) || this).method = pe.POST, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metacounter"), r.params = { metacounter: o }, r; - } - return O(n, e), n; -}(ge), QD = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.metaCounter = r, i; - } - return O(n, e), n; -}(_e), p0 = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.metaCounter, s = t.upsert, c = s !== void 0 && s, l = t.mode, u = l === void 0 ? "set" : l; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metacounter"), r.params = { metacounter: o, upsert: c, mode: u }, r; - } - return O(n, e), n; -}(ge), v0 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.metaCounter = r, i; - } - return O(n, e), n; -}(_e), AA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return i.data && (a.created = i.data.created, a.updated = i.data.updated, a.deleted = i.data.deleted), a; - } - return O(n, e), n; -}(En), XD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.key; - return (r = e.call(this) || this).method = pe.DELETE, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metacounter/").concat(o), r.params = {}, r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - return e.call(this, t, r) || this; - } - O(n, e); -})(_e); -var JD = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType; - return (r = e.call(this) || this).method = pe.DELETE, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/metacounter"), r.params = {}, r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var $D = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.userId, s = t.seconds, c = t.description; - return (r = e.call(this) || this).method = pe.POST, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/mute"), r.params = { user_id: o, seconds: s, description: c }, r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - return e.call(this, t, r) || this; - } - O(n, e); -})(_e); -var NA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return a.user = new Ul(t, i.data), a; - } - return O(n, e), n; -}(En), e5 = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.userId; - return (r = e.call(this) || this).method = pe.DELETE, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/mute/").concat(encodeURIComponent(o)), r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var IA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return a.user = new Ul(t, i.data), a; - } - return O(n, e), n; -}(En), t5 = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.userId, s = t.seconds, c = t.description; - return (r = e.call(this) || this).method = pe.POST, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/ban"), r.params = Be({ user_id: o, seconds: s, description: c }), r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var MA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return a.user = new Ul(t, i.data), i.data.member_count && (a.memberCount = i.data.member_count), i.data.joined_member_count && (a.joinedMemberCount = i.data.joined_member_count), a; - } - return O(n, e), n; -}(En), n5 = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.userId; - return (r = e.call(this) || this).method = pe.DELETE, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/ban/").concat(encodeURIComponent(o)), r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var OA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return a.user = new Ul(t, i.data), a; - } - return O(n, e), n; -}(En), Ib = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.freezing; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(Kt(a), "/").concat(encodeURIComponent(i), "/freeze"), r.params = { freeze: o }, r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var xA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return a.freeze = i.data.freeze, a; - } - return O(n, e), n; -}(En), r5 = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.category, s = t.userId, c = t.description; - return (r = e.call(this) || this).method = pe.POST, r.path = "".concat(Sw(a), "/").concat(encodeURIComponent(i)), r.params = { report_category: o, reporting_user_id: s, report_description: c }, r; - } - return O(n, e), n; -}(ge), i5 = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.category, s = t.userId, c = t.offendingUserId, l = t.description; - return (r = e.call(this) || this).method = pe.POST, r.path = "".concat(Pm, "/users/").concat(c), r.params = { channel_url: i, channel_type: a === Ft.OPEN ? "open_channels" : "group_channels", report_category: o, reporting_user_id: s, report_description: l }, r; - } - return O(n, e), n; -}(ge), a5 = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.channelType, o = t.category, s = t.userId, c = t.offendingUserId, l = t.messageId, u = t.description; - return (r = e.call(this) || this).method = pe.POST, r.path = "".concat(Sw(a), "/").concat(encodeURIComponent(i), "/messages/").concat(l), r.params = { report_category: o, reporting_user_id: s, report_description: u, offending_user_id: c }, r; - } - return O(n, e), n; -}(ge), o5 = function(e) { - function n(t) { - var r = []; - return t.mentionType === Or.USERS && (t.mentionedUserIds ? r = t.mentionedUserIds : t.mentionedUsers && (r = t.mentionedUsers.map(function(i) { - return i.userId; - }))), e.call(this, { code: "MESG", ackRequired: !0, payload: Be(Xe({ channel_url: t.channelUrl, message: t.message, data: t.data, custom_type: t.customType, metaarray: t.metaArrays, mention_type: t.mentionType, mentioned_user_ids: r, mentioned_message_template: t.mentionedMessageTemplate, target_langs: t.translationTargetLanguages, push_option: t.pushNotificationDeliveryOption && t.pushNotificationDeliveryOption !== Ca.DEFAULT ? t.pushNotificationDeliveryOption : void 0, apple_critical_alert_options: t.appleCriticalAlertOptions, silent: t.silent, reply_to_channel: t.isReplyToChannel, parent_message_id: t.parentMessageId ? t.parentMessageId : null, req_id: t.reqId, poll_id: t.pollId, pin_message: t.isPinnedMessage, extended_message_payload: t.extendedMessagePayload })) }) || this; - } - return O(n, e), n; -}(Ir), D1 = function(e) { - function n(t, r, i) { - var a, o, s, c, l = this; - (l = e.call(this, t, "MESG", i) || this).message = new Ar(t, i); - var u = U.of(t).sdkState; - return l.isMentioned = wc(l.message.mentionType, (s = (a = l.message.mentionedUserIds) !== null && a !== void 0 ? a : (o = l.message.mentionedUsers) === null || o === void 0 ? void 0 : o.map(function(d) { - return d.userId; - })) !== null && s !== void 0 ? s : [], u.userId), l.forceUpdateLastMessage = (c = i.force_update_last_message) !== null && c !== void 0 && c, l; - } - return O(n, e), n; -}(En), Mb = function(e) { - function n(t) { - var r = null; - return t.mentionType === Or.USERS && (t.mentionedUserIds ? r = t.mentionedUserIds : t.mentionedUsers && (r = t.mentionedUsers.map(function(i) { - return i.userId; - }))), e.call(this, { code: "MEDI", ackRequired: !0, payload: Be(Xe({ channel_url: t.channelUrl, msg_id: t.messageId, message: t.message, data: t.data, custom_type: t.customType, metaarray: t.metaArrayParams, mention_type: t.mentionType, mentioned_user_ids: r, mentioned_message_template: t.mentionedMessageTemplate, apple_critical_alert_options: t.appleCriticalAlertOptions ? ia.payloadify(t.appleCriticalAlertOptions) : null, poll_id: t.pollId })) }) || this; - } - return O(n, e), n; -}(Ir), sp = function(e) { - function n(t, r, i) { - var a, o, s, c, l, u = this; - (u = e.call(this, t, "MEDI", i) || this).message = new Ar(t, i); - var d = U.of(t).sdkState; - return u.mentionCountChange = _1({ mentionType: (a = i.old_values) === null || a === void 0 ? void 0 : a.mention_type, mentionedUserIds: (s = (o = i.old_values) === null || o === void 0 ? void 0 : o.mentioned_user_ids) !== null && s !== void 0 ? s : [] }, Xe({ mentionType: u.message.mentionType, mentionedUserIds: (c = u.message.mentionedUserIds) !== null && c !== void 0 ? c : (l = u.message.mentionedUsers) === null || l === void 0 ? void 0 : l.map(function(h) { - return h.userId; - }) }), d.userId), u; - } - return O(n, e), n; -}(En), Ob = function(e) { - function n(t) { - var r = null; - return t.mentionType === Or.USERS && (t.mentionedUserIds ? r = t.mentionedUserIds : t.mentionedUsers && (r = t.mentionedUsers.map(function(i) { - return i.userId; - }))), e.call(this, { code: "FEDI", ackRequired: !0, payload: Be(Xe({ channel_url: t.channelUrl, msg_id: t.messageId, data: t.data, custom_type: t.customType, metaarray: t.metaArrayParams, mention_type: t.mentionType, mentioned_user_ids: r, apple_critical_alert_options: t.appleCriticalAlertOptions })) }) || this; - } - return O(n, e), n; -}(Ir), lp = function(e) { - function n(t, r, i) { - var a, o, s, c, l, u = this; - (u = e.call(this, t, "FEDI", i) || this).message = new qn(t, i); - var d = U.of(t).sdkState; - return u.mentionCountChange = _1({ mentionType: (a = i.old_values) === null || a === void 0 ? void 0 : a.mention_type, mentionedUserIds: (s = (o = i.old_values) === null || o === void 0 ? void 0 : o.mentioned_user_ids) !== null && s !== void 0 ? s : [] }, Xe({ mentionType: u.message.mentionType, mentionedUserIds: (c = u.message.mentionedUserIds) !== null && c !== void 0 ? c : (l = u.message.mentionedUsers) === null || l === void 0 ? void 0 : l.map(function(h) { - return h.userId; - }) }), d.userId), u; - } - return O(n, e), n; -}(En), s5 = function(e) { - function n(t) { - var r = e.call(this) || this; - return r.method = pe.DELETE, r.path = "".concat(Kt(t.channelType), "/").concat(t.channelUrl, "/messages/").concat(t.messageId), r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var RA = function(e) { - function n(t, r, i) { - var a, o = this; - return (o = e.call(this, t, "DELM", i) || this).channelUrl = i.channel_url, o.channelType = i.channel_type, o.messageId = Number(i.msg_id), o.silent = i.silent, o.messageCreatedAt = i.message_created_at ? Number(i.message_created_at) : -1, o.senderId = (a = i.sender_id) !== null && a !== void 0 ? a : void 0, o; - } - return O(n, e), n; -}(En), l5 = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = t.reactionKey, s = e.call(this) || this; - return s.method = pe.POST, s.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(a, "/reactions"), s.params = { reaction: o }, s; - } - return O(n, e), n; -}(ge), c5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.reactionEvent = new M1(r), i; - } - return O(n, e), n; -}(_e), u5 = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = t.reactionKey, s = e.call(this) || this; - return s.method = pe.DELETE, s.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(a, "/reactions"), s.params = { reaction: o }, s; - } - return O(n, e), n; -}(ge), d5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.reactionEvent = new M1(L({}, r)), i; - } - return O(n, e), n; -}(_e), h5 = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = t.translationTargetLanguages, s = e.call(this) || this; - return s.method = pe.POST, s.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(encodeURIComponent(a), "/translation"), s.params = { target_langs: o }, s; - } - return O(n, e), n; -}(ge), f5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.message = new Ar(t, r), i; - } - return O(n, e), n; -}(_e), p5 = function(e) { - function n(t) { - var r, i = this; - i = e.call(this) || this; - var a = []; - t.mentionType === Or.USERS && (t.mentionedUserIds ? a = t.mentionedUserIds : t.mentionedUsers && (a = t.mentionedUsers.map(function(c) { - return c.userId; - }))); - var o = t.channelType, s = t.channelUrl; - return i.method = pe.POST, i.path = "".concat(Kt(o), "/").concat(encodeURIComponent(s), "/scheduled_messages"), i.params = Be(Xe({ req_id: t.reqId, scheduled_at: t.scheduledAt, message_type: Sc.USER, message: t.message, custom_type: t.customType, data: t.data, mention_type: t.mentionType, mentioned_user_ids: a, sorted_metaarray: (r = t.metaArrays) === null || r === void 0 ? void 0 : r.map(function(c) { - return Br.payloadify(c); - }), apple_critical_alert_options: t.appleCriticalAlertOptions ? ia.payloadify(t.appleCriticalAlertOptions) : null, target_langs: t.translationTargetLanguages, push_option: t.pushNotificationDeliveryOption })), i; - } - return O(n, e), n; -}(ge), DA = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.message = new Ar(t, r), i; - } - return O(n, e), n; -}(_e), v5 = function(e) { - function n(t) { - var r, i, a = this; - a = e.call(this) || this; - var o = []; - t.mentionType === Or.USERS && (t.mentionedUserIds ? o = t.mentionedUserIds : t.mentionedUsers && (o = t.mentionedUsers.map(function(l) { - return l.userId; - }))); - var s = t.channelType, c = t.channelUrl; - return a.method = pe.POST, a.path = "".concat(Kt(s), "/").concat(encodeURIComponent(c), "/scheduled_messages"), a.params = Xe({ req_id: t.reqId, scheduled_at: t.scheduledAt, message_type: Sc.FILE, url: t.fileUrl, file_name: t.fileName, file_size: t.fileSize, file_type: t.mimeType, thumbnails: (r = t._thumbnails) === null || r === void 0 ? void 0 : r.map(function(l) { - return Uo.payloadify(l); - }), custom_type: t.customType, data: t.data, require_auth: t.requireAuth, mention_type: t.mentionType, mentioned_user_ids: o, sorted_metaarray: (i = t.metaArrays) === null || i === void 0 ? void 0 : i.map(function(l) { - return Br.payloadify(l); - }), apple_critical_alert_options: t.appleCriticalAlertOptions ? ia.payloadify(t.appleCriticalAlertOptions) : null, push_option: t.pushNotificationDeliveryOption }), a; - } - return O(n, e), n; -}(ge), m5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.message = new qn(t, r), i; - } - return O(n, e), n; -}(_e), g5 = function(e) { - function n(t) { - var r = t.pollId, i = t.title, a = t.data, o = t.allowUserSuggestion, s = t.allowMultipleVotes, c = t.closeAt, l = e.call(this) || this; - return l.method = pe.PUT, l.path = "".concat(Aa, "/").concat(encodeURIComponent(r)), l.params = { title: i, data: a, allow_user_suggestion: o, allow_multiple_votes: s, close_at: c }, l; - } - return O(n, e), n; -}(ge), y5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.poll = new ra(t, r), i; - } - return O(n, e), n; -}(_e), E5 = function(e) { - function n(t) { - var r = t.pollId, i = e.call(this) || this; - return i.method = pe.DELETE, i.path = "".concat(Aa, "/").concat(encodeURIComponent(r)), i; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var _5 = function(e) { - function n(t) { - var r = t.pollId, i = e.call(this) || this; - return i.method = pe.PUT, i.path = "".concat(Aa, "/").concat(encodeURIComponent(r), "/close"), i; - } - return O(n, e), n; -}(ge), b5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.poll = new ra(t, r), i; - } - return O(n, e), n; -}(_e), C5 = function(e) { - function n(t) { - var r = t.channelUrl, i = t.channelType, a = t.pollId, o = t.optionText, s = e.call(this) || this; - return s.method = pe.POST, s.path = "".concat(Aa, "/").concat(encodeURIComponent(a), "/options"), s.params = { channel_url: r, channel_type: i, text: o }, s; - } - return O(n, e), n; -}(ge), T5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.poll = new ra(t, r), i; - } - return O(n, e), n; -}(_e), S5 = function(e) { - function n(t) { - var r = t.pollId, i = t.pollOptionId, a = t.optionText, o = e.call(this) || this; - return o.method = pe.PUT, o.path = "".concat(Aa, "/").concat(encodeURIComponent(r), "/options/").concat(encodeURIComponent(i)), o.params = { text: a }, o; - } - return O(n, e), n; -}(ge), w5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.poll = new ra(t, r), i; - } - return O(n, e), n; -}(_e), A5 = function(e) { - function n(t) { - var r = t.pollId, i = t.pollOptionId, a = e.call(this) || this; - return a.method = pe.DELETE, a.path = "".concat(Aa, "/").concat(encodeURIComponent(r), "/options/").concat(encodeURIComponent(i)), a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var N5 = function(e) { - function n(t) { - var r = t.reqId, i = t.channelType, a = t.channelUrl, o = t.pollId, s = t.pollOptionIds; - return e.call(this, { code: "VOTE", ackRequired: !0, payload: Be({ req_id: r, channel_type: i === Ft.OPEN ? "open_channels" : "group_channels", channel_url: a, poll_id: o, option_ids: s }) }) || this; - } - return O(n, e), n; -}(Ir), L1 = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "VOTE", i) || this; - return a.event = new qR(i), a.channelUrl = i.channel_url, a.channelType = i.channel_type, a; - } - return O(n, e), n; -}(En), LA = 100, PA = "GroupChannel", I5 = "url", kA = 100, Ym = "Message", M5 = "messageId", UA = "NotificationMessage", O5 = "notificationId", x5 = "Poll", R5 = "pollId", D5 = "FeedChannel", L5 = "url"; -function P5(e) { - var n, t, r; - return (n = e.messageParams) !== null && n !== void 0 ? n : Xe(L(L({}, e), { isReplyToChannel: !1, mentionedUserIds: (t = e.mentionedUserIds) !== null && t !== void 0 ? t : (r = e.mentionedUsers) === null || r === void 0 ? void 0 : r.map(function(i) { - return i.userId; - }), pushNotificationDeliveryOption: Ca.DEFAULT, isPinnedMessage: !1, fileInfoList: e.fileInfoList.map(function(i) { - var a; - return { fileUrl: i.plainUrl, fileName: i.fileName, fileSize: i.fileSize, mimeType: i.mimeType, thumbnailSizes: (a = i.thumbnails) === null || a === void 0 ? void 0 : a.map(function(o) { - return { maxWidth: o.width, maxHeight: o.height }; - }), _thumbnails: i.thumbnails, _uploadedMetaData: { requireAuth: i._requireAuth, isUploaded: !0 } }; - }) })); -} -var Tr, k5 = L(L({}, Xp), { fileInfoList: [] }), U5 = function(e) { - return (fr(e.file) || k("string", e.fileUrl)) && k("string", e.fileName, !0) && k("string", e.mimeType, !0) && k("number", e.fileSize, !0) && (e.thumbnailSizes === void 0 || Array.isArray(e.thumbnailSizes) && e.thumbnailSizes.every(function(n) { - return n.maxWidth > 0 && n.maxHeight > 0; - })); -}, Nf = function(e) { - function n() { - var t = e !== null && e.apply(this, arguments) || this; - return t._onFileUploaded = bt, t; - } - return O(n, e), n.prototype._triggerOnFileUploaded = function(t, r, i, a) { - this._onFileUploaded(t, r, i, a); - }, n.prototype.onFileUploaded = function(t) { - return this._onFileUploaded = t, this; - }, n.prototype.onPending = function(t) { - return e.prototype.onPending.call(this, t), this; - }, n.prototype.onFailed = function(t) { - return e.prototype.onFailed.call(this, t), this; - }, n.prototype.onSucceeded = function(t) { - return e.prototype.onSucceeded.call(this, t), this; - }, n; -}(di), F5 = 2; -(function(e) { - e.SEND = "send", e.RESEND = "resend", e.COPY = "copy"; -})(Tr || (Tr = {})); -var On, cp = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u = this; - return (u = e.call(this, t) || this)._name = "", u._createdAt = 0, u.channelType = Ft.BASE, u.coverUrl = "", u.customType = "", u.data = "", u.isFrozen = !1, u.isEphemeral = !1, u.creator = null, u._messageCollectionLastAccessedAt = 0, u._url = r.channel_url, u._name = (i = r.name) !== null && i !== void 0 ? i : "", u._createdAt = 1e3 * r.created_at, u.coverUrl = (a = r.cover_url) !== null && a !== void 0 ? a : "", u.customType = (o = r.custom_type) !== null && o !== void 0 ? o : "", u.data = (s = r.data) !== null && s !== void 0 ? s : "", u.isFrozen = (c = r.freeze) !== null && c !== void 0 && c, u.isEphemeral = (l = r.is_ephemeral) !== null && l !== void 0 && l, u.creator = r.created_by ? new Dt(u._iid, r.created_by) : null, r.metadata && Object.keys(r.metadata).length > 0 && r.ts && (u._cachedMetaData = /* @__PURE__ */ new Map(), Object.keys(r.metadata).forEach(function(d) { - u._cachedMetaData.set(d, { value: r.metadata[d], isRemoved: !1, updatedAt: r.ts }); - })), u; - } - return O(n, e), Object.defineProperty(n.prototype, "url", { get: function() { - return this._url; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "name", { get: function() { - return this._name; - }, set: function(t) { - this._name = t; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "createdAt", { get: function() { - return this._createdAt; - }, enumerable: !1, configurable: !0 }), n.prototype.toJSON = function() { - return L(L({}, this), { url: this._url, name: this._name, createdAt: this._createdAt }); - }, n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { channel_url: t.url, name: t.name, cover_url: t.coverUrl, custom_type: t.customType, data: t.data, freeze: t.isFrozen, is_ephemeral: t.isEphemeral, created_by: t.creator ? Dt.payloadify(t.creator) : null, created_at: t.createdAt / 1e3 }))); - }, n.prototype.isGroupChannel = function() { - return this.channelType === Ft.GROUP; - }, n.prototype.isOpenChannel = function() { - return this.channelType === Ft.OPEN; - }, n.prototype.isFeedChannel = function() { - return this.channelType === Ft.FEED; - }, Object.defineProperty(n.prototype, "cachedMetaData", { get: function() { - var t = {}; - return this._cachedMetaData && this._cachedMetaData.forEach(function(r, i) { - r.isRemoved || (t[i] = r.value); - }), t; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "messageCollectionLastAccessedAt", { get: function() { - return this._messageCollectionLastAccessedAt; - }, enumerable: !1, configurable: !0 }), n.prototype._updateMessageCollectionLastAccessedAt = function() { - this._messageCollectionLastAccessedAt = Date.now(); - }, n.prototype._update = function(t) { - var r = Be(t); - Object.assign(this, r); - }, n.prototype._upsertCachedMetaData = function(t, r) { - var i = this; - Object.keys(t).forEach(function(a) { - i._cachedMetaData || (i._cachedMetaData = /* @__PURE__ */ new Map()); - var o = i._cachedMetaData.get(a); - (!o || o.updatedAt <= r) && i._cachedMetaData.set(a, { value: t[a], isRemoved: !1, updatedAt: r }); - }); - }, n.prototype._updateCachedMetaData = function(t, r) { - var i = this; - this._cachedMetaData ? this._cachedMetaData.forEach(function(a, o) { - var s; - a.updatedAt <= r && i._cachedMetaData.set(o, { value: (s = t[o]) !== null && s !== void 0 ? s : a.value, isRemoved: !t[o], updatedAt: r }); - }) : (this._cachedMetaData = /* @__PURE__ */ new Map(), Object.keys(t).forEach(function(a) { - i._cachedMetaData.set(a, { value: t[a], isRemoved: !1, updatedAt: r }); - })); - }, n.prototype._removeFromCachedMetaData = function(t, r) { - var i = this; - this._cachedMetaData && t.forEach(function(a) { - var o = i._cachedMetaData.get(a); - o && o.updatedAt < r && (o.isRemoved = !0, o.updatedAt = r); - }); - }, n.prototype._runIfHandleableWithGroupChannel = function(t) { - this.isGroupChannel() ? t(this) : this.isFeedChannel() && t(this.groupChannel); - }, n.prototype._generateRequestId = function() { - return "rq-".concat(Ro()); - }, n.prototype.isIdentical = function(t) { - return t && this.url === t.url; - }, n.prototype.isEqual = function(t) { - return gw(this, t); - }, n.prototype.createOperatorListQuery = function(t) { - return t === void 0 && (t = {}), new MD(this._iid, this.url, this.channelType, t); - }, n.prototype.createMutedUserListQuery = function(t) { - return t === void 0 && (t = {}), new DD(this._iid, this.url, this.channelType, t); - }, n.prototype.createBannedUserListQuery = function(t) { - return t === void 0 && (t = {}), new kD(this._iid, this.url, this.channelType, t); - }, n.prototype.createPreviousMessageListQuery = function(t) { - return t === void 0 && (t = {}), new OD(this._iid, this.url, this.channelType, t); - }, n.prototype.addOperators = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return ve(Ot("string", t)).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new UD({ channelUrl: this.url, channelType: this.channelType, operatorUserIds: t }), [4, r.send(i)]; - case 1: - return a.sent(), [2]; - } - }); - }); - }, n.prototype.removeOperators = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return ve(Ot("string", t)).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new FD({ channelUrl: this.url, channelType: this.channelType, operatorUserIds: t }), [4, r.send(i)]; - case 1: - return a.sent(), [2]; - } - }); - }); - }, n.prototype.getMyMutedInfo = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l, u, d, h; - return C(this, function(f) { - switch (f.label) { - case 0: - return t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new BD({ channelUrl: this.url, channelType: this.channelType, userId: r.userId }), [4, i.send(a)]; - case 1: - return o = f.sent(), s = o.as(HD), c = s.isMuted, l = s.startAt, u = s.endAt, d = s.remainingDuration, h = s.description, [2, { isMuted: c, startAt: l, endAt: u, remainingDuration: d, description: h }]; - } - }); - }); - }, n.prototype.getMetaData = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return ve(Ot("string", t)).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new Sb({ channelUrl: this.url, channelType: this.channelType, keys: t }), [4, r.send(i)]; - case 1: - return a = l.sent(), o = a.as(wb), s = o.metadata, c = o.ts, this._upsertCachedMetaData(s, c), [2, s]; - } - }); - }); - }, n.prototype.getAllMetaData = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new Sb({ channelUrl: this.url, channelType: this.channelType, keys: [] }), [4, t.send(r)]; - case 1: - return i = c.sent(), a = i.as(wb), o = a.metadata, s = a.ts, this._updateCachedMetaData(o, s), [2, o]; - } - }); - }); - }, n.prototype.createMetaData = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return r = U.of(this._iid).requestQueue, i = new jD({ channelUrl: this.url, channelType: this.channelType, metadata: t }), [4, r.send(i)]; - case 1: - return a = s.sent(), o = a.as(VD).metaData, this._upsertCachedMetaData(o, 0), [2, o]; - } - }); - }); - }, n.prototype.updateMetaData = function(t, r) { - return r === void 0 && (r = !1), T(this, void 0, void 0, function() { - var i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return i = U.of(this._iid).requestQueue, a = new GD({ channelUrl: this.url, channelType: this.channelType, metadata: t, upsert: r }), [4, i.send(a)]; - case 1: - return o = u.sent(), s = o.as(zD), c = s.metadata, l = s.ts, this._upsertCachedMetaData(c, l), [2, c]; - } - }); - }); - }, n.prototype.deleteMetaData = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(k("string", t)).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new qD({ channelUrl: this.url, channelType: this.channelType, key: t }), [4, r.send(i)]; - case 1: - return a = s.sent(), o = a.as(KD).ts, this._removeFromCachedMetaData([t], o), [2]; - } - }); - }); - }, n.prototype.deleteAllMetaData = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new WD({ channelUrl: this.url, channelType: this.channelType }), [4, t.send(r)]; - case 1: - return i = o.sent(), a = i.as(YD).ts, this._removeFromCachedMetaData(dt([], tt(this._cachedMetaData.keys()), !1), a), [2]; - } - }); - }); - }, n.prototype.getMetaCounters = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return ve(Ot("string", t)).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new Ab({ channelUrl: this.url, channelType: this.channelType, keys: t }), [4, r.send(i)]; - case 1: - return a = o.sent(), [2, a.as(Nb).metaCounter]; - } - }); - }); - }, n.prototype.getAllMetaCounters = function() { - return T(this, void 0, void 0, function() { - var t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new Ab({ channelUrl: this.url, channelType: this.channelType, keys: [] }), [4, t.send(r)]; - case 1: - return i = a.sent(), [2, i.as(Nb).metaCounter]; - } - }); - }); - }, n.prototype.createMetaCounters = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return r = U.of(this._iid).requestQueue, i = new ZD({ channelUrl: this.url, channelType: this.channelType, metaCounter: t }), [4, r.send(i)]; - case 1: - return a = o.sent(), [2, a.as(QD).metaCounter]; - } - }); - }); - }, n.prototype.updateMetaCounters = function(t, r) { - return r === void 0 && (r = !1), T(this, void 0, void 0, function() { - var i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return i = U.of(this._iid).requestQueue, a = new p0({ channelUrl: this.url, channelType: this.channelType, metaCounter: t, upsert: r }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(v0).metaCounter]; - } - }); - }); - }, n.prototype.increaseMetaCounters = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return r = U.of(this._iid).requestQueue, i = new p0({ channelUrl: this.url, channelType: this.channelType, metaCounter: t, upsert: !1, mode: "increase" }), [4, r.send(i)]; - case 1: - return a = o.sent(), [2, a.as(v0).metaCounter]; - } - }); - }); - }, n.prototype.decreaseMetaCounters = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return r = U.of(this._iid).requestQueue, i = new p0({ channelUrl: this.url, channelType: this.channelType, metaCounter: t, upsert: !1, mode: "decrease" }), [4, r.send(i)]; - case 1: - return a = o.sent(), [2, a.as(v0).metaCounter]; - } - }); - }); - }, n.prototype.deleteMetaCounter = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return ve(k("string", t)).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new XD({ channelUrl: this.url, channelType: this.channelType, key: t }), [4, r.send(i)]; - case 1: - return a.sent(), [2]; - } - }); - }); - }, n.prototype.deleteAllMetaCounters = function() { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new JD({ channelUrl: this.url, channelType: this.channelType }), [4, t.send(r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.muteUser = function(t, r, i) { - return T(this, void 0, void 0, function() { - return C(this, function(a) { - return [2, this.muteUserWithUserId(t.userId, r, i)]; - }); - }); - }, n.prototype.muteUserWithUserId = function(t, r, i) { - return T(this, void 0, void 0, function() { - var a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(k("string", t) && k("number", r, !0) && k("string", i, !0)).throw(H.invalidParameters), a = U.of(this._iid).requestQueue, o = new $D({ channelUrl: this.url, channelType: this.channelType, userId: t, seconds: r, description: i }), [4, a.send(o)]; - case 1: - return s.sent(), [2]; - } - }); - }); - }, n.prototype.unmuteUser = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return [2, this.unmuteUserWithUserId(t.userId)]; - }); - }); - }, n.prototype.unmuteUserWithUserId = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return ve(k("string", t)).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new e5({ channelUrl: this.url, channelType: this.channelType, userId: t }), [4, r.send(i)]; - case 1: - return a.sent(), [2]; - } - }); - }); - }, n.prototype.banUser = function(t, r, i) { - return T(this, void 0, void 0, function() { - return C(this, function(a) { - return [2, this.banUserWithUserId(t.userId, r, i)]; - }); - }); - }, n.prototype.banUserWithUserId = function(t, r, i) { - return T(this, void 0, void 0, function() { - var a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(k("string", t) && k("number", r, !0) && k("string", i, !0)).throw(H.invalidParameters), a = U.of(this._iid).requestQueue, o = new t5({ channelUrl: this.url, channelType: this.channelType, userId: t, seconds: r, description: i }), [4, a.send(o)]; - case 1: - return s.sent(), [2]; - } - }); - }); - }, n.prototype.unbanUser = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return [2, this.unbanUserWithUserId(t.userId)]; - }); - }); - }, n.prototype.unbanUserWithUserId = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return ve(k("string", t)).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new n5({ channelUrl: this.url, channelType: this.channelType, userId: t }), [4, r.send(i)]; - case 1: - return a.sent(), [2]; - } - }); - }); - }, n.prototype.freeze = function() { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new Ib({ channelUrl: this.url, channelType: this.channelType, freezing: !0 }), [4, t.send(r)]; - case 1: - return i.sent(), this.isFrozen = !0, [2]; - } - }); - }); - }, n.prototype.unfreeze = function() { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new Ib({ channelUrl: this.url, channelType: this.channelType, freezing: !1 }), [4, t.send(r)]; - case 1: - return i.sent(), this.isFrozen = !1, [2]; - } - }); - }); - }, n.prototype.getMessagesByMessageId = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, Yu), r), ve(k("number", t) && gb(i)).throw(H.invalidParameters), [4, tr.of(this._iid).getMessagesByMessageId(this.url, this.channelType, t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n.prototype.getMessagesByTimestamp = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, Yu), r), ve(k("number", t) && gb(i)).throw(H.invalidParameters), [4, tr.of(this._iid).getMessagesByTimestamp(this.url, this.channelType, t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n.prototype.getMessageChangeLogsSinceTimestamp = function(t, r) { - return r === void 0 && (r = {}), T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, qm), r), ve(k("number", t) && yb(i)).throw(H.invalidParameters), [4, tr.of(this._iid).getMessageChangelogs(this.url, this.channelType, t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n.prototype.getMessageChangeLogsSinceToken = function(t, r) { - return r === void 0 && (r = {}), T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, qm), r), ve(k("string", t) && yb(i)).throw(H.invalidParameters), [4, tr.of(this._iid).getMessageChangelogs(this.url, this.channelType, t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n.prototype._createPendingSendableMessagePayload = function(t, r, i) { - var a, o = U.of(this._iid).sessionManager; - return Be(Xe({ channel_url: this.url, channel_type: this.channelType, msg_id: 0, parent_message_id: t.parentMessageId, data: t.data, custom_type: t.customType, mention_type: t.mentionType, sorted_metaarray: t.metaArrays ? t.metaArrays.map(function(s) { - return Br.payloadify(s); - }) : null, apple_critical_alert_options: t.appleCriticalAlertOptions ? ia.payloadify(t.appleCriticalAlertOptions) : null, created_at: i, user: o.currentUser ? Mc.payloadify(o.currentUser) : null, req_id: r, request_state: $t.PENDING, mentioned_user_ids: t.mentionedUserIds, mentioned_users: (a = t.mentionedUsers) === null || a === void 0 ? void 0 : a.map(function(s) { - return Dt.payloadify(s); - }) })); - }, n.prototype._createPendingUserMessage = function(t, r, i) { - var a, o, s = {}; - if (t.translationTargetLanguages) - try { - for (var c = Ne(t.translationTargetLanguages), l = c.next(); !l.done; l = c.next()) - s[l.value] = ""; - } catch (h) { - a = { error: h }; - } finally { - try { - l && !l.done && (o = c.return) && o.call(c); - } finally { - if (a) - throw a.error; - } - } - var u = Be(L(L({}, this._createPendingSendableMessagePayload(t, r, i)), { type: Ln.USER, message: t.message, translations: s, extended_message_payload: t.extendedMessagePayload })), d = new Ar(this._iid, u); - return d.messageParams = t, d; - }, n.prototype._createPendingScheduledUserMessage = function(t, r, i) { - var a = this._createPendingUserMessage(t, r, i); - return a.scheduledInfo = { scheduledMessageId: 0, scheduledAt: t.scheduledAt, scheduledMessageParams: t }, a; - }, n.prototype._createPendingFileMessage = function(t, r, i) { - var a, o, s, c, l, u, d, h = Be(L(L({}, this._createPendingSendableMessagePayload(t, r, i)), { type: Ln.FILE, url: t.fileUrl, file: { name: (a = t.fileName) !== null && a !== void 0 ? a : (o = t.file) === null || o === void 0 ? void 0 : o.name, size: (s = t.fileSize) !== null && s !== void 0 ? s : (c = t.file) === null || c === void 0 ? void 0 : c.size, type: (l = t.mimeType) !== null && l !== void 0 ? l : (u = t.file) === null || u === void 0 ? void 0 : u.type, data: t.data }, thumbnails: (d = t._thumbnails) === null || d === void 0 ? void 0 : d.map(function(p) { - return Uo.payloadify(p); - }) })), f = new qn(this._iid, h); - return f.messageParams = t, f; - }, n.prototype._createPendingMultipleFilesMessage = function(t, r, i) { - var a = Be(L(L({}, this._createPendingSendableMessagePayload(t, r, i)), { type: Ln.FILE })), o = new Ui(this._iid, a); - return o.messageParams = t, o; - }, n.prototype._validateFailedFileMessageHasFile = function(t, r) { - var i; - return !!t.url || fr(r) || fr((i = t.messageParams) === null || i === void 0 ? void 0 : i.file); - }, n.prototype._createPendingScheduledFileMessage = function(t, r, i) { - var a = this._createPendingFileMessage(t, r, i); - return a.scheduledInfo = { scheduledMessageId: 0, scheduledAt: t.scheduledAt, scheduledMessageParams: t }, a; - }, n.prototype._markMessageAsFailed = function(t, r, i) { - i === void 0 && (i = !1), t.errorCode = r.code, r.code === nt.REQUEST_CANCELED || r.code === nt.FILE_UPLOAD_CANCEL_FAILED ? t.sendingStatus = $t.CANCELED : i || (t.sendingStatus = $t.FAILED); - }, n.prototype.sendUserMessage = function(t) { - var r = L(L({}, EA), t); - return ve(bA(r)).throw(H.invalidParameters), this._sendUserMessage(r); - }, n.prototype._sendUserMessage = function(t, r, i) { - var a = this; - r === void 0 && (r = Tr.SEND); - var o = U.of(this._iid), s = o.dispatcher, c = o.requestQueue, l = i ?? this._generateRequestId(), u = Date.now(), d = new di(); - return Mi(2).then(function() { - var h = a._createPendingUserMessage(t, l, u); - s.dispatch(new Sn({ messages: [h], source: r === Tr.RESEND ? ne.LOCAL_MESSAGE_RESEND_STARTED : ne.EVENT_MESSAGE_SENT_PENDING })), Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(p) { - return [2, d._trigger(h)]; - }); - }); - }); - var f = new o5(L(L({}, t), { channelUrl: a.url, channelType: a.channelType, reqId: l })); - c.send(f).then(function(p) { - var v = p.as(D1).message; - s.dispatch(new Sn({ messages: [v], source: ne.EVENT_MESSAGE_SENT_SUCCESS })), Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(m) { - return [2, d._trigger(v)]; - }); - }); - }); - }).catch(function(p) { - if (qr(p)) - throw p; - Mi(2).then(function() { - var v = a._createPendingUserMessage(t, l, u), m = U.of(a._iid).cacheContext, E = m.localCacheEnabled && m.localCacheConfig.enableAutoResend && Yf(p.code); - a._markMessageAsFailed(v, p, E), s.dispatch(new Sn({ messages: [v], source: v.sendingStatus === $t.PENDING ? ne.REQUEST_RESEND_MESSAGE : ne.EVENT_MESSAGE_SENT_FAILED })), Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(y) { - return [2, d._triggerFailed(p, v)]; - }); - }); - }); - }); - }); - }), d; - }, n.prototype._autoResendUserMessage = function(t) { - return ve(t instanceof Ar && !!t.messageParams).throw(H.invalidParameters), this._sendUserMessage(t.messageParams, Tr.SEND, t.reqId); - }, n.prototype.resendUserMessage = function(t) { - var r; - return T(this, void 0, void 0, function() { - var i, a; - return C(this, function(o) { - return ve(t instanceof Ar && !t.scheduledInfo).throw(H.invalidParameters), i = new Kr(), a = (r = t.messageParams) !== null && r !== void 0 ? r : Km(t), this._sendUserMessage(a, Tr.RESEND, t.reqId).onFailed(function(s) { - return i.reject(s); - }).onSucceeded(function(s) { - return i.resolve(s); - }), [2, i.promise]; - }); - }); - }, n.prototype.updateUserMessage = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return i = L(L({}, TA), r), ve(k("number", t) && SA(i)).throw(H.invalidParameters), a = U.of(this._iid).requestQueue, o = new Mb(L({ channelType: this.channelType, channelUrl: this.url, messageId: t, metaArrayParams: i.metaArrays ? { array: i.metaArrays, mode: "add", upsert: !0 } : void 0 }, i)), [4, a.send(o)]; - case 1: - return s = c.sent(), [2, s.as(sp).message]; - } - }); - }); - }, n.prototype.copyUserMessage = function(t, r) { - var i, a, o; - return T(this, void 0, void 0, function() { - var s, c; - return C(this, function(l) { - return ve(t instanceof n && r instanceof Ar && r.sendingStatus === $t.SUCCEEDED && this.url === r.channelUrl && !r.scheduledInfo).throw(H.invalidParameters), ve(!r.poll).throw(H.notSupportedError), s = new Kr(), c = (i = r.messageParams) !== null && i !== void 0 ? i : Xe(L(L({}, r), { mentionType: r.mentionType, mentionedUserIds: (a = r.mentionedUserIds) !== null && a !== void 0 ? a : (o = r.mentionedUsers) === null || o === void 0 ? void 0 : o.map(function(u) { - return u.userId; - }), translationTargetLanguages: Object.keys(r.translations), pushNotificationDeliveryOption: Ca.DEFAULT, parentMessageId: null, isReplyToChannel: !1, isPinnedMessage: !1 })), t._sendUserMessage(c).onSucceeded(function(u) { - s.resolve(u); - }).onFailed(function(u) { - return s.reject(u); - }), [2, s.promise]; - }); - }); - }, n.prototype.translateUserMessage = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(t instanceof Ar && t.messageId > 0 && Ot("string", r)).throw(H.invalidParameters), i = U.of(this._iid).requestQueue, a = new h5({ channelType: this.channelType, channelUrl: this.url, messageId: t.messageId, translationTargetLanguages: r }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(f5).message]; - } - }); - }); - }, n.prototype._createScheduledUserMessage = function(t, r) { - var i = this, a = U.of(this._iid).requestQueue, o = Date.now(), s = this._generateRequestId(); - Mi(2).then(function() { - var l = i._createPendingScheduledUserMessage(t, s, o); - Ke(function() { - return T(i, void 0, void 0, function() { - return C(this, function(u) { - return [2, r._trigger(l)]; - }); - }); - }); - }); - var c = new p5(L({ reqId: s, channelType: this.channelType, channelUrl: this.url }, t)); - a.send(c).then(function(l) { - var u = l.as(DA).message; - Ke(function() { - return T(i, void 0, void 0, function() { - return C(this, function(d) { - return [2, r._trigger(u)]; - }); - }); - }); - }).catch(function(l) { - if (qr(l)) - throw l; - Mi(2).then(function() { - var u = i._createPendingScheduledUserMessage(t, s, o); - i._markMessageAsFailed(u, l), Ke(function() { - return T(i, void 0, void 0, function() { - return C(this, function(d) { - return [2, r._triggerFailed(l, u)]; - }); - }); - }); - }); - }); - }, n.prototype.sendFileMessage = function(t) { - var r = L(L({}, Cb), t); - return ve(Tb(r)).throw(H.invalidParameters), this._sendFileMessage(r); - }, n.prototype.sendMultipleFilesMessage = function(t) { - var r, i = L(L({}, k5), t), a = U.of(this._iid); - ve(function(s, c) { - return c === void 0 && (c = NR), Jp(s) && Array.isArray(s.fileInfoList) && s.fileInfoList.length >= 2 && s.fileInfoList.length <= c && s.fileInfoList.every(function(l) { - return U5(l); - }); - }(i, (r = a.appInfo) === null || r === void 0 ? void 0 : r.multipleFilesMessageFileCountLimit)).throw(H.invalidParameters); - var o = !!t.fileInfoList.find(function(s) { - var c = a.appInfo.uploadSizeLimit; - return s.file instanceof Blob && s.file.size > c || s.fileSize > c; - }); - return ve(!o).throw(H.fileSizeLimitExceededError), this._sendMultipleFilesMessage(i); - }, n.prototype._sendFileMessage = function(t, r, i) { - var a = this; - r === void 0 && (r = Tr.SEND); - var o = U.of(this._iid).dispatcher, s = tr.of(this._iid).fileMessageQueue, c = i ?? this._generateRequestId(), l = Date.now(), u = new di(); - return Mi(2).then(function() { - var d = a._createPendingFileMessage(t, c, l); - o.dispatch(new Sn({ messages: [d], source: r === Tr.RESEND ? ne.LOCAL_MESSAGE_RESEND_STARTED : ne.EVENT_MESSAGE_SENT_PENDING })), Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(h) { - return [2, u._trigger(d)]; - }); - }); - }), s.request(a, c, t).then(function(h) { - o.dispatch(new Sn({ messages: [h], source: ne.EVENT_MESSAGE_SENT_SUCCESS })), Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(f) { - return [2, u._trigger(h)]; - }); - }); - }); - }).catch(function(h) { - if (qr(h)) - throw h; - Mi(2).then(function() { - var f = a._createPendingFileMessage(t, c, l), p = U.of(a._iid).cacheContext, v = p.localCacheEnabled && p.localCacheConfig.enableAutoResend && Yf(h.code); - a._markMessageAsFailed(f, h, v), o.dispatch(new Sn({ messages: [f], source: f.sendingStatus === $t.PENDING ? ne.REQUEST_RESEND_MESSAGE : h.code === nt.FILE_UPLOAD_CANCEL_FAILED ? ne.LOCAL_MESSAGE_CANCELED : ne.EVENT_MESSAGE_SENT_FAILED })), Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(m) { - return [2, u._triggerFailed(h, f)]; - }); - }); - }); - }); - }); - }), u; - }, n.prototype._autoResendFileMessage = function(t) { - ve(t instanceof qn && !!t.messageParams).throw(H.invalidParameters); - var r = U.of(this._iid).logger; - return r.debug("autoResendFileMessage pending", t), this._sendFileMessage(t.messageParams, Tr.SEND, t.reqId).onFailed(function(i) { - r.debug("autoResendFileMessage failed", i); - }).onSucceeded(function(i) { - r.debug("autoResendFileMessage success", i); - }); - }, n.prototype._sendMultipleFilesMessage = function(t, r, i) { - var a = this, o = U.of(this._iid).dispatcher, s = tr.of(this._iid).fileMessageQueue, c = i ?? this._generateRequestId(), l = Date.now(), u = new Nf(); - return Mi(2).then(function() { - var d = a._createPendingMultipleFilesMessage(t, c, l); - o.dispatch(new Sn({ messages: [d], source: r === Tr.RESEND ? ne.LOCAL_MESSAGE_RESEND_STARTED : ne.EVENT_MESSAGE_SENT_PENDING })), Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(h) { - return [2, u._trigger(d)]; - }); - }); - }), s.request(a, c, t, { requestHandler: u, isCopy: r === Tr.COPY }).then(function(h) { - o.dispatch(new Sn({ messages: [h], source: ne.EVENT_MESSAGE_SENT_SUCCESS })), Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(f) { - return [2, u._trigger(h)]; - }); - }); - }); - }).catch(function(h) { - if (qr(h)) - throw h; - Mi(2).then(function() { - var f = a._createPendingMultipleFilesMessage(t, c, l); - a._markMessageAsFailed(f, h), o.dispatch(new Sn({ messages: [f], source: ne.EVENT_MESSAGE_SENT_FAILED })), Ke(function() { - return T(a, void 0, void 0, function() { - return C(this, function(p) { - return [2, u._triggerFailed(h, f)]; - }); - }); - }); - }); - }); - }), u; - }, n.prototype._createScheduledFileMessage = function(t, r, i, a) { - var o = this, s = U.of(this._iid).requestQueue, c = new v5(L(L({ reqId: i, channelType: this.channelType, channelUrl: this.url }, t), { fileUrl: t.fileUrl, requireAuth: t.requireAuth })); - s.send(c).then(function(l) { - var u = l.as(m5).message; - Ke(function() { - return T(o, void 0, void 0, function() { - return C(this, function(d) { - return [2, r._trigger(u)]; - }); - }); - }); - }).catch(function(l) { - if (qr(l)) - throw l; - Mi(2).then(function() { - var u = o._createPendingScheduledFileMessage(t, i, a); - o._markMessageAsFailed(u, l), Ke(function() { - return T(o, void 0, void 0, function() { - return C(this, function(d) { - return [2, r._triggerFailed(l, u)]; - }); - }); - }); - }); - }); - }, n.prototype.sendFileMessages = function(t) { - var r, i; - ve(t.every(function(l) { - return Tb(L(L({}, Cb), l)); - })).throw(H.invalidParameters); - var a = new di(); - try { - for (var o = Ne(t), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - this.sendFileMessage(c).onPending(function(l) { - return a._trigger(l); - }).onFailed(function(l, u) { - return a._triggerFailed(l, u); - }).onSucceeded(function(l) { - return a._trigger(l); - }); - } - } catch (l) { - r = { error: l }; - } finally { - try { - s && !s.done && (i = o.return) && i.call(o); - } finally { - if (r) - throw r.error; - } - } - return a; - }, n.prototype.resendFileMessage = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o; - return C(this, function(s) { - return i = this._validateFailedFileMessageHasFile(t, r), ve(t instanceof qn && i && !t.scheduledInfo).throw(H.invalidParameters), a = new Kr(), o = Wm(t, r), this._sendFileMessage(o, Tr.RESEND, t.reqId).onFailed(function(c) { - return a.reject(c); - }).onSucceeded(function(c) { - return a.resolve(c); - }), [2, a.promise]; - }); - }); - }, n.prototype.resendMessage = function(t, r) { - var i, a; - if (ve(t instanceof Vn && !t.scheduledInfo && t.isResendable).throw(H.invalidParameters), t.isUserMessage()) { - var o = (i = t.messageParams) !== null && i !== void 0 ? i : Km(t); - return this._sendUserMessage(o, Tr.RESEND, t.reqId); - } - if (t.isFileMessage()) { - var s = this._validateFailedFileMessageHasFile(t, r); - return ve(s).throw(H.invalidParameters), o = (a = t.messageParams) !== null && a !== void 0 ? a : Wm(t, r), this._sendFileMessage(o, Tr.RESEND, t.reqId); - } - if (t.isMultipleFilesMessage()) - throw H.channelTypeNotSupportedError; - }, n.prototype.updateFileMessage = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return i = L(L({}, AD), r), ve(k("number", t) && function(l) { - return R1(l); - }(i)).throw(H.invalidParameters), a = U.of(this._iid).requestQueue, o = new Ob(L({ channelType: this.channelType, channelUrl: this.url, messageId: t, metaArrayParams: i.metaArrays ? { array: i.metaArrays, mode: "add", upsert: !0 } : void 0 }, i)), [4, a.send(o)]; - case 1: - return s = c.sent(), [2, s.as(lp).message]; - } - }); - }); - }, n.prototype.uploadFile = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return r = U.of(this._iid).requestQueue, i = Ro(), (a = new rp({ file: t.file, channelUrl: this.url, thumbnailSizes: t.thumbnailSizes, requestId: i })).uploadProgressHandler = t.progressHandler, t.uploadStartedHandler && t.uploadStartedHandler(i), [4, r.send(a)]; - case 1: - return o = u.sent(), s = o.as(ip), c = s.url, l = s.thumbnails, [2, { requestId: i, url: c, thumbnails: l }]; - } - }); - }); - }, n.prototype.cancelUploadingFileMessage = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return ve(k("string", t)).throw(H.invalidParameters), tr.of(this._iid).fileMessageQueue.cancel(this, t), [2, !0]; - }); - }); - }, n.prototype.copyFileMessage = function(t, r) { - var i, a, o; - return T(this, void 0, void 0, function() { - var s, c; - return C(this, function(l) { - return ve(t instanceof n && r instanceof qn && r.sendingStatus === $t.SUCCEEDED && this.url === r.channelUrl && !r.scheduledInfo).throw(H.invalidParameters), s = new Kr(), c = Xe(L(L({}, r), { fileUrl: r.url, fileName: r.name, fileSize: r.size, mimeType: r.type, mentionType: r.mentionType, mentionedUserIds: (i = r.mentionedUserIds) !== null && i !== void 0 ? i : (a = r.mentionedUsers) === null || a === void 0 ? void 0 : a.map(function(u) { - return u.userId; - }), pushNotificationDeliveryOption: Ca.DEFAULT, parentMessageId: null, isReplyToChannel: !1, thumbnailSizes: (o = r.thumbnails) === null || o === void 0 ? void 0 : o.map(function(u) { - return { maxWidth: u.width, maxHeight: u.height }; - }), requireAuth: r.requireAuth, isPinnedMessage: !1 })), t._sendFileMessage(c).onSucceeded(function(u) { - return s.resolve(u); - }).onFailed(function(u) { - return s.reject(u); - }), [2, s.promise]; - }); - }); - }, n.prototype.copyMessage = function(t, r) { - ve(t instanceof n && r instanceof Vn && r.sendingStatus === $t.SUCCEEDED && this.url === r.channelUrl && !r.scheduledInfo).throw(H.invalidParameters); - var i = r, a = t; - if (i.isUserMessage()) { - ve(!i.poll).throw(H.notSupportedError); - var o = _A(i); - return a._sendUserMessage(o); - } - if (i.isFileMessage()) - return o = CA(i), a._sendFileMessage(o); - if (r.isMultipleFilesMessage()) - throw H.channelTypeNotSupportedError; - }, n.prototype.deleteMessage = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return ve(t instanceof kr).throw(H.invalidParameters), t.messageId > 0 ? (r = U.of(this._iid).requestQueue, i = new s5({ channelType: this.channelType, channelUrl: this.url, messageId: t.messageId }), [4, r.send(i)]) : [3, 2]; - case 1: - a.sent(), a.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.addReaction = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(t instanceof kr && t.messageId > 0 && k("string", r)).throw(H.invalidParameters), i = U.of(this._iid).requestQueue, a = new l5({ channelType: this.channelType, channelUrl: this.url, messageId: t.messageId, reactionKey: r }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(c5).reactionEvent]; - } - }); - }); - }, n.prototype.deleteReaction = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(t instanceof kr && t.messageId > 0 && k("string", r)).throw(H.invalidParameters), i = U.of(this._iid).requestQueue, a = new u5({ channelType: this.channelType, channelUrl: this.url, messageId: t.messageId, reactionKey: r }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(d5).reactionEvent]; - } - }); - }); - }, n.prototype._updateUserMessageMetaArray = function(t, r, i, a) { - return T(this, void 0, void 0, function() { - var o, s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - return o = U.of(this._iid), s = o.dispatcher, c = o.requestQueue, l = new Mb({ channelType: this.channelType, channelUrl: this.url, messageId: t, metaArrayParams: { array: r, mode: i, upsert: a } }), [4, c.send(l)]; - case 1: - return u = h.sent(), d = u.as(sp).message, s.dispatch(new Sn({ messages: [d], source: ne.EVENT_MESSAGE_UPDATED })), [2, d]; - } - }); - }); - }, n.prototype._updateFileMessageMetaArray = function(t, r, i, a) { - return T(this, void 0, void 0, function() { - var o, s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - return o = U.of(this._iid), s = o.dispatcher, c = o.requestQueue, l = new Ob({ channelType: this.channelType, channelUrl: this.url, messageId: t, metaArrayParams: { array: r, mode: i, upsert: a } }), [4, c.send(l)]; - case 1: - return u = h.sent(), d = u.as(lp).message, s.dispatch(new Sn({ messages: [d], source: ne.EVENT_MESSAGE_UPDATED })), [2, d]; - } - }); - }); - }, n.prototype.createMessageMetaArrayKeys = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - return ve(t instanceof kr && t.messageId > 0 && Ot("string", r)).throw(H.invalidParameters), i = r.map(function(o) { - return new Br({ key: o }); - }), t instanceof qn ? [2, this._updateFileMessageMetaArray(t.messageId, i, "add", !0)] : [2, this._updateUserMessageMetaArray(t.messageId, i, "add", !0)]; - }); - }); - }, n.prototype.deleteMessageMetaArrayKeys = function(t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - return ve(t instanceof kr && t.messageId > 0 && Ot("string", r)).throw(H.invalidParameters), i = r.map(function(o) { - return new Br({ key: o }); - }), t instanceof qn ? [2, this._updateFileMessageMetaArray(t.messageId, i, "remove", !0)] : [2, this._updateUserMessageMetaArray(t.messageId, i, "remove", !0)]; - }); - }); - }, n.prototype.addMessageMetaArrayValues = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - return ve(t instanceof kr && t.messageId > 0 && r.every(function(a) { - return a instanceof Br; - })).throw(H.invalidParameters), t instanceof qn ? [2, this._updateFileMessageMetaArray(t.messageId, r, "add", !0)] : [2, this._updateUserMessageMetaArray(t.messageId, r, "add", !0)]; - }); - }); - }, n.prototype.removeMessageMetaArrayValues = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - return ve(t instanceof kr && t.messageId > 0 && r.every(function(a) { - return a instanceof Br; - })).throw(H.invalidParameters), t instanceof qn ? [2, this._updateFileMessageMetaArray(t.messageId, r, "remove", !0)] : [2, this._updateUserMessageMetaArray(t.messageId, r, "remove", !0)]; - }); - }); - }, n.prototype.report = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return ve(Mt(Zu, t) && k("string", r)).throw(H.invalidParameters), i = U.of(this._iid), a = i.sdkState, o = i.requestQueue, s = new r5({ channelUrl: this.url, channelType: this.channelType, userId: a.userId, category: t, description: r }), [4, o.send(s)]; - case 1: - return c.sent(), [2]; - } - }); - }); - }, n.prototype.reportUser = function(t, r, i) { - return T(this, void 0, void 0, function() { - var a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return ve(t instanceof Dt && Mt(Zu, r) && k("string", i)).throw(H.invalidParameters), a = U.of(this._iid), o = a.sdkState, s = a.requestQueue, c = new i5({ channelUrl: this.url, channelType: this.channelType, userId: o.userId, offendingUserId: t.userId, category: r, description: i }), [4, s.send(c)]; - case 1: - return l.sent(), [2]; - } - }); - }); - }, n.prototype.reportMessage = function(t, r, i) { - return T(this, void 0, void 0, function() { - var a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return ve(t instanceof Vn && Mt(Zu, r) && k("string", i)).throw(H.invalidParameters), a = U.of(this._iid), o = a.sdkState, s = a.requestQueue, c = new a5({ channelUrl: this.url, channelType: this.channelType, userId: o.userId, offendingUserId: t.sender.userId, messageId: t.messageId, category: r, description: i }), [4, s.send(c)]; - case 1: - return l.sent(), [2]; - } - }); - }); - }, n.prototype.updatePoll = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(k("number", t) && function(c) { - return k("string", c.title, !0) && oA(c.data) && k("boolean", c.allowUserSuggestion, !0) && k("boolean", c.allowMultipleVotes, !0) && k("number", c.closeAt, !0); - }(r)).throw(H.invalidParameters), i = U.of(this._iid).requestQueue, a = new g5(L({ pollId: t }, r)), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(y5).poll]; - } - }); - }); - }, n.prototype.deletePoll = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return r = k("number", t), ve(r).throw(H.invalidParameters), i = U.of(this._iid).requestQueue, a = new E5({ pollId: t }), [4, i.send(a)]; - case 1: - return o.sent(), [2]; - } - }); - }); - }, n.prototype.closePoll = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return r = k("number", t), ve(r).throw(H.invalidParameters), i = U.of(this._iid).requestQueue, a = new _5({ pollId: t }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(b5).poll]; - } - }); - }); - }, n.prototype.addPollOption = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return i = k("number", t) && k("string", r) && r.trim() !== "", ve(i).throw(H.invalidParameters), a = U.of(this._iid).requestQueue, o = new C5({ channelUrl: this.url, channelType: this.channelType, pollId: t, optionText: r }), [4, a.send(o)]; - case 1: - return s = c.sent(), [2, s.as(T5).poll]; - } - }); - }); - }, n.prototype.updatePollOption = function(t, r, i) { - return T(this, void 0, void 0, function() { - var a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return a = k("number", t) && k("number", r) && k("string", i) && i.trim() !== "", ve(a).throw(H.invalidParameters), o = U.of(this._iid).requestQueue, s = new S5({ pollId: t, pollOptionId: r, optionText: i }), [4, o.send(s)]; - case 1: - return c = l.sent(), [2, c.as(w5).poll]; - } - }); - }); - }, n.prototype.deletePollOption = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return i = k("number", t) && k("number", r), ve(i).throw(H.invalidParameters), a = U.of(this._iid).requestQueue, o = new A5({ pollId: t, pollOptionId: r }), [4, a.send(o)]; - case 1: - return s.sent(), [2]; - } - }); - }); - }, n.prototype.votePoll = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s, c, l, u; - return C(this, function(d) { - switch (d.label) { - case 0: - return i = k("number", t) && Ot("number", r), ve(i).throw(H.invalidParameters), a = U.of(this._iid), o = a.requestQueue, s = a.dispatcher, c = new N5({ reqId: this._generateRequestId(), channelUrl: this.url, channelType: this.channelType, pollId: t, pollOptionIds: r }), [4, o.send(c)]; - case 1: - return l = d.sent(), u = l.as(L1).event, s.dispatch(new Zp({ event: u, source: ne.EVENT_POLL_VOTED })), [2, u]; - } - }); - }); - }, n.prototype.getPollChangeLogsSinceTimestamp = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return ve(k("number", t)).throw(H.invalidParameters), [4, np.of(this._iid).getPollChangeLogs(this.url, this.channelType, t)]; - case 1: - return [2, r.sent()]; - } - }); - }); - }, n.prototype.getPollChangeLogsSinceToken = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return ve(k("string", t, !0)), [4, np.of(this._iid).getPollChangeLogs(this.url, this.channelType, t)]; - case 1: - return [2, r.sent()]; - } - }); - }); - }, n.prototype.createPollListQuery = function(t) { - return t === void 0 && (t = 10), new uA(this._iid, { channelUrl: this.url, channelType: this.channelType, limit: t }); - }, n.prototype.createPollVoterListQuery = function(t, r, i) { - return i === void 0 && (i = 20), new dA(this._iid, { channelUrl: this.url, channelType: this.channelType, pollId: t, pollOptionId: r, limit: i }); - }, n; -}(br), FA = function(e) { - function n(t) { - t === void 0 && (t = {}); - var r = e.call(this) || this; - return Object.keys(t).forEach(function(i) { - r.hasOwnProperty(i) && (r[i] = t[i]); - }), r; - } - return O(n, e), n; -}(function() { - this.onConnected = bt, this.onReconnectStarted = bt, this.onReconnectSucceeded = bt, this.onReconnectFailed = bt, this.onDisconnected = bt; -}), B5 = function(e) { - function n(t) { - t === void 0 && (t = {}); - var r = e.call(this) || this; - return Object.keys(t).forEach(function(i) { - r.hasOwnProperty(i) && (r[i] = t[i]); - }), r; - } - return O(n, e), n; -}(function() { - this.onSessionExpired = bt, this.onSessionTokenRequired = function(e) { - return e(null); - }, this.onSessionError = bt, this.onSessionRefreshed = bt, this.onSessionClosed = bt; -}), H5 = function(e) { - function n(t) { - t === void 0 && (t = {}); - var r = e.call(this) || this; - return Object.keys(t).forEach(function(i) { - r.hasOwnProperty(i) && (r[i] = t[i]); - }), r; - } - return O(n, e), n; -}(function() { - this.onFriendsDiscovered = bt, this.onTotalUnreadMessageCountChanged = bt, this.onTotalUnreadMessageCountUpdated = bt; -}), j5 = function(e) { - function n(t) { - var r = t.limit, i = t.token, a = t.userIdsFilter, o = t.metaDataKeyFilter, s = t.metaDataValuesFilter, c = t.nicknameStartsWithFilter, l = e.call(this) || this; - return l.method = pe.GET, l.path = qt, l.params = Be({ limit: r, token: i, user_ids: a, metadatakey: o, metadatavalues_in: s, nickname_startswith: c }), l; - } - return O(n, e), n; -}(ge), V5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.users = r.users.map(function(a) { - return new Dt(t, a); - }), i.next = r.next, i; - } - return O(n, e), n; -}(_e), G5 = function(e) { - function n(t, r) { - var i, a, o, s = this; - return (s = e.call(this, t, r) || this).userIdsFilter = null, s.metaDataKeyFilter = null, s.metaDataValuesFilter = null, s.nicknameStartsWithFilter = null, s.userIdsFilter = (i = r.userIdsFilter) !== null && i !== void 0 ? i : null, s.metaDataKeyFilter = (a = r.metaDataKeyFilter) !== null && a !== void 0 ? a : null, s.metaDataValuesFilter = (o = r.metaDataValuesFilter) !== null && o !== void 0 ? o : null, s.nicknameStartsWithFilter = r.nicknameStartsWithFilter || null, s; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && Ot("string", this.userIdsFilter, !0) && k("string", this.metaDataKeyFilter, !0) && Ot("string", this.metaDataValuesFilter, !0) && k("string", this.nicknameStartsWithFilter, !0); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new j5(Xe(L(L({}, this), { token: this._token }))), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = c.sent(), a = i.as(V5), o = a.users, s = a.next, this._token = s, this._hasNext = !!s, this._isLoading = !1, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(ko), z5 = function(e) { - function n(t) { - var r = t.userId, i = t.limit, a = t.token, o = t.userIdsFilter, s = e.call(this) || this; - return s.method = pe.GET, s.path = "".concat(qt, "/").concat(r, "/block"), s.params = Be({ limit: i, token: a, user_ids: o }), s; - } - return O(n, e), n; -}(ge), q5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.users = r.users.map(function(a) { - return new Dt(t, a); - }), i.next = r.next, i; - } - return O(n, e), n; -}(_e), K5 = function(e) { - function n(t, r) { - var i, a = this; - return (a = e.call(this, t, r) || this).userIdsFilter = null, a.userIdsFilter = (i = r.userIdsFilter) !== null && i !== void 0 ? i : null, a; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && Ot("string", this.userIdsFilter, !0); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new z5(Xe(L(L({}, this), { userId: r.userId, token: this._token }))), [4, i.send(a)]) : [3, 2] : [3, 5]; - case 1: - return o = u.sent(), s = o.as(q5), c = s.users, l = s.next, this._token = l, this._hasNext = !!l, this._isLoading = !1, [2, c]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(ko), W5 = function(e) { - function n(t) { - var r = t.userId, i = t.limit, a = t.token, o = e.call(this) || this; - return o.method = pe.GET, o.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/friends"), o.params = { limit: i, token: a }, o; - } - return O(n, e), n; -}(ge), Y5 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.hasMore = r.has_more, i.users = r.users.map(function(a) { - return new Dt(t, a); - }), i.next = r.next, i; - } - return O(n, e), n; -}(_e), Z5 = function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l, u; - return C(this, function(d) { - switch (d.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new W5(L(L({}, this), { userId: r.userId, token: this._token })), [4, i.send(a)]) : [3, 2] : [3, 5]; - case 1: - return o = d.sent(), s = o.as(Y5), c = s.users, l = s.hasMore, u = s.next, this._token = u, this._hasNext = l, this._isLoading = !1, [2, c]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(ko), Wh = {}, rh = function() { - function e(n) { - var t = n.dbname, r = n.itemSizeLimit, i = r === void 0 ? 1048576 : r, a = n.cacheLimit, o = a === void 0 ? 256 : a, s = n.blockHashBase, c = s === void 0 ? 2 : s, l = n.blockHashMultiplier, u = l === void 0 ? 10 : l, d = n.blockHashConstant, h = d === void 0 ? 11 : d, f = n.transactionApplyDelay, p = f === void 0 ? 200 : f, v = n.disableLogger, m = v !== void 0 && v; - return Wh[t] || (this.itemSizeLimit = i, this.cacheLimit = o, this.blockHashBase = c, this.blockHashMultiplier = u, this.blockHashConstant = h, this.transactionApplyDelay = p, this.disableLogger = m, Wh[t] = this), Wh[t]; - } - return e.get = function(n) { - return Wh[n]; - }, e; -}(); -(function(e) { - e[e.UNKNOWN_ERROR = 6e7] = "UNKNOWN_ERROR", e[e.STORE_NOT_DEFINED = 61001e3] = "STORE_NOT_DEFINED", e[e.STORE_NOT_AVAILABLE = 61001001] = "STORE_NOT_AVAILABLE", e[e.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING = 61001002] = "STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING", e[e.STORE_IS_FULL = 61001003] = "STORE_IS_FULL", e[e.STORE_NOT_INITIALIZED = 61001004] = "STORE_NOT_INITIALIZED", e[e.STORE_INVALID_KEY_TYPE = 61002e3] = "STORE_INVALID_KEY_TYPE", e[e.STORE_BROKEN_INTEGRITY = 61002001] = "STORE_BROKEN_INTEGRITY", e[e.STORE_BROKEN_BLOB = 61002002] = "STORE_BROKEN_BLOB", e[e.STORE_ENCRYPTION_INVALID = 61002003] = "STORE_ENCRYPTION_INVALID", e[e.STORE_ITEM_SIZE_LIMIT_EXCEEDED = 61017e3] = "STORE_ITEM_SIZE_LIMIT_EXCEEDED", e[e.STORE_READ_FAILED = 61017001] = "STORE_READ_FAILED", e[e.STORE_WRITE_FAILED = 61017002] = "STORE_WRITE_FAILED", e[e.DATABASE_SCHEMA_NOT_ON_UPGRADE = 62002e3] = "DATABASE_SCHEMA_NOT_ON_UPGRADE", e[e.COLLECTION_NOT_READY = 63001e3] = "COLLECTION_NOT_READY", e[e.COLLECTION_KEY_NOT_MATCH = 63002e3] = "COLLECTION_KEY_NOT_MATCH", e[e.COLLECTION_QUERY_NOT_VALID = 63002001] = "COLLECTION_QUERY_NOT_VALID", e[e.COLLECTION_KEY_NOT_FOUND = 63004e3] = "COLLECTION_KEY_NOT_FOUND", e[e.COLLECTION_KEY_NOT_GIVEN = 63004001] = "COLLECTION_KEY_NOT_GIVEN", e[e.COLLECTION_INSERT_DUPLICATE = 63009e3] = "COLLECTION_INSERT_DUPLICATE", e[e.COLLECTION_WRITE_FAILED = 63017e3] = "COLLECTION_WRITE_FAILED", e[e.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED = 63017001] = "COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED", e[e.INDEX_TABLE_IS_REQUIRED = 65001e3] = "INDEX_TABLE_IS_REQUIRED", e[e.INDEX_TYPE_NOT_MATCH = 65002e3] = "INDEX_TYPE_NOT_MATCH", e[e.COMPARE_TYPE_NOT_MATCH = 69002001] = "COMPARE_TYPE_NOT_MATCH", e[e.CIRCULAR_REFERENCE_FOUND = 69002002] = "CIRCULAR_REFERENCE_FOUND"; -})(On || (On = {})); -var al, on = function(e) { - function n(t) { - var r = t.code, i = r === void 0 ? On.UNKNOWN_ERROR : r, a = t.message, o = a === void 0 ? "Unknown error occurred." : a, s = e.call(this, o) || this; - return s.code = i, Object.setPrototypeOf(s, n.prototype), s; - } - return O(n, e), Object.defineProperty(n, "storeNotDefined", { get: function() { - return new n({ code: On.STORE_NOT_DEFINED, message: "Store is not defined. Specify the store on NestDB()" }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeNotAvailable", { get: function() { - return new n({ code: On.STORE_NOT_AVAILABLE, message: "Store is not available. Check your environment settings." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeNotAvailableInPrivateBrowsing", { get: function() { - return new n({ code: On.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING, message: "Store is not available because it is in private browsing." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeIsFull", { get: function() { - return new n({ code: On.STORE_IS_FULL, message: "Store is full." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeNotInitialized", { get: function() { - return new n({ code: On.STORE_NOT_INITIALIZED, message: "Store is not initialized." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeKeyTypeIsInvalid", { get: function() { - return new n({ code: On.STORE_INVALID_KEY_TYPE, message: "Store key should be string type." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeBrokenIntegrity", { get: function() { - return new n({ code: On.STORE_BROKEN_INTEGRITY, message: "Data should be in a store but it does not. Integrity is broken." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeBrokenBlob", { get: function() { - return new n({ code: On.STORE_BROKEN_BLOB, message: "Data should be in a store but it does not. Blob data is broken." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeEncryptionInvalid", { get: function() { - return new n({ code: On.STORE_ENCRYPTION_INVALID, message: "Encryption algorithm has changed. All the store should reset." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeItemSizeExceeded", { get: function() { - return new n({ code: On.STORE_ITEM_SIZE_LIMIT_EXCEEDED, message: "The size of the item exceeds the limit that the store allows." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeReadFailed", { get: function() { - return new n({ code: On.STORE_READ_FAILED, message: "Failed to read from store." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "storeWriteFailed", { get: function() { - return new n({ code: On.STORE_WRITE_FAILED, message: "Failed to write to store." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "databaseSchemaNotOnUpgrade", { get: function() { - return new n({ code: On.DATABASE_SCHEMA_NOT_ON_UPGRADE, message: "Committing schema is not allowed when upgrade is not running." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "collectionNotReady", { get: function() { - return new n({ code: On.COLLECTION_NOT_READY, message: "Collection is not ready due to an error during initialization." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "collectionKeyNotMatch", { get: function() { - return new n({ code: On.COLLECTION_KEY_NOT_MATCH, message: "keyName of collection could not change." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "collectionQueryNotValid", { get: function() { - return new n({ code: On.COLLECTION_QUERY_NOT_VALID, message: "Query parameter is not a valid format." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "collectionInsertDuplicate", { get: function() { - return new n({ code: On.COLLECTION_INSERT_DUPLICATE, message: "The key already exists." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "collectionKeyNotFound", { get: function() { - return new n({ code: On.COLLECTION_KEY_NOT_FOUND, message: "The key is not found." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "collectionKeyNotGiven", { get: function() { - return new n({ code: On.COLLECTION_KEY_NOT_GIVEN, message: "The item should contain [keyName] property." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "collectionWriteFailed", { get: function() { - return new n({ code: On.COLLECTION_WRITE_FAILED, message: "Failed to write an item." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "collectionItemSizeExceeded", { get: function() { - return new n({ code: On.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED, message: "The size of the item exceeds the limit that a collection allows." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "indexTableIsRequired", { get: function() { - return new n({ code: On.INDEX_TABLE_IS_REQUIRED, message: "Index table is required." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "indexTypesNotMatch", { get: function() { - return new n({ code: On.INDEX_TYPE_NOT_MATCH, message: "Indexed column should have primitive type." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "compareTypesNotMatch", { get: function() { - return new n({ code: On.COMPARE_TYPE_NOT_MATCH, message: "Values to compare have different types." }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n, "circularReferenceFound", { get: function() { - return new n({ code: On.CIRCULAR_REFERENCE_FOUND, message: "Cannot handle circular referenced object." }); - }, enumerable: !1, configurable: !0 }), n; -}(Error); -(function(e) { - e.INIT = "init", e.READY = "ready", e.CLOSED = "closed"; -})(al || (al = {})); -var xb, ei = function(e, n) { - if (n === void 0 && (n = /* @__PURE__ */ new WeakMap()), typeof e == "object" && e !== null) { - if (n.has(e)) - throw on.circularReferenceFound; - n.set(e, !0); - var t = void 0; - if (Array.isArray(e)) - t = e.map(function(i) { - return ei(i, n); - }); - else if (e instanceof RegExp) - t = e; - else if (e instanceof Date) - t = e; - else - for (var r in t = {}, e) - t[r] = ei(e[r], n); - return n.delete(e), t; - } - return e; -}, bo = function(e, n) { - if (n == null) - return 1; - if (e == null) - return -1; - if (typeof e != typeof n) - throw on.compareTypesNotMatch; - var t = 0; - switch (typeof e) { - case "boolean": - case "number": - t = e - n; - break; - case "string": - t = e.localeCompare(n); - } - return t; -}, Rb = function(e, n) { - for (var t = 0, r = 0; r < e.length; r++) - t = e.charCodeAt(r) + (t << 6) + (t << 16) - t; - return (t >>> 0) % n; -}, Yh = function(e) { - return new Promise(function(n) { - setTimeout(function() { - return n(); - }, e); - }); -}, _l = function(e, n) { - if (!n) - return !1; - if (typeof e != "function") { - for (var t in e) - if (["/and", "&&"].includes(t)) { - if (e[t].some(function(c) { - return !_l(c, n); - })) - return !1; - } else if (["/or", "||"].includes(t)) { - if (e[t].every(function(c) { - return !_l(c, n); - })) - return !1; - } else if (t === "/where") { - if (!(0, e[t])(n)) - return !1; - } else { - var r = t; - if (typeof e[r] == "object") { - var i = e[r]; - for (var a in i) - switch (a) { - case "/eq": - case "=": - if ((o = n[r]) !== (s = i[a])) - return !1; - break; - case "/neq": - case "!=": - if ((o = n[r]) === (s = i[a])) - return !1; - break; - case "/gt": - case ">": - var o = n[r], s = i[a]; - if (!(bo(o, s) > 0)) - return !1; - break; - case "/gte": - case ">=": - if (o = n[r], s = i[a], !(bo(o, s) >= 0)) - return !1; - break; - case "/lt": - case "<": - if (o = n[r], s = i[a], !(bo(o, s) < 0)) - return !1; - break; - case "/lte": - case "<=": - if (o = n[r], s = i[a], !(bo(o, s) <= 0)) - return !1; - break; - case "/in": - if (o = n[r], !(s = i[a]).includes(o)) - return !1; - break; - case "/nin": - if (o = n[r], (s = i[a]).includes(o)) - return !1; - break; - case "/contain": - if (o = n[r], s = i[a], !o.includes(s)) - return !1; - break; - case "/regex": - if (o = n[r], !(s = i[a]).test(o)) - return !1; - break; - case "/where": - if (o = n[r], !(0, i[a])(o)) - return !1; - } - } else if (typeof e[r] == "function") { - if (!e[r](n[r])) - return !1; - } else if (e[r] !== n[r]) - return !1; - } - return !0; - } - return e(n); -}, Iu = function() { -}, Db = function() { - return Promise.resolve(); -}, Q5 = function(e) { - return e; -}, Lb = function(e, n) { - n(); -}; -(function(e) { - e[e.FORWARD = 0] = "FORWARD", e[e.BACKWARD = 1] = "BACKWARD"; -})(xb || (xb = {})); -var bl, Ur, ka, X5 = function() { - function e(n) { - var t = n.initialPrevValue, r = t === void 0 ? null : t, i = n.initialNextValue, a = i === void 0 ? null : i, o = n.iterator, s = n.map, c = s === void 0 ? Q5 : s, l = n.backward, u = l === void 0 ? Db : l, d = n.forward, h = d === void 0 ? Db : d, f = n.complete, p = f === void 0 ? Iu : f; - this._prevValue = r, this._nextValue = a, this._error = null, this._map = c, this._backward = u, this._forward = h, this._iterator = o, this._complete = p; - } - return Object.defineProperty(e.prototype, "prevValue", { get: function() { - return this._map(this._prevValue); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "nextValue", { get: function() { - return this._map(this._nextValue); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "error", { get: function() { - return this._error; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "hasPrevious", { get: function() { - return !!this._prevValue; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "hasNext", { get: function() { - return !!this._nextValue; - }, enumerable: !1, configurable: !0 }), e.prototype.prev = function() { - return T(this, void 0, void 0, function() { - var n, t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - if (!this.hasPrevious) - return [3, 6]; - i.label = 1; - case 1: - return i.trys.push([1, 3, , 4]), n = this._prevValue, t = this, [4, this._backward()]; - case 2: - return t._prevValue = i.sent() || null, this._nextValue = n, [3, 4]; - case 3: - return r = i.sent(), this._error = r, [3, 4]; - case 4: - return [4, this._iterator(this)]; - case 5: - return [2, i.sent()]; - case 6: - this._complete(), i.label = 7; - case 7: - return [2]; - } - }); - }); - }, e.prototype.next = function() { - return T(this, void 0, void 0, function() { - var n, t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - if (!this.hasNext) - return [3, 6]; - i.label = 1; - case 1: - return i.trys.push([1, 3, , 4]), n = this._nextValue, t = this, [4, this._forward()]; - case 2: - return t._nextValue = i.sent() || null, this._prevValue = n, [3, 4]; - case 3: - return r = i.sent(), this._error = r, [3, 4]; - case 4: - return [4, this._iterator(this)]; - case 5: - return [2, i.sent()]; - case 6: - this._complete(), i.label = 7; - case 7: - return [2]; - } - }); - }); - }, e.prototype.stop = function() { - this._prevValue = null, this._nextValue = null, this._complete(); - }, e; -}(), Zm = function() { - function e(n) { - var t = n.condition, r = t === void 0 ? {} : t, i = n.backward, a = i !== void 0 && i, o = n.blockManager, s = n.indexer; - this.condition = r, this.backward = a, this._blockManager = o, this._indexer = s; - } - return e.prototype.findOptimizedStartPosition = function() { - var n = this, t = ["=", "/eq", ">", ">=", "/gt", "/gte"], r = ["=", "/eq", "<", "<=", "/lt", "/lte"]; - if (this.backward) { - var i = this._indexer.origin.length - 1; - if (typeof this.condition != "function") - for (var a in this._indexer.fields) { - var o = this._indexer.fields[a], s = 1; - if (o[0] === "-" && (o = o.slice(1), s = -1), this.condition[o]) { - if (typeof this.condition[o] == "object") { - var c = s > 0 ? r : t; - for (var l in this.condition[o]) - if (c.includes(l)) { - for (var u = i; u >= 0; u--) - if (s * bo(this._indexer.origin[u].columnValues[a], this.condition[o][l]) <= 0) { - i = u; - break; - } - } - } else - for (u = i; u >= 0; u--) - if (s * bo(this._indexer.origin[u].columnValues[a], this.condition[o]) <= 0) { - i = u; - break; - } - } - } - return Math.min(i + 1, this._indexer.origin.length - 1); - } - var d = 0; - if (typeof this.condition != "function") - for (var h = function(v) { - var m = f._indexer.fields[v], E = 1; - if (m[0] === "-" && (m = m.slice(1), E = -1), f.condition[m]) { - if (typeof f.condition[m] == "object") - Object.keys(f.condition[m]).forEach(function(_) { - if ((E > 0 ? t : r).includes(_)) { - for (var S = d; S < n._indexer.origin.length; S++) - if (E * bo(n._indexer.origin[S].columnValues[v], n.condition[m][_]) >= 0) { - d = S; - break; - } - } - }); - else - for (var y = d; y < f._indexer.origin.length; y++) - if (E * bo(f._indexer.origin[y].columnValues[v], f.condition[m]) >= 0) { - d = y; - break; - } - } - }, f = this, a = 0; a < this._indexer.fields.length; a++) - h(a); - return Math.max(d - 1, 0); - }, e.prototype.each = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l = this; - return C(this, function(u) { - switch (u.label) { - case 0: - if (t = this.findOptimizedStartPosition(), r = 0, this.backward && this._indexer.origin[t] && (r = this._indexer.origin[t].keys.length - 1), i = function() { - if (l._indexer.origin[t]) { - if (!l._indexer.origin[t].keys[++r]) { - if (!l._indexer.origin[++t]) - return !1; - r = 0; - } - return !0; - } - return !1; - }, a = function() { - if (l._indexer.origin[t]) { - if (!l._indexer.origin[t].keys[--r]) { - if (!l._indexer.origin[--t]) - return !1; - r = l._indexer.origin[t].keys.length - 1; - } - return !0; - } - return !1; - }, o = null, !this._indexer.origin[t]) - return [3, 4]; - s = this.backward ? a : i, u.label = 1; - case 1: - return [4, this._blockManager.getFromBlock(this._indexer.origin[t].keys[r])]; - case 2: - if ((c = u.sent()) && _l(this.condition, c)) - return o = c, [3, 4]; - u.label = 3; - case 3: - if (s()) - return [3, 1]; - u.label = 4; - case 4: - return [4, new Promise(function(d) { - var h = new X5({ initialNextValue: ei(o), iterator: n, forward: function() { - return T(l, void 0, void 0, function() { - var f, p; - return C(this, function(v) { - switch (v.label) { - case 0: - f = this.backward ? a : i, v.label = 1; - case 1: - return f() ? [4, this._blockManager.getFromBlock(this._indexer.origin[t].keys[r])] : [3, 3]; - case 2: - return (p = v.sent()) && _l(this.condition, p) ? [2, ei(p)] : [3, 1]; - case 3: - return [2, null]; - } - }); - }); - }, backward: function() { - return T(l, void 0, void 0, function() { - var f, p; - return C(this, function(v) { - switch (v.label) { - case 0: - f = this.backward ? i : a, v.label = 1; - case 1: - return f() ? [4, this._blockManager.getFromBlock(this._indexer.origin[t].keys[r])] : [3, 3]; - case 2: - return (p = v.sent()) && _l(this.condition, p) ? [2, ei(p)] : [3, 1]; - case 3: - return [2, null]; - } - }); - }); - }, complete: d }); - n(h); - })]; - case 5: - return [2, u.sent()]; - } - }); - }); - }, e; -}(), J5 = function() { - function e(n) { - var t = n.condition, r = t === void 0 ? {} : t, i = n.backward, a = i !== void 0 && i, o = n.mutex, s = n.blockManager, c = n.indexer; - this._mutex = o, this._iterator = new Zm({ condition: r, backward: a, blockManager: s, indexer: c }); - } - return e.prototype.fetch = function(n) { - return n === void 0 && (n = {}), T(this, void 0, void 0, function() { - var t, r, i, a, o = this; - return C(this, function(s) { - switch (s.label) { - case 0: - if (t = Math.max(n.offset || 0, 0), (r = typeof n.limit == "number" ? n.limit : Number.MAX_SAFE_INTEGER) === 0) - return [2, []]; - if (r < 0) - throw on.collectionQueryNotValid; - s.label = 1; - case 1: - return s.trys.push([1, 4, , 5]), i = [], [4, this._mutex.lock()]; - case 2: - return s.sent(), [4, this._iterator.each(function(c) { - return T(o, void 0, void 0, function() { - return C(this, function(l) { - return c.error ? c.stop() : c.hasNext ? t === 0 ? (i.push(c.nextValue), 0 < r && r <= i.length ? c.stop() : c.next()) : (t--, c.next()) : c.stop(), [2]; - }); - }); - })]; - case 3: - return s.sent(), this._mutex.unlock(), [2, i]; - case 4: - throw a = s.sent(), this._mutex.unlock(), a; - case 5: - return [2]; - } - }); - }); - }, e.prototype.count = function() { - return T(this, void 0, void 0, function() { - var n, t, r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return i.trys.push([0, 3, , 4]), n = 0, [4, this._mutex.lock()]; - case 1: - return i.sent(), [4, this._iterator.each(function(a) { - return T(r, void 0, void 0, function() { - return C(this, function(o) { - return a.error ? a.stop() : a.hasNext ? (n++, a.next()) : a.stop(), [2]; - }); - }); - })]; - case 2: - return i.sent(), this._mutex.unlock(), [2, n]; - case 3: - throw t = i.sent(), this._mutex.unlock(), t; - case 4: - return [2]; - } - }); - }); - }, e; -}(), Qm = function(e) { - return "".concat("nest", "@").concat(e); -}, Nl = function(e, n) { - return "".concat(Qm(e), "/").concat(n); -}, m0 = function(e, n) { - return "".concat(Nl(e, n), ".metadata"); -}, Xm = function(e, n) { - return "".concat(Nl(e, n), "/block."); -}, Pb = function(e, n) { - return "".concat(Nl(e, n), "/blob."); -}, $5 = function() { - function e(n) { - var t = n.dbname, r = n.collectionName, i = n.store; - this.dbname = t, this.collectionName = r, this.store = i; - } - return e.prototype.get = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l, u; - return C(this, function(d) { - switch (d.label) { - case 0: - return [4, this.store.get(n)]; - case 1: - return (t = d.sent()) ? (r = t.data, i = t.type, typeof fetch > "u" ? [3, 4] : [4, fetch(r)]) : [3, 5]; - case 2: - return [4, d.sent().blob()]; - case 3: - return [2, d.sent()]; - case 4: - for (a = [], o = atob(r.split(",")[1]), s = 0; s < o.length; s += 512) { - for (c = o.slice(s, s + 512), l = new Array(c.length), u = 0; u < c.length; u++) - l[u] = c.charCodeAt(u); - a.push(new Uint8Array(l)); - } - return [2, new Blob(a, { type: i })]; - case 5: - return [2, null]; - } - }); - }); - }, e.prototype.save = function(n, t) { - return t === void 0 && (t = "".concat(Date.now())), T(this, void 0, void 0, function() { - var r, i, a, o, s = this; - return C(this, function(c) { - switch (c.label) { - case 0: - return [4, new Promise(function(l) { - var u = function(h, f, p, v) { - return v === void 0 && (v = 0), "".concat(Pb(h, f)).concat(p, ".").concat(v); - }(s.dbname, s.collectionName, t), d = new FileReader(); - d.onload = function() { - l({ blobId: u, data: d.result, type: n.type }); - }, d.readAsDataURL(n); - })]; - case 1: - return r = c.sent(), i = r.blobId, a = r.data, o = r.type, [4, this.store.set({ key: i, value: { data: a, type: o } })]; - case 2: - return c.sent(), [2, i]; - } - }); - }); - }, e.prototype.remove = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this.store.remove(n)]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, e.prototype.clear = function() { - return T(this, void 0, void 0, function() { - var n, t, r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return n = Pb(this.dbname, this.collectionName), [4, this.store.getAllKeys()]; - case 1: - return t = i.sent(), [4, Promise.all(t.filter(function(a) { - return a.startsWith(n); - }).map(function(a) { - return T(r, void 0, void 0, function() { - return C(this, function(o) { - switch (o.label) { - case 0: - return [4, this.store.remove(a)]; - case 1: - return [2, o.sent()]; - } - }); - }); - }))]; - case 2: - return i.sent(), [2]; - } - }); - }); - }, e; -}(); -(function(e) { - e[e.COMMIT = 0] = "COMMIT", e[e.WRITE = 1] = "WRITE", e[e.ERROR = 2] = "ERROR"; -})(bl || (bl = {})), function(e) { - e.PENDING = "pending", e.PERSISTENT = "persistent", e.VOLATILE = "volatile"; -}(Ur || (Ur = {})), function(e) { - e[e.NO_CACHE = 0] = "NO_CACHE", e[e.DEFAULT = 1] = "DEFAULT", e[e.PERSISTENT = 2] = "PERSISTENT"; -}(ka || (ka = {})); -var Qu, Dr, kb = [Ur.PENDING, Ur.VOLATILE], Zh = {}, $i = function() { - function e(n) { - var t = n.dbname, r = n.limit, i = r === void 0 ? 256 : r; - return Zh[t] || (this.dbname = t, this._items = [], this._limit = i, Zh[t] = this), Zh[t]; - } - return e.get = function(n) { - return Zh[n]; - }, Object.defineProperty(e.prototype, "items", { get: function() { - return this._items; - }, enumerable: !1, configurable: !0 }), e.prototype.find = function(n, t, r) { - return r === void 0 && (r = ka.DEFAULT), T(this, void 0, void 0, function() { - var i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return (i = this.get(t)) ? [3, 2] : [4, n.get(t)]; - case 1: - return (a = o.sent()) && (i = { key: t, value: a, state: r === ka.PERSISTENT ? Ur.PERSISTENT : Ur.VOLATILE }, this.put(i)), [3, 3]; - case 2: - r === ka.PERSISTENT && (i.state = Ur.PERSISTENT), o.label = 3; - case 3: - return [2, i]; - } - }); - }); - }, e.prototype.get = function(n, t) { - t === void 0 && (t = ka.DEFAULT); - var r = this._items.map(function(a) { - return a.key; - }).indexOf(n); - if (r > -1) { - var i = this._items[r]; - return t === ka.PERSISTENT && (i.state = Ur.PERSISTENT), t !== ka.NO_CACHE && this.put(i), i; - } - return null; - }, e.prototype.put = function(n) { - var t, r; - if (this._limit > 0) { - var i = this._items.map(function(d) { - return d.key; - }).indexOf(n.key); - if (i > -1) - kb.includes(this._items[i].state) && kb.includes(n.state) ? (this._items.splice(i, 1), this._items.push(n)) : (this._items[i].state = n.state, this._items[i].value = n.value); - else { - this._items.push(n); - var a = this._items.filter(function(d) { - return d.state === Ur.VOLATILE; - }), o = a.length - this._limit; - if (o > 0) { - var s = []; - try { - for (var c = Ne(this._items), l = c.next(); !l.done; l = c.next()) { - var u = l.value; - u.state === Ur.VOLATILE && o > 0 ? o-- : s.push(u); - } - } catch (d) { - t = { error: d }; - } finally { - try { - l && !l.done && (r = c.return) && r.call(c); - } finally { - if (t) - throw t.error; - } - } - this._items = s; - } - } - } - }, e.prototype.remove = function(n) { - var t = this._items.map(function(r) { - return r.key; - }).indexOf(n); - t > -1 && this._items.splice(t, 1); - }, e.prototype.clearByCondition = function(n) { - this._items = this._items.filter(function(t) { - return !n(t); - }); - }, e.prototype.clear = function(n) { - n === void 0 && (n = !1), this._items = n ? [] : this._items.filter(function(t) { - return t.state !== Ur.VOLATILE; - }); - }, e; -}(), eL = function() { - function e(n) { - var t = n.dbname, r = n.collectionName, i = n.store; - this._requests = [], this._onCommit = /* @__PURE__ */ new Map(), this._onWrite = /* @__PURE__ */ new Map(), this._onError = /* @__PURE__ */ new Map(), this.dbname = t, this.collectionName = r, this.metadataKey = function(a, o) { - return "".concat(Nl(a, o), "/trans.metadata"); - }(t, r), this.recordsetKey = function(a, o) { - return "".concat(Nl(a, o), "/trans.recordset"); - }(t, r), this._store = i; - } - return Object.defineProperty(e.prototype, "generation", { get: function() { - return this._metadata ? this._metadata.generation : 0; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "requestCount", { get: function() { - return this._requests.length; - }, enumerable: !1, configurable: !0 }), e.prototype._getReducedRecordset = function(n) { - return n === void 0 && (n = []), T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._store.get(this.recordsetKey)]; - case 1: - return (t = r.sent() || []).push.apply(t, dt([], tt(n), !1)), [2, this._reduceRecordSet(t)]; - } - }); - }); - }, e.prototype._reduceRecordSet = function(n) { - for (var t = [], r = {}, i = n.length - 1; i >= 0; i--) { - for (var a = n[i], o = [], s = a.requests.length - 1; s >= 0; s--) { - var c = a.requests[s], l = c.data; - r[l.key] || (o.unshift(c), r[l.key] = !0); - } - o.length > 0 && (a.requests = o, t.unshift(a)); - } - return t; - }, e.prototype._applyRecord = function(n, t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - r = $i.get(this.dbname), i = t.generation, a = t.requests, o = null, h.label = 1; - case 1: - return h.trys.push([1, 3, , 4]), [4, this._store.setMany(a.map(function(f) { - return L(L({}, f.data), { generation: i }); - }))]; - case 2: - for (s = h.sent(), c = 0; c < a.length; c++) - s[c] instanceof Error && (o || (o = s[c]), l = a[c].data, r.put(L(L({}, l), { state: Ur.PERSISTENT }))); - return [3, 4]; - case 3: - return u = h.sent(), o = u, [3, 4]; - case 4: - return o ? [3, 6] : (d = n.filter(function(f) { - return f.generation !== i; - }), [4, this._store.set({ key: this.recordsetKey, value: d })]); - case 5: - return h.sent(), this._onWrite.forEach(function(f) { - f(a.map(function(p) { - return p.data; - })); - }), [3, 7]; - case 6: - this._onError.forEach(function(f) { - o && f(o); - }), h.label = 7; - case 7: - return [2]; - } - }); - }); - }, e.prototype.init = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return n = this, [4, this._store.get(this.metadataKey)]; - case 1: - return n._metadata = l.sent() || { generation: 1 }, [4, this._getReducedRecordset()]; - case 2: - t = l.sent(), l.label = 3; - case 3: - l.trys.push([3, 8, 9, 10]), r = Ne(t), i = r.next(), l.label = 4; - case 4: - return i.done ? [3, 7] : (a = i.value, [4, this._applyRecord(t, a)]); - case 5: - l.sent(), l.label = 6; - case 6: - return i = r.next(), [3, 4]; - case 7: - return [3, 10]; - case 8: - return o = l.sent(), s = { error: o }, [3, 10]; - case 9: - try { - i && !i.done && (c = r.return) && c.call(r); - } finally { - if (s) - throw s.error; - } - return [7]; - case 10: - return [2]; - } - }); - }); - }, e.prototype.on = function(n, t, r) { - switch (n) { - case bl.COMMIT: - this._onCommit.set(t, r); - break; - case bl.WRITE: - this._onWrite.set(t, r); - break; - case bl.ERROR: - this._onError.set(t, r); - } - }, e.prototype.requestWrite = function(n, t) { - this._requests.push({ data: n, options: t }), $i.get(this.dbname).put(L({ state: Ur.PENDING }, n)); - }, e.prototype.requestMultipleWrite = function(n, t) { - var r, i, a = $i.get(this.dbname); - try { - for (var o = Ne(n), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - this._requests.push({ data: c, options: t }), a.put(L({ state: Ur.PENDING }, c)); - } - } catch (l) { - r = { error: l }; - } finally { - try { - s && !s.done && (i = o.return) && i.call(o); - } finally { - if (r) - throw r.error; - } - } - }, e.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - return $i.get(this.dbname).clearByCondition(function(t) { - return t.state === Ur.PENDING; - }), this._requests = [], [2]; - }); - }); - }, e.prototype.commit = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o, s, c, l, u, d, h, f = this; - return C(this, function(p) { - switch (p.label) { - case 0: - if (!((n = this._requests).length > 0)) - return [3, 4]; - for (t = [], r = {}, c = n.length - 1; c >= 0; c--) - i = n[c], u = i.data, r[u.key] || (r[u.key] = !0, t.unshift(i)); - return a = { generation: this.generation, requests: t }, [4, this._getReducedRecordset([a])]; - case 1: - return o = p.sent(), [4, this._store.set({ key: this.recordsetKey, value: o })]; - case 2: - return p.sent(), this._metadata.generation++, [4, this._store.set({ key: this.metadataKey, value: this._metadata })]; - case 3: - for (p.sent(), s = $i.get(this.dbname), c = 0; c < t.length; c++) - l = t[c], u = l.data, d = l.options, s.put(L(L({}, u), { state: d && d.persistent ? Ur.PERSISTENT : Ur.VOLATILE })); - this._requests = [], this._onCommit.forEach(function(v) { - v(n.map(function(m) { - return m.data; - })); - }), h = rh.get(this.dbname), setTimeout(function() { - try { - f._applyRecord(o, a); - } catch (v) { - f._onError.forEach(function(m) { - return m(v); - }); - } - }, h.transactionApplyDelay), p.label = 4; - case 4: - return [2]; - } - }); - }); - }, e; -}(), If = function() { - function e(n) { - var t = n.blockId, r = n.keyName, i = n.items, a = i === void 0 ? [] : i, o = n.limit; - this.blockId = t, this.keyName = r, this.limit = o, this._items = dt([], tt(a), !1); - } - return e.createFromCacheItem = function(n) { - return n ? new e(n.value) : null; - }, Object.defineProperty(e.prototype, "isEmpty", { get: function() { - return this._items.length === 0; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "items", { get: function() { - return this._items; - }, enumerable: !1, configurable: !0 }), e.prototype.serialize = function() { - return { blockId: this.blockId, keyName: this.keyName, limit: this.limit, items: this._items }; - }, e.prototype.getItemByKey = function(n) { - var t = this, r = this._items.find(function(i) { - var a = i[t.keyName]; - return n === a; - }); - return r ?? null; - }, e.prototype.has = function(n) { - var t = this; - return this._items.map(function(r) { - return r[t.keyName]; - }).includes(n); - }, e.prototype.add = function(n) { - var t = this, r = this._items.map(function(i) { - return i[t.keyName]; - }).indexOf(n[this.keyName]); - return r < 0 ? this._items.length < this.limit && (this._items.push(n), !0) : (this._items[r] = n, !0); - }, e.prototype.remove = function(n) { - for (var t in this._items) - if (this._items[t][this.keyName] === n) - return this._items.splice(parseInt(t), 1), !0; - return !1; - }, e.prototype.clear = function() { - this._items = []; - }, e; -}(), tL = function() { - function e(n) { - var t = n.dbname, r = n.collectionName, i = n.metadata, a = n.hashFunction, o = a === void 0 ? Rb : a, s = n.transaction, c = n.store; - this.dbname = t, this.collectionName = r, this.hashFunction = o, this.metadata = i, this._transaction = s, this._store = c; - } - return Object.defineProperty(e.prototype, "keyName", { get: function() { - return this.metadata.keyName; - }, enumerable: !1, configurable: !0 }), e.prototype.createBlockId = function(n, t) { - return t === void 0 && (t = this.metadata.blockLevel), r = this.dbname, i = this.collectionName, a = t, o = "".concat(function(s, c, l) { - var u = l.base * Math.pow(l.multiplier, c) + l.constant; - return (l.hashFunction || Rb)(s, u); - }(n, t, { hashFunction: this.hashFunction, base: this.metadata.blockHashBase, multiplier: this.metadata.blockHashMultiplier, constant: this.metadata.blockHashConstant })), "".concat(Xm(r, i)).concat(a, ".").concat(o); - var r, i, a, o; - }, e.prototype._findBlock = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - t = $i.get(this.dbname), r = this.metadata.blockLevel, s.label = 1; - case 1: - return r > 0 ? (i = this.createBlockId(n, r), [4, t.find(this._store, i)]) : [3, 4]; - case 2: - if ((a = s.sent()) && (o = If.createFromCacheItem(a), o == null ? void 0 : o.getItemByKey(n))) - return [2, o]; - s.label = 3; - case 3: - return r--, [3, 1]; - case 4: - return [2, null]; - } - }); - }); - }, e.prototype.getFromBlock = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._findBlock(n)]; - case 1: - return [2, (t = r.sent()) ? t.getItemByKey(n) : null]; - } - }); - }); - }, e.prototype.putToBlock = function(n, t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return r = rh.get(this.dbname), i = this.createBlockId(n), a = Math.floor(this._store.itemSizeLimit / r.itemSizeLimit), [4, $i.get(this.dbname).find(this._store, i)]; - case 1: - return o = c.sent(), (s = o ? If.createFromCacheItem(o) : new If({ blockId: i, keyName: this.keyName, items: [], limit: a })) != null && s.add(t) ? (this._transaction.requestWrite({ key: s.blockId, value: s.serialize() }), [2, !0]) : [2, !1]; - } - }); - }); - }, e.prototype.removeFromBlock = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._findBlock(n)]; - case 1: - return (t = r.sent()) && t.remove(n) ? (this._transaction.requestWrite({ key: t.blockId, value: t.serialize() }), [2, !0]) : [2, !1]; - } - }); - }); - }, e.prototype.clearAllBlocks = function() { - return T(this, void 0, void 0, function() { - var n, t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return n = Xm(this.dbname, this.collectionName), [4, this._store.getAllKeys()]; - case 1: - return t = i.sent(), r = t.filter(function(a) { - return a.startsWith(n); - }), [4, this._store.removeMany(r)]; - case 2: - return i.sent(), [4, this._transaction.clear()]; - case 3: - return i.sent(), $i.get(this.dbname).clearByCondition(function(a) { - return a.key.startsWith(n); - }), [2]; - } - }); - }); - }, e; -}(), zl = {}, Ho = function() { - function e(n) { - var t = n.dbname, r = n.collectionName, i = n.keyName, a = n.fields, o = n.transaction, s = n.store, c = this; - this._origin = [], this._table = []; - var l = function(u, d, h) { - return "".concat(Nl(u, d), "/index.").concat(h); - }(t, r, a.join(">")); - return zl[l] || (this.dbname = t, this.collectionName = r, this.keyName = i, this.fields = a, this.indexerKey = l, this._transaction = o, this._store = s, this._transaction.on(bl.COMMIT, this.indexerKey, function() { - return c.commit(); - }), this._transaction.on(bl.ERROR, this.indexerKey, function() { - return c.abort(); - })), zl[l]; - } - return e.createKey = function(n) { - return n.join(">"); - }, e.parseKey = function(n) { - return n.split(">"); - }, e.clearIndexerMap = function() { - for (var n in zl) - delete zl[n]; - }, e.prototype._addItem = function(n) { - var t = n[this.keyName], r = this.getColumnValues(n), i = tt(this.indexOf(r), 2), a = i[0]; - return i[1] ? !this._table[a].keys.includes(t) && (this._table[a].keys.push(t), !0) : (this._table.splice(a, 0, { columnValues: r, keys: [t] }), !0); - }, e.prototype._removeItem = function(n) { - var t = n[this.keyName], r = this.getColumnValues(n), i = tt(this.indexOf(r), 2), a = i[0]; - if (i[1]) { - var o = this._table[a].keys.indexOf(t); - if (o > -1) - return this._table[a].keys.splice(o, 1), this._table[a].keys.length === 0 && this._table.splice(a, 1), !0; - } - return !1; - }, Object.defineProperty(e.prototype, "origin", { get: function() { - return this._origin; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "table", { get: function() { - return this._table; - }, enumerable: !1, configurable: !0 }), e.prototype.getColumnValues = function(n) { - var t, r, i, a, o = []; - try { - for (var s = Ne(this.fields), c = s.next(); !c.done; c = s.next()) { - var l = c.value; - if (l[0] === "-" && (l = l.slice(1)), i = n[l], a = void 0, a = typeof i, i !== null && a !== "undefined" && a !== "boolean" && a !== "number" && a !== "string") - throw on.indexTypesNotMatch; - o.push(n[l]); - } - } catch (u) { - t = { error: u }; - } finally { - try { - c && !c.done && (r = s.return) && r.call(s); - } finally { - if (t) - throw t.error; - } - } - return o; - }, e.prototype.diff = function(n, t) { - for (var r in this.fields) { - var i = this.fields[r][0] === "-" ? -1 : 1, a = bo(n[r], t[r]); - if (a !== 0) - return i * a; - } - return 0; - }, e.prototype.indexOf = function(n) { - if (this._table.length > 0) { - for (var t = 0, r = this._table.length - 1; t <= r; ) { - var i = Math.floor((t + r) / 2), a = this.diff(n, this._table[i].columnValues); - if (a > 0) - t = i + 1; - else { - if (!(a < 0)) - return [i, !0]; - r = i - 1; - } - } - return [t, !1]; - } - return [0, !1]; - }, e.prototype.ensure = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o, s, c, l, u, d, h, f, p, v, m, E; - return C(this, function(y) { - switch (y.label) { - case 0: - return [4, (n = $i.get(this.dbname)).find(this._store, this.indexerKey, ka.PERSISTENT)]; - case 1: - return (t = y.sent()) ? [3, 11] : (r = Xm(this.dbname, this.collectionName), [4, this._store.getAllKeys()]); - case 2: - i = y.sent(), y.label = 3; - case 3: - y.trys.push([3, 8, 9, 10]), a = Ne(i), o = a.next(), y.label = 4; - case 4: - return o.done ? [3, 7] : (s = o.value).startsWith(r) ? [4, n.find(this._store, s, ka.NO_CACHE)] : [3, 6]; - case 5: - if (c = y.sent(), l = If.createFromCacheItem(c)) - try { - for (m = void 0, u = Ne(l.items), d = u.next(); !d.done; d = u.next()) - h = d.value, this._addItem(h); - } catch (_) { - m = { error: _ }; - } finally { - try { - d && !d.done && (E = u.return) && E.call(u); - } finally { - if (m) - throw m.error; - } - } - y.label = 6; - case 6: - return o = a.next(), [3, 4]; - case 7: - return [3, 10]; - case 8: - return f = y.sent(), p = { error: f }, [3, 10]; - case 9: - try { - o && !o.done && (v = a.return) && v.call(a); - } finally { - if (p) - throw p.error; - } - return [7]; - case 10: - return this._transaction.requestWrite({ key: this.indexerKey, value: this._table }, { persistent: !0 }), [3, 12]; - case 11: - this._origin = t.value, this._table = ei(this._origin), y.label = 12; - case 12: - return zl[this.indexerKey] = this, [2]; - } - }); - }); - }, e.prototype.drop = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return $i.get(this.dbname).remove(this.indexerKey), [4, this._store.remove(this.indexerKey)]; - case 1: - return n.sent(), delete zl[this.indexerKey], [2]; - } - }); - }); - }, e.prototype.addItem = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return this._addItem(n) && this._transaction.requestWrite({ key: this.indexerKey, value: this._table }, { persistent: !0 }), [2]; - }); - }); - }, e.prototype.removeItem = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return this._removeItem(n) && this._transaction.requestWrite({ key: this.indexerKey, value: this._table }, { persistent: !0 }), [2]; - }); - }); - }, e.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - return this._table = [], this._transaction.requestWrite({ key: this.indexerKey, value: this._table }, { persistent: !0 }), [2]; - }); - }); - }, e.prototype.commit = function() { - this._origin = this._table, this._table = ei(this._origin); - }, e.prototype.abort = function() { - this._table = ei(this._origin); - }, e; -}(), up = function() { - return typeof document < "u" && typeof navigator < "u" && navigator.product !== "ReactNative"; -}, Ub = function() { - var e = (/* @__PURE__ */ new Date()).getTime(); - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(n) { - var t = (e + 16 * Math.random()) % 16 | 0; - return e = Math.floor(e / 16), (n === "x" ? t : 3 & t | 8).toString(16); - }); -}; -(function(e) { - e[e.PROCESSING = 0] = "PROCESSING", e[e.DONE = 1] = "DONE"; -})(Qu || (Qu = {})), function(e) { - e.NEWNODE = "newnode", e.REMOVENODE = "removenode", e.CLAIM_HOST = "claimhost", e.SYNC_HOST = "synchost", e.REQUEST_LOCK = "requestlock", e.ACQUIRE_LOCK = "acquirelock", e.RELEASE_LOCK = "releaselock"; -}(Dr || (Dr = {})); -var fa, g0 = {}, P1 = function() { - function e(n, t) { - t === void 0 && (t = {}); - var r = this; - return this._state = Qu.PROCESSING, this._queue = [], this._activationQueue = [], g0[n] && !t.forceCreate || (this.nodeId = Ub(), this.key = n, up() && (t.startAsInvisible ? this.registerNode() : document.visibilityState === "visible" ? this.claimHost() : this.registerNode(), document.addEventListener("visibilitychange", function() { - document.visibilityState === "visible" && r.claimHost(); - }), window.addEventListener("message", function(i) { - var a, o, s = i.data, c = s.nodeId, l = s.requestId, u = s.key, d = s.op, h = s.data; - if (c !== r.nodeId && u === r.key) - switch (d) { - case Dr.NEWNODE: - r._sendSync(); - break; - case Dr.CLAIM_HOST: - r._sendSync(), r._hostId = c; - break; - case Dr.SYNC_HOST: - if (!r.isInSync) { - r._activationTimeout && clearTimeout(r._activationTimeout); - var f = h, p = f.currentItemRequestId, v = f.queue, m = function(S) { - var b = r._queue.findIndex(function(A) { - return A.requestId === S.requestId; - }); - b < 0 && r._requestLock({ nodeId: S.nodeId, requestId: S.requestId, key: r.key, op: Dr.REQUEST_LOCK, ts: S.ts }); - }; - try { - for (var E = Ne(v), y = E.next(); !y.done; y = E.next()) - m(y.value); - } catch (S) { - a = { error: S }; - } finally { - try { - y && !y.done && (o = E.return) && o.call(E); - } finally { - if (a) - throw a.error; - } - } - r._currentItem = r._queue.find(function(S) { - return S.requestId === p; - }), r._completeSync(); - } - break; - case Dr.REMOVENODE: - r._queue = r._queue.filter(function(S) { - return S.nodeId !== s.nodeId; - }), r._currentItem && r._currentItem.nodeId === s.nodeId && (r._currentItem = void 0, r._acquire(r._queue[0])); - break; - case Dr.REQUEST_LOCK: - r._requestLock(s); - break; - case Dr.ACQUIRE_LOCK: - var _ = r._queue.find(function(S) { - return S.requestId === l; - }); - r._acquire(_); - break; - case Dr.RELEASE_LOCK: - r._release(l); - } - }), window.addEventListener("beforeunload", function() { - r._send(Dr.REMOVENODE); - })), g0[n] = this), g0[n]; - } - return Object.defineProperty(e.prototype, "locked", { get: function() { - return !!this._currentItem; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isHost", { get: function() { - return this._hostId === this.nodeId; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isInSync", { get: function() { - return this._state == Qu.DONE; - }, enumerable: !1, configurable: !0 }), e.prototype._send = function(n, t) { - var r; - t === void 0 && (t = {}); - var i = { nodeId: this.nodeId, requestId: (r = t == null ? void 0 : t.requestId) !== null && r !== void 0 ? r : Ub(), key: this.key, op: n, data: t.data, ts: Date.now() }; - return up() && window.postMessage(i, "*"), i; - }, e.prototype._acquire = function(n) { - n ? (this._currentItem = n, this._currentItem.onAcquired && this._currentItem.onAcquired(n.requestId)) : this._currentItem = void 0; - }, e.prototype._release = function(n) { - if (this._currentItem && this._currentItem.requestId === n) { - var t = this._currentItem; - this._currentItem = void 0, t.nodeId === this.nodeId && this._send(Dr.RELEASE_LOCK, { requestId: t.requestId }); - var r = this._queue.findIndex(function(i) { - return i.requestId === n; - }); - r > -1 && this._queue.splice(r, 1), t.onReleased && t.onReleased(n); - } - }, e.prototype._requestLock = function(n) { - var t = this; - return new Promise(function(r) { - var i = { nodeId: n.nodeId, requestId: n.requestId, ts: n.ts, onAcquired: function(s) { - t.isHost && t._send(Dr.ACQUIRE_LOCK, { requestId: s }), r(); - }, onReleased: function() { - t._acquire(t._queue[0]); - } }, a = !1; - for (var o in t._queue) - if (t._queue[o].ts > i.ts) { - t._queue.splice(parseInt(o), 0, i), a = !0; - break; - } - a || t._queue.push(i), t._currentItem || t._acquire(t._queue[0]); - }); - }, e.prototype._sendSync = function() { - var n; - this.isHost && this._send(Dr.SYNC_HOST, { data: { currentItemRequestId: (n = this._currentItem) === null || n === void 0 ? void 0 : n.requestId, queue: this._queue.map(function(t) { - return { nodeId: t.nodeId, requestId: t.requestId, ts: t.ts }; - }) } }); - }, e.prototype._waitUntilSyncCompleted = function() { - return T(this, void 0, void 0, function() { - var n = this; - return C(this, function(t) { - return this.isHost && !this.isInSync ? [2, new Promise(function(r) { - n._activationQueue.push(r); - })] : [2]; - }); - }); - }, e.prototype._waitSync = function() { - var n = this; - this.isInSync || (this._activationTimeout = setTimeout(function() { - n._completeSync(); - }, 8)); - }, e.prototype._completeSync = function() { - this.isInSync || (this._state = Qu.DONE, this._activationQueue.forEach(function(n) { - return n(); - }), this._activationQueue = []); - }, e.prototype.registerNode = function() { - this._send(Dr.NEWNODE), this._waitSync(); - }, e.prototype.claimHost = function() { - this._hostId = this.nodeId, this._send(Dr.CLAIM_HOST), this._waitSync(); - }, e.prototype.lock = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this._waitUntilSyncCompleted()]; - case 1: - return t.sent(), n = this._send(Dr.REQUEST_LOCK), [4, this._requestLock(n)]; - case 2: - return t.sent(), [2]; - } - }); - }); - }, e.prototype.unlock = function() { - var n; - !((n = this._currentItem) === null || n === void 0) && n.requestId && this._release(this._currentItem.requestId); - }, e; -}(), y0 = function() { - function e(n) { - var t = n.dbname, r = n.collectionName, i = n.keyName, a = n.keyHash, o = n.indexes, s = n.store, c = this; - this._state = al.INIT, this._indexers = [], this.dbname = t, this.name = r, this.keyName = i, this.indexes = dt([[i]], tt(o.filter(function(l) { - return Ho.createKey(l) !== c.keyName; - })), !1), this._keyHash = a, this._store = s, this._mutex = new P1(function(l, u) { - return "".concat(Nl(l, u), ".lock"); - }(t, r)), this._blobContainer = new $5({ dbname: t, collectionName: r, store: s }), this._transaction = new eL({ dbname: t, collectionName: r, store: s }); - } - return e.metadataOf = function(n, t, r) { - return T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = m0(n, t), [4, r.get(i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, Object.defineProperty(e.prototype, "state", { get: function() { - return this._state; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isReady", { get: function() { - return this._state === al.READY; - }, enumerable: !1, configurable: !0 }), e.prototype.init = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o, s, c, l, u, d, h, f, p, v = this; - return C(this, function(m) { - switch (m.label) { - case 0: - return [4, this._mutex.lock()]; - case 1: - m.sent(), m.label = 2; - case 2: - return m.trys.push([2, 9, , 10]), n = rh.get(this.dbname), [4, e.metadataOf(this.dbname, this.name, this._store)]; - case 3: - return t = m.sent(), this._metadata = t || { keyName: this.keyName, blockLevel: 1, blockHashBase: n.blockHashBase, blockHashMultiplier: n.blockHashMultiplier, blockHashConstant: n.blockHashConstant, indexes: this.indexes }, [4, this._transaction.init()]; - case 4: - m.sent(), this._blockManager = new tL({ dbname: this.dbname, collectionName: this.name, hashFunction: this._keyHash, metadata: this._metadata, transaction: this._transaction, store: this._store }), r = dt([], tt(this.indexes), !1), i = [], a = r.map(function(E) { - return Ho.createKey(E); - }), o = t ? t.indexes.map(function(E) { - return Ho.createKey(E); - }) : []; - try { - for (s = Ne(o), c = s.next(); !c.done; c = s.next()) - l = c.value, a.includes(l) || i.push(Ho.parseKey(l)); - } catch (E) { - f = { error: E }; - } finally { - try { - c && !c.done && (p = s.return) && p.call(s); - } finally { - if (f) - throw f.error; - } - } - return (u = []).push.apply(u, dt([], tt(r.map(function(E) { - var y = new Ho({ dbname: v.dbname, collectionName: v.name, keyName: v.keyName, fields: E, transaction: v._transaction, store: v._store }); - return v._indexers.push(y), y.ensure(); - })), !1)), u.push.apply(u, dt([], tt(i.map(function(E) { - return new Ho({ dbname: v.dbname, collectionName: v.name, keyName: v.keyName, fields: E, transaction: v._transaction, store: v._store }).drop(); - })), !1)), [4, Promise.all(u)]; - case 5: - return m.sent(), [4, this._transaction.commit()]; - case 6: - return m.sent(), a.sort().join(",") === o.sort().join(",") ? [3, 8] : (d = m0(this.dbname, this.name), this._metadata.indexes = r, [4, this._store.set({ key: d, value: this._metadata })]); - case 7: - m.sent(), m.label = 8; - case 8: - return this._state = al.READY, this._mutex.unlock(), [3, 10]; - case 9: - throw h = m.sent(), this._mutex.unlock(), h; - case 10: - return [2]; - } - }); - }); - }, e.prototype.close = function() { - this._state = al.CLOSED; - }, e.prototype._hasPropertyOfKeyName = function(n) { - var t = n[this.keyName]; - return typeof t == "string" && !!t; - }, e.prototype._getIndexerBy = function(n) { - var t, r; - n === void 0 && (n = null), n || (n = [this.keyName]); - var i = Ho.createKey(n); - try { - for (var a = Ne(this._indexers), o = a.next(); !o.done; o = a.next()) { - var s = o.value; - if (i === Ho.createKey(s.fields)) - return s; - } - } catch (c) { - t = { error: c }; - } finally { - try { - o && !o.done && (r = a.return) && r.call(a); - } finally { - if (t) - throw t.error; - } - } - throw on.indexTableIsRequired; - }, e.prototype._upgradeBlockLevel = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return n = m0(this.dbname, this.name), this._metadata.blockLevel++, [4, this._store.set({ key: n, value: this._metadata })]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, e.prototype._requestInsert = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return t = n[this.keyName], [4, this._blockManager.getFromBlock(t)]; - case 1: - return c.sent() ? [3, 13] : [4, this._blockManager.putToBlock(t, n)]; - case 2: - return c.sent() ? [3, 5] : [4, this._upgradeBlockLevel()]; - case 3: - return c.sent(), [4, this._blockManager.putToBlock(t, n)]; - case 4: - c.sent(), c.label = 5; - case 5: - c.trys.push([5, 10, 11, 12]), r = Ne(this._indexers), i = r.next(), c.label = 6; - case 6: - return i.done ? [3, 9] : [4, i.value.addItem(n)]; - case 7: - c.sent(), c.label = 8; - case 8: - return i = r.next(), [3, 6]; - case 9: - return [3, 12]; - case 10: - return a = c.sent(), o = { error: a }, [3, 12]; - case 11: - try { - i && !i.done && (s = r.return) && s.call(r); - } finally { - if (o) - throw o.error; - } - return [7]; - case 12: - return [3, 14]; - case 13: - throw on.collectionInsertDuplicate; - case 14: - return [2]; - } - }); - }); - }, e.prototype._requestUpsert = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l, u, d, h, f, p; - return C(this, function(v) { - switch (v.label) { - case 0: - return t = n[this.keyName], [4, this._blockManager.getFromBlock(t)]; - case 1: - return (r = v.sent()) ? [3, 13] : [4, this._blockManager.putToBlock(t, n)]; - case 2: - return v.sent() ? [3, 5] : [4, this._upgradeBlockLevel()]; - case 3: - return v.sent(), [4, this._blockManager.putToBlock(t, n)]; - case 4: - v.sent(), v.label = 5; - case 5: - v.trys.push([5, 10, 11, 12]), i = Ne(this._indexers), a = i.next(), v.label = 6; - case 6: - return a.done ? [3, 9] : [4, (l = a.value).addItem(n)]; - case 7: - v.sent(), v.label = 8; - case 8: - return a = i.next(), [3, 6]; - case 9: - return [3, 12]; - case 10: - return o = v.sent(), d = { error: o }, [3, 12]; - case 11: - try { - a && !a.done && (h = i.return) && h.call(i); - } finally { - if (d) - throw d.error; - } - return [7]; - case 12: - return [3, 23]; - case 13: - return [4, this._blockManager.putToBlock(t, n)]; - case 14: - v.sent(), v.label = 15; - case 15: - v.trys.push([15, 21, 22, 23]), s = Ne(this._indexers), c = s.next(), v.label = 16; - case 16: - return c.done ? [3, 20] : (l = c.value).diff(l.getColumnValues(r), l.getColumnValues(n)) === 0 ? [3, 19] : [4, l.removeItem(r)]; - case 17: - return v.sent(), [4, l.addItem(n)]; - case 18: - v.sent(), v.label = 19; - case 19: - return c = s.next(), [3, 16]; - case 20: - return [3, 23]; - case 21: - return u = v.sent(), f = { error: u }, [3, 23]; - case 22: - try { - c && !c.done && (p = s.return) && p.call(s); - } finally { - if (f) - throw f.error; - } - return [7]; - case 23: - return [2]; - } - }); - }); - }, e.prototype._requestUpdate = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return t = n[this.keyName], [4, this._blockManager.getFromBlock(t)]; - case 1: - return (r = u.sent()) ? [4, this._blockManager.putToBlock(t, n)] : [3, 11]; - case 2: - u.sent(), u.label = 3; - case 3: - u.trys.push([3, 9, 10, 11]), i = Ne(this._indexers), a = i.next(), u.label = 4; - case 4: - return a.done ? [3, 8] : (o = a.value).diff(o.getColumnValues(r), o.getColumnValues(n)) === 0 ? [3, 7] : [4, o.removeItem(r)]; - case 5: - return u.sent(), [4, o.addItem(n)]; - case 6: - u.sent(), u.label = 7; - case 7: - return a = i.next(), [3, 4]; - case 8: - return [3, 11]; - case 9: - return s = u.sent(), c = { error: s }, [3, 11]; - case 10: - try { - a && !a.done && (l = i.return) && l.call(i); - } finally { - if (c) - throw c.error; - } - return [7]; - case 11: - return [2]; - } - }); - }); - }, e.prototype._requestRemove = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return [4, this._blockManager.getFromBlock(n)]; - case 1: - return (t = c.sent()) ? [4, this._blockManager.removeFromBlock(n)] : [3, 10]; - case 2: - c.sent(), c.label = 3; - case 3: - c.trys.push([3, 8, 9, 10]), r = Ne(this._indexers), i = r.next(), c.label = 4; - case 4: - return i.done ? [3, 7] : [4, i.value.removeItem(t)]; - case 5: - c.sent(), c.label = 6; - case 6: - return i = r.next(), [3, 4]; - case 7: - return [3, 10]; - case 8: - return a = c.sent(), o = { error: a }, [3, 10]; - case 9: - try { - i && !i.done && (s = r.return) && s.call(r); - } finally { - if (o) - throw o.error; - } - return [7]; - case 10: - return [2]; - } - }); - }); - }, e.prototype._requestClear = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return [4, this._blockManager.clearAllBlocks()]; - case 1: - o.sent(), o.label = 2; - case 2: - o.trys.push([2, 7, 8, 9]), n = Ne(this._indexers), t = n.next(), o.label = 3; - case 3: - return t.done ? [3, 6] : [4, t.value.clear()]; - case 4: - o.sent(), o.label = 5; - case 5: - return t = n.next(), [3, 3]; - case 6: - return [3, 9]; - case 7: - return r = o.sent(), i = { error: r }, [3, 9]; - case 8: - try { - t && !t.done && (a = n.return) && a.call(n); - } finally { - if (i) - throw i.error; - } - return [7]; - case 9: - return [2]; - } - }); - }); - }, e.prototype.getByKey = function(n) { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 6]; - case 1: - i.sent(), i.label = 2; - case 2: - return i.trys.push([2, 4, , 5]), [4, this._blockManager.getFromBlock(n)]; - case 3: - return t = i.sent(), this._mutex.unlock(), [2, ei(t)]; - case 4: - throw r = i.sent(), this._mutex.unlock(), r; - case 5: - return [3, 7]; - case 6: - throw on.collectionNotReady; - case 7: - return [2]; - } - }); - }); - }, e.prototype.query = function(n) { - if (n === void 0 && (n = {}), this.isReady) - return new J5({ condition: n.where, mutex: this._mutex, blockManager: this._blockManager, indexer: this._getIndexerBy(n.index), backward: !!n.backward }); - throw on.collectionNotReady; - }, e.prototype.insertOne = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 8]; - case 1: - r.sent(), r.label = 2; - case 2: - if (r.trys.push([2, 5, , 7]), !this._hasPropertyOfKeyName(n)) - throw on.collectionKeyNotGiven; - return [4, this._requestInsert(ei(n))]; - case 3: - return r.sent(), [4, this._transaction.commit()]; - case 4: - return r.sent(), this._mutex.unlock(), [2, n]; - case 5: - return t = r.sent(), [4, this._transaction.clear()]; - case 6: - throw r.sent(), this._mutex.unlock(), t; - case 7: - return [3, 9]; - case 8: - throw on.collectionNotReady; - case 9: - return [2]; - } - }); - }); - }, e.prototype.insertMany = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l = this; - return C(this, function(u) { - switch (u.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 15]; - case 1: - u.sent(), u.label = 2; - case 2: - if (u.trys.push([2, 12, , 14]), n.some(function(d) { - return !l._hasPropertyOfKeyName(d); - })) - throw on.collectionKeyNotGiven; - u.label = 3; - case 3: - u.trys.push([3, 8, 9, 10]), t = Ne(n), r = t.next(), u.label = 4; - case 4: - return r.done ? [3, 7] : (i = r.value, [4, this._requestInsert(ei(i))]); - case 5: - u.sent(), u.label = 6; - case 6: - return r = t.next(), [3, 4]; - case 7: - return [3, 10]; - case 8: - return a = u.sent(), s = { error: a }, [3, 10]; - case 9: - try { - r && !r.done && (c = t.return) && c.call(t); - } finally { - if (s) - throw s.error; - } - return [7]; - case 10: - return [4, this._transaction.commit()]; - case 11: - return u.sent(), this._mutex.unlock(), [2, n]; - case 12: - return o = u.sent(), [4, this._transaction.clear()]; - case 13: - throw u.sent(), this._mutex.unlock(), o; - case 14: - return [3, 16]; - case 15: - throw on.collectionNotReady; - case 16: - return [2]; - } - }); - }); - }, e.prototype.upsertOne = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 8]; - case 1: - r.sent(), r.label = 2; - case 2: - if (r.trys.push([2, 5, , 7]), !this._hasPropertyOfKeyName(n)) - throw on.collectionKeyNotGiven; - return [4, this._requestUpsert(ei(n))]; - case 3: - return r.sent(), [4, this._transaction.commit()]; - case 4: - return r.sent(), this._mutex.unlock(), [2, n]; - case 5: - return t = r.sent(), [4, this._transaction.clear()]; - case 6: - throw r.sent(), this._mutex.unlock(), t; - case 7: - return [3, 9]; - case 8: - throw on.collectionNotReady; - case 9: - return [2]; - } - }); - }); - }, e.prototype.upsertMany = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l = this; - return C(this, function(u) { - switch (u.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 15]; - case 1: - u.sent(), u.label = 2; - case 2: - if (u.trys.push([2, 12, , 14]), n.some(function(d) { - return !l._hasPropertyOfKeyName(d); - })) - throw on.collectionKeyNotGiven; - u.label = 3; - case 3: - u.trys.push([3, 8, 9, 10]), t = Ne(n), r = t.next(), u.label = 4; - case 4: - return r.done ? [3, 7] : (i = r.value, [4, this._requestUpsert(ei(i))]); - case 5: - u.sent(), u.label = 6; - case 6: - return r = t.next(), [3, 4]; - case 7: - return [3, 10]; - case 8: - return a = u.sent(), s = { error: a }, [3, 10]; - case 9: - try { - r && !r.done && (c = t.return) && c.call(t); - } finally { - if (s) - throw s.error; - } - return [7]; - case 10: - return [4, this._transaction.commit()]; - case 11: - return u.sent(), this._mutex.unlock(), [2, n]; - case 12: - return o = u.sent(), [4, this._transaction.clear()]; - case 13: - throw u.sent(), this._mutex.unlock(), o; - case 14: - return [3, 16]; - case 15: - throw on.collectionNotReady; - case 16: - return [2]; - } - }); - }); - }, e.prototype.update = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 8]; - case 1: - r.sent(), r.label = 2; - case 2: - if (r.trys.push([2, 5, , 7]), !this._hasPropertyOfKeyName(n)) - throw on.collectionKeyNotGiven; - return [4, this._requestUpdate(ei(n))]; - case 3: - return r.sent(), [4, this._transaction.commit()]; - case 4: - return r.sent(), this._mutex.unlock(), [2, n]; - case 5: - return t = r.sent(), [4, this._transaction.clear()]; - case 6: - throw r.sent(), this._mutex.unlock(), t; - case 7: - return [3, 9]; - case 8: - throw on.collectionNotReady; - case 9: - return [2]; - } - }); - }); - }, e.prototype.updateIf = function(n, t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u, d, h, f, p, v, m, E = this; - return C(this, function(y) { - switch (y.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 16]; - case 1: - y.sent(), y.label = 2; - case 2: - return y.trys.push([2, 13, , 15]), r = n.where, i = r === void 0 ? {} : r, a = n.index, o = a === void 0 ? null : a, s = n.backward, c = s !== void 0 && s, l = [], [4, new Zm({ condition: i, blockManager: this._blockManager, backward: c, indexer: this._getIndexerBy(o) }).each(function(_) { - return T(E, void 0, void 0, function() { - var S, b; - return C(this, function(A) { - if (_.error) - throw _.stop(), _.error; - if (_.hasNext) { - if (S = _.nextValue, _l(i, S) && t.set) { - if (typeof t.set != "function") - for (b in t.set) - S[b] = t.set[b]; - else - t.set(S); - l.push(S); - } - _.next(); - } else - _.stop(); - return [2]; - }); - }); - })]; - case 3: - y.sent(), y.label = 4; - case 4: - y.trys.push([4, 9, 10, 11]), u = Ne(l), d = u.next(), y.label = 5; - case 5: - return d.done ? [3, 8] : (h = d.value, [4, this._requestUpdate(ei(h))]); - case 6: - y.sent(), y.label = 7; - case 7: - return d = u.next(), [3, 5]; - case 8: - return [3, 11]; - case 9: - return f = y.sent(), v = { error: f }, [3, 11]; - case 10: - try { - d && !d.done && (m = u.return) && m.call(u); - } finally { - if (v) - throw v.error; - } - return [7]; - case 11: - return [4, this._transaction.commit()]; - case 12: - return y.sent(), this._mutex.unlock(), [2, l]; - case 13: - return p = y.sent(), [4, this._transaction.clear()]; - case 14: - throw y.sent(), this._mutex.unlock(), p; - case 15: - return [3, 17]; - case 16: - throw this._transaction.clear(), on.collectionNotReady; - case 17: - return [2]; - } - }); - }); - }, e.prototype.remove = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 8]; - case 1: - r.sent(), r.label = 2; - case 2: - return r.trys.push([2, 5, , 7]), [4, this._requestRemove(n)]; - case 3: - return r.sent(), [4, this._transaction.commit()]; - case 4: - return r.sent(), this._mutex.unlock(), [3, 7]; - case 5: - return t = r.sent(), [4, this._transaction.clear()]; - case 6: - throw r.sent(), this._mutex.unlock(), t; - case 7: - return [3, 9]; - case 8: - throw on.collectionNotReady; - case 9: - return [2]; - } - }); - }); - }, e.prototype.removeIf = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l, u, d, h, f, p, v, m = this; - return C(this, function(E) { - switch (E.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 15]; - case 1: - E.sent(), E.label = 2; - case 2: - return E.trys.push([2, 13, , 14]), t = n.where, r = t === void 0 ? {} : t, i = n.index, a = i === void 0 ? null : i, o = n.backward, s = o !== void 0 && o, c = [], [4, new Zm({ condition: r, blockManager: this._blockManager, backward: s, indexer: this._getIndexerBy(a) }).each(function(y) { - return T(m, void 0, void 0, function() { - var _, S; - return C(this, function(b) { - if (y.error) - throw y.stop(), y.error; - return y.hasNext ? (_ = y.nextValue, _l(r, _) && (S = _[this.keyName], c.push(S)), y.next()) : y.stop(), [2]; - }); - }); - })]; - case 3: - E.sent(), E.label = 4; - case 4: - E.trys.push([4, 9, 10, 11]), l = Ne(c), u = l.next(), E.label = 5; - case 5: - return u.done ? [3, 8] : (d = u.value, [4, this._requestRemove(d)]); - case 6: - E.sent(), E.label = 7; - case 7: - return u = l.next(), [3, 5]; - case 8: - return [3, 11]; - case 9: - return h = E.sent(), p = { error: h }, [3, 11]; - case 10: - try { - u && !u.done && (v = l.return) && v.call(l); - } finally { - if (p) - throw p.error; - } - return [7]; - case 11: - return [4, this._transaction.commit()]; - case 12: - return E.sent(), this._mutex.unlock(), [2, c]; - case 13: - throw f = E.sent(), this._mutex.unlock(), f; - case 14: - return [3, 16]; - case 15: - throw this._transaction.clear(), on.collectionNotReady; - case 16: - return [2]; - } - }); - }); - }, e.prototype.clear = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return this.isReady ? [4, this._mutex.lock()] : [3, 8]; - case 1: - t.sent(), t.label = 2; - case 2: - return t.trys.push([2, 5, , 7]), [4, this._requestClear()]; - case 3: - return t.sent(), [4, this._transaction.commit()]; - case 4: - return t.sent(), this._mutex.unlock(), [3, 7]; - case 5: - return n = t.sent(), [4, this._transaction.clear()]; - case 6: - throw t.sent(), this._mutex.unlock(), n; - case 7: - return [3, 9]; - case 8: - throw on.collectionNotReady; - case 9: - return [2]; - } - }); - }); - }, e.prototype.getBlob = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this._blobContainer.get(n)]; - case 1: - return [2, t.sent()]; - } - }); - }); - }, e.prototype.saveBlob = function(n, t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._blobContainer.save(n, t)]; - case 1: - return [2, r.sent()]; - } - }); - }); - }, e.prototype.removeBlob = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this._blobContainer.remove(n)]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, e.prototype.removeAllBlobs = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, this._blobContainer.clear()]; - case 1: - return n.sent(), [2]; - } - }); - }); - }, e; -}(), E0 = "[NESTDB]", Qh = !0, Hs = function() { - function e() { - } - return e.off = function() { - Qh = !1; - }, e.log = function() { - for (var n = [], t = 0; t < arguments.length; t++) - n[t] = arguments[t]; - Qh && console.log.apply(console, dt(["".concat(E0, "[LOG]")], tt(n), !1)); - }, e.warning = function() { - for (var n = [], t = 0; t < arguments.length; t++) - n[t] = arguments[t]; - Qh && console.warn.apply(console, dt(["".concat(E0, "[WARNING]")], tt(n), !1)); - }, e.error = function() { - for (var n = [], t = 0; t < arguments.length; t++) - n[t] = arguments[t]; - Qh && console.error.apply(console, dt(["".concat(E0, "[ERROR]")], tt(n), !1)); - }, e; -}(), nL = [{}, { a: 700400, n: "error" }], $p = function() { - function e(n) { - var t, r, i; - this.encryption = (t = n.encryption) !== null && t !== void 0 ? t : Ew, this.itemSizeLimit = (r = n.itemSizeLimit) !== null && r !== void 0 ? r : 4194304, this.metadataBuffer = (i = n.metadataBuffer) !== null && i !== void 0 ? i : 256; - } - return Object.defineProperty(e.prototype, "_encryptionCheckKey", { get: function() { - return "".concat(this.dbname, ".encrypt"); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "_reservedKeys", { get: function() { - return [this._encryptionCheckKey]; - }, enumerable: !1, configurable: !0 }), e.prototype._getRawKey = function(n, t) { - return t === void 0 && (t = ""), "".concat(n).concat(t); - }, e.prototype._generateShardPostfixArray = function(n) { - return n === void 0 && (n = 1), dt([], tt(Array(n).keys()), !1); - }, e.prototype._shardify = function(n) { - var t = this, r = n.key, i = n.value, a = JSON.stringify(this.encryption.encrypt(i)), o = Math.ceil(a.length / this.adjustedItemSizeLimit); - return this._generateShardPostfixArray(o).map(function(s) { - var c = { key: t._getRawKey(r, ".".concat(s)), data: a.substring(s * t.adjustedItemSizeLimit, (s + 1) * t.adjustedItemSizeLimit) }; - return s === 0 && (c.metadata = { shards: o }), c; - }); - }, e.prototype._resetIfEncryptionChanged = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o, s, c, l, u = this; - return C(this, function(d) { - switch (d.label) { - case 0: - return [4, this.get(this._encryptionCheckKey)]; - case 1: - if (n = d.sent(), t = { encrypted: nL.map(function(h) { - var f; - return (f = u.encryption) === null || f === void 0 ? void 0 : f.encrypt(h); - }) }, !(n && n.encrypted && Array.isArray(n.encrypted))) - return [3, 6]; - for (a in r = n.encrypted, i = [], r) - i.push(a); - o = 0, d.label = 2; - case 2: - return o < i.length ? (a = i[o]) in r ? (s = a, c = JSON.stringify(n.encrypted[s]), l = JSON.stringify(t.encrypted[s]), c === l ? [3, 4] : (Hs.warning("Encryption algorithm has changed. Stored data would be cleared."), [4, this.clear()])) : [3, 4] : [3, 5]; - case 3: - return d.sent(), [3, 5]; - case 4: - return o++, [3, 2]; - case 5: - return [3, 8]; - case 6: - return [4, this.clear()]; - case 7: - d.sent(), d.label = 8; - case 8: - return [4, this.set({ key: this._encryptionCheckKey, value: t })]; - case 9: - return d.sent(), [2]; - } - }); - }); - }, Object.defineProperty(e.prototype, "adjustedItemSizeLimit", { get: function() { - return Math.max(this.itemSizeLimit - this.metadataBuffer, 4); - }, enumerable: !1, configurable: !0 }), e.prototype.usage = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return n = 0, [4, this._getAllRawKeys()]; - case 1: - t = u.sent(), u.label = 2; - case 2: - u.trys.push([2, 7, 8, 9]), r = Ne(t), i = r.next(), u.label = 3; - case 3: - return i.done ? [3, 6] : (a = i.value, [4, this._getRaw(a)]); - case 4: - (o = u.sent()) && (n += JSON.stringify(o).length), u.label = 5; - case 5: - return i = r.next(), [3, 3]; - case 6: - return [3, 9]; - case 7: - return s = u.sent(), c = { error: s }, [3, 9]; - case 8: - try { - i && !i.done && (l = r.return) && l.call(r); - } finally { - if (c) - throw c.error; - } - return [7]; - case 9: - return [2, n]; - } - }); - }); - }, e.prototype.getAllKeys = function() { - return T(this, void 0, void 0, function() { - var n = this; - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this._getAllRawKeys()]; - case 1: - return [2, t.sent().filter(function(r) { - return r.endsWith(".0"); - }).map(function(r) { - return r.replace(/\.0$/, ""); - }).filter(function(r) { - return !n._reservedKeys.includes(r); - })]; - } - }); - }); - }, e.prototype.get = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c = this; - return C(this, function(l) { - switch (l.label) { - case 0: - return t = this._getRawKey(n, ".0"), [4, this._getRaw(t)]; - case 1: - if (!(r = l.sent())) - return [3, 7]; - l.label = 2; - case 2: - return l.trys.push([2, 6, , 7]), i = r.data, (a = r.metadata) != null && a.shards && a.shards > 1 ? [4, Promise.all(this._generateShardPostfixArray(a == null ? void 0 : a.shards).map(function(u) { - return T(c, void 0, void 0, function() { - var d, h; - return C(this, function(f) { - switch (f.label) { - case 0: - return u > 0 ? (d = this._getRawKey(n, ".".concat(u)), [4, this._getRaw(d)]) : [3, 2]; - case 1: - if (!(h = f.sent())) - throw on.storeBrokenIntegrity; - return [2, h.data]; - case 2: - return [2, i]; - } - }); - }); - }))] : [3, 4]; - case 3: - return s = l.sent(), [3, 5]; - case 4: - s = [i], l.label = 5; - case 5: - return o = s, [2, this.encryption.decrypt(JSON.parse(o.join("")))]; - case 6: - return l.sent(), [2, null]; - case 7: - return [2, null]; - } - }); - }); - }, e.prototype.set = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return t = this._shardify(n), [4, this._setRaw(t)]; - case 1: - return r.sent(), [2, L({}, n.value)]; - } - }); - }); - }, e.prototype.setMany = function(n) { - return T(this, void 0, void 0, function() { - var t, r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return t = [], [4, this._setRaw(t.concat.apply(t, dt([], tt(n.map(function(a) { - return r._shardify(a); - })), !1)))]; - case 1: - return i.sent(), [2, n.map(function(a) { - return a.value; - })]; - } - }); - }); - }, e.prototype.remove = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a = this; - return C(this, function(o) { - switch (o.label) { - case 0: - return t = this._getRawKey(n, ".0"), [4, this._getRaw(t)]; - case 1: - return (r = o.sent()) ? (i = r.metadata, [4, this._removeRaw(this._generateShardPostfixArray(i == null ? void 0 : i.shards).map(function(s) { - return a._getRawKey(n, ".".concat(s)); - }))]) : [3, 3]; - case 2: - return o.sent(), [2, !0]; - case 3: - return [2, !1]; - } - }); - }); - }, e.prototype.removeMany = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l, u, d = this; - return C(this, function(h) { - switch (h.label) { - case 0: - t = [], r = function(f) { - var p, v, m; - return C(this, function(E) { - switch (E.label) { - case 0: - return p = i._getRawKey(f, ".0"), [4, i._getRaw(p)]; - case 1: - return (v = E.sent()) && (m = v.metadata, t.push.apply(t, dt([], tt(i._generateShardPostfixArray(m == null ? void 0 : m.shards).map(function(y) { - return d._getRawKey(f, ".".concat(y)); - })), !1))), [2]; - } - }); - }, i = this, h.label = 1; - case 1: - h.trys.push([1, 6, 7, 8]), a = Ne(n), o = a.next(), h.label = 2; - case 2: - return o.done ? [3, 5] : (s = o.value, [5, r(s)]); - case 3: - h.sent(), h.label = 4; - case 4: - return o = a.next(), [3, 2]; - case 5: - return [3, 8]; - case 6: - return c = h.sent(), l = { error: c }, [3, 8]; - case 7: - try { - o && !o.done && (u = a.return) && u.call(a); - } finally { - if (l) - throw l.error; - } - return [7]; - case 8: - return t.length > 0 ? [4, this._removeRaw(t)] : [3, 10]; - case 9: - h.sent(), h.label = 10; - case 10: - return [2, n]; - } - }); - }); - }, e; -}(), Qr = {}, Xo = function(e) { - function n(t) { - t === void 0 && (t = {}); - var r, i = this; - i = e.call(this, L(L({}, t), { itemSizeLimit: (r = t.itemSizeLimit) !== null && r !== void 0 ? r : 4194304 })) || this; - var a = t.delay, o = a === void 0 ? 1 : a; - return i.delay = o, i.observer = {}, i; - } - return O(n, e), Object.defineProperty(n.prototype, "rawData", { get: function() { - return Qr[this.dbname]; - }, set: function(t) { - Qr[this.dbname] = t; - }, enumerable: !1, configurable: !0 }), n.prototype._getAllRawKeys = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - if (Qr[this.dbname]) - return [2, Object.keys(Qr[this.dbname])]; - throw on.storeNotAvailable; - }); - }); - }, n.prototype._getRaw = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return Qr[this.dbname] ? [4, Yh(this.delay)] : [3, 2]; - case 1: - return r.sent(), [2, Qr[this.dbname][t] ? L({ key: t }, Qr[this.dbname][t]) : null]; - case 2: - throw on.storeNotAvailable; - } - }); - }); - }, n.prototype._setRaw = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u; - return C(this, function(d) { - switch (d.label) { - case 0: - return Qr[this.dbname] ? [4, Yh(this.delay)] : [3, 2]; - case 1: - d.sent(); - try { - for (r = Ne(t), i = r.next(); !i.done; i = r.next()) - a = i.value, o = a.key, s = a.data, c = a.metadata, Qr[this.dbname][o] = Object.freeze({ data: s, metadata: c }); - } catch (h) { - l = { error: h }; - } finally { - try { - i && !i.done && (u = r.return) && u.call(r); - } finally { - if (l) - throw l.error; - } - } - return [3, 3]; - case 2: - throw on.storeNotAvailable; - case 3: - return [2]; - } - }); - }); - }, n.prototype._removeRaw = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return Qr[this.dbname] ? [4, Yh(this.delay)] : [3, 2]; - case 1: - c.sent(); - try { - for (r = Ne(t), i = r.next(); !i.done; i = r.next()) - a = i.value, Qr[this.dbname][a] && delete Qr[this.dbname][a]; - } catch (l) { - o = { error: l }; - } finally { - try { - i && !i.done && (s = r.return) && s.call(r); - } finally { - if (o) - throw o.error; - } - } - return [3, 3]; - case 2: - throw on.storeNotAvailable; - case 3: - return [2]; - } - }); - }); - }, n.prototype.observe = function(t, r, i) { - var a = this; - this.observer[t] || (this.observer[t] = {}), r.forEach(function(o) { - return a.observer[t][o] = i; - }); - }, n.prototype.checkAvailability = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return [2]; - }); - }); - }, n.prototype.init = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return this.dbname = t, Qr[this.dbname] || (Qr[this.dbname] = {}), [4, this._resetIfEncryptionChanged()]; - case 1: - return r.sent(), [2]; - } - }); - }); - }, n.prototype.set = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - if ((r = this.observer[t.key]) && typeof r.set == "function" && (i = r.set())) - throw i; - return [2, e.prototype.set.call(this, t)]; - }); - }); - }, n.prototype.setMany = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l; - return C(this, function(u) { - try { - for (r = Ne(t), i = r.next(); !i.done; i = r.next()) - if (a = i.value, (o = this.observer[a.key]) && typeof o.set == "function" && (s = o.set())) - throw s; - } catch (d) { - c = { error: d }; - } finally { - try { - i && !i.done && (l = r.return) && l.call(r); - } finally { - if (c) - throw c.error; - } - } - return [2, e.prototype.setMany.call(this, t)]; - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, Yh(this.delay)]; - case 1: - return t.sent(), Qr[this.dbname] = {}, [2]; - } - }); - }); - }, n; -}($p), Fb = "NestDBStore"; -(function(e) { - e[e.UNINITIALIZED = 0] = "UNINITIALIZED", e[e.OPENING = 1] = "OPENING", e[e.OPEN = 2] = "OPEN", e[e.CLOSED = 3] = "CLOSED"; -})(fa || (fa = {})); -var rL = function(e) { - function n(t) { - t === void 0 && (t = {}); - var r, i = this; - return (i = e.call(this, L(L({}, t), { itemSizeLimit: (r = t.itemSizeLimit) !== null && r !== void 0 ? r : 104857600 })) || this)._storeName = Fb, i._state = fa.UNINITIALIZED, i._openJobQueue = [], i._window = typeof window < "u" ? window : void 0, i._indexedDb = i._window ? i._window.indexedDB || i._window.mozIndexedDB || i._window.webkitIndexedDB || i._window.msIndexedDB : void 0, i; - } - return O(n, e), Object.defineProperty(n.prototype, "state", { get: function() { - return this._state; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isTransactionReusable", { get: function() { - var t = navigator == null ? void 0 : navigator.userAgent; - if (t) { - var r = "15.0.0"; - if (t.includes("Safari/") ? r = t.split("Safari/")[0].trim().split("Version/")[1] : t.includes("AppleWebKit/") && (r = t.split("AppleWebKit/")[0].trim().split("Version/")[1]), (r ? parseInt(r.split(".")[0]) : 0) <= 14) - return !1; - } - return !0; - }, enumerable: !1, configurable: !0 }), n.prototype._putToObjectStore = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - return [2, new Promise(function(a, o) { - var s = t.put(r); - s.addEventListener("success", function(c) { - a(c.target.result); - }), s.addEventListener("error", function() { - o("Failed to write."); - }); - })]; - }); - }); - }, n.prototype._deleteFromObjectStore = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - return [2, new Promise(function(a, o) { - var s = t.delete(r); - s.addEventListener("success", function() { - return a(r); - }), s.addEventListener("error", function(c) { - return o(c.target.error); - }); - })]; - }); - }); - }, n.prototype._openDatabase = function(t) { - var r = this; - return new Promise(function(i, a) { - if (r._indexedDb) { - r._state = fa.OPENING; - var o = r._indexedDb.open(t); - o.addEventListener("upgradeneeded", function(s) { - s.target.result.createObjectStore(Fb, { keyPath: "key" }); - }), o.addEventListener("success", function(s) { - r._state = fa.OPEN, r._database = s.target.result, r._openJobQueue.forEach(function(c) { - return c(); - }), r._openJobQueue = [], r._database.onclose = function() { - r._database = void 0, r._state = fa.OPENING, setTimeout(function() { - r._openDatabase(t); - }, 5); - }, i(r._database); - }), o.addEventListener("error", function(s) { - r._state = fa.UNINITIALIZED, a(s.target.error); - }); - } else - a(on.storeNotAvailable); - }); - }, n.prototype._getObjectStore = function(t) { - return T(this, void 0, void 0, function() { - var r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return this._database ? [2, this._database.transaction(this._storeName, t).objectStore(this._storeName)] : [3, 1]; - case 1: - switch (this._state) { - case fa.UNINITIALIZED: - case fa.OPEN: - return [3, 2]; - case fa.OPENING: - case fa.CLOSED: - return [3, 3]; - } - return [3, 4]; - case 2: - throw on.storeNotInitialized; - case 3: - return [2, new Promise(function(a) { - r._openJobQueue.push(function() { - return a(r._getObjectStore(t)); - }); - })]; - case 4: - return [4, this._getObjectStore(t)]; - case 5: - return [2, i.sent()]; - } - }); - }); - }, n.prototype._getAllRawKeys = function() { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._getObjectStore("readonly")]; - case 1: - return t = r.sent(), [4, new Promise(function(i, a) { - var o = t.getAllKeys(); - o.addEventListener("success", function(s) { - i(s.target.result); - }), o.addEventListener("error", function(s) { - return a(s.target.error); - }); - })]; - case 2: - return [2, r.sent()]; - } - }); - }); - }, n.prototype._getRaw = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._getObjectStore("readonly")]; - case 1: - return r = i.sent(), [4, new Promise(function(a, o) { - var s = r.get(t); - s.addEventListener("success", function(c) { - var l; - a((l = c == null ? void 0 : c.target) === null || l === void 0 ? void 0 : l.result); - }), s.addEventListener("error", function(c) { - return o(c.target.error); - }); - })]; - case 2: - return [2, i.sent()]; - } - }); - }); - }, n.prototype._setRaw = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u = this; - return C(this, function(d) { - switch (d.label) { - case 0: - return [4, this._getObjectStore("readwrite")]; - case 1: - return r = d.sent(), this.isTransactionReusable ? [4, Promise.all(t.map(function(h) { - return u._putToObjectStore(r, h); - }))] : [3, 3]; - case 2: - return d.sent(), [3, 10]; - case 3: - d.trys.push([3, 8, 9, 10]), i = Ne(t), a = i.next(), d.label = 4; - case 4: - return a.done ? [3, 7] : (o = a.value, [4, this._putToObjectStore(r, o)]); - case 5: - d.sent(), d.label = 6; - case 6: - return a = i.next(), [3, 4]; - case 7: - return [3, 10]; - case 8: - return s = d.sent(), c = { error: s }, [3, 10]; - case 9: - try { - a && !a.done && (l = i.return) && l.call(i); - } finally { - if (c) - throw c.error; - } - return [7]; - case 10: - return [2]; - } - }); - }); - }, n.prototype._removeRaw = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u = this; - return C(this, function(d) { - switch (d.label) { - case 0: - return [4, this._getObjectStore("readwrite")]; - case 1: - return r = d.sent(), this.isTransactionReusable ? [4, Promise.all(t.map(function(h) { - return u._deleteFromObjectStore(r, h); - }))] : [3, 3]; - case 2: - return d.sent(), [3, 10]; - case 3: - d.trys.push([3, 8, 9, 10]), i = Ne(t), a = i.next(), d.label = 4; - case 4: - return a.done ? [3, 7] : (o = a.value, [4, this._deleteFromObjectStore(r, o)]); - case 5: - d.sent(), d.label = 6; - case 6: - return a = i.next(), [3, 4]; - case 7: - return [3, 10]; - case 8: - return s = d.sent(), c = { error: s }, [3, 10]; - case 9: - try { - a && !a.done && (l = i.return) && l.call(i); - } finally { - if (c) - throw c.error; - } - return [7]; - case 10: - return [2]; - } - }); - }); - }, n.prototype._triggerDatabaseClose = function() { - this._database && this._database.onclose && this._database.onclose(new Event("dummy")); - }, n.prototype.checkAvailability = function() { - return T(this, void 0, void 0, function() { - var t, r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - if (!((t = typeof window < "u" ? window : null) != null && t.indexedDB || t != null && t.mozIndexedDB || t != null && t.webkitIndexedDB || t != null && t.msIndexedDB)) - return [3, 6]; - if (this._indexedDb = t.indexedDB || t.mozIndexedDB || t.webkitIndexedDB || t.msIndexedDB, !this._window || !up()) - return [3, 4]; - if (!(up() && navigator.userAgent && navigator.userAgent.includes("Edge/"))) - return [3, 1]; - if (!this._window.indexedDB && (t.PointerEvent || t.MSPointerEvent)) - throw on.storeNotAvailableInPrivateBrowsing; - return [3, 3]; - case 1: - return [4, new Promise(function(a, o) { - if (r._indexedDb) - try { - var s = r._indexedDb.open("_testMozilla"); - s.onerror = function() { - return o(on.storeNotAvailableInPrivateBrowsing); - }, s.onsuccess = function(c) { - if (c.target.result.close(), r._indexedDb) { - var l = r._indexedDb.deleteDatabase("_testMozilla"); - l.onerror = function() { - return a(); - }, l.onsuccess = function() { - return a(); - }; - } else - o(on.storeNotAvailable); - }; - } catch { - o(on.storeNotAvailableInPrivateBrowsing); - } - else - o(on.storeNotAvailable); - })]; - case 2: - i.sent(), i.label = 3; - case 3: - return [3, 5]; - case 4: - throw on.storeNotAvailable; - case 5: - return [3, 7]; - case 6: - throw on.storeNotAvailable; - case 7: - return [2]; - } - }); - }); - }, n.prototype.init = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return this.dbname = t, [4, this.checkAvailability()]; - case 1: - return r.sent(), [4, this._openDatabase(t)]; - case 2: - return r.sent(), [4, this._resetIfEncryptionChanged()]; - case 3: - return r.sent(), [2]; - } - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._getObjectStore("readwrite")]; - case 1: - return t = r.sent(), [4, new Promise(function(i, a) { - var o = t.clear(); - o.addEventListener("success", function() { - return i(); - }), o.addEventListener("error", function(s) { - return a(s.target.error); - }); - })]; - case 2: - return [2, r.sent()]; - } - }); - }); - }, n; -}($p), iL = function(e) { - function n(t) { - var r = this, i = t.AsyncStorage, a = t.itemSizeLimit, o = a === void 0 ? 6291456 : a, s = n6(t, ["AsyncStorage", "itemSizeLimit"]); - return (r = e.call(this, L(L({}, s), { itemSizeLimit: o })) || this)._asyncStorage = i, r; - } - return O(n, e), n.prototype._isBelonging = function(t) { - return t.startsWith("".concat(this.dbname, "/")); - }, n.prototype._getActualKey = function(t) { - return "".concat(this.dbname, "/").concat(t); - }, n.prototype._getAllRawKeys = function() { - return T(this, void 0, void 0, function() { - var t, r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._asyncStorage.getAllKeys()]; - case 1: - return t = i.sent(), [2, t.filter(function(a) { - return r._isBelonging(a); - }).map(function(a) { - return a.substring("".concat(r.dbname, "/").length); - })]; - } - }); - }); - }, n.prototype._getRaw = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._asyncStorage.getItem(this._getActualKey(t))]; - case 1: - return [2, (r = i.sent()) ? JSON.parse(r) : null]; - } - }); - }); - }, n.prototype._setRaw = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - r = []; - try { - for (i = Ne(t), a = i.next(); !a.done; a = i.next()) - o = a.value, s = o.key, o.data.length <= this.adjustedItemSizeLimit && r.push([this._getActualKey(s), JSON.stringify(o)]); - } catch (d) { - c = { error: d }; - } finally { - try { - a && !a.done && (l = i.return) && l.call(i); - } finally { - if (c) - throw c.error; - } - } - return [4, this._asyncStorage.multiSet(r)]; - case 1: - return u.sent(), [2]; - } - }); - }); - }, n.prototype._removeRaw = function(t) { - return T(this, void 0, void 0, function() { - var r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._asyncStorage.multiRemove(t.map(function(a) { - return r._getActualKey(a); - }))]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.checkAvailability = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - if (!this._asyncStorage) - throw on.storeNotAvailable; - return [2]; - }); - }); - }, n.prototype.init = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return this.dbname = t, [4, this._resetIfEncryptionChanged()]; - case 1: - return r.sent(), [2]; - } - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this.getAllKeys()]; - case 1: - return t = r.sent(), [4, this.removeMany(t)]; - case 2: - return r.sent(), [2]; - } - }); - }); - }, n; -}($p); -(function(e) { - function n(t) { - var r, i = this; - return (i = e.call(this, L(L({}, t), { itemSizeLimit: (r = t.itemSizeLimit) !== null && r !== void 0 ? r : 6291456 })) || this)._mmkv = t.MMKV, i; - } - O(n, e), n.prototype._isBelonging = function(t) { - return t.startsWith("".concat(this.dbname, "/")); - }, n.prototype._getActualKey = function(t) { - return "".concat(this.dbname, "/").concat(t); - }, n.prototype._getAllRawKeys = function() { - return T(this, void 0, void 0, function() { - var t, r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._mmkv.getAllKeys()]; - case 1: - return t = i.sent(), [2, t.filter(function(a) { - return r._isBelonging(a); - }).map(function(a) { - return a.substring("".concat(r.dbname, "/").length); - })]; - } - }); - }); - }, n.prototype._getRaw = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._mmkv.getString(this._getActualKey(t))]; - case 1: - return [2, (r = i.sent()) ? JSON.parse(r) : null]; - } - }); - }); - }, n.prototype._setRaw = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - try { - for (r = Ne(t), i = r.next(); !i.done; i = r.next()) - a = i.value, o = a.key, a.data.length <= this.adjustedItemSizeLimit && this._mmkv.set(this._getActualKey(o), JSON.stringify(a)); - } catch (u) { - s = { error: u }; - } finally { - try { - i && !i.done && (c = r.return) && c.call(r); - } finally { - if (s) - throw s.error; - } - } - return [2]; - }); - }); - }, n.prototype._removeRaw = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s; - return C(this, function(c) { - try { - for (r = Ne(t), i = r.next(); !i.done; i = r.next()) - a = i.value, this._mmkv.delete(this._getActualKey(a)); - } catch (l) { - o = { error: l }; - } finally { - try { - i && !i.done && (s = r.return) && s.call(r); - } finally { - if (o) - throw o.error; - } - } - return [2]; - }); - }); - }, n.prototype.checkAvailability = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - if (!this._mmkv) - throw on.storeNotAvailable; - return [2]; - }); - }); - }, n.prototype.init = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return this.dbname = t, [4, this._resetIfEncryptionChanged()]; - case 1: - return r.sent(), [2]; - } - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this.getAllKeys()]; - case 1: - return t = r.sent(), [4, this.removeMany(t)]; - case 2: - return r.sent(), [2]; - } - }); - }); - }; -})($p); -var Ua; -(function(e) { - e.INIT = "INIT", e.OPENING = "OPENING", e.OPENED = "OPENED", e.CLOSED = "CLOSED"; -})(Ua || (Ua = {})); -var Er, aL = function() { - function e(n) { - var t = n.name, r = n.version, i = n.store, a = n.config; - this.name = t, this._version = r, this._state = Ua.INIT, this._config = a || new rh({ dbname: t }), this._store = i, this._event = { success: Iu, error: Iu, storeReplaced: Iu, upgrade: Lb }, this._collections = /* @__PURE__ */ new Map(), this._globalMutex = new P1("".concat(this.name, ".lock")), this._config.disableLogger && Hs.off(), new $i({ dbname: t, limit: this._config.cacheLimit }); - } - return Object.defineProperty(e.prototype, "version", { get: function() { - return this._version; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "state", { get: function() { - return this._state; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "store", { get: function() { - return this._store; - }, enumerable: !1, configurable: !0 }), e.prototype.estimateUsage = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, (t = this._store, T(void 0, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, t.usage()]; - case 1: - return [2, r.sent()]; - } - }); - }))]; - case 1: - return [2, n.sent()]; - } - var t; - }); - }); - }, e.prototype.commitSchema = function(n) { - return T(this, void 0, void 0, function() { - var t = this; - return C(this, function(r) { - switch (r.label) { - case 0: - return this._state !== Ua.OPENING ? [3, 2] : [4, Promise.all(n.map(function(i) { - return T(t, void 0, void 0, function() { - var a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return a = i.collectionName, o = i.keyName, s = i.index, c = s === void 0 ? [] : s, this._collections.has(a) || this._collections.set(a, new y0({ dbname: this.name, collectionName: a, keyName: o, indexes: c, store: this._store })), (l = this._collections.get(a)) ? [4, l.init()] : [3, 2]; - case 1: - u.sent(), u.label = 2; - case 2: - return [2]; - } - }); - }); - }))]; - case 1: - return r.sent(), [3, 3]; - case 2: - throw on.databaseSchemaNotOnUpgrade; - case 3: - return [2]; - } - }); - }); - }, e.prototype.open = function() { - var n; - return T(this, void 0, void 0, function() { - var t, r, i, a, o = this; - return C(this, function(s) { - switch (s.label) { - case 0: - return [4, this._globalMutex.lock()]; - case 1: - if (s.sent(), this._state === Ua.OPENED) - return [3, 12]; - this._state = Ua.OPENING, s.label = 2; - case 2: - return s.trys.push([2, 5, , 12]), [4, this._store.init(this.name)]; - case 3: - return s.sent(), c = this.name, t = "".concat(Qm(c), ".metadata"), r = { version: 0, collectionNames: [] }, [4, this._store.get(t)]; - case 4: - return i = (n = s.sent()) !== null && n !== void 0 ? n : r, [2, new Promise(function(l, u) { - var d = function(f) { - i.version < o._version ? o._event.upgrade(i.version, function(p) { - return T(o, void 0, void 0, function() { - var v; - return C(this, function(m) { - switch (m.label) { - case 0: - if (p) - return [3, 5]; - i.version++, i.collectionNames = Array.from(this._collections.keys()), m.label = 1; - case 1: - return m.trys.push([1, 3, , 4]), [4, this._store.set({ key: t, value: i })]; - case 2: - return m.sent(), f({ continued: !0 }), [3, 4]; - case 3: - return v = m.sent(), f({ continued: !1, err: v }), [3, 4]; - case 4: - return [3, 6]; - case 5: - f({ continued: !1, err: p }), m.label = 6; - case 6: - return [2]; - } - }); - }); - }) : f({ continued: !1 }); - }, h = function(f) { - var p = f.continued, v = p !== void 0 && p, m = f.err, E = m === void 0 ? null : m; - if (v) - setTimeout(function() { - return d(h); - }, 10); - else if (E) - Hs.error(E.message), o._globalMutex.unlock(), o._event.error(E), u(E); - else { - var y = []; - i.collectionNames.forEach(function(_) { - var S = o._collections.get(_); - S && S.state === al.READY || y.push(T(o, void 0, void 0, function() { - var b, A; - return C(this, function(w) { - switch (w.label) { - case 0: - return [4, y0.metadataOf(this.name, _, this._store)]; - case 1: - return (b = w.sent()) ? (A = new y0({ dbname: this.name, collectionName: _, keyName: b.keyName, indexes: b.indexes, store: this._store }), this._collections.set(_, A), [4, A.init()]) : [3, 3]; - case 2: - w.sent(), w.label = 3; - case 3: - return [2]; - } - }); - })); - }), Promise.all(y).then(function() { - o._state = Ua.OPENED, o._globalMutex.unlock(), o._event.success(), l(); - }).catch(function(_) { - Hs.error(_.message), o._globalMutex.unlock(), o._event.error(_), u(_); - }); - } - }; - d(h); - })]; - case 5: - switch (a = s.sent(), a.code) { - case On.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING: - return [3, 6]; - case On.STORE_NOT_AVAILABLE: - return [3, 8]; - } - return [3, 10]; - case 6: - return Hs.warning("Access to the local storage is not allowed. Switched to MemoryStore automatically."), this._store = new Xo({}), this._globalMutex.unlock(), this._event.error(a), this._event.storeReplaced(this._store), [4, this.open()]; - case 7: - return s.sent(), [3, 11]; - case 8: - return Hs.warning("IndexedDB is not available in this environment. Switched to MemoryStore automatically. Consider using other store to save data persistently (e.g. AsyncStorage)."), this._store = new Xo({}), this._globalMutex.unlock(), this._event.error(a), this._event.storeReplaced(this._store), [4, this.open()]; - case 9: - return s.sent(), [3, 11]; - case 10: - throw Hs.error(a.message), this._globalMutex.unlock(), this._event.error(a), a; - case 11: - return [3, 12]; - case 12: - return [2]; - } - var c; - }); - }); - }, e.prototype.close = function() { - this._collections.forEach(function(n) { - return n.close(); - }), this._state = Ua.CLOSED; - }, e.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, Promise.all(Array.from(this._collections.values()).map(function(t) { - return t.clear(); - }))]; - case 1: - return n.sent(), [2]; - } - }); - }); - }, e.prototype.reset = function() { - return T(this, void 0, void 0, function() { - var n, t = this; - return C(this, function(r) { - switch (r.label) { - case 0: - return this.close(), (n = $i.get(this.name)) && n.clearByCondition(function(i) { - return i.key.startsWith(Qm(t.name)); - }), [4, this._store.clear()]; - case 1: - return r.sent(), [2]; - } - }); - }); - }, e.prototype.on = function(n, t) { - this._event[n] = t; - }, e.prototype.off = function(n) { - typeof this._event[n] == "function" && (n === "upgrade" ? this._event[n] = Lb : this._event[n] = Iu); - }, e.prototype.collection = function(n) { - var t = this._collections.get(n); - if (t) - return t; - throw on.collectionNotReady; - }, e; -}(), bs = function() { - function e(n) { - var t, r, i, a; - this.messageTypeFilter = (t = n == null ? void 0 : n.messageTypeFilter) !== null && t !== void 0 ? t : Nr.ALL, this.customTypesFilter = (r = n == null ? void 0 : n.customTypesFilter) !== null && r !== void 0 ? r : null, this.senderUserIdsFilter = (i = n == null ? void 0 : n.senderUserIdsFilter) !== null && i !== void 0 ? i : null, this.replyType = (a = n == null ? void 0 : n.replyType) !== null && a !== void 0 ? a : ir.NONE; - } - return e.prototype.clone = function() { - var n = new e(), t = JSON.parse(JSON.stringify(this)); - return Object.keys(t).forEach(function(r) { - n[r] = t[r]; - }), n; - }, e.prototype.match = function(n) { - switch (this.messageTypeFilter) { - case Nr.USER: - if (n.messageType !== Ln.USER) - return !1; - break; - case Nr.FILE: - if (n.messageType !== Ln.FILE) - return !1; - break; - case Nr.ADMIN: - if (n.messageType !== Ln.ADMIN) - return !1; - } - if (this.customTypesFilter && this.customTypesFilter.length > 0 && !this.customTypesFilter.includes("*") && !this.customTypesFilter.includes(n.customType) || this.senderUserIdsFilter && this.senderUserIdsFilter.length > 0 && (!(n instanceof Vn) || !this.senderUserIdsFilter.includes(n.sender.userId))) - return !1; - if (n instanceof kr) - switch (this.replyType) { - case ir.NONE: - if (n.parentMessageId > 0) - return !1; - break; - case ir.ONLY_REPLY_TO_CHANNEL: - if (n instanceof Vn && n.parentMessageId > 0 && !n.replyToChannel) - return !1; - } - return !0; - }, e; -}(); -(function(e) { - e.CHANNEL_LATEST = "channel_latest", e.NEWEST_CHILD_MESSAGE = "newest_child_message"; -})(Er || (Er = {})); -var Xu, Ga = function(e) { - switch (e) { - case Er.CHANNEL_LATEST: - return ["channelUrl", "-createdAt", "-messageId"]; - case Er.NEWEST_CHILD_MESSAGE: - return ["channelUrl", "-parentMessageId", "-createdAt", "-messageId"]; - } -}, oL = function() { - return ["channelUrl", "-createdAt", "-notificationId"]; -}, sL = L(L({}, EA), { scheduledAt: void 0 }), lL = function(e) { - return bA(e) && k("number", e.scheduledAt, !0); -}, cL = L(L({}, Xp), { scheduledAt: 0, file: void 0, fileUrl: void 0, fileName: void 0, mimeType: void 0, fileSize: void 0, thumbnailSizes: void 0, requireAuth: !1 }), uL = function(e) { - return Jp(e) && k("number", e.scheduledAt) && (fr(e.file) || k("string", e.fileUrl)) && k("string", e.fileName, !0) && k("string", e.mimeType, !0) && k("number", e.fileSize, !0) && (e.thumbnailSizes === null || e.thumbnailSizes === void 0 || e.thumbnailSizes.every(function(n) { - return k("object", n) && n.maxWidth > 0 && n.maxHeight > 0; - })); -}, BA = "UnsentMessage", dL = "reqId", Xh = {}, Il = function(e) { - function n(t) { - var r = e.call(this, t) || this; - return r._mutex = new P1("unsendmessagecache.lock"), Xh[t] = r, r; - } - return O(n, e), Object.defineProperty(n.prototype, "_cacheContext", { get: function() { - return U.of(this._iid).cacheContext; - }, enumerable: !1, configurable: !0 }), n.of = function(t, r) { - return r === void 0 && (r = !1), Xh[t] && !r || (Xh[t] = new n(t)), Xh[t]; - }, Object.defineProperty(n.prototype, "collection", { get: function() { - var t = this._cacheContext.nestdb, r = t == null ? void 0 : t.collection(BA); - if (!r) - throw H.databaseError; - return r; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "localCacheEnabled", { get: function() { - return this._cacheContext.localCacheEnabled && !!this.collection; - }, enumerable: !1, configurable: !0 }), n.prototype._serialize = function(t) { - if (t.messageId > 0) - throw H.invalidParameters; - var r, i = L({}, t.serialize()); - return t instanceof Ar ? (t.messageParams && (i.messageParams = _b(t.messageParams)), t.scheduledInfo && t.scheduledInfo.scheduledMessageParams && (i.scheduledInfo.scheduledMessageParams = (r = t.scheduledInfo.scheduledMessageParams, L(L({}, _b(r)), { scheduledAt: r.scheduledAt })))) : t instanceof qn ? (t.messageParams && (i.messageParams = bb(t.messageParams)), t.scheduledInfo && t.scheduledInfo.scheduledMessageParams && (i.scheduledInfo.scheduledMessageParams = function(a) { - return L(L({}, bb(a)), { scheduledAt: a.scheduledAt }); - }(t.scheduledInfo.scheduledMessageParams))) : t instanceof Ui && t.messageParams && (i.messageParams = function(a) { - return Be({ fileInfoList: a.fileInfoList, isReplyToChannel: a.isReplyToChannel, pushNotificationDeliveryOption: a.pushNotificationDeliveryOption }); - }(t.messageParams)), i; - }, n.prototype._deserialize = function(t) { - return t = L(L({}, t), { messageId: parseInt(t.messageId) }), tr.of(this._iid).buildMessageFromSerializedData(t); - }, n.prototype._deserializeWithMessageCreateParams = function(t) { - var r, i, a; - return T(this, void 0, void 0, function() { - var o, s, c, l, u, d, h = this; - return C(this, function(f) { - switch (f.label) { - case 0: - return o = tr.of(this._iid), s = this._deserialize(t), t.messageParams ? s instanceof Ar ? (l = t.messageParams, s.messageParams = o.buildUserMessageCreateParamsFromSerializedData(l, s), [3, 6]) : [3, 1] : [3, 6]; - case 1: - return s instanceof qn ? (l = t.messageParams).fileKey && typeof l.fileKey == "string" && f0((r = l.fileType) !== null && r !== void 0 ? r : "") ? (c = l, [4, this.collection.getBlob(l.fileKey)]) : [3, 3] : [3, 4]; - case 2: - c.file = (i = f.sent()) !== null && i !== void 0 ? i : void 0, f.label = 3; - case 3: - return s.messageParams = o.buildFileMessageCreateParamsFromSerializedData(l, s), [3, 6]; - case 4: - return s instanceof Ui && (l = t.messageParams) && l.fileInfoList ? (s.messageParams = o.buildMultipleFilesMessageCreateParamsFromSerializedData(l, s), [4, Promise.all(s.messageParams.fileInfoList.map(function(p) { - return T(h, void 0, void 0, function() { - var v, m, E, y, _; - return C(this, function(S) { - switch (S.label) { - case 0: - return typeof ((m = p._uploadedMetaData) === null || m === void 0 ? void 0 : m.fileKey) == "string" && f0((y = (E = p._uploadedMetaData) === null || E === void 0 ? void 0 : E.fileType) !== null && y !== void 0 ? y : "") ? (v = p, [4, this.collection.getBlob(p._uploadedMetaData.fileKey)]) : [3, 2]; - case 1: - v.file = (_ = S.sent()) !== null && _ !== void 0 ? _ : void 0, S.label = 2; - case 2: - return [2]; - } - }); - }); - }))]) : [3, 6]; - case 5: - f.sent(), f.label = 6; - case 6: - return s.scheduledInfo && t.scheduledInfo && t.scheduledInfo.scheduledMessageParams ? s instanceof Ar ? (u = t.scheduledInfo.scheduledMessageParams, s.scheduledInfo.scheduledMessageParams = o.buildScheduledUserMessageCreateParamsFromSerializedData(u, s), [3, 10]) : [3, 7] : [3, 10]; - case 7: - return s instanceof qn ? (u = t.scheduledInfo.scheduledMessageParams).fileKey && typeof u.fileKey == "string" && typeof u.fileType == "string" && f0(u.fileType) ? (d = u, [4, this.collection.getBlob(u.fileKey)]) : [3, 9] : [3, 10]; - case 8: - d.file = (a = f.sent()) !== null && a !== void 0 ? a : void 0, f.label = 9; - case 9: - s.scheduledInfo.scheduledMessageParams = o.buildScheduledFileMessageCreateParamsFromSerializedData(u, s), f.label = 10; - case 10: - return [2, s]; - } - }); - }); - }, n.prototype._getFileInfoBlobKey = function(t, r) { - return "".concat(t, ".").concat(r); - }, n.prototype.get = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.getByKey("".concat(t))] : [3, 2]; - case 1: - if (r = i.sent()) - return [2, this._deserializeWithMessageCreateParams(r)]; - i.label = 2; - case 2: - return [2, void 0]; - } - }); - }); - }, n.prototype.fetch = function(t) { - var r = t.channelUrl, i = t.filter, a = i === void 0 ? new bs() : i, o = t.order, s = o === void 0 ? Er.CHANNEL_LATEST : o, c = t.sendingStatus, l = t.backward, u = l !== void 0 && l, d = t.parentMessageId; - return T(this, void 0, void 0, function() { - var h, f, p, v, m = this; - return C(this, function(E) { - switch (E.label) { - case 0: - return this.localCacheEnabled ? (h = Ga(s), f = { "/where": function(y) { - return !!(s !== Er.NEWEST_CHILD_MESSAGE || d && y.parentMessageId !== 0 && y.parentMessageId === d) && a.match(m._deserialize(y)); - } }, r && (f.channelUrl = r), c && (f.sendingStatus = c), p = { where: f, index: h, backward: u }, [4, this.collection.query(p)]) : [3, 3]; - case 1: - return [4, E.sent().fetch({})]; - case 2: - return v = E.sent(), [2, Promise.all(v.map(function(y) { - return T(m, void 0, void 0, function() { - return C(this, function(_) { - switch (_.label) { - case 0: - return [4, this._deserializeWithMessageCreateParams(y)]; - case 1: - return [2, _.sent()]; - } - }); - }); - }))]; - case 3: - return [2, []]; - } - }); - }); - }, n.prototype.getAllChildMessages = function(t, r) { - return r === void 0 && (r = new bs()), T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this.fetch({ filter: r, order: Er.NEWEST_CHILD_MESSAGE, channelUrl: t.channelUrl, backward: !1, parentMessageId: t.messageId })]; - case 1: - return [2, i.sent()]; - } - }); - }); - }, n.prototype.upsert = function(t) { - return T(this, void 0, void 0, function() { - var r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, Promise.all(t.map(function(a) { - return T(r, void 0, void 0, function() { - var o; - return C(this, function(s) { - switch (s.label) { - case 0: - return a instanceof qn || a instanceof Ui ? [4, this._mutex.lock()] : [3, 4]; - case 1: - return s.sent(), [4, this.saveBlob(a)]; - case 2: - return s.sent(), [4, this._mutex.unlock()]; - case 3: - s.sent(), s.label = 4; - case 4: - return o = this._serialize(a), [4, this.collection.upsertOne(o)]; - case 5: - return s.sent(), [2]; - } - }); - }); - }))] : [3, 2]; - case 1: - i.sent(), i.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.upsertChildMessages = function(t) { - return T(this, void 0, void 0, function() { - var r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, Promise.all(t.map(function(a) { - return T(r, void 0, void 0, function() { - var o; - return C(this, function(s) { - switch (s.label) { - case 0: - return o = [], a.threadInfo && a.threadInfo.replyCount > 0 ? [4, this.getAllChildMessages(a)] : [3, 2]; - case 1: - o = s.sent(), s.label = 2; - case 2: - return o.length > 0 ? (o.forEach(function(c) { - return c.applyParentMessage(a); - }), [4, this.upsert(o)]) : [3, 4]; - case 3: - s.sent(), s.label = 4; - case 4: - return [2]; - } - }); - }); - }))] : [3, 2]; - case 1: - i.sent(), i.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.remove = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - if (!this.localCacheEnabled) - return [3, 8]; - l.label = 1; - case 1: - l.trys.push([1, 6, 7, 8]), r = Ne(t), i = r.next(), l.label = 2; - case 2: - return i.done ? [3, 5] : (a = i.value, [4, this.collection.remove(a)]); - case 3: - l.sent(), l.label = 4; - case 4: - return i = r.next(), [3, 2]; - case 5: - return [3, 8]; - case 6: - return o = l.sent(), s = { error: o }, [3, 8]; - case 7: - try { - i && !i.done && (c = r.return) && c.call(r); - } finally { - if (s) - throw s.error; - } - return [7]; - case 8: - return [2]; - } - }); - }); - }, n.prototype.removeMessagesOfChannel = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.removeIf({ where: { channelUrl: t } })] : [3, 2]; - case 1: - r.sent(), r.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.clear()] : [3, 2]; - case 1: - t.sent(), t.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.saveBlob = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o = this; - return C(this, function(s) { - switch (s.label) { - case 0: - return t instanceof qn ? t.messageParams && (a = t.messageParams).file && Af(a.file) ? [4, this.collection.saveBlob(a.file, t.reqId)] : [3, 2] : [3, 5]; - case 1: - i = s.sent(), a.fileKey = i, a.fileType = El.BLOB, s.label = 2; - case 2: - return t.scheduledInfo && t.scheduledInfo.scheduledMessageParams && (r = t.scheduledInfo.scheduledMessageParams).file && Af(r.file) ? [4, this.collection.saveBlob(r.file, t.reqId)] : [3, 4]; - case 3: - i = s.sent(), r.fileKey = i, r.fileType = El.BLOB, s.label = 4; - case 4: - return [3, 7]; - case 5: - return t instanceof Ui && (a = t.messageParams) && a.fileInfoList && Array.isArray(a.fileInfoList) ? [4, Promise.all(a.fileInfoList.map(function(c, l) { - return T(o, void 0, void 0, function() { - var u; - return C(this, function(d) { - switch (d.label) { - case 0: - return c.file && Af(c.file) ? [4, this.collection.saveBlob(c.file, this._getFileInfoBlobKey(t.reqId, l))] : [3, 2]; - case 1: - u = d.sent(), c._uploadedMetaData || (c._uploadedMetaData = {}), c._uploadedMetaData.fileKey = u, c._uploadedMetaData.fileType = El.BLOB, d.label = 2; - case 2: - return [2]; - } - }); - }); - }))] : [3, 7]; - case 6: - s.sent(), s.label = 7; - case 7: - return [2]; - } - }); - }); - }, n; -}(br), Jh = {}, ac = function(e) { - function n(t) { - var r = e.call(this, t) || this; - return Jh[t] = r, r; - } - return O(n, e), Object.defineProperty(n.prototype, "_sdkState", { get: function() { - return U.of(this._iid).sdkState; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "_cacheContext", { get: function() { - return U.of(this._iid).cacheContext; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "_unsentMessageCache", { get: function() { - return Il.of(this._iid); - }, enumerable: !1, configurable: !0 }), n.of = function(t, r) { - return r === void 0 && (r = !1), Jh[t] && !r || (Jh[t] = new n(t)), Jh[t]; - }, Object.defineProperty(n.prototype, "collection", { get: function() { - var t = this._cacheContext.nestdb; - return ve(!!t).throw(H.databaseError), t.collection(Ym); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "localCacheEnabled", { get: function() { - return this._cacheContext.localCacheEnabled && !!this.collection; - }, enumerable: !1, configurable: !0 }), n.prototype._serialize = function(t) { - return L(L({}, t.serialize()), { messageId: "".concat(t.messageId) }); - }, n.prototype._deserialize = function(t) { - return t = L(L({}, t), { messageId: parseInt(t.messageId) }), tr.of(this._iid).buildMessageFromSerializedData(t); - }, n.prototype.get = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.getByKey("".concat(t))] : [3, 2]; - case 1: - if (r = i.sent()) - return [2, this._deserialize(r)]; - i.label = 2; - case 2: - return [2, void 0]; - } - }); - }); - }, n.prototype.fetch = function(t) { - var r = t.channelUrl, i = t.token, a = t.limit, o = a === void 0 ? 100 : a, s = t.filter, c = s === void 0 ? new bs() : s, l = t.order, u = l === void 0 ? Er.CHANNEL_LATEST : l, d = t.backward, h = d !== void 0 && d, f = t.parentMessageId, p = t.isPollOnly, v = p !== void 0 && p, m = t.exactMatch, E = m !== void 0 && m, y = t.inclusive, _ = y === void 0 || y; - return T(this, void 0, void 0, function() { - var S, b, A, w = this; - return C(this, function(M) { - switch (M.label) { - case 0: - return this.localCacheEnabled ? (S = Ga(u), b = { where: { channelUrl: r, "/where": function(N) { - if (i) - switch (u) { - case Er.CHANNEL_LATEST: - if (E && N.createdAt !== i) - return !1; - if (h) { - if (_ && N.createdAt < i || !_ && N.createdAt <= i) - return !1; - } else if (_ && N.createdAt > i || !_ && N.createdAt >= i) - return !1; - break; - case Er.NEWEST_CHILD_MESSAGE: - if (!f || N.parentMessageId === 0 || N.parentMessageId !== f) - return !1; - } - return !(v && !N._poll) && c.match(w._deserialize(N)); - } }, index: S, backward: h }, [4, this.collection.query(b)]) : [3, 3]; - case 1: - return [4, M.sent().fetch({ limit: o ?? void 0 })]; - case 2: - return A = M.sent(), [2, Promise.all(A.map(function(N) { - return T(w, void 0, void 0, function() { - return C(this, function(x) { - return [2, this._deserialize(N)]; - }); - }); - }))]; - case 3: - return [2, []]; - } - }); - }); - }, n.prototype.getAllChildMessages = function(t, r) { - return r === void 0 && (r = new bs()), T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this.fetch({ channelUrl: t.channelUrl, token: Date.now(), limit: null, backward: !1, filter: r, order: Er.NEWEST_CHILD_MESSAGE, parentMessageId: t.messageId })]; - case 1: - return [2, i.sent()]; - } - }); - }); - }, n.prototype.upsert = function(t) { - var r; - return T(this, void 0, void 0, function() { - var i, a, o, s, c, l, u, d, h = this; - return C(this, function(f) { - switch (f.label) { - case 0: - return this.localCacheEnabled ? [4, this.saveBlobs(t)] : [3, 13]; - case 1: - f.sent(), f.label = 2; - case 2: - f.trys.push([2, 7, 8, 9]), i = Ne(t), a = i.next(), f.label = 3; - case 3: - return a.done ? [3, 6] : (o = a.value, !((r = o.threadInfo) === null || r === void 0) && r._isUpdateRequired ? [4, this.get(o.messageId)] : [3, 5]); - case 4: - (s = f.sent()) != null && s.threadInfo && o.threadInfo._updateFrom(s.threadInfo), f.label = 5; - case 5: - return a = i.next(), [3, 3]; - case 6: - return [3, 9]; - case 7: - return c = f.sent(), u = { error: c }, [3, 9]; - case 8: - try { - a && !a.done && (d = i.return) && d.call(i); - } finally { - if (u) - throw u.error; - } - return [7]; - case 9: - return l = t.map(function(p) { - return h._serialize(p); - }), [4, this.collection.upsertMany(l)]; - case 10: - return f.sent(), [4, this.upsertChildMessages(t)]; - case 11: - return f.sent(), [4, this._unsentMessageCache.upsertChildMessages(t)]; - case 12: - f.sent(), f.label = 13; - case 13: - return [2]; - } - }); - }); - }, n.prototype.upsertChildMessages = function(t) { - return T(this, void 0, void 0, function() { - var r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, Promise.all(t.map(function(a) { - return T(r, void 0, void 0, function() { - var o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return o = [], !((s = a.threadInfo) === null || s === void 0) && s.replyCount && a.threadInfo.replyCount > 0 ? [4, this.getAllChildMessages(a)] : [3, 2]; - case 1: - o = c.sent(), c.label = 2; - case 2: - return o.length > 0 ? (o.forEach(function(l) { - return l.applyParentMessage(a); - }), [4, this.upsert(o)]) : [3, 4]; - case 3: - c.sent(), c.label = 4; - case 4: - return [2]; - } - }); - }); - }))] : [3, 2]; - case 1: - i.sent(), i.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.remove = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - if (!this.localCacheEnabled) - return [3, 8]; - l.label = 1; - case 1: - l.trys.push([1, 6, 7, 8]), r = Ne(t), i = r.next(), l.label = 2; - case 2: - return i.done ? [3, 5] : (a = i.value, [4, this.collection.remove("".concat(a))]); - case 3: - l.sent(), l.label = 4; - case 4: - return i = r.next(), [3, 2]; - case 5: - return [3, 8]; - case 6: - return o = l.sent(), s = { error: o }, [3, 8]; - case 7: - try { - i && !i.done && (c = r.return) && c.call(r); - } finally { - if (s) - throw s.error; - } - return [7]; - case 8: - return [2]; - } - }); - }); - }, n.prototype.removeMessagesOfChannel = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.removeIf({ where: { channelUrl: t }, index: Ga(Er.CHANNEL_LATEST) })] : [3, 6]; - case 1: - return i.sent(), [4, (r = this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/sync"))]; - case 2: - return i.sent(), [4, r.remove("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/sync.meta"))]; - case 3: - return i.sent(), [4, r.remove("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/changelogs"))]; - case 4: - return i.sent(), [4, r.remove("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/changelogs.meta"))]; - case 5: - i.sent(), i.label = 6; - case 6: - return [2]; - } - }); - }); - }, n.prototype.removeUnderOffset = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.removeIf({ where: { channelUrl: t, createdAt: { "<": r } }, index: Ga(Er.CHANNEL_LATEST) })] : [3, 2]; - case 1: - i.sent(), i.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.clear()] : [3, 2]; - case 1: - t.sent(), t.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.countBetween = function(t, r, i) { - return T(this, void 0, void 0, function() { - var a, o = this; - return C(this, function(s) { - switch (s.label) { - case 0: - return this.localCacheEnabled ? (a = Ga(Er.CHANNEL_LATEST), [4, this.collection.query({ where: { channelUrl: t, "/where": function(c) { - var l = o._deserialize(c); - return i.includes(l.createdAt) && r.match(l); - } }, index: a }).count()]) : [3, 2]; - case 1: - return [2, s.sent()]; - case 2: - return [2, 0]; - } - }); - }); - }, n.prototype.saveBlobs = function(t) { - return T(this, void 0, void 0, function() { - var r = this; - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, Promise.all(t.map(function(a) { - return T(r, void 0, void 0, function() { - var o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return a instanceof qn && a.messageParams && (o = a.messageParams).file && Af(o.file) ? [4, this.collection.saveBlob(o.file, a.reqId)] : [3, 2]; - case 1: - s = c.sent(), o.fileKey = s, c.label = 2; - case 2: - return [2]; - } - }); - }); - }))]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype._getGroupChannelPreferenceSize = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return r = 0, [4, (i = this._cacheContext.preference).get("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/sync"))]; - case 1: - return a = l.sent(), [4, i.get("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/sync.meta"))]; - case 2: - return o = l.sent(), [4, i.get("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/changelogs"))]; - case 3: - return s = l.sent(), [4, i.get("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/changelogs.meta"))]; - case 4: - return c = l.sent(), a && (r += JSON.stringify(a).length), o && (r += JSON.stringify(o).length), s && (r += JSON.stringify(s).length), c && (r += JSON.stringify(c).length), [2, r]; - } - }); - }); - }, n; -}(br), $h = {}, hL = function(e) { - function n(t) { - var r = e.call(this, t) || this; - return $h[t] = r, r; - } - return O(n, e), Object.defineProperty(n.prototype, "_sdkState", { get: function() { - return U.of(this._iid).sdkState; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "_cacheContext", { get: function() { - return U.of(this._iid).cacheContext; - }, enumerable: !1, configurable: !0 }), n.of = function(t, r) { - return r === void 0 && (r = !1), $h[t] && !r || ($h[t] = new n(t)), $h[t]; - }, Object.defineProperty(n.prototype, "collection", { get: function() { - var t = this._cacheContext.nestdb; - return ve(!!t).throw(H.databaseError), t.collection(UA); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "localCacheEnabled", { get: function() { - return this._cacheContext.localCacheEnabled && !!this.collection; - }, enumerable: !1, configurable: !0 }), n.prototype._serialize = function(t) { - return L({}, t.serialize()); - }, n.prototype._deserialize = function(t) { - return tr.of(this._iid).buildMessageFromSerializedData(t); - }, n.prototype.get = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.getByKey(t)] : [3, 2]; - case 1: - if (r = i.sent()) - return [2, this._deserialize(r)]; - i.label = 2; - case 2: - return [2, void 0]; - } - }); - }); - }, n.prototype.fetch = function(t) { - var r = t.channelUrl, i = t.token, a = t.limit, o = a === void 0 ? 100 : a, s = t.filter, c = s === void 0 ? new bs() : s, l = t.backward, u = l !== void 0 && l, d = t.exactMatch, h = d !== void 0 && d, f = t.inclusive, p = f === void 0 || f; - return T(this, void 0, void 0, function() { - var v, m = this; - return C(this, function(E) { - switch (E.label) { - case 0: - return this.localCacheEnabled ? (v = { where: { channelUrl: r, "/where": function(y) { - if (i) { - if (h && y.createdAt !== i) - return !1; - if (u) { - if (p && y.createdAt < i || !p && y.createdAt <= i) - return !1; - } else if (p && y.createdAt > i || !p && y.createdAt >= i) - return !1; - } - return c.match(m._deserialize(y)); - } }, index: ["channelUrl", "-createdAt", "-notificationId"], backward: u }, [4, this.collection.query(v)]) : [3, 3]; - case 1: - return [4, E.sent().fetch({ limit: o ?? void 0 })]; - case 2: - return [2, E.sent().map(function(y) { - return m._deserialize(y); - })]; - case 3: - return [2, []]; - } - }); - }); - }, n.prototype.upsert = function(t) { - return T(this, void 0, void 0, function() { - var r, i = this; - return C(this, function(a) { - switch (a.label) { - case 0: - return this.localCacheEnabled ? (r = t.map(function(o) { - return i._serialize(o); - }), [4, this.collection.upsertMany(r)]) : [3, 2]; - case 1: - a.sent(), a.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.remove = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - if (!this.localCacheEnabled) - return [3, 8]; - l.label = 1; - case 1: - l.trys.push([1, 6, 7, 8]), r = Ne(t), i = r.next(), l.label = 2; - case 2: - return i.done ? [3, 5] : (a = i.value, [4, this.collection.remove(a)]); - case 3: - l.sent(), l.label = 4; - case 4: - return i = r.next(), [3, 2]; - case 5: - return [3, 8]; - case 6: - return o = l.sent(), s = { error: o }, [3, 8]; - case 7: - try { - i && !i.done && (c = r.return) && c.call(r); - } finally { - if (s) - throw s.error; - } - return [7]; - case 8: - return [2]; - } - }); - }); - }, n.prototype.markAsReadByTimestamp = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.updateIf({ where: { channelUrl: t, messageStatus: il.SENT, createdAt: { "<": r } } }, { set: { messageStatus: il.READ } })] : [3, 2]; - case 1: - i.sent(), i.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.markAsReadByMessageIds = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.updateIf({ where: { channelUrl: t, notificationId: { "/in": r }, messageStatus: il.SENT } }, { set: { messageStatus: il.READ } })] : [3, 2]; - case 1: - return [2, i.sent().length]; - case 2: - return [2, 0]; - } - }); - }); - }, n.prototype.removeMessagesOfChannel = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.removeIf({ where: { channelUrl: t }, index: ["channelUrl", "-createdAt", "-notificationId"] })] : [3, 6]; - case 1: - return i.sent(), [4, (r = this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/sync"))]; - case 2: - return i.sent(), [4, r.remove("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/sync.meta"))]; - case 3: - return i.sent(), [4, r.remove("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/changelogs"))]; - case 4: - return i.sent(), [4, r.remove("sendbird:".concat(this._sdkState.userId, "@groupchannel/").concat(t, "/message/changelogs.meta"))]; - case 5: - i.sent(), i.label = 6; - case 6: - return [2]; - } - }); - }); - }, n.prototype.removeUnderOffset = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.removeIf({ where: { channelUrl: t, createdAt: { "<": r } }, index: Ga(Er.CHANNEL_LATEST) })] : [3, 2]; - case 1: - i.sent(), i.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this.localCacheEnabled ? [4, this.collection.clear()] : [3, 2]; - case 1: - t.sent(), t.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.countBetween = function(t, r, i) { - return T(this, void 0, void 0, function() { - var a, o = this; - return C(this, function(s) { - switch (s.label) { - case 0: - return this.localCacheEnabled ? (a = ["channelUrl", "-createdAt", "-notificationId"], [4, this.collection.query({ where: { channelUrl: t, "/where": function(c) { - var l = o._deserialize(c); - return i.includes(l.createdAt) && r.match(l); - } }, index: a }).count()]) : [3, 2]; - case 1: - return [2, s.sent()]; - case 2: - return [2, 0]; - } - }); - }); - }, n; -}(br), ru = {}, HA = function(e) { - function n(t) { - var r = e.call(this, t) || this; - return r._observers = /* @__PURE__ */ new Map(), r._dispatcherContext = r._dispatcher.on(function(i) { - return T(r, void 0, void 0, function() { - var a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M = this; - return C(this, function(N) { - switch (N.label) { - case 0: - return i instanceof Sn ? (a = i.messages, w = i.source, u = i.isWebSocketEventComing, o = a.filter(function(x) { - return x instanceof kr && x.channelType !== Ft.OPEN && x.messageId > 0; - }), s = a.filter(function(x) { - return x instanceof kr && x.channelType !== Ft.OPEN && x.messageId === 0; - }), c = a.filter(function(x) { - return x instanceof Al; - }), o.length > 0 ? [4, Pn(function() { - return T(M, void 0, void 0, function() { - return C(this, function(x) { - switch (x.label) { - case 0: - return [4, this._messageCache.upsert(o)]; - case 1: - return x.sent(), [4, this._unsentMessageCache.remove(o.map(function(D) { - return D instanceof Vn ? D.reqId : null; - }).filter(function(D) { - return D !== null; - }))]; - case 2: - return x.sent(), [2]; - } - }); - }); - })] : [3, 2]) : [3, 7]; - case 1: - N.sent(), u || this._broadcastUpdateEvent(o, w), N.label = 2; - case 2: - return s.length > 0 ? [4, Pn(function() { - return T(M, void 0, void 0, function() { - return C(this, function(x) { - switch (x.label) { - case 0: - return [4, this._unsentMessageCache.upsert(s)]; - case 1: - return x.sent(), [2]; - } - }); - }); - })] : [3, 4]; - case 3: - N.sent(), u || this._broadcastUpdateEvent(s, w), N.label = 4; - case 4: - return c.length > 0 ? [4, Pn(function() { - return T(M, void 0, void 0, function() { - return C(this, function(x) { - switch (x.label) { - case 0: - return [4, this._notificationCache.upsert(c)]; - case 1: - return x.sent(), [2]; - } - }); - }); - })] : [3, 6]; - case 5: - N.sent(), u || this._broadcastUpdateEvent(c, w), N.label = 6; - case 6: - return [3, 24]; - case 7: - return i instanceof N1 ? (l = i.messageIds, w = i.source, u = i.isWebSocketEventComing, d = l.filter(function(x) { - return typeof x == "number"; - }), h = l.filter(function(x) { - return typeof x == "string"; - }), [4, Pn(function() { - return T(M, void 0, void 0, function() { - return C(this, function(x) { - switch (x.label) { - case 0: - return d.length > 0 ? [4, this._messageCache.remove(d)] : [3, 2]; - case 1: - x.sent(), x.label = 2; - case 2: - return h.length > 0 ? [4, this._notificationCache.remove(h)] : [3, 4]; - case 3: - x.sent(), x.label = 4; - case 4: - return [2]; - } - }); - }); - })]) : [3, 9]; - case 8: - return N.sent(), u || this._broadcastRemoveEvent(l, w), [3, 24]; - case 9: - return i instanceof rA ? (f = i.reqId, w = i.source, [4, Pn(function() { - return T(M, void 0, void 0, function() { - return C(this, function(x) { - switch (x.label) { - case 0: - return [4, this._unsentMessageCache.remove([f])]; - case 1: - return x.sent(), [2]; - } - }); - }); - })]) : [3, 11]; - case 10: - return N.sent(), this._broadcastRemoveUnsentEvent(f, w), [3, 24]; - case 11: - return i instanceof iA ? (p = i.polls, w = i.source, this._cacheContext.localCacheEnabled ? (v = p.map(function(x) { - return x.messageId; - }), [4, Promise.all(v.map(function(x) { - return M._messageCache.get(x); - }))]) : [3, 14]) : [3, 15]; - case 12: - return (m = N.sent().filter(function(x) { - return x; - })).length > 0 && p.forEach(function(x) { - var D = m.find(function(j) { - return j.messageId === x.messageId; - }); - D && D.applyPoll(x); - }), [4, Pn(function() { - return T(M, void 0, void 0, function() { - return C(this, function(x) { - switch (x.label) { - case 0: - return [4, this._messageCache.upsert(m)]; - case 1: - return [2, x.sent()]; - } - }); - }); - })]; - case 13: - N.sent(), N.label = 14; - case 14: - return this._broadcastPollChangeLogEvent(p, w), [3, 24]; - case 15: - return i instanceof I1 ? (E = i.event, w = i.source, [4, this._messageCache.get(E.messageId)]) : [3, 19]; - case 16: - return (y = N.sent()) && y.isUserMessage() && y.poll && y.poll.applyPollUpdateEvent(E) ? [4, Pn(function() { - return T(M, void 0, void 0, function() { - return C(this, function(x) { - switch (x.label) { - case 0: - return [4, this._messageCache.upsert([y])]; - case 1: - return [2, x.sent()]; - } - }); - }); - })] : [3, 18]; - case 17: - N.sent(), N.label = 18; - case 18: - return this._broadcastPollUpdateEvent(E, w), [3, 24]; - case 19: - return i instanceof Zp ? (_ = i.event, w = i.source, [4, this._messageCache.get(_.messageId)]) : [3, 23]; - case 20: - return (S = N.sent()) && S.isUserMessage() && S.poll && S.poll.applyPollVoteEvent(_) ? [4, Pn(function() { - return T(M, void 0, void 0, function() { - return C(this, function(x) { - switch (x.label) { - case 0: - return [4, this._messageCache.upsert([S])]; - case 1: - return [2, x.sent()]; - } - }); - }); - })] : [3, 22]; - case 21: - N.sent(), N.label = 22; - case 22: - return this._broadcastPollVoteEvent(_, w), [3, 24]; - case 23: - i instanceof tA ? (b = i.event, w = i.source, b.messageId > 0 && this._broadcastReactionUpdateEvent(b, w)) : i instanceof nA && (A = i.event, w = i.source, this._broadcastThreadUpdateEvent(A, w)), N.label = 24; - case 24: - return [2]; - } - }); - }); - }), r; - } - return O(n, e), Object.defineProperty(n.prototype, "_cacheContext", { get: function() { - return U.of(this._iid).cacheContext; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "_dispatcher", { get: function() { - return U.of(this._iid).dispatcher; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "_messageCache", { get: function() { - return ac.of(this._iid); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "_unsentMessageCache", { get: function() { - return Il.of(this._iid); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "_notificationCache", { get: function() { - return hL.of(this._iid); - }, enumerable: !1, configurable: !0 }), n.of = function(t, r) { - var i; - return r === void 0 && (r = !1), ru[t] && !r || (ru[t] && ((i = ru[t]._dispatcherContext) === null || i === void 0 || i.close()), ru[t] = new n(t)), ru[t]; - }, n.prototype._broadcastUpdateEvent = function(t, r) { - var i, a; - try { - for (var o = Ne(this._observers.values()), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - c.onUpdate && c.onUpdate(t, r); - } - } catch (l) { - i = { error: l }; - } finally { - try { - s && !s.done && (a = o.return) && a.call(o); - } finally { - if (i) - throw i.error; - } - } - }, n.prototype._broadcastPollChangeLogEvent = function(t, r) { - var i, a; - try { - for (var o = Ne(this._observers.values()), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - c.onPollChangeLogUpdate && c.onPollChangeLogUpdate(t, r); - } - } catch (l) { - i = { error: l }; - } finally { - try { - s && !s.done && (a = o.return) && a.call(o); - } finally { - if (i) - throw i.error; - } - } - }, n.prototype._broadcastPollUpdateEvent = function(t, r) { - var i, a; - try { - for (var o = Ne(this._observers.values()), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - c.onPollUpdate && c.onPollUpdate(t, r); - } - } catch (l) { - i = { error: l }; - } finally { - try { - s && !s.done && (a = o.return) && a.call(o); - } finally { - if (i) - throw i.error; - } - } - }, n.prototype._broadcastPollVoteEvent = function(t, r) { - var i, a; - try { - for (var o = Ne(this._observers.values()), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - c.onPollVote && c.onPollVote(t, r); - } - } catch (l) { - i = { error: l }; - } finally { - try { - s && !s.done && (a = o.return) && a.call(o); - } finally { - if (i) - throw i.error; - } - } - }, n.prototype._broadcastRemoveEvent = function(t, r) { - var i, a; - try { - for (var o = Ne(this._observers.values()), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - c.onRemove && c.onRemove(t, r); - } - } catch (l) { - i = { error: l }; - } finally { - try { - s && !s.done && (a = o.return) && a.call(o); - } finally { - if (i) - throw i.error; - } - } - }, n.prototype._broadcastRemoveUnsentEvent = function(t, r) { - var i, a; - try { - for (var o = Ne(this._observers.values()), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - c.onRemoveUnsent && c.onRemoveUnsent(t, r); - } - } catch (l) { - i = { error: l }; - } finally { - try { - s && !s.done && (a = o.return) && a.call(o); - } finally { - if (i) - throw i.error; - } - } - }, n.prototype._broadcastReactionUpdateEvent = function(t, r) { - var i, a; - try { - for (var o = Ne(this._observers.values()), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - c.onReactionUpdate && c.onReactionUpdate(t, r); - } - } catch (l) { - i = { error: l }; - } finally { - try { - s && !s.done && (a = o.return) && a.call(o); - } finally { - if (i) - throw i.error; - } - } - }, n.prototype._broadcastThreadUpdateEvent = function(t, r) { - var i, a; - try { - for (var o = Ne(this._observers.values()), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - c.onThreadInfoUpdate && c.onThreadInfoUpdate(t, r); - } - } catch (l) { - i = { error: l }; - } finally { - try { - s && !s.done && (a = o.return) && a.call(o); - } finally { - if (i) - throw i.error; - } - } - }, n.prototype.subscribe = function(t, r) { - this._observers.set(t, r); - }, n.prototype.unsubscribe = function(t) { - this._observers.delete(t); - }, n.prototype.unsubscribeAll = function() { - this._observers.clear(); - }, n; -}(br), fL = function(e) { - function n(t) { - var r = this, i = t.reverse, a = i !== void 0 && i, o = t.limit, s = o === void 0 ? 20 : o, c = t.token; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(Tw), r.params = Be({ token: c, limit: s, reverse: a, order: Lm.UPDATED_AT, show_ui_template: !0, show_color_variables: !0 }), r; - } - return O(n, e), n; -}(ge), pL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this, a = r.next, o = r.has_more, s = o !== void 0 && o, c = r.templates; - return i.nextToken = a, i.hasMore = s, i.templates = c.map(function(l) { - return { template: JSON.stringify(l) }; - }), i; - } - return O(n, e), n; -}(_e), vL = function(e) { - function n(t) { - var r = this, i = t.key; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(Tw, "/").concat(i), r; - } - return O(n, e), n; -}(ge), mL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.template = JSON.stringify(r), i; - } - return O(n, e), n; -}(_e), Bb = {}, tr = function() { - function e(n, t) { - var r = t.sdkState, i = t.dispatcher, a = t.requestQueue, o = t.onlineDetector, s = t.cacheContext; - this._iid = n, this._sdkState = r, this._requestQueue = a, this._dispatcher = i, this._cacheContext = s, ac.of(n), Il.of(n), HA.of(n), this.fileMessageQueue = new yD(n, { sdkState: r, dispatcher: i, requestQueue: a, onlineDetector: o, cacheContext: s }), Bb[n] = this; - } - return e.of = function(n) { - return Bb[n]; - }, e.prototype.buildMessageFromSerializedData = function(n) { - var t = ms(n); - if (t.notificationId) - return new Al(this._iid, Al.payloadify(t)); - switch (t.messageType) { - case Ln.USER: - return new Ar(this._iid, Ar.payloadify(t)); - case Ln.FILE: - return Ui._isMultipleFilesMessageSerializedData(t) ? new Ui(this._iid, Ui.payloadify(t)) : new qn(this._iid, qn.payloadify(t)); - case Ln.ADMIN: - return new Oc(this._iid, Oc.payloadify(t)); - } - throw H.invalidParameters; - }, e.prototype.buildUserMessageCreateParamsFromSerializedData = function(n, t) { - return Be(Xe({ data: t.data, customType: t.customType, mentionType: t.mentionType, mentionedUserIds: t.mentionedUserIds, mentionedUsers: t.mentionedUsers, mentionedMessageTemplate: t.mentionedMessageTemplate, metaArrays: t.metaArrays, parentMessageId: t.parentMessageId, isReplyToChannel: n.isReplyToChannel, pushNotificationDeliveryOption: n.pushNotificationDeliveryOption, appleCriticalAlertOptions: t.appleCriticalAlertOptions, reqId: t.reqId, message: t.message, translationTargetLanguages: Object.keys(t.translations), pollId: n.pollId })); - }, e.prototype.buildFileMessageCreateParamsFromSerializedData = function(n, t) { - var r; - return Be(Xe({ data: t.data, customType: t.customType, mentionType: t.mentionType, mentionedUserIds: t.mentionedUserIds, mentionedUsers: t.mentionedUsers, mentionedMessageTemplate: t.mentionedMessageTemplate, metaArrays: t.metaArrays, parentMessageId: t.parentMessageId, isReplyToChannel: n.isReplyToChannel, pushNotificationDeliveryOption: n.pushNotificationDeliveryOption, appleCriticalAlertOptions: t.appleCriticalAlertOptions, reqId: t.reqId, file: n.file, fileKey: n.fileKey, fileUrl: t.plainUrl, fileName: t.name, fileSize: t.size, mimeType: t.type, thumbnailSizes: (r = t.thumbnails) === null || r === void 0 ? void 0 : r.map(function(i) { - return { maxWidth: i.width, maxHeight: i.height }; - }), fileType: n.fileType, requireAuth: t.requireAuth })); - }, e.prototype.buildMultipleFilesMessageCreateParamsFromSerializedData = function(n, t) { - var r = this; - return Be({ data: t.data, customType: t.customType, mentionType: t.mentionType, mentionedUserIds: t.mentionedUserIds, mentionedUsers: t.mentionedUsers, mentionedMessageTemplate: t.mentionedMessageTemplate, metaArrays: t.metaArrays, parentMessageId: t.parentMessageId, isReplyToChannel: n.isReplyToChannel, pushNotificationDeliveryOption: n.pushNotificationDeliveryOption, appleCriticalAlertOptions: t.appleCriticalAlertOptions, reqId: t.reqId, fileInfoList: n.fileInfoList.map(function(i) { - return new op(r._iid, i); - }) }); - }, e.prototype.buildScheduledUserMessageCreateParamsFromSerializedData = function(n, t) { - return L(L({}, this.buildUserMessageCreateParamsFromSerializedData(n, t)), { scheduledAt: n.scheduledAt }); - }, e.prototype.buildScheduledFileMessageCreateParamsFromSerializedData = function(n, t) { - return L(L({}, this.buildFileMessageCreateParamsFromSerializedData(n, t)), { scheduledAt: n.scheduledAt }); - }, e.prototype.buildSenderFromSerializedData = function(n) { - var t = ms(n); - return new Mc(this._iid, Mc.payloadify(t)); - }, e.prototype.getMessage = function(n) { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return t = new ED(n), [4, this._requestQueue.send(t)]; - case 1: - return r = i.sent(), [2, r.as(_D).message]; - } - }); - }); - }, e.prototype.getScheduledMessage = function(n) { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return t = new TD(n), [4, this._requestQueue.send(t)]; - case 1: - return r = i.sent(), [2, r.as(SD).message]; - } - }); - }); - }, e.prototype.getMessagesByMessageId = function(n, t, r, i, a) { - return a === void 0 && (a = ne.REQUEST_MESSAGE), T(this, void 0, void 0, function() { - var o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return o = new qh(L(L({ channelType: t, channelUrl: n, token: String(r) }, Yu), i)), [4, this._requestQueue.send(o)]; - case 1: - return s = l.sent(), c = s.as(Kh).messages, this._dispatcher.dispatch(new Sn({ messages: c, source: a })), [2, c]; - } - }); - }); - }, e.prototype.getMessagesByTimestamp = function(n, t, r, i, a) { - return a === void 0 && (a = ne.REQUEST_MESSAGE), T(this, void 0, void 0, function() { - var o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return o = new qh(L(L({ channelType: t, channelUrl: n, timestamp: r }, Yu), i)), [4, this._requestQueue.send(o)]; - case 1: - return s = l.sent(), c = s.as(Kh).messages, this._dispatcher.dispatch(new Sn({ messages: c, source: a })), [2, c]; - } - }); - }); - }, e.prototype._getMessagesByTimestampForCollection = function(n, t, r, i, a, o, s) { - return a === void 0 && (a = ne.REQUEST_MESSAGE), T(this, void 0, void 0, function() { - var c, l, u, d, h, f; - return C(this, function(p) { - switch (p.label) { - case 0: - return c = new qh(L(L(L({ channelType: t, channelUrl: n, timestamp: r }, Yu), i), { checkingHasNext: o, checkingContinuousMessages: s })), [4, this._requestQueue.send(c)]; - case 1: - return l = p.sent(), u = l.as(Kh), d = u.messages, h = u.isContinuousMessages, f = u.hasNext, this._dispatcher.dispatch(new Sn({ messages: d, source: a })), [2, { messages: d, isContinuousMessages: h, hasNext: f }]; - } - }); - }); - }, e.prototype.getThreadedMessagesByTimestamp = function(n, t, r, i) { - return i === void 0 && (i = ne.REQUEST_THREADED_MESSAGE), T(this, void 0, void 0, function() { - var a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return a = new qh(L(L(L({ channelUrl: n.channelUrl, channelType: n.channelType, timestamp: t }, nh), r), { replyType: ir.ALL, parentMessageId: n.messageId, includeThreadInfo: !0 })), [4, this._requestQueue.send(a)]; - case 1: - return o = l.sent(), s = o.as(Kh).messages, (c = s.slice(1)).forEach(function(u) { - u.parentMessage = n; - }), this._dispatcher.dispatch(new Sn({ messages: c, source: i })), [2, { parentMessage: s[0], threadedMessages: c }]; - } - }); - }); - }, e.prototype.getMessageTemplatesByToken = function(n, t) { - return t === void 0 && (t = {}), T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return r = new fL(L({ token: n }, t)), [4, this._requestQueue.send(r)]; - case 1: - return i = l.sent(), a = i.as(pL), o = a.hasMore, s = a.nextToken, c = a.templates, [2, { hasMore: o, token: s, templates: c }]; - } - }); - }); - }, e.prototype.getMessageTemplate = function(n) { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return t = new vL({ key: n }), [4, this._requestQueue.send(t)]; - case 1: - return r = i.sent(), [2, { template: r.as(mL).template }]; - } - }); - }); - }, e.prototype.getMessageChangelogs = function(n, t, r, i, a) { - return a === void 0 && (a = ne.REQUEST_MESSAGE_CHANGELOGS), T(this, void 0, void 0, function() { - var o, s, c, l, u, d, h, f; - return C(this, function(p) { - switch (p.label) { - case 0: - return o = new bD(Be(Xe(L(L({ channelType: t, channelUrl: n, timestamp: typeof r == "number" ? r : null, token: typeof r == "string" ? r : null }, qm), i)))), [4, this._requestQueue.send(o)]; - case 1: - return s = p.sent(), c = s.as(CD), l = c.updatedMessages, u = c.deletedMessagesInfo, d = c.hasMore, h = c.nextToken, f = u.map(function(v) { - return v.messageId; - }), l.length > 0 && this._dispatcher.dispatch(new Sn({ messages: l, source: a })), f.length > 0 && this._dispatcher.dispatch(new N1({ messageIds: f, source: a })), [2, { updatedMessages: l, deletedMessageIds: f, hasMore: d, token: h }]; - } - }); - }); - }, e; -}(), jA = function(e) { - function n(t, r) { - var i = e.call(this, t) || this; - i.targetMessageId = 0; - var a = r.thread_info, o = r.parent_message_id, s = r.channel_url, c = r.channel_type; - return a && k("object", a) && k("number", o) && k("string", s) && k("string", c) && (i.threadInfo = new ap(t, a), i.targetMessageId = o, i.channelUrl = s, i.channelType = c), i; - } - return O(n, e), n; -}(br), gL = { channelUrl: "", channelType: Ft.BASE, messageId: 0, includeReactions: !1, includeMetaArray: !1, includeParentMessageInfo: !1, includeThreadInfo: !1 }, yL = function(e) { - function n(t) { - var r = t.channelCustomType, i = t.keyword, a = t.limit, o = t.reverse, s = t.exactMatch, c = t.channelUrl, l = t.order, u = t.messageTimestampFrom, d = t.messageTimestampTo, h = t.advancedQuery, f = t.targetFields, p = t.nextToken, v = e.call(this) || this; - return v.method = pe.GET, v.path = "".concat(v6, "/messages"), v.params = { custom_type: r, query: i, limit: a, reverse: o, exact_match: s, channel_url: c, message_ts_from: u, message_ts_to: d, sort_field: l, advanced_query: h, target_fields: f, after: p }, v; - } - return O(n, e), n; -}(ge), EL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.messages = r.results.map(function(a) { - return jr(t, a); - }), i.hasNext = r.has_next, i.nextToken = r.end_cursor, i.totalCount = r.total_count, i; - } - return O(n, e), n; -}(_e); -(function(e) { - e.SCORE = "score", e.TIMESTAMP = "ts"; -})(Xu || (Xu = {})); -var _L = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d, h, f = this; - return (f = e.call(this, t, r) || this).keyword = "", f.reverse = !1, f.exactMatch = !1, f.channelUrl = "", f.channelCustomType = "", f.messageTimestampFrom = null, f.messageTimestampTo = null, f.order = Xu.SCORE, f.advancedQuery = !1, f.targetFields = null, f._nextToken = "", f.totalCount = -1, f.keyword = r.keyword, f.reverse = (i = r.reverse) !== null && i !== void 0 && i, f.exactMatch = (a = r.exactMatch) !== null && a !== void 0 && a, f.channelUrl = (o = r.channelUrl) !== null && o !== void 0 ? o : "", f.channelCustomType = (s = r.channelCustomType) !== null && s !== void 0 ? s : "", f.messageTimestampFrom = (c = r.messageTimestampFrom) !== null && c !== void 0 ? c : null, f.messageTimestampTo = (l = r.messageTimestampTo) !== null && l !== void 0 ? l : null, f.order = (u = r.order) !== null && u !== void 0 ? u : Xu.SCORE, f.advancedQuery = (d = r.advancedQuery) !== null && d !== void 0 && d, f.targetFields = (h = r.targetFields) !== null && h !== void 0 ? h : null, f; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && k("string", this.keyword) && this.keyword.length > 0 && k("boolean", this.reverse) && k("boolean", this.exactMatch) && k("string", this.channelUrl) && k("string", this.channelCustomType) && (k("number", this.messageTimestampFrom) || this.messageTimestampFrom === null) && (k("number", this.messageTimestampTo) || this.messageTimestampTo === null) && Mt(Xu, this.order) && k("boolean", this.advancedQuery) && Ot("string", this.targetFields, !0); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new yL(Xe(L(L({}, this), { nextToken: this._nextToken ? this._nextToken : null }))), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = u.sent(), a = i.as(EL), o = a.messages, s = a.hasNext, c = a.nextToken, l = a.totalCount, this._nextToken = c, this._hasNext = s, this._isLoading = !1, this.totalCount = l, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(ko), bL = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.limit, o = t.token, s = e.call(this) || this; - return s.method = pe.GET, s.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/parent_thread_message"), s.params = Be(Xe({ limit: a, token: o })), s; - } - return O(n, e), n; -}(ge), CL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.token = r.next, i.messages = r.messages.map(function(a) { - return jr(t, a); - }), i; - } - return O(n, e), n; -}(_e), TL = function(e) { - function n(t, r, i, a) { - var o = e.call(this, t, r, i, a) || this; - return o._edge = "", o; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this); - }, n.prototype.load = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new bL({ channelType: this.channelType, channelUrl: this.channelUrl, token: this._edge, limit: this.limit }), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = c.sent(), a = i.as(CL), o = a.messages, s = a.token, this._edge = s, this._hasNext = !!s, this._isLoading = !1, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(io), SL = { channelUrl: "", scheduledMessageId: 0 }, wL = { reverse: !1, limit: 20 }, AL = function(e) { - function n() { - var t = e !== null && e.apply(this, arguments) || this; - return t.name = "message", t; - } - return O(n, e), n.prototype.init = function(t, r) { - var i = r.sdkState, a = r.dispatcher, o = r.sessionManager, s = r.requestQueue, c = r.logger, l = r.onlineDetector, u = r.cacheContext; - e.prototype.init.call(this, t, { sdkState: i, dispatcher: a, sessionManager: o, requestQueue: s, logger: c, onlineDetector: l, cacheContext: u }), this._manager = new tr(t, { sdkState: i, dispatcher: a, requestQueue: s, onlineDetector: l, cacheContext: u }); - }, n.prototype.buildMessageFromSerializedData = function(t) { - return this._manager.buildMessageFromSerializedData(t); - }, n.prototype.buildSenderFromSerializedData = function(t) { - return this._manager.buildSenderFromSerializedData(t); - }, n.prototype.getMessage = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return r = L(L({}, gL), t), ve(function(o) { - return k("string", o.channelUrl) && Mt(Ft, o.channelType) && k("number", o.messageId) && k("boolean", o.includeReactions, !0) && k("boolean", o.includeMetaArray, !0) && k("boolean", o.includeParentMessageInfo, !0) && k("boolean", o.includeThreadInfo, !0); - }(r)).throw(H.invalidParameters), [4, this._manager.getMessage(r)]; - case 1: - if ((i = a.sent()) instanceof kr || i instanceof Al || i === null) - return [2, i]; - throw "Unknown message type is given."; - } - }); - }); - }, n.prototype.getScheduledMessage = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - return r = L(L({}, SL), t), ve(function(a) { - return k("string", a.channelUrl) && a.channelUrl !== "" && k("number", a.scheduledMessageId) && a.scheduledMessageId > 0; - }(r)).throw(H.invalidParameters), [2, this._manager.getScheduledMessage(r)]; - }); - }); - }, n.prototype.getMessageTemplatesByToken = function(t, r) { - return r === void 0 && (r = {}), T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - return i = L(L({}, wL), r), ve(k("string", t, !0) && function(o) { - return k("boolean", o.reverse, !0) && k("number", o.limit, !0); - }(i)).throw(H.invalidParameters), [2, this._manager.getMessageTemplatesByToken(t, i)]; - }); - }); - }, n.prototype.getMessageTemplate = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return ve(k("string", t)).throw(H.invalidParameters), [2, this._manager.getMessageTemplate(t)]; - }); - }); - }, n; -}(Yp), Fn, Ju, Jm; -(function(e) { - e.LATEST_LAST_MESSAGE = "latest_last_message", e.CHRONOLOGICAL = "chronological", e.CHANNEL_NAME_ALPHABETICAL = "channel_name_alphabetical", e.METADATA_VALUE_ALPHABETICAL = "metadata_value_alphabetical"; -})(Fn || (Fn = {})), function(e) { - e.CHRONOLOGICAL = "chronological", e.CHANNEL_NAME_ALPHABETICAL = "channel_name_alphabetical", e.METADATA_VALUE_ALPHABETICAL = "metadata_value_alphabetical"; -}(Ju || (Ju = {})), function(e) { - e.CREATED_AT = "created_at", e.SCHEDULED_AT = "scheduled_at"; -}(Jm || (Jm = {})); -var Cd, Mf = function(e) { - switch (e) { - case Fn.LATEST_LAST_MESSAGE: - return ["-lastMessageUpdatedAt", "-createdAt", "syncIndex"]; - case Fn.CHRONOLOGICAL: - return ["-createdAt", "syncIndex"]; - case Fn.CHANNEL_NAME_ALPHABETICAL: - return ["name"]; - default: - return ["-lastMessageUpdatedAt", "-createdAt", "syncIndex"]; - } -}, VA = function(e) { - function n(t) { - var r = t.message, i = e.call(this) || this; - return i.message = r, i; - } - return O(n, e), n; -}(bn), Hb = {}, Mu = function() { - function e(n, t) { - var r = t.localCacheEnabled, i = t.enableAutoResend, a = t.dispatcher, o = t.sdkState, s = t.logger, c = this; - this._iid = n, Hb[n] = this, this._localCacheEnabled = r, this._enableAutoResend = i, this._isProcessingAutoResend = !1, this._autoResendQueue = [], this._dispatcher = a, this._logger = s, this._sdkState = o, this._localCacheEnabled && a.on(function(l) { - if (l instanceof bi) - switch (l.stateType) { - case tn.CONNECTED: - c._isProcessingAutoResend || c.processAutoResendRegisteredPendingMessages().then(function() { - return c._processNextAutoResend(); - }); - break; - case tn.INTERNAL_DISCONNECTED: - case tn.EXTERNAL_DISCONNECTED: - c._isProcessingAutoResend = !1; - } - }); - } - return e.of = function(n) { - return Hb[n]; - }, e.prototype.processNonAutoResendRegisteredPendingMessages = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return this._enableAutoResend ? [4, this._fetchAllCachedPendingMessages()] : [2]; - case 1: - n = s.sent(); - try { - for (t = Ne(n), r = t.next(); !r.done; r = t.next()) - (i = r.value).errorCode === 0 && (this._logger.debug("cached pending message is not auto-resend registered. changing its sending status to failed: ", i.reqId), i.sendingStatus = $t.FAILED, i.errorCode = nt.ACK_TIMEOUT, this._dispatcher.dispatch(new Sn({ messages: [i], source: ne.LOCAL_MESSAGE_FAILED }))); - } catch (c) { - a = { error: c }; - } finally { - try { - r && !r.done && (o = t.return) && o.call(t); - } finally { - if (a) - throw a.error; - } - } - return [2]; - } - }); - }); - }, e.prototype.processAutoResendRegisteredPendingMessages = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return [4, this._fetchAllCachedPendingMessages()]; - case 1: - n = l.sent(); - try { - for (t = Ne(n), r = t.next(); !r.done; r = t.next()) - i = r.value, this._enableAutoResend && i.errorCode && Yf(i.errorCode) && (a = (/* @__PURE__ */ new Date()).getTime(), o = i.createdAt + 2592e5, this._enableAutoResend && a <= o ? this._autoResendQueue.map(function(u) { - return u.reqId; - }).indexOf(i.reqId) < 0 && this._autoResendQueue.push(i) : (this._logger.debug("auto-resend registered pending messaged expired. expiration date: ", new Date(o).toLocaleString()), i.sendingStatus = $t.FAILED, this._dispatcher.dispatch(new Sn({ messages: [i], source: ne.LOCAL_MESSAGE_FAILED })))); - } catch (u) { - s = { error: u }; - } finally { - try { - r && !r.done && (c = t.return) && c.call(t); - } finally { - if (s) - throw s.error; - } - } - return [2]; - } - }); - }); - }, e.prototype.completeCurrentAndProcessNextAutoResend = function(n) { - if (this._localCacheEnabled && this._enableAutoResend && (n.sendingStatus === $t.SUCCEEDED || n.sendingStatus === $t.FAILED && !Yf(n.errorCode))) { - var t = this.indexOf(n); - t >= 0 && this._autoResendQueue.splice(t, 1), t === 0 && this._processNextAutoResend(); - } - }, e.prototype._fetchAllCachedPendingMessages = function() { - return T(this, void 0, void 0, function() { - var n, t; - return C(this, function(r) { - switch (r.label) { - case 0: - return n = Il.of(this._iid), (t = new bs()).replyType = ir.ALL, [4, n.fetch({ sendingStatus: $t.PENDING, backward: !0, filter: t })]; - case 1: - return [2, r.sent()]; - } - }); - }); - }, e.prototype.indexOf = function(n) { - return this._autoResendQueue.length > 0 ? this._autoResendQueue.map(function(t) { - return t.reqId; - }).indexOf(n.reqId) : -1; - }, e.prototype._isNotInQueue = function(n) { - return this._autoResendQueue.map(function(t) { - return t.reqId; - }).indexOf(n.reqId) === -1; - }, e.prototype._processNextAutoResend = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - if (this._localCacheEnabled && this._enableAutoResend && this._sdkState.appState === "foreground") - try { - this._autoResendQueue.length > 0 ? (this._isProcessingAutoResend || (this._logger.debug("auto-resend queue started."), this._isProcessingAutoResend = !0), n = this._autoResendQueue[0], this._dispatcher.dispatch(new VA({ message: n })), this._logger.debug("processing auto-resend for message request id: ", n.reqId)) : (this._logger.debug("auto-resend queue finished."), this._isProcessingAutoResend = !1); - } catch (r) { - this._logger.warn("process auto-resend error: ", r), this._isProcessingAutoResend = !1; - } - return [2]; - }); - }); - }, e; -}(); -(function(e) { - e[e.USER_BLOCK = 20001] = "USER_BLOCK", e[e.USER_UNBLOCK = 2e4] = "USER_UNBLOCK", e[e.FRIEND_DISCOVERED = 20900] = "FRIEND_DISCOVERED"; -})(Cd || (Cd = {})); -var dp = function() { - function e(n) { - this.category = n.cat, this.data = n.data; - } - return e.getDataAsUserBlockEvent = function(n, t) { - var r = t.data, i = r.blocker, a = r.blockee; - return { blocker: new Dt(n, i), blockee: new Dt(n, a) }; - }, e.getDataAsFriendDiscoveredEvent = function(n, t) { - var r = t.data.friend_discoveries; - return { friendDiscoveries: Array.isArray(r) ? r.map(function(i) { - return new Dt(n, i); - }) : [] }; - }, e; -}(), GA = function(e) { - function n(t, r) { - var i = r.userId, a = e.call(this) || this; - return a._iid = t, a.userId = i, a; - } - return O(n, e), n; -}(bn), zA = function(e) { - function n() { - return e.call(this) || this; - } - return O(n, e), n; -}(bn), qA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "USEV", i) || this; - return a.event = new dp(i), a; - } - return O(n, e), n; -}(En), NL = function(e, n) { - this.pollId = 0, this.messageId = 0, this.pollId = n.poll.id, this.messageId = n.poll.message_id, this._iid = e, this._payload = n; -}, ln; -(function(e) { - e[e.NONE = 0] = "NONE", e[e.CHANNEL_ENTER = 10102] = "CHANNEL_ENTER", e[e.CHANNEL_EXIT = 10103] = "CHANNEL_EXIT", e[e.USER_CHANNEL_MUTE = 10201] = "USER_CHANNEL_MUTE", e[e.USER_CHANNEL_UNMUTE = 10200] = "USER_CHANNEL_UNMUTE", e[e.USER_CHANNEL_BAN = 10601] = "USER_CHANNEL_BAN", e[e.USER_CHANNEL_UNBAN = 10600] = "USER_CHANNEL_UNBAN", e[e.CHANNEL_FREEZE = 10701] = "CHANNEL_FREEZE", e[e.CHANNEL_UNFREEZE = 10700] = "CHANNEL_UNFREEZE", e[e.TYPING_START = 10900] = "TYPING_START", e[e.TYPING_END = 10901] = "TYPING_END", e[e.CHANNEL_JOIN = 1e4] = "CHANNEL_JOIN", e[e.CHANNEL_LEAVE = 10001] = "CHANNEL_LEAVE", e[e.CHANNEL_OPERATOR_UPDATE = 10002] = "CHANNEL_OPERATOR_UPDATE", e[e.CHANNEL_INVITE = 10020] = "CHANNEL_INVITE", e[e.CHANNEL_ACCEPT_INVITE = 10021] = "CHANNEL_ACCEPT_INVITE", e[e.CHANNEL_DECLINE_INVITE = 10022] = "CHANNEL_DECLINE_INVITE", e[e.CHANNEL_PROP_CHANGED = 11e3] = "CHANNEL_PROP_CHANGED", e[e.CHANNEL_DELETED = 12e3] = "CHANNEL_DELETED", e[e.CHANNEL_META_DATA_CHANGED = 11100] = "CHANNEL_META_DATA_CHANGED", e[e.CHANNEL_META_COUNTERS_CHANGED = 11200] = "CHANNEL_META_COUNTERS_CHANGED", e[e.CHANNEL_HIDE = 13e3] = "CHANNEL_HIDE", e[e.CHANNEL_UNHIDE = 13001] = "CHANNEL_UNHIDE", e[e.PINNED_MESSAGE_CHANGED = 11300] = "PINNED_MESSAGE_CHANGED"; -})(ln || (ln = {})); -var IL = function() { - function e(n) { - var t; - this.channelUrl = n.channel_url, this.channelType = n.channel_type, this.category = n.cat, this.data = (t = n.data) !== null && t !== void 0 ? t : {}, this.ts = n.ts; - } - return Object.defineProperty(e.prototype, "isGroupChannelEvent", { get: function() { - return this.channelType === Ft.GROUP; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isOpenChannelEvent", { get: function() { - return this.channelType === Ft.OPEN; - }, enumerable: !1, configurable: !0 }), e; -}(), Fo = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return a.event = new IL(i), a; - } - return O(n, e), n; -}(En), KA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, r, i) || this, o = i.data.operators, s = o === void 0 ? [] : o; - return a.operators = s.map(function(c) { - return new Dt(a._iid, c); - }), a; - } - return O(n, e), n; -}(Fo), WA = function(e) { - function n(t, r) { - var i = e.call(this, t) || this; - return i._logger = r.logger, i._sdkState = r.sdkState, i._sessionManager = r.sessionManager, i._requestQueue = r.requestQueue, i._dispatcher = r.dispatcher, i._cacheContext = r.cacheContext, i._channelType = r.channelType, i; - } - return O(n, e), Object.defineProperty(n.prototype, "_messageBroadcast", { get: function() { - return HA.of(this._iid); - }, enumerable: !1, configurable: !0 }), n.prototype.subscribeMessageEvent = function(t, r) { - this._messageBroadcast.subscribe(t, r); - }, n.prototype.unsubscribeMessageEvent = function(t) { - this._messageBroadcast.unsubscribe(t); - }, n.prototype.getMessageFromCache = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return [2, null]; - }); - }); - }, n.prototype.getExactlyMatchingMessagesForTokenFromCache = function(t, r, i) { - return T(this, void 0, void 0, function() { - return C(this, function(a) { - return [2, []]; - }); - }); - }, n.prototype.getMessagesFromCache = function(t, r, i, a, o, s) { - return T(this, void 0, void 0, function() { - return C(this, function(c) { - return [2, []]; - }); - }); - }, n.prototype.getPollMessagesFromCache = function(t, r, i, a) { - return T(this, void 0, void 0, function() { - return C(this, function(o) { - return [2, []]; - }); - }); - }, n.prototype.getCachedMessageCountBetween = function(t, r, i, a) { - return T(this, void 0, void 0, function() { - return C(this, function(o) { - return [2, 0]; - }); - }); - }, n.prototype.getUnsentMessagesFromCache = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - return [2, []]; - }); - }); - }, n.prototype.removeFailedMessageFromCache = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return [2]; - }); - }); - }, n; -}(br), YA = function(e) { - function n(t, r, i) { - var a, o, s, c, l = this; - (l = e.call(this, t, "ADMM", i) || this).message = new Oc(t, i); - var u = U.of(t).sdkState; - return l.isMentioned = wc(l.message.mentionType, (s = (a = l.message.mentionedUserIds) !== null && a !== void 0 ? a : (o = l.message.mentionedUsers) === null || o === void 0 ? void 0 : o.map(function(d) { - return d.userId; - })) !== null && s !== void 0 ? s : [], u.userId), l.forceUpdateLastMessage = (c = i.force_update_last_message) !== null && c !== void 0 && c, l; - } - return O(n, e), n; -}(En), ZA = function(e) { - function n(t, r, i) { - var a, o, s, c, l, u = this; - (u = e.call(this, t, "AEDI", i) || this).message = new Oc(t, i); - var d = U.of(t).sdkState; - return u.mentionCountChange = _1({ mentionType: (a = i.old_values) === null || a === void 0 ? void 0 : a.mention_type, mentionedUserIds: (s = (o = i.old_values) === null || o === void 0 ? void 0 : o.mentioned_user_ids) !== null && s !== void 0 ? s : [] }, Xe({ mentionType: u.message.mentionType, mentionedUserIds: (c = u.message.mentionedUserIds) !== null && c !== void 0 ? c : (l = u.message.mentionedUsers) === null || l === void 0 ? void 0 : l.map(function(h) { - return h.userId; - }) }), d.userId), u; - } - return O(n, e), n; -}(En), QA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "MRCT", i) || this; - return a.channelUrl = i.channel_url, a.channelType = i.channel_type, a.event = new M1(i), a; - } - return O(n, e), n; -}(En), XA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "MTHD", i) || this; - return a.event = new jA(t, i), a; - } - return O(n, e), n; -}(En), JA = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "MCNT", i) || this; - return a.groupChannelMemberCounts = i.group_channels.map(function(o) { - return { channelUrl: o.channel_url, memberCount: o.member_count, joinedMemberCount: o.joined_member_count, updatedAt: o.ts }; - }), a.openChannelMemberCounts = i.open_channels.map(function(o) { - return { channelUrl: o.channel_url, participantCount: o.participant_count, updatedAt: o.ts }; - }), a; - } - return O(n, e), n; -}(En), $A = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "PEDI", i) || this; - return a.event = new NL(t, i), a.status = Vm(i.poll.status) || i.poll.status, a.channelUrl = i.channel_url, a.channelType = i.channel_type, a; - } - return O(n, e), n; -}(En), Bn; -(function(e) { - e.NONE = "none", e.JOINED = "joined", e.INVITED = "invited", e.LEFT = "left"; -})(Bn || (Bn = {})); -var Wa, ti, ri, ys, ma, hp, wo, Td, Li = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.state = null, i.role = null, i.isMuted = !1, i.isBlockedByMe = !1, i.isBlockingMe = !1, i.state = Mt(Bn, r.state) ? r.state : null, i.role = Mt(ea, r.role) ? r.role : null, typeof r.is_muted == "boolean" && (i.isMuted = r.is_muted), typeof r.is_blocked_by_me == "boolean" && (i.isBlockedByMe = r.is_blocked_by_me), typeof r.is_blocking_me == "boolean" && (i.isBlockingMe = r.is_blocking_me), i; - } - return O(n, e), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { state: t.state, role: t.role, is_muted: t.isMuted, is_blocked_by_me: t.isBlockedByMe, is_blocking_me: t.isBlockingMe }))); - }, n; -}(Ul); -(function(e) { - e.ALL = "all", e.PUBLIC = "public", e.PRIVATE = "private"; -})(Wa || (Wa = {})), function(e) { - e.ALL = "all", e.JOINED = "joined_only", e.INVITED = "invited_only", e.INVITED_BY_FRIEND = "invited_by_friend", e.INVITED_BY_NON_FRIEND = "invited_by_non_friend"; -}(ti || (ti = {})), function(e) { - e.ALL = "all", e.SUPER = "super", e.NON_SUPER = "nonsuper", e.BROADCAST_ONLY = "broadcast_only", e.EXCLUSIVE_ONLY = "exclusive_only"; -}(ri || (ri = {})), function(e) { - e.ALL = "all", e.UNREAD_MESSAGE = "unread_message"; -}(ys || (ys = {})), function(e) { - e.ALL = "all", e.UNHIDDEN = "unhidden_only", e.HIDDEN = "hidden_only", e.HIDDEN_ALLOW_AUTO_UNHIDE = "hidden_allow_auto_unhide", e.HIDDEN_PREVENT_AUTO_UNHIDE = "hidden_prevent_auto_unhide"; -}(ma || (ma = {})), function(e) { - e.ALL = "all", e.OPERATOR = "operator", e.NONOPERATOR = "nonoperator"; -}(hp || (hp = {})), function(e) { - e.AND = "AND", e.OR = "OR"; -}(wo || (wo = {})), function(e) { - e.MEMBER_NICKNAME = "member_nickname", e.CHANNEL_NAME = "channel_name"; -}(Td || (Td = {})); -var sr, eN = function() { - function e(n) { - var t, r, i, a, o, s, c, l, u, d, h, f, p, v; - this._searchFilter = null, this._userIdsFilter = null, this.includeEmpty = (t = n == null ? void 0 : n.includeEmpty) !== null && t !== void 0 && t, this.nicknameContainsFilter = (r = n == null ? void 0 : n.nicknameContainsFilter) !== null && r !== void 0 ? r : null, this.nicknameStartsWithFilter = (i = n == null ? void 0 : n.nicknameStartsWithFilter) !== null && i !== void 0 ? i : null, this.nicknameExactMatchFilter = (a = n == null ? void 0 : n.nicknameExactMatchFilter) !== null && a !== void 0 ? a : null, this.channelNameContainsFilter = (o = n == null ? void 0 : n.channelNameContainsFilter) !== null && o !== void 0 ? o : "", this.myMemberStateFilter = (s = n == null ? void 0 : n.myMemberStateFilter) !== null && s !== void 0 ? s : ti.ALL, this.customTypesFilter = (c = n == null ? void 0 : n.customTypesFilter) !== null && c !== void 0 ? c : null, this.channelUrlsFilter = (l = n == null ? void 0 : n.channelUrlsFilter) !== null && l !== void 0 ? l : null, this.superChannelFilter = (u = n == null ? void 0 : n.superChannelFilter) !== null && u !== void 0 ? u : ri.ALL, this.publicChannelFilter = (d = n == null ? void 0 : n.publicChannelFilter) !== null && d !== void 0 ? d : Wa.ALL, this.customTypeStartsWithFilter = (h = n == null ? void 0 : n.customTypeStartsWithFilter) !== null && h !== void 0 ? h : null, this.unreadChannelFilter = (f = n == null ? void 0 : n.unreadChannelFilter) !== null && f !== void 0 ? f : ys.ALL, this.hiddenChannelFilter = (p = n == null ? void 0 : n.hiddenChannelFilter) !== null && p !== void 0 ? p : ma.UNHIDDEN, this.includeFrozen = (v = n == null ? void 0 : n.includeFrozen) === null || v === void 0 || v, n != null && n.createdAfter && (this.createdAfter = n.createdAfter), n != null && n.createdBefore && (this.createdBefore = n.createdBefore); - } - return e.prototype._isFriend = function(n) { - return !(!n || !n.friendDiscoveryKey && !n.friendName); - }, Object.defineProperty(e.prototype, "searchFilter", { get: function() { - return this._searchFilter; - }, enumerable: !1, configurable: !0 }), e.prototype.setSearchFilter = function(n, t) { - Array.isArray(n) && n.length !== 0 && typeof t == "string" && t && (this._searchFilter = { query: t, fields: n }); - }, Object.defineProperty(e.prototype, "userIdsFilter", { get: function() { - return this._userIdsFilter; - }, enumerable: !1, configurable: !0 }), e.prototype.setUserIdsFilter = function(n, t, r) { - r === void 0 && (r = wo.AND), this._userIdsFilter = { userIds: n, includeMode: t, queryType: r }; - }, e.prototype.clone = function() { - var n, t = new e(); - this.searchFilter && t.setSearchFilter(this.searchFilter.fields, (n = this.searchFilter.query) !== null && n !== void 0 ? n : void 0), this.userIdsFilter && t.setUserIdsFilter(this.userIdsFilter.userIds, this.userIdsFilter.includeMode, this.userIdsFilter.queryType); - var r = JSON.parse(JSON.stringify(this)); - return Object.keys(r).forEach(function(i) { - t[i] = r[i]; - }), t; - }, e.prototype.match = function(n, t) { - if (this._searchFilter) { - var r = this._searchFilter, i = r.query, a = r.fields; - if (i && a && a.length > 0 && !a.some(function(p) { - switch (p) { - case Td.CHANNEL_NAME: - return n.name.toLowerCase().includes(i.toLowerCase()); - case Td.MEMBER_NICKNAME: - return n.members.some(function(v) { - return v.nickname.toLowerCase().includes(i.toLowerCase()); - }); - default: - return !0; - } - })) - return !1; - } - if (this._userIdsFilter) { - var o = this._userIdsFilter, s = o.userIds, c = o.includeMode, l = o.queryType, u = n.members.map(function(p) { - return p.userId; - }); - if (c) { - if (s.length > 0) - switch (l) { - case wo.AND: - if (s.some(function(p) { - return !u.includes(p); - })) - return !1; - break; - case wo.OR: - if (s.every(function(p) { - return !u.includes(p); - })) - return !1; - } - } else if (s.includes(t) || s.push(t), n.members.length > s.length || !s6(s, u)) - return !1; - } - if (!this.includeEmpty && !n.lastMessage || !this.includeFrozen && n.isFrozen || this.customTypesFilter && this.customTypesFilter.length > 0 && !this.customTypesFilter.includes("*") && !this.customTypesFilter.includes(n.customType) || this.customTypeStartsWithFilter && !new RegExp("^".concat(this.customTypeStartsWithFilter)).test(n.customType) || this.channelNameContainsFilter && !n.name.toLowerCase().includes(this.channelNameContainsFilter.toLowerCase())) - return !1; - if (this.nicknameContainsFilter) { - var d = this.nicknameContainsFilter.toLowerCase(); - if (!n.members.some(function(p) { - return p.userId !== t && p.nickname.toLowerCase().includes(d); - })) - return !1; - } - if (this.nicknameStartsWithFilter) { - var h = this.nicknameStartsWithFilter.toLowerCase(); - if (!n.members.some(function(p) { - return p.userId !== t && p.nickname.toLowerCase().startsWith(h); - })) - return !1; - } - if (this.nicknameExactMatchFilter) { - var f = this.nicknameExactMatchFilter.toLowerCase(); - if (!n.members.some(function(p) { - return p.userId !== t && p.nickname.toLowerCase() != f; - })) - return !1; - } - if (this.channelUrlsFilter && this.channelUrlsFilter.length > 0 && !this.channelUrlsFilter.includes(n.url)) - return !1; - if (this.myMemberStateFilter) - switch (this.myMemberStateFilter) { - case ti.ALL: - if (n.myMemberState === "none") - return !1; - break; - case ti.JOINED: - if (n.myMemberState !== "joined") - return !1; - break; - case ti.INVITED: - if (n.myMemberState !== "invited") - return !1; - break; - case ti.INVITED_BY_FRIEND: - if (n.myMemberState !== "invited" || !this._isFriend(n.inviter)) - return !1; - break; - case ti.INVITED_BY_NON_FRIEND: - if (n.myMemberState !== "invited" || this._isFriend(n.inviter)) - return !1; - } - if (this.hiddenChannelFilter) - switch (this.hiddenChannelFilter) { - case ma.UNHIDDEN: - if (n.isHidden || n.hiddenState !== "unhidden") - return !1; - break; - case ma.HIDDEN: - if (!n.isHidden) - return !1; - break; - case ma.HIDDEN_ALLOW_AUTO_UNHIDE: - if (!n.isHidden || n.hiddenState !== "hidden_allow_auto_unhide") - return !1; - break; - case ma.HIDDEN_PREVENT_AUTO_UNHIDE: - if (!n.isHidden || n.hiddenState !== "hidden_prevent_auto_unhide") - return !1; - } - if (this.unreadChannelFilter && this.unreadChannelFilter === ys.UNREAD_MESSAGE && n.unreadMessageCount === 0) - return !1; - if (this.publicChannelFilter) - switch (this.publicChannelFilter) { - case Wa.PUBLIC: - if (!n.isPublic) - return !1; - break; - case Wa.PRIVATE: - if (n.isPublic) - return !1; - } - if (this.superChannelFilter) - switch (this.superChannelFilter) { - case ri.SUPER: - if (!n.isSuper) - return !1; - break; - case ri.NON_SUPER: - if (n.isSuper) - return !1; - } - return !(this.createdAfter && n.createdAt < this.createdAfter) && !(this.createdBefore && n.createdAt > this.createdBefore); - }, e; -}(), ML = function(e) { - function n(t, r) { - var i = r.sdkState, a = r.cacheContext, o = e.call(this, t) || this; - return o._channels = /* @__PURE__ */ new Map(), o._sdkState = i, o._cacheContext = a, o; - } - return O(n, e), Object.defineProperty(n.prototype, "collection", { get: function() { - var t = this._cacheContext.nestdb; - return ve(!!t).throw(H.databaseError), t.collection(PA); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "localCacheEnabled", { get: function() { - return this._cacheContext.localCacheEnabled && !!this.collection; - }, enumerable: !1, configurable: !0 }), n.prototype._serialize = function(t, r) { - return r === void 0 && (r = 0), L(L({}, t.serialize()), { lastMessageUpdatedAt: t.lastMessage ? t.lastMessage.createdAt : 0, syncIndex: r }); - }, n.prototype._deserialize = function(t) { - return cr.of(this._iid).buildGroupChannelFromSerializedData(t); - }, Object.defineProperty(n.prototype, "channels", { get: function() { - return dt([], tt(this._channels.values()), !1); - }, enumerable: !1, configurable: !0 }), n.prototype.isCachedInMemory = function(t) { - return this._channels.has(t); - }, n.prototype.filterOffsetChanged = function(t) { - var r = this; - return t.filter(function(i) { - if (r._channels.has(i.url)) - return r._channels.get(i.url).messageOffsetTimestamp < i.messageOffsetTimestamp; - }); - }, n.prototype.get = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return this._channels.has(t) ? [3, 3] : this.localCacheEnabled ? [4, this.collection.getByKey(t)] : [3, 2]; - case 1: - if (r = a.sent()) - return i = this._deserialize(r), this._channels.set(t, i), [2, i]; - a.label = 2; - case 2: - return [2, void 0]; - case 3: - return [2, this._channels.get(t)]; - } - }); - }); - }, n.prototype.fetch = function(t) { - var r = t.token, i = t.limit, a = i === void 0 ? LA : i, o = t.backward, s = o !== void 0 && o, c = t.filter, l = c === void 0 ? new eN() : c, u = t.order, d = u === void 0 ? Fn.LATEST_LAST_MESSAGE : u, h = t.borderlineChannelUrl; - return T(this, void 0, void 0, function() { - var f, p, v, m, E = this; - return C(this, function(y) { - switch (y.label) { - case 0: - return this.localCacheEnabled ? (f = Mf(d), p = { where: function(_) { - if (r) - switch (d) { - case Fn.CHANNEL_NAME_ALPHABETICAL: - if (!s && _.name.localeCompare(r) < 0 || s && _.name.localeCompare(r) > 0 || h && h === _.url) - return !1; - break; - case Fn.CHRONOLOGICAL: - if (!s && _.createdAt > r || s && _.createdAt < r || h && h === _.url) - return !1; - break; - case Fn.LATEST_LAST_MESSAGE: - if (!s && _.lastMessageUpdatedAt > r || s && _.lastMessageUpdatedAt < r || h && h === _.url) - return !1; - } - return l.match(E._deserialize(_), E._sdkState.userId); - }, index: f, backward: s }, [4, this.collection.query(p)]) : [3, 3]; - case 1: - return [4, y.sent().fetch({ limit: a })]; - case 2: - return v = y.sent(), (m = v.map(function(_) { - return E._deserialize(_); - })).forEach(function(_) { - E._channels.has(_.url) || E._channels.set(_.url, _); - }), [2, m]; - case 3: - return [2, []]; - } - }); - }); - }, n.prototype.upsert = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s = this; - return C(this, function(c) { - switch (c.label) { - case 0: - if (i = [], t.forEach(function(l) { - if (s._channels.has(l.url)) { - var u = s._channels.get(l.url); - u._pinnedMessagesUpdatedAt < l._pinnedMessagesUpdatedAt && (u._pinnedMessagesUpdatedAt = l._pinnedMessagesUpdatedAt), u._messageCollectionLastAccessedAt > l._messageCollectionLastAccessedAt && Object.assign(l, { _messageCollectionLastAccessedAt: void 0 }), l.cachedMetaData && r && (u._updateCachedMetaData(l.cachedMetaData, r), Object.assign(l, { _cachedMetaData: void 0 })), u._update(l), i.push(u); - } else - s._channels.set(l.url, l), i.push(l); - }), !this.localCacheEnabled) - return [3, 2]; - for (o in a = [], i) - a.push(this._serialize(i[o], parseInt(o))); - return [4, this.collection.upsertMany(a)]; - case 1: - c.sent(), c.label = 2; - case 2: - return [2, i]; - } - }); - }); - }, n.prototype.remove = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - l.trys.push([0, 5, 6, 7]), r = Ne(t), i = r.next(), l.label = 1; - case 1: - return i.done ? [3, 4] : (a = i.value, this._channels.delete(a), this.localCacheEnabled ? [4, this.collection.remove(a)] : [3, 3]); - case 2: - l.sent(), l.label = 3; - case 3: - return i = r.next(), [3, 1]; - case 4: - return [3, 7]; - case 5: - return o = l.sent(), s = { error: o }, [3, 7]; - case 6: - try { - i && !i.done && (c = r.return) && c.call(r); - } finally { - if (s) - throw s.error; - } - return [7]; - case 7: - return [2]; - } - }); - }); - }, n.prototype.clear = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return this.clearMemoryCache(), this.localCacheEnabled ? [4, this.collection.clear()] : [3, 2]; - case 1: - t.sent(), t.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.clearMemoryCache = function() { - this._channels.clear(); - }, n.prototype._setBlockStateOfAllChannels = function(t, r, i) { - return T(this, void 0, void 0, function() { - var a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w; - return C(this, function(M) { - switch (M.label) { - case 0: - if (a = [], t === this._sdkState.userId) - try { - for (o = Ne(this._channels.values()), s = o.next(); !s.done; s = o.next()) { - h = s.value; - try { - for (y = void 0, c = Ne(h.members), l = c.next(); !l.done; l = c.next()) - if ((v = l.value).userId === r) { - v.isBlockedByMe = i, a.push(h); - break; - } - } catch (N) { - y = { error: N }; - } finally { - try { - l && !l.done && (_ = c.return) && _.call(c); - } finally { - if (y) - throw y.error; - } - } - } - } catch (N) { - m = { error: N }; - } finally { - try { - s && !s.done && (E = o.return) && E.call(o); - } finally { - if (m) - throw m.error; - } - } - else if (r === this._sdkState.userId) - try { - for (u = Ne(this._channels.values()), d = u.next(); !d.done; d = u.next()) { - h = d.value; - try { - for (A = void 0, f = Ne(h.members), p = f.next(); !p.done; p = f.next()) - if ((v = p.value).userId === t) { - v.isBlockingMe = i, a.push(h); - break; - } - } catch (N) { - A = { error: N }; - } finally { - try { - p && !p.done && (w = f.return) && w.call(f); - } finally { - if (A) - throw A.error; - } - } - } - } catch (N) { - S = { error: N }; - } finally { - try { - d && !d.done && (b = u.return) && b.call(u); - } finally { - if (S) - throw S.error; - } - } - return a.length > 0 ? [4, this.upsert(a)] : [3, 2]; - case 1: - M.sent(), M.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.block = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._setBlockStateOfAllChannels(t, r, !0)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.unblock = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._setBlockStateOfAllChannels(t, r, !1)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.markAsRead = function(t, r) { - return r === void 0 && (r = dt([], tt(this._channels.keys()), !1)), T(this, void 0, void 0, function() { - var i, a, o, s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - i = [], h.label = 1; - case 1: - h.trys.push([1, 6, 7, 8]), a = Ne(r), o = a.next(), h.label = 2; - case 2: - return o.done ? [3, 5] : (s = o.value, [4, this.get(s)]); - case 3: - (c = h.sent()) != null && c._updateUnreadMemberState(this._sdkState.userId, t) && (c._updateUnreadCount(0, 0), i.push(c)), h.label = 4; - case 4: - return o = a.next(), [3, 2]; - case 5: - return [3, 8]; - case 6: - return l = h.sent(), u = { error: l }, [3, 8]; - case 7: - try { - o && !o.done && (d = a.return) && d.call(a); - } finally { - if (u) - throw u.error; - } - return [7]; - case 8: - return i.length > 0 ? [4, this.upsert(i)] : [3, 10]; - case 9: - h.sent(), h.label = 10; - case 10: - return [2]; - } - }); - }); - }, n; -}(br), Of = { invitedUserIds: void 0, channelUrl: void 0, coverUrl: void 0, coverImage: void 0, isDistinct: void 0, isSuper: void 0, isBroadcast: void 0, isExclusive: void 0, isPublic: void 0, isDiscoverable: void 0, isStrict: void 0, isEphemeral: void 0, accessCode: void 0, name: void 0, data: void 0, customType: void 0, operatorUserIds: void 0, messageSurvivalSeconds: void 0 }, $m = function(e) { - return Ot("string", e.invitedUserIds, !0) && k("string", e.channelUrl, !0) && k("string", e.coverUrl, !0) && (fr(e.coverImage) || k("string", e.coverImage, !0)) && k("boolean", e.isDistinct, !0) && k("boolean", e.isSuper, !0) && k("boolean", e.isBroadcast, !0) && k("boolean", e.isExclusive, !0) && k("boolean", e.isPublic, !0) && k("boolean", e.isStrict, !0) && k("boolean", e.isDiscoverable, !0) && k("boolean", e.isEphemeral, !0) && k("string", e.accessCode, !0) && k("string", e.name, !0) && k("string", e.data, !0) && k("string", e.customType, !0) && Ot("string", e.operatorUserIds, !0) && k("number", e.messageSurvivalSeconds, !0); -}, fp = { customTypes: void 0, includeEmpty: !1, includeFrozen: !0, includeChatNotification: !1 }, eg = function(e) { - return Ot("string", e.customTypes, !0) && k("boolean", e.includeEmpty) && k("boolean", e.includeFrozen) && k("boolean", e.includeChatNotification); -}, tN = { myMemberStateFilter: ti.ALL }, nN = function(e) { - return Mt(ti, e.myMemberStateFilter); -}; -(function(e) { - e.GROUP_CHANNEL_UNREAD_MENTION_COUNT = "group_channel_unread_mention_count", e.NONSUPER_UNREAD_MENTION_COUNT = "non_super_group_channel_unread_mention_count", e.SUPER_UNREAD_MENTION_COUNT = "super_group_channel_unread_mention_count", e.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT = "group_channel_unread_message_count", e.NONSUPER_UNREAD_MESSAGE_COUNT = "non_super_group_channel_unread_message_count", e.SUPER_UNREAD_MESSAGE_COUNT = "super_group_channel_unread_message_count", e.GROUP_CHANNEL_INVITATION_COUNT = "group_channel_invitation_count", e.NONSUPER_INVITATION_COUNT = "non_super_group_channel_invitation_count", e.SUPER_INVITATION_COUNT = "super_group_channel_invitation_count"; -})(sr || (sr = {})); -var OL = { keys: [] }, xL = { channelCustomTypesFilter: void 0, superChannelFilter: ri.ALL }, RL = function(e) { - return Ot("string", e.channelCustomTypesFilter, !0) && Mt(ri, e.superChannelFilter); -}, DL = { channelUrl: void 0, scheduledStatus: void 0, messageTypeFilter: Nr.ALL }; -L({}, ne); -var xf = function(e) { - return e.startsWith("EVENT_") || e === ne.SYNC_CHANNEL_CHANGELOGS || e === ne.REFRESH_CHANNEL; -}, Ut = function(e) { - function n(t) { - var r = t.channels, i = t.source, a = t.isWebSocketEventComing, o = a !== void 0 && a, s = t.data, c = s === void 0 ? null : s, l = t.ts, u = e.call(this) || this; - return u.channels = r, u.source = i, u.isWebSocketEventComing = o, u.data = c, u.ts = l, u; - } - return O(n, e), n; -}(bn), uo = function(e) { - function n(t) { - var r = t.channelUrls, i = t.source, a = t.isWebSocketEventComing, o = a !== void 0 && a, s = e.call(this) || this; - return s.channelUrls = r, s.source = i, s.isWebSocketEventComing = o, s; - } - return O(n, e), n; -}(bn), LL = function() { - function e(n) { - var t = n.groupChannelCache, r = n.messageCache, i = n.unsentMessageCache, a = n.dispatcher, o = this; - this._observers = /* @__PURE__ */ new Map(), a.on(function(s) { - return T(o, void 0, void 0, function() { - var c, l, u, d, h, f, p, v, m, E, y, _, S, b, A = this; - return C(this, function(w) { - switch (w.label) { - case 0: - if (!(s instanceof Ut)) - return [3, 10]; - c = s.channels, y = s.source, _ = s.isWebSocketEventComing, l = s.data, u = c.filter(function(M) { - return M instanceof Hi; - }), d = t.filterOffsetChanged(u), w.label = 1; - case 1: - w.trys.push([1, 6, 7, 8]), h = Ne(d), f = h.next(), w.label = 2; - case 2: - return f.done ? [3, 5] : (p = f.value, [4, r.removeUnderOffset(p.url, p.messageOffsetTimestamp)]); - case 3: - w.sent(), w.label = 4; - case 4: - return f = h.next(), [3, 2]; - case 5: - return [3, 8]; - case 6: - return v = w.sent(), S = { error: v }, [3, 8]; - case 7: - try { - f && !f.done && (b = h.return) && b.call(h); - } finally { - if (S) - throw S.error; - } - return [7]; - case 8: - return [4, t.upsert(u, s.ts)]; - case 9: - return m = w.sent(), _ || this._broadcastUpdateEvent(m, y, l), [3, 15]; - case 10: - return s instanceof uo ? (E = s.channelUrls, y = s.source, _ = s.isWebSocketEventComing, [4, t.remove(E)]) : [3, 13]; - case 11: - return w.sent(), [4, Pn(function() { - return T(A, void 0, void 0, function() { - var M, N, x, D, j, P; - return C(this, function(G) { - switch (G.label) { - case 0: - G.trys.push([0, 6, 7, 8]), M = Ne(E), N = M.next(), G.label = 1; - case 1: - return N.done ? [3, 5] : (x = N.value, [4, r.removeMessagesOfChannel(x)]); - case 2: - return G.sent(), [4, i.removeMessagesOfChannel(x)]; - case 3: - G.sent(), G.label = 4; - case 4: - return N = M.next(), [3, 1]; - case 5: - return [3, 8]; - case 6: - return D = G.sent(), j = { error: D }, [3, 8]; - case 7: - try { - N && !N.done && (P = M.return) && P.call(M); - } finally { - if (j) - throw j.error; - } - return [7]; - case 8: - return [2]; - } - }); - }); - })]; - case 12: - return w.sent(), _ || this._broadcastRemoveEvent(E, y), [3, 15]; - case 13: - return s instanceof GA ? [4, t.fetch({ token: Number.MAX_SAFE_INTEGER, limit: Number.MAX_SAFE_INTEGER })] : [3, 15]; - case 14: - w.sent(), w.label = 15; - case 15: - return [2]; - } - }); - }); - }); - } - return e.prototype._broadcastUpdateEvent = function(n, t, r) { - var i, a; - try { - for (var o = Ne(this._observers.values()), s = o.next(); !s.done; s = o.next()) { - var c = s.value; - c.onUpdate && c.onUpdate(n, t, r); - } - } catch (l) { - i = { error: l }; - } finally { - try { - s && !s.done && (a = o.return) && a.call(o); - } finally { - if (i) - throw i.error; - } - } - }, e.prototype._broadcastRemoveEvent = function(n, t) { - var r, i; - try { - for (var a = Ne(this._observers.values()), o = a.next(); !o.done; o = a.next()) { - var s = o.value; - s.onRemove && s.onRemove(n, t); - } - } catch (c) { - r = { error: c }; - } finally { - try { - o && !o.done && (i = a.return) && i.call(a); - } finally { - if (r) - throw r.error; - } - } - }, e.prototype.subscribe = function(n, t) { - this._observers.set(n, t); - }, e.prototype.unsubscribe = function(n) { - this._observers.delete(n); - }, e.prototype.unsubscribeAll = function() { - this._observers.clear(); - }, e; -}(), PL = function(e) { - function n(t) { - var r = t.userId, i = t.ts, a = t.token, o = t.filter, s = t.includeChatNotification, c = s !== void 0 && s, l = e.call(this) || this, u = L(L({}, fp), o), d = u.customTypes, h = u.includeEmpty, f = u.includeFrozen; - return l.method = pe.GET, l.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/my_group_channels/changelogs"), l.params = Be(Xe({ show_delivery_receipt: !0, show_member: !0, show_read_receipt: !0, change_ts: i || null, token: a, custom_types: d, show_empty: h, show_frozen: f, include_chat_notification: c })), l; - } - return O(n, e), n; -}(ge), kL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.updatedChannels = r.updated.map(function(a) { - return new Hi(t, Object.assign(a, { ts: r.ts })); - }), i.deletedChannelUrls = r.deleted, i.hasMore = r.has_more, i.token = r.next, i.ts = r.ts, i; - } - return O(n, e), n; -}(_e), tg = function(e) { - function n(t) { - var r = t.channelUrl, i = t.isInternalCall, a = e.call(this) || this; - return a.method = pe.GET, a.path = "".concat(i ? f6 : xr, "/").concat(encodeURIComponent(r)), a.params = { show_member: !0, show_read_receipt: !0, show_delivery_receipt: !0 }, a; - } - return O(n, e), n; -}(ge), ng = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.channel = new Hi(t, r), i; - } - return O(n, e), n; -}(_e), ql = { includeEmpty: !1, includeFrozen: !0, includeMetaData: !0, includeChatNotification: !1, channelUrlsFilter: void 0, customTypesFilter: void 0, customTypeStartsWithFilter: void 0, nicknameContainsFilter: void 0, nicknameStartsWithFilter: void 0, nicknameExactMatchFilter: void 0, channelNameContainsFilter: void 0, myMemberStateFilter: ti.ALL, unreadChannelFilter: ys.ALL, superChannelFilter: ri.ALL, publicChannelFilter: Wa.ALL, hiddenChannelFilter: ma.ALL, userIdsFilter: { userIds: [], includeMode: !0, queryType: wo.AND }, searchFilter: { query: void 0, fields: [] }, metadataKey: void 0, metadataValues: void 0, metadataOrderKeyFilter: void 0, metadataValueStartsWith: void 0, order: Fn.LATEST_LAST_MESSAGE, createdAfter: void 0, createdBefore: void 0 }, UL = function(e) { - function n(t) { - var r = this, i = t.userId, a = t.token, o = t.limit, s = t.order, c = t.includeEmpty, l = t.myMemberStateFilter, u = t.superChannelFilter, d = t.publicChannelFilter, h = t.unreadChannelFilter, f = t.nicknameContainsFilter, p = t.nicknameStartsWithFilter, v = t.nicknameExactMatchFilter, m = t.channelNameContainsFilter, E = t.channelUrlsFilter, y = t.customTypesFilter, _ = t.customTypeStartsWithFilter, S = t.hiddenChannelFilter, b = t.metadataOrderKeyFilter, A = t.metadataKey, w = t.metadataValues, M = t.metadataValueStartsWith, N = t.includeFrozen, x = t.includeMetaData, D = t.searchFilter, j = t.userIdsFilter, P = t.includeChatNotification, G = P !== void 0 && P, z = t.includeLeftChannel, q = z !== void 0 && z, Y = t.createdAfter, ye = t.createdBefore; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(qt, "/").concat(encodeURIComponent(i), "/my_group_channels"), r.params = Be({ token: a, limit: o, order: s ?? ql.order, show_member: !0, show_read_receipt: !0, show_delivery_receipt: !0, show_empty: c ?? ql.includeEmpty, member_state_filter: l ?? ql.myMemberStateFilter, super_mode: u ?? ql.superChannelFilter, public_mode: d ?? ql.publicChannelFilter, unread_filter: h ?? ql.unreadChannelFilter, members_nickname_contains: f, members_nickname_startswith: p, members_nickname: v, name_contains: m, channel_urls: E, custom_types: y, custom_type_startswith: _, hidden_mode: S, metadata_order_key: b, metadata_key: A, metadata_values: w, metadata_value_startswith: M, show_frozen: N, show_metadata: x, include_chat_notification: G, include_left_channel: q, created_after: Y, created_before: ye }), D && D.query && D.fields && (r.params.search_query = D.query, r.params.search_fields = D.fields), j && j.userIds && j.userIds.length > 0 && (j.includeMode ? (r.params.members_include_in = j.userIds, r.params.query_type = j.queryType.toUpperCase()) : r.params.members_exactly_in = j.userIds), r; - } - return O(n, e), n; -}(ge), FL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - i.channels = []; - var a = r.next, o = r.channels, s = r.ts; - return i.token = a, o && o.length > 0 && (i.channels = o.map(function(c) { - return c.ts = s, new Hi(t, c); - })), i.ts = s ?? 0, i; - } - return O(n, e), n; -}(_e), BL = function(e) { - function n(t) { - var r = t.userId, i = t.filter, a = e.call(this) || this, o = i.myMemberStateFilter; - return a.method = pe.GET, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/group_channel_count"), a.params = { state: o ?? ti.ALL }, a; - } - return O(n, e), n; -}(ge), HL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.groupChannelCount = r.group_channel_count, i; - } - return O(n, e), n; -}(_e), jL = function(e) { - function n(t) { - var r = t.userId, i = t.filter, a = e.call(this) || this, o = i.keys; - return a.method = pe.GET, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/unread_item_count"), a.params = Be({ item_keys: o }), a; - } - return O(n, e), n; -}(ge), VL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return typeof r[sr.GROUP_CHANNEL_UNREAD_MENTION_COUNT] == "number" && (i.groupChannelUnreadMentionCount = r[sr.GROUP_CHANNEL_UNREAD_MENTION_COUNT]), typeof r[sr.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT] == "number" && (i.groupChannelUnreadMessageCount = r[sr.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]), typeof r[sr.GROUP_CHANNEL_INVITATION_COUNT] == "number" && (i.groupChannelInvitationCount = r[sr.GROUP_CHANNEL_INVITATION_COUNT]), typeof r[sr.SUPER_UNREAD_MENTION_COUNT] == "number" && (i.superGroupChannelUnreadMentionCount = r[sr.SUPER_UNREAD_MENTION_COUNT]), typeof r[sr.SUPER_UNREAD_MESSAGE_COUNT] == "number" && (i.superGroupChannelUnreadMessageCount = r[sr.SUPER_UNREAD_MESSAGE_COUNT]), typeof r[sr.SUPER_INVITATION_COUNT] == "number" && (i.superGroupChannelInvitationCount = r[sr.SUPER_INVITATION_COUNT]), typeof r[sr.NONSUPER_UNREAD_MENTION_COUNT] == "number" && (i.nonSuperGroupChannelUnreadMentionCount = r[sr.NONSUPER_UNREAD_MENTION_COUNT]), typeof r[sr.NONSUPER_UNREAD_MESSAGE_COUNT] == "number" && (i.nonSuperGroupChannelUnreadMessageCount = r[sr.NONSUPER_UNREAD_MESSAGE_COUNT]), typeof r[sr.NONSUPER_INVITATION_COUNT] == "number" && (i.nonSuperGroupChannelInvitationCount = r[sr.NONSUPER_INVITATION_COUNT]), i; - } - return O(n, e), n; -}(_e), GL = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.GET, i.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/unread_channel_count"), i; - } - return O(n, e), n; -}(ge), zL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.unreadCount = r.unread_count, i; - } - return O(n, e), n; -}(_e), qL = function(e) { - function n(t) { - var r = t.userId, i = t.filter, a = t.includeFeedChannel, o = a !== void 0 && a, s = e.call(this) || this, c = i.channelCustomTypesFilter, l = i.superChannelFilter; - return s.method = pe.GET, s.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/unread_message_count"), s.params = { super_mode: l ?? ri.ALL, custom_types: c, include_feed_channel: o }, s; - } - return O(n, e), n; -}(ge), KL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.unreadCount = r.unread_count, i.unreadFeedCount = r.unread_feed_count, i; - } - return O(n, e), n; -}(_e), WL = function(e) { - function n(t) { - var r = t.channelUrl, i = t.scheduledStatus, a = t.messageTypeFilter, o = e.call(this) || this; - return o.method = pe.GET, o.path = "".concat(Cw, "/count"), o.params = { channel_url: r, status: ZL(i) }, a && (o.params.message_type = a), o; - } - return O(n, e), n; -}(ge), YL = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.count = r.count, i; - } - return O(n, e), n; -}(_e), ZL = function(e) { - if (!e) - return []; - var n = []; - return e.forEach(function(t) { - switch (t) { - case ls.PENDING: - n.push(Di.PENDING); - break; - case ls.SENT: - n.push(Di.IN_QUEUE), n.push(Di.SENT); - break; - case ls.CANCELED: - n.push(Di.CANCELED); - break; - case ls.FAILED: - n.push(Di.FAILED); - } - }), n; -}, QL = function(e) { - function n(t) { - var r = this, i = t.userId, a = t.channelUrl, o = t.coverUrl, s = t.coverImage, c = t.isDistinct, l = t.isSuper, u = t.isBroadcast, d = t.isPublic, h = t.isExclusive, f = t.isDiscoverable, p = t.isStrict, v = t.isEphemeral, m = t.accessCode, E = t.name, y = t.data, _ = t.customType, S = t.messageSurvivalSeconds, b = t.invitedUserIds, A = t.operatorUserIds; - return (r = e.call(this) || this).method = pe.POST, r.path = xr, r.params = Be({ user_ids: dt([i], tt(b ?? []), !1).filter(function(w, M, N) { - return M === N.indexOf(w); - }), channel_url: a, cover_url: o, cover_file: s, is_distinct: c, is_super: l, is_broadcast: u, is_exclusive: h, is_public: d, is_discoverable: f, strict: p, is_ephemeral: v, access_code: m, name: E, data: y, custom_type: _, operator_ids: A, message_survival_seconds: S }), r; - } - return O(n, e), n; -}(ge), XL = function(e) { - function n(t, r) { - var i, a = this; - return (a = e.call(this, t, r) || this).channel = new Hi(t, r), a.isCreated = (i = r.is_created) === null || i === void 0 || i, a; - } - return O(n, e), n; -}(_e), jb = function(e) { - function n(t) { - var r = t.userId, i = t.channelUrls, a = e.call(this) || this; - return a.method = pe.PUT, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/mark_as_read_all"), a.params = { channel_urls: i }, a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var JL = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.userId, o = t.accessCode; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(xr, "/").concat(encodeURIComponent(i), "/join"), r.params = { user_id: a, access_code: o }, r; - } - return O(n, e), n; -}(ge), $L = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.channel = new Hi(t, r), i; - } - return O(n, e), n; -}(_e), eP = function(e) { - function n(t, r, i) { - var a = e.call(this, t, r, i) || this, o = i.data, s = o.member_count, c = s === void 0 ? 0 : s, l = o.joined_member_count, u = l === void 0 ? 0 : l, d = o.users, h = d === void 0 ? null : d; - return a.memberCount = c, a.joinedMemberCount = u, a.members = Array.isArray(h) ? h.map(function(f) { - return new Li(t, f); - }) : [new Li(t, i.data)], a; - } - return O(n, e), n; -}(Fo), tP = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.userId, o = t.shouldRemoveOperatorStatus; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(xr, "/").concat(encodeURIComponent(i), "/leave"), r.params = { user_id: a, should_remove_operator_status: o }, r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - return e.call(this, t, r) || this; - } - O(n, e); -})(_e); -var nP = function(e) { - function n(t, r, i) { - var a = e.call(this, t, r, i) || this, o = i.data, s = o.member_count, c = s === void 0 ? 0 : s, l = o.joined_member_count, u = l === void 0 ? 0 : l; - return a.memberCount = c, a.joinedMemberCount = u, a.member = new Li(a._iid, i.data), a; - } - return O(n, e), n; -}(Fo), rP = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.userIds; - return (r = e.call(this) || this).method = pe.POST, r.path = "".concat(xr, "/").concat(encodeURIComponent(i), "/invite"), r.params = { user_ids: a }, r; - } - return O(n, e), n; -}(ge), iP = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.channel = new Hi(t, r), i; - } - return O(n, e), n; -}(_e), aP = function(e) { - function n(t, r, i) { - var a = e.call(this, t, r, i) || this; - a.inviter = null; - var o = i.data, s = o.member_count, c = s === void 0 ? 0 : s, l = o.joined_member_count, u = l === void 0 ? 0 : l, d = o.inviter, h = o.invitees, f = h === void 0 ? [] : h; - return a.memberCount = c, a.joinedMemberCount = u, d && Object.keys(d).length > 0 && (a.inviter = new Dt(t, d)), a.invitees = f.map(function(p) { - return new Li(t, p); - }), a; - } - return O(n, e), n; -}(Fo), oP = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.userId; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(xr, "/").concat(encodeURIComponent(i), "/decline"), r.params = { user_id: a }, r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.channel = new Hi(t, r), i.channel.myMemberState = Bn.NONE, i; - } - O(n, e); -})(_e); -var sP = function(e) { - function n(t, r, i) { - var a = e.call(this, t, r, i) || this, o = i.data, s = o.member_count, c = o.joined_member_count, l = o.inviter, u = o.invitee; - return a.memberCount = s ?? 0, a.joinedMemberCount = c ?? 0, a.inviter = new Dt(t, l), a.invitee = new Li(t, u), a; - } - return O(n, e), n; -}(Fo), rg = { hidePreviousMessages: !1, allowAutoUnhide: !0 }, lP = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.userId, o = t.hidePreviousMessages, s = t.allowAutoUnhide; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(xr, "/").concat(encodeURIComponent(i), "/hide"), r.params = { user_id: a, hide_previous_messages: o ?? rg.hidePreviousMessages, allow_auto_unhide: s ?? rg.allowAutoUnhide }, r; - } - return O(n, e), n; -}(ge), cP = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this, a = r.ts_message_offset; - return i.messageOffsetTimestamp = a, i; - } - return O(n, e), n; -}(_e), uP = function(e) { - function n(t, r, i) { - var a, o, s, c = this; - return (c = e.call(this, t, "SYEV", i) || this).allowAutoUnhide = null, c.hidePreviousMessages = null, c.messageOffsetTimestamp = null, i.data && (c.allowAutoUnhide = (a = i.data.allow_auto_unhide) !== null && a !== void 0 ? a : null, c.hidePreviousMessages = (o = i.data.hide_previous_messages) !== null && o !== void 0 ? o : null), c.messageOffsetTimestamp = (s = i.ts_message_offset) !== null && s !== void 0 ? s : null, c; - } - return O(n, e), n; -}(En), dP = function(e) { - function n(t) { - var r = t.channelUrl, i = t.time; - return e.call(this, { code: "TPST", ackRequired: !1, payload: { channel_url: r, time: i } }) || this; - } - return O(n, e), n; -}(Ir), hP = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return a.user = new Dt(t, i.data), a; - } - return O(n, e), n; -}(En), fP = function(e) { - function n(t) { - var r = t.channelUrl, i = t.time; - return e.call(this, { code: "TPEN", ackRequired: !1, payload: { channel_url: r, time: i } }) || this; - } - return O(n, e), n; -}(Ir), pP = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "SYEV", i) || this; - return a.user = new Dt(t, i.data), a; - } - return O(n, e), n; -}(En), vP = function(e) { - function n(t) { - var r = t.channelUrl, i = t.messageId; - return e.call(this, { code: "MACK", ackRequired: !1, payload: { channel_url: r, msg_id: i } }) || this; - } - return O(n, e), n; -}(Ir), rN = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M, N, x, D = this; - return (D = e.call(this, t, r) || this).includeEmpty = !1, D.includeFrozen = !0, D.includeMetaData = !0, D.includeChatNotification = !1, D.channelUrlsFilter = null, D.customTypesFilter = null, D.customTypeStartsWithFilter = null, D.nicknameContainsFilter = null, D.nicknameStartsWithFilter = null, D.nicknameExactMatchFilter = null, D.channelNameContainsFilter = "", D.myMemberStateFilter = ti.ALL, D.unreadChannelFilter = ys.ALL, D.superChannelFilter = ri.ALL, D.publicChannelFilter = Wa.ALL, D.hiddenChannelFilter = ma.UNHIDDEN, D.searchFilter = { fields: [], query: null }, D.userIdsFilter = { userIds: [], includeMode: !0, queryType: wo.AND }, D.metadataKey = null, D.metadataValues = null, D.metadataOrderKeyFilter = null, D.metadataValueStartsWith = null, D.order = Fn.LATEST_LAST_MESSAGE, D.includeEmpty = (i = r.includeEmpty) !== null && i !== void 0 && i, D.includeFrozen = (a = r.includeFrozen) === null || a === void 0 || a, D.includeMetaData = (o = r.includeMetaData) === null || o === void 0 || o, D.includeChatNotification = (s = r.includeChatNotification) !== null && s !== void 0 && s, D.channelUrlsFilter = (c = r.channelUrlsFilter) !== null && c !== void 0 ? c : null, D.customTypesFilter = (l = r.customTypesFilter) !== null && l !== void 0 ? l : null, D.customTypeStartsWithFilter = (u = r.customTypeStartsWithFilter) !== null && u !== void 0 ? u : "", D.nicknameContainsFilter = (d = r.nicknameContainsFilter) !== null && d !== void 0 ? d : null, D.nicknameStartsWithFilter = (h = r.nicknameStartsWithFilter) !== null && h !== void 0 ? h : null, D.nicknameExactMatchFilter = (f = r.nicknameExactMatchFilter) !== null && f !== void 0 ? f : null, D.channelNameContainsFilter = (p = r.channelNameContainsFilter) !== null && p !== void 0 ? p : "", D.myMemberStateFilter = (v = r.myMemberStateFilter) !== null && v !== void 0 ? v : ti.ALL, D.unreadChannelFilter = (m = r.unreadChannelFilter) !== null && m !== void 0 ? m : ys.ALL, D.superChannelFilter = (E = r.superChannelFilter) !== null && E !== void 0 ? E : ri.ALL, D.publicChannelFilter = (y = r.publicChannelFilter) !== null && y !== void 0 ? y : Wa.ALL, D.hiddenChannelFilter = (_ = r.hiddenChannelFilter) !== null && _ !== void 0 ? _ : ma.UNHIDDEN, D.searchFilter = (S = r.searchFilter) !== null && S !== void 0 ? S : { fields: [], query: null }, D.userIdsFilter = (b = r.userIdsFilter) !== null && b !== void 0 ? b : { userIds: [], includeMode: !0, queryType: wo.AND }, D.metadataKey = (A = r.metadataKey) !== null && A !== void 0 ? A : null, D.metadataValues = (w = r.metadataValues) !== null && w !== void 0 ? w : null, D.metadataOrderKeyFilter = (M = r.metadataOrderKeyFilter) !== null && M !== void 0 ? M : null, D.metadataValueStartsWith = (N = r.metadataValueStartsWith) !== null && N !== void 0 ? N : null, D.order = (x = r.order) !== null && x !== void 0 ? x : Fn.LATEST_LAST_MESSAGE, r.createdAfter && (D.createdAfter = r.createdAfter), r.createdBefore && (D.createdBefore = r.createdBefore), D; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && k("boolean", this.includeEmpty) && k("boolean", this.includeFrozen) && k("boolean", this.includeMetaData) && k("string", this.channelNameContainsFilter) && Ot("string", this.channelUrlsFilter, !0) && Ot("string", this.customTypesFilter, !0) && k("string", this.customTypeStartsWithFilter) && k("string", this.nicknameContainsFilter, !0) && k("string", this.nicknameStartsWithFilter, !0) && k("string", this.nicknameExactMatchFilter, !0) && Mt(ti, this.myMemberStateFilter) && Mt(ri, this.superChannelFilter) && Mt(Wa, this.publicChannelFilter) && Mt(ys, this.unreadChannelFilter) && Mt(ma, this.hiddenChannelFilter) && Ot(Td, this.searchFilter.fields) && k("string", this.searchFilter.query, !0) && Ot("string", this.userIdsFilter.userIds) && k("boolean", this.userIdsFilter.includeMode) && Mt(wo, this.userIdsFilter.queryType) && Mt(Fn, this.order) && k("string", this.metadataOrderKeyFilter, !0) && k("string", this.metadataKey, !0) && Ot("string", this.metadataValues, !0) && k("string", this.metadataValueStartsWith, !0) && M_(this.createdAfter, !0) && M_(this.createdBefore, !0); - }, n.prototype.serialize = function() { - return qc(this); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, [4, cr.of(this._iid).getMyGroupChannels(this._token, Xe(L({}, this)), this.limit, ne.REQUEST_CHANNEL, !0)]) : [3, 2] : [3, 5]; - case 1: - return t = a.sent(), r = t.channels, i = t.token, this._token = i, this._hasNext = !!i, this._isLoading = !1, [2, r]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(ko), mP = function(e) { - function n(t, r, i) { - var a, o = this; - return (o = e.call(this, t, "SYEV", i) || this).pinnedMessageIds = [], o.latestPinnedMessage = null, o.ts = 0, i.data && (o.pinnedMessageIds = (a = i.data.pinned_message_ids) !== null && a !== void 0 ? a : [], o.latestPinnedMessage = i.data.latest_pinned_message ? jr(t, L({}, i.data.latest_pinned_message)) : null), o.ts = i.ts, o; - } - return O(n, e), n; -}(En), gP = function(e) { - function n(t) { - var r = t.channelUrl, i = t.userId, a = e.call(this) || this; - return a.method = pe.PUT, a.path = "".concat(xr, "/").concat(encodeURIComponent(r), "/messages/mark_as_delivered"), a.params = Be({ userId: i }), a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var vo, yP = function(e) { - function n(t, r, i) { - var a = e.call(this, t, "DLVR", i) || this; - return a.channelUrl = i.channel_url, a.deliveredStateUpdate = i.updated, a; - } - return O(n, e), n; -}(En), Va = function() { - function e(n) { - var t = n.top, r = t === void 0 ? Number.MAX_SAFE_INTEGER : t, i = n.bottom, a = i === void 0 ? 0 : i; - this.top = r, this.bottom = a; - } - return e.prototype.includes = function() { - for (var n = this, t = [], r = 0; r < arguments.length; r++) - t[r] = arguments[r]; - return t.every(function(i) { - return n.top <= i && i <= n.bottom; - }); - }, e.prototype.overlap = function(n) { - return this.includes(n.top) || this.includes(n.bottom); - }, e.prototype.intersect = function() { - for (var n = this, t = [], r = 0; r < arguments.length; r++) - t[r] = arguments[r]; - return t.some(function(i) { - return n.top <= i && i <= n.bottom; - }); - }, e.prototype.extends = function() { - for (var n = [], t = 0; t < arguments.length; t++) - n[t] = arguments[t]; - this.top = Math.min.apply(Math, dt([this.top], tt(n), !1)), this.bottom = Math.max.apply(Math, dt([this.bottom], tt(n), !1)); - }, e; -}(), Us = {}, cr = function(e) { - function n(t, r) { - var i, a = this; - return (a = e.call(this, t, L(L({}, r), { channelType: Ft.GROUP })) || this)._leftChannels = /* @__PURE__ */ new Map(), a._disableMack = !1, a._markAsReadAllLastSentAt = 0, a._disableMack = (i = r.disableMack) !== null && i !== void 0 && i, a._groupChannelHandlers = /* @__PURE__ */ new Map(), a._groupChannelCache = new ML(a._iid, { sdkState: r.sdkState, cacheContext: r.cacheContext }), a._groupChannelBroadcast = new LL({ dispatcher: r.dispatcher, groupChannelCache: a._groupChannelCache, messageCache: ac.of(a._iid), unsentMessageCache: Il.of(a._iid) }), setInterval(function() { - var o, s, c = function(d) { - d.invalidateTypingStatus() && (a._dispatcher.dispatch(new Ut({ channels: [d], source: ne.EVENT_CHANNEL_TYPING_STATUS_UPDATE })), a._groupChannelHandlers.forEach(function(h) { - h.onTypingStatusUpdated && h.onTypingStatusUpdated(d); - })); - }; - try { - for (var l = Ne(a._groupChannelCache.channels), u = l.next(); !u.done; u = l.next()) - c(u.value); - } catch (d) { - o = { error: d }; - } finally { - try { - u && !u.done && (s = l.return) && s.call(l); - } finally { - if (o) - throw o.error; - } - } - }, 1e3), a._dispatcher.on(function(o) { - o instanceof En ? a._handleEvent(o).catch(function(s) { - if (qr(s) && a._sdkState.appState === "foreground") - throw s; - }) : o instanceof VA ? T(a, void 0, void 0, function() { - var s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return s = o.message, [4, this.getChannel(s.channelUrl, !0)]; - case 1: - return c = l.sent(), s instanceof Ar ? c._autoResendUserMessage(s) : s instanceof qn && c._autoResendFileMessage(s), [2]; - } - }); - }) : o instanceof zA ? a.reduceDBSize() : o instanceof gA && T(a, void 0, void 0, function() { - var s, c, l, u, d, h = this; - return C(this, function(f) { - switch (f.label) { - case 0: - return s = o.channelUrl, c = o.channelType, l = o.parentMessage, u = new jA(this._iid, { channel_type: Ft.GROUP, channel_url: s, parent_message_id: l.messageId, thread_info: ap.payloadify(l.threadInfo) }), c !== Ft.GROUP ? [3, 2] : [4, this.getChannel(s, !0)]; - case 1: - d = f.sent(), Ke(function() { - return T(h, void 0, void 0, function() { - var p, v, m, E, y; - return C(this, function(_) { - try { - for (p = Ne(this._groupChannelHandlers.values()), v = p.next(); !v.done; v = p.next()) - (m = v.value).onThreadInfoUpdated && m.onThreadInfoUpdated(d, u); - } catch (S) { - E = { error: S }; - } finally { - try { - v && !v.done && (y = p.return) && y.call(p); - } finally { - if (E) - throw E.error; - } - } - return [2]; - }); - }); - }), f.label = 2; - case 2: - return [2]; - } - }); - }); - }), Us[t] || (Us[t] = a), a; - } - return O(n, e), Object.defineProperty(n.prototype, "_messageCache", { get: function() { - return ac.of(this._iid); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "_unsentMessageCache", { get: function() { - return Il.of(this._iid); - }, enumerable: !1, configurable: !0 }), n.of = function(t) { - return Us[t] || (Us[t] = new n(t, U.of(t))), Us[t]; - }, n.clear = function(t) { - Us[t] && delete Us[t]; - }, Object.defineProperty(n.prototype, "handlers", { get: function() { - return dt([], tt(this._groupChannelHandlers.values()), !1); - }, enumerable: !1, configurable: !0 }), n.prototype.buildGroupChannelFromSerializedData = function(t) { - var r = ms(t); - return new Hi(this._iid, Hi.payloadify(r)); - }, n.prototype.buildGroupChannelListQueryFromSerializedData = function(t) { - var r = ms(t); - return new rN(this._iid, r); - }, n.prototype.buildMemberFromSerializedData = function(t) { - var r = ms(t); - return new Li(this._iid, Li.payloadify(r)); - }, n.prototype.getChannelFromCache = function(t) { - var r; - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._groupChannelCache.get(t)]; - case 1: - return [2, (r = i.sent()) !== null && r !== void 0 ? r : null]; - } - }); - }); - }, n.prototype.getChannelsFromCache = function(t, r, i, a, o) { - return T(this, void 0, void 0, function() { - return C(this, function(s) { - switch (s.label) { - case 0: - return [4, this._groupChannelCache.fetch({ token: t, filter: r, order: i, limit: a, borderlineChannelUrl: o })]; - case 1: - return [2, s.sent()]; - } - }); - }); - }, n.prototype.upsertChannelsToCache = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._groupChannelCache.upsert(t)]; - case 1: - return [2, r.sent()]; - } - }); - }); - }, n.prototype.removeChannelsFromCache = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._groupChannelCache.remove(t)]; - case 1: - return r.sent(), [2]; - } - }); - }); - }, n.prototype.clearChannelsFromCache = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this._groupChannelCache.clear()]; - case 1: - return t.sent(), [2]; - } - }); - }); - }, n.prototype.reduceDBSize = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l, u, d, h, f, p, v, m; - return C(this, function(E) { - switch (E.label) { - case 0: - return t = ac.of(this._iid), r = U.of(this._iid).cacheContext, i = r.localCacheConfig, a = r.nestdb, r.localCacheEnabled && a && a.state == Ua.OPENED ? (o = 1024 * i.maxSize * 1024, [4, a.estimateUsage()]) : [2]; - case 1: - if ((s = E.sent()) < o) - return [2]; - c = [], l = this._groupChannelCache.channels, u = {}, p = 0, E.label = 2; - case 2: - return p < l.length ? [4, this.getMessagesFromCache(l[p].url, 0, "prev", new bs())] : [3, 5]; - case 3: - d = E.sent(), u[l[p].url] = JSON.stringify(d).length, h = new c6({ channel: l[p], cachedMessageCount: d.length }), c.push(h), E.label = 4; - case 4: - return p++, [3, 2]; - case 5: - f = c.sort(i.clearOrderComparator), p = 0, E.label = 6; - case 6: - return p < f.length ? [4, t.removeMessagesOfChannel(f[p].channel.url)] : [3, 10]; - case 7: - return E.sent(), [4, t._getGroupChannelPreferenceSize(f[p].channel.url)]; - case 8: - if (v = E.sent(), m = u[f[p].channel.url] + v, (s -= m) < o) - return [3, 10]; - E.label = 9; - case 9: - return p++, [3, 6]; - case 10: - return [2]; - } - }); - }); - }, n.prototype._handleEvent = function(t) { - var r, i; - return T(this, void 0, void 0, function() { - var a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M, N, x, D, j, P, G, z, q, Y, ye, $, ae, de, re, K, ee, J, B, se, te, Me, Ie, we, Q, ze, Ce, ke, et, Je, ot, Te, De, Ze, Le, qe, He, Fe, Ct, lt, Pt, Pe, Xt, At, Yt, rn, xt, pt, We, Oe, oe, $e, rt, ct, Bt, Rt, cn, _t, un, vn, Vt, Jt, Ht, kt, Ve, st, Re, vt, Et, F, he, be, je, ft, Se, V, le, Ue, mt, Tt, Wt, jt, wn, Nt, sn, en, Gn, Xn, Ls, so, kv, Na, Sh, Qc, Xc, Jc, Ps, wh, Ah, Nh, Ih, Bo, Mh, i_, a_, o_, Uv, Fv, Bv, Oh, xh, Hv, jv, s_, Vv, l_, Gv, c_, zv, u_, qv, d_, dn = this; - return C(this, function(zt) { - switch (zt.label) { - case 0: - switch (zt.trys.push([0, 80, , 81]), t.code) { - case "MESG": - case "FILE": - case "ADMM": - case "BRDM": - return [3, 1]; - case "MEDI": - case "FEDI": - case "AEDI": - return [3, 4]; - case "DELM": - return [3, 7]; - case "READ": - return [3, 10]; - case "DLVR": - return [3, 13]; - case "MRCT": - return [3, 15]; - case "MTHD": - return [3, 19]; - case "MCNT": - return [3, 23]; - case "PEDI": - return [3, 32]; - case "VOTE": - return [3, 35]; - case "SYEV": - return [3, 38]; - case "USEV": - return [3, 78]; - } - return [3, 79]; - case 1: - return h = null, t.code === "MESG" ? h = t.as(D1) : t.code === "FILE" ? h = t.as(O1) : t.code !== "ADMM" && t.code != "BRDM" || (h = t.as(YA)), h ? (a = h.message, o = h.isMentioned, s = h.forceUpdateLastMessage, a.channelType !== Ft.GROUP ? [3, 3] : (this._disableMack || Pn(function() { - return T(dn, void 0, void 0, function() { - var fe; - return C(this, function(W) { - return fe = new vP(a), this._requestQueue.send(fe), [2]; - }); - }); - }), q = this._groupChannelCache.isCachedInMemory(a.channelUrl), x = a instanceof Vn && a.sender.userId === this._sdkState.userId, [4, this.getChannel(a.channelUrl, !0)])) : [3, 3]; - case 2: - if ((c = zt.sent()).hiddenState === Pr.HIDDEN_ALLOW_AUTO_UNHIDE && (c.hiddenState = Pr.UNHIDDEN), a instanceof Vn) { - l = U.of(this._iid).useMemberInfoInMessage; - try { - for (u = Ne(c.members), d = u.next(); !d.done; d = u.next()) - if ((Se = d.value).userId === a.sender.userId) { - l || (a.sender.nickname = Se.nickname, a.sender.plainProfileUrl = Se.plainProfileUrl, a.sender.metaData = Se.metaData, a.sender.isBlockedByMe = Se.isBlockedByMe); - break; - } - } catch (fe) { - jv = { error: fe }; - } finally { - try { - d && !d.done && (s_ = u.return) && s_.call(u); - } finally { - if (jv) - throw jv.error; - } - } - !l && o && ((r = a.mentionedUsers) === null || r === void 0 || r.forEach(function(fe) { - var W, St; - try { - for (var ut = Ne(c.members), wt = ut.next(); !wt.done; wt = ut.next()) { - var Un = wt.value; - if (fe.userId === Un.userId) { - fe.nickname = Un.nickname, fe.plainProfileUrl = Un.plainProfileUrl, fe.metaData = Un.metaData; - break; - } - } - } catch (pn) { - W = { error: pn }; - } finally { - try { - wt && !wt.done && (St = ut.return) && St.call(ut); - } finally { - if (W) - throw W.error; - } - } - })), x && (y = this._sessionManager.currentUser) && (y.nickname = a.sender.nickname, y.plainProfileUrl = a.sender.plainProfileUrl, y.metaData = a.sender.metaData); - } - a.silent && !x || (c.isEphemeral || q) && (c._updateLastMessage(a), x || c._updateUnreadCount(c.unreadMessageCount + 1, c.unreadMentionCount + (o ? 1 : 0))), s && c._updateLastMessage(a), this._dispatcher.dispatch(new Ut({ channels: [c], source: ne.EVENT_MESSAGE_RECEIVED })), a.silent && !x || Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onChannelChanged && St.onChannelChanged(c); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), this._dispatcher.dispatch(new Sn({ messages: [a], source: ne.EVENT_MESSAGE_RECEIVED })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onMessageReceived && St.onMessageReceived(c, a), o && St.onMentionReceived && St.onMentionReceived(c, a); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), zt.label = 3; - case 3: - return [3, 79]; - case 4: - return h = null, t.code === "MEDI" ? h = t.as(sp) : t.code === "FEDI" ? h = t.as(lp) : t.code === "AEDI" && (h = t.as(ZA)), h ? (f = h.message, p = h.mentionCountChange, f.threadInfo && (f.threadInfo.unreadReplyCount = void 0), f.channelType !== Ft.GROUP ? [3, 6] : (q = this._groupChannelCache.isCachedInMemory(f.channelUrl), [4, this.getChannel(f.channelUrl, !0)])) : [3, 6]; - case 5: - v = zt.sent(), x = f instanceof Vn && f.sender.userId === this._sdkState.userId, m = !1, x ? (E = f.sender, (y = this._sessionManager.currentUser) && (y.nickname = E.nickname, y.plainProfileUrl = E.plainProfileUrl, y.metaData = E.metaData)) : v.isReadMessage(f) || p !== 0 && !f.silent && q && (v._updateUnreadCount(v.unreadMessageCount, v.unreadMentionCount + p), m = !0), v._updateLastMessage(f) ? m = !0 : !((i = v.lastMessage) === null || i === void 0) && i.isIdentical(f) && (q ? v._updateLastMessage(f) && (m = !0) : m = !0), _ = !1, v.lastPinnedMessage && v.lastPinnedMessage.messageId === f.messageId && (v.lastPinnedMessage = f, m = !0, _ = !0), m && (this._dispatcher.dispatch(new Ut({ channels: [v], source: _ ? ne.EVENT_PINNED_MESSAGE_UPDATED : ne.EVENT_MESSAGE_UPDATED })), f.silent && !x || Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onChannelChanged && St.onChannelChanged(v); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), _ && Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onPinnedMessageUpdated && St.onPinnedMessageUpdated(v); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - })), this._dispatcher.dispatch(new Sn({ messages: [f], source: ne.EVENT_MESSAGE_UPDATED })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onMessageUpdated && St.onMessageUpdated(v, f), p > 0 && St.onMentionReceived && St.onMentionReceived(v, f); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), zt.label = 6; - case 6: - return [3, 79]; - case 7: - return S = t.as(RA), Te = S.channelUrl, De = S.channelType, b = S.messageId, A = S.silent, w = S.messageCreatedAt, M = S.senderId, De !== Ft.GROUP ? [3, 9] : [4, this.getChannel(Te, !0)]; - case 8: - N = zt.sent(), x = M === this._sdkState.userId, A || x || w > 0 && N.myLastRead < w && N.unreadMessageCount > 0 && N._updateUnreadCount(N.unreadMessageCount - 1, 0), this._dispatcher.dispatch(new N1({ messageIds: [b], source: ne.EVENT_MESSAGE_DELETED })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onMessageDeleted && St.onMessageDeleted(N, b); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), zt.label = 9; - case 9: - return [3, 79]; - case 10: - return (D = t.as(mA).readStatus).channelType !== Ft.GROUP ? [3, 12] : (q = this._groupChannelCache.isCachedInMemory(D.channelUrl), [4, this.getChannel(D.channelUrl, !0)]); - case 11: - j = zt.sent(), q && j._updateUnreadMemberState(D.reader.userId, D.readAt), D.reader.userId === this._sdkState.userId ? q ? (j.unreadMessageCount > 0 || j.unreadMentionCount > 0) && (j._updateUnreadCount(0, 0), this._dispatcher.dispatch(new Ut({ channels: [j], source: ne.EVENT_CHANNEL_READ })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onChannelChanged && St.onChannelChanged(j); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - })) : j.unreadMessageCount !== 0 && j.unreadMentionCount !== 0 || (this._dispatcher.dispatch(new Ut({ channels: [j], source: ne.EVENT_CHANNEL_READ })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onChannelChanged && St.onChannelChanged(j); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - })) : (this._dispatcher.dispatch(new Ut({ channels: [j], source: ne.EVENT_CHANNEL_READ })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onUnreadMemberStatusUpdated && St.onUnreadMemberStatusUpdated(j); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - })), zt.label = 12; - case 12: - return [3, 79]; - case 13: - return P = t.as(yP), Te = P.channelUrl, G = P.deliveredStateUpdate, z = G === void 0 ? {} : G, q = this._groupChannelCache.isCachedInMemory(Te), [4, this.getChannel(Te, !0)]; - case 14: - if (Y = zt.sent(), q) - for (ye in z) - Y._updateUndeliveredMemberState(ye, z[ye]); - return Object.keys(z).some(function(fe) { - return fe !== dn._sdkState.userId; - }) && (this._dispatcher.dispatch(new Ut({ channels: [Y], source: ne.EVENT_CHANNEL_DELIVERED })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onUndeliveredMemberStatusUpdated && St.onUndeliveredMemberStatusUpdated(Y); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - })), [3, 79]; - case 15: - return $ = t.as(QA), Te = $.channelUrl, De = $.channelType, ae = $.event, De !== Ft.GROUP ? [3, 18] : [4, this.getChannel(Te, !0)]; - case 16: - return de = zt.sent(), [4, this.getMessageFromCache(ae.messageId)]; - case 17: - (ee = zt.sent()) ? ee instanceof kr && (ee.applyReactionEvent(ae), this._dispatcher.dispatch(new Sn({ messages: [ee], source: ne.EVENT_MESSAGE_REACTION_UPDATED }))) : this._dispatcher.dispatch(new tA({ event: ae, source: ne.EVENT_MESSAGE_REACTION_UPDATED })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onReactionUpdated && St.onReactionUpdated(de, ae); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), zt.label = 18; - case 18: - return [3, 79]; - case 19: - return (re = t.as(XA).event).channelType !== Ft.GROUP ? [3, 22] : [4, this.getChannel(re.channelUrl, !0)]; - case 20: - return K = zt.sent(), [4, this.getMessageFromCache(re.targetMessageId)]; - case 21: - (ee = zt.sent()) ? ee instanceof kr && (ee.applyThreadInfoUpdateEvent(re), this._dispatcher.dispatch(new Sn({ messages: [ee], source: ne.EVENT_MESSAGE_THREADINFO_UPDATED }))) : this._dispatcher.dispatch(new nA({ event: re, source: ne.EVENT_MESSAGE_THREADINFO_UPDATED })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onThreadInfoUpdated && St.onThreadInfoUpdated(K, re); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), zt.label = 22; - case 22: - return [3, 79]; - case 23: - J = t.as(JA).groupChannelMemberCounts, B = [], zt.label = 24; - case 24: - zt.trys.push([24, 29, 30, 31]), se = Ne(J), te = se.next(), zt.label = 25; - case 25: - return te.done ? [3, 28] : (Me = te.value, Te = Me.channelUrl, Ht = Me.memberCount, kt = Me.joinedMemberCount, Ie = Me.updatedAt, [4, this.getChannelFromCache(Te)]); - case 26: - (we = zt.sent()) && we._setLatestMemberCount(Ht, kt, Ie) && B.push(we), zt.label = 27; - case 27: - return te = se.next(), [3, 25]; - case 28: - return [3, 31]; - case 29: - return Q = zt.sent(), Vv = { error: Q }, [3, 31]; - case 30: - try { - te && !te.done && (l_ = se.return) && l_.call(se); - } finally { - if (Vv) - throw Vv.error; - } - return [7]; - case 31: - return B.length > 0 && (this._dispatcher.dispatch(new Ut({ channels: B, source: ne.EVENT_CHANNEL_MEMBER_COUNT_UPDATED })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onChannelMemberCountChanged && St.onChannelMemberCountChanged(B); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - })), [3, 79]; - case 32: - return ze = t.as($A), Ce = ze.event, ke = ze.status, Te = ze.channelUrl, De = ze.channelType, Te && De === Ft.GROUP ? [4, this.getChannel(Te, !0)] : [3, 34]; - case 33: - et = zt.sent(), this._dispatcher.dispatch(new I1({ event: Ce, source: ne.EVENT_POLL_UPDATED })), Ke(ke === aA ? function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onPollDeleted && St.onPollDeleted(et, Ce.pollId); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - } : function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onPollUpdated && St.onPollUpdated(et, Ce); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), zt.label = 34; - case 34: - return [3, 79]; - case 35: - return Je = t.as(L1), ot = Je.event, Te = Je.channelUrl, De = Je.channelType, Te && De === Ft.GROUP ? [4, this.getChannel(Te, !0)] : [3, 37]; - case 36: - Ze = zt.sent(), this._dispatcher.dispatch(new Zp({ event: ot, source: ne.EVENT_POLL_VOTED })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onPollVoted && St.onPollVoted(Ze, ot); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), zt.label = 37; - case 37: - return [3, 79]; - case 38: - if (!(Le = t.as(Fo).event).isGroupChannelEvent) - return [3, 77]; - switch (Le.category) { - case ln.CHANNEL_JOIN: - return [3, 39]; - case ln.CHANNEL_LEAVE: - return [3, 41]; - case ln.CHANNEL_OPERATOR_UPDATE: - return [3, 45]; - case ln.CHANNEL_INVITE: - return [3, 47]; - case ln.CHANNEL_DECLINE_INVITE: - return [3, 49]; - case ln.TYPING_START: - case ln.TYPING_END: - return [3, 51]; - case ln.USER_CHANNEL_MUTE: - case ln.USER_CHANNEL_UNMUTE: - return [3, 53]; - case ln.USER_CHANNEL_BAN: - return [3, 55]; - case ln.USER_CHANNEL_UNBAN: - return [3, 59]; - case ln.CHANNEL_FREEZE: - case ln.CHANNEL_UNFREEZE: - return [3, 61]; - case ln.CHANNEL_HIDE: - return [3, 63]; - case ln.CHANNEL_UNHIDE: - return [3, 65]; - case ln.CHANNEL_DELETED: - return [3, 67]; - case ln.CHANNEL_PROP_CHANGED: - return [3, 69]; - case ln.CHANNEL_META_DATA_CHANGED: - return [3, 71]; - case ln.CHANNEL_META_COUNTERS_CHANGED: - return [3, 73]; - case ln.PINNED_MESSAGE_CHANGED: - return [3, 75]; - } - return [3, 77]; - case 39: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 40: - return qe = zt.sent(), He = t.as(eP), Fe = He.memberCount, Ct = He.joinedMemberCount, lt = He.members, Pt = !1, lt.forEach(function(fe) { - qe.isExclusive || qe.isSuper || qe.isBroadcast ? Pt = Pt || qe._setLatestMemberCount(Fe, Ct, Le.ts) : (fe.state = Bn.JOINED, qe.addMember(fe, Le.ts), dn._updateJoinedMemberCount(qe)), fe.userId === dn._sdkState.userId && (qe.myMemberState = Bn.JOINED); - }), this._dispatcher.dispatch(new Ut({ channels: [qe], source: ne.EVENT_CHANNEL_JOINED })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - var St, ut; - try { - for (var wt = Ne(lt), Un = wt.next(); !Un.done; Un = wt.next()) { - var pn = Un.value; - W.onUserJoined && W.onUserJoined(qe, pn); - } - } catch (Yx) { - St = { error: Yx }; - } finally { - try { - Un && !Un.done && (ut = wt.return) && ut.call(wt); - } finally { - if (St) - throw St.error; - } - } - qe.isBroadcast && Pt && W.onChannelMemberCountChanged && W.onChannelMemberCountChanged([qe]); - }), [2]; - }); - }); - }), [3, 77]; - case 41: - return (V = this._leftChannels.get(Le.channelUrl)) ? (Xt = V.channel, [3, 44]) : [3, 42]; - case 42: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 43: - Xt = zt.sent(), zt.label = 44; - case 44: - return Pe = Xt, At = t.as(nP), Ht = At.memberCount, kt = At.joinedMemberCount, Yt = At.member, rn = !1, xt = U.of(this._iid).appInfo, Pe.isExclusive || Pe.isSuper || Pe.isBroadcast ? rn = Pe._setLatestMemberCount(Ht, kt, Le.ts) : (xt != null && xt.enabledChannelMemberShipHistory ? ((pt = Pe.members.find(function(fe) { - return fe.userId === Yt.userId; - })) && (pt.state = Bn.LEFT), Pe.memberCount = Ht) : Pe.removeMember(Yt), this._updateJoinedMemberCount(Pe)), Yt.userId === this._sdkState.userId ? (Pe.myMemberState = Bn.NONE, Pe.invitedAt = 0, Pe.joinedAt = 0, Pe._updateUnreadCount(0, 0), Pe.isPublic ? this._dispatcher.dispatch(new Ut({ channels: [Pe], source: ne.EVENT_CHANNEL_LEFT })) : (this._markAsLeave(Pe), this._dispatcher.dispatch(new uo({ channelUrls: [Pe.url], source: ne.EVENT_CHANNEL_LEFT })))) : this._dispatcher.dispatch(new Ut({ channels: [Pe], source: ne.EVENT_CHANNEL_LEFT })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onUserLeft && W.onUserLeft(Pe, Yt), Pe.isBroadcast && rn && W.onChannelMemberCountChanged && W.onChannelMemberCountChanged([Pe]); - }), [2]; - }); - }); - }), [3, 77]; - case 45: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 46: - We = zt.sent(), Oe = t.as(KA).operators, oe = Oe.map(function(fe) { - return fe.userId; - }); - try { - for ($e = Ne(We.members), rt = $e.next(); !rt.done; rt = $e.next()) - (Se = rt.value).role = oe.includes(Se.userId) ? ea.OPERATOR : ea.NONE; - } catch (fe) { - Gv = { error: fe }; - } finally { - try { - rt && !rt.done && (c_ = $e.return) && c_.call($e); - } finally { - if (Gv) - throw Gv.error; - } - } - return We.myRole = oe.includes(this._sdkState.userId) ? ea.OPERATOR : ea.NONE, this._dispatcher.dispatch(new Ut({ channels: [We], source: ne.EVENT_CHANNEL_OPERATOR_UPDATED })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onOperatorUpdated && W.onOperatorUpdated(We, Oe); - }), [2]; - }); - }); - }), [3, 77]; - case 47: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 48: - ct = zt.sent(), Bt = t.as(aP), Ht = Bt.memberCount, kt = Bt.joinedMemberCount, Rt = Bt.inviter, (cn = Bt.invitees).forEach(function(fe) { - return fe.state = Bn.INVITED; - }); - try { - for (_t = Ne(cn), un = _t.next(); !un.done; un = _t.next()) - vn = un.value, ct.isExclusive || ct.isSuper || ct.isBroadcast ? ct._setLatestMemberCount(Ht, kt, Le.ts) : ct.addMember(vn, Le.ts), this._sdkState.userId === vn.userId && (ct.hiddenState = Pr.UNHIDDEN, ct.myMemberState !== Bn.JOINED && (ct.myMemberState = Bn.INVITED), ct.invitedAt = Le.ts); - } catch (fe) { - zv = { error: fe }; - } finally { - try { - un && !un.done && (u_ = _t.return) && u_.call(_t); - } finally { - if (zv) - throw zv.error; - } - } - return this._dispatcher.dispatch(new Ut({ channels: [ct], source: ne.EVENT_CHANNEL_INVITED })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onUserReceivedInvitation && W.onUserReceivedInvitation(ct, Rt, cn); - }), [2]; - }); - }); - }), [3, 77]; - case 49: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 50: - return Vt = zt.sent(), Jt = t.as(sP), Ht = Jt.memberCount, kt = Jt.joinedMemberCount, Ve = Jt.inviter, st = Jt.invitee, Vt.isExclusive || Vt.isSuper || Vt.isBroadcast ? Vt._setLatestMemberCount(Ht, kt, Le.ts) : Vt.removeMember(st), this._sdkState.userId === st.userId ? (Vt.invitedAt = 0, Vt.myMemberState = Bn.NONE, Vt.isPublic ? this._dispatcher.dispatch(new Ut({ channels: [Vt], source: ne.EVENT_CHANNEL_DECLINED_INVITE })) : this._dispatcher.dispatch(new uo({ channelUrls: [Vt.url], source: ne.EVENT_CHANNEL_DECLINED_INVITE }))) : this._dispatcher.dispatch(new Ut({ channels: [Vt], source: ne.EVENT_CHANNEL_DECLINED_INVITE })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onUserDeclinedInvitation && W.onUserDeclinedInvitation(Vt, Ve, st); - }), [2]; - }); - }); - }), [3, 77]; - case 51: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 52: - return Re = zt.sent(), vt = Le.category === ln.TYPING_START, Et = t.as(vt ? hP : pP).user, Re._updateTypingStatus(Et, vt ? Le.ts : 0), this._dispatcher.dispatch(new Ut({ channels: [Re], source: ne.EVENT_CHANNEL_TYPING_STATUS_UPDATE })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onTypingStatusUpdated && W.onTypingStatusUpdated(Re); - }), [2]; - }); - }); - }), [3, 77]; - case 53: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 54: - F = zt.sent(), he = Le.category === ln.USER_CHANNEL_MUTE, (be = t.as(he ? NA : IA).user).userId === this._sdkState.userId && (F.myMutedState = he ? Ba.MUTED : Ba.UNMUTED, F._myMutedRemainingTime = be.restrictionInfo.remainingDuration); - try { - for (je = Ne(F.members), ft = je.next(); !ft.done; ft = je.next()) - if ((Se = ft.value).userId === be.userId) { - Se.isMuted = he; - break; - } - } catch (fe) { - qv = { error: fe }; - } finally { - try { - ft && !ft.done && (d_ = je.return) && d_.call(je); - } finally { - if (qv) - throw qv.error; - } - } - return this._dispatcher.dispatch(new Ut({ channels: [F], source: he ? ne.EVENT_CHANNEL_MUTED : ne.EVENT_CHANNEL_UNMUTED, data: be.userId })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - he ? W.onUserMuted && W.onUserMuted(F, be) : W.onUserUnmuted && W.onUserUnmuted(F, be); - }), [2]; - }); - }); - }), [3, 77]; - case 55: - return (V = this._leftChannels.get(Le.channelUrl)) ? (Ue = V.channel, [3, 58]) : [3, 56]; - case 56: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 57: - Ue = zt.sent(), zt.label = 58; - case 58: - return le = Ue, this._markAsLeave(le), mt = t.as(MA).user, mt.userId === this._sdkState.userId && this._dispatcher.dispatch(new uo({ channelUrls: [le.url], source: ne.EVENT_CHANNEL_BANNED })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onUserBanned && W.onUserBanned(le, mt); - }), [2]; - }); - }); - }), [3, 77]; - case 59: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 60: - return Tt = zt.sent(), Wt = t.as(OA).user, Wt.userId === this._sdkState.userId && this._dispatcher.dispatch(new uo({ channelUrls: [Tt.url], source: ne.EVENT_CHANNEL_UNBANNED })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onUserUnbanned && W.onUserUnbanned(Tt, Wt); - }), [2]; - }); - }); - }), [3, 77]; - case 61: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 62: - return jt = zt.sent(), wn = t.as(xA).freeze, jt.isFrozen = wn, this._dispatcher.dispatch(new Ut({ channels: [jt], source: wn ? ne.EVENT_CHANNEL_FROZEN : ne.EVENT_CHANNEL_UNFROZEN })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - wn ? W.onChannelFrozen && W.onChannelFrozen(jt) : W.onChannelUnfrozen && W.onChannelUnfrozen(jt); - }), [2]; - }); - }); - }), [3, 77]; - case 63: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 64: - return Nt = zt.sent(), sn = t.as(uP), en = sn.allowAutoUnhide, Gn = sn.hidePreviousMessages, Xn = sn.messageOffsetTimestamp, en !== null && (Nt.hiddenState = en ? Pr.HIDDEN_ALLOW_AUTO_UNHIDE : Pr.HIDDEN_PREVENT_AUTO_UNHIDE), Gn !== null && Gn && Nt._updateUnreadCount(0, 0), Xn !== null && (Nt.messageOffsetTimestamp = Xn), this._dispatcher.dispatch(new Ut({ channels: [Nt], source: ne.EVENT_CHANNEL_HIDDEN })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onChannelHidden && W.onChannelHidden(Nt); - }), [2]; - }); - }); - }), [3, 77]; - case 65: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 66: - return (Ls = zt.sent()).hiddenState = Pr.UNHIDDEN, this._dispatcher.dispatch(new Ut({ channels: [Ls], source: ne.EVENT_CHANNEL_UNHIDDEN })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onChannelChanged && W.onChannelChanged(Ls); - }), [2]; - }); - }); - }), [3, 77]; - case 67: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 68: - return so = zt.sent(), this._dispatcher.dispatch(new uo({ channelUrls: [Le.channelUrl], source: ne.EVENT_CHANNEL_DELETED })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onChannelDeleted && W.onChannelDeleted(so.url, so.channelType); - }), [2]; - }); - }); - }), [3, 77]; - case 69: - return [4, this.getChannelWithoutCache(Le.channelUrl, !0)]; - case 70: - return kv = zt.sent(), this._dispatcher.dispatch(new Ut({ channels: [kv], source: ne.EVENT_CHANNEL_UPDATED })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onChannelChanged && W.onChannelChanged(kv); - }), [2]; - }); - }); - }), [3, 77]; - case 71: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 72: - return Na = zt.sent(), Sh = t.as(wA), Qc = Sh.created, Xc = Sh.updated, Jc = Sh.deleted, Qc && (Na._upsertCachedMetaData(Qc, Le.ts), this._dispatcher.dispatch(new Ut({ channels: [Na], source: ne.EVENT_CHANNEL_METADATA_CREATED }))), Xc && (Na._upsertCachedMetaData(Xc, Le.ts), this._dispatcher.dispatch(new Ut({ channels: [Na], source: ne.EVENT_CHANNEL_METADATA_UPDATED }))), Jc && (Na._removeFromCachedMetaData(Jc, Le.ts), this._dispatcher.dispatch(new Ut({ channels: [Na], source: ne.EVENT_CHANNEL_METADATA_DELETED }))), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - Qc && W.onMetaDataCreated && W.onMetaDataCreated(Na, Qc), Xc && W.onMetaDataUpdated && W.onMetaDataUpdated(Na, Xc), Jc && W.onMetaDataDeleted && W.onMetaDataDeleted(Na, Jc); - }), [2]; - }); - }); - }), [3, 77]; - case 73: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 74: - return Ps = zt.sent(), wh = t.as(AA), Ah = wh.created, Nh = wh.updated, Ih = wh.deleted, Ah && this._dispatcher.dispatch(new Ut({ channels: [Ps], source: ne.EVENT_CHANNEL_METACOUNTER_CREATED })), Nh && this._dispatcher.dispatch(new Ut({ channels: [Ps], source: ne.EVENT_CHANNEL_METACOUNTER_UPDATED })), Ih && this._dispatcher.dispatch(new Ut({ channels: [Ps], source: ne.EVENT_CHANNEL_METACOUNTER_DELETED })), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - Ah && W.onMetaCounterCreated && W.onMetaCounterCreated(Ps, Ah), Nh && W.onMetaCounterUpdated && W.onMetaCounterUpdated(Ps, Nh), Ih && W.onMetaCounterDeleted && W.onMetaCounterDeleted(Ps, Ih); - }), [2]; - }); - }); - }), [3, 77]; - case 75: - return [4, this.getChannel(Le.channelUrl, !0)]; - case 76: - return Bo = zt.sent(), Mh = t.as(mP), i_ = Mh.pinnedMessageIds, a_ = Mh.latestPinnedMessage, (o_ = Mh.ts) > Bo._pinnedMessagesUpdatedAt && (Bo.pinnedMessageIds = i_, Bo.lastPinnedMessage = a_, Bo._pinnedMessagesUpdatedAt = o_, this._dispatcher.dispatch(new Ut({ channels: [Bo], source: ne.EVENT_PINNED_MESSAGE_UPDATED })), Ke(function() { - return T(dn, void 0, void 0, function() { - var fe, W, St, ut, wt; - return C(this, function(Un) { - try { - for (fe = Ne(this._groupChannelHandlers.values()), W = fe.next(); !W.done; W = fe.next()) - (St = W.value).onChannelChanged && St.onChannelChanged(Bo); - } catch (pn) { - ut = { error: pn }; - } finally { - try { - W && !W.done && (wt = fe.return) && wt.call(fe); - } finally { - if (ut) - throw ut.error; - } - } - return [2]; - }); - }); - }), Ke(function() { - return T(dn, void 0, void 0, function() { - return C(this, function(fe) { - return this._groupChannelHandlers.forEach(function(W) { - W.onPinnedMessageUpdated && W.onPinnedMessageUpdated(Bo); - }), [2]; - }); - }); - })), [3, 77]; - case 77: - return [3, 79]; - case 78: - switch ((Uv = t.as(qA).event).category) { - case Cd.USER_BLOCK: - Fv = dp.getDataAsUserBlockEvent(this._iid, Uv), Oh = Fv.blocker, xh = Fv.blockee, this._groupChannelCache.block(Oh.userId, xh.userId); - break; - case Cd.USER_UNBLOCK: - Bv = dp.getDataAsUserBlockEvent(this._iid, Uv), Oh = Bv.blocker, xh = Bv.blockee, this._groupChannelCache.unblock(Oh.userId, xh.userId); - } - return [3, 79]; - case 79: - return [3, 81]; - case 80: - if (Hv = zt.sent(), qr(Hv)) - throw Hv; - return [3, 81]; - case 81: - return [2]; - } - }); - }); - }, n.prototype._markAsLeave = function(t) { - var r, i = this, a = (r = this._leftChannels.get(t.url)) !== null && r !== void 0 ? r : { channel: t, ref: 0 }; - a.ref++, this._leftChannels.set(t.url, a), setTimeout(function() { - a.ref--, a.ref === 0 && i._leftChannels.delete(t.url); - }, 1e4); - }, n.prototype.addHandler = function(t, r) { - this._groupChannelHandlers.set(t, r); - }, n.prototype.removeHandler = function(t) { - this._groupChannelHandlers.delete(t); - }, n.prototype.clearHandler = function() { - this._groupChannelHandlers.clear(); - }, n.prototype.subscribeChannelEvent = function(t, r) { - this._groupChannelBroadcast.subscribe(t, r); - }, n.prototype.unsubscribeChannelEvent = function(t) { - this._groupChannelBroadcast.unsubscribe(t); - }, n.prototype._updateJoinedMemberCount = function(t) { - t.joinedMemberCount = t.members.filter(function(r) { - return r.state === Bn.JOINED; - }).length; - }, n.prototype.getChannel = function(t, r) { - return r === void 0 && (r = !1), T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - ve(k("string", t)).throw(H.invalidParameters), a.label = 1; - case 1: - return a.trys.push([1, 3, , 4]), [4, this.getChannelFromCache(t)]; - case 2: - return (i = a.sent()) ? [2, i] : [3, 4]; - case 3: - return a.sent(), [3, 4]; - case 4: - return [4, this.getChannelWithoutCache(t, r)]; - case 5: - return [2, a.sent()]; - } - }); - }); - }, n.prototype.getChannelWithoutCache = function(t, r) { - return r === void 0 && (r = !1), T(this, void 0, void 0, function() { - var i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return ve(k("string", t)).throw(H.invalidParameters), i = new tg({ channelUrl: t, isInternalCall: r }), [4, this._requestQueue.send(i)]; - case 1: - switch (a = l.sent(), o = a.as(ng).channel, s = o.unreadMessageCount, c = o.unreadMentionCount, o.myCountPreference) { - case Oi.UNREAD_MESSAGE_COUNT_ONLY: - c = 0; - break; - case Oi.UNREAD_MENTION_COUNT_ONLY: - s = 0; - break; - case Oi.OFF: - s = 0, c = 0; - } - return o._updateUnreadCount(s, c), [4, this.upsertChannelsToCache([o])]; - case 2: - return [2, l.sent()[0]]; - } - }); - }); - }, n.prototype.refreshChannel = function(t, r, i) { - return r === void 0 && (r = !0), i === void 0 && (i = ne.REFRESH_CHANNEL), T(this, void 0, void 0, function() { - var a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return u.trys.push([0, 5, , 6]), a = new tg({ channelUrl: t, isInternalCall: r }), [4, this._requestQueue.send(a)]; - case 1: - return o = u.sent(), (s = o.as(ng).channel).myMemberState !== Bn.NONE ? [3, 2] : (this._dispatcher.dispatch(new uo({ channelUrls: [s.url], source: i })), [3, 4]); - case 2: - return [4, this.upsertChannelsToCache([s])]; - case 3: - c = u.sent(), this._dispatcher.dispatch(new Ut({ channels: c, source: i })), u.label = 4; - case 4: - return [3, 6]; - case 5: - return (l = u.sent()).code !== nt.NON_AUTHORIZED && l.code !== nt.NOT_FOUND_IN_DATABASE || this._dispatcher.dispatch(new uo({ channelUrls: [t], source: i })), [3, 6]; - case 6: - return [2]; - } - }); - }); - }, n.prototype.getMyGroupChannels = function(t, r, i, a, o) { - return a === void 0 && (a = ne.REQUEST_CHANNEL), o === void 0 && (o = !1), T(this, void 0, void 0, function() { - var s, c, l, u, d, h, f, p, v; - return C(this, function(m) { - switch (m.label) { - case 0: - return r.createdAfter && (r.createdAfter = Math.floor(r.createdAfter / 1e3)), r.createdBefore && (r.createdBefore = Math.floor(r.createdBefore / 1e3)), s = !1, o && (c = U.of(this._iid), l = c.appInfo, (u = c.cacheContext) && !u.localCacheEnabled && (l != null && l.enabledChannelMemberShipHistory) && (l != null && l.applicationAttributes.includes("left_user_view_support")) && (s = !0)), d = new UL(L(L({}, r), { userId: this._sdkState.userId, token: t, limit: i, includeLeftChannel: o && s })), [4, this._requestQueue.send(d)]; - case 1: - return h = m.sent(), f = h.as(FL), p = f.channels, v = f.token, this._dispatcher.dispatch(new Ut({ channels: p, source: a })), [2, { channels: p, token: v }]; - } - }); - }); - }, n.prototype.getMyGroupChannelChangeLogs = function(t, r, i) { - return i === void 0 && (i = ne.REQUEST_CHANNEL_CHANGELOGS), T(this, void 0, void 0, function() { - var a, o, s, c, l, u, d, h; - return C(this, function(f) { - switch (f.label) { - case 0: - return a = L(L({}, fp), r), ve((k("string", t) || k("number", t)) && eg(a)).throw(H.invalidParameters), o = new PL(Xe({ userId: this._sdkState.userId, ts: typeof t == "number" ? t : null, token: typeof t == "string" ? t : null, filter: a })), [4, this._requestQueue.send(o)]; - case 1: - return s = f.sent(), c = s.as(kL), l = c.updatedChannels, u = c.deletedChannelUrls, d = c.hasMore, h = c.ts, l.length > 0 && this._dispatcher.dispatch(new Ut({ channels: l, source: i, ts: h })), u.length > 0 && this._dispatcher.dispatch(new uo({ channelUrls: u, source: i })), [2, { updatedChannels: l, deletedChannelUrls: u, hasMore: d, token: c.token }]; - } - }); - }); - }, n.prototype.getGroupChannelCount = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return r = L(L({}, tN), t), ve(nN(r)).throw(H.invalidParameters), i = new BL({ userId: this._sdkState.userId, filter: r }), [4, this._requestQueue.send(i)]; - case 1: - return a = o.sent(), [2, a.as(HL).groupChannelCount]; - } - }); - }); - }, n.prototype.getUnreadItemCount = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u, d, h, f, p, v, m, E, y; - return C(this, function(_) { - switch (_.label) { - case 0: - return r = L(L({}, OL), t), ve(function(S) { - return Ot(sr, S.keys); - }(r)).throw(H.invalidParameters), i = U.of(this._iid), a = i.sdkState, o = i.requestQueue, s = new jL({ userId: a.userId, filter: r }), [4, o.send(s)]; - case 1: - return c = _.sent(), l = c.as(VL), u = l.groupChannelUnreadMentionCount, d = l.groupChannelUnreadMessageCount, h = l.groupChannelInvitationCount, f = l.superGroupChannelUnreadMentionCount, p = l.superGroupChannelUnreadMessageCount, v = l.superGroupChannelInvitationCount, m = l.nonSuperGroupChannelUnreadMentionCount, E = l.nonSuperGroupChannelUnreadMessageCount, y = l.nonSuperGroupChannelInvitationCount, [2, Be({ groupChannelUnreadMentionCount: u, groupChannelUnreadMessageCount: d, groupChannelInvitationCount: h, superGroupChannelUnreadMentionCount: f, superGroupChannelUnreadMessageCount: p, superGroupChannelInvitationCount: v, nonSuperGroupChannelUnreadMentionCount: m, nonSuperGroupChannelUnreadMessageCount: E, nonSuperGroupChannelInvitationCount: y })]; - } - }); - }); - }, n.prototype.getTotalUnreadChannelCount = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new GL({ userId: r.userId }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(zL).unreadCount]; - } - }); - }); - }, n.prototype.getTotalUnreadMessageCount = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return r = L(L({}, xL), t), ve(RL(r)).throw(H.invalidParameters), i = U.of(this._iid), a = i.sdkState, o = i.requestQueue, s = new qL({ userId: a.userId, filter: r }), [4, o.send(s)]; - case 1: - return c = l.sent(), [2, c.as(KL).unreadCount]; - } - }); - }); - }, n.prototype.getTotalScheduledMessageCount = function(t) { - return t === void 0 && (t = {}), T(this, void 0, void 0, function() { - var r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return r = L(L({}, DL), t), ve(function(c) { - return k("string", c.channelUrl, !0) && Ot(ls, c.scheduledStatus, !0) && Mt(Nr, c.messageTypeFilter); - }(r)).throw(H.invalidParameters), i = U.of(this._iid).requestQueue, a = new WL(r), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(YL).count]; - } - }); - }); - }, n.prototype.getSubscribedTotalUnreadMessageCount = function() { - var t = U.of(this._iid).subscribedUnreadMessageCount; - return t.all >= 0 ? t.all : 0; - }, n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount = function() { - var t = 0, r = U.of(this._iid).subscribedUnreadMessageCount; - for (var i in r.customTypes) - t += r.customTypes[i]; - return t; - }, n.prototype.getSubscribedCustomTypeUnreadMessageCount = function(t) { - var r; - return (r = U.of(this._iid).subscribedUnreadMessageCount.customTypes[t]) !== null && r !== void 0 ? r : 0; - }, n.prototype.createChannel = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return r = L(L({}, Of), t), ve($m(r)).throw(H.invalidParameters), r.isPublic || (r.accessCode = void 0), i = new QL(L({ userId: this._sdkState.userId }, r)), [4, this._requestQueue.send(i)]; - case 1: - return a = s.sent(), o = a.as(XL).channel, [4, this.upsertChannelsToCache([o])]; - case 2: - return s.sent(), [2, o]; - } - }); - }); - }, n.prototype.markAsReadAll = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return t = Date.now(), ve(t - this._markAsReadAllLastSentAt >= 1e3).throw(H.markAsReadAllRateLimitExceeded), this._markAsReadAllLastSentAt = t, r = new jb({ userId: this._sdkState.userId }), [4, this._requestQueue.send(r)]; - case 1: - u.sent(), i = this._groupChannelCache.channels; - try { - for (a = Ne(i), o = a.next(); !o.done; o = a.next()) - (s = o.value)._updateUnreadMemberState(this._sdkState.userId, t), s._updateUnreadCount(0, 0); - } catch (d) { - c = { error: d }; - } finally { - try { - o && !o.done && (l = a.return) && l.call(a); - } finally { - if (c) - throw c.error; - } - } - return i.length > 0 ? [4, this.upsertChannelsToCache(i)] : [3, 3]; - case 2: - u.sent(), u.label = 3; - case 3: - return [2]; - } - }); - }); - }, n.prototype.markAsReadWithChannelUrls = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - return r = Date.now(), ve(Ot("string", t) && r - this._markAsReadAllLastSentAt >= 1e3).throw(H.markAsReadAllRateLimitExceeded), this._markAsReadAllLastSentAt = r, i = new jb({ userId: this._sdkState.userId, channelUrls: t }), [4, this._requestQueue.send(i)]; - case 1: - h.sent(), a = this._groupChannelCache.channels, o = []; - try { - for (s = Ne(a), c = s.next(); !c.done; c = s.next()) - l = c.value, t.includes(l.url) && (l._updateUnreadMemberState(this._sdkState.userId, r), l._updateUnreadCount(0, 0), o.push(l)); - } catch (f) { - u = { error: f }; - } finally { - try { - c && !c.done && (d = s.return) && d.call(s); - } finally { - if (u) - throw u.error; - } - } - return o.length > 0 ? [4, this.upsertChannelsToCache(o)] : [3, 3]; - case 2: - h.sent(), h.label = 3; - case 3: - return [2]; - } - }); - }); - }, n.prototype.markAsDelivered = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this.getChannel(t)]; - case 1: - return [4, r.sent().markAsDelivered()]; - case 2: - return r.sent(), [2]; - } - }); - }); - }, n.prototype.getMessageFromCache = function(t) { - var r; - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._messageCache.get(t)]; - case 1: - return [2, (r = i.sent()) !== null && r !== void 0 ? r : null]; - } - }); - }); - }, n.prototype.getExactlyMatchingMessagesForTokenFromCache = function(t, r, i) { - return T(this, void 0, void 0, function() { - return C(this, function(a) { - switch (a.label) { - case 0: - return [4, this._messageCache.fetch({ channelUrl: t, token: r, filter: i, exactMatch: !0 })]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n.prototype.getMessagesFromCache = function(t, r, i, a, o, s) { - return o === void 0 && (o = kA), s === void 0 && (s = !0), T(this, void 0, void 0, function() { - return C(this, function(c) { - switch (c.label) { - case 0: - return [4, this._messageCache.fetch({ channelUrl: t, token: r, limit: o, filter: a, backward: i === "next", inclusive: s })]; - case 1: - return [2, c.sent()]; - } - }); - }); - }, n.prototype.getPollMessagesFromCache = function(t, r, i, a) { - return T(this, void 0, void 0, function() { - return C(this, function(o) { - switch (o.label) { - case 0: - return [4, this._messageCache.fetch({ channelUrl: t, token: r, limit: a, filter: i, backward: !1, isPollOnly: !0 })]; - case 1: - return [2, o.sent()]; - } - }); - }); - }, n.prototype.getCachedMessageCountBetween = function(t, r, i, a) { - return T(this, void 0, void 0, function() { - return C(this, function(o) { - switch (o.label) { - case 0: - return [4, this._messageCache.countBetween(t, r, new Va({ top: i, bottom: a }))]; - case 1: - return [2, o.sent()]; - } - }); - }); - }, n.prototype.getUnsentMessagesFromCache = function(t, r) { - return T(this, void 0, void 0, function() { - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, this._unsentMessageCache.fetch({ channelUrl: t, filter: r })]; - case 1: - return [2, i.sent()]; - } - }); - }); - }, n.prototype.removeFailedMessageFromCache = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._unsentMessageCache.remove([t])]; - case 1: - return r.sent(), [2]; - } - }); - }); - }, n; -}(WA), Si = function(e, n) { - return n instanceof Vn ? e.findIndex(function(t) { - return t instanceof Vn && n.isIdentical(t); - }) : e.findIndex(function(t) { - return t.isIdentical(n); - }); -}, iu = function(e, n) { - return e.findIndex(function(t) { - return t instanceof kr ? t.messageId === n : t instanceof Al ? t.notificationId === n : void 0; - }); -}, _0 = function(e, n) { - if (e.length > 0) { - for (var t = 0, r = e.length - 1, i = Math.floor((t + r) / 2); t < r; ) { - var a = e[i].createdAt - n.createdAt; - if (a > 0) - r = i, i = Math.floor((t + r) / 2); - else { - if (!(a < 0)) - return i; - t = i + 1, i = Math.floor((t + r) / 2); - } - } - return e[i].createdAt > n.createdAt ? i : i + 1; - } - return e.length; -}; -(function(e) { - e[e.IDLE = 0] = "IDLE", e[e.RUNNING = 1] = "RUNNING", e[e.END = 2] = "END"; -})(vo || (vo = {})); -var ig, Cs = function(e) { - function n(t, r, i, a) { - var o = e.call(this) || this; - return o._state = vo.IDLE, o._retryCount = 0, o._retryLimit = 3, o.priority = 0, o._worker = r, o; - } - return O(n, e), Object.defineProperty(n.prototype, "isIdle", { get: function() { - return this._state === vo.IDLE; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isRunning", { get: function() { - return this._state === vo.RUNNING; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isDone", { get: function() { - return this._state === vo.END; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "retryCount", { get: function() { - return this._retryCount; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "retryLimit", { get: function() { - return this._retryLimit; - }, enumerable: !1, configurable: !0 }), n.prototype._run = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - if (!this.isRunning) - return [3, 4]; - a.label = 1; - case 1: - return a.trys.push([1, 3, , 4]), [4, this._worker(t)]; - case 2: - return r = a.sent(), this._retryCount = 0, this.dispatch("progress", r), r.hasNext ? this._run(r.nextToken) : this.end(), [3, 4]; - case 3: - return i = a.sent(), this.dispatch("error", i), this._retryCount < this._retryLimit ? (this._retryCount++, this._run(t)) : this.stop(), [3, 4]; - case 4: - return [2]; - } - }); - }); - }, n.prototype.start = function(t) { - this.isIdle && (this._state = vo.RUNNING, this._run(t)); - }, n.prototype.stop = function() { - this._state = vo.IDLE, this.dispatch("stop"); - }, n.prototype.end = function() { - this._state = vo.END, this.dispatch("end"); - }, n; -}(Dl), ca = {}, EP = function() { - function e(n) { - var t = n._iid, r = n.channel, i = n.limit, a = i === void 0 ? 100 : i, o = this; - this.ref = 0, this._iid = t, this._channel = r, this._limit = a, this._prevSyncLoopCount = 0; - var s, c, l = U.of(this._iid), u = l.sdkState, d = l.cacheContext, h = l.dispatcher, f = l.logger, p = l.statLogCollector; - this._metadataKey = (s = u.userId, c = r.url, "sendbird:".concat(s, "@groupchannel/").concat(c, "/message/sync.meta")); - var v = function(m, E) { - return "sendbird:".concat(m, "@groupchannel/").concat(E, "/message/sync"); - }(u.userId, r.url); - this._prevSync = new Cs(v, function(m) { - return T(o, void 0, void 0, function() { - var E, y, _, S, b, A, w, M, N, x, D, j; - return C(this, function(P) { - switch (P.label) { - case 0: - return E = { hasNext: !0, nextToken: 0 }, this._prevSyncLoopCount++, [4, this.loadMetadata(m)]; - case 1: - if (P.sent(), f.debug("message background prev sync from", (A = this._metadata) === null || A === void 0 ? void 0 : A.range.top), (w = this._metadata) === null || w === void 0 ? void 0 : w.previousComplete) - return [3, 10]; - P.label = 2; - case 2: - return P.trys.push([2, 5, 8, 9]), [4, tr.of(this._iid).getMessagesByTimestamp(this._channel.url, this._channel.channelType, !((N = (M = this._metadata) === null || M === void 0 ? void 0 : M.range) === null || N === void 0) && N.top ? this._metadata.range.top : m, { prevResultSize: this._limit, nextResultSize: 0, replyType: ir.ALL, includeReactions: !0, includeMetaArray: !0, includeParentMessageInfo: !0, includeThreadInfo: !0 }, ne.SYNC_MESSAGE_BACKGROUND)]; - case 3: - return (y = P.sent()).length > 0 && (_ = y.map(function(G) { - return G.createdAt; - }), !((x = this._metadata) === null || x === void 0) && (b = x.range).intersect.apply(b, dt([], tt(_), !1)) ? this.extendRange(y) : this._metadata = { range: new Va({ top: Math.min.apply(Math, dt([], tt(_), !1)), bottom: Math.max.apply(Math, dt([], tt(_), !1)) }), previousComplete: !1 }), E.hasNext = y.length >= this._limit && this._prevSyncLoopCount < 1, this._metadata && (E.nextToken = this._metadata.range.top, this._metadata.previousComplete = y.length < this._limit), f.debug("message background prev sync progress", E), [4, this.saveMetadata()]; - case 4: - return P.sent(), [3, 9]; - case 5: - return S = P.sent(), f.debug("message background prev sync error", S), S instanceof H && S.isInvalidTokenError ? [4, this.clearMetadata()] : [3, 7]; - case 6: - P.sent(), P.label = 7; - case 7: - throw S; - case 8: - return p.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: r.url, measured_on: "back_sync", event: "cache_fetch", max_db_size: (j = (D = d.localCacheConfig) === null || D === void 0 ? void 0 : D.maxSize) !== null && j !== void 0 ? j : 0, use_local_cache: d.localCacheEnabled, starting_point: 0, message_init_policy: "" } })), [7]; - case 9: - return [3, 11]; - case 10: - E.hasNext = !1, P.label = 11; - case 11: - return [2, E]; - } - }); - }); - }), this._nextSync = new Cs(v, function(m) { - return T(o, void 0, void 0, function() { - var E, y, _, S, b, A, w, M, N, x, D; - return C(this, function(j) { - switch (j.label) { - case 0: - return E = { hasNext: !0, nextToken: 0 }, [4, this.loadMetadata(m)]; - case 1: - j.sent(), f.debug("message background next sync from", (A = this._metadata) === null || A === void 0 ? void 0 : A.range.bottom), j.label = 2; - case 2: - return j.trys.push([2, 5, 6, 7]), [4, tr.of(this._iid).getMessagesByTimestamp(this._channel.url, this._channel.channelType, !((M = (w = this._metadata) === null || w === void 0 ? void 0 : w.range) === null || M === void 0) && M.bottom ? this._metadata.range.bottom : m, { prevResultSize: 0, nextResultSize: this._limit, replyType: ir.ALL, includeReactions: !0, includeMetaArray: !0, includeParentMessageInfo: !0, includeThreadInfo: !0 }, ne.SYNC_MESSAGE_BACKGROUND)]; - case 3: - return (y = j.sent()).length > 0 && (_ = y.map(function(P) { - return P.createdAt; - }), !((N = this._metadata) === null || N === void 0) && (b = N.range).intersect.apply(b, dt([], tt(_), !1)) ? this.extendRange(y) : this._metadata = { range: new Va({ top: Math.min.apply(Math, dt([], tt(_), !1)), bottom: Math.max.apply(Math, dt([], tt(_), !1)) }), previousComplete: !1 }), E.hasNext = y.length >= this._limit, this._metadata && (E.nextToken = this._metadata.range.bottom), f.debug("message background next sync progress", E), [4, this.saveMetadata()]; - case 4: - return j.sent(), [3, 7]; - case 5: - throw S = j.sent(), f.debug("message background next sync error", S), S; - case 6: - return p.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: r.url, measured_on: "back_sync", event: "cache_fetch", max_db_size: (D = (x = d.localCacheConfig) === null || x === void 0 ? void 0 : x.maxSize) !== null && D !== void 0 ? D : 0, use_local_cache: d.localCacheEnabled, starting_point: 0, message_init_policy: "" } })), [7]; - case 7: - return [2, E]; - } - }); - }); - }), this._connectionEventContext = h.on(function(m) { - m instanceof bi && (m.stateType === tn.CONNECTED ? o.resume() : o.pause()); - }); - } - return e.of = function(n, t) { - return ca[n] || (ca[n] = {}), ca[n][t.url] || (ca[n][t.url] = new e({ _iid: n, channel: t })), ca[n][t.url].ref++, ca[n][t.url]; - }, e.clear = function(n, t) { - ca[n] && ca[n][t] && (ca[n][t].close(), delete ca[n]); - }, Object.defineProperty(e.prototype, "range", { get: function() { - var n, t; - return (t = (n = this._metadata) === null || n === void 0 ? void 0 : n.range) !== null && t !== void 0 ? t : new Va({}); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "previousComplete", { get: function() { - var n; - return !!(!((n = this._metadata) === null || n === void 0) && n.previousComplete); - }, enumerable: !1, configurable: !0 }), e.prototype.isWrappingMessages = function(n) { - var t; - return (t = this.range) === null || t === void 0 ? void 0 : t.includes.apply(t, dt([], tt(n.map(function(r) { - return r.createdAt; - })), !1)); - }, e.prototype.extendRange = function(n) { - var t; - this._metadata && (t = this._metadata.range).extends.apply(t, dt([], tt(n.map(function(r) { - return r.createdAt; - })), !1)); - }, e.prototype.loadMetadata = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - return this._metadata ? [3, 2] : [4, U.of(this._iid).cacheContext.preference.get(this._metadataKey)]; - case 1: - t = r.sent(), this._metadata = t ? { range: new Va(t.range), previousComplete: t.previousComplete } : { range: new Va({}), previousComplete: !1 }, r.label = 2; - case 2: - return [2, this._metadata]; - } - }); - }); - }, e.prototype.saveMetadata = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return this._metadata ? [4, U.of(this._iid).cacheContext.preference.set(this._metadataKey, this._metadata)] : [3, 2]; - case 1: - return n.sent(), [2, !0]; - case 2: - return [2, !1]; - } - }); - }); - }, e.prototype.clearMetadata = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, U.of(this._iid).cacheContext.preference.remove(this._metadataKey)]; - case 1: - return n.sent(), this._metadata = void 0, [2]; - } - }); - }); - }, e.prototype.resume = function(n) { - var t, r, i, a; - n === void 0 && (n = Date.now()); - var o = U.of(this._iid), s = o.logger; - o.sessionManager.session.hasSession && (s.debug("message background sync resume()"), this._prevSyncLoopCount = 0, this._metadata && this._metadata.previousComplete || this._prevSync.start((r = (t = this._metadata) === null || t === void 0 ? void 0 : t.range.top) !== null && r !== void 0 ? r : n), this._nextSync.start((a = (i = this._metadata) === null || i === void 0 ? void 0 : i.range.bottom) !== null && a !== void 0 ? a : n)); - }, e.prototype.pause = function() { - U.of(this._iid).logger.debug("message background sync stop()"), this._prevSync.stop(), this._nextSync.stop(); - }, e.prototype.close = function() { - this.ref--, this.ref <= 0 && (this.ref = 0, this.pause(), this._connectionEventContext.close(), delete ca[this._iid][this._channel.url]); - }, e; -}(), ua = {}, _P = function() { - function e(n) { - var t = n._iid, r = n.channel, i = n.includeParams, a = this; - this.ref = 0, this._iid = t, this._channel = r, this._includeParams = i; - var o, s, c = U.of(this._iid), l = c.logger, u = c.sdkState, d = c.dispatcher; - this._metadataKey = (o = u.userId, s = r.url, "sendbird:".concat(o, "@groupchannel/").concat(s, "/message/changelogs.meta")); - var h = function(f, p) { - return "sendbird:".concat(f, "@groupchannel/").concat(p, "/message/changelogs"); - }(u.userId, this._channel.url); - this._sync = new Cs(h, function() { - return T(a, void 0, void 0, function() { - var f, p, v, m, E, y, _, S; - return C(this, function(b) { - switch (b.label) { - case 0: - return f = { hasNext: !0, nextToken: 0 }, [4, this.loadMetadata()]; - case 1: - b.sent(), l.debug("message changelog sync from", (S = this._metadata) === null || S === void 0 ? void 0 : S.token), b.label = 2; - case 2: - return b.trys.push([2, 5, , 8]), [4, tr.of(this._iid).getMessageChangelogs(this._channel.url, this._channel.channelType, this._metadata.token, L({ replyType: ir.ALL }, this._includeParams), ne.SYNC_MESSAGE_CHANGELOGS)]; - case 3: - return p = b.sent(), v = p.updatedMessages, m = p.deletedMessageIds, E = p.hasMore, y = p.token, f.hasNext = E, f.nextToken = y, (v.length > 0 || m.length > 0) && this._metadata && (this._metadata.token = y), l.debug("message changelog sync progress", f), [4, this.saveMetadata()]; - case 4: - return b.sent(), [3, 8]; - case 5: - return _ = b.sent(), l.debug("message changelog sync error", _), _ instanceof H && _.isInvalidTokenError ? [4, this.clearMetadata()] : [3, 7]; - case 6: - b.sent(), b.label = 7; - case 7: - throw _; - case 8: - return [2, f]; - } - }); - }); - }), this._connectionEventContext = d.on(function(f) { - f instanceof bi && (f.stateType === tn.CONNECTED ? a.resume() : a.pause()); - }); - } - return e.of = function(n, t, r) { - return ua[n] || (ua[n] = {}), ua[n][t.url] || (ua[n][t.url] = new e({ _iid: n, channel: t, includeParams: r })), ua[n][t.url].ref++, ua[n][t.url]; - }, e.clear = function(n, t) { - ua[n] && ua[n][t] && (ua[n][t].close(), delete ua[n]); - }, e.prototype.loadMetadata = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return this._metadata ? [3, 2] : (n = U.of(this._iid), t = n.cacheContext, r = n.firstConnectedAt, [4, t.preference.get(this._metadataKey)]); - case 1: - i = a.sent(), this._metadata = { token: i ? i.token : r }, a.label = 2; - case 2: - return [2, this._metadata]; - } - }); - }); - }, e.prototype.saveMetadata = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return this._metadata ? [4, U.of(this._iid).cacheContext.preference.set(this._metadataKey, this._metadata)] : [3, 2]; - case 1: - return n.sent(), [2, !0]; - case 2: - return [2, !1]; - } - }); - }); - }, e.prototype.clearMetadata = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, U.of(this._iid).cacheContext.preference.remove(this._metadataKey)]; - case 1: - return n.sent(), this._metadata = void 0, [2]; - } - }); - }); - }, e.prototype.resume = function() { - var n = U.of(this._iid), t = n.logger; - n.sessionManager.session.hasSession && (t.debug("message changelog sync resume()"), this._sync.start(0)); - }, e.prototype.pause = function() { - U.of(this._iid).logger.debug("message changelog sync pause()"), this._sync.stop(); - }, e.prototype.close = function() { - this.ref--, this.ref <= 0 && (this.ref = 0, this.pause(), this._connectionEventContext.close(), delete ua[this._iid][this._channel.url]); - }, e; -}(), Fs = {}, bP = function() { - function e(n) { - var t = n._iid, r = n.channel, i = n.hasPollMessage, a = this; - this.ref = 0, this._iid = t, this._channel = r; - var o, s, c = U.of(this._iid), l = c.logger, u = c.sdkState, d = c.dispatcher; - this._metadataKey = (o = u.userId, s = r.url, "sendbird:".concat(o, "@groupchannel/").concat(s, "/poll/changelogs.meta")); - var h = function(f, p) { - return "sendbird:".concat(f, "@groupchannel/").concat(p, "/poll/changelogs"); - }(u.userId, this._channel.url); - this._sync = new Cs(h, function() { - return T(a, void 0, void 0, function() { - var f, p, v, m, E, y, _, S; - return C(this, function(b) { - switch (b.label) { - case 0: - return f = { hasNext: !0, nextToken: 0 }, [4, this.loadMetadata()]; - case 1: - return b.sent(), l.debug("poll changelog sync from", (S = this._metadata) === null || S === void 0 ? void 0 : S.token), (p = !this._metadata || !this._metadata.token) ? [4, i()] : [3, 3]; - case 2: - p = !b.sent(), b.label = 3; - case 3: - if (p) - return [2, { hasNext: !1, nextToken: 0 }]; - this._metadata || (v = U.of(this._iid).firstConnectedAt, this._metadata = { token: v }), b.label = 4; - case 4: - return b.trys.push([4, 7, , 10]), [4, np.of(this._iid).getPollChangeLogs(this._channel.url, this._channel.channelType, this._metadata.token)]; - case 5: - return m = b.sent(), E = m.hasMore, y = m.token, f.hasNext = E, f.nextToken = y, this._metadata.token = y, l.debug("poll changelog sync progress", f), [4, this.saveMetadata()]; - case 6: - return b.sent(), [3, 10]; - case 7: - return _ = b.sent(), l.debug("poll changelog sync error", _), _ instanceof H && _.isInvalidTokenError ? [4, this.clearMetadata()] : [3, 9]; - case 8: - b.sent(), b.label = 9; - case 9: - throw _; - case 10: - return [2, f]; - } - }); - }); - }), this._connectionEventContext = d.on(function(f) { - f instanceof bi && (f.stateType === tn.CONNECTED ? a.resume() : a.pause()); - }); - } - return e.of = function(n, t, r) { - return Fs[n] || (Fs[n] = {}), Fs[n][t.url] || (Fs[n][t.url] = new e({ _iid: n, channel: t, hasPollMessage: r })), Fs[n][t.url].ref++, Fs[n][t.url]; - }, e.prototype.loadMetadata = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return this._metadata ? [3, 2] : [4, U.of(this._iid).cacheContext.preference.get(this._metadataKey)]; - case 1: - n = t.sent(), this._metadata = n ? { token: n.token } : void 0, t.label = 2; - case 2: - return [2]; - } - }); - }); - }, e.prototype.saveMetadata = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return this._metadata ? [4, U.of(this._iid).cacheContext.preference.set(this._metadataKey, this._metadata)] : [3, 2]; - case 1: - n.sent(), n.label = 2; - case 2: - return [2]; - } - }); - }); - }, e.prototype.clearMetadata = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, U.of(this._iid).cacheContext.preference.remove(this._metadataKey)]; - case 1: - return n.sent(), this._metadata = void 0, [2]; - } - }); - }); - }, e.prototype.resume = function() { - U.of(this._iid).logger.debug("poll changelog sync resume()"), this._sync.start(0); - }, e.prototype.pause = function() { - U.of(this._iid).logger.debug("poll changelog sync pause()"), this._sync.stop(); - }, e.prototype.close = function() { - this.ref--, this.ref <= 0 && (this.ref = 0, this.pause(), this._connectionEventContext.close(), delete Fs[this._iid][this._channel.url]); - }, e; -}(), CP = function(e) { - function n(t) { - var r = t.channels, i = t.source, a = t.isWebSocketEventComing, o = a !== void 0 && a, s = t.data, c = s === void 0 ? null : s, l = e.call(this) || this; - return l.channels = r, l.source = i, l.isWebSocketEventComing = o, l.data = c, l; - } - return O(n, e), n; -}(bn); -(function(e) { - function n(t) { - var r = t.channelUrls, i = t.source, a = t.isWebSocketEventComing, o = a !== void 0 && a, s = e.call(this) || this; - return s.channelUrls = r, s.source = i, s.isWebSocketEventComing = o, s; - } - return O(n, e), n; -})(bn); -var TP = function(e) { - function n(t) { - var r, i, a, o, s, c, l, u, d, h, f = this; - return (f = e.call(this) || this).method = pe.GET, f.path = "".concat(Kt(t.channelType), "/").concat(t.channelUrl, "/messages_gap"), f.params = Be({ prev_start_ts: t.prevStart, prev_end_ts: t.prevEnd, prev_cache_count: t.prevCount, next_start_ts: t.nextStart, next_end_ts: t.nextEnd, next_cache_count: t.nextCount, huge_gap_threshold: (r = t.threshold) !== null && r !== void 0 ? r : null, reverse: !0, custom_types: (i = t.customTypes) !== null && i !== void 0 ? i : ["*"], message_type: (a = t.messageType) !== null && a !== void 0 ? a : null, include_reply_type: (o = t.replyType) !== null && o !== void 0 ? o : ir.NONE, include_reactions: (s = t.includeReactions) === null || s === void 0 || s, include_meta_array: (c = t.includeMetaArray) === null || c === void 0 || c, include_thread_info: (l = t.includeThreadInfo) === null || l === void 0 || l, include_parent_message_info: (u = t.includeParentMessageInfo) === null || u === void 0 || u, with_sorted_meta_array: (d = t.includeMetaArray) === null || d === void 0 || d, show_subchannel_messages_only: (h = t.showSubchannelMessagesOnly) !== null && h !== void 0 && h, include_poll_details: !0, checking_continuous_messages: t.checkingContinuousMessages }), f; - } - return O(n, e), n; -}(ge), SP = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u = this; - return (u = e.call(this, t, r) || this).isHugeGap = r.is_huge_gap, u.prevMessages = ((i = r.prev_messages) !== null && i !== void 0 ? i : []).map(function(d) { - return jr(t, d); - }), u.prevHasMore = (a = r.prev_hasmore) !== null && a !== void 0 && a, u.isContinuousPrevMessages = (o = r.is_continuous_prev_messages) !== null && o !== void 0 && o, u.nextMessages = ((s = r.next_messages) !== null && s !== void 0 ? s : []).map(function(d) { - return jr(t, d); - }), u.nextHasmore = (c = r.next_hasmore) !== null && c !== void 0 && c, u.isContinuousNextMessages = (l = r.is_continuous_next_messages) !== null && l !== void 0 && l, u; - } - return O(n, e), n; -}(_e), iN = function(e) { - this.source = e; -}, ag = function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - return O(n, e), n; -}(iN), wP = function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - return O(n, e), n; -}(iN), aN = function(e) { - this.source = e; -}, AP = function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - return O(n, e), n; -}(aN), NP = function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - return O(n, e), n; -}(aN), Vb = { includeMetaArray: !0, includeReactions: !0, includeThreadInfo: !0, includeParentMessageInfo: !0 }; -(function(e) { - e.CACHE_AND_REPLACE_BY_API = "cache_and_replace_by_api"; -})(ig || (ig = {})); -var $u, ed, td, IP = function() { - function e() { - this._onCacheResult = bt, this._onApiResult = bt; - } - return e.prototype._invokeResponse = function(n, t, r) { - var i = this; - Ke(function() { - return T(i, void 0, void 0, function() { - return C(this, function(a) { - switch (n) { - case "local": - this._onCacheResult(t, r); - break; - case "remote": - this._onApiResult(t, r); - } - return [2]; - }); - }); - }); - }, e.prototype.onCacheResult = function(n) { - return this._onCacheResult = n, this; - }, e.prototype.onApiResult = function(n) { - return this._onApiResult = n, this; - }, e; -}(), MP = function() { - function e(n, t) { - var r = t.filter, i = t.startingPoint, a = t.limit, o = t.prevResultLimit, s = t.nextResultLimit, c = t.channel, l = t.channelManager, u = t.disableBackgroundSync, d = u !== void 0 && u, h = this; - this._messages = [], this._unsentMessages = [], this._isLoadingPrevious = !1, this._isLoadingNext = !1, this._iid = n, this._key = "mc-".concat(Ro()), this._isDisposed = !1, this.filter = r ?? new bs(), this._channel = c, this._syncRange = new Va({}), this._hasPrevious = !0, this._hasNext = !0, this._startingPoint = typeof i == "number" && Number.isFinite(i) ? i : Number.MAX_SAFE_INTEGER, this._limit = a || kA, this._prevResultLimit = o ?? Math.floor(this._limit / 2), this._nextResultLimit = s ?? Math.floor(this._limit / 2), this._channelManager = l, this._channelManager.subscribeChannelEvent(this._key, { onUpdate: function(y, _, S) { - var b = y.findIndex(function(A) { - return A.isIdentical(h.channel); - }); - b >= 0 && (h._replaceChannelOfCollection(y[b]), h.channel._runIfHandleableWithGroupChannel(function(A) { - switch (_) { - case ne.EVENT_CHANNEL_UPDATED: - var w = !1; - for (var M in h._messages) - if (h._messages[M].createdAt >= A.messageOffsetTimestamp) { - w = !0; - var N = parseInt(M); - if (N > 0) { - var x = h._messages.splice(0, N); - h._removeMessagesFromView(x.map(function(G) { - return h.keyOf(G); - }), ne.EVENT_MESSAGE_OFFSET_UPDATED); - } - break; - } - !w && h._messages.length > 0 && h._removeMessagesFromView(h._messages.map(function(G) { - return h.keyOf(G); - }), ne.EVENT_MESSAGE_OFFSET_UPDATED); - break; - case ne.EVENT_CHANNEL_UNMUTED: - var D = U.of(h._iid).sdkState, j = S; - D.userId === j && h._clearCheckMyMutedTimer(); - break; - case ne.EVENT_CHANNEL_MUTED: - D = U.of(h._iid).sdkState; - var P = S; - D.userId === P && A._myMutedRemainingTime !== -1 && h._startCheckMyMutedTimer(A._myMutedRemainingTime); - break; - case ne.EVENT_CHANNEL_LEFT: - A.isPublic && h._clearCheckMyMutedTimer(); - } - Ke(function() { - return T(h, void 0, void 0, function() { - var G, z; - return C(this, function(q) { - return G = this._createChannelEventContext(_), xf(_) && (!((z = this._handler) === null || z === void 0) && z.onChannelUpdated) && this._handler.onChannelUpdated(G, this.channel), [2]; - }); - }); - }); - }), h._postprocessChannelUpdateEvent(y[b], _)); - }, onRemove: function(y, _) { - var S = y.indexOf(h.channel.url); - S >= 0 && (h._clearCheckMyMutedTimer(), Ke(function() { - return T(h, void 0, void 0, function() { - var b, A; - return C(this, function(w) { - return b = this._createChannelEventContext(_), !((A = this._handler) === null || A === void 0) && A.onChannelDeleted && this._handler.onChannelDeleted(b, this.channel.url), [2]; - }); - }); - }), h._postprocessChannelRemoveEvent(y[S])); - } }), this._channelManager.subscribeMessageEvent(this._key, { onUpdate: function(y, _) { - var S, b, A = [], w = []; - try { - for (var M = Ne(y), N = M.next(); !N.done; N = M.next()) { - var x = N.value; - x.channelUrl === h._channel.url && (h.filter.match(x) ? A.push(x) : w.push(h.keyOf(x))); - } - } catch (D) { - S = { error: D }; - } finally { - try { - N && !N.done && (b = M.return) && b.call(M); - } finally { - if (S) - throw S.error; - } - } - if (po(_)) { - if (A.length > 0) - switch (_) { - case ne.LOCAL_MESSAGE_CANCELED: - case ne.LOCAL_MESSAGE_RESEND_STARTED: - case ne.EVENT_MESSAGE_SENT_FAILED: - case ne.EVENT_MESSAGE_SENT_SUCCESS: - case ne.EVENT_MESSAGE_UPDATED: - case ne.EVENT_MESSAGE_THREADINFO_UPDATED: - case ne.EVENT_MESSAGE_REACTION_UPDATED: - case ne.EVENT_MESSAGE_FEEDBACK_ADDED: - case ne.EVENT_MESSAGE_FEEDBACK_UPDATED: - case ne.EVENT_MESSAGE_FEEDBACK_DELETED: - case ne.SYNC_MESSAGE_CHANGELOGS: - h._updateMessagesToView(A, _); - break; - case ne.EVENT_MESSAGE_SENT_PENDING: - h._addMessagesToView(A, _); - break; - case ne.EVENT_MESSAGE_RECEIVED: - h.hasNext || h._addMessagesToView(A, _); - break; - case ne.SYNC_MESSAGE_FILL: - h._addMessagesToView(A, _); - } - w.length > 0 && h._removeMessagesFromView(w, _); - } - h._postprocessMessageUpdateEvent(y, _); - }, onRemove: function(y, _) { - h._removeMessagesFromView(y, _), h._postprocessMessageRemoveEvent(y); - }, onRemoveUnsent: function(y, _) { - h._removeUnsentMessageFromView(y, _); - }, onPollChangeLogUpdate: function(y, _) { - h._updatePollsToView(y, _); - }, onPollUpdate: function(y, _) { - h._applyPollUpdateEventToView(y, _); - }, onPollVote: function(y, _) { - h._applyPollVoteEventToView(y, _); - }, onReactionUpdate: function(y, _) { - h._applyReactionEventToView(y, _); - }, onThreadInfoUpdate: function(y, _) { - h._applyThreadInfoEventToView(y, _); - } }); - var f = U.of(this._iid), p = f.cacheContext, v = f.dispatcher; - this._channel._updateMessageCollectionLastAccessedAt(); - var m = this._createChannelUpdateEventCommand(ne.CHANNEL_LASTACCESSEDAT_UPDATED); - m && v.dispatch(m), !d && this._shouldStartBackgroundSync() && (this._backgroundSync = EP.of(this._iid, this._channel), this._backgroundSync.resume(this._startingPoint)), this._changelogSync = _P.of(this._iid, this._channel, this.changelogIncludeParams), this._changelogSync.resume(), this._pollChangelogSync = bP.of(this._iid, this._channel, this._hasPollMessage.bind(this)), this._pollChangelogSync.resume(), this._prevFill = new Cs(this._key, function(y) { - return T(h, void 0, void 0, function() { - var _, S, b, A, w, M, N; - return C(this, function(x) { - switch (x.label) { - case 0: - return [4, this._getRemoteMessages(y, { prevLimit: this._prevResultLimit, source: ne.SYNC_MESSAGE_FILL, checkingContinuousMessages: p.localCacheEnabled })]; - case 1: - return _ = x.sent(), S = _.messages, b = _.isContinuousMessages, S.length > 0 ? (A = Math.min.apply(Math, dt([], tt(S.map(function(D) { - return D.createdAt; - })), !1)), this._syncRange.extends(A), b && ((w = this._backgroundSync) === null || w === void 0 || w.range.extends(A)), [2, { hasNext: S.length >= this._prevResultLimit && this.viewTop < A, nextToken: this._syncRange.top }]) : (E.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: this.channel.url, measured_on: "gap_check", event: "cache_fetch", max_db_size: (N = (M = p.localCacheConfig) === null || M === void 0 ? void 0 : M.maxSize) !== null && N !== void 0 ? N : 0, use_local_cache: p.localCacheEnabled, starting_point: 0, message_init_policy: "" } })), [2, { hasNext: !1, nextToken: 0 }]); - } - }); - }); - }), this._nextFill = new Cs(this._key, function(y) { - return T(h, void 0, void 0, function() { - var _, S, b, A, w, M, N; - return C(this, function(x) { - switch (x.label) { - case 0: - return [4, this._getRemoteMessages(y, { nextLimit: this._nextResultLimit, source: ne.SYNC_MESSAGE_FILL, checkingContinuousMessages: p.localCacheEnabled })]; - case 1: - return _ = x.sent(), S = _.messages, b = _.isContinuousMessages, S.length > 0 ? (A = Math.max.apply(Math, dt([], tt(S.map(function(D) { - return D.createdAt; - })), !1)), this._syncRange.extends(A), b && ((w = this._backgroundSync) === null || w === void 0 || w.range.extends(A)), [2, { hasNext: !(S.length >= this._nextResultLimit && this._hasNext) || this.viewBottom > A, nextToken: this._syncRange.bottom }]) : (E.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: this.channel.url, measured_on: "gap_check", event: "cache_fetch", max_db_size: (N = (M = p.localCacheConfig) === null || M === void 0 ? void 0 : M.maxSize) !== null && N !== void 0 ? N : 0, use_local_cache: p.localCacheEnabled, starting_point: 0, message_init_policy: "" } })), [2, { hasNext: !1, nextToken: 0 }]); - } - }); - }); - }), this._connectionEventContext = v.on(function(y) { - if (y instanceof bi) - switch (y.stateType) { - case tn.CONNECTED: - Pn(function() { - return T(h, void 0, void 0, function() { - return C(this, function(_) { - return this._activate(), [2]; - }); - }); - }); - break; - case tn.LOGOUT: - h.dispose(); - break; - default: - h._clearCheckMyMutedTimer(), h._prevFill.stop(), h._nextFill.stop(); - } - }); - var E = U.of(this._iid).statLogCollector; - E.put(new rl({ type: Tn.FEATURE_LOCALCACHE, data: { use_local_cache: p.localCacheEnabled, collection_interface: { message: !0 } } })); - } - return e.prototype.keyOf = function(n) { - return 0; - }, Object.defineProperty(e.prototype, "changelogIncludeParams", { get: function() { - return { includeReactions: !0, includeThreadInfo: !0, includeMetaArray: !0, includeParentMessageInfo: !0 }; - }, enumerable: !1, configurable: !0 }), e.prototype._postprocessChannelUpdateEvent = function(n, t) { - }, e.prototype._postprocessChannelRemoveEvent = function(n) { - }, e.prototype._postprocessMessageUpdateEvent = function(n, t) { - }, e.prototype._postprocessMessageRemoveEvent = function(n) { - }, Object.defineProperty(e.prototype, "channel", { get: function() { - return this._channel; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "succeededMessages", { get: function() { - return dt([], tt(this._messages), !1); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "failedMessages", { get: function() { - return this._unsentMessages.filter(function(n) { - return n.sendingStatus === $t.FAILED; - }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "pendingMessages", { get: function() { - return this._unsentMessages.filter(function(n) { - return n.sendingStatus === $t.PENDING; - }); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "hasPrevious", { get: function() { - return this._hasPrevious; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "hasNext", { get: function() { - return this._hasNext; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "viewTop", { get: function() { - return Math.min.apply(Math, dt(dt([], tt(this._messages.map(function(n) { - return n.createdAt; - })), !1), [Number.MAX_SAFE_INTEGER], !1)); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "viewBottom", { get: function() { - return Math.max.apply(Math, dt(dt([], tt(this._messages.map(function(n) { - return n.createdAt; - })), !1), [0], !1)); - }, enumerable: !1, configurable: !0 }), e.prototype._activate = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return U.of(this._iid).logger.debug("check huge gap"), this._checkHugeGap(), [4, this._refreshChannel(ne.SYNC_CHANNEL_CHANGELOGS)]; - case 1: - return n.sent(), [2]; - } - }); - }); - }, e.prototype._replaceChannelOfCollection = function(n) { - this._channel.isGroupChannel() ? this._channel = n : this._channel.isFeedChannel() && (this._channel._groupChannel = n._groupChannel); - }, e.prototype._shouldStartBackgroundSync = function() { - var n = U.of(this._iid).cacheContext; - return this.channel.isGroupChannel() ? n.localCacheEnabled && !this.channel.isSuper : n.localCacheEnabled; - }, e.prototype._createChannelEventContext = function(n) { - switch (!0) { - case this.channel.isGroupChannel(): - return new ag(n); - case this.channel.isFeedChannel(): - return new wP(n); - default: - throw new H({ code: nt.WRONG_CHANNEL_TYPE, message: "Wrong channel type" }); - } - }, e.prototype._createMessageEventContext = function(n) { - switch (!0) { - case this.channel.isGroupChannel(): - return new AP(n); - case this.channel.isFeedChannel(): - return new NP(n); - default: - throw new H({ code: nt.WRONG_CHANNEL_TYPE, message: "Wrong channel type" }); - } - }, e.prototype._createChannelUpdateEventCommand = function(n) { - switch (!0) { - case this.channel.isGroupChannel(): - return new Ut({ channels: [this._channel], source: n }); - case this.channel.isFeedChannel(): - return new CP({ channels: [this._channel], source: n }); - default: - return null; - } - }, e.prototype._setBaseMessageCollectionHandler = function(n) { - this._handler = n; - }, e.prototype._filterUnderOffsetMessage = function(n) { - return n; - }, e.prototype._updateChildMessagesInView = function(n) { - var t = []; - return this._messages.forEach(function(r) { - r instanceof kr && r.parentMessageId === n.messageId && r.applyParentMessage(n) && t.push(r); - }), t; - }, e.prototype._updatePollsToView = function(n, t) { - var r, i, a = this, o = []; - try { - for (var s = Ne(n), c = s.next(); !c.done; c = s.next()) { - var l = c.value, u = iu(this._messages, l.messageId); - if (u >= 0) { - var d = this._messages[u]; - d.isUserMessage() && d.applyPoll(l), o.push(d); - } - } - } catch (h) { - r = { error: h }; - } finally { - try { - c && !c.done && (i = s.return) && i.call(s); - } finally { - if (r) - throw r.error; - } - } - return o.length > 0 && po(t) && Ke(function() { - return T(a, void 0, void 0, function() { - var h, f, p; - return C(this, function(v) { - return h = this._createMessageEventContext(t), o.length > 0 && ((p = (f = this._handler).onMessagesUpdated) === null || p === void 0 || p.call(f, h, this.channel, o)), [2]; - }); - }); - }), o; - }, e.prototype._applyPollUpdateEventToView = function(n, t) { - var r = this, i = iu(this._messages, n.messageId); - if (i >= 0) { - var a = this._messages[i]; - a && a.isUserMessage() && a.poll && a.poll.applyPollUpdateEvent(n) && po(t) && Ke(function() { - return T(r, void 0, void 0, function() { - var o, s, c; - return C(this, function(l) { - return o = this._createMessageEventContext(t), (c = (s = this._handler) === null || s === void 0 ? void 0 : s.onMessagesUpdated) === null || c === void 0 || c.call(s, o, this.channel, [a]), [2]; - }); - }); - }); - } - }, e.prototype._applyPollVoteEventToView = function(n, t) { - var r = this, i = iu(this._messages, n.messageId); - if (i >= 0) { - var a = this._messages[i]; - a && a.isUserMessage() && a.poll && a.poll.applyPollVoteEvent(n) && po(t) && Ke(function() { - return T(r, void 0, void 0, function() { - var o, s, c; - return C(this, function(l) { - return o = this._createMessageEventContext(t), (c = (s = this._handler) === null || s === void 0 ? void 0 : s.onMessagesUpdated) === null || c === void 0 || c.call(s, o, this.channel, [a]), [2]; - }); - }); - }); - } - }, e.prototype._applyReactionEventToView = function(n, t) { - var r = this, i = iu(this._messages, n.messageId); - if (i >= 0) { - var a = this._messages[i]; - a && (a.isUserMessage() || a.isFileMessage() || a.isMultipleFilesMessage()) && po(t) && (a.applyReactionEvent(n), Ke(function() { - return T(r, void 0, void 0, function() { - var o, s, c; - return C(this, function(l) { - return o = this._createMessageEventContext(t), (c = (s = this._handler) === null || s === void 0 ? void 0 : s.onMessagesUpdated) === null || c === void 0 || c.call(s, o, this.channel, [a]), [2]; - }); - }); - })); - } - }, e.prototype._applyThreadInfoEventToView = function(n, t) { - var r = this, i = iu(this._messages, n.targetMessageId); - if (i >= 0) { - var a = this._messages[i]; - a && (a.isUserMessage() || a.isFileMessage() || a.isMultipleFilesMessage()) && po(t) && (a.applyThreadInfoUpdateEvent(n), Ke(function() { - return T(r, void 0, void 0, function() { - var o, s, c; - return C(this, function(l) { - return o = this._createMessageEventContext(t), (c = (s = this._handler) === null || s === void 0 ? void 0 : s.onMessagesUpdated) === null || c === void 0 || c.call(s, o, this.channel, [a]), [2]; - }); - }); - })); - } - }, e.prototype._removeMessagesFromView = function(n, t) { - var r, i, a = this, o = [], s = [], c = function(h) { - var f = l._messages.findIndex(function(v) { - return a.keyOf(v) === h; - }); - if (f >= 0) { - var p = l._messages[f]; - o.push(l.keyOf(p)), s.push(p), l._messages.splice(f, 1); - } - }, l = this; - try { - for (var u = Ne(n), d = u.next(); !d.done; d = u.next()) - c(d.value); - } catch (h) { - r = { error: h }; - } finally { - try { - d && !d.done && (i = u.return) && i.call(u); - } finally { - if (r) - throw r.error; - } - } - return po(t) && s.length > 0 && Ke(function() { - return T(a, void 0, void 0, function() { - var h, f, p; - return C(this, function(v) { - return h = this._createMessageEventContext(t), (p = (f = this._handler) === null || f === void 0 ? void 0 : f.onMessagesDeleted) === null || p === void 0 || p.call(f, h, this.channel, o, s), [2]; - }); - }); - }), o; - }, e.prototype._removeUnsentMessageFromView = function(n, t) { - var r = this._unsentMessages.findIndex(function(i) { - return i.reqId === n; - }); - r >= 0 && this._unsentMessages.splice(r, 1); - }, e.prototype._getLocalMessages = function(n, t) { - var r = t.prevLimit, i = r === void 0 ? 0 : r, a = t.nextLimit, o = a === void 0 ? 0 : a, s = t.inclusive, c = s === void 0 || s; - return T(this, void 0, void 0, function() { - var l, u, d, h, f; - return C(this, function(p) { - switch (p.label) { - case 0: - return l = [], c ? [4, this._channelManager.getExactlyMatchingMessagesForTokenFromCache(this._channel.url, n, this.filter)] : [3, 2]; - case 1: - l = p.sent(), p.label = 2; - case 2: - return i > 0 ? [4, this._channelManager.getMessagesFromCache(this._channel.url, n, "prev", this.filter, i, !1)] : [3, 4]; - case 3: - return d = p.sent(), [3, 5]; - case 4: - d = [], p.label = 5; - case 5: - return u = d, o > 0 ? [4, this._channelManager.getMessagesFromCache(this._channel.url, n, "next", this.filter, o, !1)] : [3, 7]; - case 6: - return f = p.sent(), [3, 8]; - case 7: - f = [], p.label = 8; - case 8: - return h = f, [2, dt(dt(dt([], tt(l), !1), tt(u), !1), tt(h), !1).sort(function(v, m) { - return m.createdAt - v.createdAt; - })]; - } - }); - }); - }, e.prototype._getRemoteMessages = function(n, t) { - var r = t.prevLimit, i = r === void 0 ? 0 : r, a = t.nextLimit, o = a === void 0 ? 0 : a, s = t.source, c = s === void 0 ? ne.REQUEST_MESSAGE : s, l = t.reverse, u = l !== void 0 && l, d = t.checkingHasNext, h = d !== void 0 && d, f = t.checkingContinuousMessages, p = f !== void 0 && f; - return T(this, void 0, void 0, function() { - var v, m; - return C(this, function(E) { - switch (E.label) { - case 0: - return v = tr.of(this._iid), i > 0 || o > 0 ? [4, v._getMessagesByTimestampForCollection(this._channel.url, this._channel.channelType, n, Xe(L(L(L({}, this.filter), Vb), { isInclusive: !0, reverse: u, prevResultSize: i, nextResultSize: o })), c, h, p)] : [3, 2]; - case 1: - return m = E.sent(), [3, 3]; - case 2: - m = { messages: [], isContinuousMessages: !1 }, E.label = 3; - case 3: - return [2, m]; - } - }); - }); - }, e.prototype._checkHugeGap = function() { - var n, t, r, i, a; - return T(this, void 0, void 0, function() { - var o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M, N, x, D, j, P, G, z = this; - return C(this, function(q) { - switch (q.label) { - case 0: - return o = U.of(this._iid), s = o.dispatcher, c = o.requestQueue, l = o.cacheContext, u = o.statLogCollector, d = o.logger, this._messages.length > 0 ? (h = this._syncRange.top, f = this.viewTop, p = this._syncRange.bottom, v = this.hasNext ? this.viewBottom : Number.MAX_SAFE_INTEGER, [4, this._channelManager.getCachedMessageCountBetween(this._channel.url, this.filter, f, h)]) : [3, 8]; - case 1: - return m = q.sent(), [4, this._channelManager.getCachedMessageCountBetween(this._channel.url, this.filter, p, v)]; - case 2: - E = q.sent(), q.label = 3; - case 3: - return q.trys.push([3, 5, 6, 7]), [4, Kp(function() { - return T(z, void 0, void 0, function() { - var Y, ye, $, ae, de, re, K, ee, J, B, se, te, Me, Ie, we, Q, ze, Ce = this; - return C(this, function(ke) { - switch (ke.label) { - case 0: - return Y = new TP(L(L({ channelUrl: this._channel.url, channelType: this._channel.channelType, prevStart: f, prevEnd: h, prevCount: m, nextStart: p, nextEnd: v, nextCount: E, checkingContinuousMessages: l.localCacheEnabled }, this.filter), Vb)), [4, c.send(Y)]; - case 1: - return ye = ke.sent(), $ = ye.as(SP), ae = $.isHugeGap, de = $.prevMessages, re = de === void 0 ? [] : de, K = $.prevHasMore, ee = $.isContinuousPrevMessages, J = $.nextMessages, B = J === void 0 ? [] : J, se = $.nextHasmore, te = $.isContinuousNextMessages, ae ? Ke(function() { - return T(Ce, void 0, void 0, function() { - var et; - return C(this, function(Je) { - return !((et = this._handler) === null || et === void 0) && et.onHugeGapDetected && this._handler.onHugeGapDetected(), [2]; - }); - }); - }) : (Me = this.viewTop, Ie = this.viewBottom, we = Math.min.apply(Math, dt([Number.MAX_SAFE_INTEGER, Me], tt(re.map(function(et) { - return et.createdAt; - })), !1)), Q = Math.max.apply(Math, dt([0, Ie], tt(B.map(function(et) { - return et.createdAt; - })), !1)), s.dispatch(new Sn({ messages: re, source: ne.SYNC_MESSAGE_FILL })), s.dispatch(new Sn({ messages: B, source: ne.SYNC_MESSAGE_FILL })), this._syncRange.extends(we, Q), (ee || te) && ((ze = this._backgroundSync) === null || ze === void 0 || ze.range.extends(we, Q)), K && this._prevFill.start(we), se && this._nextFill.start(Q)), [2]; - } - }); - }); - }, 1)]; - case 4: - return q.sent(), [3, 7]; - case 5: - return y = q.sent(), d.debug("Failed HugeGap Check ", y), [3, 7]; - case 6: - return u.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: this.channel.url, measured_on: "gap_check", event: "cache_fetch", max_db_size: (t = (n = l.localCacheConfig) === null || n === void 0 ? void 0 : n.maxSize) !== null && t !== void 0 ? t : 0, use_local_cache: l.localCacheEnabled, starting_point: 0, message_init_policy: "" } })), [7]; - case 7: - return [3, 13]; - case 8: - _ = Date.now(), q.label = 9; - case 9: - return q.trys.push([9, 11, 12, 13]), [4, this._getRemoteMessages(_, { prevLimit: this._prevResultLimit, nextLimit: this._nextResultLimit, source: ne.SYNC_MESSAGE_FILL, checkingHasNext: !0, checkingContinuousMessages: l.localCacheEnabled })]; - case 10: - if (S = q.sent(), b = S.messages, A = S.isContinuousMessages, w = S.hasNext, b.length > 0) { - for (M = b.map(function(Y) { - return Y.createdAt; - }), N = 0, x = 0, D = 0; D < M.length; D++) - (j = M[D]) <= _ ? N++ : j >= _ && x++; - this._hasPrevious = N >= this._prevResultLimit, this._hasNext = w ?? x >= this._nextResultLimit, (G = this._syncRange).extends.apply(G, dt([], tt(M), !1)), A && ((r = this._backgroundSync) === null || r === void 0 || r.range.extends(this._syncRange.top, this._syncRange.bottom)), this._addMessagesToView(b, ne.SYNC_MESSAGE_FILL); - } else - this._hasPrevious = !1, this._hasNext = !1; - return [3, 13]; - case 11: - return (P = q.sent()) instanceof H && P.code === nt.NOT_FOUND_IN_DATABASE && (this._hasPrevious = !1, this._hasNext = !1), [3, 13]; - case 12: - return u.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: this.channel.url, measured_on: "gap_check", event: "cache_fetch", max_db_size: (a = (i = l.localCacheConfig) === null || i === void 0 ? void 0 : i.maxSize) !== null && a !== void 0 ? a : 0, use_local_cache: l.localCacheEnabled, starting_point: 0, message_init_policy: "" } })), [7]; - case 13: - return [2]; - } - }); - }); - }, e.prototype._loadUnsentMessages = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return n = this, [4, this._channelManager.getUnsentMessagesFromCache(this._channel.url, this.filter)]; - case 1: - return n._unsentMessages = t.sent(), [2]; - } - }); - }); - }, e.prototype._hasPollMessage = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, this._channelManager.getPollMessagesFromCache(this._channel.url, Date.now() + 6e5, this.filter, 1)]; - case 1: - return n.sent().length > 0 ? [2, !0] : [2, !1]; - } - }); - }); - }, e.prototype._refreshChannel = function(n) { - var t = this; - Pn(function() { - return T(t, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._channelManager.refreshChannel(this.channel.url, !0, n)]; - case 1: - return r.sent(), [2]; - } - }); - }); - }); - }, e.prototype._startCheckMyMutedTimer = function(n) { - var t = this; - this._clearCheckMyMutedTimer(), this._checkMyMutedStateTimer = setTimeout(function() { - return T(t, void 0, void 0, function() { - var r, i, a = this; - return C(this, function(o) { - switch (o.label) { - case 0: - this._checkMyMutedStateTimer = void 0, r = !0, o.label = 1; - case 1: - return o.trys.push([1, 3, 4, 5]), [4, this._channel.getMyMutedInfo()]; - case 2: - return i = o.sent(), r = !i.isMuted, [3, 5]; - case 3: - return o.sent(), r = !0, [3, 5]; - case 4: - return r && this.channel._runIfHandleableWithGroupChannel(function(s) { - var c, l; - s.myMutedState = Ba.UNMUTED; - var u = a._createChannelEventContext(ne.EVENT_CHANNEL_UNMUTED); - (l = (c = a._handler) === null || c === void 0 ? void 0 : c.onChannelUpdated) === null || l === void 0 || l.call(c, u, a.channel); - }), [7]; - case 5: - return [2]; - } - }); - }); - }, n + 1e3); - }, e.prototype._clearCheckMyMutedTimer = function() { - this._checkMyMutedStateTimer && (clearTimeout(this._checkMyMutedStateTimer), this._checkMyMutedStateTimer = void 0); - }, e.prototype.initialize = function(n) { - var t = this, r = new IP(); - this._messages = [], this._unsentMessages = [], this._syncRange = new Va({}), this._hasNext = !0, this._hasPrevious = !0, this._refreshChannel(ne.REFRESH_CHANNEL); - var i = U.of(this._iid), a = i.cacheContext, o = i.statLogCollector; - return n === ig.CACHE_AND_REPLACE_BY_API && this._getLocalMessages(this._startingPoint, { prevLimit: this._prevResultLimit, nextLimit: this._nextResultLimit }).then(function(s) { - return T(t, void 0, void 0, function() { - var c; - return C(this, function(l) { - switch (l.label) { - case 0: - return c = this._filterUnderOffsetMessage(s), this._addMessagesToView(c, ne.REQUEST_MESSAGE), [4, this._loadUnsentMessages()]; - case 1: - return l.sent(), r._invokeResponse("local", null, c), [2]; - } - }); - }); - }).catch(function(s) { - if (qr(s)) - throw s; - r._invokeResponse("local", s, null); - }).finally(function() { - var s = U.of(t._iid).cacheContext; - t._getRemoteMessages(t._startingPoint, { prevLimit: t._prevResultLimit, nextLimit: t._nextResultLimit, reverse: !0, checkingHasNext: !0, checkingContinuousMessages: s.localCacheEnabled }).then(function(c) { - var l, u, d, h, f, p, v = c.messages, m = c.isContinuousMessages, E = c.hasNext, y = t._filterUnderOffsetMessage(v), _ = !0; - if (t._messages.length === y.length) { - var S = t._messages.map(function(x) { - return t.keyOf(x); - }); - for (var b in y) - if (!S.includes(t.keyOf(y[b]))) { - _ = !1; - break; - } - } else - _ = !1; - if (t._messages = [], y.length > 0) { - var A = y.map(function(x) { - return x.createdAt; - }), w = 0, M = 0; - for (b = 0; b < A.length; b++) { - var N = A[b]; - N < t._startingPoint ? w++ : N > t._startingPoint && M++; - } - t._hasPrevious = w >= t._prevResultLimit, t._hasNext = E ?? M >= t._nextResultLimit, (l = t._syncRange).extends.apply(l, dt([], tt(y.map(function(x) { - return x.createdAt; - })), !1)), m && ((u = t._backgroundSync) === null || u === void 0 || u.range.extends(t._syncRange.top, t._syncRange.bottom)), t._addMessagesToView(y, ne.REQUEST_MESSAGE); - } else - t._hasPrevious = !1, t._hasNext = !1; - o.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: t.channel.url, starting_point: t._startingPoint, measured_on: "initial_load", event: _ ? "cache_hit" : "cache_miss", max_db_size: (h = (d = s.localCacheConfig) === null || d === void 0 ? void 0 : d.maxSize) !== null && h !== void 0 ? h : 0, message_init_policy: n, use_local_cache: s.localCacheEnabled, collection_id: t._key } })), o.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: t.channel.url, starting_point: t._startingPoint, measured_on: "initial_load", event: "cache_fetch", max_db_size: (p = (f = s.localCacheConfig) === null || f === void 0 ? void 0 : f.maxSize) !== null && p !== void 0 ? p : 0, message_init_policy: n, use_local_cache: s.localCacheEnabled, collection_id: t._key } })), r._invokeResponse("remote", null, y); - }).catch(function(c) { - if (qr(c)) - throw c; - r._invokeResponse("remote", c, null); - }); - }), o.put(new rl({ type: Tn.FEATURE_LOCALCACHE, data: { use_local_cache: a.localCacheEnabled, collection_interface: { message_init_policy: n } } })), r; - }, e.prototype.loadPrevious = function() { - var n, t, r; - return T(this, void 0, void 0, function() { - var i, a, o, s, c, l, u, d, h = this; - return C(this, function(f) { - switch (f.label) { - case 0: - if (this._isDisposed) - throw new H({ code: nt.COLLECTION_DISPOSED, message: "Collection has been disposed." }); - return i = U.of(this._iid), a = i.cacheContext, o = i.statLogCollector, s = i.logger, this._hasPrevious ? this._isLoadingPrevious ? (s.warn("Messages are already fetching."), [2, []]) : (this._isLoadingPrevious = !0, c = this.viewTop, l = [], [4, Pn(function() { - return T(h, void 0, void 0, function() { - var p; - return C(this, function(v) { - switch (v.label) { - case 0: - return p = this._filterUnderOffsetMessage, [4, this._getLocalMessages(c, { prevLimit: this._prevResultLimit, inclusive: !1 })]; - case 1: - return l = p.apply(this, [v.sent()]), [2]; - } - }); - }); - })]) : [2, []]; - case 1: - return f.sent(), u = l.length >= this._prevResultLimit, o.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: this.channel.url, starting_point: this._startingPoint, measured_on: "load_prev", event: a.localCacheEnabled && u ? "cache_hit" : "cache_miss", max_db_size: (t = (n = a.localCacheConfig) === null || n === void 0 ? void 0 : n.maxSize) !== null && t !== void 0 ? t : 0, use_local_cache: a.localCacheEnabled, collection_id: this._key, message_init_policy: "" } })), u && (!((r = this._backgroundSync) === null || r === void 0) && r.isWrappingMessages(l)) ? [3, 3] : (d = !1, [4, Pn(function() { - return T(h, void 0, void 0, function() { - var p, v, m, E, y, _, S, b = this; - return C(this, function(A) { - switch (A.label) { - case 0: - return p = U.of(this._iid).cacheContext, [4, this._getRemoteMessages(c, { prevLimit: this._prevResultLimit, reverse: !0, checkingContinuousMessages: p.localCacheEnabled })]; - case 1: - return v = A.sent(), (l = this._filterUnderOffsetMessage(v.messages)).length > 0 && ((m = this._syncRange).extends.apply(m, dt([], tt(l.map(function(w) { - return w.createdAt; - })), !1)), !((E = this._backgroundSync) === null || E === void 0) && E.range.overlap(this._syncRange) && v.isContinuousMessages && (d = !0, (y = this._backgroundSync) === null || y === void 0 || y.range.extends(this._syncRange.top))), l = l.filter(function(w) { - return Si(b._messages, w) < 0; - }), this._hasPrevious = l.length >= this._prevResultLimit, d && o.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: this.channel.url, starting_point: this._startingPoint, measured_on: "load_prev", event: "cache_fetch", max_db_size: (S = (_ = p.localCacheConfig) === null || _ === void 0 ? void 0 : _.maxSize) !== null && S !== void 0 ? S : 0, use_local_cache: p.localCacheEnabled, collection_id: this._key, message_init_policy: "" } })), [2]; - } - }); - }); - })]); - case 2: - return f.sent(), this._addMessagesToView(l, ne.REQUEST_MESSAGE), [3, 4]; - case 3: - this._hasPrevious = l.length >= this._prevResultLimit, l.length > 0 && this._addMessagesToView(l, ne.REQUEST_MESSAGE), f.label = 4; - case 4: - return this._isLoadingPrevious = !1, [2, l]; - } - }); - }); - }, e.prototype.loadNext = function() { - var n, t, r; - return T(this, void 0, void 0, function() { - var i, a, o, s, c, l, u, d, h = this; - return C(this, function(f) { - switch (f.label) { - case 0: - if (this._isDisposed) - throw new H({ code: nt.COLLECTION_DISPOSED, message: "Collection has been disposed." }); - return i = U.of(this._iid), a = i.cacheContext, o = i.statLogCollector, s = i.logger, this._hasNext ? this._isLoadingNext ? (s.warn("Messages are already fetching."), [2, []]) : (this._isLoadingNext = !0, c = this.viewBottom, l = [], [4, Pn(function() { - return T(h, void 0, void 0, function() { - var p; - return C(this, function(v) { - switch (v.label) { - case 0: - return p = this._filterUnderOffsetMessage, [4, this._getLocalMessages(c, { nextLimit: this._nextResultLimit, inclusive: !1 })]; - case 1: - return l = p.apply(this, [v.sent()]), [2]; - } - }); - }); - })]) : [2, []]; - case 1: - return f.sent(), u = l.length >= this._nextResultLimit, o.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: this.channel.url, starting_point: this._startingPoint, measured_on: "load_next", event: a.localCacheEnabled && u ? "cache_hit" : "cache_miss", max_db_size: (t = (n = a.localCacheConfig) === null || n === void 0 ? void 0 : n.maxSize) !== null && t !== void 0 ? t : 0, use_local_cache: a.localCacheEnabled, collection_id: this._key, message_init_policy: "" } })), u && (!((r = this._backgroundSync) === null || r === void 0) && r.isWrappingMessages(l)) ? [3, 3] : (d = !1, [4, Pn(function() { - return T(h, void 0, void 0, function() { - var p, v, m, E, y, _, S, b, A = this; - return C(this, function(w) { - switch (w.label) { - case 0: - return p = U.of(this._iid).cacheContext, [4, this._getRemoteMessages(c, { nextLimit: this._nextResultLimit, reverse: !0, checkingHasNext: !0, checkingContinuousMessages: p.localCacheEnabled })]; - case 1: - return v = w.sent(), (l = this._filterUnderOffsetMessage(v.messages)).length > 0 && ((m = this._syncRange).extends.apply(m, dt([], tt(l.map(function(M) { - return M.createdAt; - })), !1)), !((E = this._backgroundSync) === null || E === void 0) && E.range.overlap(this._syncRange) && v.isContinuousMessages && (d = !0, (y = this._backgroundSync) === null || y === void 0 || y.range.extends(this._syncRange.bottom))), l = l.filter(function(M) { - return Si(A._messages, M) < 0; - }), this._hasNext = (_ = v.hasNext) !== null && _ !== void 0 ? _ : l.length >= this._nextResultLimit, d && o.put(new Sr({ type: Tn.FEATURE_LOCALCACHE_EVENT, ts: Date.now(), data: { channel_url: this.channel.url, starting_point: this._startingPoint, measured_on: "load_next", event: "cache_fetch", max_db_size: (b = (S = p.localCacheConfig) === null || S === void 0 ? void 0 : S.maxSize) !== null && b !== void 0 ? b : 0, use_local_cache: p.localCacheEnabled, collection_id: this._key, message_init_policy: "" } })), [2]; - } - }); - }); - })]); - case 2: - return f.sent(), this._addMessagesToView(l, ne.REQUEST_MESSAGE), [3, 4]; - case 3: - this._hasNext = l.length >= this._nextResultLimit, l.length > 0 && this._addMessagesToView(l, ne.REQUEST_MESSAGE), f.label = 4; - case 4: - return this._isLoadingNext = !1, [2, l]; - } - }); - }); - }, e.prototype.removeFailedMessage = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - if (this._isDisposed) - throw new H({ code: nt.COLLECTION_DISPOSED, message: "Collection has been disposed." }); - return [4, this._channelManager.removeFailedMessageFromCache(n)]; - case 1: - return r.sent(), (t = this._unsentMessages.findIndex(function(i) { - return i.reqId === n; - })) > -1 && this._unsentMessages.splice(t, 1), [2]; - } - }); - }); - }, e.prototype.dispose = function() { - var n, t, r, i = this; - if (!this._isDisposed) { - this._isDisposed = !0; - var a = U.of(this._iid), o = a.cacheContext, s = a.dispatcher; - this._messages = [], this._clearCheckMyMutedTimer(), this._channel._runIfHandleableWithGroupChannel(function(c) { - if (c.myMemberState !== Bn.NONE) { - i._channel._updateMessageCollectionLastAccessedAt(); - var l = i._createChannelUpdateEventCommand(ne.CHANNEL_LASTACCESSEDAT_UPDATED); - l && s.dispatch(l); - } - }), o.localCacheEnabled && (this._prevFill.stop(), this._nextFill.stop()), (n = this._backgroundSync) === null || n === void 0 || n.close(), (t = this._changelogSync) === null || t === void 0 || t.close(), (r = this._pollChangelogSync) === null || r === void 0 || r.close(), this._channelManager.unsubscribeChannelEvent(this._key), this._channelManager.unsubscribeMessageEvent(this._key), this._connectionEventContext && this._connectionEventContext.close(); - } - }, e; -}(), OP = function(e) { - function n(t, r) { - return e.call(this, t, L(L({}, r), { channelManager: cr.of(t) })) || this; - } - return O(n, e), n.prototype.keyOf = function(t) { - return t.messageId; - }, n.prototype.initialize = function(t) { - var r = this; - return Pn(function() { - return T(r, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return [4, this.channel.getMyMutedInfo()]; - case 1: - return (i = a.sent()).isMuted && i.remainingDuration !== -1 && this._startCheckMyMutedTimer(i.remainingDuration), [2]; - } - }); - }); - }), e.prototype.initialize.call(this, t); - }, n.prototype.setMessageCollectionHandler = function(t) { - this._setBaseMessageCollectionHandler(t); - }, n.prototype._activate = function() { - return T(this, void 0, void 0, function() { - var t = this; - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, e.prototype._activate.call(this)]; - case 1: - return r.sent(), [4, Pn(function() { - return T(t, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return [4, this.channel.getMyMutedInfo()]; - case 1: - return (i = a.sent()).isMuted && i.remainingDuration !== -1 && this._startCheckMyMutedTimer(i.remainingDuration), [2]; - } - }); - }); - })]; - case 2: - return r.sent(), [2]; - } - }); - }); - }, n.prototype._addMessagesToView = function(t, r) { - var i, a, o = this, s = this._filterUnderOffsetMessage(t), c = [], l = []; - try { - for (var u = Ne(s), d = u.next(); !d.done; d = u.next()) { - var h = d.value; - if (r === ne.SYNC_MESSAGE_FILL) - if (h.messageId > 0) { - if ((m = Si(this._messages, h)) < 0) { - Si(this._unsentMessages, h) < 0 && c.push(h); - var f = _0(this._messages, h); - this._messages.splice(f, 0, h); - } - } else - h instanceof Vn && (m = Si(this._unsentMessages, h)) < 0 && Si(this._messages, h) < 0 && (this._unsentMessages.push(h), c.push(h)); - else if (h.messageId > 0) { - if ((m = Si(this._messages, h)) < 0) { - var p = Si(this._unsentMessages, h); - p < 0 ? c.push(h) : (this._unsentMessages.splice(p, 1), l.push(h)), f = _0(this._messages, h), this._messages.splice(f, 0, h); - } else - l.push(h), this._messages[m] = h; - if (h.updatedAt > 0) { - var v = this._updateChildMessagesInView(h); - l.push.apply(l, dt([], tt(v), !1)); - } - } else if (h instanceof Vn) { - var m; - (m = Si(this._unsentMessages, h)) < 0 ? Si(this._messages, h) < 0 && (this._unsentMessages.push(h), c.push(h)) : (l.push(h), this._unsentMessages[m] = h); - } - } - } catch (E) { - i = { error: E }; - } finally { - try { - d && !d.done && (a = u.return) && a.call(u); - } finally { - if (i) - throw i.error; - } - } - po(r) && Ke(function() { - return T(o, void 0, void 0, function() { - var E, y, _, S, b; - return C(this, function(A) { - return E = this._createMessageEventContext(r), c.length > 0 && ((_ = (y = this._handler) === null || y === void 0 ? void 0 : y.onMessagesAdded) === null || _ === void 0 || _.call(y, E, this.channel, c)), l.length > 0 && ((b = (S = this._handler) === null || S === void 0 ? void 0 : S.onMessagesUpdated) === null || b === void 0 || b.call(S, E, this.channel, l)), [2]; - }); - }); - }); - }, n.prototype._updateMessagesToView = function(t, r) { - var i, a, o = this, s = [], c = [], l = []; - try { - for (var u = Ne(t), d = u.next(); !d.done; d = u.next()) { - var h, f = d.value; - if (f.messageId > 0) - if ((h = Si(this._messages, f)) >= 0) - c.push(f), this._messages[h] = f; - else { - var p = Si(this._unsentMessages, f); - if (p >= 0) { - var v = tt(this._unsentMessages.splice(p, 1), 1)[0]; - if (this.hasNext && v) - l.push(v); - else { - c.push(f); - var m = _0(this._messages, f); - this._messages.splice(m, 0, f); - } - } else { - var E = this._messages.map(function(y) { - return y.createdAt; - }); - (f.createdAt < Math.min.apply(Math, dt([], tt(E), !1)) && !this._hasPrevious || f.createdAt > Math.max.apply(Math, dt([], tt(E), !1)) && !this._hasNext) && s.push(f); - } - } - else - f instanceof Vn && (h = Si(this._unsentMessages, f)) >= 0 && (c.push(f), this._unsentMessages[h] = f); - } - } catch (y) { - i = { error: y }; - } finally { - try { - d && !d.done && (a = u.return) && a.call(u); - } finally { - if (i) - throw i.error; - } - } - return po(r) && Ke(function() { - return T(o, void 0, void 0, function() { - var y, _, S, b, A; - return C(this, function(w) { - return y = this._createMessageEventContext(r), c.length > 0 ? (S = (_ = this._handler) === null || _ === void 0 ? void 0 : _.onMessagesUpdated) === null || S === void 0 || S.call(_, y, this.channel, c) : l.length > 0 ? (A = (b = this._handler) === null || b === void 0 ? void 0 : b.onMessagesDeleted) === null || A === void 0 || A.call(b, y, this.channel, [], l) : s.length > 0 && this._addMessagesToView(s, r), [2]; - }); - }); - }), c; - }, n; -}(MP), xP = { coverUrl: void 0, coverImage: void 0, isDistinct: void 0, isPublic: void 0, isDiscoverable: void 0, accessCode: void 0, name: void 0, data: void 0, customType: void 0, operatorUserIds: void 0, messageSurvivalSeconds: void 0 }, RP = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.token, o = t.limit, s = t.order, c = t.mutedMemberFilter, l = t.memberStateFilter, u = t.nicknameStartsWithFilter, d = t.operatorFilter; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(xr, "/").concat(encodeURIComponent(i), "/members"), r.params = { token: a, limit: o, order: s, muted_member_filter: c, member_state_filter: l, nickname_startswith: u, operator_filter: d, show_member_is_muted: !0, show_read_receipt: !0, show_delivery_receipt: !0 }, r; - } - return O(n, e), n; -}(ge), DP = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - i.members = []; - var a = r.next, o = r.members; - return i.token = a, o && o.length > 0 && (i.members = o.map(function(s) { - return new Li(t, s); - })), i; - } - return O(n, e), n; -}(_e); -(function(e) { - e.ALL = "all", e.MUTED = "muted", e.UNMUTED = "unmuted"; -})($u || ($u = {})), function(e) { - e.MEMBER_NICKNAME_ALPHABETICAL = "member_nickname_alphabetical", e.OPERATOR_THEN_MEMBER_ALPHABETICAL = "operator_then_member_alphabetical"; -}(ed || (ed = {})), function(e) { - e.ALL = "all", e.JOINED = "joined_only", e.INVITED = "invited_only", e.INVITED_BY_FRIEND = "invited_by_friend", e.INVITED_BY_NON_FRIEND = "invited_by_non_friend"; -}(td || (td = {})); -var LP = function(e) { - function n(t, r, i) { - var a, o, s, c, l = this; - return (l = e.call(this, t, r, Ft.GROUP, i) || this).mutedMemberFilter = $u.ALL, l.memberStateFilter = td.ALL, l.nicknameStartsWithFilter = null, l.operatorFilter = hp.ALL, l.order = ed.MEMBER_NICKNAME_ALPHABETICAL, l.mutedMemberFilter = (a = i.mutedMemberFilter) !== null && a !== void 0 ? a : $u.ALL, l.memberStateFilter = (o = i.memberStateFilter) !== null && o !== void 0 ? o : td.ALL, l.nicknameStartsWithFilter = (s = i.nicknameStartsWithFilter) !== null && s !== void 0 ? s : null, l.order = (c = i.order) !== null && c !== void 0 ? c : ed.MEMBER_NICKNAME_ALPHABETICAL, l; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && Mt($u, this.mutedMemberFilter) && Mt(td, this.memberStateFilter) && (k("string", this.nicknameStartsWithFilter) || this.nicknameStartsWithFilter === null) && Mt(hp, this.operatorFilter) && Mt(ed, this.order); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new RP(Xe(L(L({}, this), { token: this._token }))), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = c.sent(), a = i.as(DP), o = a.members, s = a.token, this._token = s, this._hasNext = !!s, this._isLoading = !1, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(io), PP = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.userId, o = t.accessCode; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(xr, "/").concat(encodeURIComponent(i), "/accept"), r.params = { user_id: a, access_code: o }, r; - } - return O(n, e), n; -}(ge), kP = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.channel = new Hi(t, r), i.channel.myMemberState = Bn.JOINED, i; - } - return O(n, e), n; -}(_e), UP = function(e) { - function n(t) { - var r = this, i = t.channelUrl, a = t.isDistinct, o = t.isPublic, s = t.isDiscoverable, c = t.coverUrl, l = t.coverImage, u = t.accessCode, d = t.name, h = t.data, f = t.customType, p = t.operatorUserIds, v = t.messageSurvivalSeconds; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(xr, "/").concat(encodeURIComponent(i)), r.params = Be({ is_distinct: a, is_public: o, is_discoverable: s, name: d, data: h, custom_type: f, cover_url: c, cover_file: l, access_code: u, operator_ids: p, message_survival_seconds: v }), r; - } - return O(n, e), n; -}(ge), FP = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.channel = new Hi(t, r), i; - } - return O(n, e), n; -}(_e), BP = function(e) { - function n(t) { - var r = this, i = t.channelUrl; - return (r = e.call(this) || this).method = pe.DELETE, r.path = "".concat(xr, "/").concat(encodeURIComponent(i)), r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - return e.call(this, t, r) || this; - } - O(n, e); -})(_e); -var HP = function(e) { - function n(t) { - var r = this, i = t.channelUrl; - return (r = e.call(this) || this).method = pe.DELETE, r.path = "".concat(xr, "/").concat(encodeURIComponent(i), "/hide"), r; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var jP = function(e) { - function n(t) { - var r = t.userId, i = t.channelUrl, a = t.countPreference, o = e.call(this) || this; - return o.method = pe.PUT, o.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/count_preference/").concat(encodeURIComponent(i)), o.params = { count_preference: a }, o; - } - return O(n, e), n; -}(ge), VP = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.countPreference = r.count_preference, i; - } - return O(n, e), n; -}(_e), GP = function(e) { - function n(t) { - var r = this, i = t.channelUrl; - return (r = e.call(this) || this).method = pe.PUT, r.path = "".concat(xr, "/").concat(encodeURIComponent(i), "/reset_user_history"), r; - } - return O(n, e), n; -}(ge), zP = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this, a = r.ts_message_offset; - return i.messageOffsetTimestamp = a, i; - } - return O(n, e), n; -}(_e), qP = L(L({}, x1), { scheduledAt: void 0, file: void 0, fileUrl: void 0, fileName: void 0, mimeType: void 0, fileSize: void 0, thumbnailSizes: void 0, requireAuth: !1 }), KP = L(L({}, TA), { scheduledAt: void 0 }), WP = function(e) { - function n(t) { - var r, i, a = this; - a = e.call(this) || this; - var o = []; - t.mentionType === Or.USERS && (t.mentionedUserIds ? o = t.mentionedUserIds : t.mentionedUsers && (o = t.mentionedUsers.map(function(u) { - return u.userId; - }))); - var s = t.channelType, c = t.channelUrl, l = t.scheduledMessageId; - return a.method = pe.PUT, a.path = "".concat(Kt(s), "/").concat(encodeURIComponent(c), "/scheduled_messages/").concat(encodeURIComponent(l)), a.params = Be(Xe({ req_id: t.reqId, scheduled_at: t.scheduledAt, message_type: Sc.FILE, url: t.fileUrl, file_name: t.fileName, file_size: t.fileSize, file_type: t.mimeType, thumbnails: (r = t._thumbnails) === null || r === void 0 ? void 0 : r.map(function(u) { - return Uo.payloadify(u); - }), custom_type: t.customType, data: t.data, require_auth: t.requireAuth, mention_type: t.mentionType, mentioned_user_ids: o, sorted_metaarray: (i = t.metaArrays) === null || i === void 0 ? void 0 : i.map(function(u) { - return Br.payloadify(u); - }), apple_critical_alert_options: t.appleCriticalAlertOptions ? ia.payloadify(t.appleCriticalAlertOptions) : null, push_option: t.pushNotificationDeliveryOption })), a; - } - return O(n, e), n; -}(ge), YP = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.message = new qn(t, r), i; - } - return O(n, e), n; -}(_e), ZP = function(e) { - function n(t) { - var r, i = this; - i = e.call(this) || this; - var a = []; - t.mentionType === Or.USERS && (t.mentionedUserIds ? a = t.mentionedUserIds : t.mentionedUsers && (a = t.mentionedUsers.map(function(l) { - return l.userId; - }))); - var o = t.channelType, s = t.channelUrl, c = t.scheduledMessageId; - return i.method = pe.PUT, i.path = "".concat(Kt(o), "/").concat(encodeURIComponent(s), "/scheduled_messages/").concat(encodeURIComponent(c)), i.params = Be(Xe({ req_id: t.reqId, scheduled_at: t.scheduledAt, message_type: Sc.USER, message: t.message, custom_type: t.customType, data: t.data, mention_type: t.mentionType, mentioned_user_ids: a, sorted_metaarray: (r = t.metaArrays) === null || r === void 0 ? void 0 : r.map(function(l) { - return Br.payloadify(l); - }), apple_critical_alert_options: t.appleCriticalAlertOptions ? ia.payloadify(t.appleCriticalAlertOptions) : null, target_langs: t.translationTargetLanguages, push_option: t.pushNotificationDeliveryOption })), i; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.message = new Ar(t, r), i; - } - O(n, e); -})(_e); -var QP = function(e) { - function n(t) { - var r = e.call(this) || this, i = t.channelType, a = t.channelUrl, o = t.scheduledMessageId; - return r.method = pe.DELETE, r.path = "".concat(Kt(i), "/").concat(encodeURIComponent(a), "/scheduled_messages/").concat(encodeURIComponent(o)), r; - } - return O(n, e), n; -}(ge), XP = function(e) { - function n(t) { - var r = e.call(this) || this, i = t.channelType, a = t.channelUrl, o = t.scheduledMessageId; - return r.method = pe.POST, r.path = "".concat(Kt(i), "/").concat(encodeURIComponent(a), "/scheduled_messages/").concat(encodeURIComponent(o), "/send_now"), r; - } - return O(n, e), n; -}(ge), JP = function(e) { - function n(t) { - var r = t.userId, i = t.channelUrl, a = t.pushTriggerOption, o = e.call(this) || this; - return o.method = pe.PUT, o.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push_preference/").concat(encodeURIComponent(i)), o.params = { push_trigger_option: a }, o; - } - return O(n, e), n; -}(ge), $P = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.pushTriggerOption = r.push_trigger_option, i.enabled = r.enable, i; - } - return O(n, e), n; -}(_e), e7 = function(e) { - function n(t) { - var r = t.userId, i = t.channelUrl, a = e.call(this) || this; - return a.method = pe.GET, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push_preference/").concat(encodeURIComponent(i)), a; - } - return O(n, e), n; -}(ge), t7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.pushTriggerOption = r.push_trigger_option, i.enabled = r.enable, i; - } - return O(n, e), n; -}(_e), n7 = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = e.call(this) || this; - return o.method = pe.POST, o.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(a, "/pin"), o; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - return e.call(this, t, r) || this; - } - O(n, e); -})(_e); -var r7 = function(e) { - function n(t) { - var r = t.channelType, i = t.channelUrl, a = t.messageId, o = e.call(this) || this; - return o.method = pe.DELETE, o.path = "".concat(Kt(r), "/").concat(encodeURIComponent(i), "/messages/").concat(a, "/pin"), o; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - return e.call(this, t, r) || this; - } - O(n, e); -})(_e); -var Oi, Pr, i7 = function(e) { - function n(t, r) { - var i = e.call(this, t) || this; - return i.message = null, i.message = jr(t, r.message), i; - } - return O(n, e), n; -}(br), a7 = function(e) { - function n(t) { - var r = this, i = t.channelType, a = t.channelUrl, o = t.limit, s = t.token, c = t.includeReactions, l = t.includeMetaArray, u = t.includeParentMessageInfo, d = t.includeThreadInfo, h = t.includePollDetails; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(Kt(i), "/").concat(encodeURIComponent(a), "/pinned_messages"), r.params = Be({ limit: o, token: s, include_reactions: c, with_sorted_meta_array: l, include_thread_info: d, include_parent_message_info: u, include_poll_details: h }), r; - } - return O(n, e), n; -}(ge), o7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this, a = r.pinned_messages, o = r.has_more, s = r.next; - return i.pinnedMessages = a.map(function(c) { - return new i7(t, c); - }), i.hasMore = o, i.token = s, i; - } - return O(n, e), n; -}(_e), s7 = function(e) { - function n(t, r, i, a) { - var o = e.call(this, t, r, i, a) || this; - return o.includeMetaArray = a.includeMetaArray, o.includeReactions = a.includeReactions, o.includeParentMessageInfo = a.includeParentMessageInfo, o.includeThreadInfo = a.includeThreadInfo, o.includePollDetails = a.includePollDetails, o; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && k("boolean", this.includeMetaArray, !0) && k("boolean", this.includeReactions, !0) && k("boolean", this.includeParentMessageInfo, !0) && k("boolean", this.includeThreadInfo, !0) && k("boolean", this.includePollDetails, !0); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new a7(L(L({}, this), { token: this._token })), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = l.sent(), a = i.as(o7), o = a.pinnedMessages, s = a.hasMore, c = a.token, this._token = c, this._hasNext = !!s, this._isLoading = !1, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(io), l7 = function(e) { - function n(t, r) { - var i, a, o = this; - return (o = e.call(this, t) || this).channelUrl = (i = r.channel_url) !== null && i !== void 0 ? i : "", o.channelType = (a = r.channel_type) !== null && a !== void 0 ? a : Ft.GROUP, o.member = new Dt(o._iid, r.user), o.deliveryAt = r.ts, o; - } - return O(n, e), n; -}(br); -(function(e) { - e.ALL = "all", e.UNREAD_MESSAGE_COUNT_ONLY = "unread_message_count_only", e.UNREAD_MENTION_COUNT_ONLY = "unread_mention_count_only", e.OFF = "off"; -})(Oi || (Oi = {})), function(e) { - e.UNHIDDEN = "unhidden", e.HIDDEN_ALLOW_AUTO_UNHIDE = "hidden_allow_auto_unhide", e.HIDDEN_PREVENT_AUTO_UNHIDE = "hidden_prevent_auto_unhide"; -}(Pr || (Pr = {})); -var Hi = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M, N = this; - return (N = e.call(this, t, r) || this)._unreadMemberStateMap = /* @__PURE__ */ new Map(), N._undeliveredMemberStateMap = /* @__PURE__ */ new Map(), N._typingStatus = /* @__PURE__ */ new Map(), N._lastMemberCountUpdated = 0, N._typingStarted = 0, N._typingEnded = 0, N.isDistinct = !1, N.isSuper = !1, N.isBroadcast = !1, N.isExclusive = !1, N.isPublic = !1, N.isDiscoverable = !0, N.isChatNotification = !1, N.isAccessCodeRequired = !1, N.isPushEnabled = !1, N.unreadMessageCount = 0, N.unreadMentionCount = 0, N.totalUnreadReplyCount = 0, N.members = [], N.memberCount = 0, N.joinedMemberCount = 0, N.hiddenState = Pr.UNHIDDEN, N.lastMessage = null, N.messageOffsetTimestamp = 0, N.messageSurvivalSeconds = -1, N.myMemberState = Bn.NONE, N.myRole = ea.NONE, N.myMutedState = Ba.UNMUTED, N.myLastRead = 0, N.myCountPreference = Oi.ALL, N.myPushTriggerOption = el.DEFAULT, N.inviter = null, N.invitedAt = 0, N.joinedAt = 0, N.pinnedMessageIds = [], N.lastPinnedMessage = null, N._pinnedMessagesUpdatedAt = 0, N._myMutedRemainingTime = -1, N.channelType = Ft.GROUP, N.isDistinct = (a = r.is_distinct) !== null && a !== void 0 && a, N.isSuper = (o = r.is_super) !== null && o !== void 0 && o, N.isBroadcast = (s = r.is_broadcast) !== null && s !== void 0 && s, N.isExclusive = (c = r.is_exclusive) !== null && c !== void 0 && c, N.isPublic = (l = r.is_public) !== null && l !== void 0 && l, N.isDiscoverable = (u = r.is_discoverable) !== null && u !== void 0 ? u : N.isPublic, N.isChatNotification = (d = r.is_chat_notification) !== null && d !== void 0 && d, N.isAccessCodeRequired = (h = r.is_access_code_required) !== null && h !== void 0 && h, N.isPushEnabled = (f = r.is_push_enabled) !== null && f !== void 0 && f, Array.isArray(r.members) && (i = N.members).push.apply(i, dt([], tt(r.members.map(function(x) { - return new Li(N._iid, x); - })), !1)), N.memberCount = (p = r.member_count) !== null && p !== void 0 ? p : 0, N.joinedMemberCount = (v = r.joined_member_count) !== null && v !== void 0 ? v : 0, N.hiddenState = Mt(Pr, r.hidden_state) ? r.hidden_state : Pr.UNHIDDEN, N.messageOffsetTimestamp = (m = r.ts_message_offset) !== null && m !== void 0 ? m : 0, N.messageSurvivalSeconds = (E = r.message_survival_seconds) !== null && E !== void 0 ? E : -1, N.lastMessage = r.last_message ? jr(N._iid, L({ channel_type: N.channelType }, r.last_message)) : null, r.read_receipt && Object.keys(r.read_receipt).forEach(function(x) { - k("number", r.read_receipt[x]) && N._updateUnreadMemberState(x, r.read_receipt[x]); - }), r.delivery_receipt && Object.keys(r.delivery_receipt).forEach(function(x) { - k("number", r.delivery_receipt[x]) && N._updateUndeliveredMemberState(x, r.delivery_receipt[x]); - }), N.myMemberState = Mt(Bn, r.member_state) ? r.member_state : Bn.NONE, N.myRole = Mt(ea, r.my_role) ? r.my_role : ea.NONE, Mt(Ba, r.is_muted) ? N.myMutedState = r.is_muted : k("boolean", r.is_muted) ? N.myMutedState = r.is_muted ? Ba.MUTED : Ba.UNMUTED : N.myMutedState = Ba.UNMUTED, N.myCountPreference = Mt(Oi, r.count_preference) ? r.count_preference : Oi.ALL, N.myPushTriggerOption = Mt(el, r.push_trigger_option) ? r.push_trigger_option : el.ALL, N.myLastRead = (y = r.user_last_read) !== null && y !== void 0 ? y : 0, N.inviter = r.inviter ? new Dt(N._iid, r.inviter) : null, N.invitedAt = (_ = r.invited_at) !== null && _ !== void 0 ? _ : 0, N.joinedAt = (S = r.joined_ts) !== null && S !== void 0 ? S : 0, N._updateUnreadCount((b = r.unread_message_count) !== null && b !== void 0 ? b : 0, (A = r.unread_mention_count) !== null && A !== void 0 ? A : 0), N.totalUnreadReplyCount = (w = r.total_unread_thread_message_count) !== null && w !== void 0 ? w : 0, N.pinnedMessageIds = (M = r.pinned_message_ids) !== null && M !== void 0 ? M : [], N.lastPinnedMessage = r.latest_pinned_message ? jr(N._iid, L({ channel_type: N.channelType }, r.latest_pinned_message)) : null, N; - } - return O(n, e), Object.defineProperty(n.prototype, "isHidden", { get: function() { - return this.hiddenState !== Pr.UNHIDDEN; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isTyping", { get: function() { - return this._typingStatus.size > 0; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "cachedUnreadMemberState", { get: function() { - var t, r, i = {}; - try { - for (var a = Ne(this._unreadMemberStateMap), o = a.next(); !o.done; o = a.next()) { - var s = tt(o.value, 2), c = s[0], l = s[1]; - i[c] = l; - } - } catch (u) { - t = { error: u }; - } finally { - try { - o && !o.done && (r = a.return) && r.call(a); - } finally { - if (t) - throw t.error; - } - } - return i; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "cachedUndeliveredMemberState", { get: function() { - var t, r, i = {}; - try { - for (var a = Ne(this._undeliveredMemberStateMap), o = a.next(); !o.done; o = a.next()) { - var s = tt(o.value, 2), c = s[0], l = s[1]; - i[c] = l; - } - } catch (u) { - t = { error: u }; - } finally { - try { - o && !o.done && (r = a.return) && r.call(a); - } finally { - if (t) - throw t.error; - } - } - return i; - }, enumerable: !1, configurable: !0 }), n.payloadify = function(t) { - return Be(Xe(L(L({}, e.payloadify.call(this, t)), { is_access_code_required: t.isAccessCodeRequired, is_distinct: t.isDistinct, is_super: t.isSuper, is_broadcast: t.isBroadcast, is_exclusive: t.isExclusive, is_public: t.isPublic, is_discoverable: t.isDiscoverable, is_muted: t.myMutedState, is_push_enabled: t.isPushEnabled, unread_message_count: t.unreadMessageCount, unread_mention_count: t.unreadMentionCount, total_unread_thread_message_count: t.totalUnreadReplyCount, push_trigger_option: t.myPushTriggerOption, count_preference: t.myCountPreference, hidden_state: t.hiddenState, member_count: t.memberCount, joined_member_count: t.joinedMemberCount, member_state: t.myMemberState, my_role: t.myRole, user_last_read: t.myLastRead, ts_message_offset: t.messageOffsetTimestamp, message_survival_seconds: t.messageSurvivalSeconds, read_receipt: t.cachedUnreadMemberState, delivery_receipt: t.cachedUndeliveredMemberState, members: t.members.map(function(r) { - return Li.payloadify(r); - }), last_message: t.lastMessage ? mb(t.lastMessage) : null, inviter: t.inviter ? Dt.payloadify(t.inviter) : null, invited_at: t.invitedAt, joined_ts: t.joinedAt, pinned_message_ids: t.pinnedMessageIds, latest_pinned_message: t.lastPinnedMessage ? mb(t.lastPinnedMessage) : null }))); - }, n.prototype._shouldUpdateLastMessageWith = function(t) { - return !(t instanceof Vn && t.parentMessageId > 0 && !t.replyToChannel) && !t.silent && (!this.lastMessage || this.lastMessage.createdAt < t.createdAt || this.lastMessage.createdAt === t.createdAt && this.lastMessage.messageId === t.messageId && this.lastMessage.updatedAt < t.updatedAt); - }, n.prototype._tryUpdateLastMessageAndCallEvents = function(t, r) { - var i = U.of(this._iid).dispatcher, a = cr.of(this._iid); - this._updateLastMessage(r), a.handlers.map(function(o) { - o.onChannelChanged && o.onChannelChanged(t); - }), i.dispatch(new Ut({ channels: [t], source: ne.EVENT_MESSAGE_SENT })); - }, n.prototype._updateLastMessage = function(t) { - return !!this._shouldUpdateLastMessageWith(t) && (this.lastMessage = t, !0); - }, n.prototype._updateUnreadCount = function(t, r) { - if (typeof t == "number" && t >= 0) - if (this.myCountPreference === Oi.ALL || this.myCountPreference === Oi.UNREAD_MESSAGE_COUNT_ONLY) - if (this.isExclusive || this.isSuper || this.isBroadcast) { - var i = U.of(this._iid).maxSuperGroupChannelUnreadCount; - this.unreadMessageCount = i && t >= i ? i : t; - } else - this.unreadMessageCount = t; - else - this.unreadMessageCount = 0; - else - this.unreadMessageCount = 0; - typeof r == "number" && r >= 0 && (this.myCountPreference === Oi.ALL || this.myCountPreference === Oi.UNREAD_MENTION_COUNT_ONLY) ? this.unreadMentionCount = r : this.unreadMentionCount = 0; - }, n.prototype._updateUnreadMemberState = function(t, r) { - var i = this._unreadMemberStateMap.get(t); - return (!i || i < r) && (this._unreadMemberStateMap.set(t, r), U.of(this._iid).sdkState.userId === t && (this.myLastRead = r), !0); - }, n.prototype._updateUndeliveredMemberState = function(t, r) { - var i = this._undeliveredMemberStateMap.get(t); - return (!i || i < r) && (this._undeliveredMemberStateMap.set(t, r), !0); - }, n.prototype._updateTypingStatus = function(t, r) { - r === void 0 && (r = (/* @__PURE__ */ new Date()).getTime()), r > 0 ? this._typingStatus.set(t.userId, { user: t, ts: r }) : this._typingStatus.delete(t.userId); - }, n.prototype._clearTypingStatus = function() { - this._typingStatus.clear(), this._typingStarted = 0, this._typingEnded = 0; - }, n.prototype._setLatestMemberCount = function(t, r, i) { - var a = !1; - return i >= this._lastMemberCountUpdated && (this._lastMemberCountUpdated = i, a = t !== this.memberCount || r !== this.joinedMemberCount, this.memberCount = t, this.joinedMemberCount = r), a; - }, n.prototype.isReadMessage = function(t) { - var r = U.of(this._iid).sdkState, i = this._unreadMemberStateMap.get(r.userId); - return !!i && i >= t.createdAt; - }, n.prototype.serialize = function() { - var t = this; - return qc(this, function(r) { - r.cachedUnreadMemberState = t.cachedUnreadMemberState, r.cachedUndeliveredMemberState = t.cachedUndeliveredMemberState; - }); - }, n.prototype.createMessageCollection = function(t) { - return t === void 0 && (t = {}), new OP(this._iid, L(L({}, t), { channel: this })); - }, n.prototype.createMemberListQuery = function(t) { - return t === void 0 && (t = {}), new LP(this._iid, this.url, t); - }, n.prototype.createThreadedParentMessageListQuery = function(t) { - return t === void 0 && (t = {}), new TL(this._iid, this.url, this.channelType, t); - }, n.prototype.createPinnedMessageListQuery = function(t) { - return t === void 0 && (t = {}), new s7(this._iid, this.url, this.channelType, t); - }, n.prototype.addMember = function(t, r) { - if (r === void 0 && (r = 0), !this.isExclusive && !this.isSuper && !this.isBroadcast) { - var i = this.members.findIndex(function(o) { - return o.userId === t.userId; - }); - if (i > -1) { - var a = this.members[i]; - a.state === Bn.JOINED && (t.state = a.state), this.members.splice(i, 1), this.memberCount--; - } - this.members.push(t), this.memberCount++, this._updateUnreadMemberState(t.userId, r), this._updateUndeliveredMemberState(t.userId, r); - } - }, n.prototype.removeMember = function(t) { - if (!this.isExclusive && !this.isSuper && !this.isBroadcast) { - var r = t instanceof Li ? t.userId : t, i = this.members.findIndex(function(a) { - return a.userId === r; - }); - if (i > -1) - return this.members.splice(i, 1), this.memberCount--, !0; - } - return !1; - }, n.prototype.getUnreadMemberCount = function(t) { - var r, i; - if (t instanceof Vn && !this.isExclusive && !this.isSuper && !this.isBroadcast) { - var a = U.of(this._iid).sdkState, o = t.createdAt, s = 0; - try { - for (var c = Ne(this.members), l = c.next(); !l.done; l = c.next()) { - var u = l.value; - a.userId !== u.userId && u.state === Bn.JOINED && t.sender.userId !== u.userId && (this.cachedUnreadMemberState[u.userId] || 0) < o && s++; - } - } catch (d) { - r = { error: d }; - } finally { - try { - l && !l.done && (i = c.return) && i.call(c); - } finally { - if (r) - throw r.error; - } - } - return s; - } - return 0; - }, n.prototype.getUndeliveredMemberCount = function(t) { - var r, i; - if (t instanceof Vn && !this.isExclusive && !this.isSuper && !this.isBroadcast) { - var a = U.of(this._iid).sdkState, o = t.createdAt, s = 0; - try { - for (var c = Ne(this.members), l = c.next(); !l.done; l = c.next()) { - var u = l.value; - a.userId !== u.userId && u.state === Bn.JOINED && t.sender.userId !== u.userId && (this.cachedUndeliveredMemberState[u.userId] || 0) < o && s++; - } - } catch (d) { - r = { error: d }; - } finally { - try { - l && !l.done && (i = c.return) && i.call(c); - } finally { - if (r) - throw r.error; - } - } - return s; - } - return 0; - }, n.prototype.getReadMembers = function(t, r) { - var i = this; - r === void 0 && (r = !1); - var a = U.of(this._iid).sdkState; - if (!a.userId || this.isExclusive || this.isSuper || this.isBroadcast) - return []; - var o = t instanceof Vn ? t.sender : null, s = []; - return this.members.forEach(function(c) { - if (r || c.userId !== a.userId && c.userId !== (o == null ? void 0 : o.userId)) { - var l = i._unreadMemberStateMap.get(c.userId); - l && l >= t.createdAt && s.push(c); - } - }), s; - }, n.prototype.getUnreadMembers = function(t, r) { - var i = this; - r === void 0 && (r = !1); - var a = U.of(this._iid).sdkState; - if (!a.userId || this.isExclusive || this.isSuper || this.isBroadcast) - return []; - var o = t instanceof Vn ? t.sender : null, s = []; - return this.members.forEach(function(c) { - if (r || c.userId !== a.userId && c.userId !== (o == null ? void 0 : o.userId)) { - var l = i._unreadMemberStateMap.get(c.userId); - l && l < t.createdAt && s.push(c); - } - }), s; - }, n.prototype.getReadStatus = function(t) { - var r = this; - t === void 0 && (t = !1); - var i = U.of(this._iid).sdkState; - if (!i.userId || this.isExclusive || this.isSuper || this.isBroadcast) - return null; - var a = {}; - return this.members.forEach(function(o) { - if (t || o.userId !== i.userId) { - var s = r._unreadMemberStateMap.get(o.userId); - a[o.userId] = new vA(r._iid, { channel_url: r.url, channel_type: r.channelType, user: Li.payloadify(o), ts: s ?? 0 }); - } - }), a; - }, n.prototype.getDeliveryStatus = function(t) { - var r = this; - t === void 0 && (t = !0); - var i = U.of(this._iid).sdkState; - if (!i.userId || this.isExclusive || this.isSuper || this.isBroadcast) - return null; - var a = {}; - return this.members.forEach(function(o) { - if (t || o.userId !== i.userId) { - var s = r._undeliveredMemberStateMap.get(o.userId); - a[o.userId] = new l7(r._iid, { channel_url: r.url, channel_type: r.channelType, user: Li.payloadify(o), ts: s ?? 0 }); - } - }), a; - }, n.prototype.getTypingUsers = function() { - var t = []; - return this._typingStatus.forEach(function(r) { - var i = r.user; - t.push(i); - }), t; - }, n.prototype.invalidateTypingStatus = function() { - var t = this, r = U.of(this._iid).typingIndicatorInvalidateTime, i = Date.now(), a = !1; - return this._typingStatus.forEach(function(o, s) { - var c = o.ts; - i - c >= r && (t._typingStatus.delete(s), a = !0); - }), a; - }, n.prototype.refresh = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return [2, this._refresh()]; - }); - }); - }, n.prototype._refresh = function(t) { - return t === void 0 && (t = !1), T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return r = U.of(this._iid), i = r.requestQueue, a = r.dispatcher, o = new tg({ channelUrl: this.url }), [4, i.send(o)]; - case 1: - return s = l.sent(), c = s.as(ng).channel, this._update(c), t || a.dispatch(new Ut({ channels: [c], source: ne.REFRESH_CHANNEL })), [2, this]; - } - }); - }); - }, n.prototype.freeze = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, e.prototype.freeze.call(this)]; - case 1: - return t.sent(), U.of(this._iid).dispatcher.dispatch(new Ut({ channels: [this], source: ne.EVENT_CHANNEL_FROZEN, isWebSocketEventComing: !0 })), [2]; - } - }); - }); - }, n.prototype.unfreeze = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, e.prototype.unfreeze.call(this)]; - case 1: - return t.sent(), U.of(this._iid).dispatcher.dispatch(new Ut({ channels: [this], source: ne.EVENT_CHANNEL_UNFROZEN, isWebSocketEventComing: !0 })), [2]; - } - }); - }); - }, n.prototype.updateChannel = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return r = L(L({}, xP), t), ve(function(d) { - return k("string", d.coverUrl, !0) && (fr(d.coverImage) || k("string", d.coverImage, !0)) && k("boolean", d.isDistinct, !0) && k("boolean", d.isPublic, !0) && k("boolean", d.isDiscoverable, !0) && k("string", d.accessCode, !0) && k("string", d.name, !0) && k("string", d.data, !0) && k("string", d.customType, !0) && Ot("string", d.operatorUserIds, !0) && k("number", d.messageSurvivalSeconds, !0); - }(r)).throw(H.invalidParameters), i = U.of(this._iid), a = i.dispatcher, o = i.requestQueue, s = new UP(L({ channelUrl: this.url }, r)), [4, o.send(s)]; - case 1: - return c = u.sent(), l = c.as(FP).channel, this._update(l), a.dispatch(new Ut({ channels: [l], source: ne.EVENT_CHANNEL_UPDATED, isWebSocketEventComing: !0 })), [2, this]; - } - }); - }); - }, n.prototype.invite = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return ve(t.every(function(i) { - return i instanceof Dt; - })).throw(H.invalidParameters), [2, this.inviteWithUserIds(t.map(function(i) { - return i.userId; - }))]; - }); - }); - }, n.prototype.inviteWithUserIds = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return ve(Ot("string", t)).throw(H.invalidParameters), r = U.of(this._iid), i = r.dispatcher, a = r.requestQueue, o = new rP({ channelUrl: this.url, userIds: t }), [4, a.send(o)]; - case 1: - return s = l.sent(), c = s.as(iP).channel, this._update(c), i.dispatch(new Ut({ channels: [c], source: ne.EVENT_CHANNEL_INVITED, isWebSocketEventComing: !0 })), [2, this]; - } - }); - }); - }, n.prototype.join = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return ve(k("string", t, !0)).throw(H.invalidParameters), r = U.of(this._iid), i = r.dispatcher, a = r.sdkState, o = r.requestQueue, s = new JL({ channelUrl: this.url, userId: a.userId, accessCode: t }), [4, o.send(s)]; - case 1: - return c = u.sent(), (l = c.as($L).channel).myMemberState = this.myMemberState = Bn.JOINED, this._update(l), i.dispatch(new Ut({ channels: [l], source: ne.EVENT_CHANNEL_JOINED, isWebSocketEventComing: !0 })), [2, this]; - } - }); - }); - }, n.prototype.leave = function(t) { - return t === void 0 && (t = !1), T(this, void 0, void 0, function() { - var r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return r = U.of(this._iid), i = r.sdkState, a = r.requestQueue, o = new tP({ channelUrl: this.url, userId: i.userId, shouldRemoveOperatorStatus: t }), [4, a.send(o)]; - case 1: - return s.sent(), this.myMemberState = Bn.NONE, [2]; - } - }); - }); - }, n.prototype.acceptInvitation = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return ve(k("string", t, !0)).throw(H.invalidParameters), r = U.of(this._iid), i = r.dispatcher, a = r.sdkState, o = r.requestQueue, s = new PP({ channelUrl: this.url, userId: a.userId, accessCode: t }), [4, o.send(s)]; - case 1: - return c = u.sent(), (l = c.as(kP).channel).myMemberState = this.myMemberState = Bn.JOINED, this._update(l), i.dispatch(new Ut({ channels: [l], source: ne.EVENT_CHANNEL_ACCEPTED_INVITE, isWebSocketEventComing: !0 })), [2, this]; - } - }); - }); - }, n.prototype.declineInvitation = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new oP({ channelUrl: this.url, userId: r.userId }), [4, i.send(a)]; - case 1: - return o.sent(), this.myMemberState = Bn.NONE, [2, this]; - } - }); - }); - }, n.prototype.sendUserMessage = function(t) { - var r = this, i = new di(), a = U.of(this._iid).dispatcher, o = Mu.of(this._iid); - return e.prototype.sendUserMessage.call(this, t).onPending(function(s) { - o.completeCurrentAndProcessNextAutoResend(s), i._trigger(s); - }).onFailed(function(s, c) { - c && o.completeCurrentAndProcessNextAutoResend(c), i._triggerFailed(s, c); - }).onSucceeded(function(s) { - r.hiddenState === Pr.HIDDEN_ALLOW_AUTO_UNHIDE && (r.hiddenState = Pr.UNHIDDEN), o.completeCurrentAndProcessNextAutoResend(s), r._updateLastMessage(s), cr.of(r._iid).handlers.map(function(c) { - c.onChannelChanged && c.onChannelChanged(r); - }), a.dispatch(new Ut({ channels: [r], source: ne.EVENT_MESSAGE_SENT })), i._trigger(s); - }), i; - }, n.prototype.updateUserMessage = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s, c = this; - return C(this, function(l) { - switch (l.label) { - case 0: - return i = U.of(this._iid).dispatcher, [4, e.prototype.updateUserMessage.call(this, t, r)]; - case 1: - return a = l.sent(), o = this._updateLastMessage(a), s = !1, this.lastPinnedMessage && this.lastPinnedMessage.messageId === a.messageId && (this.lastPinnedMessage = a, o = !0, s = !0), o && (cr.of(this._iid).handlers.map(function(u) { - u.onChannelChanged && u.onChannelChanged(c); - }), i.dispatch(new Ut({ channels: [this], source: s ? ne.EVENT_PINNED_MESSAGE_UPDATED : ne.EVENT_MESSAGE_UPDATED }))), s && cr.of(this._iid).handlers.map(function(u) { - u.onPinnedMessageUpdated && u.onPinnedMessageUpdated(c); - }), i.dispatch(new Sn({ messages: [a], source: ne.EVENT_MESSAGE_UPDATED })), [2, a]; - } - }); - }); - }, n.prototype._autoResendUserMessage = function(t) { - var r = this, i = new di(), a = U.of(this._iid).dispatcher, o = Mu.of(this._iid); - return e.prototype._autoResendUserMessage.call(this, t).onPending(function(s) { - o.completeCurrentAndProcessNextAutoResend(s), i._trigger(s); - }).onFailed(function(s, c) { - o.completeCurrentAndProcessNextAutoResend(c), i._triggerFailed(s, c); - }).onSucceeded(function(s) { - var c = cr.of(r._iid); - o.completeCurrentAndProcessNextAutoResend(s), r._updateLastMessage(s), c.handlers.map(function(l) { - l.onChannelChanged && l.onChannelChanged(r); - }), a.dispatch(new Ut({ channels: [r], source: ne.EVENT_MESSAGE_SENT })), i._trigger(s); - }), i; - }, n.prototype.sendFileMessage = function(t) { - var r = this, i = new di(), a = U.of(this._iid).dispatcher, o = Mu.of(this._iid); - return e.prototype.sendFileMessage.call(this, t).onPending(function(s) { - o.completeCurrentAndProcessNextAutoResend(s), i._trigger(s); - }).onFailed(function(s, c) { - c && o.completeCurrentAndProcessNextAutoResend(c), i._triggerFailed(s, c); - }).onSucceeded(function(s) { - var c = cr.of(r._iid); - o.completeCurrentAndProcessNextAutoResend(s), r._updateLastMessage(s), c.handlers.map(function(l) { - l.onChannelChanged && l.onChannelChanged(r); - }), a.dispatch(new Ut({ channels: [r], source: ne.EVENT_MESSAGE_SENT })), i._trigger(s); - }), i; - }, n.prototype.sendMultipleFilesMessage = function(t) { - var r = this, i = new Nf(), a = U.of(this._iid).dispatcher; - return e.prototype.sendMultipleFilesMessage.call(this, t).onPending(function(o) { - i._trigger(o); - }).onFailed(function(o, s) { - i._triggerFailed(o, s); - }).onSucceeded(function(o) { - var s = cr.of(r._iid); - r._updateLastMessage(o), s.handlers.map(function(c) { - c.onChannelChanged && c.onChannelChanged(r); - }), a.dispatch(new Ut({ channels: [r], source: ne.EVENT_MESSAGE_SENT })), i._trigger(o); - }).onFileUploaded(function(o, s, c, l) { - i._triggerOnFileUploaded(o, s, c, l); - }), i; - }, n.prototype.updateFileMessage = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s, c = this; - return C(this, function(l) { - switch (l.label) { - case 0: - return i = U.of(this._iid).dispatcher, [4, e.prototype.updateFileMessage.call(this, t, r)]; - case 1: - return a = l.sent(), o = this._updateLastMessage(a), s = !1, this.lastPinnedMessage && this.lastPinnedMessage.messageId === a.messageId && (this.lastPinnedMessage = a, o = !0, s = !0), o && (cr.of(this._iid).handlers.map(function(u) { - u.onChannelChanged && u.onChannelChanged(c); - }), i.dispatch(new Ut({ channels: [this], source: s ? ne.EVENT_PINNED_MESSAGE_UPDATED : ne.EVENT_MESSAGE_UPDATED }))), s && cr.of(this._iid).handlers.map(function(u) { - u.onPinnedMessageUpdated && u.onPinnedMessageUpdated(c); - }), i.dispatch(new Sn({ messages: [a], source: ne.EVENT_MESSAGE_UPDATED })), [2, a]; - } - }); - }); - }, n.prototype._autoResendFileMessage = function(t) { - var r = this, i = new di(), a = U.of(this._iid).dispatcher, o = Mu.of(this._iid); - return e.prototype._autoResendFileMessage.call(this, t).onPending(function(s) { - o.completeCurrentAndProcessNextAutoResend(s), i._trigger(s); - }).onFailed(function(s, c) { - o.completeCurrentAndProcessNextAutoResend(c), i._triggerFailed(s, c); - }).onSucceeded(function(s) { - var c = cr.of(r._iid); - o.completeCurrentAndProcessNextAutoResend(s), r._updateLastMessage(s), c.handlers.map(function(l) { - l.onChannelChanged && l.onChannelChanged(r); - }), a.dispatch(new Ut({ channels: [r], source: ne.EVENT_MESSAGE_SENT })), i._trigger(s); - }), i; - }, n.prototype.deleteMessage = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, e.prototype.deleteMessage.call(this, t)]; - case 1: - return r.sent(), t.messageId === 0 && t instanceof Vn && U.of(this._iid).dispatcher.dispatch(new rA({ reqId: t.reqId, source: ne.EVENT_MESSAGE_DELETED })), [2]; - } - }); - }); - }, n.prototype.hide = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u; - return C(this, function(d) { - switch (d.label) { - case 0: - return r = L(L({}, rg), t), ve(function(h) { - return k("boolean", h.hidePreviousMessages, !0) && k("boolean", h.allowAutoUnhide, !0); - }(r)).throw(H.invalidParameters), i = U.of(this._iid), a = i.dispatcher, o = i.sdkState, s = i.requestQueue, c = new lP(L({ channelUrl: this.url, userId: o.userId }, r)), [4, s.send(c)]; - case 1: - return l = d.sent(), u = l.as(cP).messageOffsetTimestamp, this.hiddenState = r.allowAutoUnhide ? Pr.HIDDEN_ALLOW_AUTO_UNHIDE : Pr.HIDDEN_PREVENT_AUTO_UNHIDE, r.hidePreviousMessages && this._updateUnreadCount(0, 0), u && (this.messageOffsetTimestamp = u), a.dispatch(new Ut({ channels: [this], source: ne.EVENT_CHANNEL_HIDDEN, isWebSocketEventComing: !0 })), [2, this]; - } - }); - }); - }, n.prototype.unhide = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return t = U.of(this._iid), r = t.dispatcher, i = t.requestQueue, a = new HP({ channelUrl: this.url }), [4, i.send(a)]; - case 1: - return o.sent(), this.hiddenState = Pr.UNHIDDEN, r.dispatch(new Ut({ channels: [this], source: ne.EVENT_CHANNEL_UNHIDDEN, isWebSocketEventComing: !0 })), [2, this]; - } - }); - }); - }, n.prototype.delete = function() { - return T(this, void 0, void 0, function() { - var t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new BP({ channelUrl: this.url }), [4, t.send(r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.markAsRead = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l = this; - return C(this, function(u) { - switch (u.label) { - case 0: - return t = U.of(this._iid), r = t.sdkState, i = t.dispatcher, a = t.requestQueue, o = new sD({ channelUrl: this.url }), [4, a.send(o)]; - case 1: - return s = u.sent(), c = s.as(mA).readStatus, this._updateUnreadMemberState(r.userId, c.readAt), (this.unreadMessageCount > 0 || this.unreadMentionCount > 0) && (this._updateUnreadCount(0, 0), cr.of(this._iid).handlers.map(function(d) { - d.onChannelChanged && d.onChannelChanged(l); - })), i.dispatch(new Ut({ channels: [this], source: ne.EVENT_CHANNEL_READ })), [2]; - } - }); - }); - }, n.prototype.markAsDelivered = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new gP({ channelUrl: this.url, userId: r.userId }), [4, i.send(a)]; - case 1: - return o.sent(), [2]; - } - }); - }); - }, n.prototype.startTyping = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return t = U.of(this._iid), r = t.requestQueue, i = t.typingIndicatorThrottle, (a = (/* @__PURE__ */ new Date()).getTime()) - this._typingStarted >= i ? (this._typingStarted = a, this._typingEnded = 0, o = new dP({ channelUrl: this.url, time: this._typingStarted }), [4, r.send(o)]) : [3, 2]; - case 1: - s.sent(), s.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.endTyping = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return t = U.of(this._iid), r = t.requestQueue, i = t.typingIndicatorThrottle, (a = (/* @__PURE__ */ new Date()).getTime()) - this._typingEnded >= i ? (this._typingStarted = 0, this._typingEnded = a, o = new fP({ channelUrl: this.url, time: this._typingStarted }), [4, r.send(o)]) : [3, 2]; - case 1: - s.sent(), s.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.createScheduledUserMessage = function(t) { - t = L(L({}, sL), t), ve(lL(t)).throw(H.invalidParameters); - var r = new di(); - return this._createScheduledUserMessage(t, r), r; - }, n.prototype.updateScheduledUserMessage = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return i = L(L({}, KP), r), ve(function(l) { - return SA(l) && k("number", l.scheduledAt, !0); - }(i)).throw(H.invalidParameters), a = U.of(this._iid).requestQueue, o = new ZP(L({ reqId: this._generateRequestId(), scheduledMessageId: t, channelType: this.channelType, channelUrl: this.url }, i)), [4, a.send(o)]; - case 1: - return s = c.sent(), [2, s.as(DA).message]; - } - }); - }); - }, n.prototype.createScheduledFileMessage = function(t) { - var r = this; - t = L(L({}, cL), t), ve(uL(t)).throw(H.invalidParameters); - var i = Date.now(), a = this._generateRequestId(), o = new di(); - return Mi(F5).then(function() { - var s = r._createPendingScheduledFileMessage(t, a, i); - Ke(function() { - return T(r, void 0, void 0, function() { - return C(this, function(c) { - return [2, o._trigger(s)]; - }); - }); - }); - }), fr(t.file) ? this._uploadFileAndUpdateParams(t).then(function() { - return r._createScheduledFileMessage(t, o, a, i); - }) : this._createScheduledFileMessage(t, o, a, i), o; - }, n.prototype.updateScheduledFileMessage = function(t, r) { - return T(this, void 0, void 0, function() { - var i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return i = L(L({}, qP), r), ve(function(c) { - return R1(c) && k("number", c.scheduledAt, !0) && (fr(c.file) || k("string", c.fileUrl)) && k("string", c.fileName, !0) && k("string", c.mimeType, !0) && k("number", c.fileSize, !0) && (c.thumbnailSizes === null || c.thumbnailSizes === void 0 || c.thumbnailSizes.every(function(l) { - return k("object", l) && l.maxWidth > 0 && l.maxHeight > 0; - })); - }(i)).throw(H.invalidParameters), fr(i.file) ? [4, this._uploadFileAndUpdateParams(i)] : [3, 2]; - case 1: - s.sent(), s.label = 2; - case 2: - return a = new WP(L({ reqId: this._generateRequestId(), scheduledMessageId: t, channelType: this.channelType, channelUrl: this.url }, i)), [4, U.of(this._iid).requestQueue.send(a)]; - case 3: - return o = s.sent(), [2, o.as(YP).message]; - } - }); - }); - }, n.prototype.cancelScheduledMessage = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = new QP({ scheduledMessageId: t, channelType: this.channelType, channelUrl: this.url }), [4, U.of(this._iid).requestQueue.send(r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.sendScheduledMessageNow = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - switch (i.label) { - case 0: - return r = new XP({ scheduledMessageId: t, channelType: this.channelType, channelUrl: this.url }), [4, U.of(this._iid).requestQueue.send(r)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, n.prototype.getMyPushTriggerOption = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new e7({ userId: r.userId, channelUrl: this.url }), [4, i.send(a)]; - case 1: - return o = c.sent(), s = o.as(t7).pushTriggerOption, this.myPushTriggerOption = s, [2, s]; - } - }); - }); - }, n.prototype.setMyPushTriggerOption = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return ve(Mt(el, t)).throw(H.invalidParameters), r = U.of(this._iid), i = r.dispatcher, a = r.sdkState, o = r.requestQueue, s = new JP({ userId: a.userId, channelUrl: this.url, pushTriggerOption: t }), [4, o.send(s)]; - case 1: - return c = u.sent(), l = c.as($P).pushTriggerOption, this.myPushTriggerOption = l, i.dispatch(new Ut({ channels: [this], source: ne.EVENT_CHANNEL_UPDATED, isWebSocketEventComing: !0 })), [2, l]; - } - }); - }); - }, n.prototype.setMyCountPreference = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return ve(Mt(Oi, t)).throw(H.invalidParameters), r = U.of(this._iid), i = r.dispatcher, a = r.sdkState, o = r.requestQueue, s = new jP({ channelUrl: this.url, userId: a.userId, countPreference: t }), [4, o.send(s)]; - case 1: - return c = u.sent(), l = c.as(VP).countPreference, this.myCountPreference = l, this._updateUnreadCount(this.unreadMessageCount, this.unreadMentionCount), i.dispatch(new Ut({ channels: [this], source: ne.EVENT_CHANNEL_UPDATED, isWebSocketEventComing: !0 })), [2, l]; - } - }); - }); - }, n.prototype.resetMyHistory = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return t = U.of(this._iid), r = t.dispatcher, i = t.requestQueue, a = new GP({ channelUrl: this.url }), [4, i.send(a)]; - case 1: - return o = c.sent(), s = o.as(zP).messageOffsetTimestamp, this.messageOffsetTimestamp = s, this.lastMessage && this.lastMessage.createdAt < s && (this.lastMessage = null), this._updateUnreadCount(0, 0), this.totalUnreadReplyCount = 0, r.dispatch(new Ut({ channels: [this], source: ne.EVENT_CHANNEL_RESET_HISTORY, isWebSocketEventComing: !0 })), [2, this]; - } - }); - }); - }, n.prototype.pinMessage = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return ve(k("number", t) && t > 0).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new n7({ channelType: this.channelType, channelUrl: this.url, messageId: t }), [4, r.send(i)]; - case 1: - return a.sent(), [2]; - } - }); - }); - }, n.prototype.unpinMessage = function(t) { - return T(this, void 0, void 0, function() { - var r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return ve(k("number", t) && t > 0).throw(H.invalidParameters), r = U.of(this._iid).requestQueue, i = new r7({ channelType: this.channelType, channelUrl: this.url, messageId: t }), [4, r.send(i)]; - case 1: - return a.sent(), [2]; - } - }); - }); - }, n.prototype._uploadFileAndUpdateParams = function(t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u, d, h; - return C(this, function(f) { - switch (f.label) { - case 0: - return fr(t.file) ? (r = U.of(this._iid).requestQueue, i = new rp({ file: t.file, channelUrl: this.url, thumbnailSizes: t.thumbnailSizes, requestId: this._generateRequestId() }), [4, r.send(i)]) : [3, 2]; - case 1: - a = f.sent(), o = a.as(ip), s = o.url, c = o.fileSize, l = c === void 0 ? t.fileSize : c, u = o.thumbnails, d = o.requireAuth, h = d !== void 0 && d, t.fileUrl = s, t.fileSize = l, t.requireAuth = h, t._thumbnails = u, f.label = 2; - case 2: - return [2]; - } - }); - }); - }, n.prototype.resendMessage = function(t, r) { - var i, a = this; - if (ve(t instanceof Vn && !t.scheduledInfo && t.isResendable).throw(H.invalidParameters), t.isUserMessage()) { - var o = (i = t.messageParams) !== null && i !== void 0 ? i : Km(t), s = new di(); - return this._sendUserMessage(o, Tr.RESEND, t.reqId).onPending(function(d) { - s._trigger(d); - }).onFailed(function(d, h) { - s._triggerFailed(d, h); - }).onSucceeded(function(d) { - a._tryUpdateLastMessageAndCallEvents(a, d), s._trigger(d); - }), s; - } - if (t.isFileMessage()) { - var c = this._validateFailedFileMessageHasFile(t, r); - ve(c).throw(H.invalidParameters), o = Wm(t, r); - var l = new di(); - return this._sendFileMessage(o, Tr.RESEND, t.reqId).onPending(function(d) { - l._trigger(d); - }).onFailed(function(d, h) { - l._triggerFailed(d, h); - }).onSucceeded(function(d) { - a._tryUpdateLastMessageAndCallEvents(a, d), l._trigger(d); - }), l; - } - if (t.isMultipleFilesMessage()) { - o = t.messageParams; - var u = new Nf(); - return this._sendMultipleFilesMessage(o, Tr.RESEND, t.reqId).onPending(function(d) { - u._trigger(d); - }).onFailed(function(d, h) { - u._triggerFailed(d, h); - }).onSucceeded(function(d) { - a._tryUpdateLastMessageAndCallEvents(a, d), u._trigger(d); - }).onFileUploaded(function(d, h, f, p) { - u._triggerOnFileUploaded(d, h, f, p); - }), u; - } - }, n.prototype.copyMessage = function(t, r) { - var i = this; - if (ve(t instanceof cp && r instanceof Vn && r.sendingStatus === $t.SUCCEEDED && this.url === r.channelUrl && !r.scheduledInfo).throw(H.invalidParameters), r.isUserMessage()) { - ve(!r.poll).throw(H.notSupportedError); - var a = _A(r), o = new di(); - return t._sendUserMessage(a).onPending(function(l) { - o._trigger(l); - }).onFailed(function(l, u) { - o._triggerFailed(l, u); - }).onSucceeded(function(l) { - t.isGroupChannel() && i._tryUpdateLastMessageAndCallEvents(t, l), o._trigger(l); - }), o; - } - if (r.isFileMessage()) { - a = CA(r); - var s = new di(); - return t._sendFileMessage(a).onPending(function(l) { - s._trigger(l); - }).onFailed(function(l, u) { - s._triggerFailed(l, u); - }).onSucceeded(function(l) { - t.isGroupChannel() && i._tryUpdateLastMessageAndCallEvents(t, l), s._trigger(l); - }), s; - } - if (r.isMultipleFilesMessage()) { - if (t.isGroupChannel()) { - a = P5(r); - var c = new Nf(); - return t._sendMultipleFilesMessage(a, Tr.COPY).onPending(function(l) { - c._trigger(l); - }).onFailed(function(l, u) { - c._triggerFailed(l, u); - }).onSucceeded(function(l) { - i._tryUpdateLastMessageAndCallEvents(t, l), c._trigger(l); - }).onFileUploaded(function(l, u, d, h) { - c._triggerOnFileUploaded(l, u, d, h); - }), c; - } - throw H.channelTypeNotSupportedError; - } - }, n; -}(cp), oN = function() { - this.onUserMuted = bt, this.onUserUnmuted = bt, this.onUserBanned = bt, this.onUserUnbanned = bt, this.onChannelChanged = bt, this.onChannelDeleted = bt, this.onChannelFrozen = bt, this.onChannelUnfrozen = bt, this.onOperatorUpdated = bt, this.onChannelMemberCountChanged = bt, this.onMetaDataCreated = bt, this.onMetaDataUpdated = bt, this.onMetaDataDeleted = bt, this.onMetaCounterCreated = bt, this.onMetaCounterUpdated = bt, this.onMetaCounterDeleted = bt, this.onMessageReceived = bt, this.onMessageUpdated = bt, this.onMessageDeleted = bt, this.onMentionReceived = bt, this.onReactionUpdated = bt, this.onThreadInfoUpdated = bt; -}, nd, jo = {}, c7 = function() { - function e(n) { - var t = n._iid, r = n.limit, i = r === void 0 ? 100 : r, a = this; - this.ref = 0, this._iid = t, this._limit = i; - var o, s = U.of(this._iid), c = s.sdkState, l = s.dispatcher, u = s.logger, d = s.cacheContext; - this._metadataKey = (o = c.userId, "sendbird:".concat(o, "@groupchannel/sync.meta")); - var h = function(f) { - return "sendbird:".concat(f, "@groupchannel/sync"); - }(c.userId); - this._sync = new Cs(h, function() { - return T(a, void 0, void 0, function() { - var f, p, v, m, E, y, _, S, b, A, w, M; - return C(this, function(N) { - switch (N.label) { - case 0: - return f = { hasNext: !0, nextToken: "" }, [4, this.loadMetadata()]; - case 1: - if (N.sent(), u.debug("channel background sync from", (b = this._metadata) === null || b === void 0 ? void 0 : b.token), (A = this._metadata) === null || A === void 0 ? void 0 : A.completed) - return [3, 13]; - N.label = 2; - case 2: - if (N.trys.push([2, 9, , 12]), (p = { includeEmpty: !0, order: Fn.CHRONOLOGICAL }).order !== Fn.LATEST_LAST_MESSAGE) - return [3, 6]; - N.label = 3; - case 3: - return N.trys.push([3, 5, , 6]), [4, d.preference.get(w1(c.appId))]; - case 4: - return v = N.sent(), p.includeChatNotification = !!v, [3, 6]; - case 5: - return N.sent(), p.includeChatNotification = !1, [3, 6]; - case 6: - return [4, cr.of(this._iid).getMyGroupChannels((M = (w = this._metadata) === null || w === void 0 ? void 0 : w.token) !== null && M !== void 0 ? M : "", p, this._limit, ne.SYNC_CHANNEL_BACKGROUND)]; - case 7: - return m = N.sent(), E = m.channels, y = m.token, f.hasNext = E.length >= this._limit && !!y, f.nextToken = y, this._metadata && (this._metadata.token = y, (S = this._metadata.range).extends.apply(S, dt([], tt(E.map(function(x) { - return x.createdAt; - })), !1)), this._metadata.completed = !f.hasNext), u.debug("channel background sync progress", f), [4, this.saveMetadata()]; - case 8: - return N.sent(), [3, 12]; - case 9: - return _ = N.sent(), u.debug("channel background sync error", _), _ instanceof H && _.isInvalidTokenError ? [4, this.clearMetaData()] : [3, 11]; - case 10: - N.sent(), N.label = 11; - case 11: - throw _; - case 12: - return [3, 14]; - case 13: - f.hasNext = !1, f.nextToken = "", N.label = 14; - case 14: - return [2, f]; - } - }); - }); - }), this._connectionEventContext = l.on(function(f) { - f instanceof bi && (f.stateType === tn.CONNECTED ? a.resume() : a.pause()); - }); - } - return e.of = function(n) { - return jo[n] || (jo[n] = new e({ _iid: n })), jo[n].ref++, jo[n]; - }, e.clear = function(n) { - jo[n] && (jo[n].close(), delete jo[n]); - }, Object.defineProperty(e.prototype, "range", { get: function() { - var n, t; - return (t = (n = this._metadata) === null || n === void 0 ? void 0 : n.range) !== null && t !== void 0 ? t : new Va({}); - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "completed", { get: function() { - var n; - return !!(!((n = this._metadata) === null || n === void 0) && n.completed); - }, enumerable: !1, configurable: !0 }), e.prototype.loadMetadata = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return this._metadata ? [3, 2] : [4, U.of(this._iid).cacheContext.preference.get(this._metadataKey)]; - case 1: - n = t.sent(), this._metadata = { token: n ? n.token : "", range: new Va(n ? n.range : { top: Number.MAX_SAFE_INTEGER, bottom: 0 }), completed: !!n && n.completed }, t.label = 2; - case 2: - return [2, this._metadata]; - } - }); - }); - }, e.prototype.saveMetadata = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return this._metadata ? [4, U.of(this._iid).cacheContext.preference.set(this._metadataKey, this._metadata)] : [3, 2]; - case 1: - return n.sent(), [2, !0]; - case 2: - return [2, !1]; - } - }); - }); - }, e.prototype.clearMetaData = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, U.of(this._iid).cacheContext.preference.remove(this._metadataKey)]; - case 1: - return n.sent(), this._metadata = void 0, [2]; - } - }); - }); - }, e.prototype.resume = function() { - var n, t, r = U.of(this._iid), i = r.logger; - r.sessionManager.session.hasSession && (i.debug("channel background sync resume()"), this._sync.start((t = (n = this._metadata) === null || n === void 0 ? void 0 : n.token) !== null && t !== void 0 ? t : "")); - }, e.prototype.pause = function() { - U.of(this._iid).logger.debug("channel background sync stop()"), this._sync.stop(); - }, e.prototype.close = function() { - this.ref--, this.ref <= 0 && (this.ref = 0, this.pause(), this._connectionEventContext.close(), delete jo[this._iid]); - }, e; -}(), Vo = {}, u7 = function() { - function e(n) { - var t = n._iid, r = this; - this.ref = 0, this._iid = t; - var i, a = U.of(this._iid), o = a.logger, s = a.sdkState, c = a.dispatcher, l = a.cacheContext; - this._metadataKey = (i = s.userId, "sendbird:".concat(i, "@groupchannel/changelogs.meta")); - var u = function(d) { - return "sendbird:".concat(d, "@groupchannel/changelogs"); - }(s.userId); - this._sync = new Cs(u, function() { - return T(r, void 0, void 0, function() { - var d, h, f, p, v, m, E, y, _, S; - return C(this, function(b) { - switch (b.label) { - case 0: - return d = { hasNext: !0, nextToken: 0 }, [4, this.loadMetadata()]; - case 1: - b.sent(), o.debug("channel changelog sync from", (y = this._metadata) === null || y === void 0 ? void 0 : y.token), b.label = 2; - case 2: - b.trys.push([2, 9, , 12]), h = { includeEmpty: !0 }, b.label = 3; - case 3: - return b.trys.push([3, 5, , 6]), [4, l.preference.get(w1(s.appId))]; - case 4: - return f = b.sent(), h.includeChatNotification = !!f, [3, 6]; - case 5: - return b.sent(), h.includeChatNotification = !1, [3, 6]; - case 6: - return [4, cr.of(this._iid).getMyGroupChannelChangeLogs((S = (_ = this._metadata) === null || _ === void 0 ? void 0 : _.token) !== null && S !== void 0 ? S : "", h, ne.SYNC_CHANNEL_CHANGELOGS)]; - case 7: - return p = b.sent(), v = p.hasMore, m = p.token, d.hasNext = v, d.nextToken = m, this._metadata && (this._metadata.token = m), o.debug("channel changelog sync progress", d), [4, this.saveMetadata()]; - case 8: - return b.sent(), [3, 12]; - case 9: - return E = b.sent(), o.debug("channel changelog sync error", E), E instanceof H && E.isInvalidTokenError ? [4, this.clearMetadata()] : [3, 11]; - case 10: - b.sent(), b.label = 11; - case 11: - throw E; - case 12: - return [2, d]; - } - }); - }); - }), this._connectionEventContext = c.on(function(d) { - d instanceof bi && (d.stateType === tn.CONNECTED ? r.resume() : r.pause()); - }); - } - return e.of = function(n) { - return Vo[n] || (Vo[n] = new e({ _iid: n })), Vo[n].ref++, Vo[n]; - }, e.clear = function(n) { - Vo[n] && (Vo[n].close(), delete Vo[n]); - }, e.prototype.loadMetadata = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return this._metadata ? [3, 2] : (n = U.of(this._iid), t = n.cacheContext, r = n.firstConnectedAt, [4, t.preference.get(this._metadataKey)]); - case 1: - i = a.sent(), this._metadata = { token: i ? i.token : r }, a.label = 2; - case 2: - return [2, this._metadata]; - } - }); - }); - }, e.prototype.saveMetadata = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return this._metadata ? [4, U.of(this._iid).cacheContext.preference.set(this._metadataKey, this._metadata)] : [3, 2]; - case 1: - return n.sent(), [2, !0]; - case 2: - return [2, !1]; - } - }); - }); - }, e.prototype.clearMetadata = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - switch (n.label) { - case 0: - return [4, U.of(this._iid).cacheContext.preference.remove(this._metadataKey)]; - case 1: - return n.sent(), this._metadata = void 0, [2]; - } - }); - }); - }, e.prototype.resume = function() { - U.of(this._iid).sessionManager.session.hasSession && this._sync.start(0); - }, e.prototype.pause = function() { - this._sync.stop(); - }, e.prototype.close = function() { - this.ref--, this.ref <= 0 && (this.ref = 0, this.pause(), this._connectionEventContext.close(), delete Vo[this._iid]); - }, e; -}(), og = function(e, n) { - return e.findIndex(function(t) { - return t.isIdentical(n); - }); -}, d7 = function(e, n, t) { - if (e.length > 0) { - for (var r = og(e, n), i = 0, a = e.length - 1, o = Math.floor((i + a) / 2); i < a; ) { - var s = Gb(e[o], n, t); - if (s > 0) - a = o, o = Math.floor((i + a) / 2); - else { - if (!(s < 0)) - return { place: o, oldPosition: r }; - i = o + 1, o = Math.floor((i + a) / 2); - } - } - return { place: Gb(e[o], n, t) >= 0 ? o : o + 1, oldPosition: r }; - } - return { place: e.length, oldPosition: -1 }; -}, Gb = function(e, n, t) { - switch (t) { - case Fn.LATEST_LAST_MESSAGE: - return e.lastMessage && n.lastMessage ? n.lastMessage.createdAt - e.lastMessage.createdAt : e.lastMessage ? -1 : n.lastMessage ? 1 : n.createdAt - e.createdAt; - case Fn.CHRONOLOGICAL: - return n.createdAt - e.createdAt; - case Fn.CHANNEL_NAME_ALPHABETICAL: - var r = e.name.localeCompare(n.name); - return r === 0 ? e.createdAt - n.createdAt : r; - default: - return 0; - } -}, h7 = function() { - function e(n, t) { - var r = t.filter, i = t.order, a = t.limit, o = this; - this.channels = [], this._iid = n, this._key = "gcc-".concat(Ro()), this._isDisposed = !1, this._isGetRemoteChannelsSucceeded = !0, this.filter = r ?? new eN(), this.order = i ?? Fn.LATEST_LAST_MESSAGE, this._hasMore = !0, this._token = "", this._limit = a ?? LA; - var s = U.of(this._iid), c = s.sdkState, l = s.cacheContext, u = s.dispatcher; - l.localCacheEnabled && (this._backgroundSync = c7.of(n), this._backgroundSync.resume()), this._changelogSync = u7.of(n), this._changelogSync.resume(), cr.of(this._iid).subscribeChannelEvent(this._key, { onUpdate: function(d, h) { - if (xf(h)) { - var f = d.filter(function(v) { - return o.filter.match(v, c.userId); - }), p = d.filter(function(v) { - return !o.filter.match(v, c.userId); - }).map(function(v) { - return v.url; - }); - f.length > 0 && o._addChannelsToView(f, h), p.length > 0 && o._removeChannelsFromView(p, h); - } - }, onRemove: function(d, h) { - o._removeChannelsFromView(d, h); - } }), U.of(this._iid).statLogCollector.put(new rl({ type: Tn.FEATURE_LOCALCACHE, data: { use_local_cache: l.localCacheEnabled, collection_interface: { group_channel: !0 } } })), u.on(function(d) { - d instanceof bi && (d.stateType === tn.CONNECTED ? o._isGetRemoteChannelsSucceeded || T(o, void 0, void 0, function() { - return C(this, function(h) { - switch (h.label) { - case 0: - return [4, this._revokeLoadMore()]; - case 1: - return h.sent(), [2]; - } - }); - }) : d.stateType === tn.LOGOUT && o.dispose()); - }); - } - return Object.defineProperty(e.prototype, "hasMore", { get: function() { - return !this._isDisposed && this._hasMore; - }, enumerable: !1, configurable: !0 }), e.prototype.setGroupChannelCollectionHandler = function(n) { - this._handler = n; - }, e.prototype._addChannelsToView = function(n, t, r) { - var i, a, o, s, c = this; - r === void 0 && (r = !1); - var l = [], u = [], d = []; - try { - for (var h = Ne(n), f = h.next(); !f.done; f = h.next()) { - var p = f.value, v = og(this.channels, p); - v >= 0 && this.channels.splice(v, 1); - var m = d7(this.channels, p, this.order).place; - if (v < 0) - m === this.channels.length ? !r && this._hasMore || (l.push(p), this.channels.push(p)) : (l.push(p), this.channels.splice(m, 0, p)); - else - switch (t) { - case ne.EVENT_CHANNEL_UPDATED: - case ne.EVENT_MESSAGE_RECEIVED: - case ne.SYNC_CHANNEL_CHANGELOGS: - case ne.EVENT_MESSAGE_SENT: - this.order === Fn.CHANNEL_NAME_ALPHABETICAL && this._hasMore && m === this.channels.length ? d.push(p) : (this.channels.splice(m, 0, p), u.push(p)); - break; - default: - this.channels.splice(m, 0, p), u.push(p); - } - } - } catch (S) { - i = { error: S }; - } finally { - try { - f && !f.done && (a = h.return) && a.call(h); - } finally { - if (i) - throw i.error; - } - } - if (d.length > 0) - try { - for (var E = Ne(d), y = E.next(); !y.done; y = E.next()) { - p = y.value; - var _ = og(this.channels, p); - _ !== -1 && this.channels.splice(_, 1); - } - } catch (S) { - o = { error: S }; - } finally { - try { - y && !y.done && (s = E.return) && s.call(E); - } finally { - if (o) - throw o.error; - } - } - xf(t) && Ke(function() { - return T(c, void 0, void 0, function() { - var S, b, A, w; - return C(this, function(M) { - return S = new ag(t), l.length > 0 && (!((b = this._handler) === null || b === void 0) && b.onChannelsAdded) && this._handler.onChannelsAdded(S, l), u.length > 0 && (!((A = this._handler) === null || A === void 0) && A.onChannelsUpdated) && this._handler.onChannelsUpdated(S, u), d.length > 0 && (!((w = this._handler) === null || w === void 0) && w.onChannelsDeleted) && this._handler.onChannelsDeleted(S, d.map(function(N) { - return N.url; - })), [2]; - }); - }); - }); - }, e.prototype._removeChannelsFromView = function(n, t) { - var r, i, a = this, o = [], s = function(d) { - var h = c.channels.findIndex(function(f) { - return f.url === d; - }); - h >= 0 && (o.push(c.channels[h].url), c.channels.splice(h, 1)); - }, c = this; - try { - for (var l = Ne(n), u = l.next(); !u.done; u = l.next()) - s(u.value); - } catch (d) { - r = { error: d }; - } finally { - try { - u && !u.done && (i = l.return) && i.call(l); - } finally { - if (r) - throw r.error; - } - } - return xf(t) && o.length > 0 && Ke(function() { - return T(a, void 0, void 0, function() { - var d, h; - return C(this, function(f) { - return d = new ag(t), !((h = this._handler) === null || h === void 0) && h.onChannelsDeleted && this._handler.onChannelsDeleted(d, o), [2]; - }); - }); - }), o; - }, e.prototype._getLocalChannels = function() { - return T(this, void 0, void 0, function() { - var n, t; - return C(this, function(r) { - switch (r.label) { - case 0: - return n = cr.of(this._iid), t = this.channels.length > 0 ? function(i, a) { - var o, s, c, l; - switch (a) { - case Fn.LATEST_LAST_MESSAGE: - return (s = (o = i.lastMessage) === null || o === void 0 ? void 0 : o.createdAt) !== null && s !== void 0 ? s : i.createdAt; - case Fn.CHRONOLOGICAL: - return i.createdAt; - case Fn.CHANNEL_NAME_ALPHABETICAL: - return i.name; - default: - return (l = (c = i.lastMessage) === null || c === void 0 ? void 0 : c.createdAt) !== null && l !== void 0 ? l : i.createdAt; - } - }(this.channels[this.channels.length - 1], this.order) : null, [4, n.getChannelsFromCache(t, this.filter, this.order, this._limit, t ? this.channels[this.channels.length - 1].url : void 0)]; - case 1: - return [2, r.sent()]; - } - }); - }); - }, e.prototype._getRemoteChannels = function() { - return T(this, void 0, void 0, function() { - var n, t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return [4, cr.of(this._iid).getMyGroupChannels(this._token, Xe(L(L({}, this.filter), { order: this.order })), this._limit)]; - case 1: - return n = i.sent(), t = n.channels, r = n.token, this._token = r, this._hasMore = !!r, [2, t]; - } - }); - }); - }, e.prototype._revokeLoadMore = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - if (this._isDisposed) - return [2]; - t.label = 1; - case 1: - return t.trys.push([1, 3, , 4]), [4, this._getRemoteChannels()]; - case 2: - return n = t.sent(), this._isGetRemoteChannelsSucceeded = !0, this._addChannelsToView(n, ne.REQUEST_CHANNEL, !0), [3, 4]; - case 3: - return t.sent(), this._isGetRemoteChannelsSucceeded = !1, [3, 4]; - case 4: - return [2]; - } - }); - }); - }, e.prototype.loadMore = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a = this; - return C(this, function(o) { - switch (o.label) { - case 0: - if (this._isDisposed) - throw new H({ code: nt.COLLECTION_DISPOSED, message: "Collection has been disposed." }); - return this._hasMore ? (n = U.of(this._iid), t = n.cacheContext, r = n.connectionManager, i = [], !t.localCacheEnabled || r.isConnected && !this._backgroundSync.completed ? [3, 2] : [4, Pn(function() { - return T(a, void 0, void 0, function() { - return C(this, function(s) { - switch (s.label) { - case 0: - return [4, this._getLocalChannels()]; - case 1: - return i = s.sent(), [2]; - } - }); - }); - })]) : [3, 6]; - case 1: - return o.sent(), this._hasMore = i.length >= this._limit, [3, 5]; - case 2: - return o.trys.push([2, 4, , 5]), [4, this._getRemoteChannels()]; - case 3: - return i = o.sent(), this._isGetRemoteChannelsSucceeded = !0, [3, 5]; - case 4: - return o.sent(), this._isGetRemoteChannelsSucceeded = !1, [3, 5]; - case 5: - return this._addChannelsToView(i, ne.REQUEST_CHANNEL, !0), [2, i]; - case 6: - return [2, []]; - } - }); - }); - }, e.prototype.dispose = function() { - var n, t; - this._isDisposed || (this._isDisposed = !0, this.channels.length > 0 && this.channels.splice(0, this.channels.length), (n = this._backgroundSync) === null || n === void 0 || n.close(), (t = this._changelogSync) === null || t === void 0 || t.close(), cr.of(this._iid).unsubscribeChannelEvent(this._key)); - }, e; -}(), f7 = function(e) { - function n(t) { - var r = this, i = t.token, a = t.limit, o = t.order, s = t.includeEmpty, c = t.membershipFilter, l = t.channelNameContainsFilter, u = t.channelUrlsFilter, d = t.customTypesFilter, h = t.customTypeStartsWithFilter, f = t.superChannelFilter, p = t.metadataOrderKeyFilter, v = t.metadataKey, m = t.metadataValues, E = t.metadataValueStartsWith, y = t.includeFrozen, _ = t.includeMetaData; - return (r = e.call(this) || this).method = pe.GET, r.path = xr, r.params = Be(Xe({ token: i, limit: a, order: o, show_member: !0, show_read_receipt: !0, show_delivery_receipt: !0, show_empty: s, public_mode: Wa.PUBLIC, public_membership_mode: c, name_contains: l, channel_urls: u, custom_types: d, custom_type_startswith: h, super_mode: f, metadata_order_key: p, metadata_key: v, metadata_values: m, metadata_value_startswith: E, show_frozen: y, show_metadata: _ })), r; - } - return O(n, e), n; -}(ge), p7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - i.channels = []; - var a = r.next, o = r.channels, s = r.ts; - return i.token = a, o && o.length > 0 && (i.channels = o.map(function(c) { - return c.ts = s, new Hi(t, c); - })), i.ts = typeof s == "number" ? s : 0, i; - } - return O(n, e), n; -}(_e); -(function(e) { - e.ALL = "all", e.JOINED = "joined"; -})(nd || (nd = {})); -var v7 = function(e) { - function n(t, r) { - var i, a, o, s, c, l, u, d, h, f, p, v, m, E, y = this; - return (y = e.call(this, t, r) || this).includeEmpty = !1, y.includeFrozen = !0, y.includeMetaData = !0, y.channelUrlsFilter = null, y.customTypesFilter = null, y.customTypeStartsWithFilter = null, y.channelNameContainsFilter = null, y.membershipFilter = nd.ALL, y.superChannelFilter = ri.ALL, y.metadataKey = null, y.metadataValues = null, y.metadataOrderKeyFilter = null, y.metadataValueStartsWith = null, y.order = Ju.CHRONOLOGICAL, y.includeEmpty = (i = r.includeEmpty) !== null && i !== void 0 && i, y.includeFrozen = (a = r.includeFrozen) === null || a === void 0 || a, y.includeMetaData = (o = r.includeMetaData) === null || o === void 0 || o, y.channelUrlsFilter = (s = r.channelUrlsFilter) !== null && s !== void 0 ? s : null, y.customTypesFilter = (c = r.customTypesFilter) !== null && c !== void 0 ? c : null, y.customTypeStartsWithFilter = (l = r.customTypeStartsWithFilter) !== null && l !== void 0 ? l : null, y.channelNameContainsFilter = (u = r.channelNameContainsFilter) !== null && u !== void 0 ? u : null, y.membershipFilter = (d = r.membershipFilter) !== null && d !== void 0 ? d : nd.ALL, y.superChannelFilter = (h = r.superChannelFilter) !== null && h !== void 0 ? h : ri.ALL, y.metadataKey = (f = r.metadataKey) !== null && f !== void 0 ? f : null, y.metadataValues = (p = r.metadataValues) !== null && p !== void 0 ? p : null, y.metadataOrderKeyFilter = (v = r.metadataOrderKeyFilter) !== null && v !== void 0 ? v : null, y.metadataValueStartsWith = (m = r.metadataValueStartsWith) !== null && m !== void 0 ? m : null, y.order = (E = r.order) !== null && E !== void 0 ? E : Ju.CHRONOLOGICAL, y; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && k("boolean", this.includeEmpty) && k("boolean", this.includeFrozen) && k("boolean", this.includeMetaData) && k("string", this.channelNameContainsFilter, !0) && Ot("string", this.channelUrlsFilter, !0) && Ot("string", this.customTypesFilter, !0) && k("string", this.customTypeStartsWithFilter, !0) && Mt(nd, this.membershipFilter) && Mt(ri, this.superChannelFilter) && Mt(Ju, this.order) && k("string", this.metadataOrderKeyFilter, !0) && k("string", this.metadataKey, !0) && Ot("string", this.metadataValues, !0) && k("string", this.metadataValueStartsWith, !0); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : (t = [], this._hasNext ? (this._isLoading = !0, r = U.of(this._iid).requestQueue, i = new f7(Xe(L(L({}, this), { token: this._token }))), [4, r.send(i)]) : [3, 2]) : [3, 5]; - case 1: - return a = l.sent(), o = a.as(p7), s = o.channels, c = o.token, this._token = c, this._hasNext = !!c, this._isLoading = !1, [2, s]; - case 2: - return [2, t]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(ko), k1 = function(e) { - function n(t) { - t === void 0 && (t = {}); - var r = e.call(this) || this; - return Object.keys(t).forEach(function(i) { - r.hasOwnProperty(i) && (r[i] = t[i]); - }), r; - } - return O(n, e), n; -}(function(e) { - function n() { - var t = e !== null && e.apply(this, arguments) || this; - return t.onUserJoined = bt, t.onUserLeft = bt, t.onUserReceivedInvitation = bt, t.onUserDeclinedInvitation = bt, t.onChannelHidden = bt, t.onUnreadMemberStatusUpdated = bt, t.onUndeliveredMemberStatusUpdated = bt, t.onTypingStatusUpdated = bt, t.onPollUpdated = bt, t.onPollVoted = bt, t.onPollDeleted = bt, t.onPinnedMessageUpdated = bt, t; - } - return O(n, e), n; -}(oN)), m7 = function(e) { - function n(t) { - var r = this, i = t.token, a = t.limit, o = t.order, s = t.reverse, c = t.channelUrl, l = t.messageTypeFilter, u = t.scheduledStatus; - return (r = e.call(this) || this).method = pe.GET, r.path = "".concat(Cw), r.params = Be(Xe({ token: i, limit: a, reverse: s, channel_url: c, order: o, message_type: l, status: u })), r; - } - return O(n, e), n; -}(ge), g7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - i.scheduledMessages = []; - var a = r.next, o = r.scheduled_messages; - return i.token = a, i.scheduledMessages = o.map(function(s) { - return jr(t, s); - }), i; - } - return O(n, e), n; -}(_e), y7 = function(e) { - function n(t, r) { - var i, a, o, s, c, l = this; - return (l = e.call(this, t, r) || this).channelUrl = null, l.order = null, l.reverse = !1, l.scheduledStatus = null, l.messageTypeFilter = Nr.ALL, l.channelUrl = (i = r.channelUrl) !== null && i !== void 0 ? i : null, l.order = (a = r.order) !== null && a !== void 0 ? a : null, l.reverse = (o = r.reverse) !== null && o !== void 0 && o, l.scheduledStatus = (s = r.scheduledStatus) !== null && s !== void 0 ? s : null, l.messageTypeFilter = (c = r.messageTypeFilter) !== null && c !== void 0 ? c : Nr.ALL, l; - } - return O(n, e), n.prototype._validate = function() { - return e.prototype._validate.call(this) && k("string", this.channelUrl, !0) && (Mt(Jm, this.order) || this.order === null) && k("boolean", this.reverse) && (Ot(ls, this.scheduledStatus) || this.scheduledStatus === null) && Mt(Nr, this.messageTypeFilter); - }, n.prototype.next = function() { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return this._validate() ? this._isLoading ? [3, 3] : this._hasNext ? (this._isLoading = !0, t = U.of(this._iid).requestQueue, r = new m7(Xe(L(L({}, this), { token: this._token }))), [4, t.send(r)]) : [3, 2] : [3, 5]; - case 1: - return i = c.sent(), a = i.as(g7), o = a.scheduledMessages, s = a.token, this._token = s, this._hasNext = !!s, this._isLoading = !1, [2, o]; - case 2: - return [2, []]; - case 3: - throw H.queryInProgress; - case 4: - return [3, 6]; - case 5: - throw H.invalidParameters; - case 6: - return [2]; - } - }); - }); - }, n; -}(ko), E7 = function(e) { - function n() { - var t = e !== null && e.apply(this, arguments) || this; - return t.name = "groupChannel", t; - } - return O(n, e), n.prototype.init = function(t, r) { - var i = r.sdkState, a = r.dispatcher, o = r.sessionManager, s = r.requestQueue, c = r.logger, l = r.onlineDetector, u = r.cacheContext; - e.prototype.init.call(this, t, { sdkState: i, dispatcher: a, sessionManager: o, requestQueue: s, logger: c, onlineDetector: l, cacheContext: u }), this._manager = new cr(t, { sdkState: i, cacheContext: u, dispatcher: a, sessionManager: o, requestQueue: s, logger: c }); - }, n.prototype.createGroupChannelCollection = function(t) { - return t === void 0 && (t = {}), new h7(this._iid, t); - }, n.prototype.createMyGroupChannelListQuery = function(t) { - return t === void 0 && (t = {}), new rN(this._iid, t); - }, n.prototype.createPublicGroupChannelListQuery = function(t) { - return t === void 0 && (t = {}), new v7(this._iid, t); - }, n.prototype.createScheduledMessageListQuery = function(t) { - return t === void 0 && (t = {}), new y7(this._iid, t); - }, n.prototype.addGroupChannelHandler = function(t, r) { - ve(k("string", t) && r instanceof k1).throw(H.invalidParameters), this._manager.addHandler(t, r); - }, n.prototype.removeGroupChannelHandler = function(t) { - ve(k("string", t)).throw(H.invalidParameters), this._manager.removeHandler(t); - }, n.prototype.removeAllGroupChannelHandlers = function() { - this._manager.clearHandler(); - }, n.prototype.buildGroupChannelFromSerializedData = function(t) { - return this._manager.buildGroupChannelFromSerializedData(t); - }, n.prototype.buildGroupChannelListQueryFromSerializedData = function(t) { - return this._manager.buildGroupChannelListQueryFromSerializedData(t); - }, n.prototype.buildMemberFromSerializedData = function(t) { - return this._manager.buildMemberFromSerializedData(t); - }, n.prototype.getChannel = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return ve(k("string", t)).throw(H.invalidParameters), [2, this._manager.getChannel(t)]; - }); - }); - }, n.prototype.getChannelWithoutCache = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return ve(k("string", t)).throw(H.invalidParameters), [2, this._manager.getChannelWithoutCache(t)]; - }); - }); - }, n.prototype.getMyGroupChannelChangeLogsByToken = function(t, r) { - return r === void 0 && (r = {}), T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, fp), r), ve(k("string", t) && eg(i)).throw(H.invalidParameters), [4, this._manager.getMyGroupChannelChangeLogs(t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n.prototype.getMyGroupChannelChangeLogsByTimestamp = function(t, r) { - return r === void 0 && (r = {}), T(this, void 0, void 0, function() { - var i; - return C(this, function(a) { - switch (a.label) { - case 0: - return i = L(L({}, fp), r), ve(k("number", t) && eg(i)).throw(H.invalidParameters), [4, this._manager.getMyGroupChannelChangeLogs(t, i)]; - case 1: - return [2, a.sent()]; - } - }); - }); - }, n.prototype.getGroupChannelCount = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - return r = L(L({}, tN), t), ve(nN(r)).throw(H.invalidParameters), [2, this._manager.getGroupChannelCount(r)]; - }); - }); - }, n.prototype.getUnreadItemCount = function(t) { - return t === void 0 && (t = {}), T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._manager.getUnreadItemCount(t)]; - case 1: - return [2, r.sent()]; - } - }); - }); - }, n.prototype.getTotalUnreadChannelCount = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - switch (t.label) { - case 0: - return [4, this._manager.getTotalUnreadChannelCount()]; - case 1: - return [2, t.sent()]; - } - }); - }); - }, n.prototype.getTotalUnreadMessageCount = function(t) { - return t === void 0 && (t = {}), T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._manager.getTotalUnreadMessageCount(t)]; - case 1: - return [2, r.sent()]; - } - }); - }); - }, n.prototype.getTotalScheduledMessageCount = function(t) { - return t === void 0 && (t = {}), T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._manager.getTotalScheduledMessageCount(t)]; - case 1: - return [2, r.sent()]; - } - }); - }); - }, n.prototype.getSubscribedTotalUnreadMessageCount = function() { - return this._manager.getSubscribedTotalUnreadMessageCount(); - }, n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount = function() { - return this._manager.getSubscribedCustomTypeTotalUnreadMessageCount(); - }, n.prototype.getSubscribedCustomTypeUnreadMessageCount = function(t) { - return this._manager.getSubscribedCustomTypeUnreadMessageCount(t); - }, n.prototype.createChannel = function(t) { - return t === void 0 && (t = {}), T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - return r = L(L({}, Of), t), ve($m(r)).throw(H.invalidParameters), [2, this._manager.createChannel(r)]; - }); - }); - }, n.prototype.createDistinctChannelIfNotExist = function(t) { - return t === void 0 && (t = {}), T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - return r = L(L({}, Of), t), ve($m(r)).throw(H.invalidParameters), r && (r.isDistinct = !0), [2, this.createChannel(r)]; - }); - }); - }, n.prototype.createChannelWithUserIds = function(t, r, i, a, o, s) { - return r === void 0 && (r = !1), o === void 0 && (o = ""), s === void 0 && (s = ""), T(this, void 0, void 0, function() { - var c; - return C(this, function(l) { - return c = L(L({}, Of), { invitedUserIds: t, isDistinct: r, name: i, data: o, customType: s }), typeof a == "string" ? c.coverUrl = a : c.coverImage = a, [2, this.createChannel(c)]; - }); - }); - }, n.prototype.markAsReadAll = function() { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return this._manager.markAsReadAll(), [2]; - }); - }); - }, n.prototype.markAsReadWithChannelUrls = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - return ve(Ot("string", t)).throw(H.invalidParameters), this._manager.markAsReadWithChannelUrls(t), [2]; - }); - }); - }, n.prototype.markAsDelivered = function(t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return ve(k("string", t)).throw(H.invalidParameters), [4, this.getChannel(t)]; - case 1: - return [4, r.sent().markAsDelivered()]; - case 2: - return r.sent(), [2]; - } - }); - }); - }, n; -}(Yp); -Fn.LATEST_LAST_MESSAGE; -globalThis && globalThis.__awaiter; -function ih(e) { - const n = yt(e); - return n.current = e, Qt((...t) => n.current(...t), [n]); -} -globalThis && globalThis.__rest; -globalThis && globalThis.__awaiter; -var _7 = function(e) { - function n() { - var t = e !== null && e.apply(this, arguments) || this; - return t.name = "poll", t; - } - return O(n, e), n.prototype.init = function(t, r) { - var i = r.sdkState, a = r.dispatcher, o = r.sessionManager, s = r.requestQueue, c = r.logger, l = r.onlineDetector, u = r.cacheContext; - e.prototype.init.call(this, t, { sdkState: i, dispatcher: a, sessionManager: o, requestQueue: s, logger: c, onlineDetector: l, cacheContext: u }), this._manager = new np(t, { sdkState: i, dispatcher: a, sessionManager: o, requestQueue: s, logger: c, onlineDetector: l, cacheContext: u }); - }, n.prototype.create = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - return r = L(L({}, eD), t), ve(sA(r)).throw(H.invalidParameters), [2, this._manager.create(r)]; - }); - }); - }, n.prototype.get = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - return r = L(L({}, nD), t), ve(cA(r)).throw(H.invalidParameters), [2, this._manager.get(r)]; - }); - }); - }, n.prototype.getOption = function(t) { - return T(this, void 0, void 0, function() { - var r; - return C(this, function(i) { - return r = L(L({}, tD), t), ve(lA(r)).throw(H.invalidParameters), [2, this._manager.getOption(r)]; - }); - }); - }, n.prototype.buildPollFromSerializedData = function(t) { - return this._manager.buildPollFromSerializedData(t); - }, n; -}(Yp), b7 = function(e) { - return ["-lastMessageUpdatedAt", "-createdAt", "syncIndex"]; -}, zb = function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - return O(n, e), n; -}(bn), sN = function(e) { - this.key = e.key, this.url = e.url; -}, lN = function(e) { - this.id = e.id, this.name = e.name, this.url = e.url, this.emojis = e.emojis ? e.emojis.map(function(n) { - return new sN(n); - }) : []; -}, C7 = function(e) { - this.emojiHash = e.emoji_hash || "", this.emojiCategories = e.emoji_categories ? e.emoji_categories.map(function(n) { - return new lN(n); - }) : []; -}, T7 = { profileImage: void 0, profileUrl: void 0, nickname: void 0 }, qb = function(e) { - return function(n, t) { - return T(void 0, void 0, void 0, function() { - var r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - switch (n) { - case 1: - case 2: - case 3: - return [3, 1]; - case 4: - return [3, 2]; - case 5: - return [3, 9]; - } - return [3, 13]; - case 1: - return t(), [3, 14]; - case 2: - return c.trys.push([2, 7, , 8]), [4, e.clear()]; - case 3: - return c.sent(), r = function(l) { - return { v2: function() { - return T(void 0, void 0, void 0, function() { - return C(this, function(u) { - switch (u.label) { - case 0: - return [4, l.commitSchema([{ collectionName: PA, keyName: I5, index: [Mf(Fn.LATEST_LAST_MESSAGE), Mf(Fn.CHRONOLOGICAL), Mf(Fn.CHANNEL_NAME_ALPHABETICAL)] }, { collectionName: Ym, keyName: M5, index: [Ga(Er.CHANNEL_LATEST), Ga(Er.NEWEST_CHILD_MESSAGE)] }, { collectionName: BA, keyName: dL, index: [Ga(Er.CHANNEL_LATEST), Ga(Er.NEWEST_CHILD_MESSAGE)] }, { collectionName: x5, keyName: R5 }])]; - case 1: - return [2, u.sent()]; - } - }); - }); - }, v3: function() { - return T(void 0, void 0, void 0, function() { - return C(this, function(u) { - switch (u.label) { - case 0: - return [4, l.commitSchema([{ collectionName: D5, keyName: L5, index: [b7()] }])]; - case 1: - return [2, u.sent()]; - } - }); - }); - }, v4: function() { - return T(void 0, void 0, void 0, function() { - return C(this, function(u) { - switch (u.label) { - case 0: - return [4, l.commitSchema([{ collectionName: UA, keyName: O5, index: [oL()] }])]; - case 1: - return [2, u.sent()]; - } - }); - }); - } }; - }(e), i = r.v2, a = r.v3, o = r.v4, [4, i()]; - case 4: - return c.sent(), [4, a()]; - case 5: - return c.sent(), [4, o()]; - case 6: - return c.sent(), t(), [3, 8]; - case 7: - return s = c.sent(), t(s), [3, 8]; - case 8: - return [3, 14]; - case 9: - return c.trys.push([9, 11, , 12]), [4, e.collection(Ym).removeIf({ where: { channelType: Ft.OPEN } })]; - case 10: - case 11: - return c.sent(), [3, 12]; - case 12: - return t(), [3, 14]; - case 13: - t(), c.label = 14; - case 14: - return [2]; - } - }); - }); - }; -}, S7 = function() { - return typeof document < "u" ? document.visibilityState : "visible"; -}, w7 = function(e) { - function n(t) { - var r = t.getVisibilityState, i = r === void 0 ? S7 : r, a = t.initialState, o = a === void 0 ? "visible" : a, s = t.isEnabled, c = s === void 0 || s, l = t.pauseCheckDelay, u = l === void 0 ? 3e4 : l, d = e.call(this) || this; - return d._pauseCheckDelay = 3e4, d._currentState = "visible", d._getVisibilityState = i, d._pauseCheckDelay = u, d._currentState = o, d._isEnabled = c, d._boundToggleState = d._toggleState.bind(d), d; - } - return O(n, e), Object.defineProperty(n.prototype, "currentState", { get: function() { - return this._currentState; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isAvailable", { get: function() { - return typeof window < "u" && !!window.addEventListener && !!window.removeEventListener; - }, enumerable: !1, configurable: !0 }), n.prototype._toggleState = function() { - var t = this, r = this._getVisibilityState(); - r !== "hidden" ? this._currentState === "hidden" && (this._pauseDelayTimer && (clearTimeout(this._pauseDelayTimer), this._pauseDelayTimer = void 0), this.dispatch("resume")) : this._currentState !== "hidden" && (this._pauseDelayTimer = setTimeout(function() { - t._pauseDelayTimer = void 0, t.dispatch("pause"); - }, this._pauseCheckDelay)), this._currentState = r; - }, n.prototype.start = function() { - this._isEnabled && this.isAvailable && (this._boundToggleState = this._toggleState.bind(this), window.addEventListener("visibilitychange", this._boundToggleState, { capture: !0 })); - }, n.prototype.stop = function() { - this._isEnabled && this.isAvailable && this._boundToggleState && window.removeEventListener("visibilitychange", this._boundToggleState, { capture: !0 }); - }, n; -}(Dl), A7 = function() { - function e(n) { - var t = n.logger, r = n.connectionDelegate, i = r === void 0 ? null : r, a = this; - this._onlineWorker = function() { - var o; - return (o = a.connectionDelegate) === null || o === void 0 ? void 0 : o.reconnect(); - }, this._offlineWorker = function() { - var o; - return (o = a.connectionDelegate) === null || o === void 0 ? void 0 : o.disconnect(); - }, this.unsubscribes = [], this._onlineListener = function(o) { - if (a.isAvailableOnWeb) - return window.addEventListener("online", o), function() { - return window.removeEventListener("online", o, !1); - }; - }, this._offlineListener = function(o) { - if (a.isAvailableOnWeb) - return window.addEventListener("offline", o), function() { - return window.removeEventListener("offline", o, !1); - }; - }, this.logger = t, i && (this.connectionDelegate = i); - } - return Object.defineProperty(e.prototype, "isAvailableOnWeb", { get: function() { - return typeof window < "u" && !!window.addEventListener && "ononline" in window && "onoffline" in window && typeof navigator < "u" && navigator.onLine !== void 0; - }, enumerable: !1, configurable: !0 }), e.prototype.setOnlineListener = function(n) { - n && typeof n == "function" && (this._onlineListener = n); - }, e.prototype.setOfflineListener = function(n) { - n && typeof n == "function" && (this._offlineListener = n); - }, e.prototype.start = function() { - this.unsubscribes = [this._onlineListener(this._onlineWorker), this._offlineListener(this._offlineWorker)]; - }, e.prototype.stop = function() { - var n = this; - this.unsubscribes.forEach(function(t) { - try { - t == null || t(); - } catch (r) { - n.logger.warn(r.message); - } - }), this.unsubscribes = []; - }, e.prototype.isOnline = function() { - return T(this, void 0, void 0, function() { - return C(this, function(n) { - return this.isAvailableOnWeb ? [2, navigator.onLine] : [2, new Promise(function(t) { - fetch("https://www.google.com", { method: pe.GET, mode: "no-cors" }).then(function() { - return t(!0); - }).catch(function() { - return t(!1); - }); - })]; - }); - }); - }, e; -}(), Kb = function(e) { - function n(t) { - var r = t.userId, i = t.nickname, a = t.profileUrl, o = t.profileImage, s = t.preferredLanguages, c = e.call(this) || this; - return c.method = pe.PUT, c.path = "".concat(qt, "/").concat(encodeURIComponent(r)), c.params = Be(Xe({ nickname: i, profile_url: a, profile_file: o, preferred_languages: s })), c; - } - return O(n, e), n; -}(ge), Wb = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.user = new Dt(t, L({}, r)), i; - } - return O(n, e), n; -}(_e), N7 = function(e) { - function n(t) { - var r = t.userId, i = t.token, a = e.call(this) || this; - return a.method = pe.POST, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push/apns"), a.params = { apns_device_token: i, always_push: !0 }, a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.token = r.token, i.type = r.type ? ur[r.type.toLowerCase()] : ur.UNKNOWN, i.user = new Dt(t, r.user), i; - } - O(n, e); -})(_e); -var I7 = function(e) { - function n(t) { - var r = t.userId, i = t.token, a = e.call(this) || this; - return a.method = pe.POST, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push/gcm"), a.params = { gcm_reg_token: i, always_push: !0 }, a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.token = r.token, i.type = r.type ? ur[r.type.toLowerCase()] : ur.UNKNOWN, i.user = new Dt(t, r.user), i; - } - O(n, e); -})(_e); -var M7 = function(e) { - function n(t) { - var r = t.userId, i = t.token, a = e.call(this) || this; - return a.method = pe.DELETE, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push/apns/").concat(encodeURIComponent(i)), a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.token = r.token, i.user = new Dt(t, r.user), i.lastDeletedAt = r.device_token_last_deleted_at, i; - } - O(n, e); -})(_e); -var O7 = function(e) { - function n(t) { - var r = t.userId, i = t.token, a = e.call(this) || this; - return a.method = pe.DELETE, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push/gcm/").concat(encodeURIComponent(i)), a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.token = r.token, i.user = new Dt(t, r.user), i.lastDeletedAt = r.device_token_last_deleted_at, i; - } - O(n, e); -})(_e); -var x7 = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.DELETE, i.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push/apns"), i; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.type = r.type ? ur[r.type.toLowerCase()] : ur.UNKNOWN, i.user = new Dt(t, r.user), i.lastDeletedAt = r.device_token_last_deleted_at, i; - } - O(n, e); -})(_e); -var R7 = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.DELETE, i.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push/gcm"), i; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.type = r.type ? ur[r.type.toLowerCase()] : ur.UNKNOWN, i.user = new Dt(t, r.user), i.lastDeletedAt = r.device_token_last_deleted_at, i; - } - O(n, e); -})(_e); -var D7 = function(e) { - function n(t) { - var r = t.userId, i = t.type, a = t.token, o = t.ts, s = e.call(this) || this; - return s.method = pe.GET, s.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push/").concat(encodeURIComponent(i), "/device_tokens"), s.params = { created_ts: o, token: a }, s; - } - return O(n, e), n; -}(ge), L7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.pushTokens = { type: r.type ? ur[r.type.toLowerCase()] : ur.UNKNOWN, deviceTokens: r.device_tokens, hasMore: r.has_more, token: r.token }, i; - } - return O(n, e), n; -}(_e), P7 = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.GET, i.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/channel_invitation_preference"), i; - } - return O(n, e), n; -}(ge), k7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.autoAccept = r.auto_accept, i; - } - return O(n, e), n; -}(_e), U7 = function(e) { - function n(t) { - var r = t.userId, i = t.willAutoAccept, a = e.call(this) || this; - return a.method = pe.PUT, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/channel_invitation_preference"), a.params = { auto_accept: i }, a; - } - return O(n, e), n; -}(ge), F7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.autoAccept = r.auto_accept, i; - } - return O(n, e), n; -}(_e), B7 = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.GET, i.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push_preference"), i; - } - return O(n, e), n; -}(ge), H7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.preference = { doNotDisturbOn: r.do_not_disturb, startHour: r.start_hour, startMin: r.start_min, endHour: r.end_hour, endMin: r.end_min, timezone: r.timezone }, i; - } - return O(n, e), n; -}(_e), j7 = function(e) { - function n(t) { - var r = t.userId, i = t.doNotDisturbOn, a = t.startHour, o = t.startMin, s = t.endHour, c = t.endMin, l = t.timezone, u = e.call(this) || this; - return u.method = pe.PUT, u.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push_preference"), u.params = { do_not_disturb: i, start_hour: a, start_min: o, end_hour: s, end_min: c, timezone: l }, u; - } - return O(n, e), n; -}(ge), V7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.preference = { doNotDisturbOn: r.do_not_disturb, startHour: r.start_hour, startMin: r.start_min, endHour: r.end_hour, endMin: r.end_min, timezone: r.timezone }, i; - } - return O(n, e), n; -}(_e), G7 = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.GET, i.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push_preference"), i; - } - return O(n, e), n; -}(ge), z7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.snoozePeriod = { isSnoozeOn: r.snooze_enabled }, typeof r.snooze_start_ts == "number" && (i.snoozePeriod.startTs = r.snooze_start_ts), typeof r.snooze_end_ts == "number" && (i.snoozePeriod.endTs = r.snooze_end_ts), i; - } - return O(n, e), n; -}(_e), q7 = function(e) { - function n(t) { - var r = t.userId, i = t.snoozeOn, a = t.startTs, o = t.endTs, s = e.call(this) || this; - return s.method = pe.PUT, s.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push_preference"), s.params = { snooze_enabled: i, snooze_start_ts: a, snooze_end_ts: o }, s; - } - return O(n, e), n; -}(ge), K7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.snoozePeriod = { isSnoozeOn: r.snooze_enabled }, typeof r.snooze_start_ts == "number" && (i.snoozePeriod.startTs = r.snooze_start_ts), typeof r.snooze_end_ts == "number" && (i.snoozePeriod.endTs = r.snooze_end_ts), i; - } - return O(n, e), n; -}(_e), W7 = function(e) { - function n(t) { - var r = t.userId, i = t.blockedUserId, a = e.call(this) || this; - return a.method = pe.POST, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/block"), a.params = { target_id: i }, a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.user = new Dt(t, r), i; - } - O(n, e); -})(_e); -var Y7 = function(e) { - function n(t) { - var r = t.userId, i = t.unblockedUserId, a = e.call(this) || this; - return a.method = pe.DELETE, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/block/").concat(encodeURIComponent(i)), a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var Z7 = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.GET, i.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push_preference"), i; - } - return O(n, e), n; -}(ge), Q7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.pushTriggerOption = r.push_trigger_option, i; - } - return O(n, e), n; -}(_e), X7 = function(e) { - function n(t) { - var r = t.userId, i = t.pushTriggerOption, a = e.call(this) || this; - return a.method = pe.PUT, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push_preference"), a.params = { push_trigger_option: i }, a; - } - return O(n, e), n; -}(ge), J7 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.pushTriggerOption = r.push_trigger_option, i; - } - return O(n, e), n; -}(_e), $7 = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.GET, i.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push/template"), i; - } - return O(n, e), n; -}(ge), e8 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.name = r.name, i; - } - return O(n, e), n; -}(_e), t8 = function(e) { - function n(t) { - var r = t.userId, i = t.templateName, a = e.call(this) || this; - return a.method = pe.PUT, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/push/template"), a.params = { name: i }, a; - } - return O(n, e), n; -}(ge), n8 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.name = r.name, i; - } - return O(n, e), n; -}(_e), r8 = function(e) { - function n(t) { - var r = t.userId, i = t.token, a = e.call(this) || this; - return a.method = pe.GET, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/friends/changelogs"), a.params = { token: i }, a; - } - return O(n, e), n; -}(ge), i8 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.changelogs = { addedUsers: r.added.map(function(a) { - return new Dt(t, a); - }), updatedUsers: r.updated.map(function(a) { - return new Dt(t, a); - }), deletedUserIds: r.deleted, hasMore: r.has_more, token: r.next }, i; - } - return O(n, e), n; -}(_e), a8 = function(e) { - function n(t) { - var r = t.userId, i = t.discoveries, a = e.call(this) || this; - return a.method = pe.PUT, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/friend_discoveries"), a.params = { friend_discoveries: i.map(function(o) { - return { friend_discovery_key: o.friendDiscoveryKey, friend_name: o.friendName }; - }) }, a; - } - return O(n, e), n; -}(ge), o8 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.friendDiscoveryRequestId = r.friend_discovery_request_id, i; - } - return O(n, e), n; -}(_e), s8 = function(e) { - function n(t) { - var r = t.userId, i = t.discoveryKeys, a = e.call(this) || this; - return a.method = pe.DELETE, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/friend_discoveries"), a.params = { friend_discovery_keys: i }, a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var l8 = function(e) { - function n(t) { - var r = t.userId, i = t.userIds, a = e.call(this) || this; - return a.method = pe.POST, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/friends"), a.params = { user_ids: i }, a; - } - return O(n, e), n; -}(ge), c8 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.users = r.users.map(function(a) { - return new Dt(t, a); - }), i; - } - return O(n, e), n; -}(_e), u8 = function(e) { - function n(t) { - var r = t.userId, i = t.userIds, a = e.call(this) || this; - return a.method = pe.DELETE, a.path = "".concat(qt, "/").concat(encodeURIComponent(r), "/friends"), a.params = { user_ids: i }, a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var d8 = function(e) { - function n(t) { - var r = t.userId, i = e.call(this) || this; - return i.method = pe.GET, i.path = "".concat(qt, "/").concat(r, "/allow_friend_discovery"), i.params = {}, i; - } - return O(n, e), n; -}(ge), h8 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.allowFriendDiscovery = r.allow_friend_discovery, i; - } - return O(n, e), n; -}(_e), f8 = function(e) { - function n(t) { - var r = t.userId, i = t.allowFriendDiscovery, a = e.call(this) || this; - return a.method = pe.PUT, a.path = "".concat(qt, "/").concat(r, "/allow_friend_discovery"), a.params = { allow_friend_discovery: i }, a; - } - return O(n, e), n; -}(ge); -(function(e) { - function n() { - return e !== null && e.apply(this, arguments) || this; - } - O(n, e); -})(_e); -var au, p8 = function(e) { - function n() { - var t = e.call(this) || this; - return t.method = pe.GET, t.path = bw, t; - } - return O(n, e), n; -}(ge), v8 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.emojiContainer = new C7(r), i; - } - return O(n, e), n; -}(_e), m8 = function(e) { - function n(t) { - var r = t.categoryId, i = e.call(this) || this; - return i.method = pe.GET, i.path = "".concat(bw, "/").concat(r), i; - } - return O(n, e), n; -}(ge), g8 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.emojiCategory = new lN(r), i; - } - return O(n, e), n; -}(_e), y8 = function(e) { - function n(t) { - var r = t.key, i = e.call(this) || this; - return i.method = pe.GET, i.path = "".concat(m6, "/").concat(r), i; - } - return O(n, e), n; -}(ge), E8 = function(e) { - function n(t, r) { - var i = e.call(this, t, r) || this; - return i.emoji = new sN(r), i; - } - return O(n, e), n; -}(_e), _8 = function(e) { - function n() { - var t = e.call(this) || this; - return t.method = pe.GET, t.path = "".concat(g6), t; - } - return O(n, e), n; -}(ge), b8 = function(e) { - function n(t, r) { - var i, a = this, o = r ?? {}; - return (a = e.call(this, t, r) || this).uikitConfiguration = { string: JSON.stringify(o), json: o }, a.updatedAt = (i = r == null ? void 0 : r.updated_at) !== null && i !== void 0 ? i : 0, a; - } - return O(n, e), n; -}(_e), C8 = function() { - function e(n, t, r) { - var i = this; - this._storeInitialized = !1, this._iid = n, this.options = t; - var a = U.of(n), o = a.sdkState, s = a.cacheContext, c = a.dispatcher, l = a.sessionManager, u = a.requestQueue, d = a.logger, h = a.userEventHandlers, f = a.appStateToggleEnabled; - this._onlineDetector = new A7({ logger: d, connectionDelegate: { reconnect: function() { - return T(i, void 0, void 0, function() { - var v, m, E, y, _, S; - return C(this, function(b) { - switch (b.label) { - case 0: - if (v = U.of(n), m = v.sdkState, E = v.connectionManager, (y = v.sessionManager).session.hasSession) - return [3, 5]; - b.label = 1; - case 1: - return b.trys.push([1, 3, , 4]), [4, E.connect(y.session.authToken)]; - case 2: - return b.sent(), [3, 4]; - case 3: - if (_ = b.sent(), qr(_)) - throw _; - return d.debug("connect failed by reconnect event = ", _), [3, 4]; - case 4: - return [3, 9]; - case 5: - if (m.appState !== "foreground") - return [3, 9]; - b.label = 6; - case 6: - return b.trys.push([6, 8, , 9]), [4, E.resetAndReconnect()]; - case 7: - return b.sent(), [3, 9]; - case 8: - if (S = b.sent(), qr(S)) - throw S; - return d.debug("resetAndReconnect failed by reconnect event = ", S), [3, 9]; - case 9: - return c.dispatch(new zb()), [2]; - } - }); - }); - }, disconnect: function() { - Pn(function() { - return T(i, void 0, void 0, function() { - return C(this, function(v) { - switch (v.label) { - case 0: - return [4, U.of(n).connectionManager.disconnect()]; - case 1: - return v.sent(), [2]; - } - }); - }); - }); - } } }); - var p = new Mu(n, { localCacheEnabled: s.localCacheEnabled, enableAutoResend: s.localCacheConfig.enableAutoResend, dispatcher: c, sdkState: o, logger: d }); - r.forEach(function(v) { - v.init(n, { sdkState: o, cacheContext: s, dispatcher: c, sessionManager: l, requestQueue: u, logger: d, onlineDetector: i._onlineDetector }), i[v.name] = v; - }), this._appStateChangeDetector = new w7({ isEnabled: f }), this._appStateChangeDetector.on("resume", function() { - d.debug("the page resumes from freeze"), i.setForegroundState(); - }).on("pause", function() { - d.debug("the page freezes"), i.setBackgroundState(); - }), c.on(function(v) { - var m; - if (v instanceof bi) - v.stateType === tn.CONNECTED && p.processNonAutoResendRegisteredPendingMessages(); - else if (v instanceof En) { - if (v.code === "USEV") { - var E = v.as(qA).event; - if (E.category === Cd.FRIEND_DISCOVERED) { - var y = dp.getDataAsFriendDiscoveredEvent(n, E).friendDiscoveries; - Ke(function() { - return T(i, void 0, void 0, function() { - return C(this, function(w) { - return [2, h.forEach(function(M) { - M.onFriendsDiscovered && M.onFriendsDiscovered(y); - })]; - }); - }); - }); - } - } - } else if (v instanceof qw) { - var _ = U.of(i._iid).subscribedUnreadMessageCount, S = !1, b = v.ts; - if (typeof b == "number" && b > _.ts) { - if (_.all !== v.all && (S = !0), _.all = v.all >= 0 ? v.all : 0, v.customTypes) - for (var A in v.customTypes) - _.customTypes[A] !== v.customTypes[A] && (S = !0), _.customTypes[A] = v.customTypes[A]; - S = S && _.ts > 0, _.ts = b; - } - S && Ke(function() { - return T(i, void 0, void 0, function() { - return C(this, function(w) { - return [2, h.forEach(function(M) { - M.onTotalUnreadMessageCountChanged && M.onTotalUnreadMessageCountChanged({ groupChannelCount: _.all, feedChannelCount: _.feed, customTypeUnreadCount: _.customTypes }), M.onTotalUnreadMessageCountUpdated && M.onTotalUnreadMessageCountUpdated(_.all, _.customTypes); - })]; - }); - }); - }); - } else - v instanceof Yw ? (s.preference.set(i._getUserProfileCacheKey(o.userId), jm.payloadify(v.userProfile)), !((m = v.userProfile.appInfo.notificationInfo) === null || m === void 0) && m.isEnabled && s.preference.set(w1(i.appId), { value: !0 })) : v instanceof Ac && v.error && v.error.isSessionInvalidatedError && (d.debug("session revoked."), i.disconnect()); - }); - } - return e.init = function(n) { - var t = n.appId, r = n.appVersion, i = n.modules, a = i === void 0 ? [] : i, o = n.options, s = o === void 0 ? new yw() : o, c = n.debugMode, l = c !== void 0 && c, u = n.customApiHost, d = n.customWebSocketHost, h = n.newInstance, f = h !== void 0 && h, p = n.logLevel, v = n.localCacheEnabled, m = v !== void 0 && v, E = n.localCacheConfig, y = E === void 0 ? new _w() : E, _ = n.localCacheEncryption, S = n.useAsyncStorageStore, b = S === void 0 ? null : S, A = n.appStateToggleEnabled, w = A === void 0 || A; - if (!au || f) { - var M = "su-".concat(Ro()), N = _ ?? { encrypt: function(P) { - return P; - }, decrypt: function(P) { - return P; - } }, x = new Xo({ encryption: N }); - l || (x = km() ? b ? new iL({ AsyncStorage: b, encryption: N }) : new Xo({ encryption: N }) : new rL({ encryption: N })), new U(M, { appId: t, appVersion: r, options: s, apiHost: u ?? "https://api-".concat(t, ".sendbird.com"), websocketHost: d ?? "wss://ws-".concat(t, ".sendbird.com"), store: x, encryption: N, logLevel: p, localCacheEnabled: m, localCacheConfig: y, debugMode: l, appStateToggleEnabled: w }); - var D = [new AL(), new _7()], j = new e(M, s, dt(dt([], tt(a), !1), tt(D), !1)); - return au || (au = j), j; - } - return au; - }, Object.defineProperty(e, "instance", { get: function() { - return au; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "version", { get: function() { - return mw; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "appId", { get: function() { - return U.of(this._iid).sdkState.appId; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "appInfo", { get: function() { - var n = U.of(this._iid).appInfo; - return n ?? null; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "appVersion", { get: function() { - var n; - return (n = U.of(this._iid).sdkState.appVersion) !== null && n !== void 0 ? n : ""; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "debugMode", { get: function() { - return !!U.of(this._iid).debugMode; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "logLevel", { get: function() { - return U.of(this._iid).logger.level; - }, set: function(n) { - U.of(this._iid).logger.level = n; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isCacheEnabled", { get: function() { - return U.of(this._iid).cacheContext.localCacheEnabled; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "localCacheConfig", { get: function() { - var n = U.of(this._iid).cacheContext; - return n.localCacheEnabled ? n.localCacheConfig : null; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "ekey", { get: function() { - return U.of(this._iid).sessionManager.ekey; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "currentUser", { get: function() { - var n; - return (n = U.of(this._iid).sessionManager.currentUser) !== null && n !== void 0 ? n : null; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "connectionState", { get: function() { - var n = U.of(this._iid).connectionManager; - return n.isConnected ? ja.OPEN : n.isConnecting ? ja.CONNECTING : ja.CLOSED; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "lastConnectedAt", { get: function() { - var n = U.of(this._iid), t = n.connectedAt; - return n.connectionManager.isConnected ? t : 0; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "fcmPushToken", { get: function() { - var n; - return (n = this._fcmPushToken) !== null && n !== void 0 ? n : null; - }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "apnsPushToken", { get: function() { - var n; - return (n = this._apnsPushToken) !== null && n !== void 0 ? n : null; - }, enumerable: !1, configurable: !0 }), e.prototype._getNestDBVersion = function() { - return 6; - }, e.prototype._getPreferenceCacheKey = function(n) { - return "sendbird@".concat(this.appId, "/").concat(n, ".pref"); - }, e.prototype._getUserProfileCacheKey = function(n) { - return "sendbird@".concat(this.appId, "/").concat(n, ".profile"); - }, e.prototype.getMemoryStoreForDebugging = function() { - var n = U.of(this._iid), t = n.debugMode, r = n.cacheContext; - if (t) - return r.store instanceof Xo ? r.store : null; - throw H.debugModeRequired; - }, e.prototype.addExtension = function(n, t) { - var r = U.of(this._iid).sdkState; - ["sb_uikit", "sb_syncmanager", "device-os-platform"].indexOf(n) > -1 && r.extensions && (r.extensions[n] = t); - }, e.prototype.addSendbirdExtensions = function(n, t, r) { - var i, a, o = U.of(this._iid), s = o.logger, c = o.sdkState, l = new RegExp(T6); - if (n.length === 0) - return s.debug("sb.addSendbirdExtensions() has failed because the given sendbirdExtensions is empty."), !1; - if (n.find(function(v) { - return !l.test(v.version); - })) - return s.debug("sb.addSendbirdExtensions() has failed because the given version did not satisfy the SemVer specification."), !1; - if (r) - try { - for (var u = Ne(Object.entries(r)), d = u.next(); !d.done; d = u.next()) { - var h = tt(d.value, 2), f = h[0], p = h[1]; - if (/&|=/.test(f) || /&|=/.test(p)) - return s.debug("sb.addSendbirdExtensions() has failed because the given customData includes at least one invalid character: = or &."), !1; - } - } catch (v) { - i = { error: v }; - } finally { - try { - d && !d.done && (a = u.return) && a.call(u); - } finally { - if (i) - throw i.error; - } - } - return c.sendbirdRuntimeEnvironment = { sendbirdExtensions: n, deviceOS: t, customData: r }, !0; - }, e.prototype.setOnlineListener = function(n) { - this._onlineDetector.setOnlineListener(n); - }, e.prototype.setOfflineListener = function(n) { - this._onlineDetector.setOfflineListener(n); - }, e.prototype._safeInitializeStore = function(n) { - return T(this, void 0, void 0, function() { - var t; - return C(this, function(r) { - switch (r.label) { - case 0: - t = U.of(this._iid).cacheContext, r.label = 1; - case 1: - return r.trys.push([1, 3, , 5]), [4, t.store.init(n)]; - case 2: - return r.sent(), this._storeInitialized = !0, [3, 5]; - case 3: - return r.sent(), t.replaceStore(new Xo()), [4, this._safeInitializeStore(n)]; - case 4: - return r.sent(), [3, 5]; - case 5: - return [2]; - } - }); - }); - }, e.prototype.initializeCache = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c, l, u; - return C(this, function(d) { - switch (d.label) { - case 0: - if (t = U.of(this._iid), r = t.sdkState, i = t.cacheContext, a = t.dispatcher, o = t.logger, r.userId && r.userId === n) - return [3, 9]; - if (s = "sendbird@".concat(r.appId, "/").concat(n, ".db"), !i.localCacheEnabled) - return [3, 7]; - d.label = 1; - case 1: - return d.trys.push([1, 4, , 6]), i.nestdb && i.nestdb.state !== Ua.CLOSED && i.nestdb.name === s ? [3, 3] : (c = "sendbird@".concat(r.appId, "/").concat(n, ".db"), (l = i.nestdb = new aL({ name: c, version: this._getNestDBVersion(), store: i.store, config: new rh({ dbname: c, itemSizeLimit: 61440 }) })).on("upgrade", qb(l)), l.on("storeReplaced", function(h) { - i.replaceStore(h), i.localCacheEnabled = !1, l.on("upgrade", qb(l)); - }), [4, l.open()]); - case 2: - d.sent(), this._storeInitialized = !0, a.dispatch(new GA(this._iid, { userId: n })), d.label = 3; - case 3: - return r.userId = n, [3, 6]; - case 4: - return u = d.sent(), o.warn("Nest DB Open Failed. ", u), i.store instanceof Xo || (i.replaceStore(new Xo()), i.localCacheEnabled = !1), [4, this._safeInitializeStore(s)]; - case 5: - throw d.sent(), r.userId = n, H.databaseError; - case 6: - return [3, 9]; - case 7: - return [4, this._safeInitializeStore(s)]; - case 8: - d.sent(), r.userId = n, d.label = 9; - case 9: - return [2]; - } - }); - }); - }, e.prototype.getCacheDataSize = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return (n = U.of(this._iid).cacheContext).localCacheEnabled && n.nestdb ? [4, n.nestdb.estimateUsage()] : [3, 2]; - case 1: - return [2, t.sent()]; - case 2: - return [2, 0]; - } - }); - }); - }, e.prototype.clearCachedData = function() { - return T(this, void 0, void 0, function() { - var n; - return C(this, function(t) { - switch (t.label) { - case 0: - return (n = U.of(this._iid).cacheContext).localCacheEnabled && n.nestdb ? [4, n.nestdb.clear()] : [3, 2]; - case 1: - t.sent(), t.label = 2; - case 2: - return this._storeInitialized ? [4, n.preference.clear()] : [3, 4]; - case 3: - t.sent(), t.label = 4; - case 4: - return [2]; - } - }); - }); - }, e.prototype.clearCachedMessages = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i = this; - return C(this, function(a) { - switch (a.label) { - case 0: - return ve(Ot("string", n)).throw(H.invalidParameters), t = ac.of(this._iid), r = Il.of(this._iid), t && r ? [4, Promise.all(n.map(function(o) { - return T(i, void 0, void 0, function() { - return C(this, function(s) { - switch (s.label) { - case 0: - return [4, t.removeMessagesOfChannel(o)]; - case 1: - return s.sent(), [4, r.removeMessagesOfChannel(o)]; - case 2: - return s.sent(), [2]; - } - }); - }); - }))] : [3, 2]; - case 1: - a.sent(), a.label = 2; - case 2: - return [2]; - } - }); - }); - }, e.prototype._setupPreference = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return t = U.of(this._iid), r = t.sdkState, i = t.cacheContext, a = t.statLogCollector, [4, i.preference.init(this._getPreferenceCacheKey(n), this._getNestDBVersion())]; - case 1: - return s.sent(), [4, i.preference.get(this._getUserProfileCacheKey(n))]; - case 2: - return (o = s.sent()) && new jm(this._iid, o).apply(), [4, a.init("sendbird@".concat(r.appId, "/").concat(n, ".statlog"))]; - case 3: - return s.sent(), [2]; - } - }); - }); - }, e.prototype._ready = function(n, t, r) { - return r === void 0 && (r = {}), T(this, void 0, void 0, function() { - var i, a, o, s, c, l; - return C(this, function(u) { - switch (u.label) { - case 0: - return ve(k("string", n) && k("string", t, !0)).throw(H.invalidParameters), i = U.of(this._iid), a = i.sdkState, o = i.cacheContext, s = i.connectionManager, c = r.errorForOtherUser, a.userId && a.userId !== n ? c ? [3, 2] : [4, s.logout()] : [3, 3]; - case 1: - return u.sent(), [3, 3]; - case 2: - throw c; - case 3: - return u.trys.push([3, 5, 6, 8]), [4, this.initializeCache(n)]; - case 4: - return u.sent(), U.of(this._iid).dispatcher.dispatch(new zA()), [3, 8]; - case 5: - return u.sent(), l = U.of(this._iid).logger, o.localCacheEnabled = !1, l.warn("Cache initialization failed - cache is not available."), [3, 8]; - case 6: - return [4, this._setupPreference(n)]; - case 7: - return u.sent(), [7]; - case 8: - return [2]; - } - }); - }); - }, e.prototype.authenticateFeed = function(n, t) { - var r; - return T(this, void 0, void 0, function() { - var i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return i = U.of(this._iid), a = i.sessionManager, o = i.connectionManager, [4, this._ready(n, t, { errorForOtherUser: o.isConnected ? H.alreadyConnectedAsAnotherUser : void 0 })]; - case 1: - return s.sent(), !((r = a.session.services) === null || r === void 0) && r.includes(md.CHAT) ? [3, 3] : [4, a.authenticateFeed(n, t)]; - case 2: - s.sent(), s.label = 3; - case 3: - return [2, this.currentUser]; - } - }); - }); - }, e.prototype.connect = function(n, t) { - return T(this, void 0, void 0, function() { - return C(this, function(r) { - switch (r.label) { - case 0: - return [4, this._ready(n, t)]; - case 1: - r.sent(), r.label = 2; - case 2: - return r.trys.push([2, , 4, 5]), [4, U.of(this._iid).connectionManager.connect(t)]; - case 3: - return r.sent(), [3, 5]; - case 4: - return this._onlineDetector.start(), this._appStateChangeDetector.start(), [7]; - case 5: - return [2, this.currentUser]; - } - }); - }); - }, e.prototype.reconnect = function() { - var n = U.of(this._iid), t = n.connectionManager, r = n.sdkState, i = n.sessionManager.session.hasSession; - return i && (this._appStateChangeDetector.start(), this._onlineDetector.start(), t.resetAndReconnect().then(function() { - r.appState = "foreground"; - }).catch(function() { - })), i; - }, e.prototype.disconnect = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return n = U.of(this._iid), t = n.connectionManager, r = n.sdkState, i = n.requestQueue, this._appStateChangeDetector.stop(), this._onlineDetector.stop(), i.cancelAll(), [4, t.logout()]; - case 1: - return a.sent(), [4, this.clearCachedData()]; - case 2: - return a.sent(), r.appState = "foreground", [2]; - } - }); - }); - }, e.prototype.disconnectWebSocket = function() { - return T(this, void 0, void 0, function() { - var n, t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return n = U.of(this._iid), t = n.connectionManager, r = n.requestQueue, this._appStateChangeDetector.stop(), this._onlineDetector.stop(), r.cancelAll(), [4, t.disconnectWebSocket(!0)]; - case 1: - return i.sent(), [2]; - } - }); - }); - }, e.prototype.setBackgroundState = function() { - var n = U.of(this._iid), t = n.connectionManager, r = n.sdkState, i = n.logger; - r.appState === "foreground" && (r.appState = "background", i.debug("going background state"), t.background().catch(function(a) { - i.debug("setBackgroundState error = ", a); - })); - }, e.prototype.setForegroundState = function() { - var n = U.of(this._iid), t = n.connectionManager, r = n.sdkState, i = n.dispatcher, a = n.logger; - r.appState === "background" && (r.appState = "foreground", a.debug("going foreground state"), t.resetAndReconnect().catch(function(o) { - a.debug("setForgroundState error = ", o); - }), i.dispatch(new zb())); - }, e.prototype.setSessionHandler = function(n) { - ve(n instanceof B5).throw(H.invalidParameters), U.of(this._iid).sessionManager.handler = n; - }, e.prototype.addUserEventHandler = function(n, t) { - ve(k("string", n) && t instanceof H5).throw(H.invalidParameters), U.of(this._iid).userEventHandlers.set(n, t); - }, e.prototype.removeUserEventHandler = function(n) { - U.of(this._iid).userEventHandlers.delete(n); - }, e.prototype.removeAllUserEventHandler = function() { - U.of(this._iid).userEventHandlers.clear(); - }, e.prototype.addConnectionHandler = function(n, t) { - ve(k("string", n) && t instanceof FA).throw(H.invalidParameters), U.of(this._iid).connectionHandlers.set(n, t); - }, e.prototype.removeConnectionHandler = function(n) { - U.of(this._iid).connectionHandlers.delete(n); - }, e.prototype.removeAllConnectionHandler = function() { - U.of(this._iid).connectionHandlers.clear(); - }, e.prototype.createApplicationUserListQuery = function(n) { - return n === void 0 && (n = {}), new G5(this._iid, n); - }, e.prototype.createBlockedUserListQuery = function(n) { - return n === void 0 && (n = {}), new K5(this._iid, n); - }, e.prototype.createFriendListQuery = function(n) { - return n === void 0 && (n = {}), new Z5(this._iid, n); - }, e.prototype.createMessageSearchQuery = function(n) { - return new _L(this._iid, n); - }, e.prototype.createPollListQuery = function(n) { - return new uA(this._iid, L({}, n)); - }, e.prototype.createPollVoterListQuery = function(n) { - return new dA(this._iid, L({}, n)); - }, e.prototype.buildUserFromSerializedData = function(n) { - var t = ms(n); - return new Dt(this._iid, Dt.payloadify(t)); - }, e.prototype.updateCurrentUserInfo = function(n) { - return n === void 0 && (n = {}), T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return t = L(L({}, T7), n), ve(function(u) { - return fr(u.profileImage, !0) && k("string", u.profileUrl, !0) && k("string", u.nickname, !0); - }(t)).throw(H.invalidParameters), this.currentUser ? (r = U.of(this._iid), i = r.sdkState, a = r.requestQueue, o = new Kb(L({ userId: i.userId }, t)), [4, a.send(o)]) : [3, 2]; - case 1: - return s = l.sent(), c = s.as(Wb).user, this.currentUser && (t.nickname && (this.currentUser.nickname = c.nickname), (t.profileUrl || t.profileImage) && (this.currentUser.plainProfileUrl = c.profileUrl)), [2, c]; - case 2: - throw H.connectionRequired; - } - }); - }); - }, e.prototype.updateCurrentUserInfoWithPreferredLanguages = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s; - return C(this, function(c) { - switch (c.label) { - case 0: - return ve(Ot("string", n)).throw(H.invalidParameters), this.currentUser ? (t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new Kb({ userId: r.userId, preferredLanguages: n }), [4, i.send(a)]) : [3, 2]; - case 1: - return o = c.sent(), s = o.as(Wb).user, this.currentUser && (this.currentUser.preferredLanguages = s.preferredLanguages), [2, s]; - case 2: - throw H.connectionRequired; - } - }); - }); - }, e.prototype.registerFCMPushTokenForCurrentUser = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s = this; - return C(this, function(c) { - switch (c.label) { - case 0: - if (ve(k("string", n)).throw(H.invalidParameters), !this.currentUser) - return [3, 6]; - c.label = 1; - case 1: - return c.trys.push([1, 4, , 5]), t = U.of(this._iid), r = t.sessionManager, i = t.sdkState, a = t.requestQueue, r.hasDeviceToken(ur.FCM, n) ? [2, Gr.SUCCESS] : (o = new I7({ userId: i.userId, token: n }), [4, a.send(o)]); - case 2: - return c.sent(), [4, Pn(function() { - return T(s, void 0, void 0, function() { - return C(this, function(l) { - switch (l.label) { - case 0: - return r.setDeviceToken(ur.FCM, n), [4, r.saveDeviceToken()]; - case 1: - return l.sent(), [2]; - } - }); - }); - })]; - case 3: - return c.sent(), this._fcmPushToken = "", [2, Gr.SUCCESS]; - case 4: - return c.sent(), [2, Gr.ERROR]; - case 5: - return [3, 7]; - case 6: - return this._fcmPushToken = n, [2, Gr.PENDING]; - case 7: - return [2]; - } - }); - }); - }, e.prototype.unregisterFCMPushTokenForCurrentUser = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c = this; - return C(this, function(l) { - switch (l.label) { - case 0: - if (ve(k("string", n)).throw(H.invalidParameters), !this.currentUser) - return [3, 6]; - l.label = 1; - case 1: - return l.trys.push([1, 4, , 5]), t = U.of(this._iid), r = t.sessionManager, i = t.sdkState, a = t.requestQueue, o = new O7({ userId: i.userId, token: n }), [4, a.send(o)]; - case 2: - return s = l.sent().lastDeletedAt, [4, Pn(function() { - return T(c, void 0, void 0, function() { - return C(this, function(u) { - switch (u.label) { - case 0: - return r.unsetDeviceToken(ur.FCM, n), r.setDeviceTokenDeletedAt(s), [4, r.saveDeviceToken()]; - case 1: - return u.sent(), [2]; - } - }); - }); - })]; - case 3: - return l.sent(), this._fcmPushToken = "", [2, Gr.SUCCESS]; - case 4: - return l.sent(), [2, Gr.ERROR]; - case 5: - return [3, 7]; - case 6: - return this._fcmPushToken = n, [2, Gr.PENDING]; - case 7: - return [2]; - } - }); - }); - }, e.prototype.unregisterFCMPushTokenAllForCurrentUser = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o, s = this; - return C(this, function(c) { - switch (c.label) { - case 0: - return this.currentUser ? (n = U.of(this._iid), t = n.sessionManager, r = n.sdkState, i = n.requestQueue, a = new R7({ userId: r.userId }), [4, i.send(a)]) : [3, 3]; - case 1: - return o = c.sent().lastDeletedAt, [4, Pn(function() { - return T(s, void 0, void 0, function() { - return C(this, function(l) { - switch (l.label) { - case 0: - return t.unsetDeviceTokens(ur.FCM), t.setDeviceTokenDeletedAt(o), [4, t.saveDeviceToken()]; - case 1: - return l.sent(), [2]; - } - }); - }); - })]; - case 2: - c.sent(), c.label = 3; - case 3: - return [2]; - } - }); - }); - }, e.prototype.registerAPNSPushTokenForCurrentUser = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s = this; - return C(this, function(c) { - switch (c.label) { - case 0: - if (ve(k("string", n)).throw(H.invalidParameters), !this.currentUser) - return [3, 6]; - c.label = 1; - case 1: - return c.trys.push([1, 4, , 5]), t = U.of(this._iid), r = t.sessionManager, i = t.sdkState, a = t.requestQueue, r.hasDeviceToken(ur.APNS, n) ? [2, Gr.SUCCESS] : (o = new N7({ userId: i.userId, token: n }), [4, a.send(o)]); - case 2: - return c.sent(), [4, Pn(function() { - return T(s, void 0, void 0, function() { - return C(this, function(l) { - switch (l.label) { - case 0: - return r.setDeviceToken(ur.APNS, n), [4, r.saveDeviceToken()]; - case 1: - return l.sent(), [2]; - } - }); - }); - })]; - case 3: - return c.sent(), this._apnsPushToken = "", [2, Gr.SUCCESS]; - case 4: - return c.sent(), [2, Gr.ERROR]; - case 5: - return [3, 7]; - case 6: - return this._apnsPushToken = n, [2, Gr.PENDING]; - case 7: - return [2]; - } - }); - }); - }, e.prototype.unregisterAPNSPushTokenForCurrentUser = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o, s, c = this; - return C(this, function(l) { - switch (l.label) { - case 0: - if (ve(k("string", n)).throw(H.invalidParameters), !this.currentUser) - return [3, 6]; - l.label = 1; - case 1: - return l.trys.push([1, 4, , 5]), t = U.of(this._iid), r = t.sessionManager, i = t.sdkState, a = t.requestQueue, o = new M7({ userId: i.userId, token: n }), [4, a.send(o)]; - case 2: - return s = l.sent().lastDeletedAt, [4, Pn(function() { - return T(c, void 0, void 0, function() { - return C(this, function(u) { - switch (u.label) { - case 0: - return r.unsetDeviceToken(ur.APNS, n), r.setDeviceTokenDeletedAt(s), [4, r.saveDeviceToken()]; - case 1: - return u.sent(), [2]; - } - }); - }); - })]; - case 3: - return l.sent(), this._apnsPushToken = "", [2, Gr.SUCCESS]; - case 4: - return l.sent(), [2, Gr.ERROR]; - case 5: - return [3, 7]; - case 6: - return this._apnsPushToken = n, [2, Gr.PENDING]; - case 7: - return [2]; - } - }); - }); - }, e.prototype.unregisterAPNSPushTokenAllForCurrentUser = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a, o, s = this; - return C(this, function(c) { - switch (c.label) { - case 0: - return this.currentUser ? (n = U.of(this._iid), t = n.sessionManager, r = n.sdkState, i = n.requestQueue, a = new x7({ userId: r.userId }), [4, i.send(a)]) : [3, 3]; - case 1: - return o = c.sent().lastDeletedAt, [4, Pn(function() { - return T(s, void 0, void 0, function() { - return C(this, function(l) { - switch (l.label) { - case 0: - return t.unsetDeviceTokens(ur.APNS), t.setDeviceTokenDeletedAt(o), [4, t.saveDeviceToken()]; - case 1: - return l.sent(), [2]; - } - }); - }); - })]; - case 2: - c.sent(), c.label = 3; - case 3: - return [2]; - } - }); - }); - }, e.prototype.getChannelInvitationPreference = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return n = U.of(this._iid), t = n.sdkState, r = n.requestQueue, i = new P7({ userId: t.userId }), [4, r.send(i)]; - case 1: - return a = o.sent(), [2, { autoAccept: a.as(k7).autoAccept }]; - } - }); - }); - }, e.prototype.setChannelInvitationPreference = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(k("boolean", n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new U7({ userId: r.userId, willAutoAccept: n }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, { autoAccept: o.as(F7).autoAccept }]; - } - }); - }); - }, e.prototype.getDoNotDisturb = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return n = U.of(this._iid), t = n.sdkState, r = n.requestQueue, i = new B7({ userId: t.userId }), [4, r.send(i)]; - case 1: - return a = o.sent(), [2, a.as(H7).preference]; - } - }); - }); - }, e.prototype.setDoNotDisturb = function(n, t, r, i, a, o) { - return t === void 0 && (t = 0), r === void 0 && (r = 0), i === void 0 && (i = 0), a === void 0 && (a = 0), o === void 0 && (o = ""), T(this, void 0, void 0, function() { - var s, c, l, u, d; - return C(this, function(h) { - switch (h.label) { - case 0: - return ve(k("boolean", n) && k("number", t) && k("number", r) && k("number", i) && k("number", a) && k("string", o)).throw(H.invalidParameters), s = U.of(this._iid), c = s.sdkState, l = s.requestQueue, u = new j7({ userId: c.userId, doNotDisturbOn: n, startHour: t, startMin: r, endHour: i, endMin: a, timezone: o }), [4, l.send(u)]; - case 1: - return d = h.sent(), [2, d.as(V7).preference]; - } - }); - }); - }, e.prototype.getSnoozePeriod = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return n = U.of(this._iid), t = n.sdkState, r = n.requestQueue, i = new G7({ userId: t.userId }), [4, r.send(i)]; - case 1: - return a = o.sent(), [2, a.as(z7).snoozePeriod]; - } - }); - }); - }, e.prototype.setSnoozePeriod = function(n, t, r) { - return t === void 0 && (t = 0), r === void 0 && (r = 0), T(this, void 0, void 0, function() { - var i, a, o, s, c; - return C(this, function(l) { - switch (l.label) { - case 0: - return ve(k("boolean", n) && k("number", t) && k("number", r)).throw(H.invalidParameters), i = U.of(this._iid), a = i.sdkState, o = i.requestQueue, s = new q7({ userId: a.userId, snoozeOn: n, startTs: t, endTs: r }), [4, o.send(s)]; - case 1: - return c = l.sent(), [2, c.as(K7).snoozePeriod]; - } - }); - }); - }, e.prototype.getMyPushTokensByToken = function(n, t) { - return T(this, void 0, void 0, function() { - var r, i, a, o, s, c, l, u, d, h, f, p; - return C(this, function(v) { - switch (v.label) { - case 0: - return ve(k("string", n) && Mt(ur, t)).throw(H.invalidParameters), r = U.of(this._iid), i = r.sdkState, a = r.requestQueue, o = r.sessionManager, s = new D7({ userId: i.userId, type: t, token: n }), [4, a.send(s)]; - case 1: - c = v.sent(), l = c.as(L7).pushTokens; - try { - for (u = Ne(l.deviceTokens), d = u.next(); !d.done; d = u.next()) - h = d.value, o.setDeviceToken(l.type, h); - } catch (m) { - f = { error: m }; - } finally { - try { - d && !d.done && (p = u.return) && p.call(u); - } finally { - if (f) - throw f.error; - } - } - return [4, o.saveDeviceToken()]; - case 2: - return v.sent(), [2, l]; - } - }); - }); - }, e.prototype.getPushTriggerOption = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return n = U.of(this._iid), t = n.sdkState, r = n.requestQueue, i = new Z7({ userId: t.userId }), [4, r.send(i)]; - case 1: - return [2, a.sent().as(Q7).pushTriggerOption]; - } - }); - }); - }, e.prototype.setPushTriggerOption = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return ve(Mt(el, n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new X7({ userId: r.userId, pushTriggerOption: n }), [4, i.send(a)]; - case 1: - return [2, o.sent().as(J7).pushTriggerOption]; - } - }); - }); - }, e.prototype.getPushTemplate = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return n = U.of(this._iid), t = n.sdkState, r = n.requestQueue, i = new $7({ userId: t.userId }), [4, r.send(i)]; - case 1: - return [2, a.sent().as(e8).name]; - } - }); - }); - }, e.prototype.setPushTemplate = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return ve(Mt(Rm, n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new t8({ userId: r.userId, templateName: n }), [4, i.send(a)]; - case 1: - return [2, o.sent().as(n8).name]; - } - }); - }); - }, e.prototype.blockUser = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return ve(n instanceof Dt || k("string", n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new W7({ userId: r.userId, blockedUserId: n instanceof Dt ? n.userId : n }), [4, i.send(a)]; - case 1: - return o.sent(), [2]; - } - }); - }); - }, e.prototype.blockUserWithUserId = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return [2, this.blockUser(n)]; - }); - }); - }, e.prototype.unblockUser = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return ve(n instanceof Dt || k("string", n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new Y7({ userId: r.userId, unblockedUserId: n instanceof Dt ? n.userId : n }), [4, i.send(a)]; - case 1: - return o.sent(), [2]; - } - }); - }); - }, e.prototype.unblockUserWithUserId = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return [2, this.unblockUser(n)]; - }); - }); - }, e.prototype.getFriendChangeLogsByToken = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(k("string", n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new r8({ userId: r.userId, token: n }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(i8).changelogs]; - } - }); - }); - }, e.prototype.getAllowFriendDiscovery = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return n = U.of(this._iid), t = n.sdkState, r = n.requestQueue, i = new d8({ userId: t.userId }), [4, r.send(i)]; - case 1: - return a = o.sent(), [2, a.as(h8).allowFriendDiscovery]; - } - }); - }); - }, e.prototype.setAllowFriendDiscovery = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return ve(k("boolean", n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new f8({ userId: r.userId, allowFriendDiscovery: n }), [4, i.send(a)]; - case 1: - return o.sent(), [2, n]; - } - }); - }); - }, e.prototype.uploadFriendDiscoveries = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new a8({ userId: r.userId, discoveries: n }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(o8).friendDiscoveryRequestId]; - } - }); - }); - }, e.prototype.deleteFriendDiscovery = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return [2, this.deleteFriendDiscoveries([n])]; - }); - }); - }, e.prototype.deleteFriendDiscoveries = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return ve(Ot("string", n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new s8({ userId: r.userId, discoveryKeys: n }), [4, i.send(a)]; - case 1: - return o.sent(), [2]; - } - }); - }); - }, e.prototype.addFriends = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a, o; - return C(this, function(s) { - switch (s.label) { - case 0: - return ve(Ot("string", n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new l8({ userId: r.userId, userIds: n }), [4, i.send(a)]; - case 1: - return o = s.sent(), [2, o.as(c8).users]; - } - }); - }); - }, e.prototype.deleteFriend = function(n) { - return T(this, void 0, void 0, function() { - return C(this, function(t) { - return [2, this.deleteFriends([n])]; - }); - }); - }, e.prototype.deleteFriends = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i, a; - return C(this, function(o) { - switch (o.label) { - case 0: - return ve(Ot("string", n)).throw(H.invalidParameters), t = U.of(this._iid), r = t.sdkState, i = t.requestQueue, a = new u8({ userId: r.userId, userIds: n }), [4, i.send(a)]; - case 1: - return o.sent(), [2]; - } - }); - }); - }, e.prototype.getAllEmoji = function() { - return T(this, void 0, void 0, function() { - var n, t, r; - return C(this, function(i) { - switch (i.label) { - case 0: - return n = U.of(this._iid).requestQueue, t = new p8(), [4, n.send(t)]; - case 1: - return r = i.sent(), [2, r.as(v8).emojiContainer]; - } - }); - }); - }, e.prototype.getEmojiCategory = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new m8({ categoryId: n }), [4, t.send(r)]; - case 1: - return i = a.sent(), [2, i.as(g8).emojiCategory]; - } - }); - }); - }, e.prototype.getEmoji = function(n) { - return T(this, void 0, void 0, function() { - var t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return t = U.of(this._iid).requestQueue, r = new y8({ key: n }), [4, t.send(r)]; - case 1: - return i = a.sent(), [2, i.as(E8).emoji]; - } - }); - }); - }, e.prototype.getUIKitConfiguration = function() { - return T(this, void 0, void 0, function() { - var n, t, r, i; - return C(this, function(a) { - switch (a.label) { - case 0: - return n = U.of(this._iid), ve(n.hasExtension("sb_uikit")).throw(H.notSupportedError), t = n.requestQueue, r = new _8(), [4, t.send(r)]; - case 1: - return i = a.sent(), [2, i.as(b8).uikitConfiguration]; - } - }); - }); - }, e; -}(); -function Zt(e) { - return typeof e == "boolean"; -} -function ou(e, n) { - return n.includes(e); -} -function T8(e) { - return e instanceof Set; -} -function S8(e, n) { - return Object.prototype.toString.call(e) === Object.prototype.toString.call(n); -} -function sg(e) { - if (typeof e != "object" || e === null) - return e; - if (Array.isArray(e)) - return e.map((t) => sg(t)); - const n = {}; - return Object.keys(e).forEach((t) => { - const r = t.replace(/_\w/g, (i) => i[1].toUpperCase()); - n[r] = sg(e[t]); - }), n; -} -globalThis && globalThis.__rest; -globalThis && globalThis.__awaiter; -function cN(e, n) { - const t = Object.assign({}, e); - return Object.keys(n).forEach((r) => { - Object.prototype.hasOwnProperty.call(t, r) && S8(t[r], n[r]) && (typeof n[r] == "object" && !Array.isArray(n[r]) ? t[r] = cN(t[r], n[r]) : t[r] = n[r]); - }), t; -} -const U1 = () => ({ - common: { - enableUsingDefaultUserProfile: !1 - }, - groupChannel: { - channel: { - enableMention: !1, - enableOgtag: !0, - enableReactions: !0, - enableReactionsSupergroup: !1, - enableTypingIndicator: !0, - enableVoiceMessage: !1, - input: { - camera: { - enablePhoto: !0, - enableVideo: !0 - }, - enableDocument: !0, - gallery: { - enablePhoto: !0, - enableVideo: !0 - } - }, - replyType: "quote_reply", - threadReplySelectType: "thread", - typingIndicatorTypes: /* @__PURE__ */ new Set(["text"]), - enableFeedback: !1, - enableSuggestedReplies: !1, - showSuggestedRepliesFor: "last_message_only" - }, - channelList: { - enableMessageReceiptStatus: !1, - enableTypingIndicator: !1 - }, - setting: { - enableMessageSearch: !1 - } - }, - openChannel: { - channel: { - enableOgtag: !0, - input: { - camera: { - enablePhoto: !0, - enableVideo: !0 - }, - enableDocument: !0, - gallery: { - enablePhoto: !0, - enableVideo: !0 - } - } - } - } -}); -function w8(e) { - return delete e.groupChannel.channel.typingIndicatorTypes, delete e.groupChannel.channel.enableFeedback, delete e.groupChannel.channel.enableSuggestedReplies, delete e.groupChannel.channel.showSuggestedRepliesFor, e; -} -const uN = () => { - const e = U1(); - return w8(e); -}, Yb = U1(), A8 = uN(); -var pp = globalThis && globalThis.__awaiter || function(e, n, t, r) { - function i(a) { - return a instanceof t ? a : new t(function(o) { - o(a); - }); - } - return new (t || (t = Promise))(function(a, o) { - function s(u) { - try { - l(r.next(u)); - } catch (d) { - o(d); - } - } - function c(u) { - try { - l(r.throw(u)); - } catch (d) { - o(d); - } - } - function l(u) { - u.done ? a(u.value) : i(u.value).then(s, c); - } - l((r = r.apply(e, n || [])).next()); - }); -}; -const lg = { - items: {}, - getItem(e) { - var n; - return pp(this, void 0, void 0, function* () { - return (n = lg.items[e]) !== null && n !== void 0 ? n : null; - }); - }, - setItem(e, n) { - return pp(this, void 0, void 0, function* () { - lg.items[e] = n; - }); - } -}; -class N8 { - constructor(n) { - this.storage = n ?? lg; - } - init(n) { - return this.key = `sbu@${n}.uikitConfiguration`, this.get(); - } - get safeKey() { - if (!this.key) - throw new Error("Please UIKitConfigManager.init() first"); - return this.key; - } - update(n) { - return pp(this, void 0, void 0, function* () { - const t = yield this.get(), r = { - updatedAt: n.updatedAt, - configuration: cN(t.configuration, n.configuration) - }; - return yield this.storage.setItem(this.safeKey, JSON.stringify(r)), r; - }); - } - get() { - return pp(this, void 0, void 0, function* () { - const n = { - updatedAt: 0, - configuration: A8 - }; - try { - const t = yield this.storage.getItem(this.safeKey); - return t ? JSON.parse(t) : n; - } catch { - return n; - } - }); - } -} -function I8(e, n, t) { - var r, i; - t.common && Zt((r = t.common) === null || r === void 0 ? void 0 : r.enableUsingDefaultUserProfile) && (e.enableUsingDefaultUserProfile = t.common.enableUsingDefaultUserProfile), n.common && Zt((i = n.common) === null || i === void 0 ? void 0 : i.enableUsingDefaultUserProfile) && (e.enableUsingDefaultUserProfile = n.common.enableUsingDefaultUserProfile); -} -function M8(e, n, t) { - O8(e, n, t), x8(e, n, t), R8(e, n, t), D8(e, n, t); -} -function O8(e, n, t) { - var r, i, a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M, N, x, D, j, P, G, z, q, Y, ye, $, ae, de, re, K, ee, J, B, se, te, Me, Ie, we, Q, ze, Ce, ke, et, Je, ot, Te, De, Ze, Le, qe, He, Fe, Ct, lt, Pt, Pe, Xt, At, Yt, rn, xt, pt, We, Oe, oe, $e, rt, ct, Bt, Rt, cn, _t, un, vn, Vt, Jt, Ht, kt, Ve, st, Re, vt, Et, F, he, be, je, ft, Se, V, le; - !((r = t.groupChannel) === null || r === void 0) && r.channel && Zt((a = (i = t.groupChannel) === null || i === void 0 ? void 0 : i.channel) === null || a === void 0 ? void 0 : a.enableOgtag) && (e.channel.enableOgtag = t.groupChannel.channel.enableOgtag), !((o = n.groupChannel) === null || o === void 0) && o.channel && Zt((c = (s = n.groupChannel) === null || s === void 0 ? void 0 : s.channel) === null || c === void 0 ? void 0 : c.enableOgtag) && (e.channel.enableOgtag = (u = (l = n.groupChannel) === null || l === void 0 ? void 0 : l.channel) === null || u === void 0 ? void 0 : u.enableOgtag), !((d = t.groupChannel) === null || d === void 0) && d.channel && Zt((f = (h = t.groupChannel) === null || h === void 0 ? void 0 : h.channel) === null || f === void 0 ? void 0 : f.enableTypingIndicator) && (e.channel.enableTypingIndicator = (v = (p = t.groupChannel) === null || p === void 0 ? void 0 : p.channel) === null || v === void 0 ? void 0 : v.enableTypingIndicator), !((m = n.groupChannel) === null || m === void 0) && m.channel && Zt((y = (E = n.groupChannel) === null || E === void 0 ? void 0 : E.channel) === null || y === void 0 ? void 0 : y.enableTypingIndicator) && (e.channel.enableTypingIndicator = (S = (_ = n.groupChannel) === null || _ === void 0 ? void 0 : _.channel) === null || S === void 0 ? void 0 : S.enableTypingIndicator), !((b = t.groupChannel) === null || b === void 0) && b.channel && Zt((w = (A = t.groupChannel) === null || A === void 0 ? void 0 : A.channel) === null || w === void 0 ? void 0 : w.enableReactions) && (e.channel.enableReactions = (N = (M = t.groupChannel) === null || M === void 0 ? void 0 : M.channel) === null || N === void 0 ? void 0 : N.enableReactions), !((x = n.groupChannel) === null || x === void 0) && x.channel && Zt((j = (D = n.groupChannel) === null || D === void 0 ? void 0 : D.channel) === null || j === void 0 ? void 0 : j.enableReactions) && (e.channel.enableReactions = (G = (P = n.groupChannel) === null || P === void 0 ? void 0 : P.channel) === null || G === void 0 ? void 0 : G.enableReactions), !((z = t.groupChannel) === null || z === void 0) && z.channel && Zt((Y = (q = t.groupChannel) === null || q === void 0 ? void 0 : q.channel) === null || Y === void 0 ? void 0 : Y.enableReactionsSupergroup) && (e.channel.enableReactionsSupergroup = ($ = (ye = t.groupChannel) === null || ye === void 0 ? void 0 : ye.channel) === null || $ === void 0 ? void 0 : $.enableReactionsSupergroup), !((ae = n.groupChannel) === null || ae === void 0) && ae.channel && Zt((re = (de = n.groupChannel) === null || de === void 0 ? void 0 : de.channel) === null || re === void 0 ? void 0 : re.enableReactionsSupergroup) && (e.channel.enableReactionsSupergroup = (ee = (K = n.groupChannel) === null || K === void 0 ? void 0 : K.channel) === null || ee === void 0 ? void 0 : ee.enableReactionsSupergroup), !((J = t.groupChannel) === null || J === void 0) && J.channel && Zt((se = (B = t.groupChannel) === null || B === void 0 ? void 0 : B.channel) === null || se === void 0 ? void 0 : se.enableMention) && (e.channel.enableMention = (Me = (te = t.groupChannel) === null || te === void 0 ? void 0 : te.channel) === null || Me === void 0 ? void 0 : Me.enableMention), !((Ie = n.groupChannel) === null || Ie === void 0) && Ie.channel && Zt((Q = (we = n.groupChannel) === null || we === void 0 ? void 0 : we.channel) === null || Q === void 0 ? void 0 : Q.enableMention) && (e.channel.enableMention = (Ce = (ze = n.groupChannel) === null || ze === void 0 ? void 0 : ze.channel) === null || Ce === void 0 ? void 0 : Ce.enableMention), !((ke = t.groupChannel) === null || ke === void 0) && ke.channel && ou((Je = (et = t.groupChannel) === null || et === void 0 ? void 0 : et.channel) === null || Je === void 0 ? void 0 : Je.replyType, ["none", "quote_reply", "thread"]) && (e.channel.replyType = (Te = (ot = t.groupChannel) === null || ot === void 0 ? void 0 : ot.channel) === null || Te === void 0 ? void 0 : Te.replyType), !((De = n.groupChannel) === null || De === void 0) && De.channel && ou((Le = (Ze = n.groupChannel) === null || Ze === void 0 ? void 0 : Ze.channel) === null || Le === void 0 ? void 0 : Le.replyType, ["none", "quote_reply", "thread"]) && (e.channel.replyType = (He = (qe = n.groupChannel) === null || qe === void 0 ? void 0 : qe.channel) === null || He === void 0 ? void 0 : He.replyType), !((Fe = t.groupChannel) === null || Fe === void 0) && Fe.channel && ou((lt = (Ct = t.groupChannel) === null || Ct === void 0 ? void 0 : Ct.channel) === null || lt === void 0 ? void 0 : lt.threadReplySelectType, ["thread", "parent"]) && (e.channel.threadReplySelectType = (Pe = (Pt = t.groupChannel) === null || Pt === void 0 ? void 0 : Pt.channel) === null || Pe === void 0 ? void 0 : Pe.threadReplySelectType), !((Xt = n.groupChannel) === null || Xt === void 0) && Xt.channel && ou((Yt = (At = n.groupChannel) === null || At === void 0 ? void 0 : At.channel) === null || Yt === void 0 ? void 0 : Yt.threadReplySelectType, ["thread", "parent"]) && (e.channel.threadReplySelectType = (xt = (rn = n.groupChannel) === null || rn === void 0 ? void 0 : rn.channel) === null || xt === void 0 ? void 0 : xt.threadReplySelectType), !((pt = t.groupChannel) === null || pt === void 0) && pt.channel && Zt((Oe = (We = t.groupChannel) === null || We === void 0 ? void 0 : We.channel) === null || Oe === void 0 ? void 0 : Oe.enableVoiceMessage) && (e.channel.enableVoiceMessage = ($e = (oe = t.groupChannel) === null || oe === void 0 ? void 0 : oe.channel) === null || $e === void 0 ? void 0 : $e.enableVoiceMessage), !((rt = n.groupChannel) === null || rt === void 0) && rt.channel && Zt((Bt = (ct = n.groupChannel) === null || ct === void 0 ? void 0 : ct.channel) === null || Bt === void 0 ? void 0 : Bt.enableVoiceMessage) && (e.channel.enableVoiceMessage = (cn = (Rt = n.groupChannel) === null || Rt === void 0 ? void 0 : Rt.channel) === null || cn === void 0 ? void 0 : cn.enableVoiceMessage), !((_t = n.groupChannel) === null || _t === void 0) && _t.channel && T8((vn = (un = n.groupChannel) === null || un === void 0 ? void 0 : un.channel) === null || vn === void 0 ? void 0 : vn.typingIndicatorTypes) && (e.channel.typingIndicatorTypes = (Jt = (Vt = n.groupChannel) === null || Vt === void 0 ? void 0 : Vt.channel) === null || Jt === void 0 ? void 0 : Jt.typingIndicatorTypes), !((Ht = n.groupChannel) === null || Ht === void 0) && Ht.channel && Zt((Ve = (kt = n.groupChannel) === null || kt === void 0 ? void 0 : kt.channel) === null || Ve === void 0 ? void 0 : Ve.enableFeedback) && (e.channel.enableFeedback = (Re = (st = n.groupChannel) === null || st === void 0 ? void 0 : st.channel) === null || Re === void 0 ? void 0 : Re.enableFeedback), !((vt = n.groupChannel) === null || vt === void 0) && vt.channel && Zt((F = (Et = n.groupChannel) === null || Et === void 0 ? void 0 : Et.channel) === null || F === void 0 ? void 0 : F.enableSuggestedReplies) && (e.channel.enableSuggestedReplies = (be = (he = n.groupChannel) === null || he === void 0 ? void 0 : he.channel) === null || be === void 0 ? void 0 : be.enableSuggestedReplies), !((je = n.groupChannel) === null || je === void 0) && je.channel && ou((Se = (ft = n.groupChannel) === null || ft === void 0 ? void 0 : ft.channel) === null || Se === void 0 ? void 0 : Se.showSuggestedRepliesFor, ["all_messages", "last_message_only"]) && (e.channel.showSuggestedRepliesFor = (le = (V = n.groupChannel) === null || V === void 0 ? void 0 : V.channel) === null || le === void 0 ? void 0 : le.showSuggestedRepliesFor); -} -function x8(e, n, t) { - var r, i, a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M, N, x, D, j, P, G, z, q, Y, ye, $, ae, de, re, K, ee, J, B, se, te, Me, Ie, we, Q, ze, Ce, ke, et, Je, ot, Te, De, Ze, Le, qe, He, Fe, Ct, lt, Pt, Pe, Xt, At, Yt, rn, xt, pt, We, Oe, oe, $e, rt, ct, Bt, Rt, cn, _t, un, vn, Vt, Jt, Ht, kt, Ve, st, Re, vt, Et, F, he, be, je, ft, Se, V, le, Ue, mt, Tt, Wt, jt, wn; - !((i = (r = t.groupChannel) === null || r === void 0 ? void 0 : r.channel) === null || i === void 0) && i.input && Zt((s = (o = (a = t.groupChannel) === null || a === void 0 ? void 0 : a.channel) === null || o === void 0 ? void 0 : o.input) === null || s === void 0 ? void 0 : s.enableDocument) && (e.channel.input.enableDocument = (u = (l = (c = t.groupChannel) === null || c === void 0 ? void 0 : c.channel) === null || l === void 0 ? void 0 : l.input) === null || u === void 0 ? void 0 : u.enableDocument), !((h = (d = n.groupChannel) === null || d === void 0 ? void 0 : d.channel) === null || h === void 0) && h.input && Zt((v = (p = (f = n.groupChannel) === null || f === void 0 ? void 0 : f.channel) === null || p === void 0 ? void 0 : p.input) === null || v === void 0 ? void 0 : v.enableDocument) && (e.channel.input.enableDocument = (y = (E = (m = n.groupChannel) === null || m === void 0 ? void 0 : m.channel) === null || E === void 0 ? void 0 : E.input) === null || y === void 0 ? void 0 : y.enableDocument), !((b = (S = (_ = t.groupChannel) === null || _ === void 0 ? void 0 : _.channel) === null || S === void 0 ? void 0 : S.input) === null || b === void 0) && b.camera && Zt((N = (M = (w = (A = t.groupChannel) === null || A === void 0 ? void 0 : A.channel) === null || w === void 0 ? void 0 : w.input) === null || M === void 0 ? void 0 : M.camera) === null || N === void 0 ? void 0 : N.enablePhoto) && (e.channel.input.camera.enablePhoto = (P = (j = (D = (x = t.groupChannel) === null || x === void 0 ? void 0 : x.channel) === null || D === void 0 ? void 0 : D.input) === null || j === void 0 ? void 0 : j.camera) === null || P === void 0 ? void 0 : P.enablePhoto), !((q = (z = (G = n.groupChannel) === null || G === void 0 ? void 0 : G.channel) === null || z === void 0 ? void 0 : z.input) === null || q === void 0) && q.camera && Zt((ae = ($ = (ye = (Y = n.groupChannel) === null || Y === void 0 ? void 0 : Y.channel) === null || ye === void 0 ? void 0 : ye.input) === null || $ === void 0 ? void 0 : $.camera) === null || ae === void 0 ? void 0 : ae.enablePhoto) && (e.channel.input.camera.enablePhoto = (ee = (K = (re = (de = n.groupChannel) === null || de === void 0 ? void 0 : de.channel) === null || re === void 0 ? void 0 : re.input) === null || K === void 0 ? void 0 : K.camera) === null || ee === void 0 ? void 0 : ee.enablePhoto), !((se = (B = (J = t.groupChannel) === null || J === void 0 ? void 0 : J.channel) === null || B === void 0 ? void 0 : B.input) === null || se === void 0) && se.camera && Zt((we = (Ie = (Me = (te = t.groupChannel) === null || te === void 0 ? void 0 : te.channel) === null || Me === void 0 ? void 0 : Me.input) === null || Ie === void 0 ? void 0 : Ie.camera) === null || we === void 0 ? void 0 : we.enableVideo) && (e.channel.input.camera.enableVideo = (ke = (Ce = (ze = (Q = t.groupChannel) === null || Q === void 0 ? void 0 : Q.channel) === null || ze === void 0 ? void 0 : ze.input) === null || Ce === void 0 ? void 0 : Ce.camera) === null || ke === void 0 ? void 0 : ke.enableVideo), !((ot = (Je = (et = n.groupChannel) === null || et === void 0 ? void 0 : et.channel) === null || Je === void 0 ? void 0 : Je.input) === null || ot === void 0) && ot.camera && Zt((Le = (Ze = (De = (Te = n.groupChannel) === null || Te === void 0 ? void 0 : Te.channel) === null || De === void 0 ? void 0 : De.input) === null || Ze === void 0 ? void 0 : Ze.camera) === null || Le === void 0 ? void 0 : Le.enableVideo) && (e.channel.input.camera.enableVideo = (Ct = (Fe = (He = (qe = n.groupChannel) === null || qe === void 0 ? void 0 : qe.channel) === null || He === void 0 ? void 0 : He.input) === null || Fe === void 0 ? void 0 : Fe.camera) === null || Ct === void 0 ? void 0 : Ct.enableVideo), !((Pe = (Pt = (lt = t.groupChannel) === null || lt === void 0 ? void 0 : lt.channel) === null || Pt === void 0 ? void 0 : Pt.input) === null || Pe === void 0) && Pe.gallery && Zt((rn = (Yt = (At = (Xt = t.groupChannel) === null || Xt === void 0 ? void 0 : Xt.channel) === null || At === void 0 ? void 0 : At.input) === null || Yt === void 0 ? void 0 : Yt.gallery) === null || rn === void 0 ? void 0 : rn.enablePhoto) && (e.channel.input.gallery.enablePhoto = (Oe = (We = (pt = (xt = t.groupChannel) === null || xt === void 0 ? void 0 : xt.channel) === null || pt === void 0 ? void 0 : pt.input) === null || We === void 0 ? void 0 : We.gallery) === null || Oe === void 0 ? void 0 : Oe.enablePhoto), !((rt = ($e = (oe = n.groupChannel) === null || oe === void 0 ? void 0 : oe.channel) === null || $e === void 0 ? void 0 : $e.input) === null || rt === void 0) && rt.gallery && Zt((cn = (Rt = (Bt = (ct = n.groupChannel) === null || ct === void 0 ? void 0 : ct.channel) === null || Bt === void 0 ? void 0 : Bt.input) === null || Rt === void 0 ? void 0 : Rt.gallery) === null || cn === void 0 ? void 0 : cn.enablePhoto) && (e.channel.input.gallery.enablePhoto = (Vt = (vn = (un = (_t = n.groupChannel) === null || _t === void 0 ? void 0 : _t.channel) === null || un === void 0 ? void 0 : un.input) === null || vn === void 0 ? void 0 : vn.gallery) === null || Vt === void 0 ? void 0 : Vt.enablePhoto), !((kt = (Ht = (Jt = t.groupChannel) === null || Jt === void 0 ? void 0 : Jt.channel) === null || Ht === void 0 ? void 0 : Ht.input) === null || kt === void 0) && kt.gallery && Zt((vt = (Re = (st = (Ve = t.groupChannel) === null || Ve === void 0 ? void 0 : Ve.channel) === null || st === void 0 ? void 0 : st.input) === null || Re === void 0 ? void 0 : Re.gallery) === null || vt === void 0 ? void 0 : vt.enableVideo) && (e.channel.input.gallery.enableVideo = (be = (he = (F = (Et = t.groupChannel) === null || Et === void 0 ? void 0 : Et.channel) === null || F === void 0 ? void 0 : F.input) === null || he === void 0 ? void 0 : he.gallery) === null || be === void 0 ? void 0 : be.enableVideo), !((Se = (ft = (je = n.groupChannel) === null || je === void 0 ? void 0 : je.channel) === null || ft === void 0 ? void 0 : ft.input) === null || Se === void 0) && Se.gallery && Zt((mt = (Ue = (le = (V = n.groupChannel) === null || V === void 0 ? void 0 : V.channel) === null || le === void 0 ? void 0 : le.input) === null || Ue === void 0 ? void 0 : Ue.gallery) === null || mt === void 0 ? void 0 : mt.enableVideo) && (e.channel.input.gallery.enableVideo = (wn = (jt = (Wt = (Tt = n.groupChannel) === null || Tt === void 0 ? void 0 : Tt.channel) === null || Wt === void 0 ? void 0 : Wt.input) === null || jt === void 0 ? void 0 : jt.gallery) === null || wn === void 0 ? void 0 : wn.enableVideo); -} -function R8(e, n, t) { - var r, i, a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S; - !((r = t.groupChannel) === null || r === void 0) && r.channelList && Zt((a = (i = t.groupChannel) === null || i === void 0 ? void 0 : i.channelList) === null || a === void 0 ? void 0 : a.enableTypingIndicator) && (e.channelList.enableTypingIndicator = t.groupChannel.channelList.enableTypingIndicator), !((o = n.groupChannel) === null || o === void 0) && o.channelList && Zt((c = (s = n.groupChannel) === null || s === void 0 ? void 0 : s.channelList) === null || c === void 0 ? void 0 : c.enableTypingIndicator) && (e.channelList.enableTypingIndicator = (u = (l = n.groupChannel) === null || l === void 0 ? void 0 : l.channelList) === null || u === void 0 ? void 0 : u.enableTypingIndicator), !((d = t.groupChannel) === null || d === void 0) && d.channelList && Zt((f = (h = t.groupChannel) === null || h === void 0 ? void 0 : h.channelList) === null || f === void 0 ? void 0 : f.enableMessageReceiptStatus) && (e.channelList.enableMessageReceiptStatus = (v = (p = t.groupChannel) === null || p === void 0 ? void 0 : p.channelList) === null || v === void 0 ? void 0 : v.enableMessageReceiptStatus), !((m = n.groupChannel) === null || m === void 0) && m.channelList && Zt((y = (E = n.groupChannel) === null || E === void 0 ? void 0 : E.channelList) === null || y === void 0 ? void 0 : y.enableMessageReceiptStatus) && (e.channelList.enableMessageReceiptStatus = (S = (_ = n.groupChannel) === null || _ === void 0 ? void 0 : _.channelList) === null || S === void 0 ? void 0 : S.enableMessageReceiptStatus); -} -function D8(e, n, t) { - var r, i, a, o, s, c, l, u; - !((r = t.groupChannel) === null || r === void 0) && r.setting && Zt((a = (i = t.groupChannel) === null || i === void 0 ? void 0 : i.setting) === null || a === void 0 ? void 0 : a.enableMessageSearch) && (e.setting.enableMessageSearch = t.groupChannel.setting.enableMessageSearch), !((o = n.groupChannel) === null || o === void 0) && o.setting && Zt((c = (s = n.groupChannel) === null || s === void 0 ? void 0 : s.setting) === null || c === void 0 ? void 0 : c.enableMessageSearch) && (e.setting.enableMessageSearch = (u = (l = n.groupChannel) === null || l === void 0 ? void 0 : l.setting) === null || u === void 0 ? void 0 : u.enableMessageSearch); -} -function L8(e, n, t) { - P8(e, n, t), k8(e, n, t); -} -function P8(e, n, t) { - var r, i, a, o, s, c, l, u; - !((r = t.openChannel) === null || r === void 0) && r.channel && Zt((a = (i = t.openChannel) === null || i === void 0 ? void 0 : i.channel) === null || a === void 0 ? void 0 : a.enableOgtag) && (e.channel.enableOgtag = t.openChannel.channel.enableOgtag), !((o = n.openChannel) === null || o === void 0) && o.channel && Zt((c = (s = n.openChannel) === null || s === void 0 ? void 0 : s.channel) === null || c === void 0 ? void 0 : c.enableOgtag) && (e.channel.enableOgtag = (u = (l = n.openChannel) === null || l === void 0 ? void 0 : l.channel) === null || u === void 0 ? void 0 : u.enableOgtag); -} -function k8(e, n, t) { - var r, i, a, o, s, c, l, u, d, h, f, p, v, m, E, y, _, S, b, A, w, M, N, x, D, j, P, G, z, q, Y, ye, $, ae, de, re, K, ee, J, B, se, te, Me, Ie, we, Q, ze, Ce, ke, et, Je, ot, Te, De, Ze, Le, qe, He, Fe, Ct, lt, Pt, Pe, Xt, At, Yt, rn, xt, pt, We, Oe, oe, $e, rt, ct, Bt, Rt, cn, _t, un, vn, Vt, Jt, Ht, kt, Ve, st, Re, vt, Et, F, he, be, je, ft, Se, V, le, Ue, mt, Tt, Wt, jt, wn; - !((i = (r = t.openChannel) === null || r === void 0 ? void 0 : r.channel) === null || i === void 0) && i.input && Zt((s = (o = (a = t.openChannel) === null || a === void 0 ? void 0 : a.channel) === null || o === void 0 ? void 0 : o.input) === null || s === void 0 ? void 0 : s.enableDocument) && (e.channel.input.enableDocument = (u = (l = (c = t.openChannel) === null || c === void 0 ? void 0 : c.channel) === null || l === void 0 ? void 0 : l.input) === null || u === void 0 ? void 0 : u.enableDocument), !((h = (d = n.openChannel) === null || d === void 0 ? void 0 : d.channel) === null || h === void 0) && h.input && Zt((v = (p = (f = n.openChannel) === null || f === void 0 ? void 0 : f.channel) === null || p === void 0 ? void 0 : p.input) === null || v === void 0 ? void 0 : v.enableDocument) && (e.channel.input.enableDocument = (y = (E = (m = n.openChannel) === null || m === void 0 ? void 0 : m.channel) === null || E === void 0 ? void 0 : E.input) === null || y === void 0 ? void 0 : y.enableDocument), !((b = (S = (_ = t.openChannel) === null || _ === void 0 ? void 0 : _.channel) === null || S === void 0 ? void 0 : S.input) === null || b === void 0) && b.camera && Zt((N = (M = (w = (A = t.openChannel) === null || A === void 0 ? void 0 : A.channel) === null || w === void 0 ? void 0 : w.input) === null || M === void 0 ? void 0 : M.camera) === null || N === void 0 ? void 0 : N.enablePhoto) && (e.channel.input.camera.enablePhoto = (P = (j = (D = (x = t.openChannel) === null || x === void 0 ? void 0 : x.channel) === null || D === void 0 ? void 0 : D.input) === null || j === void 0 ? void 0 : j.camera) === null || P === void 0 ? void 0 : P.enablePhoto), !((q = (z = (G = n.openChannel) === null || G === void 0 ? void 0 : G.channel) === null || z === void 0 ? void 0 : z.input) === null || q === void 0) && q.camera && Zt((ae = ($ = (ye = (Y = n.openChannel) === null || Y === void 0 ? void 0 : Y.channel) === null || ye === void 0 ? void 0 : ye.input) === null || $ === void 0 ? void 0 : $.camera) === null || ae === void 0 ? void 0 : ae.enablePhoto) && (e.channel.input.camera.enablePhoto = (ee = (K = (re = (de = n.openChannel) === null || de === void 0 ? void 0 : de.channel) === null || re === void 0 ? void 0 : re.input) === null || K === void 0 ? void 0 : K.camera) === null || ee === void 0 ? void 0 : ee.enablePhoto), !((se = (B = (J = t.openChannel) === null || J === void 0 ? void 0 : J.channel) === null || B === void 0 ? void 0 : B.input) === null || se === void 0) && se.camera && Zt((we = (Ie = (Me = (te = t.openChannel) === null || te === void 0 ? void 0 : te.channel) === null || Me === void 0 ? void 0 : Me.input) === null || Ie === void 0 ? void 0 : Ie.camera) === null || we === void 0 ? void 0 : we.enableVideo) && (e.channel.input.camera.enableVideo = (ke = (Ce = (ze = (Q = t.openChannel) === null || Q === void 0 ? void 0 : Q.channel) === null || ze === void 0 ? void 0 : ze.input) === null || Ce === void 0 ? void 0 : Ce.camera) === null || ke === void 0 ? void 0 : ke.enableVideo), !((ot = (Je = (et = n.openChannel) === null || et === void 0 ? void 0 : et.channel) === null || Je === void 0 ? void 0 : Je.input) === null || ot === void 0) && ot.camera && Zt((Le = (Ze = (De = (Te = n.openChannel) === null || Te === void 0 ? void 0 : Te.channel) === null || De === void 0 ? void 0 : De.input) === null || Ze === void 0 ? void 0 : Ze.camera) === null || Le === void 0 ? void 0 : Le.enableVideo) && (e.channel.input.camera.enableVideo = (Ct = (Fe = (He = (qe = n.openChannel) === null || qe === void 0 ? void 0 : qe.channel) === null || He === void 0 ? void 0 : He.input) === null || Fe === void 0 ? void 0 : Fe.camera) === null || Ct === void 0 ? void 0 : Ct.enableVideo), !((Pe = (Pt = (lt = t.openChannel) === null || lt === void 0 ? void 0 : lt.channel) === null || Pt === void 0 ? void 0 : Pt.input) === null || Pe === void 0) && Pe.gallery && Zt((rn = (Yt = (At = (Xt = t.openChannel) === null || Xt === void 0 ? void 0 : Xt.channel) === null || At === void 0 ? void 0 : At.input) === null || Yt === void 0 ? void 0 : Yt.gallery) === null || rn === void 0 ? void 0 : rn.enablePhoto) && (e.channel.input.gallery.enablePhoto = (Oe = (We = (pt = (xt = t.openChannel) === null || xt === void 0 ? void 0 : xt.channel) === null || pt === void 0 ? void 0 : pt.input) === null || We === void 0 ? void 0 : We.gallery) === null || Oe === void 0 ? void 0 : Oe.enablePhoto), !((rt = ($e = (oe = n.openChannel) === null || oe === void 0 ? void 0 : oe.channel) === null || $e === void 0 ? void 0 : $e.input) === null || rt === void 0) && rt.gallery && Zt((cn = (Rt = (Bt = (ct = n.openChannel) === null || ct === void 0 ? void 0 : ct.channel) === null || Bt === void 0 ? void 0 : Bt.input) === null || Rt === void 0 ? void 0 : Rt.gallery) === null || cn === void 0 ? void 0 : cn.enablePhoto) && (e.channel.input.gallery.enablePhoto = (Vt = (vn = (un = (_t = n.openChannel) === null || _t === void 0 ? void 0 : _t.channel) === null || un === void 0 ? void 0 : un.input) === null || vn === void 0 ? void 0 : vn.gallery) === null || Vt === void 0 ? void 0 : Vt.enablePhoto), !((kt = (Ht = (Jt = t.openChannel) === null || Jt === void 0 ? void 0 : Jt.channel) === null || Ht === void 0 ? void 0 : Ht.input) === null || kt === void 0) && kt.gallery && Zt((vt = (Re = (st = (Ve = t.openChannel) === null || Ve === void 0 ? void 0 : Ve.channel) === null || st === void 0 ? void 0 : st.input) === null || Re === void 0 ? void 0 : Re.gallery) === null || vt === void 0 ? void 0 : vt.enableVideo) && (e.channel.input.gallery.enableVideo = (be = (he = (F = (Et = t.openChannel) === null || Et === void 0 ? void 0 : Et.channel) === null || F === void 0 ? void 0 : F.input) === null || he === void 0 ? void 0 : he.gallery) === null || be === void 0 ? void 0 : be.enableVideo), !((Se = (ft = (je = n.openChannel) === null || je === void 0 ? void 0 : je.channel) === null || ft === void 0 ? void 0 : ft.input) === null || Se === void 0) && Se.gallery && Zt((mt = (Ue = (le = (V = n.openChannel) === null || V === void 0 ? void 0 : V.channel) === null || le === void 0 ? void 0 : le.input) === null || Ue === void 0 ? void 0 : Ue.gallery) === null || mt === void 0 ? void 0 : mt.enableVideo) && (e.channel.input.gallery.enableVideo = (wn = (jt = (Wt = (Tt = n.openChannel) === null || Tt === void 0 ? void 0 : Tt.channel) === null || Wt === void 0 ? void 0 : Wt.input) === null || jt === void 0 ? void 0 : jt.gallery) === null || wn === void 0 ? void 0 : wn.enableVideo); -} -function U8(e, n) { - const t = U1(); - return I8(t.common, e, n), M8(t.groupChannel, e, n), L8(t.openChannel, e, n), t; -} -function F8(e) { - return typeof e == "object" && "configuration" in e && "updated_at" in e; -} -var B8 = globalThis && globalThis.__awaiter || function(e, n, t, r) { - function i(a) { - return a instanceof t ? a : new t(function(o) { - o(a); - }); - } - return new (t || (t = Promise))(function(a, o) { - function s(u) { - try { - l(r.next(u)); - } catch (d) { - o(d); - } - } - function c(u) { - try { - l(r.throw(u)); - } catch (d) { - o(d); - } - } - function l(u) { - u.done ? a(u.value) : i(u.value).then(s, c); - } - l((r = r.apply(e, n || [])).next()); - }); -}; -function su(e) { - var n, t; - return (t = (n = e.appInfo) === null || n === void 0 ? void 0 : n.applicationAttributes) !== null && t !== void 0 ? t : []; -} -const dN = Zr({ - initDashboardConfigs: () => Promise.resolve(), - configs: Yb, - configsWithAppAttr: () => Yb -}), H8 = ({ storage: e, children: n, localConfigs: t = {} }) => { - const [r, i] = Ee(uN), [a] = Ee(() => new N8(e)), o = Qt((l) => B8(void 0, void 0, void 0, function* () { - const u = yield a.init(l.appId); - if (l.appInfo && l.appInfo.uikitConfigInfo.lastUpdatedAt === u.updatedAt) - i(u.configuration); - else - try { - const d = yield l.getUIKitConfiguration(); - if (F8(d.json)) { - const h = sg(d.json), f = yield a.update(h); - i(f.configuration); - } - } catch { - i(u.configuration); - } - }), [a]), s = U8(t, r), c = ih((l) => ({ - groupChannel: { - channel: { - get enableReactions() { - return s.groupChannel.channel.enableReactions && su(l).includes(tu.reactions); - }, - get enableReactionsSupergroup() { - return s.groupChannel.channel.enableReactionsSupergroup && su(l).includes(tu.reactions); - }, - get enableOgtag() { - return s.groupChannel.channel.enableOgtag && su(l).includes(tu.enable_og_tag); - } - }, - setting: { - get enableMessageSearch() { - return s.groupChannel.setting.enableMessageSearch && su(l).includes(tu.message_search_v3); - } - } - }, - openChannel: { - channel: { - get enableOgtag() { - return s.openChannel.channel.enableOgtag && su(l).includes(tu.enable_og_tag); - } - } - } - })); - return g.createElement(dN.Provider, { value: { initDashboardConfigs: o, configs: s, configsWithAppAttr: c } }, n); -}, j8 = () => Lt(dN); -var hN = g.createContext(null); -/*! - * css-vars-ponyfill - * v2.4.8 - * https://jhildenbiddle.github.io/css-vars-ponyfill/ - * (c) 2018-2022 John Hildenbiddle - * MIT license - */ -function hi() { - return hi = Object.assign ? Object.assign.bind() : function(e) { - for (var n = 1; n < arguments.length; n++) { - var t = arguments[n]; - for (var r in t) - Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); - } - return e; - }, hi.apply(this, arguments); -} -/*! - * get-css-data - * v2.1.0 - * https://github.com/jhildenbiddle/get-css-data - * (c) 2018-2022 John Hildenbiddle - * MIT license - */ -function Zb(e) { - var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = { - mimeType: n.mimeType || null, - onBeforeSend: n.onBeforeSend || Function.prototype, - onSuccess: n.onSuccess || Function.prototype, - onError: n.onError || Function.prototype, - onComplete: n.onComplete || Function.prototype - }, r = Array.isArray(e) ? e : [e], i = Array.apply(null, Array(r.length)).map(function(l) { - return null; - }); - function a(l) { - var u = typeof l == "string", d = u && l.trim().charAt(0) === "<"; - return u && !d; - } - function o(l, u) { - t.onError(l, r[u], u); - } - function s(l, u) { - var d = t.onSuccess(l, r[u], u); - l = d === !1 ? "" : d || l, i[u] = l, i.indexOf(null) === -1 && t.onComplete(i); - } - var c = document.createElement("a"); - r.forEach(function(l, u) { - c.setAttribute("href", l), c.href = String(c.href); - var d = !!(document.all && !window.atob), h = d && c.host.split(":")[0] !== location.host.split(":")[0]; - if (h) { - var f = c.protocol === location.protocol; - if (f) { - var p = new XDomainRequest(); - p.open("GET", l), p.timeout = 0, p.onprogress = Function.prototype, p.ontimeout = Function.prototype, p.onload = function() { - var m = p.responseText; - a(m) ? s(m, u) : o(p, u); - }, p.onerror = function(m) { - o(p, u); - }, setTimeout(function() { - p.send(); - }, 0); - } else - console.warn("Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol (".concat(l, ")")), o(null, u); - } else { - var v = new XMLHttpRequest(); - v.open("GET", l), t.mimeType && v.overrideMimeType && v.overrideMimeType(t.mimeType), t.onBeforeSend(v, l, u), v.onreadystatechange = function() { - if (v.readyState === 4) { - var m = v.responseText; - v.status < 400 && a(m) || v.status === 0 && a(m) ? s(m, u) : o(v, u); - } - }, v.send(); - } - }); -} -/** - * Gets CSS data from