yxuse 3.0.20 → 3.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.
Files changed (62) hide show
  1. package/lib/api.cjs.js +1 -1
  2. package/lib/api.es.js +8 -6
  3. package/lib/components.cjs.js +1 -1
  4. package/lib/components.es.js +14 -11
  5. package/lib/directives.cjs.js +1 -1
  6. package/lib/directives.es.js +2 -2
  7. package/lib/hooks.cjs.js +1 -0
  8. package/lib/hooks.es.js +5 -0
  9. package/lib/index.cjs.js +1 -1
  10. package/lib/index.cjs2.js +40 -1
  11. package/lib/index.cjs2.js.gz +0 -0
  12. package/lib/index.cjs3.js +1 -3
  13. package/lib/index.cjs4.js +1 -1
  14. package/lib/index.cjs5.js +1 -1
  15. package/lib/index.cjs6.js +3 -40
  16. package/lib/index.cjs6.js.gz +0 -0
  17. package/lib/index.cjs7.js +1 -0
  18. package/lib/index.cjs8.js +1 -0
  19. package/lib/index.es.js +15 -13
  20. package/lib/index.es2.js +8103 -34
  21. package/lib/index.es2.js.gz +0 -0
  22. package/lib/index.es3.js +117 -1653
  23. package/lib/index.es4.js +38 -20
  24. package/lib/index.es5.js +310 -132
  25. package/lib/index.es5.js.gz +0 -0
  26. package/lib/index.es6.js +1557 -7784
  27. package/lib/index.es6.js.gz +0 -0
  28. package/lib/index.es7.js +13 -0
  29. package/lib/index.es8.js +24 -0
  30. package/lib/style.css +1 -1
  31. package/lib/style.css.gz +0 -0
  32. package/lib/theme.cjs.js +1 -1
  33. package/lib/theme.es.js +12 -11
  34. package/lib/utils.cjs.js +1 -1
  35. package/lib/utils.es.js +2 -2
  36. package/lib/yxIcon.cjs.js +1 -0
  37. package/lib/yxIcon.es.js +43 -0
  38. package/package.json +13 -7
  39. package/types/api/index.d.ts +2 -1
  40. package/types/api/modules/assets/index.d.ts +3 -0
  41. package/types/components/YxFormV2/index.d.ts +3 -0
  42. package/types/components/YxFormV2/index.vue.d.ts +46 -0
  43. package/types/components/YxFormV2/type.d.ts +54 -0
  44. package/types/components/YxUpload/index.d.ts +3 -0
  45. package/types/components/YxUpload/index.vue.d.ts +16 -0
  46. package/types/components/YxUpload/type.d.ts +6 -0
  47. package/types/components/index.d.ts +2 -0
  48. package/types/components/type.d.ts +1 -0
  49. package/types/hooks/index.d.ts +1 -0
  50. package/types/hooks/useTime/index.d.ts +3 -0
  51. package/types/index.d.ts +6 -3
  52. package/types/translate/index.d.ts +1 -0
  53. package/types/yxIcon/index.d.ts +5 -0
  54. package/types/yxi18n/index.d.ts +4 -0
  55. package/lib/data.cjs.js +0 -1
  56. package/lib/data.cjs.js.gz +0 -0
  57. package/lib/data.es.js +0 -75
  58. package/lib/data.es.js.gz +0 -0
  59. package/lib/icons.cjs.js +0 -1
  60. package/lib/icons.es.js +0 -7
  61. package/lib/index.cjs3.js.gz +0 -0
  62. package/lib/index.es3.js.gz +0 -0
package/lib/index.es3.js CHANGED
@@ -1,1670 +1,134 @@
1
- var nt = Object.defineProperty;
2
- var we = Object.getOwnPropertySymbols;
3
- var rt = Object.prototype.hasOwnProperty, st = Object.prototype.propertyIsEnumerable;
4
- var X = (e, t, n) => t in e ? nt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, k = (e, t) => {
5
- for (var n in t || (t = {}))
6
- rt.call(t, n) && X(e, n, t[n]);
7
- if (we)
8
- for (var n of we(t))
9
- st.call(t, n) && X(e, n, t[n]);
10
- return e;
11
- };
12
- var Ee = (e, t, n) => (X(e, typeof t != "symbol" ? t + "" : t, n), n);
13
- var I = (e, t, n) => new Promise((r, s) => {
14
- var i = (l) => {
15
- try {
16
- c(n.next(l));
17
- } catch (u) {
18
- s(u);
19
- }
20
- }, o = (l) => {
21
- try {
22
- c(n.throw(l));
23
- } catch (u) {
24
- s(u);
25
- }
26
- }, c = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(i, o);
27
- c((n = n.apply(e, t)).next());
28
- });
29
- import { ElMessage as S, ElLoading as ot, ElNotification as Se } from "element-plus";
30
- function Ue(e, t) {
31
- return function() {
32
- return e.apply(t, arguments);
33
- };
34
- }
35
- const { toString: _e } = Object.prototype, { getPrototypeOf: ie } = Object, ae = /* @__PURE__ */ ((e) => (t) => {
36
- const n = _e.call(t);
37
- return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
38
- })(/* @__PURE__ */ Object.create(null)), A = (e) => (e = e.toLowerCase(), (t) => ae(t) === e), z = (e) => (t) => typeof t === e, { isArray: C } = Array, _ = z("undefined");
39
- function it(e) {
40
- return e !== null && !_(e) && e.constructor !== null && !_(e.constructor) && N(e.constructor.isBuffer) && e.constructor.isBuffer(e);
41
- }
42
- const Fe = A("ArrayBuffer");
43
- function at(e) {
44
- let t;
45
- return typeof ArrayBuffer != "undefined" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Fe(e.buffer), t;
46
- }
47
- const ct = z("string"), N = z("function"), Be = z("number"), ce = (e) => e !== null && typeof e == "object", ut = (e) => e === !0 || e === !1, j = (e) => {
48
- if (ae(e) !== "object")
49
- return !1;
50
- const t = ie(e);
51
- return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
52
- }, lt = A("Date"), ft = A("File"), dt = A("Blob"), pt = A("FileList"), ht = (e) => ce(e) && N(e.pipe), mt = (e) => {
53
- const t = "[object FormData]";
54
- return e && (typeof FormData == "function" && e instanceof FormData || _e.call(e) === t || N(e.toString) && e.toString() === t);
55
- }, yt = A("URLSearchParams"), wt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
56
- function F(e, t, { allOwnKeys: n = !1 } = {}) {
57
- if (e === null || typeof e == "undefined")
58
- return;
59
- let r, s;
60
- if (typeof e != "object" && (e = [e]), C(e))
61
- for (r = 0, s = e.length; r < s; r++)
62
- t.call(null, e[r], r, e);
63
- else {
64
- const i = n ? Object.getOwnPropertyNames(e) : Object.keys(e), o = i.length;
65
- let c;
66
- for (r = 0; r < o; r++)
67
- c = i[r], t.call(null, e[c], c, e);
68
- }
69
- }
70
- function De(e, t) {
71
- t = t.toLowerCase();
72
- const n = Object.keys(e);
73
- let r = n.length, s;
74
- for (; r-- > 0; )
75
- if (s = n[r], t === s.toLowerCase())
76
- return s;
77
- return null;
78
- }
79
- const ke = typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : global, Ie = (e) => !_(e) && e !== ke;
80
- function te() {
81
- const { caseless: e } = Ie(this) && this || {}, t = {}, n = (r, s) => {
82
- const i = e && De(t, s) || s;
83
- j(t[i]) && j(r) ? t[i] = te(t[i], r) : j(r) ? t[i] = te({}, r) : C(r) ? t[i] = r.slice() : t[i] = r;
84
- };
85
- for (let r = 0, s = arguments.length; r < s; r++)
86
- arguments[r] && F(arguments[r], n);
87
- return t;
88
- }
89
- const Et = (e, t, n, { allOwnKeys: r } = {}) => (F(t, (s, i) => {
90
- n && N(s) ? e[i] = Ue(s, n) : e[i] = s;
91
- }, { allOwnKeys: r }), e), St = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), bt = (e, t, n, r) => {
92
- e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
93
- value: t.prototype
94
- }), n && Object.assign(e.prototype, n);
95
- }, Ot = (e, t, n, r) => {
96
- let s, i, o;
97
- const c = {};
98
- if (t = t || {}, e == null)
99
- return t;
100
- do {
101
- for (s = Object.getOwnPropertyNames(e), i = s.length; i-- > 0; )
102
- o = s[i], (!r || r(o, e, t)) && !c[o] && (t[o] = e[o], c[o] = !0);
103
- e = n !== !1 && ie(e);
104
- } while (e && (!n || n(e, t)) && e !== Object.prototype);
105
- return t;
106
- }, gt = (e, t, n) => {
107
- e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
108
- const r = e.indexOf(t, n);
109
- return r !== -1 && r === n;
110
- }, Rt = (e) => {
111
- if (!e)
112
- return null;
113
- if (C(e))
114
- return e;
115
- let t = e.length;
116
- if (!Be(t))
117
- return null;
118
- const n = new Array(t);
119
- for (; t-- > 0; )
120
- n[t] = e[t];
121
- return n;
122
- }, At = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array != "undefined" && ie(Uint8Array)), Tt = (e, t) => {
123
- const r = (e && e[Symbol.iterator]).call(e);
124
- let s;
125
- for (; (s = r.next()) && !s.done; ) {
126
- const i = s.value;
127
- t.call(e, i[0], i[1]);
128
- }
129
- }, Nt = (e, t) => {
130
- let n;
131
- const r = [];
132
- for (; (n = e.exec(t)) !== null; )
133
- r.push(n);
134
- return r;
135
- }, Pt = A("HTMLFormElement"), xt = (e) => e.toLowerCase().replace(
136
- /[-_\s]([a-z\d])(\w*)/g,
137
- function(n, r, s) {
138
- return r.toUpperCase() + s;
139
- }
140
- ), be = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Ct = A("RegExp"), je = (e, t) => {
141
- const n = Object.getOwnPropertyDescriptors(e), r = {};
142
- F(n, (s, i) => {
143
- t(s, i, e) !== !1 && (r[i] = s);
144
- }), Object.defineProperties(e, r);
145
- }, Lt = (e) => {
146
- je(e, (t, n) => {
147
- if (N(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
148
- return !1;
149
- const r = e[n];
150
- if (N(r)) {
151
- if (t.enumerable = !1, "writable" in t) {
152
- t.writable = !1;
153
- return;
154
- }
155
- t.set || (t.set = () => {
156
- throw Error("Can not rewrite read-only method '" + n + "'");
157
- });
158
- }
159
- });
160
- }, Ut = (e, t) => {
161
- const n = {}, r = (s) => {
162
- s.forEach((i) => {
163
- n[i] = !0;
164
- });
165
- };
166
- return C(e) ? r(e) : r(String(e).split(t)), n;
167
- }, _t = () => {
168
- }, Ft = (e, t) => (e = +e, Number.isFinite(e) ? e : t), Q = "abcdefghijklmnopqrstuvwxyz", Oe = "0123456789", He = {
169
- DIGIT: Oe,
170
- ALPHA: Q,
171
- ALPHA_DIGIT: Q + Q.toUpperCase() + Oe
172
- }, Bt = (e = 16, t = He.ALPHA_DIGIT) => {
173
- let n = "";
174
- const { length: r } = t;
175
- for (; e--; )
176
- n += t[Math.random() * r | 0];
177
- return n;
178
- };
179
- function Dt(e) {
180
- return !!(e && N(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
181
- }
182
- const kt = (e) => {
183
- const t = new Array(10), n = (r, s) => {
184
- if (ce(r)) {
185
- if (t.indexOf(r) >= 0)
186
- return;
187
- if (!("toJSON" in r)) {
188
- t[s] = r;
189
- const i = C(r) ? [] : {};
190
- return F(r, (o, c) => {
191
- const l = n(o, s + 1);
192
- !_(l) && (i[c] = l);
193
- }), t[s] = void 0, i;
194
- }
195
- }
196
- return r;
1
+ var $ = Object.defineProperty;
2
+ var w = (e, s, t) => s in e ? $(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
+ var m = (e, s, t) => (w(e, typeof s != "symbol" ? s + "" : s, t), t);
4
+ import { h as y } from "./index.es6.js";
5
+ const S = (e) => {
6
+ new BroadcastChannel("YXUSE_BC").postMessage(e);
7
+ }, B = (e) => {
8
+ const s = new BroadcastChannel("YXUSE_BC");
9
+ s.onmessage = () => {
10
+ e();
197
11
  };
198
- return n(e, 0);
199
- }, a = {
200
- isArray: C,
201
- isArrayBuffer: Fe,
202
- isBuffer: it,
203
- isFormData: mt,
204
- isArrayBufferView: at,
205
- isString: ct,
206
- isNumber: Be,
207
- isBoolean: ut,
208
- isObject: ce,
209
- isPlainObject: j,
210
- isUndefined: _,
211
- isDate: lt,
212
- isFile: ft,
213
- isBlob: dt,
214
- isRegExp: Ct,
215
- isFunction: N,
216
- isStream: ht,
217
- isURLSearchParams: yt,
218
- isTypedArray: At,
219
- isFileList: pt,
220
- forEach: F,
221
- merge: te,
222
- extend: Et,
223
- trim: wt,
224
- stripBOM: St,
225
- inherits: bt,
226
- toFlatObject: Ot,
227
- kindOf: ae,
228
- kindOfTest: A,
229
- endsWith: gt,
230
- toArray: Rt,
231
- forEachEntry: Tt,
232
- matchAll: Nt,
233
- isHTMLForm: Pt,
234
- hasOwnProperty: be,
235
- hasOwnProp: be,
236
- // an alias to avoid ESLint no-prototype-builtins detection
237
- reduceDescriptors: je,
238
- freezeMethods: Lt,
239
- toObjectSet: Ut,
240
- toCamelCase: xt,
241
- noop: _t,
242
- toFiniteNumber: Ft,
243
- findKey: De,
244
- global: ke,
245
- isContextDefined: Ie,
246
- ALPHABET: He,
247
- generateString: Bt,
248
- isSpecCompliantForm: Dt,
249
- toJSONObject: kt
250
- };
251
- function m(e, t, n, r, s) {
252
- Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), s && (this.response = s);
253
- }
254
- a.inherits(m, Error, {
255
- toJSON: function() {
256
- return {
257
- // Standard
258
- message: this.message,
259
- name: this.name,
260
- // Microsoft
261
- description: this.description,
262
- number: this.number,
263
- // Mozilla
264
- fileName: this.fileName,
265
- lineNumber: this.lineNumber,
266
- columnNumber: this.columnNumber,
267
- stack: this.stack,
268
- // Axios
269
- config: a.toJSONObject(this.config),
270
- code: this.code,
271
- status: this.response && this.response.status ? this.response.status : null
272
- };
273
- }
274
- });
275
- const Me = m.prototype, qe = {};
276
- [
277
- "ERR_BAD_OPTION_VALUE",
278
- "ERR_BAD_OPTION",
279
- "ECONNABORTED",
280
- "ETIMEDOUT",
281
- "ERR_NETWORK",
282
- "ERR_FR_TOO_MANY_REDIRECTS",
283
- "ERR_DEPRECATED",
284
- "ERR_BAD_RESPONSE",
285
- "ERR_BAD_REQUEST",
286
- "ERR_CANCELED",
287
- "ERR_NOT_SUPPORT",
288
- "ERR_INVALID_URL"
289
- // eslint-disable-next-line func-names
290
- ].forEach((e) => {
291
- qe[e] = { value: e };
292
- });
293
- Object.defineProperties(m, qe);
294
- Object.defineProperty(Me, "isAxiosError", { value: !0 });
295
- m.from = (e, t, n, r, s, i) => {
296
- const o = Object.create(Me);
297
- return a.toFlatObject(e, o, function(l) {
298
- return l !== Error.prototype;
299
- }, (c) => c !== "isAxiosError"), m.call(o, e.message, t, n, r, s), o.cause = e, o.name = e.name, i && Object.assign(o, i), o;
300
- };
301
- const It = null;
302
- function ne(e) {
303
- return a.isPlainObject(e) || a.isArray(e);
304
- }
305
- function Je(e) {
306
- return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
307
- }
308
- function ge(e, t, n) {
309
- return e ? e.concat(t).map(function(s, i) {
310
- return s = Je(s), !n && i ? "[" + s + "]" : s;
311
- }).join(n ? "." : "") : t;
312
- }
313
- function jt(e) {
314
- return a.isArray(e) && !e.some(ne);
315
- }
316
- const Ht = a.toFlatObject(a, {}, null, function(t) {
317
- return /^is[A-Z]/.test(t);
318
- });
319
- function V(e, t, n) {
320
- if (!a.isObject(e))
321
- throw new TypeError("target must be an object");
322
- t = t || new FormData(), n = a.toFlatObject(n, {
323
- metaTokens: !0,
324
- dots: !1,
325
- indexes: !1
326
- }, !1, function(h, g) {
327
- return !a.isUndefined(g[h]);
328
- });
329
- const r = n.metaTokens, s = n.visitor || f, i = n.dots, o = n.indexes, l = (n.Blob || typeof Blob != "undefined" && Blob) && a.isSpecCompliantForm(t);
330
- if (!a.isFunction(s))
331
- throw new TypeError("visitor must be a function");
332
- function u(d) {
333
- if (d === null)
334
- return "";
335
- if (a.isDate(d))
336
- return d.toISOString();
337
- if (!l && a.isBlob(d))
338
- throw new m("Blob is not supported. Use a Buffer instead.");
339
- return a.isArrayBuffer(d) || a.isTypedArray(d) ? l && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
340
- }
341
- function f(d, h, g) {
342
- let b = d;
343
- if (d && !g && typeof d == "object") {
344
- if (a.endsWith(h, "{}"))
345
- h = r ? h : h.slice(0, -2), d = JSON.stringify(d);
346
- else if (a.isArray(d) && jt(d) || (a.isFileList(d) || a.endsWith(h, "[]")) && (b = a.toArray(d)))
347
- return h = Je(h), b.forEach(function(D, tt) {
348
- !(a.isUndefined(D) || D === null) && t.append(
349
- // eslint-disable-next-line no-nested-ternary
350
- o === !0 ? ge([h], tt, i) : o === null ? h : h + "[]",
351
- u(D)
352
- );
353
- }), !1;
354
- }
355
- return ne(d) ? !0 : (t.append(ge(g, h, i), u(d)), !1);
356
- }
357
- const p = [], E = Object.assign(Ht, {
358
- defaultVisitor: f,
359
- convertValue: u,
360
- isVisitable: ne
361
- });
362
- function y(d, h) {
363
- if (!a.isUndefined(d)) {
364
- if (p.indexOf(d) !== -1)
365
- throw Error("Circular reference detected in " + h.join("."));
366
- p.push(d), a.forEach(d, function(b, P) {
367
- (!(a.isUndefined(b) || b === null) && s.call(
368
- t,
369
- b,
370
- a.isString(P) ? P.trim() : P,
371
- h,
372
- E
373
- )) === !0 && y(b, h ? h.concat(P) : [P]);
374
- }), p.pop();
375
- }
376
- }
377
- if (!a.isObject(e))
378
- throw new TypeError("data must be an object");
379
- return y(e), t;
380
- }
381
- function Re(e) {
382
- const t = {
383
- "!": "%21",
384
- "'": "%27",
385
- "(": "%28",
386
- ")": "%29",
387
- "~": "%7E",
388
- "%20": "+",
389
- "%00": "\0"
390
- };
391
- return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
392
- return t[r];
393
- });
394
- }
395
- function ue(e, t) {
396
- this._pairs = [], e && V(e, this, t);
397
- }
398
- const ze = ue.prototype;
399
- ze.append = function(t, n) {
400
- this._pairs.push([t, n]);
401
- };
402
- ze.toString = function(t) {
403
- const n = t ? function(r) {
404
- return t.call(this, r, Re);
405
- } : Re;
406
- return this._pairs.map(function(s) {
407
- return n(s[0]) + "=" + n(s[1]);
408
- }, "").join("&");
409
- };
410
- function Mt(e) {
411
- return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
412
- }
413
- function Ve(e, t, n) {
12
+ }, F = (e, s, t, i) => Array.isArray(e) ? e.map((a) => ({
13
+ label: a == null ? void 0 : a[s],
14
+ value: i ? +a[t] : a[t]
15
+ })) : [], W = (e) => {
16
+ const s = [];
17
+ for (const t in e)
18
+ isNaN(Number(t)) && s.push({ label: t, value: e[t] });
19
+ return s;
20
+ }, _ = (e) => {
21
+ const t = ((u) => {
22
+ let f = 0, C = 0, I = 0, d = 1;
23
+ if (u.startsWith("#"))
24
+ if (u = u.slice(1), u.length === 3)
25
+ f = parseInt(u[0] + u[0], 16), C = parseInt(u[1] + u[1], 16), I = parseInt(u[2] + u[2], 16);
26
+ else if (u.length === 6)
27
+ f = parseInt(u.slice(0, 2), 16), C = parseInt(u.slice(2, 4), 16), I = parseInt(u.slice(4, 6), 16);
28
+ else
29
+ return null;
30
+ else if (u.startsWith("rgb")) {
31
+ const g = u.match(/(\d+(\.\d+)?)/g);
32
+ if (g)
33
+ f = parseFloat(g[0]), C = parseFloat(g[1]), I = parseFloat(g[2]), g.length > 3 && (d = parseFloat(g[3]));
34
+ else
35
+ return null;
36
+ } else
37
+ return null;
38
+ return [f, C, I, d];
39
+ })(e);
414
40
  if (!t)
415
- return e;
416
- const r = n && n.encode || Mt, s = n && n.serialize;
417
- let i;
418
- if (s ? i = s(t, n) : i = a.isURLSearchParams(t) ? t.toString() : new ue(t, n).toString(r), i) {
419
- const o = e.indexOf("#");
420
- o !== -1 && (e = e.slice(0, o)), e += (e.indexOf("?") === -1 ? "?" : "&") + i;
421
- }
422
- return e;
423
- }
424
- class Ae {
425
- constructor() {
426
- this.handlers = [];
427
- }
428
- /**
429
- * Add a new interceptor to the stack
430
- *
431
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
432
- * @param {Function} rejected The function to handle `reject` for a `Promise`
433
- *
434
- * @return {Number} An ID used to remove interceptor later
435
- */
436
- use(t, n, r) {
437
- return this.handlers.push({
438
- fulfilled: t,
439
- rejected: n,
440
- synchronous: r ? r.synchronous : !1,
441
- runWhen: r ? r.runWhen : null
442
- }), this.handlers.length - 1;
443
- }
444
- /**
445
- * Remove an interceptor from the stack
446
- *
447
- * @param {Number} id The ID that was returned by `use`
448
- *
449
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
450
- */
451
- eject(t) {
452
- this.handlers[t] && (this.handlers[t] = null);
453
- }
454
- /**
455
- * Clear all interceptors from the stack
456
- *
457
- * @returns {void}
458
- */
459
- clear() {
460
- this.handlers && (this.handlers = []);
461
- }
462
- /**
463
- * Iterate over all the registered interceptors
464
- *
465
- * This method is particularly useful for skipping over any
466
- * interceptors that may have become `null` calling `eject`.
467
- *
468
- * @param {Function} fn The function to call for each interceptor
469
- *
470
- * @returns {void}
471
- */
472
- forEach(t) {
473
- a.forEach(this.handlers, function(r) {
474
- r !== null && t(r);
475
- });
476
- }
477
- }
478
- const Ge = {
479
- silentJSONParsing: !0,
480
- forcedJSONParsing: !0,
481
- clarifyTimeoutError: !1
482
- }, qt = typeof URLSearchParams != "undefined" ? URLSearchParams : ue, Jt = typeof FormData != "undefined" ? FormData : null, zt = (() => {
483
- let e;
484
- return typeof navigator != "undefined" && ((e = navigator.product) === "ReactNative" || e === "NativeScript" || e === "NS") ? !1 : typeof window != "undefined" && typeof document != "undefined";
485
- })(), Vt = typeof WorkerGlobalScope != "undefined" && // eslint-disable-next-line no-undef
486
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", O = {
487
- isBrowser: !0,
488
- classes: {
489
- URLSearchParams: qt,
490
- FormData: Jt,
491
- Blob
492
- },
493
- isStandardBrowserEnv: zt,
494
- isStandardBrowserWebWorkerEnv: Vt,
495
- protocols: ["http", "https", "file", "blob", "url", "data"]
496
- };
497
- function Gt(e, t) {
498
- return V(e, new O.classes.URLSearchParams(), Object.assign({
499
- visitor: function(n, r, s, i) {
500
- return O.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
501
- }
502
- }, t));
503
- }
504
- function $t(e) {
505
- return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
506
- }
507
- function vt(e) {
508
- const t = {}, n = Object.keys(e);
509
- let r;
510
- const s = n.length;
511
- let i;
512
- for (r = 0; r < s; r++)
513
- i = n[r], t[i] = e[i];
514
- return t;
515
- }
516
- function $e(e) {
517
- function t(n, r, s, i) {
518
- let o = n[i++];
519
- const c = Number.isFinite(+o), l = i >= n.length;
520
- return o = !o && a.isArray(s) ? s.length : o, l ? (a.hasOwnProp(s, o) ? s[o] = [s[o], r] : s[o] = r, !c) : ((!s[o] || !a.isObject(s[o])) && (s[o] = []), t(n, r, s[o], i) && a.isArray(s[o]) && (s[o] = vt(s[o])), !c);
521
- }
522
- if (a.isFormData(e) && a.isFunction(e.entries)) {
523
- const n = {};
524
- return a.forEachEntry(e, (r, s) => {
525
- t($t(r), s, n, 0);
526
- }), n;
527
- }
528
- return null;
529
- }
530
- const Kt = {
531
- "Content-Type": void 0
532
- };
533
- function Wt(e, t, n) {
534
- if (a.isString(e))
535
- try {
536
- return (t || JSON.parse)(e), a.trim(e);
537
- } catch (r) {
538
- if (r.name !== "SyntaxError")
539
- throw r;
540
- }
541
- return (n || JSON.stringify)(e);
542
- }
543
- const G = {
544
- transitional: Ge,
545
- adapter: ["xhr", "http"],
546
- transformRequest: [function(t, n) {
547
- const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, i = a.isObject(t);
548
- if (i && a.isHTMLForm(t) && (t = new FormData(t)), a.isFormData(t))
549
- return s && s ? JSON.stringify($e(t)) : t;
550
- if (a.isArrayBuffer(t) || a.isBuffer(t) || a.isStream(t) || a.isFile(t) || a.isBlob(t))
551
- return t;
552
- if (a.isArrayBufferView(t))
553
- return t.buffer;
554
- if (a.isURLSearchParams(t))
555
- return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
556
- let c;
557
- if (i) {
558
- if (r.indexOf("application/x-www-form-urlencoded") > -1)
559
- return Gt(t, this.formSerializer).toString();
560
- if ((c = a.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
561
- const l = this.env && this.env.FormData;
562
- return V(
563
- c ? { "files[]": t } : t,
564
- l && new l(),
565
- this.formSerializer
566
- );
567
- }
568
- }
569
- return i || s ? (n.setContentType("application/json", !1), Wt(t)) : t;
570
- }],
571
- transformResponse: [function(t) {
572
- const n = this.transitional || G.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
573
- if (t && a.isString(t) && (r && !this.responseType || s)) {
574
- const o = !(n && n.silentJSONParsing) && s;
575
- try {
576
- return JSON.parse(t);
577
- } catch (c) {
578
- if (o)
579
- throw c.name === "SyntaxError" ? m.from(c, m.ERR_BAD_RESPONSE, this, null, this.response) : c;
580
- }
581
- }
582
- return t;
583
- }],
584
- /**
585
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
586
- * timeout is not created.
587
- */
588
- timeout: 0,
589
- xsrfCookieName: "XSRF-TOKEN",
590
- xsrfHeaderName: "X-XSRF-TOKEN",
591
- maxContentLength: -1,
592
- maxBodyLength: -1,
593
- env: {
594
- FormData: O.classes.FormData,
595
- Blob: O.classes.Blob
596
- },
597
- validateStatus: function(t) {
598
- return t >= 200 && t < 300;
599
- },
600
- headers: {
601
- common: {
602
- Accept: "application/json, text/plain, */*"
603
- }
604
- }
605
- };
606
- a.forEach(["delete", "get", "head"], function(t) {
607
- G.headers[t] = {};
608
- });
609
- a.forEach(["post", "put", "patch"], function(t) {
610
- G.headers[t] = a.merge(Kt);
611
- });
612
- const le = G, Xt = a.toObjectSet([
613
- "age",
614
- "authorization",
615
- "content-length",
616
- "content-type",
617
- "etag",
618
- "expires",
619
- "from",
620
- "host",
621
- "if-modified-since",
622
- "if-unmodified-since",
623
- "last-modified",
624
- "location",
625
- "max-forwards",
626
- "proxy-authorization",
627
- "referer",
628
- "retry-after",
629
- "user-agent"
630
- ]), Qt = (e) => {
631
- const t = {};
632
- let n, r, s;
633
- return e && e.split(`
634
- `).forEach(function(o) {
635
- s = o.indexOf(":"), n = o.substring(0, s).trim().toLowerCase(), r = o.substring(s + 1).trim(), !(!n || t[n] && Xt[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
636
- }), t;
637
- }, Te = Symbol("internals");
638
- function L(e) {
639
- return e && String(e).trim().toLowerCase();
640
- }
641
- function H(e) {
642
- return e === !1 || e == null ? e : a.isArray(e) ? e.map(H) : String(e);
643
- }
644
- function Yt(e) {
645
- const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
646
- let r;
647
- for (; r = n.exec(e); )
648
- t[r[1]] = r[2];
649
- return t;
650
- }
651
- function Zt(e) {
652
- return /^[-_a-zA-Z]+$/.test(e.trim());
653
- }
654
- function Y(e, t, n, r, s) {
655
- if (a.isFunction(r))
656
- return r.call(this, t, n);
657
- if (s && (t = n), !!a.isString(t)) {
658
- if (a.isString(r))
659
- return t.indexOf(r) !== -1;
660
- if (a.isRegExp(r))
661
- return r.test(t);
662
- }
663
- }
664
- function en(e) {
665
- return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
666
- }
667
- function tn(e, t) {
668
- const n = a.toCamelCase(" " + t);
669
- ["get", "set", "has"].forEach((r) => {
670
- Object.defineProperty(e, r + n, {
671
- value: function(s, i, o) {
672
- return this[r].call(this, t, s, i, o);
673
- },
674
- configurable: !0
675
- });
676
- });
677
- }
678
- class $ {
679
- constructor(t) {
680
- t && this.set(t);
681
- }
682
- set(t, n, r) {
683
- const s = this;
684
- function i(c, l, u) {
685
- const f = L(l);
686
- if (!f)
687
- throw new Error("header name must be a non-empty string");
688
- const p = a.findKey(s, f);
689
- (!p || s[p] === void 0 || u === !0 || u === void 0 && s[p] !== !1) && (s[p || l] = H(c));
690
- }
691
- const o = (c, l) => a.forEach(c, (u, f) => i(u, f, l));
692
- return a.isPlainObject(t) || t instanceof this.constructor ? o(t, n) : a.isString(t) && (t = t.trim()) && !Zt(t) ? o(Qt(t), n) : t != null && i(n, t, r), this;
693
- }
694
- get(t, n) {
695
- if (t = L(t), t) {
696
- const r = a.findKey(this, t);
697
- if (r) {
698
- const s = this[r];
699
- if (!n)
700
- return s;
701
- if (n === !0)
702
- return Yt(s);
703
- if (a.isFunction(n))
704
- return n.call(this, s, r);
705
- if (a.isRegExp(n))
706
- return n.exec(s);
707
- throw new TypeError("parser must be boolean|regexp|function");
708
- }
709
- }
710
- }
711
- has(t, n) {
712
- if (t = L(t), t) {
713
- const r = a.findKey(this, t);
714
- return !!(r && this[r] !== void 0 && (!n || Y(this, this[r], r, n)));
715
- }
716
- return !1;
717
- }
718
- delete(t, n) {
719
- const r = this;
720
- let s = !1;
721
- function i(o) {
722
- if (o = L(o), o) {
723
- const c = a.findKey(r, o);
724
- c && (!n || Y(r, r[c], c, n)) && (delete r[c], s = !0);
725
- }
726
- }
727
- return a.isArray(t) ? t.forEach(i) : i(t), s;
728
- }
729
- clear(t) {
730
- const n = Object.keys(this);
731
- let r = n.length, s = !1;
732
- for (; r--; ) {
733
- const i = n[r];
734
- (!t || Y(this, this[i], i, t, !0)) && (delete this[i], s = !0);
735
- }
736
- return s;
737
- }
738
- normalize(t) {
739
- const n = this, r = {};
740
- return a.forEach(this, (s, i) => {
741
- const o = a.findKey(r, i);
742
- if (o) {
743
- n[o] = H(s), delete n[i];
744
- return;
745
- }
746
- const c = t ? en(i) : String(i).trim();
747
- c !== i && delete n[i], n[c] = H(s), r[c] = !0;
748
- }), this;
749
- }
750
- concat(...t) {
751
- return this.constructor.concat(this, ...t);
752
- }
753
- toJSON(t) {
754
- const n = /* @__PURE__ */ Object.create(null);
755
- return a.forEach(this, (r, s) => {
756
- r != null && r !== !1 && (n[s] = t && a.isArray(r) ? r.join(", ") : r);
757
- }), n;
758
- }
759
- [Symbol.iterator]() {
760
- return Object.entries(this.toJSON())[Symbol.iterator]();
761
- }
762
- toString() {
763
- return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
764
- `);
765
- }
766
- get [Symbol.toStringTag]() {
767
- return "AxiosHeaders";
768
- }
769
- static from(t) {
770
- return t instanceof this ? t : new this(t);
771
- }
772
- static concat(t, ...n) {
773
- const r = new this(t);
774
- return n.forEach((s) => r.set(s)), r;
775
- }
776
- static accessor(t) {
777
- const r = (this[Te] = this[Te] = {
778
- accessors: {}
779
- }).accessors, s = this.prototype;
780
- function i(o) {
781
- const c = L(o);
782
- r[c] || (tn(s, o), r[c] = !0);
783
- }
784
- return a.isArray(t) ? t.forEach(i) : i(t), this;
785
- }
786
- }
787
- $.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
788
- a.freezeMethods($.prototype);
789
- a.freezeMethods($);
790
- const R = $;
791
- function Z(e, t) {
792
- const n = this || le, r = t || n, s = R.from(r.headers);
793
- let i = r.data;
794
- return a.forEach(e, function(c) {
795
- i = c.call(n, i, s.normalize(), t ? t.status : void 0);
796
- }), s.normalize(), i;
797
- }
798
- function ve(e) {
799
- return !!(e && e.__CANCEL__);
800
- }
801
- function B(e, t, n) {
802
- m.call(this, e == null ? "canceled" : e, m.ERR_CANCELED, t, n), this.name = "CanceledError";
803
- }
804
- a.inherits(B, m, {
805
- __CANCEL__: !0
806
- });
807
- function nn(e, t, n) {
808
- const r = n.config.validateStatus;
809
- !n.status || !r || r(n.status) ? e(n) : t(new m(
810
- "Request failed with status code " + n.status,
811
- [m.ERR_BAD_REQUEST, m.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
812
- n.config,
813
- n.request,
814
- n
815
- ));
816
- }
817
- const rn = O.isStandardBrowserEnv ? (
818
- // Standard browser envs support document.cookie
819
- /* @__PURE__ */ function() {
820
- return {
821
- write: function(n, r, s, i, o, c) {
822
- const l = [];
823
- l.push(n + "=" + encodeURIComponent(r)), a.isNumber(s) && l.push("expires=" + new Date(s).toGMTString()), a.isString(i) && l.push("path=" + i), a.isString(o) && l.push("domain=" + o), c === !0 && l.push("secure"), document.cookie = l.join("; ");
824
- },
825
- read: function(n) {
826
- const r = document.cookie.match(new RegExp("(^|;\\s*)(" + n + ")=([^;]*)"));
827
- return r ? decodeURIComponent(r[3]) : null;
828
- },
829
- remove: function(n) {
830
- this.write(n, "", Date.now() - 864e5);
831
- }
832
- };
833
- }()
834
- ) : (
835
- // Non standard browser env (web workers, react-native) lack needed support.
836
- /* @__PURE__ */ function() {
837
- return {
838
- write: function() {
839
- },
840
- read: function() {
41
+ return null;
42
+ const [i, a, r, h] = t, n = i / 255, b = a / 255, l = r / 255, p = Math.max(n, b, l), o = Math.min(n, b, l);
43
+ return (p + o) / 2 < 0.5;
44
+ }, x = (e, s, t = 100) => {
45
+ const i = (n) => {
46
+ let b, l, p, o = 1;
47
+ if (n.startsWith("#"))
48
+ if (n = n.slice(1), n.length === 3)
49
+ b = parseInt(n[0] + n[0], 16), l = parseInt(n[1] + n[1], 16), p = parseInt(n[2] + n[2], 16);
50
+ else if (n.length === 6)
51
+ b = parseInt(n.slice(0, 2), 16), l = parseInt(n.slice(2, 4), 16), p = parseInt(n.slice(4, 6), 16);
52
+ else
841
53
  return null;
842
- },
843
- remove: function() {
844
- }
845
- };
846
- }()
847
- );
848
- function sn(e) {
849
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
850
- }
851
- function on(e, t) {
852
- return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e;
853
- }
854
- function Ke(e, t) {
855
- return e && !sn(t) ? on(e, t) : t;
856
- }
857
- const an = O.isStandardBrowserEnv ? (
858
- // Standard browser envs have full support of the APIs needed to test
859
- // whether the request URL is of the same origin as current location.
860
- function() {
861
- const t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a");
862
- let r;
863
- function s(i) {
864
- let o = i;
865
- return t && (n.setAttribute("href", o), o = n.href), n.setAttribute("href", o), {
866
- href: n.href,
867
- protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
868
- host: n.host,
869
- search: n.search ? n.search.replace(/^\?/, "") : "",
870
- hash: n.hash ? n.hash.replace(/^#/, "") : "",
871
- hostname: n.hostname,
872
- port: n.port,
873
- pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname
874
- };
875
- }
876
- return r = s(window.location.href), function(o) {
877
- const c = a.isString(o) ? s(o) : o;
878
- return c.protocol === r.protocol && c.host === r.host;
879
- };
880
- }()
881
- ) : (
882
- // Non standard browser envs (web workers, react-native) lack needed support.
883
- /* @__PURE__ */ function() {
884
- return function() {
885
- return !0;
886
- };
887
- }()
888
- );
889
- function cn(e) {
890
- const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
891
- return t && t[1] || "";
892
- }
893
- function un(e, t) {
894
- e = e || 10;
895
- const n = new Array(e), r = new Array(e);
896
- let s = 0, i = 0, o;
897
- return t = t !== void 0 ? t : 1e3, function(l) {
898
- const u = Date.now(), f = r[i];
899
- o || (o = u), n[s] = l, r[s] = u;
900
- let p = i, E = 0;
901
- for (; p !== s; )
902
- E += n[p++], p = p % e;
903
- if (s = (s + 1) % e, s === i && (i = (i + 1) % e), u - o < t)
904
- return;
905
- const y = f && u - f;
906
- return y ? Math.round(E * 1e3 / y) : void 0;
907
- };
908
- }
909
- function Ne(e, t) {
910
- let n = 0;
911
- const r = un(50, 250);
912
- return (s) => {
913
- const i = s.loaded, o = s.lengthComputable ? s.total : void 0, c = i - n, l = r(c), u = i <= o;
914
- n = i;
915
- const f = {
916
- loaded: i,
917
- total: o,
918
- progress: o ? i / o : void 0,
919
- bytes: c,
920
- rate: l || void 0,
921
- estimated: l && o && u ? (o - i) / l : void 0,
922
- event: s
923
- };
924
- f[t ? "download" : "upload"] = !0, e(f);
925
- };
926
- }
927
- const ln = typeof XMLHttpRequest != "undefined", fn = ln && function(e) {
928
- return new Promise(function(n, r) {
929
- let s = e.data;
930
- const i = R.from(e.headers).normalize(), o = e.responseType;
931
- let c;
932
- function l() {
933
- e.cancelToken && e.cancelToken.unsubscribe(c), e.signal && e.signal.removeEventListener("abort", c);
934
- }
935
- a.isFormData(s) && (O.isStandardBrowserEnv || O.isStandardBrowserWebWorkerEnv) && i.setContentType(!1);
936
- let u = new XMLHttpRequest();
937
- if (e.auth) {
938
- const y = e.auth.username || "", d = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
939
- i.set("Authorization", "Basic " + btoa(y + ":" + d));
940
- }
941
- const f = Ke(e.baseURL, e.url);
942
- u.open(e.method.toUpperCase(), Ve(f, e.params, e.paramsSerializer), !0), u.timeout = e.timeout;
943
- function p() {
944
- if (!u)
945
- return;
946
- const y = R.from(
947
- "getAllResponseHeaders" in u && u.getAllResponseHeaders()
948
- ), h = {
949
- data: !o || o === "text" || o === "json" ? u.responseText : u.response,
950
- status: u.status,
951
- statusText: u.statusText,
952
- headers: y,
953
- config: e,
954
- request: u
955
- };
956
- nn(function(b) {
957
- n(b), l();
958
- }, function(b) {
959
- r(b), l();
960
- }, h), u = null;
961
- }
962
- if ("onloadend" in u ? u.onloadend = p : u.onreadystatechange = function() {
963
- !u || u.readyState !== 4 || u.status === 0 && !(u.responseURL && u.responseURL.indexOf("file:") === 0) || setTimeout(p);
964
- }, u.onabort = function() {
965
- u && (r(new m("Request aborted", m.ECONNABORTED, e, u)), u = null);
966
- }, u.onerror = function() {
967
- r(new m("Network Error", m.ERR_NETWORK, e, u)), u = null;
968
- }, u.ontimeout = function() {
969
- let d = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
970
- const h = e.transitional || Ge;
971
- e.timeoutErrorMessage && (d = e.timeoutErrorMessage), r(new m(
972
- d,
973
- h.clarifyTimeoutError ? m.ETIMEDOUT : m.ECONNABORTED,
974
- e,
975
- u
976
- )), u = null;
977
- }, O.isStandardBrowserEnv) {
978
- const y = (e.withCredentials || an(f)) && e.xsrfCookieName && rn.read(e.xsrfCookieName);
979
- y && i.set(e.xsrfHeaderName, y);
980
- }
981
- s === void 0 && i.setContentType(null), "setRequestHeader" in u && a.forEach(i.toJSON(), function(d, h) {
982
- u.setRequestHeader(h, d);
983
- }), a.isUndefined(e.withCredentials) || (u.withCredentials = !!e.withCredentials), o && o !== "json" && (u.responseType = e.responseType), typeof e.onDownloadProgress == "function" && u.addEventListener("progress", Ne(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && u.upload && u.upload.addEventListener("progress", Ne(e.onUploadProgress)), (e.cancelToken || e.signal) && (c = (y) => {
984
- u && (r(!y || y.type ? new B(null, e, u) : y), u.abort(), u = null);
985
- }, e.cancelToken && e.cancelToken.subscribe(c), e.signal && (e.signal.aborted ? c() : e.signal.addEventListener("abort", c)));
986
- const E = cn(f);
987
- if (E && O.protocols.indexOf(E) === -1) {
988
- r(new m("Unsupported protocol " + E + ":", m.ERR_BAD_REQUEST, e));
989
- return;
990
- }
991
- u.send(s || null);
992
- });
993
- }, M = {
994
- http: It,
995
- xhr: fn
996
- };
997
- a.forEach(M, (e, t) => {
998
- if (e) {
999
- try {
1000
- Object.defineProperty(e, "name", { value: t });
1001
- } catch (n) {
1002
- }
1003
- Object.defineProperty(e, "adapterName", { value: t });
1004
- }
1005
- });
1006
- const dn = {
1007
- getAdapter: (e) => {
1008
- e = a.isArray(e) ? e : [e];
1009
- const { length: t } = e;
1010
- let n, r;
1011
- for (let s = 0; s < t && (n = e[s], !(r = a.isString(n) ? M[n.toLowerCase()] : n)); s++)
1012
- ;
1013
- if (!r)
1014
- throw r === !1 ? new m(
1015
- `Adapter ${n} is not supported by the environment`,
1016
- "ERR_NOT_SUPPORT"
1017
- ) : new Error(
1018
- a.hasOwnProp(M, n) ? `Adapter '${n}' is not available in the build` : `Unknown adapter '${n}'`
1019
- );
1020
- if (!a.isFunction(r))
1021
- throw new TypeError("adapter is not a function");
1022
- return r;
1023
- },
1024
- adapters: M
1025
- };
1026
- function ee(e) {
1027
- if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1028
- throw new B(null, e);
1029
- }
1030
- function Pe(e) {
1031
- return ee(e), e.headers = R.from(e.headers), e.data = Z.call(
1032
- e,
1033
- e.transformRequest
1034
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), dn.getAdapter(e.adapter || le.adapter)(e).then(function(r) {
1035
- return ee(e), r.data = Z.call(
1036
- e,
1037
- e.transformResponse,
1038
- r
1039
- ), r.headers = R.from(r.headers), r;
1040
- }, function(r) {
1041
- return ve(r) || (ee(e), r && r.response && (r.response.data = Z.call(
1042
- e,
1043
- e.transformResponse,
1044
- r.response
1045
- ), r.response.headers = R.from(r.response.headers))), Promise.reject(r);
1046
- });
1047
- }
1048
- const xe = (e) => e instanceof R ? e.toJSON() : e;
1049
- function x(e, t) {
1050
- t = t || {};
1051
- const n = {};
1052
- function r(u, f, p) {
1053
- return a.isPlainObject(u) && a.isPlainObject(f) ? a.merge.call({ caseless: p }, u, f) : a.isPlainObject(f) ? a.merge({}, f) : a.isArray(f) ? f.slice() : f;
1054
- }
1055
- function s(u, f, p) {
1056
- if (a.isUndefined(f)) {
1057
- if (!a.isUndefined(u))
1058
- return r(void 0, u, p);
54
+ else if (n.startsWith("rgb")) {
55
+ const c = n.match(/(\d+(\.\d+)?)/g);
56
+ b = parseFloat(c[0]), l = parseFloat(c[1]), p = parseFloat(c[2]), c.length > 3 && (o = parseFloat(c[3]));
1059
57
  } else
1060
- return r(u, f, p);
1061
- }
1062
- function i(u, f) {
1063
- if (!a.isUndefined(f))
1064
- return r(void 0, f);
1065
- }
1066
- function o(u, f) {
1067
- if (a.isUndefined(f)) {
1068
- if (!a.isUndefined(u))
1069
- return r(void 0, u);
58
+ return null;
59
+ return [b, l, p, o];
60
+ }, a = i(e), r = i(s);
61
+ return !a || !r ? !1 : Math.sqrt(
62
+ Math.pow(a[0] - r[0], 2) + Math.pow(a[1] - r[1], 2) + Math.pow(a[2] - r[2], 2) + Math.pow(a[3] - r[3], 2)
63
+ ) <= t;
64
+ }, L = (e, s) => {
65
+ function t(r) {
66
+ if (r.toLowerCase().startsWith("rgba"))
67
+ return r.toLowerCase();
68
+ if (r.toLowerCase().startsWith("rgb"))
69
+ return r.replace("rgb", "rgba").replace(")", ", 1)");
70
+ if (r.length === 7) {
71
+ const h = parseInt(r.substring(1, 3), 16), n = parseInt(r.substring(3, 5), 16), b = parseInt(r.substring(5, 7), 16);
72
+ return `rgba(${h}, ${n}, ${b}, 1)`;
73
+ } else if (r.length === 9 && r.toLowerCase().startsWith("rrggbbaa")) {
74
+ const h = parseInt(r.substring(1, 3), 16), n = parseInt(r.substring(3, 5), 16), b = parseInt(r.substring(5, 7), 16), l = Math.round(parseInt(r.substring(7, 9), 16) / 255 * 100) / 100;
75
+ return `rgba(${h}, ${n}, ${b}, ${l})`;
1070
76
  } else
1071
- return r(void 0, f);
1072
- }
1073
- function c(u, f, p) {
1074
- if (p in t)
1075
- return r(u, f);
1076
- if (p in e)
1077
- return r(void 0, u);
1078
- }
1079
- const l = {
1080
- url: i,
1081
- method: i,
1082
- data: i,
1083
- baseURL: o,
1084
- transformRequest: o,
1085
- transformResponse: o,
1086
- paramsSerializer: o,
1087
- timeout: o,
1088
- timeoutMessage: o,
1089
- withCredentials: o,
1090
- adapter: o,
1091
- responseType: o,
1092
- xsrfCookieName: o,
1093
- xsrfHeaderName: o,
1094
- onUploadProgress: o,
1095
- onDownloadProgress: o,
1096
- decompress: o,
1097
- maxContentLength: o,
1098
- maxBodyLength: o,
1099
- beforeRedirect: o,
1100
- transport: o,
1101
- httpAgent: o,
1102
- httpsAgent: o,
1103
- cancelToken: o,
1104
- socketPath: o,
1105
- responseEncoding: o,
1106
- validateStatus: c,
1107
- headers: (u, f) => s(xe(u), xe(f), !0)
1108
- };
1109
- return a.forEach(Object.keys(e).concat(Object.keys(t)), function(f) {
1110
- const p = l[f] || s, E = p(e[f], t[f], f);
1111
- a.isUndefined(E) && p !== c || (n[f] = E);
1112
- }), n;
1113
- }
1114
- const We = "1.3.3", fe = {};
1115
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1116
- fe[e] = function(r) {
1117
- return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1118
- };
1119
- });
1120
- const Ce = {};
1121
- fe.transitional = function(t, n, r) {
1122
- function s(i, o) {
1123
- return "[Axios v" + We + "] Transitional option '" + i + "'" + o + (r ? ". " + r : "");
1124
- }
1125
- return (i, o, c) => {
1126
- if (t === !1)
1127
- throw new m(
1128
- s(o, " has been removed" + (n ? " in " + n : "")),
1129
- m.ERR_DEPRECATED
1130
- );
1131
- return n && !Ce[o] && (Ce[o] = !0, console.warn(
1132
- s(
1133
- o,
1134
- " has been deprecated since v" + n + " and will be removed in the near future"
1135
- )
1136
- )), t ? t(i, o, c) : !0;
1137
- };
77
+ return null;
78
+ }
79
+ const i = t(M(e)), a = t(M(s));
80
+ return !i || !a ? !1 : i === a;
81
+ }, M = (e) => {
82
+ if (e.length === 4 && e[0] === "#") {
83
+ const s = e[1], t = e[2], i = e[3];
84
+ return `#${s}${s}${t}${t}${i}${i}`;
85
+ } else
86
+ return e;
1138
87
  };
1139
- function pn(e, t, n) {
1140
- if (typeof e != "object")
1141
- throw new m("options must be an object", m.ERR_BAD_OPTION_VALUE);
1142
- const r = Object.keys(e);
1143
- let s = r.length;
1144
- for (; s-- > 0; ) {
1145
- const i = r[s], o = t[i];
1146
- if (o) {
1147
- const c = e[i], l = c === void 0 || o(c, i, e);
1148
- if (l !== !0)
1149
- throw new m("option " + i + " must be " + l, m.ERR_BAD_OPTION_VALUE);
1150
- continue;
1151
- }
1152
- if (n !== !0)
1153
- throw new m("Unknown option " + i, m.ERR_BAD_OPTION);
88
+ class v {
89
+ constructor() {
90
+ m(this, "subscribers");
91
+ this.subscribers = {};
1154
92
  }
1155
- }
1156
- const re = {
1157
- assertOptions: pn,
1158
- validators: fe
1159
- }, T = re.validators;
1160
- class J {
1161
- constructor(t) {
1162
- this.defaults = t, this.interceptors = {
1163
- request: new Ae(),
1164
- response: new Ae()
1165
- };
93
+ subscribe(s, t) {
94
+ this.subscribers[s] || (this.subscribers[s] = []), this.subscribers[s].push(t);
1166
95
  }
1167
- /**
1168
- * Dispatch a request
1169
- *
1170
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1171
- * @param {?Object} config
1172
- *
1173
- * @returns {Promise} The Promise to be fulfilled
1174
- */
1175
- request(t, n) {
1176
- typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = x(this.defaults, n);
1177
- const { transitional: r, paramsSerializer: s, headers: i } = n;
1178
- r !== void 0 && re.assertOptions(r, {
1179
- silentJSONParsing: T.transitional(T.boolean),
1180
- forcedJSONParsing: T.transitional(T.boolean),
1181
- clarifyTimeoutError: T.transitional(T.boolean)
1182
- }, !1), s !== void 0 && re.assertOptions(s, {
1183
- encode: T.function,
1184
- serialize: T.function
1185
- }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1186
- let o;
1187
- o = i && a.merge(
1188
- i.common,
1189
- i[n.method]
1190
- ), o && a.forEach(
1191
- ["delete", "get", "head", "post", "put", "patch", "common"],
1192
- (d) => {
1193
- delete i[d];
1194
- }
1195
- ), n.headers = R.concat(o, i);
1196
- const c = [];
1197
- let l = !0;
1198
- this.interceptors.request.forEach(function(h) {
1199
- typeof h.runWhen == "function" && h.runWhen(n) === !1 || (l = l && h.synchronous, c.unshift(h.fulfilled, h.rejected));
1200
- });
1201
- const u = [];
1202
- this.interceptors.response.forEach(function(h) {
1203
- u.push(h.fulfilled, h.rejected);
1204
- });
1205
- let f, p = 0, E;
1206
- if (!l) {
1207
- const d = [Pe.bind(this), void 0];
1208
- for (d.unshift.apply(d, c), d.push.apply(d, u), E = d.length, f = Promise.resolve(n); p < E; )
1209
- f = f.then(d[p++], d[p++]);
1210
- return f;
1211
- }
1212
- E = c.length;
1213
- let y = n;
1214
- for (p = 0; p < E; ) {
1215
- const d = c[p++], h = c[p++];
1216
- try {
1217
- y = d(y);
1218
- } catch (g) {
1219
- h.call(this, g);
1220
- break;
1221
- }
1222
- }
1223
- try {
1224
- f = Pe.call(this, y);
1225
- } catch (d) {
1226
- return Promise.reject(d);
96
+ unsubscribe(s, t) {
97
+ const i = this.subscribers[s];
98
+ if (!t)
99
+ return this.subscribers[s] = [];
100
+ if (i) {
101
+ const a = i.indexOf(t);
102
+ a !== -1 && i.splice(a, 1);
1227
103
  }
1228
- for (p = 0, E = u.length; p < E; )
1229
- f = f.then(u[p++], u[p++]);
1230
- return f;
1231
104
  }
1232
- getUri(t) {
1233
- t = x(this.defaults, t);
1234
- const n = Ke(t.baseURL, t.url);
1235
- return Ve(n, t.params, t.paramsSerializer);
1236
- }
1237
- }
1238
- a.forEach(["delete", "get", "head", "options"], function(t) {
1239
- J.prototype[t] = function(n, r) {
1240
- return this.request(x(r || {}, {
1241
- method: t,
1242
- url: n,
1243
- data: (r || {}).data
1244
- }));
1245
- };
1246
- });
1247
- a.forEach(["post", "put", "patch"], function(t) {
1248
- function n(r) {
1249
- return function(i, o, c) {
1250
- return this.request(x(c || {}, {
1251
- method: t,
1252
- headers: r ? {
1253
- "Content-Type": "multipart/form-data"
1254
- } : {},
1255
- url: i,
1256
- data: o
1257
- }));
1258
- };
1259
- }
1260
- J.prototype[t] = n(), J.prototype[t + "Form"] = n(!0);
1261
- });
1262
- const q = J;
1263
- class de {
1264
- constructor(t) {
1265
- if (typeof t != "function")
1266
- throw new TypeError("executor must be a function.");
1267
- let n;
1268
- this.promise = new Promise(function(i) {
1269
- n = i;
1270
- });
1271
- const r = this;
1272
- this.promise.then((s) => {
1273
- if (!r._listeners)
1274
- return;
1275
- let i = r._listeners.length;
1276
- for (; i-- > 0; )
1277
- r._listeners[i](s);
1278
- r._listeners = null;
1279
- }), this.promise.then = (s) => {
1280
- let i;
1281
- const o = new Promise((c) => {
1282
- r.subscribe(c), i = c;
1283
- }).then(s);
1284
- return o.cancel = function() {
1285
- r.unsubscribe(i);
1286
- }, o;
1287
- }, t(function(i, o, c) {
1288
- r.reason || (r.reason = new B(i, o, c), n(r.reason));
105
+ publish(s) {
106
+ const t = this.subscribers[s.type];
107
+ t && t.forEach((i) => {
108
+ i(s.data);
1289
109
  });
1290
110
  }
1291
- /**
1292
- * Throws a `CanceledError` if cancellation has been requested.
1293
- */
1294
- throwIfRequested() {
1295
- if (this.reason)
1296
- throw this.reason;
1297
- }
1298
- /**
1299
- * Subscribe to the cancel signal
1300
- */
1301
- subscribe(t) {
1302
- if (this.reason) {
1303
- t(this.reason);
1304
- return;
1305
- }
1306
- this._listeners ? this._listeners.push(t) : this._listeners = [t];
1307
- }
1308
- /**
1309
- * Unsubscribe from the cancel signal
1310
- */
1311
- unsubscribe(t) {
1312
- if (!this._listeners)
1313
- return;
1314
- const n = this._listeners.indexOf(t);
1315
- n !== -1 && this._listeners.splice(n, 1);
1316
- }
1317
- /**
1318
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1319
- * cancels the `CancelToken`.
1320
- */
1321
- static source() {
1322
- let t;
1323
- return {
1324
- token: new de(function(s) {
1325
- t = s;
1326
- }),
1327
- cancel: t
1328
- };
1329
- }
1330
111
  }
1331
- const hn = de;
1332
- function mn(e) {
1333
- return function(n) {
1334
- return e.apply(null, n);
1335
- };
1336
- }
1337
- function yn(e) {
1338
- return a.isObject(e) && e.isAxiosError === !0;
1339
- }
1340
- const se = {
1341
- Continue: 100,
1342
- SwitchingProtocols: 101,
1343
- Processing: 102,
1344
- EarlyHints: 103,
1345
- Ok: 200,
1346
- Created: 201,
1347
- Accepted: 202,
1348
- NonAuthoritativeInformation: 203,
1349
- NoContent: 204,
1350
- ResetContent: 205,
1351
- PartialContent: 206,
1352
- MultiStatus: 207,
1353
- AlreadyReported: 208,
1354
- ImUsed: 226,
1355
- MultipleChoices: 300,
1356
- MovedPermanently: 301,
1357
- Found: 302,
1358
- SeeOther: 303,
1359
- NotModified: 304,
1360
- UseProxy: 305,
1361
- Unused: 306,
1362
- TemporaryRedirect: 307,
1363
- PermanentRedirect: 308,
1364
- BadRequest: 400,
1365
- Unauthorized: 401,
1366
- PaymentRequired: 402,
1367
- Forbidden: 403,
1368
- NotFound: 404,
1369
- MethodNotAllowed: 405,
1370
- NotAcceptable: 406,
1371
- ProxyAuthenticationRequired: 407,
1372
- RequestTimeout: 408,
1373
- Conflict: 409,
1374
- Gone: 410,
1375
- LengthRequired: 411,
1376
- PreconditionFailed: 412,
1377
- PayloadTooLarge: 413,
1378
- UriTooLong: 414,
1379
- UnsupportedMediaType: 415,
1380
- RangeNotSatisfiable: 416,
1381
- ExpectationFailed: 417,
1382
- ImATeapot: 418,
1383
- MisdirectedRequest: 421,
1384
- UnprocessableEntity: 422,
1385
- Locked: 423,
1386
- FailedDependency: 424,
1387
- TooEarly: 425,
1388
- UpgradeRequired: 426,
1389
- PreconditionRequired: 428,
1390
- TooManyRequests: 429,
1391
- RequestHeaderFieldsTooLarge: 431,
1392
- UnavailableForLegalReasons: 451,
1393
- InternalServerError: 500,
1394
- NotImplemented: 501,
1395
- BadGateway: 502,
1396
- ServiceUnavailable: 503,
1397
- GatewayTimeout: 504,
1398
- HttpVersionNotSupported: 505,
1399
- VariantAlsoNegotiates: 506,
1400
- InsufficientStorage: 507,
1401
- LoopDetected: 508,
1402
- NotExtended: 510,
1403
- NetworkAuthenticationRequired: 511
1404
- };
1405
- Object.entries(se).forEach(([e, t]) => {
1406
- se[t] = e;
1407
- });
1408
- const wn = se;
1409
- function Xe(e) {
1410
- const t = new q(e), n = Ue(q.prototype.request, t);
1411
- return a.extend(n, q.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1412
- return Xe(x(e, s));
1413
- }, n;
1414
- }
1415
- const w = Xe(le);
1416
- w.Axios = q;
1417
- w.CanceledError = B;
1418
- w.CancelToken = hn;
1419
- w.isCancel = ve;
1420
- w.VERSION = We;
1421
- w.toFormData = V;
1422
- w.AxiosError = m;
1423
- w.Cancel = w.CanceledError;
1424
- w.all = function(t) {
1425
- return Promise.all(t);
1426
- };
1427
- w.spread = mn;
1428
- w.isAxiosError = yn;
1429
- w.mergeConfig = x;
1430
- w.AxiosHeaders = R;
1431
- w.formToJSON = (e) => $e(a.isHTMLForm(e) ? new FormData(e) : e);
1432
- w.HttpStatusCode = wn;
1433
- w.default = w;
1434
- const En = {
1435
- LOGIN_URL: `${window.location.origin}/ttc/cloud/#/login`,
1436
- HOME_URL: `${window.location.origin}/ttc/cloud/#/cloud`,
1437
- INTEGRATED_BASE_URL: "/gateway/integrated-management/api/v1"
1438
- }, Qe = {
1439
- ttc: En
1440
- }, Sn = (e = "ttc") => ye.get(`${Qe[e].INTEGRATED_BASE_URL}/account/auth/route/list`), bn = (e = "ttc") => ye.get(`${Qe[e].INTEGRATED_BASE_URL}/account/home/menu`), pe = (e = "ttc") => {
1441
- me({ token: "" });
1442
- }, v = (e = "ttc") => {
1443
- var s;
1444
- const t = `${e}GlobalState`, n = (s = localStorage.getItem(t)) != null ? s : "{}";
1445
- return JSON.parse(n) ? JSON.parse(n).token : null;
1446
- }, Ye = (r, ...s) => I(void 0, [r, ...s], function* ({ userName: e, password: t }, n = "ttc") {
1447
- const i = W("loginApiUrl"), { data: o } = yield ye.post(i, { userName: e, password: t });
1448
- o.tokenValue && S.success("登录成功"), me({ token: o.tokenValue, userInfo: o });
1449
- }), On = (e = "ttc") => {
1450
- var s;
1451
- const t = `${e}GlobalState`, n = (s = localStorage.getItem(t)) != null ? s : "{}";
1452
- return JSON.parse(n) ? JSON.parse(n).userInfo : null;
1453
- }, gn = () => I(void 0, null, function* () {
1454
- return v() ? yield bn() : [];
1455
- }), K = () => {
1456
- if (Ze())
1457
- pe(), window.location.replace(he());
1458
- else {
1459
- console.log("开发环境!!!");
1460
- const e = window.prompt("当前系统处于开发环境,当前登录过期,请输入登录账号", "");
1461
- if (e !== null) {
1462
- const t = window.prompt("请输入登录密码", "");
1463
- (t === null || t == "") && window.prompt("请输入登录密码", ""), Ye({ userName: e, password: t });
1464
- }
1465
- }
1466
- }, Rn = () => {
1467
- window.location.replace(he());
1468
- }, he = () => W("homeUrl"), me = (e) => {
1469
- var r;
1470
- const t = (r = localStorage.getItem("ttcGlobalState")) != null ? r : "{}", n = k(k({}, JSON.parse(t)), e);
1471
- localStorage.setItem("ttcGlobalState", JSON.stringify(n));
1472
- }, W = (e) => {
1473
- var n, r;
1474
- return (r = JSON.parse((n = localStorage.getItem("ttcGlobalState")) != null ? n : "{}")[e]) != null ? r : "";
1475
- }, Ze = () => W("environment") === "production", An = (e, t = !0, n) => I(void 0, null, function* () {
1476
- if (!v() && t)
1477
- return K();
1478
- try {
1479
- const { data: r } = yield Sn(n), s = r.filter((c) => c.routeTag.includes(e)), i = s.filter((c) => c.routeType === "VIEW"), o = s.filter((c) => c.routeType === "BTN");
1480
- return sessionStorage.setItem("ttcUserBtnList", JSON.stringify(o.map((c) => c.routeTag))), {
1481
- userMenuList: i,
1482
- userBtnList: o
1483
- };
1484
- } catch (r) {
1485
- }
1486
- }), Tn = (e, t, n) => {
1487
- let r = [];
1488
- return e.forEach((s) => {
1489
- const i = `/src/views${s.routeView}/config.ts`, o = `/src/views${s.routeView}/index.vue`;
1490
- if (t[o] && n[i]) {
1491
- const c = n[i], l = {
1492
- path: s.routeView,
1493
- name: s.routeView.split("/")[1],
1494
- meta: {
1495
- title: c.title,
1496
- icon: c.icon
1497
- },
1498
- component: t[o]
1499
- };
1500
- r.push(l);
1501
- }
1502
- }), r;
1503
- }, Nn = (e) => {
1504
- var n;
1505
- if (!e)
1506
- return !1;
1507
- const t = (n = sessionStorage.getItem("ttcUserBtnList")) != null ? n : "[]";
1508
- return JSON.parse(t).includes(e);
1509
- }, kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
112
+ const z = new v(), T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1510
113
  __proto__: null,
1511
- autoLogin: Ye,
1512
- getHomeUrl: he,
1513
- getSystemConfig: W,
1514
- getToken: v,
1515
- getUserInfo: On,
1516
- getUserIsHaveBtnPower: Nn,
1517
- getUserPermissions: An,
1518
- getUserRouteList: gn,
1519
- getUserRouter: Tn,
1520
- isProduction: Ze,
1521
- jumpToHome: Rn,
1522
- jumpToLogin: K,
1523
- removeToken: pe,
1524
- setSystemConfig: me
114
+ areColorsSimilar: x,
115
+ enumToArray: W,
116
+ getSelectOptions: F,
117
+ http: y,
118
+ isColorEqual: L,
119
+ isDarkColor: _,
120
+ notifyMessageToSystems: S,
121
+ receiveMessage: B,
122
+ yxSubscribe: z
1525
123
  }, Symbol.toStringTag, { value: "Module" }));
1526
- let et;
1527
- const Pn = {
1528
- lock: !0,
1529
- text: "加载中...",
1530
- fullscreen: !0,
1531
- background: "rgba(0, 0, 0, 0.6)"
1532
- }, xn = () => {
1533
- et = ot.service(Pn);
1534
- }, Cn = () => {
1535
- et.close();
1536
- };
1537
- let U = 0;
1538
- const Ln = () => {
1539
- U === 0 && xn(), U++;
1540
- }, Le = () => {
1541
- U <= 0 || (U--, U === 0 && Cn());
1542
- };
1543
- var oe = /* @__PURE__ */ ((e) => (e[e.SUCCESS = 200] = "SUCCESS", e[e.ERROR = 500] = "ERROR", e[e.OVERDUE = 401] = "OVERDUE", e[e.TIMEOUT = 3e4] = "TIMEOUT", e))(oe || {});
1544
- const Un = {
1545
- // 默认地址请求地址,可在 .env.*** 文件中修改
1546
- // 设置超时时间(30s)
1547
- timeout: 3e4,
1548
- // 跨域时候允许携带凭证
1549
- withCredentials: !0
1550
- }, _n = (e, t) => {
1551
- switch (e) {
1552
- case 400:
1553
- S.error(t || "请求失败!请您稍后重试");
1554
- break;
1555
- case 401:
1556
- S.error(t || "登录失效!请您重新登录"), K();
1557
- break;
1558
- case 403:
1559
- S.error(t || "当前账号无权限访问!");
1560
- break;
1561
- case 404:
1562
- S.error("你所访问的资源不存在!");
1563
- break;
1564
- case 405:
1565
- S.error(t || "请求方式错误!请您稍后重试");
1566
- break;
1567
- case 408:
1568
- S.error(t || "请求超时!请您稍后重试");
1569
- break;
1570
- case 500:
1571
- S.error(t || "服务异常!");
1572
- break;
1573
- case 502:
1574
- S.error("网关错误!");
1575
- break;
1576
- case 503:
1577
- S.error("服务不可用!");
1578
- break;
1579
- case 504:
1580
- S.error("网关超时!");
1581
- break;
1582
- default:
1583
- S.error("请求失败!");
1584
- }
1585
- };
1586
- class Fn {
1587
- constructor(t) {
1588
- Ee(this, "service");
1589
- this.service = w.create(t), this.setupInterceptors();
1590
- }
1591
- setupInterceptors() {
1592
- this.service.interceptors.request.use(
1593
- (t) => {
1594
- var n;
1595
- return (n = t.headers) != null && n.noLoading || Ln(), t.headers.token = v(), t;
1596
- },
1597
- (t) => Promise.reject(t)
1598
- ), this.service.interceptors.response.use(
1599
- (t) => {
1600
- const { data: n } = t;
1601
- return Le(), n.code == oe.OVERDUE ? this.handleOverdueResponse(n) : n.code !== oe.SUCCESS && this.handleErrorResponse(n), n;
1602
- },
1603
- (t) => (Le(), t.message.includes("timeout") ? S.error("请求超时!请稍后重试") : t.message.includes("Network Error") && S.error("网络错误!请稍后重试"), t.response && _n(t.response.status), window.navigator.onLine || Se({
1604
- title: "提示",
1605
- message: "当前网络似乎开小差了",
1606
- type: "warning",
1607
- duration: 5e3
1608
- }), Promise.reject(t))
1609
- );
1610
- }
1611
- handleOverdueResponse(t) {
1612
- return pe(), K(), Se({
1613
- title: "登录过期提醒",
1614
- message: t.resultMsg || "当前登录失效",
1615
- type: "warning",
1616
- duration: 5e3
1617
- }), Promise.reject(t);
1618
- }
1619
- handleErrorResponse(t) {
1620
- return S.error(t.resultMsg), Promise.reject(t);
1621
- }
1622
- /**
1623
- *
1624
- * @param url
1625
- * @param params
1626
- * @param options : AxiosRequestConfig
1627
- * @description get 请求
1628
- */
1629
- get(t, n, r = {}) {
1630
- return this.service.get(t, k({ params: n }, r));
1631
- }
1632
- /**
1633
- *
1634
- * @param url
1635
- * @param params
1636
- * @param options : AxiosRequestConfig
1637
- * @description post 请求
1638
- */
1639
- post(t, n, r = {}) {
1640
- return this.service.post(t, n, r);
1641
- }
1642
- /**
1643
- *
1644
- * @param url
1645
- * @param params
1646
- * @param options : AxiosRequestConfig
1647
- */
1648
- put(t, n, r = {}) {
1649
- return this.service.put(t, n, r);
1650
- }
1651
- /**
1652
- *
1653
- * @param url
1654
- * @param params
1655
- * @param options : AxiosRequestConfig
1656
- */
1657
- delete(t, n, r = {}) {
1658
- return this.service.delete(t, n, r);
1659
- }
1660
- }
1661
- const ye = new Fn(Un);
1662
124
  export {
1663
- Qe as U,
1664
- W as a,
1665
- w as b,
1666
- Nn as g,
1667
- ye as h,
1668
- kn as i,
1669
- me as s
125
+ _ as a,
126
+ x as b,
127
+ W as e,
128
+ F as g,
129
+ L as i,
130
+ S as n,
131
+ B as r,
132
+ T as u,
133
+ z as y
1670
134
  };