@opencx/widget 2.3.0 → 2.4.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 +64 -64
- package/dist/basic.cjs.map +1 -1
- package/dist/basic.js +7105 -7012
- package/dist/basic.js.map +1 -1
- package/dist/core/types/schemas-v2.d.ts +25 -0
- package/dist/index-BDLPOpfl.cjs +18 -0
- package/dist/index-BDLPOpfl.cjs.map +1 -0
- package/dist/{index-BQfnx4Er.js → index-CgATAy4r.js} +606 -560
- package/dist/index-CgATAy4r.js.map +1 -0
- package/dist/{react-lib → react-web}/hooks/useAxiosInstance.d.ts +21 -1
- package/dist/react-web/hooks/useVote.d.ts +18 -0
- package/dist/{react-lib → react-web}/index.d.ts +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +14 -28
- package/dist/react.js.map +1 -1
- package/dist/src/@components/BotMessageWrapper.d.ts +3 -1
- package/dist/src/@components/ChatEvent.component.d.ts +1 -1
- package/dist/src/@components/Fallback.component.d.ts +1 -1
- package/dist/src/@components/Text.component.d.ts +1 -1
- package/dist/src/components/VoteButtons.d.ts +8 -0
- package/dist/src/components/button.d.ts +1 -1
- package/dist/src/components/userMessage.d.ts +1 -1
- package/dist/src/designs/basic/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist-embed/script.js +101 -91
- package/dist-embed/script.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-B7LNpE9i.cjs +0 -18
- package/dist/index-B7LNpE9i.cjs.map +0 -1
- package/dist/index-BQfnx4Er.js.map +0 -1
- package/dist/react-lib/hooks/useVote.d.ts +0 -2
- /package/dist/{react-lib → react-web}/Root.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/use-sound.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/use-sound.test.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/use-sync-state.test.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useAbstractChat.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useScrollTo.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useSyncState.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useTimeoutState.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useUploadFiles.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useWidgetContentHeight.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/ar.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/de.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/en.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/fr.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/helper.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/nl.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/pt.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/ChatProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/ConfigDataProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/ContactProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/LocalesProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/componentRegistry.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/use-widget-sfx.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/usePreludeData.d.ts +0 -0
- /package/dist/{react-lib → react-web}/types/components.d.ts +0 -0
- /package/dist/{react-lib → react-web}/types/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/types/options.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/create-safe-context.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/debug.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/getters.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/index.d.ts +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var rn = Object.defineProperty;
|
|
2
2
|
var sn = (e, t, n) => t in e ? rn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
4
|
-
import { g as
|
|
5
|
-
import de, { useMemo as
|
|
6
|
-
import { jsx as
|
|
3
|
+
var rt = (e, t, n) => sn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { g as ee, S as pt, A as on } from "./schemas-BBAV6Sd_.js";
|
|
5
|
+
import de, { useMemo as ne, useState as Qe, useCallback as ge, useEffect as le, createContext as gt, useContext as ht, useRef as ae, useReducer as an, useLayoutEffect as cn, useDebugValue as un } from "react";
|
|
6
|
+
import { jsx as te } from "react/jsx-runtime";
|
|
7
7
|
import { create as ln } from "mutative";
|
|
8
8
|
import dn from "lodash.set";
|
|
9
9
|
import fn from "axios";
|
|
10
|
-
const pn = typeof window > "u",
|
|
10
|
+
const pn = typeof window > "u", st = {
|
|
11
11
|
getItem: () => null,
|
|
12
12
|
setItem: () => {
|
|
13
13
|
},
|
|
@@ -15,10 +15,10 @@ const pn = typeof window > "u", ot = {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
function gn(e) {
|
|
18
|
-
return pn ?
|
|
18
|
+
return pn ? st : e === "local" ? localStorage : e === "session" ? sessionStorage : st;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const r =
|
|
20
|
+
function We(e, t, n = "session") {
|
|
21
|
+
const r = ne(() => gn(n), [n]), [s, o] = Qe(() => {
|
|
22
22
|
const p = r.getItem(e);
|
|
23
23
|
if (p !== null)
|
|
24
24
|
try {
|
|
@@ -54,7 +54,7 @@ function Ke(e, t, n = "session") {
|
|
|
54
54
|
};
|
|
55
55
|
}, [e, s]), [s, a, l];
|
|
56
56
|
}
|
|
57
|
-
const hn = "@opencx/widget",
|
|
57
|
+
const hn = "@opencx/widget", mt = "2.4.0", mn = "module", yn = {
|
|
58
58
|
access: "public"
|
|
59
59
|
}, Sn = {
|
|
60
60
|
clean: "rm -rf ./dist ./dist-embed",
|
|
@@ -126,7 +126,7 @@ const hn = "@opencx/widget", yt = "2.3.0", mn = "module", yn = {
|
|
|
126
126
|
}, Cn = {
|
|
127
127
|
name: "openchatai",
|
|
128
128
|
url: "https://github.com/openchatai"
|
|
129
|
-
},
|
|
129
|
+
}, Nn = "./dist/index.js", Dn = "./dist/index.js", _n = "./dist/index.d.ts", xn = !1, Pn = {
|
|
130
130
|
".": {
|
|
131
131
|
types: "./dist/index.d.ts",
|
|
132
132
|
import: "./dist/index.js",
|
|
@@ -186,7 +186,7 @@ const hn = "@opencx/widget", yt = "2.3.0", mn = "module", yn = {
|
|
|
186
186
|
}, jn = {
|
|
187
187
|
name: hn,
|
|
188
188
|
private: !1,
|
|
189
|
-
version:
|
|
189
|
+
version: mt,
|
|
190
190
|
type: mn,
|
|
191
191
|
publishConfig: yn,
|
|
192
192
|
scripts: Sn,
|
|
@@ -199,23 +199,23 @@ const hn = "@opencx/widget", yt = "2.3.0", mn = "module", yn = {
|
|
|
199
199
|
files: Tn,
|
|
200
200
|
bugs: Rn,
|
|
201
201
|
author: Cn,
|
|
202
|
-
main:
|
|
203
|
-
module:
|
|
204
|
-
types:
|
|
202
|
+
main: Nn,
|
|
203
|
+
module: Dn,
|
|
204
|
+
types: _n,
|
|
205
205
|
sideEffects: xn,
|
|
206
206
|
exports: Pn,
|
|
207
207
|
devDependencies: In
|
|
208
208
|
}, kn = "X-Bot-Token", Mn = "X-Widget-Version";
|
|
209
|
-
function
|
|
210
|
-
const t =
|
|
209
|
+
function yt(e) {
|
|
210
|
+
const t = ne(() => fn.create({
|
|
211
211
|
baseURL: e.apiUrl,
|
|
212
212
|
headers: {
|
|
213
213
|
[kn]: e.botToken,
|
|
214
|
-
[Mn]:
|
|
214
|
+
[Mn]: mt,
|
|
215
215
|
"X-Use-Guard": !0
|
|
216
216
|
}
|
|
217
217
|
}), [e]);
|
|
218
|
-
return { apis:
|
|
218
|
+
return { apis: ne(
|
|
219
219
|
() => ({
|
|
220
220
|
createSession: (r) => {
|
|
221
221
|
if (!r)
|
|
@@ -243,7 +243,19 @@ function St(e) {
|
|
|
243
243
|
`widget/session/history/${r}`
|
|
244
244
|
);
|
|
245
245
|
},
|
|
246
|
+
/**
|
|
247
|
+
* downvote a message
|
|
248
|
+
* @param id
|
|
249
|
+
* @returns
|
|
250
|
+
* @deprecated use vote instead
|
|
251
|
+
*/
|
|
246
252
|
downvote: (r) => t.delete(`/chat/vote/${r}`),
|
|
253
|
+
/**
|
|
254
|
+
* upvote a message
|
|
255
|
+
* @param id
|
|
256
|
+
* @returns
|
|
257
|
+
* @deprecated use vote instead
|
|
258
|
+
*/
|
|
247
259
|
upvote: (r) => t.post(`/chat/vote/${r}`),
|
|
248
260
|
/**
|
|
249
261
|
* given the userData object we will create or update the contact + get the related conversations/tickets/sessions
|
|
@@ -277,21 +289,26 @@ function St(e) {
|
|
|
277
289
|
* send a message to the chat
|
|
278
290
|
* @param message
|
|
279
291
|
*/
|
|
280
|
-
sendMessage: async (r) => t.post("widget/chat/send", r)
|
|
292
|
+
sendMessage: async (r) => t.post("widget/chat/send", r),
|
|
293
|
+
/**
|
|
294
|
+
* vote on a message
|
|
295
|
+
* @param data
|
|
296
|
+
*/
|
|
297
|
+
vote: (r) => t.post("/widget/chat/vote", r)
|
|
281
298
|
}),
|
|
282
299
|
[t]
|
|
283
300
|
), options: e };
|
|
284
301
|
}
|
|
285
302
|
function Ce(e) {
|
|
286
|
-
const t =
|
|
303
|
+
const t = gt({});
|
|
287
304
|
return [() => {
|
|
288
|
-
const r =
|
|
305
|
+
const r = ht(t);
|
|
289
306
|
if (r === void 0)
|
|
290
307
|
throw new Error("useSafeContext must be used within a Provider");
|
|
291
308
|
return r;
|
|
292
309
|
}, t.Provider];
|
|
293
310
|
}
|
|
294
|
-
const
|
|
311
|
+
const Fn = {
|
|
295
312
|
ok: "حسنا",
|
|
296
313
|
yes: "نعم",
|
|
297
314
|
no: "لا",
|
|
@@ -344,7 +361,7 @@ const Ln = {
|
|
|
344
361
|
"start-chat": "تحدث إلى الدعم",
|
|
345
362
|
"starting-chat": "جاري الاتصال...",
|
|
346
363
|
"hello-greeting": "مرحبًا! كيف يمكننا مساعدتك اليوم؟"
|
|
347
|
-
},
|
|
364
|
+
}, Ln = {
|
|
348
365
|
ok: "OK",
|
|
349
366
|
yes: "Ja",
|
|
350
367
|
no: "Nein",
|
|
@@ -611,10 +628,10 @@ const Ln = {
|
|
|
611
628
|
"hello-greeting": "Olá! Como podemos ajudar você hoje?"
|
|
612
629
|
}, zn = {
|
|
613
630
|
en: Vn,
|
|
614
|
-
ar:
|
|
631
|
+
ar: Fn,
|
|
615
632
|
nl: Hn,
|
|
616
633
|
fr: Un,
|
|
617
|
-
de:
|
|
634
|
+
de: Ln,
|
|
618
635
|
pt: Gn
|
|
619
636
|
};
|
|
620
637
|
function Yn(e, t) {
|
|
@@ -622,9 +639,9 @@ function Yn(e, t) {
|
|
|
622
639
|
return n && n[e] || "";
|
|
623
640
|
}
|
|
624
641
|
const [as, Bn] = Ce();
|
|
625
|
-
function
|
|
626
|
-
const t =
|
|
627
|
-
return /* @__PURE__ */
|
|
642
|
+
function St({ children: e }) {
|
|
643
|
+
const t = B();
|
|
644
|
+
return /* @__PURE__ */ te(
|
|
628
645
|
Bn,
|
|
629
646
|
{
|
|
630
647
|
value: {
|
|
@@ -637,7 +654,7 @@ function vt({ children: e }) {
|
|
|
637
654
|
}
|
|
638
655
|
class qn {
|
|
639
656
|
constructor(t) {
|
|
640
|
-
|
|
657
|
+
rt(this, "components", [
|
|
641
658
|
{
|
|
642
659
|
key: "FALLBACK",
|
|
643
660
|
component: (t) => "fallback"
|
|
@@ -676,7 +693,7 @@ const Xn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABlCAYAAAC7vkbxAA
|
|
|
676
693
|
triggerOffset: "20px"
|
|
677
694
|
};
|
|
678
695
|
function Wn(e) {
|
|
679
|
-
return
|
|
696
|
+
return ne(() => {
|
|
680
697
|
var s, o, a, l;
|
|
681
698
|
const t = {
|
|
682
699
|
messageArrived: "https://cloud.opencopilot.so/sfx/notification3.mp3",
|
|
@@ -708,25 +725,25 @@ function Wn(e) {
|
|
|
708
725
|
};
|
|
709
726
|
}, [e]);
|
|
710
727
|
}
|
|
711
|
-
const [
|
|
728
|
+
const [B, Kn] = Ce(), Jn = "en";
|
|
712
729
|
function Zn({
|
|
713
730
|
children: e,
|
|
714
731
|
data: t
|
|
715
732
|
}) {
|
|
716
|
-
const n =
|
|
733
|
+
const n = ne(
|
|
717
734
|
() => new qn({
|
|
718
735
|
components: t.components
|
|
719
736
|
}),
|
|
720
737
|
[t]
|
|
721
|
-
), r = Wn(t), s =
|
|
738
|
+
), r = Wn(t), s = yt({
|
|
722
739
|
apiUrl: r.apiUrl,
|
|
723
740
|
botToken: r.token
|
|
724
|
-
}), [o, a] =
|
|
741
|
+
}), [o, a] = We(
|
|
725
742
|
"open_settings",
|
|
726
743
|
r.defaultSettings,
|
|
727
744
|
"local"
|
|
728
745
|
);
|
|
729
|
-
return /* @__PURE__ */
|
|
746
|
+
return /* @__PURE__ */ te(
|
|
730
747
|
Kn,
|
|
731
748
|
{
|
|
732
749
|
value: { ...r, http: s, componentStore: n, widgetSettings: o, setSettings: (p) => {
|
|
@@ -738,7 +755,7 @@ function Zn({
|
|
|
738
755
|
);
|
|
739
756
|
a(u);
|
|
740
757
|
} },
|
|
741
|
-
children: /* @__PURE__ */
|
|
758
|
+
children: /* @__PURE__ */ te(St, { children: e })
|
|
742
759
|
}
|
|
743
760
|
);
|
|
744
761
|
}
|
|
@@ -765,17 +782,17 @@ function $n(e) {
|
|
|
765
782
|
});
|
|
766
783
|
}), n;
|
|
767
784
|
}
|
|
768
|
-
var
|
|
769
|
-
return
|
|
785
|
+
var vt = {}, Ue = function(e, t) {
|
|
786
|
+
return Ue = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
770
787
|
n.__proto__ = r;
|
|
771
788
|
} || function(n, r) {
|
|
772
789
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
773
|
-
},
|
|
790
|
+
}, Ue(e, t);
|
|
774
791
|
};
|
|
775
|
-
function
|
|
792
|
+
function Et(e, t) {
|
|
776
793
|
if (typeof t != "function" && t !== null)
|
|
777
794
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
778
|
-
|
|
795
|
+
Ue(e, t);
|
|
779
796
|
function n() {
|
|
780
797
|
this.constructor = e;
|
|
781
798
|
}
|
|
@@ -790,7 +807,7 @@ var Te = function() {
|
|
|
790
807
|
return t;
|
|
791
808
|
}, Te.apply(this, arguments);
|
|
792
809
|
};
|
|
793
|
-
function
|
|
810
|
+
function wt(e, t) {
|
|
794
811
|
var n = {};
|
|
795
812
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
796
813
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -798,18 +815,18 @@ function bt(e, t) {
|
|
|
798
815
|
t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[s]) && (n[r[s]] = e[r[s]]);
|
|
799
816
|
return n;
|
|
800
817
|
}
|
|
801
|
-
function
|
|
818
|
+
function bt(e, t, n, r) {
|
|
802
819
|
var s = arguments.length, o = s < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, a;
|
|
803
820
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, n, r);
|
|
804
821
|
else for (var l = e.length - 1; l >= 0; l--) (a = e[l]) && (o = (s < 3 ? a(o) : s > 3 ? a(t, n, o) : a(t, n)) || o);
|
|
805
822
|
return s > 3 && o && Object.defineProperty(t, n, o), o;
|
|
806
823
|
}
|
|
807
|
-
function
|
|
824
|
+
function Ot(e, t) {
|
|
808
825
|
return function(n, r) {
|
|
809
826
|
t(n, r, e);
|
|
810
827
|
};
|
|
811
828
|
}
|
|
812
|
-
function
|
|
829
|
+
function At(e, t, n, r, s, o) {
|
|
813
830
|
function a(h) {
|
|
814
831
|
if (h !== void 0 && typeof h != "function") throw new TypeError("Function expected");
|
|
815
832
|
return h;
|
|
@@ -831,15 +848,15 @@ function Tt(e, t, n, r, s, o) {
|
|
|
831
848
|
}
|
|
832
849
|
u && Object.defineProperty(u, r.name, c), g = !0;
|
|
833
850
|
}
|
|
834
|
-
function
|
|
851
|
+
function Tt(e, t, n) {
|
|
835
852
|
for (var r = arguments.length > 2, s = 0; s < t.length; s++)
|
|
836
853
|
n = r ? t[s].call(e, n) : t[s].call(e);
|
|
837
854
|
return r ? n : void 0;
|
|
838
855
|
}
|
|
839
|
-
function
|
|
856
|
+
function Rt(e) {
|
|
840
857
|
return typeof e == "symbol" ? e : "".concat(e);
|
|
841
858
|
}
|
|
842
|
-
function
|
|
859
|
+
function Ct(e, t, n) {
|
|
843
860
|
return typeof t == "symbol" && (t = t.description ? "[".concat(t.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: n ? "".concat(n, " ", t) : t });
|
|
844
861
|
}
|
|
845
862
|
function Nt(e, t) {
|
|
@@ -872,7 +889,7 @@ function Dt(e, t, n, r) {
|
|
|
872
889
|
u((r = r.apply(e, t || [])).next());
|
|
873
890
|
});
|
|
874
891
|
}
|
|
875
|
-
function
|
|
892
|
+
function _t(e, t) {
|
|
876
893
|
var n = { label: 0, sent: function() {
|
|
877
894
|
if (o[0] & 1) throw o[1];
|
|
878
895
|
return o[1];
|
|
@@ -932,7 +949,7 @@ function xt(e, t) {
|
|
|
932
949
|
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
933
950
|
}
|
|
934
951
|
}
|
|
935
|
-
var
|
|
952
|
+
var Ne = Object.create ? function(e, t, n, r) {
|
|
936
953
|
r === void 0 && (r = n);
|
|
937
954
|
var s = Object.getOwnPropertyDescriptor(t, n);
|
|
938
955
|
(!s || ("get" in s ? !t.__esModule : s.writable || s.configurable)) && (s = { enumerable: !0, get: function() {
|
|
@@ -941,8 +958,8 @@ var _e = Object.create ? function(e, t, n, r) {
|
|
|
941
958
|
} : function(e, t, n, r) {
|
|
942
959
|
r === void 0 && (r = n), e[r] = t[n];
|
|
943
960
|
};
|
|
944
|
-
function
|
|
945
|
-
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) &&
|
|
961
|
+
function xt(e, t) {
|
|
962
|
+
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) && Ne(t, e, n);
|
|
946
963
|
}
|
|
947
964
|
function Re(e) {
|
|
948
965
|
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
|
|
@@ -954,7 +971,7 @@ function Re(e) {
|
|
|
954
971
|
};
|
|
955
972
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
956
973
|
}
|
|
957
|
-
function
|
|
974
|
+
function Ke(e, t) {
|
|
958
975
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
959
976
|
if (!n) return e;
|
|
960
977
|
var r = n.call(e), s, o = [], a;
|
|
@@ -971,19 +988,19 @@ function Je(e, t) {
|
|
|
971
988
|
}
|
|
972
989
|
return o;
|
|
973
990
|
}
|
|
974
|
-
function
|
|
991
|
+
function Pt() {
|
|
975
992
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
976
|
-
e = e.concat(
|
|
993
|
+
e = e.concat(Ke(arguments[t]));
|
|
977
994
|
return e;
|
|
978
995
|
}
|
|
979
|
-
function
|
|
996
|
+
function It() {
|
|
980
997
|
for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
|
|
981
998
|
for (var r = Array(e), s = 0, t = 0; t < n; t++)
|
|
982
999
|
for (var o = arguments[t], a = 0, l = o.length; a < l; a++, s++)
|
|
983
1000
|
r[s] = o[a];
|
|
984
1001
|
return r;
|
|
985
1002
|
}
|
|
986
|
-
function
|
|
1003
|
+
function jt(e, t, n) {
|
|
987
1004
|
if (n || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
|
|
988
1005
|
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
989
1006
|
return e.concat(o || Array.prototype.slice.call(t));
|
|
@@ -991,7 +1008,7 @@ function kt(e, t, n) {
|
|
|
991
1008
|
function he(e) {
|
|
992
1009
|
return this instanceof he ? (this.v = e, this) : new he(e);
|
|
993
1010
|
}
|
|
994
|
-
function
|
|
1011
|
+
function kt(e, t, n) {
|
|
995
1012
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
996
1013
|
var r = n.apply(e, t || []), s, o = [];
|
|
997
1014
|
return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), l("next"), l("throw"), l("return", a), s[Symbol.asyncIterator] = function() {
|
|
@@ -1029,7 +1046,7 @@ function Mt(e, t, n) {
|
|
|
1029
1046
|
f(m), o.shift(), o.length && p(o[0][0], o[0][1]);
|
|
1030
1047
|
}
|
|
1031
1048
|
}
|
|
1032
|
-
function
|
|
1049
|
+
function Mt(e) {
|
|
1033
1050
|
var t, n;
|
|
1034
1051
|
return t = {}, r("next"), r("throw", function(s) {
|
|
1035
1052
|
throw s;
|
|
@@ -1061,7 +1078,7 @@ function Ft(e) {
|
|
|
1061
1078
|
}, a);
|
|
1062
1079
|
}
|
|
1063
1080
|
}
|
|
1064
|
-
function
|
|
1081
|
+
function Lt(e, t) {
|
|
1065
1082
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1066
1083
|
}
|
|
1067
1084
|
var er = Object.create ? function(e, t) {
|
|
@@ -1069,31 +1086,31 @@ var er = Object.create ? function(e, t) {
|
|
|
1069
1086
|
} : function(e, t) {
|
|
1070
1087
|
e.default = t;
|
|
1071
1088
|
};
|
|
1072
|
-
function
|
|
1089
|
+
function Vt(e) {
|
|
1073
1090
|
if (e && e.__esModule) return e;
|
|
1074
1091
|
var t = {};
|
|
1075
|
-
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) &&
|
|
1092
|
+
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) && Ne(t, e, n);
|
|
1076
1093
|
return er(t, e), t;
|
|
1077
1094
|
}
|
|
1078
|
-
function
|
|
1095
|
+
function Ut(e) {
|
|
1079
1096
|
return e && e.__esModule ? e : { default: e };
|
|
1080
1097
|
}
|
|
1081
|
-
function
|
|
1098
|
+
function Ht(e, t, n, r) {
|
|
1082
1099
|
if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
|
|
1083
1100
|
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");
|
|
1084
1101
|
return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
|
|
1085
1102
|
}
|
|
1086
|
-
function
|
|
1103
|
+
function Gt(e, t, n, r, s) {
|
|
1087
1104
|
if (r === "m") throw new TypeError("Private method is not writable");
|
|
1088
1105
|
if (r === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
|
|
1089
1106
|
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");
|
|
1090
1107
|
return r === "a" ? s.call(e, n) : s ? s.value = n : t.set(e, n), n;
|
|
1091
1108
|
}
|
|
1092
|
-
function
|
|
1109
|
+
function zt(e, t) {
|
|
1093
1110
|
if (t === null || typeof t != "object" && typeof t != "function") throw new TypeError("Cannot use 'in' operator on non-object");
|
|
1094
1111
|
return typeof e == "function" ? t === e : e.has(t);
|
|
1095
1112
|
}
|
|
1096
|
-
function
|
|
1113
|
+
function Yt(e, t, n) {
|
|
1097
1114
|
if (t != null) {
|
|
1098
1115
|
if (typeof t != "object" && typeof t != "function") throw new TypeError("Object expected.");
|
|
1099
1116
|
var r, s;
|
|
@@ -1120,7 +1137,7 @@ var tr = typeof SuppressedError == "function" ? SuppressedError : function(e, t,
|
|
|
1120
1137
|
var r = new Error(n);
|
|
1121
1138
|
return r.name = "SuppressedError", r.error = e, r.suppressed = t, r;
|
|
1122
1139
|
};
|
|
1123
|
-
function
|
|
1140
|
+
function Bt(e) {
|
|
1124
1141
|
function t(o) {
|
|
1125
1142
|
e.error = e.hasError ? new tr(o, e.error, "An error was suppressed during disposal.") : o, e.hasError = !0;
|
|
1126
1143
|
}
|
|
@@ -1143,86 +1160,86 @@ function qt(e) {
|
|
|
1143
1160
|
}
|
|
1144
1161
|
return s();
|
|
1145
1162
|
}
|
|
1146
|
-
function
|
|
1163
|
+
function qt(e, t) {
|
|
1147
1164
|
return typeof e == "string" && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(n, r, s, o, a) {
|
|
1148
1165
|
return r ? t ? ".jsx" : ".js" : s && (!o || !a) ? n : s + o + "." + a.toLowerCase() + "js";
|
|
1149
1166
|
}) : e;
|
|
1150
1167
|
}
|
|
1151
1168
|
const nr = {
|
|
1152
|
-
__extends:
|
|
1169
|
+
__extends: Et,
|
|
1153
1170
|
__assign: Te,
|
|
1154
|
-
__rest:
|
|
1155
|
-
__decorate:
|
|
1156
|
-
__param:
|
|
1157
|
-
__esDecorate:
|
|
1158
|
-
__runInitializers:
|
|
1159
|
-
__propKey:
|
|
1160
|
-
__setFunctionName:
|
|
1171
|
+
__rest: wt,
|
|
1172
|
+
__decorate: bt,
|
|
1173
|
+
__param: Ot,
|
|
1174
|
+
__esDecorate: At,
|
|
1175
|
+
__runInitializers: Tt,
|
|
1176
|
+
__propKey: Rt,
|
|
1177
|
+
__setFunctionName: Ct,
|
|
1161
1178
|
__metadata: Nt,
|
|
1162
1179
|
__awaiter: Dt,
|
|
1163
|
-
__generator:
|
|
1164
|
-
__createBinding:
|
|
1165
|
-
__exportStar:
|
|
1180
|
+
__generator: _t,
|
|
1181
|
+
__createBinding: Ne,
|
|
1182
|
+
__exportStar: xt,
|
|
1166
1183
|
__values: Re,
|
|
1167
|
-
__read:
|
|
1168
|
-
__spread:
|
|
1169
|
-
__spreadArrays:
|
|
1170
|
-
__spreadArray:
|
|
1184
|
+
__read: Ke,
|
|
1185
|
+
__spread: Pt,
|
|
1186
|
+
__spreadArrays: It,
|
|
1187
|
+
__spreadArray: jt,
|
|
1171
1188
|
__await: he,
|
|
1172
|
-
__asyncGenerator:
|
|
1173
|
-
__asyncDelegator:
|
|
1189
|
+
__asyncGenerator: kt,
|
|
1190
|
+
__asyncDelegator: Mt,
|
|
1174
1191
|
__asyncValues: Ft,
|
|
1175
|
-
__makeTemplateObject:
|
|
1176
|
-
__importStar:
|
|
1177
|
-
__importDefault:
|
|
1178
|
-
__classPrivateFieldGet:
|
|
1179
|
-
__classPrivateFieldSet:
|
|
1180
|
-
__classPrivateFieldIn:
|
|
1181
|
-
__addDisposableResource:
|
|
1182
|
-
__disposeResources:
|
|
1183
|
-
__rewriteRelativeImportExtension:
|
|
1192
|
+
__makeTemplateObject: Lt,
|
|
1193
|
+
__importStar: Vt,
|
|
1194
|
+
__importDefault: Ut,
|
|
1195
|
+
__classPrivateFieldGet: Ht,
|
|
1196
|
+
__classPrivateFieldSet: Gt,
|
|
1197
|
+
__classPrivateFieldIn: zt,
|
|
1198
|
+
__addDisposableResource: Yt,
|
|
1199
|
+
__disposeResources: Bt,
|
|
1200
|
+
__rewriteRelativeImportExtension: qt
|
|
1184
1201
|
}, rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1185
1202
|
__proto__: null,
|
|
1186
|
-
__addDisposableResource:
|
|
1203
|
+
__addDisposableResource: Yt,
|
|
1187
1204
|
get __assign() {
|
|
1188
1205
|
return Te;
|
|
1189
1206
|
},
|
|
1190
|
-
__asyncDelegator:
|
|
1191
|
-
__asyncGenerator:
|
|
1207
|
+
__asyncDelegator: Mt,
|
|
1208
|
+
__asyncGenerator: kt,
|
|
1192
1209
|
__asyncValues: Ft,
|
|
1193
1210
|
__await: he,
|
|
1194
1211
|
__awaiter: Dt,
|
|
1195
|
-
__classPrivateFieldGet:
|
|
1196
|
-
__classPrivateFieldIn:
|
|
1197
|
-
__classPrivateFieldSet:
|
|
1198
|
-
__createBinding:
|
|
1199
|
-
__decorate:
|
|
1200
|
-
__disposeResources:
|
|
1201
|
-
__esDecorate:
|
|
1202
|
-
__exportStar:
|
|
1203
|
-
__extends:
|
|
1204
|
-
__generator:
|
|
1205
|
-
__importDefault:
|
|
1206
|
-
__importStar:
|
|
1207
|
-
__makeTemplateObject:
|
|
1212
|
+
__classPrivateFieldGet: Ht,
|
|
1213
|
+
__classPrivateFieldIn: zt,
|
|
1214
|
+
__classPrivateFieldSet: Gt,
|
|
1215
|
+
__createBinding: Ne,
|
|
1216
|
+
__decorate: bt,
|
|
1217
|
+
__disposeResources: Bt,
|
|
1218
|
+
__esDecorate: At,
|
|
1219
|
+
__exportStar: xt,
|
|
1220
|
+
__extends: Et,
|
|
1221
|
+
__generator: _t,
|
|
1222
|
+
__importDefault: Ut,
|
|
1223
|
+
__importStar: Vt,
|
|
1224
|
+
__makeTemplateObject: Lt,
|
|
1208
1225
|
__metadata: Nt,
|
|
1209
|
-
__param:
|
|
1210
|
-
__propKey:
|
|
1211
|
-
__read:
|
|
1212
|
-
__rest:
|
|
1213
|
-
__rewriteRelativeImportExtension:
|
|
1214
|
-
__runInitializers:
|
|
1215
|
-
__setFunctionName:
|
|
1216
|
-
__spread:
|
|
1217
|
-
__spreadArray:
|
|
1218
|
-
__spreadArrays:
|
|
1226
|
+
__param: Ot,
|
|
1227
|
+
__propKey: Rt,
|
|
1228
|
+
__read: Ke,
|
|
1229
|
+
__rest: wt,
|
|
1230
|
+
__rewriteRelativeImportExtension: qt,
|
|
1231
|
+
__runInitializers: Tt,
|
|
1232
|
+
__setFunctionName: Ct,
|
|
1233
|
+
__spread: Pt,
|
|
1234
|
+
__spreadArray: jt,
|
|
1235
|
+
__spreadArrays: It,
|
|
1219
1236
|
__values: Re,
|
|
1220
1237
|
default: nr
|
|
1221
1238
|
}, Symbol.toStringTag, { value: "Module" })), sr = /* @__PURE__ */ $n(rr);
|
|
1222
|
-
var be = {},
|
|
1239
|
+
var be = {}, ot;
|
|
1223
1240
|
function or() {
|
|
1224
|
-
if (
|
|
1225
|
-
|
|
1241
|
+
if (ot) return be;
|
|
1242
|
+
ot = 1, Object.defineProperty(be, "__esModule", { value: !0 });
|
|
1226
1243
|
var e = de;
|
|
1227
1244
|
function t() {
|
|
1228
1245
|
var n = e.useRef(!1), r = e.useCallback(function() {
|
|
@@ -1236,16 +1253,16 @@ function or() {
|
|
|
1236
1253
|
}
|
|
1237
1254
|
return be.default = t, be;
|
|
1238
1255
|
}
|
|
1239
|
-
Object.defineProperty(
|
|
1240
|
-
var
|
|
1256
|
+
Object.defineProperty(vt, "__esModule", { value: !0 });
|
|
1257
|
+
var He = sr, Pe = de, ar = He.__importDefault(or());
|
|
1241
1258
|
function ir(e, t, n) {
|
|
1242
1259
|
t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
|
|
1243
|
-
var r =
|
|
1260
|
+
var r = Pe.useRef(0), s = ar.default(), o = Pe.useState(n), a = o[0], l = o[1], p = Pe.useCallback(function() {
|
|
1244
1261
|
for (var u = [], c = 0; c < arguments.length; c++)
|
|
1245
1262
|
u[c] = arguments[c];
|
|
1246
1263
|
var i = ++r.current;
|
|
1247
1264
|
return a.loading || l(function(g) {
|
|
1248
|
-
return
|
|
1265
|
+
return He.__assign(He.__assign({}, g), { loading: !0 });
|
|
1249
1266
|
}), e.apply(void 0, u).then(function(g) {
|
|
1250
1267
|
return s() && i === r.current && l({ value: g, loading: !1 }), g;
|
|
1251
1268
|
}, function(g) {
|
|
@@ -1254,14 +1271,35 @@ function ir(e, t, n) {
|
|
|
1254
1271
|
}, t);
|
|
1255
1272
|
return [a, p];
|
|
1256
1273
|
}
|
|
1257
|
-
var
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1274
|
+
var Y = vt.default = ir;
|
|
1275
|
+
function us(e, t, n) {
|
|
1276
|
+
const { http: r } = B();
|
|
1277
|
+
return Y(
|
|
1278
|
+
async (s) => s === "up" ? r.apis.vote({ action: "upvote", messagePublicId: e, sessionId: t }).then(n) : r.apis.vote({ action: "downvote", messagePublicId: e, sessionId: t }).then(n),
|
|
1279
|
+
[r.apis, e, n]
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1282
|
+
function ls(e, t) {
|
|
1283
|
+
const { http: n } = B();
|
|
1284
|
+
return Y(
|
|
1285
|
+
async () => n.apis.upvote(e).then(t),
|
|
1286
|
+
[n.options, e, t]
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
function ds(e, t) {
|
|
1290
|
+
const { http: n } = B();
|
|
1291
|
+
return Y(
|
|
1292
|
+
async () => n.apis.downvote(e).then(t),
|
|
1293
|
+
[n.options, e]
|
|
1294
|
+
);
|
|
1295
|
+
}
|
|
1296
|
+
const oe = /* @__PURE__ */ new Map();
|
|
1297
|
+
function fs() {
|
|
1298
|
+
const [e, t] = Qe([]), { http: n } = B();
|
|
1261
1299
|
function r(c) {
|
|
1262
1300
|
const i = c.map((g) => ({
|
|
1263
1301
|
file: g,
|
|
1264
|
-
id:
|
|
1302
|
+
id: ee(10),
|
|
1265
1303
|
status: "pending",
|
|
1266
1304
|
progress: 0
|
|
1267
1305
|
}));
|
|
@@ -1277,7 +1315,7 @@ function us() {
|
|
|
1277
1315
|
}
|
|
1278
1316
|
const a = async (c) => {
|
|
1279
1317
|
const i = new AbortController();
|
|
1280
|
-
|
|
1318
|
+
oe.set(c.id, i);
|
|
1281
1319
|
try {
|
|
1282
1320
|
t(
|
|
1283
1321
|
(f) => f.map(
|
|
@@ -1306,17 +1344,17 @@ function us() {
|
|
|
1306
1344
|
progress: 0
|
|
1307
1345
|
});
|
|
1308
1346
|
} finally {
|
|
1309
|
-
|
|
1347
|
+
oe.delete(c.id);
|
|
1310
1348
|
}
|
|
1311
1349
|
}, l = (c) => {
|
|
1312
|
-
const i =
|
|
1313
|
-
i && (i.abort(),
|
|
1314
|
-
}, p =
|
|
1350
|
+
const i = oe.get(c);
|
|
1351
|
+
i && (i.abort(), oe.delete(c)), o(c);
|
|
1352
|
+
}, p = ne(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
|
|
1315
1353
|
function u() {
|
|
1316
|
-
|
|
1354
|
+
oe.forEach((c) => c.abort()), oe.clear(), t([]);
|
|
1317
1355
|
}
|
|
1318
1356
|
return le(() => () => {
|
|
1319
|
-
|
|
1357
|
+
oe.forEach((c) => c.abort()), oe.clear();
|
|
1320
1358
|
}, []), {
|
|
1321
1359
|
allFiles: e,
|
|
1322
1360
|
appendFiles: r,
|
|
@@ -1336,7 +1374,7 @@ function us() {
|
|
|
1336
1374
|
isUploading: e.some((c) => c.status === "uploading")
|
|
1337
1375
|
};
|
|
1338
1376
|
}
|
|
1339
|
-
function
|
|
1377
|
+
function at(e) {
|
|
1340
1378
|
var n, r, s;
|
|
1341
1379
|
const t = [];
|
|
1342
1380
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -1345,7 +1383,7 @@ function it(e) {
|
|
|
1345
1383
|
a.message && a.message.length > 0 && t.push({
|
|
1346
1384
|
type: "FROM_USER",
|
|
1347
1385
|
content: a.message,
|
|
1348
|
-
id: a.publicId ||
|
|
1386
|
+
id: a.publicId || ee(),
|
|
1349
1387
|
deliveredAt: a.created_at || "",
|
|
1350
1388
|
attachments: a.attachments
|
|
1351
1389
|
});
|
|
@@ -1358,7 +1396,7 @@ function it(e) {
|
|
|
1358
1396
|
data: {
|
|
1359
1397
|
message: a.message ?? ""
|
|
1360
1398
|
},
|
|
1361
|
-
id: a.publicId ||
|
|
1399
|
+
id: a.publicId || ee(),
|
|
1362
1400
|
timestamp: a.created_at || "",
|
|
1363
1401
|
original: a,
|
|
1364
1402
|
attachments: a.attachments,
|
|
@@ -1377,7 +1415,7 @@ function it(e) {
|
|
|
1377
1415
|
data: {
|
|
1378
1416
|
message: a.message ?? ""
|
|
1379
1417
|
},
|
|
1380
|
-
id: a.publicId ||
|
|
1418
|
+
id: a.publicId || ee(),
|
|
1381
1419
|
timestamp: a.created_at || "",
|
|
1382
1420
|
original: a,
|
|
1383
1421
|
attachments: a.attachments,
|
|
@@ -1397,7 +1435,7 @@ function it(e) {
|
|
|
1397
1435
|
event: a.type,
|
|
1398
1436
|
message: a.message ?? ""
|
|
1399
1437
|
},
|
|
1400
|
-
id: a.publicId ||
|
|
1438
|
+
id: a.publicId || ee(),
|
|
1401
1439
|
original: a,
|
|
1402
1440
|
attachments: a.attachments,
|
|
1403
1441
|
timestamp: a.created_at || "",
|
|
@@ -1413,7 +1451,7 @@ function it(e) {
|
|
|
1413
1451
|
return t;
|
|
1414
1452
|
}
|
|
1415
1453
|
function cr(e) {
|
|
1416
|
-
const t =
|
|
1454
|
+
const t = ae(null);
|
|
1417
1455
|
return le(() => {
|
|
1418
1456
|
if (!t.current) {
|
|
1419
1457
|
const n = new Audio(e.src);
|
|
@@ -1435,7 +1473,7 @@ function cr(e) {
|
|
|
1435
1473
|
};
|
|
1436
1474
|
}
|
|
1437
1475
|
function ur() {
|
|
1438
|
-
const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } =
|
|
1476
|
+
const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } = B(), r = (t == null ? void 0 : t.useSoundEffects) ?? n.useSoundEffects;
|
|
1439
1477
|
return {
|
|
1440
1478
|
messageArrivedSound: cr({
|
|
1441
1479
|
src: e.messageArrived,
|
|
@@ -1499,23 +1537,23 @@ function pr({
|
|
|
1499
1537
|
persist: e,
|
|
1500
1538
|
sessionKey: t = (n, { external_id: r }) => `[OPEN_SESSION_${n}]_${r || "session"}`
|
|
1501
1539
|
}) {
|
|
1502
|
-
const { botToken: n, http: r, user: s } =
|
|
1540
|
+
const { botToken: n, http: r, user: s } = B(), [o, a, l] = We(
|
|
1503
1541
|
t(n, s),
|
|
1504
1542
|
void 0,
|
|
1505
1543
|
e ? "local" : "memory"
|
|
1506
1544
|
), p = (d) => ({
|
|
1507
1545
|
...d,
|
|
1508
|
-
isSessionClosed: d.status !==
|
|
1546
|
+
isSessionClosed: d.status !== pt.OPEN,
|
|
1509
1547
|
isAssignedToAi: d.assignee_id === 555,
|
|
1510
1548
|
isAssignedToHuman: d.assignee_id !== 555,
|
|
1511
1549
|
isPendingHuman: d.assignee_id === 555 && d.ai_closure_type === on.handed_off
|
|
1512
|
-
}), u =
|
|
1550
|
+
}), u = ne(() => o ? p(o) : null, [o]), [c, i] = Y(
|
|
1513
1551
|
async (d) => {
|
|
1514
1552
|
let S = await r.apis.fetchSession(d);
|
|
1515
1553
|
return S.data && a(S.data), S.data;
|
|
1516
1554
|
},
|
|
1517
1555
|
[r, a]
|
|
1518
|
-
), [g, f] =
|
|
1556
|
+
), [g, f] = Y(
|
|
1519
1557
|
async (d) => {
|
|
1520
1558
|
try {
|
|
1521
1559
|
const S = await i(d);
|
|
@@ -1544,71 +1582,71 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1544
1582
|
lastUpdated: null,
|
|
1545
1583
|
messages: [],
|
|
1546
1584
|
keyboard: null
|
|
1547
|
-
}), [r, s] =
|
|
1585
|
+
}), [r, s] = Qe({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: l, widgetSettings: p, defaultSettings: u, language: c, ...i } = B(), { messageArrivedSound: g } = ur(), f = (p == null ? void 0 : p.persistSession) || u.persistSession, { refreshSession: m, session: d, deleteSession: S, setSession: h, pollSession: q } = pr({
|
|
1548
1586
|
persist: f
|
|
1549
|
-
}), [
|
|
1550
|
-
async (
|
|
1587
|
+
}), [C, y] = Y(
|
|
1588
|
+
async (A) => {
|
|
1551
1589
|
if (!d) return [];
|
|
1552
1590
|
try {
|
|
1553
|
-
const { data:
|
|
1554
|
-
return
|
|
1555
|
-
} catch (
|
|
1556
|
-
throw console.error("Error fetching history:",
|
|
1591
|
+
const { data: N } = await l.apis.fetchHistory(A);
|
|
1592
|
+
return N ? Array.isArray(N) ? at(N) : [] : [];
|
|
1593
|
+
} catch (N) {
|
|
1594
|
+
throw console.error("Error fetching history:", N), N;
|
|
1557
1595
|
}
|
|
1558
1596
|
},
|
|
1559
1597
|
[d, l.apis]
|
|
1560
|
-
), [b, v] =
|
|
1561
|
-
async (
|
|
1598
|
+
), [b, v] = Y(
|
|
1599
|
+
async (A, N) => {
|
|
1562
1600
|
try {
|
|
1563
|
-
const
|
|
1564
|
-
sessionId:
|
|
1565
|
-
lastMessageTimestamp:
|
|
1601
|
+
const L = await l.apis.getHistoryPooling({
|
|
1602
|
+
sessionId: A,
|
|
1603
|
+
lastMessageTimestamp: N
|
|
1566
1604
|
});
|
|
1567
|
-
if (
|
|
1568
|
-
const
|
|
1569
|
-
if (
|
|
1605
|
+
if (L.data) {
|
|
1606
|
+
const k = at(L.data);
|
|
1607
|
+
if (k.length > 0) {
|
|
1570
1608
|
n({
|
|
1571
1609
|
type: "APPEND_MESSAGES",
|
|
1572
|
-
payload:
|
|
1610
|
+
payload: k
|
|
1573
1611
|
});
|
|
1574
1612
|
try {
|
|
1575
1613
|
g.play();
|
|
1576
|
-
} catch (
|
|
1577
|
-
console.error("Error playing sound:",
|
|
1614
|
+
} catch (ue) {
|
|
1615
|
+
console.error("Error playing sound:", ue);
|
|
1578
1616
|
}
|
|
1579
1617
|
}
|
|
1580
|
-
return
|
|
1618
|
+
return k;
|
|
1581
1619
|
}
|
|
1582
1620
|
return [];
|
|
1583
|
-
} catch (
|
|
1584
|
-
throw console.error("Error polling messages:",
|
|
1621
|
+
} catch (L) {
|
|
1622
|
+
throw console.error("Error polling messages:", L), L;
|
|
1585
1623
|
}
|
|
1586
1624
|
},
|
|
1587
1625
|
[l.apis, n, g]
|
|
1588
1626
|
);
|
|
1589
1627
|
le(() => {
|
|
1590
|
-
let
|
|
1591
|
-
return d && (
|
|
1592
|
-
|
|
1593
|
-
}, lr),
|
|
1594
|
-
var
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1628
|
+
let A, N;
|
|
1629
|
+
return d && (A = setInterval(() => {
|
|
1630
|
+
q(d.id);
|
|
1631
|
+
}, lr), N = setInterval(() => {
|
|
1632
|
+
var k;
|
|
1633
|
+
const L = (k = t.messages.at(-1)) == null ? void 0 : k.timestamp;
|
|
1634
|
+
L && v(d.id, L);
|
|
1597
1635
|
}, dr)), () => {
|
|
1598
|
-
clearInterval(
|
|
1636
|
+
clearInterval(A), clearInterval(N);
|
|
1599
1637
|
};
|
|
1600
|
-
}, [d,
|
|
1601
|
-
const [
|
|
1638
|
+
}, [d, q, v]);
|
|
1639
|
+
const [F, O] = Y(
|
|
1602
1640
|
async () => {
|
|
1603
1641
|
if (d)
|
|
1604
1642
|
try {
|
|
1605
|
-
const
|
|
1606
|
-
if (
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1643
|
+
const A = await m(d.id);
|
|
1644
|
+
if (A) {
|
|
1645
|
+
const N = await y(A.id);
|
|
1646
|
+
N && n({ type: "PREPEND_HISTORY", payload: N });
|
|
1609
1647
|
}
|
|
1610
|
-
} catch (
|
|
1611
|
-
throw console.error("Error initializing session:",
|
|
1648
|
+
} catch (A) {
|
|
1649
|
+
throw console.error("Error initializing session:", A), A;
|
|
1612
1650
|
}
|
|
1613
1651
|
},
|
|
1614
1652
|
[d, m, y, n]
|
|
@@ -1616,187 +1654,192 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1616
1654
|
le(() => {
|
|
1617
1655
|
O();
|
|
1618
1656
|
}, []);
|
|
1619
|
-
const [
|
|
1657
|
+
const [_, x] = Y(
|
|
1620
1658
|
async () => {
|
|
1621
1659
|
try {
|
|
1622
1660
|
S(), n({ type: "RESET" }), e == null || e(), s({ state: "idle" });
|
|
1623
|
-
} catch (
|
|
1624
|
-
throw console.error("Error clearing session:",
|
|
1661
|
+
} catch (A) {
|
|
1662
|
+
throw console.error("Error clearing session:", A), A;
|
|
1625
1663
|
}
|
|
1626
1664
|
},
|
|
1627
1665
|
[S, n, e, s]
|
|
1628
|
-
), [
|
|
1666
|
+
), [X, K] = Y(
|
|
1629
1667
|
async () => {
|
|
1630
1668
|
try {
|
|
1631
1669
|
await x();
|
|
1632
|
-
const { data:
|
|
1633
|
-
return h(
|
|
1634
|
-
} catch (
|
|
1635
|
-
throw console.error("Error recreating session:",
|
|
1670
|
+
const { data: A } = await l.apis.createSession(a);
|
|
1671
|
+
return h(A), A;
|
|
1672
|
+
} catch (A) {
|
|
1673
|
+
throw console.error("Error recreating session:", A), A;
|
|
1636
1674
|
}
|
|
1637
1675
|
},
|
|
1638
1676
|
[x, l.apis, a, h]
|
|
1639
|
-
),
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
if (!d && o)
|
|
1677
|
+
), j = async ({ content: A, user: N, attachments: L, ...k }) => {
|
|
1678
|
+
var ue;
|
|
1679
|
+
try {
|
|
1680
|
+
let U = d, H = !1;
|
|
1681
|
+
if ((!d || d != null && d.isAssignedToAi) && s({ state: "loading" }), !d && o)
|
|
1645
1682
|
try {
|
|
1646
|
-
const { data:
|
|
1647
|
-
if (
|
|
1648
|
-
h(
|
|
1649
|
-
...
|
|
1650
|
-
isSessionClosed:
|
|
1651
|
-
isAssignedToAi:
|
|
1683
|
+
const { data: w } = await l.apis.createSession(a);
|
|
1684
|
+
if (w)
|
|
1685
|
+
h(w), U = {
|
|
1686
|
+
...w,
|
|
1687
|
+
isSessionClosed: w.status !== pt.OPEN,
|
|
1688
|
+
isAssignedToAi: w.assignee_id === 555,
|
|
1652
1689
|
isAssignedToHuman: !1,
|
|
1653
1690
|
isPendingHuman: !1
|
|
1654
|
-
},
|
|
1691
|
+
}, H = !0;
|
|
1655
1692
|
else
|
|
1656
|
-
throw new Error("Failed to create session");
|
|
1657
|
-
} catch (
|
|
1658
|
-
throw
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
const H = te(), { headers: fe, queryParams: Ee } = i;
|
|
1663
|
-
try {
|
|
1664
|
-
if (n({
|
|
1665
|
-
type: "APPEND_USER_MESSAGE",
|
|
1666
|
-
payload: {
|
|
1667
|
-
type: "FROM_USER",
|
|
1668
|
-
id: H,
|
|
1669
|
-
content: w.text,
|
|
1670
|
-
user: {
|
|
1671
|
-
...i.user,
|
|
1672
|
-
...C
|
|
1673
|
-
},
|
|
1674
|
-
deliveredAt: null,
|
|
1675
|
-
attachments: P
|
|
1676
|
-
}
|
|
1677
|
-
}), t.keyboard && n({
|
|
1678
|
-
type: "SET_KEYBOARD",
|
|
1679
|
-
payload: null
|
|
1680
|
-
}), !K && q.isAssignedToAi) {
|
|
1681
|
-
const G = await z(q.id);
|
|
1682
|
-
G && (q = G);
|
|
1693
|
+
throw new Error("Failed to create new chat session");
|
|
1694
|
+
} catch (w) {
|
|
1695
|
+
throw s({
|
|
1696
|
+
state: "error",
|
|
1697
|
+
error: w instanceof Error ? w.message : "Failed to create session"
|
|
1698
|
+
}), w;
|
|
1683
1699
|
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1700
|
+
if (!U) {
|
|
1701
|
+
const w = new Error("No active session available");
|
|
1702
|
+
throw s({ state: "error", error: w.message }), w;
|
|
1703
|
+
}
|
|
1704
|
+
const z = ee(), { headers: fe, queryParams: we } = i;
|
|
1705
|
+
if (n({
|
|
1706
|
+
type: "APPEND_USER_MESSAGE",
|
|
1707
|
+
payload: {
|
|
1708
|
+
type: "FROM_USER",
|
|
1709
|
+
id: z,
|
|
1710
|
+
content: A.text,
|
|
1691
1711
|
user: {
|
|
1692
1712
|
...i.user,
|
|
1693
|
-
...
|
|
1713
|
+
...N
|
|
1694
1714
|
},
|
|
1695
|
-
|
|
1696
|
-
attachments:
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1715
|
+
deliveredAt: null,
|
|
1716
|
+
attachments: L
|
|
1717
|
+
}
|
|
1718
|
+
}), t.keyboard && n({
|
|
1719
|
+
type: "SET_KEYBOARD",
|
|
1720
|
+
payload: null
|
|
1721
|
+
}), !H && U.isAssignedToAi)
|
|
1722
|
+
try {
|
|
1723
|
+
const w = await q(U.id);
|
|
1724
|
+
w && (U = w);
|
|
1725
|
+
} catch (w) {
|
|
1726
|
+
console.error("Error polling session:", w);
|
|
1727
|
+
}
|
|
1728
|
+
const se = await l.apis.sendMessage({
|
|
1729
|
+
id: z,
|
|
1730
|
+
content: A.text,
|
|
1731
|
+
session_id: U.id,
|
|
1732
|
+
bot_token: a,
|
|
1733
|
+
headers: fe,
|
|
1734
|
+
query_params: we,
|
|
1735
|
+
user: {
|
|
1736
|
+
...i.user,
|
|
1737
|
+
...N
|
|
1738
|
+
},
|
|
1739
|
+
language: c,
|
|
1740
|
+
attachments: L,
|
|
1741
|
+
...k
|
|
1742
|
+
});
|
|
1743
|
+
if (n({
|
|
1744
|
+
type: "SET_DELIVERED_AT",
|
|
1745
|
+
payload: {
|
|
1746
|
+
clientMessageId: z,
|
|
1747
|
+
deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1748
|
+
}
|
|
1749
|
+
}), se.data.success) {
|
|
1750
|
+
const w = se.data;
|
|
1751
|
+
if (w.autopilotResponse && n({
|
|
1752
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1701
1753
|
payload: {
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
type: "ADD_RESPONSE_MESSAGE",
|
|
1709
|
-
payload: {
|
|
1710
|
-
type: "FROM_BOT",
|
|
1711
|
-
id: G.autopilotResponse.id || te(),
|
|
1712
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1713
|
-
component: "TEXT",
|
|
1714
|
-
data: {
|
|
1715
|
-
message: G.autopilotResponse.value.content
|
|
1716
|
-
}
|
|
1754
|
+
type: "FROM_BOT",
|
|
1755
|
+
id: w.autopilotResponse.id || ee(),
|
|
1756
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1757
|
+
component: "TEXT",
|
|
1758
|
+
data: {
|
|
1759
|
+
message: w.autopilotResponse.value.content
|
|
1717
1760
|
}
|
|
1718
|
-
}), G.uiResponse) {
|
|
1719
|
-
const we = G.uiResponse.value;
|
|
1720
|
-
n({
|
|
1721
|
-
type: "ADD_RESPONSE_MESSAGE",
|
|
1722
|
-
payload: {
|
|
1723
|
-
type: "FROM_BOT",
|
|
1724
|
-
id: te(),
|
|
1725
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1726
|
-
component: we.name,
|
|
1727
|
-
data: we.request_response
|
|
1728
|
-
}
|
|
1729
|
-
});
|
|
1730
1761
|
}
|
|
1731
|
-
}
|
|
1762
|
+
}), w.uiResponse) {
|
|
1763
|
+
const me = w.uiResponse.value;
|
|
1732
1764
|
n({
|
|
1733
1765
|
type: "ADD_RESPONSE_MESSAGE",
|
|
1734
1766
|
payload: {
|
|
1735
1767
|
type: "FROM_BOT",
|
|
1736
|
-
id:
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
variant: "error"
|
|
1741
|
-
}
|
|
1768
|
+
id: ee(),
|
|
1769
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1770
|
+
component: me.name,
|
|
1771
|
+
data: me.request_response
|
|
1742
1772
|
}
|
|
1743
1773
|
});
|
|
1744
|
-
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1774
|
+
}
|
|
1775
|
+
} else {
|
|
1776
|
+
const w = ((ue = se.data.error) == null ? void 0 : ue.message) || "Unknown error occurred";
|
|
1777
|
+
n({
|
|
1778
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1779
|
+
payload: {
|
|
1780
|
+
type: "FROM_BOT",
|
|
1781
|
+
id: ee(),
|
|
1782
|
+
component: "TEXT",
|
|
1783
|
+
data: {
|
|
1784
|
+
message: w,
|
|
1785
|
+
variant: "error"
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
}), s({ state: "error", error: w });
|
|
1749
1789
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1790
|
+
return s({ state: "idle" }), { id: z };
|
|
1791
|
+
} catch (U) {
|
|
1792
|
+
const H = U instanceof Error ? U.message : "An unexpected error occurred";
|
|
1793
|
+
throw console.error("Error in sendMessage:", H, U), (!d || d != null && d.isAssignedToAi) && s({ state: "error", error: H }), U;
|
|
1794
|
+
}
|
|
1795
|
+
}, re = ge(
|
|
1796
|
+
(A) => {
|
|
1797
|
+
j({
|
|
1755
1798
|
content: {
|
|
1756
|
-
text:
|
|
1799
|
+
text: A
|
|
1757
1800
|
}
|
|
1758
|
-
}).catch((
|
|
1759
|
-
console.error("Error handling keyboard input:",
|
|
1801
|
+
}).catch((N) => {
|
|
1802
|
+
console.error("Error handling keyboard input:", N);
|
|
1760
1803
|
}), n({
|
|
1761
1804
|
type: "SET_KEYBOARD",
|
|
1762
1805
|
payload: null
|
|
1763
1806
|
});
|
|
1764
1807
|
},
|
|
1765
|
-
[n,
|
|
1808
|
+
[n, j]
|
|
1766
1809
|
);
|
|
1767
1810
|
return {
|
|
1768
1811
|
version: jn.version,
|
|
1769
1812
|
state: t,
|
|
1770
1813
|
session: d,
|
|
1771
1814
|
noMessages: o,
|
|
1772
|
-
initState:
|
|
1773
|
-
clearSessionState:
|
|
1774
|
-
recreateSessionState:
|
|
1815
|
+
initState: F,
|
|
1816
|
+
clearSessionState: _,
|
|
1817
|
+
recreateSessionState: X,
|
|
1775
1818
|
hookState: r,
|
|
1776
|
-
recreateSession:
|
|
1819
|
+
recreateSession: K,
|
|
1777
1820
|
clearSession: x,
|
|
1778
|
-
sendMessage:
|
|
1779
|
-
handleKeyboard:
|
|
1821
|
+
sendMessage: j,
|
|
1822
|
+
handleKeyboard: re
|
|
1780
1823
|
};
|
|
1781
1824
|
}
|
|
1782
|
-
const [
|
|
1825
|
+
const [ps, hr] = Ce();
|
|
1783
1826
|
function mr({
|
|
1784
1827
|
children: e
|
|
1785
1828
|
}) {
|
|
1786
|
-
const { settings: t } =
|
|
1829
|
+
const { settings: t } = B(), n = gr({
|
|
1787
1830
|
defaultHookSettings: {
|
|
1788
1831
|
persistSession: (t == null ? void 0 : t.persistSession) ?? !0,
|
|
1789
1832
|
useSoundEffects: (t == null ? void 0 : t.useSoundEffects) ?? !1
|
|
1790
1833
|
}
|
|
1791
1834
|
});
|
|
1792
|
-
return /* @__PURE__ */
|
|
1835
|
+
return /* @__PURE__ */ te(hr, { value: n, children: e });
|
|
1793
1836
|
}
|
|
1794
1837
|
function yr() {
|
|
1795
|
-
const { http: e, botToken: t, user: n, collectUserData: r } =
|
|
1838
|
+
const { http: e, botToken: t, user: n, collectUserData: r } = B(), [s, o] = We(
|
|
1796
1839
|
`${t}:contact:${n.external_id}`,
|
|
1797
1840
|
null,
|
|
1798
1841
|
"local"
|
|
1799
|
-
), [a, l] =
|
|
1842
|
+
), [a, l] = Y(
|
|
1800
1843
|
async (u) => {
|
|
1801
1844
|
var c;
|
|
1802
1845
|
try {
|
|
@@ -1813,7 +1856,7 @@ function yr() {
|
|
|
1813
1856
|
le(() => {
|
|
1814
1857
|
n && t && l(n);
|
|
1815
1858
|
}, [n, t]);
|
|
1816
|
-
const p =
|
|
1859
|
+
const p = ne(() => !(s != null && s.id) && r ? {
|
|
1817
1860
|
should: !0,
|
|
1818
1861
|
reason: "No contact id and collectUserData is true"
|
|
1819
1862
|
} : {
|
|
@@ -1826,18 +1869,18 @@ function yr() {
|
|
|
1826
1869
|
shouldCollectData: p
|
|
1827
1870
|
};
|
|
1828
1871
|
}
|
|
1829
|
-
const [
|
|
1872
|
+
const [gs, Sr] = Ce();
|
|
1830
1873
|
function vr({ children: e }) {
|
|
1831
1874
|
const t = yr();
|
|
1832
|
-
return /* @__PURE__ */
|
|
1875
|
+
return /* @__PURE__ */ te(Sr, { value: t, children: e });
|
|
1833
1876
|
}
|
|
1834
|
-
function
|
|
1877
|
+
function hs({
|
|
1835
1878
|
children: e,
|
|
1836
1879
|
options: t
|
|
1837
1880
|
}) {
|
|
1838
|
-
return /* @__PURE__ */
|
|
1881
|
+
return /* @__PURE__ */ te(Zn, { data: t, children: /* @__PURE__ */ te(vr, { children: /* @__PURE__ */ te(St, { children: /* @__PURE__ */ te(mr, { children: e }) }) }) });
|
|
1839
1882
|
}
|
|
1840
|
-
var
|
|
1883
|
+
var Ge = { exports: {} }, Ie = {};
|
|
1841
1884
|
/**
|
|
1842
1885
|
* @license React
|
|
1843
1886
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -1847,10 +1890,10 @@ var ze = { exports: {} }, je = {};
|
|
|
1847
1890
|
* This source code is licensed under the MIT license found in the
|
|
1848
1891
|
* LICENSE file in the root directory of this source tree.
|
|
1849
1892
|
*/
|
|
1850
|
-
var
|
|
1893
|
+
var it;
|
|
1851
1894
|
function Er() {
|
|
1852
|
-
if (
|
|
1853
|
-
|
|
1895
|
+
if (it) return Ie;
|
|
1896
|
+
it = 1;
|
|
1854
1897
|
var e = de;
|
|
1855
1898
|
function t(i, g) {
|
|
1856
1899
|
return i === g && (i !== 0 || 1 / i === 1 / g) || i !== i && g !== g;
|
|
@@ -1880,9 +1923,9 @@ function Er() {
|
|
|
1880
1923
|
return g();
|
|
1881
1924
|
}
|
|
1882
1925
|
var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
|
|
1883
|
-
return
|
|
1926
|
+
return Ie.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : c, Ie;
|
|
1884
1927
|
}
|
|
1885
|
-
var
|
|
1928
|
+
var je = {};
|
|
1886
1929
|
/**
|
|
1887
1930
|
* @license React
|
|
1888
1931
|
* use-sync-external-store-shim.development.js
|
|
@@ -1892,63 +1935,63 @@ var ke = {};
|
|
|
1892
1935
|
* This source code is licensed under the MIT license found in the
|
|
1893
1936
|
* LICENSE file in the root directory of this source tree.
|
|
1894
1937
|
*/
|
|
1895
|
-
var
|
|
1938
|
+
var ct;
|
|
1896
1939
|
function wr() {
|
|
1897
|
-
return
|
|
1940
|
+
return ct || (ct = 1, process.env.NODE_ENV !== "production" && function() {
|
|
1898
1941
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1899
1942
|
var e = de, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1900
|
-
function n(
|
|
1943
|
+
function n(C) {
|
|
1901
1944
|
{
|
|
1902
1945
|
for (var y = arguments.length, b = new Array(y > 1 ? y - 1 : 0), v = 1; v < y; v++)
|
|
1903
1946
|
b[v - 1] = arguments[v];
|
|
1904
|
-
r("error",
|
|
1947
|
+
r("error", C, b);
|
|
1905
1948
|
}
|
|
1906
1949
|
}
|
|
1907
|
-
function r(
|
|
1950
|
+
function r(C, y, b) {
|
|
1908
1951
|
{
|
|
1909
|
-
var v = t.ReactDebugCurrentFrame,
|
|
1910
|
-
|
|
1911
|
-
var O = b.map(function(
|
|
1912
|
-
return String(
|
|
1952
|
+
var v = t.ReactDebugCurrentFrame, F = v.getStackAddendum();
|
|
1953
|
+
F !== "" && (y += "%s", b = b.concat([F]));
|
|
1954
|
+
var O = b.map(function(_) {
|
|
1955
|
+
return String(_);
|
|
1913
1956
|
});
|
|
1914
|
-
O.unshift("Warning: " + y), Function.prototype.apply.call(console[
|
|
1957
|
+
O.unshift("Warning: " + y), Function.prototype.apply.call(console[C], console, O);
|
|
1915
1958
|
}
|
|
1916
1959
|
}
|
|
1917
|
-
function s(
|
|
1918
|
-
return
|
|
1960
|
+
function s(C, y) {
|
|
1961
|
+
return C === y && (C !== 0 || 1 / C === 1 / y) || C !== C && y !== y;
|
|
1919
1962
|
}
|
|
1920
1963
|
var o = typeof Object.is == "function" ? Object.is : s, a = e.useState, l = e.useEffect, p = e.useLayoutEffect, u = e.useDebugValue, c = !1, i = !1;
|
|
1921
|
-
function g(
|
|
1964
|
+
function g(C, y, b) {
|
|
1922
1965
|
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."));
|
|
1923
1966
|
var v = y();
|
|
1924
1967
|
if (!i) {
|
|
1925
|
-
var
|
|
1926
|
-
o(v,
|
|
1968
|
+
var F = y();
|
|
1969
|
+
o(v, F) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), i = !0);
|
|
1927
1970
|
}
|
|
1928
1971
|
var O = a({
|
|
1929
1972
|
inst: {
|
|
1930
1973
|
value: v,
|
|
1931
1974
|
getSnapshot: y
|
|
1932
1975
|
}
|
|
1933
|
-
}),
|
|
1976
|
+
}), _ = O[0].inst, x = O[1];
|
|
1934
1977
|
return p(function() {
|
|
1935
|
-
|
|
1936
|
-
inst:
|
|
1978
|
+
_.value = v, _.getSnapshot = y, f(_) && x({
|
|
1979
|
+
inst: _
|
|
1937
1980
|
});
|
|
1938
|
-
}, [
|
|
1939
|
-
f(
|
|
1940
|
-
inst:
|
|
1981
|
+
}, [C, v, y]), l(function() {
|
|
1982
|
+
f(_) && x({
|
|
1983
|
+
inst: _
|
|
1941
1984
|
});
|
|
1942
|
-
var
|
|
1943
|
-
f(
|
|
1944
|
-
inst:
|
|
1985
|
+
var X = function() {
|
|
1986
|
+
f(_) && x({
|
|
1987
|
+
inst: _
|
|
1945
1988
|
});
|
|
1946
1989
|
};
|
|
1947
|
-
return
|
|
1948
|
-
}, [
|
|
1990
|
+
return C(X);
|
|
1991
|
+
}, [C]), u(v), v;
|
|
1949
1992
|
}
|
|
1950
|
-
function f(
|
|
1951
|
-
var y =
|
|
1993
|
+
function f(C) {
|
|
1994
|
+
var y = C.getSnapshot, b = C.value;
|
|
1952
1995
|
try {
|
|
1953
1996
|
var v = y();
|
|
1954
1997
|
return !o(b, v);
|
|
@@ -1956,116 +1999,116 @@ function wr() {
|
|
|
1956
1999
|
return !0;
|
|
1957
2000
|
}
|
|
1958
2001
|
}
|
|
1959
|
-
function m(
|
|
2002
|
+
function m(C, y, b) {
|
|
1960
2003
|
return y();
|
|
1961
2004
|
}
|
|
1962
|
-
var d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", S = !d, h = S ? m : g,
|
|
1963
|
-
|
|
1964
|
-
}()),
|
|
2005
|
+
var d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", S = !d, h = S ? m : g, q = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h;
|
|
2006
|
+
je.useSyncExternalStore = q, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2007
|
+
}()), je;
|
|
1965
2008
|
}
|
|
1966
|
-
process.env.NODE_ENV === "production" ?
|
|
1967
|
-
var br =
|
|
1968
|
-
const
|
|
1969
|
-
},
|
|
2009
|
+
process.env.NODE_ENV === "production" ? Ge.exports = Er() : Ge.exports = wr();
|
|
2010
|
+
var br = Ge.exports;
|
|
2011
|
+
const ie = () => {
|
|
2012
|
+
}, V = (
|
|
1970
2013
|
/*#__NOINLINE__*/
|
|
1971
|
-
|
|
1972
|
-
),
|
|
2014
|
+
ie()
|
|
2015
|
+
), ke = Object, E = (e) => e === V, W = (e) => typeof e == "function", ce = (e, t) => ({
|
|
1973
2016
|
...e,
|
|
1974
2017
|
...t
|
|
1975
|
-
}), Or = (e) =>
|
|
2018
|
+
}), Or = (e) => W(e.then), Oe = /* @__PURE__ */ new WeakMap();
|
|
1976
2019
|
let Ar = 0;
|
|
1977
|
-
const
|
|
2020
|
+
const ve = (e) => {
|
|
1978
2021
|
const t = typeof e, n = e && e.constructor, r = n == Date;
|
|
1979
2022
|
let s, o;
|
|
1980
|
-
if (
|
|
2023
|
+
if (ke(e) === e && !r && n != RegExp) {
|
|
1981
2024
|
if (s = Oe.get(e), s) return s;
|
|
1982
2025
|
if (s = ++Ar + "~", Oe.set(e, s), n == Array) {
|
|
1983
2026
|
for (s = "@", o = 0; o < e.length; o++)
|
|
1984
|
-
s +=
|
|
2027
|
+
s += ve(e[o]) + ",";
|
|
1985
2028
|
Oe.set(e, s);
|
|
1986
2029
|
}
|
|
1987
|
-
if (n ==
|
|
2030
|
+
if (n == ke) {
|
|
1988
2031
|
s = "#";
|
|
1989
|
-
const a =
|
|
2032
|
+
const a = ke.keys(e).sort();
|
|
1990
2033
|
for (; !E(o = a.pop()); )
|
|
1991
|
-
E(e[o]) || (s += o + ":" +
|
|
2034
|
+
E(e[o]) || (s += o + ":" + ve(e[o]) + ",");
|
|
1992
2035
|
Oe.set(e, s);
|
|
1993
2036
|
}
|
|
1994
2037
|
} else
|
|
1995
2038
|
s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
1996
2039
|
return s;
|
|
1997
|
-
},
|
|
1998
|
-
const n =
|
|
2040
|
+
}, $ = /* @__PURE__ */ new WeakMap(), Me = {}, Ae = {}, Je = "undefined", De = typeof window != Je, ze = typeof document != Je, Tr = () => De && typeof window.requestAnimationFrame != Je, Xt = (e, t) => {
|
|
2041
|
+
const n = $.get(e);
|
|
1999
2042
|
return [
|
|
2000
2043
|
// Getter
|
|
2001
|
-
() => !E(t) && e.get(t) ||
|
|
2044
|
+
() => !E(t) && e.get(t) || Me,
|
|
2002
2045
|
// Setter
|
|
2003
2046
|
(r) => {
|
|
2004
2047
|
if (!E(t)) {
|
|
2005
2048
|
const s = e.get(t);
|
|
2006
|
-
t in Ae || (Ae[t] = s), n[5](t,
|
|
2049
|
+
t in Ae || (Ae[t] = s), n[5](t, ce(s, r), s || Me);
|
|
2007
2050
|
}
|
|
2008
2051
|
},
|
|
2009
2052
|
// Subscriber
|
|
2010
2053
|
n[6],
|
|
2011
2054
|
// Get server cache snapshot
|
|
2012
|
-
() => !E(t) && t in Ae ? Ae[t] : !E(t) && e.get(t) ||
|
|
2055
|
+
() => !E(t) && t in Ae ? Ae[t] : !E(t) && e.get(t) || Me
|
|
2013
2056
|
];
|
|
2014
2057
|
};
|
|
2015
|
-
let
|
|
2016
|
-
const Rr = () =>
|
|
2058
|
+
let Ye = !0;
|
|
2059
|
+
const Rr = () => Ye, [Be, qe] = De && window.addEventListener ? [
|
|
2017
2060
|
window.addEventListener.bind(window),
|
|
2018
2061
|
window.removeEventListener.bind(window)
|
|
2019
2062
|
] : [
|
|
2020
|
-
|
|
2021
|
-
|
|
2063
|
+
ie,
|
|
2064
|
+
ie
|
|
2022
2065
|
], Cr = () => {
|
|
2023
|
-
const e =
|
|
2066
|
+
const e = ze && document.visibilityState;
|
|
2024
2067
|
return E(e) || e !== "hidden";
|
|
2025
|
-
},
|
|
2026
|
-
|
|
2027
|
-
}),
|
|
2068
|
+
}, Nr = (e) => (ze && document.addEventListener("visibilitychange", e), Be("focus", e), () => {
|
|
2069
|
+
ze && document.removeEventListener("visibilitychange", e), qe("focus", e);
|
|
2070
|
+
}), Dr = (e) => {
|
|
2028
2071
|
const t = () => {
|
|
2029
|
-
|
|
2072
|
+
Ye = !0, e();
|
|
2030
2073
|
}, n = () => {
|
|
2031
|
-
|
|
2074
|
+
Ye = !1;
|
|
2032
2075
|
};
|
|
2033
|
-
return
|
|
2034
|
-
|
|
2076
|
+
return Be("online", t), Be("offline", n), () => {
|
|
2077
|
+
qe("online", t), qe("offline", n);
|
|
2035
2078
|
};
|
|
2036
|
-
},
|
|
2079
|
+
}, _r = {
|
|
2037
2080
|
isOnline: Rr,
|
|
2038
2081
|
isVisible: Cr
|
|
2039
2082
|
}, xr = {
|
|
2040
|
-
initFocus:
|
|
2041
|
-
initReconnect:
|
|
2042
|
-
},
|
|
2083
|
+
initFocus: Nr,
|
|
2084
|
+
initReconnect: Dr
|
|
2085
|
+
}, ut = !de.useId, Ee = !De || "Deno" in window, Pr = (e) => Tr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Fe = Ee ? le : cn, Le = typeof navigator < "u" && navigator.connection, lt = !Ee && Le && ([
|
|
2043
2086
|
"slow-2g",
|
|
2044
2087
|
"2g"
|
|
2045
|
-
].includes(
|
|
2046
|
-
if (
|
|
2088
|
+
].includes(Le.effectiveType) || Le.saveData), Ze = (e) => {
|
|
2089
|
+
if (W(e))
|
|
2047
2090
|
try {
|
|
2048
2091
|
e = e();
|
|
2049
2092
|
} catch {
|
|
2050
2093
|
e = "";
|
|
2051
2094
|
}
|
|
2052
2095
|
const t = e;
|
|
2053
|
-
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ?
|
|
2096
|
+
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? ve(e) : "", [
|
|
2054
2097
|
e,
|
|
2055
2098
|
t
|
|
2056
2099
|
];
|
|
2057
2100
|
};
|
|
2058
2101
|
let Ir = 0;
|
|
2059
|
-
const
|
|
2060
|
-
var
|
|
2102
|
+
const Xe = () => ++Ir, Qt = 0, Wt = 1, Kt = 2, jr = 3;
|
|
2103
|
+
var Se = {
|
|
2061
2104
|
__proto__: null,
|
|
2062
2105
|
ERROR_REVALIDATE_EVENT: jr,
|
|
2063
|
-
FOCUS_EVENT:
|
|
2064
|
-
MUTATE_EVENT:
|
|
2065
|
-
RECONNECT_EVENT:
|
|
2106
|
+
FOCUS_EVENT: Qt,
|
|
2107
|
+
MUTATE_EVENT: Kt,
|
|
2108
|
+
RECONNECT_EVENT: Wt
|
|
2066
2109
|
};
|
|
2067
|
-
async function
|
|
2068
|
-
const [t, n, r, s] = e, o =
|
|
2110
|
+
async function Jt(...e) {
|
|
2111
|
+
const [t, n, r, s] = e, o = ce({
|
|
2069
2112
|
populateCache: !0,
|
|
2070
2113
|
throwOnError: !0
|
|
2071
2114
|
}, typeof s == "boolean" ? {
|
|
@@ -2075,7 +2118,7 @@ async function Zt(...e) {
|
|
|
2075
2118
|
const l = o.rollbackOnError;
|
|
2076
2119
|
let p = o.optimisticData;
|
|
2077
2120
|
const u = (g) => typeof l == "function" ? l(g) : l !== !1, c = o.throwOnError;
|
|
2078
|
-
if (
|
|
2121
|
+
if (W(n)) {
|
|
2079
2122
|
const g = n, f = [], m = t.keys();
|
|
2080
2123
|
for (const d of m)
|
|
2081
2124
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
@@ -2084,57 +2127,57 @@ async function Zt(...e) {
|
|
|
2084
2127
|
}
|
|
2085
2128
|
return i(n);
|
|
2086
2129
|
async function i(g) {
|
|
2087
|
-
const [f] =
|
|
2130
|
+
const [f] = Ze(g);
|
|
2088
2131
|
if (!f) return;
|
|
2089
|
-
const [m, d] =
|
|
2090
|
-
const
|
|
2091
|
-
return (
|
|
2132
|
+
const [m, d] = Xt(t, f), [S, h, q, C] = $.get(t), y = () => {
|
|
2133
|
+
const j = S[f];
|
|
2134
|
+
return (W(o.revalidate) ? o.revalidate(m().data, g) : o.revalidate !== !1) && (delete q[f], delete C[f], j && j[0]) ? j[0](Kt).then(() => m().data) : m().data;
|
|
2092
2135
|
};
|
|
2093
2136
|
if (e.length < 3)
|
|
2094
2137
|
return y();
|
|
2095
2138
|
let b = r, v;
|
|
2096
|
-
const
|
|
2139
|
+
const F = Xe();
|
|
2097
2140
|
h[f] = [
|
|
2098
|
-
|
|
2141
|
+
F,
|
|
2099
2142
|
0
|
|
2100
2143
|
];
|
|
2101
|
-
const O = !E(p),
|
|
2102
|
-
if (O && (p =
|
|
2144
|
+
const O = !E(p), _ = m(), x = _.data, X = _._c, K = E(X) ? x : X;
|
|
2145
|
+
if (O && (p = W(p) ? p(K, x) : p, d({
|
|
2103
2146
|
data: p,
|
|
2104
|
-
_c:
|
|
2105
|
-
})),
|
|
2147
|
+
_c: K
|
|
2148
|
+
})), W(b))
|
|
2106
2149
|
try {
|
|
2107
|
-
b = b(
|
|
2108
|
-
} catch (
|
|
2109
|
-
v =
|
|
2150
|
+
b = b(K);
|
|
2151
|
+
} catch (j) {
|
|
2152
|
+
v = j;
|
|
2110
2153
|
}
|
|
2111
2154
|
if (b && Or(b))
|
|
2112
|
-
if (b = await b.catch((
|
|
2113
|
-
v =
|
|
2114
|
-
}),
|
|
2155
|
+
if (b = await b.catch((j) => {
|
|
2156
|
+
v = j;
|
|
2157
|
+
}), F !== h[f][0]) {
|
|
2115
2158
|
if (v) throw v;
|
|
2116
2159
|
return b;
|
|
2117
2160
|
} else v && O && u(v) && (a = !0, d({
|
|
2118
|
-
data:
|
|
2119
|
-
_c:
|
|
2161
|
+
data: K,
|
|
2162
|
+
_c: V
|
|
2120
2163
|
}));
|
|
2121
2164
|
if (a && !v)
|
|
2122
|
-
if (
|
|
2123
|
-
const
|
|
2165
|
+
if (W(a)) {
|
|
2166
|
+
const j = a(b, K);
|
|
2124
2167
|
d({
|
|
2125
|
-
data:
|
|
2126
|
-
error:
|
|
2127
|
-
_c:
|
|
2168
|
+
data: j,
|
|
2169
|
+
error: V,
|
|
2170
|
+
_c: V
|
|
2128
2171
|
});
|
|
2129
2172
|
} else
|
|
2130
2173
|
d({
|
|
2131
2174
|
data: b,
|
|
2132
|
-
error:
|
|
2133
|
-
_c:
|
|
2175
|
+
error: V,
|
|
2176
|
+
_c: V
|
|
2134
2177
|
});
|
|
2135
|
-
if (h[f][1] =
|
|
2178
|
+
if (h[f][1] = Xe(), Promise.resolve(y()).then(() => {
|
|
2136
2179
|
d({
|
|
2137
|
-
_c:
|
|
2180
|
+
_c: V
|
|
2138
2181
|
});
|
|
2139
2182
|
}), v) {
|
|
2140
2183
|
if (c) throw v;
|
|
@@ -2143,13 +2186,13 @@ async function Zt(...e) {
|
|
|
2143
2186
|
return b;
|
|
2144
2187
|
}
|
|
2145
2188
|
}
|
|
2146
|
-
const
|
|
2189
|
+
const dt = (e, t) => {
|
|
2147
2190
|
for (const n in e)
|
|
2148
2191
|
e[n][0] && e[n][0](t);
|
|
2149
2192
|
}, kr = (e, t) => {
|
|
2150
|
-
if (
|
|
2151
|
-
const n =
|
|
2152
|
-
let o =
|
|
2193
|
+
if (!$.has(e)) {
|
|
2194
|
+
const n = ce(xr, t), r = {}, s = Jt.bind(V, e);
|
|
2195
|
+
let o = ie;
|
|
2153
2196
|
const a = {}, l = (c, i) => {
|
|
2154
2197
|
const g = a[c] || [];
|
|
2155
2198
|
return a[c] = g, g.push(i), () => g.splice(g.indexOf(i), 1);
|
|
@@ -2160,7 +2203,7 @@ const ft = (e, t) => {
|
|
|
2160
2203
|
for (const m of f)
|
|
2161
2204
|
m(i, g);
|
|
2162
2205
|
}, u = () => {
|
|
2163
|
-
if (
|
|
2206
|
+
if (!$.has(e) && ($.set(e, [
|
|
2164
2207
|
r,
|
|
2165
2208
|
{},
|
|
2166
2209
|
{},
|
|
@@ -2168,10 +2211,10 @@ const ft = (e, t) => {
|
|
|
2168
2211
|
s,
|
|
2169
2212
|
p,
|
|
2170
2213
|
l
|
|
2171
|
-
]), !
|
|
2172
|
-
const c = n.initFocus(setTimeout.bind(
|
|
2214
|
+
]), !Ee)) {
|
|
2215
|
+
const c = n.initFocus(setTimeout.bind(V, dt.bind(V, r, Qt))), i = n.initReconnect(setTimeout.bind(V, dt.bind(V, r, Wt)));
|
|
2173
2216
|
o = () => {
|
|
2174
|
-
c && c(), i && i(),
|
|
2217
|
+
c && c(), i && i(), $.delete(e);
|
|
2175
2218
|
};
|
|
2176
2219
|
}
|
|
2177
2220
|
};
|
|
@@ -2184,48 +2227,48 @@ const ft = (e, t) => {
|
|
|
2184
2227
|
}
|
|
2185
2228
|
return [
|
|
2186
2229
|
e,
|
|
2187
|
-
|
|
2230
|
+
$.get(e)[4]
|
|
2188
2231
|
];
|
|
2189
2232
|
}, Mr = (e, t, n, r, s) => {
|
|
2190
2233
|
const o = n.errorRetryCount, a = s.retryCount, l = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
|
|
2191
2234
|
!E(o) && a > o || setTimeout(r, l, s);
|
|
2192
|
-
},
|
|
2235
|
+
}, Fr = (e, t) => ve(e) == ve(t), [Zt, Lr] = kr(/* @__PURE__ */ new Map()), Vr = ce(
|
|
2193
2236
|
{
|
|
2194
2237
|
// events
|
|
2195
|
-
onLoadingSlow:
|
|
2196
|
-
onSuccess:
|
|
2197
|
-
onError:
|
|
2238
|
+
onLoadingSlow: ie,
|
|
2239
|
+
onSuccess: ie,
|
|
2240
|
+
onError: ie,
|
|
2198
2241
|
onErrorRetry: Mr,
|
|
2199
|
-
onDiscarded:
|
|
2242
|
+
onDiscarded: ie,
|
|
2200
2243
|
// switches
|
|
2201
2244
|
revalidateOnFocus: !0,
|
|
2202
2245
|
revalidateOnReconnect: !0,
|
|
2203
2246
|
revalidateIfStale: !0,
|
|
2204
2247
|
shouldRetryOnError: !0,
|
|
2205
2248
|
// timeouts
|
|
2206
|
-
errorRetryInterval:
|
|
2249
|
+
errorRetryInterval: lt ? 1e4 : 5e3,
|
|
2207
2250
|
focusThrottleInterval: 5 * 1e3,
|
|
2208
2251
|
dedupingInterval: 2 * 1e3,
|
|
2209
|
-
loadingTimeout:
|
|
2252
|
+
loadingTimeout: lt ? 5e3 : 3e3,
|
|
2210
2253
|
// providers
|
|
2211
|
-
compare:
|
|
2254
|
+
compare: Fr,
|
|
2212
2255
|
isPaused: () => !1,
|
|
2213
|
-
cache:
|
|
2214
|
-
mutate:
|
|
2256
|
+
cache: Zt,
|
|
2257
|
+
mutate: Lr,
|
|
2215
2258
|
fallback: {}
|
|
2216
2259
|
},
|
|
2217
2260
|
// use web preset by default
|
|
2218
|
-
|
|
2261
|
+
_r
|
|
2219
2262
|
), Ur = (e, t) => {
|
|
2220
|
-
const n =
|
|
2263
|
+
const n = ce(e, t);
|
|
2221
2264
|
if (t) {
|
|
2222
2265
|
const { use: r, fallback: s } = e, { use: o, fallback: a } = t;
|
|
2223
|
-
r && o && (n.use = r.concat(o)), s && a && (n.fallback =
|
|
2266
|
+
r && o && (n.use = r.concat(o)), s && a && (n.fallback = ce(s, a));
|
|
2224
2267
|
}
|
|
2225
2268
|
return n;
|
|
2226
|
-
}, Hr =
|
|
2227
|
-
|
|
2228
|
-
}, Br = (e) =>
|
|
2269
|
+
}, Hr = gt({}), Gr = "$inf$", $t = De && window.__SWR_DEVTOOLS_USE__, zr = $t ? window.__SWR_DEVTOOLS_USE__ : [], Yr = () => {
|
|
2270
|
+
$t && (window.__SWR_DEVTOOLS_REACT__ = de);
|
|
2271
|
+
}, Br = (e) => W(e[1]) ? [
|
|
2229
2272
|
e[0],
|
|
2230
2273
|
e[1],
|
|
2231
2274
|
e[2] || {}
|
|
@@ -2233,8 +2276,8 @@ const ft = (e, t) => {
|
|
|
2233
2276
|
e[0],
|
|
2234
2277
|
null,
|
|
2235
2278
|
(e[1] === null ? e[2] : e[1]) || {}
|
|
2236
|
-
], qr = () =>
|
|
2237
|
-
const [a] =
|
|
2279
|
+
], qr = () => ce(Vr, ht(Hr)), Xr = (e) => (t, n, r) => e(t, n && ((...o) => {
|
|
2280
|
+
const [a] = Ze(t), [, , , l] = $.get(Zt);
|
|
2238
2281
|
if (a.startsWith(Gr))
|
|
2239
2282
|
return n(...o);
|
|
2240
2283
|
const p = l[a];
|
|
@@ -2254,7 +2297,7 @@ const ft = (e, t) => {
|
|
|
2254
2297
|
};
|
|
2255
2298
|
};
|
|
2256
2299
|
Yr();
|
|
2257
|
-
const
|
|
2300
|
+
const ft = de.use || ((e) => {
|
|
2258
2301
|
if (e.status === "pending")
|
|
2259
2302
|
throw e;
|
|
2260
2303
|
if (e.status === "fulfilled")
|
|
@@ -2264,95 +2307,95 @@ const pt = de.use || ((e) => {
|
|
|
2264
2307
|
}, (t) => {
|
|
2265
2308
|
e.status = "rejected", e.reason = t;
|
|
2266
2309
|
}), e);
|
|
2267
|
-
}),
|
|
2310
|
+
}), Ve = {
|
|
2268
2311
|
dedupe: !0
|
|
2269
2312
|
}, Jr = (e, t, n) => {
|
|
2270
|
-
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: l, revalidateIfStale: p, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: g } = n, [f, m, d, S] =
|
|
2271
|
-
for (const
|
|
2272
|
-
const
|
|
2273
|
-
if (
|
|
2274
|
-
if (!s(
|
|
2313
|
+
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: l, revalidateIfStale: p, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: g } = n, [f, m, d, S] = $.get(r), [h, q] = Ze(e), C = ae(!1), y = ae(!1), b = ae(h), v = ae(t), F = ae(n), O = () => F.current, _ = () => O().isVisible() && O().isOnline(), [x, X, K, j] = Xt(r, h), re = ae({}).current, A = E(a) ? n.fallback[h] : a, N = (T, R) => {
|
|
2314
|
+
for (const I in re) {
|
|
2315
|
+
const D = I;
|
|
2316
|
+
if (D === "data") {
|
|
2317
|
+
if (!s(T[D], R[D]) && (!E(T[D]) || !s(se, R[D])))
|
|
2275
2318
|
return !1;
|
|
2276
|
-
} else if (
|
|
2319
|
+
} else if (R[D] !== T[D])
|
|
2277
2320
|
return !1;
|
|
2278
2321
|
}
|
|
2279
2322
|
return !0;
|
|
2280
|
-
},
|
|
2281
|
-
const
|
|
2282
|
-
const J =
|
|
2283
|
-
return delete J._k,
|
|
2323
|
+
}, L = ne(() => {
|
|
2324
|
+
const T = !h || !t ? !1 : E(l) ? O().isPaused() || o ? !1 : E(p) ? !0 : p : l, R = (M) => {
|
|
2325
|
+
const J = ce(M);
|
|
2326
|
+
return delete J._k, T ? {
|
|
2284
2327
|
isValidating: !0,
|
|
2285
2328
|
isLoading: !0,
|
|
2286
2329
|
...J
|
|
2287
2330
|
} : J;
|
|
2288
|
-
},
|
|
2289
|
-
let
|
|
2331
|
+
}, I = x(), D = j(), Q = R(I), pe = I === D ? Q : R(D);
|
|
2332
|
+
let P = Q;
|
|
2290
2333
|
return [
|
|
2291
2334
|
() => {
|
|
2292
|
-
const
|
|
2293
|
-
return
|
|
2335
|
+
const M = R(x());
|
|
2336
|
+
return N(M, P) ? (P.data = M.data, P.isLoading = M.isLoading, P.isValidating = M.isValidating, P.error = M.error, P) : (P = M, M);
|
|
2294
2337
|
},
|
|
2295
2338
|
() => pe
|
|
2296
2339
|
];
|
|
2297
2340
|
}, [
|
|
2298
2341
|
r,
|
|
2299
2342
|
h
|
|
2300
|
-
]),
|
|
2301
|
-
(
|
|
2302
|
-
|
|
2343
|
+
]), k = br.useSyncExternalStore(ge(
|
|
2344
|
+
(T) => K(h, (R, I) => {
|
|
2345
|
+
N(I, R) || T();
|
|
2303
2346
|
}),
|
|
2304
2347
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2305
2348
|
[
|
|
2306
2349
|
r,
|
|
2307
2350
|
h
|
|
2308
2351
|
]
|
|
2309
|
-
),
|
|
2310
|
-
async (
|
|
2311
|
-
const
|
|
2312
|
-
if (!h || !
|
|
2352
|
+
), L[0], L[1]), ue = !C.current, U = f[h] && f[h].length > 0, H = k.data, z = E(H) ? A : H, fe = k.error, we = ae(z), se = g ? E(H) ? we.current : H : z, w = U && !E(fe) ? !1 : ue && !E(l) ? l : O().isPaused() ? !1 : o ? E(z) ? !1 : p : E(z) || p, me = !!(h && t && ue && w), en = E(k.isValidating) ? me : k.isValidating, tn = E(k.isLoading) ? me : k.isLoading, ye = ge(
|
|
2353
|
+
async (T) => {
|
|
2354
|
+
const R = v.current;
|
|
2355
|
+
if (!h || !R || y.current || O().isPaused())
|
|
2313
2356
|
return !1;
|
|
2314
|
-
let
|
|
2315
|
-
const pe =
|
|
2357
|
+
let I, D, Q = !0;
|
|
2358
|
+
const pe = T || {}, P = !d[h] || !pe.dedupe, M = () => ut ? !y.current && h === b.current && C.current : h === b.current, J = {
|
|
2316
2359
|
isValidating: !1,
|
|
2317
2360
|
isLoading: !1
|
|
2361
|
+
}, et = () => {
|
|
2362
|
+
X(J);
|
|
2318
2363
|
}, tt = () => {
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
V && V[1] === _ && delete d[h];
|
|
2323
|
-
}, rt = {
|
|
2364
|
+
const G = d[h];
|
|
2365
|
+
G && G[1] === D && delete d[h];
|
|
2366
|
+
}, nt = {
|
|
2324
2367
|
isValidating: !0
|
|
2325
2368
|
};
|
|
2326
|
-
E(x().data) && (
|
|
2369
|
+
E(x().data) && (nt.isLoading = !0);
|
|
2327
2370
|
try {
|
|
2328
|
-
if (
|
|
2329
|
-
|
|
2371
|
+
if (P && (X(nt), n.loadingTimeout && E(x().data) && setTimeout(() => {
|
|
2372
|
+
Q && M() && O().onLoadingSlow(h, n);
|
|
2330
2373
|
}, n.loadingTimeout), d[h] = [
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
]), [
|
|
2334
|
-
return
|
|
2335
|
-
J.error =
|
|
2336
|
-
const
|
|
2337
|
-
if (!E(
|
|
2338
|
-
(
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
return
|
|
2374
|
+
R(q),
|
|
2375
|
+
Xe()
|
|
2376
|
+
]), [I, D] = d[h], I = await I, P && setTimeout(tt, n.dedupingInterval), !d[h] || d[h][1] !== D)
|
|
2377
|
+
return P && M() && O().onDiscarded(h), !1;
|
|
2378
|
+
J.error = V;
|
|
2379
|
+
const G = m[h];
|
|
2380
|
+
if (!E(G) && // case 1
|
|
2381
|
+
(D <= G[0] || // case 2
|
|
2382
|
+
D <= G[1] || // case 3
|
|
2383
|
+
G[1] === 0))
|
|
2384
|
+
return et(), P && M() && O().onDiscarded(h), !1;
|
|
2342
2385
|
const Z = x().data;
|
|
2343
|
-
J.data = s(Z,
|
|
2344
|
-
} catch (
|
|
2345
|
-
|
|
2346
|
-
const Z = O(), { shouldRetryOnError:
|
|
2347
|
-
Z.isPaused() || (J.error =
|
|
2348
|
-
const
|
|
2349
|
-
|
|
2386
|
+
J.data = s(Z, I) ? Z : I, P && M() && O().onSuccess(I, h, n);
|
|
2387
|
+
} catch (G) {
|
|
2388
|
+
tt();
|
|
2389
|
+
const Z = O(), { shouldRetryOnError: _e } = Z;
|
|
2390
|
+
Z.isPaused() || (J.error = G, P && M() && (Z.onError(G, h, Z), (_e === !0 || W(_e) && _e(G)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || _()) && Z.onErrorRetry(G, h, Z, (nn) => {
|
|
2391
|
+
const xe = f[h];
|
|
2392
|
+
xe && xe[0] && xe[0](Se.ERROR_REVALIDATE_EVENT, nn);
|
|
2350
2393
|
}, {
|
|
2351
2394
|
retryCount: (pe.retryCount || 0) + 1,
|
|
2352
2395
|
dedupe: !0
|
|
2353
2396
|
})));
|
|
2354
2397
|
}
|
|
2355
|
-
return
|
|
2398
|
+
return Q = !1, et(), !0;
|
|
2356
2399
|
},
|
|
2357
2400
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
2358
2401
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -2369,108 +2412,111 @@ const pt = de.use || ((e) => {
|
|
|
2369
2412
|
h,
|
|
2370
2413
|
r
|
|
2371
2414
|
]
|
|
2372
|
-
),
|
|
2415
|
+
), $e = ge(
|
|
2373
2416
|
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
2374
|
-
(...
|
|
2417
|
+
(...T) => Jt(r, b.current, ...T),
|
|
2375
2418
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2376
2419
|
[]
|
|
2377
2420
|
);
|
|
2378
2421
|
if (Fe(() => {
|
|
2379
|
-
v.current = t,
|
|
2422
|
+
v.current = t, F.current = n, E(H) || (we.current = H);
|
|
2380
2423
|
}), Fe(() => {
|
|
2381
2424
|
if (!h) return;
|
|
2382
|
-
const
|
|
2383
|
-
let
|
|
2384
|
-
const
|
|
2385
|
-
if (
|
|
2386
|
-
const
|
|
2387
|
-
O().revalidateOnFocus &&
|
|
2388
|
-
} else if (
|
|
2389
|
-
O().revalidateOnReconnect &&
|
|
2425
|
+
const T = ye.bind(V, Ve);
|
|
2426
|
+
let R = 0;
|
|
2427
|
+
const D = Kr(h, f, (Q, pe = {}) => {
|
|
2428
|
+
if (Q == Se.FOCUS_EVENT) {
|
|
2429
|
+
const P = Date.now();
|
|
2430
|
+
O().revalidateOnFocus && P > R && _() && (R = P + O().focusThrottleInterval, T());
|
|
2431
|
+
} else if (Q == Se.RECONNECT_EVENT)
|
|
2432
|
+
O().revalidateOnReconnect && _() && T();
|
|
2390
2433
|
else {
|
|
2391
|
-
if (
|
|
2392
|
-
return
|
|
2393
|
-
if (
|
|
2394
|
-
return
|
|
2434
|
+
if (Q == Se.MUTATE_EVENT)
|
|
2435
|
+
return ye();
|
|
2436
|
+
if (Q == Se.ERROR_REVALIDATE_EVENT)
|
|
2437
|
+
return ye(pe);
|
|
2395
2438
|
}
|
|
2396
2439
|
});
|
|
2397
|
-
return y.current = !1, b.current = h,
|
|
2398
|
-
_k:
|
|
2399
|
-
}),
|
|
2400
|
-
y.current = !0,
|
|
2440
|
+
return y.current = !1, b.current = h, C.current = !0, X({
|
|
2441
|
+
_k: q
|
|
2442
|
+
}), w && (E(z) || Ee ? T() : Pr(T)), () => {
|
|
2443
|
+
y.current = !0, D();
|
|
2401
2444
|
};
|
|
2402
2445
|
}, [
|
|
2403
2446
|
h
|
|
2404
2447
|
]), Fe(() => {
|
|
2405
|
-
let
|
|
2406
|
-
function
|
|
2407
|
-
const
|
|
2408
|
-
|
|
2448
|
+
let T;
|
|
2449
|
+
function R() {
|
|
2450
|
+
const D = W(u) ? u(x().data) : u;
|
|
2451
|
+
D && T !== -1 && (T = setTimeout(I, D));
|
|
2409
2452
|
}
|
|
2410
|
-
function
|
|
2411
|
-
!x().error && (c || O().isVisible()) && (i || O().isOnline()) ?
|
|
2453
|
+
function I() {
|
|
2454
|
+
!x().error && (c || O().isVisible()) && (i || O().isOnline()) ? ye(Ve).then(R) : R();
|
|
2412
2455
|
}
|
|
2413
|
-
return
|
|
2414
|
-
|
|
2456
|
+
return R(), () => {
|
|
2457
|
+
T && (clearTimeout(T), T = -1);
|
|
2415
2458
|
};
|
|
2416
2459
|
}, [
|
|
2417
2460
|
u,
|
|
2418
2461
|
c,
|
|
2419
2462
|
i,
|
|
2420
2463
|
h
|
|
2421
|
-
]), un(
|
|
2422
|
-
if (!
|
|
2464
|
+
]), un(se), o && E(z) && h) {
|
|
2465
|
+
if (!ut && Ee)
|
|
2423
2466
|
throw new Error("Fallback data is required when using suspense in SSR.");
|
|
2424
|
-
v.current = t,
|
|
2425
|
-
const
|
|
2426
|
-
if (!E(
|
|
2427
|
-
const
|
|
2428
|
-
|
|
2467
|
+
v.current = t, F.current = n, y.current = !1;
|
|
2468
|
+
const T = S[h];
|
|
2469
|
+
if (!E(T)) {
|
|
2470
|
+
const R = $e(T);
|
|
2471
|
+
ft(R);
|
|
2429
2472
|
}
|
|
2430
2473
|
if (E(fe)) {
|
|
2431
|
-
const
|
|
2432
|
-
E(
|
|
2474
|
+
const R = ye(Ve);
|
|
2475
|
+
E(se) || (R.status = "fulfilled", R.value = !0), ft(R);
|
|
2433
2476
|
} else
|
|
2434
2477
|
throw fe;
|
|
2435
2478
|
}
|
|
2436
2479
|
return {
|
|
2437
|
-
mutate:
|
|
2480
|
+
mutate: $e,
|
|
2438
2481
|
get data() {
|
|
2439
|
-
return
|
|
2482
|
+
return re.data = !0, se;
|
|
2440
2483
|
},
|
|
2441
2484
|
get error() {
|
|
2442
|
-
return
|
|
2485
|
+
return re.error = !0, fe;
|
|
2443
2486
|
},
|
|
2444
2487
|
get isValidating() {
|
|
2445
|
-
return
|
|
2488
|
+
return re.isValidating = !0, en;
|
|
2446
2489
|
},
|
|
2447
2490
|
get isLoading() {
|
|
2448
|
-
return
|
|
2491
|
+
return re.isLoading = !0, tn;
|
|
2449
2492
|
}
|
|
2450
2493
|
};
|
|
2451
2494
|
}, Zr = Wr(Jr);
|
|
2452
|
-
function
|
|
2453
|
-
const { apiUrl: e, botToken: t } =
|
|
2495
|
+
function ms() {
|
|
2496
|
+
const { apiUrl: e, botToken: t } = B(), n = yt({
|
|
2454
2497
|
apiUrl: e,
|
|
2455
2498
|
botToken: t
|
|
2456
2499
|
});
|
|
2457
2500
|
return Zr(n.options, n.apis.fetchPreludeData);
|
|
2458
2501
|
}
|
|
2459
2502
|
export {
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2503
|
+
hs as W,
|
|
2504
|
+
Y as _,
|
|
2505
|
+
B as a,
|
|
2506
|
+
gs as b,
|
|
2464
2507
|
is as c,
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2508
|
+
ms as d,
|
|
2509
|
+
as as e,
|
|
2510
|
+
ps as f,
|
|
2468
2511
|
cs as g,
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2512
|
+
Ce as h,
|
|
2513
|
+
fs as i,
|
|
2514
|
+
Te as j,
|
|
2515
|
+
wt as k,
|
|
2516
|
+
jt as l,
|
|
2517
|
+
ls as m,
|
|
2518
|
+
ds as n,
|
|
2519
|
+
ur as o,
|
|
2520
|
+
us as u
|
|
2475
2521
|
};
|
|
2476
|
-
//# sourceMappingURL=index-
|
|
2522
|
+
//# sourceMappingURL=index-CgATAy4r.js.map
|