@flyfish-group/file-viewer3 1.0.4 → 1.0.6

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 (81) hide show
  1. package/LICENSE +160 -0
  2. package/README.md +119 -98
  3. package/dist/components/CadViewer.js +1 -0
  4. package/dist/components/CodeViewer.js +1 -0
  5. package/dist/components/ImageViewer.js +1 -1950
  6. package/dist/components/MarkdownViewer.js +1 -1468
  7. package/dist/components/OfdViewer.js +1 -0
  8. package/dist/components/PdfView.js +1 -22630
  9. package/dist/components/PptxRender.js +1 -21748
  10. package/dist/components/XlsxTable.js +1 -53804
  11. package/dist/components/_plugin-vue_export-helper.js +1 -0
  12. package/dist/components/asyncToGenerator.js +1 -0
  13. package/dist/components/chunk.js +1 -0
  14. package/dist/components/dist.js +1 -0
  15. package/dist/components/docx-preview.js +1 -5622
  16. package/dist/components/jszip.min.js +1 -0
  17. package/dist/components/objectSpread2.js +1 -0
  18. package/dist/components/ofd.js +1 -0
  19. package/dist/components/use.js +1 -0
  20. package/dist/components/worker-ref.js +1 -21
  21. package/dist/components/wrapAsyncGenerator.js +1 -0
  22. package/dist/file-viewer3.css +2 -0
  23. package/dist/index.mjs +1 -6
  24. package/dist/index.umd.js +1 -247
  25. package/dist/src/components/utils.d.ts +3 -0
  26. package/dist/src/main.d.ts +0 -0
  27. package/dist/src/package/common/type.d.ts +30 -0
  28. package/dist/src/package/common/util.d.ts +5 -0
  29. package/dist/src/package/common/worker-ref.d.ts +12 -0
  30. package/dist/src/package/components/FileViewer/FileViewer.vue.d.ts +8 -0
  31. package/dist/src/package/components/FileViewer/index.d.ts +2 -0
  32. package/dist/src/package/components/FileViewer/util.d.ts +2 -0
  33. package/dist/src/package/index.d.ts +15 -3
  34. package/dist/src/package/use/index.d.ts +2 -0
  35. package/dist/src/package/use/loading.d.ts +33 -0
  36. package/dist/src/package/use/worker.d.ts +24 -0
  37. package/dist/src/package/vendors/cad/CadViewer.vue.d.ts +7 -0
  38. package/dist/src/package/vendors/cad/index.d.ts +7 -0
  39. package/dist/src/package/vendors/image/ImageViewer.vue.d.ts +6 -0
  40. package/dist/src/package/vendors/image/index.d.ts +4 -0
  41. package/dist/src/package/vendors/md/MarkdownViewer.vue.d.ts +6 -0
  42. package/dist/src/package/vendors/md/index.d.ts +4 -0
  43. package/dist/src/package/vendors/mp4/index.d.ts +4 -0
  44. package/dist/src/package/vendors/ofd/OfdViewer.vue.d.ts +6 -0
  45. package/dist/src/package/vendors/ofd/index.d.ts +7 -0
  46. package/dist/src/package/vendors/pdf/PdfView.vue.d.ts +6 -0
  47. package/dist/src/package/vendors/pdf/index.d.ts +1 -0
  48. package/dist/src/package/vendors/pdf/worker/index.d.ts +4 -0
  49. package/dist/src/package/vendors/pptx/PptxRender.vue.d.ts +9 -0
  50. package/dist/src/package/vendors/pptx/index.d.ts +6 -0
  51. package/dist/src/package/vendors/pptx/options.d.ts +39 -0
  52. package/dist/src/package/vendors/pptx/support/chart.d.ts +4 -0
  53. package/dist/src/package/vendors/pptx/worker/index.d.ts +4 -0
  54. package/dist/src/package/vendors/renders.d.ts +3 -0
  55. package/dist/src/package/vendors/text/CodeViewer.vue.d.ts +7 -0
  56. package/dist/src/package/vendors/text/index.d.ts +10 -0
  57. package/dist/src/package/vendors/word/doc.d.ts +5 -0
  58. package/dist/src/package/vendors/word/docx.d.ts +5 -0
  59. package/dist/src/package/vendors/word/index.d.ts +3 -0
  60. package/dist/src/package/vendors/xlsx/XlsxTable.state.d.ts +79 -0
  61. package/dist/src/package/vendors/xlsx/XlsxTable.view.d.ts +22 -0
  62. package/dist/src/package/vendors/xlsx/XlsxTable.vue.d.ts +6 -0
  63. package/dist/src/package/vendors/xlsx/index.d.ts +5 -0
  64. package/dist/src/package/vendors/xlsx/util.d.ts +8 -0
  65. package/dist/src/package/vendors/xlsx/worker/index.d.ts +4 -0
  66. package/dist/src/package/vendors/xlsx/worker/sheetjs/SheetJsModel.d.ts +69 -0
  67. package/dist/src/package/vendors/xlsx/worker/sheetjs/color.d.ts +2 -0
  68. package/dist/src/package/vendors/xlsx/worker/sheetjs/index.d.ts +4 -0
  69. package/dist/src/package/vendors/xlsx/worker/sheetjs/sheet.worker.d.ts +1 -0
  70. package/dist/worker/pdf.worker.js +1 -58
  71. package/dist/worker/pptx.worker.js +1 -21
  72. package/dist/worker/sheet.worker.js +1 -38
  73. package/package.json +62 -41
  74. package/.vscode/extensions.json +0 -3
  75. package/dist/components/_commonjs-dynamic-modules.js +0 -6
  76. package/dist/components/_commonjsHelpers.js +0 -30
  77. package/dist/components/index.js +0 -1837
  78. package/dist/favicon.ico +0 -0
  79. package/dist/index.d.ts +0 -47
  80. package/dist/style.css +0 -57
  81. package/dist/worker/xlsx.worker.js +0 -62
@@ -1,1837 +0,0 @@
1
- var it = Object.defineProperty;
2
- var ye = Object.getOwnPropertySymbols;
3
- var at = Object.prototype.hasOwnProperty, ct = Object.prototype.propertyIsEnumerable;
4
- var Z = (e, t, n) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Y = (e, t) => {
5
- for (var n in t || (t = {}))
6
- at.call(t, n) && Z(e, n, t[n]);
7
- if (ye)
8
- for (var n of ye(t))
9
- ct.call(t, n) && Z(e, n, t[n]);
10
- return e;
11
- };
12
- var we = (e, t, n) => (Z(e, typeof t != "symbol" ? t + "" : t, n), n);
13
- var w = (e, t, n) => new Promise((r, s) => {
14
- var o = (u) => {
15
- try {
16
- l(n.next(u));
17
- } catch (p) {
18
- s(p);
19
- }
20
- }, i = (u) => {
21
- try {
22
- l(n.throw(u));
23
- } catch (p) {
24
- s(p);
25
- }
26
- }, l = (u) => u.done ? r(u.value) : Promise.resolve(u.value).then(o, i);
27
- l((n = n.apply(e, t)).next());
28
- });
29
- import { defineAsyncComponent as k, createApp as N, createVNode as F, defineComponent as Ue, openBlock as H, createElementBlock as M, toDisplayString as q, ref as B, onMounted as lt, watch as be, createElementVNode as ee, Fragment as ut, withDirectives as Ee, vShow as Re } from "vue";
30
- const ft = (() => {
31
- const e = {
32
- module: null,
33
- load() {
34
- return w(this, null, function* () {
35
- return this.module || (this.module = import("./docx-preview.js")), this.module;
36
- });
37
- }
38
- };
39
- return () => w(void 0, null, function* () {
40
- return yield e.load();
41
- });
42
- })();
43
- function dt(e, t) {
44
- return w(this, null, function* () {
45
- const { defaultOptions: n, renderAsync: r } = yield ft(), s = Object.assign(n, {
46
- debug: !0,
47
- experimental: !0
48
- });
49
- yield r(e, t, void 0, s);
50
- });
51
- }
52
- const pt = k(() => import("./PptxRender.js"));
53
- function ht(e, t) {
54
- return w(this, null, function* () {
55
- return N({
56
- render: () => F(pt, {
57
- data: e
58
- }, null)
59
- }).mount(t);
60
- });
61
- }
62
- const mt = k(() => import("./XlsxTable.js"));
63
- function Se(e, t, n) {
64
- return w(this, null, function* () {
65
- const r = N({
66
- render: () => F(mt, {
67
- data: e,
68
- type: n
69
- }, null)
70
- });
71
- return r.mount(t), r;
72
- });
73
- }
74
- const yt = k(() => import("./PdfView.js"));
75
- function wt(e, t) {
76
- return w(this, null, function* () {
77
- const n = N({
78
- render: () => F(yt, {
79
- data: e
80
- }, null)
81
- });
82
- return n.mount(t), n;
83
- });
84
- }
85
- function bt(e) {
86
- return w(this, null, function* () {
87
- return new Promise((t, n) => {
88
- const r = new FileReader();
89
- r.onload = (s) => {
90
- var o;
91
- return t((o = s.target) == null ? void 0 : o.result);
92
- }, r.onerror = (s) => n(s), r.readAsArrayBuffer(e);
93
- });
94
- });
95
- }
96
- function Et(e) {
97
- return w(this, null, function* () {
98
- return new Promise((t, n) => {
99
- const r = new FileReader();
100
- r.onload = (s) => {
101
- var i;
102
- const o = (i = s.target) == null ? void 0 : i.result;
103
- typeof o == "string" && t(o);
104
- }, r.onerror = (s) => n(s), r.readAsDataURL(new Blob([e]));
105
- });
106
- });
107
- }
108
- function De(e) {
109
- return w(this, null, function* () {
110
- return new Promise((t, n) => {
111
- const r = new FileReader();
112
- r.onload = (s) => {
113
- var i;
114
- const o = (i = s.target) == null ? void 0 : i.result;
115
- typeof o == "string" && t(o);
116
- }, r.onerror = (s) => n(s), r.readAsText(new Blob([e]), "utf-8");
117
- });
118
- });
119
- }
120
- const Rt = k(() => import("./ImageViewer.js"));
121
- function St(e, t) {
122
- return w(this, null, function* () {
123
- const n = yield Et(e), r = N({
124
- render: () => F(Rt, {
125
- image: n
126
- }, null)
127
- });
128
- return r.mount(t), r;
129
- });
130
- }
131
- const gt = k(() => import("./MarkdownViewer.js"));
132
- function Ot(e, t) {
133
- return w(this, null, function* () {
134
- const n = yield De(e), r = N({
135
- render: () => F(gt, {
136
- data: n
137
- }, null)
138
- });
139
- return r.mount(t), r;
140
- });
141
- }
142
- const xt = { class: "code-area" }, At = /* @__PURE__ */ Ue({
143
- __name: "CodeViewer",
144
- props: {
145
- value: {}
146
- },
147
- setup(e) {
148
- return (t, n) => (H(), M("pre", xt, " " + q(t.value) + `
149
- `, 1));
150
- }
151
- });
152
- const ke = (e, t) => {
153
- const n = e.__vccOpts || e;
154
- for (const [r, s] of t)
155
- n[r] = s;
156
- return n;
157
- }, _t = /* @__PURE__ */ ke(At, [["__scopeId", "data-v-3be501eb"]]);
158
- function Tt(e, t) {
159
- return w(this, null, function* () {
160
- const n = yield De(e), r = N({
161
- render: () => F(_t, {
162
- value: n
163
- }, null)
164
- });
165
- return r.mount(t), r;
166
- });
167
- }
168
- function Pt(e, t) {
169
- const n = document.createElement("video");
170
- n.width = 840, n.height = 480, n.controls = !0, Object.assign(n.style, {
171
- margin: "40px auto",
172
- display: "block"
173
- });
174
- const r = document.createElement("source");
175
- r.src = URL.createObjectURL(new Blob([e])), n.appendChild(r), t.appendChild(n);
176
- }
177
- const I = (e) => ({
178
- $el: e,
179
- unmount() {
180
- }
181
- }), Ct = [
182
- // 使用docxjs支持,目前效果最好的渲染器
183
- {
184
- accepts: ["docx"],
185
- handler: (e, t) => w(void 0, null, function* () {
186
- return yield dt(e, t), window.dispatchEvent(new Event("resize")), I(t);
187
- })
188
- },
189
- // 使用pptx2html,已通过默认值更替
190
- {
191
- accepts: ["pptx"],
192
- handler: (e, t) => w(void 0, null, function* () {
193
- return yield ht(e, t), window.dispatchEvent(new Event("resize")), I(t);
194
- })
195
- },
196
- // 使用exceljs + handsontable,全部样式
197
- {
198
- accepts: ["xlsx"],
199
- handler: (e, t) => w(void 0, null, function* () {
200
- return Se(e, t, "xml");
201
- })
202
- },
203
- // 使用js-xlsx + handsontable,无样式
204
- {
205
- accepts: ["xlsm", "xlsb", "xls", "csv", "ods", "fods", "numbers"],
206
- handler: (e, t) => w(void 0, null, function* () {
207
- return Se(e, t, "binary");
208
- })
209
- },
210
- // 使用pdfjs,渲染pdf,效果最好
211
- {
212
- accepts: ["pdf"],
213
- handler: (e, t) => w(void 0, null, function* () {
214
- return wt(e, t);
215
- })
216
- },
217
- // 图片过滤器
218
- {
219
- accepts: ["gif", "jpg", "jpeg", "bmp", "tiff", "tif", "png", "svg", "webp"],
220
- handler: (e, t) => w(void 0, null, function* () {
221
- return St(e, t);
222
- })
223
- },
224
- {
225
- accepts: ["md", "markdown"],
226
- handler: (e, t) => w(void 0, null, function* () {
227
- return Ot(e, t);
228
- })
229
- },
230
- // 纯文本预览
231
- {
232
- accepts: ["txt", "json", "js", "css", "java", "py", "html", "jsx", "ts", "tsx", "xml", "log"],
233
- handler: (e, t) => w(void 0, null, function* () {
234
- return Tt(e, t);
235
- })
236
- },
237
- // 视频预览,仅支持MP4
238
- {
239
- accepts: ["mp4"],
240
- handler: (e, t) => w(void 0, null, function* () {
241
- return Pt(e, t), I(t);
242
- })
243
- },
244
- // 错误处理
245
- {
246
- accepts: ["error"],
247
- handler: (e, t, n) => w(void 0, null, function* () {
248
- return t.innerHTML = `<div style='text-align: center; margin-top: 80px'>不支持.${n}格式的在线预览,请下载后预览或转换为支持的格式</div>
249
- <div style='text-align: center'>支持docx, xlsx, pptx, pdf, 以及纯文本格式和各种图片格式的在线预览</div>`, I(t);
250
- })
251
- }
252
- ], je = Ct.reduce((e, { accepts: t, handler: n }) => (t.forEach((r) => e.set(r, n)), e), /* @__PURE__ */ new Map()), ge = je.get("error");
253
- function Nt(e) {
254
- const t = e.lastIndexOf(".");
255
- return e.substring(t + 1);
256
- }
257
- function Ft(e, t, n) {
258
- return w(this, null, function* () {
259
- const r = je.get(t.toLowerCase());
260
- if (r)
261
- return r(e, n);
262
- if (ge)
263
- return ge(e, n, t);
264
- });
265
- }
266
- function ve(e, t) {
267
- return function() {
268
- return e.apply(t, arguments);
269
- };
270
- }
271
- const { toString: Lt } = Object.prototype, { getPrototypeOf: ue } = Object, W = ((e) => (t) => {
272
- const n = Lt.call(t);
273
- return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
274
- })(/* @__PURE__ */ Object.create(null)), _ = (e) => (e = e.toLowerCase(), (t) => W(t) === e), K = (e) => (t) => typeof t === e, { isArray: L } = Array, D = K("undefined");
275
- function Bt(e) {
276
- return e !== null && !D(e) && e.constructor !== null && !D(e.constructor) && g(e.constructor.isBuffer) && e.constructor.isBuffer(e);
277
- }
278
- const Ie = _("ArrayBuffer");
279
- function Ut(e) {
280
- let t;
281
- return typeof ArrayBuffer != "undefined" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Ie(e.buffer), t;
282
- }
283
- const Dt = K("string"), g = K("function"), He = K("number"), X = (e) => e !== null && typeof e == "object", kt = (e) => e === !0 || e === !1, z = (e) => {
284
- if (W(e) !== "object")
285
- return !1;
286
- const t = ue(e);
287
- return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
288
- }, jt = _("Date"), vt = _("File"), It = _("Blob"), Ht = _("FileList"), Mt = (e) => X(e) && g(e.pipe), qt = (e) => {
289
- let t;
290
- return e && (typeof FormData == "function" && e instanceof FormData || g(e.append) && ((t = W(e)) === "formdata" || // detect form-data instance
291
- t === "object" && g(e.toString) && e.toString() === "[object FormData]"));
292
- }, zt = _("URLSearchParams"), Vt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
293
- function j(e, t, { allOwnKeys: n = !1 } = {}) {
294
- if (e === null || typeof e == "undefined")
295
- return;
296
- let r, s;
297
- if (typeof e != "object" && (e = [e]), L(e))
298
- for (r = 0, s = e.length; r < s; r++)
299
- t.call(null, e[r], r, e);
300
- else {
301
- const o = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = o.length;
302
- let l;
303
- for (r = 0; r < i; r++)
304
- l = o[r], t.call(null, e[l], l, e);
305
- }
306
- }
307
- function Me(e, t) {
308
- t = t.toLowerCase();
309
- const n = Object.keys(e);
310
- let r = n.length, s;
311
- for (; r-- > 0; )
312
- if (s = n[r], t === s.toLowerCase())
313
- return s;
314
- return null;
315
- }
316
- const qe = (() => typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : global)(), ze = (e) => !D(e) && e !== qe;
317
- function oe() {
318
- const { caseless: e } = ze(this) && this || {}, t = {}, n = (r, s) => {
319
- const o = e && Me(t, s) || s;
320
- z(t[o]) && z(r) ? t[o] = oe(t[o], r) : z(r) ? t[o] = oe({}, r) : L(r) ? t[o] = r.slice() : t[o] = r;
321
- };
322
- for (let r = 0, s = arguments.length; r < s; r++)
323
- arguments[r] && j(arguments[r], n);
324
- return t;
325
- }
326
- const $t = (e, t, n, { allOwnKeys: r } = {}) => (j(t, (s, o) => {
327
- n && g(s) ? e[o] = ve(s, n) : e[o] = s;
328
- }, { allOwnKeys: r }), e), Jt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Wt = (e, t, n, r) => {
329
- e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
330
- value: t.prototype
331
- }), n && Object.assign(e.prototype, n);
332
- }, Kt = (e, t, n, r) => {
333
- let s, o, i;
334
- const l = {};
335
- if (t = t || {}, e == null)
336
- return t;
337
- do {
338
- for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
339
- i = s[o], (!r || r(i, e, t)) && !l[i] && (t[i] = e[i], l[i] = !0);
340
- e = n !== !1 && ue(e);
341
- } while (e && (!n || n(e, t)) && e !== Object.prototype);
342
- return t;
343
- }, Xt = (e, t, n) => {
344
- e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
345
- const r = e.indexOf(t, n);
346
- return r !== -1 && r === n;
347
- }, Gt = (e) => {
348
- if (!e)
349
- return null;
350
- if (L(e))
351
- return e;
352
- let t = e.length;
353
- if (!He(t))
354
- return null;
355
- const n = new Array(t);
356
- for (; t-- > 0; )
357
- n[t] = e[t];
358
- return n;
359
- }, Qt = ((e) => (t) => e && t instanceof e)(typeof Uint8Array != "undefined" && ue(Uint8Array)), Zt = (e, t) => {
360
- const r = (e && e[Symbol.iterator]).call(e);
361
- let s;
362
- for (; (s = r.next()) && !s.done; ) {
363
- const o = s.value;
364
- t.call(e, o[0], o[1]);
365
- }
366
- }, Yt = (e, t) => {
367
- let n;
368
- const r = [];
369
- for (; (n = e.exec(t)) !== null; )
370
- r.push(n);
371
- return r;
372
- }, en = _("HTMLFormElement"), tn = (e) => e.toLowerCase().replace(
373
- /[-_\s]([a-z\d])(\w*)/g,
374
- function(n, r, s) {
375
- return r.toUpperCase() + s;
376
- }
377
- ), Oe = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), nn = _("RegExp"), Ve = (e, t) => {
378
- const n = Object.getOwnPropertyDescriptors(e), r = {};
379
- j(n, (s, o) => {
380
- let i;
381
- (i = t(s, o, e)) !== !1 && (r[o] = i || s);
382
- }), Object.defineProperties(e, r);
383
- }, rn = (e) => {
384
- Ve(e, (t, n) => {
385
- if (g(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
386
- return !1;
387
- const r = e[n];
388
- if (g(r)) {
389
- if (t.enumerable = !1, "writable" in t) {
390
- t.writable = !1;
391
- return;
392
- }
393
- t.set || (t.set = () => {
394
- throw Error("Can not rewrite read-only method '" + n + "'");
395
- });
396
- }
397
- });
398
- }, sn = (e, t) => {
399
- const n = {}, r = (s) => {
400
- s.forEach((o) => {
401
- n[o] = !0;
402
- });
403
- };
404
- return L(e) ? r(e) : r(String(e).split(t)), n;
405
- }, on = () => {
406
- }, an = (e, t) => (e = +e, Number.isFinite(e) ? e : t), te = "abcdefghijklmnopqrstuvwxyz", xe = "0123456789", $e = {
407
- DIGIT: xe,
408
- ALPHA: te,
409
- ALPHA_DIGIT: te + te.toUpperCase() + xe
410
- }, cn = (e = 16, t = $e.ALPHA_DIGIT) => {
411
- let n = "";
412
- const { length: r } = t;
413
- for (; e--; )
414
- n += t[Math.random() * r | 0];
415
- return n;
416
- };
417
- function ln(e) {
418
- return !!(e && g(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
419
- }
420
- const un = (e) => {
421
- const t = new Array(10), n = (r, s) => {
422
- if (X(r)) {
423
- if (t.indexOf(r) >= 0)
424
- return;
425
- if (!("toJSON" in r)) {
426
- t[s] = r;
427
- const o = L(r) ? [] : {};
428
- return j(r, (i, l) => {
429
- const u = n(i, s + 1);
430
- !D(u) && (o[l] = u);
431
- }), t[s] = void 0, o;
432
- }
433
- }
434
- return r;
435
- };
436
- return n(e, 0);
437
- }, fn = _("AsyncFunction"), dn = (e) => e && (X(e) || g(e)) && g(e.then) && g(e.catch), a = {
438
- isArray: L,
439
- isArrayBuffer: Ie,
440
- isBuffer: Bt,
441
- isFormData: qt,
442
- isArrayBufferView: Ut,
443
- isString: Dt,
444
- isNumber: He,
445
- isBoolean: kt,
446
- isObject: X,
447
- isPlainObject: z,
448
- isUndefined: D,
449
- isDate: jt,
450
- isFile: vt,
451
- isBlob: It,
452
- isRegExp: nn,
453
- isFunction: g,
454
- isStream: Mt,
455
- isURLSearchParams: zt,
456
- isTypedArray: Qt,
457
- isFileList: Ht,
458
- forEach: j,
459
- merge: oe,
460
- extend: $t,
461
- trim: Vt,
462
- stripBOM: Jt,
463
- inherits: Wt,
464
- toFlatObject: Kt,
465
- kindOf: W,
466
- kindOfTest: _,
467
- endsWith: Xt,
468
- toArray: Gt,
469
- forEachEntry: Zt,
470
- matchAll: Yt,
471
- isHTMLForm: en,
472
- hasOwnProperty: Oe,
473
- hasOwnProp: Oe,
474
- // an alias to avoid ESLint no-prototype-builtins detection
475
- reduceDescriptors: Ve,
476
- freezeMethods: rn,
477
- toObjectSet: sn,
478
- toCamelCase: tn,
479
- noop: on,
480
- toFiniteNumber: an,
481
- findKey: Me,
482
- global: qe,
483
- isContextDefined: ze,
484
- ALPHABET: $e,
485
- generateString: cn,
486
- isSpecCompliantForm: ln,
487
- toJSONObject: un,
488
- isAsyncFn: fn,
489
- isThenable: dn
490
- };
491
- function m(e, t, n, r, s) {
492
- 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);
493
- }
494
- a.inherits(m, Error, {
495
- toJSON: function() {
496
- return {
497
- // Standard
498
- message: this.message,
499
- name: this.name,
500
- // Microsoft
501
- description: this.description,
502
- number: this.number,
503
- // Mozilla
504
- fileName: this.fileName,
505
- lineNumber: this.lineNumber,
506
- columnNumber: this.columnNumber,
507
- stack: this.stack,
508
- // Axios
509
- config: a.toJSONObject(this.config),
510
- code: this.code,
511
- status: this.response && this.response.status ? this.response.status : null
512
- };
513
- }
514
- });
515
- const Je = m.prototype, We = {};
516
- [
517
- "ERR_BAD_OPTION_VALUE",
518
- "ERR_BAD_OPTION",
519
- "ECONNABORTED",
520
- "ETIMEDOUT",
521
- "ERR_NETWORK",
522
- "ERR_FR_TOO_MANY_REDIRECTS",
523
- "ERR_DEPRECATED",
524
- "ERR_BAD_RESPONSE",
525
- "ERR_BAD_REQUEST",
526
- "ERR_CANCELED",
527
- "ERR_NOT_SUPPORT",
528
- "ERR_INVALID_URL"
529
- // eslint-disable-next-line func-names
530
- ].forEach((e) => {
531
- We[e] = { value: e };
532
- });
533
- Object.defineProperties(m, We);
534
- Object.defineProperty(Je, "isAxiosError", { value: !0 });
535
- m.from = (e, t, n, r, s, o) => {
536
- const i = Object.create(Je);
537
- return a.toFlatObject(e, i, function(u) {
538
- return u !== Error.prototype;
539
- }, (l) => l !== "isAxiosError"), m.call(i, e.message, t, n, r, s), i.cause = e, i.name = e.name, o && Object.assign(i, o), i;
540
- };
541
- const pn = null;
542
- function ie(e) {
543
- return a.isPlainObject(e) || a.isArray(e);
544
- }
545
- function Ke(e) {
546
- return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
547
- }
548
- function Ae(e, t, n) {
549
- return e ? e.concat(t).map(function(s, o) {
550
- return s = Ke(s), !n && o ? "[" + s + "]" : s;
551
- }).join(n ? "." : "") : t;
552
- }
553
- function hn(e) {
554
- return a.isArray(e) && !e.some(ie);
555
- }
556
- const mn = a.toFlatObject(a, {}, null, function(t) {
557
- return /^is[A-Z]/.test(t);
558
- });
559
- function G(e, t, n) {
560
- if (!a.isObject(e))
561
- throw new TypeError("target must be an object");
562
- t = t || new FormData(), n = a.toFlatObject(n, {
563
- metaTokens: !0,
564
- dots: !1,
565
- indexes: !1
566
- }, !1, function(d, E) {
567
- return !a.isUndefined(E[d]);
568
- });
569
- const r = n.metaTokens, s = n.visitor || f, o = n.dots, i = n.indexes, u = (n.Blob || typeof Blob != "undefined" && Blob) && a.isSpecCompliantForm(t);
570
- if (!a.isFunction(s))
571
- throw new TypeError("visitor must be a function");
572
- function p(h) {
573
- if (h === null)
574
- return "";
575
- if (a.isDate(h))
576
- return h.toISOString();
577
- if (!u && a.isBlob(h))
578
- throw new m("Blob is not supported. Use a Buffer instead.");
579
- return a.isArrayBuffer(h) || a.isTypedArray(h) ? u && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
580
- }
581
- function f(h, d, E) {
582
- let S = h;
583
- if (h && !E && typeof h == "object") {
584
- if (a.endsWith(d, "{}"))
585
- d = r ? d : d.slice(0, -2), h = JSON.stringify(h);
586
- else if (a.isArray(h) && hn(h) || (a.isFileList(h) || a.endsWith(d, "[]")) && (S = a.toArray(h)))
587
- return d = Ke(d), S.forEach(function(x, ot) {
588
- !(a.isUndefined(x) || x === null) && t.append(
589
- // eslint-disable-next-line no-nested-ternary
590
- i === !0 ? Ae([d], ot, o) : i === null ? d : d + "[]",
591
- p(x)
592
- );
593
- }), !1;
594
- }
595
- return ie(h) ? !0 : (t.append(Ae(E, d, o), p(h)), !1);
596
- }
597
- const c = [], y = Object.assign(mn, {
598
- defaultVisitor: f,
599
- convertValue: p,
600
- isVisitable: ie
601
- });
602
- function b(h, d) {
603
- if (!a.isUndefined(h)) {
604
- if (c.indexOf(h) !== -1)
605
- throw Error("Circular reference detected in " + d.join("."));
606
- c.push(h), a.forEach(h, function(S, O) {
607
- (!(a.isUndefined(S) || S === null) && s.call(
608
- t,
609
- S,
610
- a.isString(O) ? O.trim() : O,
611
- d,
612
- y
613
- )) === !0 && b(S, d ? d.concat(O) : [O]);
614
- }), c.pop();
615
- }
616
- }
617
- if (!a.isObject(e))
618
- throw new TypeError("data must be an object");
619
- return b(e), t;
620
- }
621
- function _e(e) {
622
- const t = {
623
- "!": "%21",
624
- "'": "%27",
625
- "(": "%28",
626
- ")": "%29",
627
- "~": "%7E",
628
- "%20": "+",
629
- "%00": "\0"
630
- };
631
- return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
632
- return t[r];
633
- });
634
- }
635
- function fe(e, t) {
636
- this._pairs = [], e && G(e, this, t);
637
- }
638
- const Xe = fe.prototype;
639
- Xe.append = function(t, n) {
640
- this._pairs.push([t, n]);
641
- };
642
- Xe.toString = function(t) {
643
- const n = t ? function(r) {
644
- return t.call(this, r, _e);
645
- } : _e;
646
- return this._pairs.map(function(s) {
647
- return n(s[0]) + "=" + n(s[1]);
648
- }, "").join("&");
649
- };
650
- function yn(e) {
651
- return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
652
- }
653
- function Ge(e, t, n) {
654
- if (!t)
655
- return e;
656
- const r = n && n.encode || yn, s = n && n.serialize;
657
- let o;
658
- if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new fe(t, n).toString(r), o) {
659
- const i = e.indexOf("#");
660
- i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
661
- }
662
- return e;
663
- }
664
- class wn {
665
- constructor() {
666
- this.handlers = [];
667
- }
668
- /**
669
- * Add a new interceptor to the stack
670
- *
671
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
672
- * @param {Function} rejected The function to handle `reject` for a `Promise`
673
- *
674
- * @return {Number} An ID used to remove interceptor later
675
- */
676
- use(t, n, r) {
677
- return this.handlers.push({
678
- fulfilled: t,
679
- rejected: n,
680
- synchronous: r ? r.synchronous : !1,
681
- runWhen: r ? r.runWhen : null
682
- }), this.handlers.length - 1;
683
- }
684
- /**
685
- * Remove an interceptor from the stack
686
- *
687
- * @param {Number} id The ID that was returned by `use`
688
- *
689
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
690
- */
691
- eject(t) {
692
- this.handlers[t] && (this.handlers[t] = null);
693
- }
694
- /**
695
- * Clear all interceptors from the stack
696
- *
697
- * @returns {void}
698
- */
699
- clear() {
700
- this.handlers && (this.handlers = []);
701
- }
702
- /**
703
- * Iterate over all the registered interceptors
704
- *
705
- * This method is particularly useful for skipping over any
706
- * interceptors that may have become `null` calling `eject`.
707
- *
708
- * @param {Function} fn The function to call for each interceptor
709
- *
710
- * @returns {void}
711
- */
712
- forEach(t) {
713
- a.forEach(this.handlers, function(r) {
714
- r !== null && t(r);
715
- });
716
- }
717
- }
718
- const Te = wn, Qe = {
719
- silentJSONParsing: !0,
720
- forcedJSONParsing: !0,
721
- clarifyTimeoutError: !1
722
- }, bn = typeof URLSearchParams != "undefined" ? URLSearchParams : fe, En = typeof FormData != "undefined" ? FormData : null, Rn = typeof Blob != "undefined" ? Blob : null, Sn = {
723
- isBrowser: !0,
724
- classes: {
725
- URLSearchParams: bn,
726
- FormData: En,
727
- Blob: Rn
728
- },
729
- protocols: ["http", "https", "file", "blob", "url", "data"]
730
- }, Ze = typeof window != "undefined" && typeof document != "undefined", gn = ((e) => Ze && ["ReactNative", "NativeScript", "NS"].indexOf(e) < 0)(typeof navigator != "undefined" && navigator.product), On = (() => typeof WorkerGlobalScope != "undefined" && // eslint-disable-next-line no-undef
731
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
732
- __proto__: null,
733
- hasBrowserEnv: Ze,
734
- hasStandardBrowserEnv: gn,
735
- hasStandardBrowserWebWorkerEnv: On
736
- }, Symbol.toStringTag, { value: "Module" })), A = Y(Y({}, xn), Sn);
737
- function An(e, t) {
738
- return G(e, new A.classes.URLSearchParams(), Object.assign({
739
- visitor: function(n, r, s, o) {
740
- return A.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
741
- }
742
- }, t));
743
- }
744
- function _n(e) {
745
- return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
746
- }
747
- function Tn(e) {
748
- const t = {}, n = Object.keys(e);
749
- let r;
750
- const s = n.length;
751
- let o;
752
- for (r = 0; r < s; r++)
753
- o = n[r], t[o] = e[o];
754
- return t;
755
- }
756
- function Ye(e) {
757
- function t(n, r, s, o) {
758
- let i = n[o++];
759
- if (i === "__proto__")
760
- return !0;
761
- const l = Number.isFinite(+i), u = o >= n.length;
762
- return i = !i && a.isArray(s) ? s.length : i, u ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !l) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] = Tn(s[i])), !l);
763
- }
764
- if (a.isFormData(e) && a.isFunction(e.entries)) {
765
- const n = {};
766
- return a.forEachEntry(e, (r, s) => {
767
- t(_n(r), s, n, 0);
768
- }), n;
769
- }
770
- return null;
771
- }
772
- function Pn(e, t, n) {
773
- if (a.isString(e))
774
- try {
775
- return (t || JSON.parse)(e), a.trim(e);
776
- } catch (r) {
777
- if (r.name !== "SyntaxError")
778
- throw r;
779
- }
780
- return (n || JSON.stringify)(e);
781
- }
782
- const de = {
783
- transitional: Qe,
784
- adapter: ["xhr", "http"],
785
- transformRequest: [function(t, n) {
786
- const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, o = a.isObject(t);
787
- if (o && a.isHTMLForm(t) && (t = new FormData(t)), a.isFormData(t))
788
- return s ? JSON.stringify(Ye(t)) : t;
789
- if (a.isArrayBuffer(t) || a.isBuffer(t) || a.isStream(t) || a.isFile(t) || a.isBlob(t))
790
- return t;
791
- if (a.isArrayBufferView(t))
792
- return t.buffer;
793
- if (a.isURLSearchParams(t))
794
- return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
795
- let l;
796
- if (o) {
797
- if (r.indexOf("application/x-www-form-urlencoded") > -1)
798
- return An(t, this.formSerializer).toString();
799
- if ((l = a.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
800
- const u = this.env && this.env.FormData;
801
- return G(
802
- l ? { "files[]": t } : t,
803
- u && new u(),
804
- this.formSerializer
805
- );
806
- }
807
- }
808
- return o || s ? (n.setContentType("application/json", !1), Pn(t)) : t;
809
- }],
810
- transformResponse: [function(t) {
811
- const n = this.transitional || de.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
812
- if (t && a.isString(t) && (r && !this.responseType || s)) {
813
- const i = !(n && n.silentJSONParsing) && s;
814
- try {
815
- return JSON.parse(t);
816
- } catch (l) {
817
- if (i)
818
- throw l.name === "SyntaxError" ? m.from(l, m.ERR_BAD_RESPONSE, this, null, this.response) : l;
819
- }
820
- }
821
- return t;
822
- }],
823
- /**
824
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
825
- * timeout is not created.
826
- */
827
- timeout: 0,
828
- xsrfCookieName: "XSRF-TOKEN",
829
- xsrfHeaderName: "X-XSRF-TOKEN",
830
- maxContentLength: -1,
831
- maxBodyLength: -1,
832
- env: {
833
- FormData: A.classes.FormData,
834
- Blob: A.classes.Blob
835
- },
836
- validateStatus: function(t) {
837
- return t >= 200 && t < 300;
838
- },
839
- headers: {
840
- common: {
841
- Accept: "application/json, text/plain, */*",
842
- "Content-Type": void 0
843
- }
844
- }
845
- };
846
- a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
847
- de.headers[e] = {};
848
- });
849
- const pe = de, Cn = a.toObjectSet([
850
- "age",
851
- "authorization",
852
- "content-length",
853
- "content-type",
854
- "etag",
855
- "expires",
856
- "from",
857
- "host",
858
- "if-modified-since",
859
- "if-unmodified-since",
860
- "last-modified",
861
- "location",
862
- "max-forwards",
863
- "proxy-authorization",
864
- "referer",
865
- "retry-after",
866
- "user-agent"
867
- ]), Nn = (e) => {
868
- const t = {};
869
- let n, r, s;
870
- return e && e.split(`
871
- `).forEach(function(i) {
872
- s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && Cn[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
873
- }), t;
874
- }, Pe = Symbol("internals");
875
- function U(e) {
876
- return e && String(e).trim().toLowerCase();
877
- }
878
- function V(e) {
879
- return e === !1 || e == null ? e : a.isArray(e) ? e.map(V) : String(e);
880
- }
881
- function Fn(e) {
882
- const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
883
- let r;
884
- for (; r = n.exec(e); )
885
- t[r[1]] = r[2];
886
- return t;
887
- }
888
- const Ln = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
889
- function ne(e, t, n, r, s) {
890
- if (a.isFunction(r))
891
- return r.call(this, t, n);
892
- if (s && (t = n), !!a.isString(t)) {
893
- if (a.isString(r))
894
- return t.indexOf(r) !== -1;
895
- if (a.isRegExp(r))
896
- return r.test(t);
897
- }
898
- }
899
- function Bn(e) {
900
- return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
901
- }
902
- function Un(e, t) {
903
- const n = a.toCamelCase(" " + t);
904
- ["get", "set", "has"].forEach((r) => {
905
- Object.defineProperty(e, r + n, {
906
- value: function(s, o, i) {
907
- return this[r].call(this, t, s, o, i);
908
- },
909
- configurable: !0
910
- });
911
- });
912
- }
913
- class Q {
914
- constructor(t) {
915
- t && this.set(t);
916
- }
917
- set(t, n, r) {
918
- const s = this;
919
- function o(l, u, p) {
920
- const f = U(u);
921
- if (!f)
922
- throw new Error("header name must be a non-empty string");
923
- const c = a.findKey(s, f);
924
- (!c || s[c] === void 0 || p === !0 || p === void 0 && s[c] !== !1) && (s[c || u] = V(l));
925
- }
926
- const i = (l, u) => a.forEach(l, (p, f) => o(p, f, u));
927
- return a.isPlainObject(t) || t instanceof this.constructor ? i(t, n) : a.isString(t) && (t = t.trim()) && !Ln(t) ? i(Nn(t), n) : t != null && o(n, t, r), this;
928
- }
929
- get(t, n) {
930
- if (t = U(t), t) {
931
- const r = a.findKey(this, t);
932
- if (r) {
933
- const s = this[r];
934
- if (!n)
935
- return s;
936
- if (n === !0)
937
- return Fn(s);
938
- if (a.isFunction(n))
939
- return n.call(this, s, r);
940
- if (a.isRegExp(n))
941
- return n.exec(s);
942
- throw new TypeError("parser must be boolean|regexp|function");
943
- }
944
- }
945
- }
946
- has(t, n) {
947
- if (t = U(t), t) {
948
- const r = a.findKey(this, t);
949
- return !!(r && this[r] !== void 0 && (!n || ne(this, this[r], r, n)));
950
- }
951
- return !1;
952
- }
953
- delete(t, n) {
954
- const r = this;
955
- let s = !1;
956
- function o(i) {
957
- if (i = U(i), i) {
958
- const l = a.findKey(r, i);
959
- l && (!n || ne(r, r[l], l, n)) && (delete r[l], s = !0);
960
- }
961
- }
962
- return a.isArray(t) ? t.forEach(o) : o(t), s;
963
- }
964
- clear(t) {
965
- const n = Object.keys(this);
966
- let r = n.length, s = !1;
967
- for (; r--; ) {
968
- const o = n[r];
969
- (!t || ne(this, this[o], o, t, !0)) && (delete this[o], s = !0);
970
- }
971
- return s;
972
- }
973
- normalize(t) {
974
- const n = this, r = {};
975
- return a.forEach(this, (s, o) => {
976
- const i = a.findKey(r, o);
977
- if (i) {
978
- n[i] = V(s), delete n[o];
979
- return;
980
- }
981
- const l = t ? Bn(o) : String(o).trim();
982
- l !== o && delete n[o], n[l] = V(s), r[l] = !0;
983
- }), this;
984
- }
985
- concat(...t) {
986
- return this.constructor.concat(this, ...t);
987
- }
988
- toJSON(t) {
989
- const n = /* @__PURE__ */ Object.create(null);
990
- return a.forEach(this, (r, s) => {
991
- r != null && r !== !1 && (n[s] = t && a.isArray(r) ? r.join(", ") : r);
992
- }), n;
993
- }
994
- [Symbol.iterator]() {
995
- return Object.entries(this.toJSON())[Symbol.iterator]();
996
- }
997
- toString() {
998
- return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
999
- `);
1000
- }
1001
- get [Symbol.toStringTag]() {
1002
- return "AxiosHeaders";
1003
- }
1004
- static from(t) {
1005
- return t instanceof this ? t : new this(t);
1006
- }
1007
- static concat(t, ...n) {
1008
- const r = new this(t);
1009
- return n.forEach((s) => r.set(s)), r;
1010
- }
1011
- static accessor(t) {
1012
- const r = (this[Pe] = this[Pe] = {
1013
- accessors: {}
1014
- }).accessors, s = this.prototype;
1015
- function o(i) {
1016
- const l = U(i);
1017
- r[l] || (Un(s, i), r[l] = !0);
1018
- }
1019
- return a.isArray(t) ? t.forEach(o) : o(t), this;
1020
- }
1021
- }
1022
- Q.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
1023
- a.reduceDescriptors(Q.prototype, ({ value: e }, t) => {
1024
- let n = t[0].toUpperCase() + t.slice(1);
1025
- return {
1026
- get: () => e,
1027
- set(r) {
1028
- this[n] = r;
1029
- }
1030
- };
1031
- });
1032
- a.freezeMethods(Q);
1033
- const T = Q;
1034
- function re(e, t) {
1035
- const n = this || pe, r = t || n, s = T.from(r.headers);
1036
- let o = r.data;
1037
- return a.forEach(e, function(l) {
1038
- o = l.call(n, o, s.normalize(), t ? t.status : void 0);
1039
- }), s.normalize(), o;
1040
- }
1041
- function et(e) {
1042
- return !!(e && e.__CANCEL__);
1043
- }
1044
- function v(e, t, n) {
1045
- m.call(this, e == null ? "canceled" : e, m.ERR_CANCELED, t, n), this.name = "CanceledError";
1046
- }
1047
- a.inherits(v, m, {
1048
- __CANCEL__: !0
1049
- });
1050
- function Dn(e, t, n) {
1051
- const r = n.config.validateStatus;
1052
- !n.status || !r || r(n.status) ? e(n) : t(new m(
1053
- "Request failed with status code " + n.status,
1054
- [m.ERR_BAD_REQUEST, m.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
1055
- n.config,
1056
- n.request,
1057
- n
1058
- ));
1059
- }
1060
- const kn = A.hasStandardBrowserEnv ? (
1061
- // Standard browser envs support document.cookie
1062
- {
1063
- write(e, t, n, r, s, o) {
1064
- const i = [e + "=" + encodeURIComponent(t)];
1065
- a.isNumber(n) && i.push("expires=" + new Date(n).toGMTString()), a.isString(r) && i.push("path=" + r), a.isString(s) && i.push("domain=" + s), o === !0 && i.push("secure"), document.cookie = i.join("; ");
1066
- },
1067
- read(e) {
1068
- const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
1069
- return t ? decodeURIComponent(t[3]) : null;
1070
- },
1071
- remove(e) {
1072
- this.write(e, "", Date.now() - 864e5);
1073
- }
1074
- }
1075
- ) : (
1076
- // Non-standard browser env (web workers, react-native) lack needed support.
1077
- {
1078
- write() {
1079
- },
1080
- read() {
1081
- return null;
1082
- },
1083
- remove() {
1084
- }
1085
- }
1086
- );
1087
- function jn(e) {
1088
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
1089
- }
1090
- function vn(e, t) {
1091
- return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
1092
- }
1093
- function tt(e, t) {
1094
- return e && !jn(t) ? vn(e, t) : t;
1095
- }
1096
- const In = A.hasStandardBrowserEnv ? (
1097
- // Standard browser envs have full support of the APIs needed to test
1098
- // whether the request URL is of the same origin as current location.
1099
- function() {
1100
- const t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a");
1101
- let r;
1102
- function s(o) {
1103
- let i = o;
1104
- return t && (n.setAttribute("href", i), i = n.href), n.setAttribute("href", i), {
1105
- href: n.href,
1106
- protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
1107
- host: n.host,
1108
- search: n.search ? n.search.replace(/^\?/, "") : "",
1109
- hash: n.hash ? n.hash.replace(/^#/, "") : "",
1110
- hostname: n.hostname,
1111
- port: n.port,
1112
- pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname
1113
- };
1114
- }
1115
- return r = s(window.location.href), function(i) {
1116
- const l = a.isString(i) ? s(i) : i;
1117
- return l.protocol === r.protocol && l.host === r.host;
1118
- };
1119
- }()
1120
- ) : (
1121
- // Non standard browser envs (web workers, react-native) lack needed support.
1122
- function() {
1123
- return function() {
1124
- return !0;
1125
- };
1126
- }()
1127
- );
1128
- function Hn(e) {
1129
- const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
1130
- return t && t[1] || "";
1131
- }
1132
- function Mn(e, t) {
1133
- e = e || 10;
1134
- const n = new Array(e), r = new Array(e);
1135
- let s = 0, o = 0, i;
1136
- return t = t !== void 0 ? t : 1e3, function(u) {
1137
- const p = Date.now(), f = r[o];
1138
- i || (i = p), n[s] = u, r[s] = p;
1139
- let c = o, y = 0;
1140
- for (; c !== s; )
1141
- y += n[c++], c = c % e;
1142
- if (s = (s + 1) % e, s === o && (o = (o + 1) % e), p - i < t)
1143
- return;
1144
- const b = f && p - f;
1145
- return b ? Math.round(y * 1e3 / b) : void 0;
1146
- };
1147
- }
1148
- function Ce(e, t) {
1149
- let n = 0;
1150
- const r = Mn(50, 250);
1151
- return (s) => {
1152
- const o = s.loaded, i = s.lengthComputable ? s.total : void 0, l = o - n, u = r(l), p = o <= i;
1153
- n = o;
1154
- const f = {
1155
- loaded: o,
1156
- total: i,
1157
- progress: i ? o / i : void 0,
1158
- bytes: l,
1159
- rate: u || void 0,
1160
- estimated: u && i && p ? (i - o) / u : void 0,
1161
- event: s
1162
- };
1163
- f[t ? "download" : "upload"] = !0, e(f);
1164
- };
1165
- }
1166
- const qn = typeof XMLHttpRequest != "undefined", zn = qn && function(e) {
1167
- return new Promise(function(n, r) {
1168
- let s = e.data;
1169
- const o = T.from(e.headers).normalize();
1170
- let { responseType: i, withXSRFToken: l } = e, u;
1171
- function p() {
1172
- e.cancelToken && e.cancelToken.unsubscribe(u), e.signal && e.signal.removeEventListener("abort", u);
1173
- }
1174
- let f;
1175
- if (a.isFormData(s)) {
1176
- if (A.hasStandardBrowserEnv || A.hasStandardBrowserWebWorkerEnv)
1177
- o.setContentType(!1);
1178
- else if ((f = o.getContentType()) !== !1) {
1179
- const [d, ...E] = f ? f.split(";").map((S) => S.trim()).filter(Boolean) : [];
1180
- o.setContentType([d || "multipart/form-data", ...E].join("; "));
1181
- }
1182
- }
1183
- let c = new XMLHttpRequest();
1184
- if (e.auth) {
1185
- const d = e.auth.username || "", E = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
1186
- o.set("Authorization", "Basic " + btoa(d + ":" + E));
1187
- }
1188
- const y = tt(e.baseURL, e.url);
1189
- c.open(e.method.toUpperCase(), Ge(y, e.params, e.paramsSerializer), !0), c.timeout = e.timeout;
1190
- function b() {
1191
- if (!c)
1192
- return;
1193
- const d = T.from(
1194
- "getAllResponseHeaders" in c && c.getAllResponseHeaders()
1195
- ), S = {
1196
- data: !i || i === "text" || i === "json" ? c.responseText : c.response,
1197
- status: c.status,
1198
- statusText: c.statusText,
1199
- headers: d,
1200
- config: e,
1201
- request: c
1202
- };
1203
- Dn(function(x) {
1204
- n(x), p();
1205
- }, function(x) {
1206
- r(x), p();
1207
- }, S), c = null;
1208
- }
1209
- if ("onloadend" in c ? c.onloadend = b : c.onreadystatechange = function() {
1210
- !c || c.readyState !== 4 || c.status === 0 && !(c.responseURL && c.responseURL.indexOf("file:") === 0) || setTimeout(b);
1211
- }, c.onabort = function() {
1212
- c && (r(new m("Request aborted", m.ECONNABORTED, e, c)), c = null);
1213
- }, c.onerror = function() {
1214
- r(new m("Network Error", m.ERR_NETWORK, e, c)), c = null;
1215
- }, c.ontimeout = function() {
1216
- let E = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
1217
- const S = e.transitional || Qe;
1218
- e.timeoutErrorMessage && (E = e.timeoutErrorMessage), r(new m(
1219
- E,
1220
- S.clarifyTimeoutError ? m.ETIMEDOUT : m.ECONNABORTED,
1221
- e,
1222
- c
1223
- )), c = null;
1224
- }, A.hasStandardBrowserEnv && (l && a.isFunction(l) && (l = l(e)), l || l !== !1 && In(y))) {
1225
- const d = e.xsrfHeaderName && e.xsrfCookieName && kn.read(e.xsrfCookieName);
1226
- d && o.set(e.xsrfHeaderName, d);
1227
- }
1228
- s === void 0 && o.setContentType(null), "setRequestHeader" in c && a.forEach(o.toJSON(), function(E, S) {
1229
- c.setRequestHeader(S, E);
1230
- }), a.isUndefined(e.withCredentials) || (c.withCredentials = !!e.withCredentials), i && i !== "json" && (c.responseType = e.responseType), typeof e.onDownloadProgress == "function" && c.addEventListener("progress", Ce(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && c.upload && c.upload.addEventListener("progress", Ce(e.onUploadProgress)), (e.cancelToken || e.signal) && (u = (d) => {
1231
- c && (r(!d || d.type ? new v(null, e, c) : d), c.abort(), c = null);
1232
- }, e.cancelToken && e.cancelToken.subscribe(u), e.signal && (e.signal.aborted ? u() : e.signal.addEventListener("abort", u)));
1233
- const h = Hn(y);
1234
- if (h && A.protocols.indexOf(h) === -1) {
1235
- r(new m("Unsupported protocol " + h + ":", m.ERR_BAD_REQUEST, e));
1236
- return;
1237
- }
1238
- c.send(s || null);
1239
- });
1240
- }, ae = {
1241
- http: pn,
1242
- xhr: zn
1243
- };
1244
- a.forEach(ae, (e, t) => {
1245
- if (e) {
1246
- try {
1247
- Object.defineProperty(e, "name", { value: t });
1248
- } catch (n) {
1249
- }
1250
- Object.defineProperty(e, "adapterName", { value: t });
1251
- }
1252
- });
1253
- const Ne = (e) => `- ${e}`, Vn = (e) => a.isFunction(e) || e === null || e === !1, nt = {
1254
- getAdapter: (e) => {
1255
- e = a.isArray(e) ? e : [e];
1256
- const { length: t } = e;
1257
- let n, r;
1258
- const s = {};
1259
- for (let o = 0; o < t; o++) {
1260
- n = e[o];
1261
- let i;
1262
- if (r = n, !Vn(n) && (r = ae[(i = String(n)).toLowerCase()], r === void 0))
1263
- throw new m(`Unknown adapter '${i}'`);
1264
- if (r)
1265
- break;
1266
- s[i || "#" + o] = r;
1267
- }
1268
- if (!r) {
1269
- const o = Object.entries(s).map(
1270
- ([l, u]) => `adapter ${l} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build")
1271
- );
1272
- let i = t ? o.length > 1 ? `since :
1273
- ` + o.map(Ne).join(`
1274
- `) : " " + Ne(o[0]) : "as no adapter specified";
1275
- throw new m(
1276
- "There is no suitable adapter to dispatch the request " + i,
1277
- "ERR_NOT_SUPPORT"
1278
- );
1279
- }
1280
- return r;
1281
- },
1282
- adapters: ae
1283
- };
1284
- function se(e) {
1285
- if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1286
- throw new v(null, e);
1287
- }
1288
- function Fe(e) {
1289
- return se(e), e.headers = T.from(e.headers), e.data = re.call(
1290
- e,
1291
- e.transformRequest
1292
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), nt.getAdapter(e.adapter || pe.adapter)(e).then(function(r) {
1293
- return se(e), r.data = re.call(
1294
- e,
1295
- e.transformResponse,
1296
- r
1297
- ), r.headers = T.from(r.headers), r;
1298
- }, function(r) {
1299
- return et(r) || (se(e), r && r.response && (r.response.data = re.call(
1300
- e,
1301
- e.transformResponse,
1302
- r.response
1303
- ), r.response.headers = T.from(r.response.headers))), Promise.reject(r);
1304
- });
1305
- }
1306
- const Le = (e) => e instanceof T ? e.toJSON() : e;
1307
- function C(e, t) {
1308
- t = t || {};
1309
- const n = {};
1310
- function r(p, f, c) {
1311
- return a.isPlainObject(p) && a.isPlainObject(f) ? a.merge.call({ caseless: c }, p, f) : a.isPlainObject(f) ? a.merge({}, f) : a.isArray(f) ? f.slice() : f;
1312
- }
1313
- function s(p, f, c) {
1314
- if (a.isUndefined(f)) {
1315
- if (!a.isUndefined(p))
1316
- return r(void 0, p, c);
1317
- } else
1318
- return r(p, f, c);
1319
- }
1320
- function o(p, f) {
1321
- if (!a.isUndefined(f))
1322
- return r(void 0, f);
1323
- }
1324
- function i(p, f) {
1325
- if (a.isUndefined(f)) {
1326
- if (!a.isUndefined(p))
1327
- return r(void 0, p);
1328
- } else
1329
- return r(void 0, f);
1330
- }
1331
- function l(p, f, c) {
1332
- if (c in t)
1333
- return r(p, f);
1334
- if (c in e)
1335
- return r(void 0, p);
1336
- }
1337
- const u = {
1338
- url: o,
1339
- method: o,
1340
- data: o,
1341
- baseURL: i,
1342
- transformRequest: i,
1343
- transformResponse: i,
1344
- paramsSerializer: i,
1345
- timeout: i,
1346
- timeoutMessage: i,
1347
- withCredentials: i,
1348
- withXSRFToken: i,
1349
- adapter: i,
1350
- responseType: i,
1351
- xsrfCookieName: i,
1352
- xsrfHeaderName: i,
1353
- onUploadProgress: i,
1354
- onDownloadProgress: i,
1355
- decompress: i,
1356
- maxContentLength: i,
1357
- maxBodyLength: i,
1358
- beforeRedirect: i,
1359
- transport: i,
1360
- httpAgent: i,
1361
- httpsAgent: i,
1362
- cancelToken: i,
1363
- socketPath: i,
1364
- responseEncoding: i,
1365
- validateStatus: l,
1366
- headers: (p, f) => s(Le(p), Le(f), !0)
1367
- };
1368
- return a.forEach(Object.keys(Object.assign({}, e, t)), function(f) {
1369
- const c = u[f] || s, y = c(e[f], t[f], f);
1370
- a.isUndefined(y) && c !== l || (n[f] = y);
1371
- }), n;
1372
- }
1373
- const rt = "1.6.7", he = {};
1374
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1375
- he[e] = function(r) {
1376
- return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1377
- };
1378
- });
1379
- const Be = {};
1380
- he.transitional = function(t, n, r) {
1381
- function s(o, i) {
1382
- return "[Axios v" + rt + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
1383
- }
1384
- return (o, i, l) => {
1385
- if (t === !1)
1386
- throw new m(
1387
- s(i, " has been removed" + (n ? " in " + n : "")),
1388
- m.ERR_DEPRECATED
1389
- );
1390
- return n && !Be[i] && (Be[i] = !0, console.warn(
1391
- s(
1392
- i,
1393
- " has been deprecated since v" + n + " and will be removed in the near future"
1394
- )
1395
- )), t ? t(o, i, l) : !0;
1396
- };
1397
- };
1398
- function $n(e, t, n) {
1399
- if (typeof e != "object")
1400
- throw new m("options must be an object", m.ERR_BAD_OPTION_VALUE);
1401
- const r = Object.keys(e);
1402
- let s = r.length;
1403
- for (; s-- > 0; ) {
1404
- const o = r[s], i = t[o];
1405
- if (i) {
1406
- const l = e[o], u = l === void 0 || i(l, o, e);
1407
- if (u !== !0)
1408
- throw new m("option " + o + " must be " + u, m.ERR_BAD_OPTION_VALUE);
1409
- continue;
1410
- }
1411
- if (n !== !0)
1412
- throw new m("Unknown option " + o, m.ERR_BAD_OPTION);
1413
- }
1414
- }
1415
- const ce = {
1416
- assertOptions: $n,
1417
- validators: he
1418
- }, P = ce.validators;
1419
- class J {
1420
- constructor(t) {
1421
- this.defaults = t, this.interceptors = {
1422
- request: new Te(),
1423
- response: new Te()
1424
- };
1425
- }
1426
- /**
1427
- * Dispatch a request
1428
- *
1429
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1430
- * @param {?Object} config
1431
- *
1432
- * @returns {Promise} The Promise to be fulfilled
1433
- */
1434
- request(t, n) {
1435
- return w(this, null, function* () {
1436
- try {
1437
- return yield this._request(t, n);
1438
- } catch (r) {
1439
- if (r instanceof Error) {
1440
- let s;
1441
- Error.captureStackTrace ? Error.captureStackTrace(s = {}) : s = new Error();
1442
- const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
1443
- r.stack ? o && !String(r.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (r.stack += `
1444
- ` + o) : r.stack = o;
1445
- }
1446
- throw r;
1447
- }
1448
- });
1449
- }
1450
- _request(t, n) {
1451
- typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = C(this.defaults, n);
1452
- const { transitional: r, paramsSerializer: s, headers: o } = n;
1453
- r !== void 0 && ce.assertOptions(r, {
1454
- silentJSONParsing: P.transitional(P.boolean),
1455
- forcedJSONParsing: P.transitional(P.boolean),
1456
- clarifyTimeoutError: P.transitional(P.boolean)
1457
- }, !1), s != null && (a.isFunction(s) ? n.paramsSerializer = {
1458
- serialize: s
1459
- } : ce.assertOptions(s, {
1460
- encode: P.function,
1461
- serialize: P.function
1462
- }, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1463
- let i = o && a.merge(
1464
- o.common,
1465
- o[n.method]
1466
- );
1467
- o && a.forEach(
1468
- ["delete", "get", "head", "post", "put", "patch", "common"],
1469
- (h) => {
1470
- delete o[h];
1471
- }
1472
- ), n.headers = T.concat(i, o);
1473
- const l = [];
1474
- let u = !0;
1475
- this.interceptors.request.forEach(function(d) {
1476
- typeof d.runWhen == "function" && d.runWhen(n) === !1 || (u = u && d.synchronous, l.unshift(d.fulfilled, d.rejected));
1477
- });
1478
- const p = [];
1479
- this.interceptors.response.forEach(function(d) {
1480
- p.push(d.fulfilled, d.rejected);
1481
- });
1482
- let f, c = 0, y;
1483
- if (!u) {
1484
- const h = [Fe.bind(this), void 0];
1485
- for (h.unshift.apply(h, l), h.push.apply(h, p), y = h.length, f = Promise.resolve(n); c < y; )
1486
- f = f.then(h[c++], h[c++]);
1487
- return f;
1488
- }
1489
- y = l.length;
1490
- let b = n;
1491
- for (c = 0; c < y; ) {
1492
- const h = l[c++], d = l[c++];
1493
- try {
1494
- b = h(b);
1495
- } catch (E) {
1496
- d.call(this, E);
1497
- break;
1498
- }
1499
- }
1500
- try {
1501
- f = Fe.call(this, b);
1502
- } catch (h) {
1503
- return Promise.reject(h);
1504
- }
1505
- for (c = 0, y = p.length; c < y; )
1506
- f = f.then(p[c++], p[c++]);
1507
- return f;
1508
- }
1509
- getUri(t) {
1510
- t = C(this.defaults, t);
1511
- const n = tt(t.baseURL, t.url);
1512
- return Ge(n, t.params, t.paramsSerializer);
1513
- }
1514
- }
1515
- a.forEach(["delete", "get", "head", "options"], function(t) {
1516
- J.prototype[t] = function(n, r) {
1517
- return this.request(C(r || {}, {
1518
- method: t,
1519
- url: n,
1520
- data: (r || {}).data
1521
- }));
1522
- };
1523
- });
1524
- a.forEach(["post", "put", "patch"], function(t) {
1525
- function n(r) {
1526
- return function(o, i, l) {
1527
- return this.request(C(l || {}, {
1528
- method: t,
1529
- headers: r ? {
1530
- "Content-Type": "multipart/form-data"
1531
- } : {},
1532
- url: o,
1533
- data: i
1534
- }));
1535
- };
1536
- }
1537
- J.prototype[t] = n(), J.prototype[t + "Form"] = n(!0);
1538
- });
1539
- const $ = J;
1540
- class me {
1541
- constructor(t) {
1542
- if (typeof t != "function")
1543
- throw new TypeError("executor must be a function.");
1544
- let n;
1545
- this.promise = new Promise(function(o) {
1546
- n = o;
1547
- });
1548
- const r = this;
1549
- this.promise.then((s) => {
1550
- if (!r._listeners)
1551
- return;
1552
- let o = r._listeners.length;
1553
- for (; o-- > 0; )
1554
- r._listeners[o](s);
1555
- r._listeners = null;
1556
- }), this.promise.then = (s) => {
1557
- let o;
1558
- const i = new Promise((l) => {
1559
- r.subscribe(l), o = l;
1560
- }).then(s);
1561
- return i.cancel = function() {
1562
- r.unsubscribe(o);
1563
- }, i;
1564
- }, t(function(o, i, l) {
1565
- r.reason || (r.reason = new v(o, i, l), n(r.reason));
1566
- });
1567
- }
1568
- /**
1569
- * Throws a `CanceledError` if cancellation has been requested.
1570
- */
1571
- throwIfRequested() {
1572
- if (this.reason)
1573
- throw this.reason;
1574
- }
1575
- /**
1576
- * Subscribe to the cancel signal
1577
- */
1578
- subscribe(t) {
1579
- if (this.reason) {
1580
- t(this.reason);
1581
- return;
1582
- }
1583
- this._listeners ? this._listeners.push(t) : this._listeners = [t];
1584
- }
1585
- /**
1586
- * Unsubscribe from the cancel signal
1587
- */
1588
- unsubscribe(t) {
1589
- if (!this._listeners)
1590
- return;
1591
- const n = this._listeners.indexOf(t);
1592
- n !== -1 && this._listeners.splice(n, 1);
1593
- }
1594
- /**
1595
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1596
- * cancels the `CancelToken`.
1597
- */
1598
- static source() {
1599
- let t;
1600
- return {
1601
- token: new me(function(s) {
1602
- t = s;
1603
- }),
1604
- cancel: t
1605
- };
1606
- }
1607
- }
1608
- const Jn = me;
1609
- function Wn(e) {
1610
- return function(n) {
1611
- return e.apply(null, n);
1612
- };
1613
- }
1614
- function Kn(e) {
1615
- return a.isObject(e) && e.isAxiosError === !0;
1616
- }
1617
- const le = {
1618
- Continue: 100,
1619
- SwitchingProtocols: 101,
1620
- Processing: 102,
1621
- EarlyHints: 103,
1622
- Ok: 200,
1623
- Created: 201,
1624
- Accepted: 202,
1625
- NonAuthoritativeInformation: 203,
1626
- NoContent: 204,
1627
- ResetContent: 205,
1628
- PartialContent: 206,
1629
- MultiStatus: 207,
1630
- AlreadyReported: 208,
1631
- ImUsed: 226,
1632
- MultipleChoices: 300,
1633
- MovedPermanently: 301,
1634
- Found: 302,
1635
- SeeOther: 303,
1636
- NotModified: 304,
1637
- UseProxy: 305,
1638
- Unused: 306,
1639
- TemporaryRedirect: 307,
1640
- PermanentRedirect: 308,
1641
- BadRequest: 400,
1642
- Unauthorized: 401,
1643
- PaymentRequired: 402,
1644
- Forbidden: 403,
1645
- NotFound: 404,
1646
- MethodNotAllowed: 405,
1647
- NotAcceptable: 406,
1648
- ProxyAuthenticationRequired: 407,
1649
- RequestTimeout: 408,
1650
- Conflict: 409,
1651
- Gone: 410,
1652
- LengthRequired: 411,
1653
- PreconditionFailed: 412,
1654
- PayloadTooLarge: 413,
1655
- UriTooLong: 414,
1656
- UnsupportedMediaType: 415,
1657
- RangeNotSatisfiable: 416,
1658
- ExpectationFailed: 417,
1659
- ImATeapot: 418,
1660
- MisdirectedRequest: 421,
1661
- UnprocessableEntity: 422,
1662
- Locked: 423,
1663
- FailedDependency: 424,
1664
- TooEarly: 425,
1665
- UpgradeRequired: 426,
1666
- PreconditionRequired: 428,
1667
- TooManyRequests: 429,
1668
- RequestHeaderFieldsTooLarge: 431,
1669
- UnavailableForLegalReasons: 451,
1670
- InternalServerError: 500,
1671
- NotImplemented: 501,
1672
- BadGateway: 502,
1673
- ServiceUnavailable: 503,
1674
- GatewayTimeout: 504,
1675
- HttpVersionNotSupported: 505,
1676
- VariantAlsoNegotiates: 506,
1677
- InsufficientStorage: 507,
1678
- LoopDetected: 508,
1679
- NotExtended: 510,
1680
- NetworkAuthenticationRequired: 511
1681
- };
1682
- Object.entries(le).forEach(([e, t]) => {
1683
- le[t] = e;
1684
- });
1685
- const Xn = le;
1686
- function st(e) {
1687
- const t = new $(e), n = ve($.prototype.request, t);
1688
- return a.extend(n, $.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1689
- return st(C(e, s));
1690
- }, n;
1691
- }
1692
- const R = st(pe);
1693
- R.Axios = $;
1694
- R.CanceledError = v;
1695
- R.CancelToken = Jn;
1696
- R.isCancel = et;
1697
- R.VERSION = rt;
1698
- R.toFormData = G;
1699
- R.AxiosError = m;
1700
- R.Cancel = R.CanceledError;
1701
- R.all = function(t) {
1702
- return Promise.all(t);
1703
- };
1704
- R.spread = Wn;
1705
- R.isAxiosError = Kn;
1706
- R.mergeConfig = C;
1707
- R.AxiosHeaders = T;
1708
- R.formToJSON = (e) => Ye(a.isHTMLForm(e) ? new FormData(e) : e);
1709
- R.getAdapter = nt.getAdapter;
1710
- R.HttpStatusCode = Xn;
1711
- R.default = R;
1712
- const Gn = R, Qn = { class: "file-viewer" }, Zn = { class: "name" }, Yn = {
1713
- key: 0,
1714
- class: "content loading"
1715
- }, er = /* @__PURE__ */ Ue({
1716
- __name: "FileViewer",
1717
- props: {
1718
- file: {},
1719
- url: {}
1720
- },
1721
- setup(e) {
1722
- const t = e, n = B(!1), r = B(""), s = B(""), o = B(""), i = B();
1723
- return (() => {
1724
- const l = {
1725
- loading: "正在加载中,请耐心等待...",
1726
- reading: "正在努力解析文件...",
1727
- errorLoading: (c) => `加载文件异常:${c}`,
1728
- errorReading: (c) => `读取文件异常:${c}`
1729
- };
1730
- let u;
1731
- const p = {
1732
- // 从url加载
1733
- loadFromUrl() {
1734
- return w(this, null, function* () {
1735
- const { url: c } = t;
1736
- if (!c)
1737
- return;
1738
- this.startLoading(l.loading);
1739
- const y = c.substring(c.lastIndexOf("/") + 1);
1740
- try {
1741
- const { data: b } = yield Gn({ url: c, method: "get", responseType: "blob" });
1742
- if (!b)
1743
- return this.showError("文件下载失败");
1744
- const h = this.wrap(b, y);
1745
- return this.resolveFile(h);
1746
- } catch (b) {
1747
- this.showError(l.errorLoading(b));
1748
- } finally {
1749
- this.endLoading();
1750
- }
1751
- });
1752
- },
1753
- // 包装file
1754
- wrap(c, y) {
1755
- if (c instanceof File)
1756
- return c;
1757
- if (c instanceof Blob && y)
1758
- return new File([c], y, {});
1759
- if (c instanceof ArrayBuffer)
1760
- return this.wrap(new Blob([c]));
1761
- throw new Error("不支持的文件类型格式!");
1762
- },
1763
- // 处理并解析文件
1764
- resolveFile(c) {
1765
- return w(this, null, function* () {
1766
- n.value && this.endLoading();
1767
- const y = this.wrap(c);
1768
- this.startLoading(l.reading);
1769
- try {
1770
- o.value = y.name && decodeURIComponent(y.name) || "";
1771
- const b = yield bt(y);
1772
- b instanceof ArrayBuffer && (u = yield this.displayResult(b, y));
1773
- } catch (b) {
1774
- console.error(b), this.showError(l.errorReading(b));
1775
- } finally {
1776
- this.endLoading();
1777
- }
1778
- });
1779
- },
1780
- // 展示渲染最终效果
1781
- displayResult(c, y) {
1782
- const { name: b } = y, h = Nt(b), d = i.value;
1783
- if (!d)
1784
- return Promise.resolve();
1785
- u && (d.lastChild && d.removeChild(d.lastChild), u.unmount());
1786
- const E = document.createElement("div");
1787
- E.className = "file-render";
1788
- const S = d.appendChild(E);
1789
- return new Promise((O, x) => Ft(c, h, S).then(O).catch(x));
1790
- },
1791
- showError(c) {
1792
- r.value = c;
1793
- },
1794
- startLoading(c) {
1795
- n.value = !0, s.value = c, r.value = "";
1796
- },
1797
- endLoading() {
1798
- n.value = !1, s.value = "";
1799
- }
1800
- };
1801
- lt(() => {
1802
- t.file && p.resolveFile(t.file), p.loadFromUrl();
1803
- }), be(() => t.url, () => p.loadFromUrl()), be(() => t.file, (c) => c && p.resolveFile(c));
1804
- })(), (l, u) => (H(), M("div", Qn, [
1805
- ee("div", Zn, q(o.value), 1),
1806
- r.value ? (H(), M("div", Yn, q(r.value), 1)) : (H(), M(ut, { key: 1 }, [
1807
- Ee(ee("div", { class: "content loading" }, q(s.value), 513), [
1808
- [Re, n.value]
1809
- ]),
1810
- Ee(ee("div", {
1811
- class: "content",
1812
- ref_key: "output",
1813
- ref: i
1814
- }, null, 512), [
1815
- [Re, !n.value]
1816
- ])
1817
- ], 64))
1818
- ]));
1819
- }
1820
- });
1821
- const tr = /* @__PURE__ */ ke(er, [["__scopeId", "data-v-4732f9f2"]]), nr = [
1822
- ["file-viewer", tr]
1823
- ];
1824
- class rr {
1825
- constructor() {
1826
- we(this, "installed", !1);
1827
- }
1828
- install(t) {
1829
- this.installed || (nr.forEach(([n, r]) => t.component(n, r)), this.installed = !0);
1830
- }
1831
- }
1832
- const ir = new rr();
1833
- export {
1834
- tr as F,
1835
- ke as _,
1836
- ir as i
1837
- };