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