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

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