@opencx/widget 3.0.14 → 3.0.15

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,7 +1,7 @@
1
1
  var Kt = Object.defineProperty;
2
2
  var kt = (e, t, n) => t in e ? Kt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Ye = (e, t, n) => kt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import k, { createContext as rt, useContext as ot, useMemo as le, useSyncExternalStore as zt, useEffect as st, useLayoutEffect as Yt, useRef as K, useCallback as ve, useDebugValue as Jt, useState as Xt } from "react";
4
+ import k, { createContext as rt, useContext as ot, useMemo as de, useSyncExternalStore as zt, useEffect as st, useLayoutEffect as Yt, useRef as K, useCallback as ve, useDebugValue as Jt, useState as Xt } from "react";
5
5
  import { jsx as Qt } from "react/jsx-runtime";
6
6
  import { W as Zt } from "./widget.ctx-BN_4PZd7.js";
7
7
  import { v4 as en } from "uuid";
@@ -50,16 +50,16 @@ function nn(e) {
50
50
  return r;
51
51
  }, t.Provider];
52
52
  }
53
- const rn = "3.0.14", [te, on] = nn();
53
+ const rn = "3.0.15", [z, on] = nn();
54
54
  function tr({
55
55
  options: e,
56
56
  children: t,
57
57
  components: n
58
58
  }) {
59
- const r = le(
59
+ const r = de(
60
60
  () => new Zt({ config: e }),
61
61
  [e]
62
- ), o = le(
62
+ ), o = de(
63
63
  () => new tn({
64
64
  components: n
65
65
  }),
@@ -79,25 +79,25 @@ function tr({
79
79
  );
80
80
  }
81
81
  function nr() {
82
- const { widgetCtx: e } = te();
82
+ const { widgetCtx: e } = z();
83
83
  return e.config;
84
84
  }
85
- function de(e) {
85
+ function oe(e) {
86
86
  return zt(e.subscribe, e.get, e.get);
87
87
  }
88
88
  function rr() {
89
- const { widgetCtx: e } = te();
89
+ const { widgetCtx: e } = z();
90
90
  return {
91
- contactState: de(e.contactCtx.state),
91
+ contactState: oe(e.contactCtx.state),
92
92
  createUnverifiedContact: e.contactCtx.createUnverifiedContact
93
93
  };
94
94
  }
95
95
  function sn() {
96
- const { widgetCtx: e } = te();
97
- return { messagesState: de(e.messageCtx.state), sendMessage: e.messageCtx.sendMessage };
96
+ const { widgetCtx: e } = z();
97
+ return { messagesState: oe(e.messageCtx.state), sendMessage: e.messageCtx.sendMessage };
98
98
  }
99
99
  function an() {
100
- const { widgetCtx: e } = te(), t = de(e.sessionCtx.sessionState), n = de(e.sessionCtx.sessionsState);
100
+ const { widgetCtx: e } = z(), t = oe(e.sessionCtx.sessionState), n = oe(e.sessionCtx.sessionsState);
101
101
  return {
102
102
  sessionState: t,
103
103
  sessionsState: n,
@@ -113,7 +113,7 @@ var sr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
113
113
  function ir(e) {
114
114
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
115
115
  }
116
- function cn(e) {
116
+ function un(e) {
117
117
  if (e.__esModule) return e;
118
118
  var t = e.default;
119
119
  if (typeof t == "function") {
@@ -132,7 +132,7 @@ function cn(e) {
132
132
  });
133
133
  }), n;
134
134
  }
135
- var De = { exports: {} }, we = {};
135
+ var De = { exports: {} }, Se = {};
136
136
  /**
137
137
  * @license React
138
138
  * use-sync-external-store-shim.production.min.js
@@ -143,41 +143,41 @@ var De = { exports: {} }, we = {};
143
143
  * LICENSE file in the root directory of this source tree.
144
144
  */
145
145
  var Je;
146
- function un() {
147
- if (Je) return we;
146
+ function cn() {
147
+ if (Je) return Se;
148
148
  Je = 1;
149
149
  var e = k;
150
- function t(c, l) {
151
- return c === l && (c !== 0 || 1 / c === 1 / l) || c !== c && l !== l;
150
+ function t(u, l) {
151
+ return u === l && (u !== 0 || 1 / u === 1 / l) || u !== u && l !== l;
152
152
  }
153
153
  var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, o = e.useEffect, s = e.useLayoutEffect, i = e.useDebugValue;
154
- function d(c, l) {
155
- var u = l(), y = r({ inst: { value: u, getSnapshot: l } }), _ = y[0].inst, T = y[1];
154
+ function d(u, l) {
155
+ var c = l(), y = r({ inst: { value: c, getSnapshot: l } }), _ = y[0].inst, C = y[1];
156
156
  return s(function() {
157
- _.value = u, _.getSnapshot = l, h(_) && T({ inst: _ });
158
- }, [c, u, l]), o(function() {
159
- return h(_) && T({ inst: _ }), c(function() {
160
- h(_) && T({ inst: _ });
157
+ _.value = c, _.getSnapshot = l, h(_) && C({ inst: _ });
158
+ }, [u, c, l]), o(function() {
159
+ return h(_) && C({ inst: _ }), u(function() {
160
+ h(_) && C({ inst: _ });
161
161
  });
162
- }, [c]), i(u), u;
162
+ }, [u]), i(c), c;
163
163
  }
164
- function h(c) {
165
- var l = c.getSnapshot;
166
- c = c.value;
164
+ function h(u) {
165
+ var l = u.getSnapshot;
166
+ u = u.value;
167
167
  try {
168
- var u = l();
169
- return !n(c, u);
168
+ var c = l();
169
+ return !n(u, c);
170
170
  } catch {
171
171
  return !0;
172
172
  }
173
173
  }
174
- function f(c, l) {
174
+ function f(u, l) {
175
175
  return l();
176
176
  }
177
177
  var a = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? f : d;
178
- return we.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : a, we;
178
+ return Se.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : a, Se;
179
179
  }
180
- var Se = {};
180
+ var we = {};
181
181
  /**
182
182
  * @license React
183
183
  * use-sync-external-store-shim.development.js
@@ -194,71 +194,71 @@ function fn() {
194
194
  var e = k, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
195
195
  function n(O) {
196
196
  {
197
- for (var E = arguments.length, w = new Array(E > 1 ? E - 1 : 0), v = 1; v < E; v++)
198
- w[v - 1] = arguments[v];
199
- r("error", O, w);
197
+ for (var E = arguments.length, S = new Array(E > 1 ? E - 1 : 0), v = 1; v < E; v++)
198
+ S[v - 1] = arguments[v];
199
+ r("error", O, S);
200
200
  }
201
201
  }
202
- function r(O, E, w) {
202
+ function r(O, E, S) {
203
203
  {
204
204
  var v = t.ReactDebugCurrentFrame, L = v.getStackAddendum();
205
- L !== "" && (E += "%s", w = w.concat([L]));
206
- var S = w.map(function(C) {
207
- return String(C);
205
+ L !== "" && (E += "%s", S = S.concat([L]));
206
+ var w = S.map(function(T) {
207
+ return String(T);
208
208
  });
209
- S.unshift("Warning: " + E), Function.prototype.apply.call(console[O], console, S);
209
+ w.unshift("Warning: " + E), Function.prototype.apply.call(console[O], console, w);
210
210
  }
211
211
  }
212
212
  function o(O, E) {
213
213
  return O === E && (O !== 0 || 1 / O === 1 / E) || O !== O && E !== E;
214
214
  }
215
- var s = typeof Object.is == "function" ? Object.is : o, i = e.useState, d = e.useEffect, h = e.useLayoutEffect, f = e.useDebugValue, a = !1, c = !1;
216
- function l(O, E, w) {
215
+ var s = typeof Object.is == "function" ? Object.is : o, i = e.useState, d = e.useEffect, h = e.useLayoutEffect, f = e.useDebugValue, a = !1, u = !1;
216
+ function l(O, E, S) {
217
217
  a || e.startTransition !== void 0 && (a = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
218
218
  var v = E();
219
- if (!c) {
219
+ if (!u) {
220
220
  var L = E();
221
- s(v, L) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0);
221
+ s(v, L) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), u = !0);
222
222
  }
223
- var S = i({
223
+ var w = i({
224
224
  inst: {
225
225
  value: v,
226
226
  getSnapshot: E
227
227
  }
228
- }), C = S[0].inst, x = S[1];
228
+ }), T = w[0].inst, j = w[1];
229
229
  return h(function() {
230
- C.value = v, C.getSnapshot = E, u(C) && x({
231
- inst: C
230
+ T.value = v, T.getSnapshot = E, c(T) && j({
231
+ inst: T
232
232
  });
233
233
  }, [O, v, E]), d(function() {
234
- u(C) && x({
235
- inst: C
234
+ c(T) && j({
235
+ inst: T
236
236
  });
237
237
  var q = function() {
238
- u(C) && x({
239
- inst: C
238
+ c(T) && j({
239
+ inst: T
240
240
  });
241
241
  };
242
242
  return O(q);
243
243
  }, [O]), f(v), v;
244
244
  }
245
- function u(O) {
246
- var E = O.getSnapshot, w = O.value;
245
+ function c(O) {
246
+ var E = O.getSnapshot, S = O.value;
247
247
  try {
248
248
  var v = E();
249
- return !s(w, v);
249
+ return !s(S, v);
250
250
  } catch {
251
251
  return !0;
252
252
  }
253
253
  }
254
- function y(O, E, w) {
254
+ function y(O, E, S) {
255
255
  return E();
256
256
  }
257
- var _ = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", T = !_, p = T ? y : l, z = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : p;
258
- Se.useSyncExternalStore = z, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
259
- }()), Se;
257
+ var _ = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", C = !_, p = C ? y : l, Y = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : p;
258
+ we.useSyncExternalStore = Y, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
259
+ }()), we;
260
260
  }
261
- process.env.NODE_ENV === "production" ? De.exports = un() : De.exports = fn();
261
+ process.env.NODE_ENV === "production" ? De.exports = cn() : De.exports = fn();
262
262
  var ln = De.exports;
263
263
  const H = () => {
264
264
  }, P = (
@@ -269,27 +269,27 @@ const H = () => {
269
269
  ...t
270
270
  }), dn = (e) => M(e.then), ce = /* @__PURE__ */ new WeakMap();
271
271
  let pn = 0;
272
- const oe = (e) => {
272
+ const se = (e) => {
273
273
  const t = typeof e, n = e && e.constructor, r = n == Date;
274
274
  let o, s;
275
275
  if (me(e) === e && !r && n != RegExp) {
276
276
  if (o = ce.get(e), o) return o;
277
277
  if (o = ++pn + "~", ce.set(e, o), n == Array) {
278
278
  for (o = "@", s = 0; s < e.length; s++)
279
- o += oe(e[s]) + ",";
279
+ o += se(e[s]) + ",";
280
280
  ce.set(e, o);
281
281
  }
282
282
  if (n == me) {
283
283
  o = "#";
284
284
  const i = me.keys(e).sort();
285
285
  for (; !g(s = i.pop()); )
286
- g(e[s]) || (o += s + ":" + oe(e[s]) + ",");
286
+ g(e[s]) || (o += s + ":" + se(e[s]) + ",");
287
287
  ce.set(e, o);
288
288
  }
289
289
  } else
290
290
  o = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
291
291
  return o;
292
- }, W = /* @__PURE__ */ new WeakMap(), be = {}, ue = {}, Fe = "undefined", _e = typeof window != Fe, Ae = typeof document != Fe, hn = () => _e && typeof window.requestAnimationFrame != Fe, it = (e, t) => {
292
+ }, W = /* @__PURE__ */ new WeakMap(), be = {}, fe = {}, Fe = "undefined", _e = typeof window != Fe, Ae = typeof document != Fe, hn = () => _e && typeof window.requestAnimationFrame != Fe, it = (e, t) => {
293
293
  const n = W.get(e);
294
294
  return [
295
295
  // Getter
@@ -298,17 +298,17 @@ const oe = (e) => {
298
298
  (r) => {
299
299
  if (!g(t)) {
300
300
  const o = e.get(t);
301
- t in ue || (ue[t] = o), n[5](t, G(o, r), o || be);
301
+ t in fe || (fe[t] = o), n[5](t, G(o, r), o || be);
302
302
  }
303
303
  },
304
304
  // Subscriber
305
305
  n[6],
306
306
  // Get server cache snapshot
307
- () => !g(t) && t in ue ? ue[t] : !g(t) && e.get(t) || be
307
+ () => !g(t) && t in fe ? fe[t] : !g(t) && e.get(t) || be
308
308
  ];
309
309
  };
310
- let je = !0;
311
- const _n = () => je, [xe, Pe] = _e && window.addEventListener ? [
310
+ let xe = !0;
311
+ const _n = () => xe, [je, Pe] = _e && window.addEventListener ? [
312
312
  window.addEventListener.bind(window),
313
313
  window.removeEventListener.bind(window)
314
314
  ] : [
@@ -317,24 +317,24 @@ const _n = () => je, [xe, Pe] = _e && window.addEventListener ? [
317
317
  ], yn = () => {
318
318
  const e = Ae && document.visibilityState;
319
319
  return g(e) || e !== "hidden";
320
- }, gn = (e) => (Ae && document.addEventListener("visibilitychange", e), xe("focus", e), () => {
320
+ }, gn = (e) => (Ae && document.addEventListener("visibilitychange", e), je("focus", e), () => {
321
321
  Ae && document.removeEventListener("visibilitychange", e), Pe("focus", e);
322
322
  }), En = (e) => {
323
323
  const t = () => {
324
- je = !0, e();
324
+ xe = !0, e();
325
325
  }, n = () => {
326
- je = !1;
326
+ xe = !1;
327
327
  };
328
- return xe("online", t), xe("offline", n), () => {
328
+ return je("online", t), je("offline", n), () => {
329
329
  Pe("online", t), Pe("offline", n);
330
330
  };
331
331
  }, vn = {
332
332
  isOnline: _n,
333
333
  isVisible: yn
334
- }, wn = {
334
+ }, Sn = {
335
335
  initFocus: gn,
336
336
  initReconnect: En
337
- }, Qe = !k.useId, se = !_e || "Deno" in window, Sn = (e) => hn() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Oe = se ? st : Yt, Re = typeof navigator < "u" && navigator.connection, Ze = !se && Re && ([
337
+ }, Qe = !k.useId, ie = !_e || "Deno" in window, wn = (e) => hn() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Oe = ie ? st : Yt, Re = typeof navigator < "u" && navigator.connection, Ze = !ie && Re && ([
338
338
  "slow-2g",
339
339
  "2g"
340
340
  ].includes(Re.effectiveType) || Re.saveData), Me = (e) => {
@@ -345,19 +345,19 @@ const _n = () => je, [xe, Pe] = _e && window.addEventListener ? [
345
345
  e = "";
346
346
  }
347
347
  const t = e;
348
- return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? oe(e) : "", [
348
+ return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? se(e) : "", [
349
349
  e,
350
350
  t
351
351
  ];
352
352
  };
353
353
  let mn = 0;
354
- const Le = () => ++mn, at = 0, ct = 1, ut = 2, bn = 3;
354
+ const Le = () => ++mn, at = 0, ut = 1, ct = 2, bn = 3;
355
355
  var re = {
356
356
  __proto__: null,
357
357
  ERROR_REVALIDATE_EVENT: bn,
358
358
  FOCUS_EVENT: at,
359
- MUTATE_EVENT: ut,
360
- RECONNECT_EVENT: ct
359
+ MUTATE_EVENT: ct,
360
+ RECONNECT_EVENT: ut
361
361
  };
362
362
  async function ft(...e) {
363
363
  const [t, n, r, o] = e, s = G({
@@ -371,51 +371,51 @@ async function ft(...e) {
371
371
  let h = s.optimisticData;
372
372
  const f = (l) => typeof d == "function" ? d(l) : d !== !1, a = s.throwOnError;
373
373
  if (M(n)) {
374
- const l = n, u = [], y = t.keys();
374
+ const l = n, c = [], y = t.keys();
375
375
  for (const _ of y)
376
376
  // Skip the special useSWRInfinite and useSWRSubscription keys.
377
- !/^\$(inf|sub)\$/.test(_) && l(t.get(_)._k) && u.push(_);
378
- return Promise.all(u.map(c));
377
+ !/^\$(inf|sub)\$/.test(_) && l(t.get(_)._k) && c.push(_);
378
+ return Promise.all(c.map(u));
379
379
  }
380
- return c(n);
381
- async function c(l) {
382
- const [u] = Me(l);
383
- if (!u) return;
384
- const [y, _] = it(t, u), [T, p, z, O] = W.get(t), E = () => {
385
- const V = T[u];
386
- return (M(s.revalidate) ? s.revalidate(y().data, l) : s.revalidate !== !1) && (delete z[u], delete O[u], V && V[0]) ? V[0](ut).then(() => y().data) : y().data;
380
+ return u(n);
381
+ async function u(l) {
382
+ const [c] = Me(l);
383
+ if (!c) return;
384
+ const [y, _] = it(t, c), [C, p, Y, O] = W.get(t), E = () => {
385
+ const V = C[c];
386
+ return (M(s.revalidate) ? s.revalidate(y().data, l) : s.revalidate !== !1) && (delete Y[c], delete O[c], V && V[0]) ? V[0](ct).then(() => y().data) : y().data;
387
387
  };
388
388
  if (e.length < 3)
389
389
  return E();
390
- let w = r, v;
390
+ let S = r, v;
391
391
  const L = Le();
392
- p[u] = [
392
+ p[c] = [
393
393
  L,
394
394
  0
395
395
  ];
396
- const S = !g(h), C = y(), x = C.data, q = C._c, $ = g(q) ? x : q;
397
- if (S && (h = M(h) ? h($, x) : h, _({
396
+ const w = !g(h), T = y(), j = T.data, q = T._c, $ = g(q) ? j : q;
397
+ if (w && (h = M(h) ? h($, j) : h, _({
398
398
  data: h,
399
399
  _c: $
400
- })), M(w))
400
+ })), M(S))
401
401
  try {
402
- w = w($);
402
+ S = S($);
403
403
  } catch (V) {
404
404
  v = V;
405
405
  }
406
- if (w && dn(w))
407
- if (w = await w.catch((V) => {
406
+ if (S && dn(S))
407
+ if (S = await S.catch((V) => {
408
408
  v = V;
409
- }), L !== p[u][0]) {
409
+ }), L !== p[c][0]) {
410
410
  if (v) throw v;
411
- return w;
412
- } else v && S && f(v) && (i = !0, _({
411
+ return S;
412
+ } else v && w && f(v) && (i = !0, _({
413
413
  data: $,
414
414
  _c: P
415
415
  }));
416
416
  if (i && !v)
417
417
  if (M(i)) {
418
- const V = i(w, $);
418
+ const V = i(S, $);
419
419
  _({
420
420
  data: V,
421
421
  error: P,
@@ -423,11 +423,11 @@ async function ft(...e) {
423
423
  });
424
424
  } else
425
425
  _({
426
- data: w,
426
+ data: S,
427
427
  error: P,
428
428
  _c: P
429
429
  });
430
- if (p[u][1] = Le(), Promise.resolve(E()).then(() => {
430
+ if (p[c][1] = Le(), Promise.resolve(E()).then(() => {
431
431
  _({
432
432
  _c: P
433
433
  });
@@ -435,7 +435,7 @@ async function ft(...e) {
435
435
  if (a) throw v;
436
436
  return;
437
437
  }
438
- return w;
438
+ return S;
439
439
  }
440
440
  }
441
441
  const et = (e, t) => {
@@ -443,17 +443,17 @@ const et = (e, t) => {
443
443
  e[n][0] && e[n][0](t);
444
444
  }, On = (e, t) => {
445
445
  if (!W.has(e)) {
446
- const n = G(wn, t), r = {}, o = ft.bind(P, e);
446
+ const n = G(Sn, t), r = {}, o = ft.bind(P, e);
447
447
  let s = H;
448
- const i = {}, d = (a, c) => {
448
+ const i = {}, d = (a, u) => {
449
449
  const l = i[a] || [];
450
- return i[a] = l, l.push(c), () => l.splice(l.indexOf(c), 1);
451
- }, h = (a, c, l) => {
452
- e.set(a, c);
453
- const u = i[a];
454
- if (u)
455
- for (const y of u)
456
- y(c, l);
450
+ return i[a] = l, l.push(u), () => l.splice(l.indexOf(u), 1);
451
+ }, h = (a, u, l) => {
452
+ e.set(a, u);
453
+ const c = i[a];
454
+ if (c)
455
+ for (const y of c)
456
+ y(u, l);
457
457
  }, f = () => {
458
458
  if (!W.has(e) && (W.set(e, [
459
459
  r,
@@ -463,10 +463,10 @@ const et = (e, t) => {
463
463
  o,
464
464
  h,
465
465
  d
466
- ]), !se)) {
467
- const a = n.initFocus(setTimeout.bind(P, et.bind(P, r, at))), c = n.initReconnect(setTimeout.bind(P, et.bind(P, r, ct)));
466
+ ]), !ie)) {
467
+ const a = n.initFocus(setTimeout.bind(P, et.bind(P, r, at))), u = n.initReconnect(setTimeout.bind(P, et.bind(P, r, ut)));
468
468
  s = () => {
469
- a && a(), c && c(), W.delete(e);
469
+ a && a(), u && u(), W.delete(e);
470
470
  };
471
471
  }
472
472
  };
@@ -484,7 +484,7 @@ const et = (e, t) => {
484
484
  }, Rn = (e, t, n, r, o) => {
485
485
  const s = n.errorRetryCount, i = o.retryCount, d = ~~((Math.random() + 0.5) * (1 << (i < 8 ? i : 8))) * n.errorRetryInterval;
486
486
  !g(s) && i > s || setTimeout(r, d, o);
487
- }, Tn = (e, t) => oe(e) == oe(t), [lt, Cn] = On(/* @__PURE__ */ new Map()), Dn = G(
487
+ }, Cn = (e, t) => se(e) == se(t), [lt, Tn] = On(/* @__PURE__ */ new Map()), Dn = G(
488
488
  {
489
489
  // events
490
490
  onLoadingSlow: H,
@@ -503,10 +503,10 @@ const et = (e, t) => {
503
503
  dedupingInterval: 2 * 1e3,
504
504
  loadingTimeout: Ze ? 5e3 : 3e3,
505
505
  // providers
506
- compare: Tn,
506
+ compare: Cn,
507
507
  isPaused: () => !1,
508
508
  cache: lt,
509
- mutate: Cn,
509
+ mutate: Tn,
510
510
  fallback: {}
511
511
  },
512
512
  // use web preset by default
@@ -518,7 +518,7 @@ const et = (e, t) => {
518
518
  r && s && (n.use = r.concat(s)), o && i && (n.fallback = G(o, i));
519
519
  }
520
520
  return n;
521
- }, jn = rt({}), xn = "$inf$", dt = _e && window.__SWR_DEVTOOLS_USE__, Pn = dt ? window.__SWR_DEVTOOLS_USE__ : [], Ln = () => {
521
+ }, xn = rt({}), jn = "$inf$", dt = _e && window.__SWR_DEVTOOLS_USE__, Pn = dt ? window.__SWR_DEVTOOLS_USE__ : [], Ln = () => {
522
522
  dt && (window.__SWR_DEVTOOLS_REACT__ = k);
523
523
  }, In = (e) => M(e[1]) ? [
524
524
  e[0],
@@ -528,9 +528,9 @@ const et = (e, t) => {
528
528
  e[0],
529
529
  null,
530
530
  (e[1] === null ? e[2] : e[1]) || {}
531
- ], Vn = () => G(Dn, ot(jn)), Fn = (e) => (t, n, r) => e(t, n && ((...s) => {
531
+ ], Vn = () => G(Dn, ot(xn)), Fn = (e) => (t, n, r) => e(t, n && ((...s) => {
532
532
  const [i] = Me(t), [, , , d] = W.get(lt);
533
- if (i.startsWith(xn))
533
+ if (i.startsWith(jn))
534
534
  return n(...s);
535
535
  const h = d[i];
536
536
  return g(h) ? n(...s) : (delete d[i], h);
@@ -538,8 +538,8 @@ const et = (e, t) => {
538
538
  const r = Vn(), [o, s, i] = In(n), d = An(r, i);
539
539
  let h = e;
540
540
  const { use: f } = d, a = (f || []).concat(Mn);
541
- for (let c = a.length; c--; )
542
- h = a[c](h);
541
+ for (let u = a.length; u--; )
542
+ h = a[u](h);
543
543
  return h(o, s || d.fetcher || null, d);
544
544
  }, Un = (e, t, n) => {
545
545
  const r = t[e] || (t[e] = []);
@@ -559,40 +559,40 @@ const tt = k.use || ((e) => {
559
559
  }, (t) => {
560
560
  e.status = "rejected", e.reason = t;
561
561
  }), e);
562
- }), Te = {
562
+ }), Ce = {
563
563
  dedupe: !0
564
564
  }, Wn = (e, t, n) => {
565
- const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: d, revalidateIfStale: h, refreshInterval: f, refreshWhenHidden: a, refreshWhenOffline: c, keepPreviousData: l } = n, [u, y, _, T] = W.get(r), [p, z] = Me(e), O = K(!1), E = K(!1), w = K(p), v = K(t), L = K(n), S = () => L.current, C = () => S().isVisible() && S().isOnline(), [x, q, $, V] = it(r, p), Y = K({}).current, qt = g(i) ? n.fallback[p] : i, Ue = (m, b) => {
566
- for (const A in Y) {
565
+ const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: d, revalidateIfStale: h, refreshInterval: f, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: l } = n, [c, y, _, C] = W.get(r), [p, Y] = Me(e), O = K(!1), E = K(!1), S = K(p), v = K(t), L = K(n), w = () => L.current, T = () => w().isVisible() && w().isOnline(), [j, q, $, V] = it(r, p), J = K({}).current, qt = g(i) ? n.fallback[p] : i, Ue = (m, b) => {
566
+ for (const A in J) {
567
567
  const R = A;
568
568
  if (R === "data") {
569
- if (!o(m[R], b[R]) && (!g(m[R]) || !o(ae, b[R])))
569
+ if (!o(m[R], b[R]) && (!g(m[R]) || !o(ue, b[R])))
570
570
  return !1;
571
571
  } else if (b[R] !== m[R])
572
572
  return !1;
573
573
  }
574
574
  return !0;
575
- }, We = le(() => {
576
- const m = !p || !t ? !1 : g(d) ? S().isPaused() || s ? !1 : g(h) ? !0 : h : d, b = (j) => {
577
- const N = G(j);
575
+ }, We = de(() => {
576
+ const m = !p || !t ? !1 : g(d) ? w().isPaused() || s ? !1 : g(h) ? !0 : h : d, b = (x) => {
577
+ const N = G(x);
578
578
  return delete N._k, m ? {
579
579
  isValidating: !0,
580
580
  isLoading: !0,
581
581
  ...N
582
582
  } : N;
583
- }, A = x(), R = V(), F = b(A), Z = A === R ? F : b(R);
583
+ }, A = j(), R = V(), F = b(A), ee = A === R ? F : b(R);
584
584
  let D = F;
585
585
  return [
586
586
  () => {
587
- const j = b(x());
588
- return Ue(j, D) ? (D.data = j.data, D.isLoading = j.isLoading, D.isValidating = j.isValidating, D.error = j.error, D) : (D = j, j);
587
+ const x = b(j());
588
+ return Ue(x, D) ? (D.data = x.data, D.isLoading = x.isLoading, D.isValidating = x.isValidating, D.error = x.error, D) : (D = x, x);
589
589
  },
590
- () => Z
590
+ () => ee
591
591
  ];
592
592
  }, [
593
593
  r,
594
594
  p
595
- ]), J = ln.useSyncExternalStore(ve(
595
+ ]), X = ln.useSyncExternalStore(ve(
596
596
  (m) => $(p, (b, A) => {
597
597
  Ue(A, b) || m();
598
598
  }),
@@ -601,13 +601,13 @@ const tt = k.use || ((e) => {
601
601
  r,
602
602
  p
603
603
  ]
604
- ), We[0], We[1]), qe = !O.current, Bt = u[p] && u[p].length > 0, X = J.data, Q = g(X) ? qt : X, ie = J.error, Be = K(Q), ae = l ? g(X) ? Be.current : X : Q, He = Bt && !g(ie) ? !1 : qe && !g(d) ? d : S().isPaused() ? !1 : s ? g(Q) ? !1 : h : g(Q) || h, Ge = !!(p && t && qe && He), Ht = g(J.isValidating) ? Ge : J.isValidating, Gt = g(J.isLoading) ? Ge : J.isLoading, ne = ve(
604
+ ), We[0], We[1]), qe = !O.current, Bt = c[p] && c[p].length > 0, Q = X.data, Z = g(Q) ? qt : Q, ae = X.error, Be = K(Z), ue = l ? g(Q) ? Be.current : Q : Z, He = Bt && !g(ae) ? !1 : qe && !g(d) ? d : w().isPaused() ? !1 : s ? g(Z) ? !1 : h : g(Z) || h, Ge = !!(p && t && qe && He), Ht = g(X.isValidating) ? Ge : X.isValidating, Gt = g(X.isLoading) ? Ge : X.isLoading, ne = ve(
605
605
  async (m) => {
606
606
  const b = v.current;
607
- if (!p || !b || E.current || S().isPaused())
607
+ if (!p || !b || E.current || w().isPaused())
608
608
  return !1;
609
609
  let A, R, F = !0;
610
- const Z = m || {}, D = !_[p] || !Z.dedupe, j = () => Qe ? !E.current && p === w.current && O.current : p === w.current, N = {
610
+ const ee = m || {}, D = !_[p] || !ee.dedupe, x = () => Qe ? !E.current && p === S.current && O.current : p === S.current, N = {
611
611
  isValidating: !1,
612
612
  isLoading: !1
613
613
  }, Ke = () => {
@@ -618,32 +618,32 @@ const tt = k.use || ((e) => {
618
618
  }, ze = {
619
619
  isValidating: !0
620
620
  };
621
- g(x().data) && (ze.isLoading = !0);
621
+ g(j().data) && (ze.isLoading = !0);
622
622
  try {
623
- if (D && (q(ze), n.loadingTimeout && g(x().data) && setTimeout(() => {
624
- F && j() && S().onLoadingSlow(p, n);
623
+ if (D && (q(ze), n.loadingTimeout && g(j().data) && setTimeout(() => {
624
+ F && x() && w().onLoadingSlow(p, n);
625
625
  }, n.loadingTimeout), _[p] = [
626
- b(z),
626
+ b(Y),
627
627
  Le()
628
628
  ]), [A, R] = _[p], A = await A, D && setTimeout(ke, n.dedupingInterval), !_[p] || _[p][1] !== R)
629
- return D && j() && S().onDiscarded(p), !1;
629
+ return D && x() && w().onDiscarded(p), !1;
630
630
  N.error = P;
631
631
  const I = y[p];
632
632
  if (!g(I) && // case 1
633
633
  (R <= I[0] || // case 2
634
634
  R <= I[1] || // case 3
635
635
  I[1] === 0))
636
- return Ke(), D && j() && S().onDiscarded(p), !1;
637
- const U = x().data;
638
- N.data = o(U, A) ? U : A, D && j() && S().onSuccess(A, p, n);
636
+ return Ke(), D && x() && w().onDiscarded(p), !1;
637
+ const U = j().data;
638
+ N.data = o(U, A) ? U : A, D && x() && w().onSuccess(A, p, n);
639
639
  } catch (I) {
640
640
  ke();
641
- const U = S(), { shouldRetryOnError: ge } = U;
642
- U.isPaused() || (N.error = I, D && j() && (U.onError(I, p, U), (ge === !0 || M(ge) && ge(I)) && (!S().revalidateOnFocus || !S().revalidateOnReconnect || C()) && U.onErrorRetry(I, p, U, ($t) => {
643
- const Ee = u[p];
641
+ const U = w(), { shouldRetryOnError: ge } = U;
642
+ U.isPaused() || (N.error = I, D && x() && (U.onError(I, p, U), (ge === !0 || M(ge) && ge(I)) && (!w().revalidateOnFocus || !w().revalidateOnReconnect || T()) && U.onErrorRetry(I, p, U, ($t) => {
643
+ const Ee = c[p];
644
644
  Ee && Ee[0] && Ee[0](re.ERROR_REVALIDATE_EVENT, $t);
645
645
  }, {
646
- retryCount: (Z.retryCount || 0) + 1,
646
+ retryCount: (ee.retryCount || 0) + 1,
647
647
  dedupe: !0
648
648
  })));
649
649
  }
@@ -666,32 +666,32 @@ const tt = k.use || ((e) => {
666
666
  ]
667
667
  ), $e = ve(
668
668
  // Use callback to make sure `keyRef.current` returns latest result every time
669
- (...m) => ft(r, w.current, ...m),
669
+ (...m) => ft(r, S.current, ...m),
670
670
  // eslint-disable-next-line react-hooks/exhaustive-deps
671
671
  []
672
672
  );
673
673
  if (Oe(() => {
674
- v.current = t, L.current = n, g(X) || (Be.current = X);
674
+ v.current = t, L.current = n, g(Q) || (Be.current = Q);
675
675
  }), Oe(() => {
676
676
  if (!p) return;
677
- const m = ne.bind(P, Te);
677
+ const m = ne.bind(P, Ce);
678
678
  let b = 0;
679
- const R = Un(p, u, (F, Z = {}) => {
679
+ const R = Un(p, c, (F, ee = {}) => {
680
680
  if (F == re.FOCUS_EVENT) {
681
681
  const D = Date.now();
682
- S().revalidateOnFocus && D > b && C() && (b = D + S().focusThrottleInterval, m());
682
+ w().revalidateOnFocus && D > b && T() && (b = D + w().focusThrottleInterval, m());
683
683
  } else if (F == re.RECONNECT_EVENT)
684
- S().revalidateOnReconnect && C() && m();
684
+ w().revalidateOnReconnect && T() && m();
685
685
  else {
686
686
  if (F == re.MUTATE_EVENT)
687
687
  return ne();
688
688
  if (F == re.ERROR_REVALIDATE_EVENT)
689
- return ne(Z);
689
+ return ne(ee);
690
690
  }
691
691
  });
692
- return E.current = !1, w.current = p, O.current = !0, q({
693
- _k: z
694
- }), He && (g(Q) || se ? m() : Sn(m)), () => {
692
+ return E.current = !1, S.current = p, O.current = !0, q({
693
+ _k: Y
694
+ }), He && (g(Z) || ie ? m() : wn(m)), () => {
695
695
  E.current = !0, R();
696
696
  };
697
697
  }, [
@@ -699,11 +699,11 @@ const tt = k.use || ((e) => {
699
699
  ]), Oe(() => {
700
700
  let m;
701
701
  function b() {
702
- const R = M(f) ? f(x().data) : f;
702
+ const R = M(f) ? f(j().data) : f;
703
703
  R && m !== -1 && (m = setTimeout(A, R));
704
704
  }
705
705
  function A() {
706
- !x().error && (a || S().isVisible()) && (c || S().isOnline()) ? ne(Te).then(b) : b();
706
+ !j().error && (a || w().isVisible()) && (u || w().isOnline()) ? ne(Ce).then(b) : b();
707
707
  }
708
708
  return b(), () => {
709
709
  m && (clearTimeout(m), m = -1);
@@ -711,45 +711,53 @@ const tt = k.use || ((e) => {
711
711
  }, [
712
712
  f,
713
713
  a,
714
- c,
714
+ u,
715
715
  p
716
- ]), Jt(ae), s && g(Q) && p) {
717
- if (!Qe && se)
716
+ ]), Jt(ue), s && g(Z) && p) {
717
+ if (!Qe && ie)
718
718
  throw new Error("Fallback data is required when using suspense in SSR.");
719
719
  v.current = t, L.current = n, E.current = !1;
720
- const m = T[p];
720
+ const m = C[p];
721
721
  if (!g(m)) {
722
722
  const b = $e(m);
723
723
  tt(b);
724
724
  }
725
- if (g(ie)) {
726
- const b = ne(Te);
727
- g(ae) || (b.status = "fulfilled", b.value = !0), tt(b);
725
+ if (g(ae)) {
726
+ const b = ne(Ce);
727
+ g(ue) || (b.status = "fulfilled", b.value = !0), tt(b);
728
728
  } else
729
- throw ie;
729
+ throw ae;
730
730
  }
731
731
  return {
732
732
  mutate: $e,
733
733
  get data() {
734
- return Y.data = !0, ae;
734
+ return J.data = !0, ue;
735
735
  },
736
736
  get error() {
737
- return Y.error = !0, ie;
737
+ return J.error = !0, ae;
738
738
  },
739
739
  get isValidating() {
740
- return Y.isValidating = !0, Ht;
740
+ return J.isValidating = !0, Ht;
741
741
  },
742
742
  get isLoading() {
743
- return Y.isLoading = !0, Gt;
743
+ return J.isLoading = !0, Gt;
744
744
  }
745
745
  };
746
746
  }, qn = Nn(Wn);
747
747
  function ar() {
748
- const { widgetCtx: e } = te();
748
+ const { widgetCtx: e } = z();
749
749
  return qn([e.config.token], e.api.widgetPrelude, {
750
750
  revalidateOnFocus: !1
751
751
  });
752
752
  }
753
+ function ur() {
754
+ const { widgetCtx: e } = z();
755
+ return {
756
+ routerState: oe(e.routerCtx.state),
757
+ toSessionsScreen: e.routerCtx.toSessionsScreen,
758
+ toChatScreen: e.routerCtx.toChatScreen
759
+ };
760
+ }
753
761
  var pt = {}, Ie = function(e, t) {
754
762
  return Ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
755
763
  n.__proto__ = r;
@@ -799,7 +807,7 @@ function Et(e, t, n, r, o, s) {
799
807
  if (p !== void 0 && typeof p != "function") throw new TypeError("Function expected");
800
808
  return p;
801
809
  }
802
- for (var d = r.kind, h = d === "getter" ? "get" : d === "setter" ? "set" : "value", f = !t && e ? r.static ? e : e.prototype : null, a = t || (f ? Object.getOwnPropertyDescriptor(f, r.name) : {}), c, l = !1, u = n.length - 1; u >= 0; u--) {
810
+ for (var d = r.kind, h = d === "getter" ? "get" : d === "setter" ? "set" : "value", f = !t && e ? r.static ? e : e.prototype : null, a = t || (f ? Object.getOwnPropertyDescriptor(f, r.name) : {}), u, l = !1, c = n.length - 1; c >= 0; c--) {
803
811
  var y = {};
804
812
  for (var _ in r) y[_] = _ === "access" ? {} : r[_];
805
813
  for (var _ in r.access) y.access[_] = r.access[_];
@@ -807,12 +815,12 @@ function Et(e, t, n, r, o, s) {
807
815
  if (l) throw new TypeError("Cannot add initializers after decoration has completed");
808
816
  s.push(i(p || null));
809
817
  };
810
- var T = (0, n[u])(d === "accessor" ? { get: a.get, set: a.set } : a[h], y);
818
+ var C = (0, n[c])(d === "accessor" ? { get: a.get, set: a.set } : a[h], y);
811
819
  if (d === "accessor") {
812
- if (T === void 0) continue;
813
- if (T === null || typeof T != "object") throw new TypeError("Object expected");
814
- (c = i(T.get)) && (a.get = c), (c = i(T.set)) && (a.set = c), (c = i(T.init)) && o.unshift(c);
815
- } else (c = i(T)) && (d === "field" ? o.unshift(c) : a[h] = c);
820
+ if (C === void 0) continue;
821
+ if (C === null || typeof C != "object") throw new TypeError("Object expected");
822
+ (u = i(C.get)) && (a.get = u), (u = i(C.set)) && (a.set = u), (u = i(C.init)) && o.unshift(u);
823
+ } else (u = i(C)) && (d === "field" ? o.unshift(u) : a[h] = u);
816
824
  }
817
825
  f && Object.defineProperty(f, r.name, a), l = !0;
818
826
  }
@@ -821,10 +829,10 @@ function vt(e, t, n) {
821
829
  n = r ? t[o].call(e, n) : t[o].call(e);
822
830
  return r ? n : void 0;
823
831
  }
824
- function wt(e) {
832
+ function St(e) {
825
833
  return typeof e == "symbol" ? e : "".concat(e);
826
834
  }
827
- function St(e, t, n) {
835
+ function wt(e, t, n) {
828
836
  return typeof t == "symbol" && (t = t.description ? "[".concat(t.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: n ? "".concat(n, " ", t) : t });
829
837
  }
830
838
  function mt(e, t) {
@@ -840,15 +848,15 @@ function bt(e, t, n, r) {
840
848
  function d(a) {
841
849
  try {
842
850
  f(r.next(a));
843
- } catch (c) {
844
- i(c);
851
+ } catch (u) {
852
+ i(u);
845
853
  }
846
854
  }
847
855
  function h(a) {
848
856
  try {
849
857
  f(r.throw(a));
850
- } catch (c) {
851
- i(c);
858
+ } catch (u) {
859
+ i(u);
852
860
  }
853
861
  }
854
862
  function f(a) {
@@ -956,12 +964,12 @@ function Ne(e, t) {
956
964
  }
957
965
  return s;
958
966
  }
959
- function Tt() {
967
+ function Ct() {
960
968
  for (var e = [], t = 0; t < arguments.length; t++)
961
969
  e = e.concat(Ne(arguments[t]));
962
970
  return e;
963
971
  }
964
- function Ct() {
972
+ function Tt() {
965
973
  for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
966
974
  for (var r = Array(e), o = 0, t = 0; t < n; t++)
967
975
  for (var s = arguments[t], i = 0, d = s.length; i < d; i++, o++)
@@ -973,8 +981,8 @@ function Dt(e, t, n) {
973
981
  (s || !(r in t)) && (s || (s = Array.prototype.slice.call(t, 0, r)), s[r] = t[r]);
974
982
  return e.concat(s || Array.prototype.slice.call(t));
975
983
  }
976
- function ee(e) {
977
- return this instanceof ee ? (this.v = e, this) : new ee(e);
984
+ function te(e) {
985
+ return this instanceof te ? (this.v = e, this) : new te(e);
978
986
  }
979
987
  function At(e, t, n) {
980
988
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
@@ -982,39 +990,39 @@ function At(e, t, n) {
982
990
  return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), d("next"), d("throw"), d("return", i), o[Symbol.asyncIterator] = function() {
983
991
  return this;
984
992
  }, o;
985
- function i(u) {
993
+ function i(c) {
986
994
  return function(y) {
987
- return Promise.resolve(y).then(u, c);
995
+ return Promise.resolve(y).then(c, u);
988
996
  };
989
997
  }
990
- function d(u, y) {
991
- r[u] && (o[u] = function(_) {
992
- return new Promise(function(T, p) {
993
- s.push([u, _, T, p]) > 1 || h(u, _);
998
+ function d(c, y) {
999
+ r[c] && (o[c] = function(_) {
1000
+ return new Promise(function(C, p) {
1001
+ s.push([c, _, C, p]) > 1 || h(c, _);
994
1002
  });
995
- }, y && (o[u] = y(o[u])));
1003
+ }, y && (o[c] = y(o[c])));
996
1004
  }
997
- function h(u, y) {
1005
+ function h(c, y) {
998
1006
  try {
999
- f(r[u](y));
1007
+ f(r[c](y));
1000
1008
  } catch (_) {
1001
1009
  l(s[0][3], _);
1002
1010
  }
1003
1011
  }
1004
- function f(u) {
1005
- u.value instanceof ee ? Promise.resolve(u.value.v).then(a, c) : l(s[0][2], u);
1012
+ function f(c) {
1013
+ c.value instanceof te ? Promise.resolve(c.value.v).then(a, u) : l(s[0][2], c);
1006
1014
  }
1007
- function a(u) {
1008
- h("next", u);
1015
+ function a(c) {
1016
+ h("next", c);
1009
1017
  }
1010
- function c(u) {
1011
- h("throw", u);
1018
+ function u(c) {
1019
+ h("throw", c);
1012
1020
  }
1013
- function l(u, y) {
1014
- u(y), s.shift(), s.length && h(s[0][0], s[0][1]);
1021
+ function l(c, y) {
1022
+ c(y), s.shift(), s.length && h(s[0][0], s[0][1]);
1015
1023
  }
1016
1024
  }
1017
- function jt(e) {
1025
+ function xt(e) {
1018
1026
  var t, n;
1019
1027
  return t = {}, r("next"), r("throw", function(o) {
1020
1028
  throw o;
@@ -1023,11 +1031,11 @@ function jt(e) {
1023
1031
  }, t;
1024
1032
  function r(o, s) {
1025
1033
  t[o] = e[o] ? function(i) {
1026
- return (n = !n) ? { value: ee(e[o](i)), done: !1 } : s ? s(i) : i;
1034
+ return (n = !n) ? { value: te(e[o](i)), done: !1 } : s ? s(i) : i;
1027
1035
  } : s;
1028
1036
  }
1029
1037
  }
1030
- function xt(e) {
1038
+ function jt(e) {
1031
1039
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1032
1040
  var t = e[Symbol.asyncIterator], n;
1033
1041
  return t ? t.call(e) : (e = typeof he == "function" ? he(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
@@ -1141,8 +1149,8 @@ const Gn = {
1141
1149
  __param: gt,
1142
1150
  __esDecorate: Et,
1143
1151
  __runInitializers: vt,
1144
- __propKey: wt,
1145
- __setFunctionName: St,
1152
+ __propKey: St,
1153
+ __setFunctionName: wt,
1146
1154
  __metadata: mt,
1147
1155
  __awaiter: bt,
1148
1156
  __generator: Ot,
@@ -1150,13 +1158,13 @@ const Gn = {
1150
1158
  __exportStar: Rt,
1151
1159
  __values: he,
1152
1160
  __read: Ne,
1153
- __spread: Tt,
1154
- __spreadArrays: Ct,
1161
+ __spread: Ct,
1162
+ __spreadArrays: Tt,
1155
1163
  __spreadArray: Dt,
1156
- __await: ee,
1164
+ __await: te,
1157
1165
  __asyncGenerator: At,
1158
- __asyncDelegator: jt,
1159
- __asyncValues: xt,
1166
+ __asyncDelegator: xt,
1167
+ __asyncValues: jt,
1160
1168
  __makeTemplateObject: Pt,
1161
1169
  __importStar: Lt,
1162
1170
  __importDefault: It,
@@ -1172,10 +1180,10 @@ const Gn = {
1172
1180
  get __assign() {
1173
1181
  return pe;
1174
1182
  },
1175
- __asyncDelegator: jt,
1183
+ __asyncDelegator: xt,
1176
1184
  __asyncGenerator: At,
1177
- __asyncValues: xt,
1178
- __await: ee,
1185
+ __asyncValues: jt,
1186
+ __await: te,
1179
1187
  __awaiter: bt,
1180
1188
  __classPrivateFieldGet: Vt,
1181
1189
  __classPrivateFieldIn: Mt,
@@ -1192,22 +1200,22 @@ const Gn = {
1192
1200
  __makeTemplateObject: Pt,
1193
1201
  __metadata: mt,
1194
1202
  __param: gt,
1195
- __propKey: wt,
1203
+ __propKey: St,
1196
1204
  __read: Ne,
1197
1205
  __rest: _t,
1198
1206
  __rewriteRelativeImportExtension: Wt,
1199
1207
  __runInitializers: vt,
1200
- __setFunctionName: St,
1201
- __spread: Tt,
1208
+ __setFunctionName: wt,
1209
+ __spread: Ct,
1202
1210
  __spreadArray: Dt,
1203
- __spreadArrays: Ct,
1211
+ __spreadArrays: Tt,
1204
1212
  __values: he,
1205
1213
  default: Gn
1206
- }, Symbol.toStringTag, { value: "Module" })), Kn = /* @__PURE__ */ cn($n);
1207
- var fe = {}, nt;
1214
+ }, Symbol.toStringTag, { value: "Module" })), Kn = /* @__PURE__ */ un($n);
1215
+ var le = {}, nt;
1208
1216
  function kn() {
1209
- if (nt) return fe;
1210
- nt = 1, Object.defineProperty(fe, "__esModule", { value: !0 });
1217
+ if (nt) return le;
1218
+ nt = 1, Object.defineProperty(le, "__esModule", { value: !0 });
1211
1219
  var e = k;
1212
1220
  function t() {
1213
1221
  var n = e.useRef(!1), r = e.useCallback(function() {
@@ -1219,62 +1227,62 @@ function kn() {
1219
1227
  };
1220
1228
  }, []), r;
1221
1229
  }
1222
- return fe.default = t, fe;
1230
+ return le.default = t, le;
1223
1231
  }
1224
1232
  Object.defineProperty(pt, "__esModule", { value: !0 });
1225
- var Ve = Kn, Ce = k, zn = Ve.__importDefault(kn());
1233
+ var Ve = Kn, Te = k, zn = Ve.__importDefault(kn());
1226
1234
  function Yn(e, t, n) {
1227
1235
  t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
1228
- var r = Ce.useRef(0), o = zn.default(), s = Ce.useState(n), i = s[0], d = s[1], h = Ce.useCallback(function() {
1236
+ var r = Te.useRef(0), o = zn.default(), s = Te.useState(n), i = s[0], d = s[1], h = Te.useCallback(function() {
1229
1237
  for (var f = [], a = 0; a < arguments.length; a++)
1230
1238
  f[a] = arguments[a];
1231
- var c = ++r.current;
1239
+ var u = ++r.current;
1232
1240
  return i.loading || d(function(l) {
1233
1241
  return Ve.__assign(Ve.__assign({}, l), { loading: !0 });
1234
1242
  }), e.apply(void 0, f).then(function(l) {
1235
- return o() && c === r.current && d({ value: l, loading: !1 }), l;
1243
+ return o() && u === r.current && d({ value: l, loading: !1 }), l;
1236
1244
  }, function(l) {
1237
- return o() && c === r.current && d({ error: l, loading: !1 }), l;
1245
+ return o() && u === r.current && d({ error: l, loading: !1 }), l;
1238
1246
  });
1239
1247
  }, t);
1240
1248
  return [i, h];
1241
1249
  }
1242
1250
  var cr = pt.default = Yn;
1243
1251
  const B = /* @__PURE__ */ new Map();
1244
- function ur() {
1245
- const [e, t] = Xt([]), { widgetCtx: { api: n } } = te();
1252
+ function fr() {
1253
+ const [e, t] = Xt([]), { widgetCtx: { api: n } } = z();
1246
1254
  function r(a) {
1247
- const c = a.map((l) => ({
1255
+ const u = a.map((l) => ({
1248
1256
  file: l,
1249
1257
  id: en(),
1250
1258
  status: "pending",
1251
1259
  progress: 0
1252
1260
  }));
1253
- t((l) => [...l, ...c]), c.forEach(i);
1261
+ t((l) => [...l, ...u]), u.forEach(i);
1254
1262
  }
1255
- function o(a, c) {
1263
+ function o(a, u) {
1256
1264
  t(
1257
- (l) => l.map((u) => u.id === a ? { ...u, ...c } : u)
1265
+ (l) => l.map((c) => c.id === a ? { ...c, ...u } : c)
1258
1266
  );
1259
1267
  }
1260
1268
  function s(a) {
1261
- t((c) => c.filter((l) => l.id !== a));
1269
+ t((u) => u.filter((l) => l.id !== a));
1262
1270
  }
1263
1271
  const i = async (a) => {
1264
- const c = new AbortController();
1265
- B.set(a.id, c);
1272
+ const u = new AbortController();
1273
+ B.set(a.id, u);
1266
1274
  try {
1267
1275
  t(
1268
- (u) => u.map(
1276
+ (c) => c.map(
1269
1277
  (y) => y.id === a.id ? { ...y, status: "uploading", progress: 0 } : y
1270
1278
  )
1271
1279
  );
1272
1280
  const l = await n.uploadFile(a, {
1273
- signal: c.signal,
1274
- onUploadProgress: (u) => {
1275
- if (!u.total) return;
1281
+ signal: u.signal,
1282
+ onUploadProgress: (c) => {
1283
+ if (!c.total) return;
1276
1284
  const y = Math.round(
1277
- u.loaded * 100 / u.total
1285
+ c.loaded * 100 / c.total
1278
1286
  );
1279
1287
  o(a.id, { progress: y });
1280
1288
  }
@@ -1285,7 +1293,7 @@ function ur() {
1285
1293
  progress: 100
1286
1294
  });
1287
1295
  } catch (l) {
1288
- c.signal.aborted || o(a.id, {
1296
+ u.signal.aborted || o(a.id, {
1289
1297
  status: "error",
1290
1298
  error: l instanceof Error ? l.message : "Upload failed",
1291
1299
  progress: 0
@@ -1294,9 +1302,9 @@ function ur() {
1294
1302
  B.delete(a.id);
1295
1303
  }
1296
1304
  }, d = (a) => {
1297
- const c = B.get(a);
1298
- c && (c.abort(), B.delete(a)), s(a);
1299
- }, h = le(() => e.filter((a) => a.status === "success" && a.fileUrl), [e]);
1305
+ const u = B.get(a);
1306
+ u && (u.abort(), B.delete(a)), s(a);
1307
+ }, h = de(() => e.filter((a) => a.status === "success" && a.fileUrl), [e]);
1300
1308
  function f() {
1301
1309
  B.forEach((a) => a.abort()), B.clear(), t([]);
1302
1310
  }
@@ -1308,14 +1316,14 @@ function ur() {
1308
1316
  handleCancelUpload: d,
1309
1317
  successFiles: h,
1310
1318
  emptyTheFiles: f,
1311
- getFileById: (a) => e.find((c) => c.id === a),
1319
+ getFileById: (a) => e.find((u) => u.id === a),
1312
1320
  getUploadProgress: (a) => {
1313
- var c;
1314
- return ((c = e.find((l) => l.id === a)) == null ? void 0 : c.progress) ?? 0;
1321
+ var u;
1322
+ return ((u = e.find((l) => l.id === a)) == null ? void 0 : u.progress) ?? 0;
1315
1323
  },
1316
1324
  getUploadStatus: (a) => {
1317
- var c;
1318
- return (c = e.find((l) => l.id === a)) == null ? void 0 : c.status;
1325
+ var u;
1326
+ return (u = e.find((l) => l.id === a)) == null ? void 0 : u.status;
1319
1327
  },
1320
1328
  hasErrors: e.some((a) => a.status === "error"),
1321
1329
  isUploading: e.some((a) => a.status === "uploading")
@@ -1329,14 +1337,15 @@ export {
1329
1337
  or as c,
1330
1338
  sn as d,
1331
1339
  ar as e,
1332
- de as f,
1340
+ oe as f,
1333
1341
  an as g,
1334
1342
  ur as h,
1335
- pe as i,
1336
- _t as j,
1337
- Dt as k,
1338
- sr as l,
1339
- ir as m,
1340
- te as u
1343
+ fr as i,
1344
+ pe as j,
1345
+ _t as k,
1346
+ Dt as l,
1347
+ sr as m,
1348
+ ir as n,
1349
+ z as u
1341
1350
  };
1342
- //# sourceMappingURL=useUploadFiles-pIJKchG_.js.map
1351
+ //# sourceMappingURL=useUploadFiles-DxCK19Jn.js.map