@sheetxl/io-xlsx 0.8.0-beta.7 → 0.8.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/browser/cjs/B0Ugu_crqQYpdfQz.cjs +1 -0
  2. package/browser/cjs/{CDs8etXnw0kbBKKv.cjs → BHM3_D9PsNURVAVy.cjs} +1 -1
  3. package/browser/cjs/BHWdwAQ322YA8JAZ.cjs +6 -0
  4. package/browser/cjs/CeuX8p1aBuKTuagi.cjs +2 -0
  5. package/browser/cjs/DSM4q1dhVVXvsgby.cjs +30 -0
  6. package/browser/cjs/DiAHwNv2I8RHE9GY.cjs +1 -0
  7. package/browser/cjs/index.cjs +1 -1
  8. package/browser/cjs/wrpXlaSBGEicQf6_.cjs +6 -0
  9. package/browser/esm/{BsNoW41d6hdpxTTS.mjs → Bu64BYvRAlVftMr1.mjs} +4 -4
  10. package/browser/esm/{CX3yVwe-BnhCk4FY.mjs → C-2KaUyV4gs-sDTZ.mjs} +2 -2
  11. package/browser/esm/{DUi-V-E_AJwTIqlO.mjs → CRrTMRdN_IcSA_pm.mjs} +2 -2
  12. package/browser/esm/{CjKioy-GzeSf08f8.mjs → CWt4fDYEbj2hvsl_.mjs} +820 -800
  13. package/browser/esm/{dsVZVtt5w_yLb967.mjs → Ccnxz-y2WBEgfvvh.mjs} +2606 -1408
  14. package/browser/esm/{B4eKxNwxJjHLN126.mjs → CxtFawTfwRTCC4Xr.mjs} +1 -1
  15. package/browser/esm/{CGXxwkCRWLc0gcRQ.mjs → D-epcZSoKLbsAIaC.mjs} +2 -2
  16. package/browser/esm/DsSIg46AR7IFBN5N.mjs +2298 -0
  17. package/browser/esm/{cJxidonaVNZHAXiZ.mjs → Dx64JMAGwNNDBkC1.mjs} +1555 -1159
  18. package/browser/esm/Sv4twwEJDb9dZ91h.mjs +149 -0
  19. package/browser/esm/index.mjs +2 -2
  20. package/node/esm/{CMq7eF1vxibUumqT.mjs → BCr4lCI6qQXXN0K1.mjs} +2 -2
  21. package/node/esm/BPn5XBizKkwaUqXB.mjs +4285 -0
  22. package/node/esm/{BRQYaMYO4UfhjJHw.mjs → BVV11IlqF6Lmlv8D.mjs} +53 -69
  23. package/node/esm/{s_yVG0m9KB14YKeN.mjs → BiJEEgltJzx94zIR.mjs} +930 -909
  24. package/node/esm/{C51yFT2l-6il_xXO.mjs → BsTMtvwpQoPNv95M.mjs} +1 -1
  25. package/node/esm/{DLBm8l0jyL2fVlxg.mjs → CBtj0-a4l2qux2hA.mjs} +2 -2
  26. package/node/esm/CkmZuMvRTpva7eQu.mjs +5074 -0
  27. package/node/esm/index.mjs +4 -4
  28. package/node/esm/j0RE2usgdljRw_gr.mjs +2345 -0
  29. package/package.json +3 -3
  30. package/types/src/AutoFilterRules.d.ts +83 -10
  31. package/types/src/OOXMLExtensions.d.ts +6 -0
  32. package/types/src/reader/dom/CustGeomUtils.d.ts +7 -0
  33. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +13 -0
  34. package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +7 -1
  35. package/types/src/reader/domVisitors/DrawingCxnSpVisitor.d.ts +1 -0
  36. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +23 -1
  37. package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +9 -0
  38. package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +20 -1
  39. package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +20 -1
  40. package/types/src/reader/domVisitors/DrawingVisitor.d.ts +8 -0
  41. package/types/src/reader/domVisitors/FormControlPrVisitor.d.ts +9 -0
  42. package/types/src/reader/domVisitors/ShapeTextVisitor.d.ts +44 -0
  43. package/types/src/reader/domVisitors/TextPropertiesVisitor.d.ts +13 -1
  44. package/types/src/reader/domVisitors/index.d.ts +4 -2
  45. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +1 -1
  46. package/types/src/utils/DrawingMLText.d.ts +39 -0
  47. package/types/src/utils/FormControls.d.ts +97 -0
  48. package/types/src/writer/builder/Emitter.d.ts +5 -0
  49. package/types/src/writer/builder/PackageBuilder.d.ts +2 -0
  50. package/types/src/writer/builder/Types.d.ts +10 -0
  51. package/types/src/writer/utils/CustGeomUtils.d.ts +5 -0
  52. package/types/src/writer/utils/DrawMLUtils.d.ts +39 -2
  53. package/types/src/writer/utils/PrstGeomUtils.d.ts +6 -0
  54. package/types/src/writer/utils/TextUtils.d.ts +21 -2
  55. package/browser/cjs/17tMBnuyu4YIxixh.cjs +0 -1
  56. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  57. package/browser/cjs/BxU-OlZIQViQl7gX.cjs +0 -1
  58. package/browser/cjs/CIpMN7SDVREKQUQE.cjs +0 -6
  59. package/browser/cjs/CycnxkfuKrDdwoJN.cjs +0 -5
  60. package/browser/cjs/DHKWtqZ0vQfXrbq1.cjs +0 -2
  61. package/browser/cjs/MqKQ_B5qRARrRbO4.cjs +0 -24
  62. package/browser/esm/9n64lXAgZUe3aThr.mjs +0 -159
  63. package/browser/esm/BvAptAMpZVyBCx6-.mjs +0 -2402
  64. package/browser/esm/DwcLXqv8-6Tl1zLO.mjs +0 -24
  65. package/node/esm/BlbtH3EvAf3K4foF.mjs +0 -2450
  66. package/node/esm/DhSPOg9wN0kD87Tb.mjs +0 -3051
  67. package/node/esm/KeV-N47eTyh5YE70.mjs +0 -4642
  68. package/types/src/reader/domVisitors/HyperlinkVisitor.d.ts +0 -6
@@ -1,2450 +0,0 @@
1
- /**
2
- * @license @sheetxl/io-xlsx - SheetXL - Import/Export from/to Excel - v0.8.0-beta.7
3
- *
4
- * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */
7
- import { a as t, c as e, g as s, i as r, m as o, o as i, p as n, r as a, s as l, t as c } from "./BRQYaMYO4UfhjJHw.mjs";
8
- import { b as u, h, y as p } from "./DhSPOg9wN0kD87Tb.mjs";
9
- import { CommonUtils as d } from "@sheetxl/utils";
10
- import { AddressUtils as g, FormulaError as m, IBorders as b, ICondition as f, IEffect as A, IFill as y, IFont as v, IRange as N, IStyle as F, ITextFrame as C, Sort as w, Tuple as P } from "@sheetxl/sdk";
11
- var S = class {
12
- constructor(t) {
13
- this.list = t;
14
- }
15
- get length() {
16
- return this.list.length;
17
- }
18
- item(t) {
19
- return this.list[t];
20
- }
21
- forEach(t, e) {
22
- const s = this.list, r = s.length;
23
- for (let e = 0; e < r; e++) t(s[e], e, this);
24
- }
25
- entries() {
26
- return this.list.entries();
27
- }
28
- keys() {
29
- return this.list.keys();
30
- }
31
- values() {
32
- return this.list.values();
33
- }
34
- [Symbol.iterator]() {
35
- return this.list.values();
36
- }
37
- }, x = (t) => !0 === t || "1" === t || "on" === t || "true" === t || !1 !== t && "0" !== t && "off" !== t && "false" !== t && null, T = (t) => {
38
- const e = parseInt(t);
39
- return isNaN(e) ? null : e;
40
- }, O = (t) => {
41
- const e = parseFloat(t);
42
- return isNaN(e) ? null : e;
43
- }, k = /* @__PURE__ */ new Map(), V = class {
44
- constructor(t, e, s, r, o, i = null, n = d.EmptyObject) {
45
- this._fileLocation = "";
46
- const a = (t, e, s) => n?.getRef?.(t, e, s, n?.parsedRefs), l = (t) => n?.getRefs?.(t, n?.parsedRefs);
47
- this._parent = t, this.sharedShared = e, this.currentPath = s, this.elemRoot = r, this.jsonRoot = o, t ? (this._fileLocation = t._fileLocation, this._getRef = t._getRef, this._getRefs = t._getRefs, this._serializeElement = t._serializeElement, this._readEmbeddedPart = t._readEmbeddedPart) : (i && (this._fileLocation = i), n?.getRef && (this._getRef = a), n?.getRefs && (this._getRefs = l), this._onWarning = n?.onWarning, this._addPerson = n?.addPerson, this._serializeElement = n?.serializeElement, this._readEmbeddedPart = n?.readEmbeddedPart);
48
- }
49
- getRef(t, e = !1) {
50
- return this._getRef?.(t, this._fileLocation, e) ?? null;
51
- }
52
- readEmbeddedPart(t) {
53
- return this._readEmbeddedPart?.(t, this._fileLocation) ?? null;
54
- }
55
- getRelationships() {
56
- return this._getRefs?.(this._fileLocation) ?? k;
57
- }
58
- getPath() {
59
- return this.currentPath;
60
- }
61
- getFileLocation() {
62
- return this._fileLocation;
63
- }
64
- getElemRoot() {
65
- return this.elemRoot;
66
- }
67
- getJsonRoot() {
68
- return this.jsonRoot;
69
- }
70
- warn(t, e) {
71
- this._raiseWarning(t, this.getFileLocation(), e?.onceKey);
72
- }
73
- _raiseWarning(t, e, s) {
74
- this._onWarning ? this._onWarning(t, e, s) : this._parent ? this._parent._raiseWarning(t, e, s) : console.warn(t);
75
- }
76
- serializeElement(t) {
77
- return this._serializeElement?.(t) ?? null;
78
- }
79
- addPerson(t) {
80
- return "string" == typeof t && (t = { displayName: t }), this._addPerson ? this._addPerson(t) : this._parent ? this._parent?._addPerson?.(t) ?? null : null;
81
- }
82
- getVisitorParamsState() {
83
- return this.sharedShared.getVisitorParamsState();
84
- }
85
- evaluate(t, e) {
86
- if (!t) return e;
87
- let s = [e];
88
- const r = t.split("/"), o = r.length;
89
- for (let t = 0; t < o; t++) {
90
- const e = r[t];
91
- if ("" === e || "." === e) continue;
92
- const i = [], n = ("*" === e || "**" === e) && !(t === o - 1);
93
- for (const o of s) if (o) if (n) {
94
- const e = r[t + 1];
95
- e && "" !== e && "." !== e && (this._findDescendants(o, e, i), t++);
96
- } else if ("*" === e || "**" === e) {
97
- if (!o.childNodes) continue;
98
- const t = o.childNodes, e = t.length;
99
- for (let s = 0; s < e; s++) {
100
- const e = t[s];
101
- 1 === e.nodeType && i.push(e);
102
- }
103
- } else {
104
- if (!o.childNodes) continue;
105
- const t = o.childNodes, s = t.length;
106
- for (let r = 0; r < s; r++) {
107
- const s = t[r];
108
- if (1 !== s.nodeType) continue;
109
- const o = s;
110
- this._matchesElementName(o, e) && i.push(o);
111
- }
112
- }
113
- if (s = i, 0 === s.length) return null;
114
- }
115
- return 1 === s.length ? s[0] : 0 === s.length ? null : new S(s);
116
- }
117
- _matchesElementName(t, e) {
118
- return e.includes(":") ? (t.tagName || t.nodeName) === e : t.localName === e;
119
- }
120
- _findDescendants(t, e, s) {
121
- if (!t || !t.childNodes) return;
122
- const r = t.childNodes, o = r.length;
123
- for (let t = 0; t < o; t++) {
124
- const o = r[t];
125
- if (1 !== o.nodeType) continue;
126
- const i = o;
127
- this._matchesElementName(i, e) && s.push(i), this._findDescendants(i, e, s);
128
- }
129
- }
130
- getFromPath(t, e) {
131
- return d.getFromPath(t, e);
132
- }
133
- setToPath(t, e, s) {
134
- return d.setToPath(t, e, s);
135
- }
136
- getValAttrAsString(t, e) {
137
- let s = this.evaluate(t, e);
138
- return s && s.hasAttribute("val") ? s.getAttribute("val") ?? null : null;
139
- }
140
- getValAttrAsBoolean(t, e, s = !1) {
141
- let r = this.evaluate(t, e);
142
- if (!r) return null;
143
- const o = r.hasAttribute("val") ? r.getAttribute("val") : void 0;
144
- return null == o ? s : "1" === o || "on" === o || "true" === o || "0" !== o && "off" !== o && "false" !== o && s;
145
- }
146
- getValAttrAsInteger(t, e) {
147
- let s = this.evaluate(t, e);
148
- return s && s.hasAttribute("val") ? parseInt(s.getAttribute("val")) ?? null : null;
149
- }
150
- getValAttrAsFloat(t, e) {
151
- let s = this.evaluate(t, e);
152
- return s && s.hasAttribute("val") ? parseFloat(s.getAttribute("val")) ?? null : null;
153
- }
154
- get BOOLEAN_COPY() {
155
- return x;
156
- }
157
- get INT_COPY() {
158
- return T;
159
- }
160
- get FLOAT_COPY() {
161
- return O;
162
- }
163
- copyFromAttribute(t, e, s, r = e, o = null) {
164
- if (!t || !s || !t.hasAttribute(e)) return;
165
- let i = t.getAttribute(e);
166
- if (o) if (Array.isArray(o)) {
167
- const t = o.length;
168
- for (let e = 0; e < t; e++) {
169
- if (null == i) return;
170
- if (i = o[e](i), null == i) return;
171
- }
172
- } else {
173
- if (null == i) return;
174
- if (i = o(i), null == i) return;
175
- }
176
- this.setToPath(s, r, i);
177
- }
178
- }, I = s({
179
- isBlank: () => j,
180
- isNotBlank: () => D,
181
- length: () => Y,
182
- parseRotation: () => L,
183
- parseValAttrAsBoolean: () => B,
184
- parseValAttrAsFloat: () => R,
185
- parseValAttrAsInteger: () => E,
186
- parseValAttrAsString: () => _
187
- }), L = (t, e) => {
188
- if (!t || !t.hasAttribute("rot")) return;
189
- const s = t.getAttribute("rot"), o = d.roundAccurately(r(s), 2);
190
- -1e3 !== o && (e.rotation = o);
191
- }, _ = (t, e, s, r, o) => {
192
- const i = t.getValAttrAsString(r, e);
193
- null !== i && (s[o] = i);
194
- }, B = (t, e, s, r, o = r, i = null) => {
195
- const n = t.getValAttrAsBoolean(r, e, i);
196
- null !== n && (s[o] = n);
197
- }, E = (t, e, s, r, o) => {
198
- const i = t.getValAttrAsInteger(r, e);
199
- null !== i && (s[o] = i);
200
- }, R = (t, e, s, r, o, i = 1) => {
201
- const n = t.getValAttrAsFloat(r, e);
202
- null !== n && (s[o] = n * i);
203
- }, j = (t) => !t || 0 === t.trim().length, D = (t) => !j(t), Y = (t) => t?.length ?? 0, M = class {
204
- constructor(t) {
205
- this.jsonKey = t;
206
- }
207
- visit(t, e, s) {
208
- const r = {};
209
- return s[this.jsonKey] = r, r;
210
- }
211
- }, U = class {
212
- visit(t, e, s) {}
213
- getStroke(t, e) {
214
- const s = t.evaluate("ln", e);
215
- return s ? this.parseLn(t, s) : {};
216
- }
217
- parseLn(t, s) {
218
- const r = {};
219
- s.hasAttribute("algn") && (r.align = s.getAttribute("algn")), s.hasAttribute("cap") && (r.lineCap = X(s.getAttribute("cap"))), s.hasAttribute("cmpd") && (r.compound = s.getAttribute("cmpd")), s.hasAttribute("w") && (r.width = e(s.getAttribute("w")));
220
- const o = t.evaluate("miter", s);
221
- o && (r.lineJoin = "miter", o.hasAttribute("lim") && (r.miterLimit = parseFloat(o.getAttribute("lim")) / 1e5)), t.evaluate("bevel", s) && (r.lineJoin = "bevel"), t.evaluate("round", s) && (r.lineJoin = "round");
222
- const n = t.evaluate("custDash", s);
223
- if (n) {
224
- const e = t.evaluate("ds", n);
225
- if (e && e.length > 0) {
226
- const t = [];
227
- for (let s = 0; s < e.length; s++) {
228
- const r = e.item(s);
229
- t.push(i(r.getAttribute("d") ?? "")), t.push(i(r.getAttribute("sp") ?? ""));
230
- }
231
- r.dash = t;
232
- }
233
- }
234
- const a = t.evaluate("prstDash", s);
235
- a && a.hasAttribute("val") && (r.dash = a.getAttribute("val")), this.parseEndElement(t, s, r, "headEnd", "head"), this.parseEndElement(t, s, r, "tailEnd", "tail");
236
- const l = this.getFill(t, s);
237
- return l && (r.fill = l), r;
238
- }
239
- parseEndElement(t, e, s, r, o) {
240
- const i = t.evaluate(r, e);
241
- if (i && (i.hasAttribute("type") && (s[o + "Type"] = i.getAttribute("type")), i.hasAttribute("len") || i.hasAttribute("w"))) {
242
- const t = i.getAttribute("len") || "med", e = i.getAttribute("w") || "med";
243
- s[o + "Size"] = t + "-" + e;
244
- }
245
- }
246
- getEffects(t, e) {
247
- const s = t.evaluate("effectLst", e);
248
- if (!s) return null;
249
- const r = [], o = s.childNodes, i = o.length;
250
- for (let e = 0; e < i; e++) {
251
- const s = o.item(e);
252
- if (1 !== s.nodeType) continue;
253
- const i = this.processEffectElement(t, s, s.localName);
254
- if (void 0 === i) return;
255
- r.push(i);
256
- }
257
- return r;
258
- }
259
- processEffectElement(s, o, n) {
260
- switch (n) {
261
- case "outerShdw": {
262
- const n = {
263
- type: A.Type.OuterShadow,
264
- color: this.processAdjColor(s, o)
265
- };
266
- return o.hasAttribute("dist") && (n.distance = e(o.getAttribute("dist"))), o.hasAttribute("dir") && (n.angle = r(o.getAttribute("dir"))), o.hasAttribute("blurRad") && (n.blur = e(o.getAttribute("blurRad"))), o.hasAttribute("algn") && (n.alignment = o.getAttribute("algn")), o.hasAttribute("rotWithShape") && (n.isRotatedWithShape = t(o.getAttribute("rotWithShape"))), o.hasAttribute("sx") && (n.scaleX = i(o.getAttribute("sx"))), o.hasAttribute("sy") && (n.scaleY = i(o.getAttribute("sy"))), o.hasAttribute("kx") && (n.skewX = r(o.getAttribute("kx"))), o.hasAttribute("ky") && (n.skewY = r(o.getAttribute("ky"))), n;
267
- }
268
- case "innerShdw": {
269
- const t = {
270
- type: A.Type.InnerShadow,
271
- color: this.processAdjColor(s, o)
272
- };
273
- return o.hasAttribute("dist") && (t.distance = e(o.getAttribute("dist"))), o.hasAttribute("dir") && (t.angle = r(o.getAttribute("dir"))), o.hasAttribute("blurRad") && (t.blur = e(o.getAttribute("blurRad"))), t;
274
- }
275
- case "prstShdw": {
276
- const t = {
277
- type: A.Type.PresetShadow,
278
- color: this.processAdjColor(s, o),
279
- preset: o.getAttribute("prst") ?? void 0
280
- };
281
- return o.hasAttribute("dist") && (t.distance = e(o.getAttribute("dist"))), o.hasAttribute("dir") && (t.angle = r(o.getAttribute("dir"))), t;
282
- }
283
- case "glow": {
284
- const t = {
285
- type: A.Type.Glow,
286
- color: this.processAdjColor(s, o)
287
- };
288
- return o.hasAttribute("rad") && (t.radius = e(o.getAttribute("rad"))), t;
289
- }
290
- case "softEdge": {
291
- const t = { type: A.Type.SoftEdge };
292
- return o.hasAttribute("rad") && (t.radius = e(o.getAttribute("rad"))), t;
293
- }
294
- case "reflection": {
295
- const s = { type: A.Type.Reflection };
296
- return o.hasAttribute("blurRad") && (s.blur = e(o.getAttribute("blurRad"))), o.hasAttribute("dist") && (s.distance = e(o.getAttribute("dist"))), o.hasAttribute("dir") && (s.angle = r(o.getAttribute("dir"))), o.hasAttribute("fadeDir") && (s.fadeAngle = r(o.getAttribute("fadeDir"))), o.hasAttribute("stA") && (s.startAlpha = i(o.getAttribute("stA"))), o.hasAttribute("stPos") && (s.startPosition = i(o.getAttribute("stPos"))), o.hasAttribute("endA") && (s.endAlpha = i(o.getAttribute("endA"))), o.hasAttribute("endPos") && (s.endPosition = i(o.getAttribute("endPos"))), o.hasAttribute("sx") && (s.scaleX = i(o.getAttribute("sx"))), o.hasAttribute("sy") && (s.scaleY = i(o.getAttribute("sy"))), o.hasAttribute("kx") && (s.skewX = r(o.getAttribute("kx"))), o.hasAttribute("ky") && (s.skewY = r(o.getAttribute("ky"))), o.hasAttribute("algn") && (s.alignment = o.getAttribute("algn")), o.hasAttribute("rotWithShape") && (s.isRotatedWithShape = t(o.getAttribute("rotWithShape"))), s;
297
- }
298
- default: return;
299
- }
300
- }
301
- getFill(t, e) {
302
- if (t.evaluate("noFill", e)) return { type: y.Type.None };
303
- const s = t.evaluate("solidFill", e);
304
- if (s) {
305
- const e = this.processAdjColor(t, s);
306
- if (e) return {
307
- type: y.Type.Solid,
308
- color: e
309
- };
310
- }
311
- const r = t.evaluate("gradFill", e);
312
- if (r) return this.processGradFill(t, r);
313
- const o = t.evaluate("pattFill", e);
314
- if (o) return this.processPatternFill(t, o);
315
- const i = t.evaluate("blipFill", e);
316
- return i ? this.processImageFill(t, i) : null;
317
- }
318
- processGradFill(e, s) {
319
- const o = { type: y.Type.Gradient };
320
- s.hasAttribute("rotWithShape") && (o.isRotatedWithShape = "1" === s.getAttribute("rotWithShape"));
321
- const n = e.evaluate("lin", s);
322
- n && (o.gradientType = y.GradientType.Linear, n.hasAttribute("ang") && (o.angle = r(n.getAttribute("ang"))), n.hasAttribute("scaled") && (o.scaled = t(n.getAttribute("scaled"))));
323
- const a = {};
324
- s.hasAttribute("flip") && (a.mirror = s.getAttribute("flip")), Object.keys(a).length > 0 && (o.tile = a);
325
- const l = e.evaluate("path", s);
326
- if (l) {
327
- l.hasAttribute("path") && (o.gradientType = z(l.getAttribute("path")));
328
- const t = e.evaluate("fillToRect", l);
329
- t && (o.focus = this.getRect(t));
330
- }
331
- const c = e.evaluate("tileRect", s);
332
- c && (o.tile || (o.tile = {}), o.tile.bounds = this.getRect(c));
333
- const u = [], h = e.evaluate("gsLst/gs", s), p = h ? h.length : 0;
334
- for (let t = 0; t < p; t++) {
335
- const s = h.item(t), r = {
336
- offset: i(s.getAttribute("pos") ?? ""),
337
- color: this.processAdjColor(e, s)
338
- };
339
- u.push(r);
340
- }
341
- return u.length > 0 && (o.stops = u), o;
342
- }
343
- getRect(t) {
344
- const e = {};
345
- return t.hasAttribute("t") && (e.t = i(t.getAttribute("t"))), t.hasAttribute("l") && (e.l = i(t.getAttribute("l"))), t.hasAttribute("b") && (e.b = i(t.getAttribute("b"))), t.hasAttribute("r") && (e.r = i(t.getAttribute("r"))), 0 === Object.keys(e).length ? null : e;
346
- }
347
- processImageFill(e, s) {
348
- const r = { type: y.Type.Image };
349
- return s.hasAttribute("rotWithShape") && (r.isRotatedWithShape = t(s.getAttribute("rotWithShape"))), s.hasAttribute("dpi") && (r.dpi = s.getAttribute("dpi")), r.ref = "https://www.sheetxl.com/logo-color-padded-white.jpg", r.tile = !1, r;
350
- }
351
- processPatternFill(t, e) {
352
- const s = { type: y.Type.Pattern };
353
- s.patternType = e.getAttribute("prst");
354
- const r = t.evaluate("bgClr", e);
355
- if (r) {
356
- const e = this.processAdjColor(t, r);
357
- e && (s.background = e);
358
- }
359
- const o = t.evaluate("fgClr", e);
360
- if (o) {
361
- let e = this.processAdjColor(t, o);
362
- e && (s.foreground = e);
363
- }
364
- return s;
365
- }
366
- processAdjColor(t, e) {
367
- const s = t.evaluate("hslClr", e);
368
- if (s) return this.processHslClr(t, s);
369
- const r = t.evaluate("prstClr", e);
370
- if (r) return this.processClrWithValAttribute(t, r);
371
- const o = t.evaluate("schemeClr", e);
372
- if (o) return this.processClrWithValAttribute(t, o);
373
- const i = t.evaluate("sysClr", e);
374
- if (i) {
375
- let e = this.processClrWithValAttribute(t, i);
376
- const s = i.getAttribute("lastClr");
377
- return e && s && (e += ` lastClr ${s}`), e;
378
- }
379
- const n = t.evaluate("scrgbClr", e);
380
- if (n) return this.processScrgbClrElement(t, n);
381
- const a = t.evaluate("srgbClr", e);
382
- return a ? this.processSrgbClrElement(t, a) : null;
383
- }
384
- processScrgbClrElement(t, e) {
385
- let s = "lrgba(" + i(e.getAttribute("r") ?? "") + "," + i(e.getAttribute("g") ?? "") + "," + i(e.getAttribute("b") ?? "") + ")";
386
- return s += this.processAdjustments(t, e), s;
387
- }
388
- processSrgbClrElement(t, e) {
389
- let s = e.getAttribute("val");
390
- return s += this.processAdjustments(t, e), s;
391
- }
392
- processHslClr(t, e) {
393
- let s = "hsl(" + r(e.getAttribute("hue") ?? "") + "," + i(e.getAttribute("sat") ?? "") + "," + i(e.getAttribute("lum") ?? "") + ")";
394
- return s += this.processAdjustments(t, e), s;
395
- }
396
- processClrWithValAttribute(t, e) {
397
- const s = e.getAttribute("val");
398
- if (!s) return null;
399
- let r = s;
400
- return r += this.processAdjustments(t, e), r;
401
- }
402
- processAdjustments(t, e) {
403
- let s = "";
404
- const r = e.childNodes, o = r.length;
405
- for (let e = 0; e < o; e++) {
406
- const o = r.item(e);
407
- if (1 === o.nodeType) {
408
- let e = o.localName;
409
- s += "hue" === e || "hueOff" === e || "hueMod" === e ? this.processAdjustmentElement(t, o, e, 6e4) : "gray" === e || "comp" === e || "inv" === e || "gamma" === e || "invGamma" === e ? this.processAdjustmentElement(t, o, e, 1) : "alpha" === e || "alphaOff" === e || "alphaMod" === e ? this.processAdjustmentElement(t, o, e, 1e5) : this.processAdjustmentElement(t, o, e);
410
- }
411
- }
412
- return s;
413
- }
414
- processAdjustmentElement(t, e, s, r = 1e3) {
415
- const o = e.getAttribute("val");
416
- return o ? ` ${s} ${!o || parseFloat(o) / r}` : ` ${s}`;
417
- }
418
- }, z = (t) => "circle" === t ? "radial" : t, X = (t) => {
419
- if ("rnd" === t) return "round";
420
- if ("flat" === t) return "butt";
421
- if ("sq" === t) return "square";
422
- throw new Error("Invalid lineCap type: " + t);
423
- }, W = class extends U {
424
- visit(t, e, s) {
425
- try {
426
- const r = t.evaluate("xfrm", e);
427
- if (r) {
428
- L(r, s);
429
- const e = {
430
- x: 0,
431
- y: 0,
432
- width: 0,
433
- height: 0
434
- }, o = t.evaluate("off", r);
435
- o && (e.x = l(o.getAttribute("x")) ?? 0, e.y = l(o.getAttribute("y")) ?? 0);
436
- const i = t.evaluate("ext", r);
437
- o && (e.width = l(i.getAttribute("cx")) ?? 0, e.height = l(i.getAttribute("cy")) ?? 0), s.bounds = e;
438
- }
439
- const o = t.evaluate("prstGeom", e);
440
- o?.hasAttribute("prst") ? s.geometry = o?.getAttribute("prst") : t.evaluate("customGeom", e) && t.warn("Custom shape geometry is not supported; the shape keeps its bounds only.", { onceKey: "xlsx.shape.customGeometry" });
441
- const i = this.getFill(t, e);
442
- i && Object.keys(i).length > 0 && (s.fill = i);
443
- const n = this.getStroke(t, e);
444
- return n && Object.keys(n).length > 0 && (s.stroke = n), s;
445
- } catch (e) {
446
- t.warn(`Unable to read shape properties: ${e?.message ?? e}`, { onceKey: "xlsx.shape.unreadable" });
447
- }
448
- }
449
- }, G = class {
450
- visit(t, e, s) {
451
- let r = {};
452
- if (_(t, e, r, "grouping", "grouping"), B(t, e, r, "varyColors", "varyColors"), R(t, e, r, "gapWidth", "gapWidth", .01), R(t, e, r, "overlap", "overlap", .01), this.parseType(t, e, r), E(t, e, r, "bubbleScale", "bubbleScale"), B(t, e, r, "showNegBubbles", "showNegativeBubbleValues"), B(t, e, r, "sizeRepresents", "bubbleSizeRepresentsWidth"), E(t, e, r, "firstSliceAng", "startAngle"), E(t, e, r, "holeSize", "holeSize"), _(t, e, r, "scatterStyle", "scatterStyle"), this.parseAxisIds(t, e, r), Object.keys(r).length > 0) {
453
- let e = t.getVisitorParamsState().get("types");
454
- e || (t.warn("A chart type was read outside a chart; its types were started fresh.", { onceKey: "xlsx.chart.typesState" }), e = [], t.getVisitorParamsState().set("types", e)), e.push(r);
455
- }
456
- return r;
457
- }
458
- parseType(t, e, s) {
459
- switch (e.localName) {
460
- case "areaChart":
461
- s.type = "area";
462
- break;
463
- case "bubbleChart":
464
- s.type = "bubble";
465
- break;
466
- case "doughnutChart":
467
- case "ofPieType":
468
- case "pieChart":
469
- s.type = "pie";
470
- break;
471
- case "lineChart":
472
- s.type = "line";
473
- break;
474
- case "scatterChart": s.type = "scatter";
475
- }
476
- }
477
- parseAxisIds(t, e, s) {
478
- const r = t.evaluate("axId", e);
479
- r && 0 !== r.length && (s.xAxisId = r.item(0).getAttribute("val"), s.yAxisId = r.item(1).getAttribute("val"));
480
- }
481
- }, K = (t, e, s) => {
482
- if (!0 === t.getValAttrAsBoolean("invertIfNegative", e)) if (t.evaluate("extLst/ext/invertSolidFillFmt", e)) {
483
- if (s.fill && s.fillNegative) {
484
- const e = t.getFromPath(s, "fill.solid.adjs");
485
- e && t.setToPath(s, "fillNegative.solid.adjs", e);
486
- }
487
- } else {
488
- const t = { val: "FFFFFF" }, e = {};
489
- e.solid = t, s.fillNegative = e;
490
- const r = { val: "000000" }, o = {};
491
- o.solid = r;
492
- const i = {};
493
- i.fill = o, s.strokeNegative = i;
494
- }
495
- }, $ = class extends U {
496
- constructor(t = "text") {
497
- super(), this._jsonKey = t;
498
- }
499
- getTextPath() {
500
- return this._jsonKey;
501
- }
502
- visit(t, e, s) {
503
- let r = t.getFromPath(s, this.getTextPath());
504
- return r || (r = {}), this.parseTextElement(t, e, r, !1), Object.keys(r).length > 0 && t.setToPath(s, this.getTextPath(), r), s;
505
- }
506
- parseTextElement(t, e, s, r) {
507
- const o = t.evaluate("p/pPr/defRPr", e) ?? t.evaluate("defRPr", e), i = void 0 !== o?.length ? o.item(0) : o;
508
- i && (this.parseTextProperties(t, i, s), new W().visit(t, i, s));
509
- const n = s.runs ?? [], a = t.evaluate("p/r", e) ?? t.evaluate("r", e), l = (e) => {
510
- const s = {};
511
- let r = t.evaluate("t", e);
512
- const o = t.evaluate("rPr", e);
513
- o && this.parseTextProperties(t, o, s), r && r.firstChild ? s.text = r.firstChild.textContent ?? "" : e.textContent && (s.text = e.textContent ?? ""), Object.keys(s).length > 0 && n.push(s);
514
- };
515
- if (void 0 !== a?.length) for (let t = 0; a && t < a.length; t++) l(a.item(t));
516
- else l(a || e);
517
- n.length > 0 && (s.runs = n);
518
- const c = t.evaluate("bodyPr", e);
519
- c && L(c, s);
520
- }
521
- parseTextProperties(t, e, s) {
522
- if (!e) return;
523
- e.hasAttribute("sz") && (s.size = parseFloat(e.getAttribute("sz")) / 100), e.hasAttribute("b") && (s.weight = "1" === e.getAttribute("b") ? 700 : 400), e.hasAttribute("i") && (s.italic = "1" === e.getAttribute("i")), e.hasAttribute("u") && (s.underline = e.getAttribute("u")), e.hasAttribute("strike") && (s.strike = e.getAttribute("strike"));
524
- const r = this.getFill(t, e);
525
- r && Object.keys(r).length > 0 && (s.color = r);
526
- const o = t.evaluate("latin", e);
527
- if (o && !o.getAttribute("typeface").startsWith("+")) {
528
- const t = s.font ?? {};
529
- if (o.hasAttribute("typeface") && (t.family = o.getAttribute("typeface")), o.hasAttribute("panose")) {
530
- const e = o.getAttribute("panose");
531
- e && (t.fallbacks = [v.getPanoseFallback(e)]);
532
- }
533
- o.hasAttribute("pitchFamily") && (t.pitch = o.getAttribute("pitchFamily")), o.hasAttribute("charset") && (t.charset = o.getAttribute("charset")), Object.keys(t).length > 0 && (s.font = t);
534
- }
535
- }
536
- }, H = class {
537
- visit(t, e, s) {}
538
- processDataBarColor(t, e, s, r, o = "auto") {
539
- if (!e) return;
540
- const i = n((t) => e.getAttribute(t), o);
541
- return i && (s[r] = i), s;
542
- }
543
- processFonts(t, e, s) {
544
- if (!e) return;
545
- const r = e.childNodes;
546
- let o = 0;
547
- const i = r.length;
548
- for (let e = 0; e < i; e++) {
549
- const i = r.item(e);
550
- if (1 === i.nodeType && "font" === i.localName) {
551
- const e = {};
552
- this.processFont(t, i, e), s[o++] = e;
553
- }
554
- }
555
- return s;
556
- }
557
- processFont(t, e, s) {
558
- t.getValAttrAsBoolean("b", e, !0) && (s.weight = 700), t.getValAttrAsBoolean("i", e, !0) && (s.style = v.Style.Italic), t.getValAttrAsBoolean("strike", e, !0) && (s.strike = !0);
559
- const r = t.evaluate("u", e);
560
- r && (s.underline = r.getAttribute("val") || v.UnderlineStyle.Single), _(t, e, s, "vertAlign", "verticalAlign"), "superscript" === s.verticalAlign ? s.verticalAlign = v.VerticalAlignment.Super : "subscript" === s.verticalAlign && (s.verticalAlign = v.VerticalAlignment.Sub), R(t, e, s, "sz", "size");
561
- const o = t.evaluate("color", e);
562
- this.processDataBarColor(t, o, s, "color"), s.color || (s.color = "auto"), _(t, e, s, "name", "family"), _(t, e, s, "rFont", "family");
563
- const i = t.evaluate("family", e);
564
- if (i) {
565
- const t = i.getAttribute("val");
566
- if (t) switch (t) {
567
- case "1":
568
- s.fallbacks = ["serif"];
569
- break;
570
- case "2":
571
- s.fallbacks = ["sans-serif"];
572
- break;
573
- case "3":
574
- s.fallbacks = ["monospace"];
575
- break;
576
- case "4":
577
- s.fallbacks = ["cursive"];
578
- break;
579
- case "5": s.fallbacks = ["fantasy"];
580
- }
581
- }
582
- return _(t, e, s, "scheme", "scheme"), void 0 !== s.family && void 0 === s.scheme && (s.scheme = v.Scheme.None), B(t, e, s, "shadow", "shadow", !0), B(t, e, s, "outline", "outline", !0), t.getValAttrAsBoolean("condense", e, !0) && (s.letterSpacing = -1), t.getValAttrAsBoolean("extend", e, !0) && (s.letterSpacing = 1), E(t, e, s, "charset", "charset"), s;
583
- }
584
- processFills(t, e, s) {
585
- if (!e) return;
586
- const r = e.childNodes;
587
- let o = 0;
588
- const i = r.length;
589
- for (let e = 0; e < i; e++) {
590
- const i = r.item(e);
591
- 1 === i.nodeType && "fill" === i.localName && this.processFill(t, i, s, o++);
592
- }
593
- return s;
594
- }
595
- processFill(t, e, s, r) {
596
- const o = { type: y.Type.None }, i = e.childNodes;
597
- let n = !1;
598
- const a = i.length;
599
- for (let e = 0; !n && e < a; e++) {
600
- const s = i.item(e);
601
- 1 === s.nodeType && ("gradientFill" === s.localName ? (this.processGradientFill(t, s, o), n = !0) : "patternFill" === s.localName && (this.processPatternFill(t, s, o), n = !0));
602
- }
603
- return s[r] = o, s;
604
- }
605
- processGradientFill(t, e, s) {
606
- if (!e) return;
607
- s.type = y.Type.Gradient;
608
- const r = [];
609
- s.stops = r;
610
- const o = e.getAttribute("type");
611
- o && (s.gradientType = o);
612
- const i = e.hasAttribute("degree") ? parseFloat(e.getAttribute("degree")) : 0;
613
- (i + 90) % 360 != 0 && (s.angle = (i + 90) % 360), (e.hasAttribute("left") || e.hasAttribute("top") || e.hasAttribute("right") || e.hasAttribute("bottom")) && (s.focus = {
614
- left: q(e.getAttribute("left")),
615
- top: q(e.getAttribute("top")),
616
- right: q(e.getAttribute("right")),
617
- bottom: q(e.getAttribute("bottom"))
618
- });
619
- const n = e.childNodes, a = n.length;
620
- for (let e = 0; e < a; e++) {
621
- const s = n.item(e);
622
- if (1 === s.nodeType && "stop" === s.localName) {
623
- const e = {};
624
- r.push(e), e.offset = parseFloat(s.getAttribute("position") ?? "");
625
- const o = t.evaluate("color", s);
626
- this.processDataBarColor(t, o, e, "color");
627
- }
628
- }
629
- return s;
630
- }
631
- processPatternFill(t, e, s) {
632
- if (!e) return;
633
- const r = t.getVisitorParamsState().get("processingDXFs"), o = e.getAttribute("patternType") || (r ? y.BuiltInSheetPattern.Solid : y.BuiltInSheetPattern.None);
634
- if (o === y.BuiltInSheetPattern.None) return { none: !0 };
635
- s.type = y.Type.Pattern, o && (s.patternType = o);
636
- let i = "foreground", n = "background";
637
- const a = s.patternType === y.BuiltInSheetPattern.Solid && r;
638
- let l = a ? "dk1" : "lt1", c = a ? "lt1" : "dk1";
639
- if (a) {
640
- const t = i;
641
- i = n, n = t;
642
- }
643
- const u = t.evaluate("fgColor", e);
644
- this.processDataBarColor(t, u, s, i, l);
645
- const h = t.evaluate("bgColor", e);
646
- return this.processDataBarColor(t, h, s, n, c), a && (s.foreground || (s.foreground = "lt1"), s.background || (s.background = "dk1")), s;
647
- }
648
- processBorders(t, e, s, r) {
649
- if (!e) return;
650
- const o = e.childNodes;
651
- let i = 0;
652
- const n = o.length;
653
- for (let e = 0; e < n; e++) {
654
- const n = o.item(e);
655
- 1 === n.nodeType && "border" === n.localName && this.processBorder(t, n, s, i++, r);
656
- }
657
- return s;
658
- }
659
- processBorder(t, e, s, r, o) {
660
- if (!e) return;
661
- const i = {};
662
- return this.processBorderStroke(t, e, i, b.Edge.Left), this.processBorderStroke(t, e, i, b.Edge.Right), o ? (i.right || i.left) && (i.right ? i.vertical = { ...i.right } : i.vertical = { ...i.left }) : this.processBorderStroke(t, e, i, b.Edge.Vertical), this.processBorderStroke(t, e, i, b.Edge.Top), this.processBorderStroke(t, e, i, b.Edge.Bottom), o ? (i.bottom || i.top) && (i.bottom ? i.horizontal = { ...i.bottom } : i.horizontal = { ...i.top }) : this.processBorderStroke(t, e, i, b.Edge.Horizontal), s[r] = i, s;
663
- }
664
- processBorderStroke(t, e, s, r) {
665
- if (!e) return;
666
- const o = t.evaluate(r, e);
667
- if (!o) return;
668
- const i = {};
669
- o.hasAttribute("style") ? i.style = o.getAttribute("style") : t.getVisitorParamsState().get("processingDXFs") && (i.style = b.StrokeStyle.None);
670
- const n = t.evaluate("color", o);
671
- return n && this.processDataBarColor(t, n, i, "color"), Object.keys(i).length > 0 ? s[r] = i : null;
672
- }
673
- }, q = (t) => {
674
- if (!t) return 0;
675
- const e = parseFloat(t);
676
- return isNaN(e) ? 0 : e;
677
- }, J = {
678
- auto: "auto",
679
- autoNoTable: "automaticExceptTables",
680
- manual: "manual"
681
- }, Z = class {
682
- visit(t, e, s) {
683
- if (!e) return;
684
- let r = t.evaluate("*/cNvPr", e);
685
- return r.item && (r = r.item(0)), r && (t.copyFromAttribute(r, "name", s), t.copyFromAttribute(r, "descr", s, "description"), t.copyFromAttribute(r, "hidden", s, "hidden", t.BOOLEAN_COPY), t.copyFromAttribute(r, "id", s)), s;
686
- }
687
- setContent(t, e) {
688
- const s = t;
689
- void 0 !== s.name && (e.name = s.name, delete s.name), void 0 !== s.description && (e.description = s.description, delete s.description), t.content = e;
690
- }
691
- }, Q = class extends Z {
692
- visit(t, e, s) {
693
- if (!e) return;
694
- if (t.getPath().includes("Fallback") && s.content) {
695
- const r = s.content.json;
696
- return "sp" === s.content.type && r?.xml && void 0 === r.fallbackXml && (r.fallbackXml = t.serializeElement(e) ?? void 0), s;
697
- }
698
- s = super.visit(t, e, s);
699
- const r = t.evaluate("nvSpPr/cNvSpPr", e);
700
- if (r) {
701
- const e = t.evaluate("spLocks", r);
702
- if (e) {
703
- e.hasAttribute("noChangeAspect") && (s.lockAspect = "1" === e.getAttribute("noChangeAspect"));
704
- const t = {};
705
- Object.keys(t).length > 0 && (s.locks = t);
706
- }
707
- }
708
- let o = t.evaluate("*/cNvPr", e);
709
- o?.item && (o = o.item(0));
710
- const i = o?.getAttribute?.("id"), n = i ? parseInt(i, 10) : void 0, a = {
711
- type: "sp",
712
- xml: t.serializeElement(e) ?? void 0,
713
- sourceId: void 0 === n || isNaN(n) ? void 0 : n
714
- };
715
- return this.setContent(s, {
716
- type: "sp",
717
- json: a
718
- }), a;
719
- }
720
- }, tt = "richTypes", et = "richData";
721
- var st = (t) => {
722
- const e = t.getAttribute("val");
723
- return "0" !== e && "false" !== e;
724
- }, rt = {
725
- 1: "serif",
726
- 2: "sans-serif",
727
- 3: "monospace",
728
- 4: "cursive",
729
- 5: "fantasy"
730
- };
731
- function ot(t) {
732
- const e = {}, s = t.childNodes;
733
- for (let t = 0; t < s.length; t++) {
734
- const r = s.item(t);
735
- if (1 === r.nodeType) switch (r.localName) {
736
- case "b":
737
- e.weight = st(r) ? 700 : 400;
738
- break;
739
- case "i":
740
- e.style = st(r) ? v.Style.Italic : v.Style.Normal;
741
- break;
742
- case "strike":
743
- e.strike = st(r);
744
- break;
745
- case "outline":
746
- e.outline = st(r);
747
- break;
748
- case "shadow":
749
- e.shadow = st(r);
750
- break;
751
- case "extend":
752
- e.extend = st(r);
753
- break;
754
- case "u":
755
- e.underline = r.getAttribute("val") || v.UnderlineStyle.Single;
756
- break;
757
- case "vertAlign": {
758
- const t = r.getAttribute("val");
759
- "superscript" === t ? e.verticalAlign = v.VerticalAlignment.Super : "subscript" === t ? e.verticalAlign = v.VerticalAlignment.Sub : "baseline" === t && (e.verticalAlign = v.VerticalAlignment.Baseline);
760
- break;
761
- }
762
- case "sz": {
763
- const t = parseFloat(r.getAttribute("val") ?? "");
764
- isNaN(t) || (e.size = t);
765
- break;
766
- }
767
- case "rFont": {
768
- const t = r.getAttribute("val");
769
- t && (e.family = t);
770
- break;
771
- }
772
- case "family": {
773
- const t = rt[r.getAttribute("val") ?? ""];
774
- t && (e.fallbacks = [t]);
775
- break;
776
- }
777
- case "charset": {
778
- const t = parseInt(r.getAttribute("val") ?? "", 10);
779
- isNaN(t) || (e.charset = t);
780
- break;
781
- }
782
- case "scheme": {
783
- const t = r.getAttribute("val");
784
- t && (e.scheme = t);
785
- break;
786
- }
787
- case "color": {
788
- const t = r.getAttribute("rgb");
789
- if (t && !r.hasAttribute("theme")) {
790
- e.color = "#" + (8 === t.length ? t.substring(2) : t).toUpperCase();
791
- break;
792
- }
793
- const s = n((t) => r.getAttribute(t));
794
- s && (e.color = s);
795
- break;
796
- }
797
- }
798
- }
799
- return Object.keys(e).length > 0 ? e : null;
800
- }
801
- var it = class {
802
- visit(t, e, s) {
803
- if (!e) return;
804
- const r = e.childNodes, o = r.length;
805
- for (let e = 0; e < o; e++) {
806
- const o = r.item(e);
807
- 1 === o.nodeType && "Relationship" === o.localName && this.processRelationship(t, o, s);
808
- }
809
- return s;
810
- }
811
- processRelationship(t, e, s) {
812
- const r = {};
813
- t.copyFromAttribute(e, "Target", r, "target"), t.copyFromAttribute(e, "Type", r, "type"), t.copyFromAttribute(e, "TargetMode", r, "targetMode");
814
- s[e.getAttribute("Id")] = r;
815
- }
816
- }, nt = class {
817
- visit(t, e, s) {
818
- const r = [], o = e.childNodes, i = o.length;
819
- for (let e = 0; e < i; e++) {
820
- const s = o.item(e);
821
- if (1 !== s.nodeType) continue;
822
- const i = this.processProperty(t, s);
823
- i && r.push(i);
824
- }
825
- return r.length > 0 && (s.properties = r), r;
826
- }
827
- processProperty(t, e) {
828
- if (e) return e.getAttribute("xsi:type"), {
829
- key: e.localName,
830
- value: e.textContent || ""
831
- };
832
- }
833
- }, at = class {
834
- visit(t, e, s) {
835
- const r = [], o = e.childNodes, i = o.length;
836
- for (let e = 0; e < i; e++) {
837
- const s = o.item(e);
838
- if (1 !== s.nodeType) continue;
839
- const i = this.processProperty(t, s);
840
- i && r.push(i);
841
- }
842
- return r.length > 0 && (s.properties = r), r;
843
- }
844
- processProperty(t, e) {
845
- if (e) return {
846
- key: e.localName,
847
- value: e.textContent || ""
848
- };
849
- }
850
- }, lt = class {
851
- visit(t, e, s) {
852
- return B(t, e, s, "roundedCorners", "roundedCorners"), E(t, e, s, ".//AlternateContent/Fallback/style", "styleId"), t.getVisitorParamsState().set("types", []), t.getVisitorParamsState().set("axes", /* @__PURE__ */ new Map()), s.range = null, s;
853
- }
854
- afterVisit(t, e, s) {
855
- let r = {};
856
- s.types = r;
857
- let o = {}, i = 0, n = {}, a = 0, l = t.getVisitorParamsState().get("axes");
858
- const c = t.getVisitorParamsState().get("types"), u = c.length;
859
- for (let t = 0; t < u; t++) {
860
- const e = c[t];
861
- if (e.xAxisId) {
862
- const r = e.xAxisId, n = l.get(r);
863
- o[t + ""] = n, e.offsetXAxis = t, delete e.xAxisId, s.xAxes = o, o.length = ++i;
864
- }
865
- if (e.yAxisId) {
866
- const r = e.yAxisId, o = l.get(r);
867
- n[t + ""] = o, e.offsetYAxis = t, delete e.yAxisId, s.yAxes = n, n.length = ++a;
868
- }
869
- r[t + ""] = e;
870
- }
871
- r.length = c.length;
872
- const h = t.getVisitorParamsState().get("series");
873
- if (!h || 0 === h.length) return;
874
- const p = {};
875
- s.series = p;
876
- const d = h.length;
877
- for (let t = 0; t < d; t++) p[t + ""] = h[t];
878
- p.length = d, t.getVisitorParamsState().delete("types"), t.getVisitorParamsState().delete("axes"), t.getVisitorParamsState().delete("series");
879
- }
880
- }, ct = class {
881
- visit(t, e, s) {
882
- let r = {};
883
- return s.plotArea = r, r;
884
- }
885
- }, ut = W, ht = class extends G {
886
- parseType(t, e, s) {
887
- const r = t.getValAttrAsString("barDir", e);
888
- r && (s.type = "col" === r ? "column" : "bar");
889
- }
890
- }, pt = G, dt = class {
891
- constructor(t) {
892
- this.jsonKey = t;
893
- }
894
- visit(t, e, s) {
895
- let r = {}, o = r, i = t.getValAttrAsString("idx", e);
896
- null !== i && (o = {}, o[i] = r);
897
- const n = t.getValAttrAsBoolean("delete", e);
898
- this.parseNumFormat(t, e, r), !0 === n ? (r.showBubbleSize = !1, r.showCatName = !1, r.showLeaderLines = !1, r.showPercentage = !1, r.showSerName = !1, r.showVal = !1, r.showLegendKey = !1) : (B(t, e, r, "showBubbleSize", "showBubbleSize"), B(t, e, r, "showCatName", "showCatName"), B(t, e, r, "showLeaderLines", "showLeaderLines"), B(t, e, r, "showPercent", "showPercentage"), B(t, e, r, "showSerName", "showSerName"), B(t, e, r, "showVal", "showVal"), B(t, e, r, "showLegendKey", "showLegendKey"));
899
- const a = t.evaluate("separator", e);
900
- return null !== a && (r.separator = a.textContent), _(t, e, r, "dLblPos", "position"), s[this.jsonKey] = o, r;
901
- }
902
- parseNumFormat(t, e, s) {
903
- const r = t.evaluate("numFmt", e);
904
- r && (s.formatCode = r.getAttribute("formatCode"), r.hasAttribute("sourceLinked") && (s.sourceLinked = "1" === r.getAttribute("sourceLinked")));
905
- }
906
- }, gt = class {
907
- visit(t, e, s) {
908
- const r = {};
909
- E(t, e, r, "explosion", "explosion");
910
- let o = t.evaluate("cat/*/f", e);
911
- o || (o = t.evaluate("xVal/*/f", e));
912
- let i = null;
913
- null !== o && null !== o.firstChild && (i = o.firstChild.nodeValue), o || (o = t.evaluate("cat/strLit", e), o || (o = t.evaluate("cat/numLit", e)), o && (i = this.parsePointsAsString(t, o))), null !== i && (r.xRange = i);
914
- let n = t.evaluate("val/*/f", e);
915
- n || (n = t.evaluate("yVal/*/f", e));
916
- let a = null;
917
- n && n.firstChild && (a = n.firstChild.nodeValue), n || (n = t.evaluate("val/numLit", e), null !== n && (a = this.parsePointsAsString(t, n))), null !== a && (r.valRange = a), this.parseTitleRangeOrValue(t, e, r), E(t, e, r, "idx", "idx"), B(t, e, r, "smooth", "smooth"), r.offsetChart = t.getVisitorParamsState().get("types").length - 1;
918
- let l = t.getVisitorParamsState().get("series");
919
- return l || (l = [], t.getVisitorParamsState().set("series", l)), l.push(r), r;
920
- }
921
- parseTitleRangeOrValue(t, e, s) {
922
- const r = t.evaluate("tx/strRef/f", e);
923
- if (null !== r) {
924
- const e = r.firstChild.nodeValue;
925
- t.setToPath(s, "title.range", e);
926
- } else {
927
- const r = t.evaluate("tx/v", e);
928
- null !== r && t.setToPath(s, "title.text.simpleRun", r.firstChild.nodeValue);
929
- }
930
- }
931
- parsePointsAsString(t, e) {
932
- let s = "{";
933
- const r = t.getValAttrAsInteger("ptCount", e), o = t.evaluate("pt", e), i = [];
934
- for (let s = 0; o && r && s < r; s++) {
935
- let r = null;
936
- const o = t.evaluate("pt[@idx='" + s + "']/v", e);
937
- o && (r = o.textContent), i[s] = r;
938
- }
939
- for (let t = 0; t < i.length; t++) t > 0 && (s += ","), void 0 !== i[t] && (s += i[t]);
940
- return s += "}", s;
941
- }
942
- afterVisit(t, e, s) {
943
- K(t, e, s);
944
- let r = t.getFromPath(s, "points");
945
- if (r) {
946
- const e = Object.keys(r);
947
- for (let o = 0; o < e.length; o++) {
948
- const i = e[o], n = t.getFromPath(r, i);
949
- if (!n) continue;
950
- let a = t.getFromPath(n, "markers");
951
- a && (t.setToPath(s, "markers.points." + i, a), delete n.markers);
952
- }
953
- }
954
- }
955
- }, mt = class {
956
- DataPointVisitor() {}
957
- visit(t, e, s) {
958
- let r = t.getFromPath(s, "points"), o = null;
959
- r ? o = r : (o = {}, t.setToPath(s, "points", o));
960
- let i = {}, n = t.getValAttrAsString("idx", e);
961
- return null !== n && (o[n] = i), B(t, e, i, "bubble3D", "bubble3D"), E(t, e, i, "explosion", "explosion"), K(t, e, i), i;
962
- }
963
- }, bt = class {
964
- visit(t, e, s) {
965
- const r = e.parentNode.localName;
966
- if ("ser" === r || "dPt" === r) {
967
- const r = {}, o = t.getValAttrAsString("size", e);
968
- null !== o && (r.size = o);
969
- const i = t.getValAttrAsString("symbol", e);
970
- return i && (r.type = i), s.markers = r, r;
971
- }
972
- return null;
973
- }
974
- }, ft = class {
975
- visit(t, e, s) {
976
- let r = {};
977
- this.parseScaling(t, e, r), R(t, e, r, "majorUnit", "majorUnits"), R(t, e, r, "minorUnit", "minorUnits"), B(t, e, r, "delete", "shown"), this.parseOrientation(t, e, r), this.parseNumFormat(t, e, r), _(t, e, r, "majorTickMark", "majorTickMarks"), _(t, e, r, "minorTickMark", "minorTickMarks"), _(t, e, r, "crosses", "crosses"), R(t, e, r, "crossesAt", "crosses"), _(t, e, r, "crossBetween", "crossBetween"), this.parseLabelAlign(t, e, r), E(t, e, r, "lblOffset", "labelOffset"), _(t, e, r, "tickLblPos", "labelPosition");
978
- const o = t.getValAttrAsInteger("noMultiLvlLbl", e);
979
- r.labelMultiLevel = null !== o && 0 === o, E(t, e, r, "tickMarkSkip", "tickMarkSkip"), E(t, e, r, "tickLblSkip", "labelInterval"), this.parseDisplayCustOrBuiltInUnit(e, t, r), this.parseTimeUnits(t, e, r, "majorUnitDates", "majorTimeUnit", "majorUnit"), this.parseTimeUnits(t, e, r, "minorUnitDates", "minorTimeUnit", "minorUnit"), _(t, e, r, "baseTimeUnit", "baseUnitDates"), t.getVisitorParamsState().get("axes") || (t.warn("An axis was read outside a chart; its axes were started fresh.", { onceKey: "xlsx.chart.axesState" }), t.getVisitorParamsState().set("axes", /* @__PURE__ */ new Map()));
980
- const i = t.getValAttrAsString("axId", e);
981
- return t.getVisitorParamsState().get("axes").set(i, r), r;
982
- }
983
- parseTimeUnits(t, e, s, r, o, i) {
984
- const n = {};
985
- let a = t.getValAttrAsString(o, e);
986
- null !== a && (n.dem = a, n.amt = t.getValAttrAsString(i, e)), Object.keys(n).length > 0 && (s[r] = n);
987
- }
988
- parseDisplayCustOrBuiltInUnit(t, e, s) {
989
- let r = e.getValAttrAsString("dispUnits/builtInUnit", t);
990
- r || (r = e.getValAttrAsString("dispUnits/custUnit", t)), r && (s.displayUnits = r);
991
- }
992
- parseLabelAlign(t, e, s) {
993
- let r = t.getValAttrAsString("lblAlgn", e);
994
- null !== r && ("ctr" === r ? s.labelAlign = "center" : "l" === r ? s.labelAlign = "left" : "r" === r && (s.labelAlign = "right"));
995
- }
996
- parseOrientation(t, e, s) {
997
- const r = t.getValAttrAsString("AxPos", e);
998
- null !== r && ("b" === r ? s.orientation = "bottom" : "l" === r ? s.orientation = "left" : "r" === r ? s.orientation = "right" : "t" === r && (s.orientation = "top"));
999
- }
1000
- parseNumFormat(t, e, s) {
1001
- const r = {}, o = t.evaluate("numFmt", e);
1002
- null !== o && (o.hasAttribute("formatCode") && (r.formatCode = o.getAttribute("formatCode")), o.hasAttribute("sourceLinked") && (r.sourceLinked = "1" === o.getAttribute("sourceLinked"))), Object.keys(r).length > 0 && (s.labels = r);
1003
- }
1004
- parseScaling(t, e, s) {
1005
- const r = t.getValAttrAsString("scaling/orientation", e);
1006
- null !== r && (s.inverted = "minMax" !== r);
1007
- const o = t.getValAttrAsFloat("scaling/logBase", e);
1008
- null !== o && (s.logBase = o, s.scaleType = "log"), R(t, e, s, "scaling/max", "max"), R(t, e, s, "scaling/min", "min");
1009
- }
1010
- afterVisit(t, e, s) {
1011
- s.fill && s.labels && (s.labels.fill = s.fill, delete s.fill);
1012
- let r = t.getValAttrAsBoolean("delete", e);
1013
- null !== r && (t.setToPath(s, "labels.shown", !0 !== r), t.setToPath(s, "shown", !0 !== r));
1014
- const o = t.getFromPath(s, "dispUnits.displayUnitsLabel");
1015
- o && (t.setToPath(s, "displayUnitsLabel", o), delete s.dispUnits);
1016
- const i = t.evaluate("title", e);
1017
- t.setToPath(s, "title.shown", null !== i);
1018
- const n = t.evaluate("minorGridlines", e);
1019
- t.setToPath(s, "gridLinesMinor.shown", null !== n);
1020
- const a = t.evaluate("majorGridlines", e);
1021
- t.setToPath(s, "gridLinesMajor.shown", null !== a);
1022
- }
1023
- }, At = $, yt = class {
1024
- visit(t, e, s) {
1025
- const r = t.getVisitorParamsState().get("series");
1026
- let o = t.getValAttrAsInteger("idx", e), i = null !== o ? r[o] : void 0;
1027
- if (i) {
1028
- let s = t.getFromPath(i, "title");
1029
- s || (s = {}, t.setToPath(i, "title", s));
1030
- let r = s, o = t.getValAttrAsBoolean("delete", e);
1031
- return null !== o && (r.shown = !o), r;
1032
- }
1033
- return s;
1034
- }
1035
- }, vt = class {
1036
- visit(t, e, s) {
1037
- const r = {};
1038
- return B(t, e, r, "overlay", "overlay"), _(t, e, r, "legendPos", "position"), s.legend = r, r;
1039
- }
1040
- }, Nt = class extends W {
1041
- visit(t, e, s) {
1042
- const r = this.getFill(t, e);
1043
- Object.keys(r).length > 0 && (s.fillNegative = r);
1044
- const o = this.getStroke(t, e);
1045
- return Object.keys(o).length > 0 && (s.strokeNegative = o), s;
1046
- }
1047
- }, Ft = class extends $ {
1048
- constructor(t = "title") {
1049
- super(t);
1050
- }
1051
- parseTitleRangeOrValue(t, e, s) {
1052
- let r = t.evaluate("tx/strRef/f", e) ?? null;
1053
- if (r) {
1054
- const e = r.firstElementChild.nodeValue;
1055
- t.setToPath(s, "range", e);
1056
- }
1057
- }
1058
- visit(t, e, s) {
1059
- const r = {};
1060
- B(t, e, r, "overlay", "overlay"), s[this._jsonKey] = r;
1061
- let o = t.getFromPath(r, this.getTextPath());
1062
- o || (o = {}), this.parseTitleRangeOrValue(t, e, r);
1063
- const i = t.evaluate("txPr", e);
1064
- i && this.parseTextElement(t, i, o, !1);
1065
- const n = t.evaluate("tx/rich", e);
1066
- return n && this.parseTextElement(t, n, o, !0), Object.keys(o).length > 0 && t.setToPath(r, "text", o), r;
1067
- }
1068
- afterVisit(t, e, s) {
1069
- if (s?.text) {
1070
- const t = s.text?.rotation ?? null;
1071
- null !== t && (s.rotation = parseInt(t), delete s.title.rotation);
1072
- }
1073
- }
1074
- }, Ct = class {
1075
- visit(t, e, s) {
1076
- const r = t.evaluate("manualLayout", e);
1077
- if (r) {
1078
- let e = {};
1079
- R(t, r, e, "x", "x"), R(t, r, e, "y", "y"), R(t, r, e, "w", "w"), R(t, r, e, "h", "h"), _(t, r, e, "xMode", "xMode"), _(t, r, e, "yMode", "yMode"), _(t, r, e, "wMode", "wMode"), _(t, r, e, "hMode", "hMode"), Object.keys(e).length > 0 && (s.manualLayout = e);
1080
- }
1081
- return s;
1082
- }
1083
- }, wt = class {
1084
- visit(t, e, s) {
1085
- return s.name = e.getAttribute("name"), s;
1086
- }
1087
- }, Pt = class extends U {
1088
- visit(t, e, s) {
1089
- const r = {};
1090
- r.name = e.getAttribute("name");
1091
- const o = e.childNodes, i = o.length;
1092
- for (let s = 0; s < i; s++) {
1093
- const i = o.item(s);
1094
- if (1 === i.nodeType) {
1095
- let s = i.localName;
1096
- const o = t.evaluate(s, e);
1097
- r[s] = this.processAdjColor(t, o);
1098
- }
1099
- }
1100
- return Object.keys(r).length > 0 && (s.colors = r), r;
1101
- }
1102
- }, St = class {
1103
- visit(t, e, s) {
1104
- const r = {};
1105
- r.name = e.getAttribute("name");
1106
- const o = t.evaluate("majorFont", e), i = this.processFontElement(t, o, {});
1107
- i && (r.majorFont = i.family, i.fallbacks && (r.majorFallbacks = i.fallbacks));
1108
- const n = t.evaluate("minorFont", e), a = this.processFontElement(t, n, {});
1109
- return a && (r.minorFont = a.family, a.fallbacks && (r.minorFallbacks = a.fallbacks)), s.fonts = r, r;
1110
- }
1111
- processFontElement(t, e, s) {
1112
- if (!e) return;
1113
- const r = t.evaluate("latin", e);
1114
- if (!r) return;
1115
- const o = r.getAttribute("typeface");
1116
- o && (s.family = o);
1117
- const i = r.getAttribute("panose");
1118
- return i && (s.fallbacks = [v.getPanoseFallback(i)]), s;
1119
- }
1120
- }, xt = class extends U {
1121
- visit(t, e, s) {
1122
- const r = this.parseFillList(t, e, "fillStyleLst"), o = this.parseLnList(t, e, "lnStyleLst"), i = this.parseEffectStyleList(t, e, "effectStyleLst"), n = this.parseFillList(t, e, "bgFillStyleLst");
1123
- if (r && o && i && n) return s.fillStyleLst = r, s.lnStyleLst = o, s.effectStyleLst = i, void (s.bgFillStyleLst = n);
1124
- const a = t.serializeElement(e);
1125
- a && (s.formatSchemeXml = a);
1126
- }
1127
- parseFillList(t, e, s) {
1128
- const r = t.evaluate(s, e);
1129
- if (!r) return;
1130
- const o = [], i = r.childNodes, n = i.length;
1131
- for (let e = 0; e < n; e++) {
1132
- const s = i.item(e);
1133
- if (1 !== s.nodeType) continue;
1134
- const r = this.parseFillListItem(t, s);
1135
- if (void 0 === r) return;
1136
- o.push(r);
1137
- }
1138
- return o;
1139
- }
1140
- parseFillListItem(t, e) {
1141
- switch (e.localName) {
1142
- case "noFill": return { type: y.Type.None };
1143
- case "solidFill": {
1144
- const s = this.processAdjColor(t, e);
1145
- return s ? {
1146
- type: y.Type.Solid,
1147
- color: s
1148
- } : void 0;
1149
- }
1150
- case "gradFill": return this.processGradFill(t, e);
1151
- case "pattFill": return this.processPatternFill(t, e);
1152
- default: return;
1153
- }
1154
- }
1155
- parseLnList(t, e, s) {
1156
- const r = t.evaluate(s, e);
1157
- if (!r) return;
1158
- const o = [], i = r.childNodes, n = i.length;
1159
- for (let e = 0; e < n; e++) {
1160
- const s = i.item(e);
1161
- if (1 === s.nodeType) {
1162
- if (t.evaluate("headEnd", s) || t.evaluate("tailEnd", s)) return;
1163
- o.push(this.parseLn(t, s));
1164
- }
1165
- }
1166
- return o;
1167
- }
1168
- parseEffectStyleList(t, e, s) {
1169
- const r = t.evaluate(s, e);
1170
- if (!r) return;
1171
- const o = [], i = r.childNodes, n = i.length;
1172
- for (let e = 0; e < n; e++) {
1173
- const s = i.item(e);
1174
- if (1 !== s.nodeType) continue;
1175
- if (t.evaluate("scene3d", s) || t.evaluate("sp3d", s)) return;
1176
- const r = this.getEffects(t, s);
1177
- if (void 0 === r) return;
1178
- o.push(r ?? []);
1179
- }
1180
- return o;
1181
- }
1182
- }, Tt = class {
1183
- visit(t, e, s) {
1184
- if (!e) return;
1185
- const r = {}, o = e.getAttribute("r:id");
1186
- if (o) {
1187
- const e = t.getRef(o);
1188
- "string" == typeof e && (r.address = e);
1189
- }
1190
- return t.copyFromAttribute(e, "tooltip", r, "screenTip"), t.copyFromAttribute(e, "history", r, "history", t.BOOLEAN_COPY), t.copyFromAttribute(e, "tgtFrame", r, "target"), s.hyperlink = r, r;
1191
- }
1192
- }, Ot = class {
1193
- visit(t, e, s) {
1194
- if (!e) return;
1195
- const r = {}, o = [];
1196
- return this.processFilterColumns(t, e, o, s), o.length > 0 && (r.conditions = o), Object.keys(r).length > 0 && (s.filter = r), r;
1197
- }
1198
- processColorFilter(t, e) {
1199
- const s = {}, r = {
1200
- operator: f.BuiltInOperatorNames.Color,
1201
- param: s
1202
- };
1203
- return t.copyFromAttribute(e, "cellColor", s, "cellColor", t.BOOLEAN_COPY), t.copyFromAttribute(e, "dxfId", s, "styleId", t.INT_COPY), r;
1204
- }
1205
- processCustomFilter(t, e) {
1206
- return h({
1207
- operator: e.getAttribute("operator"),
1208
- val: e.getAttribute("val")
1209
- });
1210
- }
1211
- processCustomFilters(t, e) {
1212
- const s = e.getAttribute("and"), r = "and" === s || "1" === s;
1213
- e.getAttribute("val");
1214
- const o = [], i = {
1215
- operator: r ? f.BuiltInOperatorNames.And : f.BuiltInOperatorNames.Or,
1216
- param: o
1217
- }, n = e.childNodes, a = n.length;
1218
- for (let e = 0; e < a; e++) {
1219
- const s = n.item(e);
1220
- if (1 !== s.nodeType) continue;
1221
- let r = null;
1222
- "customFilter" === s.localName && (r = this.processCustomFilter(t, s)), r && o.push(r);
1223
- }
1224
- return 1 === o.length ? o[0] : i;
1225
- }
1226
- processDynamicFilter(t, e) {
1227
- const s = {}, r = {
1228
- operator: f.BuiltInOperatorNames.TimePeriod,
1229
- param: s
1230
- };
1231
- let o = e.getAttribute("type");
1232
- return "aboveAverage" === o ? o = f.AverageType.Above : "belowAverage" === o && (o = f.AverageType.Below), Object.values(f.AverageType).includes(o) ? (r.operator = f.BuiltInOperatorNames.Average, t.copyFromAttribute(e, "val", s, "stdDevs", t.INT_COPY)) : t.copyFromAttribute(e, "val", s, "anchorDate", t.INT_COPY), t.copyFromAttribute(e, "type", s, "operator"), t.copyFromAttribute(e, "maxVal", s, "maxVal", t.INT_COPY), r;
1233
- }
1234
- processDateGroupItem(t, e) {
1235
- const s = {};
1236
- return t.copyFromAttribute(e, "dateTimeGrouping", s, "group"), t.copyFromAttribute(e, "day", s, "day", t.INT_COPY), t.copyFromAttribute(e, "hour", s, "hour", t.INT_COPY), t.copyFromAttribute(e, "minute", s, "minute", t.INT_COPY), t.copyFromAttribute(e, "month", s, "month", t.INT_COPY), t.copyFromAttribute(e, "second", s, "second", t.INT_COPY), t.copyFromAttribute(e, "year", s, "year", t.INT_COPY), s;
1237
- }
1238
- processFilterItem(t, e) {
1239
- if (e.hasAttribute("val")) return e.getAttribute("val");
1240
- }
1241
- processFilters(t, e) {
1242
- const s = {}, r = {
1243
- operator: f.BuiltInOperatorNames.InSet,
1244
- param: s
1245
- };
1246
- t.copyFromAttribute(e, "blank", r, "blank", t.BOOLEAN_COPY), t.copyFromAttribute(e, "calendarType", r, "calendarType");
1247
- let o = [], i = [];
1248
- const n = e.childNodes, a = n.length;
1249
- for (let e = 0; e < a; e++) {
1250
- const s = n.item(e);
1251
- if (1 === s.nodeType) {
1252
- if ("dateGroupItem" === s.localName) {
1253
- const e = this.processDateGroupItem(t, s);
1254
- e && o.push(e);
1255
- } else if ("filter" === s.localName) {
1256
- const e = this.processFilterItem(t, s);
1257
- void 0 !== e && i.push(e);
1258
- }
1259
- }
1260
- }
1261
- return o.length > 0 && (s.dateGroups = o), i.length > 0 && (s.items = i), r;
1262
- }
1263
- processIcon(t, e) {
1264
- const s = {}, r = {
1265
- operator: f.BuiltInOperatorNames.Icon,
1266
- param: s
1267
- };
1268
- return t.copyFromAttribute(e, "iconId", s, "iconId", t.INT_COPY), t.copyFromAttribute(e, "iconSet", s), r;
1269
- }
1270
- processTop10(t, e) {
1271
- const s = {}, r = {
1272
- operator: f.BuiltInOperatorNames.TopN,
1273
- param: s
1274
- };
1275
- return t.copyFromAttribute(e, "filterVal", s, "filterVal", t.FLOAT_COPY), t.copyFromAttribute(e, "percent", s, "percent", t.BOOLEAN_COPY), t.copyFromAttribute(e, "top", s, "top", t.BOOLEAN_COPY), t.copyFromAttribute(e, "val", s, "val", t.FLOAT_COPY), r;
1276
- }
1277
- processFilterCriteria(t, e) {
1278
- if (!e) return;
1279
- const s = e.childNodes;
1280
- let r;
1281
- const o = s.length;
1282
- for (let e = 0; e < o; e++) {
1283
- const o = s.item(e);
1284
- 1 === o.nodeType && ("colorFilter" === o.localName ? r = this.processColorFilter(t, o) : "customFilters" === o.localName ? r = this.processCustomFilters(t, o) : "dynamicFilter" === o.localName ? r = this.processDynamicFilter(t, o) : "filters" === o.localName ? r = this.processFilters(t, o) : "iconFilter" === o.localName ? r = this.processIcon(t, o) : "top10" === o.localName && (r = this.processTop10(t, o)));
1285
- }
1286
- return r;
1287
- }
1288
- processFilterColumn(e, s, r) {
1289
- if (!s) return null;
1290
- if (!s.hasAttribute("colId")) return;
1291
- const o = parseInt(s.getAttribute("colId"));
1292
- let i = !1;
1293
- if (s.hasAttribute("hiddenButton") && (i = t(s.getAttribute("hiddenButton"))), i && r) {
1294
- let t = r.hiddenButtons;
1295
- t || (t = [], r.hiddenButtons = t), t.push(o);
1296
- }
1297
- let n = !1;
1298
- if (s.hasAttribute("showButton") && (n = t(s.getAttribute("showButton"))), n && r) {
1299
- let t = r.showButtons;
1300
- !0 !== t && (t || (t = [], r.showButtons = t), t[o] = !0);
1301
- }
1302
- const a = this.processFilterCriteria(e, s);
1303
- return a ? (a.index = o, a) : null;
1304
- }
1305
- processFilterColumns(t, e, s, r) {
1306
- if (!e) return;
1307
- const o = e.childNodes, i = o.length;
1308
- for (let e = 0; e < i; e++) {
1309
- const i = o.item(e);
1310
- if (1 === i.nodeType && "filterColumn" === i.localName) {
1311
- const e = this.processFilterColumn(t, i, r);
1312
- e && s.push(e);
1313
- }
1314
- }
1315
- return s;
1316
- }
1317
- }, kt = class {
1318
- visit(e, s, r) {
1319
- if (!s) return;
1320
- const o = s.getAttribute("ref"), i = {};
1321
- s.hasAttribute("caseSensitive") && (i.collatorOptions = t(s.getAttribute("caseSensitive")) ? w.CaseSensitiveOptions : w.CaseInsensitiveOptions);
1322
- const n = s.getAttribute("sortMethod");
1323
- null != n && "none" !== n && ("stroke" === n ? i.collatorOptions = {
1324
- ...i.collatorOptions,
1325
- collation: "stroke"
1326
- } : "pinYin" === n && (i.collatorOptions = {
1327
- ...i.collatorOptions,
1328
- collation: "pinyin"
1329
- }));
1330
- const a = {};
1331
- s.hasAttribute("columnSort") && t(s.getAttribute("columnSort")) && (a.axis = N.Axis.Column);
1332
- const l = g.fastStringToRange(o), c = [];
1333
- return this.processSortConditions(e, s, c, l, i), c.length > 0 && (a.sorts = c), Object.keys(c).length > 0 && (r.sort = a), a;
1334
- }
1335
- processSortCondition(e, s, r, o) {
1336
- if (!s) return null;
1337
- const i = {};
1338
- if (!s.hasAttribute("ref")) return void e.warn("A sort condition has no ref; it was dropped.", { onceKey: "xlsx.sheet.sort.noRef" });
1339
- if (s.hasAttribute("ref")) {
1340
- const t = s.getAttribute("ref"), e = g.fastStringToRange(t);
1341
- i.index = r ? e.colStart - r.colStart : e.colStart;
1342
- }
1343
- const n = { ...o };
1344
- return i.criteria = n, n.reverse = !1, s.hasAttribute("descending") && (n.reverse = t(s.getAttribute("descending"))), e.copyFromAttribute(s, "sortBy", n, "sortOn"), e.copyFromAttribute(s, "dxfId", n), e.copyFromAttribute(s, "iconSet", n), e.copyFromAttribute(s, "customList", n), i;
1345
- }
1346
- processSortConditions(t, e, s, r, o) {
1347
- if (!e) return;
1348
- const i = e.childNodes, n = i.length;
1349
- for (let e = 0; e < n; e++) {
1350
- const n = i.item(e);
1351
- if (1 === n.nodeType && "sortCondition" === n.localName) {
1352
- const e = this.processSortCondition(t, n, r, o);
1353
- e && s.push(e);
1354
- }
1355
- }
1356
- }
1357
- }, Vt = class extends H {
1358
- visit(t, e, s) {
1359
- this.processNumFmts(t, t.evaluate("numFmts", e), null), t.getVisitorParamsState().set("colorsToProcess", /* @__PURE__ */ new Set());
1360
- const r = {
1361
- fills: {},
1362
- fonts: {},
1363
- borders: {}
1364
- };
1365
- this.processFonts(t, t.evaluate("fonts", e), r.fonts), this.processFills(t, t.evaluate("fills", e), r.fills), this.processBorders(t, t.evaluate("borders", e), r.borders, !0), r.fills[0] = { type: y.Type.None }, r.fills[1] = {
1366
- type: y.Type.Pattern,
1367
- patternType: y.BuiltInSheetPattern.Gray125
1368
- }, r.borders[0] = {
1369
- bottom: { style: b.StrokeStyle.None },
1370
- left: { style: b.StrokeStyle.None },
1371
- right: { style: b.StrokeStyle.None },
1372
- top: { style: b.StrokeStyle.None }
1373
- };
1374
- const o = [];
1375
- this.processXFs(t, t.evaluate("cellStyleXfs", e), o, r, null, !1);
1376
- const i = /* @__PURE__ */ new Map();
1377
- if (o.length > 0) {
1378
- const r = [];
1379
- this.processCellStyles(t, t.evaluate("cellStyles", e), r, o, i), s.named = r;
1380
- }
1381
- const n = [];
1382
- this.processXFs(t, t.evaluate("cellXfs", e), n, r, i), Object.keys(n).length > 0 && (s.direct = n);
1383
- const a = this.collectHiddenXfs(t.evaluate("cellXfs", e));
1384
- a.size > 0 && t.getVisitorParamsState().set(c, a);
1385
- const l = [];
1386
- return this.processDXFs(t, t.evaluate("dxfs", e), l), this.processTableStyles(t, t.evaluate("tableStyles", e), s, l), this.processIndexColors(t, t.evaluate("colors/indexedColors", e), s), this.processMruColors(t, t.evaluate("colors/mruColors", e), s), s;
1387
- }
1388
- processIndexColors(t, e, s) {
1389
- if (!e) return;
1390
- const r = [], o = e.childNodes, i = o.length;
1391
- for (let e = 0; e < i; e++) {
1392
- const s = o.item(e);
1393
- if (1 === s.nodeType && "rgbColor" === s.localName) {
1394
- const e = { color: null };
1395
- this.processDataBarColor(t, s, e, "color"), e.color && r.push(e.color);
1396
- }
1397
- }
1398
- s.indexedColors = r;
1399
- }
1400
- processMruColors(t, e, s) {
1401
- if (!e) return;
1402
- const r = [], o = e.childNodes, i = o.length;
1403
- for (let e = 0; e < i; e++) {
1404
- const s = o.item(e);
1405
- if (1 === s.nodeType && "color" === s.localName) {
1406
- const e = { color: null };
1407
- this.processDataBarColor(t, s, e, "color"), e.color && r.push(e.color);
1408
- }
1409
- }
1410
- r.length > 0 && (s.mruColors = r);
1411
- }
1412
- processNumFmts(t, e, s) {
1413
- if (!e) return;
1414
- const r = /* @__PURE__ */ new Map();
1415
- if (t.getVisitorParamsState().set("numFmts", r), !e) return;
1416
- const o = e.childNodes, i = o.length;
1417
- for (let t = 0; t < i; t++) {
1418
- const e = o.item(t);
1419
- if (1 === e.nodeType && "numFmt" === e.localName) {
1420
- const t = e.getAttribute("numFmtId"), s = e.getAttribute("formatCode");
1421
- if (t && s) {
1422
- const e = s;
1423
- r.set(parseInt(t), e);
1424
- }
1425
- }
1426
- }
1427
- }
1428
- processXFs(t, e, s, r, o = null, i = !0) {
1429
- if (!e) return;
1430
- const n = e.childNodes, a = n.length;
1431
- for (let e = 0; e < a; e++) {
1432
- const a = n.item(e);
1433
- if (1 === a.nodeType && "xf" === a.localName) {
1434
- const e = {};
1435
- this.processXF(t, a, e, r, o, i), s.push(e);
1436
- }
1437
- }
1438
- }
1439
- processXF(e, s, r, o, i, n) {
1440
- if (!s) return;
1441
- const a = s.getAttribute("xfId");
1442
- if (a && i) {
1443
- const t = i.get(parseInt(a));
1444
- t && t !== F.BuiltInName.Normal && (r.named = t);
1445
- }
1446
- const l = (e) => !(!n && s.hasAttribute(e)) || t(s.getAttribute(e)), c = (e) => !n || s.hasAttribute(e) && t(s.getAttribute(e)), u = "0", h = n ? u : void 0;
1447
- if (l("applyFont")) {
1448
- const t = s.getAttribute("fontId") ?? h;
1449
- if (void 0 !== t && (t !== u || c("applyFont"))) {
1450
- const e = o.fonts[t];
1451
- void 0 !== e && (r.font = e);
1452
- }
1453
- }
1454
- if (l("applyFill")) {
1455
- const t = s.getAttribute("fillId") ?? h;
1456
- if (void 0 !== t && (t !== u || c("applyFill"))) {
1457
- const e = o.fills[t];
1458
- void 0 !== e && Object.keys(e).length > 0 && (r.fill = e);
1459
- }
1460
- }
1461
- if (l("applyBorder")) {
1462
- const t = s.getAttribute("borderId") ?? h;
1463
- if (void 0 !== t && (t !== u || c("applyBorder"))) {
1464
- const e = o.borders[t];
1465
- void 0 !== e && (r.borders = e);
1466
- }
1467
- }
1468
- if (l("applyNumberFormat")) {
1469
- const t = s.getAttribute("numFmtId") ?? h;
1470
- if (void 0 !== t && (t !== u || c("applyNumberFormat"))) {
1471
- const s = parseInt(t);
1472
- let o;
1473
- const i = e.getVisitorParamsState();
1474
- if (i) {
1475
- const t = i.get("numFmts");
1476
- t && (o = t.get(s)), r.numberFormat = o ?? s;
1477
- } else e.warn("Number formats were unavailable; a cell format was not read.", { onceKey: "xlsx.style.numberFormat.state" });
1478
- }
1479
- }
1480
- if (l("applyAlignment")) {
1481
- const t = e.evaluate("alignment", s);
1482
- (t || c("applyAlignment")) && this.processAlignment(e, t, r);
1483
- }
1484
- if (l("applyProtection")) {
1485
- const t = e.evaluate("protection", s);
1486
- (t || c("applyProtection")) && this.processProtection(e, t, r);
1487
- }
1488
- const p = t(s.getAttribute("quotePrefix") ?? "");
1489
- p && (r.quotePrefix = p);
1490
- }
1491
- processAlignment(e, s, r) {
1492
- const o = {};
1493
- if (s?.hasAttribute("horizontal") ? o.horizontal = s.getAttribute("horizontal") : o.horizontal = C.HorizontalAlignment.General, s?.hasAttribute("vertical") ? o.vertical = s.getAttribute("vertical") : o.vertical = C.VerticalAlignment.Bottom, s?.hasAttribute("indent") ? o.indent = parseInt(s.getAttribute("indent")) : o.indent = 0, s?.hasAttribute("relativeIndent") ? o.relativeIndent = parseInt(s.getAttribute("relativeIndent")) : o.relativeIndent = 0, t(s?.getAttribute("wrapText") ?? "") ? o.overflow = C.Overflow.Wrap : o.overflow = C.Overflow.Visible, t(s?.getAttribute("shrinkToFit") ?? "") && (o.overflow = C.Overflow.Shrink), s?.hasAttribute("textRotation")) {
1494
- let t = parseFloat(s.getAttribute("textRotation"));
1495
- t > 0 && t <= 90 ? t = 360 - t : t > 90 && t <= 180 ? t -= 90 : 255 === t && (t = 0, o.stacked = !0), o.rotation = t;
1496
- } else o.rotation = 0;
1497
- s?.hasAttribute("justifyLastLine") && (o.justifyLastLine = t(s.getAttribute("justifyLastLine")));
1498
- const i = s?.getAttribute("readingOrder");
1499
- return i && ("0" === i ? o.readingDirection = C.ReadingDirection.Auto : "1" === i ? o.readingDirection = C.ReadingDirection.LeftToRight : "2" === i ? o.readingDirection = C.ReadingDirection.RightToLeft : e.warn(`Invalid readingOrder '${i}'; the direction was left automatic.`, { onceKey: "xlsx.style.readingOrder" })), Object.keys(o).length > 0 && (r.alignment = o), r;
1500
- }
1501
- collectHiddenXfs(e) {
1502
- const s = /* @__PURE__ */ new Set();
1503
- if (!e) return s;
1504
- const r = e.childNodes;
1505
- let o = 0;
1506
- for (let e = 0; e < r.length; e++) {
1507
- const i = r.item(e);
1508
- if (1 !== i.nodeType || "xf" !== i.localName) continue;
1509
- const n = i.childNodes;
1510
- for (let e = 0; e < n.length; e++) {
1511
- const r = n.item(e);
1512
- 1 === r.nodeType && "protection" === r.localName && t(r.getAttribute("hidden") ?? "") && s.add(o);
1513
- }
1514
- o++;
1515
- }
1516
- return s;
1517
- }
1518
- processProtection(e, s, r) {
1519
- if (!s) return;
1520
- const o = s.getAttribute("locked");
1521
- return r.protection = { alwaysUnlocked: !!o && !t(o) }, r;
1522
- }
1523
- processDXF(t, e, s) {
1524
- if (!e) return;
1525
- const r = e.childNodes, o = r.length;
1526
- for (let e = 0; e < o; e++) {
1527
- const o = r.item(e);
1528
- if (1 === o.nodeType && "font" === o.localName) {
1529
- const e = {};
1530
- this.processFont(t, o, e), s.font = e;
1531
- } else if (1 === o.nodeType && "fill" === o.localName) {
1532
- const e = [];
1533
- this.processFill(t, o, e, 0), e.length > 0 && e[0] && (s.fill = e[0]);
1534
- } else if (1 === o.nodeType && "border" === o.localName) {
1535
- const e = [];
1536
- this.processBorder(t, o, e, 0, !1), e.length > 0 && e[0] && (s.borders = e[0]);
1537
- } else if (1 === o.nodeType && "numFmt" === o.localName) {
1538
- const t = o.getAttribute("formatCode");
1539
- if (t) s.numberFormat = t;
1540
- else {
1541
- const t = o.getAttribute("numFmtId");
1542
- t && (s.numberFormat = Number(t));
1543
- }
1544
- } else 1 === o.nodeType && "alignment" === o.localName && this.processAlignment(t, o, s);
1545
- }
1546
- }
1547
- processDXFs(t, e, s) {
1548
- if (!e) return;
1549
- t.getVisitorParamsState().set("processingDXFs", !0);
1550
- const r = /* @__PURE__ */ new Map();
1551
- t.getVisitorParamsState().set("dxfs", r);
1552
- const o = e.childNodes, i = o.length;
1553
- for (let e = 0; e < i; e++) {
1554
- const i = o.item(e);
1555
- if (1 === i.nodeType && "dxf" === i.localName) {
1556
- const e = {};
1557
- this.processDXF(t, i, e);
1558
- const o = s.length;
1559
- r.set(o, e), s.push(e);
1560
- }
1561
- }
1562
- t.getVisitorParamsState().delete("processingDXFs");
1563
- }
1564
- processTableStyle(e, s, r, o, i = !1) {
1565
- const n = s.getAttribute("name"), a = { name: n };
1566
- s.hasAttribute("table") && (a.table = t(s.getAttribute("table"))), s.hasAttribute("pivot") && (a.pivot = t(s.getAttribute("pivot"))), i && !a.pivot && o.unshift(null);
1567
- const l = s.childNodes, c = l.length;
1568
- for (let t = 0; t < c; t++) {
1569
- const s = l.item(t);
1570
- if (1 === s.nodeType && "tableStyleElement" === s.localName) {
1571
- const t = s.getAttribute("type"), r = s.getAttribute("dxfId");
1572
- let i = null != r ? o?.[r] : void 0;
1573
- i || (e.warn(`A table style names a format that does not exist (dxfId '${r}').`, { onceKey: "xlsx.style.tableStyle.dxf" }), i = {}), a[t] = i;
1574
- let n = null;
1575
- s.hasAttribute("size") && (n = parseInt(s.getAttribute("size"))), n && !isNaN(n) && (i.size = n);
1576
- }
1577
- }
1578
- delete a.name, r[n] = a;
1579
- }
1580
- processTableStyles(t, e, s, r, o) {
1581
- if (!e) return;
1582
- const i = {}, n = e.getAttribute("defaultTableStyle");
1583
- n && (i.defaultTableStyle = n);
1584
- const a = e.getAttribute("defaultPivotStyle");
1585
- a && (i.defaultPivotStyle = a);
1586
- const l = e.childNodes, c = {}, u = l.length;
1587
- for (let e = 0; e < u; e++) {
1588
- const s = l.item(e);
1589
- 1 === s.nodeType && "tableStyle" === s.localName && this.processTableStyle(t, s, c, r, o);
1590
- }
1591
- return Object.keys(c).length > 0 && (i.styles = c), Object.keys(i).length > 0 && (s.tables = i), s;
1592
- }
1593
- processCellStyles(e, s, r, o, i) {
1594
- if (!s) return;
1595
- const n = s.childNodes, a = n.length;
1596
- for (let e = 0; e < a; e++) {
1597
- const s = n.item(e);
1598
- if (1 === s.nodeType && "cellStyle" === s.localName) {
1599
- const e = parseInt(s.getAttribute("xfId") ?? ""), n = s.getAttribute("name"), a = s.getAttribute("builtinId");
1600
- let l = n;
1601
- if (null !== a) {
1602
- const t = F.builtInNameFromId(parseInt(a));
1603
- void 0 !== t && (l = t);
1604
- }
1605
- if (i.set(e, l), !o[e]) continue;
1606
- const c = {
1607
- name: l,
1608
- style: o[e]
1609
- };
1610
- s.getAttribute("hidden") && (c.hidden = t(s.getAttribute("hidden"))), s.getAttribute("iLevel") && (c.iLevel = parseInt(s.getAttribute("iLevel"))), r.push(c);
1611
- }
1612
- }
1613
- }
1614
- afterVisit(t, e, s) {}
1615
- }, It = class extends H {
1616
- visit(t, e, s) {
1617
- return this.processSheetRefs(t, t.evaluate("sheets", e), s), this.processExternalReferences(t, t.evaluate("externalReferences", e), s), this.processBookViews(t, t.evaluate("bookViews", e), s), this.processDefinedNames(t, t.evaluate("definedNames", e), s), this.processCalcPr(t, t.evaluate("calcPr", e), s), this.processPivotCaches(t, t.evaluate("pivotCaches", e), s), this.processWorkbookProtection(t, t.evaluate("workbookProtection", e), s), this.processWorkbookPr(t, t.evaluate("workbookPr", e), s), s;
1618
- }
1619
- processPassword(t, e, s, r = "workbook", o = "password") {
1620
- if (!e) return;
1621
- const i = {};
1622
- t.copyFromAttribute(e, `${r}AlgorithmName`, i, "algorithm"), t.copyFromAttribute(e, `${r}HashValue`, i, "hash"), t.copyFromAttribute(e, `${r}SaltValue`, i, "salt"), t.copyFromAttribute(e, `${r}SpinCount`, i, "spinCount", t.INT_COPY), Object.keys(i).length > 0 && (s[o] = i);
1623
- }
1624
- processWorkbookProtection(t, e, s) {
1625
- if (!e) return;
1626
- const r = {};
1627
- this.processPassword(t, e, r, "workbook", "password"), this.processPassword(t, e, r, "revisions", "revisionsPassword");
1628
- for (const t of p) r[t.key] = u(t, e.getAttribute(t.attribute));
1629
- return s.protection = r, s;
1630
- }
1631
- processCalcPr(t, e, s) {
1632
- if (!e) return;
1633
- const r = {};
1634
- t.copyFromAttribute(e, "calcMode", r, "calcMode", (t) => J[t] ?? null), t.copyFromAttribute(e, "fullCalcOnLoad", r, "fullCalcOnLoad", t.BOOLEAN_COPY), t.copyFromAttribute(e, "calcOnSave", r, "calcOnSave", t.BOOLEAN_COPY), t.copyFromAttribute(e, "calcCompleted", r, "calcCompleted", t.BOOLEAN_COPY), t.copyFromAttribute(e, "fullPrecision", r, "fullPrecision", t.BOOLEAN_COPY), t.copyFromAttribute(e, "forceFullCalc", r, "forceFullCalc", t.BOOLEAN_COPY), t.copyFromAttribute(e, "concurrentCalc", r, "concurrentCalc", t.BOOLEAN_COPY), t.copyFromAttribute(e, "refMode", r, "refMode"), t.copyFromAttribute(e, "iterate", r, "iterate", t.BOOLEAN_COPY), t.copyFromAttribute(e, "iterateCount", r, "maxIteration", t.INT_COPY), t.copyFromAttribute(e, "iterateDelta", r, "maxIterateChange", t.FLOAT_COPY);
1635
- const o = e.getAttribute("calcId");
1636
- null !== o && t.getVisitorParamsState().set("calcId", o), s.calc = r;
1637
- }
1638
- processSheetRefs(t, e, s) {
1639
- if (!e) return;
1640
- const r = [], o = e.childNodes, i = o.length;
1641
- for (let e = 0; e < i; e++) {
1642
- const s = o.item(e);
1643
- 1 === s.nodeType && "sheet" === s.localName && this.processSheetRef(t, s, r);
1644
- }
1645
- s.sheets = r;
1646
- }
1647
- processSheetRef(t, e, s) {
1648
- const r = {};
1649
- t.copyFromAttribute(e, "name", r, "name"), t.copyFromAttribute(e, "state", r, "visibility"), t.copyFromAttribute(e, "sheetId", r, "sheetId", t.INT_COPY);
1650
- const o = e.getAttribute("r:id"), i = t.getRef(o);
1651
- i && (r.sheet = i), s.push(r);
1652
- }
1653
- processExternalReferences(t, e, s) {
1654
- if (!e) return;
1655
- const r = [], o = e.childNodes, i = o.length;
1656
- for (let e = 0; e < i; e++) {
1657
- const s = o.item(e);
1658
- if (1 === s.nodeType && "externalReference" === s.localName) {
1659
- const e = s.getAttribute("r:id"), o = e ? t.getRef(e) : null;
1660
- r.push(o ?? null);
1661
- }
1662
- }
1663
- r.length > 0 && (s.externalBooks = r);
1664
- }
1665
- processPivotCaches(t, e, s) {
1666
- if (!e) return;
1667
- const r = [], o = e.childNodes, i = o.length;
1668
- for (let e = 0; e < i; e++) {
1669
- const s = o.item(e);
1670
- if (1 !== s.nodeType || "pivotCache" !== s.localName) continue;
1671
- const i = parseInt(s.getAttribute("cacheId") ?? "", 10), n = s.getAttribute("r:id");
1672
- if (isNaN(i) || !n) continue;
1673
- const a = t.readEmbeddedPart(n);
1674
- a && r.push({
1675
- cacheId: i,
1676
- part: a
1677
- });
1678
- }
1679
- r.length > 0 && (s.pivotCaches = r);
1680
- }
1681
- processBookViews(t, e, s) {
1682
- if (!e) return;
1683
- const r = e.childNodes;
1684
- let o = 0;
1685
- const i = r.length;
1686
- for (let e = 0; o < 1 && e < i; e++) {
1687
- const i = r.item(e);
1688
- 1 === i.nodeType && "workbookView" === i.localName && (this.processWorkbookView(t, i, s), o++);
1689
- }
1690
- }
1691
- processWorkbookView(t, e, s) {
1692
- if (!e) return;
1693
- const r = {};
1694
- t.copyFromAttribute(e, "activeTab", r, "activeSheetId", [t.INT_COPY, (t) => t]), e.hasAttribute("activeTab") || (r.activeSheetId = 0), t.copyFromAttribute(e, "showHorizontalScroll", r, "showHorizontalScrollbar", t.BOOLEAN_COPY), t.copyFromAttribute(e, "showVerticalScroll", r, "showVerticalScrollbar", t.BOOLEAN_COPY), t.copyFromAttribute(e, "showSheetTabs", r, "showTabs", t.BOOLEAN_COPY), t.copyFromAttribute(e, "tabRatio", r, "tabRatio", [t.FLOAT_COPY, (t) => t]), Object.keys(r).length > 0 && (s.view = r);
1695
- }
1696
- processDefineName(t, e, s, r) {
1697
- if (!e) return;
1698
- const o = {}, i = e.firstChild;
1699
- if (i && 3 === i.nodeType && (o.ref = i.textContent), t.copyFromAttribute(e, "name", o), t.copyFromAttribute(e, "comment", o), t.copyFromAttribute(e, "hidden", o, "hidden", t.BOOLEAN_COPY), e.hasAttribute("localSheetId")) {
1700
- const s = e.getAttribute("localSheetId");
1701
- if (!r[s]?.name) return void t.warn(`Defined name '${e.getAttribute("name")}' references a sheet with localSheetId '${s}' which does not exist.`);
1702
- o.scope = r[s].name;
1703
- }
1704
- t.copyFromAttribute(e, "customMenu", o), t.copyFromAttribute(e, "description", o), t.copyFromAttribute(e, "statusBar", o), t.copyFromAttribute(e, "help", o), t.copyFromAttribute(e, "shortcutKey", o), t.copyFromAttribute(e, "function", o, "function", t.BOOLEAN_COPY), t.copyFromAttribute(e, "functionGroupId", o, "functionGroupId", t.INT_COPY), t.copyFromAttribute(e, "publishToServer", o, "publishToServer", t.BOOLEAN_COPY), t.copyFromAttribute(e, "vbProcedure", o, "vbProcedure", t.BOOLEAN_COPY), t.copyFromAttribute(e, "xlm", o, "xlm", t.BOOLEAN_COPY), Object.keys(o).length > 0 && s.push(o);
1705
- }
1706
- processDefinedNames(t, e, s) {
1707
- if (!e) return;
1708
- const r = [], o = e.childNodes, i = o.length;
1709
- for (let e = 0; e < i; e++) {
1710
- const i = o.item(e);
1711
- 1 === i.nodeType && "definedName" === i.localName && this.processDefineName(t, i, r, s.sheets);
1712
- }
1713
- r.length > 0 && (s.names = r);
1714
- }
1715
- processWorkbookPr(t, e, s) {
1716
- e && (t.copyFromAttribute(e, "date1904", s, "date1904", t.BOOLEAN_COPY), t.copyFromAttribute(e, "codeName", s, "codeName"), t.copyFromAttribute(e, "updateLinks", s, "updateLinks"));
1717
- }
1718
- afterVisit(t, e, s) {}
1719
- }, Lt = class {
1720
- visit(t, e, s) {
1721
- const r = {};
1722
- return t.copyFromAttribute(e, "ref", s, "r"), t.getVisitorParamsState().set("ref", s.r), s.v = r, t.copyFromAttribute(e, "name", r), t.copyFromAttribute(e, "displayName", r), t.copyFromAttribute(e, "headerRowCount", r, "headerRowCount", t.INT_COPY), t.copyFromAttribute(e, "totalsRowCount", r, "totalsRowCount", t.INT_COPY), this.processTableColumns(t, e, r), this.processTableStyleInfo(t, e, r), t.copyFromAttribute(e, "id", r), t.copyFromAttribute(e, "comment", r, "description"), t.copyFromAttribute(e, "connectionId", r, "connectionId", t.INT_COPY), t.copyFromAttribute(e, "tableType", r), t.copyFromAttribute(e, "published", r, "published", t.BOOLEAN_COPY), t.copyFromAttribute(e, "insertRow", r, "insertRow", t.BOOLEAN_COPY), t.copyFromAttribute(e, "insertRowShift", r, "insertRowShift", t.BOOLEAN_COPY), r.totalsRowShown = "0" !== e.getAttribute("totalsRowShown"), r;
1723
- }
1724
- afterVisit(t, e, s) {
1725
- const r = s.v;
1726
- if (t.evaluate("autoFilter", e)) {
1727
- if (Array.isArray(r.hiddenButtons)) {
1728
- const t = r.hiddenButtons.length;
1729
- 0 === t ? r.hiddenButtons = !1 : t === r.columns?.length && (r.hiddenButtons = !0);
1730
- }
1731
- } else r.hiddenButtons = !0, r.showButtons = !1;
1732
- return r;
1733
- }
1734
- processTableStyleInfo(t, e, s) {
1735
- if (!e) return;
1736
- const r = e.childNodes, o = {}, i = r.length;
1737
- for (let e = 0; e < i; e++) {
1738
- const s = r.item(e);
1739
- 1 === s.nodeType && "tableStyleInfo" === s.localName && (t.copyFromAttribute(s, "name", o), t.copyFromAttribute(s, "showColumnStripes", o, "showColumnStripes", t.BOOLEAN_COPY), t.copyFromAttribute(s, "showFirstColumn", o, "showFirstColumn", t.BOOLEAN_COPY), t.copyFromAttribute(s, "showLastColumn", o, "showLastColumn", t.BOOLEAN_COPY), t.copyFromAttribute(s, "showRowStripes", o, "showRowStripes", t.BOOLEAN_COPY));
1740
- }
1741
- Object.keys(o).length > 0 && (s.style = o);
1742
- }
1743
- processTableColumn(t, e, s) {
1744
- if (!e) return null;
1745
- const r = e.childNodes, o = r.length;
1746
- for (let e = 0; e < o; e++) {
1747
- const o = r.item(e);
1748
- if (1 === o.nodeType && "tableColumn" === o.localName) {
1749
- const e = {};
1750
- t.copyFromAttribute(o, "name", e), t.copyFromAttribute(o, "id", e), t.copyFromAttribute(o, "uniqueName", e), t.copyFromAttribute(o, "queryTableFieldId", e), t.copyFromAttribute(o, "totalsRowLabel", e);
1751
- let r = o.getAttribute("totalsRowFunction");
1752
- if (null !== r) if ("custom" === r) {
1753
- const s = t.evaluate("totalsRowFormula", o);
1754
- s && (e.totalsRowFormula = s.textContent);
1755
- } else e.totalsRowFormula = r;
1756
- t.copyFromAttribute(o, "totalsRowLabel", e);
1757
- const i = t.evaluate("calculatedColumnFormula", o);
1758
- i?.textContent && (e.calculatedColumnFormula = i.textContent), s.push(e);
1759
- }
1760
- }
1761
- return s;
1762
- }
1763
- processTableColumns(t, e, s) {
1764
- const r = e.childNodes, o = [], i = r.length;
1765
- for (let e = 0; e < i; e++) {
1766
- const s = r.item(e);
1767
- 1 === s.nodeType && "tableColumns" === s.localName && this.processTableColumn(t, s, o);
1768
- }
1769
- o.length > 0 && (s.columns = o);
1770
- }
1771
- }, _t = class {
1772
- visit(t, e, s) {
1773
- const r = t.getVisitorParamsState().get("ref");
1774
- if (r) {
1775
- const s = t.getVisitorParamsState().get("descriptions");
1776
- s && (s.add(r, e.getAttribute("altText")), s.add(r, e.getAttribute("altTextSummary")));
1777
- }
1778
- return t.copyFromAttribute(e, "altText", s), t.copyFromAttribute(e, "altTextSummary", s), s;
1779
- }
1780
- }, Bt = class {
1781
- visit(t, e, s) {
1782
- const r = e.childNodes, o = r.length;
1783
- let i = null;
1784
- for (let t = 0; t < o; t++) {
1785
- const e = r.item(t);
1786
- if (1 === e.nodeType) {
1787
- "externalBook" === e.localName && (i = e);
1788
- break;
1789
- }
1790
- }
1791
- if (!i) return s;
1792
- e.getAttribute("mc:Ignorable") && (s.mceIgnorable = !0);
1793
- const n = i.getAttribute("r:id");
1794
- n && (s.__bookRelId = n);
1795
- const a = this._findAbsoluteUrlRelId(i);
1796
- return a && (s.__absoluteUrlRelId = a), s.sheetNames = [], this.processSheetNames(t, i, s), this.processDefinedNames(t, i, s), this.processSheetDataSet(t, i, s), s;
1797
- }
1798
- processSheetNames(t, e, s) {
1799
- const r = this._findChild(e, "sheetNames");
1800
- if (!r) return;
1801
- const o = r.childNodes, i = o.length;
1802
- for (let t = 0; t < i; t++) {
1803
- const e = o.item(t);
1804
- 1 === e.nodeType && "sheetName" === e.localName && s.sheetNames.push(e.getAttribute("val") ?? "");
1805
- }
1806
- }
1807
- processDefinedNames(t, e, s) {
1808
- const r = this._findChild(e, "definedNames");
1809
- if (!r) return;
1810
- const o = [], i = r.childNodes, n = i.length;
1811
- for (let t = 0; t < n; t++) {
1812
- const e = i.item(t);
1813
- if (1 !== e.nodeType || "definedName" !== e.localName) continue;
1814
- const s = e.getAttribute("name");
1815
- if (!s) continue;
1816
- const r = {
1817
- name: s,
1818
- refersTo: e.getAttribute("refersTo") ?? ""
1819
- }, n = e.getAttribute("sheetId");
1820
- null !== n && (r.sheetIndex = parseInt(n, 10)), o.push(r);
1821
- }
1822
- o.length > 0 && (s.definedNames = o);
1823
- }
1824
- processSheetDataSet(t, e, s) {
1825
- const r = this._findChild(e, "sheetDataSet");
1826
- if (!r) return;
1827
- const o = [], i = r.childNodes, n = i.length;
1828
- for (let e = 0; e < n; e++) {
1829
- const s = i.item(e);
1830
- if (1 !== s.nodeType || "sheetData" !== s.localName) continue;
1831
- const r = s.getAttribute("sheetId");
1832
- if (null === r) continue;
1833
- const n = this.processSheetData(t, s);
1834
- n.sheetIndex = parseInt(r, 10), "1" === s.getAttribute("refreshError") && (n.refreshError = !0), o.push(n);
1835
- }
1836
- o.length > 0 && (s.sheetDataSet = o);
1837
- }
1838
- processSheetData(t, e) {
1839
- const s = new P.Builder(), r = e.childNodes, o = r.length;
1840
- for (let t = 0; t < o; t++) {
1841
- const e = r.item(t);
1842
- if (1 !== e.nodeType || "row" !== e.localName) continue;
1843
- const o = e.childNodes, i = o.length;
1844
- for (let t = 0; t < i; t++) {
1845
- const e = o.item(t);
1846
- if (1 !== e.nodeType || "cell" !== e.localName) continue;
1847
- const r = e.getAttribute("r");
1848
- if (!r) continue;
1849
- const i = g.fastStringToCell(r);
1850
- if (void 0 === i?.rowIndex || void 0 === i?.colIndex) continue;
1851
- const n = this._readCellValue(e);
1852
- void 0 !== n && s.pushAt(i.rowIndex, i.colIndex, n);
1853
- }
1854
- }
1855
- return {
1856
- sheetIndex: -1,
1857
- data: s.build()?.tuples ?? []
1858
- };
1859
- }
1860
- _readCellValue(t) {
1861
- const e = this._findChild(t, "v")?.textContent?.trim();
1862
- if (void 0 !== e && "" !== e) switch (t.getAttribute("t")) {
1863
- case null:
1864
- case "n": return parseFloat(e);
1865
- case "b": return "1" === e || "true" === e;
1866
- case "str":
1867
- default: return e;
1868
- case "e": {
1869
- const t = m.getBuiltInByLabel(e);
1870
- return t ? {
1871
- t: "e",
1872
- v: t.getCode()
1873
- } : e;
1874
- }
1875
- }
1876
- }
1877
- _findChild(t, e) {
1878
- const s = t.childNodes, r = s.length;
1879
- for (let t = 0; t < r; t++) {
1880
- const r = s.item(t);
1881
- if (1 === r.nodeType && r.localName === e) return r;
1882
- }
1883
- return null;
1884
- }
1885
- _findAbsoluteUrlRelId(t) {
1886
- const e = this._findChild(t, "alternateUrls");
1887
- return e ? this._findChild(e, "absoluteUrl")?.getAttribute("r:id") ?? null : null;
1888
- }
1889
- }, Et = class {
1890
- visit(t, e, s) {
1891
- t.copyFromAttribute(e, "name", s), t.copyFromAttribute(e, "sourceName", s);
1892
- const r = t.evaluate("*/tableSlicerCache", e);
1893
- return r ? (t.copyFromAttribute(r, "tableId", s), t.copyFromAttribute(r, "column", s, "columnId"), t.copyFromAttribute(r, "crossFilter", s), s) : (t.warn("A slicer names no table; it was not imported.", { onceKey: "xlsx.slicer.cacheDefinition" }), s);
1894
- }
1895
- }, Rt = class {
1896
- visit(t, e, s) {
1897
- let r = s.slicers;
1898
- r || (r = {}, s.slicers = r);
1899
- const o = e.childNodes, i = o.length;
1900
- for (let e = 0; e < i; e++) {
1901
- const s = o.item(e);
1902
- 1 === s.nodeType && "slicer" === s.localName && this.processSlicer(t, s, r);
1903
- }
1904
- return r;
1905
- }
1906
- processSlicer(t, e, s) {
1907
- if (!e) return;
1908
- const r = {};
1909
- s[e.getAttribute("name")] = r;
1910
- const o = e.getAttribute("cache"), i = t.getVisitorParamsState().get("slicerCaches");
1911
- if (o) {
1912
- const t = i.get(o);
1913
- t && (r.columnId = t.columnId, r.tableId = t.tableId);
1914
- }
1915
- t.copyFromAttribute(e, "caption", r), t.copyFromAttribute(e, "startItem", r, "startItem", t.INT_COPY), t.copyFromAttribute(e, "columnCount", r, "columnCount", t.INT_COPY), t.copyFromAttribute(e, "showCaption", r, "showCaption", t.BOOLEAN_COPY), t.copyFromAttribute(e, "level", r, "level", t.INT_COPY), t.copyFromAttribute(e, "style", r), t.copyFromAttribute(e, "locked", r, "locked", t.BOOLEAN_COPY), t.copyFromAttribute(e, "rowHeight", r, "rowHeight", t.INT_COPY);
1916
- }
1917
- }, jt = class {
1918
- visit(t, e, s) {
1919
- return s;
1920
- }
1921
- }, Dt = class {
1922
- visit(t, e, s) {
1923
- if (!e) return;
1924
- const r = {};
1925
- return t.copyFromAttribute(e, "editAs", r, "anchorType"), r.anchor = {}, "absoluteAnchor" === e.localName ? (r.anchorType = "absolute", this.processAbsoluteCoord(t, t.evaluate("xdr:pos", e), r.anchor, "from", "x", "y"), this.processAbsoluteCoord(t, t.evaluate("xdr:ext", e), r.anchor, "to", "cx", "cy")) : "oneCellAnchor" === e.localName ? (this.processOffsetCoord(t, t.evaluate("from", e), r.anchor, "from"), this.processAbsoluteCoord(t, t.evaluate("xdr:ext", e), r.anchor, "to", "cx", "cy")) : (this.processOffsetCoord(t, t.evaluate("from", e), r.anchor, "from"), this.processOffsetCoord(t, t.evaluate("to", e), r.anchor, "to")), s.movables || (s.movables = []), s.movables.push(r), r;
1926
- }
1927
- processAbsoluteCoord(t, e, s, r, o, i) {
1928
- if (!e) return;
1929
- const n = {
1930
- x: 0,
1931
- y: 0
1932
- };
1933
- return n.x = l(e.getAttribute(o)), n.y = l(e.getAttribute(i)), "from" === r ? s.tl = n : s.br = n, s;
1934
- }
1935
- processOffsetCoord(t, e, s, r) {
1936
- if (!e) return;
1937
- const o = {
1938
- c: 0,
1939
- r: 0,
1940
- x: 0,
1941
- y: 0
1942
- };
1943
- return t.evaluate("col", e) && (o.c = parseInt(t.evaluate("col", e).textContent)), t.evaluate("row", e) && (o.r = parseInt(t.evaluate("row", e).textContent)), t.evaluate("colOff", e) && (o.x = l(t.evaluate("colOff", e).textContent)), t.evaluate("rowOff", e) && (o.y = l(t.evaluate("rowOff", e).textContent)), "from" === r ? s.tl = o : s.br = o, s;
1944
- }
1945
- }, Yt = class extends Z {
1946
- visit(t, e, s) {
1947
- if (!e) return;
1948
- s = super.visit(t, e, s);
1949
- const r = t.evaluate("nvGraphicFramePr/cNvGraphicFramePr", e);
1950
- if (r) {
1951
- const e = t.evaluate("graphicFrameLocks", r);
1952
- if (e) {
1953
- e.hasAttribute("noChangeAspect") && (s.lockAspect = "1" === e.getAttribute("noChangeAspect"));
1954
- const t = {};
1955
- Object.keys(t).length > 0 && (s.locks = t);
1956
- }
1957
- }
1958
- let o = {
1959
- type: "graphicFrame",
1960
- json: {}
1961
- };
1962
- const i = t.evaluate("graphic/graphicData", e).childNodes, n = i.length;
1963
- for (let s = 0; s < n; s++) {
1964
- const r = i.item(s);
1965
- if (1 === r.nodeType) try {
1966
- let s = r.localName;
1967
- "chart" === s ? s = "chart" : "slicer" === s && (s = "slicer"), o.type = s;
1968
- const i = r.getAttribute("r:id");
1969
- if ("chart" === s && i) {
1970
- let s = t.evaluate("*/cNvPr", e);
1971
- s?.item && (s = s.item(0));
1972
- const r = s?.getAttribute?.("id"), n = r ? parseInt(r, 10) : void 0;
1973
- o.json = {
1974
- xml: t.serializeElement(e) ?? void 0,
1975
- sourceId: void 0 === n || isNaN(n) ? void 0 : n,
1976
- part: t.readEmbeddedPart(i) ?? void 0
1977
- };
1978
- } else i && (o.json = t.getRef(i));
1979
- } catch (e) {
1980
- t.warn(`Unable to read a graphic frame: ${e?.message ?? e}`, { onceKey: "xlsx.drawing.graphicFrame" });
1981
- }
1982
- }
1983
- return o && this.setContent(s, o), o;
1984
- }
1985
- }, Mt = Q, Ut = class extends Z {
1986
- visit(t, e, s) {
1987
- if (!e) return;
1988
- const r = super.visit(t, e, s), o = t.evaluate("nvPicPr/cNvPicPr", e);
1989
- if (o) {
1990
- t.copyFromAttribute(e, "preferRelativeResize", r, "preferRelativeResize", t.BOOLEAN_COPY);
1991
- const s = t.evaluate("picLocks", o);
1992
- if (s) {
1993
- s.hasAttribute("noChangeAspect") && (r.lockAspect = "1" === s.getAttribute("noChangeAspect"));
1994
- const e = {};
1995
- t.copyFromAttribute(s, "noChangeArrowheads", r, "noChangeArrowheads", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noChangeShapeType", r, "noChangeShapeType", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noEditPoints", r, "noEditPoints", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noAdjustHandles", r, "noAdjustHandles", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noCrop", r, "noCrop", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noGrp", r, "noGrp", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noMove", r, "noMove", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noResize", r, "noResize", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noRot", r, "noRot", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noSelect", r, "noSelect", t.BOOLEAN_COPY), Object.keys(e).length > 0 && (r.locks = e);
1996
- }
1997
- }
1998
- const i = t.evaluate("blipFill/blip", e);
1999
- let n;
2000
- if (i) {
2001
- let e;
2002
- if (e = i.getAttribute("r:embed") ?? i.getAttribute("embed"), e || (e = i.getAttribute("r:link") ?? i.getAttribute("link")), !e) return void t.warn("A picture names no image; it was not imported.", { onceKey: "xlsx.drawing.picture.noRel" });
2003
- n = t.getRef(e, !0);
2004
- }
2005
- const a = { resId: n };
2006
- return this.setContent(s, {
2007
- type: "picture",
2008
- json: a
2009
- }), r;
2010
- }
2011
- }, zt = class extends Q {
2012
- visit(t, e, s) {
2013
- if (!e) return;
2014
- const r = s;
2015
- s = super.visit(t, e, s);
2016
- const o = t.evaluate("nvGrpSpPr/cNvGrpSpPr", e);
2017
- if (o) {
2018
- const e = t.evaluate("grpSpLocks", o);
2019
- if (e) {
2020
- e.hasAttribute("noChangeAspect") && (s.lockAspect = "1" === e.getAttribute("noChangeAspect"));
2021
- const t = {};
2022
- Object.keys(t).length > 0 && (s.locks = t);
2023
- }
2024
- }
2025
- t.warn(`Unable to import '${r.content?.name}', group shapes are not supported.`);
2026
- const i = {};
2027
- return s.content = {
2028
- type: "grpSp",
2029
- json: i
2030
- }, i;
2031
- }
2032
- }, Xt = class extends Q {
2033
- visit(t, e, s) {
2034
- if (!e) return;
2035
- s = super.visit(t, e, s);
2036
- const r = t.evaluate("nvCxnSpPr/cNvCxnSpPr", e);
2037
- if (r) {
2038
- const e = t.evaluate("cxnSpLocks", r);
2039
- if (e) {
2040
- e.hasAttribute("noChangeAspect") && (s.lockAspect = "1" === e.getAttribute("noChangeAspect"));
2041
- const t = {};
2042
- Object.keys(t).length > 0 && (s.locks = t);
2043
- }
2044
- }
2045
- let o = t.evaluate("*/cNvPr", e);
2046
- o?.item && (o = o.item(0));
2047
- const i = o?.getAttribute?.("id"), n = i ? parseInt(i, 10) : void 0, a = {
2048
- type: "cxnSp",
2049
- xml: t.serializeElement(e) ?? void 0,
2050
- sourceId: void 0 === n || isNaN(n) ? void 0 : n
2051
- };
2052
- return s.content = {
2053
- type: "cxnSp",
2054
- json: a
2055
- }, a;
2056
- }
2057
- }, Wt = class {
2058
- visit(t, e, s) {
2059
- const r = [], o = /* @__PURE__ */ new Map(), i = {
2060
- cells: [],
2061
- values: []
2062
- }, n = e.childNodes;
2063
- for (let t = 0; t < n.length; t++) {
2064
- const e = n.item(t);
2065
- if (1 === e.nodeType) switch (e.localName) {
2066
- case "metadataTypes":
2067
- this._parseMetadataTypes(e, r, o);
2068
- break;
2069
- case "futureMetadata":
2070
- this._attachFutureMetadata(e, o);
2071
- break;
2072
- case "cellMetadata":
2073
- this._resolveBlocks(e, r, i.cells);
2074
- break;
2075
- case "valueMetadata": this._resolveBlocks(e, r, i.values);
2076
- }
2077
- }
2078
- return s.metadata = i, i;
2079
- }
2080
- _parseMetadataTypes(t, e, s) {
2081
- const r = t.childNodes;
2082
- for (let t = 0; t < r.length; t++) {
2083
- const o = r.item(t);
2084
- if (1 === o.nodeType && "metadataType" === o.localName) {
2085
- const t = this._parseMetadataType(o);
2086
- e.push(t), s.set(t.name, t);
2087
- }
2088
- }
2089
- }
2090
- _parseMetadataType(t) {
2091
- const e = {
2092
- name: t.getAttribute("name") ?? "",
2093
- _blocks: []
2094
- }, s = t.getAttribute("minSupportedVersion");
2095
- null != s && (e.minSupportedVersion = Number(s));
2096
- for (const s of [
2097
- "copy",
2098
- "pasteAll",
2099
- "pasteValues",
2100
- "merge",
2101
- "splitFirst",
2102
- "splitAll",
2103
- "rowColShift",
2104
- "clearFormats",
2105
- "clearComments",
2106
- "assign",
2107
- "coerce",
2108
- "cellMeta",
2109
- "adjust",
2110
- "trans",
2111
- "delete",
2112
- "edit"
2113
- ]) "1" === t.getAttribute(s) && (e[s] = !0);
2114
- return e;
2115
- }
2116
- _attachFutureMetadata(t, e) {
2117
- const s = t.getAttribute("name") ?? "", r = e.get(s);
2118
- if (!r) return;
2119
- const o = t.childNodes;
2120
- for (let t = 0; t < o.length; t++) {
2121
- const e = o.item(t);
2122
- 1 === e.nodeType && "bk" === e.localName && r._blocks.push(this._parseFutureBlock(e));
2123
- }
2124
- }
2125
- _parseFutureBlock(t) {
2126
- const e = {}, s = t.childNodes;
2127
- for (let t = 0; t < s.length; t++) {
2128
- const r = s.item(t);
2129
- if (1 !== r.nodeType || "extLst" !== r.localName) continue;
2130
- const o = r.childNodes;
2131
- for (let t = 0; t < o.length; t++) {
2132
- const s = o.item(t);
2133
- if (1 !== s.nodeType || "ext" !== s.localName) continue;
2134
- const r = s.childNodes;
2135
- for (let t = 0; t < r.length; t++) {
2136
- const s = r.item(t);
2137
- 1 === s.nodeType && ("dynamicArrayProperties" === s.localName ? (e.fDynamic = "1" === s.getAttribute("fDynamic"), e.fCollapsed = "1" === s.getAttribute("fCollapsed")) : "rvb" === s.localName && (e.richValueIndex = Number(s.getAttribute("i") ?? "0")));
2138
- }
2139
- }
2140
- }
2141
- return e;
2142
- }
2143
- _resolveBlocks(t, e, s) {
2144
- const r = t.childNodes;
2145
- for (let t = 0; t < r.length; t++) {
2146
- const o = r.item(t);
2147
- 1 === o.nodeType && "bk" === o.localName && s.push(this._resolveBlock(o, e));
2148
- }
2149
- }
2150
- _resolveBlock(t, e) {
2151
- const s = /* @__PURE__ */ new Map(), r = t.childNodes;
2152
- for (let t = 0; t < r.length; t++) {
2153
- const o = r.item(t);
2154
- if (1 !== o.nodeType || "rc" !== o.localName) continue;
2155
- const i = Number(o.getAttribute("t")), n = Number(o.getAttribute("v")), a = e[i - 1];
2156
- if (!a) continue;
2157
- const { _blocks: l, ...c } = a, u = { ...c };
2158
- for (const t of Object.keys(u)) void 0 === u[t] && delete u[t];
2159
- const h = l[n];
2160
- h && (void 0 !== h.fDynamic && (u.fDynamic = h.fDynamic, u.fCollapsed = h.fCollapsed ?? !1), void 0 !== h.richValueIndex && (u.richValueIndex = h.richValueIndex)), s.set(a.name, u);
2161
- }
2162
- return s;
2163
- }
2164
- }, Gt = class {
2165
- visit(t, e, s) {
2166
- let r = t.getVisitorParamsState().get(tt);
2167
- r || (r = [], t.getVisitorParamsState().set(tt, r));
2168
- const o = e.childNodes, i = o.length;
2169
- for (let e = 0; e < i; e++) {
2170
- const s = o.item(e);
2171
- if (1 === s.nodeType && "s" === s.localName) {
2172
- const e = {
2173
- type: s.getAttribute("t") ?? "n",
2174
- keys: []
2175
- };
2176
- this.processKeys(t, s, e), r.push(e);
2177
- }
2178
- }
2179
- return s.richTypes = r, r;
2180
- }
2181
- processKeys(t, e, s) {
2182
- const r = e.childNodes, o = r.length, i = s.keys;
2183
- for (let t = 0; t < o; t++) {
2184
- const e = r.item(t);
2185
- if (1 === e.nodeType && "k" === e.localName) {
2186
- const t = e.getAttribute("n"), s = e.getAttribute("t");
2187
- i.push([t, s]);
2188
- }
2189
- }
2190
- }
2191
- }, Kt = class {
2192
- visit(t, e, s) {
2193
- let r = t.getVisitorParamsState().get("richTypes");
2194
- if (!r) return void t.warn("RichValueFound but not type.");
2195
- let o = t.getVisitorParamsState().get(et);
2196
- o || (o = [], t.getVisitorParamsState().set(et, o));
2197
- const i = e.childNodes, n = i.length;
2198
- for (let e = 0; e < n; e++) {
2199
- const s = i.item(e);
2200
- if (1 === s.nodeType && "rv" === s.localName) {
2201
- const e = r[s.getAttribute("s")], i = { type: e.type };
2202
- this.processValues(t, s, i, e);
2203
- const n = this.mapType(t, i);
2204
- o.push(n);
2205
- }
2206
- }
2207
- return s.richData = o, o;
2208
- }
2209
- mapType(t, e) {
2210
- if ("_error" === e.type) {
2211
- const t = e.errorType;
2212
- if (t) try {
2213
- e = m.getBuiltInByCode(t + 1) ?? m.BuiltIn.Unknown;
2214
- } catch (t) {}
2215
- }
2216
- return e;
2217
- }
2218
- processValues(t, e, s, r) {
2219
- const o = e.childNodes, i = o.length;
2220
- r.type;
2221
- const n = r.keys;
2222
- for (let e = 0; e < i; e++) {
2223
- const r = o.item(e);
2224
- if (1 === r.nodeType && "v" === r.localName) {
2225
- const o = n[e];
2226
- if (!o) return void t.warn("Invalid richData");
2227
- const i = o[0], a = o[1];
2228
- let l = r.textContent;
2229
- "i" === a && (l = Number(l)), s[i] = l;
2230
- }
2231
- }
2232
- }
2233
- }, $t = class {
2234
- visit(t, e, s) {
2235
- if (!e) return;
2236
- const r = [];
2237
- this.processAuthors(t, t.evaluate("authors", e), r), r.length > 0 && (s.authors = r);
2238
- const o = [];
2239
- return s.comments = o, o;
2240
- }
2241
- processAuthors(t, e, s) {
2242
- if (!e) return;
2243
- const r = e.childNodes, o = r.length;
2244
- for (let t = 0; t < o; t++) {
2245
- const e = r.item(t);
2246
- if (1 === e.nodeType && "author" === e.localName) {
2247
- const t = e.firstChild;
2248
- t && 3 === t.nodeType && s.push(t.textContent);
2249
- }
2250
- }
2251
- }
2252
- }, Ht = class {
2253
- visit(t, e, s) {
2254
- if (!e) return;
2255
- const r = e.getAttribute("ref");
2256
- if (!r) return;
2257
- const o = { content: "" };
2258
- if (e.hasAttribute("authorId")) {
2259
- const t = parseInt(e.getAttribute("authorId"), 10);
2260
- isNaN(t) || (o.authorId = t);
2261
- }
2262
- return o.content = function(t) {
2263
- if (!t) return "";
2264
- const e = [];
2265
- let s = !0;
2266
- const r = t.childNodes;
2267
- for (let t = 0; t < r.length; t++) {
2268
- const o = r.item(t);
2269
- if (1 === o.nodeType) {
2270
- if ("t" === o.localName) e.push({ text: o.textContent ?? "" });
2271
- else if ("r" === o.localName) {
2272
- const t = { text: "" }, r = o.childNodes;
2273
- for (let e = 0; e < r.length; e++) {
2274
- const s = r.item(e);
2275
- if (1 === s.nodeType) {
2276
- if ("t" === s.localName) t.text += s.textContent ?? "";
2277
- else if ("rPr" === s.localName) {
2278
- const e = ot(s);
2279
- e && (t.font = e);
2280
- }
2281
- }
2282
- }
2283
- t.font && (s = !1), e.push(t);
2284
- }
2285
- }
2286
- }
2287
- return 0 === e.length ? t.textContent ?? "" : s ? e.map((t) => t.text).join("") : { runs: e };
2288
- }(t.evaluate("text", e)), s.push({
2289
- r,
2290
- v: o
2291
- }), o;
2292
- }
2293
- }, qt = class {
2294
- visit(t, e, s) {
2295
- if (!e) return;
2296
- const r = [];
2297
- return s.comments = r, r;
2298
- }
2299
- }, Jt = class {
2300
- visit(e, s, r) {
2301
- if (!s) return;
2302
- const i = {};
2303
- e.copyFromAttribute(s, "id", i, "id", o);
2304
- const n = s.getAttribute("ref");
2305
- e.copyFromAttribute(s, "personId", i, "personId", o), e.copyFromAttribute(s, "parentId", i, "parentId", o);
2306
- const a = s.getAttribute("dT");
2307
- a && (i.dt = function(t) {
2308
- const e = /^(.*T\d{2}:\d{2}:\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:?\d{2})?$/i.exec(t.trim());
2309
- if (!e) return t;
2310
- const [, s, r, o] = e;
2311
- return `${s}${r ? `.${(r + "00").substring(0, 3)}` : ""}${o ?? "Z"}`;
2312
- }(a)), s.hasAttribute("done") && (i.done = t(s.getAttribute("done")));
2313
- const l = function(t) {
2314
- let e;
2315
- const s = t.childNodes;
2316
- for (let t = 0; t < s.length; t++) {
2317
- const r = s.item(t);
2318
- if (1 !== r.nodeType || "mentions" !== r.localName) continue;
2319
- const i = r.childNodes;
2320
- for (let t = 0; t < i.length; t++) {
2321
- const s = i.item(t);
2322
- if (1 !== s.nodeType || "mention" !== s.localName) continue;
2323
- const r = s.getAttribute("mentionId"), n = s.getAttribute("mentionpersonId");
2324
- if (!r || !n) continue;
2325
- const a = {
2326
- id: o(r),
2327
- personId: o(n)
2328
- }, l = parseInt(s.getAttribute("startIndex") ?? "", 10);
2329
- isNaN(l) || (a.startIndex = l);
2330
- const c = parseInt(s.getAttribute("length") ?? "", 10);
2331
- isNaN(c) || (a.length = c), (e ??= []).push(a);
2332
- }
2333
- }
2334
- return e;
2335
- }(s);
2336
- return l && (i.mentions = l), r.push({
2337
- r: n,
2338
- v: i
2339
- }), i;
2340
- }
2341
- }, Zt = class {
2342
- visit(t, e, s) {
2343
- const r = [], i = e.childNodes, n = i.length;
2344
- for (let e = 0; e < n; e++) {
2345
- const s = i.item(e);
2346
- if (1 === s.nodeType && "person" === s.localName) {
2347
- const e = {};
2348
- t.copyFromAttribute(s, "id", e, "id", o), t.copyFromAttribute(s, "displayName", e), t.copyFromAttribute(s, "userId", e, "userId", o), t.copyFromAttribute(s, "providerId", e), r.push(e);
2349
- }
2350
- }
2351
- return r.length > 0 && (s.persons = r), r;
2352
- }
2353
- }, Qt = class {
2354
- constructor(t, e) {
2355
- this.path = t, this.visitor = e;
2356
- }
2357
- }, te = class {
2358
- constructor() {
2359
- this.visitorsByXmlTagName = /* @__PURE__ */ new Map(), this.scopedVisitorsByXmlTagName = /* @__PURE__ */ new Map(), this.visitorParamsState = null, this.registerVisitor("Relationships", new it()), this.registerVisitor("cp:coreProperties", new nt()), this.registerVisitor("Properties", new at()), this.registerVisitor("spPr", new ut()), this.registerVisitor("txBody", new At()), this.registerVisitor("txPr", new At()), this.registerVisitor("c:chartSpace", new lt()), this.registerVisitor("c:plotArea", new ct()), this.registerVisitor("c:barChart", new ht()), this.registerVisitor("c:doughnutChart", new pt()), this.registerVisitor("c:lineChart", new pt()), this.registerVisitor("c:ofPieType", new pt()), this.registerVisitor("c:pieChart", new pt()), this.registerVisitor("c:scatterChart", new pt()), this.registerVisitor("c:barChart", new dt("dataLabels"), "dLbls"), this.registerVisitor("c:doughnutChart", new dt("dataLabels"), "dLbls"), this.registerVisitor("c:lineChart", new dt("dataLabels"), "dLbls"), this.registerVisitor("c:ofPieType", new dt("dataLabels"), "dLbls"), this.registerVisitor("c:pieChart", new dt("dataLabels"), "dLbls"), this.registerVisitor("c:scatterChart", new dt("dataLabels"), "dLbls"), this.registerVisitor("c:ser", new gt()), this.registerVisitor("c:dPt", new mt()), this.registerVisitor("c:marker", new bt()), this.registerVisitor("c:catAx", new ft()), this.registerVisitor("c:valAx", new ft()), this.registerVisitor("c:dateAx", new ft()), this.registerVisitor("c:majorGridlines", new M("gridLinesMajor")), this.registerVisitor("c:minorGridlines", new M("gridLinesMinor")), this.registerVisitor("c:chartSpace", null, "txPr"), this.registerVisitor("c:catAx", new At("labels.text"), "txPr"), this.registerVisitor("c:valAx", new At("labels.text"), "txPr"), this.registerVisitor("c:dateAx", new At("labels.text"), "txPr"), this.registerVisitor("c:legend", new vt()), this.registerVisitor("c:legend", new At("labels.text"), "txPr"), this.registerVisitor("c:legendEntry", new yt()), this.registerVisitor("c:ser", new Nt(), "extLst/ext/invertSolidFillFmt/spPr"), this.registerVisitor("c:ser", new dt("labels"), "dLbls"), this.registerVisitor("c:dLbl", new dt("points")), this.registerVisitor("c:title", new Ft()), this.registerVisitor("c:title", null, "tx/rich"), this.registerVisitor("c:title", null, "txPr"), this.registerVisitor("c:layout", new Ct()), this.registerVisitor("c:dispUnits", new M("dispUnits")), this.registerVisitor("c:dispUnitsLbl", new Ft("displayUnitsLabel")), this.registerVisitor("c:dispUnitsLbl", new At(), "tx/rich"), this.registerVisitor("a:theme", new wt()), this.registerVisitor("a:theme", new Pt(), "themeElements/clrScheme"), this.registerVisitor("a:theme", new St(), "themeElements/fontScheme"), this.registerVisitor("a:theme", new xt(), "themeElements/fmtScheme"), this.registerVisitor("autoFilter", new Ot()), this.registerVisitor("sortState", new kt()), this.registerVisitor("s:workbook", new It()), this.registerVisitor("styleSheet", new Vt()), this.registerVisitor("x14:table", new _t()), this.registerVisitor("table", new Lt()), this.registerVisitor("externalLink", new Bt()), this.registerVisitor("hlinkClick", new Tt()), this.registerVisitor("wsDr", new jt()), this.registerVisitor("twoCellAnchor", new Dt()), this.registerVisitor("oneCellAnchor", new Dt()), this.registerVisitor("absoluteAnchor", new Dt()), this.registerVisitor("graphicFrame", new Yt()), this.registerVisitor("sp", new Mt()), this.registerVisitor("grpSp", new zt()), this.registerVisitor("cxnSp", new Xt()), this.registerVisitor("pic", new Ut()), this.registerVisitor("metadata", new Wt()), this.registerVisitor("rvStructures", new Gt()), this.registerVisitor("rvData", new Kt()), this.registerVisitor("comments", new $t()), this.registerVisitor("comment", new Ht()), this.registerVisitor("ThreadedComments", new qt()), this.registerVisitor("threadedComment", new Jt()), this.registerVisitor("threadedComment", new At("content"), "text"), this.registerVisitor("personList", new Zt()), this.registerVisitor("slicerCacheDefinition", new Et()), this.registerVisitor("slicers", new Rt());
2360
- }
2361
- registerVisitor(t, e, s = null) {
2362
- -1 === t.indexOf(":") && (t = "*:" + t);
2363
- const r = t.split(":"), o = r.length > 1 ? r[1] : r[0];
2364
- if (!s) return this.visitorsByXmlTagName.set(o, e), void this.visitorsByXmlTagName.set(t, e);
2365
- let i = this.scopedVisitorsByXmlTagName.get(o);
2366
- i || (i = [], this.scopedVisitorsByXmlTagName.set(o, i), this.scopedVisitorsByXmlTagName.set(t, i)), i.push(new Qt(s, e));
2367
- }
2368
- parseDxf(t, e = "", s = d.EmptyObject) {
2369
- this.visitorParamsState || (this.visitorParamsState = /* @__PURE__ */ new Map());
2370
- const r = this.visitorParamsState, o = r.get("processingDXFs");
2371
- r.set("processingDXFs", !0);
2372
- try {
2373
- const r = new V(null, this, "/dxf", t, {}, e, s), o = {};
2374
- return new Vt().processDXF(r, t, o), o;
2375
- } finally {
2376
- void 0 === o ? r.delete("processingDXFs") : r.set("processingDXFs", o);
2377
- }
2378
- }
2379
- getVisitorParamsState() {
2380
- return this.visitorParamsState;
2381
- }
2382
- transform(t, e, s = d.EmptyObject) {
2383
- const r = t.documentElement;
2384
- this.visitorParamsState && !s?.paramMap || (this.visitorParamsState = s?.paramMap ?? /* @__PURE__ */ new Map());
2385
- const o = {};
2386
- let i = this.visitorsByXmlTagName.get(r.nodeName);
2387
- if (i || (i = this.visitorsByXmlTagName.get(r.localName)), !i) throw new Error(`A visitor for the root element: '${r.nodeName}' or '${r.localName}' must be registered.`);
2388
- const n = "/" + r.localName, a = new V(null, this, n, r, o, e, s), l = [];
2389
- this._doWalk(i, a, l, r, o, e, s);
2390
- const c = l.length;
2391
- for (let t = 0; t < c; t++) {
2392
- const e = l[t];
2393
- try {
2394
- e.visitor?.afterVisit?.(e.context, e.elemParent, e.jsonParent);
2395
- } catch (t) {
2396
- e.context.warn(`Unable to finish reading '${e.context.getPath()}': ${t?.message ?? t}`, { onceKey: "xlsx.transform.afterVisit" });
2397
- }
2398
- }
2399
- return o;
2400
- }
2401
- _walkScoped(t, e, s, r, o, i, n) {
2402
- const a = this.scopedVisitorsByXmlTagName.get(t), l = a ? a.length : 0;
2403
- for (let c = 0; c < l; c++) {
2404
- const l = a[c];
2405
- let u = null;
2406
- try {
2407
- u = e.evaluate(l.path, r);
2408
- } catch (s) {
2409
- e.warn(`Invalid path '${l.path}' for '${t}'.`, { onceKey: "xlsx.transform.invalidPath" });
2410
- }
2411
- if (!u) continue;
2412
- const h = (t) => {
2413
- let a = t.localName, c = t.parentNode;
2414
- for (; c && c !== r;) a = c.localName + "/" + a, c = c.parentNode;
2415
- const u = e.getPath() + "/" + a;
2416
- if (l.visitor) {
2417
- const r = new V(e, this, u, e.getElemRoot(), e.getJsonRoot(), i, n);
2418
- this._doWalk(l.visitor, r, s, t, o, i, n);
2419
- }
2420
- };
2421
- if (u.length > 0) {
2422
- const t = u, e = t.length;
2423
- for (let s = 0; s < e; s++) h(t.item(s));
2424
- } else h(u);
2425
- }
2426
- }
2427
- _doWalk(t, e, s, r, o, i, n) {
2428
- let a = null;
2429
- t && (s.push({
2430
- visitor: t,
2431
- context: e,
2432
- elemParent: r,
2433
- jsonParent: o
2434
- }), a = t.visit(e, r, o)), a || (a = o);
2435
- const l = r.localName;
2436
- this._walkScoped(l, e, s, r, a, i, n);
2437
- const c = this.visitorsByXmlTagName, u = e.getElemRoot(), h = e.getJsonRoot(), p = r.childNodes, d = p.length;
2438
- for (let t = 0; t < d; t++) {
2439
- const r = p.item(t);
2440
- if (1 !== r.nodeType) continue;
2441
- const l = r;
2442
- let d = l.nodeName, g = c.get(d);
2443
- g || (d = l.localName, g = c.get(d));
2444
- const m = e.getPath() + "/" + d, b = new V(e, this, m, u, h, i, n);
2445
- this._doWalk(g, b, s, l, a ?? o, i, n);
2446
- }
2447
- return a;
2448
- }
2449
- };
2450
- export { te as DOMTransformer, V as ExecutionContext, a as NumberUtils, I as VisitorUtils };