@opencx/widget 2.5.0 → 2.5.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,11 +1,11 @@
1
1
  var ln = Object.defineProperty;
2
2
  var dn = (e, t, n) => t in e ? ln(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var at = (e, t, n) => dn(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { g as $, c as ht } from "./schemas-v2-DZ3nwfID.js";
5
- import fe, { useMemo as te, useState as Ke, useCallback as me, useEffect as de, createContext as yt, useContext as St, useRef as oe, useReducer as fn, useLayoutEffect as pn, useDebugValue as gn } from "react";
6
- import { jsx as ee } from "react/jsx-runtime";
4
+ import de, { useMemo as ee, useState as Ke, useCallback as ge, useEffect as le, createContext as ht, useContext as yt, useRef as se, useReducer as fn, useLayoutEffect as pn, useDebugValue as gn } from "react";
5
+ import { jsx as $ } from "react/jsx-runtime";
7
6
  import { create as mn } from "mutative";
8
7
  import l from "zod";
8
+ import { c as St, g as ve } from "./genUuid-CDpI3ugS.js";
9
9
  import hn from "lodash.set";
10
10
  import yn from "axios";
11
11
  const Sn = typeof window > "u", it = {
@@ -19,7 +19,7 @@ function vn(e) {
19
19
  return Sn ? it : e === "local" ? localStorage : e === "session" ? sessionStorage : it;
20
20
  }
21
21
  function Je(e, t, n = "session") {
22
- const r = te(() => vn(n), [n]), [s, o] = Ke(() => {
22
+ const r = ee(() => vn(n), [n]), [s, o] = Ke(() => {
23
23
  const g = r.getItem(e);
24
24
  if (g !== null)
25
25
  try {
@@ -28,7 +28,7 @@ function Je(e, t, n = "session") {
28
28
  console.error(`Error parsing stored value for key '${e}':`, u);
29
29
  }
30
30
  return typeof t == "function" ? t() : t ?? null;
31
- }), a = me(
31
+ }), a = ge(
32
32
  (g) => {
33
33
  if (o(g), g === null)
34
34
  r.removeItem(e);
@@ -43,10 +43,10 @@ function Je(e, t, n = "session") {
43
43
  }
44
44
  },
45
45
  [e, r]
46
- ), d = me(() => {
46
+ ), d = ge(() => {
47
47
  o(null), r.removeItem(e);
48
48
  }, [e, r]);
49
- return de(() => {
49
+ return le(() => {
50
50
  const g = (u) => {
51
51
  u.key === e && u.newValue !== JSON.stringify(s) && o(u.newValue ? JSON.parse(u.newValue) : null);
52
52
  };
@@ -55,7 +55,7 @@ function Je(e, t, n = "session") {
55
55
  };
56
56
  }, [e, s]), [s, a, d];
57
57
  }
58
- const En = "@opencx/widget", vt = "2.5.0", bn = "module", wn = {
58
+ const En = "@opencx/widget", vt = "2.5.1", bn = "module", wn = {
59
59
  access: "public"
60
60
  }, On = {
61
61
  clean: "rm -rf ./dist ./dist-embed",
@@ -100,6 +100,7 @@ const En = "@opencx/widget", vt = "2.5.0", bn = "module", wn = {
100
100
  "react-dropzone": "^14.3.5",
101
101
  "react-hot-toast": "^2.4.1",
102
102
  tinycolor2: "^1.6.0",
103
+ uuid: "^11.0.4",
103
104
  zod: "^3.23.8"
104
105
  }, Dn = {
105
106
  "@opencx/widget": {
@@ -210,7 +211,7 @@ const En = "@opencx/widget", vt = "2.5.0", bn = "module", wn = {
210
211
  devDependencies: Mn
211
212
  }, Un = "X-Bot-Token", Hn = "X-Widget-Version";
212
213
  function Et(e) {
213
- const t = te(() => yn.create({
214
+ const t = ee(() => yn.create({
214
215
  baseURL: e.apiUrl,
215
216
  headers: {
216
217
  [Un]: e.botToken,
@@ -218,7 +219,7 @@ function Et(e) {
218
219
  "X-Use-Guard": !0
219
220
  }
220
221
  }), [e]);
221
- return { apis: te(
222
+ return { apis: ee(
222
223
  () => ({
223
224
  createSession: (r) => {
224
225
  if (!r)
@@ -304,9 +305,9 @@ function Et(e) {
304
305
  ), options: e };
305
306
  }
306
307
  function De(e) {
307
- const t = yt({});
308
+ const t = ht({});
308
309
  return [() => {
309
- const r = St(t);
310
+ const r = yt(t);
310
311
  if (r === void 0)
311
312
  throw new Error("useSafeContext must be used within a Provider");
312
313
  return r;
@@ -471,7 +472,7 @@ const Gn = {
471
472
  "start-chat": "Talk to support",
472
473
  "starting-chat": "Connecting...",
473
474
  "hello-greeting": "Hi there!"
474
- }, Bn = {
475
+ }, qn = {
475
476
  ok: "D'accord",
476
477
  yes: "Oui",
477
478
  no: "Non",
@@ -524,7 +525,7 @@ const Gn = {
524
525
  "start-chat": "Parler au support",
525
526
  "starting-chat": "Connexion...",
526
527
  "hello-greeting": "Bonjour ! Comment pouvons-nous vous aider aujourd'hui ?"
527
- }, qn = {
528
+ }, Bn = {
528
529
  ok: "OK",
529
530
  yes: "Ja",
530
531
  no: "Nee",
@@ -633,8 +634,8 @@ const Gn = {
633
634
  }, Qn = {
634
635
  en: Yn,
635
636
  ar: Gn,
636
- nl: qn,
637
- fr: Bn,
637
+ nl: Bn,
638
+ fr: qn,
638
639
  de: zn,
639
640
  pt: Xn
640
641
  };
@@ -642,10 +643,10 @@ function Wn(e, t) {
642
643
  const n = Qn[t];
643
644
  return n && n[e] || "";
644
645
  }
645
- const [vs, Kn] = De();
646
+ const [Es, Kn] = De();
646
647
  function bt({ children: e }) {
647
- const t = ue();
648
- return /* @__PURE__ */ ee(
648
+ const t = ce();
649
+ return /* @__PURE__ */ $(
649
650
  Kn,
650
651
  {
651
652
  value: {
@@ -697,7 +698,7 @@ const Zn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABlCAYAAAC7vkbxAA
697
698
  triggerOffset: "20px"
698
699
  };
699
700
  function er(e) {
700
- return te(() => {
701
+ return ee(() => {
701
702
  var s, o, a, d;
702
703
  const t = {
703
704
  messageArrived: "https://cloud.opencopilot.so/sfx/notification3.mp3",
@@ -729,12 +730,12 @@ function er(e) {
729
730
  };
730
731
  }, [e]);
731
732
  }
732
- const [ue, tr] = De(), nr = "en";
733
+ const [ce, tr] = De(), nr = "en";
733
734
  function rr({
734
735
  children: e,
735
736
  data: t
736
737
  }) {
737
- const n = te(
738
+ const n = ee(
738
739
  () => new Jn({
739
740
  components: t.components
740
741
  }),
@@ -747,7 +748,7 @@ function rr({
747
748
  r.defaultSettings,
748
749
  "local"
749
750
  );
750
- return /* @__PURE__ */ ee(
751
+ return /* @__PURE__ */ $(
751
752
  tr,
752
753
  {
753
754
  value: { ...r, http: s, componentStore: n, widgetSettings: o, setSettings: (g) => {
@@ -759,12 +760,12 @@ function rr({
759
760
  );
760
761
  a(u);
761
762
  } },
762
- children: /* @__PURE__ */ ee(bt, { children: e })
763
+ children: /* @__PURE__ */ $(bt, { children: e })
763
764
  }
764
765
  );
765
766
  }
766
- var Es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
767
- function bs(e) {
767
+ var bs = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
768
+ function ws(e) {
768
769
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
769
770
  }
770
771
  function sr(e) {
@@ -1009,8 +1010,8 @@ function Ft(e, t, n) {
1009
1010
  (o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
1010
1011
  return e.concat(o || Array.prototype.slice.call(t));
1011
1012
  }
1012
- function he(e) {
1013
- return this instanceof he ? (this.v = e, this) : new he(e);
1013
+ function me(e) {
1014
+ return this instanceof me ? (this.v = e, this) : new me(e);
1014
1015
  }
1015
1016
  function Mt(e, t, n) {
1016
1017
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
@@ -1038,7 +1039,7 @@ function Mt(e, t, n) {
1038
1039
  }
1039
1040
  }
1040
1041
  function u(p) {
1041
- p.value instanceof he ? Promise.resolve(p.value.v).then(c, i) : m(o[0][2], p);
1042
+ p.value instanceof me ? Promise.resolve(p.value.v).then(c, i) : m(o[0][2], p);
1042
1043
  }
1043
1044
  function c(p) {
1044
1045
  g("next", p);
@@ -1059,7 +1060,7 @@ function Vt(e) {
1059
1060
  }, t;
1060
1061
  function r(s, o) {
1061
1062
  t[s] = e[s] ? function(a) {
1062
- return (n = !n) ? { value: he(e[s](a)), done: !1 } : o ? o(a) : a;
1063
+ return (n = !n) ? { value: me(e[s](a)), done: !1 } : o ? o(a) : a;
1063
1064
  } : o;
1064
1065
  }
1065
1066
  }
@@ -1104,13 +1105,13 @@ function Yt(e, t, n, r) {
1104
1105
  if (typeof t == "function" ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1105
1106
  return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
1106
1107
  }
1107
- function Bt(e, t, n, r, s) {
1108
+ function qt(e, t, n, r, s) {
1108
1109
  if (r === "m") throw new TypeError("Private method is not writable");
1109
1110
  if (r === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
1110
1111
  if (typeof t == "function" ? e !== t || !s : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1111
1112
  return r === "a" ? s.call(e, n) : s ? s.value = n : t.set(e, n), n;
1112
1113
  }
1113
- function qt(e, t) {
1114
+ function Bt(e, t) {
1114
1115
  if (t === null || typeof t != "object" && typeof t != "function") throw new TypeError("Cannot use 'in' operator on non-object");
1115
1116
  return typeof e == "function" ? t === e : e.has(t);
1116
1117
  }
@@ -1189,7 +1190,7 @@ const ir = {
1189
1190
  __spread: Lt,
1190
1191
  __spreadArrays: kt,
1191
1192
  __spreadArray: Ft,
1192
- __await: he,
1193
+ __await: me,
1193
1194
  __asyncGenerator: Mt,
1194
1195
  __asyncDelegator: Vt,
1195
1196
  __asyncValues: Ut,
@@ -1197,8 +1198,8 @@ const ir = {
1197
1198
  __importStar: Gt,
1198
1199
  __importDefault: zt,
1199
1200
  __classPrivateFieldGet: Yt,
1200
- __classPrivateFieldSet: Bt,
1201
- __classPrivateFieldIn: qt,
1201
+ __classPrivateFieldSet: qt,
1202
+ __classPrivateFieldIn: Bt,
1202
1203
  __addDisposableResource: Xt,
1203
1204
  __disposeResources: Qt,
1204
1205
  __rewriteRelativeImportExtension: Wt
@@ -1211,11 +1212,11 @@ const ir = {
1211
1212
  __asyncDelegator: Vt,
1212
1213
  __asyncGenerator: Mt,
1213
1214
  __asyncValues: Ut,
1214
- __await: he,
1215
+ __await: me,
1215
1216
  __awaiter: Pt,
1216
1217
  __classPrivateFieldGet: Yt,
1217
- __classPrivateFieldIn: qt,
1218
- __classPrivateFieldSet: Bt,
1218
+ __classPrivateFieldIn: Bt,
1219
+ __classPrivateFieldSet: qt,
1219
1220
  __createBinding: Ne,
1220
1221
  __decorate: _t,
1221
1222
  __disposeResources: Qt,
@@ -1244,7 +1245,7 @@ var Oe = {}, ct;
1244
1245
  function lr() {
1245
1246
  if (ct) return Oe;
1246
1247
  ct = 1, Object.defineProperty(Oe, "__esModule", { value: !0 });
1247
- var e = fe;
1248
+ var e = de;
1248
1249
  function t() {
1249
1250
  var n = e.useRef(!1), r = e.useCallback(function() {
1250
1251
  return n.current;
@@ -1258,7 +1259,7 @@ function lr() {
1258
1259
  return Oe.default = t, Oe;
1259
1260
  }
1260
1261
  Object.defineProperty(wt, "__esModule", { value: !0 });
1261
- var ze = ur, je = fe, dr = ze.__importDefault(lr());
1262
+ var ze = ur, je = de, dr = ze.__importDefault(lr());
1262
1263
  function fr(e, t, n) {
1263
1264
  t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
1264
1265
  var r = je.useRef(0), s = dr.default(), o = je.useState(n), a = o[0], d = o[1], g = je.useCallback(function() {
@@ -1275,14 +1276,20 @@ function fr(e, t, n) {
1275
1276
  }, t);
1276
1277
  return [a, g];
1277
1278
  }
1278
- var ae = wt.default = fr;
1279
- const se = /* @__PURE__ */ new Map();
1280
- function ws() {
1281
- const [e, t] = Ke([]), { http: n } = ue();
1279
+ var oe = wt.default = fr;
1280
+ const pr = (e = 20) => {
1281
+ const t = "abcdefghijklmnopqrstuvwxyz0123456789";
1282
+ let n = "";
1283
+ for (let r = 0; r < e; r++)
1284
+ n += t[Math.floor(Math.random() * t.length)];
1285
+ return n;
1286
+ }, re = /* @__PURE__ */ new Map();
1287
+ function Os() {
1288
+ const [e, t] = Ke([]), { http: n } = ce();
1282
1289
  function r(c) {
1283
1290
  const i = c.map((m) => ({
1284
1291
  file: m,
1285
- id: $(10),
1292
+ id: pr(10),
1286
1293
  status: "pending",
1287
1294
  progress: 0
1288
1295
  }));
@@ -1298,7 +1305,7 @@ function ws() {
1298
1305
  }
1299
1306
  const a = async (c) => {
1300
1307
  const i = new AbortController();
1301
- se.set(c.id, i);
1308
+ re.set(c.id, i);
1302
1309
  try {
1303
1310
  t(
1304
1311
  (p) => p.map(
@@ -1327,17 +1334,17 @@ function ws() {
1327
1334
  progress: 0
1328
1335
  });
1329
1336
  } finally {
1330
- se.delete(c.id);
1337
+ re.delete(c.id);
1331
1338
  }
1332
1339
  }, d = (c) => {
1333
- const i = se.get(c);
1334
- i && (i.abort(), se.delete(c)), o(c);
1335
- }, g = te(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
1340
+ const i = re.get(c);
1341
+ i && (i.abort(), re.delete(c)), o(c);
1342
+ }, g = ee(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
1336
1343
  function u() {
1337
- se.forEach((c) => c.abort()), se.clear(), t([]);
1344
+ re.forEach((c) => c.abort()), re.clear(), t([]);
1338
1345
  }
1339
- return de(() => () => {
1340
- se.forEach((c) => c.abort()), se.clear();
1346
+ return le(() => () => {
1347
+ re.forEach((c) => c.abort()), re.clear();
1341
1348
  }, []), {
1342
1349
  allFiles: e,
1343
1350
  appendFiles: r,
@@ -1358,7 +1365,7 @@ function ws() {
1358
1365
  };
1359
1366
  }
1360
1367
  var Ce = /* @__PURE__ */ ((e) => (e[e.OPEN = 0] = "OPEN", e[e.CLOSED_RESOLVED = 1] = "CLOSED_RESOLVED", e[e.CLOSED_UNRESOLVED = 2] = "CLOSED_UNRESOLVED", e))(Ce || {}), Kt = /* @__PURE__ */ ((e) => (e.WEB = "web", e.WEB_VOICE = "web_voice", e.PHONE_VOICE = "phone_voice", e.EMAIL = "email", e.SMS = "sms", e.WHATSAPP = "whatsapp", e.API = "api", e))(Kt || {}), $e = /* @__PURE__ */ ((e) => (e.resolved = "resolved", e.assumed_resolved = "assumed_resolved", e.handed_off = "handed_off", e))($e || {}), Jt = /* @__PURE__ */ ((e) => (e.happy = "happy", e.neutral = "neutral", e.angry = "angry", e))(Jt || {}), Zt = /* @__PURE__ */ ((e) => (e.MESSAGE = "message", e.HANDOFF = "handoff", e.HANDOFF_TO_ZENDESK = "handoff_to_zendesk", e.AGENT_MESSAGE = "agent_message", e.AGENT_JOINED = "agent_joined", e.AGENT_TOOK_SESSION_FROM_AI = "agent_took_session_from_ai", e.AI_DECIDED_TO_RESOLVE_THE_ISSUE = "ai_decided_to_resolve_the_issue", e.EMAIL_DRAFT_MESSAGE = "email_draft_message", e.FOLLOWUP = "followup", e))(Zt || {});
1361
- const pr = l.object({
1368
+ const gr = l.object({
1362
1369
  id: l.string(),
1363
1370
  ai_closure_type: l.nativeEnum($e).nullable(),
1364
1371
  assignee_id: l.number().nullable(),
@@ -1387,25 +1394,25 @@ l.object({
1387
1394
  handoff_happened_during_office_hours: l.boolean().nullable(),
1388
1395
  session_id: l.string(),
1389
1396
  updated_at: l.string().nullable(),
1390
- attachments: l.array(ht).optional()
1397
+ attachments: l.array(St).optional()
1391
1398
  });
1392
- const gr = l.object({
1399
+ const mr = l.object({
1393
1400
  name: l.string(),
1394
1401
  is_ai: l.boolean(),
1395
1402
  profile_picture: l.string().optional().nullable(),
1396
1403
  id: l.string().nullable()
1397
- }), mr = l.object({
1404
+ }), hr = l.object({
1398
1405
  type: l.literal("message"),
1399
1406
  value: l.string(),
1400
- attachments: l.array(ht).optional(),
1407
+ attachments: l.array(St).optional(),
1401
1408
  is_stream_chunk: l.boolean().optional(),
1402
1409
  server_session_id: l.string(),
1403
1410
  client_message_id: l.string().optional(),
1404
1411
  server_message_id: l.string()
1405
- }), hr = l.object({
1412
+ }), yr = l.object({
1406
1413
  type: l.literal("info"),
1407
1414
  value: l.string()
1408
- }), yr = l.object({
1415
+ }), Sr = l.object({
1409
1416
  type: l.literal("ui"),
1410
1417
  value: l.object({
1411
1418
  type: l.string(),
@@ -1416,36 +1423,36 @@ const gr = l.object({
1416
1423
  }),
1417
1424
  client_message_id: l.string().optional(),
1418
1425
  server_session_id: l.string()
1419
- }), Sr = l.object({
1426
+ }), vr = l.object({
1420
1427
  type: l.literal("chat_event"),
1421
1428
  value: l.object({
1422
1429
  event: l.nativeEnum(Zt),
1423
1430
  message: l.string()
1424
1431
  })
1425
- }), vr = l.object({
1432
+ }), Er = l.object({
1426
1433
  type: l.literal("options"),
1427
1434
  value: l.object({
1428
1435
  options: l.array(l.string())
1429
1436
  }),
1430
1437
  server_session_id: l.string()
1431
- }), Er = l.object({
1438
+ }), br = l.object({
1432
1439
  type: l.literal("session_update"),
1433
1440
  value: l.object({
1434
- session: pr
1441
+ session: gr
1435
1442
  }),
1436
1443
  server_session_id: l.string()
1437
1444
  });
1438
1445
  l.discriminatedUnion("type", [
1439
- mr,
1440
1446
  hr,
1441
1447
  yr,
1442
1448
  Sr,
1443
1449
  vr,
1444
- Er
1450
+ Er,
1451
+ br
1445
1452
  ]).and(
1446
1453
  l.object({
1447
1454
  timestamp: l.string(),
1448
- agent: gr
1455
+ agent: mr
1449
1456
  })
1450
1457
  );
1451
1458
  l.object({
@@ -1464,7 +1471,7 @@ function ut(e) {
1464
1471
  a.message && a.message.length > 0 && t.push({
1465
1472
  type: "FROM_USER",
1466
1473
  content: a.message,
1467
- id: a.publicId || $(),
1474
+ id: a.publicId,
1468
1475
  deliveredAt: a.created_at || "",
1469
1476
  attachments: a.attachments,
1470
1477
  timestamp: a.created_at || ""
@@ -1478,7 +1485,7 @@ function ut(e) {
1478
1485
  data: {
1479
1486
  message: a.message ?? ""
1480
1487
  },
1481
- id: a.publicId || $(),
1488
+ id: a.publicId,
1482
1489
  timestamp: a.created_at || "",
1483
1490
  original: a,
1484
1491
  attachments: a.attachments,
@@ -1497,7 +1504,7 @@ function ut(e) {
1497
1504
  data: {
1498
1505
  message: a.message ?? ""
1499
1506
  },
1500
- id: a.publicId || $(),
1507
+ id: a.publicId,
1501
1508
  timestamp: a.created_at || "",
1502
1509
  original: a,
1503
1510
  attachments: a.attachments,
@@ -1517,7 +1524,7 @@ function ut(e) {
1517
1524
  event: a.type,
1518
1525
  message: a.message ?? ""
1519
1526
  },
1520
- id: a.publicId || $(),
1527
+ id: a.publicId || ve(),
1521
1528
  original: a,
1522
1529
  attachments: a.attachments,
1523
1530
  timestamp: a.created_at || "",
@@ -1532,9 +1539,9 @@ function ut(e) {
1532
1539
  }
1533
1540
  return t;
1534
1541
  }
1535
- function br(e) {
1536
- const t = oe(null);
1537
- return de(() => {
1542
+ function wr(e) {
1543
+ const t = se(null);
1544
+ return le(() => {
1538
1545
  if (!t.current) {
1539
1546
  const n = new Audio(e.src);
1540
1547
  n.volume = e.volume, n.loop = !1, n.preload = "auto", t.current = n;
@@ -1554,18 +1561,18 @@ function br(e) {
1554
1561
  }
1555
1562
  };
1556
1563
  }
1557
- function wr() {
1558
- const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } = ue(), r = (t == null ? void 0 : t.useSoundEffects) ?? n.useSoundEffects;
1564
+ function Or() {
1565
+ const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } = ce(), r = (t == null ? void 0 : t.useSoundEffects) ?? n.useSoundEffects;
1559
1566
  return {
1560
- messageArrivedSound: br({
1567
+ messageArrivedSound: wr({
1561
1568
  src: e.messageArrived,
1562
1569
  soundEnabled: r,
1563
1570
  volume: 0.5
1564
1571
  })
1565
1572
  };
1566
1573
  }
1567
- const Or = 5e3;
1568
- function Ar(e, t) {
1574
+ const Ar = 5e3;
1575
+ function _r(e, t) {
1569
1576
  return mn(e, (n) => {
1570
1577
  const r = () => {
1571
1578
  n.lastUpdated = Date.now();
@@ -1615,11 +1622,11 @@ function Ar(e, t) {
1615
1622
  }
1616
1623
  });
1617
1624
  }
1618
- function _r({
1625
+ function Rr({
1619
1626
  persist: e,
1620
1627
  sessionKey: t = (n, { external_id: r }) => `[OPEN_SESSION_${n}]_${r || "session"}`
1621
1628
  }) {
1622
- const { botToken: n, http: r, user: s } = ue(), [o, a, d] = Je(
1629
+ const { botToken: n, http: r, user: s } = ce(), [o, a, d] = Je(
1623
1630
  t(n, s),
1624
1631
  void 0,
1625
1632
  e ? "local" : "memory"
@@ -1629,13 +1636,13 @@ function _r({
1629
1636
  isAssignedToAi: f.assignee_id === 555,
1630
1637
  isAssignedToHuman: f.assignee_id !== 555,
1631
1638
  isPendingHuman: f.assignee_id === 555 && f.ai_closure_type === $e.handed_off
1632
- }), u = te(() => o ? g(o) : null, [o]), [c, i] = ae(
1639
+ }), u = ee(() => o ? g(o) : null, [o]), [c, i] = oe(
1633
1640
  async (f) => {
1634
1641
  let v = await r.apis.fetchSession(f);
1635
1642
  return v.data && a(v.data), v.data;
1636
1643
  },
1637
1644
  [r, a]
1638
- ), [m, p] = ae(
1645
+ ), [m, p] = oe(
1639
1646
  async (f) => {
1640
1647
  try {
1641
1648
  const v = await i(f);
@@ -1659,14 +1666,14 @@ function _r({
1659
1666
  pollSession: p
1660
1667
  };
1661
1668
  }
1662
- function Rr({ onSessionDestroy: e }) {
1663
- const [t, n] = fn(Ar, {
1669
+ function Tr({ onSessionDestroy: e }) {
1670
+ const [t, n] = fn(_r, {
1664
1671
  lastUpdated: null,
1665
1672
  messages: [],
1666
1673
  keyboard: null
1667
- }), [r, s] = Ke({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: d, widgetSettings: g, defaultSettings: u, language: c, ...i } = ue(), { messageArrivedSound: m } = wr(), p = (g == null ? void 0 : g.persistSession) || u.persistSession, { refreshSession: y, session: f, deleteSession: v, setSession: h, pollSession: B } = _r({
1674
+ }), [r, s] = Ke({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: d, widgetSettings: g, defaultSettings: u, language: c, ...i } = ce(), { messageArrivedSound: m } = Or(), p = (g == null ? void 0 : g.persistSession) || u.persistSession, { refreshSession: y, session: f, deleteSession: v, setSession: h, pollSession: q } = Rr({
1668
1675
  persist: p
1669
- }), [D, S] = ae(
1676
+ }), [D, S] = oe(
1670
1677
  async (_) => {
1671
1678
  if (!f) return [];
1672
1679
  try {
@@ -1677,7 +1684,7 @@ function Rr({ onSessionDestroy: e }) {
1677
1684
  }
1678
1685
  },
1679
1686
  [f, d.apis]
1680
- ), [O, E] = ae(
1687
+ ), [O, E] = oe(
1681
1688
  async (_, N) => {
1682
1689
  try {
1683
1690
  const M = await d.apis.getHistoryPooling({
@@ -1693,8 +1700,8 @@ function Rr({ onSessionDestroy: e }) {
1693
1700
  });
1694
1701
  try {
1695
1702
  m.play();
1696
- } catch (le) {
1697
- console.error("Error playing sound:", le);
1703
+ } catch (ue) {
1704
+ console.error("Error playing sound:", ue);
1698
1705
  }
1699
1706
  }
1700
1707
  return H;
@@ -1706,18 +1713,18 @@ function Rr({ onSessionDestroy: e }) {
1706
1713
  },
1707
1714
  [d.apis, n, m]
1708
1715
  );
1709
- de(() => {
1716
+ le(() => {
1710
1717
  let _;
1711
1718
  return f && (_ = setInterval(() => {
1712
1719
  var M;
1713
- B(f.id);
1720
+ q(f.id);
1714
1721
  const N = (M = t.messages.at(-1)) == null ? void 0 : M.timestamp;
1715
1722
  N && E(f.id, N);
1716
- }, Or)), () => {
1723
+ }, Ar)), () => {
1717
1724
  clearInterval(_);
1718
1725
  };
1719
- }, [f, B, E]);
1720
- const [F, A] = ae(
1726
+ }, [f, q, E]);
1727
+ const [F, A] = oe(
1721
1728
  async () => {
1722
1729
  if (f)
1723
1730
  try {
@@ -1732,10 +1739,10 @@ function Rr({ onSessionDestroy: e }) {
1732
1739
  },
1733
1740
  [f, y, S, n]
1734
1741
  );
1735
- de(() => {
1742
+ le(() => {
1736
1743
  A();
1737
1744
  }, []);
1738
- const [x, P] = ae(
1745
+ const [x, P] = oe(
1739
1746
  async () => {
1740
1747
  try {
1741
1748
  v(), n({ type: "RESET" }), e == null || e(), s({ state: "idle" });
@@ -1744,7 +1751,7 @@ function Rr({ onSessionDestroy: e }) {
1744
1751
  }
1745
1752
  },
1746
1753
  [v, n, e, s]
1747
- ), [q, W] = ae(
1754
+ ), [B, W] = oe(
1748
1755
  async () => {
1749
1756
  try {
1750
1757
  await P();
@@ -1756,7 +1763,7 @@ function Rr({ onSessionDestroy: e }) {
1756
1763
  },
1757
1764
  [P, d.apis, a, h]
1758
1765
  ), L = async ({ content: _, user: N, attachments: M, ...H }) => {
1759
- var le;
1766
+ var ue;
1760
1767
  try {
1761
1768
  let U = f, G = !1;
1762
1769
  if ((!f || f != null && f.isAssignedToAi) && s({ state: "loading" }), !f && o)
@@ -1782,7 +1789,7 @@ function Rr({ onSessionDestroy: e }) {
1782
1789
  const w = new Error("No active session available");
1783
1790
  throw s({ state: "error", error: w.message }), w;
1784
1791
  }
1785
- const Y = $(), { headers: pe, queryParams: we } = i;
1792
+ const Y = ve(), { headers: fe, queryParams: we } = i;
1786
1793
  if (n({
1787
1794
  type: "APPEND_USER_MESSAGE",
1788
1795
  payload: {
@@ -1802,17 +1809,17 @@ function Rr({ onSessionDestroy: e }) {
1802
1809
  payload: null
1803
1810
  }), !G && U.isAssignedToAi)
1804
1811
  try {
1805
- const w = await B(U.id);
1812
+ const w = await q(U.id);
1806
1813
  w && (U = w);
1807
1814
  } catch (w) {
1808
1815
  console.error("Error polling session:", w);
1809
1816
  }
1810
- const re = await d.apis.sendMessage({
1817
+ const ne = await d.apis.sendMessage({
1811
1818
  id: Y,
1812
1819
  content: _.text,
1813
1820
  session_id: U.id,
1814
1821
  bot_token: a,
1815
- headers: pe,
1822
+ headers: fe,
1816
1823
  query_params: we,
1817
1824
  user: {
1818
1825
  ...i.user,
@@ -1828,13 +1835,13 @@ function Rr({ onSessionDestroy: e }) {
1828
1835
  clientMessageId: Y,
1829
1836
  deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
1830
1837
  }
1831
- }), re.data.success) {
1832
- const w = re.data;
1838
+ }), ne.data.success) {
1839
+ const w = ne.data;
1833
1840
  if (w.autopilotResponse && n({
1834
1841
  type: "ADD_RESPONSE_MESSAGE",
1835
1842
  payload: {
1836
1843
  type: "FROM_BOT",
1837
- id: w.autopilotResponse.id || $(),
1844
+ id: w.autopilotResponse.id || ve(),
1838
1845
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1839
1846
  component: "TEXT",
1840
1847
  data: {
@@ -1842,25 +1849,25 @@ function Rr({ onSessionDestroy: e }) {
1842
1849
  }
1843
1850
  }
1844
1851
  }), w.uiResponse) {
1845
- const ye = w.uiResponse.value;
1852
+ const he = w.uiResponse.value;
1846
1853
  n({
1847
1854
  type: "ADD_RESPONSE_MESSAGE",
1848
1855
  payload: {
1849
1856
  type: "FROM_BOT",
1850
- id: $(),
1857
+ id: ve(),
1851
1858
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1852
- component: ye.name,
1853
- data: ye.request_response
1859
+ component: he.name,
1860
+ data: he.request_response
1854
1861
  }
1855
1862
  });
1856
1863
  }
1857
1864
  } else {
1858
- const w = ((le = re.data.error) == null ? void 0 : le.message) || "Unknown error occurred";
1865
+ const w = ((ue = ne.data.error) == null ? void 0 : ue.message) || "Unknown error occurred";
1859
1866
  n({
1860
1867
  type: "ADD_RESPONSE_MESSAGE",
1861
1868
  payload: {
1862
1869
  type: "FROM_BOT",
1863
- id: $(),
1870
+ id: ve(),
1864
1871
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1865
1872
  component: "TEXT",
1866
1873
  data: {
@@ -1875,7 +1882,7 @@ function Rr({ onSessionDestroy: e }) {
1875
1882
  const G = U instanceof Error ? U.message : "An unexpected error occurred";
1876
1883
  throw console.error("Error in sendMessage:", G, U), (!f || f != null && f.isAssignedToAi) && s({ state: "error", error: G }), U;
1877
1884
  }
1878
- }, ne = me(
1885
+ }, te = ge(
1879
1886
  (_) => {
1880
1887
  L({
1881
1888
  content: {
@@ -1897,32 +1904,32 @@ function Rr({ onSessionDestroy: e }) {
1897
1904
  noMessages: o,
1898
1905
  initState: F,
1899
1906
  clearSessionState: x,
1900
- recreateSessionState: q,
1907
+ recreateSessionState: B,
1901
1908
  hookState: r,
1902
1909
  recreateSession: W,
1903
1910
  clearSession: P,
1904
1911
  sendMessage: L,
1905
- handleKeyboard: ne
1912
+ handleKeyboard: te
1906
1913
  };
1907
1914
  }
1908
- const [Os, Tr] = De();
1909
- function Dr({
1915
+ const [As, Dr] = De();
1916
+ function Nr({
1910
1917
  children: e
1911
1918
  }) {
1912
- const { settings: t } = ue(), n = Rr({
1919
+ const { settings: t } = ce(), n = Tr({
1913
1920
  defaultHookSettings: {
1914
1921
  persistSession: (t == null ? void 0 : t.persistSession) ?? !0,
1915
1922
  useSoundEffects: (t == null ? void 0 : t.useSoundEffects) ?? !1
1916
1923
  }
1917
1924
  });
1918
- return /* @__PURE__ */ ee(Tr, { value: n, children: e });
1925
+ return /* @__PURE__ */ $(Dr, { value: n, children: e });
1919
1926
  }
1920
- function Nr() {
1921
- const { http: e, botToken: t, user: n, collectUserData: r } = ue(), [s, o] = Je(
1927
+ function Cr() {
1928
+ const { http: e, botToken: t, user: n, collectUserData: r } = ce(), [s, o] = Je(
1922
1929
  `${t}:contact:${n.external_id}`,
1923
1930
  null,
1924
1931
  "local"
1925
- ), [a, d] = ae(
1932
+ ), [a, d] = oe(
1926
1933
  async (u) => {
1927
1934
  var c;
1928
1935
  try {
@@ -1936,10 +1943,10 @@ function Nr() {
1936
1943
  },
1937
1944
  [e.apis]
1938
1945
  );
1939
- de(() => {
1946
+ le(() => {
1940
1947
  n && t && d(n);
1941
1948
  }, [n, t]);
1942
- const g = te(() => !(s != null && s.id) && r ? {
1949
+ const g = ee(() => !(s != null && s.id) && r ? {
1943
1950
  should: !0,
1944
1951
  reason: "No contact id and collectUserData is true"
1945
1952
  } : {
@@ -1952,16 +1959,16 @@ function Nr() {
1952
1959
  shouldCollectData: g
1953
1960
  };
1954
1961
  }
1955
- const [As, Cr] = De();
1956
- function xr({ children: e }) {
1957
- const t = Nr();
1958
- return /* @__PURE__ */ ee(Cr, { value: t, children: e });
1962
+ const [_s, xr] = De();
1963
+ function Pr({ children: e }) {
1964
+ const t = Cr();
1965
+ return /* @__PURE__ */ $(xr, { value: t, children: e });
1959
1966
  }
1960
- function _s({
1967
+ function Rs({
1961
1968
  children: e,
1962
1969
  options: t
1963
1970
  }) {
1964
- return /* @__PURE__ */ ee(rr, { data: t, children: /* @__PURE__ */ ee(xr, { children: /* @__PURE__ */ ee(bt, { children: /* @__PURE__ */ ee(Dr, { children: e }) }) }) });
1971
+ return /* @__PURE__ */ $(rr, { data: t, children: /* @__PURE__ */ $(Pr, { children: /* @__PURE__ */ $(bt, { children: /* @__PURE__ */ $(Nr, { children: e }) }) }) });
1965
1972
  }
1966
1973
  var Ye = { exports: {} }, Le = {};
1967
1974
  /**
@@ -1974,10 +1981,10 @@ var Ye = { exports: {} }, Le = {};
1974
1981
  * LICENSE file in the root directory of this source tree.
1975
1982
  */
1976
1983
  var lt;
1977
- function Pr() {
1984
+ function Ir() {
1978
1985
  if (lt) return Le;
1979
1986
  lt = 1;
1980
- var e = fe;
1987
+ var e = de;
1981
1988
  function t(i, m) {
1982
1989
  return i === m && (i !== 0 || 1 / i === 1 / m) || i !== i && m !== m;
1983
1990
  }
@@ -2019,10 +2026,10 @@ var ke = {};
2019
2026
  * LICENSE file in the root directory of this source tree.
2020
2027
  */
2021
2028
  var dt;
2022
- function Ir() {
2029
+ function jr() {
2023
2030
  return dt || (dt = 1, process.env.NODE_ENV !== "production" && function() {
2024
2031
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2025
- var e = fe, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2032
+ var e = de, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2026
2033
  function n(D) {
2027
2034
  {
2028
2035
  for (var S = arguments.length, O = new Array(S > 1 ? S - 1 : 0), E = 1; E < S; E++)
@@ -2065,12 +2072,12 @@ function Ir() {
2065
2072
  p(x) && P({
2066
2073
  inst: x
2067
2074
  });
2068
- var q = function() {
2075
+ var B = function() {
2069
2076
  p(x) && P({
2070
2077
  inst: x
2071
2078
  });
2072
2079
  };
2073
- return D(q);
2080
+ return D(B);
2074
2081
  }, [D]), u(E), E;
2075
2082
  }
2076
2083
  function p(D) {
@@ -2085,27 +2092,27 @@ function Ir() {
2085
2092
  function y(D, S, O) {
2086
2093
  return S();
2087
2094
  }
2088
- var f = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !f, h = v ? y : m, B = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h;
2089
- ke.useSyncExternalStore = B, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2095
+ var f = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !f, h = v ? y : m, q = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h;
2096
+ ke.useSyncExternalStore = q, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2090
2097
  }()), ke;
2091
2098
  }
2092
- process.env.NODE_ENV === "production" ? Ye.exports = Pr() : Ye.exports = Ir();
2093
- var jr = Ye.exports;
2094
- const ie = () => {
2099
+ process.env.NODE_ENV === "production" ? Ye.exports = Ir() : Ye.exports = jr();
2100
+ var Lr = Ye.exports;
2101
+ const ae = () => {
2095
2102
  }, V = (
2096
2103
  /*#__NOINLINE__*/
2097
- ie()
2098
- ), Fe = Object, b = (e) => e === V, Q = (e) => typeof e == "function", ce = (e, t) => ({
2104
+ ae()
2105
+ ), Fe = Object, b = (e) => e === V, Q = (e) => typeof e == "function", ie = (e, t) => ({
2099
2106
  ...e,
2100
2107
  ...t
2101
- }), Lr = (e) => Q(e.then), Ae = /* @__PURE__ */ new WeakMap();
2102
- let kr = 0;
2108
+ }), kr = (e) => Q(e.then), Ae = /* @__PURE__ */ new WeakMap();
2109
+ let Fr = 0;
2103
2110
  const Ee = (e) => {
2104
2111
  const t = typeof e, n = e && e.constructor, r = n == Date;
2105
2112
  let s, o;
2106
2113
  if (Fe(e) === e && !r && n != RegExp) {
2107
2114
  if (s = Ae.get(e), s) return s;
2108
- if (s = ++kr + "~", Ae.set(e, s), n == Array) {
2115
+ if (s = ++Fr + "~", Ae.set(e, s), n == Array) {
2109
2116
  for (s = "@", o = 0; o < e.length; o++)
2110
2117
  s += Ee(e[o]) + ",";
2111
2118
  Ae.set(e, s);
@@ -2120,7 +2127,7 @@ const Ee = (e) => {
2120
2127
  } else
2121
2128
  s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
2122
2129
  return s;
2123
- }, Z = /* @__PURE__ */ new WeakMap(), Me = {}, _e = {}, et = "undefined", xe = typeof window != et, Be = typeof document != et, Fr = () => xe && typeof window.requestAnimationFrame != et, $t = (e, t) => {
2130
+ }, Z = /* @__PURE__ */ new WeakMap(), Me = {}, _e = {}, et = "undefined", xe = typeof window != et, qe = typeof document != et, Mr = () => xe && typeof window.requestAnimationFrame != et, $t = (e, t) => {
2124
2131
  const n = Z.get(e);
2125
2132
  return [
2126
2133
  // Getter
@@ -2129,7 +2136,7 @@ const Ee = (e) => {
2129
2136
  (r) => {
2130
2137
  if (!b(t)) {
2131
2138
  const s = e.get(t);
2132
- t in _e || (_e[t] = s), n[5](t, ce(s, r), s || Me);
2139
+ t in _e || (_e[t] = s), n[5](t, ie(s, r), s || Me);
2133
2140
  }
2134
2141
  },
2135
2142
  // Subscriber
@@ -2138,34 +2145,34 @@ const Ee = (e) => {
2138
2145
  () => !b(t) && t in _e ? _e[t] : !b(t) && e.get(t) || Me
2139
2146
  ];
2140
2147
  };
2141
- let qe = !0;
2142
- const Mr = () => qe, [Xe, Qe] = xe && window.addEventListener ? [
2148
+ let Be = !0;
2149
+ const Vr = () => Be, [Xe, Qe] = xe && window.addEventListener ? [
2143
2150
  window.addEventListener.bind(window),
2144
2151
  window.removeEventListener.bind(window)
2145
2152
  ] : [
2146
- ie,
2147
- ie
2148
- ], Vr = () => {
2149
- const e = Be && document.visibilityState;
2153
+ ae,
2154
+ ae
2155
+ ], Ur = () => {
2156
+ const e = qe && document.visibilityState;
2150
2157
  return b(e) || e !== "hidden";
2151
- }, Ur = (e) => (Be && document.addEventListener("visibilitychange", e), Xe("focus", e), () => {
2152
- Be && document.removeEventListener("visibilitychange", e), Qe("focus", e);
2153
- }), Hr = (e) => {
2158
+ }, Hr = (e) => (qe && document.addEventListener("visibilitychange", e), Xe("focus", e), () => {
2159
+ qe && document.removeEventListener("visibilitychange", e), Qe("focus", e);
2160
+ }), Gr = (e) => {
2154
2161
  const t = () => {
2155
- qe = !0, e();
2162
+ Be = !0, e();
2156
2163
  }, n = () => {
2157
- qe = !1;
2164
+ Be = !1;
2158
2165
  };
2159
2166
  return Xe("online", t), Xe("offline", n), () => {
2160
2167
  Qe("online", t), Qe("offline", n);
2161
2168
  };
2162
- }, Gr = {
2163
- isOnline: Mr,
2164
- isVisible: Vr
2165
2169
  }, zr = {
2166
- initFocus: Ur,
2167
- initReconnect: Hr
2168
- }, ft = !fe.useId, be = !xe || "Deno" in window, Yr = (e) => Fr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ve = be ? de : pn, Ue = typeof navigator < "u" && navigator.connection, pt = !be && Ue && ([
2170
+ isOnline: Vr,
2171
+ isVisible: Ur
2172
+ }, Yr = {
2173
+ initFocus: Hr,
2174
+ initReconnect: Gr
2175
+ }, ft = !de.useId, be = !xe || "Deno" in window, qr = (e) => Mr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ve = be ? le : pn, Ue = typeof navigator < "u" && navigator.connection, pt = !be && Ue && ([
2169
2176
  "slow-2g",
2170
2177
  "2g"
2171
2178
  ].includes(Ue.effectiveType) || Ue.saveData), tt = (e) => {
@@ -2182,16 +2189,16 @@ const Mr = () => qe, [Xe, Qe] = xe && window.addEventListener ? [
2182
2189
  ];
2183
2190
  };
2184
2191
  let Br = 0;
2185
- const We = () => ++Br, en = 0, tn = 1, nn = 2, qr = 3;
2186
- var ve = {
2192
+ const We = () => ++Br, en = 0, tn = 1, nn = 2, Xr = 3;
2193
+ var Se = {
2187
2194
  __proto__: null,
2188
- ERROR_REVALIDATE_EVENT: qr,
2195
+ ERROR_REVALIDATE_EVENT: Xr,
2189
2196
  FOCUS_EVENT: en,
2190
2197
  MUTATE_EVENT: nn,
2191
2198
  RECONNECT_EVENT: tn
2192
2199
  };
2193
2200
  async function rn(...e) {
2194
- const [t, n, r, s] = e, o = ce({
2201
+ const [t, n, r, s] = e, o = ie({
2195
2202
  populateCache: !0,
2196
2203
  throwOnError: !0
2197
2204
  }, typeof s == "boolean" ? {
@@ -2212,9 +2219,9 @@ async function rn(...e) {
2212
2219
  async function i(m) {
2213
2220
  const [p] = tt(m);
2214
2221
  if (!p) return;
2215
- const [y, f] = $t(t, p), [v, h, B, D] = Z.get(t), S = () => {
2222
+ const [y, f] = $t(t, p), [v, h, q, D] = Z.get(t), S = () => {
2216
2223
  const L = v[p];
2217
- return (Q(o.revalidate) ? o.revalidate(y().data, m) : o.revalidate !== !1) && (delete B[p], delete D[p], L && L[0]) ? L[0](nn).then(() => y().data) : y().data;
2224
+ return (Q(o.revalidate) ? o.revalidate(y().data, m) : o.revalidate !== !1) && (delete q[p], delete D[p], L && L[0]) ? L[0](nn).then(() => y().data) : y().data;
2218
2225
  };
2219
2226
  if (e.length < 3)
2220
2227
  return S();
@@ -2224,7 +2231,7 @@ async function rn(...e) {
2224
2231
  F,
2225
2232
  0
2226
2233
  ];
2227
- const A = !b(g), x = y(), P = x.data, q = x._c, W = b(q) ? P : q;
2234
+ const A = !b(g), x = y(), P = x.data, B = x._c, W = b(B) ? P : B;
2228
2235
  if (A && (g = Q(g) ? g(W, P) : g, f({
2229
2236
  data: g,
2230
2237
  _c: W
@@ -2234,7 +2241,7 @@ async function rn(...e) {
2234
2241
  } catch (L) {
2235
2242
  E = L;
2236
2243
  }
2237
- if (O && Lr(O))
2244
+ if (O && kr(O))
2238
2245
  if (O = await O.catch((L) => {
2239
2246
  E = L;
2240
2247
  }), F !== h[p][0]) {
@@ -2272,10 +2279,10 @@ async function rn(...e) {
2272
2279
  const gt = (e, t) => {
2273
2280
  for (const n in e)
2274
2281
  e[n][0] && e[n][0](t);
2275
- }, Xr = (e, t) => {
2282
+ }, Qr = (e, t) => {
2276
2283
  if (!Z.has(e)) {
2277
- const n = ce(zr, t), r = {}, s = rn.bind(V, e);
2278
- let o = ie;
2284
+ const n = ie(Yr, t), r = {}, s = rn.bind(V, e);
2285
+ let o = ae;
2279
2286
  const a = {}, d = (c, i) => {
2280
2287
  const m = a[c] || [];
2281
2288
  return a[c] = m, m.push(i), () => m.splice(m.indexOf(i), 1);
@@ -2312,17 +2319,17 @@ const gt = (e, t) => {
2312
2319
  e,
2313
2320
  Z.get(e)[4]
2314
2321
  ];
2315
- }, Qr = (e, t, n, r, s) => {
2322
+ }, Wr = (e, t, n, r, s) => {
2316
2323
  const o = n.errorRetryCount, a = s.retryCount, d = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
2317
2324
  !b(o) && a > o || setTimeout(r, d, s);
2318
- }, Wr = (e, t) => Ee(e) == Ee(t), [sn, Kr] = Xr(/* @__PURE__ */ new Map()), Jr = ce(
2325
+ }, Kr = (e, t) => Ee(e) == Ee(t), [sn, Jr] = Qr(/* @__PURE__ */ new Map()), Zr = ie(
2319
2326
  {
2320
2327
  // events
2321
- onLoadingSlow: ie,
2322
- onSuccess: ie,
2323
- onError: ie,
2324
- onErrorRetry: Qr,
2325
- onDiscarded: ie,
2328
+ onLoadingSlow: ae,
2329
+ onSuccess: ae,
2330
+ onError: ae,
2331
+ onErrorRetry: Wr,
2332
+ onDiscarded: ae,
2326
2333
  // switches
2327
2334
  revalidateOnFocus: !0,
2328
2335
  revalidateOnReconnect: !0,
@@ -2334,24 +2341,24 @@ const gt = (e, t) => {
2334
2341
  dedupingInterval: 2 * 1e3,
2335
2342
  loadingTimeout: pt ? 5e3 : 3e3,
2336
2343
  // providers
2337
- compare: Wr,
2344
+ compare: Kr,
2338
2345
  isPaused: () => !1,
2339
2346
  cache: sn,
2340
- mutate: Kr,
2347
+ mutate: Jr,
2341
2348
  fallback: {}
2342
2349
  },
2343
2350
  // use web preset by default
2344
- Gr
2345
- ), Zr = (e, t) => {
2346
- const n = ce(e, t);
2351
+ zr
2352
+ ), $r = (e, t) => {
2353
+ const n = ie(e, t);
2347
2354
  if (t) {
2348
2355
  const { use: r, fallback: s } = e, { use: o, fallback: a } = t;
2349
- r && o && (n.use = r.concat(o)), s && a && (n.fallback = ce(s, a));
2356
+ r && o && (n.use = r.concat(o)), s && a && (n.fallback = ie(s, a));
2350
2357
  }
2351
2358
  return n;
2352
- }, $r = yt({}), es = "$inf$", on = xe && window.__SWR_DEVTOOLS_USE__, ts = on ? window.__SWR_DEVTOOLS_USE__ : [], ns = () => {
2353
- on && (window.__SWR_DEVTOOLS_REACT__ = fe);
2354
- }, rs = (e) => Q(e[1]) ? [
2359
+ }, es = ht({}), ts = "$inf$", on = xe && window.__SWR_DEVTOOLS_USE__, ns = on ? window.__SWR_DEVTOOLS_USE__ : [], rs = () => {
2360
+ on && (window.__SWR_DEVTOOLS_REACT__ = de);
2361
+ }, ss = (e) => Q(e[1]) ? [
2355
2362
  e[0],
2356
2363
  e[1],
2357
2364
  e[2] || {}
@@ -2359,28 +2366,28 @@ const gt = (e, t) => {
2359
2366
  e[0],
2360
2367
  null,
2361
2368
  (e[1] === null ? e[2] : e[1]) || {}
2362
- ], ss = () => ce(Jr, St($r)), os = (e) => (t, n, r) => e(t, n && ((...o) => {
2369
+ ], os = () => ie(Zr, yt(es)), as = (e) => (t, n, r) => e(t, n && ((...o) => {
2363
2370
  const [a] = tt(t), [, , , d] = Z.get(sn);
2364
- if (a.startsWith(es))
2371
+ if (a.startsWith(ts))
2365
2372
  return n(...o);
2366
2373
  const g = d[a];
2367
2374
  return b(g) ? n(...o) : (delete d[a], g);
2368
- }), r), as = ts.concat(os), is = (e) => function(...n) {
2369
- const r = ss(), [s, o, a] = rs(n), d = Zr(r, a);
2375
+ }), r), is = ns.concat(as), cs = (e) => function(...n) {
2376
+ const r = os(), [s, o, a] = ss(n), d = $r(r, a);
2370
2377
  let g = e;
2371
- const { use: u } = d, c = (u || []).concat(as);
2378
+ const { use: u } = d, c = (u || []).concat(is);
2372
2379
  for (let i = c.length; i--; )
2373
2380
  g = c[i](g);
2374
2381
  return g(s, o || d.fetcher || null, d);
2375
- }, cs = (e, t, n) => {
2382
+ }, us = (e, t, n) => {
2376
2383
  const r = t[e] || (t[e] = []);
2377
2384
  return r.push(n), () => {
2378
2385
  const s = r.indexOf(n);
2379
2386
  s >= 0 && (r[s] = r[r.length - 1], r.pop());
2380
2387
  };
2381
2388
  };
2382
- ns();
2383
- const mt = fe.use || ((e) => {
2389
+ rs();
2390
+ const mt = de.use || ((e) => {
2384
2391
  if (e.status === "pending")
2385
2392
  throw e;
2386
2393
  if (e.status === "fulfilled")
@@ -2392,38 +2399,38 @@ const mt = fe.use || ((e) => {
2392
2399
  }), e);
2393
2400
  }), He = {
2394
2401
  dedupe: !0
2395
- }, us = (e, t, n) => {
2396
- const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: d, revalidateIfStale: g, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: m } = n, [p, y, f, v] = Z.get(r), [h, B] = tt(e), D = oe(!1), S = oe(!1), O = oe(h), E = oe(t), F = oe(n), A = () => F.current, x = () => A().isVisible() && A().isOnline(), [P, q, W, L] = $t(r, h), ne = oe({}).current, _ = b(a) ? n.fallback[h] : a, N = (R, T) => {
2397
- for (const j in ne) {
2402
+ }, ls = (e, t, n) => {
2403
+ const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: d, revalidateIfStale: g, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: m } = n, [p, y, f, v] = Z.get(r), [h, q] = tt(e), D = se(!1), S = se(!1), O = se(h), E = se(t), F = se(n), A = () => F.current, x = () => A().isVisible() && A().isOnline(), [P, B, W, L] = $t(r, h), te = se({}).current, _ = b(a) ? n.fallback[h] : a, N = (R, T) => {
2404
+ for (const j in te) {
2398
2405
  const C = j;
2399
2406
  if (C === "data") {
2400
- if (!s(R[C], T[C]) && (!b(R[C]) || !s(re, T[C])))
2407
+ if (!s(R[C], T[C]) && (!b(R[C]) || !s(ne, T[C])))
2401
2408
  return !1;
2402
2409
  } else if (T[C] !== R[C])
2403
2410
  return !1;
2404
2411
  }
2405
2412
  return !0;
2406
- }, M = te(() => {
2413
+ }, M = ee(() => {
2407
2414
  const R = !h || !t ? !1 : b(d) ? A().isPaused() || o ? !1 : b(g) ? !0 : g : d, T = (k) => {
2408
- const K = ce(k);
2415
+ const K = ie(k);
2409
2416
  return delete K._k, R ? {
2410
2417
  isValidating: !0,
2411
2418
  isLoading: !0,
2412
2419
  ...K
2413
2420
  } : K;
2414
- }, j = P(), C = L(), X = T(j), ge = j === C ? X : T(C);
2421
+ }, j = P(), C = L(), X = T(j), pe = j === C ? X : T(C);
2415
2422
  let I = X;
2416
2423
  return [
2417
2424
  () => {
2418
2425
  const k = T(P());
2419
2426
  return N(k, I) ? (I.data = k.data, I.isLoading = k.isLoading, I.isValidating = k.isValidating, I.error = k.error, I) : (I = k, k);
2420
2427
  },
2421
- () => ge
2428
+ () => pe
2422
2429
  ];
2423
2430
  }, [
2424
2431
  r,
2425
2432
  h
2426
- ]), H = jr.useSyncExternalStore(me(
2433
+ ]), H = Lr.useSyncExternalStore(ge(
2427
2434
  (R) => W(h, (T, j) => {
2428
2435
  N(j, T) || R();
2429
2436
  }),
@@ -2432,17 +2439,17 @@ const mt = fe.use || ((e) => {
2432
2439
  r,
2433
2440
  h
2434
2441
  ]
2435
- ), M[0], M[1]), le = !D.current, U = p[h] && p[h].length > 0, G = H.data, Y = b(G) ? _ : G, pe = H.error, we = oe(Y), re = m ? b(G) ? we.current : G : Y, w = U && !b(pe) ? !1 : le && !b(d) ? d : A().isPaused() ? !1 : o ? b(Y) ? !1 : g : b(Y) || g, ye = !!(h && t && le && w), an = b(H.isValidating) ? ye : H.isValidating, cn = b(H.isLoading) ? ye : H.isLoading, Se = me(
2442
+ ), M[0], M[1]), ue = !D.current, U = p[h] && p[h].length > 0, G = H.data, Y = b(G) ? _ : G, fe = H.error, we = se(Y), ne = m ? b(G) ? we.current : G : Y, w = U && !b(fe) ? !1 : ue && !b(d) ? d : A().isPaused() ? !1 : o ? b(Y) ? !1 : g : b(Y) || g, he = !!(h && t && ue && w), an = b(H.isValidating) ? he : H.isValidating, cn = b(H.isLoading) ? he : H.isLoading, ye = ge(
2436
2443
  async (R) => {
2437
2444
  const T = E.current;
2438
2445
  if (!h || !T || S.current || A().isPaused())
2439
2446
  return !1;
2440
2447
  let j, C, X = !0;
2441
- const ge = R || {}, I = !f[h] || !ge.dedupe, k = () => ft ? !S.current && h === O.current && D.current : h === O.current, K = {
2448
+ const pe = R || {}, I = !f[h] || !pe.dedupe, k = () => ft ? !S.current && h === O.current && D.current : h === O.current, K = {
2442
2449
  isValidating: !1,
2443
2450
  isLoading: !1
2444
2451
  }, rt = () => {
2445
- q(K);
2452
+ B(K);
2446
2453
  }, st = () => {
2447
2454
  const z = f[h];
2448
2455
  z && z[1] === C && delete f[h];
@@ -2451,10 +2458,10 @@ const mt = fe.use || ((e) => {
2451
2458
  };
2452
2459
  b(P().data) && (ot.isLoading = !0);
2453
2460
  try {
2454
- if (I && (q(ot), n.loadingTimeout && b(P().data) && setTimeout(() => {
2461
+ if (I && (B(ot), n.loadingTimeout && b(P().data) && setTimeout(() => {
2455
2462
  X && k() && A().onLoadingSlow(h, n);
2456
2463
  }, n.loadingTimeout), f[h] = [
2457
- T(B),
2464
+ T(q),
2458
2465
  We()
2459
2466
  ]), [j, C] = f[h], j = await j, I && setTimeout(st, n.dedupingInterval), !f[h] || f[h][1] !== C)
2460
2467
  return I && k() && A().onDiscarded(h), !1;
@@ -2472,9 +2479,9 @@ const mt = fe.use || ((e) => {
2472
2479
  const J = A(), { shouldRetryOnError: Pe } = J;
2473
2480
  J.isPaused() || (K.error = z, I && k() && (J.onError(z, h, J), (Pe === !0 || Q(Pe) && Pe(z)) && (!A().revalidateOnFocus || !A().revalidateOnReconnect || x()) && J.onErrorRetry(z, h, J, (un) => {
2474
2481
  const Ie = p[h];
2475
- Ie && Ie[0] && Ie[0](ve.ERROR_REVALIDATE_EVENT, un);
2482
+ Ie && Ie[0] && Ie[0](Se.ERROR_REVALIDATE_EVENT, un);
2476
2483
  }, {
2477
- retryCount: (ge.retryCount || 0) + 1,
2484
+ retryCount: (pe.retryCount || 0) + 1,
2478
2485
  dedupe: !0
2479
2486
  })));
2480
2487
  }
@@ -2495,7 +2502,7 @@ const mt = fe.use || ((e) => {
2495
2502
  h,
2496
2503
  r
2497
2504
  ]
2498
- ), nt = me(
2505
+ ), nt = ge(
2499
2506
  // Use callback to make sure `keyRef.current` returns latest result every time
2500
2507
  (...R) => rn(r, O.current, ...R),
2501
2508
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -2505,24 +2512,24 @@ const mt = fe.use || ((e) => {
2505
2512
  E.current = t, F.current = n, b(G) || (we.current = G);
2506
2513
  }), Ve(() => {
2507
2514
  if (!h) return;
2508
- const R = Se.bind(V, He);
2515
+ const R = ye.bind(V, He);
2509
2516
  let T = 0;
2510
- const C = cs(h, p, (X, ge = {}) => {
2511
- if (X == ve.FOCUS_EVENT) {
2517
+ const C = us(h, p, (X, pe = {}) => {
2518
+ if (X == Se.FOCUS_EVENT) {
2512
2519
  const I = Date.now();
2513
2520
  A().revalidateOnFocus && I > T && x() && (T = I + A().focusThrottleInterval, R());
2514
- } else if (X == ve.RECONNECT_EVENT)
2521
+ } else if (X == Se.RECONNECT_EVENT)
2515
2522
  A().revalidateOnReconnect && x() && R();
2516
2523
  else {
2517
- if (X == ve.MUTATE_EVENT)
2518
- return Se();
2519
- if (X == ve.ERROR_REVALIDATE_EVENT)
2520
- return Se(ge);
2524
+ if (X == Se.MUTATE_EVENT)
2525
+ return ye();
2526
+ if (X == Se.ERROR_REVALIDATE_EVENT)
2527
+ return ye(pe);
2521
2528
  }
2522
2529
  });
2523
- return S.current = !1, O.current = h, D.current = !0, q({
2524
- _k: B
2525
- }), w && (b(Y) || be ? R() : Yr(R)), () => {
2530
+ return S.current = !1, O.current = h, D.current = !0, B({
2531
+ _k: q
2532
+ }), w && (b(Y) || be ? R() : qr(R)), () => {
2526
2533
  S.current = !0, C();
2527
2534
  };
2528
2535
  }, [
@@ -2534,7 +2541,7 @@ const mt = fe.use || ((e) => {
2534
2541
  C && R !== -1 && (R = setTimeout(j, C));
2535
2542
  }
2536
2543
  function j() {
2537
- !P().error && (c || A().isVisible()) && (i || A().isOnline()) ? Se(He).then(T) : T();
2544
+ !P().error && (c || A().isVisible()) && (i || A().isOnline()) ? ye(He).then(T) : T();
2538
2545
  }
2539
2546
  return T(), () => {
2540
2547
  R && (clearTimeout(R), R = -1);
@@ -2544,7 +2551,7 @@ const mt = fe.use || ((e) => {
2544
2551
  c,
2545
2552
  i,
2546
2553
  h
2547
- ]), gn(re), o && b(Y) && h) {
2554
+ ]), gn(ne), o && b(Y) && h) {
2548
2555
  if (!ft && be)
2549
2556
  throw new Error("Fallback data is required when using suspense in SSR.");
2550
2557
  E.current = t, F.current = n, S.current = !1;
@@ -2553,50 +2560,50 @@ const mt = fe.use || ((e) => {
2553
2560
  const T = nt(R);
2554
2561
  mt(T);
2555
2562
  }
2556
- if (b(pe)) {
2557
- const T = Se(He);
2558
- b(re) || (T.status = "fulfilled", T.value = !0), mt(T);
2563
+ if (b(fe)) {
2564
+ const T = ye(He);
2565
+ b(ne) || (T.status = "fulfilled", T.value = !0), mt(T);
2559
2566
  } else
2560
- throw pe;
2567
+ throw fe;
2561
2568
  }
2562
2569
  return {
2563
2570
  mutate: nt,
2564
2571
  get data() {
2565
- return ne.data = !0, re;
2572
+ return te.data = !0, ne;
2566
2573
  },
2567
2574
  get error() {
2568
- return ne.error = !0, pe;
2575
+ return te.error = !0, fe;
2569
2576
  },
2570
2577
  get isValidating() {
2571
- return ne.isValidating = !0, an;
2578
+ return te.isValidating = !0, an;
2572
2579
  },
2573
2580
  get isLoading() {
2574
- return ne.isLoading = !0, cn;
2581
+ return te.isLoading = !0, cn;
2575
2582
  }
2576
2583
  };
2577
- }, ls = is(us);
2578
- function Rs() {
2579
- const { apiUrl: e, botToken: t } = ue(), n = Et({
2584
+ }, ds = cs(ls);
2585
+ function Ts() {
2586
+ const { apiUrl: e, botToken: t } = ce(), n = Et({
2580
2587
  apiUrl: e,
2581
2588
  botToken: t
2582
2589
  });
2583
- return ls(n.options, n.apis.fetchPreludeData);
2590
+ return ds(n.options, n.apis.fetchPreludeData);
2584
2591
  }
2585
2592
  export {
2586
2593
  $e as A,
2587
- _s as W,
2588
- ae as _,
2589
- As as a,
2590
- Os as b,
2591
- Es as c,
2592
- vs as d,
2593
- ws as e,
2594
- Rs as f,
2595
- bs as g,
2594
+ Rs as W,
2595
+ oe as _,
2596
+ _s as a,
2597
+ As as b,
2598
+ bs as c,
2599
+ Es as d,
2600
+ Os as e,
2601
+ Ts as f,
2602
+ ws as g,
2596
2603
  Re as h,
2597
2604
  At as i,
2598
2605
  Ft as j,
2599
- wr as k,
2600
- ue as u
2606
+ Or as k,
2607
+ ce as u
2601
2608
  };
2602
- //# sourceMappingURL=index-CJ_skeU7.js.map
2609
+ //# sourceMappingURL=index-D84Xc70r.js.map