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

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