@opencx/widget 2.5.1 → 2.6.0
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.
- package/dist/basic.cjs +1 -1
- package/dist/basic.cjs.map +1 -1
- package/dist/basic.js +1 -1
- package/dist/basic.js.map +1 -1
- package/dist/core/client/api.d.ts +1 -1
- package/dist/core/client/chat.d.ts +37 -2
- package/dist/core/client/contact.d.ts +2 -2
- package/dist/core/errors/index.d.ts +6 -0
- package/dist/core/platform/audio.d.ts +38 -0
- package/dist/core/platform/index.d.ts +6 -2
- package/dist/core/platform/storage.d.ts +8 -2
- package/dist/core/tests/client/integration.test.d.ts +1 -0
- package/dist/core/tests/platform/audio.test.d.ts +1 -0
- package/dist/core/tests/platform/logger.test.d.ts +1 -0
- package/dist/core/tests/platform/storage.test.d.ts +1 -0
- package/dist/core/tests/test-utils.d.ts +2 -0
- package/dist/core/tests/types/pub-sub.test.d.ts +1 -0
- package/dist/core/tests/utils/create-fetch.test.d.ts +1 -0
- package/dist/core/types/helpers.d.ts +2 -2
- package/dist/core/types/pub-sub.d.ts +1 -0
- package/dist/core/types/schemas-v2.d.ts +3 -0
- package/dist/core/utils/create-fetch.d.ts +2 -1
- package/dist/{genUuid-CDpI3ugS.js → genUuid-C12yFv3j.js} +2 -1
- package/dist/genUuid-C12yFv3j.js.map +1 -0
- package/dist/genUuid-DdeSE04H.cjs +2 -0
- package/dist/genUuid-DdeSE04H.cjs.map +1 -0
- package/dist/{index-D84Xc70r.js → index-C87obATS.js} +531 -524
- package/dist/index-C87obATS.js.map +1 -0
- package/dist/index-ChwS_h0D.cjs +18 -0
- package/dist/index-ChwS_h0D.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +668 -471
- package/dist/index.js.map +1 -1
- package/dist/package.json.d.ts +2 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist-embed/script.js +20 -20
- package/dist-embed/script.js.map +1 -1
- package/package.json +2 -1
- package/dist/genUuid-BkZtn1k9.cjs +0 -2
- package/dist/genUuid-BkZtn1k9.cjs.map +0 -1
- package/dist/genUuid-CDpI3ugS.js.map +0 -1
- package/dist/index-1bY4_hBw.cjs +0 -18
- package/dist/index-1bY4_hBw.cjs.map +0 -1
- package/dist/index-D84Xc70r.js.map +0 -1
- /package/dist/core/{utils/genId.test.d.ts → tests/client/integration-perisitance.test.d.ts} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
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
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { jsx as
|
|
3
|
+
var it = (e, t, n) => dn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import fe, { useMemo as ne, useState as Je, useCallback as me, useEffect as de, createContext as yt, useContext as St, useRef as ae, useReducer as fn, useLayoutEffect as pn, useDebugValue as gn } from "react";
|
|
5
|
+
import { jsx as te } from "react/jsx-runtime";
|
|
6
6
|
import { create as mn } from "mutative";
|
|
7
7
|
import l from "zod";
|
|
8
|
-
import { c as
|
|
8
|
+
import { c as vt, g as ve } from "./genUuid-C12yFv3j.js";
|
|
9
9
|
import hn from "lodash.set";
|
|
10
10
|
import yn from "axios";
|
|
11
|
-
const Sn = typeof window > "u",
|
|
11
|
+
const Sn = typeof window > "u", ct = {
|
|
12
12
|
getItem: () => null,
|
|
13
13
|
setItem: () => {
|
|
14
14
|
},
|
|
@@ -16,10 +16,10 @@ const Sn = typeof window > "u", it = {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
function vn(e) {
|
|
19
|
-
return Sn ?
|
|
19
|
+
return Sn ? ct : e === "local" ? localStorage : e === "session" ? sessionStorage : ct;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const r =
|
|
21
|
+
function Ze(e, t, n = "session") {
|
|
22
|
+
const r = ne(() => vn(n), [n]), [s, o] = Je(() => {
|
|
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 =
|
|
31
|
+
}), a = me(
|
|
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 =
|
|
46
|
+
), d = me(() => {
|
|
47
47
|
o(null), r.removeItem(e);
|
|
48
48
|
}, [e, r]);
|
|
49
|
-
return
|
|
49
|
+
return de(() => {
|
|
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",
|
|
58
|
+
const En = "@opencx/widget", Et = "2.6.0", bn = "module", wn = {
|
|
59
59
|
access: "public"
|
|
60
60
|
}, On = {
|
|
61
61
|
clean: "rm -rf ./dist ./dist-embed",
|
|
@@ -101,6 +101,7 @@ const En = "@opencx/widget", vt = "2.5.1", bn = "module", wn = {
|
|
|
101
101
|
"react-hot-toast": "^2.4.1",
|
|
102
102
|
tinycolor2: "^1.6.0",
|
|
103
103
|
uuid: "^11.0.4",
|
|
104
|
+
"whatwg-fetch": "^3.6.20",
|
|
104
105
|
zod: "^3.23.8"
|
|
105
106
|
}, Dn = {
|
|
106
107
|
"@opencx/widget": {
|
|
@@ -190,7 +191,7 @@ const En = "@opencx/widget", vt = "2.5.1", bn = "module", wn = {
|
|
|
190
191
|
}, Vn = {
|
|
191
192
|
name: En,
|
|
192
193
|
private: !1,
|
|
193
|
-
version:
|
|
194
|
+
version: Et,
|
|
194
195
|
type: bn,
|
|
195
196
|
publishConfig: wn,
|
|
196
197
|
scripts: On,
|
|
@@ -210,16 +211,16 @@ const En = "@opencx/widget", vt = "2.5.1", bn = "module", wn = {
|
|
|
210
211
|
exports: Fn,
|
|
211
212
|
devDependencies: Mn
|
|
212
213
|
}, Un = "X-Bot-Token", Hn = "X-Widget-Version";
|
|
213
|
-
function
|
|
214
|
-
const t =
|
|
214
|
+
function bt(e) {
|
|
215
|
+
const t = ne(() => yn.create({
|
|
215
216
|
baseURL: e.apiUrl,
|
|
216
217
|
headers: {
|
|
217
218
|
[Un]: e.botToken,
|
|
218
|
-
[Hn]:
|
|
219
|
+
[Hn]: Et,
|
|
219
220
|
"X-Use-Guard": !0
|
|
220
221
|
}
|
|
221
222
|
}), [e]);
|
|
222
|
-
return { apis:
|
|
223
|
+
return { apis: ne(
|
|
223
224
|
() => ({
|
|
224
225
|
createSession: (r) => {
|
|
225
226
|
if (!r)
|
|
@@ -304,10 +305,10 @@ function Et(e) {
|
|
|
304
305
|
[t]
|
|
305
306
|
), options: e };
|
|
306
307
|
}
|
|
307
|
-
function
|
|
308
|
-
const t =
|
|
308
|
+
function Ne(e) {
|
|
309
|
+
const t = yt({});
|
|
309
310
|
return [() => {
|
|
310
|
-
const r =
|
|
311
|
+
const r = St(t);
|
|
311
312
|
if (r === void 0)
|
|
312
313
|
throw new Error("useSafeContext must be used within a Provider");
|
|
313
314
|
return r;
|
|
@@ -643,10 +644,10 @@ function Wn(e, t) {
|
|
|
643
644
|
const n = Qn[t];
|
|
644
645
|
return n && n[e] || "";
|
|
645
646
|
}
|
|
646
|
-
const [Es, Kn] =
|
|
647
|
-
function
|
|
648
|
-
const t =
|
|
649
|
-
return /* @__PURE__ */
|
|
647
|
+
const [Es, Kn] = Ne();
|
|
648
|
+
function wt({ children: e }) {
|
|
649
|
+
const t = le();
|
|
650
|
+
return /* @__PURE__ */ te(
|
|
650
651
|
Kn,
|
|
651
652
|
{
|
|
652
653
|
value: {
|
|
@@ -659,7 +660,7 @@ function bt({ children: e }) {
|
|
|
659
660
|
}
|
|
660
661
|
class Jn {
|
|
661
662
|
constructor(t) {
|
|
662
|
-
|
|
663
|
+
it(this, "components", [
|
|
663
664
|
{
|
|
664
665
|
key: "FALLBACK",
|
|
665
666
|
component: (t) => "fallback"
|
|
@@ -698,7 +699,7 @@ const Zn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABlCAYAAAC7vkbxAA
|
|
|
698
699
|
triggerOffset: "20px"
|
|
699
700
|
};
|
|
700
701
|
function er(e) {
|
|
701
|
-
return
|
|
702
|
+
return ne(() => {
|
|
702
703
|
var s, o, a, d;
|
|
703
704
|
const t = {
|
|
704
705
|
messageArrived: "https://cloud.opencopilot.so/sfx/notification3.mp3",
|
|
@@ -730,25 +731,25 @@ function er(e) {
|
|
|
730
731
|
};
|
|
731
732
|
}, [e]);
|
|
732
733
|
}
|
|
733
|
-
const [
|
|
734
|
+
const [le, tr] = Ne(), nr = "en";
|
|
734
735
|
function rr({
|
|
735
736
|
children: e,
|
|
736
737
|
data: t
|
|
737
738
|
}) {
|
|
738
|
-
const n =
|
|
739
|
+
const n = ne(
|
|
739
740
|
() => new Jn({
|
|
740
741
|
components: t.components
|
|
741
742
|
}),
|
|
742
743
|
[t]
|
|
743
|
-
), r = er(t), s =
|
|
744
|
+
), r = er(t), s = bt({
|
|
744
745
|
apiUrl: r.apiUrl,
|
|
745
746
|
botToken: r.token
|
|
746
|
-
}), [o, a] =
|
|
747
|
+
}), [o, a] = Ze(
|
|
747
748
|
"open_settings",
|
|
748
749
|
r.defaultSettings,
|
|
749
750
|
"local"
|
|
750
751
|
);
|
|
751
|
-
return /* @__PURE__ */
|
|
752
|
+
return /* @__PURE__ */ te(
|
|
752
753
|
tr,
|
|
753
754
|
{
|
|
754
755
|
value: { ...r, http: s, componentStore: n, widgetSettings: o, setSettings: (g) => {
|
|
@@ -760,7 +761,7 @@ function rr({
|
|
|
760
761
|
);
|
|
761
762
|
a(u);
|
|
762
763
|
} },
|
|
763
|
-
children: /* @__PURE__ */
|
|
764
|
+
children: /* @__PURE__ */ te(wt, { children: e })
|
|
764
765
|
}
|
|
765
766
|
);
|
|
766
767
|
}
|
|
@@ -787,32 +788,32 @@ function sr(e) {
|
|
|
787
788
|
});
|
|
788
789
|
}), n;
|
|
789
790
|
}
|
|
790
|
-
var
|
|
791
|
-
return
|
|
791
|
+
var Ot = {}, ze = function(e, t) {
|
|
792
|
+
return ze = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
792
793
|
n.__proto__ = r;
|
|
793
794
|
} || function(n, r) {
|
|
794
795
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
795
|
-
},
|
|
796
|
+
}, ze(e, t);
|
|
796
797
|
};
|
|
797
|
-
function
|
|
798
|
+
function At(e, t) {
|
|
798
799
|
if (typeof t != "function" && t !== null)
|
|
799
800
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
800
|
-
|
|
801
|
+
ze(e, t);
|
|
801
802
|
function n() {
|
|
802
803
|
this.constructor = e;
|
|
803
804
|
}
|
|
804
805
|
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
|
|
805
806
|
}
|
|
806
|
-
var
|
|
807
|
-
return
|
|
807
|
+
var Te = function() {
|
|
808
|
+
return Te = Object.assign || function(t) {
|
|
808
809
|
for (var n, r = 1, s = arguments.length; r < s; r++) {
|
|
809
810
|
n = arguments[r];
|
|
810
811
|
for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
|
|
811
812
|
}
|
|
812
813
|
return t;
|
|
813
|
-
},
|
|
814
|
+
}, Te.apply(this, arguments);
|
|
814
815
|
};
|
|
815
|
-
function
|
|
816
|
+
function _t(e, t) {
|
|
816
817
|
var n = {};
|
|
817
818
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
818
819
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -820,18 +821,18 @@ function At(e, t) {
|
|
|
820
821
|
t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[s]) && (n[r[s]] = e[r[s]]);
|
|
821
822
|
return n;
|
|
822
823
|
}
|
|
823
|
-
function
|
|
824
|
+
function Rt(e, t, n, r) {
|
|
824
825
|
var s = arguments.length, o = s < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, a;
|
|
825
826
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, n, r);
|
|
826
827
|
else for (var d = e.length - 1; d >= 0; d--) (a = e[d]) && (o = (s < 3 ? a(o) : s > 3 ? a(t, n, o) : a(t, n)) || o);
|
|
827
828
|
return s > 3 && o && Object.defineProperty(t, n, o), o;
|
|
828
829
|
}
|
|
829
|
-
function
|
|
830
|
+
function Tt(e, t) {
|
|
830
831
|
return function(n, r) {
|
|
831
832
|
t(n, r, e);
|
|
832
833
|
};
|
|
833
834
|
}
|
|
834
|
-
function
|
|
835
|
+
function Dt(e, t, n, r, s, o) {
|
|
835
836
|
function a(h) {
|
|
836
837
|
if (h !== void 0 && typeof h != "function") throw new TypeError("Function expected");
|
|
837
838
|
return h;
|
|
@@ -853,21 +854,21 @@ function Tt(e, t, n, r, s, o) {
|
|
|
853
854
|
}
|
|
854
855
|
u && Object.defineProperty(u, r.name, c), m = !0;
|
|
855
856
|
}
|
|
856
|
-
function
|
|
857
|
+
function Nt(e, t, n) {
|
|
857
858
|
for (var r = arguments.length > 2, s = 0; s < t.length; s++)
|
|
858
859
|
n = r ? t[s].call(e, n) : t[s].call(e);
|
|
859
860
|
return r ? n : void 0;
|
|
860
861
|
}
|
|
861
|
-
function
|
|
862
|
+
function Ct(e) {
|
|
862
863
|
return typeof e == "symbol" ? e : "".concat(e);
|
|
863
864
|
}
|
|
864
|
-
function
|
|
865
|
+
function xt(e, t, n) {
|
|
865
866
|
return typeof t == "symbol" && (t = t.description ? "[".concat(t.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: n ? "".concat(n, " ", t) : t });
|
|
866
867
|
}
|
|
867
|
-
function
|
|
868
|
+
function Pt(e, t) {
|
|
868
869
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
869
870
|
}
|
|
870
|
-
function
|
|
871
|
+
function It(e, t, n, r) {
|
|
871
872
|
function s(o) {
|
|
872
873
|
return o instanceof n ? o : new n(function(a) {
|
|
873
874
|
a(o);
|
|
@@ -894,7 +895,7 @@ function Pt(e, t, n, r) {
|
|
|
894
895
|
u((r = r.apply(e, t || [])).next());
|
|
895
896
|
});
|
|
896
897
|
}
|
|
897
|
-
function
|
|
898
|
+
function jt(e, t) {
|
|
898
899
|
var n = { label: 0, sent: function() {
|
|
899
900
|
if (o[0] & 1) throw o[1];
|
|
900
901
|
return o[1];
|
|
@@ -954,7 +955,7 @@ function It(e, t) {
|
|
|
954
955
|
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
955
956
|
}
|
|
956
957
|
}
|
|
957
|
-
var
|
|
958
|
+
var Ce = Object.create ? function(e, t, n, r) {
|
|
958
959
|
r === void 0 && (r = n);
|
|
959
960
|
var s = Object.getOwnPropertyDescriptor(t, n);
|
|
960
961
|
(!s || ("get" in s ? !t.__esModule : s.writable || s.configurable)) && (s = { enumerable: !0, get: function() {
|
|
@@ -963,10 +964,10 @@ var Ne = Object.create ? function(e, t, n, r) {
|
|
|
963
964
|
} : function(e, t, n, r) {
|
|
964
965
|
r === void 0 && (r = n), e[r] = t[n];
|
|
965
966
|
};
|
|
966
|
-
function
|
|
967
|
-
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) &&
|
|
967
|
+
function Lt(e, t) {
|
|
968
|
+
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) && Ce(t, e, n);
|
|
968
969
|
}
|
|
969
|
-
function
|
|
970
|
+
function De(e) {
|
|
970
971
|
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
|
|
971
972
|
if (n) return n.call(e);
|
|
972
973
|
if (e && typeof e.length == "number") return {
|
|
@@ -976,7 +977,7 @@ function Te(e) {
|
|
|
976
977
|
};
|
|
977
978
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
978
979
|
}
|
|
979
|
-
function
|
|
980
|
+
function $e(e, t) {
|
|
980
981
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
981
982
|
if (!n) return e;
|
|
982
983
|
var r = n.call(e), s, o = [], a;
|
|
@@ -993,27 +994,27 @@ function Ze(e, t) {
|
|
|
993
994
|
}
|
|
994
995
|
return o;
|
|
995
996
|
}
|
|
996
|
-
function
|
|
997
|
+
function kt() {
|
|
997
998
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
998
|
-
e = e.concat(
|
|
999
|
+
e = e.concat($e(arguments[t]));
|
|
999
1000
|
return e;
|
|
1000
1001
|
}
|
|
1001
|
-
function
|
|
1002
|
+
function Ft() {
|
|
1002
1003
|
for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
|
|
1003
1004
|
for (var r = Array(e), s = 0, t = 0; t < n; t++)
|
|
1004
1005
|
for (var o = arguments[t], a = 0, d = o.length; a < d; a++, s++)
|
|
1005
1006
|
r[s] = o[a];
|
|
1006
1007
|
return r;
|
|
1007
1008
|
}
|
|
1008
|
-
function
|
|
1009
|
+
function Mt(e, t, n) {
|
|
1009
1010
|
if (n || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
|
|
1010
1011
|
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
1011
1012
|
return e.concat(o || Array.prototype.slice.call(t));
|
|
1012
1013
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return this instanceof
|
|
1014
|
+
function he(e) {
|
|
1015
|
+
return this instanceof he ? (this.v = e, this) : new he(e);
|
|
1015
1016
|
}
|
|
1016
|
-
function
|
|
1017
|
+
function Vt(e, t, n) {
|
|
1017
1018
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1018
1019
|
var r = n.apply(e, t || []), s, o = [];
|
|
1019
1020
|
return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), d("next"), d("throw"), d("return", a), s[Symbol.asyncIterator] = function() {
|
|
@@ -1039,7 +1040,7 @@ function Mt(e, t, n) {
|
|
|
1039
1040
|
}
|
|
1040
1041
|
}
|
|
1041
1042
|
function u(p) {
|
|
1042
|
-
p.value instanceof
|
|
1043
|
+
p.value instanceof he ? Promise.resolve(p.value.v).then(c, i) : m(o[0][2], p);
|
|
1043
1044
|
}
|
|
1044
1045
|
function c(p) {
|
|
1045
1046
|
g("next", p);
|
|
@@ -1051,7 +1052,7 @@ function Mt(e, t, n) {
|
|
|
1051
1052
|
p(y), o.shift(), o.length && g(o[0][0], o[0][1]);
|
|
1052
1053
|
}
|
|
1053
1054
|
}
|
|
1054
|
-
function
|
|
1055
|
+
function Ut(e) {
|
|
1055
1056
|
var t, n;
|
|
1056
1057
|
return t = {}, r("next"), r("throw", function(s) {
|
|
1057
1058
|
throw s;
|
|
@@ -1060,14 +1061,14 @@ function Vt(e) {
|
|
|
1060
1061
|
}, t;
|
|
1061
1062
|
function r(s, o) {
|
|
1062
1063
|
t[s] = e[s] ? function(a) {
|
|
1063
|
-
return (n = !n) ? { value:
|
|
1064
|
+
return (n = !n) ? { value: he(e[s](a)), done: !1 } : o ? o(a) : a;
|
|
1064
1065
|
} : o;
|
|
1065
1066
|
}
|
|
1066
1067
|
}
|
|
1067
|
-
function
|
|
1068
|
+
function Ht(e) {
|
|
1068
1069
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1069
1070
|
var t = e[Symbol.asyncIterator], n;
|
|
1070
|
-
return t ? t.call(e) : (e = typeof
|
|
1071
|
+
return t ? t.call(e) : (e = typeof De == "function" ? De(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
|
|
1071
1072
|
return this;
|
|
1072
1073
|
}, n);
|
|
1073
1074
|
function r(o) {
|
|
@@ -1083,7 +1084,7 @@ function Ut(e) {
|
|
|
1083
1084
|
}, a);
|
|
1084
1085
|
}
|
|
1085
1086
|
}
|
|
1086
|
-
function
|
|
1087
|
+
function Gt(e, t) {
|
|
1087
1088
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1088
1089
|
}
|
|
1089
1090
|
var or = Object.create ? function(e, t) {
|
|
@@ -1091,31 +1092,31 @@ var or = Object.create ? function(e, t) {
|
|
|
1091
1092
|
} : function(e, t) {
|
|
1092
1093
|
e.default = t;
|
|
1093
1094
|
};
|
|
1094
|
-
function
|
|
1095
|
+
function zt(e) {
|
|
1095
1096
|
if (e && e.__esModule) return e;
|
|
1096
1097
|
var t = {};
|
|
1097
|
-
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) &&
|
|
1098
|
+
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) && Ce(t, e, n);
|
|
1098
1099
|
return or(t, e), t;
|
|
1099
1100
|
}
|
|
1100
|
-
function
|
|
1101
|
+
function Yt(e) {
|
|
1101
1102
|
return e && e.__esModule ? e : { default: e };
|
|
1102
1103
|
}
|
|
1103
|
-
function
|
|
1104
|
+
function qt(e, t, n, r) {
|
|
1104
1105
|
if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
|
|
1105
1106
|
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");
|
|
1106
1107
|
return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
|
|
1107
1108
|
}
|
|
1108
|
-
function
|
|
1109
|
+
function Bt(e, t, n, r, s) {
|
|
1109
1110
|
if (r === "m") throw new TypeError("Private method is not writable");
|
|
1110
1111
|
if (r === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
|
|
1111
1112
|
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");
|
|
1112
1113
|
return r === "a" ? s.call(e, n) : s ? s.value = n : t.set(e, n), n;
|
|
1113
1114
|
}
|
|
1114
|
-
function
|
|
1115
|
+
function Xt(e, t) {
|
|
1115
1116
|
if (t === null || typeof t != "object" && typeof t != "function") throw new TypeError("Cannot use 'in' operator on non-object");
|
|
1116
1117
|
return typeof e == "function" ? t === e : e.has(t);
|
|
1117
1118
|
}
|
|
1118
|
-
function
|
|
1119
|
+
function Qt(e, t, n) {
|
|
1119
1120
|
if (t != null) {
|
|
1120
1121
|
if (typeof t != "object" && typeof t != "function") throw new TypeError("Object expected.");
|
|
1121
1122
|
var r, s;
|
|
@@ -1142,7 +1143,7 @@ var ar = typeof SuppressedError == "function" ? SuppressedError : function(e, t,
|
|
|
1142
1143
|
var r = new Error(n);
|
|
1143
1144
|
return r.name = "SuppressedError", r.error = e, r.suppressed = t, r;
|
|
1144
1145
|
};
|
|
1145
|
-
function
|
|
1146
|
+
function Wt(e) {
|
|
1146
1147
|
function t(o) {
|
|
1147
1148
|
e.error = e.hasError ? new ar(o, e.error, "An error was suppressed during disposal.") : o, e.hasError = !0;
|
|
1148
1149
|
}
|
|
@@ -1165,87 +1166,87 @@ function Qt(e) {
|
|
|
1165
1166
|
}
|
|
1166
1167
|
return s();
|
|
1167
1168
|
}
|
|
1168
|
-
function
|
|
1169
|
+
function Kt(e, t) {
|
|
1169
1170
|
return typeof e == "string" && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(n, r, s, o, a) {
|
|
1170
1171
|
return r ? t ? ".jsx" : ".js" : s && (!o || !a) ? n : s + o + "." + a.toLowerCase() + "js";
|
|
1171
1172
|
}) : e;
|
|
1172
1173
|
}
|
|
1173
1174
|
const ir = {
|
|
1174
|
-
__extends:
|
|
1175
|
-
__assign:
|
|
1176
|
-
__rest:
|
|
1177
|
-
__decorate:
|
|
1178
|
-
__param:
|
|
1179
|
-
__esDecorate:
|
|
1180
|
-
__runInitializers:
|
|
1181
|
-
__propKey:
|
|
1182
|
-
__setFunctionName:
|
|
1183
|
-
__metadata:
|
|
1184
|
-
__awaiter:
|
|
1185
|
-
__generator:
|
|
1186
|
-
__createBinding:
|
|
1187
|
-
__exportStar:
|
|
1188
|
-
__values:
|
|
1189
|
-
__read:
|
|
1190
|
-
__spread:
|
|
1191
|
-
__spreadArrays:
|
|
1192
|
-
__spreadArray:
|
|
1193
|
-
__await:
|
|
1194
|
-
__asyncGenerator:
|
|
1195
|
-
__asyncDelegator:
|
|
1196
|
-
__asyncValues:
|
|
1197
|
-
__makeTemplateObject:
|
|
1198
|
-
__importStar:
|
|
1199
|
-
__importDefault:
|
|
1200
|
-
__classPrivateFieldGet:
|
|
1201
|
-
__classPrivateFieldSet:
|
|
1202
|
-
__classPrivateFieldIn:
|
|
1203
|
-
__addDisposableResource:
|
|
1204
|
-
__disposeResources:
|
|
1205
|
-
__rewriteRelativeImportExtension:
|
|
1175
|
+
__extends: At,
|
|
1176
|
+
__assign: Te,
|
|
1177
|
+
__rest: _t,
|
|
1178
|
+
__decorate: Rt,
|
|
1179
|
+
__param: Tt,
|
|
1180
|
+
__esDecorate: Dt,
|
|
1181
|
+
__runInitializers: Nt,
|
|
1182
|
+
__propKey: Ct,
|
|
1183
|
+
__setFunctionName: xt,
|
|
1184
|
+
__metadata: Pt,
|
|
1185
|
+
__awaiter: It,
|
|
1186
|
+
__generator: jt,
|
|
1187
|
+
__createBinding: Ce,
|
|
1188
|
+
__exportStar: Lt,
|
|
1189
|
+
__values: De,
|
|
1190
|
+
__read: $e,
|
|
1191
|
+
__spread: kt,
|
|
1192
|
+
__spreadArrays: Ft,
|
|
1193
|
+
__spreadArray: Mt,
|
|
1194
|
+
__await: he,
|
|
1195
|
+
__asyncGenerator: Vt,
|
|
1196
|
+
__asyncDelegator: Ut,
|
|
1197
|
+
__asyncValues: Ht,
|
|
1198
|
+
__makeTemplateObject: Gt,
|
|
1199
|
+
__importStar: zt,
|
|
1200
|
+
__importDefault: Yt,
|
|
1201
|
+
__classPrivateFieldGet: qt,
|
|
1202
|
+
__classPrivateFieldSet: Bt,
|
|
1203
|
+
__classPrivateFieldIn: Xt,
|
|
1204
|
+
__addDisposableResource: Qt,
|
|
1205
|
+
__disposeResources: Wt,
|
|
1206
|
+
__rewriteRelativeImportExtension: Kt
|
|
1206
1207
|
}, cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1207
1208
|
__proto__: null,
|
|
1208
|
-
__addDisposableResource:
|
|
1209
|
+
__addDisposableResource: Qt,
|
|
1209
1210
|
get __assign() {
|
|
1210
|
-
return
|
|
1211
|
+
return Te;
|
|
1211
1212
|
},
|
|
1212
|
-
__asyncDelegator:
|
|
1213
|
-
__asyncGenerator:
|
|
1214
|
-
__asyncValues:
|
|
1215
|
-
__await:
|
|
1216
|
-
__awaiter:
|
|
1217
|
-
__classPrivateFieldGet:
|
|
1218
|
-
__classPrivateFieldIn:
|
|
1219
|
-
__classPrivateFieldSet:
|
|
1220
|
-
__createBinding:
|
|
1221
|
-
__decorate:
|
|
1222
|
-
__disposeResources:
|
|
1223
|
-
__esDecorate:
|
|
1224
|
-
__exportStar:
|
|
1225
|
-
__extends:
|
|
1226
|
-
__generator:
|
|
1227
|
-
__importDefault:
|
|
1228
|
-
__importStar:
|
|
1229
|
-
__makeTemplateObject:
|
|
1230
|
-
__metadata:
|
|
1231
|
-
__param:
|
|
1232
|
-
__propKey:
|
|
1233
|
-
__read:
|
|
1234
|
-
__rest:
|
|
1235
|
-
__rewriteRelativeImportExtension:
|
|
1236
|
-
__runInitializers:
|
|
1237
|
-
__setFunctionName:
|
|
1238
|
-
__spread:
|
|
1239
|
-
__spreadArray:
|
|
1240
|
-
__spreadArrays:
|
|
1241
|
-
__values:
|
|
1213
|
+
__asyncDelegator: Ut,
|
|
1214
|
+
__asyncGenerator: Vt,
|
|
1215
|
+
__asyncValues: Ht,
|
|
1216
|
+
__await: he,
|
|
1217
|
+
__awaiter: It,
|
|
1218
|
+
__classPrivateFieldGet: qt,
|
|
1219
|
+
__classPrivateFieldIn: Xt,
|
|
1220
|
+
__classPrivateFieldSet: Bt,
|
|
1221
|
+
__createBinding: Ce,
|
|
1222
|
+
__decorate: Rt,
|
|
1223
|
+
__disposeResources: Wt,
|
|
1224
|
+
__esDecorate: Dt,
|
|
1225
|
+
__exportStar: Lt,
|
|
1226
|
+
__extends: At,
|
|
1227
|
+
__generator: jt,
|
|
1228
|
+
__importDefault: Yt,
|
|
1229
|
+
__importStar: zt,
|
|
1230
|
+
__makeTemplateObject: Gt,
|
|
1231
|
+
__metadata: Pt,
|
|
1232
|
+
__param: Tt,
|
|
1233
|
+
__propKey: Ct,
|
|
1234
|
+
__read: $e,
|
|
1235
|
+
__rest: _t,
|
|
1236
|
+
__rewriteRelativeImportExtension: Kt,
|
|
1237
|
+
__runInitializers: Nt,
|
|
1238
|
+
__setFunctionName: xt,
|
|
1239
|
+
__spread: kt,
|
|
1240
|
+
__spreadArray: Mt,
|
|
1241
|
+
__spreadArrays: Ft,
|
|
1242
|
+
__values: De,
|
|
1242
1243
|
default: ir
|
|
1243
1244
|
}, Symbol.toStringTag, { value: "Module" })), ur = /* @__PURE__ */ sr(cr);
|
|
1244
|
-
var
|
|
1245
|
+
var Ae = {}, ut;
|
|
1245
1246
|
function lr() {
|
|
1246
|
-
if (
|
|
1247
|
-
|
|
1248
|
-
var e =
|
|
1247
|
+
if (ut) return Ae;
|
|
1248
|
+
ut = 1, Object.defineProperty(Ae, "__esModule", { value: !0 });
|
|
1249
|
+
var e = fe;
|
|
1249
1250
|
function t() {
|
|
1250
1251
|
var n = e.useRef(!1), r = e.useCallback(function() {
|
|
1251
1252
|
return n.current;
|
|
@@ -1256,18 +1257,18 @@ function lr() {
|
|
|
1256
1257
|
};
|
|
1257
1258
|
}, []), r;
|
|
1258
1259
|
}
|
|
1259
|
-
return
|
|
1260
|
+
return Ae.default = t, Ae;
|
|
1260
1261
|
}
|
|
1261
|
-
Object.defineProperty(
|
|
1262
|
-
var
|
|
1262
|
+
Object.defineProperty(Ot, "__esModule", { value: !0 });
|
|
1263
|
+
var Ye = ur, Le = fe, dr = Ye.__importDefault(lr());
|
|
1263
1264
|
function fr(e, t, n) {
|
|
1264
1265
|
t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
|
|
1265
|
-
var r =
|
|
1266
|
+
var r = Le.useRef(0), s = dr.default(), o = Le.useState(n), a = o[0], d = o[1], g = Le.useCallback(function() {
|
|
1266
1267
|
for (var u = [], c = 0; c < arguments.length; c++)
|
|
1267
1268
|
u[c] = arguments[c];
|
|
1268
1269
|
var i = ++r.current;
|
|
1269
1270
|
return a.loading || d(function(m) {
|
|
1270
|
-
return
|
|
1271
|
+
return Ye.__assign(Ye.__assign({}, m), { loading: !0 });
|
|
1271
1272
|
}), e.apply(void 0, u).then(function(m) {
|
|
1272
1273
|
return s() && i === r.current && d({ value: m, loading: !1 }), m;
|
|
1273
1274
|
}, function(m) {
|
|
@@ -1276,16 +1277,16 @@ function fr(e, t, n) {
|
|
|
1276
1277
|
}, t);
|
|
1277
1278
|
return [a, g];
|
|
1278
1279
|
}
|
|
1279
|
-
var
|
|
1280
|
+
var ie = Ot.default = fr;
|
|
1280
1281
|
const pr = (e = 20) => {
|
|
1281
1282
|
const t = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
1282
1283
|
let n = "";
|
|
1283
1284
|
for (let r = 0; r < e; r++)
|
|
1284
1285
|
n += t[Math.floor(Math.random() * t.length)];
|
|
1285
1286
|
return n;
|
|
1286
|
-
},
|
|
1287
|
+
}, oe = /* @__PURE__ */ new Map();
|
|
1287
1288
|
function Os() {
|
|
1288
|
-
const [e, t] =
|
|
1289
|
+
const [e, t] = Je([]), { http: n } = le();
|
|
1289
1290
|
function r(c) {
|
|
1290
1291
|
const i = c.map((m) => ({
|
|
1291
1292
|
file: m,
|
|
@@ -1305,7 +1306,7 @@ function Os() {
|
|
|
1305
1306
|
}
|
|
1306
1307
|
const a = async (c) => {
|
|
1307
1308
|
const i = new AbortController();
|
|
1308
|
-
|
|
1309
|
+
oe.set(c.id, i);
|
|
1309
1310
|
try {
|
|
1310
1311
|
t(
|
|
1311
1312
|
(p) => p.map(
|
|
@@ -1334,17 +1335,17 @@ function Os() {
|
|
|
1334
1335
|
progress: 0
|
|
1335
1336
|
});
|
|
1336
1337
|
} finally {
|
|
1337
|
-
|
|
1338
|
+
oe.delete(c.id);
|
|
1338
1339
|
}
|
|
1339
1340
|
}, d = (c) => {
|
|
1340
|
-
const i =
|
|
1341
|
-
i && (i.abort(),
|
|
1342
|
-
}, g =
|
|
1341
|
+
const i = oe.get(c);
|
|
1342
|
+
i && (i.abort(), oe.delete(c)), o(c);
|
|
1343
|
+
}, g = ne(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
|
|
1343
1344
|
function u() {
|
|
1344
|
-
|
|
1345
|
+
oe.forEach((c) => c.abort()), oe.clear(), t([]);
|
|
1345
1346
|
}
|
|
1346
|
-
return
|
|
1347
|
-
|
|
1347
|
+
return de(() => () => {
|
|
1348
|
+
oe.forEach((c) => c.abort()), oe.clear();
|
|
1348
1349
|
}, []), {
|
|
1349
1350
|
allFiles: e,
|
|
1350
1351
|
appendFiles: r,
|
|
@@ -1364,14 +1365,14 @@ function Os() {
|
|
|
1364
1365
|
isUploading: e.some((c) => c.status === "uploading")
|
|
1365
1366
|
};
|
|
1366
1367
|
}
|
|
1367
|
-
var
|
|
1368
|
+
var xe = /* @__PURE__ */ ((e) => (e[e.OPEN = 0] = "OPEN", e[e.CLOSED_RESOLVED = 1] = "CLOSED_RESOLVED", e[e.CLOSED_UNRESOLVED = 2] = "CLOSED_UNRESOLVED", e))(xe || {}), Jt = /* @__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))(Jt || {}), et = /* @__PURE__ */ ((e) => (e.resolved = "resolved", e.assumed_resolved = "assumed_resolved", e.handed_off = "handed_off", e))(et || {}), Zt = /* @__PURE__ */ ((e) => (e.happy = "happy", e.neutral = "neutral", e.angry = "angry", e))(Zt || {}), $t = /* @__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))($t || {});
|
|
1368
1369
|
const gr = l.object({
|
|
1369
1370
|
id: l.string(),
|
|
1370
|
-
ai_closure_type: l.nativeEnum(
|
|
1371
|
+
ai_closure_type: l.nativeEnum(et).nullable(),
|
|
1371
1372
|
assignee_id: l.number().nullable(),
|
|
1372
|
-
channel: l.nativeEnum(
|
|
1373
|
+
channel: l.nativeEnum(Jt),
|
|
1373
1374
|
summary: l.string().nullable(),
|
|
1374
|
-
status: l.nativeEnum(
|
|
1375
|
+
status: l.nativeEnum(xe),
|
|
1375
1376
|
language: l.string().nullable(),
|
|
1376
1377
|
last_message: l.string().nullable(),
|
|
1377
1378
|
last_message_at: l.date().nullable(),
|
|
@@ -1380,7 +1381,7 @@ const gr = l.object({
|
|
|
1380
1381
|
email: l.string(),
|
|
1381
1382
|
avatar_url: l.string().optional()
|
|
1382
1383
|
}).nullable().optional(),
|
|
1383
|
-
sentiment: l.nativeEnum(
|
|
1384
|
+
sentiment: l.nativeEnum(Zt).nullable()
|
|
1384
1385
|
});
|
|
1385
1386
|
l.object({
|
|
1386
1387
|
publicId: l.string().uuid(),
|
|
@@ -1394,7 +1395,7 @@ l.object({
|
|
|
1394
1395
|
handoff_happened_during_office_hours: l.boolean().nullable(),
|
|
1395
1396
|
session_id: l.string(),
|
|
1396
1397
|
updated_at: l.string().nullable(),
|
|
1397
|
-
attachments: l.array(
|
|
1398
|
+
attachments: l.array(vt).optional()
|
|
1398
1399
|
});
|
|
1399
1400
|
const mr = l.object({
|
|
1400
1401
|
name: l.string(),
|
|
@@ -1404,7 +1405,7 @@ const mr = l.object({
|
|
|
1404
1405
|
}), hr = l.object({
|
|
1405
1406
|
type: l.literal("message"),
|
|
1406
1407
|
value: l.string(),
|
|
1407
|
-
attachments: l.array(
|
|
1408
|
+
attachments: l.array(vt).optional(),
|
|
1408
1409
|
is_stream_chunk: l.boolean().optional(),
|
|
1409
1410
|
server_session_id: l.string(),
|
|
1410
1411
|
client_message_id: l.string().optional(),
|
|
@@ -1426,7 +1427,7 @@ const mr = l.object({
|
|
|
1426
1427
|
}), vr = l.object({
|
|
1427
1428
|
type: l.literal("chat_event"),
|
|
1428
1429
|
value: l.object({
|
|
1429
|
-
event: l.nativeEnum(
|
|
1430
|
+
event: l.nativeEnum($t),
|
|
1430
1431
|
message: l.string()
|
|
1431
1432
|
})
|
|
1432
1433
|
}), Er = l.object({
|
|
@@ -1462,7 +1463,7 @@ l.object({
|
|
|
1462
1463
|
avatar_url: l.string().nullable(),
|
|
1463
1464
|
email: l.string().nullable()
|
|
1464
1465
|
});
|
|
1465
|
-
function
|
|
1466
|
+
function lt(e) {
|
|
1466
1467
|
var n, r, s;
|
|
1467
1468
|
const t = [];
|
|
1468
1469
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -1540,8 +1541,8 @@ function ut(e) {
|
|
|
1540
1541
|
return t;
|
|
1541
1542
|
}
|
|
1542
1543
|
function wr(e) {
|
|
1543
|
-
const t =
|
|
1544
|
-
return
|
|
1544
|
+
const t = ae(null);
|
|
1545
|
+
return de(() => {
|
|
1545
1546
|
if (!t.current) {
|
|
1546
1547
|
const n = new Audio(e.src);
|
|
1547
1548
|
n.volume = e.volume, n.loop = !1, n.preload = "auto", t.current = n;
|
|
@@ -1562,7 +1563,7 @@ function wr(e) {
|
|
|
1562
1563
|
};
|
|
1563
1564
|
}
|
|
1564
1565
|
function Or() {
|
|
1565
|
-
const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } =
|
|
1566
|
+
const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } = le(), r = (t == null ? void 0 : t.useSoundEffects) ?? n.useSoundEffects;
|
|
1566
1567
|
return {
|
|
1567
1568
|
messageArrivedSound: wr({
|
|
1568
1569
|
src: e.messageArrived,
|
|
@@ -1626,23 +1627,23 @@ function Rr({
|
|
|
1626
1627
|
persist: e,
|
|
1627
1628
|
sessionKey: t = (n, { external_id: r }) => `[OPEN_SESSION_${n}]_${r || "session"}`
|
|
1628
1629
|
}) {
|
|
1629
|
-
const { botToken: n, http: r, user: s } =
|
|
1630
|
+
const { botToken: n, http: r, user: s } = le(), [o, a, d] = Ze(
|
|
1630
1631
|
t(n, s),
|
|
1631
1632
|
void 0,
|
|
1632
1633
|
e ? "local" : "memory"
|
|
1633
1634
|
), g = (f) => ({
|
|
1634
1635
|
...f,
|
|
1635
|
-
isSessionClosed: f.status !==
|
|
1636
|
+
isSessionClosed: f.status !== xe.OPEN,
|
|
1636
1637
|
isAssignedToAi: f.assignee_id === 555,
|
|
1637
1638
|
isAssignedToHuman: f.assignee_id !== 555,
|
|
1638
|
-
isPendingHuman: f.assignee_id === 555 && f.ai_closure_type ===
|
|
1639
|
-
}), u =
|
|
1639
|
+
isPendingHuman: f.assignee_id === 555 && f.ai_closure_type === et.handed_off
|
|
1640
|
+
}), u = ne(() => o ? g(o) : null, [o]), [c, i] = ie(
|
|
1640
1641
|
async (f) => {
|
|
1641
1642
|
let v = await r.apis.fetchSession(f);
|
|
1642
1643
|
return v.data && a(v.data), v.data;
|
|
1643
1644
|
},
|
|
1644
1645
|
[r, a]
|
|
1645
|
-
), [m, p] =
|
|
1646
|
+
), [m, p] = ie(
|
|
1646
1647
|
async (f) => {
|
|
1647
1648
|
try {
|
|
1648
1649
|
const v = await i(f);
|
|
@@ -1671,40 +1672,40 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1671
1672
|
lastUpdated: null,
|
|
1672
1673
|
messages: [],
|
|
1673
1674
|
keyboard: null
|
|
1674
|
-
}), [r, s] =
|
|
1675
|
+
}), [r, s] = Je({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: d, widgetSettings: g, defaultSettings: u, language: c, ...i } = le(), { messageArrivedSound: m } = Or(), p = (g == null ? void 0 : g.persistSession) || u.persistSession, { refreshSession: y, session: f, deleteSession: v, setSession: h, pollSession: B } = Rr({
|
|
1675
1676
|
persist: p
|
|
1676
|
-
}), [
|
|
1677
|
-
async (
|
|
1677
|
+
}), [T, S] = ie(
|
|
1678
|
+
async (A) => {
|
|
1678
1679
|
if (!f) return [];
|
|
1679
1680
|
try {
|
|
1680
|
-
const { data: N } = await d.apis.fetchHistory(
|
|
1681
|
-
return N ? Array.isArray(N) ?
|
|
1681
|
+
const { data: N } = await d.apis.fetchHistory(A);
|
|
1682
|
+
return N ? Array.isArray(N) ? lt(N) : [] : [];
|
|
1682
1683
|
} catch (N) {
|
|
1683
1684
|
throw console.error("Error fetching history:", N), N;
|
|
1684
1685
|
}
|
|
1685
1686
|
},
|
|
1686
1687
|
[f, d.apis]
|
|
1687
|
-
), [
|
|
1688
|
-
async (
|
|
1688
|
+
), [w, E] = ie(
|
|
1689
|
+
async (A, N) => {
|
|
1689
1690
|
try {
|
|
1690
1691
|
const M = await d.apis.getHistoryPooling({
|
|
1691
|
-
sessionId:
|
|
1692
|
+
sessionId: A,
|
|
1692
1693
|
lastMessageTimestamp: N
|
|
1693
1694
|
});
|
|
1694
1695
|
if (M.data) {
|
|
1695
|
-
const
|
|
1696
|
-
if (
|
|
1696
|
+
const U = lt(M.data);
|
|
1697
|
+
if (U.length > 0) {
|
|
1697
1698
|
n({
|
|
1698
1699
|
type: "APPEND_MESSAGES",
|
|
1699
|
-
payload:
|
|
1700
|
+
payload: U
|
|
1700
1701
|
});
|
|
1701
1702
|
try {
|
|
1702
1703
|
m.play();
|
|
1703
|
-
} catch (
|
|
1704
|
-
console.error("Error playing sound:",
|
|
1704
|
+
} catch (G) {
|
|
1705
|
+
console.error("Error playing sound:", G);
|
|
1705
1706
|
}
|
|
1706
1707
|
}
|
|
1707
|
-
return
|
|
1708
|
+
return U;
|
|
1708
1709
|
}
|
|
1709
1710
|
return [];
|
|
1710
1711
|
} catch (M) {
|
|
@@ -1713,89 +1714,137 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1713
1714
|
},
|
|
1714
1715
|
[d.apis, n, m]
|
|
1715
1716
|
);
|
|
1716
|
-
|
|
1717
|
-
let
|
|
1718
|
-
return f && (
|
|
1717
|
+
de(() => {
|
|
1718
|
+
let A;
|
|
1719
|
+
return f && (A = setInterval(() => {
|
|
1719
1720
|
var M;
|
|
1720
|
-
|
|
1721
|
+
B(f.id);
|
|
1721
1722
|
const N = (M = t.messages.at(-1)) == null ? void 0 : M.timestamp;
|
|
1722
1723
|
N && E(f.id, N);
|
|
1723
1724
|
}, Ar)), () => {
|
|
1724
|
-
clearInterval(
|
|
1725
|
+
clearInterval(A);
|
|
1725
1726
|
};
|
|
1726
|
-
}, [f,
|
|
1727
|
-
const [F,
|
|
1727
|
+
}, [f, B, E]);
|
|
1728
|
+
const [F, O] = ie(
|
|
1728
1729
|
async () => {
|
|
1729
1730
|
if (f)
|
|
1730
1731
|
try {
|
|
1731
|
-
const
|
|
1732
|
-
if (
|
|
1733
|
-
const N = await S(
|
|
1732
|
+
const A = await y(f.id);
|
|
1733
|
+
if (A) {
|
|
1734
|
+
const N = await S(A.id);
|
|
1734
1735
|
N && n({ type: "PREPEND_HISTORY", payload: N });
|
|
1735
1736
|
}
|
|
1736
|
-
} catch (
|
|
1737
|
-
throw console.error("Error initializing session:",
|
|
1737
|
+
} catch (A) {
|
|
1738
|
+
throw console.error("Error initializing session:", A), A;
|
|
1738
1739
|
}
|
|
1739
1740
|
},
|
|
1740
1741
|
[f, y, S, n]
|
|
1741
1742
|
);
|
|
1742
|
-
|
|
1743
|
-
|
|
1743
|
+
de(() => {
|
|
1744
|
+
O();
|
|
1744
1745
|
}, []);
|
|
1745
|
-
const [x, P] =
|
|
1746
|
+
const [x, P] = ie(
|
|
1746
1747
|
async () => {
|
|
1747
1748
|
try {
|
|
1748
1749
|
v(), n({ type: "RESET" }), e == null || e(), s({ state: "idle" });
|
|
1749
|
-
} catch (
|
|
1750
|
-
throw console.error("Error clearing session:",
|
|
1750
|
+
} catch (A) {
|
|
1751
|
+
throw console.error("Error clearing session:", A), A;
|
|
1751
1752
|
}
|
|
1752
1753
|
},
|
|
1753
1754
|
[v, n, e, s]
|
|
1754
|
-
), [
|
|
1755
|
+
), [X, K] = ie(
|
|
1755
1756
|
async () => {
|
|
1756
1757
|
try {
|
|
1757
1758
|
await P();
|
|
1758
|
-
const { data:
|
|
1759
|
-
return h(
|
|
1760
|
-
} catch (
|
|
1761
|
-
throw console.error("Error recreating session:",
|
|
1759
|
+
const { data: A } = await d.apis.createSession(a);
|
|
1760
|
+
return h(A), A;
|
|
1761
|
+
} catch (A) {
|
|
1762
|
+
throw console.error("Error recreating session:", A), A;
|
|
1762
1763
|
}
|
|
1763
1764
|
},
|
|
1764
1765
|
[P, d.apis, a, h]
|
|
1765
|
-
), L = async ({ content:
|
|
1766
|
-
var ue;
|
|
1766
|
+
), L = async ({ content: A, user: N, attachments: M, ...U }) => {
|
|
1767
1767
|
try {
|
|
1768
|
-
let
|
|
1768
|
+
let G = function() {
|
|
1769
|
+
var D;
|
|
1770
|
+
if (se.data.success) {
|
|
1771
|
+
const q = se.data;
|
|
1772
|
+
if (q.uiResponse) {
|
|
1773
|
+
const Oe = q.uiResponse.value;
|
|
1774
|
+
n({
|
|
1775
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1776
|
+
payload: {
|
|
1777
|
+
type: "FROM_BOT",
|
|
1778
|
+
id: ve(),
|
|
1779
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1780
|
+
component: Oe.name,
|
|
1781
|
+
data: Oe.request_response
|
|
1782
|
+
}
|
|
1783
|
+
});
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1786
|
+
if (q.autopilotResponse) {
|
|
1787
|
+
n({
|
|
1788
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1789
|
+
payload: {
|
|
1790
|
+
type: "FROM_BOT",
|
|
1791
|
+
id: q.autopilotResponse.id || ve(),
|
|
1792
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1793
|
+
component: "TEXT",
|
|
1794
|
+
data: {
|
|
1795
|
+
message: q.autopilotResponse.value.content
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
});
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
} else {
|
|
1802
|
+
const q = ((D = se.data.error) == null ? void 0 : D.message) || "Unknown error occurred";
|
|
1803
|
+
n({
|
|
1804
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1805
|
+
payload: {
|
|
1806
|
+
type: "FROM_BOT",
|
|
1807
|
+
id: ve(),
|
|
1808
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1809
|
+
component: "TEXT",
|
|
1810
|
+
data: {
|
|
1811
|
+
message: q,
|
|
1812
|
+
variant: "error"
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
}), s({ state: "error", error: q });
|
|
1816
|
+
}
|
|
1817
|
+
}, z = f, J = !1;
|
|
1769
1818
|
if ((!f || f != null && f.isAssignedToAi) && s({ state: "loading" }), !f && o)
|
|
1770
1819
|
try {
|
|
1771
|
-
const { data:
|
|
1772
|
-
if (
|
|
1773
|
-
h(
|
|
1774
|
-
...
|
|
1775
|
-
isSessionClosed:
|
|
1776
|
-
isAssignedToAi:
|
|
1820
|
+
const { data: D } = await d.apis.createSession(a);
|
|
1821
|
+
if (D)
|
|
1822
|
+
h(D), z = {
|
|
1823
|
+
...D,
|
|
1824
|
+
isSessionClosed: D.status !== xe.OPEN,
|
|
1825
|
+
isAssignedToAi: D.assignee_id === 555,
|
|
1777
1826
|
isAssignedToHuman: !1,
|
|
1778
1827
|
isPendingHuman: !1
|
|
1779
|
-
},
|
|
1828
|
+
}, J = !0;
|
|
1780
1829
|
else
|
|
1781
1830
|
throw new Error("Failed to create new chat session");
|
|
1782
|
-
} catch (
|
|
1831
|
+
} catch (D) {
|
|
1783
1832
|
throw s({
|
|
1784
1833
|
state: "error",
|
|
1785
|
-
error:
|
|
1786
|
-
}),
|
|
1834
|
+
error: D instanceof Error ? D.message : "Failed to create session"
|
|
1835
|
+
}), D;
|
|
1787
1836
|
}
|
|
1788
|
-
if (!
|
|
1789
|
-
const
|
|
1790
|
-
throw s({ state: "error", error:
|
|
1837
|
+
if (!z) {
|
|
1838
|
+
const D = new Error("No active session available");
|
|
1839
|
+
throw s({ state: "error", error: D.message }), D;
|
|
1791
1840
|
}
|
|
1792
|
-
const Y = ve(), { headers:
|
|
1841
|
+
const Y = ve(), { headers: pe, queryParams: we } = i;
|
|
1793
1842
|
if (n({
|
|
1794
1843
|
type: "APPEND_USER_MESSAGE",
|
|
1795
1844
|
payload: {
|
|
1796
1845
|
type: "FROM_USER",
|
|
1797
1846
|
id: Y,
|
|
1798
|
-
content:
|
|
1847
|
+
content: A.text,
|
|
1799
1848
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1800
1849
|
user: {
|
|
1801
1850
|
...i.user,
|
|
@@ -1807,19 +1856,19 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1807
1856
|
}), t.keyboard && n({
|
|
1808
1857
|
type: "SET_KEYBOARD",
|
|
1809
1858
|
payload: null
|
|
1810
|
-
}), !
|
|
1859
|
+
}), !J && z.isAssignedToAi)
|
|
1811
1860
|
try {
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1814
|
-
} catch (
|
|
1815
|
-
console.error("Error polling session:",
|
|
1861
|
+
const D = await B(z.id);
|
|
1862
|
+
D && (z = D);
|
|
1863
|
+
} catch (D) {
|
|
1864
|
+
console.error("Error polling session:", D);
|
|
1816
1865
|
}
|
|
1817
|
-
const
|
|
1866
|
+
const se = await d.apis.sendMessage({
|
|
1818
1867
|
id: Y,
|
|
1819
|
-
content:
|
|
1820
|
-
session_id:
|
|
1868
|
+
content: A.text,
|
|
1869
|
+
session_id: z.id,
|
|
1821
1870
|
bot_token: a,
|
|
1822
|
-
headers:
|
|
1871
|
+
headers: pe,
|
|
1823
1872
|
query_params: we,
|
|
1824
1873
|
user: {
|
|
1825
1874
|
...i.user,
|
|
@@ -1827,66 +1876,24 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1827
1876
|
},
|
|
1828
1877
|
language: c,
|
|
1829
1878
|
attachments: M,
|
|
1830
|
-
...
|
|
1879
|
+
...U
|
|
1831
1880
|
});
|
|
1832
|
-
|
|
1881
|
+
return n({
|
|
1833
1882
|
type: "SET_DELIVERED_AT",
|
|
1834
1883
|
payload: {
|
|
1835
1884
|
clientMessageId: Y,
|
|
1836
1885
|
deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1837
1886
|
}
|
|
1838
|
-
}),
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
payload: {
|
|
1843
|
-
type: "FROM_BOT",
|
|
1844
|
-
id: w.autopilotResponse.id || ve(),
|
|
1845
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1846
|
-
component: "TEXT",
|
|
1847
|
-
data: {
|
|
1848
|
-
message: w.autopilotResponse.value.content
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
}), w.uiResponse) {
|
|
1852
|
-
const he = w.uiResponse.value;
|
|
1853
|
-
n({
|
|
1854
|
-
type: "ADD_RESPONSE_MESSAGE",
|
|
1855
|
-
payload: {
|
|
1856
|
-
type: "FROM_BOT",
|
|
1857
|
-
id: ve(),
|
|
1858
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1859
|
-
component: he.name,
|
|
1860
|
-
data: he.request_response
|
|
1861
|
-
}
|
|
1862
|
-
});
|
|
1863
|
-
}
|
|
1864
|
-
} else {
|
|
1865
|
-
const w = ((ue = ne.data.error) == null ? void 0 : ue.message) || "Unknown error occurred";
|
|
1866
|
-
n({
|
|
1867
|
-
type: "ADD_RESPONSE_MESSAGE",
|
|
1868
|
-
payload: {
|
|
1869
|
-
type: "FROM_BOT",
|
|
1870
|
-
id: ve(),
|
|
1871
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1872
|
-
component: "TEXT",
|
|
1873
|
-
data: {
|
|
1874
|
-
message: w,
|
|
1875
|
-
variant: "error"
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
}), s({ state: "error", error: w });
|
|
1879
|
-
}
|
|
1880
|
-
return s({ state: "idle" }), { id: Y };
|
|
1881
|
-
} catch (U) {
|
|
1882
|
-
const G = U instanceof Error ? U.message : "An unexpected error occurred";
|
|
1883
|
-
throw console.error("Error in sendMessage:", G, U), (!f || f != null && f.isAssignedToAi) && s({ state: "error", error: G }), U;
|
|
1887
|
+
}), G(), s({ state: "idle" }), { id: Y };
|
|
1888
|
+
} catch (G) {
|
|
1889
|
+
const z = G instanceof Error ? G.message : "An unexpected error occurred";
|
|
1890
|
+
throw console.error("Error in sendMessage:", z, G), (!f || f != null && f.isAssignedToAi) && s({ state: "error", error: z }), G;
|
|
1884
1891
|
}
|
|
1885
|
-
},
|
|
1886
|
-
(
|
|
1892
|
+
}, re = me(
|
|
1893
|
+
(A) => {
|
|
1887
1894
|
L({
|
|
1888
1895
|
content: {
|
|
1889
|
-
text:
|
|
1896
|
+
text: A
|
|
1890
1897
|
}
|
|
1891
1898
|
}).catch((N) => {
|
|
1892
1899
|
console.error("Error handling keyboard input:", N);
|
|
@@ -1904,32 +1911,32 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1904
1911
|
noMessages: o,
|
|
1905
1912
|
initState: F,
|
|
1906
1913
|
clearSessionState: x,
|
|
1907
|
-
recreateSessionState:
|
|
1914
|
+
recreateSessionState: X,
|
|
1908
1915
|
hookState: r,
|
|
1909
|
-
recreateSession:
|
|
1916
|
+
recreateSession: K,
|
|
1910
1917
|
clearSession: P,
|
|
1911
1918
|
sendMessage: L,
|
|
1912
|
-
handleKeyboard:
|
|
1919
|
+
handleKeyboard: re
|
|
1913
1920
|
};
|
|
1914
1921
|
}
|
|
1915
|
-
const [As, Dr] =
|
|
1922
|
+
const [As, Dr] = Ne();
|
|
1916
1923
|
function Nr({
|
|
1917
1924
|
children: e
|
|
1918
1925
|
}) {
|
|
1919
|
-
const { settings: t } =
|
|
1926
|
+
const { settings: t } = le(), n = Tr({
|
|
1920
1927
|
defaultHookSettings: {
|
|
1921
1928
|
persistSession: (t == null ? void 0 : t.persistSession) ?? !0,
|
|
1922
1929
|
useSoundEffects: (t == null ? void 0 : t.useSoundEffects) ?? !1
|
|
1923
1930
|
}
|
|
1924
1931
|
});
|
|
1925
|
-
return /* @__PURE__ */
|
|
1932
|
+
return /* @__PURE__ */ te(Dr, { value: n, children: e });
|
|
1926
1933
|
}
|
|
1927
1934
|
function Cr() {
|
|
1928
|
-
const { http: e, botToken: t, user: n, collectUserData: r } =
|
|
1935
|
+
const { http: e, botToken: t, user: n, collectUserData: r } = le(), [s, o] = Ze(
|
|
1929
1936
|
`${t}:contact:${n.external_id}`,
|
|
1930
1937
|
null,
|
|
1931
1938
|
"local"
|
|
1932
|
-
), [a, d] =
|
|
1939
|
+
), [a, d] = ie(
|
|
1933
1940
|
async (u) => {
|
|
1934
1941
|
var c;
|
|
1935
1942
|
try {
|
|
@@ -1943,10 +1950,10 @@ function Cr() {
|
|
|
1943
1950
|
},
|
|
1944
1951
|
[e.apis]
|
|
1945
1952
|
);
|
|
1946
|
-
|
|
1953
|
+
de(() => {
|
|
1947
1954
|
n && t && d(n);
|
|
1948
1955
|
}, [n, t]);
|
|
1949
|
-
const g =
|
|
1956
|
+
const g = ne(() => !(s != null && s.id) && r ? {
|
|
1950
1957
|
should: !0,
|
|
1951
1958
|
reason: "No contact id and collectUserData is true"
|
|
1952
1959
|
} : {
|
|
@@ -1959,18 +1966,18 @@ function Cr() {
|
|
|
1959
1966
|
shouldCollectData: g
|
|
1960
1967
|
};
|
|
1961
1968
|
}
|
|
1962
|
-
const [_s, xr] =
|
|
1969
|
+
const [_s, xr] = Ne();
|
|
1963
1970
|
function Pr({ children: e }) {
|
|
1964
1971
|
const t = Cr();
|
|
1965
|
-
return /* @__PURE__ */
|
|
1972
|
+
return /* @__PURE__ */ te(xr, { value: t, children: e });
|
|
1966
1973
|
}
|
|
1967
1974
|
function Rs({
|
|
1968
1975
|
children: e,
|
|
1969
1976
|
options: t
|
|
1970
1977
|
}) {
|
|
1971
|
-
return /* @__PURE__ */
|
|
1978
|
+
return /* @__PURE__ */ te(rr, { data: t, children: /* @__PURE__ */ te(Pr, { children: /* @__PURE__ */ te(wt, { children: /* @__PURE__ */ te(Nr, { children: e }) }) }) });
|
|
1972
1979
|
}
|
|
1973
|
-
var
|
|
1980
|
+
var qe = { exports: {} }, ke = {};
|
|
1974
1981
|
/**
|
|
1975
1982
|
* @license React
|
|
1976
1983
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -1980,11 +1987,11 @@ var Ye = { exports: {} }, Le = {};
|
|
|
1980
1987
|
* This source code is licensed under the MIT license found in the
|
|
1981
1988
|
* LICENSE file in the root directory of this source tree.
|
|
1982
1989
|
*/
|
|
1983
|
-
var
|
|
1990
|
+
var dt;
|
|
1984
1991
|
function Ir() {
|
|
1985
|
-
if (
|
|
1986
|
-
|
|
1987
|
-
var e =
|
|
1992
|
+
if (dt) return ke;
|
|
1993
|
+
dt = 1;
|
|
1994
|
+
var e = fe;
|
|
1988
1995
|
function t(i, m) {
|
|
1989
1996
|
return i === m && (i !== 0 || 1 / i === 1 / m) || i !== i && m !== m;
|
|
1990
1997
|
}
|
|
@@ -2013,9 +2020,9 @@ function Ir() {
|
|
|
2013
2020
|
return m();
|
|
2014
2021
|
}
|
|
2015
2022
|
var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : d;
|
|
2016
|
-
return
|
|
2023
|
+
return ke.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : c, ke;
|
|
2017
2024
|
}
|
|
2018
|
-
var
|
|
2025
|
+
var Fe = {};
|
|
2019
2026
|
/**
|
|
2020
2027
|
* @license React
|
|
2021
2028
|
* use-sync-external-store-shim.development.js
|
|
@@ -2025,146 +2032,146 @@ var ke = {};
|
|
|
2025
2032
|
* This source code is licensed under the MIT license found in the
|
|
2026
2033
|
* LICENSE file in the root directory of this source tree.
|
|
2027
2034
|
*/
|
|
2028
|
-
var
|
|
2035
|
+
var ft;
|
|
2029
2036
|
function jr() {
|
|
2030
|
-
return
|
|
2037
|
+
return ft || (ft = 1, process.env.NODE_ENV !== "production" && function() {
|
|
2031
2038
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
2032
|
-
var e =
|
|
2033
|
-
function n(
|
|
2039
|
+
var e = fe, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
2040
|
+
function n(T) {
|
|
2034
2041
|
{
|
|
2035
|
-
for (var S = arguments.length,
|
|
2036
|
-
|
|
2037
|
-
r("error",
|
|
2042
|
+
for (var S = arguments.length, w = new Array(S > 1 ? S - 1 : 0), E = 1; E < S; E++)
|
|
2043
|
+
w[E - 1] = arguments[E];
|
|
2044
|
+
r("error", T, w);
|
|
2038
2045
|
}
|
|
2039
2046
|
}
|
|
2040
|
-
function r(
|
|
2047
|
+
function r(T, S, w) {
|
|
2041
2048
|
{
|
|
2042
2049
|
var E = t.ReactDebugCurrentFrame, F = E.getStackAddendum();
|
|
2043
|
-
F !== "" && (S += "%s",
|
|
2044
|
-
var
|
|
2050
|
+
F !== "" && (S += "%s", w = w.concat([F]));
|
|
2051
|
+
var O = w.map(function(x) {
|
|
2045
2052
|
return String(x);
|
|
2046
2053
|
});
|
|
2047
|
-
|
|
2054
|
+
O.unshift("Warning: " + S), Function.prototype.apply.call(console[T], console, O);
|
|
2048
2055
|
}
|
|
2049
2056
|
}
|
|
2050
|
-
function s(
|
|
2051
|
-
return
|
|
2057
|
+
function s(T, S) {
|
|
2058
|
+
return T === S && (T !== 0 || 1 / T === 1 / S) || T !== T && S !== S;
|
|
2052
2059
|
}
|
|
2053
2060
|
var o = typeof Object.is == "function" ? Object.is : s, a = e.useState, d = e.useEffect, g = e.useLayoutEffect, u = e.useDebugValue, c = !1, i = !1;
|
|
2054
|
-
function m(
|
|
2061
|
+
function m(T, S, w) {
|
|
2055
2062
|
c || e.startTransition !== void 0 && (c = !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."));
|
|
2056
2063
|
var E = S();
|
|
2057
2064
|
if (!i) {
|
|
2058
2065
|
var F = S();
|
|
2059
2066
|
o(E, F) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), i = !0);
|
|
2060
2067
|
}
|
|
2061
|
-
var
|
|
2068
|
+
var O = a({
|
|
2062
2069
|
inst: {
|
|
2063
2070
|
value: E,
|
|
2064
2071
|
getSnapshot: S
|
|
2065
2072
|
}
|
|
2066
|
-
}), x =
|
|
2073
|
+
}), x = O[0].inst, P = O[1];
|
|
2067
2074
|
return g(function() {
|
|
2068
2075
|
x.value = E, x.getSnapshot = S, p(x) && P({
|
|
2069
2076
|
inst: x
|
|
2070
2077
|
});
|
|
2071
|
-
}, [
|
|
2078
|
+
}, [T, E, S]), d(function() {
|
|
2072
2079
|
p(x) && P({
|
|
2073
2080
|
inst: x
|
|
2074
2081
|
});
|
|
2075
|
-
var
|
|
2082
|
+
var X = function() {
|
|
2076
2083
|
p(x) && P({
|
|
2077
2084
|
inst: x
|
|
2078
2085
|
});
|
|
2079
2086
|
};
|
|
2080
|
-
return
|
|
2081
|
-
}, [
|
|
2087
|
+
return T(X);
|
|
2088
|
+
}, [T]), u(E), E;
|
|
2082
2089
|
}
|
|
2083
|
-
function p(
|
|
2084
|
-
var S =
|
|
2090
|
+
function p(T) {
|
|
2091
|
+
var S = T.getSnapshot, w = T.value;
|
|
2085
2092
|
try {
|
|
2086
2093
|
var E = S();
|
|
2087
|
-
return !o(
|
|
2094
|
+
return !o(w, E);
|
|
2088
2095
|
} catch {
|
|
2089
2096
|
return !0;
|
|
2090
2097
|
}
|
|
2091
2098
|
}
|
|
2092
|
-
function y(
|
|
2099
|
+
function y(T, S, w) {
|
|
2093
2100
|
return S();
|
|
2094
2101
|
}
|
|
2095
|
-
var f = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !f, h = v ? y : m,
|
|
2096
|
-
|
|
2097
|
-
}()),
|
|
2102
|
+
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;
|
|
2103
|
+
Fe.useSyncExternalStore = B, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2104
|
+
}()), Fe;
|
|
2098
2105
|
}
|
|
2099
|
-
process.env.NODE_ENV === "production" ?
|
|
2100
|
-
var Lr =
|
|
2101
|
-
const
|
|
2106
|
+
process.env.NODE_ENV === "production" ? qe.exports = Ir() : qe.exports = jr();
|
|
2107
|
+
var Lr = qe.exports;
|
|
2108
|
+
const ce = () => {
|
|
2102
2109
|
}, V = (
|
|
2103
2110
|
/*#__NOINLINE__*/
|
|
2104
|
-
|
|
2105
|
-
),
|
|
2111
|
+
ce()
|
|
2112
|
+
), Me = Object, b = (e) => e === V, W = (e) => typeof e == "function", ue = (e, t) => ({
|
|
2106
2113
|
...e,
|
|
2107
2114
|
...t
|
|
2108
|
-
}), kr = (e) =>
|
|
2115
|
+
}), kr = (e) => W(e.then), _e = /* @__PURE__ */ new WeakMap();
|
|
2109
2116
|
let Fr = 0;
|
|
2110
2117
|
const Ee = (e) => {
|
|
2111
2118
|
const t = typeof e, n = e && e.constructor, r = n == Date;
|
|
2112
2119
|
let s, o;
|
|
2113
|
-
if (
|
|
2114
|
-
if (s =
|
|
2115
|
-
if (s = ++Fr + "~",
|
|
2120
|
+
if (Me(e) === e && !r && n != RegExp) {
|
|
2121
|
+
if (s = _e.get(e), s) return s;
|
|
2122
|
+
if (s = ++Fr + "~", _e.set(e, s), n == Array) {
|
|
2116
2123
|
for (s = "@", o = 0; o < e.length; o++)
|
|
2117
2124
|
s += Ee(e[o]) + ",";
|
|
2118
|
-
|
|
2125
|
+
_e.set(e, s);
|
|
2119
2126
|
}
|
|
2120
|
-
if (n ==
|
|
2127
|
+
if (n == Me) {
|
|
2121
2128
|
s = "#";
|
|
2122
|
-
const a =
|
|
2129
|
+
const a = Me.keys(e).sort();
|
|
2123
2130
|
for (; !b(o = a.pop()); )
|
|
2124
2131
|
b(e[o]) || (s += o + ":" + Ee(e[o]) + ",");
|
|
2125
|
-
|
|
2132
|
+
_e.set(e, s);
|
|
2126
2133
|
}
|
|
2127
2134
|
} else
|
|
2128
2135
|
s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
2129
2136
|
return s;
|
|
2130
|
-
},
|
|
2131
|
-
const n =
|
|
2137
|
+
}, ee = /* @__PURE__ */ new WeakMap(), Ve = {}, Re = {}, tt = "undefined", Pe = typeof window != tt, Be = typeof document != tt, Mr = () => Pe && typeof window.requestAnimationFrame != tt, en = (e, t) => {
|
|
2138
|
+
const n = ee.get(e);
|
|
2132
2139
|
return [
|
|
2133
2140
|
// Getter
|
|
2134
|
-
() => !b(t) && e.get(t) ||
|
|
2141
|
+
() => !b(t) && e.get(t) || Ve,
|
|
2135
2142
|
// Setter
|
|
2136
2143
|
(r) => {
|
|
2137
2144
|
if (!b(t)) {
|
|
2138
2145
|
const s = e.get(t);
|
|
2139
|
-
t in
|
|
2146
|
+
t in Re || (Re[t] = s), n[5](t, ue(s, r), s || Ve);
|
|
2140
2147
|
}
|
|
2141
2148
|
},
|
|
2142
2149
|
// Subscriber
|
|
2143
2150
|
n[6],
|
|
2144
2151
|
// Get server cache snapshot
|
|
2145
|
-
() => !b(t) && t in
|
|
2152
|
+
() => !b(t) && t in Re ? Re[t] : !b(t) && e.get(t) || Ve
|
|
2146
2153
|
];
|
|
2147
2154
|
};
|
|
2148
|
-
let
|
|
2149
|
-
const Vr = () =>
|
|
2155
|
+
let Xe = !0;
|
|
2156
|
+
const Vr = () => Xe, [Qe, We] = Pe && window.addEventListener ? [
|
|
2150
2157
|
window.addEventListener.bind(window),
|
|
2151
2158
|
window.removeEventListener.bind(window)
|
|
2152
2159
|
] : [
|
|
2153
|
-
|
|
2154
|
-
|
|
2160
|
+
ce,
|
|
2161
|
+
ce
|
|
2155
2162
|
], Ur = () => {
|
|
2156
|
-
const e =
|
|
2163
|
+
const e = Be && document.visibilityState;
|
|
2157
2164
|
return b(e) || e !== "hidden";
|
|
2158
|
-
}, Hr = (e) => (
|
|
2159
|
-
|
|
2165
|
+
}, Hr = (e) => (Be && document.addEventListener("visibilitychange", e), Qe("focus", e), () => {
|
|
2166
|
+
Be && document.removeEventListener("visibilitychange", e), We("focus", e);
|
|
2160
2167
|
}), Gr = (e) => {
|
|
2161
2168
|
const t = () => {
|
|
2162
|
-
|
|
2169
|
+
Xe = !0, e();
|
|
2163
2170
|
}, n = () => {
|
|
2164
|
-
|
|
2171
|
+
Xe = !1;
|
|
2165
2172
|
};
|
|
2166
|
-
return
|
|
2167
|
-
|
|
2173
|
+
return Qe("online", t), Qe("offline", n), () => {
|
|
2174
|
+
We("online", t), We("offline", n);
|
|
2168
2175
|
};
|
|
2169
2176
|
}, zr = {
|
|
2170
2177
|
isOnline: Vr,
|
|
@@ -2172,11 +2179,11 @@ const Vr = () => Be, [Xe, Qe] = xe && window.addEventListener ? [
|
|
|
2172
2179
|
}, Yr = {
|
|
2173
2180
|
initFocus: Hr,
|
|
2174
2181
|
initReconnect: Gr
|
|
2175
|
-
},
|
|
2182
|
+
}, pt = !fe.useId, be = !Pe || "Deno" in window, qr = (e) => Mr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ue = be ? de : pn, He = typeof navigator < "u" && navigator.connection, gt = !be && He && ([
|
|
2176
2183
|
"slow-2g",
|
|
2177
2184
|
"2g"
|
|
2178
|
-
].includes(
|
|
2179
|
-
if (
|
|
2185
|
+
].includes(He.effectiveType) || He.saveData), nt = (e) => {
|
|
2186
|
+
if (W(e))
|
|
2180
2187
|
try {
|
|
2181
2188
|
e = e();
|
|
2182
2189
|
} catch {
|
|
@@ -2189,16 +2196,16 @@ const Vr = () => Be, [Xe, Qe] = xe && window.addEventListener ? [
|
|
|
2189
2196
|
];
|
|
2190
2197
|
};
|
|
2191
2198
|
let Br = 0;
|
|
2192
|
-
const
|
|
2199
|
+
const Ke = () => ++Br, tn = 0, nn = 1, rn = 2, Xr = 3;
|
|
2193
2200
|
var Se = {
|
|
2194
2201
|
__proto__: null,
|
|
2195
2202
|
ERROR_REVALIDATE_EVENT: Xr,
|
|
2196
|
-
FOCUS_EVENT:
|
|
2197
|
-
MUTATE_EVENT:
|
|
2198
|
-
RECONNECT_EVENT:
|
|
2203
|
+
FOCUS_EVENT: tn,
|
|
2204
|
+
MUTATE_EVENT: rn,
|
|
2205
|
+
RECONNECT_EVENT: nn
|
|
2199
2206
|
};
|
|
2200
|
-
async function
|
|
2201
|
-
const [t, n, r, s] = e, o =
|
|
2207
|
+
async function sn(...e) {
|
|
2208
|
+
const [t, n, r, s] = e, o = ue({
|
|
2202
2209
|
populateCache: !0,
|
|
2203
2210
|
throwOnError: !0
|
|
2204
2211
|
}, typeof s == "boolean" ? {
|
|
@@ -2208,7 +2215,7 @@ async function rn(...e) {
|
|
|
2208
2215
|
const d = o.rollbackOnError;
|
|
2209
2216
|
let g = o.optimisticData;
|
|
2210
2217
|
const u = (m) => typeof d == "function" ? d(m) : d !== !1, c = o.throwOnError;
|
|
2211
|
-
if (
|
|
2218
|
+
if (W(n)) {
|
|
2212
2219
|
const m = n, p = [], y = t.keys();
|
|
2213
2220
|
for (const f of y)
|
|
2214
2221
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
@@ -2217,43 +2224,43 @@ async function rn(...e) {
|
|
|
2217
2224
|
}
|
|
2218
2225
|
return i(n);
|
|
2219
2226
|
async function i(m) {
|
|
2220
|
-
const [p] =
|
|
2227
|
+
const [p] = nt(m);
|
|
2221
2228
|
if (!p) return;
|
|
2222
|
-
const [y, f] =
|
|
2229
|
+
const [y, f] = en(t, p), [v, h, B, T] = ee.get(t), S = () => {
|
|
2223
2230
|
const L = v[p];
|
|
2224
|
-
return (
|
|
2231
|
+
return (W(o.revalidate) ? o.revalidate(y().data, m) : o.revalidate !== !1) && (delete B[p], delete T[p], L && L[0]) ? L[0](rn).then(() => y().data) : y().data;
|
|
2225
2232
|
};
|
|
2226
2233
|
if (e.length < 3)
|
|
2227
2234
|
return S();
|
|
2228
|
-
let
|
|
2229
|
-
const F =
|
|
2235
|
+
let w = r, E;
|
|
2236
|
+
const F = Ke();
|
|
2230
2237
|
h[p] = [
|
|
2231
2238
|
F,
|
|
2232
2239
|
0
|
|
2233
2240
|
];
|
|
2234
|
-
const
|
|
2235
|
-
if (
|
|
2241
|
+
const O = !b(g), x = y(), P = x.data, X = x._c, K = b(X) ? P : X;
|
|
2242
|
+
if (O && (g = W(g) ? g(K, P) : g, f({
|
|
2236
2243
|
data: g,
|
|
2237
|
-
_c:
|
|
2238
|
-
})),
|
|
2244
|
+
_c: K
|
|
2245
|
+
})), W(w))
|
|
2239
2246
|
try {
|
|
2240
|
-
|
|
2247
|
+
w = w(K);
|
|
2241
2248
|
} catch (L) {
|
|
2242
2249
|
E = L;
|
|
2243
2250
|
}
|
|
2244
|
-
if (
|
|
2245
|
-
if (
|
|
2251
|
+
if (w && kr(w))
|
|
2252
|
+
if (w = await w.catch((L) => {
|
|
2246
2253
|
E = L;
|
|
2247
2254
|
}), F !== h[p][0]) {
|
|
2248
2255
|
if (E) throw E;
|
|
2249
|
-
return
|
|
2250
|
-
} else E &&
|
|
2251
|
-
data:
|
|
2256
|
+
return w;
|
|
2257
|
+
} else E && O && u(E) && (a = !0, f({
|
|
2258
|
+
data: K,
|
|
2252
2259
|
_c: V
|
|
2253
2260
|
}));
|
|
2254
2261
|
if (a && !E)
|
|
2255
|
-
if (
|
|
2256
|
-
const L = a(
|
|
2262
|
+
if (W(a)) {
|
|
2263
|
+
const L = a(w, K);
|
|
2257
2264
|
f({
|
|
2258
2265
|
data: L,
|
|
2259
2266
|
error: V,
|
|
@@ -2261,11 +2268,11 @@ async function rn(...e) {
|
|
|
2261
2268
|
});
|
|
2262
2269
|
} else
|
|
2263
2270
|
f({
|
|
2264
|
-
data:
|
|
2271
|
+
data: w,
|
|
2265
2272
|
error: V,
|
|
2266
2273
|
_c: V
|
|
2267
2274
|
});
|
|
2268
|
-
if (h[p][1] =
|
|
2275
|
+
if (h[p][1] = Ke(), Promise.resolve(S()).then(() => {
|
|
2269
2276
|
f({
|
|
2270
2277
|
_c: V
|
|
2271
2278
|
});
|
|
@@ -2273,16 +2280,16 @@ async function rn(...e) {
|
|
|
2273
2280
|
if (c) throw E;
|
|
2274
2281
|
return;
|
|
2275
2282
|
}
|
|
2276
|
-
return
|
|
2283
|
+
return w;
|
|
2277
2284
|
}
|
|
2278
2285
|
}
|
|
2279
|
-
const
|
|
2286
|
+
const mt = (e, t) => {
|
|
2280
2287
|
for (const n in e)
|
|
2281
2288
|
e[n][0] && e[n][0](t);
|
|
2282
2289
|
}, Qr = (e, t) => {
|
|
2283
|
-
if (!
|
|
2284
|
-
const n =
|
|
2285
|
-
let o =
|
|
2290
|
+
if (!ee.has(e)) {
|
|
2291
|
+
const n = ue(Yr, t), r = {}, s = sn.bind(V, e);
|
|
2292
|
+
let o = ce;
|
|
2286
2293
|
const a = {}, d = (c, i) => {
|
|
2287
2294
|
const m = a[c] || [];
|
|
2288
2295
|
return a[c] = m, m.push(i), () => m.splice(m.indexOf(i), 1);
|
|
@@ -2293,7 +2300,7 @@ const gt = (e, t) => {
|
|
|
2293
2300
|
for (const y of p)
|
|
2294
2301
|
y(i, m);
|
|
2295
2302
|
}, u = () => {
|
|
2296
|
-
if (!
|
|
2303
|
+
if (!ee.has(e) && (ee.set(e, [
|
|
2297
2304
|
r,
|
|
2298
2305
|
{},
|
|
2299
2306
|
{},
|
|
@@ -2302,9 +2309,9 @@ const gt = (e, t) => {
|
|
|
2302
2309
|
g,
|
|
2303
2310
|
d
|
|
2304
2311
|
]), !be)) {
|
|
2305
|
-
const c = n.initFocus(setTimeout.bind(V,
|
|
2312
|
+
const c = n.initFocus(setTimeout.bind(V, mt.bind(V, r, tn))), i = n.initReconnect(setTimeout.bind(V, mt.bind(V, r, nn)));
|
|
2306
2313
|
o = () => {
|
|
2307
|
-
c && c(), i && i(),
|
|
2314
|
+
c && c(), i && i(), ee.delete(e);
|
|
2308
2315
|
};
|
|
2309
2316
|
}
|
|
2310
2317
|
};
|
|
@@ -2317,48 +2324,48 @@ const gt = (e, t) => {
|
|
|
2317
2324
|
}
|
|
2318
2325
|
return [
|
|
2319
2326
|
e,
|
|
2320
|
-
|
|
2327
|
+
ee.get(e)[4]
|
|
2321
2328
|
];
|
|
2322
2329
|
}, Wr = (e, t, n, r, s) => {
|
|
2323
2330
|
const o = n.errorRetryCount, a = s.retryCount, d = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
|
|
2324
2331
|
!b(o) && a > o || setTimeout(r, d, s);
|
|
2325
|
-
}, Kr = (e, t) => Ee(e) == Ee(t), [
|
|
2332
|
+
}, Kr = (e, t) => Ee(e) == Ee(t), [on, Jr] = Qr(/* @__PURE__ */ new Map()), Zr = ue(
|
|
2326
2333
|
{
|
|
2327
2334
|
// events
|
|
2328
|
-
onLoadingSlow:
|
|
2329
|
-
onSuccess:
|
|
2330
|
-
onError:
|
|
2335
|
+
onLoadingSlow: ce,
|
|
2336
|
+
onSuccess: ce,
|
|
2337
|
+
onError: ce,
|
|
2331
2338
|
onErrorRetry: Wr,
|
|
2332
|
-
onDiscarded:
|
|
2339
|
+
onDiscarded: ce,
|
|
2333
2340
|
// switches
|
|
2334
2341
|
revalidateOnFocus: !0,
|
|
2335
2342
|
revalidateOnReconnect: !0,
|
|
2336
2343
|
revalidateIfStale: !0,
|
|
2337
2344
|
shouldRetryOnError: !0,
|
|
2338
2345
|
// timeouts
|
|
2339
|
-
errorRetryInterval:
|
|
2346
|
+
errorRetryInterval: gt ? 1e4 : 5e3,
|
|
2340
2347
|
focusThrottleInterval: 5 * 1e3,
|
|
2341
2348
|
dedupingInterval: 2 * 1e3,
|
|
2342
|
-
loadingTimeout:
|
|
2349
|
+
loadingTimeout: gt ? 5e3 : 3e3,
|
|
2343
2350
|
// providers
|
|
2344
2351
|
compare: Kr,
|
|
2345
2352
|
isPaused: () => !1,
|
|
2346
|
-
cache:
|
|
2353
|
+
cache: on,
|
|
2347
2354
|
mutate: Jr,
|
|
2348
2355
|
fallback: {}
|
|
2349
2356
|
},
|
|
2350
2357
|
// use web preset by default
|
|
2351
2358
|
zr
|
|
2352
2359
|
), $r = (e, t) => {
|
|
2353
|
-
const n =
|
|
2360
|
+
const n = ue(e, t);
|
|
2354
2361
|
if (t) {
|
|
2355
2362
|
const { use: r, fallback: s } = e, { use: o, fallback: a } = t;
|
|
2356
|
-
r && o && (n.use = r.concat(o)), s && a && (n.fallback =
|
|
2363
|
+
r && o && (n.use = r.concat(o)), s && a && (n.fallback = ue(s, a));
|
|
2357
2364
|
}
|
|
2358
2365
|
return n;
|
|
2359
|
-
}, es =
|
|
2360
|
-
|
|
2361
|
-
}, ss = (e) =>
|
|
2366
|
+
}, es = yt({}), ts = "$inf$", an = Pe && window.__SWR_DEVTOOLS_USE__, ns = an ? window.__SWR_DEVTOOLS_USE__ : [], rs = () => {
|
|
2367
|
+
an && (window.__SWR_DEVTOOLS_REACT__ = fe);
|
|
2368
|
+
}, ss = (e) => W(e[1]) ? [
|
|
2362
2369
|
e[0],
|
|
2363
2370
|
e[1],
|
|
2364
2371
|
e[2] || {}
|
|
@@ -2366,8 +2373,8 @@ const gt = (e, t) => {
|
|
|
2366
2373
|
e[0],
|
|
2367
2374
|
null,
|
|
2368
2375
|
(e[1] === null ? e[2] : e[1]) || {}
|
|
2369
|
-
], os = () =>
|
|
2370
|
-
const [a] =
|
|
2376
|
+
], os = () => ue(Zr, St(es)), as = (e) => (t, n, r) => e(t, n && ((...o) => {
|
|
2377
|
+
const [a] = nt(t), [, , , d] = ee.get(on);
|
|
2371
2378
|
if (a.startsWith(ts))
|
|
2372
2379
|
return n(...o);
|
|
2373
2380
|
const g = d[a];
|
|
@@ -2387,7 +2394,7 @@ const gt = (e, t) => {
|
|
|
2387
2394
|
};
|
|
2388
2395
|
};
|
|
2389
2396
|
rs();
|
|
2390
|
-
const
|
|
2397
|
+
const ht = fe.use || ((e) => {
|
|
2391
2398
|
if (e.status === "pending")
|
|
2392
2399
|
throw e;
|
|
2393
2400
|
if (e.status === "fulfilled")
|
|
@@ -2397,95 +2404,95 @@ const mt = de.use || ((e) => {
|
|
|
2397
2404
|
}, (t) => {
|
|
2398
2405
|
e.status = "rejected", e.reason = t;
|
|
2399
2406
|
}), e);
|
|
2400
|
-
}),
|
|
2407
|
+
}), Ge = {
|
|
2401
2408
|
dedupe: !0
|
|
2402
2409
|
}, 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] =
|
|
2404
|
-
for (const j in
|
|
2410
|
+
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] = ee.get(r), [h, B] = nt(e), T = ae(!1), S = ae(!1), w = ae(h), E = ae(t), F = ae(n), O = () => F.current, x = () => O().isVisible() && O().isOnline(), [P, X, K, L] = en(r, h), re = ae({}).current, A = b(a) ? n.fallback[h] : a, N = (_, R) => {
|
|
2411
|
+
for (const j in re) {
|
|
2405
2412
|
const C = j;
|
|
2406
2413
|
if (C === "data") {
|
|
2407
|
-
if (!s(
|
|
2414
|
+
if (!s(_[C], R[C]) && (!b(_[C]) || !s(se, R[C])))
|
|
2408
2415
|
return !1;
|
|
2409
|
-
} else if (
|
|
2416
|
+
} else if (R[C] !== _[C])
|
|
2410
2417
|
return !1;
|
|
2411
2418
|
}
|
|
2412
2419
|
return !0;
|
|
2413
|
-
}, M =
|
|
2414
|
-
const
|
|
2415
|
-
const
|
|
2416
|
-
return delete
|
|
2420
|
+
}, M = ne(() => {
|
|
2421
|
+
const _ = !h || !t ? !1 : b(d) ? O().isPaused() || o ? !1 : b(g) ? !0 : g : d, R = (k) => {
|
|
2422
|
+
const Z = ue(k);
|
|
2423
|
+
return delete Z._k, _ ? {
|
|
2417
2424
|
isValidating: !0,
|
|
2418
2425
|
isLoading: !0,
|
|
2419
|
-
...
|
|
2420
|
-
} :
|
|
2421
|
-
}, j = P(), C = L(),
|
|
2422
|
-
let I =
|
|
2426
|
+
...Z
|
|
2427
|
+
} : Z;
|
|
2428
|
+
}, j = P(), C = L(), Q = R(j), ge = j === C ? Q : R(C);
|
|
2429
|
+
let I = Q;
|
|
2423
2430
|
return [
|
|
2424
2431
|
() => {
|
|
2425
|
-
const k =
|
|
2432
|
+
const k = R(P());
|
|
2426
2433
|
return N(k, I) ? (I.data = k.data, I.isLoading = k.isLoading, I.isValidating = k.isValidating, I.error = k.error, I) : (I = k, k);
|
|
2427
2434
|
},
|
|
2428
|
-
() =>
|
|
2435
|
+
() => ge
|
|
2429
2436
|
];
|
|
2430
2437
|
}, [
|
|
2431
2438
|
r,
|
|
2432
2439
|
h
|
|
2433
|
-
]),
|
|
2434
|
-
(
|
|
2435
|
-
N(j,
|
|
2440
|
+
]), U = Lr.useSyncExternalStore(me(
|
|
2441
|
+
(_) => K(h, (R, j) => {
|
|
2442
|
+
N(j, R) || _();
|
|
2436
2443
|
}),
|
|
2437
2444
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2438
2445
|
[
|
|
2439
2446
|
r,
|
|
2440
2447
|
h
|
|
2441
2448
|
]
|
|
2442
|
-
), M[0], M[1]),
|
|
2443
|
-
async (
|
|
2444
|
-
const
|
|
2445
|
-
if (!h || !
|
|
2449
|
+
), M[0], M[1]), G = !T.current, z = p[h] && p[h].length > 0, J = U.data, Y = b(J) ? A : J, pe = U.error, we = ae(Y), se = m ? b(J) ? we.current : J : Y, D = z && !b(pe) ? !1 : G && !b(d) ? d : O().isPaused() ? !1 : o ? b(Y) ? !1 : g : b(Y) || g, q = !!(h && t && G && D), Oe = b(U.isValidating) ? q : U.isValidating, cn = b(U.isLoading) ? q : U.isLoading, ye = me(
|
|
2450
|
+
async (_) => {
|
|
2451
|
+
const R = E.current;
|
|
2452
|
+
if (!h || !R || S.current || O().isPaused())
|
|
2446
2453
|
return !1;
|
|
2447
|
-
let j, C,
|
|
2448
|
-
const
|
|
2454
|
+
let j, C, Q = !0;
|
|
2455
|
+
const ge = _ || {}, I = !f[h] || !ge.dedupe, k = () => pt ? !S.current && h === w.current && T.current : h === w.current, Z = {
|
|
2449
2456
|
isValidating: !1,
|
|
2450
2457
|
isLoading: !1
|
|
2451
|
-
}, rt = () => {
|
|
2452
|
-
B(K);
|
|
2453
2458
|
}, st = () => {
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2459
|
+
X(Z);
|
|
2460
|
+
}, ot = () => {
|
|
2461
|
+
const H = f[h];
|
|
2462
|
+
H && H[1] === C && delete f[h];
|
|
2463
|
+
}, at = {
|
|
2457
2464
|
isValidating: !0
|
|
2458
2465
|
};
|
|
2459
|
-
b(P().data) && (
|
|
2466
|
+
b(P().data) && (at.isLoading = !0);
|
|
2460
2467
|
try {
|
|
2461
|
-
if (I && (
|
|
2462
|
-
|
|
2468
|
+
if (I && (X(at), n.loadingTimeout && b(P().data) && setTimeout(() => {
|
|
2469
|
+
Q && k() && O().onLoadingSlow(h, n);
|
|
2463
2470
|
}, n.loadingTimeout), f[h] = [
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
]), [j, C] = f[h], j = await j, I && setTimeout(
|
|
2467
|
-
return I && k() &&
|
|
2468
|
-
|
|
2469
|
-
const
|
|
2470
|
-
if (!b(
|
|
2471
|
-
(C <=
|
|
2472
|
-
C <=
|
|
2473
|
-
|
|
2474
|
-
return
|
|
2475
|
-
const
|
|
2476
|
-
|
|
2477
|
-
} catch (
|
|
2478
|
-
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2481
|
-
const
|
|
2482
|
-
|
|
2471
|
+
R(B),
|
|
2472
|
+
Ke()
|
|
2473
|
+
]), [j, C] = f[h], j = await j, I && setTimeout(ot, n.dedupingInterval), !f[h] || f[h][1] !== C)
|
|
2474
|
+
return I && k() && O().onDiscarded(h), !1;
|
|
2475
|
+
Z.error = V;
|
|
2476
|
+
const H = y[h];
|
|
2477
|
+
if (!b(H) && // case 1
|
|
2478
|
+
(C <= H[0] || // case 2
|
|
2479
|
+
C <= H[1] || // case 3
|
|
2480
|
+
H[1] === 0))
|
|
2481
|
+
return st(), I && k() && O().onDiscarded(h), !1;
|
|
2482
|
+
const $ = P().data;
|
|
2483
|
+
Z.data = s($, j) ? $ : j, I && k() && O().onSuccess(j, h, n);
|
|
2484
|
+
} catch (H) {
|
|
2485
|
+
ot();
|
|
2486
|
+
const $ = O(), { shouldRetryOnError: Ie } = $;
|
|
2487
|
+
$.isPaused() || (Z.error = H, I && k() && ($.onError(H, h, $), (Ie === !0 || W(Ie) && Ie(H)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || x()) && $.onErrorRetry(H, h, $, (un) => {
|
|
2488
|
+
const je = p[h];
|
|
2489
|
+
je && je[0] && je[0](Se.ERROR_REVALIDATE_EVENT, un);
|
|
2483
2490
|
}, {
|
|
2484
|
-
retryCount: (
|
|
2491
|
+
retryCount: (ge.retryCount || 0) + 1,
|
|
2485
2492
|
dedupe: !0
|
|
2486
2493
|
})));
|
|
2487
2494
|
}
|
|
2488
|
-
return
|
|
2495
|
+
return Q = !1, st(), !0;
|
|
2489
2496
|
},
|
|
2490
2497
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
2491
2498
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -2502,97 +2509,97 @@ const mt = de.use || ((e) => {
|
|
|
2502
2509
|
h,
|
|
2503
2510
|
r
|
|
2504
2511
|
]
|
|
2505
|
-
),
|
|
2512
|
+
), rt = me(
|
|
2506
2513
|
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
2507
|
-
(...
|
|
2514
|
+
(..._) => sn(r, w.current, ..._),
|
|
2508
2515
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2509
2516
|
[]
|
|
2510
2517
|
);
|
|
2511
|
-
if (
|
|
2512
|
-
E.current = t, F.current = n, b(
|
|
2513
|
-
}),
|
|
2518
|
+
if (Ue(() => {
|
|
2519
|
+
E.current = t, F.current = n, b(J) || (we.current = J);
|
|
2520
|
+
}), Ue(() => {
|
|
2514
2521
|
if (!h) return;
|
|
2515
|
-
const
|
|
2516
|
-
let
|
|
2517
|
-
const C = us(h, p, (
|
|
2518
|
-
if (
|
|
2522
|
+
const _ = ye.bind(V, Ge);
|
|
2523
|
+
let R = 0;
|
|
2524
|
+
const C = us(h, p, (Q, ge = {}) => {
|
|
2525
|
+
if (Q == Se.FOCUS_EVENT) {
|
|
2519
2526
|
const I = Date.now();
|
|
2520
|
-
|
|
2521
|
-
} else if (
|
|
2522
|
-
|
|
2527
|
+
O().revalidateOnFocus && I > R && x() && (R = I + O().focusThrottleInterval, _());
|
|
2528
|
+
} else if (Q == Se.RECONNECT_EVENT)
|
|
2529
|
+
O().revalidateOnReconnect && x() && _();
|
|
2523
2530
|
else {
|
|
2524
|
-
if (
|
|
2531
|
+
if (Q == Se.MUTATE_EVENT)
|
|
2525
2532
|
return ye();
|
|
2526
|
-
if (
|
|
2527
|
-
return ye(
|
|
2533
|
+
if (Q == Se.ERROR_REVALIDATE_EVENT)
|
|
2534
|
+
return ye(ge);
|
|
2528
2535
|
}
|
|
2529
2536
|
});
|
|
2530
|
-
return S.current = !1,
|
|
2531
|
-
_k:
|
|
2532
|
-
}),
|
|
2537
|
+
return S.current = !1, w.current = h, T.current = !0, X({
|
|
2538
|
+
_k: B
|
|
2539
|
+
}), D && (b(Y) || be ? _() : qr(_)), () => {
|
|
2533
2540
|
S.current = !0, C();
|
|
2534
2541
|
};
|
|
2535
2542
|
}, [
|
|
2536
2543
|
h
|
|
2537
|
-
]),
|
|
2538
|
-
let
|
|
2539
|
-
function
|
|
2540
|
-
const C =
|
|
2541
|
-
C &&
|
|
2544
|
+
]), Ue(() => {
|
|
2545
|
+
let _;
|
|
2546
|
+
function R() {
|
|
2547
|
+
const C = W(u) ? u(P().data) : u;
|
|
2548
|
+
C && _ !== -1 && (_ = setTimeout(j, C));
|
|
2542
2549
|
}
|
|
2543
2550
|
function j() {
|
|
2544
|
-
!P().error && (c ||
|
|
2551
|
+
!P().error && (c || O().isVisible()) && (i || O().isOnline()) ? ye(Ge).then(R) : R();
|
|
2545
2552
|
}
|
|
2546
|
-
return
|
|
2547
|
-
|
|
2553
|
+
return R(), () => {
|
|
2554
|
+
_ && (clearTimeout(_), _ = -1);
|
|
2548
2555
|
};
|
|
2549
2556
|
}, [
|
|
2550
2557
|
u,
|
|
2551
2558
|
c,
|
|
2552
2559
|
i,
|
|
2553
2560
|
h
|
|
2554
|
-
]), gn(
|
|
2555
|
-
if (!
|
|
2561
|
+
]), gn(se), o && b(Y) && h) {
|
|
2562
|
+
if (!pt && be)
|
|
2556
2563
|
throw new Error("Fallback data is required when using suspense in SSR.");
|
|
2557
2564
|
E.current = t, F.current = n, S.current = !1;
|
|
2558
|
-
const
|
|
2559
|
-
if (!b(
|
|
2560
|
-
const
|
|
2561
|
-
|
|
2565
|
+
const _ = v[h];
|
|
2566
|
+
if (!b(_)) {
|
|
2567
|
+
const R = rt(_);
|
|
2568
|
+
ht(R);
|
|
2562
2569
|
}
|
|
2563
|
-
if (b(
|
|
2564
|
-
const
|
|
2565
|
-
b(
|
|
2570
|
+
if (b(pe)) {
|
|
2571
|
+
const R = ye(Ge);
|
|
2572
|
+
b(se) || (R.status = "fulfilled", R.value = !0), ht(R);
|
|
2566
2573
|
} else
|
|
2567
|
-
throw
|
|
2574
|
+
throw pe;
|
|
2568
2575
|
}
|
|
2569
2576
|
return {
|
|
2570
|
-
mutate:
|
|
2577
|
+
mutate: rt,
|
|
2571
2578
|
get data() {
|
|
2572
|
-
return
|
|
2579
|
+
return re.data = !0, se;
|
|
2573
2580
|
},
|
|
2574
2581
|
get error() {
|
|
2575
|
-
return
|
|
2582
|
+
return re.error = !0, pe;
|
|
2576
2583
|
},
|
|
2577
2584
|
get isValidating() {
|
|
2578
|
-
return
|
|
2585
|
+
return re.isValidating = !0, Oe;
|
|
2579
2586
|
},
|
|
2580
2587
|
get isLoading() {
|
|
2581
|
-
return
|
|
2588
|
+
return re.isLoading = !0, cn;
|
|
2582
2589
|
}
|
|
2583
2590
|
};
|
|
2584
2591
|
}, ds = cs(ls);
|
|
2585
2592
|
function Ts() {
|
|
2586
|
-
const { apiUrl: e, botToken: t } =
|
|
2593
|
+
const { apiUrl: e, botToken: t } = le(), n = bt({
|
|
2587
2594
|
apiUrl: e,
|
|
2588
2595
|
botToken: t
|
|
2589
2596
|
});
|
|
2590
2597
|
return ds(n.options, n.apis.fetchPreludeData);
|
|
2591
2598
|
}
|
|
2592
2599
|
export {
|
|
2593
|
-
|
|
2600
|
+
et as A,
|
|
2594
2601
|
Rs as W,
|
|
2595
|
-
|
|
2602
|
+
ie as _,
|
|
2596
2603
|
_s as a,
|
|
2597
2604
|
As as b,
|
|
2598
2605
|
bs as c,
|
|
@@ -2600,10 +2607,10 @@ export {
|
|
|
2600
2607
|
Os as e,
|
|
2601
2608
|
Ts as f,
|
|
2602
2609
|
ws as g,
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2610
|
+
Te as h,
|
|
2611
|
+
_t as i,
|
|
2612
|
+
Mt as j,
|
|
2606
2613
|
Or as k,
|
|
2607
|
-
|
|
2614
|
+
le as u
|
|
2608
2615
|
};
|
|
2609
|
-
//# sourceMappingURL=index-
|
|
2616
|
+
//# sourceMappingURL=index-C87obATS.js.map
|