joytalk 0.0.21 → 0.0.22
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/README.md +106 -46
- package/dist/apis/request.d.ts +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.es.js +374 -359
- package/dist/index.umd.js +6 -6
- package/dist/lib/index.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/request.d.ts +0 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -3,45 +3,45 @@ function ot(e, t) {
|
|
|
3
3
|
return e.apply(t, arguments);
|
|
4
4
|
};
|
|
5
5
|
}
|
|
6
|
-
const { toString:
|
|
7
|
-
const n =
|
|
6
|
+
const { toString: Dt } = Object.prototype, { getPrototypeOf: De } = Object, { iterator: me, toStringTag: it } = Symbol, Ee = /* @__PURE__ */ ((e) => (t) => {
|
|
7
|
+
const n = Dt.call(t);
|
|
8
8
|
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
9
|
-
})(/* @__PURE__ */ Object.create(null)), P = (e) => (e = e.toLowerCase(), (t) => Ee(t) === e), Se = (e) => (t) => typeof t === e, { isArray:
|
|
10
|
-
function
|
|
11
|
-
return e !== null && !
|
|
9
|
+
})(/* @__PURE__ */ Object.create(null)), P = (e) => (e = e.toLowerCase(), (t) => Ee(t) === e), Se = (e) => (t) => typeof t === e, { isArray: Y } = Array, X = Se("undefined");
|
|
10
|
+
function ne(e) {
|
|
11
|
+
return e !== null && !X(e) && e.constructor !== null && !X(e.constructor) && _(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
12
12
|
}
|
|
13
13
|
const at = P("ArrayBuffer");
|
|
14
14
|
function It(e) {
|
|
15
15
|
let t;
|
|
16
16
|
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && at(e.buffer), t;
|
|
17
17
|
}
|
|
18
|
-
const Lt = Se("string"),
|
|
18
|
+
const Lt = Se("string"), _ = Se("function"), ct = Se("number"), re = (e) => e !== null && typeof e == "object", Ft = (e) => e === !0 || e === !1, ue = (e) => {
|
|
19
19
|
if (Ee(e) !== "object")
|
|
20
20
|
return !1;
|
|
21
|
-
const t =
|
|
21
|
+
const t = De(e);
|
|
22
22
|
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(it in e) && !(me in e);
|
|
23
23
|
}, Pt = (e) => {
|
|
24
|
-
if (!
|
|
24
|
+
if (!re(e) || ne(e))
|
|
25
25
|
return !1;
|
|
26
26
|
try {
|
|
27
27
|
return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
|
|
28
28
|
} catch {
|
|
29
29
|
return !1;
|
|
30
30
|
}
|
|
31
|
-
}, xt = P("Date"),
|
|
31
|
+
}, xt = P("Date"), Bt = P("File"), kt = P("Blob"), Ht = P("FileList"), jt = (e) => re(e) && _(e.pipe), vt = (e) => {
|
|
32
32
|
let t;
|
|
33
|
-
return e && (typeof FormData == "function" && e instanceof FormData ||
|
|
34
|
-
t === "object" &&
|
|
35
|
-
},
|
|
36
|
-
function
|
|
33
|
+
return e && (typeof FormData == "function" && e instanceof FormData || _(e.append) && ((t = Ee(e)) === "formdata" || // detect form-data instance
|
|
34
|
+
t === "object" && _(e.toString) && e.toString() === "[object FormData]"));
|
|
35
|
+
}, Mt = P("URLSearchParams"), [qt, $t, Gt, zt] = ["ReadableStream", "Request", "Response", "Headers"].map(P), Jt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
36
|
+
function se(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]), Y(e))
|
|
41
41
|
for (r = 0, s = e.length; r < s; r++)
|
|
42
42
|
t.call(null, e[r], r, e);
|
|
43
43
|
else {
|
|
44
|
-
if (
|
|
44
|
+
if (ne(e))
|
|
45
45
|
return;
|
|
46
46
|
const o = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = o.length;
|
|
47
47
|
let c;
|
|
@@ -50,7 +50,7 @@ function ne(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function lt(e, t) {
|
|
53
|
-
if (
|
|
53
|
+
if (ne(e))
|
|
54
54
|
return null;
|
|
55
55
|
t = t.toLowerCase();
|
|
56
56
|
const n = Object.keys(e);
|
|
@@ -60,18 +60,18 @@ function lt(e, t) {
|
|
|
60
60
|
return s;
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
|
-
const G = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, ut = (e) => !
|
|
63
|
+
const G = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, ut = (e) => !X(e) && e !== G;
|
|
64
64
|
function Oe() {
|
|
65
65
|
const { caseless: e, skipUndefined: t } = ut(this) && this || {}, n = {}, r = (s, o) => {
|
|
66
66
|
const i = e && lt(n, o) || o;
|
|
67
|
-
|
|
67
|
+
ue(n[i]) && ue(s) ? n[i] = Oe(n[i], s) : ue(s) ? n[i] = Oe({}, s) : Y(s) ? n[i] = s.slice() : (!t || !X(s)) && (n[i] = s);
|
|
68
68
|
};
|
|
69
69
|
for (let s = 0, o = arguments.length; s < o; s++)
|
|
70
|
-
arguments[s] &&
|
|
70
|
+
arguments[s] && se(arguments[s], r);
|
|
71
71
|
return n;
|
|
72
72
|
}
|
|
73
|
-
const Wt = (e, t, n, { allOwnKeys: r } = {}) => (
|
|
74
|
-
n &&
|
|
73
|
+
const Wt = (e, t, n, { allOwnKeys: r } = {}) => (se(t, (s, o) => {
|
|
74
|
+
n && _(s) ? e[o] = ot(s, n) : e[o] = s;
|
|
75
75
|
}, { allOwnKeys: r }), e), Vt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Kt = (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
|
|
@@ -83,7 +83,7 @@ const Wt = (e, t, n, { allOwnKeys: r } = {}) => (ne(t, (s, o) => {
|
|
|
83
83
|
do {
|
|
84
84
|
for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
|
|
85
85
|
i = s[o], (!r || r(i, e, t)) && !c[i] && (t[i] = e[i], c[i] = !0);
|
|
86
|
-
e = n !== !1 &&
|
|
86
|
+
e = n !== !1 && De(e);
|
|
87
87
|
} while (e && (!n || n(e, t)) && e !== Object.prototype);
|
|
88
88
|
return t;
|
|
89
89
|
}, Yt = (e, t, n) => {
|
|
@@ -92,14 +92,14 @@ const Wt = (e, t, n, { allOwnKeys: r } = {}) => (ne(t, (s, o) => {
|
|
|
92
92
|
return r !== -1 && r === n;
|
|
93
93
|
}, Qt = (e) => {
|
|
94
94
|
if (!e) return null;
|
|
95
|
-
if (
|
|
95
|
+
if (Y(e)) return e;
|
|
96
96
|
let t = e.length;
|
|
97
97
|
if (!ct(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" &&
|
|
102
|
+
}, Zt = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && De(Uint8Array)), en = (e, t) => {
|
|
103
103
|
const r = (e && e[me]).call(e);
|
|
104
104
|
let s;
|
|
105
105
|
for (; (s = r.next()) && !s.done; ) {
|
|
@@ -117,18 +117,18 @@ const Wt = (e, t, n, { allOwnKeys: r } = {}) => (ne(t, (s, o) => {
|
|
|
117
117
|
function(n, r, s) {
|
|
118
118
|
return r.toUpperCase() + s;
|
|
119
119
|
}
|
|
120
|
-
),
|
|
120
|
+
), Me = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), sn = P("RegExp"), ft = (e, t) => {
|
|
121
121
|
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
122
|
-
|
|
122
|
+
se(n, (s, o) => {
|
|
123
123
|
let i;
|
|
124
124
|
(i = t(s, o, e)) !== !1 && (r[o] = i || s);
|
|
125
125
|
}), Object.defineProperties(e, r);
|
|
126
126
|
}, on = (e) => {
|
|
127
127
|
ft(e, (t, n) => {
|
|
128
|
-
if (
|
|
128
|
+
if (_(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
129
129
|
return !1;
|
|
130
130
|
const r = e[n];
|
|
131
|
-
if (
|
|
131
|
+
if (_(r)) {
|
|
132
132
|
if (t.enumerable = !1, "writable" in t) {
|
|
133
133
|
t.writable = !1;
|
|
134
134
|
return;
|
|
@@ -144,65 +144,65 @@ const Wt = (e, t, n, { allOwnKeys: r } = {}) => (ne(t, (s, o) => {
|
|
|
144
144
|
n[o] = !0;
|
|
145
145
|
});
|
|
146
146
|
};
|
|
147
|
-
return
|
|
147
|
+
return Y(e) ? r(e) : r(String(e).split(t)), n;
|
|
148
148
|
}, cn = () => {
|
|
149
149
|
}, ln = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
150
150
|
function un(e) {
|
|
151
|
-
return !!(e &&
|
|
151
|
+
return !!(e && _(e.append) && e[it] === "FormData" && e[me]);
|
|
152
152
|
}
|
|
153
153
|
const fn = (e) => {
|
|
154
154
|
const t = new Array(10), n = (r, s) => {
|
|
155
|
-
if (
|
|
155
|
+
if (re(r)) {
|
|
156
156
|
if (t.indexOf(r) >= 0)
|
|
157
157
|
return;
|
|
158
|
-
if (
|
|
158
|
+
if (ne(r))
|
|
159
159
|
return r;
|
|
160
160
|
if (!("toJSON" in r)) {
|
|
161
161
|
t[s] = r;
|
|
162
|
-
const o =
|
|
163
|
-
return
|
|
162
|
+
const o = Y(r) ? [] : {};
|
|
163
|
+
return se(r, (i, c) => {
|
|
164
164
|
const d = n(i, s + 1);
|
|
165
|
-
!
|
|
165
|
+
!X(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
|
-
}, dn = P("AsyncFunction"), hn = (e) => e && (
|
|
172
|
+
}, dn = P("AsyncFunction"), hn = (e) => e && (re(e) || _(e)) && _(e.then) && _(e.catch), dt = ((e, t) => e ? setImmediate : t ? ((n, r) => (G.addEventListener("message", ({ source: s, data: o }) => {
|
|
173
173
|
s === G && o === n && r.length && r.shift()();
|
|
174
174
|
}, !1), (s) => {
|
|
175
175
|
r.push(s), G.postMessage(n, "*");
|
|
176
176
|
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
177
177
|
typeof setImmediate == "function",
|
|
178
|
-
|
|
179
|
-
), pn = typeof queueMicrotask < "u" ? queueMicrotask.bind(G) : typeof process < "u" && process.nextTick || dt, mn = (e) => e != null &&
|
|
180
|
-
isArray:
|
|
178
|
+
_(G.postMessage)
|
|
179
|
+
), pn = typeof queueMicrotask < "u" ? queueMicrotask.bind(G) : typeof process < "u" && process.nextTick || dt, mn = (e) => e != null && _(e[me]), a = {
|
|
180
|
+
isArray: Y,
|
|
181
181
|
isArrayBuffer: at,
|
|
182
|
-
isBuffer:
|
|
183
|
-
isFormData:
|
|
182
|
+
isBuffer: ne,
|
|
183
|
+
isFormData: vt,
|
|
184
184
|
isArrayBufferView: It,
|
|
185
185
|
isString: Lt,
|
|
186
186
|
isNumber: ct,
|
|
187
187
|
isBoolean: Ft,
|
|
188
|
-
isObject:
|
|
189
|
-
isPlainObject:
|
|
188
|
+
isObject: re,
|
|
189
|
+
isPlainObject: ue,
|
|
190
190
|
isEmptyObject: Pt,
|
|
191
191
|
isReadableStream: qt,
|
|
192
192
|
isRequest: $t,
|
|
193
193
|
isResponse: Gt,
|
|
194
194
|
isHeaders: zt,
|
|
195
|
-
isUndefined:
|
|
195
|
+
isUndefined: X,
|
|
196
196
|
isDate: xt,
|
|
197
|
-
isFile:
|
|
198
|
-
isBlob:
|
|
197
|
+
isFile: Bt,
|
|
198
|
+
isBlob: kt,
|
|
199
199
|
isRegExp: sn,
|
|
200
|
-
isFunction:
|
|
200
|
+
isFunction: _,
|
|
201
201
|
isStream: jt,
|
|
202
|
-
isURLSearchParams:
|
|
202
|
+
isURLSearchParams: Mt,
|
|
203
203
|
isTypedArray: Zt,
|
|
204
204
|
isFileList: Ht,
|
|
205
|
-
forEach:
|
|
205
|
+
forEach: se,
|
|
206
206
|
merge: Oe,
|
|
207
207
|
extend: Wt,
|
|
208
208
|
trim: Jt,
|
|
@@ -216,8 +216,8 @@ const fn = (e) => {
|
|
|
216
216
|
forEachEntry: en,
|
|
217
217
|
matchAll: tn,
|
|
218
218
|
isHTMLForm: nn,
|
|
219
|
-
hasOwnProperty:
|
|
220
|
-
hasOwnProp:
|
|
219
|
+
hasOwnProperty: Me,
|
|
220
|
+
hasOwnProp: Me,
|
|
221
221
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
222
222
|
reduceDescriptors: ft,
|
|
223
223
|
freezeMethods: on,
|
|
@@ -295,7 +295,7 @@ function Ce(e) {
|
|
|
295
295
|
function mt(e) {
|
|
296
296
|
return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function qe(e, t, n) {
|
|
299
299
|
return e ? e.concat(t).map(function(s, o) {
|
|
300
300
|
return s = mt(s), !n && o ? "[" + s + "]" : s;
|
|
301
301
|
}).join(n ? "." : "") : t;
|
|
@@ -313,8 +313,8 @@ function Te(e, t, n) {
|
|
|
313
313
|
metaTokens: !0,
|
|
314
314
|
dots: !1,
|
|
315
315
|
indexes: !1
|
|
316
|
-
}, !1, function(m,
|
|
317
|
-
return !a.isUndefined(
|
|
316
|
+
}, !1, function(m, p) {
|
|
317
|
+
return !a.isUndefined(p[m]);
|
|
318
318
|
});
|
|
319
319
|
const r = n.metaTokens, s = n.visitor || l, o = n.dots, i = n.indexes, d = (n.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(t);
|
|
320
320
|
if (!a.isFunction(s))
|
|
@@ -329,47 +329,47 @@ function Te(e, t, n) {
|
|
|
329
329
|
throw new E("Blob is not supported. Use a Buffer instead.");
|
|
330
330
|
return a.isArrayBuffer(f) || a.isTypedArray(f) ? d && typeof Blob == "function" ? new Blob([f]) : Buffer.from(f) : f;
|
|
331
331
|
}
|
|
332
|
-
function l(f, m,
|
|
332
|
+
function l(f, m, p) {
|
|
333
333
|
let w = f;
|
|
334
|
-
if (f && !
|
|
334
|
+
if (f && !p && typeof f == "object") {
|
|
335
335
|
if (a.endsWith(m, "{}"))
|
|
336
336
|
m = r ? m : m.slice(0, -2), f = JSON.stringify(f);
|
|
337
337
|
else if (a.isArray(f) && Sn(f) || (a.isFileList(f) || a.endsWith(m, "[]")) && (w = a.toArray(f)))
|
|
338
338
|
return m = mt(m), w.forEach(function(R, g) {
|
|
339
339
|
!(a.isUndefined(R) || R === null) && t.append(
|
|
340
340
|
// eslint-disable-next-line no-nested-ternary
|
|
341
|
-
i === !0 ?
|
|
341
|
+
i === !0 ? qe([m], g, o) : i === null ? m : m + "[]",
|
|
342
342
|
u(R)
|
|
343
343
|
);
|
|
344
344
|
}), !1;
|
|
345
345
|
}
|
|
346
|
-
return Ce(f) ? !0 : (t.append(
|
|
346
|
+
return Ce(f) ? !0 : (t.append(qe(p, m, o), u(f)), !1);
|
|
347
347
|
}
|
|
348
|
-
const
|
|
348
|
+
const h = [], S = Object.assign(Tn, {
|
|
349
349
|
defaultVisitor: l,
|
|
350
350
|
convertValue: u,
|
|
351
351
|
isVisitable: Ce
|
|
352
352
|
});
|
|
353
|
-
function
|
|
353
|
+
function b(f, m) {
|
|
354
354
|
if (!a.isUndefined(f)) {
|
|
355
|
-
if (
|
|
355
|
+
if (h.indexOf(f) !== -1)
|
|
356
356
|
throw Error("Circular reference detected in " + m.join("."));
|
|
357
|
-
|
|
357
|
+
h.push(f), a.forEach(f, function(w, I) {
|
|
358
358
|
(!(a.isUndefined(w) || w === null) && s.call(
|
|
359
359
|
t,
|
|
360
360
|
w,
|
|
361
361
|
a.isString(I) ? I.trim() : I,
|
|
362
362
|
m,
|
|
363
363
|
S
|
|
364
|
-
)) === !0 &&
|
|
365
|
-
}),
|
|
364
|
+
)) === !0 && b(w, m ? m.concat(I) : [I]);
|
|
365
|
+
}), h.pop();
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
if (!a.isObject(e))
|
|
369
369
|
throw new TypeError("data must be an object");
|
|
370
|
-
return
|
|
370
|
+
return b(e), t;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function $e(e) {
|
|
373
373
|
const t = {
|
|
374
374
|
"!": "%21",
|
|
375
375
|
"'": "%27",
|
|
@@ -383,17 +383,17 @@ function Ge(e) {
|
|
|
383
383
|
return t[r];
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function Ie(e, t) {
|
|
387
387
|
this._pairs = [], e && Te(e, this, t);
|
|
388
388
|
}
|
|
389
|
-
const Et =
|
|
389
|
+
const Et = Ie.prototype;
|
|
390
390
|
Et.append = function(t, n) {
|
|
391
391
|
this._pairs.push([t, n]);
|
|
392
392
|
};
|
|
393
393
|
Et.toString = function(t) {
|
|
394
394
|
const n = t ? function(r) {
|
|
395
|
-
return t.call(this, r,
|
|
396
|
-
} :
|
|
395
|
+
return t.call(this, r, $e);
|
|
396
|
+
} : $e;
|
|
397
397
|
return this._pairs.map(function(s) {
|
|
398
398
|
return n(s[0]) + "=" + n(s[1]);
|
|
399
399
|
}, "").join("&");
|
|
@@ -410,13 +410,13 @@ function St(e, t, n) {
|
|
|
410
410
|
});
|
|
411
411
|
const s = n && n.serialize;
|
|
412
412
|
let o;
|
|
413
|
-
if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new
|
|
413
|
+
if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new Ie(t, n).toString(r), o) {
|
|
414
414
|
const i = e.indexOf("#");
|
|
415
415
|
i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
|
|
416
416
|
}
|
|
417
417
|
return e;
|
|
418
418
|
}
|
|
419
|
-
class
|
|
419
|
+
class Ge {
|
|
420
420
|
constructor() {
|
|
421
421
|
this.handlers = [];
|
|
422
422
|
}
|
|
@@ -474,25 +474,25 @@ const Tt = {
|
|
|
474
474
|
silentJSONParsing: !0,
|
|
475
475
|
forcedJSONParsing: !0,
|
|
476
476
|
clarifyTimeoutError: !1
|
|
477
|
-
}, Rn = typeof URLSearchParams < "u" ? URLSearchParams :
|
|
477
|
+
}, Rn = typeof URLSearchParams < "u" ? URLSearchParams : Ie, yn = typeof FormData < "u" ? FormData : null, An = typeof Blob < "u" ? Blob : null, bn = {
|
|
478
478
|
isBrowser: !0,
|
|
479
479
|
classes: {
|
|
480
480
|
URLSearchParams: Rn,
|
|
481
481
|
FormData: yn,
|
|
482
|
-
Blob:
|
|
482
|
+
Blob: An
|
|
483
483
|
},
|
|
484
484
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
485
|
-
},
|
|
486
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Cn =
|
|
485
|
+
}, Le = typeof window < "u" && typeof document < "u", ge = typeof navigator == "object" && navigator || void 0, Nn = Le && (!ge || ["ReactNative", "NativeScript", "NS"].indexOf(ge.product) < 0), On = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
486
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Cn = Le && window.location.href || "http://localhost", gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
487
487
|
__proto__: null,
|
|
488
|
-
hasBrowserEnv:
|
|
488
|
+
hasBrowserEnv: Le,
|
|
489
489
|
hasStandardBrowserEnv: Nn,
|
|
490
490
|
hasStandardBrowserWebWorkerEnv: On,
|
|
491
491
|
navigator: ge,
|
|
492
492
|
origin: Cn
|
|
493
493
|
}, Symbol.toStringTag, { value: "Module" })), N = {
|
|
494
494
|
...gn,
|
|
495
|
-
...
|
|
495
|
+
...bn
|
|
496
496
|
};
|
|
497
497
|
function Un(e, t) {
|
|
498
498
|
return Te(e, new N.classes.URLSearchParams(), {
|
|
@@ -502,10 +502,10 @@ function Un(e, t) {
|
|
|
502
502
|
...t
|
|
503
503
|
});
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function _n(e) {
|
|
506
506
|
return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function Dn(e) {
|
|
509
509
|
const t = {}, n = Object.keys(e);
|
|
510
510
|
let r;
|
|
511
511
|
const s = n.length;
|
|
@@ -519,12 +519,12 @@ function wt(e) {
|
|
|
519
519
|
let i = n[o++];
|
|
520
520
|
if (i === "__proto__") return !0;
|
|
521
521
|
const c = Number.isFinite(+i), d = o >= n.length;
|
|
522
|
-
return i = !i && a.isArray(s) ? s.length : i, d ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !c) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] =
|
|
522
|
+
return i = !i && a.isArray(s) ? s.length : i, d ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !c) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] = Dn(s[i])), !c);
|
|
523
523
|
}
|
|
524
524
|
if (a.isFormData(e) && a.isFunction(e.entries)) {
|
|
525
525
|
const n = {};
|
|
526
526
|
return a.forEachEntry(e, (r, s) => {
|
|
527
|
-
t(
|
|
527
|
+
t(_n(r), s, n, 0);
|
|
528
528
|
}), n;
|
|
529
529
|
}
|
|
530
530
|
return null;
|
|
@@ -539,7 +539,7 @@ function In(e, t, n) {
|
|
|
539
539
|
}
|
|
540
540
|
return (n || JSON.stringify)(e);
|
|
541
541
|
}
|
|
542
|
-
const
|
|
542
|
+
const oe = {
|
|
543
543
|
transitional: Tt,
|
|
544
544
|
adapter: ["xhr", "http", "fetch"],
|
|
545
545
|
transformRequest: [function(t, n) {
|
|
@@ -568,7 +568,7 @@ const re = {
|
|
|
568
568
|
return o || s ? (n.setContentType("application/json", !1), In(t)) : t;
|
|
569
569
|
}],
|
|
570
570
|
transformResponse: [function(t) {
|
|
571
|
-
const n = this.transitional ||
|
|
571
|
+
const n = this.transitional || oe.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
|
|
572
572
|
if (a.isResponse(t) || a.isReadableStream(t))
|
|
573
573
|
return t;
|
|
574
574
|
if (t && a.isString(t) && (r && !this.responseType || s)) {
|
|
@@ -606,7 +606,7 @@ const re = {
|
|
|
606
606
|
}
|
|
607
607
|
};
|
|
608
608
|
a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
|
|
609
|
-
|
|
609
|
+
oe.headers[e] = {};
|
|
610
610
|
});
|
|
611
611
|
const Ln = a.toObjectSet([
|
|
612
612
|
"age",
|
|
@@ -633,12 +633,12 @@ const Ln = 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] && Ln[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
|
-
},
|
|
637
|
-
function
|
|
636
|
+
}, ze = Symbol("internals");
|
|
637
|
+
function ee(e) {
|
|
638
638
|
return e && String(e).trim().toLowerCase();
|
|
639
639
|
}
|
|
640
|
-
function
|
|
641
|
-
return e === !1 || e == null ? e : a.isArray(e) ? e.map(
|
|
640
|
+
function fe(e) {
|
|
641
|
+
return e === !1 || e == null ? e : a.isArray(e) ? e.map(fe) : String(e);
|
|
642
642
|
}
|
|
643
643
|
function Pn(e) {
|
|
644
644
|
const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
@@ -648,7 +648,7 @@ function Pn(e) {
|
|
|
648
648
|
return t;
|
|
649
649
|
}
|
|
650
650
|
const xn = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
651
|
-
function
|
|
651
|
+
function Ae(e, t, n, r, s) {
|
|
652
652
|
if (a.isFunction(r))
|
|
653
653
|
return r.call(this, t, n);
|
|
654
654
|
if (s && (t = n), !!a.isString(t)) {
|
|
@@ -658,10 +658,10 @@ function be(e, t, n, r, s) {
|
|
|
658
658
|
return r.test(t);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
|
-
function
|
|
661
|
+
function Bn(e) {
|
|
662
662
|
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function kn(e, t) {
|
|
665
665
|
const n = a.toCamelCase(" " + t);
|
|
666
666
|
["get", "set", "has"].forEach((r) => {
|
|
667
667
|
Object.defineProperty(e, r + n, {
|
|
@@ -672,18 +672,18 @@ function Bn(e, t) {
|
|
|
672
672
|
});
|
|
673
673
|
});
|
|
674
674
|
}
|
|
675
|
-
let
|
|
675
|
+
let D = class {
|
|
676
676
|
constructor(t) {
|
|
677
677
|
t && this.set(t);
|
|
678
678
|
}
|
|
679
679
|
set(t, n, r) {
|
|
680
680
|
const s = this;
|
|
681
681
|
function o(c, d, u) {
|
|
682
|
-
const l =
|
|
682
|
+
const l = ee(d);
|
|
683
683
|
if (!l)
|
|
684
684
|
throw new Error("header name must be a non-empty string");
|
|
685
|
-
const
|
|
686
|
-
(!
|
|
685
|
+
const h = a.findKey(s, l);
|
|
686
|
+
(!h || s[h] === void 0 || u === !0 || u === void 0 && s[h] !== !1) && (s[h || d] = fe(c));
|
|
687
687
|
}
|
|
688
688
|
const i = (c, d) => a.forEach(c, (u, l) => o(u, l, d));
|
|
689
689
|
if (a.isPlainObject(t) || t instanceof this.constructor)
|
|
@@ -703,7 +703,7 @@ let _ = class {
|
|
|
703
703
|
return this;
|
|
704
704
|
}
|
|
705
705
|
get(t, n) {
|
|
706
|
-
if (t =
|
|
706
|
+
if (t = ee(t), t) {
|
|
707
707
|
const r = a.findKey(this, t);
|
|
708
708
|
if (r) {
|
|
709
709
|
const s = this[r];
|
|
@@ -720,9 +720,9 @@ let _ = class {
|
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
has(t, n) {
|
|
723
|
-
if (t =
|
|
723
|
+
if (t = ee(t), t) {
|
|
724
724
|
const r = a.findKey(this, t);
|
|
725
|
-
return !!(r && this[r] !== void 0 && (!n ||
|
|
725
|
+
return !!(r && this[r] !== void 0 && (!n || Ae(this, this[r], r, n)));
|
|
726
726
|
}
|
|
727
727
|
return !1;
|
|
728
728
|
}
|
|
@@ -730,9 +730,9 @@ let _ = class {
|
|
|
730
730
|
const r = this;
|
|
731
731
|
let s = !1;
|
|
732
732
|
function o(i) {
|
|
733
|
-
if (i =
|
|
733
|
+
if (i = ee(i), i) {
|
|
734
734
|
const c = a.findKey(r, i);
|
|
735
|
-
c && (!n ||
|
|
735
|
+
c && (!n || Ae(r, r[c], c, n)) && (delete r[c], s = !0);
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
738
|
return a.isArray(t) ? t.forEach(o) : o(t), s;
|
|
@@ -742,7 +742,7 @@ let _ = class {
|
|
|
742
742
|
let r = n.length, s = !1;
|
|
743
743
|
for (; r--; ) {
|
|
744
744
|
const o = n[r];
|
|
745
|
-
(!t ||
|
|
745
|
+
(!t || Ae(this, this[o], o, t, !0)) && (delete this[o], s = !0);
|
|
746
746
|
}
|
|
747
747
|
return s;
|
|
748
748
|
}
|
|
@@ -751,11 +751,11 @@ let _ = class {
|
|
|
751
751
|
return a.forEach(this, (s, o) => {
|
|
752
752
|
const i = a.findKey(r, o);
|
|
753
753
|
if (i) {
|
|
754
|
-
n[i] =
|
|
754
|
+
n[i] = fe(s), delete n[o];
|
|
755
755
|
return;
|
|
756
756
|
}
|
|
757
|
-
const c = t ?
|
|
758
|
-
c !== o && delete n[o], n[c] =
|
|
757
|
+
const c = t ? Bn(o) : String(o).trim();
|
|
758
|
+
c !== o && delete n[o], n[c] = fe(s), r[c] = !0;
|
|
759
759
|
}), this;
|
|
760
760
|
}
|
|
761
761
|
concat(...t) {
|
|
@@ -788,18 +788,18 @@ let _ = 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[ze] = this[ze] = {
|
|
792
792
|
accessors: {}
|
|
793
793
|
}).accessors, s = this.prototype;
|
|
794
794
|
function o(i) {
|
|
795
|
-
const c =
|
|
796
|
-
r[c] || (
|
|
795
|
+
const c = ee(i);
|
|
796
|
+
r[c] || (kn(s, i), r[c] = !0);
|
|
797
797
|
}
|
|
798
798
|
return a.isArray(t) ? t.forEach(o) : o(t), this;
|
|
799
799
|
}
|
|
800
800
|
};
|
|
801
|
-
|
|
802
|
-
a.reduceDescriptors(
|
|
801
|
+
D.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
802
|
+
a.reduceDescriptors(D.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(_.prototype, ({ value: e }, t) => {
|
|
|
808
808
|
}
|
|
809
809
|
};
|
|
810
810
|
});
|
|
811
|
-
a.freezeMethods(
|
|
812
|
-
function
|
|
813
|
-
const n = this ||
|
|
811
|
+
a.freezeMethods(D);
|
|
812
|
+
function be(e, t) {
|
|
813
|
+
const n = this || oe, r = t || n, s = D.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);
|
|
@@ -819,10 +819,10 @@ function Ae(e, t) {
|
|
|
819
819
|
function Rt(e) {
|
|
820
820
|
return !!(e && e.__CANCEL__);
|
|
821
821
|
}
|
|
822
|
-
function
|
|
822
|
+
function Q(e, t, n) {
|
|
823
823
|
E.call(this, e ?? "canceled", E.ERR_CANCELED, t, n), this.name = "CanceledError";
|
|
824
824
|
}
|
|
825
|
-
a.inherits(
|
|
825
|
+
a.inherits(Q, E, {
|
|
826
826
|
__CANCEL__: !0
|
|
827
827
|
});
|
|
828
828
|
function yt(e, t, n) {
|
|
@@ -846,34 +846,34 @@ function jn(e, t) {
|
|
|
846
846
|
return t = t !== void 0 ? t : 1e3, function(d) {
|
|
847
847
|
const u = Date.now(), l = r[o];
|
|
848
848
|
i || (i = u), n[s] = d, r[s] = u;
|
|
849
|
-
let
|
|
850
|
-
for (;
|
|
851
|
-
S += n[
|
|
849
|
+
let h = o, S = 0;
|
|
850
|
+
for (; h !== s; )
|
|
851
|
+
S += n[h++], h = h % e;
|
|
852
852
|
if (s = (s + 1) % e, s === o && (o = (o + 1) % e), u - i < t)
|
|
853
853
|
return;
|
|
854
|
-
const
|
|
855
|
-
return
|
|
854
|
+
const b = l && u - l;
|
|
855
|
+
return b ? Math.round(S * 1e3 / b) : void 0;
|
|
856
856
|
};
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function vn(e, t) {
|
|
859
859
|
let n = 0, r = 1e3 / t, s, o;
|
|
860
860
|
const i = (u, l = Date.now()) => {
|
|
861
861
|
n = l, s = null, o && (clearTimeout(o), o = null), e(...u);
|
|
862
862
|
};
|
|
863
863
|
return [(...u) => {
|
|
864
|
-
const l = Date.now(),
|
|
865
|
-
|
|
864
|
+
const l = Date.now(), h = l - n;
|
|
865
|
+
h >= r ? i(u, l) : (s = u, o || (o = setTimeout(() => {
|
|
866
866
|
o = null, i(s);
|
|
867
|
-
}, r -
|
|
867
|
+
}, r - h)));
|
|
868
868
|
}, () => s && i(s)];
|
|
869
869
|
}
|
|
870
870
|
const he = (e, t, n = 3) => {
|
|
871
871
|
let r = 0;
|
|
872
872
|
const s = jn(50, 250);
|
|
873
|
-
return
|
|
873
|
+
return vn((o) => {
|
|
874
874
|
const i = o.loaded, c = o.lengthComputable ? o.total : void 0, d = i - r, u = s(d), l = i <= c;
|
|
875
875
|
r = i;
|
|
876
|
-
const
|
|
876
|
+
const h = {
|
|
877
877
|
loaded: i,
|
|
878
878
|
total: c,
|
|
879
879
|
progress: c ? i / c : void 0,
|
|
@@ -884,16 +884,16 @@ const he = (e, t, n = 3) => {
|
|
|
884
884
|
lengthComputable: c != null,
|
|
885
885
|
[t ? "download" : "upload"]: !0
|
|
886
886
|
};
|
|
887
|
-
e(
|
|
887
|
+
e(h);
|
|
888
888
|
}, n);
|
|
889
|
-
},
|
|
889
|
+
}, Je = (e, t) => {
|
|
890
890
|
const n = e != null;
|
|
891
891
|
return [(r) => t[0]({
|
|
892
892
|
lengthComputable: n,
|
|
893
893
|
total: e,
|
|
894
894
|
loaded: r
|
|
895
895
|
}), t[1]];
|
|
896
|
-
},
|
|
896
|
+
}, We = (e) => (...t) => a.asap(() => e(...t)), Mn = N.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, N.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
|
|
897
897
|
new URL(N.origin),
|
|
898
898
|
N.navigator && /(msie|trident)/i.test(N.navigator.userAgent)
|
|
899
899
|
) : () => !0, qn = N.hasStandardBrowserEnv ? (
|
|
@@ -931,22 +931,22 @@ function $n(e) {
|
|
|
931
931
|
function Gn(e, t) {
|
|
932
932
|
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
933
933
|
}
|
|
934
|
-
function
|
|
934
|
+
function At(e, t, n) {
|
|
935
935
|
let r = !$n(t);
|
|
936
936
|
return e && (r || n == !1) ? Gn(e, t) : t;
|
|
937
937
|
}
|
|
938
|
-
const
|
|
938
|
+
const Ve = (e) => e instanceof D ? { ...e } : e;
|
|
939
939
|
function J(e, t) {
|
|
940
940
|
t = t || {};
|
|
941
941
|
const n = {};
|
|
942
|
-
function r(u, l,
|
|
942
|
+
function r(u, l, h, S) {
|
|
943
943
|
return a.isPlainObject(u) && a.isPlainObject(l) ? a.merge.call({ caseless: S }, u, l) : a.isPlainObject(l) ? a.merge({}, l) : a.isArray(l) ? l.slice() : l;
|
|
944
944
|
}
|
|
945
|
-
function s(u, l,
|
|
945
|
+
function s(u, l, h, S) {
|
|
946
946
|
if (a.isUndefined(l)) {
|
|
947
947
|
if (!a.isUndefined(u))
|
|
948
|
-
return r(void 0, u,
|
|
949
|
-
} else return r(u, l,
|
|
948
|
+
return r(void 0, u, h, S);
|
|
949
|
+
} else return r(u, l, h, S);
|
|
950
950
|
}
|
|
951
951
|
function o(u, l) {
|
|
952
952
|
if (!a.isUndefined(l))
|
|
@@ -958,10 +958,10 @@ function J(e, t) {
|
|
|
958
958
|
return r(void 0, u);
|
|
959
959
|
} else return r(void 0, l);
|
|
960
960
|
}
|
|
961
|
-
function c(u, l,
|
|
962
|
-
if (
|
|
961
|
+
function c(u, l, h) {
|
|
962
|
+
if (h in t)
|
|
963
963
|
return r(u, l);
|
|
964
|
-
if (
|
|
964
|
+
if (h in e)
|
|
965
965
|
return r(void 0, u);
|
|
966
966
|
}
|
|
967
967
|
const d = {
|
|
@@ -993,17 +993,17 @@ function J(e, t) {
|
|
|
993
993
|
socketPath: i,
|
|
994
994
|
responseEncoding: i,
|
|
995
995
|
validateStatus: c,
|
|
996
|
-
headers: (u, l,
|
|
996
|
+
headers: (u, l, h) => s(Ve(u), Ve(l), h, !0)
|
|
997
997
|
};
|
|
998
998
|
return a.forEach(Object.keys({ ...e, ...t }), function(l) {
|
|
999
|
-
const
|
|
1000
|
-
a.isUndefined(S) &&
|
|
999
|
+
const h = d[l] || s, S = h(e[l], t[l], l);
|
|
1000
|
+
a.isUndefined(S) && h !== c || (n[l] = S);
|
|
1001
1001
|
}), n;
|
|
1002
1002
|
}
|
|
1003
|
-
const
|
|
1003
|
+
const bt = (e) => {
|
|
1004
1004
|
const t = J({}, 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 = D.from(i), t.url = St(At(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)) {
|
|
@@ -1011,73 +1011,73 @@ const At = (e) => {
|
|
|
1011
1011
|
i.setContentType(void 0);
|
|
1012
1012
|
else if (a.isFunction(n.getHeaders)) {
|
|
1013
1013
|
const d = n.getHeaders(), u = ["content-type", "content-length"];
|
|
1014
|
-
Object.entries(d).forEach(([l,
|
|
1015
|
-
u.includes(l.toLowerCase()) && i.set(l,
|
|
1014
|
+
Object.entries(d).forEach(([l, h]) => {
|
|
1015
|
+
u.includes(l.toLowerCase()) && i.set(l, h);
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
|
-
if (N.hasStandardBrowserEnv && (r && a.isFunction(r) && (r = r(t)), r || r !== !1 &&
|
|
1019
|
+
if (N.hasStandardBrowserEnv && (r && a.isFunction(r) && (r = r(t)), r || r !== !1 && Mn(t.url))) {
|
|
1020
1020
|
const d = s && o && qn.read(o);
|
|
1021
1021
|
d && i.set(s, d);
|
|
1022
1022
|
}
|
|
1023
1023
|
return t;
|
|
1024
1024
|
}, zn = typeof XMLHttpRequest < "u", Jn = zn && function(e) {
|
|
1025
1025
|
return new Promise(function(n, r) {
|
|
1026
|
-
const s =
|
|
1026
|
+
const s = bt(e);
|
|
1027
1027
|
let o = s.data;
|
|
1028
|
-
const i =
|
|
1029
|
-
let { responseType: c, onUploadProgress: d, onDownloadProgress: u } = s, l,
|
|
1028
|
+
const i = D.from(s.headers).normalize();
|
|
1029
|
+
let { responseType: c, onUploadProgress: d, onDownloadProgress: u } = s, l, h, S, b, f;
|
|
1030
1030
|
function m() {
|
|
1031
|
-
|
|
1031
|
+
b && b(), f && f(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
|
|
1032
1032
|
}
|
|
1033
|
-
let
|
|
1034
|
-
|
|
1033
|
+
let p = new XMLHttpRequest();
|
|
1034
|
+
p.open(s.method.toUpperCase(), s.url, !0), p.timeout = s.timeout;
|
|
1035
1035
|
function w() {
|
|
1036
|
-
if (!
|
|
1036
|
+
if (!p)
|
|
1037
1037
|
return;
|
|
1038
|
-
const R =
|
|
1039
|
-
"getAllResponseHeaders" in
|
|
1038
|
+
const R = D.from(
|
|
1039
|
+
"getAllResponseHeaders" in p && p.getAllResponseHeaders()
|
|
1040
1040
|
), F = {
|
|
1041
|
-
data: !c || c === "text" || c === "json" ?
|
|
1042
|
-
status:
|
|
1043
|
-
statusText:
|
|
1041
|
+
data: !c || c === "text" || c === "json" ? p.responseText : p.response,
|
|
1042
|
+
status: p.status,
|
|
1043
|
+
statusText: p.statusText,
|
|
1044
1044
|
headers: R,
|
|
1045
1045
|
config: e,
|
|
1046
|
-
request:
|
|
1046
|
+
request: p
|
|
1047
1047
|
};
|
|
1048
1048
|
yt(function(L) {
|
|
1049
1049
|
n(L), m();
|
|
1050
1050
|
}, function(L) {
|
|
1051
1051
|
r(L), m();
|
|
1052
|
-
}, F),
|
|
1052
|
+
}, F), p = null;
|
|
1053
1053
|
}
|
|
1054
|
-
"onloadend" in
|
|
1055
|
-
!
|
|
1056
|
-
},
|
|
1057
|
-
|
|
1058
|
-
},
|
|
1059
|
-
const F = g && g.message ? g.message : "Network Error", q = new E(F, E.ERR_NETWORK, e,
|
|
1060
|
-
q.event = g || null, r(q),
|
|
1061
|
-
},
|
|
1054
|
+
"onloadend" in p ? p.onloadend = w : p.onreadystatechange = function() {
|
|
1055
|
+
!p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(w);
|
|
1056
|
+
}, p.onabort = function() {
|
|
1057
|
+
p && (r(new E("Request aborted", E.ECONNABORTED, e, p)), p = null);
|
|
1058
|
+
}, p.onerror = function(g) {
|
|
1059
|
+
const F = g && g.message ? g.message : "Network Error", q = new E(F, E.ERR_NETWORK, e, p);
|
|
1060
|
+
q.event = g || null, r(q), p = null;
|
|
1061
|
+
}, p.ontimeout = function() {
|
|
1062
1062
|
let g = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
|
|
1063
1063
|
const F = s.transitional || Tt;
|
|
1064
1064
|
s.timeoutErrorMessage && (g = s.timeoutErrorMessage), r(new E(
|
|
1065
1065
|
g,
|
|
1066
1066
|
F.clarifyTimeoutError ? E.ETIMEDOUT : E.ECONNABORTED,
|
|
1067
1067
|
e,
|
|
1068
|
-
|
|
1069
|
-
)),
|
|
1070
|
-
}, o === void 0 && i.setContentType(null), "setRequestHeader" in
|
|
1071
|
-
|
|
1072
|
-
}), a.isUndefined(s.withCredentials) || (
|
|
1073
|
-
|
|
1068
|
+
p
|
|
1069
|
+
)), p = null;
|
|
1070
|
+
}, o === void 0 && i.setContentType(null), "setRequestHeader" in p && a.forEach(i.toJSON(), function(g, F) {
|
|
1071
|
+
p.setRequestHeader(F, g);
|
|
1072
|
+
}), a.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), c && c !== "json" && (p.responseType = s.responseType), u && ([S, f] = he(u, !0), p.addEventListener("progress", S)), d && p.upload && ([h, b] = he(d), p.upload.addEventListener("progress", h), p.upload.addEventListener("loadend", b)), (s.cancelToken || s.signal) && (l = (R) => {
|
|
1073
|
+
p && (r(!R || R.type ? new Q(null, e, p) : R), p.abort(), p = null);
|
|
1074
1074
|
}, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
|
|
1075
1075
|
const I = Hn(s.url);
|
|
1076
1076
|
if (I && N.protocols.indexOf(I) === -1) {
|
|
1077
1077
|
r(new E("Unsupported protocol " + I + ":", E.ERR_BAD_REQUEST, e));
|
|
1078
1078
|
return;
|
|
1079
1079
|
}
|
|
1080
|
-
|
|
1080
|
+
p.send(o || null);
|
|
1081
1081
|
});
|
|
1082
1082
|
}, Wn = (e, t) => {
|
|
1083
1083
|
const { length: n } = e = e ? e.filter(Boolean) : [];
|
|
@@ -1087,7 +1087,7 @@ const At = (e) => {
|
|
|
1087
1087
|
if (!s) {
|
|
1088
1088
|
s = !0, c();
|
|
1089
1089
|
const l = u instanceof Error ? u : this.reason;
|
|
1090
|
-
r.abort(l instanceof E ? l : new
|
|
1090
|
+
r.abort(l instanceof E ? l : new Q(l instanceof Error ? l.message : l));
|
|
1091
1091
|
}
|
|
1092
1092
|
};
|
|
1093
1093
|
let i = t && setTimeout(() => {
|
|
@@ -1130,7 +1130,7 @@ const At = (e) => {
|
|
|
1130
1130
|
} finally {
|
|
1131
1131
|
await t.cancel();
|
|
1132
1132
|
}
|
|
1133
|
-
},
|
|
1133
|
+
}, Ke = (e, t, n, r) => {
|
|
1134
1134
|
const s = Kn(e, t);
|
|
1135
1135
|
let o = 0, i, c = (d) => {
|
|
1136
1136
|
i || (i = !0, r && r(d));
|
|
@@ -1143,9 +1143,9 @@ const At = (e) => {
|
|
|
1143
1143
|
c(), d.close();
|
|
1144
1144
|
return;
|
|
1145
1145
|
}
|
|
1146
|
-
let
|
|
1146
|
+
let h = l.byteLength;
|
|
1147
1147
|
if (n) {
|
|
1148
|
-
let S = o +=
|
|
1148
|
+
let S = o += h;
|
|
1149
1149
|
n(S);
|
|
1150
1150
|
}
|
|
1151
1151
|
d.enqueue(new Uint8Array(l));
|
|
@@ -1159,13 +1159,13 @@ const At = (e) => {
|
|
|
1159
1159
|
}, {
|
|
1160
1160
|
highWaterMark: 2
|
|
1161
1161
|
});
|
|
1162
|
-
},
|
|
1162
|
+
}, Xe = 64 * 1024, { isFunction: le } = a, Yn = (({ Request: e, Response: t }) => ({
|
|
1163
1163
|
Request: e,
|
|
1164
1164
|
Response: t
|
|
1165
1165
|
}))(a.global), {
|
|
1166
|
-
ReadableStream:
|
|
1167
|
-
TextEncoder:
|
|
1168
|
-
} = a.global,
|
|
1166
|
+
ReadableStream: Ye,
|
|
1167
|
+
TextEncoder: Qe
|
|
1168
|
+
} = a.global, Ze = (e, ...t) => {
|
|
1169
1169
|
try {
|
|
1170
1170
|
return !!e(...t);
|
|
1171
1171
|
} catch {
|
|
@@ -1175,28 +1175,28 @@ const At = (e) => {
|
|
|
1175
1175
|
e = a.merge.call({
|
|
1176
1176
|
skipUndefined: !0
|
|
1177
1177
|
}, Yn, e);
|
|
1178
|
-
const { fetch: t, Request: n, Response: r } = e, s = t ?
|
|
1178
|
+
const { fetch: t, Request: n, Response: r } = e, s = t ? le(t) : typeof fetch == "function", o = le(n), i = le(r);
|
|
1179
1179
|
if (!s)
|
|
1180
1180
|
return !1;
|
|
1181
|
-
const c = s &&
|
|
1181
|
+
const c = s && le(Ye), d = s && (typeof Qe == "function" ? /* @__PURE__ */ ((f) => (m) => f.encode(m))(new Qe()) : async (f) => new Uint8Array(await new n(f).arrayBuffer())), u = o && c && Ze(() => {
|
|
1182
1182
|
let f = !1;
|
|
1183
1183
|
const m = new n(N.origin, {
|
|
1184
|
-
body: new
|
|
1184
|
+
body: new Ye(),
|
|
1185
1185
|
method: "POST",
|
|
1186
1186
|
get duplex() {
|
|
1187
1187
|
return f = !0, "half";
|
|
1188
1188
|
}
|
|
1189
1189
|
}).headers.has("Content-Type");
|
|
1190
1190
|
return f && !m;
|
|
1191
|
-
}), l = i && c &&
|
|
1191
|
+
}), l = i && c && Ze(() => a.isReadableStream(new r("").body)), h = {
|
|
1192
1192
|
stream: l && ((f) => f.body)
|
|
1193
1193
|
};
|
|
1194
1194
|
s && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((f) => {
|
|
1195
|
-
!
|
|
1195
|
+
!h[f] && (h[f] = (m, p) => {
|
|
1196
1196
|
let w = m && m[f];
|
|
1197
1197
|
if (w)
|
|
1198
1198
|
return w.call(m);
|
|
1199
|
-
throw new E(`Response type '${f}' is not supported`, E.ERR_NOT_SUPPORT,
|
|
1199
|
+
throw new E(`Response type '${f}' is not supported`, E.ERR_NOT_SUPPORT, p);
|
|
1200
1200
|
});
|
|
1201
1201
|
});
|
|
1202
1202
|
const S = async (f) => {
|
|
@@ -1213,14 +1213,14 @@ const At = (e) => {
|
|
|
1213
1213
|
return f.byteLength;
|
|
1214
1214
|
if (a.isURLSearchParams(f) && (f = f + ""), a.isString(f))
|
|
1215
1215
|
return (await d(f)).byteLength;
|
|
1216
|
-
},
|
|
1217
|
-
const
|
|
1218
|
-
return
|
|
1216
|
+
}, b = async (f, m) => {
|
|
1217
|
+
const p = a.toFiniteNumber(f.getContentLength());
|
|
1218
|
+
return p ?? S(m);
|
|
1219
1219
|
};
|
|
1220
1220
|
return async (f) => {
|
|
1221
1221
|
let {
|
|
1222
1222
|
url: m,
|
|
1223
|
-
method:
|
|
1223
|
+
method: p,
|
|
1224
1224
|
data: w,
|
|
1225
1225
|
signal: I,
|
|
1226
1226
|
cancelToken: R,
|
|
@@ -1229,78 +1229,78 @@ const At = (e) => {
|
|
|
1229
1229
|
onUploadProgress: q,
|
|
1230
1230
|
responseType: L,
|
|
1231
1231
|
headers: Re,
|
|
1232
|
-
withCredentials:
|
|
1233
|
-
fetchOptions:
|
|
1234
|
-
} =
|
|
1232
|
+
withCredentials: ie = "same-origin",
|
|
1233
|
+
fetchOptions: xe
|
|
1234
|
+
} = bt(f), Be = t || fetch;
|
|
1235
1235
|
L = L ? (L + "").toLowerCase() : "text";
|
|
1236
|
-
let
|
|
1237
|
-
const $ =
|
|
1238
|
-
|
|
1236
|
+
let ae = Wn([I, R && R.toAbortSignal()], g), Z = null;
|
|
1237
|
+
const $ = ae && ae.unsubscribe && (() => {
|
|
1238
|
+
ae.unsubscribe();
|
|
1239
1239
|
});
|
|
1240
|
-
let
|
|
1240
|
+
let ke;
|
|
1241
1241
|
try {
|
|
1242
|
-
if (q && u &&
|
|
1242
|
+
if (q && u && p !== "get" && p !== "head" && (ke = await b(Re, w)) !== 0) {
|
|
1243
1243
|
let j = new n(m, {
|
|
1244
1244
|
method: "POST",
|
|
1245
1245
|
body: w,
|
|
1246
1246
|
duplex: "half"
|
|
1247
1247
|
}), V;
|
|
1248
1248
|
if (a.isFormData(w) && (V = j.headers.get("content-type")) && Re.setContentType(V), j.body) {
|
|
1249
|
-
const [ye,
|
|
1250
|
-
|
|
1251
|
-
he(
|
|
1249
|
+
const [ye, ce] = Je(
|
|
1250
|
+
ke,
|
|
1251
|
+
he(We(q))
|
|
1252
1252
|
);
|
|
1253
|
-
w =
|
|
1253
|
+
w = Ke(j.body, Xe, ye, ce);
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
|
-
a.isString(
|
|
1257
|
-
const x = o && "credentials" in n.prototype,
|
|
1258
|
-
...
|
|
1259
|
-
signal:
|
|
1260
|
-
method:
|
|
1256
|
+
a.isString(ie) || (ie = ie ? "include" : "omit");
|
|
1257
|
+
const x = o && "credentials" in n.prototype, He = {
|
|
1258
|
+
...xe,
|
|
1259
|
+
signal: ae,
|
|
1260
|
+
method: p.toUpperCase(),
|
|
1261
1261
|
headers: Re.normalize().toJSON(),
|
|
1262
1262
|
body: w,
|
|
1263
1263
|
duplex: "half",
|
|
1264
|
-
credentials: x ?
|
|
1264
|
+
credentials: x ? ie : void 0
|
|
1265
1265
|
};
|
|
1266
|
-
|
|
1267
|
-
let H = await (o ? Be(
|
|
1268
|
-
const
|
|
1269
|
-
if (l && (F ||
|
|
1266
|
+
Z = o && new n(m, He);
|
|
1267
|
+
let H = await (o ? Be(Z, xe) : Be(m, He));
|
|
1268
|
+
const je = l && (L === "stream" || L === "response");
|
|
1269
|
+
if (l && (F || je && $)) {
|
|
1270
1270
|
const j = {};
|
|
1271
1271
|
["status", "statusText", "headers"].forEach((ve) => {
|
|
1272
1272
|
j[ve] = H[ve];
|
|
1273
1273
|
});
|
|
1274
|
-
const V = a.toFiniteNumber(H.headers.get("content-length")), [ye,
|
|
1274
|
+
const V = a.toFiniteNumber(H.headers.get("content-length")), [ye, ce] = F && Je(
|
|
1275
1275
|
V,
|
|
1276
|
-
he(
|
|
1276
|
+
he(We(F), !0)
|
|
1277
1277
|
) || [];
|
|
1278
1278
|
H = new r(
|
|
1279
|
-
|
|
1280
|
-
|
|
1279
|
+
Ke(H.body, Xe, ye, () => {
|
|
1280
|
+
ce && ce(), $ && $();
|
|
1281
1281
|
}),
|
|
1282
1282
|
j
|
|
1283
1283
|
);
|
|
1284
1284
|
}
|
|
1285
1285
|
L = L || "text";
|
|
1286
|
-
let
|
|
1287
|
-
return !
|
|
1286
|
+
let _t = await h[a.findKey(h, L) || "text"](H, f);
|
|
1287
|
+
return !je && $ && $(), await new Promise((j, V) => {
|
|
1288
1288
|
yt(j, V, {
|
|
1289
|
-
data:
|
|
1290
|
-
headers:
|
|
1289
|
+
data: _t,
|
|
1290
|
+
headers: D.from(H.headers),
|
|
1291
1291
|
status: H.status,
|
|
1292
1292
|
statusText: H.statusText,
|
|
1293
1293
|
config: f,
|
|
1294
|
-
request:
|
|
1294
|
+
request: Z
|
|
1295
1295
|
});
|
|
1296
1296
|
});
|
|
1297
1297
|
} catch (x) {
|
|
1298
1298
|
throw $ && $(), x && x.name === "TypeError" && /Load failed|fetch/i.test(x.message) ? Object.assign(
|
|
1299
|
-
new E("Network Error", E.ERR_NETWORK, f,
|
|
1299
|
+
new E("Network Error", E.ERR_NETWORK, f, Z),
|
|
1300
1300
|
{
|
|
1301
1301
|
cause: x.cause || x
|
|
1302
1302
|
}
|
|
1303
|
-
) : E.from(x, x && x.code, f,
|
|
1303
|
+
) : E.from(x, x && x.code, f, Z);
|
|
1304
1304
|
}
|
|
1305
1305
|
};
|
|
1306
1306
|
}, Zn = /* @__PURE__ */ new Map(), Nt = (e) => {
|
|
@@ -1316,14 +1316,14 @@ const At = (e) => {
|
|
|
1316
1316
|
return u;
|
|
1317
1317
|
};
|
|
1318
1318
|
Nt();
|
|
1319
|
-
const
|
|
1319
|
+
const Fe = {
|
|
1320
1320
|
http: En,
|
|
1321
1321
|
xhr: Jn,
|
|
1322
1322
|
fetch: {
|
|
1323
1323
|
get: Nt
|
|
1324
1324
|
}
|
|
1325
1325
|
};
|
|
1326
|
-
a.forEach(
|
|
1326
|
+
a.forEach(Fe, (e, t) => {
|
|
1327
1327
|
if (e) {
|
|
1328
1328
|
try {
|
|
1329
1329
|
Object.defineProperty(e, "name", { value: t });
|
|
@@ -1332,7 +1332,7 @@ a.forEach(Pe, (e, t) => {
|
|
|
1332
1332
|
Object.defineProperty(e, "adapterName", { value: t });
|
|
1333
1333
|
}
|
|
1334
1334
|
});
|
|
1335
|
-
const
|
|
1335
|
+
const et = (e) => `- ${e}`, er = (e) => a.isFunction(e) || e === null || e === !1;
|
|
1336
1336
|
function tr(e, t) {
|
|
1337
1337
|
e = a.isArray(e) ? e : [e];
|
|
1338
1338
|
const { length: n } = e;
|
|
@@ -1341,7 +1341,7 @@ function tr(e, t) {
|
|
|
1341
1341
|
for (let i = 0; i < n; i++) {
|
|
1342
1342
|
r = e[i];
|
|
1343
1343
|
let c;
|
|
1344
|
-
if (s = r, !er(r) && (s =
|
|
1344
|
+
if (s = r, !er(r) && (s = Fe[(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 tr(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(et).join(`
|
|
1356
|
+
`) : " " + et(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"
|
|
@@ -1371,28 +1371,28 @@ const Ot = {
|
|
|
1371
1371
|
* Exposes all known adapters
|
|
1372
1372
|
* @type {Object<string, Function|Object>}
|
|
1373
1373
|
*/
|
|
1374
|
-
adapters:
|
|
1374
|
+
adapters: Fe
|
|
1375
1375
|
};
|
|
1376
1376
|
function Ne(e) {
|
|
1377
1377
|
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1378
|
-
throw new
|
|
1378
|
+
throw new Q(null, e);
|
|
1379
1379
|
}
|
|
1380
|
-
function
|
|
1381
|
-
return Ne(e), e.headers =
|
|
1380
|
+
function tt(e) {
|
|
1381
|
+
return Ne(e), e.headers = D.from(e.headers), e.data = be.call(
|
|
1382
1382
|
e,
|
|
1383
1383
|
e.transformRequest
|
|
1384
|
-
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Ot.getAdapter(e.adapter ||
|
|
1385
|
-
return Ne(e), r.data =
|
|
1384
|
+
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Ot.getAdapter(e.adapter || oe.adapter, e)(e).then(function(r) {
|
|
1385
|
+
return Ne(e), r.data = be.call(
|
|
1386
1386
|
e,
|
|
1387
1387
|
e.transformResponse,
|
|
1388
1388
|
r
|
|
1389
|
-
), r.headers =
|
|
1389
|
+
), r.headers = D.from(r.headers), r;
|
|
1390
1390
|
}, function(r) {
|
|
1391
|
-
return Rt(r) || (Ne(e), r && r.response && (r.response.data =
|
|
1391
|
+
return Rt(r) || (Ne(e), r && r.response && (r.response.data = be.call(
|
|
1392
1392
|
e,
|
|
1393
1393
|
e.transformResponse,
|
|
1394
1394
|
r.response
|
|
1395
|
-
), r.response.headers =
|
|
1395
|
+
), r.response.headers = D.from(r.response.headers))), Promise.reject(r);
|
|
1396
1396
|
});
|
|
1397
1397
|
}
|
|
1398
1398
|
const Ct = "1.13.2", we = {};
|
|
@@ -1401,7 +1401,7 @@ const Ct = "1.13.2", we = {};
|
|
|
1401
1401
|
return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
|
|
1402
1402
|
};
|
|
1403
1403
|
});
|
|
1404
|
-
const
|
|
1404
|
+
const nt = {};
|
|
1405
1405
|
we.transitional = function(t, n, r) {
|
|
1406
1406
|
function s(o, i) {
|
|
1407
1407
|
return "[Axios v" + Ct + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
|
|
@@ -1412,7 +1412,7 @@ we.transitional = function(t, n, r) {
|
|
|
1412
1412
|
s(i, " has been removed" + (n ? " in " + n : "")),
|
|
1413
1413
|
E.ERR_DEPRECATED
|
|
1414
1414
|
);
|
|
1415
|
-
return n && !
|
|
1415
|
+
return n && !nt[i] && (nt[i] = !0, console.warn(
|
|
1416
1416
|
s(
|
|
1417
1417
|
i,
|
|
1418
1418
|
" has been deprecated since v" + n + " and will be removed in the near future"
|
|
@@ -1440,15 +1440,15 @@ function nr(e, t, n) {
|
|
|
1440
1440
|
throw new E("Unknown option " + o, E.ERR_BAD_OPTION);
|
|
1441
1441
|
}
|
|
1442
1442
|
}
|
|
1443
|
-
const
|
|
1443
|
+
const de = {
|
|
1444
1444
|
assertOptions: nr,
|
|
1445
1445
|
validators: we
|
|
1446
|
-
},
|
|
1446
|
+
}, B = de.validators;
|
|
1447
1447
|
let z = class {
|
|
1448
1448
|
constructor(t) {
|
|
1449
1449
|
this.defaults = t || {}, this.interceptors = {
|
|
1450
|
-
request: new
|
|
1451
|
-
response: new
|
|
1450
|
+
request: new Ge(),
|
|
1451
|
+
response: new Ge()
|
|
1452
1452
|
};
|
|
1453
1453
|
}
|
|
1454
1454
|
/**
|
|
@@ -1479,18 +1479,18 @@ let z = class {
|
|
|
1479
1479
|
_request(t, n) {
|
|
1480
1480
|
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = J(this.defaults, n);
|
|
1481
1481
|
const { transitional: r, paramsSerializer: s, headers: o } = n;
|
|
1482
|
-
r !== void 0 &&
|
|
1483
|
-
silentJSONParsing:
|
|
1484
|
-
forcedJSONParsing:
|
|
1485
|
-
clarifyTimeoutError:
|
|
1482
|
+
r !== void 0 && de.assertOptions(r, {
|
|
1483
|
+
silentJSONParsing: B.transitional(B.boolean),
|
|
1484
|
+
forcedJSONParsing: B.transitional(B.boolean),
|
|
1485
|
+
clarifyTimeoutError: B.transitional(B.boolean)
|
|
1486
1486
|
}, !1), s != null && (a.isFunction(s) ? n.paramsSerializer = {
|
|
1487
1487
|
serialize: s
|
|
1488
|
-
} :
|
|
1489
|
-
encode:
|
|
1490
|
-
serialize:
|
|
1491
|
-
}, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0),
|
|
1492
|
-
baseUrl:
|
|
1493
|
-
withXsrfToken:
|
|
1488
|
+
} : de.assertOptions(s, {
|
|
1489
|
+
encode: B.function,
|
|
1490
|
+
serialize: B.function
|
|
1491
|
+
}, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), de.assertOptions(n, {
|
|
1492
|
+
baseUrl: B.spelling("baseURL"),
|
|
1493
|
+
withXsrfToken: B.spelling("withXSRFToken")
|
|
1494
1494
|
}, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
|
|
1495
1495
|
let i = o && a.merge(
|
|
1496
1496
|
o.common,
|
|
@@ -1501,7 +1501,7 @@ let z = class {
|
|
|
1501
1501
|
(f) => {
|
|
1502
1502
|
delete o[f];
|
|
1503
1503
|
}
|
|
1504
|
-
), n.headers =
|
|
1504
|
+
), n.headers = D.concat(i, o);
|
|
1505
1505
|
const c = [];
|
|
1506
1506
|
let d = !0;
|
|
1507
1507
|
this.interceptors.request.forEach(function(m) {
|
|
@@ -1511,36 +1511,36 @@ let z = class {
|
|
|
1511
1511
|
this.interceptors.response.forEach(function(m) {
|
|
1512
1512
|
u.push(m.fulfilled, m.rejected);
|
|
1513
1513
|
});
|
|
1514
|
-
let l,
|
|
1514
|
+
let l, h = 0, S;
|
|
1515
1515
|
if (!d) {
|
|
1516
|
-
const f = [
|
|
1517
|
-
for (f.unshift(...c), f.push(...u), S = f.length, l = Promise.resolve(n);
|
|
1518
|
-
l = l.then(f[
|
|
1516
|
+
const f = [tt.bind(this), void 0];
|
|
1517
|
+
for (f.unshift(...c), f.push(...u), S = f.length, l = Promise.resolve(n); h < S; )
|
|
1518
|
+
l = l.then(f[h++], f[h++]);
|
|
1519
1519
|
return l;
|
|
1520
1520
|
}
|
|
1521
1521
|
S = c.length;
|
|
1522
|
-
let
|
|
1523
|
-
for (;
|
|
1524
|
-
const f = c[
|
|
1522
|
+
let b = n;
|
|
1523
|
+
for (; h < S; ) {
|
|
1524
|
+
const f = c[h++], m = c[h++];
|
|
1525
1525
|
try {
|
|
1526
|
-
|
|
1527
|
-
} catch (
|
|
1528
|
-
m.call(this,
|
|
1526
|
+
b = f(b);
|
|
1527
|
+
} catch (p) {
|
|
1528
|
+
m.call(this, p);
|
|
1529
1529
|
break;
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
1532
|
try {
|
|
1533
|
-
l =
|
|
1533
|
+
l = tt.call(this, b);
|
|
1534
1534
|
} catch (f) {
|
|
1535
1535
|
return Promise.reject(f);
|
|
1536
1536
|
}
|
|
1537
|
-
for (
|
|
1538
|
-
l = l.then(u[
|
|
1537
|
+
for (h = 0, S = u.length; h < S; )
|
|
1538
|
+
l = l.then(u[h++], u[h++]);
|
|
1539
1539
|
return l;
|
|
1540
1540
|
}
|
|
1541
1541
|
getUri(t) {
|
|
1542
1542
|
t = J(this.defaults, t);
|
|
1543
|
-
const n =
|
|
1543
|
+
const n = At(t.baseURL, t.url, t.allowAbsoluteUrls);
|
|
1544
1544
|
return St(n, t.params, t.paramsSerializer);
|
|
1545
1545
|
}
|
|
1546
1546
|
};
|
|
@@ -1592,7 +1592,7 @@ let rr = class gt {
|
|
|
1592
1592
|
r.unsubscribe(o);
|
|
1593
1593
|
}, i;
|
|
1594
1594
|
}, t(function(o, i, c) {
|
|
1595
|
-
r.reason || (r.reason = new
|
|
1595
|
+
r.reason || (r.reason = new Q(o, i, c), n(r.reason));
|
|
1596
1596
|
});
|
|
1597
1597
|
}
|
|
1598
1598
|
/**
|
|
@@ -1729,9 +1729,9 @@ function Ut(e) {
|
|
|
1729
1729
|
return Ut(J(e, s));
|
|
1730
1730
|
}, n;
|
|
1731
1731
|
}
|
|
1732
|
-
const T = Ut(
|
|
1732
|
+
const T = Ut(oe);
|
|
1733
1733
|
T.Axios = z;
|
|
1734
|
-
T.CanceledError =
|
|
1734
|
+
T.CanceledError = Q;
|
|
1735
1735
|
T.CancelToken = rr;
|
|
1736
1736
|
T.isCancel = Rt;
|
|
1737
1737
|
T.VERSION = Ct;
|
|
@@ -1744,7 +1744,7 @@ T.all = function(t) {
|
|
|
1744
1744
|
T.spread = sr;
|
|
1745
1745
|
T.isAxiosError = or;
|
|
1746
1746
|
T.mergeConfig = J;
|
|
1747
|
-
T.AxiosHeaders =
|
|
1747
|
+
T.AxiosHeaders = D;
|
|
1748
1748
|
T.formToJSON = (e) => wt(a.isHTMLForm(e) ? new FormData(e) : e);
|
|
1749
1749
|
T.getAdapter = Ot.getAdapter;
|
|
1750
1750
|
T.HttpStatusCode = Ue;
|
|
@@ -1753,22 +1753,20 @@ const {
|
|
|
1753
1753
|
Axios: Cr,
|
|
1754
1754
|
AxiosError: gr,
|
|
1755
1755
|
CanceledError: Ur,
|
|
1756
|
-
isCancel:
|
|
1757
|
-
CancelToken:
|
|
1756
|
+
isCancel: _r,
|
|
1757
|
+
CancelToken: Dr,
|
|
1758
1758
|
VERSION: Ir,
|
|
1759
1759
|
all: Lr,
|
|
1760
1760
|
Cancel: Fr,
|
|
1761
1761
|
isAxiosError: Pr,
|
|
1762
1762
|
spread: xr,
|
|
1763
|
-
toFormData:
|
|
1764
|
-
AxiosHeaders:
|
|
1763
|
+
toFormData: Br,
|
|
1764
|
+
AxiosHeaders: kr,
|
|
1765
1765
|
HttpStatusCode: Hr,
|
|
1766
1766
|
formToJSON: jr,
|
|
1767
|
-
getAdapter:
|
|
1768
|
-
mergeConfig:
|
|
1769
|
-
} = T,
|
|
1770
|
-
var B = /* @__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))(B || {}), M = /* @__PURE__ */ ((e) => (e.TEXT = "1", e.IMAGE = "2", e.VIDEO = "3", e.FILE = "4", e.FAQ = "5", e))(M || {}), U = /* @__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[e.REPLY_FAIL = 50008] = "REPLY_FAIL", e[e.REPLY_SUCCESS = 209] = "REPLY_SUCCESS", e[e.UNBIND_SUCCESS = 60006] = "UNBIND_SUCCESS", e[e.REMATCH = 60001] = "REMATCH", e))(U || {}), _e = /* @__PURE__ */ ((e) => (e.CUSTOMER = "1", e.USER = "2", e.ANONYMOUS = "3", e))(_e || {}), y = /* @__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))(y || {}), O = /* @__PURE__ */ ((e) => (e.DISCONNECTED = "disconnected", e.CONNECTING = "connecting", e.CONNECTED = "connected", e.RECONNECTING = "reconnecting", e.ERROR = "error", e))(O || {}), C = /* @__PURE__ */ ((e) => (e.UNMATCHED = "1", e.MATCHING = "2", e.MATCHED = "3", e.UNBIND = "4", e))(C || {});
|
|
1771
|
-
const b = {
|
|
1767
|
+
getAdapter: vr,
|
|
1768
|
+
mergeConfig: Mr
|
|
1769
|
+
} = T, y = {
|
|
1772
1770
|
/** 未初始化 */
|
|
1773
1771
|
UNINITIALIZED: {
|
|
1774
1772
|
code: 10001,
|
|
@@ -1824,12 +1822,25 @@ const b = {
|
|
|
1824
1822
|
code: 10011,
|
|
1825
1823
|
msg: "数据为空"
|
|
1826
1824
|
}
|
|
1827
|
-
}, ir = "/api/customer-service/customer/v1/CustomerService/TestLineLatency", ar = "/api/customer-service/customer/v1/CustomerService/ListLines", cr = "/pub/logo.png",
|
|
1825
|
+
}, ir = "/api/customer-service/customer/v1/CustomerService/TestLineLatency", ar = "/api/customer-service/customer/v1/CustomerService/ListLines", cr = "/pub/logo.png", rt = {
|
|
1826
|
+
development: {
|
|
1827
|
+
BASE_API_URL: "http://dev-joytalk-api.halaladmin.vip",
|
|
1828
|
+
OBS_URL: "http://dev-joytalk-img.halaladmin.vip"
|
|
1829
|
+
},
|
|
1830
|
+
prodtest: {
|
|
1831
|
+
BASE_API_URL: "https://fat-joytalk-api.halaladmin.vip",
|
|
1832
|
+
OBS_URL: "https://fat-joytalk-img.halaladmin.vip"
|
|
1833
|
+
},
|
|
1834
|
+
production: {
|
|
1835
|
+
BASE_API_URL: "https://fat-joytalk-api.halaladmin.vip",
|
|
1836
|
+
OBS_URL: "https://fat-joytalk-img.halaladmin.vip"
|
|
1837
|
+
}
|
|
1838
|
+
}, v = {
|
|
1828
1839
|
api: "",
|
|
1829
1840
|
download: "",
|
|
1830
1841
|
ws: ""
|
|
1831
1842
|
};
|
|
1832
|
-
let
|
|
1843
|
+
let K = null;
|
|
1833
1844
|
function lr(e) {
|
|
1834
1845
|
const t = `${e.replace(/\/$/, "")}${ir}`;
|
|
1835
1846
|
return T.get(t, {
|
|
@@ -1848,33 +1859,33 @@ function fr(e) {
|
|
|
1848
1859
|
function dr(e) {
|
|
1849
1860
|
return e?.length ? Promise.any(e.map((t) => ur(t))) : Promise.reject(new Error("No download urls to test"));
|
|
1850
1861
|
}
|
|
1851
|
-
async function
|
|
1862
|
+
async function Pe(e, t) {
|
|
1852
1863
|
if (v.api && v.download) return;
|
|
1853
|
-
if (
|
|
1854
|
-
const
|
|
1855
|
-
|
|
1856
|
-
const
|
|
1864
|
+
if (K) return K;
|
|
1865
|
+
const n = rt[t].BASE_API_URL || "", r = rt[t].OBS_URL || "";
|
|
1866
|
+
n || (K = Promise.reject(new Error("环境配置错误")), await K), K = (async () => {
|
|
1867
|
+
const s = await T.get(`${n.replace(/\/$/, "")}${ar}`, {
|
|
1857
1868
|
headers: { Authorization: `Bearer ${e}` },
|
|
1858
1869
|
timeout: 15e3
|
|
1859
1870
|
});
|
|
1860
|
-
if (
|
|
1871
|
+
if (s.data?.code !== 200 || !s.data?.data)
|
|
1861
1872
|
throw new Error(
|
|
1862
|
-
|
|
1873
|
+
s.data?.message || "ListLines failed or empty data"
|
|
1863
1874
|
);
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1866
|
-
|
|
1875
|
+
const o = (s.data.data.api ?? []).map((h) => h.url).filter(Boolean), i = (s.data.data.download ?? []).map((h) => h.url).filter(Boolean), c = n, d = r, [u, l] = await Promise.all([
|
|
1876
|
+
o.length ? fr(o).catch(() => c) : Promise.resolve(c),
|
|
1877
|
+
i.length ? dr(i).catch(() => c) : Promise.resolve(d)
|
|
1867
1878
|
]);
|
|
1868
|
-
v.api =
|
|
1869
|
-
})(), await
|
|
1879
|
+
v.api = u, v.download = l, v.ws = u.replace(/http/g, "ws");
|
|
1880
|
+
})(), await K;
|
|
1870
1881
|
}
|
|
1871
1882
|
const W = T.create({
|
|
1872
1883
|
timeout: 6e5
|
|
1873
1884
|
});
|
|
1874
1885
|
W.interceptors.request.use(
|
|
1875
1886
|
async (e) => {
|
|
1876
|
-
const t =
|
|
1877
|
-
return
|
|
1887
|
+
const t = new te(), n = t.config.token;
|
|
1888
|
+
return n ? (e.headers.Authorization = `Bearer ${n}`, await Pe(n, t.config.env), e.baseURL = v.api, e) : Promise.reject(y.UNINITIALIZED);
|
|
1878
1889
|
},
|
|
1879
1890
|
(e) => Promise.reject(e)
|
|
1880
1891
|
);
|
|
@@ -1912,6 +1923,7 @@ const pr = (e) => W.post(
|
|
|
1912
1923
|
"/api/open-auth/user/v1/UserService/GetUserHistoryMessages",
|
|
1913
1924
|
e
|
|
1914
1925
|
);
|
|
1926
|
+
var k = /* @__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))(k || {}), M = /* @__PURE__ */ ((e) => (e.TEXT = "1", e.IMAGE = "2", e.VIDEO = "3", e.FILE = "4", e.FAQ = "5", e))(M || {}), U = /* @__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[e.REPLY_FAIL = 50008] = "REPLY_FAIL", e[e.REPLY_SUCCESS = 209] = "REPLY_SUCCESS", e[e.UNBIND_SUCCESS = 60006] = "UNBIND_SUCCESS", e[e.REMATCH = 60001] = "REMATCH", e))(U || {}), _e = /* @__PURE__ */ ((e) => (e.CUSTOMER = "1", e.USER = "2", e.ANONYMOUS = "3", e))(_e || {}), 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 || {}), O = /* @__PURE__ */ ((e) => (e.DISCONNECTED = "disconnected", e.CONNECTING = "connecting", e.CONNECTED = "connected", e.RECONNECTING = "reconnecting", e.ERROR = "error", e))(O || {}), C = /* @__PURE__ */ ((e) => (e.UNMATCHED = "1", e.MATCHING = "2", e.MATCHED = "3", e.UNBIND = "4", e))(C || {});
|
|
1915
1927
|
class Rr {
|
|
1916
1928
|
events = /* @__PURE__ */ new Map();
|
|
1917
1929
|
/**
|
|
@@ -1968,13 +1980,13 @@ class Rr {
|
|
|
1968
1980
|
this.on(t, r);
|
|
1969
1981
|
}
|
|
1970
1982
|
}
|
|
1971
|
-
async function yr(e) {
|
|
1972
|
-
return await
|
|
1983
|
+
async function yr(e, t) {
|
|
1984
|
+
return await Pe(e, t), `${await hr()}/api/ws?Authorization=${e}`;
|
|
1973
1985
|
}
|
|
1974
|
-
function
|
|
1986
|
+
function Ar() {
|
|
1975
1987
|
return Date.now().toString(36) + Math.random().toString(36).slice(2);
|
|
1976
1988
|
}
|
|
1977
|
-
function
|
|
1989
|
+
function br(e) {
|
|
1978
1990
|
return typeof e == "object" && e !== null && "data" in e && "msgType" in e && "toUid" in e && "chatType" in e && "code" in e;
|
|
1979
1991
|
}
|
|
1980
1992
|
function st(e) {
|
|
@@ -1983,13 +1995,14 @@ function st(e) {
|
|
|
1983
1995
|
e.replyContent
|
|
1984
1996
|
), e.replyContent?.fileUrl?.startsWith("http") || (e.replyContent.fileUrl = t + e.replyContent.fileUrl), e.replyContent?.thumbnailUrl?.startsWith("http") || (e.replyContent.thumbnailUrl = t + e.replyContent.thumbnailUrl)), e;
|
|
1985
1997
|
}
|
|
1986
|
-
class
|
|
1998
|
+
class te extends Rr {
|
|
1987
1999
|
config = {
|
|
1988
2000
|
token: "",
|
|
1989
2001
|
autoReconnect: !0,
|
|
1990
2002
|
reconnectInterval: 3e3,
|
|
1991
2003
|
maxReconnectAttempts: 5,
|
|
1992
|
-
responseTimeout: 1e4
|
|
2004
|
+
responseTimeout: 1e4,
|
|
2005
|
+
env: "production"
|
|
1993
2006
|
};
|
|
1994
2007
|
ws = null;
|
|
1995
2008
|
status = O.DISCONNECTED;
|
|
@@ -2007,14 +2020,14 @@ class de extends Rr {
|
|
|
2007
2020
|
/** 匹配状态 */
|
|
2008
2021
|
matchStatus = C.UNMATCHED;
|
|
2009
2022
|
constructor() {
|
|
2010
|
-
if (super(),
|
|
2011
|
-
return
|
|
2012
|
-
|
|
2023
|
+
if (super(), te.instance)
|
|
2024
|
+
return te.instance;
|
|
2025
|
+
te.instance = this;
|
|
2013
2026
|
}
|
|
2014
2027
|
async init(t) {
|
|
2015
2028
|
if (!t.token)
|
|
2016
|
-
return
|
|
2017
|
-
|
|
2029
|
+
return Promise.reject(y.PARAMETER_ERROR);
|
|
2030
|
+
Pe(t.token, t.env || "production"), this.config = Object.assign(this.config, t);
|
|
2018
2031
|
}
|
|
2019
2032
|
/**
|
|
2020
2033
|
* 连接到服务器
|
|
@@ -2023,28 +2036,31 @@ class de extends Rr {
|
|
|
2023
2036
|
connect(t) {
|
|
2024
2037
|
return this.consultationTypeId = t, new Promise(async (n, r) => {
|
|
2025
2038
|
if (!this.config.token)
|
|
2026
|
-
return r(
|
|
2039
|
+
return r(y.UNINITIALIZED);
|
|
2027
2040
|
if (this.status === O.CONNECTED)
|
|
2028
2041
|
return n();
|
|
2029
2042
|
if (this.status !== O.CONNECTING) {
|
|
2030
2043
|
this.setStatus(O.CONNECTING);
|
|
2031
2044
|
try {
|
|
2032
|
-
const s = await yr(
|
|
2045
|
+
const s = await yr(
|
|
2046
|
+
this.config.token,
|
|
2047
|
+
this.config.env
|
|
2048
|
+
);
|
|
2033
2049
|
this.ws = new WebSocket(s), this.ws.onopen = () => {
|
|
2034
|
-
this.reconnectAttempts = 0, this.setStatus(O.CONNECTED), this.emit(
|
|
2050
|
+
this.reconnectAttempts = 0, this.setStatus(O.CONNECTED), this.emit(A.CONNECTED), n();
|
|
2035
2051
|
}, this.ws.onmessage = (o) => {
|
|
2036
2052
|
try {
|
|
2037
2053
|
this.handleMessage(o.data);
|
|
2038
2054
|
} catch (i) {
|
|
2039
|
-
throw console.error("解析消息失败:", i),
|
|
2055
|
+
throw console.error("解析消息失败:", i), y.DATA_PARSING_ERROR;
|
|
2040
2056
|
}
|
|
2041
2057
|
}, this.ws.onerror = (o) => {
|
|
2042
|
-
console.error("连接错误:", o), this.setStatus(O.ERROR), this.emit(
|
|
2058
|
+
console.error("连接错误:", o), this.setStatus(O.ERROR), this.emit(A.ERROR, o), r(o);
|
|
2043
2059
|
}, this.ws.onclose = () => {
|
|
2044
|
-
this.setStatus(O.DISCONNECTED), this.emit(
|
|
2060
|
+
this.setStatus(O.DISCONNECTED), this.emit(A.DISCONNECTED), this.config.autoReconnect && this.reconnectAttempts < this.config.maxReconnectAttempts && this.scheduleReconnect();
|
|
2045
2061
|
};
|
|
2046
2062
|
} catch (s) {
|
|
2047
|
-
this.setStatus(O.ERROR), this.emit(
|
|
2063
|
+
this.setStatus(O.ERROR), this.emit(A.ERROR, s), r(s);
|
|
2048
2064
|
}
|
|
2049
2065
|
}
|
|
2050
2066
|
});
|
|
@@ -2063,7 +2079,7 @@ class de extends Rr {
|
|
|
2063
2079
|
* @param msgType - 消息类型
|
|
2064
2080
|
* @returns Promise<{ messageId?: string; data?: Message }>
|
|
2065
2081
|
*/
|
|
2066
|
-
async sendMessage(t, n, r =
|
|
2082
|
+
async sendMessage(t, n, r = k.SEND) {
|
|
2067
2083
|
const s = {
|
|
2068
2084
|
msgType: r,
|
|
2069
2085
|
data: t,
|
|
@@ -2077,25 +2093,25 @@ class de extends Rr {
|
|
|
2077
2093
|
try {
|
|
2078
2094
|
await this.connect(this.consultationTypeId);
|
|
2079
2095
|
} catch (o) {
|
|
2080
|
-
throw console.error("重连失败:", o),
|
|
2096
|
+
throw console.error("重连失败:", o), y.DISCONNECTED;
|
|
2081
2097
|
}
|
|
2082
2098
|
} else
|
|
2083
|
-
throw console.error(
|
|
2099
|
+
throw console.error(y.DISCONNECTED), y.DISCONNECTED;
|
|
2084
2100
|
try {
|
|
2085
2101
|
if (!this.ws)
|
|
2086
|
-
throw
|
|
2087
|
-
return r ===
|
|
2088
|
-
const c =
|
|
2102
|
+
throw y.DISCONNECTED;
|
|
2103
|
+
return r === k.SEND ? new Promise((o, i) => {
|
|
2104
|
+
const c = Ar();
|
|
2089
2105
|
s.ext = c;
|
|
2090
2106
|
const d = setTimeout(() => {
|
|
2091
|
-
this.off(c, u), i(
|
|
2107
|
+
this.off(c, u), i(y.MESSAGE_SEND_FAIL);
|
|
2092
2108
|
}, this.config.responseTimeout), u = (l) => {
|
|
2093
2109
|
clearTimeout(d), o({ messageId: l, data: t });
|
|
2094
2110
|
};
|
|
2095
2111
|
this.once(c, u), this.ws.send(JSON.stringify(s));
|
|
2096
2112
|
}) : (this.ws.send(JSON.stringify(s)), { data: t });
|
|
2097
2113
|
} catch (o) {
|
|
2098
|
-
throw console.error("发送消息失败:", o),
|
|
2114
|
+
throw console.error("发送消息失败:", o), y.MESSAGE_SEND_FAIL;
|
|
2099
2115
|
}
|
|
2100
2116
|
}
|
|
2101
2117
|
/**
|
|
@@ -2106,16 +2122,16 @@ class de extends Rr {
|
|
|
2106
2122
|
if (this.matchStatus === C.UNBIND && (await this.sendMessage(
|
|
2107
2123
|
this.consultationTypeId,
|
|
2108
2124
|
void 0,
|
|
2109
|
-
|
|
2125
|
+
k.INBOUND
|
|
2110
2126
|
), await new Promise((t, n) => {
|
|
2111
2127
|
const r = setTimeout(() => {
|
|
2112
|
-
clearTimeout(r), n(
|
|
2128
|
+
clearTimeout(r), n(y.MESSAGE_SEND_FAIL);
|
|
2113
2129
|
}, this.config.responseTimeout);
|
|
2114
|
-
this.once(
|
|
2130
|
+
this.once(A.MESSAGE, (s) => {
|
|
2115
2131
|
s.code === U.REMATCH && (clearTimeout(r), t(!0));
|
|
2116
2132
|
});
|
|
2117
2133
|
})), this.matchStatus !== C.MATCHED)
|
|
2118
|
-
throw console.error(
|
|
2134
|
+
throw console.error(y.NO_CUSTOMER_SERVICE), y.NO_CUSTOMER_SERVICE;
|
|
2119
2135
|
}
|
|
2120
2136
|
/**
|
|
2121
2137
|
* 发送文本消息
|
|
@@ -2187,7 +2203,7 @@ class de extends Rr {
|
|
|
2187
2203
|
this.lastHeartbeatTime = Date.now(), this.heartbeatTimeoutTimer && (clearTimeout(this.heartbeatTimeoutTimer), this.heartbeatTimeoutTimer = null), this.sendHeartbeat();
|
|
2188
2204
|
return;
|
|
2189
2205
|
}
|
|
2190
|
-
if (t = JSON.parse(t), !!
|
|
2206
|
+
if (t = JSON.parse(t), !!br(t))
|
|
2191
2207
|
try {
|
|
2192
2208
|
const n = t.data ? JSON.parse(t.data) : t.data;
|
|
2193
2209
|
switch (t.data = n, t.code) {
|
|
@@ -2198,7 +2214,7 @@ class de extends Rr {
|
|
|
2198
2214
|
this.matchStatus = C.MATCHING, this.sendMessage(
|
|
2199
2215
|
this.consultationTypeId,
|
|
2200
2216
|
void 0,
|
|
2201
|
-
|
|
2217
|
+
k.INBOUND
|
|
2202
2218
|
);
|
|
2203
2219
|
break;
|
|
2204
2220
|
// 匹配成功
|
|
@@ -2206,10 +2222,10 @@ class de extends Rr {
|
|
|
2206
2222
|
case U.MATCH_SUCCESS:
|
|
2207
2223
|
if (this.matchStatus === C.MATCHED)
|
|
2208
2224
|
return;
|
|
2209
|
-
this.sessionData = t.data, this.matchStatus === C.UNBIND ? (this.matchStatus = C.MATCHED, this.emit(
|
|
2225
|
+
this.sessionData = t.data, this.matchStatus === C.UNBIND ? (this.matchStatus = C.MATCHED, this.emit(A.MESSAGE, {
|
|
2210
2226
|
...t,
|
|
2211
2227
|
code: U.REMATCH
|
|
2212
|
-
})) : (this.matchStatus = C.MATCHED, this.getFaqList(), this.emit(
|
|
2228
|
+
})) : (this.matchStatus = C.MATCHED, this.getFaqList(), this.emit(A.MESSAGE, t));
|
|
2213
2229
|
break;
|
|
2214
2230
|
// 转接用户成功
|
|
2215
2231
|
case U.TRANSFER_USER_SUCCESS:
|
|
@@ -2223,7 +2239,7 @@ class de extends Rr {
|
|
|
2223
2239
|
customerName: r.customerName,
|
|
2224
2240
|
groupId: r.groupId,
|
|
2225
2241
|
sessionId: r.sessionId
|
|
2226
|
-
}, this.emit(
|
|
2242
|
+
}, this.emit(A.MESSAGE, t);
|
|
2227
2243
|
break;
|
|
2228
2244
|
case U.SEND_SUCCESS:
|
|
2229
2245
|
case U.EDIT:
|
|
@@ -2231,7 +2247,7 @@ class de extends Rr {
|
|
|
2231
2247
|
const s = t.data;
|
|
2232
2248
|
if (s.sessionId !== this.sessionData?.sessionId)
|
|
2233
2249
|
return;
|
|
2234
|
-
st(s), this.emit(
|
|
2250
|
+
st(s), this.emit(A.MESSAGE, t);
|
|
2235
2251
|
break;
|
|
2236
2252
|
case U.SEND_CALLBACK:
|
|
2237
2253
|
const o = t.ext, c = t.data.messageId;
|
|
@@ -2240,10 +2256,10 @@ class de extends Rr {
|
|
|
2240
2256
|
case U.UNBIND_SUCCESS:
|
|
2241
2257
|
if (n.sessionId !== this.sessionData?.sessionId)
|
|
2242
2258
|
return;
|
|
2243
|
-
this.matchStatus = C.UNBIND, this.sessionData = null, this.emit(
|
|
2259
|
+
this.matchStatus = C.UNBIND, this.sessionData = null, this.emit(A.MESSAGE, t);
|
|
2244
2260
|
break;
|
|
2245
2261
|
default:
|
|
2246
|
-
this.emit(
|
|
2262
|
+
this.emit(A.MESSAGE, t);
|
|
2247
2263
|
break;
|
|
2248
2264
|
}
|
|
2249
2265
|
} catch (n) {
|
|
@@ -2256,7 +2272,7 @@ class de extends Rr {
|
|
|
2256
2272
|
* @returns void
|
|
2257
2273
|
*/
|
|
2258
2274
|
setStatus(t) {
|
|
2259
|
-
this.status !== t && (this.status = t, this.emit(
|
|
2275
|
+
this.status !== t && (this.status = t, this.emit(A.STATUS_CHANGE, t));
|
|
2260
2276
|
}
|
|
2261
2277
|
/**
|
|
2262
2278
|
* 安排重连
|
|
@@ -2284,7 +2300,7 @@ class de extends Rr {
|
|
|
2284
2300
|
if (!(this.status !== O.CONNECTED || !this.ws))
|
|
2285
2301
|
try {
|
|
2286
2302
|
this.ws.send("pong"), this.lastHeartbeatTime = Date.now(), this.heartbeatTimeoutTimer = setTimeout(() => {
|
|
2287
|
-
Date.now() - this.lastHeartbeatTime >= this.config.responseTimeout && (this.emit(
|
|
2303
|
+
Date.now() - this.lastHeartbeatTime >= this.config.responseTimeout && (this.emit(A.HEARTBEAT_TIMEOUT), console.warn("心跳超时,尝试重连"), this.ws && this.ws.close());
|
|
2288
2304
|
}, this.config.responseTimeout);
|
|
2289
2305
|
} catch (t) {
|
|
2290
2306
|
console.error("发送心跳失败:", t);
|
|
@@ -2300,7 +2316,7 @@ class de extends Rr {
|
|
|
2300
2316
|
size: n = 50
|
|
2301
2317
|
}) {
|
|
2302
2318
|
if (this.matchStatus !== C.MATCHED)
|
|
2303
|
-
return Promise.reject(
|
|
2319
|
+
return Promise.reject(y.NO_CUSTOMER_SERVICE);
|
|
2304
2320
|
const r = await wr({
|
|
2305
2321
|
sessionId: this.sessionData?.sessionId,
|
|
2306
2322
|
lastMsgId: t,
|
|
@@ -2322,8 +2338,8 @@ class de extends Rr {
|
|
|
2322
2338
|
return new Promise(async (n, r) => {
|
|
2323
2339
|
const s = t.name.split(".").pop(), o = await pr({ ext: s || "" }), { accessKeyId: i, signature: c, policy: d, key: u } = o.data, l = new FormData();
|
|
2324
2340
|
l.append("key", u), l.append("AccessKeyId", i), l.append("signature", c), l.append("policy", d), l.append("file", t);
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2341
|
+
const h = await mr(l);
|
|
2342
|
+
h.status === 204 ? n(`${u}`) : r(h.data);
|
|
2327
2343
|
});
|
|
2328
2344
|
}
|
|
2329
2345
|
/**
|
|
@@ -2345,7 +2361,7 @@ class de extends Rr {
|
|
|
2345
2361
|
i.drawImage(s, 0, 0, o.width, o.height), o.toBlob(
|
|
2346
2362
|
(d) => {
|
|
2347
2363
|
if (URL.revokeObjectURL(c), s.remove(), !d) {
|
|
2348
|
-
r(
|
|
2364
|
+
r(y.FILE_PARSING_ERROR);
|
|
2349
2365
|
return;
|
|
2350
2366
|
}
|
|
2351
2367
|
const u = t.name.replace(/\.[^/.]+$/, "") + "_thumb.jpg", l = new File([d], u, {
|
|
@@ -2362,12 +2378,12 @@ class de extends Rr {
|
|
|
2362
2378
|
URL.revokeObjectURL(c), s.remove(), r(d);
|
|
2363
2379
|
}
|
|
2364
2380
|
}), s.addEventListener("error", () => {
|
|
2365
|
-
URL.revokeObjectURL(c), s.remove(), r(
|
|
2381
|
+
URL.revokeObjectURL(c), s.remove(), r(y.FILE_PARSING_ERROR);
|
|
2366
2382
|
}), s.load();
|
|
2367
2383
|
});
|
|
2368
2384
|
async getFaqList() {
|
|
2369
2385
|
if (this.matchStatus !== C.MATCHED)
|
|
2370
|
-
return Promise.reject(
|
|
2386
|
+
return Promise.reject(y.NO_CUSTOMER_SERVICE);
|
|
2371
2387
|
const t = await Sr({ id: this.sessionData?.cid });
|
|
2372
2388
|
if (!t.data?.topic?.length)
|
|
2373
2389
|
return;
|
|
@@ -2388,12 +2404,12 @@ class de extends Rr {
|
|
|
2388
2404
|
customerServiceAvatar: this.sessionData?.customerAvatar,
|
|
2389
2405
|
customerServiceName: this.sessionData?.customerName,
|
|
2390
2406
|
createTime: Date.now(),
|
|
2391
|
-
msgType:
|
|
2407
|
+
msgType: k.SEND
|
|
2392
2408
|
},
|
|
2393
|
-
msgType:
|
|
2409
|
+
msgType: k.SEND,
|
|
2394
2410
|
chatType: M.FAQ
|
|
2395
2411
|
};
|
|
2396
|
-
this.emit(
|
|
2412
|
+
this.emit(A.MESSAGE, r);
|
|
2397
2413
|
}, t.data.showDelaySeconds * 1e3);
|
|
2398
2414
|
}
|
|
2399
2415
|
sendFaq(t) {
|
|
@@ -2404,22 +2420,22 @@ class de extends Rr {
|
|
|
2404
2420
|
customerServiceAvatar: this.sessionData?.customerAvatar,
|
|
2405
2421
|
customerServiceName: this.sessionData?.customerName,
|
|
2406
2422
|
createTime: Date.now(),
|
|
2407
|
-
msgType:
|
|
2423
|
+
msgType: k.SEND,
|
|
2408
2424
|
contentType: M.FAQ,
|
|
2409
2425
|
content: {}
|
|
2410
2426
|
},
|
|
2411
|
-
msgType:
|
|
2427
|
+
msgType: k.SEND,
|
|
2412
2428
|
chatType: M.FAQ
|
|
2413
2429
|
};
|
|
2414
2430
|
if (t.isMulti)
|
|
2415
2431
|
n.data.content = {
|
|
2416
2432
|
list: t.item
|
|
2417
|
-
}, this.emit(
|
|
2433
|
+
}, this.emit(A.MESSAGE, n);
|
|
2418
2434
|
else {
|
|
2419
2435
|
const r = t.item?.[0] || t, s = pe();
|
|
2420
2436
|
r.imageUrl = r.imageUrl?.map((o) => o?.startsWith("http") ? o : `${s}/${o}`), n.data.content = {
|
|
2421
2437
|
answer: r
|
|
2422
|
-
}, this.emit(
|
|
2438
|
+
}, this.emit(A.MESSAGE, n);
|
|
2423
2439
|
}
|
|
2424
2440
|
}
|
|
2425
2441
|
async getUserInfo() {
|
|
@@ -2432,12 +2448,11 @@ class de extends Rr {
|
|
|
2432
2448
|
export {
|
|
2433
2449
|
M as ChatType,
|
|
2434
2450
|
O as ConnectionStatus,
|
|
2435
|
-
|
|
2436
|
-
|
|
2451
|
+
A as EventType,
|
|
2452
|
+
te as JoyTalk,
|
|
2437
2453
|
C as MatchStatus,
|
|
2438
2454
|
U as MessageCode,
|
|
2439
|
-
|
|
2455
|
+
k as MessageType,
|
|
2440
2456
|
_e as SendUserType,
|
|
2441
|
-
|
|
2442
|
-
de as default
|
|
2457
|
+
te as default
|
|
2443
2458
|
};
|