@opencx/widget 2.3.1 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  var rn = Object.defineProperty;
2
2
  var sn = (e, t, n) => t in e ? rn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var rt = (e, t, n) => sn(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { g as Z, S as pt, A as on } from "./schemas-BBAV6Sd_.js";
5
- import de, { useMemo as ee, useState as Qe, useCallback as ge, useEffect as le, createContext as gt, useContext as ht, useRef as se, useReducer as an, useLayoutEffect as cn, useDebugValue as un } from "react";
6
- import { jsx as $ } from "react/jsx-runtime";
4
+ import { g as ee, S as pt, A as on } from "./schemas-BBAV6Sd_.js";
5
+ import de, { useMemo as ne, useState as Qe, useCallback as ge, useEffect as le, createContext as gt, useContext as ht, useRef as ae, useReducer as an, useLayoutEffect as cn, useDebugValue as un } from "react";
6
+ import { jsx as te } from "react/jsx-runtime";
7
7
  import { create as ln } from "mutative";
8
8
  import dn from "lodash.set";
9
9
  import fn from "axios";
@@ -18,7 +18,7 @@ function gn(e) {
18
18
  return pn ? st : e === "local" ? localStorage : e === "session" ? sessionStorage : st;
19
19
  }
20
20
  function We(e, t, n = "session") {
21
- const r = ee(() => gn(n), [n]), [s, o] = Qe(() => {
21
+ const r = ne(() => gn(n), [n]), [s, o] = Qe(() => {
22
22
  const p = r.getItem(e);
23
23
  if (p !== null)
24
24
  try {
@@ -54,7 +54,7 @@ function We(e, t, n = "session") {
54
54
  };
55
55
  }, [e, s]), [s, a, l];
56
56
  }
57
- const hn = "@opencx/widget", mt = "2.3.1", mn = "module", yn = {
57
+ const hn = "@opencx/widget", mt = "2.4.1", mn = "module", yn = {
58
58
  access: "public"
59
59
  }, Sn = {
60
60
  clean: "rm -rf ./dist ./dist-embed",
@@ -126,7 +126,7 @@ const hn = "@opencx/widget", mt = "2.3.1", mn = "module", yn = {
126
126
  }, Cn = {
127
127
  name: "openchatai",
128
128
  url: "https://github.com/openchatai"
129
- }, Nn = "./dist/index.js", _n = "./dist/index.js", xn = "./dist/index.d.ts", Dn = !1, Pn = {
129
+ }, Nn = "./dist/index.js", Dn = "./dist/index.js", _n = "./dist/index.d.ts", xn = !1, Pn = {
130
130
  ".": {
131
131
  types: "./dist/index.d.ts",
132
132
  import: "./dist/index.js",
@@ -200,14 +200,14 @@ const hn = "@opencx/widget", mt = "2.3.1", mn = "module", yn = {
200
200
  bugs: Rn,
201
201
  author: Cn,
202
202
  main: Nn,
203
- module: _n,
204
- types: xn,
205
- sideEffects: Dn,
203
+ module: Dn,
204
+ types: _n,
205
+ sideEffects: xn,
206
206
  exports: Pn,
207
207
  devDependencies: In
208
208
  }, kn = "X-Bot-Token", Mn = "X-Widget-Version";
209
209
  function yt(e) {
210
- const t = ee(() => fn.create({
210
+ const t = ne(() => fn.create({
211
211
  baseURL: e.apiUrl,
212
212
  headers: {
213
213
  [kn]: e.botToken,
@@ -215,7 +215,7 @@ function yt(e) {
215
215
  "X-Use-Guard": !0
216
216
  }
217
217
  }), [e]);
218
- return { apis: ee(
218
+ return { apis: ne(
219
219
  () => ({
220
220
  createSession: (r) => {
221
221
  if (!r)
@@ -243,7 +243,19 @@ function yt(e) {
243
243
  `widget/session/history/${r}`
244
244
  );
245
245
  },
246
+ /**
247
+ * downvote a message
248
+ * @param id
249
+ * @returns
250
+ * @deprecated use vote instead
251
+ */
246
252
  downvote: (r) => t.delete(`/chat/vote/${r}`),
253
+ /**
254
+ * upvote a message
255
+ * @param id
256
+ * @returns
257
+ * @deprecated use vote instead
258
+ */
247
259
  upvote: (r) => t.post(`/chat/vote/${r}`),
248
260
  /**
249
261
  * given the userData object we will create or update the contact + get the related conversations/tickets/sessions
@@ -277,7 +289,12 @@ function yt(e) {
277
289
  * send a message to the chat
278
290
  * @param message
279
291
  */
280
- sendMessage: async (r) => t.post("widget/chat/send", r)
292
+ sendMessage: async (r) => t.post("widget/chat/send", r),
293
+ /**
294
+ * vote on a message
295
+ * @param data
296
+ */
297
+ vote: (r) => t.post("/widget/chat/vote", r)
281
298
  }),
282
299
  [t]
283
300
  ), options: e };
@@ -623,8 +640,8 @@ function Yn(e, t) {
623
640
  }
624
641
  const [as, Bn] = Ce();
625
642
  function St({ children: e }) {
626
- const t = ce();
627
- return /* @__PURE__ */ $(
643
+ const t = B();
644
+ return /* @__PURE__ */ te(
628
645
  Bn,
629
646
  {
630
647
  value: {
@@ -676,7 +693,7 @@ const Xn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABlCAYAAAC7vkbxAA
676
693
  triggerOffset: "20px"
677
694
  };
678
695
  function Wn(e) {
679
- return ee(() => {
696
+ return ne(() => {
680
697
  var s, o, a, l;
681
698
  const t = {
682
699
  messageArrived: "https://cloud.opencopilot.so/sfx/notification3.mp3",
@@ -708,12 +725,12 @@ function Wn(e) {
708
725
  };
709
726
  }, [e]);
710
727
  }
711
- const [ce, Kn] = Ce(), Jn = "en";
728
+ const [B, Kn] = Ce(), Jn = "en";
712
729
  function Zn({
713
730
  children: e,
714
731
  data: t
715
732
  }) {
716
- const n = ee(
733
+ const n = ne(
717
734
  () => new qn({
718
735
  components: t.components
719
736
  }),
@@ -726,7 +743,7 @@ function Zn({
726
743
  r.defaultSettings,
727
744
  "local"
728
745
  );
729
- return /* @__PURE__ */ $(
746
+ return /* @__PURE__ */ te(
730
747
  Kn,
731
748
  {
732
749
  value: { ...r, http: s, componentStore: n, widgetSettings: o, setSettings: (p) => {
@@ -738,7 +755,7 @@ function Zn({
738
755
  );
739
756
  a(u);
740
757
  } },
741
- children: /* @__PURE__ */ $(St, { children: e })
758
+ children: /* @__PURE__ */ te(St, { children: e })
742
759
  }
743
760
  );
744
761
  }
@@ -845,7 +862,7 @@ function Ct(e, t, n) {
845
862
  function Nt(e, t) {
846
863
  if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
847
864
  }
848
- function _t(e, t, n, r) {
865
+ function Dt(e, t, n, r) {
849
866
  function s(o) {
850
867
  return o instanceof n ? o : new n(function(a) {
851
868
  a(o);
@@ -872,7 +889,7 @@ function _t(e, t, n, r) {
872
889
  u((r = r.apply(e, t || [])).next());
873
890
  });
874
891
  }
875
- function xt(e, t) {
892
+ function _t(e, t) {
876
893
  var n = { label: 0, sent: function() {
877
894
  if (o[0] & 1) throw o[1];
878
895
  return o[1];
@@ -941,7 +958,7 @@ var Ne = Object.create ? function(e, t, n, r) {
941
958
  } : function(e, t, n, r) {
942
959
  r === void 0 && (r = n), e[r] = t[n];
943
960
  };
944
- function Dt(e, t) {
961
+ function xt(e, t) {
945
962
  for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) && Ne(t, e, n);
946
963
  }
947
964
  function Re(e) {
@@ -1159,10 +1176,10 @@ const nr = {
1159
1176
  __propKey: Rt,
1160
1177
  __setFunctionName: Ct,
1161
1178
  __metadata: Nt,
1162
- __awaiter: _t,
1163
- __generator: xt,
1179
+ __awaiter: Dt,
1180
+ __generator: _t,
1164
1181
  __createBinding: Ne,
1165
- __exportStar: Dt,
1182
+ __exportStar: xt,
1166
1183
  __values: Re,
1167
1184
  __read: Ke,
1168
1185
  __spread: Pt,
@@ -1191,7 +1208,7 @@ const nr = {
1191
1208
  __asyncGenerator: kt,
1192
1209
  __asyncValues: Ft,
1193
1210
  __await: he,
1194
- __awaiter: _t,
1211
+ __awaiter: Dt,
1195
1212
  __classPrivateFieldGet: Ht,
1196
1213
  __classPrivateFieldIn: zt,
1197
1214
  __classPrivateFieldSet: Gt,
@@ -1199,9 +1216,9 @@ const nr = {
1199
1216
  __decorate: bt,
1200
1217
  __disposeResources: Bt,
1201
1218
  __esDecorate: At,
1202
- __exportStar: Dt,
1219
+ __exportStar: xt,
1203
1220
  __extends: Et,
1204
- __generator: xt,
1221
+ __generator: _t,
1205
1222
  __importDefault: Ut,
1206
1223
  __importStar: Vt,
1207
1224
  __makeTemplateObject: Lt,
@@ -1254,14 +1271,35 @@ function ir(e, t, n) {
1254
1271
  }, t);
1255
1272
  return [a, p];
1256
1273
  }
1257
- var oe = vt.default = ir;
1258
- const re = /* @__PURE__ */ new Map();
1259
- function us() {
1260
- const [e, t] = Qe([]), { http: n } = ce();
1274
+ var Y = vt.default = ir;
1275
+ function us(e, t, n) {
1276
+ const { http: r } = B();
1277
+ return Y(
1278
+ async (s) => s === "up" ? r.apis.vote({ action: "upvote", messagePublicId: e, sessionId: t }).then(n) : r.apis.vote({ action: "downvote", messagePublicId: e, sessionId: t }).then(n),
1279
+ [r.apis, e, n]
1280
+ );
1281
+ }
1282
+ function ls(e, t) {
1283
+ const { http: n } = B();
1284
+ return Y(
1285
+ async () => n.apis.upvote(e).then(t),
1286
+ [n.options, e, t]
1287
+ );
1288
+ }
1289
+ function ds(e, t) {
1290
+ const { http: n } = B();
1291
+ return Y(
1292
+ async () => n.apis.downvote(e).then(t),
1293
+ [n.options, e]
1294
+ );
1295
+ }
1296
+ const oe = /* @__PURE__ */ new Map();
1297
+ function fs() {
1298
+ const [e, t] = Qe([]), { http: n } = B();
1261
1299
  function r(c) {
1262
1300
  const i = c.map((g) => ({
1263
1301
  file: g,
1264
- id: Z(10),
1302
+ id: ee(10),
1265
1303
  status: "pending",
1266
1304
  progress: 0
1267
1305
  }));
@@ -1277,7 +1315,7 @@ function us() {
1277
1315
  }
1278
1316
  const a = async (c) => {
1279
1317
  const i = new AbortController();
1280
- re.set(c.id, i);
1318
+ oe.set(c.id, i);
1281
1319
  try {
1282
1320
  t(
1283
1321
  (f) => f.map(
@@ -1306,17 +1344,17 @@ function us() {
1306
1344
  progress: 0
1307
1345
  });
1308
1346
  } finally {
1309
- re.delete(c.id);
1347
+ oe.delete(c.id);
1310
1348
  }
1311
1349
  }, l = (c) => {
1312
- const i = re.get(c);
1313
- i && (i.abort(), re.delete(c)), o(c);
1314
- }, p = ee(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
1350
+ const i = oe.get(c);
1351
+ i && (i.abort(), oe.delete(c)), o(c);
1352
+ }, p = ne(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
1315
1353
  function u() {
1316
- re.forEach((c) => c.abort()), re.clear(), t([]);
1354
+ oe.forEach((c) => c.abort()), oe.clear(), t([]);
1317
1355
  }
1318
1356
  return le(() => () => {
1319
- re.forEach((c) => c.abort()), re.clear();
1357
+ oe.forEach((c) => c.abort()), oe.clear();
1320
1358
  }, []), {
1321
1359
  allFiles: e,
1322
1360
  appendFiles: r,
@@ -1345,7 +1383,7 @@ function at(e) {
1345
1383
  a.message && a.message.length > 0 && t.push({
1346
1384
  type: "FROM_USER",
1347
1385
  content: a.message,
1348
- id: a.publicId || Z(),
1386
+ id: a.publicId || ee(),
1349
1387
  deliveredAt: a.created_at || "",
1350
1388
  attachments: a.attachments
1351
1389
  });
@@ -1358,7 +1396,7 @@ function at(e) {
1358
1396
  data: {
1359
1397
  message: a.message ?? ""
1360
1398
  },
1361
- id: a.publicId || Z(),
1399
+ id: a.publicId || ee(),
1362
1400
  timestamp: a.created_at || "",
1363
1401
  original: a,
1364
1402
  attachments: a.attachments,
@@ -1377,7 +1415,7 @@ function at(e) {
1377
1415
  data: {
1378
1416
  message: a.message ?? ""
1379
1417
  },
1380
- id: a.publicId || Z(),
1418
+ id: a.publicId || ee(),
1381
1419
  timestamp: a.created_at || "",
1382
1420
  original: a,
1383
1421
  attachments: a.attachments,
@@ -1397,7 +1435,7 @@ function at(e) {
1397
1435
  event: a.type,
1398
1436
  message: a.message ?? ""
1399
1437
  },
1400
- id: a.publicId || Z(),
1438
+ id: a.publicId || ee(),
1401
1439
  original: a,
1402
1440
  attachments: a.attachments,
1403
1441
  timestamp: a.created_at || "",
@@ -1413,7 +1451,7 @@ function at(e) {
1413
1451
  return t;
1414
1452
  }
1415
1453
  function cr(e) {
1416
- const t = se(null);
1454
+ const t = ae(null);
1417
1455
  return le(() => {
1418
1456
  if (!t.current) {
1419
1457
  const n = new Audio(e.src);
@@ -1435,7 +1473,7 @@ function cr(e) {
1435
1473
  };
1436
1474
  }
1437
1475
  function ur() {
1438
- const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } = ce(), r = (t == null ? void 0 : t.useSoundEffects) ?? n.useSoundEffects;
1476
+ const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } = B(), r = (t == null ? void 0 : t.useSoundEffects) ?? n.useSoundEffects;
1439
1477
  return {
1440
1478
  messageArrivedSound: cr({
1441
1479
  src: e.messageArrived,
@@ -1499,7 +1537,7 @@ function pr({
1499
1537
  persist: e,
1500
1538
  sessionKey: t = (n, { external_id: r }) => `[OPEN_SESSION_${n}]_${r || "session"}`
1501
1539
  }) {
1502
- const { botToken: n, http: r, user: s } = ce(), [o, a, l] = We(
1540
+ const { botToken: n, http: r, user: s } = B(), [o, a, l] = We(
1503
1541
  t(n, s),
1504
1542
  void 0,
1505
1543
  e ? "local" : "memory"
@@ -1509,13 +1547,13 @@ function pr({
1509
1547
  isAssignedToAi: d.assignee_id === 555,
1510
1548
  isAssignedToHuman: d.assignee_id !== 555,
1511
1549
  isPendingHuman: d.assignee_id === 555 && d.ai_closure_type === on.handed_off
1512
- }), u = ee(() => o ? p(o) : null, [o]), [c, i] = oe(
1550
+ }), u = ne(() => o ? p(o) : null, [o]), [c, i] = Y(
1513
1551
  async (d) => {
1514
1552
  let S = await r.apis.fetchSession(d);
1515
1553
  return S.data && a(S.data), S.data;
1516
1554
  },
1517
1555
  [r, a]
1518
- ), [g, f] = oe(
1556
+ ), [g, f] = Y(
1519
1557
  async (d) => {
1520
1558
  try {
1521
1559
  const S = await i(d);
@@ -1544,9 +1582,9 @@ function gr({ onSessionDestroy: e }) {
1544
1582
  lastUpdated: null,
1545
1583
  messages: [],
1546
1584
  keyboard: null
1547
- }), [r, s] = Qe({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: l, widgetSettings: p, defaultSettings: u, language: c, ...i } = ce(), { messageArrivedSound: g } = ur(), f = (p == null ? void 0 : p.persistSession) || u.persistSession, { refreshSession: m, session: d, deleteSession: S, setSession: h, pollSession: Y } = pr({
1585
+ }), [r, s] = Qe({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: l, widgetSettings: p, defaultSettings: u, language: c, ...i } = B(), { messageArrivedSound: g } = ur(), f = (p == null ? void 0 : p.persistSession) || u.persistSession, { refreshSession: m, session: d, deleteSession: S, setSession: h, pollSession: q } = pr({
1548
1586
  persist: f
1549
- }), [C, y] = oe(
1587
+ }), [C, y] = Y(
1550
1588
  async (A) => {
1551
1589
  if (!d) return [];
1552
1590
  try {
@@ -1557,7 +1595,7 @@ function gr({ onSessionDestroy: e }) {
1557
1595
  }
1558
1596
  },
1559
1597
  [d, l.apis]
1560
- ), [b, v] = oe(
1598
+ ), [b, v] = Y(
1561
1599
  async (A, N) => {
1562
1600
  try {
1563
1601
  const L = await l.apis.getHistoryPooling({
@@ -1589,7 +1627,7 @@ function gr({ onSessionDestroy: e }) {
1589
1627
  le(() => {
1590
1628
  let A, N;
1591
1629
  return d && (A = setInterval(() => {
1592
- Y(d.id);
1630
+ q(d.id);
1593
1631
  }, lr), N = setInterval(() => {
1594
1632
  var k;
1595
1633
  const L = (k = t.messages.at(-1)) == null ? void 0 : k.timestamp;
@@ -1597,8 +1635,8 @@ function gr({ onSessionDestroy: e }) {
1597
1635
  }, dr)), () => {
1598
1636
  clearInterval(A), clearInterval(N);
1599
1637
  };
1600
- }, [d, Y, v]);
1601
- const [F, O] = oe(
1638
+ }, [d, q, v]);
1639
+ const [F, O] = Y(
1602
1640
  async () => {
1603
1641
  if (d)
1604
1642
  try {
@@ -1616,7 +1654,7 @@ function gr({ onSessionDestroy: e }) {
1616
1654
  le(() => {
1617
1655
  O();
1618
1656
  }, []);
1619
- const [x, D] = oe(
1657
+ const [_, x] = Y(
1620
1658
  async () => {
1621
1659
  try {
1622
1660
  S(), n({ type: "RESET" }), e == null || e(), s({ state: "idle" });
@@ -1625,17 +1663,17 @@ function gr({ onSessionDestroy: e }) {
1625
1663
  }
1626
1664
  },
1627
1665
  [S, n, e, s]
1628
- ), [B, Q] = oe(
1666
+ ), [X, K] = Y(
1629
1667
  async () => {
1630
1668
  try {
1631
- await D();
1669
+ await x();
1632
1670
  const { data: A } = await l.apis.createSession(a);
1633
1671
  return h(A), A;
1634
1672
  } catch (A) {
1635
1673
  throw console.error("Error recreating session:", A), A;
1636
1674
  }
1637
1675
  },
1638
- [D, l.apis, a, h]
1676
+ [x, l.apis, a, h]
1639
1677
  ), j = async ({ content: A, user: N, attachments: L, ...k }) => {
1640
1678
  var ue;
1641
1679
  try {
@@ -1663,7 +1701,7 @@ function gr({ onSessionDestroy: e }) {
1663
1701
  const w = new Error("No active session available");
1664
1702
  throw s({ state: "error", error: w.message }), w;
1665
1703
  }
1666
- const z = Z(), { headers: fe, queryParams: we } = i;
1704
+ const z = ee(), { headers: fe, queryParams: we } = i;
1667
1705
  if (n({
1668
1706
  type: "APPEND_USER_MESSAGE",
1669
1707
  payload: {
@@ -1682,12 +1720,12 @@ function gr({ onSessionDestroy: e }) {
1682
1720
  payload: null
1683
1721
  }), !H && U.isAssignedToAi)
1684
1722
  try {
1685
- const w = await Y(U.id);
1723
+ const w = await q(U.id);
1686
1724
  w && (U = w);
1687
1725
  } catch (w) {
1688
1726
  console.error("Error polling session:", w);
1689
1727
  }
1690
- const ne = await l.apis.sendMessage({
1728
+ const se = await l.apis.sendMessage({
1691
1729
  id: z,
1692
1730
  content: A.text,
1693
1731
  session_id: U.id,
@@ -1708,13 +1746,13 @@ function gr({ onSessionDestroy: e }) {
1708
1746
  clientMessageId: z,
1709
1747
  deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
1710
1748
  }
1711
- }), ne.data.success) {
1712
- const w = ne.data;
1749
+ }), se.data.success) {
1750
+ const w = se.data;
1713
1751
  if (w.autopilotResponse && n({
1714
1752
  type: "ADD_RESPONSE_MESSAGE",
1715
1753
  payload: {
1716
1754
  type: "FROM_BOT",
1717
- id: w.autopilotResponse.id || Z(),
1755
+ id: w.autopilotResponse.id || ee(),
1718
1756
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1719
1757
  component: "TEXT",
1720
1758
  data: {
@@ -1727,7 +1765,7 @@ function gr({ onSessionDestroy: e }) {
1727
1765
  type: "ADD_RESPONSE_MESSAGE",
1728
1766
  payload: {
1729
1767
  type: "FROM_BOT",
1730
- id: Z(),
1768
+ id: ee(),
1731
1769
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1732
1770
  component: me.name,
1733
1771
  data: me.request_response
@@ -1735,12 +1773,12 @@ function gr({ onSessionDestroy: e }) {
1735
1773
  });
1736
1774
  }
1737
1775
  } else {
1738
- const w = ((ue = ne.data.error) == null ? void 0 : ue.message) || "Unknown error occurred";
1776
+ const w = ((ue = se.data.error) == null ? void 0 : ue.message) || "Unknown error occurred";
1739
1777
  n({
1740
1778
  type: "ADD_RESPONSE_MESSAGE",
1741
1779
  payload: {
1742
1780
  type: "FROM_BOT",
1743
- id: Z(),
1781
+ id: ee(),
1744
1782
  component: "TEXT",
1745
1783
  data: {
1746
1784
  message: w,
@@ -1754,7 +1792,7 @@ function gr({ onSessionDestroy: e }) {
1754
1792
  const H = U instanceof Error ? U.message : "An unexpected error occurred";
1755
1793
  throw console.error("Error in sendMessage:", H, U), (!d || d != null && d.isAssignedToAi) && s({ state: "error", error: H }), U;
1756
1794
  }
1757
- }, te = ge(
1795
+ }, re = ge(
1758
1796
  (A) => {
1759
1797
  j({
1760
1798
  content: {
@@ -1775,33 +1813,33 @@ function gr({ onSessionDestroy: e }) {
1775
1813
  session: d,
1776
1814
  noMessages: o,
1777
1815
  initState: F,
1778
- clearSessionState: x,
1779
- recreateSessionState: B,
1816
+ clearSessionState: _,
1817
+ recreateSessionState: X,
1780
1818
  hookState: r,
1781
- recreateSession: Q,
1782
- clearSession: D,
1819
+ recreateSession: K,
1820
+ clearSession: x,
1783
1821
  sendMessage: j,
1784
- handleKeyboard: te
1822
+ handleKeyboard: re
1785
1823
  };
1786
1824
  }
1787
- const [ls, hr] = Ce();
1825
+ const [ps, hr] = Ce();
1788
1826
  function mr({
1789
1827
  children: e
1790
1828
  }) {
1791
- const { settings: t } = ce(), n = gr({
1829
+ const { settings: t } = B(), n = gr({
1792
1830
  defaultHookSettings: {
1793
1831
  persistSession: (t == null ? void 0 : t.persistSession) ?? !0,
1794
1832
  useSoundEffects: (t == null ? void 0 : t.useSoundEffects) ?? !1
1795
1833
  }
1796
1834
  });
1797
- return /* @__PURE__ */ $(hr, { value: n, children: e });
1835
+ return /* @__PURE__ */ te(hr, { value: n, children: e });
1798
1836
  }
1799
1837
  function yr() {
1800
- const { http: e, botToken: t, user: n, collectUserData: r } = ce(), [s, o] = We(
1838
+ const { http: e, botToken: t, user: n, collectUserData: r } = B(), [s, o] = We(
1801
1839
  `${t}:contact:${n.external_id}`,
1802
1840
  null,
1803
1841
  "local"
1804
- ), [a, l] = oe(
1842
+ ), [a, l] = Y(
1805
1843
  async (u) => {
1806
1844
  var c;
1807
1845
  try {
@@ -1818,7 +1856,7 @@ function yr() {
1818
1856
  le(() => {
1819
1857
  n && t && l(n);
1820
1858
  }, [n, t]);
1821
- const p = ee(() => !(s != null && s.id) && r ? {
1859
+ const p = ne(() => !(s != null && s.id) && r ? {
1822
1860
  should: !0,
1823
1861
  reason: "No contact id and collectUserData is true"
1824
1862
  } : {
@@ -1831,16 +1869,16 @@ function yr() {
1831
1869
  shouldCollectData: p
1832
1870
  };
1833
1871
  }
1834
- const [ds, Sr] = Ce();
1872
+ const [gs, Sr] = Ce();
1835
1873
  function vr({ children: e }) {
1836
1874
  const t = yr();
1837
- return /* @__PURE__ */ $(Sr, { value: t, children: e });
1875
+ return /* @__PURE__ */ te(Sr, { value: t, children: e });
1838
1876
  }
1839
- function fs({
1877
+ function hs({
1840
1878
  children: e,
1841
1879
  options: t
1842
1880
  }) {
1843
- return /* @__PURE__ */ $(Zn, { data: t, children: /* @__PURE__ */ $(vr, { children: /* @__PURE__ */ $(St, { children: /* @__PURE__ */ $(mr, { children: e }) }) }) });
1881
+ return /* @__PURE__ */ te(Zn, { data: t, children: /* @__PURE__ */ te(vr, { children: /* @__PURE__ */ te(St, { children: /* @__PURE__ */ te(mr, { children: e }) }) }) });
1844
1882
  }
1845
1883
  var Ge = { exports: {} }, Ie = {};
1846
1884
  /**
@@ -1913,8 +1951,8 @@ function wr() {
1913
1951
  {
1914
1952
  var v = t.ReactDebugCurrentFrame, F = v.getStackAddendum();
1915
1953
  F !== "" && (y += "%s", b = b.concat([F]));
1916
- var O = b.map(function(x) {
1917
- return String(x);
1954
+ var O = b.map(function(_) {
1955
+ return String(_);
1918
1956
  });
1919
1957
  O.unshift("Warning: " + y), Function.prototype.apply.call(console[C], console, O);
1920
1958
  }
@@ -1935,21 +1973,21 @@ function wr() {
1935
1973
  value: v,
1936
1974
  getSnapshot: y
1937
1975
  }
1938
- }), x = O[0].inst, D = O[1];
1976
+ }), _ = O[0].inst, x = O[1];
1939
1977
  return p(function() {
1940
- x.value = v, x.getSnapshot = y, f(x) && D({
1941
- inst: x
1978
+ _.value = v, _.getSnapshot = y, f(_) && x({
1979
+ inst: _
1942
1980
  });
1943
1981
  }, [C, v, y]), l(function() {
1944
- f(x) && D({
1945
- inst: x
1982
+ f(_) && x({
1983
+ inst: _
1946
1984
  });
1947
- var B = function() {
1948
- f(x) && D({
1949
- inst: x
1985
+ var X = function() {
1986
+ f(_) && x({
1987
+ inst: _
1950
1988
  });
1951
1989
  };
1952
- return C(B);
1990
+ return C(X);
1953
1991
  }, [C]), u(v), v;
1954
1992
  }
1955
1993
  function f(C) {
@@ -1964,20 +2002,20 @@ function wr() {
1964
2002
  function m(C, y, b) {
1965
2003
  return y();
1966
2004
  }
1967
- var d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", S = !d, h = S ? m : g, Y = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h;
1968
- je.useSyncExternalStore = Y, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2005
+ var d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", S = !d, h = S ? m : g, q = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h;
2006
+ je.useSyncExternalStore = q, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
1969
2007
  }()), je;
1970
2008
  }
1971
2009
  process.env.NODE_ENV === "production" ? Ge.exports = Er() : Ge.exports = wr();
1972
2010
  var br = Ge.exports;
1973
- const ae = () => {
2011
+ const ie = () => {
1974
2012
  }, V = (
1975
2013
  /*#__NOINLINE__*/
1976
- ae()
1977
- ), ke = Object, E = (e) => e === V, X = (e) => typeof e == "function", ie = (e, t) => ({
2014
+ ie()
2015
+ ), ke = Object, E = (e) => e === V, W = (e) => typeof e == "function", ce = (e, t) => ({
1978
2016
  ...e,
1979
2017
  ...t
1980
- }), Or = (e) => X(e.then), Oe = /* @__PURE__ */ new WeakMap();
2018
+ }), Or = (e) => W(e.then), Oe = /* @__PURE__ */ new WeakMap();
1981
2019
  let Ar = 0;
1982
2020
  const ve = (e) => {
1983
2021
  const t = typeof e, n = e && e.constructor, r = n == Date;
@@ -1999,8 +2037,8 @@ const ve = (e) => {
1999
2037
  } else
2000
2038
  s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
2001
2039
  return s;
2002
- }, J = /* @__PURE__ */ new WeakMap(), Me = {}, Ae = {}, Je = "undefined", _e = typeof window != Je, ze = typeof document != Je, Tr = () => _e && typeof window.requestAnimationFrame != Je, Xt = (e, t) => {
2003
- const n = J.get(e);
2040
+ }, $ = /* @__PURE__ */ new WeakMap(), Me = {}, Ae = {}, Je = "undefined", De = typeof window != Je, ze = typeof document != Je, Tr = () => De && typeof window.requestAnimationFrame != Je, Xt = (e, t) => {
2041
+ const n = $.get(e);
2004
2042
  return [
2005
2043
  // Getter
2006
2044
  () => !E(t) && e.get(t) || Me,
@@ -2008,7 +2046,7 @@ const ve = (e) => {
2008
2046
  (r) => {
2009
2047
  if (!E(t)) {
2010
2048
  const s = e.get(t);
2011
- t in Ae || (Ae[t] = s), n[5](t, ie(s, r), s || Me);
2049
+ t in Ae || (Ae[t] = s), n[5](t, ce(s, r), s || Me);
2012
2050
  }
2013
2051
  },
2014
2052
  // Subscriber
@@ -2018,18 +2056,18 @@ const ve = (e) => {
2018
2056
  ];
2019
2057
  };
2020
2058
  let Ye = !0;
2021
- const Rr = () => Ye, [Be, qe] = _e && window.addEventListener ? [
2059
+ const Rr = () => Ye, [Be, qe] = De && window.addEventListener ? [
2022
2060
  window.addEventListener.bind(window),
2023
2061
  window.removeEventListener.bind(window)
2024
2062
  ] : [
2025
- ae,
2026
- ae
2063
+ ie,
2064
+ ie
2027
2065
  ], Cr = () => {
2028
2066
  const e = ze && document.visibilityState;
2029
2067
  return E(e) || e !== "hidden";
2030
2068
  }, Nr = (e) => (ze && document.addEventListener("visibilitychange", e), Be("focus", e), () => {
2031
2069
  ze && document.removeEventListener("visibilitychange", e), qe("focus", e);
2032
- }), _r = (e) => {
2070
+ }), Dr = (e) => {
2033
2071
  const t = () => {
2034
2072
  Ye = !0, e();
2035
2073
  }, n = () => {
@@ -2038,17 +2076,17 @@ const Rr = () => Ye, [Be, qe] = _e && window.addEventListener ? [
2038
2076
  return Be("online", t), Be("offline", n), () => {
2039
2077
  qe("online", t), qe("offline", n);
2040
2078
  };
2041
- }, xr = {
2079
+ }, _r = {
2042
2080
  isOnline: Rr,
2043
2081
  isVisible: Cr
2044
- }, Dr = {
2082
+ }, xr = {
2045
2083
  initFocus: Nr,
2046
- initReconnect: _r
2047
- }, ut = !de.useId, Ee = !_e || "Deno" in window, Pr = (e) => Tr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Fe = Ee ? le : cn, Le = typeof navigator < "u" && navigator.connection, lt = !Ee && Le && ([
2084
+ initReconnect: Dr
2085
+ }, ut = !de.useId, Ee = !De || "Deno" in window, Pr = (e) => Tr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Fe = Ee ? le : cn, Le = typeof navigator < "u" && navigator.connection, lt = !Ee && Le && ([
2048
2086
  "slow-2g",
2049
2087
  "2g"
2050
2088
  ].includes(Le.effectiveType) || Le.saveData), Ze = (e) => {
2051
- if (X(e))
2089
+ if (W(e))
2052
2090
  try {
2053
2091
  e = e();
2054
2092
  } catch {
@@ -2070,7 +2108,7 @@ var Se = {
2070
2108
  RECONNECT_EVENT: Wt
2071
2109
  };
2072
2110
  async function Jt(...e) {
2073
- const [t, n, r, s] = e, o = ie({
2111
+ const [t, n, r, s] = e, o = ce({
2074
2112
  populateCache: !0,
2075
2113
  throwOnError: !0
2076
2114
  }, typeof s == "boolean" ? {
@@ -2080,7 +2118,7 @@ async function Jt(...e) {
2080
2118
  const l = o.rollbackOnError;
2081
2119
  let p = o.optimisticData;
2082
2120
  const u = (g) => typeof l == "function" ? l(g) : l !== !1, c = o.throwOnError;
2083
- if (X(n)) {
2121
+ if (W(n)) {
2084
2122
  const g = n, f = [], m = t.keys();
2085
2123
  for (const d of m)
2086
2124
  // Skip the special useSWRInfinite and useSWRSubscription keys.
@@ -2091,9 +2129,9 @@ async function Jt(...e) {
2091
2129
  async function i(g) {
2092
2130
  const [f] = Ze(g);
2093
2131
  if (!f) return;
2094
- const [m, d] = Xt(t, f), [S, h, Y, C] = J.get(t), y = () => {
2132
+ const [m, d] = Xt(t, f), [S, h, q, C] = $.get(t), y = () => {
2095
2133
  const j = S[f];
2096
- return (X(o.revalidate) ? o.revalidate(m().data, g) : o.revalidate !== !1) && (delete Y[f], delete C[f], j && j[0]) ? j[0](Kt).then(() => m().data) : m().data;
2134
+ return (W(o.revalidate) ? o.revalidate(m().data, g) : o.revalidate !== !1) && (delete q[f], delete C[f], j && j[0]) ? j[0](Kt).then(() => m().data) : m().data;
2097
2135
  };
2098
2136
  if (e.length < 3)
2099
2137
  return y();
@@ -2103,13 +2141,13 @@ async function Jt(...e) {
2103
2141
  F,
2104
2142
  0
2105
2143
  ];
2106
- const O = !E(p), x = m(), D = x.data, B = x._c, Q = E(B) ? D : B;
2107
- if (O && (p = X(p) ? p(Q, D) : p, d({
2144
+ const O = !E(p), _ = m(), x = _.data, X = _._c, K = E(X) ? x : X;
2145
+ if (O && (p = W(p) ? p(K, x) : p, d({
2108
2146
  data: p,
2109
- _c: Q
2110
- })), X(b))
2147
+ _c: K
2148
+ })), W(b))
2111
2149
  try {
2112
- b = b(Q);
2150
+ b = b(K);
2113
2151
  } catch (j) {
2114
2152
  v = j;
2115
2153
  }
@@ -2120,12 +2158,12 @@ async function Jt(...e) {
2120
2158
  if (v) throw v;
2121
2159
  return b;
2122
2160
  } else v && O && u(v) && (a = !0, d({
2123
- data: Q,
2161
+ data: K,
2124
2162
  _c: V
2125
2163
  }));
2126
2164
  if (a && !v)
2127
- if (X(a)) {
2128
- const j = a(b, Q);
2165
+ if (W(a)) {
2166
+ const j = a(b, K);
2129
2167
  d({
2130
2168
  data: j,
2131
2169
  error: V,
@@ -2152,9 +2190,9 @@ const dt = (e, t) => {
2152
2190
  for (const n in e)
2153
2191
  e[n][0] && e[n][0](t);
2154
2192
  }, kr = (e, t) => {
2155
- if (!J.has(e)) {
2156
- const n = ie(Dr, t), r = {}, s = Jt.bind(V, e);
2157
- let o = ae;
2193
+ if (!$.has(e)) {
2194
+ const n = ce(xr, t), r = {}, s = Jt.bind(V, e);
2195
+ let o = ie;
2158
2196
  const a = {}, l = (c, i) => {
2159
2197
  const g = a[c] || [];
2160
2198
  return a[c] = g, g.push(i), () => g.splice(g.indexOf(i), 1);
@@ -2165,7 +2203,7 @@ const dt = (e, t) => {
2165
2203
  for (const m of f)
2166
2204
  m(i, g);
2167
2205
  }, u = () => {
2168
- if (!J.has(e) && (J.set(e, [
2206
+ if (!$.has(e) && ($.set(e, [
2169
2207
  r,
2170
2208
  {},
2171
2209
  {},
@@ -2176,7 +2214,7 @@ const dt = (e, t) => {
2176
2214
  ]), !Ee)) {
2177
2215
  const c = n.initFocus(setTimeout.bind(V, dt.bind(V, r, Qt))), i = n.initReconnect(setTimeout.bind(V, dt.bind(V, r, Wt)));
2178
2216
  o = () => {
2179
- c && c(), i && i(), J.delete(e);
2217
+ c && c(), i && i(), $.delete(e);
2180
2218
  };
2181
2219
  }
2182
2220
  };
@@ -2189,19 +2227,19 @@ const dt = (e, t) => {
2189
2227
  }
2190
2228
  return [
2191
2229
  e,
2192
- J.get(e)[4]
2230
+ $.get(e)[4]
2193
2231
  ];
2194
2232
  }, Mr = (e, t, n, r, s) => {
2195
2233
  const o = n.errorRetryCount, a = s.retryCount, l = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
2196
2234
  !E(o) && a > o || setTimeout(r, l, s);
2197
- }, Fr = (e, t) => ve(e) == ve(t), [Zt, Lr] = kr(/* @__PURE__ */ new Map()), Vr = ie(
2235
+ }, Fr = (e, t) => ve(e) == ve(t), [Zt, Lr] = kr(/* @__PURE__ */ new Map()), Vr = ce(
2198
2236
  {
2199
2237
  // events
2200
- onLoadingSlow: ae,
2201
- onSuccess: ae,
2202
- onError: ae,
2238
+ onLoadingSlow: ie,
2239
+ onSuccess: ie,
2240
+ onError: ie,
2203
2241
  onErrorRetry: Mr,
2204
- onDiscarded: ae,
2242
+ onDiscarded: ie,
2205
2243
  // switches
2206
2244
  revalidateOnFocus: !0,
2207
2245
  revalidateOnReconnect: !0,
@@ -2220,17 +2258,17 @@ const dt = (e, t) => {
2220
2258
  fallback: {}
2221
2259
  },
2222
2260
  // use web preset by default
2223
- xr
2261
+ _r
2224
2262
  ), Ur = (e, t) => {
2225
- const n = ie(e, t);
2263
+ const n = ce(e, t);
2226
2264
  if (t) {
2227
2265
  const { use: r, fallback: s } = e, { use: o, fallback: a } = t;
2228
- r && o && (n.use = r.concat(o)), s && a && (n.fallback = ie(s, a));
2266
+ r && o && (n.use = r.concat(o)), s && a && (n.fallback = ce(s, a));
2229
2267
  }
2230
2268
  return n;
2231
- }, Hr = gt({}), Gr = "$inf$", $t = _e && window.__SWR_DEVTOOLS_USE__, zr = $t ? window.__SWR_DEVTOOLS_USE__ : [], Yr = () => {
2269
+ }, Hr = gt({}), Gr = "$inf$", $t = De && window.__SWR_DEVTOOLS_USE__, zr = $t ? window.__SWR_DEVTOOLS_USE__ : [], Yr = () => {
2232
2270
  $t && (window.__SWR_DEVTOOLS_REACT__ = de);
2233
- }, Br = (e) => X(e[1]) ? [
2271
+ }, Br = (e) => W(e[1]) ? [
2234
2272
  e[0],
2235
2273
  e[1],
2236
2274
  e[2] || {}
@@ -2238,8 +2276,8 @@ const dt = (e, t) => {
2238
2276
  e[0],
2239
2277
  null,
2240
2278
  (e[1] === null ? e[2] : e[1]) || {}
2241
- ], qr = () => ie(Vr, ht(Hr)), Xr = (e) => (t, n, r) => e(t, n && ((...o) => {
2242
- const [a] = Ze(t), [, , , l] = J.get(Zt);
2279
+ ], qr = () => ce(Vr, ht(Hr)), Xr = (e) => (t, n, r) => e(t, n && ((...o) => {
2280
+ const [a] = Ze(t), [, , , l] = $.get(Zt);
2243
2281
  if (a.startsWith(Gr))
2244
2282
  return n(...o);
2245
2283
  const p = l[a];
@@ -2272,29 +2310,29 @@ const ft = de.use || ((e) => {
2272
2310
  }), Ve = {
2273
2311
  dedupe: !0
2274
2312
  }, Jr = (e, t, n) => {
2275
- const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: l, revalidateIfStale: p, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: g } = n, [f, m, d, S] = J.get(r), [h, Y] = Ze(e), C = se(!1), y = se(!1), b = se(h), v = se(t), F = se(n), O = () => F.current, x = () => O().isVisible() && O().isOnline(), [D, B, Q, j] = Xt(r, h), te = se({}).current, A = E(a) ? n.fallback[h] : a, N = (T, R) => {
2276
- for (const I in te) {
2277
- const _ = I;
2278
- if (_ === "data") {
2279
- if (!s(T[_], R[_]) && (!E(T[_]) || !s(ne, R[_])))
2313
+ const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: l, revalidateIfStale: p, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: g } = n, [f, m, d, S] = $.get(r), [h, q] = Ze(e), C = ae(!1), y = ae(!1), b = ae(h), v = ae(t), F = ae(n), O = () => F.current, _ = () => O().isVisible() && O().isOnline(), [x, X, K, j] = Xt(r, h), re = ae({}).current, A = E(a) ? n.fallback[h] : a, N = (T, R) => {
2314
+ for (const I in re) {
2315
+ const D = I;
2316
+ if (D === "data") {
2317
+ if (!s(T[D], R[D]) && (!E(T[D]) || !s(se, R[D])))
2280
2318
  return !1;
2281
- } else if (R[_] !== T[_])
2319
+ } else if (R[D] !== T[D])
2282
2320
  return !1;
2283
2321
  }
2284
2322
  return !0;
2285
- }, L = ee(() => {
2323
+ }, L = ne(() => {
2286
2324
  const T = !h || !t ? !1 : E(l) ? O().isPaused() || o ? !1 : E(p) ? !0 : p : l, R = (M) => {
2287
- const W = ie(M);
2288
- return delete W._k, T ? {
2325
+ const J = ce(M);
2326
+ return delete J._k, T ? {
2289
2327
  isValidating: !0,
2290
2328
  isLoading: !0,
2291
- ...W
2292
- } : W;
2293
- }, I = D(), _ = j(), q = R(I), pe = I === _ ? q : R(_);
2294
- let P = q;
2329
+ ...J
2330
+ } : J;
2331
+ }, I = x(), D = j(), Q = R(I), pe = I === D ? Q : R(D);
2332
+ let P = Q;
2295
2333
  return [
2296
2334
  () => {
2297
- const M = R(D());
2335
+ const M = R(x());
2298
2336
  return N(M, P) ? (P.data = M.data, P.isLoading = M.isLoading, P.isValidating = M.isValidating, P.error = M.error, P) : (P = M, M);
2299
2337
  },
2300
2338
  () => pe
@@ -2303,7 +2341,7 @@ const ft = de.use || ((e) => {
2303
2341
  r,
2304
2342
  h
2305
2343
  ]), k = br.useSyncExternalStore(ge(
2306
- (T) => Q(h, (R, I) => {
2344
+ (T) => K(h, (R, I) => {
2307
2345
  N(I, R) || T();
2308
2346
  }),
2309
2347
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -2311,53 +2349,53 @@ const ft = de.use || ((e) => {
2311
2349
  r,
2312
2350
  h
2313
2351
  ]
2314
- ), L[0], L[1]), ue = !C.current, U = f[h] && f[h].length > 0, H = k.data, z = E(H) ? A : H, fe = k.error, we = se(z), ne = g ? E(H) ? we.current : H : z, w = U && !E(fe) ? !1 : ue && !E(l) ? l : O().isPaused() ? !1 : o ? E(z) ? !1 : p : E(z) || p, me = !!(h && t && ue && w), en = E(k.isValidating) ? me : k.isValidating, tn = E(k.isLoading) ? me : k.isLoading, ye = ge(
2352
+ ), L[0], L[1]), ue = !C.current, U = f[h] && f[h].length > 0, H = k.data, z = E(H) ? A : H, fe = k.error, we = ae(z), se = g ? E(H) ? we.current : H : z, w = U && !E(fe) ? !1 : ue && !E(l) ? l : O().isPaused() ? !1 : o ? E(z) ? !1 : p : E(z) || p, me = !!(h && t && ue && w), en = E(k.isValidating) ? me : k.isValidating, tn = E(k.isLoading) ? me : k.isLoading, ye = ge(
2315
2353
  async (T) => {
2316
2354
  const R = v.current;
2317
2355
  if (!h || !R || y.current || O().isPaused())
2318
2356
  return !1;
2319
- let I, _, q = !0;
2320
- const pe = T || {}, P = !d[h] || !pe.dedupe, M = () => ut ? !y.current && h === b.current && C.current : h === b.current, W = {
2357
+ let I, D, Q = !0;
2358
+ const pe = T || {}, P = !d[h] || !pe.dedupe, M = () => ut ? !y.current && h === b.current && C.current : h === b.current, J = {
2321
2359
  isValidating: !1,
2322
2360
  isLoading: !1
2323
2361
  }, et = () => {
2324
- B(W);
2362
+ X(J);
2325
2363
  }, tt = () => {
2326
2364
  const G = d[h];
2327
- G && G[1] === _ && delete d[h];
2365
+ G && G[1] === D && delete d[h];
2328
2366
  }, nt = {
2329
2367
  isValidating: !0
2330
2368
  };
2331
- E(D().data) && (nt.isLoading = !0);
2369
+ E(x().data) && (nt.isLoading = !0);
2332
2370
  try {
2333
- if (P && (B(nt), n.loadingTimeout && E(D().data) && setTimeout(() => {
2334
- q && M() && O().onLoadingSlow(h, n);
2371
+ if (P && (X(nt), n.loadingTimeout && E(x().data) && setTimeout(() => {
2372
+ Q && M() && O().onLoadingSlow(h, n);
2335
2373
  }, n.loadingTimeout), d[h] = [
2336
- R(Y),
2374
+ R(q),
2337
2375
  Xe()
2338
- ]), [I, _] = d[h], I = await I, P && setTimeout(tt, n.dedupingInterval), !d[h] || d[h][1] !== _)
2376
+ ]), [I, D] = d[h], I = await I, P && setTimeout(tt, n.dedupingInterval), !d[h] || d[h][1] !== D)
2339
2377
  return P && M() && O().onDiscarded(h), !1;
2340
- W.error = V;
2378
+ J.error = V;
2341
2379
  const G = m[h];
2342
2380
  if (!E(G) && // case 1
2343
- (_ <= G[0] || // case 2
2344
- _ <= G[1] || // case 3
2381
+ (D <= G[0] || // case 2
2382
+ D <= G[1] || // case 3
2345
2383
  G[1] === 0))
2346
2384
  return et(), P && M() && O().onDiscarded(h), !1;
2347
- const K = D().data;
2348
- W.data = s(K, I) ? K : I, P && M() && O().onSuccess(I, h, n);
2385
+ const Z = x().data;
2386
+ J.data = s(Z, I) ? Z : I, P && M() && O().onSuccess(I, h, n);
2349
2387
  } catch (G) {
2350
2388
  tt();
2351
- const K = O(), { shouldRetryOnError: xe } = K;
2352
- K.isPaused() || (W.error = G, P && M() && (K.onError(G, h, K), (xe === !0 || X(xe) && xe(G)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || x()) && K.onErrorRetry(G, h, K, (nn) => {
2353
- const De = f[h];
2354
- De && De[0] && De[0](Se.ERROR_REVALIDATE_EVENT, nn);
2389
+ const Z = O(), { shouldRetryOnError: _e } = Z;
2390
+ Z.isPaused() || (J.error = G, P && M() && (Z.onError(G, h, Z), (_e === !0 || W(_e) && _e(G)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || _()) && Z.onErrorRetry(G, h, Z, (nn) => {
2391
+ const xe = f[h];
2392
+ xe && xe[0] && xe[0](Se.ERROR_REVALIDATE_EVENT, nn);
2355
2393
  }, {
2356
2394
  retryCount: (pe.retryCount || 0) + 1,
2357
2395
  dedupe: !0
2358
2396
  })));
2359
2397
  }
2360
- return q = !1, et(), !0;
2398
+ return Q = !1, et(), !0;
2361
2399
  },
2362
2400
  // `setState` is immutable, and `eventsCallback`, `fnArg`, and
2363
2401
  // `keyValidating` are depending on `key`, so we can exclude them from
@@ -2386,34 +2424,34 @@ const ft = de.use || ((e) => {
2386
2424
  if (!h) return;
2387
2425
  const T = ye.bind(V, Ve);
2388
2426
  let R = 0;
2389
- const _ = Kr(h, f, (q, pe = {}) => {
2390
- if (q == Se.FOCUS_EVENT) {
2427
+ const D = Kr(h, f, (Q, pe = {}) => {
2428
+ if (Q == Se.FOCUS_EVENT) {
2391
2429
  const P = Date.now();
2392
- O().revalidateOnFocus && P > R && x() && (R = P + O().focusThrottleInterval, T());
2393
- } else if (q == Se.RECONNECT_EVENT)
2394
- O().revalidateOnReconnect && x() && T();
2430
+ O().revalidateOnFocus && P > R && _() && (R = P + O().focusThrottleInterval, T());
2431
+ } else if (Q == Se.RECONNECT_EVENT)
2432
+ O().revalidateOnReconnect && _() && T();
2395
2433
  else {
2396
- if (q == Se.MUTATE_EVENT)
2434
+ if (Q == Se.MUTATE_EVENT)
2397
2435
  return ye();
2398
- if (q == Se.ERROR_REVALIDATE_EVENT)
2436
+ if (Q == Se.ERROR_REVALIDATE_EVENT)
2399
2437
  return ye(pe);
2400
2438
  }
2401
2439
  });
2402
- return y.current = !1, b.current = h, C.current = !0, B({
2403
- _k: Y
2440
+ return y.current = !1, b.current = h, C.current = !0, X({
2441
+ _k: q
2404
2442
  }), w && (E(z) || Ee ? T() : Pr(T)), () => {
2405
- y.current = !0, _();
2443
+ y.current = !0, D();
2406
2444
  };
2407
2445
  }, [
2408
2446
  h
2409
2447
  ]), Fe(() => {
2410
2448
  let T;
2411
2449
  function R() {
2412
- const _ = X(u) ? u(D().data) : u;
2413
- _ && T !== -1 && (T = setTimeout(I, _));
2450
+ const D = W(u) ? u(x().data) : u;
2451
+ D && T !== -1 && (T = setTimeout(I, D));
2414
2452
  }
2415
2453
  function I() {
2416
- !D().error && (c || O().isVisible()) && (i || O().isOnline()) ? ye(Ve).then(R) : R();
2454
+ !x().error && (c || O().isVisible()) && (i || O().isOnline()) ? ye(Ve).then(R) : R();
2417
2455
  }
2418
2456
  return R(), () => {
2419
2457
  T && (clearTimeout(T), T = -1);
@@ -2423,7 +2461,7 @@ const ft = de.use || ((e) => {
2423
2461
  c,
2424
2462
  i,
2425
2463
  h
2426
- ]), un(ne), o && E(z) && h) {
2464
+ ]), un(se), o && E(z) && h) {
2427
2465
  if (!ut && Ee)
2428
2466
  throw new Error("Fallback data is required when using suspense in SSR.");
2429
2467
  v.current = t, F.current = n, y.current = !1;
@@ -2434,48 +2472,51 @@ const ft = de.use || ((e) => {
2434
2472
  }
2435
2473
  if (E(fe)) {
2436
2474
  const R = ye(Ve);
2437
- E(ne) || (R.status = "fulfilled", R.value = !0), ft(R);
2475
+ E(se) || (R.status = "fulfilled", R.value = !0), ft(R);
2438
2476
  } else
2439
2477
  throw fe;
2440
2478
  }
2441
2479
  return {
2442
2480
  mutate: $e,
2443
2481
  get data() {
2444
- return te.data = !0, ne;
2482
+ return re.data = !0, se;
2445
2483
  },
2446
2484
  get error() {
2447
- return te.error = !0, fe;
2485
+ return re.error = !0, fe;
2448
2486
  },
2449
2487
  get isValidating() {
2450
- return te.isValidating = !0, en;
2488
+ return re.isValidating = !0, en;
2451
2489
  },
2452
2490
  get isLoading() {
2453
- return te.isLoading = !0, tn;
2491
+ return re.isLoading = !0, tn;
2454
2492
  }
2455
2493
  };
2456
2494
  }, Zr = Wr(Jr);
2457
- function ps() {
2458
- const { apiUrl: e, botToken: t } = ce(), n = yt({
2495
+ function ms() {
2496
+ const { apiUrl: e, botToken: t } = B(), n = yt({
2459
2497
  apiUrl: e,
2460
2498
  botToken: t
2461
2499
  });
2462
2500
  return Zr(n.options, n.apis.fetchPreludeData);
2463
2501
  }
2464
2502
  export {
2465
- fs as W,
2466
- oe as _,
2467
- ds as a,
2468
- ps as b,
2503
+ hs as W,
2504
+ Y as _,
2505
+ B as a,
2506
+ gs as b,
2469
2507
  is as c,
2470
- as as d,
2471
- ls as e,
2472
- Ce as f,
2508
+ ms as d,
2509
+ as as e,
2510
+ ps as f,
2473
2511
  cs as g,
2474
- us as h,
2475
- Te as i,
2476
- wt as j,
2477
- jt as k,
2478
- ur as l,
2479
- ce as u
2512
+ Ce as h,
2513
+ fs as i,
2514
+ Te as j,
2515
+ wt as k,
2516
+ jt as l,
2517
+ ls as m,
2518
+ ds as n,
2519
+ ur as o,
2520
+ us as u
2480
2521
  };
2481
- //# sourceMappingURL=index-pl-6K_wU.js.map
2522
+ //# sourceMappingURL=index-Cdz5xDDT.js.map