@sheetxl/io-xlsx 0.8.0-beta.2 → 0.8.0-beta.21

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