joytalk 0.0.1 → 0.0.2
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/apis/index.d.ts +2 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.es.js +274 -299
- package/dist/index.umd.js +6 -6
- package/dist/lib/index.d.ts +85 -1
- package/dist/types/request.d.ts +12 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6,16 +6,16 @@ function Xe(e, t) {
|
|
|
6
6
|
const { toString: Rt } = Object.prototype, { getPrototypeOf: Ae } = Object, { iterator: le, toStringTag: Qe } = Symbol, ue = /* @__PURE__ */ ((e) => (t) => {
|
|
7
7
|
const n = Rt.call(t);
|
|
8
8
|
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
9
|
-
})(/* @__PURE__ */ Object.create(null)), F = (e) => (e = e.toLowerCase(), (t) => ue(t) === e), fe = (e) => (t) => typeof t === e, { isArray:
|
|
9
|
+
})(/* @__PURE__ */ Object.create(null)), F = (e) => (e = e.toLowerCase(), (t) => ue(t) === e), fe = (e) => (t) => typeof t === e, { isArray: G } = Array, z = fe("undefined");
|
|
10
10
|
function Q(e) {
|
|
11
|
-
return e !== null && !
|
|
11
|
+
return e !== null && !z(e) && e.constructor !== null && !z(e.constructor) && N(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
12
12
|
}
|
|
13
13
|
const Ye = F("ArrayBuffer");
|
|
14
14
|
function Ot(e) {
|
|
15
15
|
let t;
|
|
16
16
|
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Ye(e.buffer), t;
|
|
17
17
|
}
|
|
18
|
-
const At = fe("string"),
|
|
18
|
+
const At = fe("string"), N = fe("function"), Ze = fe("number"), Y = (e) => e !== null && typeof e == "object", gt = (e) => e === !0 || e === !1, oe = (e) => {
|
|
19
19
|
if (ue(e) !== "object")
|
|
20
20
|
return !1;
|
|
21
21
|
const t = Ae(e);
|
|
@@ -28,16 +28,16 @@ const At = fe("string"), g = fe("function"), Ze = fe("number"), Y = (e) => e !==
|
|
|
28
28
|
} catch {
|
|
29
29
|
return !1;
|
|
30
30
|
}
|
|
31
|
-
}, Ct = F("Date"), Ut = F("File"), _t = F("Blob"), Dt = F("FileList"), Ft = (e) => Y(e) &&
|
|
31
|
+
}, Ct = F("Date"), Ut = F("File"), _t = F("Blob"), Dt = F("FileList"), Ft = (e) => Y(e) && N(e.pipe), xt = (e) => {
|
|
32
32
|
let t;
|
|
33
|
-
return e && (typeof FormData == "function" && e instanceof FormData ||
|
|
34
|
-
t === "object" &&
|
|
35
|
-
}, Lt = F("URLSearchParams"), [
|
|
33
|
+
return e && (typeof FormData == "function" && e instanceof FormData || N(e.append) && ((t = ue(e)) === "formdata" || // detect form-data instance
|
|
34
|
+
t === "object" && N(e.toString) && e.toString() === "[object FormData]"));
|
|
35
|
+
}, Lt = F("URLSearchParams"), [It, Pt, kt, Bt] = ["ReadableStream", "Request", "Response", "Headers"].map(F), Ht = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
36
36
|
function Z(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
37
37
|
if (e === null || typeof e > "u")
|
|
38
38
|
return;
|
|
39
39
|
let r, s;
|
|
40
|
-
if (typeof e != "object" && (e = [e]),
|
|
40
|
+
if (typeof e != "object" && (e = [e]), G(e))
|
|
41
41
|
for (r = 0, s = e.length; r < s; r++)
|
|
42
42
|
t.call(null, e[r], r, e);
|
|
43
43
|
else {
|
|
@@ -60,23 +60,23 @@ function et(e, t) {
|
|
|
60
60
|
return s;
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
|
-
const v = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, tt = (e) => !
|
|
64
|
-
function
|
|
63
|
+
const v = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, tt = (e) => !z(e) && e !== v;
|
|
64
|
+
function Te() {
|
|
65
65
|
const { caseless: e, skipUndefined: t } = tt(this) && this || {}, n = {}, r = (s, o) => {
|
|
66
66
|
const i = e && et(n, o) || o;
|
|
67
|
-
oe(n[i]) && oe(s) ? n[i] =
|
|
67
|
+
oe(n[i]) && oe(s) ? n[i] = Te(n[i], s) : oe(s) ? n[i] = Te({}, s) : G(s) ? n[i] = s.slice() : (!t || !z(s)) && (n[i] = s);
|
|
68
68
|
};
|
|
69
69
|
for (let s = 0, o = arguments.length; s < o; s++)
|
|
70
70
|
arguments[s] && Z(arguments[s], r);
|
|
71
71
|
return n;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
n &&
|
|
73
|
+
const jt = (e, t, n, { allOwnKeys: r } = {}) => (Z(t, (s, o) => {
|
|
74
|
+
n && N(s) ? e[o] = Xe(s, n) : e[o] = s;
|
|
75
75
|
}, { allOwnKeys: r }), e), vt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), qt = (e, t, n, r) => {
|
|
76
76
|
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
77
77
|
value: t.prototype
|
|
78
78
|
}), n && Object.assign(e.prototype, n);
|
|
79
|
-
},
|
|
79
|
+
}, Mt = (e, t, n, r) => {
|
|
80
80
|
let s, o, i;
|
|
81
81
|
const c = {};
|
|
82
82
|
if (t = t || {}, e == null) return t;
|
|
@@ -86,27 +86,27 @@ const Ht = (e, t, n, { allOwnKeys: r } = {}) => (Z(t, (s, o) => {
|
|
|
86
86
|
e = n !== !1 && Ae(e);
|
|
87
87
|
} while (e && (!n || n(e, t)) && e !== Object.prototype);
|
|
88
88
|
return t;
|
|
89
|
-
},
|
|
89
|
+
}, $t = (e, t, n) => {
|
|
90
90
|
e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
|
|
91
91
|
const r = e.indexOf(t, n);
|
|
92
92
|
return r !== -1 && r === n;
|
|
93
93
|
}, Jt = (e) => {
|
|
94
94
|
if (!e) return null;
|
|
95
|
-
if (
|
|
95
|
+
if (G(e)) return e;
|
|
96
96
|
let t = e.length;
|
|
97
97
|
if (!Ze(t)) return null;
|
|
98
98
|
const n = new Array(t);
|
|
99
99
|
for (; t-- > 0; )
|
|
100
100
|
n[t] = e[t];
|
|
101
101
|
return n;
|
|
102
|
-
}, zt = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Ae(Uint8Array)),
|
|
102
|
+
}, zt = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Ae(Uint8Array)), Gt = (e, t) => {
|
|
103
103
|
const r = (e && e[le]).call(e);
|
|
104
104
|
let s;
|
|
105
105
|
for (; (s = r.next()) && !s.done; ) {
|
|
106
106
|
const o = s.value;
|
|
107
107
|
t.call(e, o[0], o[1]);
|
|
108
108
|
}
|
|
109
|
-
},
|
|
109
|
+
}, Wt = (e, t) => {
|
|
110
110
|
let n;
|
|
111
111
|
const r = [];
|
|
112
112
|
for (; (n = e.exec(t)) !== null; )
|
|
@@ -117,7 +117,7 @@ const Ht = (e, t, n, { allOwnKeys: r } = {}) => (Z(t, (s, o) => {
|
|
|
117
117
|
function(n, r, s) {
|
|
118
118
|
return r.toUpperCase() + s;
|
|
119
119
|
}
|
|
120
|
-
),
|
|
120
|
+
), Ie = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Xt = F("RegExp"), nt = (e, t) => {
|
|
121
121
|
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
122
122
|
Z(n, (s, o) => {
|
|
123
123
|
let i;
|
|
@@ -125,10 +125,10 @@ const Ht = (e, t, n, { allOwnKeys: r } = {}) => (Z(t, (s, o) => {
|
|
|
125
125
|
}), Object.defineProperties(e, r);
|
|
126
126
|
}, Qt = (e) => {
|
|
127
127
|
nt(e, (t, n) => {
|
|
128
|
-
if (
|
|
128
|
+
if (N(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
129
129
|
return !1;
|
|
130
130
|
const r = e[n];
|
|
131
|
-
if (
|
|
131
|
+
if (N(r)) {
|
|
132
132
|
if (t.enumerable = !1, "writable" in t) {
|
|
133
133
|
t.writable = !1;
|
|
134
134
|
return;
|
|
@@ -144,11 +144,11 @@ const Ht = (e, t, n, { allOwnKeys: r } = {}) => (Z(t, (s, o) => {
|
|
|
144
144
|
n[o] = !0;
|
|
145
145
|
});
|
|
146
146
|
};
|
|
147
|
-
return
|
|
147
|
+
return G(e) ? r(e) : r(String(e).split(t)), n;
|
|
148
148
|
}, Zt = () => {
|
|
149
149
|
}, en = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
150
150
|
function tn(e) {
|
|
151
|
-
return !!(e &&
|
|
151
|
+
return !!(e && N(e.append) && e[Qe] === "FormData" && e[le]);
|
|
152
152
|
}
|
|
153
153
|
const nn = (e) => {
|
|
154
154
|
const t = new Array(10), n = (r, s) => {
|
|
@@ -159,25 +159,25 @@ const nn = (e) => {
|
|
|
159
159
|
return r;
|
|
160
160
|
if (!("toJSON" in r)) {
|
|
161
161
|
t[s] = r;
|
|
162
|
-
const o =
|
|
162
|
+
const o = G(r) ? [] : {};
|
|
163
163
|
return Z(r, (i, c) => {
|
|
164
164
|
const d = n(i, s + 1);
|
|
165
|
-
!
|
|
165
|
+
!z(d) && (o[c] = d);
|
|
166
166
|
}), t[s] = void 0, o;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
return r;
|
|
170
170
|
};
|
|
171
171
|
return n(e, 0);
|
|
172
|
-
}, rn = F("AsyncFunction"), sn = (e) => e && (Y(e) ||
|
|
172
|
+
}, rn = F("AsyncFunction"), sn = (e) => e && (Y(e) || N(e)) && N(e.then) && N(e.catch), rt = ((e, t) => e ? setImmediate : t ? ((n, r) => (v.addEventListener("message", ({ source: s, data: o }) => {
|
|
173
173
|
s === v && o === n && r.length && r.shift()();
|
|
174
174
|
}, !1), (s) => {
|
|
175
175
|
r.push(s), v.postMessage(n, "*");
|
|
176
176
|
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
177
177
|
typeof setImmediate == "function",
|
|
178
|
-
|
|
179
|
-
), on = typeof queueMicrotask < "u" ? queueMicrotask.bind(v) : typeof process < "u" && process.nextTick || rt, an = (e) => e != null &&
|
|
180
|
-
isArray:
|
|
178
|
+
N(v.postMessage)
|
|
179
|
+
), on = typeof queueMicrotask < "u" ? queueMicrotask.bind(v) : typeof process < "u" && process.nextTick || rt, an = (e) => e != null && N(e[le]), a = {
|
|
180
|
+
isArray: G,
|
|
181
181
|
isArrayBuffer: Ye,
|
|
182
182
|
isBuffer: Q,
|
|
183
183
|
isFormData: xt,
|
|
@@ -188,36 +188,36 @@ const nn = (e) => {
|
|
|
188
188
|
isObject: Y,
|
|
189
189
|
isPlainObject: oe,
|
|
190
190
|
isEmptyObject: Nt,
|
|
191
|
-
isReadableStream:
|
|
192
|
-
isRequest:
|
|
191
|
+
isReadableStream: It,
|
|
192
|
+
isRequest: Pt,
|
|
193
193
|
isResponse: kt,
|
|
194
194
|
isHeaders: Bt,
|
|
195
|
-
isUndefined:
|
|
195
|
+
isUndefined: z,
|
|
196
196
|
isDate: Ct,
|
|
197
197
|
isFile: Ut,
|
|
198
198
|
isBlob: _t,
|
|
199
199
|
isRegExp: Xt,
|
|
200
|
-
isFunction:
|
|
200
|
+
isFunction: N,
|
|
201
201
|
isStream: Ft,
|
|
202
202
|
isURLSearchParams: Lt,
|
|
203
203
|
isTypedArray: zt,
|
|
204
204
|
isFileList: Dt,
|
|
205
205
|
forEach: Z,
|
|
206
|
-
merge:
|
|
207
|
-
extend:
|
|
208
|
-
trim:
|
|
206
|
+
merge: Te,
|
|
207
|
+
extend: jt,
|
|
208
|
+
trim: Ht,
|
|
209
209
|
stripBOM: vt,
|
|
210
210
|
inherits: qt,
|
|
211
|
-
toFlatObject:
|
|
211
|
+
toFlatObject: Mt,
|
|
212
212
|
kindOf: ue,
|
|
213
213
|
kindOfTest: F,
|
|
214
|
-
endsWith:
|
|
214
|
+
endsWith: $t,
|
|
215
215
|
toArray: Jt,
|
|
216
|
-
forEachEntry:
|
|
217
|
-
matchAll:
|
|
216
|
+
forEachEntry: Gt,
|
|
217
|
+
matchAll: Wt,
|
|
218
218
|
isHTMLForm: Kt,
|
|
219
|
-
hasOwnProperty:
|
|
220
|
-
hasOwnProp:
|
|
219
|
+
hasOwnProperty: Ie,
|
|
220
|
+
hasOwnProp: Ie,
|
|
221
221
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
222
222
|
reduceDescriptors: nt,
|
|
223
223
|
freezeMethods: Qt,
|
|
@@ -295,7 +295,7 @@ function be(e) {
|
|
|
295
295
|
function it(e) {
|
|
296
296
|
return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function Pe(e, t, n) {
|
|
299
299
|
return e ? e.concat(t).map(function(s, o) {
|
|
300
300
|
return s = it(s), !n && o ? "[" + s + "]" : s;
|
|
301
301
|
}).join(n ? "." : "") : t;
|
|
@@ -330,20 +330,20 @@ function de(e, t, n) {
|
|
|
330
330
|
return a.isArrayBuffer(f) || a.isTypedArray(f) ? d && typeof Blob == "function" ? new Blob([f]) : Buffer.from(f) : f;
|
|
331
331
|
}
|
|
332
332
|
function l(f, m, h) {
|
|
333
|
-
let
|
|
333
|
+
let T = f;
|
|
334
334
|
if (f && !h && typeof f == "object") {
|
|
335
335
|
if (a.endsWith(m, "{}"))
|
|
336
336
|
m = r ? m : m.slice(0, -2), f = JSON.stringify(f);
|
|
337
|
-
else if (a.isArray(f) && ln(f) || (a.isFileList(f) || a.endsWith(m, "[]")) && (
|
|
338
|
-
return m = it(m),
|
|
337
|
+
else if (a.isArray(f) && ln(f) || (a.isFileList(f) || a.endsWith(m, "[]")) && (T = a.toArray(f)))
|
|
338
|
+
return m = it(m), T.forEach(function(b, O) {
|
|
339
339
|
!(a.isUndefined(b) || b === null) && t.append(
|
|
340
340
|
// eslint-disable-next-line no-nested-ternary
|
|
341
|
-
i === !0 ?
|
|
341
|
+
i === !0 ? Pe([m], O, o) : i === null ? m : m + "[]",
|
|
342
342
|
u(b)
|
|
343
343
|
);
|
|
344
344
|
}), !1;
|
|
345
345
|
}
|
|
346
|
-
return be(f) ? !0 : (t.append(
|
|
346
|
+
return be(f) ? !0 : (t.append(Pe(h, m, o), u(f)), !1);
|
|
347
347
|
}
|
|
348
348
|
const p = [], S = Object.assign(un, {
|
|
349
349
|
defaultVisitor: l,
|
|
@@ -354,14 +354,14 @@ function de(e, t, n) {
|
|
|
354
354
|
if (!a.isUndefined(f)) {
|
|
355
355
|
if (p.indexOf(f) !== -1)
|
|
356
356
|
throw Error("Circular reference detected in " + m.join("."));
|
|
357
|
-
p.push(f), a.forEach(f, function(
|
|
358
|
-
(!(a.isUndefined(
|
|
357
|
+
p.push(f), a.forEach(f, function(T, U) {
|
|
358
|
+
(!(a.isUndefined(T) || T === null) && s.call(
|
|
359
359
|
t,
|
|
360
|
-
|
|
361
|
-
a.isString(
|
|
360
|
+
T,
|
|
361
|
+
a.isString(U) ? U.trim() : U,
|
|
362
362
|
m,
|
|
363
363
|
S
|
|
364
|
-
)) === !0 && w(
|
|
364
|
+
)) === !0 && w(T, m ? m.concat(U) : [U]);
|
|
365
365
|
}), p.pop();
|
|
366
366
|
}
|
|
367
367
|
}
|
|
@@ -483,15 +483,15 @@ const lt = {
|
|
|
483
483
|
},
|
|
484
484
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
485
485
|
}, Ne = typeof window < "u" && typeof document < "u", we = typeof navigator == "object" && navigator || void 0, En = Ne && (!we || ["ReactNative", "NativeScript", "NS"].indexOf(we.product) < 0), Sn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
486
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts == "function",
|
|
486
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", yn = Ne && window.location.href || "http://localhost", Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
487
487
|
__proto__: null,
|
|
488
488
|
hasBrowserEnv: Ne,
|
|
489
489
|
hasStandardBrowserEnv: En,
|
|
490
490
|
hasStandardBrowserWebWorkerEnv: Sn,
|
|
491
491
|
navigator: we,
|
|
492
|
-
origin:
|
|
492
|
+
origin: yn
|
|
493
493
|
}, Symbol.toStringTag, { value: "Module" })), R = {
|
|
494
|
-
...
|
|
494
|
+
...Tn,
|
|
495
495
|
...mn
|
|
496
496
|
};
|
|
497
497
|
function bn(e, t) {
|
|
@@ -633,7 +633,7 @@ const An = a.toObjectSet([
|
|
|
633
633
|
`).forEach(function(i) {
|
|
634
634
|
s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && An[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
|
|
635
635
|
}), t;
|
|
636
|
-
},
|
|
636
|
+
}, He = Symbol("internals");
|
|
637
637
|
function V(e) {
|
|
638
638
|
return e && String(e).trim().toLowerCase();
|
|
639
639
|
}
|
|
@@ -672,7 +672,7 @@ function _n(e, t) {
|
|
|
672
672
|
});
|
|
673
673
|
});
|
|
674
674
|
}
|
|
675
|
-
let
|
|
675
|
+
let C = class {
|
|
676
676
|
constructor(t) {
|
|
677
677
|
t && this.set(t);
|
|
678
678
|
}
|
|
@@ -788,7 +788,7 @@ let N = class {
|
|
|
788
788
|
return n.forEach((s) => r.set(s)), r;
|
|
789
789
|
}
|
|
790
790
|
static accessor(t) {
|
|
791
|
-
const r = (this[
|
|
791
|
+
const r = (this[He] = this[He] = {
|
|
792
792
|
accessors: {}
|
|
793
793
|
}).accessors, s = this.prototype;
|
|
794
794
|
function o(i) {
|
|
@@ -798,8 +798,8 @@ let N = class {
|
|
|
798
798
|
return a.isArray(t) ? t.forEach(o) : o(t), this;
|
|
799
799
|
}
|
|
800
800
|
};
|
|
801
|
-
|
|
802
|
-
a.reduceDescriptors(
|
|
801
|
+
C.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
802
|
+
a.reduceDescriptors(C.prototype, ({ value: e }, t) => {
|
|
803
803
|
let n = t[0].toUpperCase() + t.slice(1);
|
|
804
804
|
return {
|
|
805
805
|
get: () => e,
|
|
@@ -808,9 +808,9 @@ a.reduceDescriptors(N.prototype, ({ value: e }, t) => {
|
|
|
808
808
|
}
|
|
809
809
|
};
|
|
810
810
|
});
|
|
811
|
-
a.freezeMethods(
|
|
811
|
+
a.freezeMethods(C);
|
|
812
812
|
function Se(e, t) {
|
|
813
|
-
const n = this || ee, r = t || n, s =
|
|
813
|
+
const n = this || ee, r = t || n, s = C.from(r.headers);
|
|
814
814
|
let o = r.data;
|
|
815
815
|
return a.forEach(e, function(c) {
|
|
816
816
|
o = c.call(n, o, s.normalize(), t ? t.status : void 0);
|
|
@@ -886,7 +886,7 @@ const ce = (e, t, n = 3) => {
|
|
|
886
886
|
};
|
|
887
887
|
e(p);
|
|
888
888
|
}, n);
|
|
889
|
-
},
|
|
889
|
+
}, je = (e, t) => {
|
|
890
890
|
const n = e != null;
|
|
891
891
|
return [(r) => t[0]({
|
|
892
892
|
lengthComputable: n,
|
|
@@ -896,7 +896,7 @@ const ce = (e, t, n = 3) => {
|
|
|
896
896
|
}, ve = (e) => (...t) => a.asap(() => e(...t)), Ln = R.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, R.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
|
|
897
897
|
new URL(R.origin),
|
|
898
898
|
R.navigator && /(msie|trident)/i.test(R.navigator.userAgent)
|
|
899
|
-
) : () => !0,
|
|
899
|
+
) : () => !0, In = R.hasStandardBrowserEnv ? (
|
|
900
900
|
// Standard browser envs support document.cookie
|
|
901
901
|
{
|
|
902
902
|
write(e, t, n, r, s, o, i) {
|
|
@@ -925,18 +925,18 @@ const ce = (e, t, n = 3) => {
|
|
|
925
925
|
}
|
|
926
926
|
}
|
|
927
927
|
);
|
|
928
|
-
function
|
|
928
|
+
function Pn(e) {
|
|
929
929
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
|
|
930
930
|
}
|
|
931
931
|
function kn(e, t) {
|
|
932
932
|
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
933
933
|
}
|
|
934
934
|
function ht(e, t, n) {
|
|
935
|
-
let r = !
|
|
935
|
+
let r = !Pn(t);
|
|
936
936
|
return e && (r || n == !1) ? kn(e, t) : t;
|
|
937
937
|
}
|
|
938
|
-
const qe = (e) => e instanceof
|
|
939
|
-
function
|
|
938
|
+
const qe = (e) => e instanceof C ? { ...e } : e;
|
|
939
|
+
function M(e, t) {
|
|
940
940
|
t = t || {};
|
|
941
941
|
const n = {};
|
|
942
942
|
function r(u, l, p, S) {
|
|
@@ -1001,9 +1001,9 @@ function $(e, t) {
|
|
|
1001
1001
|
}), n;
|
|
1002
1002
|
}
|
|
1003
1003
|
const pt = (e) => {
|
|
1004
|
-
const t =
|
|
1004
|
+
const t = M({}, e);
|
|
1005
1005
|
let { data: n, withXSRFToken: r, xsrfHeaderName: s, xsrfCookieName: o, headers: i, auth: c } = t;
|
|
1006
|
-
if (t.headers = i =
|
|
1006
|
+
if (t.headers = i = C.from(i), t.url = ct(ht(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), c && i.set(
|
|
1007
1007
|
"Authorization",
|
|
1008
1008
|
"Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
|
|
1009
1009
|
), a.isFormData(n)) {
|
|
@@ -1017,25 +1017,25 @@ const pt = (e) => {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
1019
|
if (R.hasStandardBrowserEnv && (r && a.isFunction(r) && (r = r(t)), r || r !== !1 && Ln(t.url))) {
|
|
1020
|
-
const d = s && o &&
|
|
1020
|
+
const d = s && o && In.read(o);
|
|
1021
1021
|
d && i.set(s, d);
|
|
1022
1022
|
}
|
|
1023
1023
|
return t;
|
|
1024
|
-
}, Bn = typeof XMLHttpRequest < "u",
|
|
1024
|
+
}, Bn = typeof XMLHttpRequest < "u", Hn = Bn && function(e) {
|
|
1025
1025
|
return new Promise(function(n, r) {
|
|
1026
1026
|
const s = pt(e);
|
|
1027
1027
|
let o = s.data;
|
|
1028
|
-
const i =
|
|
1028
|
+
const i = C.from(s.headers).normalize();
|
|
1029
1029
|
let { responseType: c, onUploadProgress: d, onDownloadProgress: u } = s, l, p, S, w, f;
|
|
1030
1030
|
function m() {
|
|
1031
1031
|
w && w(), f && f(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
|
|
1032
1032
|
}
|
|
1033
1033
|
let h = new XMLHttpRequest();
|
|
1034
1034
|
h.open(s.method.toUpperCase(), s.url, !0), h.timeout = s.timeout;
|
|
1035
|
-
function
|
|
1035
|
+
function T() {
|
|
1036
1036
|
if (!h)
|
|
1037
1037
|
return;
|
|
1038
|
-
const b =
|
|
1038
|
+
const b = C.from(
|
|
1039
1039
|
"getAllResponseHeaders" in h && h.getAllResponseHeaders()
|
|
1040
1040
|
), D = {
|
|
1041
1041
|
data: !c || c === "text" || c === "json" ? h.responseText : h.response,
|
|
@@ -1045,14 +1045,14 @@ const pt = (e) => {
|
|
|
1045
1045
|
config: e,
|
|
1046
1046
|
request: h
|
|
1047
1047
|
};
|
|
1048
|
-
dt(function(
|
|
1049
|
-
n(
|
|
1050
|
-
}, function(
|
|
1051
|
-
r(
|
|
1048
|
+
dt(function(_) {
|
|
1049
|
+
n(_), m();
|
|
1050
|
+
}, function(_) {
|
|
1051
|
+
r(_), m();
|
|
1052
1052
|
}, D), h = null;
|
|
1053
1053
|
}
|
|
1054
|
-
"onloadend" in h ? h.onloadend =
|
|
1055
|
-
!h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(
|
|
1054
|
+
"onloadend" in h ? h.onloadend = T : h.onreadystatechange = function() {
|
|
1055
|
+
!h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(T);
|
|
1056
1056
|
}, h.onabort = function() {
|
|
1057
1057
|
h && (r(new E("Request aborted", E.ECONNABORTED, e, h)), h = null);
|
|
1058
1058
|
}, h.onerror = function(O) {
|
|
@@ -1072,14 +1072,14 @@ const pt = (e) => {
|
|
|
1072
1072
|
}), a.isUndefined(s.withCredentials) || (h.withCredentials = !!s.withCredentials), c && c !== "json" && (h.responseType = s.responseType), u && ([S, f] = ce(u, !0), h.addEventListener("progress", S)), d && h.upload && ([p, w] = ce(d), h.upload.addEventListener("progress", p), h.upload.addEventListener("loadend", w)), (s.cancelToken || s.signal) && (l = (b) => {
|
|
1073
1073
|
h && (r(!b || b.type ? new W(null, e, h) : b), h.abort(), h = null);
|
|
1074
1074
|
}, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
|
|
1075
|
-
const
|
|
1076
|
-
if (
|
|
1077
|
-
r(new E("Unsupported protocol " +
|
|
1075
|
+
const U = Dn(s.url);
|
|
1076
|
+
if (U && R.protocols.indexOf(U) === -1) {
|
|
1077
|
+
r(new E("Unsupported protocol " + U + ":", E.ERR_BAD_REQUEST, e));
|
|
1078
1078
|
return;
|
|
1079
1079
|
}
|
|
1080
1080
|
h.send(o || null);
|
|
1081
1081
|
});
|
|
1082
|
-
},
|
|
1082
|
+
}, jn = (e, t) => {
|
|
1083
1083
|
const { length: n } = e = e ? e.filter(Boolean) : [];
|
|
1084
1084
|
if (t || n) {
|
|
1085
1085
|
let r = new AbortController(), s;
|
|
@@ -1112,9 +1112,9 @@ const pt = (e) => {
|
|
|
1112
1112
|
for (; r < n; )
|
|
1113
1113
|
s = r + t, yield e.slice(r, s), r = s;
|
|
1114
1114
|
}, qn = async function* (e, t) {
|
|
1115
|
-
for await (const n of
|
|
1115
|
+
for await (const n of Mn(e))
|
|
1116
1116
|
yield* vn(n, t);
|
|
1117
|
-
},
|
|
1117
|
+
}, Mn = async function* (e) {
|
|
1118
1118
|
if (e[Symbol.asyncIterator]) {
|
|
1119
1119
|
yield* e;
|
|
1120
1120
|
return;
|
|
@@ -1130,7 +1130,7 @@ const pt = (e) => {
|
|
|
1130
1130
|
} finally {
|
|
1131
1131
|
await t.cancel();
|
|
1132
1132
|
}
|
|
1133
|
-
},
|
|
1133
|
+
}, Me = (e, t, n, r) => {
|
|
1134
1134
|
const s = qn(e, t);
|
|
1135
1135
|
let o = 0, i, c = (d) => {
|
|
1136
1136
|
i || (i = !0, r && r(d));
|
|
@@ -1159,13 +1159,13 @@ const pt = (e) => {
|
|
|
1159
1159
|
}, {
|
|
1160
1160
|
highWaterMark: 2
|
|
1161
1161
|
});
|
|
1162
|
-
},
|
|
1162
|
+
}, $e = 64 * 1024, { isFunction: se } = a, $n = (({ Request: e, Response: t }) => ({
|
|
1163
1163
|
Request: e,
|
|
1164
1164
|
Response: t
|
|
1165
1165
|
}))(a.global), {
|
|
1166
1166
|
ReadableStream: Je,
|
|
1167
1167
|
TextEncoder: ze
|
|
1168
|
-
} = a.global,
|
|
1168
|
+
} = a.global, Ge = (e, ...t) => {
|
|
1169
1169
|
try {
|
|
1170
1170
|
return !!e(...t);
|
|
1171
1171
|
} catch {
|
|
@@ -1174,11 +1174,11 @@ const pt = (e) => {
|
|
|
1174
1174
|
}, Jn = (e) => {
|
|
1175
1175
|
e = a.merge.call({
|
|
1176
1176
|
skipUndefined: !0
|
|
1177
|
-
},
|
|
1177
|
+
}, $n, e);
|
|
1178
1178
|
const { fetch: t, Request: n, Response: r } = e, s = t ? se(t) : typeof fetch == "function", o = se(n), i = se(r);
|
|
1179
1179
|
if (!s)
|
|
1180
1180
|
return !1;
|
|
1181
|
-
const c = s && se(Je), d = s && (typeof ze == "function" ? /* @__PURE__ */ ((f) => (m) => f.encode(m))(new ze()) : async (f) => new Uint8Array(await new n(f).arrayBuffer())), u = o && c &&
|
|
1181
|
+
const c = s && se(Je), d = s && (typeof ze == "function" ? /* @__PURE__ */ ((f) => (m) => f.encode(m))(new ze()) : async (f) => new Uint8Array(await new n(f).arrayBuffer())), u = o && c && Ge(() => {
|
|
1182
1182
|
let f = !1;
|
|
1183
1183
|
const m = new n(R.origin, {
|
|
1184
1184
|
body: new Je(),
|
|
@@ -1188,14 +1188,14 @@ const pt = (e) => {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
}).headers.has("Content-Type");
|
|
1190
1190
|
return f && !m;
|
|
1191
|
-
}), l = i && c &&
|
|
1191
|
+
}), l = i && c && Ge(() => a.isReadableStream(new r("").body)), p = {
|
|
1192
1192
|
stream: l && ((f) => f.body)
|
|
1193
1193
|
};
|
|
1194
1194
|
s && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((f) => {
|
|
1195
1195
|
!p[f] && (p[f] = (m, h) => {
|
|
1196
|
-
let
|
|
1197
|
-
if (
|
|
1198
|
-
return
|
|
1196
|
+
let T = m && m[f];
|
|
1197
|
+
if (T)
|
|
1198
|
+
return T.call(m);
|
|
1199
1199
|
throw new E(`Response type '${f}' is not supported`, E.ERR_NOT_SUPPORT, h);
|
|
1200
1200
|
});
|
|
1201
1201
|
});
|
|
@@ -1221,36 +1221,36 @@ const pt = (e) => {
|
|
|
1221
1221
|
let {
|
|
1222
1222
|
url: m,
|
|
1223
1223
|
method: h,
|
|
1224
|
-
data:
|
|
1225
|
-
signal:
|
|
1224
|
+
data: T,
|
|
1225
|
+
signal: U,
|
|
1226
1226
|
cancelToken: b,
|
|
1227
1227
|
timeout: O,
|
|
1228
1228
|
onDownloadProgress: D,
|
|
1229
1229
|
onUploadProgress: B,
|
|
1230
|
-
responseType:
|
|
1230
|
+
responseType: _,
|
|
1231
1231
|
headers: pe,
|
|
1232
1232
|
withCredentials: te = "same-origin",
|
|
1233
1233
|
fetchOptions: Ue
|
|
1234
1234
|
} = pt(f), _e = t || fetch;
|
|
1235
|
-
|
|
1236
|
-
let ne =
|
|
1237
|
-
const
|
|
1235
|
+
_ = _ ? (_ + "").toLowerCase() : "text";
|
|
1236
|
+
let ne = jn([U, b && b.toAbortSignal()], O), K = null;
|
|
1237
|
+
const H = ne && ne.unsubscribe && (() => {
|
|
1238
1238
|
ne.unsubscribe();
|
|
1239
1239
|
});
|
|
1240
1240
|
let De;
|
|
1241
1241
|
try {
|
|
1242
|
-
if (B && u && h !== "get" && h !== "head" && (De = await w(pe,
|
|
1242
|
+
if (B && u && h !== "get" && h !== "head" && (De = await w(pe, T)) !== 0) {
|
|
1243
1243
|
let k = new n(m, {
|
|
1244
1244
|
method: "POST",
|
|
1245
|
-
body:
|
|
1245
|
+
body: T,
|
|
1246
1246
|
duplex: "half"
|
|
1247
|
-
}),
|
|
1248
|
-
if (a.isFormData(
|
|
1249
|
-
const [me, re] =
|
|
1247
|
+
}), J;
|
|
1248
|
+
if (a.isFormData(T) && (J = k.headers.get("content-type")) && pe.setContentType(J), k.body) {
|
|
1249
|
+
const [me, re] = je(
|
|
1250
1250
|
De,
|
|
1251
1251
|
ce(ve(B))
|
|
1252
1252
|
);
|
|
1253
|
-
|
|
1253
|
+
T = Me(k.body, $e, me, re);
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
a.isString(te) || (te = te ? "include" : "omit");
|
|
@@ -1259,43 +1259,43 @@ const pt = (e) => {
|
|
|
1259
1259
|
signal: ne,
|
|
1260
1260
|
method: h.toUpperCase(),
|
|
1261
1261
|
headers: pe.normalize().toJSON(),
|
|
1262
|
-
body:
|
|
1262
|
+
body: T,
|
|
1263
1263
|
duplex: "half",
|
|
1264
1264
|
credentials: x ? te : void 0
|
|
1265
1265
|
};
|
|
1266
1266
|
K = o && new n(m, Fe);
|
|
1267
|
-
let
|
|
1268
|
-
const xe = l && (
|
|
1269
|
-
if (l && (D || xe &&
|
|
1267
|
+
let P = await (o ? _e(K, Ue) : _e(m, Fe));
|
|
1268
|
+
const xe = l && (_ === "stream" || _ === "response");
|
|
1269
|
+
if (l && (D || xe && H)) {
|
|
1270
1270
|
const k = {};
|
|
1271
1271
|
["status", "statusText", "headers"].forEach((Le) => {
|
|
1272
|
-
k[Le] =
|
|
1272
|
+
k[Le] = P[Le];
|
|
1273
1273
|
});
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1274
|
+
const J = a.toFiniteNumber(P.headers.get("content-length")), [me, re] = D && je(
|
|
1275
|
+
J,
|
|
1276
1276
|
ce(ve(D), !0)
|
|
1277
1277
|
) || [];
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
re && re(),
|
|
1278
|
+
P = new r(
|
|
1279
|
+
Me(P.body, $e, me, () => {
|
|
1280
|
+
re && re(), H && H();
|
|
1281
1281
|
}),
|
|
1282
1282
|
k
|
|
1283
1283
|
);
|
|
1284
1284
|
}
|
|
1285
|
-
|
|
1286
|
-
let wt = await p[a.findKey(p,
|
|
1287
|
-
return !xe &&
|
|
1288
|
-
dt(k,
|
|
1285
|
+
_ = _ || "text";
|
|
1286
|
+
let wt = await p[a.findKey(p, _) || "text"](P, f);
|
|
1287
|
+
return !xe && H && H(), await new Promise((k, J) => {
|
|
1288
|
+
dt(k, J, {
|
|
1289
1289
|
data: wt,
|
|
1290
|
-
headers:
|
|
1291
|
-
status:
|
|
1292
|
-
statusText:
|
|
1290
|
+
headers: C.from(P.headers),
|
|
1291
|
+
status: P.status,
|
|
1292
|
+
statusText: P.statusText,
|
|
1293
1293
|
config: f,
|
|
1294
1294
|
request: K
|
|
1295
1295
|
});
|
|
1296
1296
|
});
|
|
1297
1297
|
} catch (x) {
|
|
1298
|
-
throw
|
|
1298
|
+
throw H && H(), x && x.name === "TypeError" && /Load failed|fetch/i.test(x.message) ? Object.assign(
|
|
1299
1299
|
new E("Network Error", E.ERR_NETWORK, f, K),
|
|
1300
1300
|
{
|
|
1301
1301
|
cause: x.cause || x
|
|
@@ -1318,7 +1318,7 @@ const pt = (e) => {
|
|
|
1318
1318
|
mt();
|
|
1319
1319
|
const Ce = {
|
|
1320
1320
|
http: cn,
|
|
1321
|
-
xhr:
|
|
1321
|
+
xhr: Hn,
|
|
1322
1322
|
fetch: {
|
|
1323
1323
|
get: mt
|
|
1324
1324
|
}
|
|
@@ -1332,8 +1332,8 @@ a.forEach(Ce, (e, t) => {
|
|
|
1332
1332
|
Object.defineProperty(e, "adapterName", { value: t });
|
|
1333
1333
|
}
|
|
1334
1334
|
});
|
|
1335
|
-
const
|
|
1336
|
-
function
|
|
1335
|
+
const We = (e) => `- ${e}`, Gn = (e) => a.isFunction(e) || e === null || e === !1;
|
|
1336
|
+
function Wn(e, t) {
|
|
1337
1337
|
e = a.isArray(e) ? e : [e];
|
|
1338
1338
|
const { length: n } = e;
|
|
1339
1339
|
let r, s;
|
|
@@ -1341,7 +1341,7 @@ function Gn(e, t) {
|
|
|
1341
1341
|
for (let i = 0; i < n; i++) {
|
|
1342
1342
|
r = e[i];
|
|
1343
1343
|
let c;
|
|
1344
|
-
if (s = r, !
|
|
1344
|
+
if (s = r, !Gn(r) && (s = Ce[(c = String(r)).toLowerCase()], s === void 0))
|
|
1345
1345
|
throw new E(`Unknown adapter '${c}'`);
|
|
1346
1346
|
if (s && (a.isFunction(s) || (s = s.get(t))))
|
|
1347
1347
|
break;
|
|
@@ -1352,8 +1352,8 @@ function Gn(e, t) {
|
|
|
1352
1352
|
([d, u]) => `adapter ${d} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1353
1353
|
);
|
|
1354
1354
|
let c = n ? i.length > 1 ? `since :
|
|
1355
|
-
` + i.map(
|
|
1356
|
-
`) : " " +
|
|
1355
|
+
` + i.map(We).join(`
|
|
1356
|
+
`) : " " + We(i[0]) : "as no adapter specified";
|
|
1357
1357
|
throw new E(
|
|
1358
1358
|
"There is no suitable adapter to dispatch the request " + c,
|
|
1359
1359
|
"ERR_NOT_SUPPORT"
|
|
@@ -1366,33 +1366,33 @@ const Et = {
|
|
|
1366
1366
|
* Resolve an adapter from a list of adapter names or functions.
|
|
1367
1367
|
* @type {Function}
|
|
1368
1368
|
*/
|
|
1369
|
-
getAdapter:
|
|
1369
|
+
getAdapter: Wn,
|
|
1370
1370
|
/**
|
|
1371
1371
|
* Exposes all known adapters
|
|
1372
1372
|
* @type {Object<string, Function|Object>}
|
|
1373
1373
|
*/
|
|
1374
1374
|
adapters: Ce
|
|
1375
1375
|
};
|
|
1376
|
-
function
|
|
1376
|
+
function ye(e) {
|
|
1377
1377
|
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1378
1378
|
throw new W(null, e);
|
|
1379
1379
|
}
|
|
1380
1380
|
function Ke(e) {
|
|
1381
|
-
return
|
|
1381
|
+
return ye(e), e.headers = C.from(e.headers), e.data = Se.call(
|
|
1382
1382
|
e,
|
|
1383
1383
|
e.transformRequest
|
|
1384
1384
|
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Et.getAdapter(e.adapter || ee.adapter, e)(e).then(function(r) {
|
|
1385
|
-
return
|
|
1385
|
+
return ye(e), r.data = Se.call(
|
|
1386
1386
|
e,
|
|
1387
1387
|
e.transformResponse,
|
|
1388
1388
|
r
|
|
1389
|
-
), r.headers =
|
|
1389
|
+
), r.headers = C.from(r.headers), r;
|
|
1390
1390
|
}, function(r) {
|
|
1391
|
-
return ft(r) || (
|
|
1391
|
+
return ft(r) || (ye(e), r && r.response && (r.response.data = Se.call(
|
|
1392
1392
|
e,
|
|
1393
1393
|
e.transformResponse,
|
|
1394
1394
|
r.response
|
|
1395
|
-
), r.response.headers =
|
|
1395
|
+
), r.response.headers = C.from(r.response.headers))), Promise.reject(r);
|
|
1396
1396
|
});
|
|
1397
1397
|
}
|
|
1398
1398
|
const St = "1.13.2", he = {};
|
|
@@ -1477,7 +1477,7 @@ let q = class {
|
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
1479
1479
|
_request(t, n) {
|
|
1480
|
-
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n =
|
|
1480
|
+
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = M(this.defaults, n);
|
|
1481
1481
|
const { transitional: r, paramsSerializer: s, headers: o } = n;
|
|
1482
1482
|
r !== void 0 && ae.assertOptions(r, {
|
|
1483
1483
|
silentJSONParsing: L.transitional(L.boolean),
|
|
@@ -1501,7 +1501,7 @@ let q = class {
|
|
|
1501
1501
|
(f) => {
|
|
1502
1502
|
delete o[f];
|
|
1503
1503
|
}
|
|
1504
|
-
), n.headers =
|
|
1504
|
+
), n.headers = C.concat(i, o);
|
|
1505
1505
|
const c = [];
|
|
1506
1506
|
let d = !0;
|
|
1507
1507
|
this.interceptors.request.forEach(function(m) {
|
|
@@ -1539,14 +1539,14 @@ let q = class {
|
|
|
1539
1539
|
return l;
|
|
1540
1540
|
}
|
|
1541
1541
|
getUri(t) {
|
|
1542
|
-
t =
|
|
1542
|
+
t = M(this.defaults, t);
|
|
1543
1543
|
const n = ht(t.baseURL, t.url, t.allowAbsoluteUrls);
|
|
1544
1544
|
return ct(n, t.params, t.paramsSerializer);
|
|
1545
1545
|
}
|
|
1546
1546
|
};
|
|
1547
1547
|
a.forEach(["delete", "get", "head", "options"], function(t) {
|
|
1548
1548
|
q.prototype[t] = function(n, r) {
|
|
1549
|
-
return this.request(
|
|
1549
|
+
return this.request(M(r || {}, {
|
|
1550
1550
|
method: t,
|
|
1551
1551
|
url: n,
|
|
1552
1552
|
data: (r || {}).data
|
|
@@ -1556,7 +1556,7 @@ a.forEach(["delete", "get", "head", "options"], function(t) {
|
|
|
1556
1556
|
a.forEach(["post", "put", "patch"], function(t) {
|
|
1557
1557
|
function n(r) {
|
|
1558
1558
|
return function(o, i, c) {
|
|
1559
|
-
return this.request(
|
|
1559
|
+
return this.request(M(c || {}, {
|
|
1560
1560
|
method: t,
|
|
1561
1561
|
headers: r ? {
|
|
1562
1562
|
"Content-Type": "multipart/form-data"
|
|
@@ -1568,7 +1568,7 @@ a.forEach(["post", "put", "patch"], function(t) {
|
|
|
1568
1568
|
}
|
|
1569
1569
|
q.prototype[t] = n(), q.prototype[t + "Form"] = n(!0);
|
|
1570
1570
|
});
|
|
1571
|
-
let Vn = class
|
|
1571
|
+
let Vn = class yt {
|
|
1572
1572
|
constructor(t) {
|
|
1573
1573
|
if (typeof t != "function")
|
|
1574
1574
|
throw new TypeError("executor must be a function.");
|
|
@@ -1634,7 +1634,7 @@ let Vn = class Tt {
|
|
|
1634
1634
|
static source() {
|
|
1635
1635
|
let t;
|
|
1636
1636
|
return {
|
|
1637
|
-
token: new
|
|
1637
|
+
token: new yt(function(s) {
|
|
1638
1638
|
t = s;
|
|
1639
1639
|
}),
|
|
1640
1640
|
cancel: t
|
|
@@ -1723,88 +1723,91 @@ const Re = {
|
|
|
1723
1723
|
Object.entries(Re).forEach(([e, t]) => {
|
|
1724
1724
|
Re[t] = e;
|
|
1725
1725
|
});
|
|
1726
|
-
function
|
|
1726
|
+
function Tt(e) {
|
|
1727
1727
|
const t = new q(e), n = Xe(q.prototype.request, t);
|
|
1728
1728
|
return a.extend(n, q.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
|
|
1729
|
-
return
|
|
1729
|
+
return Tt(M(e, s));
|
|
1730
1730
|
}, n;
|
|
1731
1731
|
}
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1732
|
+
const y = Tt(ee);
|
|
1733
|
+
y.Axios = q;
|
|
1734
|
+
y.CanceledError = W;
|
|
1735
|
+
y.CancelToken = Vn;
|
|
1736
|
+
y.isCancel = ft;
|
|
1737
|
+
y.VERSION = St;
|
|
1738
|
+
y.toFormData = de;
|
|
1739
|
+
y.AxiosError = E;
|
|
1740
|
+
y.Cancel = y.CanceledError;
|
|
1741
|
+
y.all = function(t) {
|
|
1742
1742
|
return Promise.all(t);
|
|
1743
1743
|
};
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1744
|
+
y.spread = Xn;
|
|
1745
|
+
y.isAxiosError = Qn;
|
|
1746
|
+
y.mergeConfig = M;
|
|
1747
|
+
y.AxiosHeaders = C;
|
|
1748
|
+
y.formToJSON = (e) => ut(a.isHTMLForm(e) ? new FormData(e) : e);
|
|
1749
|
+
y.getAdapter = Et.getAdapter;
|
|
1750
|
+
y.HttpStatusCode = Re;
|
|
1751
|
+
y.default = y;
|
|
1752
1752
|
const {
|
|
1753
|
-
Axios:
|
|
1754
|
-
AxiosError:
|
|
1755
|
-
CanceledError:
|
|
1756
|
-
isCancel:
|
|
1757
|
-
CancelToken:
|
|
1758
|
-
VERSION:
|
|
1759
|
-
all:
|
|
1760
|
-
Cancel:
|
|
1761
|
-
isAxiosError:
|
|
1762
|
-
spread:
|
|
1763
|
-
toFormData:
|
|
1753
|
+
Axios: cr,
|
|
1754
|
+
AxiosError: lr,
|
|
1755
|
+
CanceledError: ur,
|
|
1756
|
+
isCancel: fr,
|
|
1757
|
+
CancelToken: dr,
|
|
1758
|
+
VERSION: hr,
|
|
1759
|
+
all: pr,
|
|
1760
|
+
Cancel: mr,
|
|
1761
|
+
isAxiosError: Er,
|
|
1762
|
+
spread: Sr,
|
|
1763
|
+
toFormData: yr,
|
|
1764
1764
|
AxiosHeaders: Tr,
|
|
1765
|
-
HttpStatusCode:
|
|
1766
|
-
formToJSON:
|
|
1767
|
-
getAdapter:
|
|
1768
|
-
mergeConfig:
|
|
1769
|
-
} =
|
|
1770
|
-
var X = /* @__PURE__ */ ((e) => (e.SEND = "1", e.WITHDRAW = "2", e.EDIT = "3", e.SYSTEM_NOTICE = "4", e.TRANSFER = "5", e.INBOUND = "6", e.REPLY = "7", e.UNBIND = "8", e))(X || {}),
|
|
1771
|
-
function
|
|
1765
|
+
HttpStatusCode: br,
|
|
1766
|
+
formToJSON: wr,
|
|
1767
|
+
getAdapter: Rr,
|
|
1768
|
+
mergeConfig: Or
|
|
1769
|
+
} = y, bt = "JOYTALK_TOKEN";
|
|
1770
|
+
var X = /* @__PURE__ */ ((e) => (e.SEND = "1", e.WITHDRAW = "2", e.EDIT = "3", e.SYSTEM_NOTICE = "4", e.TRANSFER = "5", e.INBOUND = "6", e.REPLY = "7", e.UNBIND = "8", e))(X || {}), I = /* @__PURE__ */ ((e) => (e.TEXT = "1", e.IMAGE = "2", e.VIDEO = "3", e.FILE = "4", e.FAQ = "5", e))(I || {}), j = /* @__PURE__ */ ((e) => (e[e.CONNECT_SUCCESS = 200] = "CONNECT_SUCCESS", e[e.CONNECT_FAILED = 40001] = "CONNECT_FAILED", e[e.TRANSFER_CUSTOMER_SUCCESS = 201] = "TRANSFER_CUSTOMER_SUCCESS", e[e.TRANSFER_TO_CUSTOMER_SUCCESS = 202] = "TRANSFER_TO_CUSTOMER_SUCCESS", e[e.TRANSFER_USER_SUCCESS = 203] = "TRANSFER_USER_SUCCESS", e[e.TRANSFER_FAIL = 50001] = "TRANSFER_FAIL", e[e.MATCH_FAIL = 50002] = "MATCH_FAIL", e[e.MATCH_INFO = 50005] = "MATCH_INFO", e[e.MATCH_SUCCESS = 50006] = "MATCH_SUCCESS", e[e.RETRACT = 204] = "RETRACT", e[e.RETRACT_FAIL = 50003] = "RETRACT_FAIL", e[e.EDIT = 205] = "EDIT", e[e.EDIT_FAIL = 50004] = "EDIT_FAIL", e[e.COMMON_FAIL = 5e4] = "COMMON_FAIL", e[e.SEND_SUCCESS = 206] = "SEND_SUCCESS", e[e.SEND_CALLBACK = 207] = "SEND_CALLBACK", e[e.CHANGE_CHAT_STATUS = 208] = "CHANGE_CHAT_STATUS", e))(j || {}), Oe = /* @__PURE__ */ ((e) => (e.CUSTOMER = "1", e.USER = "2", e.ANONYMOUS = "3", e))(Oe || {});
|
|
1771
|
+
function Ar(e) {
|
|
1772
1772
|
return e.contentType === "1";
|
|
1773
1773
|
}
|
|
1774
|
-
var
|
|
1775
|
-
const
|
|
1774
|
+
var A = /* @__PURE__ */ ((e) => (e.CONNECTED = "connected", e.DISCONNECTED = "disconnected", e.ERROR = "error", e.MESSAGE = "message", e.STATUS_CHANGE = "status_change", e.HEARTBEAT_TIMEOUT = "heartbeat_timeout", e))(A || {}), g = /* @__PURE__ */ ((e) => (e.DISCONNECTED = "disconnected", e.CONNECTING = "connecting", e.CONNECTED = "connected", e.RECONNECTING = "reconnecting", e.ERROR = "error", e))(g || {});
|
|
1775
|
+
const $ = y.create({
|
|
1776
1776
|
baseURL: "http://dev-joytalk-api.halaladmin.vip",
|
|
1777
1777
|
timeout: 6e5
|
|
1778
1778
|
});
|
|
1779
|
-
|
|
1779
|
+
$.interceptors.request.use(
|
|
1780
1780
|
(e) => (e.noAuth || (e.headers.Authorization = `Bearer ${localStorage.getItem(
|
|
1781
1781
|
bt
|
|
1782
1782
|
)}`), delete e.noAuth, e),
|
|
1783
1783
|
(e) => Promise.reject(e)
|
|
1784
1784
|
);
|
|
1785
|
-
|
|
1785
|
+
$.interceptors.response.use(
|
|
1786
1786
|
(e) => e.data.code !== 200 ? (console.error(e.data.message), Promise.reject(e)) : Promise.resolve(e.data),
|
|
1787
1787
|
(e) => Promise.reject(e)
|
|
1788
1788
|
);
|
|
1789
|
-
const Yn = (e) =>
|
|
1789
|
+
const Yn = (e) => $.post(
|
|
1790
1790
|
"/api/open-auth/obs/v1/ObsService/GetObsAuthInfo",
|
|
1791
1791
|
e
|
|
1792
|
-
), Zn = (e) =>
|
|
1792
|
+
), Zn = (e) => y.post("https://joytalk-fat.obs.ap-southeast-1.myhuaweicloud.com:443", e, {
|
|
1793
1793
|
headers: {
|
|
1794
1794
|
"Content-Type": "multipart/form-data"
|
|
1795
1795
|
}
|
|
1796
|
-
}), er = (e) =>
|
|
1796
|
+
}), er = (e) => $.post(
|
|
1797
1797
|
"/api/open-auth/open_consultation/v1/OpenConsultationService/GetConsultationList",
|
|
1798
1798
|
e
|
|
1799
|
-
), tr = (e) =>
|
|
1799
|
+
), tr = (e) => $.get(
|
|
1800
1800
|
"/api/open-auth/faq/v1/FaqService/GetFaqList",
|
|
1801
1801
|
{
|
|
1802
1802
|
params: e
|
|
1803
1803
|
}
|
|
1804
|
-
), nr = () =>
|
|
1804
|
+
), nr = () => $.get(
|
|
1805
1805
|
"/api/open-auth/user/v1/UserService/GetUserInfo"
|
|
1806
|
+
), rr = (e) => $.post(
|
|
1807
|
+
"/api/open-auth/user/v1/UserService/GetUserHistoryMessages",
|
|
1808
|
+
e
|
|
1806
1809
|
);
|
|
1807
|
-
class
|
|
1810
|
+
class sr {
|
|
1808
1811
|
events = /* @__PURE__ */ new Map();
|
|
1809
1812
|
/**
|
|
1810
1813
|
* 监听事件
|
|
@@ -1849,11 +1852,11 @@ class rr {
|
|
|
1849
1852
|
t ? this.events.delete(t) : this.events.clear();
|
|
1850
1853
|
}
|
|
1851
1854
|
}
|
|
1852
|
-
const
|
|
1853
|
-
class
|
|
1855
|
+
const or = "https://joytalk-fat.obs.ap-southeast-1.myhuaweicloud.com:443/";
|
|
1856
|
+
class gr extends sr {
|
|
1854
1857
|
config;
|
|
1855
1858
|
ws = null;
|
|
1856
|
-
status =
|
|
1859
|
+
status = g.DISCONNECTED;
|
|
1857
1860
|
reconnectTimer = null;
|
|
1858
1861
|
reconnectAttempts = 0;
|
|
1859
1862
|
/** 心跳超时定时器 */
|
|
@@ -1863,7 +1866,7 @@ class Ar extends rr {
|
|
|
1863
1866
|
/** 客户组ID */
|
|
1864
1867
|
customerGroupId = "";
|
|
1865
1868
|
/** obs 地址 */
|
|
1866
|
-
OBS_URL =
|
|
1869
|
+
OBS_URL = or;
|
|
1867
1870
|
sessionData = null;
|
|
1868
1871
|
userInfo = null;
|
|
1869
1872
|
constructor(t) {
|
|
@@ -1881,16 +1884,16 @@ class Ar extends rr {
|
|
|
1881
1884
|
*/
|
|
1882
1885
|
connect(t) {
|
|
1883
1886
|
return this.customerGroupId = t, new Promise((n, r) => {
|
|
1884
|
-
if (this.status ===
|
|
1887
|
+
if (this.status === g.CONNECTED) {
|
|
1885
1888
|
n();
|
|
1886
1889
|
return;
|
|
1887
1890
|
}
|
|
1888
|
-
if (this.status !==
|
|
1889
|
-
this.setStatus(
|
|
1891
|
+
if (this.status !== g.CONNECTING) {
|
|
1892
|
+
this.setStatus(g.CONNECTING);
|
|
1890
1893
|
try {
|
|
1891
1894
|
const s = this.buildWebSocketUrl();
|
|
1892
1895
|
this.ws = new WebSocket(s), this.ws.onopen = () => {
|
|
1893
|
-
this.reconnectAttempts = 0, this.setStatus(
|
|
1896
|
+
this.reconnectAttempts = 0, this.setStatus(g.CONNECTED), this.emit(A.CONNECTED), n();
|
|
1894
1897
|
}, this.ws.onmessage = (o) => {
|
|
1895
1898
|
try {
|
|
1896
1899
|
this.handleMessage(o.data);
|
|
@@ -1898,12 +1901,12 @@ class Ar extends rr {
|
|
|
1898
1901
|
console.error("解析消息失败:", i);
|
|
1899
1902
|
}
|
|
1900
1903
|
}, this.ws.onerror = (o) => {
|
|
1901
|
-
console.error("连接错误:", o), this.setStatus(
|
|
1904
|
+
console.error("连接错误:", o), this.setStatus(g.ERROR), this.emit(A.ERROR, o), r(o);
|
|
1902
1905
|
}, this.ws.onclose = () => {
|
|
1903
|
-
this.setStatus(
|
|
1906
|
+
this.setStatus(g.DISCONNECTED), this.emit(A.DISCONNECTED), this.config.autoReconnect && this.reconnectAttempts < this.config.maxReconnectAttempts && this.scheduleReconnect();
|
|
1904
1907
|
};
|
|
1905
1908
|
} catch (s) {
|
|
1906
|
-
this.setStatus(
|
|
1909
|
+
this.setStatus(g.ERROR), this.emit(A.ERROR, s), r(s);
|
|
1907
1910
|
}
|
|
1908
1911
|
}
|
|
1909
1912
|
});
|
|
@@ -1913,7 +1916,7 @@ class Ar extends rr {
|
|
|
1913
1916
|
* @returns void
|
|
1914
1917
|
*/
|
|
1915
1918
|
disconnect() {
|
|
1916
|
-
this.config.autoReconnect = !1, this.clearReconnectTimer(), this.heartbeatTimeoutTimer && (clearTimeout(this.heartbeatTimeoutTimer), this.heartbeatTimeoutTimer = null), this.ws && (this.ws.close(), this.ws = null), this.setStatus(
|
|
1919
|
+
this.config.autoReconnect = !1, this.sessionData = null, this.clearReconnectTimer(), this.heartbeatTimeoutTimer && (clearTimeout(this.heartbeatTimeoutTimer), this.heartbeatTimeoutTimer = null), this.ws && (this.ws.close(), this.ws = null), this.setStatus(g.DISCONNECTED);
|
|
1917
1920
|
}
|
|
1918
1921
|
/**
|
|
1919
1922
|
* 发送消息
|
|
@@ -1923,7 +1926,7 @@ class Ar extends rr {
|
|
|
1923
1926
|
* @returns void
|
|
1924
1927
|
*/
|
|
1925
1928
|
sendMessage(t, n, r = X.SEND) {
|
|
1926
|
-
if (this.status !==
|
|
1929
|
+
if (this.status !== g.CONNECTED || !this.ws)
|
|
1927
1930
|
throw new Error("未连接到服务器");
|
|
1928
1931
|
const s = {
|
|
1929
1932
|
msgType: r,
|
|
@@ -1940,7 +1943,7 @@ class Ar extends rr {
|
|
|
1940
1943
|
* @returns void
|
|
1941
1944
|
*/
|
|
1942
1945
|
sendText(t) {
|
|
1943
|
-
return this.sendMessage(t,
|
|
1946
|
+
return this.sendMessage(t, I.TEXT), Promise.resolve(!0);
|
|
1944
1947
|
}
|
|
1945
1948
|
/**
|
|
1946
1949
|
* 发送文件消息
|
|
@@ -1982,7 +1985,7 @@ class Ar extends rr {
|
|
|
1982
1985
|
* @returns boolean
|
|
1983
1986
|
*/
|
|
1984
1987
|
isConnected() {
|
|
1985
|
-
return this.status ===
|
|
1988
|
+
return this.status === g.CONNECTED;
|
|
1986
1989
|
}
|
|
1987
1990
|
/**
|
|
1988
1991
|
* 构建 WebSocket URL
|
|
@@ -2006,7 +2009,7 @@ class Ar extends rr {
|
|
|
2006
2009
|
try {
|
|
2007
2010
|
switch (t.code) {
|
|
2008
2011
|
// 连接成功
|
|
2009
|
-
case
|
|
2012
|
+
case j.CONNECT_SUCCESS:
|
|
2010
2013
|
this.sendMessage(
|
|
2011
2014
|
this.customerGroupId,
|
|
2012
2015
|
void 0,
|
|
@@ -2014,23 +2017,29 @@ class Ar extends rr {
|
|
|
2014
2017
|
);
|
|
2015
2018
|
break;
|
|
2016
2019
|
// 匹配成功
|
|
2017
|
-
case
|
|
2018
|
-
case
|
|
2020
|
+
case j.MATCH_INFO:
|
|
2021
|
+
case j.MATCH_SUCCESS:
|
|
2022
|
+
if (console.log("MATCH_SUCCESS", this.sessionData), this.sessionData)
|
|
2023
|
+
return;
|
|
2019
2024
|
const n = JSON.parse(
|
|
2020
2025
|
typeof t.data == "string" ? t.data : JSON.stringify(t.data)
|
|
2021
2026
|
);
|
|
2022
|
-
this.sessionData = n, t.data = n, this.getFaqList();
|
|
2027
|
+
this.sessionData = n, t.data = n, this.getFaqList(), this.emit(A.MESSAGE, t);
|
|
2023
2028
|
break;
|
|
2024
|
-
case
|
|
2029
|
+
case j.SEND_SUCCESS:
|
|
2025
2030
|
const r = JSON.parse(
|
|
2026
2031
|
typeof t.data == "string" ? t.data : JSON.stringify(t.data)
|
|
2027
2032
|
);
|
|
2028
|
-
|
|
2033
|
+
if (r.sessionId !== this.sessionData?.sessionId)
|
|
2034
|
+
return;
|
|
2035
|
+
t.chatType !== I.TEXT && typeof r.content == "string" && (r.content = JSON.parse(
|
|
2029
2036
|
r.content
|
|
2030
|
-
), r.content?.fileUrl?.startsWith("http") || (r.content.fileUrl = this.OBS_URL + r.content.fileUrl), r.content?.thumbnailUrl?.startsWith("http") || (r.content.thumbnailUrl = this.OBS_URL + r.content.thumbnailUrl)), t.data = r;
|
|
2037
|
+
), r.content?.fileUrl?.startsWith("http") || (r.content.fileUrl = this.OBS_URL + r.content.fileUrl), r.content?.thumbnailUrl?.startsWith("http") || (r.content.thumbnailUrl = this.OBS_URL + r.content.thumbnailUrl)), t.data = r, this.emit(A.MESSAGE, t);
|
|
2038
|
+
break;
|
|
2039
|
+
default:
|
|
2040
|
+
this.emit(A.MESSAGE, t);
|
|
2031
2041
|
break;
|
|
2032
2042
|
}
|
|
2033
|
-
this.emit(_.MESSAGE, t);
|
|
2034
2043
|
} catch (n) {
|
|
2035
2044
|
console.error("解析消息失败:", n);
|
|
2036
2045
|
}
|
|
@@ -2049,14 +2058,14 @@ class Ar extends rr {
|
|
|
2049
2058
|
* @returns void
|
|
2050
2059
|
*/
|
|
2051
2060
|
setStatus(t) {
|
|
2052
|
-
this.status !== t && (this.status = t, this.emit(
|
|
2061
|
+
this.status !== t && (this.status = t, this.emit(A.STATUS_CHANGE, t));
|
|
2053
2062
|
}
|
|
2054
2063
|
/**
|
|
2055
2064
|
* 安排重连
|
|
2056
2065
|
* @returns void
|
|
2057
2066
|
*/
|
|
2058
2067
|
scheduleReconnect() {
|
|
2059
|
-
this.clearReconnectTimer(), this.reconnectAttempts++, this.setStatus(
|
|
2068
|
+
this.clearReconnectTimer(), this.reconnectAttempts++, this.setStatus(g.RECONNECTING), this.reconnectTimer = setTimeout(() => {
|
|
2060
2069
|
this.connect(this.customerGroupId).catch((t) => {
|
|
2061
2070
|
console.error("重连失败:", t);
|
|
2062
2071
|
});
|
|
@@ -2074,74 +2083,40 @@ class Ar extends rr {
|
|
|
2074
2083
|
* @returns void
|
|
2075
2084
|
*/
|
|
2076
2085
|
sendHeartbeat() {
|
|
2077
|
-
if (!(this.status !==
|
|
2086
|
+
if (!(this.status !== g.CONNECTED || !this.ws))
|
|
2078
2087
|
try {
|
|
2079
2088
|
this.ws.send("pong"), this.lastHeartbeatTime = Date.now(), this.heartbeatTimeoutTimer = setTimeout(() => {
|
|
2080
|
-
Date.now() - this.lastHeartbeatTime >= this.config.heartbeatTimeout && (this.emit(
|
|
2089
|
+
Date.now() - this.lastHeartbeatTime >= this.config.heartbeatTimeout && (this.emit(A.HEARTBEAT_TIMEOUT), console.warn("心跳超时,尝试重连"), this.ws && this.ws.close());
|
|
2081
2090
|
}, this.config.heartbeatTimeout);
|
|
2082
2091
|
} catch (t) {
|
|
2083
2092
|
console.error("发送心跳失败:", t);
|
|
2084
2093
|
}
|
|
2085
2094
|
}
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
// queryParams.set("startTime", params.startTime.toString());
|
|
2112
|
-
// }
|
|
2113
|
-
// if (params.endTime) {
|
|
2114
|
-
// queryParams.set("endTime", params.endTime.toString());
|
|
2115
|
-
// }
|
|
2116
|
-
// // const url = `${
|
|
2117
|
-
// // this.config.apiBaseUrl
|
|
2118
|
-
// // }/api/chat/history?${queryParams.toString()}`;
|
|
2119
|
-
// // const headers: HeadersInit = {
|
|
2120
|
-
// // "Content-Type": "application/json",
|
|
2121
|
-
// // };
|
|
2122
|
-
// // if (this.config.token) {
|
|
2123
|
-
// // headers["Authorization"] = `Bearer ${this.config.token}`;
|
|
2124
|
-
// // }
|
|
2125
|
-
// // // if (this.config.userId) {
|
|
2126
|
-
// // // headers["X-User-Id"] = this.config.userId;
|
|
2127
|
-
// // // }
|
|
2128
|
-
// // try {
|
|
2129
|
-
// // const response = await fetch(url, {
|
|
2130
|
-
// // method: "GET",
|
|
2131
|
-
// // headers,
|
|
2132
|
-
// // });
|
|
2133
|
-
// // if (!response.ok) {
|
|
2134
|
-
// // throw new Error(
|
|
2135
|
-
// // `获取聊天记录失败: ${response.status} ${response.statusText}`
|
|
2136
|
-
// // );
|
|
2137
|
-
// // }
|
|
2138
|
-
// // const data = await response.json();
|
|
2139
|
-
// // return data as ChatHistoryResponse;
|
|
2140
|
-
// // } catch (error) {
|
|
2141
|
-
// // console.error("获取聊天记录失败:", error);
|
|
2142
|
-
// // throw error;
|
|
2143
|
-
// // }
|
|
2144
|
-
// }
|
|
2095
|
+
/**
|
|
2096
|
+
* 获取聊天记录
|
|
2097
|
+
* @param params - 查询参数
|
|
2098
|
+
* @returns Promise<ChatHistoryResponse>
|
|
2099
|
+
*/
|
|
2100
|
+
async getHistoryMessages({
|
|
2101
|
+
lastMsgId: t,
|
|
2102
|
+
size: n = 10
|
|
2103
|
+
}) {
|
|
2104
|
+
const r = await rr({
|
|
2105
|
+
sessionId: this.sessionData?.sessionId,
|
|
2106
|
+
lastMsgId: t,
|
|
2107
|
+
size: n
|
|
2108
|
+
}), s = r.data.list.map((o) => {
|
|
2109
|
+
let i = o.content;
|
|
2110
|
+
return o.contentType === I.TEXT ? i = o.content : (i = JSON.parse(o.content), i?.fileUrl?.startsWith("http") || (i.fileUrl = this.OBS_URL + i.fileUrl), i?.thumbnailUrl?.startsWith("http") || (i.thumbnailUrl = this.OBS_URL + i.thumbnailUrl)), {
|
|
2111
|
+
...o,
|
|
2112
|
+
content: i
|
|
2113
|
+
};
|
|
2114
|
+
});
|
|
2115
|
+
return {
|
|
2116
|
+
hasMore: r.data.hasMore,
|
|
2117
|
+
list: s.reverse()
|
|
2118
|
+
};
|
|
2119
|
+
}
|
|
2145
2120
|
/**
|
|
2146
2121
|
* 获取咨询列表
|
|
2147
2122
|
* @returns Promise<ConsultationListResponse>
|
|
@@ -2207,20 +2182,20 @@ class Ar extends rr {
|
|
|
2207
2182
|
};
|
|
2208
2183
|
setTimeout(() => {
|
|
2209
2184
|
const r = {
|
|
2210
|
-
code:
|
|
2185
|
+
code: j.SEND_SUCCESS,
|
|
2211
2186
|
data: {
|
|
2212
2187
|
content: n,
|
|
2213
|
-
contentType:
|
|
2188
|
+
contentType: I.FAQ,
|
|
2214
2189
|
sendUserType: Oe.CUSTOMER,
|
|
2215
2190
|
customerServiceAvatar: this.sessionData?.customerAvatar,
|
|
2216
2191
|
customerServiceName: this.sessionData?.customerName,
|
|
2217
2192
|
createTime: Date.now()
|
|
2218
2193
|
},
|
|
2219
2194
|
msgType: X.SEND,
|
|
2220
|
-
chatType:
|
|
2195
|
+
chatType: I.FAQ,
|
|
2221
2196
|
toUid: this.sessionData?.uid
|
|
2222
2197
|
};
|
|
2223
|
-
this.emit(
|
|
2198
|
+
this.emit(A.MESSAGE, r);
|
|
2224
2199
|
}, t.data.showDelaySeconds * 1e3);
|
|
2225
2200
|
}
|
|
2226
2201
|
sendFaq(t) {
|
|
@@ -2230,10 +2205,10 @@ class Ar extends rr {
|
|
|
2230
2205
|
customerServiceName: this.sessionData?.customerName,
|
|
2231
2206
|
createTime: Date.now()
|
|
2232
2207
|
}, r = {
|
|
2233
|
-
code:
|
|
2208
|
+
code: j.SEND_SUCCESS,
|
|
2234
2209
|
data: n,
|
|
2235
2210
|
msgType: X.SEND,
|
|
2236
|
-
chatType:
|
|
2211
|
+
chatType: I.FAQ,
|
|
2237
2212
|
toUid: this.sessionData?.uid
|
|
2238
2213
|
};
|
|
2239
2214
|
if (t.isMulti) {
|
|
@@ -2244,10 +2219,10 @@ class Ar extends rr {
|
|
|
2244
2219
|
content: {
|
|
2245
2220
|
list: t.item
|
|
2246
2221
|
},
|
|
2247
|
-
contentType:
|
|
2222
|
+
contentType: I.FAQ
|
|
2248
2223
|
}
|
|
2249
2224
|
};
|
|
2250
|
-
this.emit(
|
|
2225
|
+
this.emit(A.MESSAGE, s);
|
|
2251
2226
|
} else {
|
|
2252
2227
|
const s = t.item?.[0] || t;
|
|
2253
2228
|
if (s.answer) {
|
|
@@ -2256,10 +2231,10 @@ class Ar extends rr {
|
|
|
2256
2231
|
data: {
|
|
2257
2232
|
...n,
|
|
2258
2233
|
content: s.answer,
|
|
2259
|
-
contentType:
|
|
2234
|
+
contentType: I.TEXT
|
|
2260
2235
|
}
|
|
2261
2236
|
};
|
|
2262
|
-
this.emit(
|
|
2237
|
+
this.emit(A.MESSAGE, o);
|
|
2263
2238
|
}
|
|
2264
2239
|
s.imageUrl?.forEach((o) => {
|
|
2265
2240
|
const i = {
|
|
@@ -2270,10 +2245,10 @@ class Ar extends rr {
|
|
|
2270
2245
|
fileUrl: o?.startsWith("http") ? o : this.OBS_URL + o,
|
|
2271
2246
|
fileName: o.split("/").pop()
|
|
2272
2247
|
},
|
|
2273
|
-
contentType:
|
|
2248
|
+
contentType: I.IMAGE
|
|
2274
2249
|
}
|
|
2275
2250
|
};
|
|
2276
|
-
this.emit(
|
|
2251
|
+
this.emit(A.MESSAGE, i);
|
|
2277
2252
|
});
|
|
2278
2253
|
}
|
|
2279
2254
|
}
|
|
@@ -2285,13 +2260,13 @@ class Ar extends rr {
|
|
|
2285
2260
|
}
|
|
2286
2261
|
}
|
|
2287
2262
|
export {
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2263
|
+
I as ChatType,
|
|
2264
|
+
g as ConnectionStatus,
|
|
2265
|
+
A as EventType,
|
|
2266
|
+
j as MessageCode,
|
|
2292
2267
|
X as MessageType,
|
|
2293
2268
|
Oe as SendUserType,
|
|
2294
2269
|
bt as TOKEN_KEY,
|
|
2295
|
-
|
|
2296
|
-
|
|
2270
|
+
gr as default,
|
|
2271
|
+
Ar as isTextMessage
|
|
2297
2272
|
};
|