@flyfish-group/file-viewer3 1.0.5 → 1.0.7

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 (79) hide show
  1. package/LICENSE +160 -0
  2. package/README.md +103 -19
  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 -1469
  7. package/dist/components/OfdViewer.js +1 -0
  8. package/dist/components/PdfView.js +1 -22630
  9. package/dist/components/PptxRender.js +1 -22428
  10. package/dist/components/XlsxTable.js +1 -55468
  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 -5795
  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 -313
  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 +41 -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 +20 -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 +18 -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 +50 -42
  74. package/dist/components/_commonjs-dynamic-modules.js +0 -6
  75. package/dist/components/_commonjsHelpers.js +0 -30
  76. package/dist/components/index.js +0 -4914
  77. package/dist/index.d.ts +0 -48
  78. package/dist/style.css +0 -57
  79. package/dist/worker/xlsx.worker.js +0 -62
@@ -1,4914 +0,0 @@
1
- var Xn = Object.defineProperty, Qn = Object.defineProperties;
2
- var Yn = Object.getOwnPropertyDescriptors;
3
- var Dt = Object.getOwnPropertySymbols;
4
- var Zn = Object.prototype.hasOwnProperty, er = Object.prototype.propertyIsEnumerable;
5
- var xe = (e, t) => {
6
- if (t = Symbol[e])
7
- return t;
8
- throw Error("Symbol." + e + " is not defined");
9
- };
10
- var nt = (e, t, r) => t in e ? Xn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, J = (e, t) => {
11
- for (var r in t || (t = {}))
12
- Zn.call(t, r) && nt(e, r, t[r]);
13
- if (Dt)
14
- for (var r of Dt(t))
15
- er.call(t, r) && nt(e, r, t[r]);
16
- return e;
17
- }, oe = (e, t) => Qn(e, Yn(t));
18
- var ye = (e, t, r) => (nt(e, typeof t != "symbol" ? t + "" : t, r), r);
19
- var B = (e, t, r) => new Promise((n, s) => {
20
- var o = (l) => {
21
- try {
22
- i(r.next(l));
23
- } catch (c) {
24
- s(c);
25
- }
26
- }, a = (l) => {
27
- try {
28
- i(r.throw(l));
29
- } catch (c) {
30
- s(c);
31
- }
32
- }, i = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(o, a);
33
- i((r = r.apply(e, t)).next());
34
- }), ae = function(e, t) {
35
- this[0] = e, this[1] = t;
36
- }, rt = (e, t, r) => {
37
- var n = (a, i, l, c) => {
38
- try {
39
- var u = r[a](i), f = (i = u.value) instanceof ae, h = u.done;
40
- Promise.resolve(f ? i[0] : i).then((b) => f ? n(a === "return" ? a : "next", i[1] ? { done: b.done, value: b.value } : b, l, c) : l({ value: b, done: h })).catch((b) => n("throw", b, l, c));
41
- } catch (b) {
42
- c(b);
43
- }
44
- }, s = (a) => o[a] = (i) => new Promise((l, c) => n(a, i, l, c)), o = {};
45
- return r = r.apply(e, t), o[Symbol.asyncIterator] = () => o, s("next"), s("throw"), s("return"), o;
46
- }, st = (e) => {
47
- var t = e[xe("asyncIterator")], r = !1, n, s = {};
48
- return t == null ? (t = e[xe("iterator")](), n = (o) => s[o] = (a) => t[o](a)) : (t = t.call(e), n = (o) => s[o] = (a) => {
49
- if (r) {
50
- if (r = !1, o === "throw")
51
- throw a;
52
- return a;
53
- }
54
- return r = !0, {
55
- done: !1,
56
- value: new ae(new Promise((i) => {
57
- var l = t[o](a);
58
- if (!(l instanceof Object))
59
- throw TypeError("Object expected");
60
- i(l);
61
- }), 1)
62
- };
63
- }), s[xe("iterator")] = () => s, n("next"), "throw" in t ? n("throw") : s.throw = (o) => {
64
- throw o;
65
- }, "return" in t && n("return"), s;
66
- }, Lt = (e, t, r) => (t = e[xe("asyncIterator")]) ? t.call(e) : (e = e[xe("iterator")](), t = {}, r = (n, s) => (s = e[n]) && (t[n] = (o) => new Promise((a, i, l) => (o = s.call(e, o), l = o.done, Promise.resolve(o.value).then((c) => a({ value: c, done: l }), i)))), r("next"), r("return"), t);
67
- import { defineAsyncComponent as Be, createApp as he, createVNode as me, defineComponent as ln, openBlock as Oe, createElementBlock as Ie, toDisplayString as De, ref as we, onMounted as tr, watch as _t, createElementVNode as ot, Fragment as nr, withDirectives as Mt, vShow as Nt } from "vue";
68
- const rr = (() => {
69
- const e = {
70
- module: null,
71
- load() {
72
- return B(this, null, function* () {
73
- return this.module || (this.module = import("./docx-preview.js")), this.module;
74
- });
75
- }
76
- };
77
- return () => B(void 0, null, function* () {
78
- return yield e.load();
79
- });
80
- })();
81
- function sr(e, t) {
82
- return B(this, null, function* () {
83
- const { defaultOptions: r, renderAsync: n } = yield rr(), s = Object.assign(r, {
84
- debug: !0,
85
- experimental: !0
86
- });
87
- yield n(e, t, void 0, s);
88
- });
89
- }
90
- const Ut = globalThis.Buffer;
91
- let $t = 0;
92
- function te(e) {
93
- return String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
94
- }
95
- function G(e = "id") {
96
- return $t += 1, `${e}-${$t}`;
97
- }
98
- function Pe(e) {
99
- return e % 2 === 0 ? e : e + 1;
100
- }
101
- function or(e) {
102
- const t = e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
103
- if (Ut)
104
- return Ut.from(t).toString("base64");
105
- let r = "";
106
- const n = 32768;
107
- for (let s = 0; s < t.length; s += n)
108
- r += String.fromCharCode(...t.subarray(s, Math.min(s + n, t.length)));
109
- return btoa(r);
110
- }
111
- function He(e, t = "application/octet-stream") {
112
- return `data:${t};base64,${or(e)}`;
113
- }
114
- function un(e) {
115
- return String(e != null ? e : "").toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, "-").replace(/^-+|-+$/g, "") || "item";
116
- }
117
- function fn(e, t) {
118
- if (e === t)
119
- return !0;
120
- if (!e || !t)
121
- return !1;
122
- const r = Object.keys(e), n = Object.keys(t);
123
- if (r.length !== n.length)
124
- return !1;
125
- for (const s of r)
126
- if (e[s] !== t[s])
127
- return !1;
128
- return !0;
129
- }
130
- function Le(e, t, r) {
131
- const n = r ? J({ message: t }, r) : { message: t };
132
- return e.push(n), n;
133
- }
134
- function ne(e, t = 96) {
135
- if (!(e == null || Number.isNaN(e)))
136
- return e / 1440 * t;
137
- }
138
- function ar(e) {
139
- return String(e != null ? e : "").replace(/\u000b/g, `
140
- `).replace(/\u000c/g, `
141
- `);
142
- }
143
- function mt(e = "utf-8") {
144
- return new TextDecoder(e, { fatal: !1 });
145
- }
146
- const Ht = mt("utf-16le"), ir = mt(typeof TextDecoder != "undefined" ? "windows-1252" : "latin1");
147
- class k {
148
- constructor(t) {
149
- ye(this, "bytes");
150
- ye(this, "view");
151
- ye(this, "length");
152
- if (t instanceof Uint8Array)
153
- this.bytes = t;
154
- else if (t instanceof ArrayBuffer)
155
- this.bytes = new Uint8Array(t);
156
- else if (ArrayBuffer.isView(t))
157
- this.bytes = new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
158
- else
159
- throw new TypeError("BinaryReader expects ArrayBuffer or Uint8Array");
160
- this.view = new DataView(this.bytes.buffer, this.bytes.byteOffset, this.bytes.byteLength), this.length = this.bytes.byteLength;
161
- }
162
- ensure(t, r = 1) {
163
- return t >= 0 && t + r <= this.length;
164
- }
165
- u8(t) {
166
- return this.ensure(t, 1) ? this.view.getUint8(t) : 0;
167
- }
168
- i8(t) {
169
- return this.ensure(t, 1) ? this.view.getInt8(t) : 0;
170
- }
171
- u16(t) {
172
- return this.ensure(t, 2) ? this.view.getUint16(t, !0) : 0;
173
- }
174
- i16(t) {
175
- return this.ensure(t, 2) ? this.view.getInt16(t, !0) : 0;
176
- }
177
- u32(t) {
178
- return this.ensure(t, 4) ? this.view.getUint32(t, !0) : 0;
179
- }
180
- i32(t) {
181
- return this.ensure(t, 4) ? this.view.getInt32(t, !0) : 0;
182
- }
183
- u64(t) {
184
- const r = this.u32(t);
185
- return this.u32(t + 4) * 4294967296 + r;
186
- }
187
- slice(t, r) {
188
- return this.ensure(t, r) ? this.bytes.subarray(t, t + r) : new Uint8Array(0);
189
- }
190
- array(t, r, n) {
191
- var a;
192
- const s = [], o = (a = n.byteWidth) != null ? a : 1;
193
- for (let i = 0; i < r; i += 1)
194
- s.push(n.call(this, t + i * o));
195
- return s;
196
- }
197
- utf16le(t, r) {
198
- return this.ensure(t, r) ? Ht.decode(this.slice(t, r)) : "";
199
- }
200
- latin1(t, r) {
201
- return this.ensure(t, r) ? ir.decode(this.slice(t, r)) : "";
202
- }
203
- ascii(t, r) {
204
- var o;
205
- if (!this.ensure(t, r))
206
- return "";
207
- let n = "";
208
- const s = this.slice(t, r);
209
- for (let a = 0; a < s.length; a += 1)
210
- n += String.fromCharCode((o = s[a]) != null ? o : 0);
211
- return n;
212
- }
213
- utf16z(t, r) {
214
- const n = this.slice(t, r);
215
- let s = n.length;
216
- for (let o = 0; o + 1 < n.length; o += 2)
217
- if (n[o] === 0 && n[o + 1] === 0) {
218
- s = o;
219
- break;
220
- }
221
- return Ht.decode(n.subarray(0, s));
222
- }
223
- }
224
- k.prototype.u8.byteWidth = 1;
225
- k.prototype.i8.byteWidth = 1;
226
- k.prototype.u16.byteWidth = 2;
227
- k.prototype.i16.byteWidth = 2;
228
- k.prototype.u32.byteWidth = 4;
229
- k.prototype.i32.byteWidth = 4;
230
- function cr(e) {
231
- if (e instanceof Uint8Array)
232
- return e;
233
- if (e instanceof ArrayBuffer)
234
- return new Uint8Array(e);
235
- if (ArrayBuffer.isView(e))
236
- return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
237
- throw new TypeError("Unsupported binary input");
238
- }
239
- const jt = [208, 207, 17, 224, 161, 177, 26, 225], Je = 4294967295, pe = 4294967294, lr = 4294967293, ur = 4294967292, fr = 1 << 20, dr = 4096;
240
- function Wt(e) {
241
- return e === Je || e === pe || e === lr || e === ur;
242
- }
243
- function gt(e, t, r) {
244
- const n = 512 + r * t, s = n + t;
245
- if (n < 0 || s > e.length)
246
- throw new Error(`Sector ${r} is out of bounds`);
247
- return e.subarray(n, s);
248
- }
249
- function dn(e, t, r = fr) {
250
- const n = [], s = /* @__PURE__ */ new Set();
251
- let o = e, a = 0;
252
- for (; o !== pe && o !== Je && o >= 0; ) {
253
- if (s.has(o))
254
- throw new Error(`Detected sector loop at ${o}`);
255
- if (s.add(o), n.push(o), o = t(o), a += 1, a > r)
256
- throw new Error("Sector chain exceeds safe limit");
257
- }
258
- return n;
259
- }
260
- function Ae(e, t, r, n, s = null) {
261
- if (r === pe || r === Je || r < 0)
262
- return new Uint8Array(0);
263
- const o = dn(r, (l) => {
264
- var c;
265
- return (c = n[l]) != null ? c : pe;
266
- }), a = new Uint8Array(o.length * t);
267
- let i = 0;
268
- for (const l of o)
269
- a.set(gt(e, t, l), i), i += t;
270
- return s == null ? a : a.subarray(0, Math.min(s, a.length));
271
- }
272
- function pr(e) {
273
- function t(s, o) {
274
- if (s < 0 || s >= e.length)
275
- return;
276
- const a = e[s];
277
- a && (t(a.leftSiblingId, o), o.push(s), t(a.rightSiblingId, o));
278
- }
279
- function r(s) {
280
- const o = e[s];
281
- if (!o || o.childId < 0)
282
- return;
283
- const a = [];
284
- t(o.childId, a), o.children = a;
285
- for (const i of a) {
286
- const l = e[i];
287
- l && (l.parentId = s, r(i));
288
- }
289
- }
290
- const n = e.find((s) => s.objectType === 5);
291
- if (!n)
292
- throw new Error("CFB root storage not found");
293
- return r(n.id), n;
294
- }
295
- function hr(e) {
296
- var r;
297
- const t = /* @__PURE__ */ new Map();
298
- for (const n of e) {
299
- if (!n || !n.name)
300
- continue;
301
- const s = [];
302
- let o = n;
303
- for (; o; )
304
- o.objectType !== 5 && s.push(o.name), o = o.parentId != null && (r = e[o.parentId]) != null ? r : null;
305
- const a = `/${s.reverse().join("/")}`;
306
- n.path = a === "/" ? `/${n.name}` : a, t.set(n.path, n);
307
- }
308
- return t;
309
- }
310
- function mr(e) {
311
- return e.replace(/\u0000+$/, "");
312
- }
313
- function gr(e, t = {}) {
314
- const r = cr(e), n = new k(r), s = [];
315
- for (let w = 0; w < jt.length; w += 1)
316
- if (n.u8(w) !== jt[w])
317
- throw new Error("Not a Compound File Binary document");
318
- const o = n.u16(26), a = n.u16(30), i = n.u16(32), l = 1 << a, c = 1 << i, u = n.u32(40), f = n.u32(44), h = n.i32(48), b = n.u32(52), m = n.u32(56), y = n.i32(60), x = n.u32(64), T = n.i32(68), S = n.u32(72);
319
- m !== dr && Le(s, `Unexpected mini stream cutoff size ${m}`);
320
- const E = [];
321
- for (let w = 0; w < 109; w += 1) {
322
- const R = n.i32(76 + w * 4);
323
- !Wt(R) && R >= 0 && E.push(R);
324
- }
325
- const O = [...E];
326
- let A = T, D = 0;
327
- for (; A !== pe && A !== Je && A >= 0; ) {
328
- const w = gt(r, l, A), R = new k(w), L = l / 4 - 1;
329
- for (let M = 0; M < L; M += 1) {
330
- const V = R.i32(M * 4);
331
- !Wt(V) && V >= 0 && O.push(V);
332
- }
333
- if (A = R.i32(l - 4), D += 1, D > S + 4) {
334
- Le(s, "DIFAT chain exceeded declared sector count; stopping early");
335
- break;
336
- }
337
- }
338
- f && O.length < f && Le(s, `FAT sector count mismatch: header says ${f}, found ${O.length}`);
339
- const I = [];
340
- for (const w of O) {
341
- const R = gt(r, l, w), L = new k(R);
342
- for (let M = 0; M < l / 4; M += 1)
343
- I.push(L.i32(M * 4));
344
- }
345
- const U = Ae(r, l, h, I), v = new k(U), P = [];
346
- for (let w = 0, R = 0; w + 128 <= U.length; w += 128, R += 1) {
347
- const L = v.u16(w + 64), M = mr(v.utf16le(w, Math.max(0, L - 2)));
348
- !M && v.u8(w + 66) === 0 || P.push({
349
- id: R,
350
- name: M,
351
- objectType: v.u8(w + 66),
352
- colorFlag: v.u8(w + 67),
353
- leftSiblingId: v.i32(w + 68),
354
- rightSiblingId: v.i32(w + 72),
355
- childId: v.i32(w + 76),
356
- clsid: v.slice(w + 80, 16),
357
- stateBits: v.u32(w + 96),
358
- creationTime: v.u64(w + 100),
359
- modifiedTime: v.u64(w + 108),
360
- startSector: v.i32(w + 116),
361
- streamSize: o === 3 ? v.u32(w + 120) : v.u64(w + 120),
362
- children: [],
363
- parentId: null
364
- });
365
- }
366
- const j = pr(P), z = hr(P), se = [];
367
- if (x && y >= 0) {
368
- const w = Ae(r, l, y, I), R = new k(w);
369
- for (let L = 0; L + 4 <= w.length; L += 4)
370
- se.push(R.i32(L));
371
- }
372
- const tt = Ae(r, l, j.startSector, I, j.streamSize);
373
- function Jn(w) {
374
- if (w.startSector < 0)
375
- return new Uint8Array(0);
376
- const R = dn(w.startSector, (V) => {
377
- var Y;
378
- return (Y = se[V]) != null ? Y : pe;
379
- }), L = new Uint8Array(R.length * c);
380
- let M = 0;
381
- for (const V of R) {
382
- const Y = V * c, ke = Y + c;
383
- if (ke > tt.length)
384
- throw new Error(`Mini sector ${V} is out of bounds`);
385
- L.set(tt.subarray(Y, ke), M), M += c;
386
- }
387
- return L.subarray(0, Math.min(w.streamSize, L.length));
388
- }
389
- function Kn(w) {
390
- var L;
391
- const R = typeof w == "string" ? (L = z.get(w)) != null ? L : null : w;
392
- return !R || R.objectType !== 2 && R.objectType !== 5 ? null : R.objectType === 5 ? tt : R.streamSize < m && R.startSector >= 0 && se.length ? Jn(R) : Ae(r, l, R.startSector, I, R.streamSize);
393
- }
394
- function Gn(w) {
395
- var L;
396
- const R = typeof w == "string" ? (L = z.get(w)) != null ? L : null : w;
397
- return R ? (R.children || []).map((M) => P[M]).filter((M) => !!M) : [];
398
- }
399
- return {
400
- bytes: r,
401
- majorVersion: o,
402
- sectorSize: l,
403
- miniSectorSize: c,
404
- numDirSectors: u,
405
- numFatSectors: f,
406
- firstDirSector: h,
407
- transactionSignature: b,
408
- miniStreamCutoffSize: m,
409
- warnings: s,
410
- entries: P,
411
- root: j,
412
- pathMap: z,
413
- getEntry(w) {
414
- var R;
415
- return (R = z.get(w)) != null ? R : null;
416
- },
417
- getStream: Kn,
418
- listChildren: Gn,
419
- findByName(w, R = "/") {
420
- var V;
421
- const L = R === "/" ? j : (V = z.get(R)) != null ? V : null;
422
- if (!L)
423
- return null;
424
- const M = [L];
425
- for (; M.length; ) {
426
- const Y = M.pop();
427
- if (Y) {
428
- if (Y.name === w)
429
- return Y;
430
- for (const ke of Y.children || []) {
431
- const It = P[ke];
432
- It && M.push(It);
433
- }
434
- }
435
- }
436
- return null;
437
- }
438
- };
439
- }
440
- const br = {
441
- "‚": "‚",
442
- "ƒ": "ƒ",
443
- "„": "„",
444
- "…": "…",
445
- "†": "†",
446
- "‡": "‡",
447
- "ˆ": "ˆ",
448
- "‰": "‰",
449
- "Š": "Š",
450
- "‹": "‹",
451
- "Œ": "Œ",
452
- "‘": "‘",
453
- "’": "’",
454
- "“": "“",
455
- "”": "”",
456
- "•": "•",
457
- "–": "–",
458
- "—": "—",
459
- "˜": "˜",
460
- "™": "™",
461
- "š": "š",
462
- "›": "›",
463
- "œ": "œ",
464
- "Ÿ": "Ÿ"
465
- };
466
- function xr(e) {
467
- return e.replace(/[\x82-\x8C\x91-\x9C\x9F]/g, (t) => br[t] || t);
468
- }
469
- function yr(e) {
470
- var r;
471
- let t = "";
472
- for (let n = 0; n < e.length; n += 1)
473
- t += String.fromCharCode((r = e[n]) != null ? r : 0);
474
- return xr(t);
475
- }
476
- function wr(e) {
477
- return new TextDecoder("utf-16le").decode(e);
478
- }
479
- function Tr(e, t) {
480
- const r = t.fcClx, n = t.lcbClx;
481
- if (r == null || n == null || n <= 0)
482
- throw new Error("FIB does not point to a CLX structure");
483
- const s = e.subarray(r, r + n), o = new k(s);
484
- let a = 0;
485
- const i = [];
486
- for (; a < s.length && o.u8(a) === 1; ) {
487
- const f = o.u16(a + 1);
488
- i.push({ type: 1, cbGrpprl: f, bytes: o.slice(a + 3, f) }), a += 3 + f;
489
- }
490
- if (o.u8(a) !== 2)
491
- throw new Error("CLX does not contain a Pcdt marker");
492
- const l = o.u32(a + 1), c = o.slice(a + 5, l), u = Pr(c);
493
- return { prcs: i, pcdt: { lcb: l, pieceTable: u } };
494
- }
495
- function Pr(e) {
496
- var a, i;
497
- if (!e.length)
498
- throw new Error("Empty PlcPcd");
499
- const t = new k(e), r = (e.length - 4) / 12;
500
- if (!Number.isInteger(r) || r < 0)
501
- throw new Error("Invalid PlcPcd size");
502
- const n = [];
503
- for (let l = 0; l < r + 1; l += 1)
504
- n.push(t.u32(l * 4));
505
- const s = [];
506
- let o = (r + 1) * 4;
507
- for (let l = 0; l < r; l += 1) {
508
- const c = t.u16(o), u = t.u32(o + 2) >>> 0, f = t.u16(o + 6), h = !!(u & 1073741824), b = u & 1073741823, m = (a = n[l]) != null ? a : 0, y = (i = n[l + 1]) != null ? i : m, x = h ? Math.floor(b / 2) : b, T = h ? y - m : (y - m) * 2;
509
- s.push({
510
- index: l,
511
- descriptor: c,
512
- fNoParaLast: !!(c & 1),
513
- fRaw: !!(c & 2),
514
- prm: f,
515
- compressed: h,
516
- fcRaw: u,
517
- fc: b,
518
- cpStart: m,
519
- cpEnd: y,
520
- actualByteStart: x,
521
- byteLength: T,
522
- actualByteEnd: x + T
523
- }), o += 8;
524
- }
525
- return { cps: n, pieces: s };
526
- }
527
- function Sr(e, t) {
528
- const r = e.subarray(t.actualByteStart, t.actualByteEnd);
529
- return t.compressed ? yr(r) : wr(r);
530
- }
531
- function Cr(e, t) {
532
- return t.pcdt.pieceTable.pieces.map((r) => Sr(e, r));
533
- }
534
- function je(e, t, r = null) {
535
- const n = e.pcdt.pieceTable.pieces, s = r == null ? !!(t & 1073741824) : r, o = r == null ? t & 1073741823 : t, a = s ? Math.floor(o / 2) : o;
536
- for (const i of n) {
537
- if (a < i.actualByteStart || a > i.actualByteEnd)
538
- continue;
539
- const l = a - i.actualByteStart, c = i.cpStart + Math.floor(l / (i.compressed ? 1 : 2));
540
- if (c >= i.cpStart && c <= i.cpEnd)
541
- return c;
542
- }
543
- for (const i of n) {
544
- if (t < i.actualByteStart || t > i.actualByteEnd)
545
- continue;
546
- const l = t - i.actualByteStart, c = i.cpStart + Math.floor(l / (i.compressed ? 1 : 2));
547
- if (c >= i.cpStart && c <= i.cpEnd)
548
- return c;
549
- }
550
- return null;
551
- }
552
- function Er(e, t, r, n, s) {
553
- var a;
554
- if (s <= n)
555
- return "";
556
- const o = [];
557
- for (let i = 0; i < t.pcdt.pieceTable.pieces.length; i += 1) {
558
- const l = t.pcdt.pieceTable.pieces[i];
559
- if (l.cpEnd <= n)
560
- continue;
561
- if (l.cpStart >= s)
562
- break;
563
- const c = Math.max(n, l.cpStart) - l.cpStart, u = Math.min(s, l.cpEnd) - l.cpStart;
564
- o.push(((a = r[i]) != null ? a : "").slice(c, u));
565
- }
566
- return o.join("");
567
- }
568
- function Br(e) {
569
- const t = [];
570
- let r = 0;
571
- for (let n = 0; n < e.length; n += 1) {
572
- const s = e[n];
573
- (s === "\r" || s === "\x07") && (t.push({ cpStart: r, cpEnd: n + 1, terminator: s }), r = n + 1);
574
- }
575
- return r < e.length && t.push({ cpStart: r, cpEnd: e.length, terminator: "" }), t;
576
- }
577
- const q = {
578
- paragraph: "\r",
579
- cellMark: "\x07",
580
- picture: "",
581
- fieldStart: "",
582
- fieldSeparator: "",
583
- fieldEnd: "",
584
- annotationRef: "",
585
- hardLineBreak: "\v",
586
- pageBreak: "\f",
587
- nonBreakingHyphen: "",
588
- nonRequiredHyphen: ""
589
- }, Fr = {
590
- 0: "none",
591
- 1: "single",
592
- 2: "word",
593
- 3: "double",
594
- 4: "dotted",
595
- 5: "hidden",
596
- 6: "thick",
597
- 7: "dash",
598
- 9: "dot-dash",
599
- 10: "dot-dot-dash",
600
- 11: "wave",
601
- 16: "dotted-heavy",
602
- 17: "dashed-heavy",
603
- 18: "dash-long",
604
- 19: "dash-long-heavy",
605
- 20: "dot-dash-heavy",
606
- 21: "dot-dot-dash-heavy",
607
- 22: "wavy-heavy",
608
- 23: "wavy-double"
609
- }, Rr = {
610
- 0: "left",
611
- 1: "center",
612
- 2: "right",
613
- 3: "justify",
614
- 4: "distributed"
615
- }, kr = {
616
- 0: "top",
617
- 1: "center",
618
- 2: "bottom"
619
- }, bt = {
620
- 1: "#000000",
621
- 2: "#0000ff",
622
- 3: "#00ffff",
623
- 4: "#00ff00",
624
- 5: "#ff00ff",
625
- 6: "#ff0000",
626
- 7: "#ffff00",
627
- 8: "#ffffff",
628
- 9: "#000080",
629
- 10: "#008080",
630
- 11: "#008000",
631
- 12: "#800080",
632
- 13: "#800000",
633
- 14: "#808000",
634
- 15: "#808080",
635
- 16: "#c0c0c0"
636
- }, Ar = [
637
- "StshfOrig",
638
- "Stshf",
639
- "PlcffndRef",
640
- "PlcffndTxt",
641
- "PlcfandRef",
642
- "PlcfandTxt",
643
- "PlcfSed",
644
- "PlcPad",
645
- "PlcfPhe",
646
- "SttbfGlsy",
647
- "PlcfGlsy",
648
- "PlcfHdd",
649
- "PlcfBteChpx",
650
- "PlcfBtePapx",
651
- "PlcfSea",
652
- "SttbfFfn",
653
- "PlcfFldMom",
654
- "PlcfFldHdr",
655
- "PlcfFldFtn",
656
- "PlcfFldAtn",
657
- "PlcfFldMcr",
658
- "SttbfBkmk",
659
- "PlcfBkf",
660
- "PlcfBkl",
661
- "Cmds",
662
- "Unused1",
663
- "SttbfMcr",
664
- "PrDrvr",
665
- "PrEnvPort",
666
- "PrEnvLand",
667
- "Wss",
668
- "Dop",
669
- "SttbfAssoc",
670
- "Clx",
671
- "PlcfPgdFtn",
672
- "AutosaveSource",
673
- "GrpXstAtnOwners",
674
- "SttbfAtnBkmk",
675
- "Unused2",
676
- "Unused3",
677
- "PlcSpaMom",
678
- "PlcSpaHdr",
679
- "PlcfAtnBkf",
680
- "PlcfAtnBkl",
681
- "Pms",
682
- "FormFldSttbs",
683
- "PlcfendRef",
684
- "PlcfendTxt",
685
- "PlcfFldEdn",
686
- "Unused4",
687
- "DggInfo",
688
- "SttbfRMark",
689
- "SttbfCaption",
690
- "SttbfAutoCaption",
691
- "PlcfWkb",
692
- "PlcfSpl",
693
- "PlcftxbxTxt",
694
- "PlcfFldTxbx",
695
- "PlcfHdrtxbxTxt",
696
- "PlcffldHdrTxbx",
697
- "StwUser",
698
- "SttbTtmbd",
699
- "CookieData",
700
- "PgdMotherOldOld",
701
- "BkdMotherOldOld",
702
- "PgdFtnOldOld",
703
- "BkdFtnOldOld",
704
- "PgdEdnOldOld",
705
- "BkdEdnOldOld",
706
- "SttbfIntlFld",
707
- "RouteSlip",
708
- "SttbSavedBy",
709
- "SttbFnm",
710
- "PlfLst",
711
- "PlfLfo",
712
- "PlcfTxbxBkd",
713
- "PlcfTxbxHdrBkd",
714
- "DocUndoWord9",
715
- "RgbUse",
716
- "Usp",
717
- "Uskf",
718
- "PlcupcRgbUse",
719
- "PlcupcUsp",
720
- "SttbGlsyStyle",
721
- "Plgosl",
722
- "Plcocx",
723
- "PlcfBteLvc",
724
- "dwLowDateTime",
725
- "dwHighDateTime",
726
- "PlcfLvcPre10",
727
- "PlcfAsumy",
728
- "PlcfGram",
729
- "SttbListNames",
730
- "SttbfUssr"
731
- ];
732
- function vr(e) {
733
- const t = new k(e), r = Or(t);
734
- let n = 32;
735
- const s = t.u16(n);
736
- n += 2;
737
- const o = t.slice(n, s * 2);
738
- n += s * 2;
739
- const a = t.u16(n);
740
- n += 2;
741
- const i = t.slice(n, a * 4);
742
- n += a * 4;
743
- const l = t.u16(n);
744
- n += 2;
745
- const c = t.slice(n, l * 8);
746
- n += l * 8;
747
- const u = t.ensure(n, 2) ? t.u16(n) : 0;
748
- t.ensure(n, 2) && (n += 2);
749
- const f = u ? t.slice(n, u * 2) : new Uint8Array(0), h = Ir(i), b = Dr(c, l), m = u ? new k(f).u16(0) : 0;
750
- return {
751
- base: r,
752
- csw: s,
753
- cslw: a,
754
- cbRgFcLcb: l,
755
- cswNew: u,
756
- nFibNew: m,
757
- fibRgWBytes: o,
758
- fibRgLwBytes: i,
759
- fibRgFcLcbBytes: c,
760
- fibRgCswNewBytes: f,
761
- fibRgLw: h,
762
- fibRgFcLcb: b
763
- };
764
- }
765
- function Or(e) {
766
- const t = e.u16(0), r = e.u16(2), n = e.u16(6), s = e.u16(8), o = e.u16(10), a = e.u16(18);
767
- return {
768
- wIdent: t,
769
- nFib: r,
770
- lid: n,
771
- pnNext: s,
772
- flags: o,
773
- envFlags: a,
774
- fDot: !!(o & 1),
775
- fGlsy: !!(o & 2),
776
- fComplex: !!(o & 4),
777
- fHasPic: !!(o & 8),
778
- cQuickSaves: o >> 4 & 15,
779
- fEncrypted: !!(o & 256),
780
- fWhichTblStm: o & 512 ? 1 : 0,
781
- fReadOnlyRecommended: !!(o & 1024),
782
- fWriteReservation: !!(o & 2048),
783
- fExtChar: !!(o & 4096),
784
- fLoadOverride: !!(o & 8192),
785
- fFarEast: !!(o & 16384),
786
- fObfuscated: !!(o & 32768),
787
- nFibBack: e.u16(12),
788
- lKey: e.u32(14),
789
- envr: e.u8(18),
790
- fMac: !!(a & 1),
791
- fEmptySpecial: !!(a & 2),
792
- fLoadOverridePage: !!(a & 4)
793
- };
794
- }
795
- function Ir(e) {
796
- var n, s, o, a, i, l, c, u, f;
797
- const t = new k(e), r = [];
798
- for (let h = 0; h + 4 <= e.length; h += 4)
799
- r.push(t.i32(h));
800
- return {
801
- raw: r,
802
- cbMac: (n = r[0]) != null ? n : 0,
803
- ccpText: (s = r[3]) != null ? s : 0,
804
- ccpFtn: (o = r[4]) != null ? o : 0,
805
- ccpHdd: (a = r[5]) != null ? a : 0,
806
- ccpMcr: (i = r[6]) != null ? i : 0,
807
- ccpAtn: (l = r[7]) != null ? l : 0,
808
- ccpEdn: (c = r[8]) != null ? c : 0,
809
- ccpTxbx: (u = r[9]) != null ? u : 0,
810
- ccpHdrTxbx: (f = r[10]) != null ? f : 0
811
- };
812
- }
813
- function Dr(e, t) {
814
- const r = new k(e), n = { _pairs: [] }, s = [];
815
- for (let o = 0; o < t && o * 8 + 8 <= e.length; o += 1) {
816
- const a = r.u32(o * 8), i = r.u32(o * 8 + 4), l = Ar[o] || `Field${o}`;
817
- n[`fc${l}`] = a, n[`lcb${l}`] = i, s.push({ name: l, fc: a, lcb: i, index: o });
818
- }
819
- return n._pairs = s, n;
820
- }
821
- const d = {
822
- sprmCFRMarkDel: 2048,
823
- sprmCFRMark: 2049,
824
- sprmCFFldVanish: 2050,
825
- sprmCPicLocation: 27139,
826
- sprmCIbstRMark: 18436,
827
- sprmCDttmRMark: 26629,
828
- sprmCFData: 2054,
829
- sprmCFOle2: 2058,
830
- sprmCHighlight: 10764,
831
- sprmCIstd: 18992,
832
- sprmCPlain: 10803,
833
- sprmCFBold: 2101,
834
- sprmCFItalic: 2102,
835
- sprmCFStrike: 2103,
836
- sprmCFOutline: 2104,
837
- sprmCFShadow: 2105,
838
- sprmCFSmallCaps: 2106,
839
- sprmCFCaps: 2107,
840
- sprmCFVanish: 2108,
841
- sprmCKul: 10814,
842
- sprmCDxaSpace: 34880,
843
- sprmCIco: 10818,
844
- sprmCHps: 19011,
845
- sprmCHpsPos: 18501,
846
- sprmCSymbol: 27145,
847
- sprmCHpsKern: 18507,
848
- sprmCRgFtc0: 19023,
849
- sprmCRgFtc1: 19024,
850
- sprmCRgFtc2: 19025,
851
- sprmCCharScale: 18514,
852
- sprmCFDStrike: 10835,
853
- sprmCFImprint: 2132,
854
- sprmCFSpec: 2133,
855
- sprmCFObj: 2134,
856
- sprmCFEmboss: 2136,
857
- sprmCFBiDi: 2138,
858
- sprmCFBoldBi: 2140,
859
- sprmCFItalicBi: 2141,
860
- sprmCFtcBi: 19038,
861
- sprmCIcoBi: 19040,
862
- sprmCHpsBi: 19041,
863
- sprmPIstd: 17920,
864
- sprmPIstdPermute: 50689,
865
- sprmPIncLvl: 9730,
866
- sprmPJc80: 9219,
867
- sprmPFKeep: 9221,
868
- sprmPFKeepFollow: 9222,
869
- sprmPFPageBreakBefore: 9223,
870
- sprmPIlvl: 9738,
871
- sprmPIlfo: 17931,
872
- sprmPChgTabsPapx: 50701,
873
- sprmPDxaRight80: 33806,
874
- sprmPDxaLeft80: 33807,
875
- sprmPNest80: 17936,
876
- sprmPDxaLeft180: 33809,
877
- sprmPDyaLine: 25618,
878
- sprmPDyaBefore: 42003,
879
- sprmPDyaAfter: 42004,
880
- sprmPChgTabs: 50709,
881
- sprmPFInTable: 9238,
882
- sprmPFTtp: 9239,
883
- sprmPDxaAbs: 33816,
884
- sprmPDyaAbs: 33817,
885
- sprmPDxaWidth: 33818,
886
- sprmPPc: 9755,
887
- sprmPWr: 9251,
888
- sprmPBrcTop80: 25636,
889
- sprmPBrcLeft80: 25637,
890
- sprmPBrcBottom80: 25638,
891
- sprmPBrcRight80: 25639,
892
- sprmPBrcBetween80: 25640,
893
- sprmPBrcBar80: 26153,
894
- sprmPWHeightAbs: 17451,
895
- sprmPDcs: 17452,
896
- sprmPShd80: 17453,
897
- sprmPDyaFromText: 33838,
898
- sprmPDxaFromText: 33839,
899
- sprmPFLocked: 9264,
900
- sprmPFWidowControl: 9265,
901
- sprmPFBiDi: 9281,
902
- sprmPHugePapx: 26182,
903
- sprmPFAdjustRight: 9288,
904
- sprmPItap: 26185,
905
- sprmPDtap: 26186,
906
- sprmPFInnerTableCell: 9291,
907
- sprmPFInnerTtp: 9292,
908
- sprmPShd: 50765,
909
- sprmPBrcTop: 50766,
910
- sprmPBrcLeft: 50767,
911
- sprmPBrcBottom: 50768,
912
- sprmPBrcRight: 50769,
913
- sprmPBrcBetween: 50770,
914
- sprmPBrcBar: 50771,
915
- sprmPDxcRight: 17493,
916
- sprmPDxcLeft: 17494,
917
- sprmPDxcLeft1: 17495,
918
- sprmPDylBefore: 17496,
919
- sprmPDylAfter: 17497,
920
- sprmPFDyaBeforeAuto: 9307,
921
- sprmPFDyaAfterAuto: 9308,
922
- sprmPDxaRight: 33885,
923
- sprmPDxaLeft: 33886,
924
- sprmPNest: 18015,
925
- sprmPDxaLeft1: 33888,
926
- sprmPJc: 9313,
927
- sprmTJc90: 21504,
928
- sprmTDxaLeft: 38401,
929
- sprmTDxaGapHalf: 38402,
930
- sprmTFCantSplit90: 13315,
931
- sprmTTableHeader: 13316,
932
- sprmTTableBorders80: 54789,
933
- sprmTDyaRowHeight: 37895,
934
- sprmTDefTable: 54792,
935
- sprmTDefTableShd80: 54793,
936
- sprmTTlp: 29706,
937
- sprmTFBiDi: 22027,
938
- sprmTDefTableShd3rd: 54796,
939
- sprmTPc: 13837,
940
- sprmTDxaAbs: 37902,
941
- sprmTDyaAbs: 37903,
942
- sprmTDxaFromText: 37904,
943
- sprmTDyaFromText: 37905,
944
- sprmTDefTableShd: 54802,
945
- sprmTTableBorders: 54803,
946
- sprmTTableWidth: 62996,
947
- sprmTFAutofit: 13845,
948
- sprmTWidthBefore: 62999,
949
- sprmTWidthAfter: 63e3,
950
- sprmTSetBrc80: 54816,
951
- sprmTInsert: 30241,
952
- sprmTDelete: 22050,
953
- sprmTDxaCol: 30243,
954
- sprmTMerge: 22052,
955
- sprmTSplit: 22053,
956
- sprmTTextFlow: 30249,
957
- sprmTVertMerge: 54827,
958
- sprmTVertAlign: 54828,
959
- sprmTSetShd: 54829,
960
- sprmTSetShdOdd: 54830,
961
- sprmTSetBrc: 54831,
962
- sprmTCellPadding: 54834,
963
- sprmTCellPaddingDefault: 54835,
964
- sprmTCellWidth: 54837,
965
- sprmTFitText: 63030,
966
- sprmTFCellNoWrap: 54841,
967
- sprmTIstd: 22074
968
- }, Lr = /* @__PURE__ */ new Set([
969
- d.sprmPChgTabs,
970
- d.sprmPChgTabsPapx,
971
- d.sprmTDefTable,
972
- d.sprmTTableBorders80,
973
- d.sprmTTableBorders,
974
- d.sprmTDefTableShd,
975
- d.sprmTDefTableShd80,
976
- d.sprmTDefTableShd3rd,
977
- d.sprmTSetBrc80,
978
- d.sprmTSetBrc,
979
- d.sprmTSetShd,
980
- d.sprmTSetShdOdd,
981
- d.sprmTCellPadding,
982
- d.sprmTCellPaddingDefault,
983
- d.sprmTCellWidth,
984
- d.sprmTVertAlign,
985
- d.sprmTVertMerge,
986
- d.sprmTTextFlow,
987
- d.sprmTDxaCol
988
- ]);
989
- function _r(e) {
990
- return e >> 13 & 7;
991
- }
992
- function $(e, t = 0) {
993
- var r, n;
994
- return t + 2 > e.length ? 0 : ((r = e[t]) != null ? r : 0) | ((n = e[t + 1]) != null ? n : 0) << 8;
995
- }
996
- function _(e, t = 0) {
997
- const r = $(e, t);
998
- return r > 32767 ? r - 65536 : r;
999
- }
1000
- function _e(e, t = 0) {
1001
- var r, n, s, o;
1002
- return t + 4 > e.length ? 0 : (((r = e[t]) != null ? r : 0) | ((n = e[t + 1]) != null ? n : 0) << 8 | ((s = e[t + 2]) != null ? s : 0) << 16 | ((o = e[t + 3]) != null ? o : 0) << 24 >>> 0) >>> 0;
1003
- }
1004
- function le(e, t = 0) {
1005
- var r, n;
1006
- return {
1007
- first: (r = e[t]) != null ? r : 0,
1008
- lim: (n = e[t + 1]) != null ? n : 0
1009
- };
1010
- }
1011
- function K(e, t = 0) {
1012
- if (t + 4 > e.length)
1013
- return null;
1014
- const r = _e(e, t) >>> 0, n = r & 255, s = r >> 8 & 255, o = r >> 16 & 255;
1015
- return { raw: r, lineWidth: n, borderType: s, color: o };
1016
- }
1017
- function Mr(e, t = 0) {
1018
- const r = $(e, t);
1019
- return {
1020
- raw: r,
1021
- horzMerge: r & 3,
1022
- textFlow: r >> 2 & 7,
1023
- vertMerge: r >> 5 & 3,
1024
- vertAlign: r >> 7 & 3,
1025
- ftsWidth: r >> 9 & 7,
1026
- fitText: !!(r & 4096),
1027
- noWrap: !!(r & 8192),
1028
- hideMark: !!(r & 16384)
1029
- };
1030
- }
1031
- function pn(e, t = 0) {
1032
- return t + 20 > e.length ? null : {
1033
- tcgrf: Mr(e, t),
1034
- wWidth: $(e, t + 2),
1035
- borders: {
1036
- top: K(e, t + 4) || {},
1037
- left: K(e, t + 8) || {},
1038
- bottom: K(e, t + 12) || {},
1039
- right: K(e, t + 16) || {}
1040
- }
1041
- };
1042
- }
1043
- function Nr(e) {
1044
- var a;
1045
- if (e.length < 3)
1046
- return null;
1047
- const t = $(e, 0), r = (a = e[2]) != null ? a : 0;
1048
- let n = 3;
1049
- const s = [];
1050
- for (let i = 0; i < r + 1 && n + 2 <= e.length; i += 1)
1051
- s.push(_(e, n)), n += 2;
1052
- const o = [];
1053
- for (let i = 0; i < r && n + 20 <= e.length; i += 1) {
1054
- const l = pn(e, n);
1055
- l && o.push(l), n += 20;
1056
- }
1057
- return { cb: t, numberOfColumns: r, rgdxaCenter: s, cells: o };
1058
- }
1059
- function fe(e) {
1060
- var r, n;
1061
- return e.length ? {
1062
- cb: (r = e[0]) != null ? r : 0,
1063
- range: le(e, 1),
1064
- value: (n = e[3]) != null ? n : 0,
1065
- extra: e.subarray(4)
1066
- } : null;
1067
- }
1068
- function at(e) {
1069
- var n, s;
1070
- if (!e.length)
1071
- return null;
1072
- const t = (n = e[0]) != null ? n : 0, r = $(e, 4);
1073
- return {
1074
- cb: t,
1075
- range: le(e, 1),
1076
- ftsWidth: (s = e[3]) != null ? s : 0,
1077
- width: r,
1078
- wWidth: r
1079
- };
1080
- }
1081
- function Ur(e) {
1082
- var t;
1083
- return e.length ? {
1084
- cb: (t = e[0]) != null ? t : 0,
1085
- range: le(e, 1),
1086
- border: K(e, 3) || {},
1087
- extra: e.subarray(7)
1088
- } : null;
1089
- }
1090
- function it(e) {
1091
- var r;
1092
- if (!e.length)
1093
- return null;
1094
- const t = $(e, 1);
1095
- return {
1096
- ftsWidth: (r = e[0]) != null ? r : 0,
1097
- width: t,
1098
- wWidth: t
1099
- };
1100
- }
1101
- function $r(e) {
1102
- var i;
1103
- if (!e.length)
1104
- return null;
1105
- const t = (i = e[0]) != null ? i : 0, r = le(e, 1), n = r.lim - r.first;
1106
- let s = 3;
1107
- const o = [];
1108
- for (let l = 0; l < n && s + 2 <= e.length; l += 1)
1109
- o.push(_(e, s)), s += 2;
1110
- const a = [];
1111
- for (let l = 0; l < n && s + 20 <= e.length; l += 1)
1112
- a.push(pn(e, s)), s += 20;
1113
- return { cb: t, range: r, itcFirst: r.first, ctc: n, dxaCol: o, cells: a };
1114
- }
1115
- function Hr(e, t, r) {
1116
- var s, o;
1117
- const n = r >> 13 & 7;
1118
- if (t >= e.length)
1119
- return 0;
1120
- if (r === d.sprmTDefTable) {
1121
- const a = $(e, t);
1122
- return a ? a + 1 : 0;
1123
- }
1124
- if (Lr.has(r))
1125
- return ((s = e[t]) != null ? s : 0) + 1;
1126
- switch (n) {
1127
- case 0:
1128
- return 1;
1129
- case 1:
1130
- return 1;
1131
- case 2:
1132
- return 2;
1133
- case 3:
1134
- return 4;
1135
- case 4:
1136
- return 2;
1137
- case 5:
1138
- return 2;
1139
- case 6:
1140
- return ((o = e[t]) != null ? o : 0) + 1;
1141
- case 7:
1142
- return 3;
1143
- default:
1144
- return 0;
1145
- }
1146
- }
1147
- function F(e) {
1148
- var t;
1149
- return !!((t = e[0]) != null && t);
1150
- }
1151
- function g(e, t, r, n, s) {
1152
- return { kind: e, name: t, value: r, raw: n, operandBytes: s };
1153
- }
1154
- function jr(e, t) {
1155
- var o, a, i, l, c, u, f, h;
1156
- const r = _r(e), n = t, s = e;
1157
- switch (e) {
1158
- case d.sprmCPicLocation:
1159
- return g("char", "pictureOffset", _e(n, 0) >>> 0, s, n);
1160
- case d.sprmCFData:
1161
- return g("char", "data", F(n), s, n);
1162
- case d.sprmCFOle2:
1163
- return g("char", "ole2", F(n), s, n);
1164
- case d.sprmCIstd:
1165
- return g("char", "charStyleId", $(n, 0), s, n);
1166
- case d.sprmCPlain:
1167
- return g("char", "plain", F(n), s, n);
1168
- case d.sprmCFBold:
1169
- return g("char", "bold", F(n), s, n);
1170
- case d.sprmCFItalic:
1171
- return g("char", "italic", F(n), s, n);
1172
- case d.sprmCFStrike:
1173
- return g("char", "strike", F(n), s, n);
1174
- case d.sprmCFOutline:
1175
- return g("char", "outline", F(n), s, n);
1176
- case d.sprmCFShadow:
1177
- return g("char", "shadow", F(n), s, n);
1178
- case d.sprmCFSmallCaps:
1179
- return g("char", "smallCaps", F(n), s, n);
1180
- case d.sprmCFCaps:
1181
- return g("char", "caps", F(n), s, n);
1182
- case d.sprmCFVanish:
1183
- return g("char", "hidden", F(n), s, n);
1184
- case d.sprmCKul:
1185
- return g("char", "underline", (o = n[0]) != null ? o : 0, s, n);
1186
- case d.sprmCDxaSpace:
1187
- return g("char", "spacing", _(n, 0), s, n);
1188
- case d.sprmCIco:
1189
- case d.sprmCIcoBi:
1190
- return g("char", "colorIndex", (a = n[0]) != null ? a : 0, s, n);
1191
- case d.sprmCHighlight: {
1192
- const b = (i = n[0]) != null ? i : 0, m = { index: b, color: bt[b] };
1193
- return g("char", "highlight", m, s, n);
1194
- }
1195
- case d.sprmCHps:
1196
- case d.sprmCHpsBi:
1197
- return g("char", "fontSizeHalfPoints", $(n, 0), s, n);
1198
- case d.sprmCHpsPos:
1199
- return g("char", "positionHalfPoints", _(n, 0), s, n);
1200
- case d.sprmCSymbol:
1201
- return g("char", "symbol", { font: $(n, 0), charCode: $(n, 2) }, s, n);
1202
- case d.sprmCRgFtc0:
1203
- case d.sprmCRgFtc1:
1204
- case d.sprmCRgFtc2:
1205
- case d.sprmCFtcBi:
1206
- return g("char", "fontFamilyId", $(n, 0), s, n);
1207
- case d.sprmCCharScale:
1208
- return g("char", "scale", $(n, 0), s, n);
1209
- case d.sprmCFDStrike:
1210
- return g("char", "doubleStrike", F(n), s, n);
1211
- case d.sprmCFImprint:
1212
- return g("char", "imprint", F(n), s, n);
1213
- case d.sprmCFSpec:
1214
- return g("char", "special", F(n), s, n);
1215
- case d.sprmCFObj:
1216
- return g("char", "object", F(n), s, n);
1217
- case d.sprmCFEmboss:
1218
- return g("char", "emboss", F(n), s, n);
1219
- case d.sprmCFBiDi:
1220
- return g("char", "rtl", F(n), s, n);
1221
- case d.sprmCFBoldBi:
1222
- return g("char", "boldBi", F(n), s, n);
1223
- case d.sprmCFItalicBi:
1224
- return g("char", "italicBi", F(n), s, n);
1225
- case d.sprmPIstd:
1226
- return g("para", "styleId", $(n, 0), s, n);
1227
- case d.sprmPJc80:
1228
- case d.sprmPJc:
1229
- return g("para", "alignment", (l = n[0]) != null ? l : 0, s, n);
1230
- case d.sprmPFKeep:
1231
- return g("para", "keepLines", F(n), s, n);
1232
- case d.sprmPFKeepFollow:
1233
- return g("para", "keepNext", F(n), s, n);
1234
- case d.sprmPFPageBreakBefore:
1235
- return g("para", "pageBreakBefore", F(n), s, n);
1236
- case d.sprmPIlvl:
1237
- return g("para", "listLevel", (c = n[0]) != null ? c : 0, s, n);
1238
- case d.sprmPIlfo:
1239
- return g("para", "listId", $(n, 0), s, n);
1240
- case d.sprmPDxaRight80:
1241
- case d.sprmPDxaRight:
1242
- return g("para", "rightIndent", _(n, 0), s, n);
1243
- case d.sprmPDxaLeft80:
1244
- case d.sprmPDxaLeft:
1245
- return g("para", "leftIndent", _(n, 0), s, n);
1246
- case d.sprmPDxaLeft180:
1247
- case d.sprmPDxaLeft1:
1248
- return g("para", "firstLineIndent", _(n, 0), s, n);
1249
- case d.sprmPDyaLine:
1250
- return g("para", "lineSpacing", _(n, 0), s, n);
1251
- case d.sprmPDyaBefore:
1252
- return g("para", "spacingBefore", _(n, 0), s, n);
1253
- case d.sprmPDyaAfter:
1254
- return g("para", "spacingAfter", _(n, 0), s, n);
1255
- case d.sprmPFInTable:
1256
- return g("para", "inTable", F(n), s, n);
1257
- case d.sprmPFTtp:
1258
- return g("para", "tableRowEnd", F(n), s, n);
1259
- case d.sprmPDxaAbs:
1260
- return g("para", "frameLeft", _(n, 0), s, n);
1261
- case d.sprmPDyaAbs:
1262
- return g("para", "frameTop", _(n, 0), s, n);
1263
- case d.sprmPDxaWidth:
1264
- return g("para", "frameWidth", _(n, 0), s, n);
1265
- case d.sprmPPc:
1266
- return g("para", "framePosition", (u = n[0]) != null ? u : 0, s, n);
1267
- case d.sprmPWr:
1268
- return g("para", "frameWrap", (f = n[0]) != null ? f : 0, s, n);
1269
- case d.sprmPBrcTop80:
1270
- case d.sprmPBrcTop:
1271
- return g("para", "borderTop", K(n, 0), s, n);
1272
- case d.sprmPBrcLeft80:
1273
- case d.sprmPBrcLeft:
1274
- return g("para", "borderLeft", K(n, 0), s, n);
1275
- case d.sprmPBrcBottom80:
1276
- case d.sprmPBrcBottom:
1277
- return g("para", "borderBottom", K(n, 0), s, n);
1278
- case d.sprmPBrcRight80:
1279
- case d.sprmPBrcRight:
1280
- return g("para", "borderRight", K(n, 0), s, n);
1281
- case d.sprmPBrcBetween80:
1282
- case d.sprmPBrcBetween:
1283
- return g("para", "borderBetween", K(n, 0), s, n);
1284
- case d.sprmPBrcBar80:
1285
- case d.sprmPBrcBar:
1286
- return g("para", "borderBar", K(n, 0), s, n);
1287
- case d.sprmPWHeightAbs:
1288
- return g("para", "frameHeight", _(n, 0), s, n);
1289
- case d.sprmPShd80:
1290
- case d.sprmPShd:
1291
- return g("para", "shading", n.slice(), s, n);
1292
- case d.sprmPDyaFromText:
1293
- return g("para", "distanceFromTextY", _(n, 0), s, n);
1294
- case d.sprmPDxaFromText:
1295
- return g("para", "distanceFromTextX", _(n, 0), s, n);
1296
- case d.sprmPFLocked:
1297
- return g("para", "locked", F(n), s, n);
1298
- case d.sprmPFWidowControl:
1299
- return g("para", "widowControl", F(n), s, n);
1300
- case d.sprmPFBiDi:
1301
- return g("para", "rtlPara", F(n), s, n);
1302
- case d.sprmPFAdjustRight:
1303
- return g("para", "adjustRight", F(n), s, n);
1304
- case d.sprmPItap:
1305
- return g("para", "itap", _e(n, 0), s, n);
1306
- case d.sprmPDtap:
1307
- return g("para", "dtap", _e(n, 0), s, n);
1308
- case d.sprmPFInnerTableCell:
1309
- return g("para", "innerTableCell", F(n), s, n);
1310
- case d.sprmPFInnerTtp:
1311
- return g("para", "innerTableRowEnd", F(n), s, n);
1312
- case d.sprmPFDyaBeforeAuto:
1313
- return g("para", "spacingBeforeAuto", F(n), s, n);
1314
- case d.sprmPFDyaAfterAuto:
1315
- return g("para", "spacingAfterAuto", F(n), s, n);
1316
- case d.sprmTJc90:
1317
- return g("table", "alignment", $(n, 0), s, n);
1318
- case d.sprmTDxaLeft:
1319
- return g("table", "leftIndent", _(n, 0), s, n);
1320
- case d.sprmTDxaGapHalf:
1321
- return g("table", "gapHalf", $(n, 0), s, n);
1322
- case d.sprmTFCantSplit90:
1323
- return g("table", "cantSplit", F(n), s, n);
1324
- case d.sprmTTableHeader:
1325
- return g("table", "header", F(n), s, n);
1326
- case d.sprmTDyaRowHeight:
1327
- return g("table", "rowHeight", _(n, 0), s, n);
1328
- case d.sprmTDefTable:
1329
- return g("table", "defTable", Nr(n), s, n);
1330
- case d.sprmTFBiDi:
1331
- return g("table", "rtl", F(n), s, n);
1332
- case d.sprmTPc:
1333
- return g("table", "positionCode", (h = n[0]) != null ? h : 0, s, n);
1334
- case d.sprmTDxaAbs:
1335
- return g("table", "absLeft", _(n, 0), s, n);
1336
- case d.sprmTDyaAbs:
1337
- return g("table", "absTop", _(n, 0), s, n);
1338
- case d.sprmTDxaFromText:
1339
- return g("table", "distanceLeft", _(n, 0), s, n);
1340
- case d.sprmTDyaFromText:
1341
- return g("table", "distanceTop", _(n, 0), s, n);
1342
- case d.sprmTTableWidth:
1343
- return g("table", "tableWidth", it(n), s, n);
1344
- case d.sprmTFAutofit:
1345
- return g("table", "autoFit", F(n), s, n);
1346
- case d.sprmTWidthBefore:
1347
- return g("table", "widthBefore", it(n), s, n);
1348
- case d.sprmTWidthAfter:
1349
- return g("table", "widthAfter", it(n), s, n);
1350
- case d.sprmTInsert:
1351
- return g("table", "insertCells", $r(n), s, n);
1352
- case d.sprmTDelete:
1353
- return g("table", "deleteCells", le(n, 0), s, n);
1354
- case d.sprmTDxaCol:
1355
- return g("table", "columnWidth", at(n), s, n);
1356
- case d.sprmTMerge:
1357
- return g("table", "merge", le(n, 0), s, n);
1358
- case d.sprmTSplit:
1359
- return g("table", "split", le(n, 0), s, n);
1360
- case d.sprmTTextFlow:
1361
- return g("table", "textFlow", fe(n), s, n);
1362
- case d.sprmTVertMerge:
1363
- return g("table", "vertMerge", fe(n), s, n);
1364
- case d.sprmTVertAlign:
1365
- return g("table", "vertAlign", fe(n), s, n);
1366
- case d.sprmTSetShd:
1367
- case d.sprmTSetShdOdd:
1368
- return g("table", "setShading", fe(n), s, n);
1369
- case d.sprmTSetBrc80:
1370
- case d.sprmTSetBrc:
1371
- return g("table", "setBorder", Ur(n), s, n);
1372
- case d.sprmTCellPadding:
1373
- case d.sprmTCellPaddingDefault:
1374
- return g("table", "cellPadding", at(n), s, n);
1375
- case d.sprmTCellWidth:
1376
- return g("table", "cellWidth", at(n), s, n);
1377
- case d.sprmTFitText:
1378
- return g("table", "fitText", fe(n), s, n);
1379
- case d.sprmTFCellNoWrap:
1380
- return g("table", "cellNoWrap", fe(n), s, n);
1381
- case d.sprmTIstd:
1382
- return g("table", "styleId", $(n, 0), s, n);
1383
- default:
1384
- return { kind: r === 1 ? "para" : r === 2 ? "char" : r === 5 ? "table" : "unknown", name: `sprm_${e.toString(16)}`, value: n, raw: e, operandBytes: n };
1385
- }
1386
- }
1387
- function Fe(e, t, r) {
1388
- const n = [];
1389
- let s = t;
1390
- for (; s + 2 <= r; ) {
1391
- const o = $(e, s);
1392
- s += 2;
1393
- const a = Hr(e, s, o);
1394
- if (!a || s + a > r)
1395
- break;
1396
- const i = e.subarray(s, s + a);
1397
- s += a, n.push(jr(o, i));
1398
- }
1399
- return n;
1400
- }
1401
- function hn(e, t, r) {
1402
- if (t == null || r == null || r <= 0)
1403
- return { aFC: [], pages: [] };
1404
- const n = e.subarray(t, t + r), s = new k(n), o = Math.floor((r - 4) / 8);
1405
- if (o <= 0)
1406
- return { aFC: [], pages: [] };
1407
- const a = [];
1408
- for (let c = 0; c <= o; c += 1)
1409
- a.push(s.u32(c * 4) >>> 0);
1410
- const i = [], l = (o + 1) * 4;
1411
- for (let c = 0; c < o; c += 1)
1412
- i.push(s.u32(l + c * 4) & 4194303);
1413
- return { aFC: a, pages: i };
1414
- }
1415
- function Wr(e, t) {
1416
- const r = t * 512, n = e.subarray(r, r + 512);
1417
- if (n.length < 512)
1418
- return null;
1419
- const s = new k(n), o = s.u8(511);
1420
- if (!o || o > 100)
1421
- return null;
1422
- const a = [];
1423
- for (let u = 0; u <= o; u += 1)
1424
- a.push(s.u32(u * 4) >>> 0);
1425
- const i = [], l = [], c = (o + 1) * 4;
1426
- for (let u = 0; u < o; u += 1) {
1427
- const f = s.u8(c + u);
1428
- i.push(f), l.push(f ? r + f * 2 : 0);
1429
- }
1430
- return { crun: o, rgfc: a, rgb: i, chpxOffsets: l };
1431
- }
1432
- function zr(e, t) {
1433
- const r = t * 512, n = e.subarray(r, r + 512);
1434
- if (n.length < 512)
1435
- return null;
1436
- const s = new k(n), o = s.u8(511);
1437
- if (o > 29)
1438
- return null;
1439
- const a = [];
1440
- for (let u = 0; u <= o; u += 1)
1441
- a.push(s.u32(u * 4) >>> 0);
1442
- const i = (o + 1) * 4, l = [], c = [];
1443
- for (let u = 0; u < o; u += 1) {
1444
- const f = s.u8(i + u * 13);
1445
- l.push(f), c.push(f ? r + f * 2 : 0);
1446
- }
1447
- return { cpara: o, rgfc: a, bOffsets: l, papxOffsets: c };
1448
- }
1449
- function qr(e, t, r, n) {
1450
- var l, c;
1451
- const s = r.fibRgFcLcb.fcPlcfBteChpx, o = r.fibRgFcLcb.lcbPlcfBteChpx, a = hn(t, s, o), i = [];
1452
- for (const u of a.pages) {
1453
- const f = Wr(e, u);
1454
- if (f)
1455
- for (let h = 0; h < f.crun; h += 1) {
1456
- const b = (l = f.rgfc[h]) != null ? l : 0, m = (c = f.rgfc[h + 1]) != null ? c : b, y = je(n, b), x = je(n, m);
1457
- if (y == null || x == null || x <= y)
1458
- continue;
1459
- const T = f.chpxOffsets[h] ? Jr(e, f.chpxOffsets[h]) : [];
1460
- i.push({ cpStart: y, cpEnd: x, fcStart: b, fcEnd: m, properties: T });
1461
- }
1462
- }
1463
- return i.sort((u, f) => u.cpStart - f.cpStart || u.cpEnd - f.cpEnd), i;
1464
- }
1465
- function Vr(e, t, r, n) {
1466
- var l, c, u;
1467
- const s = r.fibRgFcLcb.fcPlcfBtePapx, o = r.fibRgFcLcb.lcbPlcfBtePapx, a = hn(t, s, o), i = [];
1468
- for (const f of a.pages) {
1469
- const h = zr(e, f);
1470
- if (h)
1471
- for (let b = 0; b < h.cpara; b += 1) {
1472
- const m = (l = h.rgfc[b]) != null ? l : 0, y = (c = h.rgfc[b + 1]) != null ? c : m, x = je(n, m), T = je(n, y);
1473
- if (x == null || T == null || T < x)
1474
- continue;
1475
- const S = h.papxOffsets[b] ? Kr(e, h.papxOffsets[b]) : { styleId: 0, properties: [] };
1476
- i.push({ cpStart: x, cpEnd: T, fcStart: m, fcEnd: y, styleId: S.styleId, properties: S.properties, rawOffset: (u = h.papxOffsets[b]) != null ? u : 0 });
1477
- }
1478
- }
1479
- return i.sort((f, h) => f.cpStart - h.cpStart || f.cpEnd - h.cpEnd), i;
1480
- }
1481
- function Jr(e, t) {
1482
- var o;
1483
- if (t == null || t < 0 || t >= e.length)
1484
- return [];
1485
- const r = (o = e[t]) != null ? o : 0;
1486
- if (!r)
1487
- return [];
1488
- const n = t + 1, s = Math.min(e.length, n + r);
1489
- return Fe(e, n, s);
1490
- }
1491
- function Kr(e, t) {
1492
- if (t == null || t < 0 || t >= e.length)
1493
- return { styleId: 0, properties: [] };
1494
- const r = new k(e), n = r.u8(t);
1495
- if (n === 0 && !r.ensure(t + 1, 1))
1496
- return { styleId: 0, properties: [] };
1497
- let s, o;
1498
- if (n === 0 ? (o = r.u8(t + 1) * 2, s = t + 2) : (o = n - 1, s = t + 1), o < 2 || !r.ensure(s, Math.max(2, o)))
1499
- return { styleId: 0, properties: [] };
1500
- const a = r.u16(s), i = s + 2, l = Math.min(e.length, s + o), c = Fe(e, i, l);
1501
- return { styleId: a, properties: c };
1502
- }
1503
- function Gr(e, t) {
1504
- let r = t;
1505
- for (; r + 1 < e.length && !(e[r] === 0 && e[r + 1] === 0); )
1506
- r += 2;
1507
- return { value: new TextDecoder("utf-16le").decode(e.subarray(t, r)), nextOffset: Math.min(e.length, r + 2) };
1508
- }
1509
- function Xr(e, t) {
1510
- if (!e.length)
1511
- return null;
1512
- const r = new k(e), n = r.u8(0), s = r.u8(1), o = r.u16(2), a = r.u8(4), i = r.u8(5), l = r.slice(6, 10), c = r.slice(16, 24), u = 40;
1513
- let f = "", h = "";
1514
- if (e.length > u) {
1515
- const m = new TextDecoder("utf-16le").decode(e.subarray(u)).split("\0").filter(Boolean);
1516
- if (f = m[0] || "", h = m[1] || "", !h && i) {
1517
- const y = u + i * 2;
1518
- y + 2 <= e.length && (h = Gr(e, y).value);
1519
- }
1520
- }
1521
- return {
1522
- index: t,
1523
- cbFfnM1: n,
1524
- ffid: s,
1525
- weight: o,
1526
- charset: a,
1527
- ixchSzAlt: i,
1528
- panose: l,
1529
- fontSignature: c,
1530
- name: f,
1531
- altName: h
1532
- };
1533
- }
1534
- function Qr(e, t) {
1535
- const r = t.fcSttbfFfn, n = t.lcbSttbfFfn;
1536
- if (r == null || n == null || n <= 0)
1537
- return {
1538
- header: null,
1539
- fonts: [],
1540
- byIndex(u) {
1541
- return u == null, null;
1542
- }
1543
- };
1544
- const s = e.subarray(r, r + n), o = new k(s), a = o.u16(0), i = o.u16(2);
1545
- let l = 4;
1546
- const c = [];
1547
- for (let u = 0; u < a && l < s.length; u += 1) {
1548
- const h = o.u8(l) + 1, b = s.subarray(l, Math.min(l + h, s.length)), m = Xr(b, u);
1549
- m && c.push(m), l += h + i;
1550
- }
1551
- return {
1552
- header: { cData: a, cbExtra: i },
1553
- fonts: c,
1554
- byIndex(u) {
1555
- return u == null || u < 0 ? null : c[u] || null;
1556
- }
1557
- };
1558
- }
1559
- function mn(e, t, r = 0) {
1560
- if (r + t.length > e.length)
1561
- return !1;
1562
- for (let n = 0; n < t.length; n += 1)
1563
- if (e[r + n] !== t[n])
1564
- return !1;
1565
- return !0;
1566
- }
1567
- function Yr(e) {
1568
- const t = [
1569
- { mime: "image/png", magic: [137, 80, 78, 71], end: Zr },
1570
- { mime: "image/jpeg", magic: [255, 216, 255], end: es },
1571
- { mime: "image/gif", magic: [71, 73, 70, 56], end: ts },
1572
- { mime: "image/bmp", magic: [66, 77], end: ns },
1573
- { mime: "image/tiff", magic: [73, 73, 42, 0], end: null },
1574
- { mime: "image/tiff", magic: [77, 77, 0, 42], end: null },
1575
- { mime: "image/emf", magic: [1, 0, 0, 0], end: rs },
1576
- { mime: "image/wmf", magic: [215, 205, 198, 154], end: null }
1577
- ];
1578
- for (let r = 0; r < e.length - 4; r += 1)
1579
- for (const n of t)
1580
- if (mn(e, n.magic, r)) {
1581
- const s = n.end ? n.end(e, r) : e.length;
1582
- return { mime: n.mime, start: r, end: s || e.length };
1583
- }
1584
- return null;
1585
- }
1586
- function Zr(e, t) {
1587
- for (let r = t + 8; r + 8 < e.length; r += 1)
1588
- if (mn(e, [73, 69, 78, 68], r))
1589
- return r + 8;
1590
- return e.length;
1591
- }
1592
- function es(e, t) {
1593
- for (let r = t + 2; r + 1 < e.length; r += 1)
1594
- if (e[r] === 255 && e[r + 1] === 217)
1595
- return r + 2;
1596
- return e.length;
1597
- }
1598
- function ts(e, t) {
1599
- for (let r = t + 6; r < e.length; r += 1)
1600
- if (e[r] === 59)
1601
- return r + 1;
1602
- return e.length;
1603
- }
1604
- function ns(e, t) {
1605
- if (t + 6 <= e.length) {
1606
- const r = new k(e.subarray(t)).u32(2);
1607
- if (r > 0 && t + r <= e.length)
1608
- return t + r;
1609
- }
1610
- return e.length;
1611
- }
1612
- function rs(e, t) {
1613
- if (t + 48 <= e.length) {
1614
- const n = new k(e.subarray(t)).u32(40);
1615
- if (n > 0 && t + n <= e.length)
1616
- return t + n;
1617
- }
1618
- return e.length;
1619
- }
1620
- function ss(e, t, r = {}) {
1621
- if (!e || t == null || t < 0 || t + 68 > e.length)
1622
- return null;
1623
- const n = new k(e), s = n.i32(t), o = n.u16(t + 4), a = s > 0 && t + s <= e.length ? s : Math.min(e.length - t, r.maxPictureBytes || 8 * 1024 * 1024), i = e.subarray(t, t + a), l = Math.min(o || 68, i.length), c = Yr(i.subarray(l));
1624
- if (!c)
1625
- return {
1626
- id: G("asset-img"),
1627
- type: "image",
1628
- mime: "application/octet-stream",
1629
- bytes: i,
1630
- dataUrl: He(i, "application/octet-stream"),
1631
- meta: { pictureOffset: t, lcb: s, cbHeader: o }
1632
- };
1633
- const u = l + c.start, f = Math.min(l + c.end, i.length), h = i.subarray(u, f);
1634
- return {
1635
- id: G("asset-img"),
1636
- type: "image",
1637
- mime: c.mime,
1638
- bytes: h,
1639
- dataUrl: He(h, c.mime),
1640
- meta: { pictureOffset: t, lcb: s, cbHeader: o }
1641
- };
1642
- }
1643
- function ct(e, t) {
1644
- let r = t;
1645
- for (; r < e.length && e[r] !== 0; )
1646
- r += 1;
1647
- return { value: new TextDecoder("windows-1252").decode(e.subarray(t, r)), nextOffset: r + 1 };
1648
- }
1649
- function os(e) {
1650
- const t = new k(e), r = [4, 6];
1651
- for (const n of r)
1652
- try {
1653
- let s = n;
1654
- const o = ct(e, s);
1655
- s = o.nextOffset;
1656
- const a = ct(e, s);
1657
- s = a.nextOffset;
1658
- const i = ct(e, s);
1659
- if (s = i.nextOffset, s + 4 > e.length)
1660
- continue;
1661
- const l = t.u32(s);
1662
- if (s += 4, l > 0 && s + l <= e.length) {
1663
- const c = e.subarray(s, s + l);
1664
- return { label: o.value, originalPath: a.value, tempPath: i.value, dataSize: l, bytes: c };
1665
- }
1666
- } catch (s) {
1667
- }
1668
- return null;
1669
- }
1670
- function as(e, t) {
1671
- const r = e.listChildren(t).filter((l) => l.objectType === 2 || l.objectType === 5), n = new Map(r.map((l) => [l.name.toLowerCase(), l])), s = n.get("objinfo") || n.get("objinfo") || n.get(String.fromCharCode(3) + "objinfo"), o = n.get("ole10native") || n.get("ole10native") || n.get(String.fromCharCode(1) + "ole10native"), a = n.get("package") || n.get("contents") || n.get("content"), i = { entry: t, streams: r, displayName: t.name, attachment: null, objectData: null };
1672
- if (o) {
1673
- const l = e.getStream(o) || new Uint8Array(0), c = os(l);
1674
- if (c) {
1675
- const u = c.label || c.originalPath.split(/[\\/]/).pop() || `${t.name}.bin`, f = {
1676
- id: G("asset-ole"),
1677
- type: "attachment",
1678
- name: u,
1679
- mime: "application/octet-stream",
1680
- bytes: c.bytes,
1681
- dataUrl: He(c.bytes, "application/octet-stream"),
1682
- meta: c
1683
- };
1684
- return i.attachment = f, i;
1685
- }
1686
- }
1687
- if (a) {
1688
- const l = e.getStream(a) || new Uint8Array(0), c = {
1689
- id: G("asset-pkg"),
1690
- type: "attachment",
1691
- name: `${un(t.name)}.bin`,
1692
- mime: "application/octet-stream",
1693
- bytes: l,
1694
- dataUrl: He(l, "application/octet-stream"),
1695
- meta: { stream: a.name }
1696
- };
1697
- i.attachment = c;
1698
- }
1699
- return s && (i.objectData = e.getStream(s) || new Uint8Array(0)), i;
1700
- }
1701
- function is(e) {
1702
- const t = e.getEntry("/ObjectPool");
1703
- if (!t)
1704
- return /* @__PURE__ */ new Map();
1705
- const r = e.listChildren(t).filter((s) => s.objectType === 1), n = /* @__PURE__ */ new Map();
1706
- for (const s of r)
1707
- n.set(s.name, as(e, s));
1708
- return n;
1709
- }
1710
- function lt(e) {
1711
- var r;
1712
- const t = {
1713
- bold: !1,
1714
- italic: !1,
1715
- strike: !1,
1716
- underline: 0,
1717
- fontSizeHalfPoints: void 0,
1718
- fontFamilyId: void 0,
1719
- colorIndex: void 0,
1720
- highlight: void 0,
1721
- spacing: 0,
1722
- positionHalfPoints: 0,
1723
- scale: 100,
1724
- hidden: !1,
1725
- smallCaps: !1,
1726
- caps: !1,
1727
- outline: !1,
1728
- shadow: !1,
1729
- emboss: !1,
1730
- imprint: !1,
1731
- rtl: !1,
1732
- pictureOffset: void 0,
1733
- data: !1,
1734
- ole2: !1,
1735
- object: !1,
1736
- special: !1,
1737
- charStyleId: void 0
1738
- };
1739
- for (const n of e || [])
1740
- switch (n.name) {
1741
- case "plain":
1742
- n.value && (t.bold = !1, t.italic = !1, t.strike = !1, t.underline = 0, t.smallCaps = !1, t.caps = !1);
1743
- break;
1744
- case "bold":
1745
- case "italic":
1746
- case "strike":
1747
- case "hidden":
1748
- case "smallCaps":
1749
- case "caps":
1750
- case "outline":
1751
- case "shadow":
1752
- case "emboss":
1753
- case "imprint":
1754
- case "rtl":
1755
- case "data":
1756
- case "ole2":
1757
- case "object":
1758
- case "special":
1759
- t[n.name] = !!n.value;
1760
- break;
1761
- case "underline":
1762
- t.underline = (r = n.value) != null ? r : 0;
1763
- break;
1764
- case "fontSizeHalfPoints":
1765
- t.fontSizeHalfPoints = n.value;
1766
- break;
1767
- case "fontFamilyId":
1768
- t.fontFamilyId = n.value;
1769
- break;
1770
- case "colorIndex":
1771
- t.colorIndex = n.value;
1772
- break;
1773
- case "highlight":
1774
- t.highlight = n.value;
1775
- break;
1776
- case "spacing":
1777
- t.spacing = n.value || 0;
1778
- break;
1779
- case "positionHalfPoints":
1780
- t.positionHalfPoints = n.value || 0;
1781
- break;
1782
- case "scale":
1783
- t.scale = n.value || 100;
1784
- break;
1785
- case "pictureOffset":
1786
- t.pictureOffset = n.value;
1787
- break;
1788
- case "charStyleId":
1789
- t.charStyleId = n.value;
1790
- break;
1791
- default:
1792
- t[n.name] = n.value;
1793
- break;
1794
- }
1795
- return t;
1796
- }
1797
- function cs(e) {
1798
- var r;
1799
- const t = {
1800
- styleId: 0,
1801
- alignment: 0,
1802
- spacingBefore: 0,
1803
- spacingAfter: 0,
1804
- lineSpacing: 0,
1805
- leftIndent: 0,
1806
- rightIndent: 0,
1807
- firstLineIndent: 0,
1808
- keepLines: !1,
1809
- keepNext: !1,
1810
- pageBreakBefore: !1,
1811
- widowControl: !1,
1812
- inTable: !1,
1813
- tableRowEnd: !1,
1814
- innerTableCell: !1,
1815
- innerTableRowEnd: !1,
1816
- itap: 0,
1817
- dtap: 0,
1818
- listLevel: void 0,
1819
- listId: void 0,
1820
- rtlPara: !1,
1821
- adjustRight: !1,
1822
- frameLeft: void 0,
1823
- frameTop: void 0,
1824
- frameWidth: void 0,
1825
- frameHeight: void 0,
1826
- framePosition: void 0,
1827
- frameWrap: void 0,
1828
- borders: {},
1829
- shading: void 0
1830
- };
1831
- for (const n of e || [])
1832
- switch (n.name) {
1833
- case "styleId":
1834
- t.styleId = n.value || 0;
1835
- break;
1836
- case "alignment":
1837
- t.alignment = (r = n.value) != null ? r : 0;
1838
- break;
1839
- case "spacingBefore":
1840
- t.spacingBefore = n.value || 0;
1841
- break;
1842
- case "spacingAfter":
1843
- t.spacingAfter = n.value || 0;
1844
- break;
1845
- case "lineSpacing":
1846
- t.lineSpacing = n.value || 0;
1847
- break;
1848
- case "leftIndent":
1849
- t.leftIndent = n.value || 0;
1850
- break;
1851
- case "rightIndent":
1852
- t.rightIndent = n.value || 0;
1853
- break;
1854
- case "firstLineIndent":
1855
- t.firstLineIndent = n.value || 0;
1856
- break;
1857
- case "keepLines":
1858
- case "keepNext":
1859
- case "pageBreakBefore":
1860
- case "widowControl":
1861
- case "inTable":
1862
- case "tableRowEnd":
1863
- case "innerTableCell":
1864
- case "innerTableRowEnd":
1865
- case "rtlPara":
1866
- case "adjustRight":
1867
- t[n.name] = !!n.value;
1868
- break;
1869
- case "itap":
1870
- t.itap = n.value || 0;
1871
- break;
1872
- case "dtap":
1873
- t.dtap = n.value || 0;
1874
- break;
1875
- case "listLevel":
1876
- t.listLevel = n.value;
1877
- break;
1878
- case "listId":
1879
- t.listId = n.value;
1880
- break;
1881
- case "frameLeft":
1882
- t.frameLeft = n.value;
1883
- break;
1884
- case "frameTop":
1885
- t.frameTop = n.value;
1886
- break;
1887
- case "frameWidth":
1888
- t.frameWidth = n.value;
1889
- break;
1890
- case "frameHeight":
1891
- t.frameHeight = n.value;
1892
- break;
1893
- case "framePosition":
1894
- t.framePosition = n.value;
1895
- break;
1896
- case "frameWrap":
1897
- t.frameWrap = n.value;
1898
- break;
1899
- case "borderTop":
1900
- t.borders.top = n.value;
1901
- break;
1902
- case "borderLeft":
1903
- t.borders.left = n.value;
1904
- break;
1905
- case "borderBottom":
1906
- t.borders.bottom = n.value;
1907
- break;
1908
- case "borderRight":
1909
- t.borders.right = n.value;
1910
- break;
1911
- case "borderBetween":
1912
- t.borders.between = n.value;
1913
- break;
1914
- case "borderBar":
1915
- t.borders.bar = n.value;
1916
- break;
1917
- case "shading":
1918
- t.shading = n.value;
1919
- break;
1920
- default:
1921
- t[n.name] = n.value;
1922
- break;
1923
- }
1924
- return t;
1925
- }
1926
- function We(e) {
1927
- var r;
1928
- const t = {
1929
- styleId: void 0,
1930
- alignment: 0,
1931
- leftIndent: 0,
1932
- gapHalf: 0,
1933
- cantSplit: !1,
1934
- header: !1,
1935
- rowHeight: 0,
1936
- rtl: !1,
1937
- positionCode: void 0,
1938
- absLeft: void 0,
1939
- absTop: void 0,
1940
- distanceLeft: void 0,
1941
- distanceTop: void 0,
1942
- tableWidth: void 0,
1943
- autoFit: void 0,
1944
- widthBefore: void 0,
1945
- widthAfter: void 0,
1946
- defTable: void 0,
1947
- operations: []
1948
- };
1949
- for (const n of e || [])
1950
- switch (n.name) {
1951
- case "styleId":
1952
- t.styleId = n.value;
1953
- break;
1954
- case "alignment":
1955
- t.alignment = (r = n.value) != null ? r : 0;
1956
- break;
1957
- case "leftIndent":
1958
- t.leftIndent = n.value || 0;
1959
- break;
1960
- case "gapHalf":
1961
- t.gapHalf = n.value || 0;
1962
- break;
1963
- case "cantSplit":
1964
- case "header":
1965
- case "rtl":
1966
- t[n.name] = !!n.value;
1967
- break;
1968
- case "rowHeight":
1969
- t.rowHeight = n.value || 0;
1970
- break;
1971
- case "positionCode":
1972
- t.positionCode = n.value;
1973
- break;
1974
- case "absLeft":
1975
- t.absLeft = n.value;
1976
- break;
1977
- case "absTop":
1978
- t.absTop = n.value;
1979
- break;
1980
- case "distanceLeft":
1981
- t.distanceLeft = n.value;
1982
- break;
1983
- case "distanceTop":
1984
- t.distanceTop = n.value;
1985
- break;
1986
- case "tableWidth":
1987
- t.tableWidth = n.value;
1988
- break;
1989
- case "autoFit":
1990
- t.autoFit = n.value;
1991
- break;
1992
- case "widthBefore":
1993
- t.widthBefore = n.value;
1994
- break;
1995
- case "widthAfter":
1996
- t.widthAfter = n.value;
1997
- break;
1998
- case "defTable":
1999
- t.defTable = n.value;
2000
- break;
2001
- default:
2002
- t.operations.push(n);
2003
- break;
2004
- }
2005
- return t;
2006
- }
2007
- function xt(e) {
2008
- return e != null && e.inTable ? Math.max(1, e.itap || 0 || (e.dtap ? e.dtap : 1)) : 0;
2009
- }
2010
- function ls(e) {
2011
- return Rr[e] || "left";
2012
- }
2013
- function us(e) {
2014
- return Fr[e] || (e ? "single" : "none");
2015
- }
2016
- function fs(e) {
2017
- return kr[e] || "top";
2018
- }
2019
- function Z(e, t, r) {
2020
- if (!t)
2021
- return;
2022
- const n = Math.max(0, t.first || 0), s = Math.max(n, t.lim || n);
2023
- for (let o = n; o < s && o < e.length; o += 1)
2024
- r(e[o], o);
2025
- }
2026
- function ds(e) {
2027
- const t = e == null ? void 0 : e.defTable;
2028
- if (!t || !Array.isArray(t.cells))
2029
- return [];
2030
- const r = t.cells.map((n, s) => {
2031
- var o, a, i, l, c, u, f, h, b, m;
2032
- return {
2033
- index: s,
2034
- width: n == null ? void 0 : n.wWidth,
2035
- ftsWidth: (o = n == null ? void 0 : n.tcgrf) == null ? void 0 : o.ftsWidth,
2036
- borders: (n == null ? void 0 : n.borders) || {},
2037
- merge: ((a = n == null ? void 0 : n.tcgrf) == null ? void 0 : a.horzMerge) || 0,
2038
- vertMerge: ((i = n == null ? void 0 : n.tcgrf) == null ? void 0 : i.vertMerge) || 0,
2039
- vertAlign: ((l = n == null ? void 0 : n.tcgrf) == null ? void 0 : l.vertAlign) || 0,
2040
- fitText: !!((c = n == null ? void 0 : n.tcgrf) != null && c.fitText),
2041
- noWrap: !!((u = n == null ? void 0 : n.tcgrf) != null && u.noWrap),
2042
- hideMark: !!((f = n == null ? void 0 : n.tcgrf) != null && f.hideMark),
2043
- textFlow: ((h = n == null ? void 0 : n.tcgrf) == null ? void 0 : h.textFlow) || 0,
2044
- rightBoundary: (b = t.rgdxaCenter) == null ? void 0 : b[s + 1],
2045
- leftBoundary: (m = t.rgdxaCenter) == null ? void 0 : m[s]
2046
- };
2047
- });
2048
- for (const n of e.operations || [])
2049
- switch (n.name) {
2050
- case "merge":
2051
- Z(r, n.value, (s, o) => {
2052
- const a = n.value;
2053
- o === a.first ? s.merge = 2 : s.merge = 1;
2054
- });
2055
- break;
2056
- case "split":
2057
- Z(r, n.value, (s) => {
2058
- s.merge = 0;
2059
- });
2060
- break;
2061
- case "cellWidth":
2062
- case "columnWidth":
2063
- Z(r, n.value.range, (s) => {
2064
- const o = n.value;
2065
- s.width = o.width, s.ftsWidth = o.ftsWidth;
2066
- });
2067
- break;
2068
- case "vertMerge":
2069
- Z(r, n.value.range, (s) => {
2070
- s.vertMerge = n.value.value;
2071
- });
2072
- break;
2073
- case "vertAlign":
2074
- Z(r, n.value.range, (s) => {
2075
- s.vertAlign = n.value.value;
2076
- });
2077
- break;
2078
- case "setBorder":
2079
- Z(r, n.value.range, (s) => {
2080
- s.borders = oe(J({}, s.borders || {}), { all: n.value.border });
2081
- });
2082
- break;
2083
- case "setShading":
2084
- Z(r, n.value.range, (s) => {
2085
- s.shading = n.value.value;
2086
- });
2087
- break;
2088
- case "fitText":
2089
- Z(r, n.value.range, (s) => {
2090
- s.fitText = !!n.value.value;
2091
- });
2092
- break;
2093
- case "cellNoWrap":
2094
- Z(r, n.value.range, (s) => {
2095
- s.noWrap = !!n.value.value;
2096
- });
2097
- break;
2098
- case "textFlow":
2099
- Z(r, n.value.range, (s) => {
2100
- s.textFlow = n.value.value;
2101
- });
2102
- break;
2103
- }
2104
- return r;
2105
- }
2106
- function de(...e) {
2107
- const t = /* @__PURE__ */ new Map();
2108
- for (const r of e)
2109
- for (const n of r || [])
2110
- t.set(`${n.kind}:${n.name}`, n);
2111
- return Array.from(t.values());
2112
- }
2113
- function ps(e) {
2114
- const t = { para: [], char: [], table: [] };
2115
- for (const r of e || [])
2116
- r.kind === "para" ? t.para.push(r) : r.kind === "char" ? t.char.push(r) : r.kind === "table" && t.table.push(r);
2117
- return t;
2118
- }
2119
- function hs(e, t) {
2120
- const r = new k(e), n = r.u16(t), s = t + 2, o = n * 2, a = r.utf16le(s, o), i = s + o + 2;
2121
- return { value: a.replace(/\u0000+$/, ""), nextOffset: i };
2122
- }
2123
- function ms(e, t) {
2124
- const r = new k(e), n = r.u16(t), s = r.u16(t + 2), o = r.u16(t + 4);
2125
- return {
2126
- sti: n & 4095,
2127
- flags1: n >> 12,
2128
- stk: s & 15,
2129
- istdBase: s >> 4 & 4095,
2130
- cupx: o & 15,
2131
- istdNext: o >> 4 & 4095,
2132
- bchUpe: r.u16(t + 6),
2133
- grfstd: r.u16(t + 8)
2134
- };
2135
- }
2136
- function zt(e, t) {
2137
- var c;
2138
- const n = new k(e).u16(t), s = t + 2, o = s + n, a = e.subarray(s, Math.min(o, e.length));
2139
- let i = 0, l = [];
2140
- return a.length >= 2 && (i = a[0] | ((c = a[1]) != null ? c : 0) << 8, l = Fe(a, 2, a.length)), { cbUpx: n, styleId: i, properties: l, nextOffset: Pe(o) };
2141
- }
2142
- function ut(e, t) {
2143
- const n = new k(e).u16(t), s = t + 2, o = s + n, a = e.subarray(s, Math.min(o, e.length)), i = Fe(a, 0, a.length);
2144
- return { cbUpx: n, properties: i, nextOffset: Pe(o) };
2145
- }
2146
- function gs(e, t) {
2147
- const n = new k(e).u16(t), s = t + 2, o = s + n, a = e.subarray(s, Math.min(o, e.length)), i = Fe(a, 0, a.length);
2148
- return { cbUpx: n, properties: i, nextOffset: Pe(o) };
2149
- }
2150
- function bs(e, t, r) {
2151
- if (!e.length)
2152
- return {
2153
- istd: r,
2154
- empty: !0,
2155
- name: "",
2156
- stdfBase: { istdBase: 4095, istdNext: 0, stk: 1, cupx: 0 },
2157
- paraProps: [],
2158
- charProps: [],
2159
- tableProps: []
2160
- };
2161
- const n = Math.max(10, Math.min(t || 10, e.length)), s = ms(e, 0);
2162
- let o = n;
2163
- const a = hs(e, o);
2164
- o = a.nextOffset;
2165
- let i = [], l = [], c = [];
2166
- try {
2167
- if (s.stk === 1) {
2168
- if (s.cupx >= 1 && o + 2 <= e.length) {
2169
- const u = zt(e, o);
2170
- i = u.properties, o = u.nextOffset;
2171
- }
2172
- s.cupx >= 2 && o + 2 <= e.length && (l = ut(e, o).properties);
2173
- } else if (s.stk === 2)
2174
- o + 2 <= e.length && (l = ut(e, o).properties);
2175
- else if (s.stk === 3) {
2176
- if (s.cupx >= 1 && o + 2 <= e.length) {
2177
- const u = gs(e, o);
2178
- c = u.properties, o = u.nextOffset;
2179
- }
2180
- if (s.cupx >= 2 && o + 2 <= e.length) {
2181
- const u = zt(e, o);
2182
- i = u.properties, o = u.nextOffset;
2183
- }
2184
- s.cupx >= 3 && o + 2 <= e.length && (l = ut(e, o).properties);
2185
- }
2186
- } catch (u) {
2187
- }
2188
- return {
2189
- istd: r,
2190
- name: a.value,
2191
- stdfBase: s,
2192
- paraProps: i,
2193
- charProps: l,
2194
- tableProps: c,
2195
- empty: !1
2196
- };
2197
- }
2198
- function xs(e, t) {
2199
- const r = t.fcStshf, n = t.lcbStshf;
2200
- if (r == null || n == null || n <= 0)
2201
- return { styles: /* @__PURE__ */ new Map(), header: null, resolveStyle(x) {
2202
- return yt(/* @__PURE__ */ new Map(), x);
2203
- } };
2204
- const s = e.subarray(r, r + n), o = new k(s), a = o.u16(0), i = 2, l = o.u16(i + 0), c = o.u16(i + 2), u = o.u16(i + 10), f = o.u16(i + 12), h = o.u16(i + 14), b = { cbStshi: a, cstd: l, cbSTDBaseInFile: c, ftcAsci: u, ftcFE: f, ftcOther: h };
2205
- let m = 2 + a;
2206
- const y = /* @__PURE__ */ new Map();
2207
- for (let x = 0; x < l && m + 2 <= s.length; x += 1) {
2208
- const T = o.u16(m), S = m + 2, E = S + T;
2209
- if (T === 0) {
2210
- y.set(x, {
2211
- istd: x,
2212
- empty: !0,
2213
- name: "",
2214
- stdfBase: { istdBase: 4095, istdNext: 0, stk: 1, cupx: 0 },
2215
- paraProps: [],
2216
- charProps: [],
2217
- tableProps: []
2218
- }), m = Pe(E);
2219
- continue;
2220
- }
2221
- const O = s.subarray(S, Math.min(E, s.length)), A = bs(O, c, x);
2222
- y.set(x, A), m = Pe(E);
2223
- }
2224
- return {
2225
- header: b,
2226
- styles: y,
2227
- resolveStyle(x) {
2228
- return yt(y, x);
2229
- }
2230
- };
2231
- }
2232
- function yt(e, t, r = /* @__PURE__ */ new Set()) {
2233
- var o;
2234
- if (t == null || t === 4095 || r.has(t))
2235
- return { paraProps: [], charProps: [], tableProps: [], styleIds: [] };
2236
- const n = e.get(t);
2237
- if (!n || n.empty)
2238
- return { paraProps: [], charProps: [], tableProps: [], styleIds: [] };
2239
- r.add(t);
2240
- const s = yt(e, (o = n.stdfBase) == null ? void 0 : o.istdBase, r);
2241
- return {
2242
- styleIds: [...s.styleIds, t],
2243
- paraProps: de(s.paraProps, n.paraProps),
2244
- charProps: de(s.charProps, n.charProps),
2245
- tableProps: de(s.tableProps, n.tableProps)
2246
- };
2247
- }
2248
- function ys(e, t, r, n) {
2249
- let s = (n == null ? void 0 : n.index) || 0;
2250
- for (; s < e.length && e[s].cpEnd <= t; )
2251
- s += 1;
2252
- n && (n.index = s);
2253
- const o = [];
2254
- let a = s;
2255
- for (; a < e.length && e[a].cpStart < r; )
2256
- e[a].cpEnd > t && o.push(e[a]), a += 1;
2257
- return o;
2258
- }
2259
- function ws(e) {
2260
- return String(e || "").trim();
2261
- }
2262
- function qt(e) {
2263
- const t = String(e || "").replace(/[\r\n\t]+/g, " ").replace(/\s+/g, " ").trim();
2264
- if (!t)
2265
- return null;
2266
- const r = t.toUpperCase();
2267
- if (r.startsWith("HYPERLINK")) {
2268
- const n = t.slice(9).trim(), s = n.match(/"([^"]+)"/), o = (s == null ? void 0 : s[1]) || n.split(/\s+/)[0] || "";
2269
- return o ? { type: "hyperlink", href: o } : null;
2270
- }
2271
- if (r.startsWith("INCLUDEPICTURE")) {
2272
- const n = t.slice(14).trim(), s = n.match(/"([^"]+)"/);
2273
- return { type: "includePicture", target: (s == null ? void 0 : s[1]) || n.split(/\s+/)[0] || "" };
2274
- }
2275
- return r.startsWith("EMBED") ? { type: "embed", raw: t } : r.startsWith("LINK") ? { type: "link", raw: t } : { type: "unknown", raw: t };
2276
- }
2277
- function Ts(e, t) {
2278
- if (!t.text)
2279
- return;
2280
- const r = e[e.length - 1];
2281
- if (r && r.type === "text" && r.href === t.href && fn(r.style, t.style)) {
2282
- r.text += t.text;
2283
- return;
2284
- }
2285
- e.push(t);
2286
- }
2287
- function ie(e, t, r) {
2288
- if (!r)
2289
- return;
2290
- const n = e.length ? e[e.length - 1].nodes : t;
2291
- r.type === "text" ? Ts(n, r) : n.push(r);
2292
- }
2293
- function Ps(e, t) {
2294
- const r = [
2295
- `_${t}`,
2296
- `_${String(t)}`,
2297
- `_${t.toString(16)}`,
2298
- `_${t.toString(16).toUpperCase()}`
2299
- ];
2300
- for (const n of r)
2301
- if (e.has(n))
2302
- return e.get(n) || null;
2303
- return null;
2304
- }
2305
- function Ss(e, t, r, n, s, o = {}) {
2306
- return function(i) {
2307
- const l = i == null ? void 0 : i.pictureOffset;
2308
- if (l == null)
2309
- return null;
2310
- if (s.has(l))
2311
- return s.get(l) || null;
2312
- let c = null;
2313
- const u = Ps(t, l);
2314
- if ((i.ole2 || i.object || i.data) && (u != null && u.attachment) && (c = u.attachment, n.add(u.entry.name)), !c && (e != null && e.length)) {
2315
- const f = ss(e, l, o);
2316
- f && f.mime !== "application/octet-stream" ? c = f : !c && (u != null && u.attachment) ? (c = u.attachment, n.add(u.entry.name)) : f && (c = f);
2317
- }
2318
- return !c && (u != null && u.attachment) && (c = u.attachment, n.add(u.entry.name)), c && r.push(c), s.set(l, c), c;
2319
- };
2320
- }
2321
- function Cs(e) {
2322
- switch (e) {
2323
- case q.nonBreakingHyphen:
2324
- return "-";
2325
- case q.nonRequiredHyphen:
2326
- return "";
2327
- case q.annotationRef:
2328
- return "";
2329
- default:
2330
- return e;
2331
- }
2332
- }
2333
- function Es(e, t) {
2334
- var s;
2335
- const r = [], n = [];
2336
- for (const o of e)
2337
- if (!(!o.text || o.state.hidden))
2338
- for (const a of o.text) {
2339
- const i = Cs(a);
2340
- if (i === q.fieldStart) {
2341
- n.push({ instruction: "", parsed: null, readingInstruction: !0, nodes: [] });
2342
- continue;
2343
- }
2344
- if (i === q.fieldSeparator) {
2345
- const c = n[n.length - 1];
2346
- c && (c.parsed = qt(c.instruction), c.readingInstruction = !1);
2347
- continue;
2348
- }
2349
- if (i === q.fieldEnd) {
2350
- const c = n.pop();
2351
- if (!c)
2352
- continue;
2353
- let u = c.nodes;
2354
- if (c.readingInstruction && (c.parsed = qt(c.instruction)), ((s = c.parsed) == null ? void 0 : s.type) === "hyperlink") {
2355
- const f = c.parsed.href;
2356
- u = u.map((h) => h.type === "lineBreak" || h.type === "pageBreak" ? h : oe(J({}, h), { href: f }));
2357
- }
2358
- for (const f of u)
2359
- ie(n, r, f);
2360
- continue;
2361
- }
2362
- const l = n[n.length - 1];
2363
- if (l != null && l.readingInstruction) {
2364
- l.instruction += i;
2365
- continue;
2366
- }
2367
- if (i === q.hardLineBreak) {
2368
- ie(n, r, { type: "lineBreak" });
2369
- continue;
2370
- }
2371
- if (i === q.pageBreak) {
2372
- ie(n, r, { type: "pageBreak" });
2373
- continue;
2374
- }
2375
- if (i === q.picture) {
2376
- const c = t(o.state);
2377
- (c == null ? void 0 : c.type) === "image" ? ie(n, r, { type: "image", asset: c, style: o.state }) : (c == null ? void 0 : c.type) === "attachment" && ie(n, r, { type: "attachment", asset: c, style: o.state });
2378
- continue;
2379
- }
2380
- ie(n, r, {
2381
- type: "text",
2382
- text: ar(i),
2383
- style: o.state
2384
- });
2385
- }
2386
- for (; n.length; ) {
2387
- const o = n.pop();
2388
- for (const a of o.nodes)
2389
- ie(n, r, a);
2390
- }
2391
- return r;
2392
- }
2393
- function Bs(e, t, r, n, s, o, a) {
2394
- const i = ys(r, e.cpStart, e.cpEnd, a), l = /* @__PURE__ */ new Set([e.cpStart, e.cpEnd]);
2395
- for (const f of i)
2396
- l.add(Math.max(e.cpStart, f.cpStart)), l.add(Math.min(e.cpEnd, f.cpEnd));
2397
- const c = Array.from(l).sort((f, h) => f - h), u = [];
2398
- for (let f = 0; f < c.length - 1; f += 1) {
2399
- const h = c[f], b = c[f + 1];
2400
- if (b <= h)
2401
- continue;
2402
- const m = i.find((v) => v.cpStart <= h && v.cpEnd >= b), y = (m == null ? void 0 : m.properties) || [], x = lt(y), T = x.charStyleId != null ? n.resolveStyle(x.charStyleId).charProps : [], S = de(s, T, y), E = lt(S), O = o(E.fontFamilyId);
2403
- O && (E.fontFamily = O.name || O.altName || void 0);
2404
- const A = h - e.cpStart, D = b - e.cpStart, I = t.slice(A, D);
2405
- if (!I)
2406
- continue;
2407
- const U = u[u.length - 1];
2408
- if (U && fn(U.state, E)) {
2409
- U.text += I, U.cpEnd = b;
2410
- continue;
2411
- }
2412
- u.push({ cpStart: h, cpEnd: b, text: I, state: E });
2413
- }
2414
- if (!u.length && t) {
2415
- const f = lt(s), h = o(f.fontFamilyId);
2416
- h && (f.fontFamily = h.name || h.altName || void 0), u.push({ cpStart: e.cpStart, cpEnd: e.cpEnd, text: t, state: f });
2417
- }
2418
- return u;
2419
- }
2420
- function Fs(e, t, r, n, s, o, a) {
2421
- var O, A;
2422
- const i = ps(e.properties || []), l = e.styleId || ((O = i.para.find((D) => D.name === "styleId")) == null ? void 0 : O.value) || 0, c = r.resolveStyle(l), u = de(c.paraProps, i.para), f = cs(u), h = We(i.table), b = h.styleId != null ? r.resolveStyle(h.styleId).tableProps : [], m = de(b, i.table), y = We(m), x = c.charProps, S = Bs(e, t, s, r, x, (D) => n.byIndex(D), a), E = Es(S, o);
2423
- return {
2424
- id: G("para"),
2425
- cpStart: e.cpStart,
2426
- cpEnd: e.cpEnd,
2427
- terminator: e.terminator || "",
2428
- text: t,
2429
- rawProperties: e.properties || [],
2430
- styleId: l,
2431
- styleName: ws((A = r.styles.get(l)) == null ? void 0 : A.name),
2432
- paraProps: u,
2433
- paraState: f,
2434
- tableProps: m,
2435
- tableState: y,
2436
- segments: S,
2437
- inlines: E
2438
- };
2439
- }
2440
- function Rs(e) {
2441
- var t, r, n, s;
2442
- for (const o of e)
2443
- for (let a = 0; a < o.cells.length; a += 1) {
2444
- const i = o.cells[a], l = ((t = i.meta) == null ? void 0 : t.merge) || 0;
2445
- if (i.colIndex = a, i.colspan = 1, i.rowspan = 1, i.hidden = !1, l === 1) {
2446
- i.hidden = !0;
2447
- continue;
2448
- }
2449
- if (l > 1) {
2450
- let c = a + 1;
2451
- for (; c < o.cells.length && (((r = o.cells[c].meta) == null ? void 0 : r.merge) || 0) === 1; )
2452
- o.cells[c].hidden = !0, i.colspan += 1, c += 1;
2453
- }
2454
- }
2455
- for (let o = 0; o < e.length; o += 1) {
2456
- const a = e[o];
2457
- for (const i of a.cells) {
2458
- if (i.hidden)
2459
- continue;
2460
- const l = ((n = i.meta) == null ? void 0 : n.vertMerge) || 0;
2461
- if (l === 1) {
2462
- i.hidden = !0;
2463
- continue;
2464
- }
2465
- if (l > 1) {
2466
- let c = o + 1;
2467
- for (; c < e.length; ) {
2468
- let u = !0;
2469
- for (let f = i.colIndex || 0; f < (i.colIndex || 0) + (i.colspan || 1); f += 1) {
2470
- const h = e[c].cells[f];
2471
- if (!h || (((s = h.meta) == null ? void 0 : s.vertMerge) || 0) !== 1) {
2472
- u = !1;
2473
- break;
2474
- }
2475
- }
2476
- if (!u)
2477
- break;
2478
- for (let f = i.colIndex || 0; f < (i.colIndex || 0) + (i.colspan || 1); f += 1)
2479
- e[c].cells[f].hidden = !0;
2480
- i.rowspan = (i.rowspan || 1) + 1, c += 1;
2481
- }
2482
- }
2483
- }
2484
- }
2485
- }
2486
- function wt(e) {
2487
- return {
2488
- type: "paragraph",
2489
- id: e.id,
2490
- styleId: e.styleId,
2491
- styleName: e.styleName,
2492
- paraState: e.paraState,
2493
- inlines: e.inlines,
2494
- text: e.text
2495
- };
2496
- }
2497
- function ks(e) {
2498
- var a, i, l;
2499
- const t = [];
2500
- let r = { cells: [] }, n = [];
2501
- for (const c of e)
2502
- if (n.push(c), c.terminator === q.cellMark && (r.cells.push({
2503
- id: G("cell"),
2504
- paragraphs: n.map(wt),
2505
- meta: null
2506
- }), n = [], c.paraState.tableRowEnd || c.paraState.innerTableRowEnd)) {
2507
- const u = ds(c.tableState);
2508
- for (; u.length && r.cells.length > u.length && r.cells[r.cells.length - 1].paragraphs.every((h) => !h.text && !(h.inlines || []).length); )
2509
- r.cells.pop();
2510
- r.cells.forEach((h, b) => {
2511
- h.meta = u[b] || { index: b };
2512
- });
2513
- const f = u.length ? (u[u.length - 1].rightBoundary || 0) - (u[0].leftBoundary || 0) : 0;
2514
- t.push({
2515
- id: G("row"),
2516
- cells: r.cells,
2517
- state: c.tableState,
2518
- gridWidthTwips: f
2519
- }), r = { cells: [] };
2520
- }
2521
- n.length && r.cells.push({ id: G("cell"), paragraphs: n.map(wt), meta: null }), r.cells.length && t.push({ id: G("row"), cells: r.cells, state: ((a = e[0]) == null ? void 0 : a.tableState) || We([]), gridWidthTwips: 0 }), Rs(t);
2522
- const s = ((i = t.find((c) => c.gridWidthTwips)) == null ? void 0 : i.gridWidthTwips) || 0, o = Math.max(...e.map((c) => xt(c.paraState)), 1);
2523
- return {
2524
- type: "table",
2525
- id: G("table"),
2526
- depth: o,
2527
- rows: t,
2528
- state: ((l = t[0]) == null ? void 0 : l.state) || We([]),
2529
- gridWidthTwips: s
2530
- };
2531
- }
2532
- function As(e) {
2533
- const t = [];
2534
- let r = 0;
2535
- for (; r < e.length; ) {
2536
- const n = e[r];
2537
- if (xt(n.paraState) <= 0) {
2538
- t.push(wt(n)), r += 1;
2539
- continue;
2540
- }
2541
- const o = [];
2542
- for (; r < e.length && xt(e[r].paraState) > 0; )
2543
- o.push(e[r]), r += 1;
2544
- t.push(ks(o));
2545
- }
2546
- return t;
2547
- }
2548
- function vs(e, t = {}) {
2549
- const r = [], n = gr(e, t);
2550
- r.push(...n.warnings || []);
2551
- const s = n.getStream("/WordDocument");
2552
- if (!s)
2553
- throw new Error("Missing WordDocument stream");
2554
- const o = vr(s);
2555
- if (o.base.wIdent !== 42476 && Le(r, `Unexpected FIB identifier: 0x${o.base.wIdent.toString(16)}`), o.base.fEncrypted)
2556
- throw new Error("Encrypted .doc files are not supported yet");
2557
- const a = n.getStream(o.base.fWhichTblStm ? "/1Table" : "/0Table");
2558
- if (!a)
2559
- throw new Error("Missing table stream");
2560
- const i = n.getStream("/Data") || new Uint8Array(0), l = Tr(a, o.fibRgFcLcb), c = Cr(s, l), u = c.join(""), f = o.fibRgLw.ccpText > 0 ? o.fibRgLw.ccpText : u.length, h = xs(a, o.fibRgFcLcb), b = Qr(a, o.fibRgFcLcb), m = qr(s, a, o, l).filter((P) => P.cpStart < f), y = Vr(s, a, o, l).filter((P) => P.cpStart < f).map((P) => oe(J({}, P), { cpEnd: Math.min(P.cpEnd, f) })), x = y.length ? y.map((P) => ({
2561
- cpStart: P.cpStart,
2562
- cpEnd: P.cpEnd,
2563
- terminator: u[P.cpEnd - 1] || "",
2564
- styleId: P.styleId,
2565
- properties: P.properties
2566
- })) : Br(u.slice(0, f)).map((P) => oe(J({}, P), { styleId: 0, properties: [] })), T = is(n), S = [], E = /* @__PURE__ */ new Set(), A = Ss(i, T, S, E, /* @__PURE__ */ new Map(), t), D = { index: 0 }, I = x.map((P) => {
2567
- const j = Er(s, l, c, P.cpStart, P.cpEnd), z = P.terminator === q.paragraph || P.terminator === q.cellMark ? P.terminator : "", se = z && j.endsWith(z) ? j.slice(0, -1) : j;
2568
- return Fs(oe(J({}, P), { terminator: z }), se, h, b, m, A, D);
2569
- }), U = As(I), v = Array.from(T.values()).filter((P) => (P == null ? void 0 : P.attachment) && !E.has(P.entry.name)).map((P) => P.attachment);
2570
- for (const P of v)
2571
- S.push(P);
2572
- return v.length && U.push({ type: "attachments", id: G("attachments"), items: v }), {
2573
- kind: "msdoc",
2574
- version: 1,
2575
- warnings: r,
2576
- meta: {
2577
- fib: {
2578
- wIdent: o.base.wIdent,
2579
- nFib: o.base.nFib,
2580
- fWhichTblStm: o.base.fWhichTblStm,
2581
- fComplex: o.base.fComplex,
2582
- fEncrypted: o.base.fEncrypted,
2583
- ccpText: o.fibRgLw.ccpText
2584
- },
2585
- counts: {
2586
- paragraphs: I.length,
2587
- blocks: U.length,
2588
- assets: S.length,
2589
- styles: h.styles.size,
2590
- fonts: b.fonts.length
2591
- }
2592
- },
2593
- fonts: b.fonts,
2594
- styles: Array.from(h.styles.values()).map((P) => {
2595
- var j, z, se;
2596
- return {
2597
- istd: P.istd,
2598
- name: P.name,
2599
- type: (j = P.stdfBase) == null ? void 0 : j.stk,
2600
- basedOn: (z = P.stdfBase) == null ? void 0 : z.istdBase,
2601
- next: (se = P.stdfBase) == null ? void 0 : se.istdNext
2602
- };
2603
- }),
2604
- blocks: U,
2605
- assets: S
2606
- };
2607
- }
2608
- const Se = {
2609
- 1: "#000000",
2610
- 2: "#0000ff",
2611
- 3: "#00ffff",
2612
- 4: "#00ff00",
2613
- 5: "#ff00ff",
2614
- 6: "#ff0000",
2615
- 7: "#ffff00",
2616
- 8: "#ffffff",
2617
- 9: "#000080",
2618
- 10: "#008080",
2619
- 11: "#008000",
2620
- 12: "#800080",
2621
- 13: "#800000",
2622
- 14: "#808000",
2623
- 15: "#808080",
2624
- 16: "#c0c0c0"
2625
- };
2626
- function Ce(e) {
2627
- return Object.entries(e).filter(([, t]) => t != null && t !== "").map(([t, r]) => `${t}:${r}`).join(";");
2628
- }
2629
- function re(e) {
2630
- var a;
2631
- if (!e)
2632
- return null;
2633
- const t = Math.max(1, Math.round(((a = e.lineWidth) != null ? a : 8) / 8 * 1.3333)), r = e.borderType, n = r === 6 ? "double" : r === 3 ? "dotted" : r === 2 ? "dashed" : "solid", s = e.color, o = s && Se[s] || "#666";
2634
- return `${t}px ${n} ${o}`;
2635
- }
2636
- function Os(e) {
2637
- var f, h, b, m;
2638
- const t = {
2639
- "text-align": ls(e.alignment)
2640
- }, r = ne(e.spacingBefore), n = ne(e.spacingAfter), s = ne(e.leftIndent), o = ne(e.rightIndent), a = ne(e.firstLineIndent);
2641
- if (r && (t["margin-top"] = `${r}px`), n && (t["margin-bottom"] = `${n}px`), s && (t["margin-left"] = `${s}px`), o && (t["margin-right"] = `${o}px`), a && (t["text-indent"] = `${a}px`), e.lineSpacing) {
2642
- const y = Math.abs(e.lineSpacing) / 240;
2643
- y && (t["line-height"] = String(Math.max(1, y)));
2644
- }
2645
- e.keepLines && (t["break-inside"] = "avoid"), e.keepNext && (t["break-after"] = "avoid"), e.pageBreakBefore && (t["break-before"] = "page"), e.rtlPara && (t.direction = "rtl");
2646
- const i = re((f = e.borders) == null ? void 0 : f.top), l = re((h = e.borders) == null ? void 0 : h.right), c = re((b = e.borders) == null ? void 0 : b.bottom), u = re((m = e.borders) == null ? void 0 : m.left);
2647
- return i && (t["border-top"] = i), l && (t["border-right"] = l), c && (t["border-bottom"] = c), u && (t["border-left"] = u), t;
2648
- }
2649
- function Is(e) {
2650
- const t = us(e);
2651
- if (!e || t === "none")
2652
- return {};
2653
- const r = { "text-decoration-line": "underline" };
2654
- return t === "double" || t === "wavy-double" ? r["text-decoration-style"] = "double" : t.includes("dot") || t === "dotted-heavy" ? r["text-decoration-style"] = "dotted" : t.includes("dash") ? r["text-decoration-style"] = "dashed" : t.includes("wave") || t.includes("wavy") ? r["text-decoration-style"] = "wavy" : r["text-decoration-style"] = "solid", r;
2655
- }
2656
- function gn(e) {
2657
- var n;
2658
- const t = {};
2659
- (e.bold || e.boldBi) && (t["font-weight"] = "700"), (e.italic || e.italicBi) && (t["font-style"] = "italic"), (e.strike || e.doubleStrike) && (t["text-decoration-line"] = `${t["text-decoration-line"] ? `${t["text-decoration-line"]} ` : ""}line-through`), Object.assign(t, Is(e.underline)), e.fontSizeHalfPoints && (t["font-size"] = `${e.fontSizeHalfPoints / 2}pt`), e.fontFamily && (t["font-family"] = `'${String(e.fontFamily).replace(/'/g, "\\'")}', sans-serif`), e.colorIndex && Se[e.colorIndex] && (t.color = Se[e.colorIndex]);
2660
- const r = typeof e.highlight == "number" ? e.highlight : (n = e.highlight) == null ? void 0 : n.index;
2661
- return r && bt[r] && (t["background-color"] = bt[r]), e.smallCaps && (t["font-variant-caps"] = "small-caps"), e.caps && (t["text-transform"] = "uppercase"), e.scale && e.scale !== 100 && (t.display = "inline-block", t.transform = `scaleX(${e.scale / 100})`, t["transform-origin"] = "left center"), e.positionHalfPoints > 0 && (t["vertical-align"] = "super"), e.positionHalfPoints < 0 && (t["vertical-align"] = "sub"), e.outline && (t["text-shadow"] = "0 0 0.02em currentColor"), (e.shadow || e.emboss || e.imprint) && (t["text-shadow"] = t["text-shadow"] ? `${t["text-shadow"]}, 0.06em 0.06em 0.08em rgba(0,0,0,.25)` : "0.06em 0.06em 0.08em rgba(0,0,0,.25)"), e.rtl && (t.direction = "rtl"), t;
2662
- }
2663
- function Ds(e) {
2664
- const t = te(e.text), r = gn(e.style);
2665
- r["white-space"] = "break-spaces";
2666
- const n = Ce(r), s = `<span${n ? ` style="${n}"` : ""}>${t}</span>`;
2667
- return e.href ? `<a class="msdoc-link" href="${te(e.href)}" target="_blank" rel="noreferrer noopener">${s}</a>` : s;
2668
- }
2669
- function Ls(e) {
2670
- const t = gn(e.style);
2671
- t["max-width"] = "100%", t.height = "auto";
2672
- const r = `<img class="msdoc-image" src="${te(e.asset.dataUrl)}" alt="" style="${Ce(t)}">`;
2673
- return e.href ? `<a class="msdoc-link" href="${te(e.href)}" target="_blank" rel="noreferrer noopener">${r}</a>` : r;
2674
- }
2675
- function _s(e) {
2676
- const t = te(e.asset.name || "embedded-file"), r = `<a class="msdoc-attachment" href="${te(e.asset.dataUrl)}" download="${t}">📎 ${t}</a>`;
2677
- return e.href ? `<a class="msdoc-link" href="${te(e.href)}" target="_blank" rel="noreferrer noopener">${r}</a>` : r;
2678
- }
2679
- function Ms(e) {
2680
- return e.map((t) => t.type === "text" ? Ds(t) : t.type === "image" ? Ls(t) : t.type === "attachment" ? _s(t) : t.type === "lineBreak" ? "<br>" : t.type === "pageBreak" ? '<span class="msdoc-page-break"></span>' : "").join("");
2681
- }
2682
- function bn(e, t = {}) {
2683
- const r = t.inline ? "div" : "p", n = Ce(Os(e.paraState)), o = Ms(e.inlines || []) || "<br>", a = ["msdoc-paragraph"];
2684
- return e.styleName && a.push(`msdoc-style-${un(e.styleName)}`), `<${r} class="${a.join(" ")}"${n ? ` style="${n}"` : ""}>${o}</${r}>`;
2685
- }
2686
- function Ns(e) {
2687
- var u, f, h, b, m, y, x, T, S, E, O, A, D, I, U, v, P, j;
2688
- const t = {}, r = ((u = e.meta) == null ? void 0 : u.rightBoundary) != null && ((f = e.meta) == null ? void 0 : f.leftBoundary) != null ? e.meta.rightBoundary - e.meta.leftBoundary : (h = e.meta) == null ? void 0 : h.width, n = ne(r);
2689
- n && (t.width = `${n}px`), (b = e.meta) != null && b.noWrap && (t["white-space"] = "nowrap"), (m = e.meta) != null && m.fitText && (t["text-align"] = "justify"), ((y = e.meta) == null ? void 0 : y.vertAlign) != null && (t["vertical-align"] = fs(e.meta.vertAlign));
2690
- const s = re((T = (x = e.meta) == null ? void 0 : x.borders) == null ? void 0 : T.all), o = re((E = (S = e.meta) == null ? void 0 : S.borders) == null ? void 0 : E.top) || s, a = re((A = (O = e.meta) == null ? void 0 : O.borders) == null ? void 0 : A.right) || s, i = re((I = (D = e.meta) == null ? void 0 : D.borders) == null ? void 0 : I.bottom) || s, l = re((v = (U = e.meta) == null ? void 0 : U.borders) == null ? void 0 : v.left) || s;
2691
- o && (t["border-top"] = o), a && (t["border-right"] = a), i && (t["border-bottom"] = i), l && (t["border-left"] = l);
2692
- const c = typeof ((P = e.meta) == null ? void 0 : P.shading) == "object" && ((j = e.meta) != null && j.shading) && "color" in e.meta.shading ? e.meta.shading.color : void 0;
2693
- return c && Se[c] && (t["background-color"] = Se[c]), t;
2694
- }
2695
- function Us(e) {
2696
- var s, o, a;
2697
- const t = {}, r = ne(e.gridWidthTwips || ((o = (s = e.state) == null ? void 0 : s.tableWidth) == null ? void 0 : o.wWidth));
2698
- r ? t.width = `${r}px` : t.width = "100%";
2699
- const n = ne((a = e.state) == null ? void 0 : a.leftIndent);
2700
- return n && (t["margin-left"] = `${n}px`), t["border-collapse"] = "collapse", t["table-layout"] = "fixed", t;
2701
- }
2702
- function $s(e) {
2703
- const t = e.rows.map((r) => {
2704
- var a;
2705
- const n = (a = r.state) != null && a.rowHeight ? ne(Math.abs(r.state.rowHeight)) : null, s = n ? ` style="height:${n}px"` : "", o = r.cells.filter((i) => !i.hidden).map((i) => {
2706
- var f, h;
2707
- const l = [];
2708
- ((f = i.colspan) != null ? f : 1) > 1 && l.push(` colspan="${i.colspan}"`), ((h = i.rowspan) != null ? h : 1) > 1 && l.push(` rowspan="${i.rowspan}"`);
2709
- const c = Ce(Ns(i)), u = i.paragraphs.map((b) => bn(b, { inline: !0 })).join("");
2710
- return `<td class="msdoc-cell"${l.join("")}${c ? ` style="${c}"` : ""}>${u || '<div class="msdoc-paragraph"><br></div>'}</td>`;
2711
- }).join("");
2712
- return `<tr class="msdoc-row"${s}>${o}</tr>`;
2713
- }).join("");
2714
- return `<table class="msdoc-table msdoc-table-depth-${e.depth}" style="${Ce(Us(e))}"><tbody>${t}</tbody></table>`;
2715
- }
2716
- function Hs(e) {
2717
- return `<section class="msdoc-attachments"><div class="msdoc-attachments-title">Embedded attachments</div><ul>${e.items.map((r) => `<li><a class="msdoc-attachment" href="${te(r.dataUrl)}" download="${te(r.name || "embedded-file")}">📎 ${te(r.name || "embedded-file")}</a></li>`).join("")}</ul></section>`;
2718
- }
2719
- function xn() {
2720
- return `
2721
- .msdoc-root{box-sizing:border-box;max-width:100%;padding:24px;background:#fff;color:#111;font:14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
2722
- .msdoc-root *{box-sizing:border-box}
2723
- .msdoc-paragraph{margin:0 0 8px;white-space:normal;word-break:break-word;overflow-wrap:anywhere}
2724
- .msdoc-paragraph:last-child{margin-bottom:0}
2725
- .msdoc-table{margin:12px 0;border-collapse:collapse;border-spacing:0;max-width:100%}
2726
- .msdoc-cell{padding:6px 8px;vertical-align:top;word-break:break-word;overflow-wrap:anywhere}
2727
- .msdoc-link{color:#1a73e8;text-decoration:none}
2728
- .msdoc-link:hover{text-decoration:underline}
2729
- .msdoc-image{display:inline-block;vertical-align:middle}
2730
- .msdoc-attachment{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border:1px solid #d0d7de;border-radius:6px;background:#f6f8fa;color:#0969da;text-decoration:none}
2731
- .msdoc-attachments{margin-top:20px;padding-top:12px;border-top:1px solid #e5e7eb}
2732
- .msdoc-attachments-title{font-weight:600;margin-bottom:8px}
2733
- .msdoc-page-break{display:block;height:0;border-top:1px dashed #cbd5e1;margin:16px 0}
2734
- `;
2735
- }
2736
- function js(e, t = {}) {
2737
- var s;
2738
- const r = (s = t.css) != null ? s : xn();
2739
- return {
2740
- html: e.blocks.map((o) => o.type === "paragraph" ? bn(o) : o.type === "table" ? $s(o) : o.type === "attachments" ? Hs(o) : "").join(""),
2741
- css: r,
2742
- warnings: e.warnings || [],
2743
- meta: e.meta,
2744
- assets: e.assets || [],
2745
- parsed: e
2746
- };
2747
- }
2748
- function Ws(e) {
2749
- return B(this, null, function* () {
2750
- if (e instanceof ArrayBuffer)
2751
- return e;
2752
- if (ArrayBuffer.isView(e)) {
2753
- const t = new Uint8Array(e.byteLength);
2754
- return t.set(new Uint8Array(e.buffer, e.byteOffset, e.byteLength)), t.buffer;
2755
- }
2756
- if (typeof Blob != "undefined" && e instanceof Blob)
2757
- return yield e.arrayBuffer();
2758
- if (typeof e == "string") {
2759
- const t = yield fetch(e);
2760
- if (!t.ok)
2761
- throw new Error(`Failed to fetch document: ${t.status}`);
2762
- return yield t.arrayBuffer();
2763
- }
2764
- throw new TypeError("Unsupported input type");
2765
- });
2766
- }
2767
- function zs(r) {
2768
- return B(this, arguments, function* (e, t = {}) {
2769
- const n = yield Ws(e);
2770
- if (t.workerClient)
2771
- return t.workerClient.parseToHtml(n, {
2772
- parseOptions: t.parseOptions || {},
2773
- renderOptions: t.renderOptions || {}
2774
- });
2775
- const s = vs(n, t.parseOptions || {});
2776
- return js(s, t.renderOptions || {});
2777
- });
2778
- }
2779
- const yn = '<span class="msdoc-page-break"></span>', qs = '<p class="msdoc-paragraph"><br></p>', Vs = `
2780
- .msdoc-stage{
2781
- box-sizing:border-box;
2782
- min-height:100%;
2783
- padding:32px 24px 48px;
2784
- background:#ececec;
2785
- display:flex;
2786
- flex-direction:column;
2787
- align-items:center;
2788
- gap:24px;
2789
- }
2790
- .msdoc-page{
2791
- width:min(100%,794px);
2792
- }
2793
- .msdoc-page > .msdoc-root{
2794
- width:100%;
2795
- max-width:none;
2796
- min-height:1123px;
2797
- padding:96px 88px;
2798
- background:#fff;
2799
- border:1px solid #d9d9d9;
2800
- box-shadow:0 1px 3px rgba(0,0,0,0.08), 0 12px 32px rgba(0,0,0,0.12);
2801
- }
2802
- .msdoc-page .msdoc-page-break{
2803
- display:none;
2804
- }
2805
- @media (max-width: 860px){
2806
- .msdoc-stage{
2807
- padding:16px 12px 24px;
2808
- gap:16px;
2809
- }
2810
- .msdoc-page{
2811
- width:100%;
2812
- }
2813
- .msdoc-page > .msdoc-root{
2814
- min-height:auto;
2815
- padding:24px 20px;
2816
- box-shadow:none;
2817
- }
2818
- }
2819
- `;
2820
- function Js(e) {
2821
- return e.replace(/<(p|table|section)([^>]*?)style="([^"]*?\bbreak-before\s*:\s*page;?[^"]*?)"([^>]*)>/gi, (t) => `${yn}${t}`);
2822
- }
2823
- function Ks(e) {
2824
- return `<div class="msdoc-stage">${Js(e).split(yn).map((n) => `<section class="msdoc-page"><div class="msdoc-root">${n || qs}</div></section>`).join("")}</div>`;
2825
- }
2826
- function Gs(e, t) {
2827
- return B(this, null, function* () {
2828
- const r = yield zs(e, {
2829
- renderOptions: {
2830
- css: `${xn()}
2831
- ${Vs}`
2832
- }
2833
- });
2834
- return t.innerHTML = `<style data-msdoc>${r.css}</style>${Ks(r.html)}`, {
2835
- $el: t,
2836
- unmount() {
2837
- t.innerHTML = "";
2838
- }
2839
- };
2840
- });
2841
- }
2842
- const Xs = Be(() => import("./PptxRender.js"));
2843
- function Qs(e, t) {
2844
- return B(this, null, function* () {
2845
- return he({
2846
- render: () => me(Xs, {
2847
- data: e
2848
- }, null)
2849
- }).mount(t);
2850
- });
2851
- }
2852
- const Ys = Be(() => import("./XlsxTable.js"));
2853
- function Vt(e, t, r) {
2854
- return B(this, null, function* () {
2855
- const n = he({
2856
- render: () => me(Ys, {
2857
- data: e,
2858
- type: r
2859
- }, null)
2860
- });
2861
- return n.mount(t), n;
2862
- });
2863
- }
2864
- const Zs = Be(() => import("./PdfView.js"));
2865
- function eo(e, t) {
2866
- return B(this, null, function* () {
2867
- const r = he({
2868
- render: () => me(Zs, {
2869
- data: e
2870
- }, null)
2871
- });
2872
- return r.mount(t), r;
2873
- });
2874
- }
2875
- function to(e) {
2876
- return B(this, null, function* () {
2877
- return new Promise((t, r) => {
2878
- const n = new FileReader();
2879
- n.onload = (s) => {
2880
- var o;
2881
- return t((o = s.target) == null ? void 0 : o.result);
2882
- }, n.onerror = (s) => r(s), n.readAsArrayBuffer(e);
2883
- });
2884
- });
2885
- }
2886
- function no(e) {
2887
- return B(this, null, function* () {
2888
- return new Promise((t, r) => {
2889
- const n = new FileReader();
2890
- n.onload = (s) => {
2891
- var a;
2892
- const o = (a = s.target) == null ? void 0 : a.result;
2893
- typeof o == "string" && t(o);
2894
- }, n.onerror = (s) => r(s), n.readAsDataURL(new Blob([e]));
2895
- });
2896
- });
2897
- }
2898
- function wn(e) {
2899
- return B(this, null, function* () {
2900
- return new Promise((t, r) => {
2901
- const n = new FileReader();
2902
- n.onload = (s) => {
2903
- var a;
2904
- const o = (a = s.target) == null ? void 0 : a.result;
2905
- typeof o == "string" && t(o);
2906
- }, n.onerror = (s) => r(s), n.readAsText(new Blob([e]), "utf-8");
2907
- });
2908
- });
2909
- }
2910
- const ro = Be(() => import("./ImageViewer.js"));
2911
- function so(e, t) {
2912
- return B(this, null, function* () {
2913
- const r = yield no(e), n = he({
2914
- render: () => me(ro, {
2915
- image: r
2916
- }, null)
2917
- });
2918
- return n.mount(t), n;
2919
- });
2920
- }
2921
- const oo = Be(() => import("./MarkdownViewer.js"));
2922
- function ao(e, t) {
2923
- return B(this, null, function* () {
2924
- const r = yield wn(e), n = he({
2925
- render: () => me(oo, {
2926
- data: r
2927
- }, null)
2928
- });
2929
- return n.mount(t), n;
2930
- });
2931
- }
2932
- const io = { class: "code-area" }, co = /* @__PURE__ */ ln({
2933
- __name: "CodeViewer",
2934
- props: {
2935
- value: {}
2936
- },
2937
- setup(e) {
2938
- return (t, r) => (Oe(), Ie("pre", io, " " + De(t.value) + `
2939
- `, 1));
2940
- }
2941
- });
2942
- const Tn = (e, t) => {
2943
- const r = e.__vccOpts || e;
2944
- for (const [n, s] of t)
2945
- r[n] = s;
2946
- return r;
2947
- }, lo = /* @__PURE__ */ Tn(co, [["__scopeId", "data-v-3be501eb"]]);
2948
- function uo(e, t) {
2949
- return B(this, null, function* () {
2950
- const r = yield wn(e), n = he({
2951
- render: () => me(lo, {
2952
- value: r
2953
- }, null)
2954
- });
2955
- return n.mount(t), n;
2956
- });
2957
- }
2958
- function fo(e, t) {
2959
- const r = document.createElement("video");
2960
- r.width = 840, r.height = 480, r.controls = !0, Object.assign(r.style, {
2961
- margin: "40px auto",
2962
- display: "block"
2963
- });
2964
- const n = document.createElement("source");
2965
- n.src = URL.createObjectURL(new Blob([e])), r.appendChild(n), t.appendChild(r);
2966
- }
2967
- const ve = (e) => ({
2968
- $el: e,
2969
- unmount() {
2970
- }
2971
- }), po = [
2972
- // 使用docxjs支持,目前效果最好的渲染器
2973
- {
2974
- accepts: ["docx"],
2975
- handler: (e, t) => B(void 0, null, function* () {
2976
- return yield sr(e, t), window.dispatchEvent(new Event("resize")), ve(t);
2977
- })
2978
- },
2979
- {
2980
- accepts: ["doc"],
2981
- handler: (e, t) => B(void 0, null, function* () {
2982
- return Gs(e, t);
2983
- })
2984
- },
2985
- // 使用pptx2html,已通过默认值更替
2986
- {
2987
- accepts: ["pptx"],
2988
- handler: (e, t) => B(void 0, null, function* () {
2989
- return yield Qs(e, t), window.dispatchEvent(new Event("resize")), ve(t);
2990
- })
2991
- },
2992
- // 使用exceljs + handsontable,全部样式
2993
- {
2994
- accepts: ["xlsx"],
2995
- handler: (e, t) => B(void 0, null, function* () {
2996
- return Vt(e, t, "xml");
2997
- })
2998
- },
2999
- // 使用js-xlsx + handsontable,无样式
3000
- {
3001
- accepts: ["xlsm", "xlsb", "xls", "csv", "ods", "fods", "numbers"],
3002
- handler: (e, t) => B(void 0, null, function* () {
3003
- return Vt(e, t, "binary");
3004
- })
3005
- },
3006
- // 使用pdfjs,渲染pdf,效果最好
3007
- {
3008
- accepts: ["pdf"],
3009
- handler: (e, t) => B(void 0, null, function* () {
3010
- return eo(e, t);
3011
- })
3012
- },
3013
- // 图片过滤器
3014
- {
3015
- accepts: ["gif", "jpg", "jpeg", "bmp", "tiff", "tif", "png", "svg", "webp"],
3016
- handler: (e, t) => B(void 0, null, function* () {
3017
- return so(e, t);
3018
- })
3019
- },
3020
- {
3021
- accepts: ["md", "markdown"],
3022
- handler: (e, t) => B(void 0, null, function* () {
3023
- return ao(e, t);
3024
- })
3025
- },
3026
- // 纯文本预览
3027
- {
3028
- accepts: ["txt", "json", "js", "css", "java", "py", "html", "jsx", "ts", "tsx", "xml", "log"],
3029
- handler: (e, t) => B(void 0, null, function* () {
3030
- return uo(e, t);
3031
- })
3032
- },
3033
- // 视频预览,仅支持MP4
3034
- {
3035
- accepts: ["mp4"],
3036
- handler: (e, t) => B(void 0, null, function* () {
3037
- return fo(e, t), ve(t);
3038
- })
3039
- },
3040
- // 错误处理
3041
- {
3042
- accepts: ["error"],
3043
- handler: (e, t, r) => B(void 0, null, function* () {
3044
- return t.innerHTML = `<div style='text-align: center; margin-top: 80px'>不支持.${r}格式的在线预览,请下载后预览或转换为支持的格式</div>
3045
- <div style='text-align: center'>支持doc、docx、xlsx、pptx、pdf,以及纯文本格式和各种图片格式的在线预览</div>`, ve(t);
3046
- })
3047
- }
3048
- ], Pn = po.reduce((e, { accepts: t, handler: r }) => (t.forEach((n) => e.set(n, r)), e), /* @__PURE__ */ new Map()), Jt = Pn.get("error");
3049
- function ho(e) {
3050
- const t = e.lastIndexOf(".");
3051
- return e.substring(t + 1);
3052
- }
3053
- function mo(e, t, r) {
3054
- return B(this, null, function* () {
3055
- const n = Pn.get(t.toLowerCase());
3056
- if (n)
3057
- return n(e, r);
3058
- if (Jt)
3059
- return Jt(e, r, t);
3060
- });
3061
- }
3062
- function Sn(e, t) {
3063
- return function() {
3064
- return e.apply(t, arguments);
3065
- };
3066
- }
3067
- const { toString: go } = Object.prototype, { getPrototypeOf: Ft } = Object, Ke = ((e) => (t) => {
3068
- const r = go.call(t);
3069
- return e[r] || (e[r] = r.slice(8, -1).toLowerCase());
3070
- })(/* @__PURE__ */ Object.create(null)), Q = (e) => (e = e.toLowerCase(), (t) => Ke(t) === e), Ge = (e) => (t) => typeof t === e, { isArray: ge } = Array, Ee = Ge("undefined");
3071
- function bo(e) {
3072
- return e !== null && !Ee(e) && e.constructor !== null && !Ee(e.constructor) && W(e.constructor.isBuffer) && e.constructor.isBuffer(e);
3073
- }
3074
- const Cn = Q("ArrayBuffer");
3075
- function xo(e) {
3076
- let t;
3077
- return typeof ArrayBuffer != "undefined" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Cn(e.buffer), t;
3078
- }
3079
- const yo = Ge("string"), W = Ge("function"), En = Ge("number"), Xe = (e) => e !== null && typeof e == "object", wo = (e) => e === !0 || e === !1, Me = (e) => {
3080
- if (Ke(e) !== "object")
3081
- return !1;
3082
- const t = Ft(e);
3083
- return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
3084
- }, To = Q("Date"), Po = Q("File"), So = Q("Blob"), Co = Q("FileList"), Eo = (e) => Xe(e) && W(e.pipe), Bo = (e) => {
3085
- let t;
3086
- return e && (typeof FormData == "function" && e instanceof FormData || W(e.append) && ((t = Ke(e)) === "formdata" || // detect form-data instance
3087
- t === "object" && W(e.toString) && e.toString() === "[object FormData]"));
3088
- }, Fo = Q("URLSearchParams"), [Ro, ko, Ao, vo] = ["ReadableStream", "Request", "Response", "Headers"].map(Q), Oo = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
3089
- function Re(e, t, { allOwnKeys: r = !1 } = {}) {
3090
- if (e === null || typeof e == "undefined")
3091
- return;
3092
- let n, s;
3093
- if (typeof e != "object" && (e = [e]), ge(e))
3094
- for (n = 0, s = e.length; n < s; n++)
3095
- t.call(null, e[n], n, e);
3096
- else {
3097
- const o = r ? Object.getOwnPropertyNames(e) : Object.keys(e), a = o.length;
3098
- let i;
3099
- for (n = 0; n < a; n++)
3100
- i = o[n], t.call(null, e[i], i, e);
3101
- }
3102
- }
3103
- function Bn(e, t) {
3104
- t = t.toLowerCase();
3105
- const r = Object.keys(e);
3106
- let n = r.length, s;
3107
- for (; n-- > 0; )
3108
- if (s = r[n], t === s.toLowerCase())
3109
- return s;
3110
- return null;
3111
- }
3112
- const ce = (() => typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : global)(), Fn = (e) => !Ee(e) && e !== ce;
3113
- function Tt() {
3114
- const { caseless: e } = Fn(this) && this || {}, t = {}, r = (n, s) => {
3115
- const o = e && Bn(t, s) || s;
3116
- Me(t[o]) && Me(n) ? t[o] = Tt(t[o], n) : Me(n) ? t[o] = Tt({}, n) : ge(n) ? t[o] = n.slice() : t[o] = n;
3117
- };
3118
- for (let n = 0, s = arguments.length; n < s; n++)
3119
- arguments[n] && Re(arguments[n], r);
3120
- return t;
3121
- }
3122
- const Io = (e, t, r, { allOwnKeys: n } = {}) => (Re(t, (s, o) => {
3123
- r && W(s) ? e[o] = Sn(s, r) : e[o] = s;
3124
- }, { allOwnKeys: n }), e), Do = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Lo = (e, t, r, n) => {
3125
- e.prototype = Object.create(t.prototype, n), e.prototype.constructor = e, Object.defineProperty(e, "super", {
3126
- value: t.prototype
3127
- }), r && Object.assign(e.prototype, r);
3128
- }, _o = (e, t, r, n) => {
3129
- let s, o, a;
3130
- const i = {};
3131
- if (t = t || {}, e == null)
3132
- return t;
3133
- do {
3134
- for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
3135
- a = s[o], (!n || n(a, e, t)) && !i[a] && (t[a] = e[a], i[a] = !0);
3136
- e = r !== !1 && Ft(e);
3137
- } while (e && (!r || r(e, t)) && e !== Object.prototype);
3138
- return t;
3139
- }, Mo = (e, t, r) => {
3140
- e = String(e), (r === void 0 || r > e.length) && (r = e.length), r -= t.length;
3141
- const n = e.indexOf(t, r);
3142
- return n !== -1 && n === r;
3143
- }, No = (e) => {
3144
- if (!e)
3145
- return null;
3146
- if (ge(e))
3147
- return e;
3148
- let t = e.length;
3149
- if (!En(t))
3150
- return null;
3151
- const r = new Array(t);
3152
- for (; t-- > 0; )
3153
- r[t] = e[t];
3154
- return r;
3155
- }, Uo = ((e) => (t) => e && t instanceof e)(typeof Uint8Array != "undefined" && Ft(Uint8Array)), $o = (e, t) => {
3156
- const n = (e && e[Symbol.iterator]).call(e);
3157
- let s;
3158
- for (; (s = n.next()) && !s.done; ) {
3159
- const o = s.value;
3160
- t.call(e, o[0], o[1]);
3161
- }
3162
- }, Ho = (e, t) => {
3163
- let r;
3164
- const n = [];
3165
- for (; (r = e.exec(t)) !== null; )
3166
- n.push(r);
3167
- return n;
3168
- }, jo = Q("HTMLFormElement"), Wo = (e) => e.toLowerCase().replace(
3169
- /[-_\s]([a-z\d])(\w*)/g,
3170
- function(r, n, s) {
3171
- return n.toUpperCase() + s;
3172
- }
3173
- ), Kt = (({ hasOwnProperty: e }) => (t, r) => e.call(t, r))(Object.prototype), zo = Q("RegExp"), Rn = (e, t) => {
3174
- const r = Object.getOwnPropertyDescriptors(e), n = {};
3175
- Re(r, (s, o) => {
3176
- let a;
3177
- (a = t(s, o, e)) !== !1 && (n[o] = a || s);
3178
- }), Object.defineProperties(e, n);
3179
- }, qo = (e) => {
3180
- Rn(e, (t, r) => {
3181
- if (W(e) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
3182
- return !1;
3183
- const n = e[r];
3184
- if (W(n)) {
3185
- if (t.enumerable = !1, "writable" in t) {
3186
- t.writable = !1;
3187
- return;
3188
- }
3189
- t.set || (t.set = () => {
3190
- throw Error("Can not rewrite read-only method '" + r + "'");
3191
- });
3192
- }
3193
- });
3194
- }, Vo = (e, t) => {
3195
- const r = {}, n = (s) => {
3196
- s.forEach((o) => {
3197
- r[o] = !0;
3198
- });
3199
- };
3200
- return ge(e) ? n(e) : n(String(e).split(t)), r;
3201
- }, Jo = () => {
3202
- }, Ko = (e, t) => e != null && Number.isFinite(e = +e) ? e : t, ft = "abcdefghijklmnopqrstuvwxyz", Gt = "0123456789", kn = {
3203
- DIGIT: Gt,
3204
- ALPHA: ft,
3205
- ALPHA_DIGIT: ft + ft.toUpperCase() + Gt
3206
- }, Go = (e = 16, t = kn.ALPHA_DIGIT) => {
3207
- let r = "";
3208
- const { length: n } = t;
3209
- for (; e--; )
3210
- r += t[Math.random() * n | 0];
3211
- return r;
3212
- };
3213
- function Xo(e) {
3214
- return !!(e && W(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
3215
- }
3216
- const Qo = (e) => {
3217
- const t = new Array(10), r = (n, s) => {
3218
- if (Xe(n)) {
3219
- if (t.indexOf(n) >= 0)
3220
- return;
3221
- if (!("toJSON" in n)) {
3222
- t[s] = n;
3223
- const o = ge(n) ? [] : {};
3224
- return Re(n, (a, i) => {
3225
- const l = r(a, s + 1);
3226
- !Ee(l) && (o[i] = l);
3227
- }), t[s] = void 0, o;
3228
- }
3229
- }
3230
- return n;
3231
- };
3232
- return r(e, 0);
3233
- }, Yo = Q("AsyncFunction"), Zo = (e) => e && (Xe(e) || W(e)) && W(e.then) && W(e.catch), An = ((e, t) => e ? setImmediate : t ? ((r, n) => (ce.addEventListener("message", ({ source: s, data: o }) => {
3234
- s === ce && o === r && n.length && n.shift()();
3235
- }, !1), (s) => {
3236
- n.push(s), ce.postMessage(r, "*");
3237
- }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(
3238
- typeof setImmediate == "function",
3239
- W(ce.postMessage)
3240
- ), ea = typeof queueMicrotask != "undefined" ? queueMicrotask.bind(ce) : typeof process != "undefined" && process.nextTick || An, p = {
3241
- isArray: ge,
3242
- isArrayBuffer: Cn,
3243
- isBuffer: bo,
3244
- isFormData: Bo,
3245
- isArrayBufferView: xo,
3246
- isString: yo,
3247
- isNumber: En,
3248
- isBoolean: wo,
3249
- isObject: Xe,
3250
- isPlainObject: Me,
3251
- isReadableStream: Ro,
3252
- isRequest: ko,
3253
- isResponse: Ao,
3254
- isHeaders: vo,
3255
- isUndefined: Ee,
3256
- isDate: To,
3257
- isFile: Po,
3258
- isBlob: So,
3259
- isRegExp: zo,
3260
- isFunction: W,
3261
- isStream: Eo,
3262
- isURLSearchParams: Fo,
3263
- isTypedArray: Uo,
3264
- isFileList: Co,
3265
- forEach: Re,
3266
- merge: Tt,
3267
- extend: Io,
3268
- trim: Oo,
3269
- stripBOM: Do,
3270
- inherits: Lo,
3271
- toFlatObject: _o,
3272
- kindOf: Ke,
3273
- kindOfTest: Q,
3274
- endsWith: Mo,
3275
- toArray: No,
3276
- forEachEntry: $o,
3277
- matchAll: Ho,
3278
- isHTMLForm: jo,
3279
- hasOwnProperty: Kt,
3280
- hasOwnProp: Kt,
3281
- // an alias to avoid ESLint no-prototype-builtins detection
3282
- reduceDescriptors: Rn,
3283
- freezeMethods: qo,
3284
- toObjectSet: Vo,
3285
- toCamelCase: Wo,
3286
- noop: Jo,
3287
- toFiniteNumber: Ko,
3288
- findKey: Bn,
3289
- global: ce,
3290
- isContextDefined: Fn,
3291
- ALPHABET: kn,
3292
- generateString: Go,
3293
- isSpecCompliantForm: Xo,
3294
- toJSONObject: Qo,
3295
- isAsyncFn: Yo,
3296
- isThenable: Zo,
3297
- setImmediate: An,
3298
- asap: ea
3299
- };
3300
- function C(e, t, r, n, s) {
3301
- 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), r && (this.config = r), n && (this.request = n), s && (this.response = s, this.status = s.status ? s.status : null);
3302
- }
3303
- p.inherits(C, Error, {
3304
- toJSON: function() {
3305
- return {
3306
- // Standard
3307
- message: this.message,
3308
- name: this.name,
3309
- // Microsoft
3310
- description: this.description,
3311
- number: this.number,
3312
- // Mozilla
3313
- fileName: this.fileName,
3314
- lineNumber: this.lineNumber,
3315
- columnNumber: this.columnNumber,
3316
- stack: this.stack,
3317
- // Axios
3318
- config: p.toJSONObject(this.config),
3319
- code: this.code,
3320
- status: this.status
3321
- };
3322
- }
3323
- });
3324
- const vn = C.prototype, On = {};
3325
- [
3326
- "ERR_BAD_OPTION_VALUE",
3327
- "ERR_BAD_OPTION",
3328
- "ECONNABORTED",
3329
- "ETIMEDOUT",
3330
- "ERR_NETWORK",
3331
- "ERR_FR_TOO_MANY_REDIRECTS",
3332
- "ERR_DEPRECATED",
3333
- "ERR_BAD_RESPONSE",
3334
- "ERR_BAD_REQUEST",
3335
- "ERR_CANCELED",
3336
- "ERR_NOT_SUPPORT",
3337
- "ERR_INVALID_URL"
3338
- // eslint-disable-next-line func-names
3339
- ].forEach((e) => {
3340
- On[e] = { value: e };
3341
- });
3342
- Object.defineProperties(C, On);
3343
- Object.defineProperty(vn, "isAxiosError", { value: !0 });
3344
- C.from = (e, t, r, n, s, o) => {
3345
- const a = Object.create(vn);
3346
- return p.toFlatObject(e, a, function(l) {
3347
- return l !== Error.prototype;
3348
- }, (i) => i !== "isAxiosError"), C.call(a, e.message, t, r, n, s), a.cause = e, a.name = e.name, o && Object.assign(a, o), a;
3349
- };
3350
- const ta = null;
3351
- function Pt(e) {
3352
- return p.isPlainObject(e) || p.isArray(e);
3353
- }
3354
- function In(e) {
3355
- return p.endsWith(e, "[]") ? e.slice(0, -2) : e;
3356
- }
3357
- function Xt(e, t, r) {
3358
- return e ? e.concat(t).map(function(s, o) {
3359
- return s = In(s), !r && o ? "[" + s + "]" : s;
3360
- }).join(r ? "." : "") : t;
3361
- }
3362
- function na(e) {
3363
- return p.isArray(e) && !e.some(Pt);
3364
- }
3365
- const ra = p.toFlatObject(p, {}, null, function(t) {
3366
- return /^is[A-Z]/.test(t);
3367
- });
3368
- function Qe(e, t, r) {
3369
- if (!p.isObject(e))
3370
- throw new TypeError("target must be an object");
3371
- t = t || new FormData(), r = p.toFlatObject(r, {
3372
- metaTokens: !0,
3373
- dots: !1,
3374
- indexes: !1
3375
- }, !1, function(y, x) {
3376
- return !p.isUndefined(x[y]);
3377
- });
3378
- const n = r.metaTokens, s = r.visitor || u, o = r.dots, a = r.indexes, l = (r.Blob || typeof Blob != "undefined" && Blob) && p.isSpecCompliantForm(t);
3379
- if (!p.isFunction(s))
3380
- throw new TypeError("visitor must be a function");
3381
- function c(m) {
3382
- if (m === null)
3383
- return "";
3384
- if (p.isDate(m))
3385
- return m.toISOString();
3386
- if (!l && p.isBlob(m))
3387
- throw new C("Blob is not supported. Use a Buffer instead.");
3388
- return p.isArrayBuffer(m) || p.isTypedArray(m) ? l && typeof Blob == "function" ? new Blob([m]) : Buffer.from(m) : m;
3389
- }
3390
- function u(m, y, x) {
3391
- let T = m;
3392
- if (m && !x && typeof m == "object") {
3393
- if (p.endsWith(y, "{}"))
3394
- y = n ? y : y.slice(0, -2), m = JSON.stringify(m);
3395
- else if (p.isArray(m) && na(m) || (p.isFileList(m) || p.endsWith(y, "[]")) && (T = p.toArray(m)))
3396
- return y = In(y), T.forEach(function(E, O) {
3397
- !(p.isUndefined(E) || E === null) && t.append(
3398
- // eslint-disable-next-line no-nested-ternary
3399
- a === !0 ? Xt([y], O, o) : a === null ? y : y + "[]",
3400
- c(E)
3401
- );
3402
- }), !1;
3403
- }
3404
- return Pt(m) ? !0 : (t.append(Xt(x, y, o), c(m)), !1);
3405
- }
3406
- const f = [], h = Object.assign(ra, {
3407
- defaultVisitor: u,
3408
- convertValue: c,
3409
- isVisitable: Pt
3410
- });
3411
- function b(m, y) {
3412
- if (!p.isUndefined(m)) {
3413
- if (f.indexOf(m) !== -1)
3414
- throw Error("Circular reference detected in " + y.join("."));
3415
- f.push(m), p.forEach(m, function(T, S) {
3416
- (!(p.isUndefined(T) || T === null) && s.call(
3417
- t,
3418
- T,
3419
- p.isString(S) ? S.trim() : S,
3420
- y,
3421
- h
3422
- )) === !0 && b(T, y ? y.concat(S) : [S]);
3423
- }), f.pop();
3424
- }
3425
- }
3426
- if (!p.isObject(e))
3427
- throw new TypeError("data must be an object");
3428
- return b(e), t;
3429
- }
3430
- function Qt(e) {
3431
- const t = {
3432
- "!": "%21",
3433
- "'": "%27",
3434
- "(": "%28",
3435
- ")": "%29",
3436
- "~": "%7E",
3437
- "%20": "+",
3438
- "%00": "\0"
3439
- };
3440
- return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(n) {
3441
- return t[n];
3442
- });
3443
- }
3444
- function Rt(e, t) {
3445
- this._pairs = [], e && Qe(e, this, t);
3446
- }
3447
- const Dn = Rt.prototype;
3448
- Dn.append = function(t, r) {
3449
- this._pairs.push([t, r]);
3450
- };
3451
- Dn.toString = function(t) {
3452
- const r = t ? function(n) {
3453
- return t.call(this, n, Qt);
3454
- } : Qt;
3455
- return this._pairs.map(function(s) {
3456
- return r(s[0]) + "=" + r(s[1]);
3457
- }, "").join("&");
3458
- };
3459
- function sa(e) {
3460
- return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
3461
- }
3462
- function Ln(e, t, r) {
3463
- if (!t)
3464
- return e;
3465
- const n = r && r.encode || sa;
3466
- p.isFunction(r) && (r = {
3467
- serialize: r
3468
- });
3469
- const s = r && r.serialize;
3470
- let o;
3471
- if (s ? o = s(t, r) : o = p.isURLSearchParams(t) ? t.toString() : new Rt(t, r).toString(n), o) {
3472
- const a = e.indexOf("#");
3473
- a !== -1 && (e = e.slice(0, a)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
3474
- }
3475
- return e;
3476
- }
3477
- class oa {
3478
- constructor() {
3479
- this.handlers = [];
3480
- }
3481
- /**
3482
- * Add a new interceptor to the stack
3483
- *
3484
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
3485
- * @param {Function} rejected The function to handle `reject` for a `Promise`
3486
- *
3487
- * @return {Number} An ID used to remove interceptor later
3488
- */
3489
- use(t, r, n) {
3490
- return this.handlers.push({
3491
- fulfilled: t,
3492
- rejected: r,
3493
- synchronous: n ? n.synchronous : !1,
3494
- runWhen: n ? n.runWhen : null
3495
- }), this.handlers.length - 1;
3496
- }
3497
- /**
3498
- * Remove an interceptor from the stack
3499
- *
3500
- * @param {Number} id The ID that was returned by `use`
3501
- *
3502
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
3503
- */
3504
- eject(t) {
3505
- this.handlers[t] && (this.handlers[t] = null);
3506
- }
3507
- /**
3508
- * Clear all interceptors from the stack
3509
- *
3510
- * @returns {void}
3511
- */
3512
- clear() {
3513
- this.handlers && (this.handlers = []);
3514
- }
3515
- /**
3516
- * Iterate over all the registered interceptors
3517
- *
3518
- * This method is particularly useful for skipping over any
3519
- * interceptors that may have become `null` calling `eject`.
3520
- *
3521
- * @param {Function} fn The function to call for each interceptor
3522
- *
3523
- * @returns {void}
3524
- */
3525
- forEach(t) {
3526
- p.forEach(this.handlers, function(n) {
3527
- n !== null && t(n);
3528
- });
3529
- }
3530
- }
3531
- const Yt = oa, _n = {
3532
- silentJSONParsing: !0,
3533
- forcedJSONParsing: !0,
3534
- clarifyTimeoutError: !1
3535
- }, aa = typeof URLSearchParams != "undefined" ? URLSearchParams : Rt, ia = typeof FormData != "undefined" ? FormData : null, ca = typeof Blob != "undefined" ? Blob : null, la = {
3536
- isBrowser: !0,
3537
- classes: {
3538
- URLSearchParams: aa,
3539
- FormData: ia,
3540
- Blob: ca
3541
- },
3542
- protocols: ["http", "https", "file", "blob", "url", "data"]
3543
- }, kt = typeof window != "undefined" && typeof document != "undefined", St = typeof navigator == "object" && navigator || void 0, ua = kt && (!St || ["ReactNative", "NativeScript", "NS"].indexOf(St.product) < 0), fa = (() => typeof WorkerGlobalScope != "undefined" && // eslint-disable-next-line no-undef
3544
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), da = kt && window.location.href || "http://localhost", pa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3545
- __proto__: null,
3546
- hasBrowserEnv: kt,
3547
- hasStandardBrowserEnv: ua,
3548
- hasStandardBrowserWebWorkerEnv: fa,
3549
- navigator: St,
3550
- origin: da
3551
- }, Symbol.toStringTag, { value: "Module" })), H = J(J({}, pa), la);
3552
- function ha(e, t) {
3553
- return Qe(e, new H.classes.URLSearchParams(), Object.assign({
3554
- visitor: function(r, n, s, o) {
3555
- return H.isNode && p.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
3556
- }
3557
- }, t));
3558
- }
3559
- function ma(e) {
3560
- return p.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
3561
- }
3562
- function ga(e) {
3563
- const t = {}, r = Object.keys(e);
3564
- let n;
3565
- const s = r.length;
3566
- let o;
3567
- for (n = 0; n < s; n++)
3568
- o = r[n], t[o] = e[o];
3569
- return t;
3570
- }
3571
- function Mn(e) {
3572
- function t(r, n, s, o) {
3573
- let a = r[o++];
3574
- if (a === "__proto__")
3575
- return !0;
3576
- const i = Number.isFinite(+a), l = o >= r.length;
3577
- return a = !a && p.isArray(s) ? s.length : a, l ? (p.hasOwnProp(s, a) ? s[a] = [s[a], n] : s[a] = n, !i) : ((!s[a] || !p.isObject(s[a])) && (s[a] = []), t(r, n, s[a], o) && p.isArray(s[a]) && (s[a] = ga(s[a])), !i);
3578
- }
3579
- if (p.isFormData(e) && p.isFunction(e.entries)) {
3580
- const r = {};
3581
- return p.forEachEntry(e, (n, s) => {
3582
- t(ma(n), s, r, 0);
3583
- }), r;
3584
- }
3585
- return null;
3586
- }
3587
- function ba(e, t, r) {
3588
- if (p.isString(e))
3589
- try {
3590
- return (t || JSON.parse)(e), p.trim(e);
3591
- } catch (n) {
3592
- if (n.name !== "SyntaxError")
3593
- throw n;
3594
- }
3595
- return (r || JSON.stringify)(e);
3596
- }
3597
- const At = {
3598
- transitional: _n,
3599
- adapter: ["xhr", "http", "fetch"],
3600
- transformRequest: [function(t, r) {
3601
- const n = r.getContentType() || "", s = n.indexOf("application/json") > -1, o = p.isObject(t);
3602
- if (o && p.isHTMLForm(t) && (t = new FormData(t)), p.isFormData(t))
3603
- return s ? JSON.stringify(Mn(t)) : t;
3604
- if (p.isArrayBuffer(t) || p.isBuffer(t) || p.isStream(t) || p.isFile(t) || p.isBlob(t) || p.isReadableStream(t))
3605
- return t;
3606
- if (p.isArrayBufferView(t))
3607
- return t.buffer;
3608
- if (p.isURLSearchParams(t))
3609
- return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
3610
- let i;
3611
- if (o) {
3612
- if (n.indexOf("application/x-www-form-urlencoded") > -1)
3613
- return ha(t, this.formSerializer).toString();
3614
- if ((i = p.isFileList(t)) || n.indexOf("multipart/form-data") > -1) {
3615
- const l = this.env && this.env.FormData;
3616
- return Qe(
3617
- i ? { "files[]": t } : t,
3618
- l && new l(),
3619
- this.formSerializer
3620
- );
3621
- }
3622
- }
3623
- return o || s ? (r.setContentType("application/json", !1), ba(t)) : t;
3624
- }],
3625
- transformResponse: [function(t) {
3626
- const r = this.transitional || At.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
3627
- if (p.isResponse(t) || p.isReadableStream(t))
3628
- return t;
3629
- if (t && p.isString(t) && (n && !this.responseType || s)) {
3630
- const a = !(r && r.silentJSONParsing) && s;
3631
- try {
3632
- return JSON.parse(t);
3633
- } catch (i) {
3634
- if (a)
3635
- throw i.name === "SyntaxError" ? C.from(i, C.ERR_BAD_RESPONSE, this, null, this.response) : i;
3636
- }
3637
- }
3638
- return t;
3639
- }],
3640
- /**
3641
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
3642
- * timeout is not created.
3643
- */
3644
- timeout: 0,
3645
- xsrfCookieName: "XSRF-TOKEN",
3646
- xsrfHeaderName: "X-XSRF-TOKEN",
3647
- maxContentLength: -1,
3648
- maxBodyLength: -1,
3649
- env: {
3650
- FormData: H.classes.FormData,
3651
- Blob: H.classes.Blob
3652
- },
3653
- validateStatus: function(t) {
3654
- return t >= 200 && t < 300;
3655
- },
3656
- headers: {
3657
- common: {
3658
- Accept: "application/json, text/plain, */*",
3659
- "Content-Type": void 0
3660
- }
3661
- }
3662
- };
3663
- p.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
3664
- At.headers[e] = {};
3665
- });
3666
- const vt = At, xa = p.toObjectSet([
3667
- "age",
3668
- "authorization",
3669
- "content-length",
3670
- "content-type",
3671
- "etag",
3672
- "expires",
3673
- "from",
3674
- "host",
3675
- "if-modified-since",
3676
- "if-unmodified-since",
3677
- "last-modified",
3678
- "location",
3679
- "max-forwards",
3680
- "proxy-authorization",
3681
- "referer",
3682
- "retry-after",
3683
- "user-agent"
3684
- ]), ya = (e) => {
3685
- const t = {};
3686
- let r, n, s;
3687
- return e && e.split(`
3688
- `).forEach(function(a) {
3689
- s = a.indexOf(":"), r = a.substring(0, s).trim().toLowerCase(), n = a.substring(s + 1).trim(), !(!r || t[r] && xa[r]) && (r === "set-cookie" ? t[r] ? t[r].push(n) : t[r] = [n] : t[r] = t[r] ? t[r] + ", " + n : n);
3690
- }), t;
3691
- }, Zt = Symbol("internals");
3692
- function Te(e) {
3693
- return e && String(e).trim().toLowerCase();
3694
- }
3695
- function Ne(e) {
3696
- return e === !1 || e == null ? e : p.isArray(e) ? e.map(Ne) : String(e);
3697
- }
3698
- function wa(e) {
3699
- const t = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
3700
- let n;
3701
- for (; n = r.exec(e); )
3702
- t[n[1]] = n[2];
3703
- return t;
3704
- }
3705
- const Ta = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
3706
- function dt(e, t, r, n, s) {
3707
- if (p.isFunction(n))
3708
- return n.call(this, t, r);
3709
- if (s && (t = r), !!p.isString(t)) {
3710
- if (p.isString(n))
3711
- return t.indexOf(n) !== -1;
3712
- if (p.isRegExp(n))
3713
- return n.test(t);
3714
- }
3715
- }
3716
- function Pa(e) {
3717
- return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, r, n) => r.toUpperCase() + n);
3718
- }
3719
- function Sa(e, t) {
3720
- const r = p.toCamelCase(" " + t);
3721
- ["get", "set", "has"].forEach((n) => {
3722
- Object.defineProperty(e, n + r, {
3723
- value: function(s, o, a) {
3724
- return this[n].call(this, t, s, o, a);
3725
- },
3726
- configurable: !0
3727
- });
3728
- });
3729
- }
3730
- class Ye {
3731
- constructor(t) {
3732
- t && this.set(t);
3733
- }
3734
- set(t, r, n) {
3735
- const s = this;
3736
- function o(i, l, c) {
3737
- const u = Te(l);
3738
- if (!u)
3739
- throw new Error("header name must be a non-empty string");
3740
- const f = p.findKey(s, u);
3741
- (!f || s[f] === void 0 || c === !0 || c === void 0 && s[f] !== !1) && (s[f || l] = Ne(i));
3742
- }
3743
- const a = (i, l) => p.forEach(i, (c, u) => o(c, u, l));
3744
- if (p.isPlainObject(t) || t instanceof this.constructor)
3745
- a(t, r);
3746
- else if (p.isString(t) && (t = t.trim()) && !Ta(t))
3747
- a(ya(t), r);
3748
- else if (p.isHeaders(t))
3749
- for (const [i, l] of t.entries())
3750
- o(l, i, n);
3751
- else
3752
- t != null && o(r, t, n);
3753
- return this;
3754
- }
3755
- get(t, r) {
3756
- if (t = Te(t), t) {
3757
- const n = p.findKey(this, t);
3758
- if (n) {
3759
- const s = this[n];
3760
- if (!r)
3761
- return s;
3762
- if (r === !0)
3763
- return wa(s);
3764
- if (p.isFunction(r))
3765
- return r.call(this, s, n);
3766
- if (p.isRegExp(r))
3767
- return r.exec(s);
3768
- throw new TypeError("parser must be boolean|regexp|function");
3769
- }
3770
- }
3771
- }
3772
- has(t, r) {
3773
- if (t = Te(t), t) {
3774
- const n = p.findKey(this, t);
3775
- return !!(n && this[n] !== void 0 && (!r || dt(this, this[n], n, r)));
3776
- }
3777
- return !1;
3778
- }
3779
- delete(t, r) {
3780
- const n = this;
3781
- let s = !1;
3782
- function o(a) {
3783
- if (a = Te(a), a) {
3784
- const i = p.findKey(n, a);
3785
- i && (!r || dt(n, n[i], i, r)) && (delete n[i], s = !0);
3786
- }
3787
- }
3788
- return p.isArray(t) ? t.forEach(o) : o(t), s;
3789
- }
3790
- clear(t) {
3791
- const r = Object.keys(this);
3792
- let n = r.length, s = !1;
3793
- for (; n--; ) {
3794
- const o = r[n];
3795
- (!t || dt(this, this[o], o, t, !0)) && (delete this[o], s = !0);
3796
- }
3797
- return s;
3798
- }
3799
- normalize(t) {
3800
- const r = this, n = {};
3801
- return p.forEach(this, (s, o) => {
3802
- const a = p.findKey(n, o);
3803
- if (a) {
3804
- r[a] = Ne(s), delete r[o];
3805
- return;
3806
- }
3807
- const i = t ? Pa(o) : String(o).trim();
3808
- i !== o && delete r[o], r[i] = Ne(s), n[i] = !0;
3809
- }), this;
3810
- }
3811
- concat(...t) {
3812
- return this.constructor.concat(this, ...t);
3813
- }
3814
- toJSON(t) {
3815
- const r = /* @__PURE__ */ Object.create(null);
3816
- return p.forEach(this, (n, s) => {
3817
- n != null && n !== !1 && (r[s] = t && p.isArray(n) ? n.join(", ") : n);
3818
- }), r;
3819
- }
3820
- [Symbol.iterator]() {
3821
- return Object.entries(this.toJSON())[Symbol.iterator]();
3822
- }
3823
- toString() {
3824
- return Object.entries(this.toJSON()).map(([t, r]) => t + ": " + r).join(`
3825
- `);
3826
- }
3827
- get [Symbol.toStringTag]() {
3828
- return "AxiosHeaders";
3829
- }
3830
- static from(t) {
3831
- return t instanceof this ? t : new this(t);
3832
- }
3833
- static concat(t, ...r) {
3834
- const n = new this(t);
3835
- return r.forEach((s) => n.set(s)), n;
3836
- }
3837
- static accessor(t) {
3838
- const n = (this[Zt] = this[Zt] = {
3839
- accessors: {}
3840
- }).accessors, s = this.prototype;
3841
- function o(a) {
3842
- const i = Te(a);
3843
- n[i] || (Sa(s, a), n[i] = !0);
3844
- }
3845
- return p.isArray(t) ? t.forEach(o) : o(t), this;
3846
- }
3847
- }
3848
- Ye.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
3849
- p.reduceDescriptors(Ye.prototype, ({ value: e }, t) => {
3850
- let r = t[0].toUpperCase() + t.slice(1);
3851
- return {
3852
- get: () => e,
3853
- set(n) {
3854
- this[r] = n;
3855
- }
3856
- };
3857
- });
3858
- p.freezeMethods(Ye);
3859
- const X = Ye;
3860
- function pt(e, t) {
3861
- const r = this || vt, n = t || r, s = X.from(n.headers);
3862
- let o = n.data;
3863
- return p.forEach(e, function(i) {
3864
- o = i.call(r, o, s.normalize(), t ? t.status : void 0);
3865
- }), s.normalize(), o;
3866
- }
3867
- function Nn(e) {
3868
- return !!(e && e.__CANCEL__);
3869
- }
3870
- function be(e, t, r) {
3871
- C.call(this, e == null ? "canceled" : e, C.ERR_CANCELED, t, r), this.name = "CanceledError";
3872
- }
3873
- p.inherits(be, C, {
3874
- __CANCEL__: !0
3875
- });
3876
- function Un(e, t, r) {
3877
- const n = r.config.validateStatus;
3878
- !r.status || !n || n(r.status) ? e(r) : t(new C(
3879
- "Request failed with status code " + r.status,
3880
- [C.ERR_BAD_REQUEST, C.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
3881
- r.config,
3882
- r.request,
3883
- r
3884
- ));
3885
- }
3886
- function Ca(e) {
3887
- const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
3888
- return t && t[1] || "";
3889
- }
3890
- function Ea(e, t) {
3891
- e = e || 10;
3892
- const r = new Array(e), n = new Array(e);
3893
- let s = 0, o = 0, a;
3894
- return t = t !== void 0 ? t : 1e3, function(l) {
3895
- const c = Date.now(), u = n[o];
3896
- a || (a = c), r[s] = l, n[s] = c;
3897
- let f = o, h = 0;
3898
- for (; f !== s; )
3899
- h += r[f++], f = f % e;
3900
- if (s = (s + 1) % e, s === o && (o = (o + 1) % e), c - a < t)
3901
- return;
3902
- const b = u && c - u;
3903
- return b ? Math.round(h * 1e3 / b) : void 0;
3904
- };
3905
- }
3906
- function Ba(e, t) {
3907
- let r = 0, n = 1e3 / t, s, o;
3908
- const a = (c, u = Date.now()) => {
3909
- r = u, s = null, o && (clearTimeout(o), o = null), e.apply(null, c);
3910
- };
3911
- return [(...c) => {
3912
- const u = Date.now(), f = u - r;
3913
- f >= n ? a(c, u) : (s = c, o || (o = setTimeout(() => {
3914
- o = null, a(s);
3915
- }, n - f)));
3916
- }, () => s && a(s)];
3917
- }
3918
- const ze = (e, t, r = 3) => {
3919
- let n = 0;
3920
- const s = Ea(50, 250);
3921
- return Ba((o) => {
3922
- const a = o.loaded, i = o.lengthComputable ? o.total : void 0, l = a - n, c = s(l), u = a <= i;
3923
- n = a;
3924
- const f = {
3925
- loaded: a,
3926
- total: i,
3927
- progress: i ? a / i : void 0,
3928
- bytes: l,
3929
- rate: c || void 0,
3930
- estimated: c && i && u ? (i - a) / c : void 0,
3931
- event: o,
3932
- lengthComputable: i != null,
3933
- [t ? "download" : "upload"]: !0
3934
- };
3935
- e(f);
3936
- }, r);
3937
- }, en = (e, t) => {
3938
- const r = e != null;
3939
- return [(n) => t[0]({
3940
- lengthComputable: r,
3941
- total: e,
3942
- loaded: n
3943
- }), t[1]];
3944
- }, tn = (e) => (...t) => p.asap(() => e(...t)), Fa = H.hasStandardBrowserEnv ? ((e, t) => (r) => (r = new URL(r, H.origin), e.protocol === r.protocol && e.host === r.host && (t || e.port === r.port)))(
3945
- new URL(H.origin),
3946
- H.navigator && /(msie|trident)/i.test(H.navigator.userAgent)
3947
- ) : () => !0, Ra = H.hasStandardBrowserEnv ? (
3948
- // Standard browser envs support document.cookie
3949
- {
3950
- write(e, t, r, n, s, o) {
3951
- const a = [e + "=" + encodeURIComponent(t)];
3952
- p.isNumber(r) && a.push("expires=" + new Date(r).toGMTString()), p.isString(n) && a.push("path=" + n), p.isString(s) && a.push("domain=" + s), o === !0 && a.push("secure"), document.cookie = a.join("; ");
3953
- },
3954
- read(e) {
3955
- const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
3956
- return t ? decodeURIComponent(t[3]) : null;
3957
- },
3958
- remove(e) {
3959
- this.write(e, "", Date.now() - 864e5);
3960
- }
3961
- }
3962
- ) : (
3963
- // Non-standard browser env (web workers, react-native) lack needed support.
3964
- {
3965
- write() {
3966
- },
3967
- read() {
3968
- return null;
3969
- },
3970
- remove() {
3971
- }
3972
- }
3973
- );
3974
- function ka(e) {
3975
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
3976
- }
3977
- function Aa(e, t) {
3978
- return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
3979
- }
3980
- function $n(e, t) {
3981
- return e && !ka(t) ? Aa(e, t) : t;
3982
- }
3983
- const nn = (e) => e instanceof X ? J({}, e) : e;
3984
- function ue(e, t) {
3985
- t = t || {};
3986
- const r = {};
3987
- function n(c, u, f, h) {
3988
- return p.isPlainObject(c) && p.isPlainObject(u) ? p.merge.call({ caseless: h }, c, u) : p.isPlainObject(u) ? p.merge({}, u) : p.isArray(u) ? u.slice() : u;
3989
- }
3990
- function s(c, u, f, h) {
3991
- if (p.isUndefined(u)) {
3992
- if (!p.isUndefined(c))
3993
- return n(void 0, c, f, h);
3994
- } else
3995
- return n(c, u, f, h);
3996
- }
3997
- function o(c, u) {
3998
- if (!p.isUndefined(u))
3999
- return n(void 0, u);
4000
- }
4001
- function a(c, u) {
4002
- if (p.isUndefined(u)) {
4003
- if (!p.isUndefined(c))
4004
- return n(void 0, c);
4005
- } else
4006
- return n(void 0, u);
4007
- }
4008
- function i(c, u, f) {
4009
- if (f in t)
4010
- return n(c, u);
4011
- if (f in e)
4012
- return n(void 0, c);
4013
- }
4014
- const l = {
4015
- url: o,
4016
- method: o,
4017
- data: o,
4018
- baseURL: a,
4019
- transformRequest: a,
4020
- transformResponse: a,
4021
- paramsSerializer: a,
4022
- timeout: a,
4023
- timeoutMessage: a,
4024
- withCredentials: a,
4025
- withXSRFToken: a,
4026
- adapter: a,
4027
- responseType: a,
4028
- xsrfCookieName: a,
4029
- xsrfHeaderName: a,
4030
- onUploadProgress: a,
4031
- onDownloadProgress: a,
4032
- decompress: a,
4033
- maxContentLength: a,
4034
- maxBodyLength: a,
4035
- beforeRedirect: a,
4036
- transport: a,
4037
- httpAgent: a,
4038
- httpsAgent: a,
4039
- cancelToken: a,
4040
- socketPath: a,
4041
- responseEncoding: a,
4042
- validateStatus: i,
4043
- headers: (c, u, f) => s(nn(c), nn(u), f, !0)
4044
- };
4045
- return p.forEach(Object.keys(Object.assign({}, e, t)), function(u) {
4046
- const f = l[u] || s, h = f(e[u], t[u], u);
4047
- p.isUndefined(h) && f !== i || (r[u] = h);
4048
- }), r;
4049
- }
4050
- const Hn = (e) => {
4051
- const t = ue({}, e);
4052
- let { data: r, withXSRFToken: n, xsrfHeaderName: s, xsrfCookieName: o, headers: a, auth: i } = t;
4053
- t.headers = a = X.from(a), t.url = Ln($n(t.baseURL, t.url), e.params, e.paramsSerializer), i && a.set(
4054
- "Authorization",
4055
- "Basic " + btoa((i.username || "") + ":" + (i.password ? unescape(encodeURIComponent(i.password)) : ""))
4056
- );
4057
- let l;
4058
- if (p.isFormData(r)) {
4059
- if (H.hasStandardBrowserEnv || H.hasStandardBrowserWebWorkerEnv)
4060
- a.setContentType(void 0);
4061
- else if ((l = a.getContentType()) !== !1) {
4062
- const [c, ...u] = l ? l.split(";").map((f) => f.trim()).filter(Boolean) : [];
4063
- a.setContentType([c || "multipart/form-data", ...u].join("; "));
4064
- }
4065
- }
4066
- if (H.hasStandardBrowserEnv && (n && p.isFunction(n) && (n = n(t)), n || n !== !1 && Fa(t.url))) {
4067
- const c = s && o && Ra.read(o);
4068
- c && a.set(s, c);
4069
- }
4070
- return t;
4071
- }, va = typeof XMLHttpRequest != "undefined", Oa = va && function(e) {
4072
- return new Promise(function(r, n) {
4073
- const s = Hn(e);
4074
- let o = s.data;
4075
- const a = X.from(s.headers).normalize();
4076
- let { responseType: i, onUploadProgress: l, onDownloadProgress: c } = s, u, f, h, b, m;
4077
- function y() {
4078
- b && b(), m && m(), s.cancelToken && s.cancelToken.unsubscribe(u), s.signal && s.signal.removeEventListener("abort", u);
4079
- }
4080
- let x = new XMLHttpRequest();
4081
- x.open(s.method.toUpperCase(), s.url, !0), x.timeout = s.timeout;
4082
- function T() {
4083
- if (!x)
4084
- return;
4085
- const E = X.from(
4086
- "getAllResponseHeaders" in x && x.getAllResponseHeaders()
4087
- ), A = {
4088
- data: !i || i === "text" || i === "json" ? x.responseText : x.response,
4089
- status: x.status,
4090
- statusText: x.statusText,
4091
- headers: E,
4092
- config: e,
4093
- request: x
4094
- };
4095
- Un(function(I) {
4096
- r(I), y();
4097
- }, function(I) {
4098
- n(I), y();
4099
- }, A), x = null;
4100
- }
4101
- "onloadend" in x ? x.onloadend = T : x.onreadystatechange = function() {
4102
- !x || x.readyState !== 4 || x.status === 0 && !(x.responseURL && x.responseURL.indexOf("file:") === 0) || setTimeout(T);
4103
- }, x.onabort = function() {
4104
- x && (n(new C("Request aborted", C.ECONNABORTED, e, x)), x = null);
4105
- }, x.onerror = function() {
4106
- n(new C("Network Error", C.ERR_NETWORK, e, x)), x = null;
4107
- }, x.ontimeout = function() {
4108
- let O = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
4109
- const A = s.transitional || _n;
4110
- s.timeoutErrorMessage && (O = s.timeoutErrorMessage), n(new C(
4111
- O,
4112
- A.clarifyTimeoutError ? C.ETIMEDOUT : C.ECONNABORTED,
4113
- e,
4114
- x
4115
- )), x = null;
4116
- }, o === void 0 && a.setContentType(null), "setRequestHeader" in x && p.forEach(a.toJSON(), function(O, A) {
4117
- x.setRequestHeader(A, O);
4118
- }), p.isUndefined(s.withCredentials) || (x.withCredentials = !!s.withCredentials), i && i !== "json" && (x.responseType = s.responseType), c && ([h, m] = ze(c, !0), x.addEventListener("progress", h)), l && x.upload && ([f, b] = ze(l), x.upload.addEventListener("progress", f), x.upload.addEventListener("loadend", b)), (s.cancelToken || s.signal) && (u = (E) => {
4119
- x && (n(!E || E.type ? new be(null, e, x) : E), x.abort(), x = null);
4120
- }, s.cancelToken && s.cancelToken.subscribe(u), s.signal && (s.signal.aborted ? u() : s.signal.addEventListener("abort", u)));
4121
- const S = Ca(s.url);
4122
- if (S && H.protocols.indexOf(S) === -1) {
4123
- n(new C("Unsupported protocol " + S + ":", C.ERR_BAD_REQUEST, e));
4124
- return;
4125
- }
4126
- x.send(o || null);
4127
- });
4128
- }, Ia = (e, t) => {
4129
- const { length: r } = e = e ? e.filter(Boolean) : [];
4130
- if (t || r) {
4131
- let n = new AbortController(), s;
4132
- const o = function(c) {
4133
- if (!s) {
4134
- s = !0, i();
4135
- const u = c instanceof Error ? c : this.reason;
4136
- n.abort(u instanceof C ? u : new be(u instanceof Error ? u.message : u));
4137
- }
4138
- };
4139
- let a = t && setTimeout(() => {
4140
- a = null, o(new C(`timeout ${t} of ms exceeded`, C.ETIMEDOUT));
4141
- }, t);
4142
- const i = () => {
4143
- e && (a && clearTimeout(a), a = null, e.forEach((c) => {
4144
- c.unsubscribe ? c.unsubscribe(o) : c.removeEventListener("abort", o);
4145
- }), e = null);
4146
- };
4147
- e.forEach((c) => c.addEventListener("abort", o));
4148
- const { signal: l } = n;
4149
- return l.unsubscribe = () => p.asap(i), l;
4150
- }
4151
- }, Da = Ia, La = function* (e, t) {
4152
- let r = e.byteLength;
4153
- if (!t || r < t) {
4154
- yield e;
4155
- return;
4156
- }
4157
- let n = 0, s;
4158
- for (; n < r; )
4159
- s = n + t, yield e.slice(n, s), n = s;
4160
- }, _a = function(e, t) {
4161
- return rt(this, null, function* () {
4162
- try {
4163
- for (var r = Lt(Ma(e)), n, s, o; n = !(s = yield new ae(r.next())).done; n = !1) {
4164
- const a = s.value;
4165
- yield* st(La(a, t));
4166
- }
4167
- } catch (s) {
4168
- o = [s];
4169
- } finally {
4170
- try {
4171
- n && (s = r.return) && (yield new ae(s.call(r)));
4172
- } finally {
4173
- if (o)
4174
- throw o[0];
4175
- }
4176
- }
4177
- });
4178
- }, Ma = function(e) {
4179
- return rt(this, null, function* () {
4180
- if (e[Symbol.asyncIterator]) {
4181
- yield* st(e);
4182
- return;
4183
- }
4184
- const t = e.getReader();
4185
- try {
4186
- for (; ; ) {
4187
- const { done: r, value: n } = yield new ae(t.read());
4188
- if (r)
4189
- break;
4190
- yield n;
4191
- }
4192
- } finally {
4193
- yield new ae(t.cancel());
4194
- }
4195
- });
4196
- }, rn = (e, t, r, n) => {
4197
- const s = _a(e, t);
4198
- let o = 0, a, i = (c) => {
4199
- a || (a = !0, n && n(c));
4200
- };
4201
- return new ReadableStream({
4202
- pull(c) {
4203
- return B(this, null, function* () {
4204
- try {
4205
- const { done: u, value: f } = yield s.next();
4206
- if (u) {
4207
- i(), c.close();
4208
- return;
4209
- }
4210
- let h = f.byteLength;
4211
- if (r) {
4212
- let b = o += h;
4213
- r(b);
4214
- }
4215
- c.enqueue(new Uint8Array(f));
4216
- } catch (u) {
4217
- throw i(u), u;
4218
- }
4219
- });
4220
- },
4221
- cancel(c) {
4222
- return i(c), s.return();
4223
- }
4224
- }, {
4225
- highWaterMark: 2
4226
- });
4227
- }, Ze = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", jn = Ze && typeof ReadableStream == "function", Na = Ze && (typeof TextEncoder == "function" ? ((e) => (t) => e.encode(t))(new TextEncoder()) : (e) => B(void 0, null, function* () {
4228
- return new Uint8Array(yield new Response(e).arrayBuffer());
4229
- })), Wn = (e, ...t) => {
4230
- try {
4231
- return !!e(...t);
4232
- } catch (r) {
4233
- return !1;
4234
- }
4235
- }, Ua = jn && Wn(() => {
4236
- let e = !1;
4237
- const t = new Request(H.origin, {
4238
- body: new ReadableStream(),
4239
- method: "POST",
4240
- get duplex() {
4241
- return e = !0, "half";
4242
- }
4243
- }).headers.has("Content-Type");
4244
- return e && !t;
4245
- }), sn = 64 * 1024, Ct = jn && Wn(() => p.isReadableStream(new Response("").body)), qe = {
4246
- stream: Ct && ((e) => e.body)
4247
- };
4248
- Ze && ((e) => {
4249
- ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((t) => {
4250
- !qe[t] && (qe[t] = p.isFunction(e[t]) ? (r) => r[t]() : (r, n) => {
4251
- throw new C(`Response type '${t}' is not supported`, C.ERR_NOT_SUPPORT, n);
4252
- });
4253
- });
4254
- })(new Response());
4255
- const $a = (e) => B(void 0, null, function* () {
4256
- if (e == null)
4257
- return 0;
4258
- if (p.isBlob(e))
4259
- return e.size;
4260
- if (p.isSpecCompliantForm(e))
4261
- return (yield new Request(H.origin, {
4262
- method: "POST",
4263
- body: e
4264
- }).arrayBuffer()).byteLength;
4265
- if (p.isArrayBufferView(e) || p.isArrayBuffer(e))
4266
- return e.byteLength;
4267
- if (p.isURLSearchParams(e) && (e = e + ""), p.isString(e))
4268
- return (yield Na(e)).byteLength;
4269
- }), Ha = (e, t) => B(void 0, null, function* () {
4270
- const r = p.toFiniteNumber(e.getContentLength());
4271
- return r == null ? $a(t) : r;
4272
- }), ja = Ze && ((e) => B(void 0, null, function* () {
4273
- let {
4274
- url: t,
4275
- method: r,
4276
- data: n,
4277
- signal: s,
4278
- cancelToken: o,
4279
- timeout: a,
4280
- onDownloadProgress: i,
4281
- onUploadProgress: l,
4282
- responseType: c,
4283
- headers: u,
4284
- withCredentials: f = "same-origin",
4285
- fetchOptions: h
4286
- } = Hn(e);
4287
- c = c ? (c + "").toLowerCase() : "text";
4288
- let b = Da([s, o && o.toAbortSignal()], a), m;
4289
- const y = b && b.unsubscribe && (() => {
4290
- b.unsubscribe();
4291
- });
4292
- let x;
4293
- try {
4294
- if (l && Ua && r !== "get" && r !== "head" && (x = yield Ha(u, n)) !== 0) {
4295
- let A = new Request(t, {
4296
- method: "POST",
4297
- body: n,
4298
- duplex: "half"
4299
- }), D;
4300
- if (p.isFormData(n) && (D = A.headers.get("content-type")) && u.setContentType(D), A.body) {
4301
- const [I, U] = en(
4302
- x,
4303
- ze(tn(l))
4304
- );
4305
- n = rn(A.body, sn, I, U);
4306
- }
4307
- }
4308
- p.isString(f) || (f = f ? "include" : "omit");
4309
- const T = "credentials" in Request.prototype;
4310
- m = new Request(t, oe(J({}, h), {
4311
- signal: b,
4312
- method: r.toUpperCase(),
4313
- headers: u.normalize().toJSON(),
4314
- body: n,
4315
- duplex: "half",
4316
- credentials: T ? f : void 0
4317
- }));
4318
- let S = yield fetch(m);
4319
- const E = Ct && (c === "stream" || c === "response");
4320
- if (Ct && (i || E && y)) {
4321
- const A = {};
4322
- ["status", "statusText", "headers"].forEach((v) => {
4323
- A[v] = S[v];
4324
- });
4325
- const D = p.toFiniteNumber(S.headers.get("content-length")), [I, U] = i && en(
4326
- D,
4327
- ze(tn(i), !0)
4328
- ) || [];
4329
- S = new Response(
4330
- rn(S.body, sn, I, () => {
4331
- U && U(), y && y();
4332
- }),
4333
- A
4334
- );
4335
- }
4336
- c = c || "text";
4337
- let O = yield qe[p.findKey(qe, c) || "text"](S, e);
4338
- return !E && y && y(), yield new Promise((A, D) => {
4339
- Un(A, D, {
4340
- data: O,
4341
- headers: X.from(S.headers),
4342
- status: S.status,
4343
- statusText: S.statusText,
4344
- config: e,
4345
- request: m
4346
- });
4347
- });
4348
- } catch (T) {
4349
- throw y && y(), T && T.name === "TypeError" && /fetch/i.test(T.message) ? Object.assign(
4350
- new C("Network Error", C.ERR_NETWORK, e, m),
4351
- {
4352
- cause: T.cause || T
4353
- }
4354
- ) : C.from(T, T && T.code, e, m);
4355
- }
4356
- })), Et = {
4357
- http: ta,
4358
- xhr: Oa,
4359
- fetch: ja
4360
- };
4361
- p.forEach(Et, (e, t) => {
4362
- if (e) {
4363
- try {
4364
- Object.defineProperty(e, "name", { value: t });
4365
- } catch (r) {
4366
- }
4367
- Object.defineProperty(e, "adapterName", { value: t });
4368
- }
4369
- });
4370
- const on = (e) => `- ${e}`, Wa = (e) => p.isFunction(e) || e === null || e === !1, zn = {
4371
- getAdapter: (e) => {
4372
- e = p.isArray(e) ? e : [e];
4373
- const { length: t } = e;
4374
- let r, n;
4375
- const s = {};
4376
- for (let o = 0; o < t; o++) {
4377
- r = e[o];
4378
- let a;
4379
- if (n = r, !Wa(r) && (n = Et[(a = String(r)).toLowerCase()], n === void 0))
4380
- throw new C(`Unknown adapter '${a}'`);
4381
- if (n)
4382
- break;
4383
- s[a || "#" + o] = n;
4384
- }
4385
- if (!n) {
4386
- const o = Object.entries(s).map(
4387
- ([i, l]) => `adapter ${i} ` + (l === !1 ? "is not supported by the environment" : "is not available in the build")
4388
- );
4389
- let a = t ? o.length > 1 ? `since :
4390
- ` + o.map(on).join(`
4391
- `) : " " + on(o[0]) : "as no adapter specified";
4392
- throw new C(
4393
- "There is no suitable adapter to dispatch the request " + a,
4394
- "ERR_NOT_SUPPORT"
4395
- );
4396
- }
4397
- return n;
4398
- },
4399
- adapters: Et
4400
- };
4401
- function ht(e) {
4402
- if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
4403
- throw new be(null, e);
4404
- }
4405
- function an(e) {
4406
- return ht(e), e.headers = X.from(e.headers), e.data = pt.call(
4407
- e,
4408
- e.transformRequest
4409
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), zn.getAdapter(e.adapter || vt.adapter)(e).then(function(n) {
4410
- return ht(e), n.data = pt.call(
4411
- e,
4412
- e.transformResponse,
4413
- n
4414
- ), n.headers = X.from(n.headers), n;
4415
- }, function(n) {
4416
- return Nn(n) || (ht(e), n && n.response && (n.response.data = pt.call(
4417
- e,
4418
- e.transformResponse,
4419
- n.response
4420
- ), n.response.headers = X.from(n.response.headers))), Promise.reject(n);
4421
- });
4422
- }
4423
- const qn = "1.7.9", et = {};
4424
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
4425
- et[e] = function(n) {
4426
- return typeof n === e || "a" + (t < 1 ? "n " : " ") + e;
4427
- };
4428
- });
4429
- const cn = {};
4430
- et.transitional = function(t, r, n) {
4431
- function s(o, a) {
4432
- return "[Axios v" + qn + "] Transitional option '" + o + "'" + a + (n ? ". " + n : "");
4433
- }
4434
- return (o, a, i) => {
4435
- if (t === !1)
4436
- throw new C(
4437
- s(a, " has been removed" + (r ? " in " + r : "")),
4438
- C.ERR_DEPRECATED
4439
- );
4440
- return r && !cn[a] && (cn[a] = !0, console.warn(
4441
- s(
4442
- a,
4443
- " has been deprecated since v" + r + " and will be removed in the near future"
4444
- )
4445
- )), t ? t(o, a, i) : !0;
4446
- };
4447
- };
4448
- et.spelling = function(t) {
4449
- return (r, n) => (console.warn(`${n} is likely a misspelling of ${t}`), !0);
4450
- };
4451
- function za(e, t, r) {
4452
- if (typeof e != "object")
4453
- throw new C("options must be an object", C.ERR_BAD_OPTION_VALUE);
4454
- const n = Object.keys(e);
4455
- let s = n.length;
4456
- for (; s-- > 0; ) {
4457
- const o = n[s], a = t[o];
4458
- if (a) {
4459
- const i = e[o], l = i === void 0 || a(i, o, e);
4460
- if (l !== !0)
4461
- throw new C("option " + o + " must be " + l, C.ERR_BAD_OPTION_VALUE);
4462
- continue;
4463
- }
4464
- if (r !== !0)
4465
- throw new C("Unknown option " + o, C.ERR_BAD_OPTION);
4466
- }
4467
- }
4468
- const Ue = {
4469
- assertOptions: za,
4470
- validators: et
4471
- }, ee = Ue.validators;
4472
- class Ve {
4473
- constructor(t) {
4474
- this.defaults = t, this.interceptors = {
4475
- request: new Yt(),
4476
- response: new Yt()
4477
- };
4478
- }
4479
- /**
4480
- * Dispatch a request
4481
- *
4482
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
4483
- * @param {?Object} config
4484
- *
4485
- * @returns {Promise} The Promise to be fulfilled
4486
- */
4487
- request(t, r) {
4488
- return B(this, null, function* () {
4489
- try {
4490
- return yield this._request(t, r);
4491
- } catch (n) {
4492
- if (n instanceof Error) {
4493
- let s = {};
4494
- Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
4495
- const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
4496
- try {
4497
- n.stack ? o && !String(n.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (n.stack += `
4498
- ` + o) : n.stack = o;
4499
- } catch (a) {
4500
- }
4501
- }
4502
- throw n;
4503
- }
4504
- });
4505
- }
4506
- _request(t, r) {
4507
- typeof t == "string" ? (r = r || {}, r.url = t) : r = t || {}, r = ue(this.defaults, r);
4508
- const { transitional: n, paramsSerializer: s, headers: o } = r;
4509
- n !== void 0 && Ue.assertOptions(n, {
4510
- silentJSONParsing: ee.transitional(ee.boolean),
4511
- forcedJSONParsing: ee.transitional(ee.boolean),
4512
- clarifyTimeoutError: ee.transitional(ee.boolean)
4513
- }, !1), s != null && (p.isFunction(s) ? r.paramsSerializer = {
4514
- serialize: s
4515
- } : Ue.assertOptions(s, {
4516
- encode: ee.function,
4517
- serialize: ee.function
4518
- }, !0)), Ue.assertOptions(r, {
4519
- baseUrl: ee.spelling("baseURL"),
4520
- withXsrfToken: ee.spelling("withXSRFToken")
4521
- }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
4522
- let a = o && p.merge(
4523
- o.common,
4524
- o[r.method]
4525
- );
4526
- o && p.forEach(
4527
- ["delete", "get", "head", "post", "put", "patch", "common"],
4528
- (m) => {
4529
- delete o[m];
4530
- }
4531
- ), r.headers = X.concat(a, o);
4532
- const i = [];
4533
- let l = !0;
4534
- this.interceptors.request.forEach(function(y) {
4535
- typeof y.runWhen == "function" && y.runWhen(r) === !1 || (l = l && y.synchronous, i.unshift(y.fulfilled, y.rejected));
4536
- });
4537
- const c = [];
4538
- this.interceptors.response.forEach(function(y) {
4539
- c.push(y.fulfilled, y.rejected);
4540
- });
4541
- let u, f = 0, h;
4542
- if (!l) {
4543
- const m = [an.bind(this), void 0];
4544
- for (m.unshift.apply(m, i), m.push.apply(m, c), h = m.length, u = Promise.resolve(r); f < h; )
4545
- u = u.then(m[f++], m[f++]);
4546
- return u;
4547
- }
4548
- h = i.length;
4549
- let b = r;
4550
- for (f = 0; f < h; ) {
4551
- const m = i[f++], y = i[f++];
4552
- try {
4553
- b = m(b);
4554
- } catch (x) {
4555
- y.call(this, x);
4556
- break;
4557
- }
4558
- }
4559
- try {
4560
- u = an.call(this, b);
4561
- } catch (m) {
4562
- return Promise.reject(m);
4563
- }
4564
- for (f = 0, h = c.length; f < h; )
4565
- u = u.then(c[f++], c[f++]);
4566
- return u;
4567
- }
4568
- getUri(t) {
4569
- t = ue(this.defaults, t);
4570
- const r = $n(t.baseURL, t.url);
4571
- return Ln(r, t.params, t.paramsSerializer);
4572
- }
4573
- }
4574
- p.forEach(["delete", "get", "head", "options"], function(t) {
4575
- Ve.prototype[t] = function(r, n) {
4576
- return this.request(ue(n || {}, {
4577
- method: t,
4578
- url: r,
4579
- data: (n || {}).data
4580
- }));
4581
- };
4582
- });
4583
- p.forEach(["post", "put", "patch"], function(t) {
4584
- function r(n) {
4585
- return function(o, a, i) {
4586
- return this.request(ue(i || {}, {
4587
- method: t,
4588
- headers: n ? {
4589
- "Content-Type": "multipart/form-data"
4590
- } : {},
4591
- url: o,
4592
- data: a
4593
- }));
4594
- };
4595
- }
4596
- Ve.prototype[t] = r(), Ve.prototype[t + "Form"] = r(!0);
4597
- });
4598
- const $e = Ve;
4599
- class Ot {
4600
- constructor(t) {
4601
- if (typeof t != "function")
4602
- throw new TypeError("executor must be a function.");
4603
- let r;
4604
- this.promise = new Promise(function(o) {
4605
- r = o;
4606
- });
4607
- const n = this;
4608
- this.promise.then((s) => {
4609
- if (!n._listeners)
4610
- return;
4611
- let o = n._listeners.length;
4612
- for (; o-- > 0; )
4613
- n._listeners[o](s);
4614
- n._listeners = null;
4615
- }), this.promise.then = (s) => {
4616
- let o;
4617
- const a = new Promise((i) => {
4618
- n.subscribe(i), o = i;
4619
- }).then(s);
4620
- return a.cancel = function() {
4621
- n.unsubscribe(o);
4622
- }, a;
4623
- }, t(function(o, a, i) {
4624
- n.reason || (n.reason = new be(o, a, i), r(n.reason));
4625
- });
4626
- }
4627
- /**
4628
- * Throws a `CanceledError` if cancellation has been requested.
4629
- */
4630
- throwIfRequested() {
4631
- if (this.reason)
4632
- throw this.reason;
4633
- }
4634
- /**
4635
- * Subscribe to the cancel signal
4636
- */
4637
- subscribe(t) {
4638
- if (this.reason) {
4639
- t(this.reason);
4640
- return;
4641
- }
4642
- this._listeners ? this._listeners.push(t) : this._listeners = [t];
4643
- }
4644
- /**
4645
- * Unsubscribe from the cancel signal
4646
- */
4647
- unsubscribe(t) {
4648
- if (!this._listeners)
4649
- return;
4650
- const r = this._listeners.indexOf(t);
4651
- r !== -1 && this._listeners.splice(r, 1);
4652
- }
4653
- toAbortSignal() {
4654
- const t = new AbortController(), r = (n) => {
4655
- t.abort(n);
4656
- };
4657
- return this.subscribe(r), t.signal.unsubscribe = () => this.unsubscribe(r), t.signal;
4658
- }
4659
- /**
4660
- * Returns an object that contains a new `CancelToken` and a function that, when called,
4661
- * cancels the `CancelToken`.
4662
- */
4663
- static source() {
4664
- let t;
4665
- return {
4666
- token: new Ot(function(s) {
4667
- t = s;
4668
- }),
4669
- cancel: t
4670
- };
4671
- }
4672
- }
4673
- const qa = Ot;
4674
- function Va(e) {
4675
- return function(r) {
4676
- return e.apply(null, r);
4677
- };
4678
- }
4679
- function Ja(e) {
4680
- return p.isObject(e) && e.isAxiosError === !0;
4681
- }
4682
- const Bt = {
4683
- Continue: 100,
4684
- SwitchingProtocols: 101,
4685
- Processing: 102,
4686
- EarlyHints: 103,
4687
- Ok: 200,
4688
- Created: 201,
4689
- Accepted: 202,
4690
- NonAuthoritativeInformation: 203,
4691
- NoContent: 204,
4692
- ResetContent: 205,
4693
- PartialContent: 206,
4694
- MultiStatus: 207,
4695
- AlreadyReported: 208,
4696
- ImUsed: 226,
4697
- MultipleChoices: 300,
4698
- MovedPermanently: 301,
4699
- Found: 302,
4700
- SeeOther: 303,
4701
- NotModified: 304,
4702
- UseProxy: 305,
4703
- Unused: 306,
4704
- TemporaryRedirect: 307,
4705
- PermanentRedirect: 308,
4706
- BadRequest: 400,
4707
- Unauthorized: 401,
4708
- PaymentRequired: 402,
4709
- Forbidden: 403,
4710
- NotFound: 404,
4711
- MethodNotAllowed: 405,
4712
- NotAcceptable: 406,
4713
- ProxyAuthenticationRequired: 407,
4714
- RequestTimeout: 408,
4715
- Conflict: 409,
4716
- Gone: 410,
4717
- LengthRequired: 411,
4718
- PreconditionFailed: 412,
4719
- PayloadTooLarge: 413,
4720
- UriTooLong: 414,
4721
- UnsupportedMediaType: 415,
4722
- RangeNotSatisfiable: 416,
4723
- ExpectationFailed: 417,
4724
- ImATeapot: 418,
4725
- MisdirectedRequest: 421,
4726
- UnprocessableEntity: 422,
4727
- Locked: 423,
4728
- FailedDependency: 424,
4729
- TooEarly: 425,
4730
- UpgradeRequired: 426,
4731
- PreconditionRequired: 428,
4732
- TooManyRequests: 429,
4733
- RequestHeaderFieldsTooLarge: 431,
4734
- UnavailableForLegalReasons: 451,
4735
- InternalServerError: 500,
4736
- NotImplemented: 501,
4737
- BadGateway: 502,
4738
- ServiceUnavailable: 503,
4739
- GatewayTimeout: 504,
4740
- HttpVersionNotSupported: 505,
4741
- VariantAlsoNegotiates: 506,
4742
- InsufficientStorage: 507,
4743
- LoopDetected: 508,
4744
- NotExtended: 510,
4745
- NetworkAuthenticationRequired: 511
4746
- };
4747
- Object.entries(Bt).forEach(([e, t]) => {
4748
- Bt[t] = e;
4749
- });
4750
- const Ka = Bt;
4751
- function Vn(e) {
4752
- const t = new $e(e), r = Sn($e.prototype.request, t);
4753
- return p.extend(r, $e.prototype, t, { allOwnKeys: !0 }), p.extend(r, t, null, { allOwnKeys: !0 }), r.create = function(s) {
4754
- return Vn(ue(e, s));
4755
- }, r;
4756
- }
4757
- const N = Vn(vt);
4758
- N.Axios = $e;
4759
- N.CanceledError = be;
4760
- N.CancelToken = qa;
4761
- N.isCancel = Nn;
4762
- N.VERSION = qn;
4763
- N.toFormData = Qe;
4764
- N.AxiosError = C;
4765
- N.Cancel = N.CanceledError;
4766
- N.all = function(t) {
4767
- return Promise.all(t);
4768
- };
4769
- N.spread = Va;
4770
- N.isAxiosError = Ja;
4771
- N.mergeConfig = ue;
4772
- N.AxiosHeaders = X;
4773
- N.formToJSON = (e) => Mn(p.isHTMLForm(e) ? new FormData(e) : e);
4774
- N.getAdapter = zn.getAdapter;
4775
- N.HttpStatusCode = Ka;
4776
- N.default = N;
4777
- const Ga = N, Xa = { class: "file-viewer" }, Qa = { class: "name" }, Ya = {
4778
- key: 0,
4779
- class: "content loading"
4780
- }, Za = /* @__PURE__ */ ln({
4781
- __name: "FileViewer",
4782
- props: {
4783
- file: {},
4784
- url: {}
4785
- },
4786
- setup(e) {
4787
- const t = e, r = we(!1), n = we(""), s = we(""), o = we(""), a = we();
4788
- return (() => {
4789
- const i = {
4790
- loading: "正在加载中,请耐心等待...",
4791
- reading: "正在努力解析文件...",
4792
- errorLoading: (f) => `加载文件异常:${f}`,
4793
- errorReading: (f) => `读取文件异常:${f}`
4794
- };
4795
- let l;
4796
- const c = {
4797
- // 从url加载
4798
- loadFromUrl() {
4799
- return B(this, null, function* () {
4800
- const { url: f } = t;
4801
- if (!f)
4802
- return;
4803
- this.startLoading(i.loading);
4804
- const h = f.substring(f.lastIndexOf("/") + 1);
4805
- try {
4806
- const { data: b } = yield Ga({ url: f, method: "get", responseType: "blob" });
4807
- if (!b)
4808
- return this.showError("文件下载失败");
4809
- const m = this.wrap(b, h);
4810
- return this.resolveFile(m);
4811
- } catch (b) {
4812
- this.showError(i.errorLoading(b));
4813
- } finally {
4814
- this.endLoading();
4815
- }
4816
- });
4817
- },
4818
- // 包装file
4819
- wrap(f, h) {
4820
- if (f instanceof File)
4821
- return f;
4822
- if (f instanceof Blob && h)
4823
- return new File([f], h, {});
4824
- if (f instanceof ArrayBuffer)
4825
- return this.wrap(new Blob([f]));
4826
- throw new Error("不支持的文件类型格式!");
4827
- },
4828
- // 处理并解析文件
4829
- resolveFile(f) {
4830
- return B(this, null, function* () {
4831
- r.value && this.endLoading();
4832
- const h = this.wrap(f);
4833
- this.startLoading(i.reading);
4834
- try {
4835
- o.value = h.name && decodeURIComponent(h.name) || "";
4836
- const b = yield to(h);
4837
- b instanceof ArrayBuffer && (l = yield this.displayResult(b, h));
4838
- } catch (b) {
4839
- console.error(b), this.showError(i.errorReading(b));
4840
- } finally {
4841
- this.endLoading();
4842
- }
4843
- });
4844
- },
4845
- // 展示渲染最终效果
4846
- displayResult(f, h) {
4847
- const { name: b } = h, m = ho(b), y = a.value;
4848
- if (!y)
4849
- return Promise.resolve();
4850
- l && (y.lastChild && y.removeChild(y.lastChild), l.unmount());
4851
- const x = document.createElement("div");
4852
- x.className = "file-render";
4853
- const T = y.appendChild(x);
4854
- return new Promise((S, E) => mo(f, m, T).then(S).catch(E));
4855
- },
4856
- showError(f) {
4857
- n.value = f;
4858
- },
4859
- startLoading(f) {
4860
- r.value = !0, s.value = f, n.value = "";
4861
- },
4862
- endLoading() {
4863
- r.value = !1, s.value = "";
4864
- }
4865
- };
4866
- tr(() => {
4867
- if (t.file) {
4868
- c.resolveFile(t.file);
4869
- return;
4870
- }
4871
- c.loadFromUrl();
4872
- }), _t(() => t.url, () => {
4873
- t.file || c.loadFromUrl();
4874
- }), _t(() => t.file, (f) => {
4875
- if (f) {
4876
- c.resolveFile(f);
4877
- return;
4878
- }
4879
- c.loadFromUrl();
4880
- });
4881
- })(), (i, l) => (Oe(), Ie("div", Xa, [
4882
- ot("div", Qa, De(o.value), 1),
4883
- n.value ? (Oe(), Ie("div", Ya, De(n.value), 1)) : (Oe(), Ie(nr, { key: 1 }, [
4884
- Mt(ot("div", { class: "content loading" }, De(s.value), 513), [
4885
- [Nt, r.value]
4886
- ]),
4887
- Mt(ot("div", {
4888
- class: "content",
4889
- ref_key: "output",
4890
- ref: a
4891
- }, null, 512), [
4892
- [Nt, !r.value]
4893
- ])
4894
- ], 64))
4895
- ]));
4896
- }
4897
- });
4898
- const ei = /* @__PURE__ */ Tn(Za, [["__scopeId", "data-v-2ee323c7"]]), ti = [
4899
- ["file-viewer", ei]
4900
- ];
4901
- class ni {
4902
- constructor() {
4903
- ye(this, "installed", !1);
4904
- }
4905
- install(t) {
4906
- this.installed || (ti.forEach(([r, n]) => t.component(r, n)), this.installed = !0);
4907
- }
4908
- }
4909
- const oi = new ni();
4910
- export {
4911
- ei as F,
4912
- Tn as _,
4913
- oi as i
4914
- };