@sheetxl/io-xlsx 0.8.0-beta.10 → 0.8.0-beta.11

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