ooxml-excel-editor 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2646 +0,0 @@
1
- var B = Uint8Array, Q = Uint16Array, Tt = Int32Array, ct = new B([
2
- 0,
3
- 0,
4
- 0,
5
- 0,
6
- 0,
7
- 0,
8
- 0,
9
- 0,
10
- 1,
11
- 1,
12
- 1,
13
- 1,
14
- 2,
15
- 2,
16
- 2,
17
- 2,
18
- 3,
19
- 3,
20
- 3,
21
- 3,
22
- 4,
23
- 4,
24
- 4,
25
- 4,
26
- 5,
27
- 5,
28
- 5,
29
- 5,
30
- 0,
31
- /* unused */
32
- 0,
33
- 0,
34
- /* impossible */
35
- 0
36
- ]), pt = new B([
37
- 0,
38
- 0,
39
- 0,
40
- 0,
41
- 1,
42
- 1,
43
- 2,
44
- 2,
45
- 3,
46
- 3,
47
- 4,
48
- 4,
49
- 5,
50
- 5,
51
- 6,
52
- 6,
53
- 7,
54
- 7,
55
- 8,
56
- 8,
57
- 9,
58
- 9,
59
- 10,
60
- 10,
61
- 11,
62
- 11,
63
- 12,
64
- 12,
65
- 13,
66
- 13,
67
- /* unused */
68
- 0,
69
- 0
70
- ]), Ft = new B([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), dt = function(t, n) {
71
- for (var r = new Q(31), i = 0; i < 31; ++i)
72
- r[i] = n += 1 << t[i - 1];
73
- for (var a = new Tt(r[30]), i = 1; i < 30; ++i)
74
- for (var u = r[i]; u < r[i + 1]; ++u)
75
- a[u] = u - r[i] << 5 | i;
76
- return { b: r, r: a };
77
- }, ht = dt(ct, 2), gt = ht.b, At = ht.r;
78
- gt[28] = 258, At[258] = 28;
79
- var It = dt(pt, 0), St = It.b, Pe = new Q(32768);
80
- for (var R = 0; R < 32768; ++R) {
81
- var H = (R & 43690) >> 1 | (R & 21845) << 1;
82
- H = (H & 52428) >> 2 | (H & 13107) << 2, H = (H & 61680) >> 4 | (H & 3855) << 4, Pe[R] = ((H & 65280) >> 8 | (H & 255) << 8) >> 1;
83
- }
84
- var D = (function(t, n, r) {
85
- for (var i = t.length, a = 0, u = new Q(n); a < i; ++a)
86
- t[a] && ++u[t[a] - 1];
87
- var s = new Q(n);
88
- for (a = 1; a < n; ++a)
89
- s[a] = s[a - 1] + u[a - 1] << 1;
90
- var e;
91
- if (r) {
92
- e = new Q(1 << n);
93
- var o = 15 - n;
94
- for (a = 0; a < i; ++a)
95
- if (t[a])
96
- for (var l = a << 4 | t[a], c = n - t[a], f = s[t[a] - 1]++ << c, p = f | (1 << c) - 1; f <= p; ++f)
97
- e[Pe[f] >> o] = l;
98
- } else
99
- for (e = new Q(i), a = 0; a < i; ++a)
100
- t[a] && (e[a] = Pe[s[t[a] - 1]++] >> 15 - t[a]);
101
- return e;
102
- }), ee = new B(288);
103
- for (var R = 0; R < 144; ++R)
104
- ee[R] = 8;
105
- for (var R = 144; R < 256; ++R)
106
- ee[R] = 9;
107
- for (var R = 256; R < 280; ++R)
108
- ee[R] = 7;
109
- for (var R = 280; R < 288; ++R)
110
- ee[R] = 8;
111
- var mt = new B(32);
112
- for (var R = 0; R < 32; ++R)
113
- mt[R] = 5;
114
- var Pt = /* @__PURE__ */ D(ee, 9, 1), Ot = /* @__PURE__ */ D(mt, 5, 1), ue = function(t) {
115
- for (var n = t[0], r = 1; r < t.length; ++r)
116
- t[r] > n && (n = t[r]);
117
- return n;
118
- }, G = function(t, n, r) {
119
- var i = n / 8 | 0;
120
- return (t[i] | t[i + 1] << 8) >> (n & 7) & r;
121
- }, fe = function(t, n) {
122
- var r = n / 8 | 0;
123
- return (t[r] | t[r + 1] << 8 | t[r + 2] << 16) >> (n & 7);
124
- }, kt = function(t) {
125
- return (t + 7) / 8 | 0;
126
- }, Re = function(t, n, r) {
127
- return (n == null || n < 0) && (n = 0), (r == null || r > t.length) && (r = t.length), new B(t.subarray(n, r));
128
- }, _t = [
129
- "unexpected EOF",
130
- "invalid block type",
131
- "invalid length/literal",
132
- "invalid distance",
133
- "stream finished",
134
- "no stream handler",
135
- ,
136
- // determined by compression function
137
- "no callback",
138
- "invalid UTF-8 data",
139
- "extra field too long",
140
- "date not in range 1980-2099",
141
- "filename too long",
142
- "stream finishing",
143
- "invalid zip data"
144
- // determined by unknown compression method
145
- ], U = function(t, n, r) {
146
- var i = new Error(n || _t[t]);
147
- if (i.code = t, Error.captureStackTrace && Error.captureStackTrace(i, U), !r)
148
- throw i;
149
- return i;
150
- }, Rt = function(t, n, r, i) {
151
- var a = t.length, u = i ? i.length : 0;
152
- if (!a || n.f && !n.l)
153
- return r || new B(0);
154
- var s = !r, e = s || n.i != 2, o = n.i;
155
- s && (r = new B(a * 3));
156
- var l = function(Ue) {
157
- var Be = r.length;
158
- if (Ue > Be) {
159
- var ze = new B(Math.max(Be * 2, Ue));
160
- ze.set(r), r = ze;
161
- }
162
- }, c = n.f || 0, f = n.p || 0, p = n.b || 0, h = n.l, b = n.d, N = n.m, A = n.n, d = a * 8;
163
- do {
164
- if (!h) {
165
- c = G(t, f, 1);
166
- var y = G(t, f + 1, 3);
167
- if (f += 3, y)
168
- if (y == 1)
169
- h = Pt, b = Ot, N = 9, A = 5;
170
- else if (y == 2) {
171
- var v = G(t, f, 31) + 257, g = G(t, f + 10, 15) + 4, C = v + G(t, f + 5, 31) + 1;
172
- f += 14;
173
- for (var m = new B(C), w = new B(19), E = 0; E < g; ++E)
174
- w[Ft[E]] = G(t, f + E * 3, 7);
175
- f += g * 3;
176
- for (var T = ue(w), F = (1 << T) - 1, M = D(w, T, 1), E = 0; E < C; ) {
177
- var S = M[G(t, f, F)];
178
- f += S & 15;
179
- var x = S >> 4;
180
- if (x < 16)
181
- m[E++] = x;
182
- else {
183
- var I = 0, $ = 0;
184
- for (x == 16 ? ($ = 3 + G(t, f, 3), f += 2, I = m[E - 1]) : x == 17 ? ($ = 3 + G(t, f, 7), f += 3) : x == 18 && ($ = 11 + G(t, f, 127), f += 7); $--; )
185
- m[E++] = I;
186
- }
187
- }
188
- var k = m.subarray(0, v), L = m.subarray(v);
189
- N = ue(k), A = ue(L), h = D(k, N, 1), b = D(L, A, 1);
190
- } else
191
- U(1);
192
- else {
193
- var x = kt(f) + 4, P = t[x - 4] | t[x - 3] << 8, O = x + P;
194
- if (O > a) {
195
- o && U(0);
196
- break;
197
- }
198
- e && l(p + P), r.set(t.subarray(x, O), p), n.b = p += P, n.p = f = O * 8, n.f = c;
199
- continue;
200
- }
201
- if (f > d) {
202
- o && U(0);
203
- break;
204
- }
205
- }
206
- e && l(p + 131072);
207
- for (var te = (1 << N) - 1, ne = (1 << A) - 1, Y = f; ; Y = f) {
208
- var I = h[fe(t, f) & te], _ = I >> 4;
209
- if (f += I & 15, f > d) {
210
- o && U(0);
211
- break;
212
- }
213
- if (I || U(2), _ < 256)
214
- r[p++] = _;
215
- else if (_ == 256) {
216
- Y = f, h = null;
217
- break;
218
- } else {
219
- var W = _ - 254;
220
- if (_ > 264) {
221
- var E = _ - 257, X = ct[E];
222
- W = G(t, f, (1 << X) - 1) + gt[E], f += X;
223
- }
224
- var ae = b[fe(t, f) & ne], le = ae >> 4;
225
- ae || U(3), f += ae & 15;
226
- var L = St[le];
227
- if (le > 3) {
228
- var X = pt[le];
229
- L += fe(t, f) & (1 << X) - 1, f += X;
230
- }
231
- if (f > d) {
232
- o && U(0);
233
- break;
234
- }
235
- e && l(p + 131072);
236
- var Ve = p + W;
237
- if (p < L) {
238
- var Le = u - L, Ct = Math.min(L, Ve);
239
- for (Le + p < 0 && U(3); p < Ct; ++p)
240
- r[p] = i[Le + p];
241
- }
242
- for (; p < Ve; ++p)
243
- r[p] = r[p - L];
244
- }
245
- }
246
- n.l = h, n.p = Y, n.b = p, n.f = c, h && (c = 1, n.m = N, n.d = b, n.n = A);
247
- } while (!c);
248
- return p != r.length && s ? Re(r, 0, p) : r.subarray(0, p);
249
- }, Mt = /* @__PURE__ */ new B(0), q = function(t, n) {
250
- return t[n] | t[n + 1] << 8;
251
- }, z = function(t, n) {
252
- return (t[n] | t[n + 1] << 8 | t[n + 2] << 16 | t[n + 3] << 24) >>> 0;
253
- }, ce = function(t, n) {
254
- return z(t, n) + z(t, n + 4) * 4294967296;
255
- };
256
- function $t(t, n) {
257
- return Rt(t, { i: 2 }, n && n.out, n && n.dictionary);
258
- }
259
- var Oe = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), Vt = 0;
260
- try {
261
- Oe.decode(Mt, { stream: !0 }), Vt = 1;
262
- } catch {
263
- }
264
- var Lt = function(t) {
265
- for (var n = "", r = 0; ; ) {
266
- var i = t[r++], a = (i > 127) + (i > 223) + (i > 239);
267
- if (r + a > t.length)
268
- return { s: n, r: Re(t, r - 1) };
269
- a ? a == 3 ? (i = ((i & 15) << 18 | (t[r++] & 63) << 12 | (t[r++] & 63) << 6 | t[r++] & 63) - 65536, n += String.fromCharCode(55296 | i >> 10, 56320 | i & 1023)) : a & 1 ? n += String.fromCharCode((i & 31) << 6 | t[r++] & 63) : n += String.fromCharCode((i & 15) << 12 | (t[r++] & 63) << 6 | t[r++] & 63) : n += String.fromCharCode(i);
270
- }
271
- };
272
- function ke(t, n) {
273
- if (n) {
274
- for (var r = "", i = 0; i < t.length; i += 16384)
275
- r += String.fromCharCode.apply(null, t.subarray(i, i + 16384));
276
- return r;
277
- } else {
278
- if (Oe)
279
- return Oe.decode(t);
280
- var a = Lt(t), u = a.s, r = a.r;
281
- return r.length && U(8), u;
282
- }
283
- }
284
- var Ut = function(t, n) {
285
- return n + 30 + q(t, n + 26) + q(t, n + 28);
286
- }, Bt = function(t, n, r) {
287
- var i = q(t, n + 28), a = q(t, n + 30), u = ke(t.subarray(n + 46, n + 46 + i), !(q(t, n + 8) & 2048)), s = n + 46 + i, e = zt(t, s, a, r, z(t, n + 20), z(t, n + 24), z(t, n + 42)), o = e[0], l = e[1], c = e[2];
288
- return [q(t, n + 10), o, l, u, s + a + q(t, n + 32), c];
289
- }, zt = function(t, n, r, i, a, u, s) {
290
- var e = a == 4294967295, o = u == 4294967295, l = s == 4294967295, c = n + r, f = e + o + l;
291
- if (i && f) {
292
- for (; n + 4 < c; n += 4 + q(t, n + 2))
293
- if (q(t, n) == 1)
294
- return [
295
- e ? ce(t, n + 4 + 8 * o) : a,
296
- o ? ce(t, n + 4) : u,
297
- l ? ce(t, n + 4 + 8 * (o + e)) : s,
298
- 1
299
- ];
300
- i < 2 && U(13);
301
- }
302
- return [a, u, s, 0];
303
- };
304
- function Gt(t, n) {
305
- for (var r = {}, i = t.length - 22; z(t, i) != 101010256; --i)
306
- (!i || t.length - i > 65558) && U(13);
307
- var a = q(t, i + 8);
308
- if (!a)
309
- return {};
310
- var u = z(t, i + 16), s = z(t, i - 20) == 117853008;
311
- if (s) {
312
- var e = z(t, i - 12);
313
- s = z(t, e) == 101075792, s && (a = z(t, e + 32), u = z(t, e + 48));
314
- }
315
- for (var o = 0; o < a; ++o) {
316
- var l = Bt(t, u, s), c = l[0], f = l[1], p = l[2], h = l[3], b = l[4], N = l[5], A = Ut(t, N);
317
- u = b, c ? c == 8 ? r[h] = $t(t.subarray(A, A + f), { out: new B(p) }) : U(14, "unknown compression type " + c) : r[h] = Re(t, A, A + f);
318
- }
319
- return r;
320
- }
321
- var pe = {}, de = {}, Ge;
322
- function oe() {
323
- return Ge || (Ge = 1, (function(t) {
324
- const n = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", r = n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", i = "[" + n + "][" + r + "]*", a = new RegExp("^" + i + "$"), u = function(l, c) {
325
- const f = [];
326
- let p = c.exec(l);
327
- for (; p; ) {
328
- const h = [];
329
- h.startIndex = c.lastIndex - p[0].length;
330
- const b = p.length;
331
- for (let N = 0; N < b; N++)
332
- h.push(p[N]);
333
- f.push(h), p = c.exec(l);
334
- }
335
- return f;
336
- }, s = function(l) {
337
- const c = a.exec(l);
338
- return !(c === null || typeof c > "u");
339
- };
340
- t.isExist = function(l) {
341
- return typeof l < "u";
342
- }, t.isEmptyObject = function(l) {
343
- return Object.keys(l).length === 0;
344
- }, t.merge = function(l, c, f) {
345
- if (c) {
346
- const p = Object.keys(c), h = p.length;
347
- for (let b = 0; b < h; b++)
348
- f === "strict" ? l[p[b]] = [c[p[b]]] : l[p[b]] = c[p[b]];
349
- }
350
- }, t.getValue = function(l) {
351
- return t.isExist(l) ? l : "";
352
- };
353
- const e = [
354
- // '__proto__',
355
- // 'constructor',
356
- // 'prototype',
357
- "hasOwnProperty",
358
- "toString",
359
- "valueOf",
360
- "__defineGetter__",
361
- "__defineSetter__",
362
- "__lookupGetter__",
363
- "__lookupSetter__"
364
- ], o = ["__proto__", "constructor", "prototype"];
365
- t.isName = s, t.getAllMatches = u, t.nameRegexp = i, t.DANGEROUS_PROPERTY_NAMES = e, t.criticalProperties = o;
366
- })(de)), de;
367
- }
368
- var qe;
369
- function yt() {
370
- if (qe) return pe;
371
- qe = 1;
372
- const t = oe(), n = {
373
- allowBooleanAttributes: !1,
374
- //A tag can have attributes without any value
375
- unpairedTags: []
376
- };
377
- pe.validate = function(d, y) {
378
- y = Object.assign({}, n, y);
379
- const x = [];
380
- let P = !1, O = !1;
381
- d[0] === "\uFEFF" && (d = d.substr(1));
382
- for (let v = 0; v < d.length; v++)
383
- if (d[v] === "<" && d[v + 1] === "?") {
384
- if (v += 2, v = i(d, v), v.err) return v;
385
- } else if (d[v] === "<") {
386
- let g = v;
387
- if (v++, d[v] === "!") {
388
- v = a(d, v);
389
- continue;
390
- } else {
391
- let C = !1;
392
- d[v] === "/" && (C = !0, v++);
393
- let m = "";
394
- for (; v < d.length && d[v] !== ">" && d[v] !== " " && d[v] !== " " && d[v] !== `
395
- ` && d[v] !== "\r"; v++)
396
- m += d[v];
397
- if (m = m.trim(), m[m.length - 1] === "/" && (m = m.substring(0, m.length - 1), v--), !b(m)) {
398
- let T;
399
- return m.trim().length === 0 ? T = "Invalid space after '<'." : T = "Tag '" + m + "' is an invalid name.", p("InvalidTag", T, N(d, v));
400
- }
401
- const w = e(d, v);
402
- if (w === !1)
403
- return p("InvalidAttr", "Attributes for '" + m + "' have open quote.", N(d, v));
404
- let E = w.value;
405
- if (v = w.index, E[E.length - 1] === "/") {
406
- const T = v - E.length;
407
- E = E.substring(0, E.length - 1);
408
- const F = l(E, y);
409
- if (F === !0)
410
- P = !0;
411
- else
412
- return p(F.err.code, F.err.msg, N(d, T + F.err.line));
413
- } else if (C)
414
- if (w.tagClosed) {
415
- if (E.trim().length > 0)
416
- return p("InvalidTag", "Closing tag '" + m + "' can't have attributes or invalid starting.", N(d, g));
417
- if (x.length === 0)
418
- return p("InvalidTag", "Closing tag '" + m + "' has not been opened.", N(d, g));
419
- {
420
- const T = x.pop();
421
- if (m !== T.tagName) {
422
- let F = N(d, T.tagStartPos);
423
- return p(
424
- "InvalidTag",
425
- "Expected closing tag '" + T.tagName + "' (opened in line " + F.line + ", col " + F.col + ") instead of closing tag '" + m + "'.",
426
- N(d, g)
427
- );
428
- }
429
- x.length == 0 && (O = !0);
430
- }
431
- } else return p("InvalidTag", "Closing tag '" + m + "' doesn't have proper closing.", N(d, v));
432
- else {
433
- const T = l(E, y);
434
- if (T !== !0)
435
- return p(T.err.code, T.err.msg, N(d, v - E.length + T.err.line));
436
- if (O === !0)
437
- return p("InvalidXml", "Multiple possible root nodes found.", N(d, v));
438
- y.unpairedTags.indexOf(m) !== -1 || x.push({ tagName: m, tagStartPos: g }), P = !0;
439
- }
440
- for (v++; v < d.length; v++)
441
- if (d[v] === "<")
442
- if (d[v + 1] === "!") {
443
- v++, v = a(d, v);
444
- continue;
445
- } else if (d[v + 1] === "?") {
446
- if (v = i(d, ++v), v.err) return v;
447
- } else
448
- break;
449
- else if (d[v] === "&") {
450
- const T = f(d, v);
451
- if (T == -1)
452
- return p("InvalidChar", "char '&' is not expected.", N(d, v));
453
- v = T;
454
- } else if (O === !0 && !r(d[v]))
455
- return p("InvalidXml", "Extra text at the end", N(d, v));
456
- d[v] === "<" && v--;
457
- }
458
- } else {
459
- if (r(d[v]))
460
- continue;
461
- return p("InvalidChar", "char '" + d[v] + "' is not expected.", N(d, v));
462
- }
463
- if (P) {
464
- if (x.length == 1)
465
- return p("InvalidTag", "Unclosed tag '" + x[0].tagName + "'.", N(d, x[0].tagStartPos));
466
- if (x.length > 0)
467
- return p("InvalidXml", "Invalid '" + JSON.stringify(x.map((v) => v.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
468
- } else return p("InvalidXml", "Start tag expected.", 1);
469
- return !0;
470
- };
471
- function r(d) {
472
- return d === " " || d === " " || d === `
473
- ` || d === "\r";
474
- }
475
- function i(d, y) {
476
- const x = y;
477
- for (; y < d.length; y++)
478
- if (d[y] == "?" || d[y] == " ") {
479
- const P = d.substr(x, y - x);
480
- if (y > 5 && P === "xml")
481
- return p("InvalidXml", "XML declaration allowed only at the start of the document.", N(d, y));
482
- if (d[y] == "?" && d[y + 1] == ">") {
483
- y++;
484
- break;
485
- } else
486
- continue;
487
- }
488
- return y;
489
- }
490
- function a(d, y) {
491
- if (d.length > y + 5 && d[y + 1] === "-" && d[y + 2] === "-") {
492
- for (y += 3; y < d.length; y++)
493
- if (d[y] === "-" && d[y + 1] === "-" && d[y + 2] === ">") {
494
- y += 2;
495
- break;
496
- }
497
- } else if (d.length > y + 8 && d[y + 1] === "D" && d[y + 2] === "O" && d[y + 3] === "C" && d[y + 4] === "T" && d[y + 5] === "Y" && d[y + 6] === "P" && d[y + 7] === "E") {
498
- let x = 1;
499
- for (y += 8; y < d.length; y++)
500
- if (d[y] === "<")
501
- x++;
502
- else if (d[y] === ">" && (x--, x === 0))
503
- break;
504
- } else if (d.length > y + 9 && d[y + 1] === "[" && d[y + 2] === "C" && d[y + 3] === "D" && d[y + 4] === "A" && d[y + 5] === "T" && d[y + 6] === "A" && d[y + 7] === "[") {
505
- for (y += 8; y < d.length; y++)
506
- if (d[y] === "]" && d[y + 1] === "]" && d[y + 2] === ">") {
507
- y += 2;
508
- break;
509
- }
510
- }
511
- return y;
512
- }
513
- const u = '"', s = "'";
514
- function e(d, y) {
515
- let x = "", P = "", O = !1;
516
- for (; y < d.length; y++) {
517
- if (d[y] === u || d[y] === s)
518
- P === "" ? P = d[y] : P !== d[y] || (P = "");
519
- else if (d[y] === ">" && P === "") {
520
- O = !0;
521
- break;
522
- }
523
- x += d[y];
524
- }
525
- return P !== "" ? !1 : {
526
- value: x,
527
- index: y,
528
- tagClosed: O
529
- };
530
- }
531
- const o = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
532
- function l(d, y) {
533
- const x = t.getAllMatches(d, o), P = {};
534
- for (let O = 0; O < x.length; O++) {
535
- if (x[O][1].length === 0)
536
- return p("InvalidAttr", "Attribute '" + x[O][2] + "' has no space in starting.", A(x[O]));
537
- if (x[O][3] !== void 0 && x[O][4] === void 0)
538
- return p("InvalidAttr", "Attribute '" + x[O][2] + "' is without value.", A(x[O]));
539
- if (x[O][3] === void 0 && !y.allowBooleanAttributes)
540
- return p("InvalidAttr", "boolean attribute '" + x[O][2] + "' is not allowed.", A(x[O]));
541
- const v = x[O][2];
542
- if (!h(v))
543
- return p("InvalidAttr", "Attribute '" + v + "' is an invalid name.", A(x[O]));
544
- if (!P.hasOwnProperty(v))
545
- P[v] = 1;
546
- else
547
- return p("InvalidAttr", "Attribute '" + v + "' is repeated.", A(x[O]));
548
- }
549
- return !0;
550
- }
551
- function c(d, y) {
552
- let x = /\d/;
553
- for (d[y] === "x" && (y++, x = /[\da-fA-F]/); y < d.length; y++) {
554
- if (d[y] === ";")
555
- return y;
556
- if (!d[y].match(x))
557
- break;
558
- }
559
- return -1;
560
- }
561
- function f(d, y) {
562
- if (y++, d[y] === ";")
563
- return -1;
564
- if (d[y] === "#")
565
- return y++, c(d, y);
566
- let x = 0;
567
- for (; y < d.length; y++, x++)
568
- if (!(d[y].match(/\w/) && x < 20)) {
569
- if (d[y] === ";")
570
- break;
571
- return -1;
572
- }
573
- return y;
574
- }
575
- function p(d, y, x) {
576
- return {
577
- err: {
578
- code: d,
579
- msg: y,
580
- line: x.line || x,
581
- col: x.col
582
- }
583
- };
584
- }
585
- function h(d) {
586
- return t.isName(d);
587
- }
588
- function b(d) {
589
- return t.isName(d);
590
- }
591
- function N(d, y) {
592
- const x = d.substring(0, y).split(/\r?\n/);
593
- return {
594
- line: x.length,
595
- // column number is last line's length + 1, because column numbering starts at 1:
596
- col: x[x.length - 1].length + 1
597
- };
598
- }
599
- function A(d) {
600
- return d.startIndex + d[1].length;
601
- }
602
- return pe;
603
- }
604
- var re = {}, We;
605
- function qt() {
606
- if (We) return re;
607
- We = 1;
608
- const { DANGEROUS_PROPERTY_NAMES: t, criticalProperties: n } = oe(), r = (e) => t.includes(e) ? "__" + e : e, i = {
609
- preserveOrder: !1,
610
- attributeNamePrefix: "@_",
611
- attributesGroupName: !1,
612
- textNodeName: "#text",
613
- ignoreAttributes: !0,
614
- removeNSPrefix: !1,
615
- // remove NS from tag name or attribute name if true
616
- allowBooleanAttributes: !1,
617
- //a tag can have attributes without any value
618
- //ignoreRootElement : false,
619
- parseTagValue: !0,
620
- parseAttributeValue: !1,
621
- trimValues: !0,
622
- //Trim string values of tag and attributes
623
- cdataPropName: !1,
624
- numberParseOptions: {
625
- hex: !0,
626
- leadingZeros: !0,
627
- eNotation: !0
628
- },
629
- tagValueProcessor: function(e, o) {
630
- return o;
631
- },
632
- attributeValueProcessor: function(e, o) {
633
- return o;
634
- },
635
- stopNodes: [],
636
- //nested tags will not be parsed even for errors
637
- alwaysCreateTextNode: !1,
638
- isArray: () => !1,
639
- commentPropName: !1,
640
- unpairedTags: [],
641
- processEntities: !0,
642
- htmlEntities: !1,
643
- ignoreDeclaration: !1,
644
- ignorePiTags: !1,
645
- transformTagName: !1,
646
- transformAttributeName: !1,
647
- updateTag: function(e, o, l) {
648
- return e;
649
- },
650
- // skipEmptyListItem: false
651
- captureMetaData: !1,
652
- maxNestedTags: 100,
653
- strictReservedNames: !0,
654
- onDangerousProperty: r
655
- };
656
- function a(e, o) {
657
- if (typeof e != "string")
658
- return;
659
- const l = e.toLowerCase();
660
- if (t.some((c) => l === c.toLowerCase()))
661
- throw new Error(
662
- `[SECURITY] Invalid ${o}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`
663
- );
664
- if (n.some((c) => l === c.toLowerCase()))
665
- throw new Error(
666
- `[SECURITY] Invalid ${o}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`
667
- );
668
- }
669
- function u(e) {
670
- return typeof e == "boolean" ? {
671
- enabled: e,
672
- // true or false
673
- maxEntitySize: 1e4,
674
- maxExpansionDepth: 10,
675
- maxTotalExpansions: 1e3,
676
- maxExpandedLength: 1e5,
677
- allowedTags: null,
678
- tagFilter: null
679
- } : typeof e == "object" && e !== null ? {
680
- enabled: e.enabled !== !1,
681
- maxEntitySize: Math.max(1, e.maxEntitySize ?? 1e4),
682
- maxExpansionDepth: Math.max(1, e.maxExpansionDepth ?? 1e4),
683
- maxTotalExpansions: Math.max(1, e.maxTotalExpansions ?? 1 / 0),
684
- maxExpandedLength: Math.max(1, e.maxExpandedLength ?? 1e5),
685
- maxEntityCount: Math.max(1, e.maxEntityCount ?? 1e3),
686
- allowedTags: e.allowedTags ?? null,
687
- tagFilter: e.tagFilter ?? null
688
- } : u(!0);
689
- }
690
- const s = function(e) {
691
- const o = Object.assign({}, i, e), l = [
692
- { value: o.attributeNamePrefix, name: "attributeNamePrefix" },
693
- { value: o.attributesGroupName, name: "attributesGroupName" },
694
- { value: o.textNodeName, name: "textNodeName" },
695
- { value: o.cdataPropName, name: "cdataPropName" },
696
- { value: o.commentPropName, name: "commentPropName" }
697
- ];
698
- for (const { value: c, name: f } of l)
699
- c && a(c, f);
700
- return o.onDangerousProperty === null && (o.onDangerousProperty = r), o.processEntities = u(o.processEntities), o;
701
- };
702
- return re.buildOptions = s, re.defaultOptions = i, re;
703
- }
704
- var he, Xe;
705
- function Wt() {
706
- if (Xe) return he;
707
- Xe = 1;
708
- class t {
709
- constructor(r) {
710
- this.tagname = r, this.child = [], this[":@"] = {};
711
- }
712
- add(r, i) {
713
- r === "__proto__" && (r = "#__proto__"), this.child.push({ [r]: i });
714
- }
715
- addChild(r) {
716
- r.tagname === "__proto__" && (r.tagname = "#__proto__"), r[":@"] && Object.keys(r[":@"]).length > 0 ? this.child.push({ [r.tagname]: r.child, ":@": r[":@"] }) : this.child.push({ [r.tagname]: r.child });
717
- }
718
- }
719
- return he = t, he;
720
- }
721
- var ge, je;
722
- function Xt() {
723
- if (je) return ge;
724
- je = 1;
725
- const t = oe();
726
- class n {
727
- constructor(s) {
728
- this.suppressValidationErr = !s, this.options = s || {};
729
- }
730
- readDocType(s, e) {
731
- const o = /* @__PURE__ */ Object.create(null);
732
- let l = 0;
733
- if (s[e + 3] === "O" && s[e + 4] === "C" && s[e + 5] === "T" && s[e + 6] === "Y" && s[e + 7] === "P" && s[e + 8] === "E") {
734
- e = e + 9;
735
- let c = 1, f = !1, p = !1, h = "";
736
- for (; e < s.length; e++)
737
- if (s[e] === "<" && !p) {
738
- if (f && i(s, "!ENTITY", e)) {
739
- e += 7;
740
- let b, N;
741
- if ([b, N, e] = this.readEntityExp(s, e + 1, this.suppressValidationErr), N.indexOf("&") === -1) {
742
- if (this.options.enabled !== !1 && this.options.maxEntityCount != null && l >= this.options.maxEntityCount)
743
- throw new Error(
744
- `Entity count (${l + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
745
- );
746
- const A = b.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
747
- o[b] = {
748
- regx: RegExp(`&${A};`, "g"),
749
- val: N
750
- }, l++;
751
- }
752
- } else if (f && i(s, "!ELEMENT", e)) {
753
- e += 8;
754
- const { index: b } = this.readElementExp(s, e + 1);
755
- e = b;
756
- } else if (f && i(s, "!ATTLIST", e))
757
- e += 8;
758
- else if (f && i(s, "!NOTATION", e)) {
759
- e += 9;
760
- const { index: b } = this.readNotationExp(s, e + 1, this.suppressValidationErr);
761
- e = b;
762
- } else if (i(s, "!--", e))
763
- p = !0;
764
- else
765
- throw new Error("Invalid DOCTYPE");
766
- c++, h = "";
767
- } else if (s[e] === ">") {
768
- if (p ? s[e - 1] === "-" && s[e - 2] === "-" && (p = !1, c--) : c--, c === 0)
769
- break;
770
- } else s[e] === "[" ? f = !0 : h += s[e];
771
- if (c !== 0)
772
- throw new Error("Unclosed DOCTYPE");
773
- } else
774
- throw new Error("Invalid Tag instead of DOCTYPE");
775
- return { entities: o, i: e };
776
- }
777
- readEntityExp(s, e) {
778
- e = r(s, e);
779
- let o = "";
780
- for (; e < s.length && !/\s/.test(s[e]) && s[e] !== '"' && s[e] !== "'"; )
781
- o += s[e], e++;
782
- if (a(o), e = r(s, e), !this.suppressValidationErr) {
783
- if (s.substring(e, e + 6).toUpperCase() === "SYSTEM")
784
- throw new Error("External entities are not supported");
785
- if (s[e] === "%")
786
- throw new Error("Parameter entities are not supported");
787
- }
788
- let l = "";
789
- if ([e, l] = this.readIdentifierVal(s, e, "entity"), this.options.enabled !== !1 && this.options.maxEntitySize != null && l.length > this.options.maxEntitySize)
790
- throw new Error(
791
- `Entity "${o}" size (${l.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
792
- );
793
- return e--, [o, l, e];
794
- }
795
- readNotationExp(s, e) {
796
- e = r(s, e);
797
- let o = "";
798
- for (; e < s.length && !/\s/.test(s[e]); )
799
- o += s[e], e++;
800
- !this.suppressValidationErr && a(o), e = r(s, e);
801
- const l = s.substring(e, e + 6).toUpperCase();
802
- if (!this.suppressValidationErr && l !== "SYSTEM" && l !== "PUBLIC")
803
- throw new Error(`Expected SYSTEM or PUBLIC, found "${l}"`);
804
- e += l.length, e = r(s, e);
805
- let c = null, f = null;
806
- if (l === "PUBLIC")
807
- [e, c] = this.readIdentifierVal(s, e, "publicIdentifier"), e = r(s, e), (s[e] === '"' || s[e] === "'") && ([e, f] = this.readIdentifierVal(s, e, "systemIdentifier"));
808
- else if (l === "SYSTEM" && ([e, f] = this.readIdentifierVal(s, e, "systemIdentifier"), !this.suppressValidationErr && !f))
809
- throw new Error("Missing mandatory system identifier for SYSTEM notation");
810
- return { notationName: o, publicIdentifier: c, systemIdentifier: f, index: --e };
811
- }
812
- readIdentifierVal(s, e, o) {
813
- let l = "";
814
- const c = s[e];
815
- if (c !== '"' && c !== "'")
816
- throw new Error(`Expected quoted string, found "${c}"`);
817
- for (e++; e < s.length && s[e] !== c; )
818
- l += s[e], e++;
819
- if (s[e] !== c)
820
- throw new Error(`Unterminated ${o} value`);
821
- return e++, [e, l];
822
- }
823
- readElementExp(s, e) {
824
- e = r(s, e);
825
- let o = "";
826
- for (; e < s.length && !/\s/.test(s[e]); )
827
- o += s[e], e++;
828
- if (!this.suppressValidationErr && !t.isName(o))
829
- throw new Error(`Invalid element name: "${o}"`);
830
- e = r(s, e);
831
- let l = "";
832
- if (s[e] === "E" && i(s, "MPTY", e))
833
- e += 4;
834
- else if (s[e] === "A" && i(s, "NY", e))
835
- e += 2;
836
- else if (s[e] === "(") {
837
- for (e++; e < s.length && s[e] !== ")"; )
838
- l += s[e], e++;
839
- if (s[e] !== ")")
840
- throw new Error("Unterminated content model");
841
- } else if (!this.suppressValidationErr)
842
- throw new Error(`Invalid Element Expression, found "${s[e]}"`);
843
- return {
844
- elementName: o,
845
- contentModel: l.trim(),
846
- index: e
847
- };
848
- }
849
- readAttlistExp(s, e) {
850
- e = r(s, e);
851
- let o = "";
852
- for (; e < s.length && !/\s/.test(s[e]); )
853
- o += s[e], e++;
854
- a(o), e = r(s, e);
855
- let l = "";
856
- for (; e < s.length && !/\s/.test(s[e]); )
857
- l += s[e], e++;
858
- if (!a(l))
859
- throw new Error(`Invalid attribute name: "${l}"`);
860
- e = r(s, e);
861
- let c = "";
862
- if (s.substring(e, e + 8).toUpperCase() === "NOTATION") {
863
- if (c = "NOTATION", e += 8, e = r(s, e), s[e] !== "(")
864
- throw new Error(`Expected '(', found "${s[e]}"`);
865
- e++;
866
- let p = [];
867
- for (; e < s.length && s[e] !== ")"; ) {
868
- let h = "";
869
- for (; e < s.length && s[e] !== "|" && s[e] !== ")"; )
870
- h += s[e], e++;
871
- if (h = h.trim(), !a(h))
872
- throw new Error(`Invalid notation name: "${h}"`);
873
- p.push(h), s[e] === "|" && (e++, e = r(s, e));
874
- }
875
- if (s[e] !== ")")
876
- throw new Error("Unterminated list of notations");
877
- e++, c += " (" + p.join("|") + ")";
878
- } else {
879
- for (; e < s.length && !/\s/.test(s[e]); )
880
- c += s[e], e++;
881
- const p = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
882
- if (!this.suppressValidationErr && !p.includes(c.toUpperCase()))
883
- throw new Error(`Invalid attribute type: "${c}"`);
884
- }
885
- e = r(s, e);
886
- let f = "";
887
- return s.substring(e, e + 8).toUpperCase() === "#REQUIRED" ? (f = "#REQUIRED", e += 8) : s.substring(e, e + 7).toUpperCase() === "#IMPLIED" ? (f = "#IMPLIED", e += 7) : [e, f] = this.readIdentifierVal(s, e, "ATTLIST"), {
888
- elementName: o,
889
- attributeName: l,
890
- attributeType: c,
891
- defaultValue: f,
892
- index: e
893
- };
894
- }
895
- }
896
- const r = (u, s) => {
897
- for (; s < u.length && /\s/.test(u[s]); )
898
- s++;
899
- return s;
900
- };
901
- function i(u, s, e) {
902
- for (let o = 0; o < s.length; o++)
903
- if (s[o] !== u[e + o + 1]) return !1;
904
- return !0;
905
- }
906
- function a(u) {
907
- if (t.isName(u))
908
- return u;
909
- throw new Error(`Invalid entity name ${u}`);
910
- }
911
- return ge = n, ge;
912
- }
913
- var me, He;
914
- function jt() {
915
- if (He) return me;
916
- He = 1;
917
- const t = /^[-+]?0x[a-fA-F0-9]+$/, n = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, r = {
918
- hex: !0,
919
- // oct: false,
920
- leadingZeros: !0,
921
- decimalPoint: ".",
922
- eNotation: !0
923
- //skipLike: /regex/
924
- };
925
- function i(s, e = {}) {
926
- if (e = Object.assign({}, r, e), !s || typeof s != "string") return s;
927
- let o = s.trim();
928
- if (e.skipLike !== void 0 && e.skipLike.test(o)) return s;
929
- if (s === "0") return 0;
930
- if (e.hex && t.test(o))
931
- return u(o, 16);
932
- if (o.search(/[eE]/) !== -1) {
933
- const l = o.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
934
- if (l) {
935
- if (e.leadingZeros)
936
- o = (l[1] || "") + l[3];
937
- else if (!(l[2] === "0" && l[3][0] === ".")) return s;
938
- return e.eNotation ? Number(o) : s;
939
- } else
940
- return s;
941
- } else {
942
- const l = n.exec(o);
943
- if (l) {
944
- const c = l[1], f = l[2];
945
- let p = a(l[3]);
946
- if (!e.leadingZeros && f.length > 0 && c && o[2] !== ".") return s;
947
- if (!e.leadingZeros && f.length > 0 && !c && o[1] !== ".") return s;
948
- if (e.leadingZeros && f === s) return 0;
949
- {
950
- const h = Number(o), b = "" + h;
951
- return b.search(/[eE]/) !== -1 ? e.eNotation ? h : s : o.indexOf(".") !== -1 ? b === "0" && p === "" || b === p || c && b === "-" + p ? h : s : f ? p === b || c + p === b ? h : s : o === b || o === c + b ? h : s;
952
- }
953
- } else
954
- return s;
955
- }
956
- }
957
- function a(s) {
958
- return s && s.indexOf(".") !== -1 && (s = s.replace(/0+$/, ""), s === "." ? s = "0" : s[0] === "." ? s = "0" + s : s[s.length - 1] === "." && (s = s.substr(0, s.length - 1))), s;
959
- }
960
- function u(s, e) {
961
- if (parseInt) return parseInt(s, e);
962
- if (Number.parseInt) return Number.parseInt(s, e);
963
- if (window && window.parseInt) return window.parseInt(s, e);
964
- throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
965
- }
966
- return me = i, me;
967
- }
968
- var ye, Ye;
969
- function bt() {
970
- if (Ye) return ye;
971
- Ye = 1;
972
- function t(n) {
973
- return typeof n == "function" ? n : Array.isArray(n) ? (r) => {
974
- for (const i of n)
975
- if (typeof i == "string" && r === i || i instanceof RegExp && i.test(r))
976
- return !0;
977
- } : () => !1;
978
- }
979
- return ye = t, ye;
980
- }
981
- var be, Je;
982
- function Ht() {
983
- if (Je) return be;
984
- Je = 1;
985
- const t = oe(), n = Wt(), r = Xt(), i = jt(), a = bt();
986
- class u {
987
- constructor(C) {
988
- if (this.options = C, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
989
- apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
990
- gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
991
- lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
992
- quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
993
- }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = {
994
- space: { regex: /&(nbsp|#160);/g, val: " " },
995
- // "lt" : { regex: /&(lt|#60);/g, val: "<" },
996
- // "gt" : { regex: /&(gt|#62);/g, val: ">" },
997
- // "amp" : { regex: /&(amp|#38);/g, val: "&" },
998
- // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
999
- // "apos" : { regex: /&(apos|#39);/g, val: "'" },
1000
- cent: { regex: /&(cent|#162);/g, val: "¢" },
1001
- pound: { regex: /&(pound|#163);/g, val: "£" },
1002
- yen: { regex: /&(yen|#165);/g, val: "¥" },
1003
- euro: { regex: /&(euro|#8364);/g, val: "€" },
1004
- copyright: { regex: /&(copy|#169);/g, val: "©" },
1005
- reg: { regex: /&(reg|#174);/g, val: "®" },
1006
- inr: { regex: /&(inr|#8377);/g, val: "₹" },
1007
- num_dec: { regex: /&#([0-9]{1,7});/g, val: (m, w) => O(w, 10, "&#") },
1008
- num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (m, w) => O(w, 16, "&#x") }
1009
- }, this.addExternalEntities = s, this.parseXml = f, this.parseTextData = e, this.resolveNameSpace = o, this.buildAttributesMap = c, this.isItStopNode = N, this.replaceEntitiesValue = h, this.readStopNodeData = x, this.saveTextToParentTag = b, this.addChild = p, this.ignoreAttributesFn = a(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) {
1010
- this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
1011
- for (let m = 0; m < this.options.stopNodes.length; m++) {
1012
- const w = this.options.stopNodes[m];
1013
- typeof w == "string" && (w.startsWith("*.") ? this.stopNodesWildcard.add(w.substring(2)) : this.stopNodesExact.add(w));
1014
- }
1015
- }
1016
- }
1017
- }
1018
- function s(g) {
1019
- const C = Object.keys(g);
1020
- for (let m = 0; m < C.length; m++) {
1021
- const w = C[m], E = w.replace(/[.\-+*:]/g, "\\.");
1022
- this.lastEntities[w] = {
1023
- regex: new RegExp("&" + E + ";", "g"),
1024
- val: g[w]
1025
- };
1026
- }
1027
- }
1028
- function e(g, C, m, w, E, T, F) {
1029
- if (g !== void 0 && (this.options.trimValues && !w && (g = g.trim()), g.length > 0)) {
1030
- F || (g = this.replaceEntitiesValue(g, C, m));
1031
- const M = this.options.tagValueProcessor(C, g, m, E, T);
1032
- return M == null ? g : typeof M != typeof g || M !== g ? M : this.options.trimValues ? P(g, this.options.parseTagValue, this.options.numberParseOptions) : g.trim() === g ? P(g, this.options.parseTagValue, this.options.numberParseOptions) : g;
1033
- }
1034
- }
1035
- function o(g) {
1036
- if (this.options.removeNSPrefix) {
1037
- const C = g.split(":"), m = g.charAt(0) === "/" ? "/" : "";
1038
- if (C[0] === "xmlns")
1039
- return "";
1040
- C.length === 2 && (g = m + C[1]);
1041
- }
1042
- return g;
1043
- }
1044
- const l = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
1045
- function c(g, C, m) {
1046
- if (this.options.ignoreAttributes !== !0 && typeof g == "string") {
1047
- const w = t.getAllMatches(g, l), E = w.length, T = {};
1048
- for (let F = 0; F < E; F++) {
1049
- const M = this.resolveNameSpace(w[F][1]);
1050
- if (this.ignoreAttributesFn(M, C))
1051
- continue;
1052
- let S = w[F][4], I = this.options.attributeNamePrefix + M;
1053
- if (M.length)
1054
- if (this.options.transformAttributeName && (I = this.options.transformAttributeName(I)), I = v(I, this.options), S !== void 0) {
1055
- this.options.trimValues && (S = S.trim()), S = this.replaceEntitiesValue(S, m, C);
1056
- const $ = this.options.attributeValueProcessor(M, S, C);
1057
- $ == null ? T[I] = S : typeof $ != typeof S || $ !== S ? T[I] = $ : T[I] = P(
1058
- S,
1059
- this.options.parseAttributeValue,
1060
- this.options.numberParseOptions
1061
- );
1062
- } else this.options.allowBooleanAttributes && (T[I] = !0);
1063
- }
1064
- if (!Object.keys(T).length)
1065
- return;
1066
- if (this.options.attributesGroupName) {
1067
- const F = {};
1068
- return F[this.options.attributesGroupName] = T, F;
1069
- }
1070
- return T;
1071
- }
1072
- }
1073
- const f = function(g) {
1074
- g = g.replace(/\r\n?/g, `
1075
- `);
1076
- const C = new n("!xml");
1077
- let m = C, w = "", E = "";
1078
- this.entityExpansionCount = 0, this.currentExpandedLength = 0;
1079
- const T = new r(this.options.processEntities);
1080
- for (let F = 0; F < g.length; F++)
1081
- if (g[F] === "<")
1082
- if (g[F + 1] === "/") {
1083
- const S = d(g, ">", F, "Closing Tag is not closed.");
1084
- let I = g.substring(F + 2, S).trim();
1085
- if (this.options.removeNSPrefix) {
1086
- const L = I.indexOf(":");
1087
- L !== -1 && (I = I.substr(L + 1));
1088
- }
1089
- this.options.transformTagName && (I = this.options.transformTagName(I)), m && (w = this.saveTextToParentTag(w, m, E));
1090
- const $ = E.substring(E.lastIndexOf(".") + 1);
1091
- if (I && this.options.unpairedTags.indexOf(I) !== -1)
1092
- throw new Error(`Unpaired tag can not be used as closing tag: </${I}>`);
1093
- let k = 0;
1094
- $ && this.options.unpairedTags.indexOf($) !== -1 ? (k = E.lastIndexOf(".", E.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : k = E.lastIndexOf("."), E = E.substring(0, k), m = this.tagsNodeStack.pop(), w = "", F = S;
1095
- } else if (g[F + 1] === "?") {
1096
- let S = y(g, F, !1, "?>");
1097
- if (!S) throw new Error("Pi Tag is not closed.");
1098
- if (w = this.saveTextToParentTag(w, m, E), !(this.options.ignoreDeclaration && S.tagName === "?xml" || this.options.ignorePiTags)) {
1099
- const I = new n(S.tagName);
1100
- I.add(this.options.textNodeName, ""), S.tagName !== S.tagExp && S.attrExpPresent && (I[":@"] = this.buildAttributesMap(S.tagExp, E, S.tagName)), this.addChild(m, I, E, F);
1101
- }
1102
- F = S.closeIndex + 1;
1103
- } else if (g.substr(F + 1, 3) === "!--") {
1104
- const S = d(g, "-->", F + 4, "Comment is not closed.");
1105
- if (this.options.commentPropName) {
1106
- const I = g.substring(F + 4, S - 2);
1107
- w = this.saveTextToParentTag(w, m, E), m.add(this.options.commentPropName, [{ [this.options.textNodeName]: I }]);
1108
- }
1109
- F = S;
1110
- } else if (g.substr(F + 1, 2) === "!D") {
1111
- const S = T.readDocType(g, F);
1112
- this.docTypeEntities = S.entities, F = S.i;
1113
- } else if (g.substr(F + 1, 2) === "![") {
1114
- const S = d(g, "]]>", F, "CDATA is not closed.") - 2, I = g.substring(F + 9, S);
1115
- w = this.saveTextToParentTag(w, m, E);
1116
- let $ = this.parseTextData(I, m.tagname, E, !0, !1, !0, !0);
1117
- $ == null && ($ = ""), this.options.cdataPropName ? m.add(this.options.cdataPropName, [{ [this.options.textNodeName]: I }]) : m.add(this.options.textNodeName, $), F = S + 2;
1118
- } else {
1119
- let S = y(g, F, this.options.removeNSPrefix), I = S.tagName;
1120
- const $ = S.rawTagName;
1121
- let k = S.tagExp, L = S.attrExpPresent, te = S.closeIndex;
1122
- if (this.options.transformTagName) {
1123
- const _ = this.options.transformTagName(I);
1124
- k === I && (k = _), I = _;
1125
- }
1126
- if (this.options.strictReservedNames && (I === this.options.commentPropName || I === this.options.cdataPropName || I === this.options.textNodeName || I === this.options.attributesGroupName))
1127
- throw new Error(`Invalid tag name: ${I}`);
1128
- m && w && m.tagname !== "!xml" && (w = this.saveTextToParentTag(w, m, E, !1));
1129
- const ne = m;
1130
- ne && this.options.unpairedTags.indexOf(ne.tagname) !== -1 && (m = this.tagsNodeStack.pop(), E = E.substring(0, E.lastIndexOf("."))), I !== C.tagname && (E += E ? "." + I : I);
1131
- const Y = F;
1132
- if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, E, I)) {
1133
- let _ = "";
1134
- if (k.length > 0 && k.lastIndexOf("/") === k.length - 1)
1135
- I[I.length - 1] === "/" ? (I = I.substr(0, I.length - 1), E = E.substr(0, E.length - 1), k = I) : k = k.substr(0, k.length - 1), F = S.closeIndex;
1136
- else if (this.options.unpairedTags.indexOf(I) !== -1)
1137
- F = S.closeIndex;
1138
- else {
1139
- const X = this.readStopNodeData(g, $, te + 1);
1140
- if (!X) throw new Error(`Unexpected end of ${$}`);
1141
- F = X.i, _ = X.tagContent;
1142
- }
1143
- const W = new n(I);
1144
- I !== k && L && (W[":@"] = this.buildAttributesMap(k, E, I)), _ && (_ = this.parseTextData(_, I, E, !0, L, !0, !0)), E = E.substr(0, E.lastIndexOf(".")), W.add(this.options.textNodeName, _), this.addChild(m, W, E, Y);
1145
- } else {
1146
- if (k.length > 0 && k.lastIndexOf("/") === k.length - 1) {
1147
- if (I[I.length - 1] === "/" ? (I = I.substr(0, I.length - 1), E = E.substr(0, E.length - 1), k = I) : k = k.substr(0, k.length - 1), this.options.transformTagName) {
1148
- const W = this.options.transformTagName(I);
1149
- k === I && (k = W), I = W;
1150
- }
1151
- const _ = new n(I);
1152
- I !== k && L && (_[":@"] = this.buildAttributesMap(k, E, I)), this.addChild(m, _, E, Y), E = E.substr(0, E.lastIndexOf("."));
1153
- } else if (this.options.unpairedTags.indexOf(I) !== -1) {
1154
- const _ = new n(I);
1155
- I !== k && L && (_[":@"] = this.buildAttributesMap(k, E)), this.addChild(m, _, E, Y), E = E.substr(0, E.lastIndexOf(".")), F = S.closeIndex;
1156
- continue;
1157
- } else {
1158
- const _ = new n(I);
1159
- if (this.tagsNodeStack.length > this.options.maxNestedTags)
1160
- throw new Error("Maximum nested tags exceeded");
1161
- this.tagsNodeStack.push(m), I !== k && L && (_[":@"] = this.buildAttributesMap(k, E, I)), this.addChild(m, _, E), m = _;
1162
- }
1163
- w = "", F = te;
1164
- }
1165
- }
1166
- else
1167
- w += g[F];
1168
- return C.child;
1169
- };
1170
- function p(g, C, m, w) {
1171
- this.options.captureMetaData || (w = void 0);
1172
- const E = this.options.updateTag(C.tagname, m, C[":@"]);
1173
- E === !1 || (typeof E == "string" && (C.tagname = E), g.addChild(C, w));
1174
- }
1175
- const h = function(g, C, m) {
1176
- if (g.indexOf("&") === -1)
1177
- return g;
1178
- const w = this.options.processEntities;
1179
- if (!w.enabled || w.allowedTags && !w.allowedTags.includes(C) || w.tagFilter && !w.tagFilter(C, m))
1180
- return g;
1181
- for (let E in this.docTypeEntities) {
1182
- const T = this.docTypeEntities[E], F = g.match(T.regx);
1183
- if (F) {
1184
- if (this.entityExpansionCount += F.length, w.maxTotalExpansions && this.entityExpansionCount > w.maxTotalExpansions)
1185
- throw new Error(
1186
- `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${w.maxTotalExpansions}`
1187
- );
1188
- const M = g.length;
1189
- if (g = g.replace(T.regx, T.val), w.maxExpandedLength && (this.currentExpandedLength += g.length - M, this.currentExpandedLength > w.maxExpandedLength))
1190
- throw new Error(
1191
- `Total expanded content size exceeded: ${this.currentExpandedLength} > ${w.maxExpandedLength}`
1192
- );
1193
- }
1194
- }
1195
- if (g.indexOf("&") === -1) return g;
1196
- for (const E of Object.keys(this.lastEntities)) {
1197
- const T = this.lastEntities[E], F = g.match(T.regex);
1198
- if (F && (this.entityExpansionCount += F.length, w.maxTotalExpansions && this.entityExpansionCount > w.maxTotalExpansions))
1199
- throw new Error(
1200
- `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${w.maxTotalExpansions}`
1201
- );
1202
- g = g.replace(T.regex, T.val);
1203
- }
1204
- if (g.indexOf("&") === -1) return g;
1205
- if (this.options.htmlEntities)
1206
- for (const E of Object.keys(this.htmlEntities)) {
1207
- const T = this.htmlEntities[E], F = g.match(T.regex);
1208
- if (F && (this.entityExpansionCount += F.length, w.maxTotalExpansions && this.entityExpansionCount > w.maxTotalExpansions))
1209
- throw new Error(
1210
- `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${w.maxTotalExpansions}`
1211
- );
1212
- g = g.replace(T.regex, T.val);
1213
- }
1214
- return g = g.replace(this.ampEntity.regex, this.ampEntity.val), g;
1215
- };
1216
- function b(g, C, m, w) {
1217
- return g && (w === void 0 && (w = C.child.length === 0), g = this.parseTextData(
1218
- g,
1219
- C.tagname,
1220
- m,
1221
- !1,
1222
- C[":@"] ? Object.keys(C[":@"]).length !== 0 : !1,
1223
- w
1224
- ), g !== void 0 && g !== "" && C.add(this.options.textNodeName, g), g = ""), g;
1225
- }
1226
- function N(g, C, m, w) {
1227
- return !!(C && C.has(w) || g && g.has(m));
1228
- }
1229
- function A(g, C, m = ">") {
1230
- let w, E = "";
1231
- for (let T = C; T < g.length; T++) {
1232
- let F = g[T];
1233
- if (w)
1234
- F === w && (w = "");
1235
- else if (F === '"' || F === "'")
1236
- w = F;
1237
- else if (F === m[0])
1238
- if (m[1]) {
1239
- if (g[T + 1] === m[1])
1240
- return {
1241
- data: E,
1242
- index: T
1243
- };
1244
- } else
1245
- return {
1246
- data: E,
1247
- index: T
1248
- };
1249
- else F === " " && (F = " ");
1250
- E += F;
1251
- }
1252
- }
1253
- function d(g, C, m, w) {
1254
- const E = g.indexOf(C, m);
1255
- if (E === -1)
1256
- throw new Error(w);
1257
- return E + C.length - 1;
1258
- }
1259
- function y(g, C, m, w = ">") {
1260
- const E = A(g, C + 1, w);
1261
- if (!E) return;
1262
- let T = E.data;
1263
- const F = E.index, M = T.search(/\s/);
1264
- let S = T, I = !0;
1265
- M !== -1 && (S = T.substring(0, M), T = T.substring(M + 1).trimStart());
1266
- const $ = S;
1267
- if (m) {
1268
- const k = S.indexOf(":");
1269
- k !== -1 && (S = S.substr(k + 1), I = S !== E.data.substr(k + 1));
1270
- }
1271
- return {
1272
- tagName: S,
1273
- tagExp: T,
1274
- closeIndex: F,
1275
- attrExpPresent: I,
1276
- rawTagName: $
1277
- };
1278
- }
1279
- function x(g, C, m) {
1280
- const w = m;
1281
- let E = 1;
1282
- for (; m < g.length; m++)
1283
- if (g[m] === "<")
1284
- if (g[m + 1] === "/") {
1285
- const T = d(g, ">", m, `${C} is not closed`);
1286
- if (g.substring(m + 2, T).trim() === C && (E--, E === 0))
1287
- return {
1288
- tagContent: g.substring(w, m),
1289
- i: T
1290
- };
1291
- m = T;
1292
- } else if (g[m + 1] === "?")
1293
- m = d(g, "?>", m + 1, "StopNode is not closed.");
1294
- else if (g.substr(m + 1, 3) === "!--")
1295
- m = d(g, "-->", m + 3, "StopNode is not closed.");
1296
- else if (g.substr(m + 1, 2) === "![")
1297
- m = d(g, "]]>", m, "StopNode is not closed.") - 2;
1298
- else {
1299
- const T = y(g, m, ">");
1300
- T && ((T && T.tagName) === C && T.tagExp[T.tagExp.length - 1] !== "/" && E++, m = T.closeIndex);
1301
- }
1302
- }
1303
- function P(g, C, m) {
1304
- if (C && typeof g == "string") {
1305
- const w = g.trim();
1306
- return w === "true" ? !0 : w === "false" ? !1 : i(g, m);
1307
- } else
1308
- return t.isExist(g) ? g : "";
1309
- }
1310
- function O(g, C, m) {
1311
- const w = Number.parseInt(g, C);
1312
- return w >= 0 && w <= 1114111 ? String.fromCodePoint(w) : m + g + ";";
1313
- }
1314
- function v(g, C) {
1315
- if (t.criticalProperties.includes(g))
1316
- throw new Error(`[SECURITY] Invalid name: "${g}" is a reserved JavaScript keyword that could cause prototype pollution`);
1317
- return t.DANGEROUS_PROPERTY_NAMES.includes(g) ? C.onDangerousProperty(g) : g;
1318
- }
1319
- return be = u, be;
1320
- }
1321
- var Ee = {}, Ze;
1322
- function Yt() {
1323
- if (Ze) return Ee;
1324
- Ze = 1;
1325
- function t(u, s) {
1326
- return n(u, s);
1327
- }
1328
- function n(u, s, e) {
1329
- let o;
1330
- const l = {};
1331
- for (let c = 0; c < u.length; c++) {
1332
- const f = u[c], p = r(f);
1333
- let h = "";
1334
- if (e === void 0 ? h = p : h = e + "." + p, p === s.textNodeName)
1335
- o === void 0 ? o = f[p] : o += "" + f[p];
1336
- else {
1337
- if (p === void 0)
1338
- continue;
1339
- if (f[p]) {
1340
- let b = n(f[p], s, h);
1341
- const N = a(b, s);
1342
- f[":@"] ? i(b, f[":@"], h, s) : Object.keys(b).length === 1 && b[s.textNodeName] !== void 0 && !s.alwaysCreateTextNode ? b = b[s.textNodeName] : Object.keys(b).length === 0 && (s.alwaysCreateTextNode ? b[s.textNodeName] = "" : b = ""), l[p] !== void 0 && l.hasOwnProperty(p) ? (Array.isArray(l[p]) || (l[p] = [l[p]]), l[p].push(b)) : s.isArray(p, h, N) ? l[p] = [b] : l[p] = b;
1343
- }
1344
- }
1345
- }
1346
- return typeof o == "string" ? o.length > 0 && (l[s.textNodeName] = o) : o !== void 0 && (l[s.textNodeName] = o), l;
1347
- }
1348
- function r(u) {
1349
- const s = Object.keys(u);
1350
- for (let e = 0; e < s.length; e++) {
1351
- const o = s[e];
1352
- if (o !== ":@") return o;
1353
- }
1354
- }
1355
- function i(u, s, e, o) {
1356
- if (s) {
1357
- const l = Object.keys(s), c = l.length;
1358
- for (let f = 0; f < c; f++) {
1359
- const p = l[f];
1360
- o.isArray(p, e + "." + p, !0, !0) ? u[p] = [s[p]] : u[p] = s[p];
1361
- }
1362
- }
1363
- }
1364
- function a(u, s) {
1365
- const { textNodeName: e } = s, o = Object.keys(u).length;
1366
- return !!(o === 0 || o === 1 && (u[e] || typeof u[e] == "boolean" || u[e] === 0));
1367
- }
1368
- return Ee.prettify = t, Ee;
1369
- }
1370
- var Ne, Ke;
1371
- function Jt() {
1372
- if (Ke) return Ne;
1373
- Ke = 1;
1374
- const { buildOptions: t } = qt(), n = Ht(), { prettify: r } = Yt(), i = yt();
1375
- class a {
1376
- constructor(s) {
1377
- this.externalEntities = {}, this.options = t(s);
1378
- }
1379
- /**
1380
- * Parse XML dats to JS object
1381
- * @param {string|Buffer} xmlData
1382
- * @param {boolean|Object} validationOption
1383
- */
1384
- parse(s, e) {
1385
- if (typeof s != "string") if (s.toString)
1386
- s = s.toString();
1387
- else
1388
- throw new Error("XML data is accepted in String or Bytes[] form.");
1389
- if (e) {
1390
- e === !0 && (e = {});
1391
- const c = i.validate(s, e);
1392
- if (c !== !0)
1393
- throw Error(`${c.err.msg}:${c.err.line}:${c.err.col}`);
1394
- }
1395
- const o = new n(this.options);
1396
- o.addExternalEntities(this.externalEntities);
1397
- const l = o.parseXml(s);
1398
- return this.options.preserveOrder || l === void 0 ? l : r(l, this.options);
1399
- }
1400
- /**
1401
- * Add Entity which is not by default supported by this library
1402
- * @param {string} key
1403
- * @param {string} value
1404
- */
1405
- addEntity(s, e) {
1406
- if (e.indexOf("&") !== -1)
1407
- throw new Error("Entity value can't have '&'");
1408
- if (s.indexOf("&") !== -1 || s.indexOf(";") !== -1)
1409
- throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
1410
- if (e === "&")
1411
- throw new Error("An entity with value '&' is not permitted");
1412
- this.externalEntities[s] = e;
1413
- }
1414
- }
1415
- return Ne = a, Ne;
1416
- }
1417
- var we, Qe;
1418
- function Zt() {
1419
- if (Qe) return we;
1420
- Qe = 1;
1421
- const t = `
1422
- `;
1423
- function n(e, o) {
1424
- let l = "";
1425
- return o.format && o.indentBy.length > 0 && (l = t), r(e, o, "", l);
1426
- }
1427
- function r(e, o, l, c) {
1428
- let f = "", p = !1;
1429
- if (!Array.isArray(e)) {
1430
- if (e != null) {
1431
- let h = e.toString();
1432
- return h = s(h, o), h;
1433
- }
1434
- return "";
1435
- }
1436
- for (let h = 0; h < e.length; h++) {
1437
- const b = e[h], N = i(b);
1438
- if (N === void 0) continue;
1439
- let A = "";
1440
- if (l.length === 0 ? A = N : A = `${l}.${N}`, N === o.textNodeName) {
1441
- let O = b[N];
1442
- u(A, o) || (O = o.tagValueProcessor(N, O), O = s(O, o)), p && (f += c), f += O, p = !1;
1443
- continue;
1444
- } else if (N === o.cdataPropName) {
1445
- p && (f += c), f += `<![CDATA[${b[N][0][o.textNodeName]}]]>`, p = !1;
1446
- continue;
1447
- } else if (N === o.commentPropName) {
1448
- f += c + `<!--${b[N][0][o.textNodeName]}-->`, p = !0;
1449
- continue;
1450
- } else if (N[0] === "?") {
1451
- const O = a(b[":@"], o), v = N === "?xml" ? "" : c;
1452
- let g = b[N][0][o.textNodeName];
1453
- g = g.length !== 0 ? " " + g : "", f += v + `<${N}${g}${O}?>`, p = !0;
1454
- continue;
1455
- }
1456
- let d = c;
1457
- d !== "" && (d += o.indentBy);
1458
- const y = a(b[":@"], o), x = c + `<${N}${y}`, P = r(b[N], o, A, d);
1459
- o.unpairedTags.indexOf(N) !== -1 ? o.suppressUnpairedNode ? f += x + ">" : f += x + "/>" : (!P || P.length === 0) && o.suppressEmptyNode ? f += x + "/>" : P && P.endsWith(">") ? f += x + `>${P}${c}</${N}>` : (f += x + ">", P && c !== "" && (P.includes("/>") || P.includes("</")) ? f += c + o.indentBy + P + c : f += P, f += `</${N}>`), p = !0;
1460
- }
1461
- return f;
1462
- }
1463
- function i(e) {
1464
- const o = Object.keys(e);
1465
- for (let l = 0; l < o.length; l++) {
1466
- const c = o[l];
1467
- if (Object.prototype.hasOwnProperty.call(e, c) && c !== ":@")
1468
- return c;
1469
- }
1470
- }
1471
- function a(e, o) {
1472
- let l = "";
1473
- if (e && !o.ignoreAttributes)
1474
- for (let c in e) {
1475
- if (!Object.prototype.hasOwnProperty.call(e, c)) continue;
1476
- let f = o.attributeValueProcessor(c, e[c]);
1477
- f = s(f, o), f === !0 && o.suppressBooleanAttributes ? l += ` ${c.substr(o.attributeNamePrefix.length)}` : l += ` ${c.substr(o.attributeNamePrefix.length)}="${f}"`;
1478
- }
1479
- return l;
1480
- }
1481
- function u(e, o) {
1482
- e = e.substr(0, e.length - o.textNodeName.length - 1);
1483
- let l = e.substr(e.lastIndexOf(".") + 1);
1484
- for (let c in o.stopNodes)
1485
- if (o.stopNodes[c] === e || o.stopNodes[c] === "*." + l) return !0;
1486
- return !1;
1487
- }
1488
- function s(e, o) {
1489
- if (e && e.length > 0 && o.processEntities)
1490
- for (let l = 0; l < o.entities.length; l++) {
1491
- const c = o.entities[l];
1492
- e = e.replace(c.regex, c.val);
1493
- }
1494
- return e;
1495
- }
1496
- return we = n, we;
1497
- }
1498
- var ve, De;
1499
- function Kt() {
1500
- if (De) return ve;
1501
- De = 1;
1502
- const t = Zt(), n = bt(), r = {
1503
- attributeNamePrefix: "@_",
1504
- attributesGroupName: !1,
1505
- textNodeName: "#text",
1506
- ignoreAttributes: !0,
1507
- cdataPropName: !1,
1508
- format: !1,
1509
- indentBy: " ",
1510
- suppressEmptyNode: !1,
1511
- suppressUnpairedNode: !0,
1512
- suppressBooleanAttributes: !0,
1513
- tagValueProcessor: function(e, o) {
1514
- return o;
1515
- },
1516
- attributeValueProcessor: function(e, o) {
1517
- return o;
1518
- },
1519
- preserveOrder: !1,
1520
- commentPropName: !1,
1521
- unpairedTags: [],
1522
- entities: [
1523
- { regex: new RegExp("&", "g"), val: "&amp;" },
1524
- //it must be on top
1525
- { regex: new RegExp(">", "g"), val: "&gt;" },
1526
- { regex: new RegExp("<", "g"), val: "&lt;" },
1527
- { regex: new RegExp("'", "g"), val: "&apos;" },
1528
- { regex: new RegExp('"', "g"), val: "&quot;" }
1529
- ],
1530
- processEntities: !0,
1531
- stopNodes: [],
1532
- // transformTagName: false,
1533
- // transformAttributeName: false,
1534
- oneListGroup: !1
1535
- };
1536
- function i(e) {
1537
- this.options = Object.assign({}, r, e), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
1538
- return !1;
1539
- } : (this.ignoreAttributesFn = n(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = s), this.processTextOrObjNode = a, this.options.format ? (this.indentate = u, this.tagEndChar = `>
1540
- `, this.newLine = `
1541
- `) : (this.indentate = function() {
1542
- return "";
1543
- }, this.tagEndChar = ">", this.newLine = "");
1544
- }
1545
- i.prototype.build = function(e) {
1546
- return this.options.preserveOrder ? t(e, this.options) : (Array.isArray(e) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (e = {
1547
- [this.options.arrayNodeName]: e
1548
- }), this.j2x(e, 0, []).val);
1549
- }, i.prototype.j2x = function(e, o, l) {
1550
- let c = "", f = "";
1551
- const p = l.join(".");
1552
- for (let h in e)
1553
- if (Object.prototype.hasOwnProperty.call(e, h))
1554
- if (typeof e[h] > "u")
1555
- this.isAttribute(h) && (f += "");
1556
- else if (e[h] === null)
1557
- this.isAttribute(h) || h === this.options.cdataPropName ? f += "" : h[0] === "?" ? f += this.indentate(o) + "<" + h + "?" + this.tagEndChar : f += this.indentate(o) + "<" + h + "/" + this.tagEndChar;
1558
- else if (e[h] instanceof Date)
1559
- f += this.buildTextValNode(e[h], h, "", o);
1560
- else if (typeof e[h] != "object") {
1561
- const b = this.isAttribute(h);
1562
- if (b && !this.ignoreAttributesFn(b, p))
1563
- c += this.buildAttrPairStr(b, "" + e[h]);
1564
- else if (!b)
1565
- if (h === this.options.textNodeName) {
1566
- let N = this.options.tagValueProcessor(h, "" + e[h]);
1567
- f += this.replaceEntitiesValue(N);
1568
- } else
1569
- f += this.buildTextValNode(e[h], h, "", o);
1570
- } else if (Array.isArray(e[h])) {
1571
- const b = e[h].length;
1572
- let N = "", A = "";
1573
- for (let d = 0; d < b; d++) {
1574
- const y = e[h][d];
1575
- if (!(typeof y > "u")) if (y === null)
1576
- h[0] === "?" ? f += this.indentate(o) + "<" + h + "?" + this.tagEndChar : f += this.indentate(o) + "<" + h + "/" + this.tagEndChar;
1577
- else if (typeof y == "object")
1578
- if (this.options.oneListGroup) {
1579
- const x = this.j2x(y, o + 1, l.concat(h));
1580
- N += x.val, this.options.attributesGroupName && y.hasOwnProperty(this.options.attributesGroupName) && (A += x.attrStr);
1581
- } else
1582
- N += this.processTextOrObjNode(y, h, o, l);
1583
- else if (this.options.oneListGroup) {
1584
- let x = this.options.tagValueProcessor(h, y);
1585
- x = this.replaceEntitiesValue(x), N += x;
1586
- } else
1587
- N += this.buildTextValNode(y, h, "", o);
1588
- }
1589
- this.options.oneListGroup && (N = this.buildObjectNode(N, h, A, o)), f += N;
1590
- } else if (this.options.attributesGroupName && h === this.options.attributesGroupName) {
1591
- const b = Object.keys(e[h]), N = b.length;
1592
- for (let A = 0; A < N; A++)
1593
- c += this.buildAttrPairStr(b[A], "" + e[h][b[A]]);
1594
- } else
1595
- f += this.processTextOrObjNode(e[h], h, o, l);
1596
- return { attrStr: c, val: f };
1597
- }, i.prototype.buildAttrPairStr = function(e, o) {
1598
- return o = this.options.attributeValueProcessor(e, "" + o), o = this.replaceEntitiesValue(o), this.options.suppressBooleanAttributes && o === "true" ? " " + e : " " + e + '="' + o + '"';
1599
- };
1600
- function a(e, o, l, c) {
1601
- const f = this.j2x(e, l + 1, c.concat(o));
1602
- return e[this.options.textNodeName] !== void 0 && Object.keys(e).length === 1 ? this.buildTextValNode(e[this.options.textNodeName], o, f.attrStr, l) : this.buildObjectNode(f.val, o, f.attrStr, l);
1603
- }
1604
- i.prototype.buildObjectNode = function(e, o, l, c) {
1605
- if (e === "")
1606
- return o[0] === "?" ? this.indentate(c) + "<" + o + l + "?" + this.tagEndChar : this.indentate(c) + "<" + o + l + this.closeTag(o) + this.tagEndChar;
1607
- {
1608
- let f = "</" + o + this.tagEndChar, p = "";
1609
- return o[0] === "?" && (p = "?", f = ""), (l || l === "") && e.indexOf("<") === -1 ? this.indentate(c) + "<" + o + l + p + ">" + e + f : this.options.commentPropName !== !1 && o === this.options.commentPropName && p.length === 0 ? this.indentate(c) + `<!--${e}-->` + this.newLine : this.indentate(c) + "<" + o + l + p + this.tagEndChar + e + this.indentate(c) + f;
1610
- }
1611
- }, i.prototype.closeTag = function(e) {
1612
- let o = "";
1613
- return this.options.unpairedTags.indexOf(e) !== -1 ? this.options.suppressUnpairedNode || (o = "/") : this.options.suppressEmptyNode ? o = "/" : o = `></${e}`, o;
1614
- }, i.prototype.buildTextValNode = function(e, o, l, c) {
1615
- if (this.options.cdataPropName !== !1 && o === this.options.cdataPropName)
1616
- return this.indentate(c) + `<![CDATA[${e}]]>` + this.newLine;
1617
- if (this.options.commentPropName !== !1 && o === this.options.commentPropName)
1618
- return this.indentate(c) + `<!--${e}-->` + this.newLine;
1619
- if (o[0] === "?")
1620
- return this.indentate(c) + "<" + o + l + "?" + this.tagEndChar;
1621
- {
1622
- let f = this.options.tagValueProcessor(o, e);
1623
- return f = this.replaceEntitiesValue(f), f === "" ? this.indentate(c) + "<" + o + l + this.closeTag(o) + this.tagEndChar : this.indentate(c) + "<" + o + l + ">" + f + "</" + o + this.tagEndChar;
1624
- }
1625
- }, i.prototype.replaceEntitiesValue = function(e) {
1626
- if (e && e.length > 0 && this.options.processEntities)
1627
- for (let o = 0; o < this.options.entities.length; o++) {
1628
- const l = this.options.entities[o];
1629
- e = e.replace(l.regex, l.val);
1630
- }
1631
- return e;
1632
- };
1633
- function u(e) {
1634
- return this.options.indentBy.repeat(e);
1635
- }
1636
- function s(e) {
1637
- return e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName ? e.substr(this.attrPrefixLen) : !1;
1638
- }
1639
- return ve = i, ve;
1640
- }
1641
- var xe, et;
1642
- function Qt() {
1643
- if (et) return xe;
1644
- et = 1;
1645
- const t = yt(), n = Jt(), r = Kt();
1646
- return xe = {
1647
- XMLParser: n,
1648
- XMLValidator: t,
1649
- XMLBuilder: r
1650
- }, xe;
1651
- }
1652
- var Dt = Qt();
1653
- const en = new Dt.XMLParser({
1654
- ignoreAttributes: !1,
1655
- attributeNamePrefix: "@_",
1656
- removeNSPrefix: !0,
1657
- // 去掉命名空间前缀(a: / c: / xdr:),统一节点名
1658
- allowBooleanAttributes: !0,
1659
- parseAttributeValue: !0,
1660
- trimValues: !0,
1661
- // 放宽实体展开上限:大表(几百个 DISPIMG 格,每个含 &quot;)会超 fxp 默认 1000 上限而抛错,
1662
- // 导致 drawing-parser / row-meta 在大表上静默失败。本地解析可信 xlsx,放宽到足够大。
1663
- processEntities: {
1664
- enabled: !0,
1665
- maxEntitySize: 1e7,
1666
- maxTotalExpansions: 1e8,
1667
- maxExpandedLength: 1e8,
1668
- maxEntityCount: 1e7
1669
- }
1670
- });
1671
- function tn(t) {
1672
- const n = Gt(new Uint8Array(t)), r = /* @__PURE__ */ new Map(), i = (a) => a.replace(/^\//, "");
1673
- return {
1674
- files: n,
1675
- bytes(a) {
1676
- return n[i(a)];
1677
- },
1678
- text(a) {
1679
- const u = n[i(a)];
1680
- return u ? ke(u) : void 0;
1681
- },
1682
- parse(a) {
1683
- const u = i(a);
1684
- if (r.has(u)) return r.get(u);
1685
- const s = n[u];
1686
- if (!s) return;
1687
- const e = en.parse(ke(s));
1688
- return r.set(u, e), e;
1689
- },
1690
- list(a) {
1691
- const u = i(a);
1692
- return Object.keys(n).filter((s) => s.startsWith(u));
1693
- }
1694
- };
1695
- }
1696
- function J(t, n) {
1697
- var e;
1698
- const r = n.includes("/") ? n.slice(0, n.lastIndexOf("/")) : "", i = r ? `${r}/_rels/${se(n)}.rels` : `_rels/${se(n)}.rels`, a = t.parse(i), u = {};
1699
- if (!((e = a == null ? void 0 : a.Relationships) != null && e.Relationship)) return u;
1700
- const s = V(a.Relationships.Relationship);
1701
- for (const o of s) {
1702
- const l = o["@_Id"];
1703
- let c = o["@_Target"];
1704
- !l || !c || (o["@_TargetMode"] === "External" ? u[l] = c : u[l] = nn(r, c));
1705
- }
1706
- return u;
1707
- }
1708
- function se(t) {
1709
- return t.slice(t.lastIndexOf("/") + 1);
1710
- }
1711
- function nn(t, n) {
1712
- if (n.startsWith("/")) return n.slice(1);
1713
- const r = t ? t.split("/") : [];
1714
- for (const i of n.split("/"))
1715
- if (i === "..") r.pop();
1716
- else {
1717
- if (i === "." || i === "") continue;
1718
- r.push(i);
1719
- }
1720
- return r.join("/");
1721
- }
1722
- function V(t) {
1723
- return t == null ? [] : Array.isArray(t) ? t : [t];
1724
- }
1725
- const Ce = [
1726
- "#FFFFFF",
1727
- // 0 lt1 (bg1)
1728
- "#000000",
1729
- // 1 dk1 (tx1)
1730
- "#E7E6E6",
1731
- // 2 lt2 (bg2)
1732
- "#44546A",
1733
- // 3 dk2 (tx2)
1734
- "#4472C4",
1735
- // 4 accent1
1736
- "#ED7D31",
1737
- // 5 accent2
1738
- "#A5A5A5",
1739
- // 6 accent3
1740
- "#FFC000",
1741
- // 7 accent4
1742
- "#5B9BD5",
1743
- // 8 accent5
1744
- "#70AD47",
1745
- // 9 accent6
1746
- "#0563C1",
1747
- // 10 hlink
1748
- "#954F72"
1749
- // 11 folHlink
1750
- ];
1751
- function rn(t) {
1752
- var n, r;
1753
- try {
1754
- const i = t.parse("xl/theme/theme1.xml"), a = (r = (n = i == null ? void 0 : i.theme) == null ? void 0 : n.themeElements) == null ? void 0 : r.clrScheme;
1755
- if (!a) return [...Ce];
1756
- const u = (b) => {
1757
- if (b) {
1758
- if (b.srgbClr) return "#" + String(b.srgbClr["@_val"]).toUpperCase();
1759
- if (b.sysClr) {
1760
- const N = b.sysClr["@_lastClr"];
1761
- if (N) return "#" + String(N).toUpperCase();
1762
- }
1763
- }
1764
- }, s = u(a.dk1), e = u(a.lt1), o = u(a.dk2), l = u(a.lt2), c = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"].map(
1765
- (b) => u(a[b])
1766
- ), f = u(a.hlink), p = u(a.folHlink);
1767
- return [e, s, l, o, ...c, f, p].map((b, N) => b ?? Ce[N] ?? "#000000");
1768
- } catch {
1769
- return [...Ce];
1770
- }
1771
- }
1772
- const Et = (t, n) => `${t}:${n}`, tt = [
1773
- "#000000",
1774
- "#FFFFFF",
1775
- "#FF0000",
1776
- "#00FF00",
1777
- "#0000FF",
1778
- "#FFFF00",
1779
- "#FF00FF",
1780
- "#00FFFF",
1781
- "#000000",
1782
- "#FFFFFF",
1783
- "#FF0000",
1784
- "#00FF00",
1785
- "#0000FF",
1786
- "#FFFF00",
1787
- "#FF00FF",
1788
- "#00FFFF",
1789
- "#800000",
1790
- "#008000",
1791
- "#000080",
1792
- "#808000",
1793
- "#800080",
1794
- "#008080",
1795
- "#C0C0C0",
1796
- "#808080",
1797
- "#9999FF",
1798
- "#993366",
1799
- "#FFFFCC",
1800
- "#CCFFFF",
1801
- "#660066",
1802
- "#FF8080",
1803
- "#0066CC",
1804
- "#CCCCFF",
1805
- "#000080",
1806
- "#FF00FF",
1807
- "#FFFF00",
1808
- "#00FFFF",
1809
- "#800080",
1810
- "#800000",
1811
- "#008080",
1812
- "#0000FF",
1813
- "#00CCFF",
1814
- "#CCFFFF",
1815
- "#CCFFCC",
1816
- "#FFFF99",
1817
- "#99CCFF",
1818
- "#FF99CC",
1819
- "#CC99FF",
1820
- "#FFCC99",
1821
- "#3366FF",
1822
- "#33CCCC",
1823
- "#99CC00",
1824
- "#FFCC00",
1825
- "#FF9900",
1826
- "#FF6600",
1827
- "#666699",
1828
- "#969696",
1829
- "#003366",
1830
- "#339966",
1831
- "#003300",
1832
- "#333300",
1833
- "#993300",
1834
- "#993366",
1835
- "#333399",
1836
- "#333333"
1837
- ];
1838
- function nt(t) {
1839
- if (!t) return;
1840
- let n = t.replace(/^#/, "");
1841
- if (n.length === 8) {
1842
- const r = parseInt(n.slice(0, 2), 16) / 255, i = parseInt(n.slice(2, 4), 16), a = parseInt(n.slice(4, 6), 16), u = parseInt(n.slice(6, 8), 16);
1843
- return r >= 1 ? `#${n.slice(2)}` : `rgba(${i},${a},${u},${+r.toFixed(3)})`;
1844
- }
1845
- if (n.length === 6) return `#${n}`;
1846
- }
1847
- function sn(t) {
1848
- if (t >= 0 && t < tt.length) return tt[t];
1849
- }
1850
- function on(t, n, r = 0) {
1851
- const i = t[n];
1852
- if (i)
1853
- return r ? an(i, r) : i;
1854
- }
1855
- function an(t, n) {
1856
- const r = un(t);
1857
- if (!r) return t;
1858
- const i = cn(r.r, r.g, r.b);
1859
- let a = i.l;
1860
- n < 0 ? a = a * (1 + n) : a = a * (1 - n) + n;
1861
- const u = pn(i.h, i.s, ln(a));
1862
- return fn(u.r, u.g, u.b);
1863
- }
1864
- function j(t, n) {
1865
- if (t) {
1866
- if (typeof t == "string") return nt(t);
1867
- if (typeof t.argb == "string") return nt(t.argb);
1868
- if (typeof t.theme == "number") return on(n, t.theme, t.tint ?? 0);
1869
- if (typeof t.indexed == "number") return sn(t.indexed);
1870
- }
1871
- }
1872
- function ln(t) {
1873
- return Math.min(1, Math.max(0, t));
1874
- }
1875
- function un(t) {
1876
- const n = /^#?([0-9a-f]{6})$/i.exec(t);
1877
- if (!n) return null;
1878
- const r = parseInt(n[1], 16);
1879
- return { r: r >> 16 & 255, g: r >> 8 & 255, b: r & 255 };
1880
- }
1881
- function fn(t, n, r) {
1882
- const i = (a) => Math.round(a).toString(16).padStart(2, "0");
1883
- return `#${i(t)}${i(n)}${i(r)}`;
1884
- }
1885
- function cn(t, n, r) {
1886
- t /= 255, n /= 255, r /= 255;
1887
- const i = Math.max(t, n, r), a = Math.min(t, n, r);
1888
- let u = 0, s = 0;
1889
- const e = (i + a) / 2;
1890
- if (i !== a) {
1891
- const o = i - a;
1892
- switch (s = e > 0.5 ? o / (2 - i - a) : o / (i + a), i) {
1893
- case t:
1894
- u = (n - r) / o + (n < r ? 6 : 0);
1895
- break;
1896
- case n:
1897
- u = (r - t) / o + 2;
1898
- break;
1899
- default:
1900
- u = (t - n) / o + 4;
1901
- }
1902
- u /= 6;
1903
- }
1904
- return { h: u, s, l: e };
1905
- }
1906
- function pn(t, n, r) {
1907
- let i, a, u;
1908
- if (n === 0)
1909
- i = a = u = r;
1910
- else {
1911
- const s = (l, c, f) => (f < 0 && (f += 1), f > 1 && (f -= 1), f < 0.16666666666666666 ? l + (c - l) * 6 * f : f < 0.5 ? c : f < 0.6666666666666666 ? l + (c - l) * (0.6666666666666666 - f) * 6 : l), e = r < 0.5 ? r * (1 + n) : r + n - r * n, o = 2 * r - e;
1912
- i = s(o, e, t + 1 / 3), a = s(o, e, t), u = s(o, e, t - 1 / 3);
1913
- }
1914
- return { r: i * 255, g: a * 255, b: u * 255 };
1915
- }
1916
- const dn = 7, hn = 96 / 72, Nt = 8.43, wt = 15;
1917
- function rt(t, n = dn) {
1918
- return t == null && (t = Nt), t <= 0 ? 0 : Math.floor(t * n + 0.5) + 5;
1919
- }
1920
- function st(t) {
1921
- return Math.round((t ?? wt) * hn);
1922
- }
1923
- const Te = {
1924
- name: "Calibri",
1925
- size: 11,
1926
- bold: !1,
1927
- italic: !1,
1928
- underline: !1,
1929
- strike: !1,
1930
- color: "#000000"
1931
- };
1932
- function gn(t, n, r) {
1933
- const i = t.worksheets.reduce((e, o) => e + (o.rowCount || 0), 0) || 1;
1934
- let a = 0;
1935
- const u = r ? () => {
1936
- a++, a % 1e3 === 0 && r({ stage: "build", ratio: Math.min(1, a / i) });
1937
- } : void 0, s = [];
1938
- return t.worksheets.forEach((e, o) => {
1939
- s.push(mn(e, o, n, u));
1940
- }), r == null || r({ stage: "build", ratio: 1 }), s;
1941
- }
1942
- function mn(t, n, r, i) {
1943
- const a = [], u = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), e = (C) => {
1944
- const m = JSON.stringify(C), w = u.get(m);
1945
- if (w !== void 0) return w;
1946
- const E = a.length;
1947
- return a.push(C), u.set(m, E), E;
1948
- };
1949
- let o = 0, l = 0;
1950
- t.eachRow({ includeEmpty: !1 }, (C, m) => {
1951
- C.eachCell({ includeEmpty: !1 }, (w, E) => {
1952
- const T = m - 1, F = E - 1, M = wn(w, T, F, r, e);
1953
- M && (s.set(Et(T, F), M), T > o && (o = T), F > l && (l = F));
1954
- }), i == null || i();
1955
- });
1956
- const c = Cn(t);
1957
- for (const C of c)
1958
- o = Math.max(o, C.bottom), l = Math.max(l, C.right);
1959
- const f = /* @__PURE__ */ new Map(), p = t.properties || {}, h = rt(p.defaultColWidth ?? Nt), b = st(p.defaultRowHeight ?? wt);
1960
- for (let C = 1; C <= t.columnCount; C++) {
1961
- const m = t.getColumn(C);
1962
- m && (m.width != null || m.hidden) && f.set(C - 1, {
1963
- width: m.width != null ? rt(m.width) : h,
1964
- hidden: !!m.hidden
1965
- });
1966
- }
1967
- const N = /* @__PURE__ */ new Map();
1968
- t.eachRow({ includeEmpty: !0 }, (C, m) => {
1969
- (C.height != null || C.hidden) && N.set(m - 1, {
1970
- height: C.height != null ? st(C.height) : b,
1971
- hidden: !!C.hidden
1972
- });
1973
- });
1974
- const A = t.views && t.views[0], d = {
1975
- frozenRows: (A == null ? void 0 : A.state) === "frozen" ? A.ySplit ?? 0 : 0,
1976
- frozenCols: (A == null ? void 0 : A.state) === "frozen" ? A.xSplit ?? 0 : 0
1977
- }, y = (A == null ? void 0 : A.showGridLines) !== !1, x = Tn(t, r), P = Fn(t), O = Nn(t), v = yn(t), g = t.state === "hidden" ? "hidden" : t.state === "veryHidden" ? "veryHidden" : "visible";
1978
- return {
1979
- name: t.name,
1980
- index: n,
1981
- state: g,
1982
- dimension: { rows: o + 1, cols: l + 1 },
1983
- cells: s,
1984
- styles: a,
1985
- merges: c,
1986
- columns: f,
1987
- rows: N,
1988
- defaultColWidth: h,
1989
- defaultRowHeight: b,
1990
- freeze: d,
1991
- conditional: x,
1992
- autoFilterRange: P,
1993
- dataValidations: O,
1994
- images: [],
1995
- charts: [],
1996
- shapes: [],
1997
- sparklines: [],
1998
- pageSetup: v,
1999
- showGridLines: y
2000
- };
2001
- }
2002
- const it = {
2003
- 1: "letter",
2004
- // Letter 8.5x11
2005
- 8: "a3",
2006
- // A3 297x420
2007
- 9: "a4",
2008
- // A4 210x297
2009
- 70: "a4"
2010
- // ISO A4 (部分写法)
2011
- }, K = 25.4;
2012
- function yn(t) {
2013
- const n = t.pageSetup;
2014
- if (!n) return;
2015
- const r = {};
2016
- (n.orientation === "portrait" || n.orientation === "landscape") && (r.orientation = n.orientation), typeof n.paperSize == "number" && it[n.paperSize] && (r.paperFormat = it[n.paperSize]), typeof n.scale == "number" && n.scale > 0 && (r.scale = n.scale), n.fitToPage && (r.fitToPage = !0), typeof n.fitToWidth == "number" && (r.fitToWidth = n.fitToWidth), typeof n.fitToHeight == "number" && (r.fitToHeight = n.fitToHeight);
2017
- const i = n.margins;
2018
- if (i && typeof i == "object" && (r.margins = {
2019
- top: (i.top ?? 0.75) * K,
2020
- bottom: (i.bottom ?? 0.75) * K,
2021
- left: (i.left ?? 0.7) * K,
2022
- right: (i.right ?? 0.7) * K,
2023
- header: (i.header ?? 0.3) * K,
2024
- footer: (i.footer ?? 0.3) * K
2025
- }), typeof n.printArea == "string" && n.printArea.trim()) {
2026
- const s = n.printArea.split(",")[0], e = Z(Me(s));
2027
- e && (r.printArea = e);
2028
- }
2029
- const a = bn(n.printTitlesRow);
2030
- a && (r.printTitleRows = a);
2031
- const u = En(n.printTitlesColumn);
2032
- return u && (r.printTitleCols = u), Object.keys(r).length ? r : void 0;
2033
- }
2034
- function Me(t) {
2035
- const n = t.lastIndexOf("!");
2036
- return (n >= 0 ? t.slice(n + 1) : t).trim();
2037
- }
2038
- function bn(t) {
2039
- if (typeof t != "string" || !t.trim()) return;
2040
- const n = Me(t).replace(/\$/g, ""), r = /^(\d+):(\d+)$/.exec(n);
2041
- if (!r) return;
2042
- const i = parseInt(r[1], 10) - 1, a = parseInt(r[2], 10) - 1;
2043
- if (!(!Number.isFinite(i) || !Number.isFinite(a)))
2044
- return [Math.min(i, a), Math.max(i, a)];
2045
- }
2046
- function En(t) {
2047
- if (typeof t != "string" || !t.trim()) return;
2048
- const n = Me(t).replace(/\$/g, ""), r = /^([A-Z]+):([A-Z]+)$/i.exec(n);
2049
- if (!r) return;
2050
- const i = _e(r[1].toUpperCase()), a = _e(r[2].toUpperCase());
2051
- return [Math.min(i, a), Math.max(i, a)];
2052
- }
2053
- function Nn(t) {
2054
- var i;
2055
- const n = (i = t.dataValidations) == null ? void 0 : i.model;
2056
- if (!n) return [];
2057
- const r = [];
2058
- for (const [a, u] of Object.entries(n))
2059
- if ((u == null ? void 0 : u.type) === "list")
2060
- for (const s of a.split(/\s+/)) {
2061
- const e = Z(s);
2062
- e && r.push(e);
2063
- }
2064
- return r;
2065
- }
2066
- function wn(t, n, r, i, a) {
2067
- const u = t.value;
2068
- if (u == null) {
2069
- const h = ot(t, i);
2070
- return { row: n, col: r, type: "empty", raw: null, styleId: a(h) };
2071
- }
2072
- let s = "string", e = null, o, l, c;
2073
- if (typeof u == "number")
2074
- s = "number", e = u;
2075
- else if (typeof u == "boolean")
2076
- s = "boolean", e = u;
2077
- else if (u instanceof Date)
2078
- s = "date", e = u;
2079
- else if (typeof u == "string")
2080
- s = "string", e = u;
2081
- else if (typeof u == "object") {
2082
- const h = u;
2083
- if (h.richText)
2084
- s = "richtext", o = h.richText.map((b) => ({
2085
- text: b.text ?? "",
2086
- font: b.font ? $e(b.font, i) : void 0
2087
- })), e = o.map((b) => b.text).join("");
2088
- else if (h.formula !== void 0 || h.sharedFormula !== void 0) {
2089
- s = "formula", l = h.formula ?? h.sharedFormula;
2090
- const b = h.result;
2091
- b instanceof Date ? e = b : b && typeof b == "object" && "error" in b ? e = b.error : e = b ?? null;
2092
- } else h.hyperlink !== void 0 ? (s = "hyperlink", c = h.hyperlink, e = h.text ?? h.hyperlink) : h.error !== void 0 ? (s = "error", e = h.error) : e = String(h);
2093
- }
2094
- const f = ot(t, i), p = vn(t.note);
2095
- return { row: n, col: r, type: s, raw: e, rich: o, formula: l, hyperlink: c, comment: p, styleId: a(f) };
2096
- }
2097
- function vn(t) {
2098
- if (t) {
2099
- if (typeof t == "string") return t;
2100
- if (Array.isArray(t.texts))
2101
- return t.texts.map((r) => (r == null ? void 0 : r.text) ?? "").join("") || void 0;
2102
- if (typeof t.text == "string") return t.text;
2103
- }
2104
- }
2105
- function ot(t, n) {
2106
- const r = t.style || {}, i = r.alignment || {};
2107
- return {
2108
- font: $e(r.font, n),
2109
- fill: vt(r.fill, n),
2110
- borders: xt(r.border, n),
2111
- hAlign: i.horizontal || "general",
2112
- vAlign: xn(i.vertical),
2113
- wrapText: !!i.wrapText,
2114
- shrinkToFit: !!i.shrinkToFit,
2115
- // ExcelJS: 竖排返回 'vertical' → 255(渲染器据此走竖排堆叠);其余是 -90..90
2116
- textRotation: i.textRotation === "vertical" ? 255 : typeof i.textRotation == "number" ? i.textRotation : 0,
2117
- indent: i.indent || 0,
2118
- numFmt: r.numFmt || "General"
2119
- };
2120
- }
2121
- function $e(t, n) {
2122
- return t ? {
2123
- name: t.name || Te.name,
2124
- size: t.size || Te.size,
2125
- bold: !!t.bold,
2126
- italic: !!t.italic,
2127
- underline: !!t.underline,
2128
- strike: !!t.strike,
2129
- color: j(t.color, n) || "#000000"
2130
- } : { ...Te };
2131
- }
2132
- function vt(t, n) {
2133
- var r;
2134
- if (!t || t.type === "none") return { type: "none" };
2135
- if (t.type === "pattern") {
2136
- const i = t.pattern;
2137
- return i === "none" ? { type: "none" } : i === "solid" ? {
2138
- type: "solid",
2139
- fgColor: j(t.fgColor, n) || j(t.bgColor, n)
2140
- } : {
2141
- type: "pattern",
2142
- pattern: i,
2143
- fgColor: j(t.fgColor, n),
2144
- bgColor: j(t.bgColor, n)
2145
- };
2146
- }
2147
- if (t.type === "gradient") {
2148
- const i = (t.stops || []).map((u) => ({
2149
- position: u.position ?? 0,
2150
- color: j(u.color, n) || "#FFFFFF"
2151
- })), a = typeof t.degree == "number" ? t.degree : void 0;
2152
- return { type: "gradient", gradientStops: i, gradientAngle: a, fgColor: (r = i[0]) == null ? void 0 : r.color };
2153
- }
2154
- return { type: "none" };
2155
- }
2156
- function xt(t, n) {
2157
- if (!t) return {};
2158
- const r = (a) => a && a.style ? { style: a.style, color: j(a.color, n) || "#000000" } : void 0, i = t.diagonal;
2159
- return {
2160
- top: r(t.top),
2161
- bottom: r(t.bottom),
2162
- left: r(t.left),
2163
- right: r(t.right),
2164
- diagonal: r(i),
2165
- diagonalUp: !!(i != null && i.up),
2166
- diagonalDown: !!(i != null && i.down)
2167
- };
2168
- }
2169
- function xn(t) {
2170
- return t === "top" ? "top" : t === "middle" ? "middle" : "bottom";
2171
- }
2172
- function Cn(t) {
2173
- const n = t.model, r = (n == null ? void 0 : n.merges) || [], i = [];
2174
- for (const a of r) {
2175
- const u = Z(a);
2176
- u && i.push(u);
2177
- }
2178
- return i;
2179
- }
2180
- function Tn(t, n) {
2181
- const r = t.conditionalFormattings || [], i = [];
2182
- for (const a of r) {
2183
- const u = An(a.ref);
2184
- for (const s of a.rules || []) {
2185
- const e = {
2186
- ranges: u,
2187
- priority: s.priority ?? 0,
2188
- type: "unsupported"
2189
- };
2190
- switch (s.type) {
2191
- case "cellIs":
2192
- e.type = "cellIs", e.operator = s.operator, e.formulae = s.formulae, e.style = s.style ? Fe(s.style, n) : void 0;
2193
- break;
2194
- case "expression":
2195
- e.type = "expression", e.formulae = s.formulae, e.style = s.style ? Fe(s.style, n) : void 0;
2196
- break;
2197
- case "colorScale": {
2198
- e.type = "colorScale";
2199
- const o = (s.color || []).map((l) => j(l, n) || "#FFFFFF");
2200
- o.length === 3 ? e.colorScale = { min: o[0], mid: o[1], max: o[2] } : o.length === 2 && (e.colorScale = { min: o[0], max: o[1] });
2201
- break;
2202
- }
2203
- case "dataBar":
2204
- e.type = "dataBar", e.dataBar = {
2205
- color: j(s.color, n) || "#638EC6",
2206
- gradient: s.gradient !== !1
2207
- };
2208
- break;
2209
- case "iconSet":
2210
- e.type = "iconSet", e.iconSet = { name: s.iconSet || "3TrafficLights1" };
2211
- break;
2212
- case "top10":
2213
- e.type = "top10", e.style = s.style ? Fe(s.style, n) : void 0;
2214
- break;
2215
- }
2216
- i.push(e);
2217
- }
2218
- }
2219
- return i.sort((a, u) => a.priority - u.priority);
2220
- }
2221
- function Fe(t, n) {
2222
- const r = {};
2223
- return t.font && (r.font = $e(t.font, n)), t.fill && (r.fill = vt(t.fill, n)), t.border && (r.borders = xt(t.border, n)), r;
2224
- }
2225
- function Fn(t) {
2226
- const n = t.autoFilter;
2227
- if (n) {
2228
- if (typeof n == "string") return Z(n) || void 0;
2229
- if (n.from && n.to) {
2230
- const r = typeof n.from == "string" ? ie(n.from) : { row: n.from.row - 1, col: n.from.column - 1 }, i = typeof n.to == "string" ? ie(n.to) : { row: n.to.row - 1, col: n.to.column - 1 };
2231
- if (r && i) return { top: r.row, left: r.col, bottom: i.row, right: i.col };
2232
- }
2233
- }
2234
- }
2235
- function _e(t) {
2236
- let n = 0;
2237
- for (let r = 0; r < t.length; r++)
2238
- n = n * 26 + (t.charCodeAt(r) - 64);
2239
- return n - 1;
2240
- }
2241
- function ie(t) {
2242
- const n = /^\$?([A-Z]+)\$?(\d+)$/.exec(t.trim());
2243
- return n ? { col: _e(n[1]), row: parseInt(n[2], 10) - 1 } : null;
2244
- }
2245
- function Z(t) {
2246
- const n = t.split(":"), r = ie(n[0]), i = n[1] ? ie(n[1]) : r;
2247
- return !r || !i ? null : {
2248
- top: Math.min(r.row, i.row),
2249
- left: Math.min(r.col, i.col),
2250
- bottom: Math.max(r.row, i.row),
2251
- right: Math.max(r.col, i.col)
2252
- };
2253
- }
2254
- function An(t) {
2255
- return t ? t.split(/\s+/).map((n) => Z(n)).filter((n) => !!n) : [];
2256
- }
2257
- function In(t, n) {
2258
- var o, l;
2259
- const r = t.parse(n), i = (o = r == null ? void 0 : r.chartSpace) == null ? void 0 : o.chart;
2260
- if (!i) return;
2261
- const a = i.plotArea;
2262
- if (!a) return;
2263
- const u = Sn(i), s = !!i.legend, e = [
2264
- { key: "barChart", type: "bar" },
2265
- { key: "bar3DChart", type: "bar" },
2266
- { key: "lineChart", type: "line" },
2267
- { key: "line3DChart", type: "line" },
2268
- { key: "pieChart", type: "pie" },
2269
- { key: "pie3DChart", type: "pie" },
2270
- { key: "doughnutChart", type: "doughnut" },
2271
- { key: "areaChart", type: "area" },
2272
- { key: "area3DChart", type: "area" },
2273
- { key: "scatterChart", type: "scatter" },
2274
- { key: "radarChart", type: "radar" }
2275
- ];
2276
- for (const c of e) {
2277
- const f = a[c.key];
2278
- if (!f) continue;
2279
- const p = Array.isArray(f) ? f[0] : f;
2280
- let h = c.type, b;
2281
- c.key.startsWith("bar") && (b = ((l = p.barDir) == null ? void 0 : l["@_val"]) === "bar" ? "bar" : "col");
2282
- const { categories: N, series: A } = Pn(p, h);
2283
- return { type: h, title: u, showLegend: s, barDirection: b, categories: N, series: A };
2284
- }
2285
- return { type: "unsupported", title: u, showLegend: s, categories: [], series: [] };
2286
- }
2287
- function Sn(t) {
2288
- var a, u;
2289
- const n = (u = (a = t.title) == null ? void 0 : a.tx) == null ? void 0 : u.rich;
2290
- if (!n) return;
2291
- const r = V(n.p), i = [];
2292
- for (const s of r)
2293
- for (const e of V(s.r))
2294
- e.t != null && i.push(typeof e.t == "object" ? e.t["#text"] ?? "" : String(e.t));
2295
- return i.join("") || void 0;
2296
- }
2297
- function Pn(t, n) {
2298
- const r = V(t.ser), i = [];
2299
- let a = [];
2300
- return r.forEach((u, s) => {
2301
- var f, p, h, b, N, A, d, y, x, P, O;
2302
- let e;
2303
- const o = ((p = (f = u.tx) == null ? void 0 : f.strRef) == null ? void 0 : p.strCache) ?? ((h = u.tx) == null ? void 0 : h.v);
2304
- if ((N = (b = u.tx) == null ? void 0 : b.strRef) != null && N.strCache ? e = at(u.tx.strRef.strCache)[0] : typeof o == "string" && (e = o), s === 0) {
2305
- const v = u.cat;
2306
- if (v) {
2307
- const g = (A = v.strRef) != null && A.strCache ? at(v.strRef.strCache) : null, C = (d = v.numRef) != null && d.numCache ? Ae(v.numRef.numCache) : null;
2308
- a = g ?? (C ?? []).map((m) => m ?? "");
2309
- }
2310
- }
2311
- let l = [];
2312
- if (n === "scatter") {
2313
- const v = (x = (y = u.yVal) == null ? void 0 : y.numRef) == null ? void 0 : x.numCache;
2314
- l = v ? Ae(v) : [];
2315
- } else {
2316
- const v = (O = (P = u.val) == null ? void 0 : P.numRef) == null ? void 0 : O.numCache;
2317
- l = v ? Ae(v) : [];
2318
- }
2319
- const c = On(u);
2320
- i.push({ name: e, values: l, color: c });
2321
- }), { categories: a, series: i };
2322
- }
2323
- function at(t) {
2324
- const n = V(t.pt), r = [];
2325
- for (const i of n) {
2326
- const a = Number(i["@_idx"] ?? r.length);
2327
- r[a] = i.v != null ? typeof i.v == "object" ? i.v["#text"] ?? "" : String(i.v) : "";
2328
- }
2329
- return Array.from(r, (i) => i ?? "");
2330
- }
2331
- function Ae(t) {
2332
- const n = V(t.pt), r = Number(t["@_count"] ?? n.length), i = new Array(r).fill(null);
2333
- for (const a of n) {
2334
- const u = Number(a["@_idx"] ?? 0), s = a.v;
2335
- i[u] = s == null || s === "" ? null : Number(s);
2336
- }
2337
- return i;
2338
- }
2339
- function On(t) {
2340
- var r, i;
2341
- const n = (r = t.spPr) == null ? void 0 : r.solidFill;
2342
- if ((i = n == null ? void 0 : n.srgbClr) != null && i["@_val"]) return "#" + String(n.srgbClr["@_val"]).toUpperCase();
2343
- }
2344
- const kn = {
2345
- png: "image/png",
2346
- jpg: "image/jpeg",
2347
- jpeg: "image/jpeg",
2348
- gif: "image/gif",
2349
- bmp: "image/bmp",
2350
- svg: "image/svg+xml",
2351
- webp: "image/webp"
2352
- };
2353
- function _n(t, n) {
2354
- var s, e, o, l;
2355
- const r = t.parse("xl/workbook.xml"), i = V((e = (s = r == null ? void 0 : r.workbook) == null ? void 0 : s.sheets) == null ? void 0 : e.sheet), a = J(t, "xl/workbook.xml"), u = /* @__PURE__ */ new Map();
2356
- for (const c of i) {
2357
- const f = c["@_name"], p = c["@_id"];
2358
- f && p && a[p] && u.set(String(f), a[p]);
2359
- }
2360
- for (const c of n) {
2361
- const f = u.get(c.name);
2362
- if (!f) continue;
2363
- const p = J(t, f), h = t.parse(f), b = (o = h == null ? void 0 : h.worksheet) == null ? void 0 : o.drawing, N = Array.isArray(b) ? (l = b[0]) == null ? void 0 : l["@_id"] : b == null ? void 0 : b["@_id"];
2364
- if (!N || !p[N]) continue;
2365
- const A = p[N];
2366
- Rn(t, A, c);
2367
- }
2368
- }
2369
- function Rn(t, n, r) {
2370
- var e, o, l, c, f, p;
2371
- const i = t.parse(n), a = i == null ? void 0 : i.wsDr;
2372
- if (!a) return;
2373
- const u = J(t, n), s = [
2374
- ...V(a.twoCellAnchor).map((h) => ({ a: h, kind: "two" })),
2375
- ...V(a.oneCellAnchor).map((h) => ({ a: h, kind: "one" }))
2376
- ];
2377
- for (const { a: h, kind: b } of s) {
2378
- const N = lt(h.from), A = b === "two" ? lt(h.to) ?? void 0 : void 0;
2379
- let d, y;
2380
- if (b === "one" && h.ext && (d = Number(h.ext["@_cx"]), y = Number(h.ext["@_cy"])), !N) continue;
2381
- const x = { src: "", from: N, to: A, extWidthEmu: d, extHeightEmu: y }, P = h.pic;
2382
- if (P) {
2383
- const g = ((o = (e = P.blipFill) == null ? void 0 : e.blip) == null ? void 0 : o["@_embed"]) ?? ((c = (l = P.blipFill) == null ? void 0 : l.blip) == null ? void 0 : c["@_link"]), C = g ? u[g] : void 0;
2384
- if (C) {
2385
- const m = $n(t, C);
2386
- m && r.images.push({ ...x, src: "", bytes: m.bytes, mime: m.mime });
2387
- }
2388
- continue;
2389
- }
2390
- const O = h.graphicFrame;
2391
- if (O) {
2392
- const g = (p = (f = O.graphic) == null ? void 0 : f.graphicData) == null ? void 0 : p.chart, C = g == null ? void 0 : g["@_id"], m = C ? u[C] : void 0;
2393
- if (m) {
2394
- const w = In(t, m);
2395
- if (w && w.type !== "unsupported") {
2396
- const E = { ...w, anchor: x };
2397
- r.charts.push(E);
2398
- }
2399
- }
2400
- continue;
2401
- }
2402
- const v = h.sp;
2403
- v && r.shapes.push(Mn(v, x));
2404
- }
2405
- }
2406
- function Mn(t, n) {
2407
- var h, b, N, A, d, y, x, P, O, v, g, C, m, w;
2408
- const r = t.spPr || {}, i = String(((h = r.prstGeom) == null ? void 0 : h["@_prst"]) ?? "rect"), a = i === "roundRect" ? "roundRect" : i === "ellipse" || i === "circle" ? "ellipse" : i === "rect" ? "rect" : "other", u = Ie((N = (b = r.solidFill) == null ? void 0 : b.srgbClr) == null ? void 0 : N["@_val"]), s = Ie((y = (d = (A = r.ln) == null ? void 0 : A.solidFill) == null ? void 0 : d.srgbClr) == null ? void 0 : y["@_val"]);
2409
- let e = "", o, l = !1;
2410
- const c = V((x = t.txBody) == null ? void 0 : x.p);
2411
- for (const E of c) {
2412
- for (const T of V(E.r)) {
2413
- const F = T.t;
2414
- e += F == null ? "" : typeof F == "object" ? F["#text"] ?? "" : String(F), o || (o = Ie((v = (O = (P = T.rPr) == null ? void 0 : P.solidFill) == null ? void 0 : O.srgbClr) == null ? void 0 : v["@_val"])), (((g = T.rPr) == null ? void 0 : g["@_b"]) === 1 || ((C = T.rPr) == null ? void 0 : C["@_b"]) === "1") && (l = !0);
2415
- }
2416
- e += `
2417
- `;
2418
- }
2419
- e = e.trim();
2420
- const f = (w = (m = c[0]) == null ? void 0 : m.pPr) == null ? void 0 : w["@_algn"];
2421
- return { anchor: n, geom: a, text: e || void 0, fillColor: u, lineColor: s, textColor: o, bold: l, align: f === "ctr" ? "center" : f === "r" ? "right" : "left" };
2422
- }
2423
- function Ie(t) {
2424
- if (t)
2425
- return "#" + String(t).toUpperCase();
2426
- }
2427
- function lt(t) {
2428
- return t ? {
2429
- col: Number(t.col ?? 0),
2430
- colOffEmu: Number(t.colOff ?? 0),
2431
- row: Number(t.row ?? 0),
2432
- rowOffEmu: Number(t.rowOff ?? 0)
2433
- } : null;
2434
- }
2435
- function $n(t, n) {
2436
- var u;
2437
- const r = t.bytes(n);
2438
- if (!r) return;
2439
- const i = ((u = se(n).split(".").pop()) == null ? void 0 : u.toLowerCase()) || "png", a = kn[i];
2440
- if (a)
2441
- return { bytes: r, mime: a };
2442
- }
2443
- const Vn = {
2444
- png: "image/png",
2445
- jpg: "image/jpeg",
2446
- jpeg: "image/jpeg",
2447
- gif: "image/gif",
2448
- bmp: "image/bmp",
2449
- svg: "image/svg+xml",
2450
- webp: "image/webp"
2451
- };
2452
- function Ln(t) {
2453
- if (!t || t.indexOf("DISPIMG") < 0) return;
2454
- const n = /DISPIMG\s*\(\s*"([^"]+)"/i.exec(t);
2455
- return n ? n[1] : void 0;
2456
- }
2457
- function Un(t, n) {
2458
- const r = Bn(t);
2459
- let i = !1;
2460
- for (const a of n)
2461
- for (const u of a.cells.values()) {
2462
- if (u.type !== "formula") continue;
2463
- const s = Ln(u.formula);
2464
- s && (u.dispImgId = s, i = !0);
2465
- }
2466
- if (!(!r && !i))
2467
- return r ?? /* @__PURE__ */ new Map();
2468
- }
2469
- function Bn(t) {
2470
- var u, s, e, o, l, c;
2471
- const n = t.parse("xl/cellimages.xml"), r = n == null ? void 0 : n.cellImages;
2472
- if (!r) return;
2473
- const i = J(t, "xl/cellimages.xml"), a = /* @__PURE__ */ new Map();
2474
- for (const f of V(r.cellImage)) {
2475
- const p = f == null ? void 0 : f.pic;
2476
- if (!p) continue;
2477
- const h = (s = (u = p.nvPicPr) == null ? void 0 : u.cNvPr) == null ? void 0 : s["@_name"], b = ((o = (e = p.blipFill) == null ? void 0 : e.blip) == null ? void 0 : o["@_embed"]) ?? ((c = (l = p.blipFill) == null ? void 0 : l.blip) == null ? void 0 : c["@_link"]);
2478
- if (!h || !b) continue;
2479
- const N = i[b];
2480
- if (!N) continue;
2481
- const A = zn(t, N);
2482
- A && a.set(String(h), { id: String(h), bytes: A.bytes, mime: A.mime, src: "" });
2483
- }
2484
- return a.size ? a : void 0;
2485
- }
2486
- function zn(t, n) {
2487
- var u;
2488
- const r = t.bytes(n);
2489
- if (!r) return;
2490
- const i = ((u = se(n).split(".").pop()) == null ? void 0 : u.toLowerCase()) || "png", a = Vn[i];
2491
- if (a)
2492
- return { bytes: r, mime: a };
2493
- }
2494
- function Gn(t, n) {
2495
- var s, e, o, l;
2496
- const r = t.parse("xl/workbook.xml"), i = V((e = (s = r == null ? void 0 : r.workbook) == null ? void 0 : s.sheets) == null ? void 0 : e.sheet), a = J(t, "xl/workbook.xml"), u = /* @__PURE__ */ new Map();
2497
- for (const c of i) {
2498
- const f = c["@_name"], p = c["@_id"];
2499
- f && p && a[p] && u.set(String(f), a[p]);
2500
- }
2501
- for (const c of n) {
2502
- const f = u.get(c.name);
2503
- if (!f) continue;
2504
- const p = t.parse(f), h = V((l = (o = p == null ? void 0 : p.worksheet) == null ? void 0 : o.sheetData) == null ? void 0 : l.row);
2505
- for (const b of h) {
2506
- const N = b["@_customHeight"];
2507
- if (N === 1 || N === "1" || N === !0) {
2508
- const A = Number(b["@_r"]) - 1;
2509
- if (!Number.isFinite(A) || A < 0) continue;
2510
- const d = c.rows.get(A);
2511
- d && (d.customHeight = !0);
2512
- }
2513
- }
2514
- }
2515
- }
2516
- function qn(t, n) {
2517
- var s, e;
2518
- const r = t.parse("xl/workbook.xml"), i = V((e = (s = r == null ? void 0 : r.workbook) == null ? void 0 : s.sheets) == null ? void 0 : e.sheet), a = J(t, "xl/workbook.xml"), u = /* @__PURE__ */ new Map();
2519
- for (const o of i) {
2520
- const l = o["@_name"], c = o["@_id"];
2521
- l && c && a[c] && u.set(String(l), a[c]);
2522
- }
2523
- for (const o of n) {
2524
- const l = u.get(o.name);
2525
- if (l)
2526
- try {
2527
- Wn(t, l, o);
2528
- } catch {
2529
- }
2530
- }
2531
- }
2532
- function Wn(t, n, r) {
2533
- var u, s, e, o;
2534
- const i = t.parse(n), a = V((s = (u = i == null ? void 0 : i.worksheet) == null ? void 0 : u.extLst) == null ? void 0 : s.ext);
2535
- for (const l of a) {
2536
- const c = V((e = l.sparklineGroups) == null ? void 0 : e.sparklineGroup);
2537
- for (const f of c) {
2538
- const p = String(f["@_type"] ?? "line"), h = p === "column" ? "column" : p === "stacked" ? "winloss" : "line", b = ft(f.colorSeries), N = ft(f.colorNegative);
2539
- for (const A of V((o = f.sparklines) == null ? void 0 : o.sparkline)) {
2540
- const d = ut(A.f), y = ut(A.sqref);
2541
- if (!d || !y) continue;
2542
- const x = jn(y);
2543
- if (!x) continue;
2544
- const P = Xn(r, d);
2545
- P.length && r.sparklines.push({ row: x.row, col: x.col, type: h, values: P, color: b, negativeColor: N });
2546
- }
2547
- }
2548
- }
2549
- }
2550
- function Xn(t, n) {
2551
- const r = n.includes("!") ? n.slice(n.indexOf("!") + 1) : n, i = Z(r.replace(/\$/g, ""));
2552
- if (!i) return [];
2553
- const a = [];
2554
- for (let u = i.top; u <= i.bottom; u++)
2555
- for (let s = i.left; s <= i.right; s++) {
2556
- const e = t.cells.get(Et(u, s));
2557
- a.push(e && typeof e.raw == "number" ? e.raw : null);
2558
- }
2559
- return a;
2560
- }
2561
- function jn(t) {
2562
- const n = t.trim().split(/\s+/)[0], r = Z(n);
2563
- return r ? { row: r.top, col: r.left } : null;
2564
- }
2565
- function ut(t) {
2566
- if (t != null) {
2567
- if (typeof t == "string" || typeof t == "number") return String(t);
2568
- if (typeof t == "object" && t["#text"] != null) return String(t["#text"]);
2569
- }
2570
- }
2571
- function ft(t) {
2572
- const n = t == null ? void 0 : t["@_rgb"];
2573
- if (!n) return;
2574
- const r = String(n);
2575
- return "#" + (r.length === 8 ? r.slice(2) : r).toUpperCase();
2576
- }
2577
- function Hn(t, n) {
2578
- var s, e, o, l, c;
2579
- const r = t.parse("xl/workbook.xml"), i = V((e = (s = r == null ? void 0 : r.workbook) == null ? void 0 : s.sheets) == null ? void 0 : e.sheet), a = J(t, "xl/workbook.xml"), u = /* @__PURE__ */ new Map();
2580
- for (const f of i) {
2581
- const p = f["@_name"], h = f["@_id"];
2582
- p && h && a[h] && u.set(String(p), a[h]);
2583
- }
2584
- for (const f of n) {
2585
- const p = u.get(f.name);
2586
- if (p)
2587
- try {
2588
- const h = (o = t.parse(p)) == null ? void 0 : o.worksheet, b = V((l = h == null ? void 0 : h.rowBreaks) == null ? void 0 : l.brk).map((A) => Number(A["@_id"])).filter((A) => Number.isFinite(A) && A > 0), N = V((c = h == null ? void 0 : h.colBreaks) == null ? void 0 : c.brk).map((A) => Number(A["@_id"])).filter((A) => Number.isFinite(A) && A > 0);
2589
- (b.length || N.length) && (f.pageBreaks = { rows: b, cols: N });
2590
- } catch {
2591
- }
2592
- }
2593
- }
2594
- async function Yn(t, n) {
2595
- var l;
2596
- const r = tn(t.slice(0)), i = rn(r);
2597
- n == null || n({ stage: "parse" });
2598
- const a = (await import("./exceljs.min-DH9BABny.js").then(function(c) {
2599
- return c.e;
2600
- })).default, u = new a.Workbook();
2601
- await u.xlsx.load(t);
2602
- const s = gn(u, i, n);
2603
- try {
2604
- _n(r, s);
2605
- } catch (c) {
2606
- console.warn("[ooxml-preview] drawings 解析失败,跳过图片/图表:", c);
2607
- }
2608
- let e;
2609
- try {
2610
- e = Un(r, s);
2611
- } catch (c) {
2612
- console.warn("[ooxml-preview] WPS 单元格内嵌图(DISPIMG)解析失败,跳过:", c);
2613
- }
2614
- try {
2615
- qn(r, s);
2616
- } catch (c) {
2617
- console.warn("[ooxml-preview] sparklines 解析失败,跳过迷你图:", c);
2618
- }
2619
- try {
2620
- Hn(r, s);
2621
- } catch (c) {
2622
- console.warn("[ooxml-preview] 分页符解析失败,跳过:", c);
2623
- }
2624
- try {
2625
- Gn(r, s);
2626
- } catch (c) {
2627
- console.warn("[ooxml-preview] 行高标记解析失败,跳过:", c);
2628
- }
2629
- const o = !!((l = u.properties) != null && l.date1904);
2630
- return {
2631
- sheets: s,
2632
- activeSheet: 0,
2633
- themeColors: i,
2634
- date1904: o,
2635
- cellImages: e
2636
- };
2637
- }
2638
- const Se = (t) => self.postMessage(t);
2639
- self.onmessage = async (t) => {
2640
- try {
2641
- const n = await Yn(t.data, (r) => Se({ type: "progress", progress: r }));
2642
- Se({ type: "done", ok: !0, model: n });
2643
- } catch (n) {
2644
- Se({ type: "done", ok: !1, error: (n == null ? void 0 : n.message) || String(n) });
2645
- }
2646
- };