@sheetxl/io-xlsx 0.8.0-beta.7 → 1.0.0

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 (215) hide show
  1. package/LICENSE.md +8 -7
  2. package/browser/esm/7rZlWcm56hn3Jmnk.mjs +7021 -0
  3. package/browser/esm/AZus_5slvoIVhf1u.mjs +10323 -0
  4. package/browser/esm/B9QfzGvsvg-V3utu.mjs +4632 -0
  5. package/browser/esm/{CX3yVwe-BnhCk4FY.mjs → BIR_Si489gIkGOnc.mjs} +194 -144
  6. package/browser/esm/BJFvc-i40R4rPZ5y.mjs +2433 -0
  7. package/browser/esm/{CGXxwkCRWLc0gcRQ.mjs → BX8Ebx4NC5zp7_3J.mjs} +3 -3
  8. package/browser/esm/{B4eKxNwxJjHLN126.mjs → Bnxw38IvtA04zXEE.mjs} +2 -2
  9. package/browser/esm/{DwcLXqv8-6Tl1zLO.mjs → CfVhYH77KdrR3fEK.mjs} +3 -3
  10. package/browser/esm/index.mjs +3 -4
  11. package/browser/esm/jIQks3Crw6jehdDU.mjs +2474 -0
  12. package/browser/esm/{DUi-V-E_AJwTIqlO.mjs → qc9hnuR2z-whY8YO.mjs} +3 -3
  13. package/browser/esm/wZGpmkMUubNjClhG.mjs +104 -0
  14. package/licenses/dependencies.txt +2 -2
  15. package/node/esm/{C51yFT2l-6il_xXO.mjs → BNLHWJHyy5eB0P_4.mjs} +2 -2
  16. package/node/esm/CVtsY2F9A9NzEGLk.mjs +2478 -0
  17. package/node/esm/CoeQ0LO-nNXiowwv.mjs +7284 -0
  18. package/node/esm/CxY3iIYLXVhCebeV.mjs +4746 -0
  19. package/node/esm/D2CZy9TQM9h2uqBh.mjs +2562 -0
  20. package/node/esm/{CMq7eF1vxibUumqT.mjs → Dm0hvKcR4xb0TV_N.mjs} +3 -3
  21. package/node/esm/_IA1gQ-zFQYQSZSs.mjs +6957 -0
  22. package/node/esm/index.mjs +65 -28
  23. package/node/esm/{DLBm8l0jyL2fVlxg.mjs → zZFe3mW0xjmobowq.mjs} +3 -3
  24. package/package.json +9 -10
  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 +2 -2
  85. package/types/src/reader/domVisitors/DrawingCxnSpVisitor.d.ts +1 -0
  86. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +30 -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/ThreadedCommentsVisitor.d.ts +2 -2
  106. package/types/src/reader/domVisitors/TimelinesVisitor.d.ts +13 -0
  107. package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +0 -9
  108. package/types/src/reader/domVisitors/_Dxfs.d.ts +10 -0
  109. package/types/src/reader/domVisitors/index.d.ts +10 -36
  110. package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +1 -0
  111. package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +31 -6
  112. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +26 -8
  113. package/types/src/richValue/ErrorRichValueHandler.d.ts +22 -0
  114. package/types/src/richValue/IRichValueHandler.d.ts +109 -0
  115. package/types/src/richValue/LocalImageRichValueHandler.d.ts +18 -0
  116. package/types/src/richValue/RichDataParts.d.ts +69 -0
  117. package/types/src/richValue/RichRecordWriter.d.ts +61 -0
  118. package/types/src/richValue/RichValueHandlers.d.ts +25 -0
  119. package/types/src/richValue/RichValueResolver.d.ts +54 -0
  120. package/types/src/richValue/WebImageRichValueHandler.d.ts +37 -0
  121. package/types/src/richValue/index.d.ts +7 -0
  122. package/types/src/utils/DrawingMLText.d.ts +39 -0
  123. package/types/src/utils/FormControls.d.ts +170 -0
  124. package/types/src/utils/SharedNames.d.ts +13 -0
  125. package/types/src/utils/SpreadsheetFont.d.ts +38 -0
  126. package/types/src/utils/VmlNoteShapes.d.ts +25 -32
  127. package/types/src/utils/VmlNoteStyle.d.ts +25 -0
  128. package/types/src/utils/VmlPrefixes.d.ts +24 -0
  129. package/types/src/vba/VBAProject.d.ts +0 -19
  130. package/types/src/writer/EvaluationSheet.d.ts +5 -0
  131. package/types/src/writer/builder/Emitter.d.ts +5 -0
  132. package/types/src/writer/builder/OpcXmlUtils.d.ts +0 -8
  133. package/types/src/writer/builder/PackageBuilder.d.ts +4 -41
  134. package/types/src/writer/builder/Types.d.ts +28 -28
  135. package/types/src/writer/emitters/CommentsEmitter.d.ts +3 -3
  136. package/types/src/writer/emitters/DrawingEmitter.d.ts +2 -2
  137. package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +0 -11
  138. package/types/src/writer/emitters/FeaturePropertyBagEmitter.d.ts +8 -0
  139. package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +4 -4
  140. package/types/src/writer/emitters/PivotTableEmitter.d.ts +30 -1
  141. package/types/src/writer/emitters/PropsCoreEmitter.d.ts +7 -2
  142. package/types/src/writer/emitters/PropsCustomEmitter.d.ts +15 -0
  143. package/types/src/writer/emitters/RichValuePartsEmitters.d.ts +36 -0
  144. package/types/src/writer/emitters/RichValueRelEmitter.d.ts +12 -0
  145. package/types/src/writer/emitters/RichValueStructureEmitter.d.ts +4 -3
  146. package/types/src/writer/emitters/RichValueTypesEmitter.d.ts +3 -2
  147. package/types/src/writer/emitters/RichValueWebImageEmitter.d.ts +24 -0
  148. package/types/src/writer/emitters/SharedStringsEmitter.d.ts +6 -3
  149. package/types/src/writer/emitters/SlicerEmitter.d.ts +132 -0
  150. package/types/src/writer/emitters/StylesEmitter.d.ts +35 -2
  151. package/types/src/writer/emitters/TableEmitter.d.ts +14 -0
  152. package/types/src/writer/emitters/WorkbookEmitter.d.ts +24 -2
  153. package/types/src/writer/emitters/WorksheetEmitter.d.ts +4 -3
  154. package/types/src/writer/utils/AutoFilter.d.ts +3 -3
  155. package/types/src/writer/utils/CellControlComplements.d.ts +29 -0
  156. package/types/src/writer/utils/CustGeomUtils.d.ts +5 -0
  157. package/types/src/writer/utils/DateSystem.d.ts +6 -0
  158. package/types/src/writer/utils/DefaultRows.d.ts +22 -0
  159. package/types/src/writer/utils/DrawMLUtils.d.ts +42 -3
  160. package/types/src/writer/utils/DummyFunction.d.ts +0 -25
  161. package/types/src/writer/utils/DxfCollector.d.ts +14 -11
  162. package/types/src/writer/utils/PrstGeomUtils.d.ts +14 -0
  163. package/types/src/writer/utils/RichValueCollector.d.ts +81 -129
  164. package/types/src/writer/utils/SheetStyleLayout.d.ts +86 -0
  165. package/types/src/writer/utils/TextUtils.d.ts +26 -2
  166. package/types/src/writer/utils/UnsupportedFunctions.d.ts +2 -2
  167. package/types/src/writer/utils/XfVariants.d.ts +61 -0
  168. package/browser/cjs/17tMBnuyu4YIxixh.cjs +0 -1
  169. package/browser/cjs/B6sirGz6w-Bm7Ofo.cjs +0 -1
  170. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  171. package/browser/cjs/BxU-OlZIQViQl7gX.cjs +0 -1
  172. package/browser/cjs/CDs8etXnw0kbBKKv.cjs +0 -1
  173. package/browser/cjs/CIpMN7SDVREKQUQE.cjs +0 -6
  174. package/browser/cjs/CycnxkfuKrDdwoJN.cjs +0 -5
  175. package/browser/cjs/D3EWCPfCu-qMOIGd.cjs +0 -1
  176. package/browser/cjs/DHKWtqZ0vQfXrbq1.cjs +0 -2
  177. package/browser/cjs/MqKQ_B5qRARrRbO4.cjs +0 -24
  178. package/browser/cjs/index.cjs +0 -1
  179. package/browser/cjs/xQ6-wbTw5UzZUM1Y.cjs +0 -1
  180. package/browser/esm/9n64lXAgZUe3aThr.mjs +0 -159
  181. package/browser/esm/BsNoW41d6hdpxTTS.mjs +0 -67
  182. package/browser/esm/BvAptAMpZVyBCx6-.mjs +0 -2402
  183. package/browser/esm/CjKioy-GzeSf08f8.mjs +0 -3326
  184. package/browser/esm/cJxidonaVNZHAXiZ.mjs +0 -4532
  185. package/browser/esm/dsVZVtt5w_yLb967.mjs +0 -5300
  186. package/node/esm/BRQYaMYO4UfhjJHw.mjs +0 -170
  187. package/node/esm/BlbtH3EvAf3K4foF.mjs +0 -2450
  188. package/node/esm/DhSPOg9wN0kD87Tb.mjs +0 -3051
  189. package/node/esm/KeV-N47eTyh5YE70.mjs +0 -4642
  190. package/node/esm/s_yVG0m9KB14YKeN.mjs +0 -3412
  191. package/types/src/legacyChart/OOXMLMappings.d.ts +0 -8
  192. package/types/src/legacyChart/OOXMLUtils.d.ts +0 -78
  193. package/types/src/legacyChart/ToOOXMLConverter.d.ts +0 -30
  194. package/types/src/reader/domVisitors/AxisVisitor.d.ts +0 -12
  195. package/types/src/reader/domVisitors/BarChartTypeVisitor.d.ts +0 -6
  196. package/types/src/reader/domVisitors/ChartSpaceVisitor.d.ts +0 -6
  197. package/types/src/reader/domVisitors/ChartTypeVisitor.d.ts +0 -7
  198. package/types/src/reader/domVisitors/ChartVisitor.d.ts +0 -7
  199. package/types/src/reader/domVisitors/DataLabelsVisitor.d.ts +0 -8
  200. package/types/src/reader/domVisitors/DataPointVisitor.d.ts +0 -6
  201. package/types/src/reader/domVisitors/HyperlinkVisitor.d.ts +0 -6
  202. package/types/src/reader/domVisitors/LayoutVisitor.d.ts +0 -5
  203. package/types/src/reader/domVisitors/LegendEntryVisitor.d.ts +0 -5
  204. package/types/src/reader/domVisitors/LegendVisitor.d.ts +0 -5
  205. package/types/src/reader/domVisitors/MarkerVisitor.d.ts +0 -5
  206. package/types/src/reader/domVisitors/NegativeShapeVisitor.d.ts +0 -6
  207. package/types/src/reader/domVisitors/PlotAreaVisitor.d.ts +0 -5
  208. package/types/src/reader/domVisitors/RichValueDataVisitor.d.ts +0 -7
  209. package/types/src/reader/domVisitors/RichValueStructureVisitor.d.ts +0 -6
  210. package/types/src/reader/domVisitors/SeriesVisitor.d.ts +0 -8
  211. package/types/src/reader/domVisitors/TitleVisitor.d.ts +0 -9
  212. package/types/src/writer/emitters/ChartColorsEmitter.d.ts +0 -7
  213. package/types/src/writer/emitters/ChartEmitter.d.ts +0 -14
  214. package/types/src/writer/emitters/ChartStyleEmitter.d.ts +0 -46
  215. package/types/src/writer/utils/HiddenFormulaXfs.d.ts +0 -28
@@ -0,0 +1,4746 @@
1
+ /**
2
+ * @license @sheetxl/io-xlsx - SheetXL - Import/Export from/to Excel - v1.0.0
3
+ *
4
+ * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
+ * License: SheetXL EULA — https://www.sheetxl.com/eula
6
+ */
7
+ import { $ as t, $n as e, An as o, C as r, Ct as n, Dr as i, E as a, Fr as l, Gt as c, In as u, It as h, Jn as d, Kn as p, Ln as f, Lr as g, Lt as m, Mr as b, Nn as x, Nt as y, Pn as v, Qn as w, Rn as T, Rt as S, Sr as C, St as k, T as A, Tr as E, Tt as I, Ut as P, Vn as O, Wt as D, Xn as N, Yn as _, Z as $, Zn as M, _ as R, _t as V, ar as L, br as j, ct as B, dn as F, dr as H, er as W, f as z, fn as X, fr as q, ft as U, gr as G, hr as K, ht as J, in as Z, ir as Q, it as Y, jn as tt, jt as et, lt as ot, mn as st, mt as rt, n as nt, nn as it, nt as at, o as lt, or as ct, ot as ut, p as ht, pt as dt, rn as pt, rr as ft, sr as gt, t as mt, tn as bt, tr as xt, ur as yt, ut as vt, vr as wt, vt as Tt, wt as St, xt as Ct, yn as kt, yr as At } from "./_IA1gQ-zFQYQSZSs.mjs";
8
+ import { BufferUtils as Et, CommonUtils as It, ExpectedError as Pt, OverlappingRange as Ot, RangeAxis as Dt } from "@sheetxl/utils";
9
+ import { AddressUtils as Nt, BufferUtils as _t, CommonUtils as $t, CoordUtils as Mt, FormulaError as Rt, FormulaText as Vt, FunctionDeclarations as Lt, ICellStyle as jt, ICondition as Bt, IConditionalFormat as Ft, ICustomProperty as Ht, IFont as Wt, IRange as zt, ITextFrame as Xt, NumberFormat as qt, OutOfBoundsError as Ut, PersonCollection as Gt, ResourceCollection as Kt, RichDataRegistry as Jt, Scalar as Zt, Sort as Qt, Theme as Yt, Tuple as te, Workbook as ee, pivotCellFormatsOf as oe } from "@sheetxl/sdk";
10
+ import { BlobReader as se, Uint8ArrayReader as re, Uint8ArrayWriter as ne, ZipReader as ie } from "@zip.js/zip.js";
11
+ var ae = {
12
+ ascending: "ascending",
13
+ descending: "descending",
14
+ natural: "dataSource"
15
+ };
16
+ function le(t, e) {
17
+ const o = t.sheets ?? [], s = /* @__PURE__ */ new Map();
18
+ for (let t = 0; t < o.length; t++) {
19
+ const e = o[t], r = b(e)?.tables ?? [];
20
+ for (let t = 0; t < r.length; t++) {
21
+ const e = r[t], o = Array.isArray(e) ? e[1] : e?.v;
22
+ if (!o?.id) continue;
23
+ const n = (o.columns ?? []).map((t) => "string" == typeof t ? { name: t } : t);
24
+ s.set(String(o.id), {
25
+ name: o.name ?? "",
26
+ columns: n
27
+ });
28
+ }
29
+ }
30
+ const r = /* @__PURE__ */ new Map();
31
+ for (let t = 0; t < o.length; t++) {
32
+ const e = o[t];
33
+ void 0 !== e?.sheetId && e.name && r.set(String(e.sheetId), e.name);
34
+ }
35
+ const n = function(t) {
36
+ const e = /* @__PURE__ */ new Map(), o = t.pivotCaches ?? [];
37
+ for (let t = 0; t < o.length; t++) {
38
+ const s = o[t].part?.xml, r = s ? /<(?:\w+:)?pivotCacheDefinition\b[^>]*?\spivotCacheId="(\d+)"[^>]*\/?>\s*<\/(?:\w+:)?ext>/.exec(s)?.[1] : void 0;
39
+ void 0 !== r && e.set(r, o[t].cacheId);
40
+ }
41
+ return e;
42
+ }(t), i = /* @__PURE__ */ new Map();
43
+ for (let t = 0; t < o.length; t++) {
44
+ const e = b(o[t])?.pivotTables ?? [];
45
+ for (let s = 0; s < e.length; s++) i.set(`${o[t].name}\0${e[s].name}`, e[s]);
46
+ }
47
+ const a = new Set((t.pivotCaches ?? []).flatMap((t) => t.fields ? [t.cacheId] : [])), l = /* @__PURE__ */ new Set();
48
+ for (let t = 0; t < o.length; t++) {
49
+ const c = o[t], u = b(c);
50
+ if (!u) continue;
51
+ const h = u.slicers, d = u.movables;
52
+ if (h && d) for (let t = d.length - 1; t >= 0; t--) {
53
+ const o = d[t].content;
54
+ if ("slicer" !== o?.type || o.json?.source) continue;
55
+ const c = o.name ?? "", u = h[c];
56
+ if (!u) continue;
57
+ if (!u.tableId) {
58
+ if (void 0 === u.pivotBody) continue;
59
+ o.json = he(u, o.json), o.json.pivot = ue(u, r, n, i, a), l.add(c), u.cachePath && e.markAbsorbed(u.cachePath);
60
+ continue;
61
+ }
62
+ const p = s.get(String(u.tableId)), f = p ? ce(p.columns, u.columnId) : null;
63
+ p && f ? (o.json = he(u, o.json, Vt.structuredReference(p.name, f.name)), l.add(c), u.cachePath && e.markAbsorbed(u.cachePath)) : (e.warn("A slicer names no table; it was not imported.", "xlsx.slicer.cacheDefinition"), d.splice(t, 1));
64
+ }
65
+ delete u.slicers;
66
+ }
67
+ e.slicerParts.forEach((t, o) => {
68
+ const s = Object.keys(t);
69
+ s.length > 0 && s.every((t) => l.has(t)) && e.markAbsorbed(o);
70
+ });
71
+ }
72
+ function ce(t, e) {
73
+ if (!e) return null;
74
+ for (let o = 0; o < t.length; o++) if (void 0 !== t[o].id && String(t[o].id) === e) return t[o];
75
+ const o = Number(e);
76
+ return Number.isInteger(o) && o >= 1 && o <= t.length ? t[o - 1] : null;
77
+ }
78
+ function ue(t, e, o, s, r) {
79
+ const n = [], i = t.pivotTables ?? [];
80
+ for (let t = 0; t < i.length; t++) {
81
+ const o = e.get(i[t].tabId);
82
+ o && n.push({
83
+ sheet: o,
84
+ name: i[t].name
85
+ });
86
+ }
87
+ const a = {
88
+ sourceName: t.sourceName ?? "",
89
+ tables: n,
90
+ body: t.pivotBody ?? ""
91
+ };
92
+ let l = void 0 !== t.pivotCacheId ? o.get(t.pivotCacheId) : void 0;
93
+ if (t.tabular) {
94
+ const e = n.length > 0 ? s.get(`${n[0].sheet}\0${n[0].name}`) : void 0;
95
+ l ??= e?.cacheId, e?.fields && void 0 !== l && r.has(l) ? a.tabular = !1 === t.showMissing ? { hideMissing: !0 } : {} : a.body = (t.pivotData ?? "") + a.body;
96
+ }
97
+ return void 0 !== l && (a.cacheId = l), t.timelineAttributes && (a.timeline = {
98
+ attributes: t.timelineAttributes,
99
+ body: t.timelineBody ?? ""
100
+ }), a;
101
+ }
102
+ function he(t, e, o) {
103
+ const s = { ...e };
104
+ if (void 0 !== o && (s.source = o), void 0 !== t.caption && t.caption !== t.sourceName && (s.caption = t.caption), !1 === t.showCaption && (s.hiddenCaption = !0), void 0 !== t.columnCount && t.columnCount > 1 && (s.columnCount = t.columnCount), void 0 !== t.rowHeight) {
105
+ const e = Math.round(t.rowHeight / 9525);
106
+ e > 0 && 27 !== e && (s.rowHeight = e);
107
+ }
108
+ t.style && "SlicerStyleLight1" !== t.style && (s.style = t.style);
109
+ const r = t.sortOrder ? ae[t.sortOrder] : void 0;
110
+ return r && "ascending" !== r && (s.sortOrder = r), t.crossFilter && "showItemsWithDataAtTop" !== t.crossFilter && (s.crossFilter = t.crossFilter), t.lockedPosition && (s.lockedPosition = !0), !1 === t.customListSort && (s.disabledCustomListSort = !0), t.cacheName && (s.cacheName = t.cacheName), t.startItem && (s.startItem = t.startItem), void 0 !== t.level && (s.level = t.level), t.uid && (s.uid = t.uid), s;
111
+ }
112
+ var de = "xl/richData/rdrichvaluestructure.xml", pe = "xl/richData/rdrichvalue.xml", fe = "xl/richData/rdarray.xml", ge = "xl/richData/rdsupportingpropertybagstructure.xml", me = "xl/richData/rdsupportingpropertybag.xml", be = "xl/richData/rdRichValueTypes.xml", xe = "xl/richData/richStyles.xml", ye = (t, e) => {
113
+ const o = [], s = t?.childNodes, r = s?.length ?? 0;
114
+ for (let t = 0; t < r; t++) {
115
+ const r = s.item(t);
116
+ 1 !== r.nodeType || e && r.localName !== e || o.push(r);
117
+ }
118
+ return o;
119
+ }, ve = (t) => ye(t, "k").map((t) => [t.getAttribute("n") ?? "", t.getAttribute("t") || null]), we = (t) => ye(t, "v").map((t) => ({
120
+ t: t.getAttribute("t") || null,
121
+ text: t.textContent ?? ""
122
+ })), Te = (t) => {
123
+ const e = /* @__PURE__ */ new Map();
124
+ for (const o of ye(t, "key")) {
125
+ const t = /* @__PURE__ */ new Map();
126
+ for (const e of ye(o, "flag")) t.set(e.getAttribute("name") ?? "", e.getAttribute("value") ?? "");
127
+ e.set(o.getAttribute("name") ?? "", t);
128
+ }
129
+ return e;
130
+ }, Se = /* @__PURE__ */ new Uint8Array(0), Ce = class t {
131
+ constructor(t, e, o) {
132
+ this.buffers = /* @__PURE__ */ new Map(), this.zip = t, this.entries = e, this.rawBuffer = o;
133
+ }
134
+ static normalize(t) {
135
+ return t.startsWith("/") ? t.slice(1) : t;
136
+ }
137
+ static async create(e) {
138
+ const o = e instanceof Blob ? Se : e instanceof Uint8Array ? e : new Uint8Array(e), s = e instanceof Blob ? new se(e) : new re(o), r = new ie(s), n = /* @__PURE__ */ new Map();
139
+ for (const t of await r.getEntries()) t.directory || n.set(t.filename, t);
140
+ return new t(r, n, o);
141
+ }
142
+ getNames() {
143
+ return [...this.entries.keys()];
144
+ }
145
+ has(e) {
146
+ return this.entries.has(t.normalize(e));
147
+ }
148
+ uncompressedSize(e) {
149
+ return this.entries.get(t.normalize(e))?.uncompressedSize ?? 0;
150
+ }
151
+ async getBuffer(e) {
152
+ const o = t.normalize(e), s = this.buffers.get(o);
153
+ if (s) return s;
154
+ const r = this.entries.get(o);
155
+ if (!r) return null;
156
+ const n = await r.getData(new ne());
157
+ return this.buffers.set(o, n), n;
158
+ }
159
+ async prefetch(t) {
160
+ const e = [];
161
+ for (const [o, s] of this.entries) !this.buffers.has(o) && t(o, s) && e.push(s.getData(new ne()).then((t) => {
162
+ this.buffers.set(o, t);
163
+ }));
164
+ await Promise.all(e);
165
+ }
166
+ getEntry(e) {
167
+ return this.buffers.get(t.normalize(e)) ?? null;
168
+ }
169
+ async getTextStream(e, o) {
170
+ const s = this.entries.get(t.normalize(e));
171
+ if (!s) return null;
172
+ const r = new TransformStream();
173
+ s.getData(r.writable).catch(() => {});
174
+ const n = r.readable.getReader(), i = new TextDecoder("utf-8");
175
+ return new ReadableStream({ async pull(t) {
176
+ const { value: e, done: s } = await n.read();
177
+ if (s) {
178
+ const e = i.decode();
179
+ e && t.enqueue(e), t.close();
180
+ return;
181
+ }
182
+ o?.(e.byteLength);
183
+ const r = i.decode(e, { stream: !0 });
184
+ r && t.enqueue(r);
185
+ } }).getReader();
186
+ }
187
+ getRawEntry(e) {
188
+ const o = this.entries.get(t.normalize(e));
189
+ if (!o || o.encrypted || void 0 === o.crc32) return null;
190
+ const s = o.offset;
191
+ if (s + 30 > this.rawBuffer.byteLength) return null;
192
+ const r = new DataView(this.rawBuffer.buffer, this.rawBuffer.byteOffset + s, 30);
193
+ if (67324752 !== r.getUint32(0, !0)) return null;
194
+ const n = s + 30 + r.getUint16(26, !0) + r.getUint16(28, !0), i = n + o.compressedSize;
195
+ return i > this.rawBuffer.byteLength ? null : {
196
+ data: this.rawBuffer.subarray(n, i),
197
+ compressionMethod: o.compressionMethod,
198
+ signature: o.crc32
199
+ };
200
+ }
201
+ async close() {
202
+ await this.zip.close();
203
+ }
204
+ }, ke = class {
205
+ constructor(t) {
206
+ this._sink = t, this._samples = [], this._t0 = Ae(), this._tPrev = this._t0, this._heapPrev = Ee();
207
+ }
208
+ mark(t) {
209
+ const e = Ae(), o = Ee(), s = {
210
+ label: t,
211
+ tMs: e - this._t0,
212
+ dtMs: e - this._tPrev,
213
+ heapBytes: o,
214
+ dHeapBytes: void 0 !== o && void 0 !== this._heapPrev ? o - this._heapPrev : void 0,
215
+ rssBytes: Ie()
216
+ };
217
+ this._tPrev = e, this._heapPrev = o, this._samples.push(s), this._sink?.(s);
218
+ }
219
+ samples() {
220
+ return this._samples;
221
+ }
222
+ toTable() {
223
+ return this._samples.map((t) => ({
224
+ phase: t.label,
225
+ tMs: Math.round(t.tMs),
226
+ dtMs: Math.round(t.dtMs),
227
+ heapMB: void 0 !== t.heapBytes ? Pe(t.heapBytes / 1048576) : "—",
228
+ dHeapMB: void 0 !== t.dHeapBytes ? Pe(t.dHeapBytes / 1048576) : "—",
229
+ rssMB: void 0 !== t.rssBytes ? Pe(t.rssBytes / 1048576) : "—"
230
+ }));
231
+ }
232
+ }, Ae = "object" == typeof performance && "function" == typeof performance.now ? () => performance.now() : () => Date.now();
233
+ function Ee() {
234
+ const t = "object" == typeof performance ? performance.memory : void 0;
235
+ if (t && "number" == typeof t.usedJSHeapSize) return t.usedJSHeapSize;
236
+ const e = globalThis.process;
237
+ return "object" == typeof e && "function" == typeof e.memoryUsage ? e.memoryUsage().heapUsed : void 0;
238
+ }
239
+ function Ie() {
240
+ const t = globalThis.process;
241
+ if ("object" == typeof t && "function" == typeof t.memoryUsage) return t.memoryUsage().rss;
242
+ }
243
+ function Pe(t) {
244
+ return Math.round(10 * t) / 10;
245
+ }
246
+ var Oe = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", De = `-${Oe}.0-9·̀-ͯ‿-⁀`, Ne = (new RegExp(`^[${Oe}]$`, "u"), new RegExp(`^[${De}]$`, "u"), new RegExp(`^[${Oe}][${De}]*$`, "u")), _e = (new RegExp(`^[${De}]+$`, "u"), [
247
+ 32,
248
+ 10,
249
+ 13,
250
+ 9
251
+ ]);
252
+ function $e(t) {
253
+ return t >= 65 && t <= 90 || t >= 97 && t <= 122 || 58 === t || 95 === t || 8204 === t || 8205 === t || t >= 192 && t <= 214 || t >= 216 && t <= 246 || t >= 248 && t <= 767 || t >= 880 && t <= 893 || t >= 895 && t <= 8191 || t >= 8304 && t <= 8591 || t >= 11264 && t <= 12271 || t >= 12289 && t <= 55295 || t >= 63744 && t <= 64975 || t >= 65008 && t <= 65533 || t >= 65536 && t <= 983039;
254
+ }
255
+ var Me = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", Re = `-${Me}.0-9·̀-ͯ‿-⁀`;
256
+ new RegExp(`^[${Me}]$`, "u"), new RegExp(`^[${Re}]$`, "u"), new RegExp(`^[${Me}][${Re}]*$`, "u"), new RegExp(`^[${Re}]+$`, "u");
257
+ var Ve = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", Le = `-${Ve}.0-9·̀-ͯ‿-⁀`, je = (new RegExp(`^[${Ve}]$`, "u"), new RegExp(`^[${Le}]$`, "u"), new RegExp(`^[${Ve}][${Le}]*$`, "u"));
258
+ function Be(t) {
259
+ return t >= 65 && t <= 90 || 95 === t || t >= 97 && t <= 122 || t >= 192 && t <= 214 || t >= 216 && t <= 246 || t >= 248 && t <= 767 || t >= 880 && t <= 893 || t >= 895 && t <= 8191 || t >= 8204 && t <= 8205 || t >= 8304 && t <= 8591 || t >= 11264 && t <= 12271 || t >= 12289 && t <= 55295 || t >= 63744 && t <= 64975 || t >= 65008 && t <= 65533 || t >= 65536 && t <= 983039;
260
+ }
261
+ var Fe = function(t) {
262
+ return 32 === t || 10 === t || 13 === t || 9 === t;
263
+ }, He = function(t) {
264
+ return t >= 32 && t <= 55295 || 10 === t || 13 === t || 9 === t || t >= 57344 && t <= 65533 || t >= 65536 && t <= 1114111;
265
+ }, We = $e, ze = function(t) {
266
+ return $e(t) || t >= 48 && t <= 57 || 45 === t || 46 === t || 183 === t || t >= 768 && t <= 879 || t >= 8255 && t <= 8256;
267
+ }, Xe = _e, qe = Ne, Ue = function(t) {
268
+ return t >= 1 && t <= 55295 || t >= 57344 && t <= 65533 || t >= 65536 && t <= 1114111;
269
+ }, Ge = Be, Ke = function(t) {
270
+ return Be(t) || 45 === t || 46 === t || t >= 48 && t <= 57 || 183 === t || t >= 768 && t <= 879 || t >= 8255 && t <= 8256;
271
+ }, Je = je, Ze = "http://www.w3.org/XML/1998/namespace", Qe = "http://www.w3.org/2000/xmlns/", Ye = {
272
+ __proto__: null,
273
+ xml: Ze,
274
+ xmlns: Qe
275
+ }, to = {
276
+ __proto__: null,
277
+ amp: "&",
278
+ gt: ">",
279
+ lt: "<",
280
+ quot: "\"",
281
+ apos: "'"
282
+ }, eo = -1, oo = -2, so = 13, ro = 33, no = 10, io = 60, ao = 61, lo = 62, co = 63, uo = 93, ho = (t) => 34 === t || 39 === t, po = [34, 39], fo = [
283
+ ...po,
284
+ 91,
285
+ lo
286
+ ], go = [
287
+ ...po,
288
+ io,
289
+ uo
290
+ ], mo = [
291
+ ao,
292
+ co,
293
+ ...Xe
294
+ ], bo = [
295
+ ...Xe,
296
+ lo,
297
+ 38,
298
+ io
299
+ ];
300
+ function xo(t, e, o) {
301
+ switch (e) {
302
+ case "xml":
303
+ o !== Ze && t.fail(`xml prefix must be bound to ${Ze}.`);
304
+ break;
305
+ case "xmlns": o !== Qe && t.fail(`xmlns prefix must be bound to ${Qe}.`);
306
+ }
307
+ switch (o) {
308
+ case Qe:
309
+ t.fail("" === e ? `the default namespace may not be set to ${o}.` : `may not assign a prefix (even "xmlns") to the URI ${Qe}.`);
310
+ break;
311
+ case Ze: switch (e) {
312
+ case "xml": break;
313
+ case "":
314
+ t.fail(`the default namespace may not be set to ${o}.`);
315
+ break;
316
+ default: t.fail("may not assign the xml namespace to another prefix.");
317
+ }
318
+ }
319
+ }
320
+ var yo, vo = (t) => Je.test(t), wo = (t) => qe.test(t), To = {
321
+ xmldecl: "xmlDeclHandler",
322
+ text: "textHandler",
323
+ processinginstruction: "piHandler",
324
+ doctype: "doctypeHandler",
325
+ comment: "commentHandler",
326
+ opentagstart: "openTagStartHandler",
327
+ attribute: "attributeHandler",
328
+ opentag: "openTagHandler",
329
+ closetag: "closeTagHandler",
330
+ cdata: "cdataHandler",
331
+ error: "errorHandler",
332
+ end: "endHandler",
333
+ ready: "readyHandler"
334
+ }, So = class {
335
+ get closed() {
336
+ return this._closed;
337
+ }
338
+ constructor(t) {
339
+ this.i = 0, this.prevI = 0, this.opt = t ?? {}, this.fragmentOpt = !!this.opt.fragment;
340
+ const e = this.xmlnsOpt = !!this.opt.xmlns;
341
+ if (this.trackPosition = !1 !== this.opt.position, this.fileName = this.opt.fileName, e) {
342
+ this.nameStartCheck = Ge, this.nameCheck = Ke, this.isName = vo, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = {
343
+ __proto__: null,
344
+ ...Ye
345
+ };
346
+ const t = this.opt.additionalNamespaces;
347
+ null != t && (function(t, e) {
348
+ for (const o of Object.keys(e)) xo(t, o, e[o]);
349
+ }(this, t), Object.assign(this.ns, t));
350
+ } else this.nameStartCheck = We, this.nameCheck = ze, this.isName = wo, this.processAttribs = this.processAttribsPlain, this.pushAttrib = this.pushAttribPlain;
351
+ this.stateTable = [
352
+ this.sBegin,
353
+ this.sBeginWhitespace,
354
+ this.sDoctype,
355
+ this.sDoctypeQuote,
356
+ this.sDTD,
357
+ this.sDTDQuoted,
358
+ this.sDTDOpenWaka,
359
+ this.sDTDOpenWakaBang,
360
+ this.sDTDComment,
361
+ this.sDTDCommentEnding,
362
+ this.sDTDCommentEnded,
363
+ this.sDTDPI,
364
+ this.sDTDPIEnding,
365
+ this.sText,
366
+ this.sEntity,
367
+ this.sOpenWaka,
368
+ this.sOpenWakaBang,
369
+ this.sComment,
370
+ this.sCommentEnding,
371
+ this.sCommentEnded,
372
+ this.sCData,
373
+ this.sCDataEnding,
374
+ this.sCDataEnding2,
375
+ this.sPIFirstChar,
376
+ this.sPIRest,
377
+ this.sPIBody,
378
+ this.sPIEnding,
379
+ this.sXMLDeclNameStart,
380
+ this.sXMLDeclName,
381
+ this.sXMLDeclEq,
382
+ this.sXMLDeclValueStart,
383
+ this.sXMLDeclValue,
384
+ this.sXMLDeclSeparator,
385
+ this.sXMLDeclEnding,
386
+ this.sOpenTag,
387
+ this.sOpenTagSlash,
388
+ this.sAttrib,
389
+ this.sAttribName,
390
+ this.sAttribNameSawWhite,
391
+ this.sAttribValue,
392
+ this.sAttribValueQuoted,
393
+ this.sAttribValueClosed,
394
+ this.sAttribValueUnquoted,
395
+ this.sCloseTag,
396
+ this.sCloseTagSawWhite
397
+ ], this._init();
398
+ }
399
+ _init() {
400
+ this.openWakaBang = "", this.text = "", this.name = "", this.piTarget = "", this.entity = "", this.q = null, this.tags = [], this.tag = null, this.topNS = null, this.chunk = "", this.chunkPosition = 0, this.i = 0, this.prevI = 0, this.carriedFromPrevious = void 0, this.forbiddenState = 0, this.attribList = [];
401
+ const { fragmentOpt: t } = this;
402
+ this.state = t ? so : 0, this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = t, this.xmlDeclPossible = !t, this.xmlDeclExpects = ["version"], this.entityReturnState = void 0;
403
+ let { defaultXMLVersion: e } = this.opt;
404
+ if (void 0 === e) {
405
+ if (!0 === this.opt.forceXMLVersion) throw new Error("forceXMLVersion set but defaultXMLVersion is not set");
406
+ e = "1.0";
407
+ }
408
+ this.setXMLVersion(e), this.positionAtNewLine = 0, this.doctype = !1, this._closed = !1, this.xmlDecl = {
409
+ version: void 0,
410
+ encoding: void 0,
411
+ standalone: void 0
412
+ }, this.line = 1, this.column = 0, this.ENTITIES = Object.create(to), this.readyHandler?.();
413
+ }
414
+ get position() {
415
+ return this.chunkPosition + this.i;
416
+ }
417
+ get columnIndex() {
418
+ return this.position - this.positionAtNewLine;
419
+ }
420
+ on(t, e) {
421
+ this[To[t]] = e;
422
+ }
423
+ off(t) {
424
+ this[To[t]] = void 0;
425
+ }
426
+ makeError(t) {
427
+ let e = this.fileName ?? "";
428
+ return this.trackPosition && (e.length > 0 && (e += ":"), e += `${this.line}:${this.column}`), e.length > 0 && (e += ": "), new Error(e + t);
429
+ }
430
+ fail(t) {
431
+ const e = this.makeError(t), o = this.errorHandler;
432
+ if (void 0 === o) throw e;
433
+ return o(e), this;
434
+ }
435
+ write(t) {
436
+ if (this.closed) return this.fail("cannot write after close.");
437
+ let e = !1;
438
+ null === t ? (e = !0, t = "") : "object" == typeof t && (t = t.toString()), void 0 !== this.carriedFromPrevious && (t = `${this.carriedFromPrevious}${t}`, this.carriedFromPrevious = void 0);
439
+ let o = t.length;
440
+ const s = t.charCodeAt(o - 1);
441
+ !e && (13 === s || s >= 55296 && s <= 56319) && (this.carriedFromPrevious = t[o - 1], o--, t = t.slice(0, o));
442
+ const { stateTable: r } = this;
443
+ for (this.chunk = t, this.i = 0; this.i < o;) r[this.state].call(this);
444
+ return this.chunkPosition += o, e ? this.end() : this;
445
+ }
446
+ close() {
447
+ return this.write(null);
448
+ }
449
+ getCode10() {
450
+ const t = this.chunk, e = this.i;
451
+ if (this.prevI = e, this.i++, e >= t.length) return eo;
452
+ const o = t.charCodeAt(e);
453
+ if (this.column++, o < 55296) {
454
+ if (o >= 32 || 9 === o) return o;
455
+ switch (o) {
456
+ case no: return this.line++, this.column = 0, this.positionAtNewLine = this.position, no;
457
+ case 13: return t.charCodeAt(e + 1) === no && (this.i = e + 2), this.line++, this.column = 0, this.positionAtNewLine = this.position, oo;
458
+ default: return this.fail("disallowed character."), o;
459
+ }
460
+ }
461
+ if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o;
462
+ const s = 65536 + 1024 * (o - 55296) + (t.charCodeAt(e + 1) - 56320);
463
+ return this.i = e + 2, s > 1114111 && this.fail("disallowed character."), s;
464
+ }
465
+ getCode11() {
466
+ const { chunk: t, i: e } = this;
467
+ if (this.prevI = e, this.i = e + 1, e >= t.length) return eo;
468
+ const o = t.charCodeAt(e);
469
+ if (this.column++, o < 55296) {
470
+ if (o > 31 && o < 127 || o > 159 && 8232 !== o || 9 === o) return o;
471
+ switch (o) {
472
+ case no: return this.line++, this.column = 0, this.positionAtNewLine = this.position, no;
473
+ case 13: {
474
+ const o = t.charCodeAt(e + 1);
475
+ o !== no && 133 !== o || (this.i = e + 2);
476
+ }
477
+ case 133:
478
+ case 8232: return this.line++, this.column = 0, this.positionAtNewLine = this.position, oo;
479
+ default: return this.fail("disallowed character."), o;
480
+ }
481
+ }
482
+ if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o;
483
+ const s = 65536 + 1024 * (o - 55296) + (t.charCodeAt(e + 1) - 56320);
484
+ return this.i = e + 2, s > 1114111 && this.fail("disallowed character."), s;
485
+ }
486
+ getCodeNorm() {
487
+ const t = this.getCode();
488
+ return t === oo ? no : t;
489
+ }
490
+ unGet() {
491
+ this.i = this.prevI, this.column--;
492
+ }
493
+ captureTo(t) {
494
+ let { i: e } = this;
495
+ const { chunk: o } = this;
496
+ for (;;) {
497
+ const s = this.getCode(), r = s === oo, n = r ? no : s;
498
+ if (n === eo || t.includes(n)) return this.text += o.slice(e, this.prevI), n;
499
+ r && (this.text += `${o.slice(e, this.prevI)}\n`, e = this.i);
500
+ }
501
+ }
502
+ captureToChar(t) {
503
+ let { i: e } = this;
504
+ const { chunk: o } = this;
505
+ for (;;) {
506
+ let s = this.getCode();
507
+ switch (s) {
508
+ case oo:
509
+ this.text += `${o.slice(e, this.prevI)}\n`, e = this.i, s = no;
510
+ break;
511
+ case eo: return this.text += o.slice(e), !1;
512
+ }
513
+ if (s === t) return this.text += o.slice(e, this.prevI), !0;
514
+ }
515
+ }
516
+ captureNameChars() {
517
+ const { chunk: t, i: e } = this;
518
+ for (;;) {
519
+ const o = this.getCode();
520
+ if (o === eo) return this.name += t.slice(e), eo;
521
+ if (!ze(o)) return this.name += t.slice(e, this.prevI), o === oo ? no : o;
522
+ }
523
+ }
524
+ skipSpaces() {
525
+ for (;;) {
526
+ const t = this.getCodeNorm();
527
+ if (t === eo || !Fe(t)) return t;
528
+ }
529
+ }
530
+ setXMLVersion(t) {
531
+ this.currentXMLVersion = t, "1.0" === t ? (this.isChar = He, this.getCode = this.getCode10) : (this.isChar = Ue, this.getCode = this.getCode11);
532
+ }
533
+ sBegin() {
534
+ 65279 === this.chunk.charCodeAt(0) && (this.i++, this.column++), this.state = 1;
535
+ }
536
+ sBeginWhitespace() {
537
+ const t = this.i, e = this.skipSpaces();
538
+ switch (this.prevI !== t && (this.xmlDeclPossible = !1), e) {
539
+ case io:
540
+ if (this.state = 15, 0 !== this.text.length) throw new Error("no-empty text at start");
541
+ break;
542
+ case eo: break;
543
+ default: this.unGet(), this.state = so, this.xmlDeclPossible = !1;
544
+ }
545
+ }
546
+ sDoctype() {
547
+ const t = this.captureTo(fo);
548
+ switch (t) {
549
+ case lo:
550
+ this.doctypeHandler?.(this.text), this.text = "", this.state = so, this.doctype = !0;
551
+ break;
552
+ case eo: break;
553
+ default: this.text += String.fromCodePoint(t), 91 === t ? this.state = 4 : ho(t) && (this.state = 3, this.q = t);
554
+ }
555
+ }
556
+ sDoctypeQuote() {
557
+ const t = this.q;
558
+ this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.q = null, this.state = 2);
559
+ }
560
+ sDTD() {
561
+ const t = this.captureTo(go);
562
+ t !== eo && (this.text += String.fromCodePoint(t), t === uo ? this.state = 2 : t === io ? this.state = 6 : ho(t) && (this.state = 5, this.q = t));
563
+ }
564
+ sDTDQuoted() {
565
+ const t = this.q;
566
+ this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.state = 4, this.q = null);
567
+ }
568
+ sDTDOpenWaka() {
569
+ const t = this.getCodeNorm();
570
+ switch (this.text += String.fromCodePoint(t), t) {
571
+ case 33:
572
+ this.state = 7, this.openWakaBang = "";
573
+ break;
574
+ case co:
575
+ this.state = 11;
576
+ break;
577
+ default: this.state = 4;
578
+ }
579
+ }
580
+ sDTDOpenWakaBang() {
581
+ const t = String.fromCodePoint(this.getCodeNorm()), e = this.openWakaBang += t;
582
+ this.text += t, "-" !== e && (this.state = "--" === e ? 8 : 4, this.openWakaBang = "");
583
+ }
584
+ sDTDComment() {
585
+ this.captureToChar(45) && (this.text += "-", this.state = 9);
586
+ }
587
+ sDTDCommentEnding() {
588
+ const t = this.getCodeNorm();
589
+ this.text += String.fromCodePoint(t), this.state = 45 === t ? 10 : 8;
590
+ }
591
+ sDTDCommentEnded() {
592
+ const t = this.getCodeNorm();
593
+ this.text += String.fromCodePoint(t), t === lo ? this.state = 4 : (this.fail("malformed comment."), this.state = 8);
594
+ }
595
+ sDTDPI() {
596
+ this.captureToChar(co) && (this.text += "?", this.state = 12);
597
+ }
598
+ sDTDPIEnding() {
599
+ const t = this.getCodeNorm();
600
+ this.text += String.fromCodePoint(t), t === lo && (this.state = 4);
601
+ }
602
+ sText() {
603
+ 0 !== this.tags.length ? this.handleTextInRoot() : this.handleTextOutsideRoot();
604
+ }
605
+ sEntity() {
606
+ let { i: t } = this;
607
+ const { chunk: e } = this;
608
+ t: for (;;) switch (this.getCode()) {
609
+ case oo:
610
+ this.entity += `${e.slice(t, this.prevI)}\n`, t = this.i;
611
+ break;
612
+ case 59: {
613
+ const { entityReturnState: o } = this, s = this.entity + e.slice(t, this.prevI);
614
+ let r;
615
+ this.state = o, "" === s ? (this.fail("empty entity name."), r = "&;") : (r = this.parseEntity(s), this.entity = ""), o === so && void 0 === this.textHandler || (this.text += r);
616
+ break t;
617
+ }
618
+ case eo:
619
+ this.entity += e.slice(t);
620
+ break t;
621
+ }
622
+ }
623
+ sOpenWaka() {
624
+ const t = this.getCode();
625
+ if (We(t)) this.state = 34, this.unGet(), this.xmlDeclPossible = !1;
626
+ else switch (t) {
627
+ case 47:
628
+ this.state = 43, this.xmlDeclPossible = !1;
629
+ break;
630
+ case 33:
631
+ this.state = 16, this.openWakaBang = "", this.xmlDeclPossible = !1;
632
+ break;
633
+ case co:
634
+ this.state = 23;
635
+ break;
636
+ default: this.fail("disallowed character in tag name"), this.state = so, this.xmlDeclPossible = !1;
637
+ }
638
+ }
639
+ sOpenWakaBang() {
640
+ switch (this.openWakaBang += String.fromCodePoint(this.getCodeNorm()), this.openWakaBang) {
641
+ case "[CDATA[":
642
+ this.sawRoot || this.reportedTextBeforeRoot || (this.fail("text data outside of root node."), this.reportedTextBeforeRoot = !0), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = !0), this.state = 20, this.openWakaBang = "";
643
+ break;
644
+ case "--":
645
+ this.state = 17, this.openWakaBang = "";
646
+ break;
647
+ case "DOCTYPE":
648
+ this.state = 2, (this.doctype || this.sawRoot) && this.fail("inappropriately located doctype declaration."), this.openWakaBang = "";
649
+ break;
650
+ default: this.openWakaBang.length >= 7 && this.fail("incorrect syntax.");
651
+ }
652
+ }
653
+ sComment() {
654
+ this.captureToChar(45) && (this.state = 18);
655
+ }
656
+ sCommentEnding() {
657
+ const t = this.getCodeNorm();
658
+ 45 === t ? (this.state = 19, this.commentHandler?.(this.text), this.text = "") : (this.text += `-${String.fromCodePoint(t)}`, this.state = 17);
659
+ }
660
+ sCommentEnded() {
661
+ const t = this.getCodeNorm();
662
+ t !== lo ? (this.fail("malformed comment."), this.text += `--${String.fromCodePoint(t)}`, this.state = 17) : this.state = so;
663
+ }
664
+ sCData() {
665
+ this.captureToChar(uo) && (this.state = 21);
666
+ }
667
+ sCDataEnding() {
668
+ const t = this.getCodeNorm();
669
+ t === uo ? this.state = 22 : (this.text += `]${String.fromCodePoint(t)}`, this.state = 20);
670
+ }
671
+ sCDataEnding2() {
672
+ const t = this.getCodeNorm();
673
+ switch (t) {
674
+ case lo:
675
+ this.cdataHandler?.(this.text), this.text = "", this.state = so;
676
+ break;
677
+ case uo:
678
+ this.text += "]";
679
+ break;
680
+ default: this.text += `]]${String.fromCodePoint(t)}`, this.state = 20;
681
+ }
682
+ }
683
+ sPIFirstChar() {
684
+ const t = this.getCodeNorm();
685
+ this.nameStartCheck(t) ? (this.piTarget += String.fromCodePoint(t), this.state = 24) : t === co || Fe(t) ? (this.fail("processing instruction without a target."), this.state = t === co ? 26 : 25) : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(t), this.state = 24);
686
+ }
687
+ sPIRest() {
688
+ const { chunk: t, i: e } = this;
689
+ for (;;) {
690
+ const o = this.getCodeNorm();
691
+ if (o === eo) return void (this.piTarget += t.slice(e));
692
+ if (!this.nameCheck(o)) {
693
+ this.piTarget += t.slice(e, this.prevI);
694
+ const s = o === co;
695
+ s || Fe(o) ? "xml" === this.piTarget ? (this.xmlDeclPossible || this.fail("an XML declaration must be at the start of the document."), this.state = s ? ro : 27) : this.state = s ? 26 : 25 : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(o));
696
+ break;
697
+ }
698
+ }
699
+ }
700
+ sPIBody() {
701
+ if (0 === this.text.length) {
702
+ const t = this.getCodeNorm();
703
+ t === co ? this.state = 26 : Fe(t) || (this.text = String.fromCodePoint(t));
704
+ } else this.captureToChar(co) && (this.state = 26);
705
+ }
706
+ sPIEnding() {
707
+ const t = this.getCodeNorm();
708
+ if (t === lo) {
709
+ const { piTarget: t } = this;
710
+ "xml" === t.toLowerCase() && this.fail("the XML declaration must appear at the start of the document."), this.piHandler?.({
711
+ target: t,
712
+ body: this.text
713
+ }), this.piTarget = this.text = "", this.state = so;
714
+ } else t === co ? this.text += "?" : (this.text += `?${String.fromCodePoint(t)}`, this.state = 25);
715
+ this.xmlDeclPossible = !1;
716
+ }
717
+ sXMLDeclNameStart() {
718
+ const t = this.skipSpaces();
719
+ t !== co ? t !== eo && (this.state = 28, this.name = String.fromCodePoint(t)) : this.state = ro;
720
+ }
721
+ sXMLDeclName() {
722
+ const t = this.captureTo(mo);
723
+ if (t === co) return this.state = ro, this.name += this.text, this.text = "", void this.fail("XML declaration is incomplete.");
724
+ if (Fe(t) || t === ao) {
725
+ if (this.name += this.text, this.text = "", !this.xmlDeclExpects.includes(this.name)) switch (this.name.length) {
726
+ case 0:
727
+ this.fail("did not expect any more name/value pairs.");
728
+ break;
729
+ case 1:
730
+ this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);
731
+ break;
732
+ default: this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`);
733
+ }
734
+ this.state = t === ao ? 30 : 29;
735
+ }
736
+ }
737
+ sXMLDeclEq() {
738
+ const t = this.getCodeNorm();
739
+ if (t === co) return this.state = ro, void this.fail("XML declaration is incomplete.");
740
+ Fe(t) || (t !== ao && this.fail("value required."), this.state = 30);
741
+ }
742
+ sXMLDeclValueStart() {
743
+ const t = this.getCodeNorm();
744
+ if (t === co) return this.state = ro, void this.fail("XML declaration is incomplete.");
745
+ Fe(t) || (ho(t) ? this.q = t : (this.fail("value must be quoted."), this.q = 32), this.state = 31);
746
+ }
747
+ sXMLDeclValue() {
748
+ const t = this.captureTo([this.q, co]);
749
+ if (t === co) return this.state = ro, this.text = "", void this.fail("XML declaration is incomplete.");
750
+ if (t === eo) return;
751
+ const e = this.text;
752
+ switch (this.text = "", this.name) {
753
+ case "version": {
754
+ this.xmlDeclExpects = ["encoding", "standalone"];
755
+ const t = e;
756
+ this.xmlDecl.version = t, /^1\.[0-9]+$/.test(t) ? this.opt.forceXMLVersion || this.setXMLVersion(t) : this.fail("version number must match /^1\\.[0-9]+$/.");
757
+ break;
758
+ }
759
+ case "encoding":
760
+ /^[A-Za-z][A-Za-z0-9._-]*$/.test(e) || this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."), this.xmlDeclExpects = ["standalone"], this.xmlDecl.encoding = e;
761
+ break;
762
+ case "standalone": "yes" !== e && "no" !== e && this.fail("standalone value must match \"yes\" or \"no\"."), this.xmlDeclExpects = [], this.xmlDecl.standalone = e;
763
+ }
764
+ this.name = "", this.state = 32;
765
+ }
766
+ sXMLDeclSeparator() {
767
+ const t = this.getCodeNorm();
768
+ t !== co ? (Fe(t) || (this.fail("whitespace required."), this.unGet()), this.state = 27) : this.state = ro;
769
+ }
770
+ sXMLDeclEnding() {
771
+ this.getCodeNorm() === lo ? ("xml" !== this.piTarget ? this.fail("processing instructions are not allowed before root.") : "version" !== this.name && this.xmlDeclExpects.includes("version") && this.fail("XML declaration must contain a version."), this.xmlDeclHandler?.(this.xmlDecl), this.name = "", this.piTarget = this.text = "", this.state = so) : this.fail("The character ? is disallowed anywhere in XML declarations."), this.xmlDeclPossible = !1;
772
+ }
773
+ sOpenTag() {
774
+ const t = this.captureNameChars();
775
+ if (t === eo) return;
776
+ const e = this.tag = {
777
+ name: this.name,
778
+ attributes: Object.create(null)
779
+ };
780
+ switch (this.name = "", this.xmlnsOpt && (this.topNS = e.ns = Object.create(null)), this.openTagStartHandler?.(e), this.sawRoot = !0, !this.fragmentOpt && this.closedRoot && this.fail("documents may contain only one root."), t) {
781
+ case lo:
782
+ this.openTag();
783
+ break;
784
+ case 47:
785
+ this.state = 35;
786
+ break;
787
+ default: Fe(t) || this.fail("disallowed character in tag name."), this.state = 36;
788
+ }
789
+ }
790
+ sOpenTagSlash() {
791
+ this.getCode() === lo ? this.openSelfClosingTag() : (this.fail("forward-slash in opening tag not followed by >."), this.state = 36);
792
+ }
793
+ sAttrib() {
794
+ const t = this.skipSpaces();
795
+ t !== eo && (We(t) ? (this.unGet(), this.state = 37) : t === lo ? this.openTag() : 47 === t ? this.state = 35 : this.fail("disallowed character in attribute name."));
796
+ }
797
+ sAttribName() {
798
+ const t = this.captureNameChars();
799
+ t === ao ? this.state = 39 : Fe(t) ? this.state = 38 : t === lo ? (this.fail("attribute without value."), this.pushAttrib(this.name, this.name), this.name = this.text = "", this.openTag()) : t !== eo && this.fail("disallowed character in attribute name.");
800
+ }
801
+ sAttribNameSawWhite() {
802
+ const t = this.skipSpaces();
803
+ switch (t) {
804
+ case eo: return;
805
+ case ao:
806
+ this.state = 39;
807
+ break;
808
+ default: this.fail("attribute without value."), this.text = "", this.name = "", t === lo ? this.openTag() : We(t) ? (this.unGet(), this.state = 37) : (this.fail("disallowed character in attribute name."), this.state = 36);
809
+ }
810
+ }
811
+ sAttribValue() {
812
+ const t = this.getCodeNorm();
813
+ ho(t) ? (this.q = t, this.state = 40) : Fe(t) || (this.fail("unquoted attribute value."), this.state = 42, this.unGet());
814
+ }
815
+ sAttribValueQuoted() {
816
+ const { q: t, chunk: e } = this;
817
+ let { i: o } = this;
818
+ for (;;) switch (this.getCode()) {
819
+ case t:
820
+ this.pushAttrib(this.name, this.text + e.slice(o, this.prevI)), this.name = this.text = "", this.q = null, this.state = 41;
821
+ return;
822
+ case 38:
823
+ this.text += e.slice(o, this.prevI), this.state = 14, this.entityReturnState = 40;
824
+ return;
825
+ case no:
826
+ case oo:
827
+ case 9:
828
+ this.text += `${e.slice(o, this.prevI)} `, o = this.i;
829
+ break;
830
+ case io:
831
+ this.text += e.slice(o, this.prevI), this.fail("disallowed character.");
832
+ return;
833
+ case eo:
834
+ this.text += e.slice(o);
835
+ return;
836
+ }
837
+ }
838
+ sAttribValueClosed() {
839
+ const t = this.getCodeNorm();
840
+ Fe(t) ? this.state = 36 : t === lo ? this.openTag() : 47 === t ? this.state = 35 : We(t) ? (this.fail("no whitespace between attributes."), this.unGet(), this.state = 37) : this.fail("disallowed character in attribute name.");
841
+ }
842
+ sAttribValueUnquoted() {
843
+ const t = this.captureTo(bo);
844
+ switch (t) {
845
+ case 38:
846
+ this.state = 14, this.entityReturnState = 42;
847
+ break;
848
+ case io:
849
+ this.fail("disallowed character.");
850
+ break;
851
+ case eo: break;
852
+ default: this.text.includes("]]>") && this.fail("the string \"]]>\" is disallowed in char data."), this.pushAttrib(this.name, this.text), this.name = this.text = "", t === lo ? this.openTag() : this.state = 36;
853
+ }
854
+ }
855
+ sCloseTag() {
856
+ const t = this.captureNameChars();
857
+ t === lo ? this.closeTag() : Fe(t) ? this.state = 44 : t !== eo && this.fail("disallowed character in closing tag.");
858
+ }
859
+ sCloseTagSawWhite() {
860
+ switch (this.skipSpaces()) {
861
+ case lo:
862
+ this.closeTag();
863
+ break;
864
+ case eo: break;
865
+ default: this.fail("disallowed character in closing tag.");
866
+ }
867
+ }
868
+ handleTextInRoot() {
869
+ let { i: t, forbiddenState: e } = this;
870
+ const { chunk: o, textHandler: s } = this;
871
+ t: for (;;) switch (this.getCode()) {
872
+ case io:
873
+ if (this.state = 15, void 0 !== s) {
874
+ const { text: e } = this, r = o.slice(t, this.prevI);
875
+ 0 !== e.length ? (s(e + r), this.text = "") : 0 !== r.length && s(r);
876
+ }
877
+ e = 0;
878
+ break t;
879
+ case 38:
880
+ this.state = 14, this.entityReturnState = so, void 0 !== s && (this.text += o.slice(t, this.prevI)), e = 0;
881
+ break t;
882
+ case uo:
883
+ switch (e) {
884
+ case 0:
885
+ e = 1;
886
+ break;
887
+ case 1:
888
+ e = 2;
889
+ break;
890
+ case 2: break;
891
+ default: throw new Error("impossible state");
892
+ }
893
+ break;
894
+ case lo:
895
+ 2 === e && this.fail("the string \"]]>\" is disallowed in char data."), e = 0;
896
+ break;
897
+ case oo:
898
+ void 0 !== s && (this.text += `${o.slice(t, this.prevI)}\n`), t = this.i, e = 0;
899
+ break;
900
+ case eo:
901
+ void 0 !== s && (this.text += o.slice(t));
902
+ break t;
903
+ default: e = 0;
904
+ }
905
+ this.forbiddenState = e;
906
+ }
907
+ handleTextOutsideRoot() {
908
+ let { i: t } = this;
909
+ const { chunk: e, textHandler: o } = this;
910
+ let s = !1;
911
+ t: for (;;) {
912
+ const r = this.getCode();
913
+ switch (r) {
914
+ case io:
915
+ if (this.state = 15, void 0 !== o) {
916
+ const { text: s } = this, r = e.slice(t, this.prevI);
917
+ 0 !== s.length ? (o(s + r), this.text = "") : 0 !== r.length && o(r);
918
+ }
919
+ break t;
920
+ case 38:
921
+ this.state = 14, this.entityReturnState = so, void 0 !== o && (this.text += e.slice(t, this.prevI)), s = !0;
922
+ break t;
923
+ case oo:
924
+ void 0 !== o && (this.text += `${e.slice(t, this.prevI)}\n`), t = this.i;
925
+ break;
926
+ case eo:
927
+ void 0 !== o && (this.text += e.slice(t));
928
+ break t;
929
+ default: Fe(r) || (s = !0);
930
+ }
931
+ }
932
+ s && (this.sawRoot || this.reportedTextBeforeRoot || (this.fail("text data outside of root node."), this.reportedTextBeforeRoot = !0), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = !0));
933
+ }
934
+ pushAttribNS(t, e) {
935
+ const { prefix: o, local: s } = this.qName(t), r = {
936
+ name: t,
937
+ prefix: o,
938
+ local: s,
939
+ value: e
940
+ };
941
+ if (this.attribList.push(r), this.attributeHandler?.(r), "xmlns" === o) {
942
+ const t = e.trim();
943
+ "1.0" === this.currentXMLVersion && "" === t && this.fail("invalid attempt to undefine prefix in XML 1.0"), this.topNS[s] = t, xo(this, s, t);
944
+ } else if ("xmlns" === t) {
945
+ const t = e.trim();
946
+ this.topNS[""] = t, xo(this, "", t);
947
+ }
948
+ }
949
+ pushAttribPlain(t, e) {
950
+ const o = {
951
+ name: t,
952
+ value: e
953
+ };
954
+ this.attribList.push(o), this.attributeHandler?.(o);
955
+ }
956
+ end() {
957
+ this.sawRoot || this.fail("document must contain a root element.");
958
+ const { tags: t } = this;
959
+ for (; t.length > 0;) {
960
+ const e = t.pop();
961
+ this.fail(`unclosed tag: ${e.name}`);
962
+ }
963
+ 0 !== this.state && this.state !== so && this.fail("unexpected end.");
964
+ const { text: e } = this;
965
+ return 0 !== e.length && (this.textHandler?.(e), this.text = ""), this._closed = !0, this.endHandler?.(), this._init(), this;
966
+ }
967
+ resolve(t) {
968
+ let e = this.topNS[t];
969
+ if (void 0 !== e) return e;
970
+ const { tags: o } = this;
971
+ for (let s = o.length - 1; s >= 0; s--) if (e = o[s].ns[t], void 0 !== e) return e;
972
+ return e = this.ns[t], void 0 !== e ? e : this.opt.resolvePrefix?.(t);
973
+ }
974
+ qName(t) {
975
+ const e = t.indexOf(":");
976
+ if (-1 === e) return {
977
+ prefix: "",
978
+ local: t
979
+ };
980
+ const o = t.slice(e + 1), s = t.slice(0, e);
981
+ return ("" === s || "" === o || o.includes(":")) && this.fail(`malformed name: ${t}.`), {
982
+ prefix: s,
983
+ local: o
984
+ };
985
+ }
986
+ processAttribsNS() {
987
+ const { attribList: t } = this, e = this.tag;
988
+ {
989
+ const { prefix: t, local: o } = this.qName(e.name);
990
+ e.prefix = t, e.local = o;
991
+ const s = e.uri = this.resolve(t) ?? "";
992
+ "" !== t && ("xmlns" === t && this.fail("tags may not have \"xmlns\" as prefix."), "" === s && (this.fail(`unbound namespace prefix: ${JSON.stringify(t)}.`), e.uri = t));
993
+ }
994
+ if (0 === t.length) return;
995
+ const { attributes: o } = e, s = /* @__PURE__ */ new Set();
996
+ for (const e of t) {
997
+ const { name: t, prefix: r, local: n } = e;
998
+ let i, a;
999
+ "" === r ? (i = "xmlns" === t ? Qe : "", a = t) : (i = this.resolve(r), void 0 === i && (this.fail(`unbound namespace prefix: ${JSON.stringify(r)}.`), i = r), a = `{${i}}${n}`), s.has(a) && this.fail(`duplicate attribute: ${a}.`), s.add(a), e.uri = i, o[t] = e;
1000
+ }
1001
+ this.attribList = [];
1002
+ }
1003
+ processAttribsPlain() {
1004
+ const { attribList: t } = this, e = this.tag.attributes;
1005
+ for (const { name: o, value: s } of t) void 0 !== e[o] && this.fail(`duplicate attribute: ${o}.`), e[o] = s;
1006
+ this.attribList = [];
1007
+ }
1008
+ openTag() {
1009
+ this.processAttribs();
1010
+ const { tags: t } = this, e = this.tag;
1011
+ e.isSelfClosing = !1, this.openTagHandler?.(e), t.push(e), this.state = so, this.name = "";
1012
+ }
1013
+ openSelfClosingTag() {
1014
+ this.processAttribs();
1015
+ const { tags: t } = this, e = this.tag;
1016
+ e.isSelfClosing = !0, this.openTagHandler?.(e), this.closeTagHandler?.(e), null === (this.tag = t[t.length - 1] ?? null) && (this.closedRoot = !0), this.state = so, this.name = "";
1017
+ }
1018
+ closeTag() {
1019
+ const { tags: t, name: e } = this;
1020
+ if (this.state = so, this.name = "", "" === e) return this.fail("weird empty close tag."), void (this.text += "</>");
1021
+ const o = this.closeTagHandler;
1022
+ let s = t.length;
1023
+ for (; s-- > 0;) {
1024
+ const s = this.tag = t.pop();
1025
+ if (this.topNS = s.ns, o?.(s), s.name === e) break;
1026
+ this.fail(`unexpected close tag: ${e}.`);
1027
+ }
1028
+ 0 === s ? this.closedRoot = !0 : s < 0 && (this.fail(`unmatched closing tag: ${e}.`), this.text += `</${e}>`);
1029
+ }
1030
+ parseEntity(t) {
1031
+ if ("#" !== t[0]) {
1032
+ const e = this.ENTITIES[t];
1033
+ return void 0 !== e ? e : (this.fail(this.isName(t) ? "undefined entity." : "disallowed character in entity name."), `&${t};`);
1034
+ }
1035
+ let e = NaN;
1036
+ return "x" === t[1] && /^#x[0-9a-f]+$/i.test(t) ? e = parseInt(t.slice(2), 16) : /^#[0-9]+$/.test(t) && (e = parseInt(t.slice(1), 10)), this.isChar(e) ? String.fromCodePoint(e) : (this.fail("malformed character entity."), `&${t};`);
1037
+ }
1038
+ }, Co = /&(#x[0-9a-fA-F]+|#[0-9]+|amp|lt|gt|quot|apos);/g, ko = {
1039
+ amp: "&",
1040
+ lt: "<",
1041
+ gt: ">",
1042
+ quot: "\"",
1043
+ apos: "'"
1044
+ }, Ao = (t, e) => {
1045
+ const o = ko[e];
1046
+ if (void 0 !== o) return o;
1047
+ const s = 120 === e.charCodeAt(1) ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
1048
+ return s > 0 && s <= 1114111 ? String.fromCodePoint(s) : t;
1049
+ }, Eo = (t) => {
1050
+ let e = t;
1051
+ return -1 !== e.indexOf("\r") && (e = e.replace(/\r\n?/g, "\n")), -1 !== e.indexOf("&") && (e = e.replace(Co, Ao)), e;
1052
+ }, Io = (t) => {
1053
+ let e = t;
1054
+ const o = e.length;
1055
+ for (let t = 0; t < o; t++) {
1056
+ const o = e.charCodeAt(t);
1057
+ if (9 === o || 10 === o || 13 === o) {
1058
+ e = e.replace(/\r\n|[\t\n\r]/g, " ");
1059
+ break;
1060
+ }
1061
+ }
1062
+ return -1 !== e.indexOf("&") && (e = e.replace(Co, Ao)), e;
1063
+ }, Po = (t) => 32 === t || 9 === t || 10 === t || 13 === t, Oo = class t {
1064
+ constructor() {
1065
+ this._openTagHandler = void 0, this._closeTagHandler = void 0, this._textHandler = void 0, this._cdataHandler = void 0, this._errorHandler = void 0, this._endHandler = void 0, this._scanners = null, this._carry = "", this._text = "", this._tags = [], this._sawRoot = !1, this._closed = !1;
1066
+ }
1067
+ static {
1068
+ this.NEED_MORE = -1;
1069
+ }
1070
+ static {
1071
+ this.NOT_HANDLED = -2;
1072
+ }
1073
+ static decodeText(t) {
1074
+ return Eo(t);
1075
+ }
1076
+ on(t, e) {
1077
+ switch (t) {
1078
+ case "opentag":
1079
+ this._openTagHandler = e;
1080
+ break;
1081
+ case "closetag":
1082
+ this._closeTagHandler = e;
1083
+ break;
1084
+ case "text":
1085
+ this._textHandler = e;
1086
+ break;
1087
+ case "cdata":
1088
+ this._cdataHandler = e;
1089
+ break;
1090
+ case "error":
1091
+ this._errorHandler = e;
1092
+ break;
1093
+ case "end": this._endHandler = e;
1094
+ }
1095
+ }
1096
+ setElementScanners(t) {
1097
+ if (!t || 0 === t.length) return void (this._scanners = null);
1098
+ const e = new Array(128);
1099
+ for (const o of t) {
1100
+ const t = o.name.charCodeAt(0);
1101
+ if (!(t < 128) || void 0 !== e[t]) throw new Error(`Element scanner '${o.name}' needs an ASCII first character no other scanner uses.`);
1102
+ e[t] = o;
1103
+ }
1104
+ this._scanners = e;
1105
+ }
1106
+ fail(t) {
1107
+ const e = new Error(t), o = this._errorHandler;
1108
+ if (void 0 === o) throw e;
1109
+ o(e);
1110
+ }
1111
+ write(t) {
1112
+ if (this._closed) return this.fail("cannot write after close."), this;
1113
+ let e = t;
1114
+ 0 !== this._carry.length && (e = this._carry + t, this._carry = "");
1115
+ const o = e.length;
1116
+ let s = 0;
1117
+ for (; s < o;) {
1118
+ const t = e.indexOf("<", s);
1119
+ if (-1 === t) return this._text += e.slice(s), this;
1120
+ t > s && (this._text += e.slice(s, t));
1121
+ const r = this._markup(e, t, o);
1122
+ if (-1 === r) return this._carry = e.slice(t), this;
1123
+ s = r;
1124
+ }
1125
+ return this;
1126
+ }
1127
+ close() {
1128
+ 0 !== this._carry.length && (this.fail("unexpected end."), this._carry = ""), this._sawRoot || this.fail("document must contain a root element.");
1129
+ const t = this._tags;
1130
+ for (; t.length > 0;) {
1131
+ const e = t.pop();
1132
+ this.fail(`unclosed tag: ${e.name}`);
1133
+ }
1134
+ return this._flushText(), this._closed = !0, this._endHandler?.(), this;
1135
+ }
1136
+ _flushText() {
1137
+ const t = this._text;
1138
+ if (0 === t.length) return;
1139
+ this._text = "";
1140
+ const e = this._textHandler;
1141
+ void 0 !== e && 0 !== this._tags.length && e(Eo(t));
1142
+ }
1143
+ _markup(e, o, s) {
1144
+ if (o + 1 >= s) return -1;
1145
+ const r = e.charCodeAt(o + 1);
1146
+ if (47 === r) {
1147
+ const t = e.indexOf(">", o + 2);
1148
+ return -1 === t ? -1 : (this._flushText(), this._closeTag(e.slice(o + 2, t).trimEnd()), t + 1);
1149
+ }
1150
+ if (63 === r) {
1151
+ const t = e.indexOf("?>", o + 2);
1152
+ return -1 === t ? -1 : t + 2;
1153
+ }
1154
+ if (33 === r) {
1155
+ if (o + 4 > s) return -1;
1156
+ if (45 === e.charCodeAt(o + 2) && 45 === e.charCodeAt(o + 3)) {
1157
+ const t = e.indexOf("-->", o + 4);
1158
+ return -1 === t ? -1 : t + 3;
1159
+ }
1160
+ if (o + 9 > s) return -1;
1161
+ if (e.startsWith("[CDATA[", o + 2)) {
1162
+ const t = e.indexOf("]]>", o + 9);
1163
+ return -1 === t ? -1 : (this._flushText(), this._cdataHandler?.(e.slice(o + 9, t)), t + 3);
1164
+ }
1165
+ const t = e.indexOf("[", o + 2), r = e.indexOf(">", o + 2);
1166
+ if (-1 === r) return -1;
1167
+ if (-1 !== t && t < r) {
1168
+ const o = e.indexOf("]>", t);
1169
+ return -1 === o ? -1 : o + 2;
1170
+ }
1171
+ return r + 1;
1172
+ }
1173
+ const n = this._scanners;
1174
+ if (null !== n) {
1175
+ const i = r < 128 ? n[r] : void 0;
1176
+ if (void 0 !== i && e.startsWith(i.name, o + 1)) {
1177
+ const r = o + 1 + i.name.length;
1178
+ if (r >= s) return -1;
1179
+ const n = e.charCodeAt(r);
1180
+ if (62 === n || 47 === n || Po(n)) {
1181
+ this._flushText();
1182
+ const r = i.scan(e, o, s);
1183
+ if (r !== t.NOT_HANDLED) {
1184
+ if (r !== t.NEED_MORE) {
1185
+ this._sawRoot = !0;
1186
+ const t = i.openTag;
1187
+ void 0 !== t && this._tags.push(t);
1188
+ }
1189
+ return r;
1190
+ }
1191
+ }
1192
+ }
1193
+ }
1194
+ return this._openTag(e, o, s);
1195
+ }
1196
+ _openTag(t, e, o) {
1197
+ let s = e + 1, r = 0;
1198
+ for (; s < o && (r = t.charCodeAt(s), 62 !== r && 47 !== r && !Po(r));) s++;
1199
+ if (s >= o) return -1;
1200
+ const n = t.slice(e + 1, s), i = {};
1201
+ let a = !1;
1202
+ for (;;) {
1203
+ for (; s < o && Po(r = t.charCodeAt(s));) s++;
1204
+ if (s >= o) return -1;
1205
+ if (62 === r) {
1206
+ s++;
1207
+ break;
1208
+ }
1209
+ if (47 === r) {
1210
+ if (s + 1 >= o) return -1;
1211
+ if (62 !== t.charCodeAt(s + 1)) {
1212
+ this.fail("forward-slash in opening tag not followed by >."), s++;
1213
+ continue;
1214
+ }
1215
+ a = !0, s += 2;
1216
+ break;
1217
+ }
1218
+ const e = s;
1219
+ for (; s < o && (r = t.charCodeAt(s), 61 !== r && 62 !== r && 47 !== r && !Po(r));) s++;
1220
+ if (s >= o) return -1;
1221
+ const n = t.slice(e, s);
1222
+ for (; s < o && Po(r = t.charCodeAt(s));) s++;
1223
+ if (s >= o) return -1;
1224
+ if (61 !== r) {
1225
+ this.fail("attribute without value.");
1226
+ continue;
1227
+ }
1228
+ for (s++; s < o && Po(r = t.charCodeAt(s));) s++;
1229
+ if (s >= o) return -1;
1230
+ if (34 !== r && 39 !== r) {
1231
+ this.fail("unquoted attribute value.");
1232
+ continue;
1233
+ }
1234
+ const l = t.indexOf(34 === r ? "\"" : "'", s + 1);
1235
+ if (-1 === l) return -1;
1236
+ "__proto__" !== n && (i[n] = Io(t.slice(s + 1, l))), s = l + 1;
1237
+ }
1238
+ this._flushText(), this._sawRoot = !0;
1239
+ const l = {
1240
+ name: n,
1241
+ attributes: i,
1242
+ isSelfClosing: a
1243
+ };
1244
+ return this._openTagHandler?.(l), a ? this._closeTagHandler?.(l) : this._tags.push(l), s;
1245
+ }
1246
+ _closeTag(t) {
1247
+ if ("" === t) return void this.fail("weird empty close tag.");
1248
+ const e = this._tags, o = this._closeTagHandler;
1249
+ let s = e.length;
1250
+ for (; s-- > 0;) {
1251
+ const s = e.pop();
1252
+ if (o?.(s), s.name === t) return;
1253
+ this.fail(`unexpected close tag: ${t}.`);
1254
+ }
1255
+ this.fail(`unmatched closing tag: ${t}.`);
1256
+ }
1257
+ };
1258
+ (function(t) {
1259
+ t.Events = {
1260
+ XmlDecl: "xmldecl",
1261
+ Text: "text",
1262
+ ProcessingInstruction: "processinginstruction",
1263
+ Doctype: "doctype",
1264
+ Comment: "comment",
1265
+ OpenTagStart: "opentagstart",
1266
+ Attribute: "attribute",
1267
+ OpenTag: "opentag",
1268
+ CloseTag: "closetag",
1269
+ CDdata: "cdata",
1270
+ Error: "error",
1271
+ End: "end",
1272
+ Ready: "ready"
1273
+ };
1274
+ t.parseStream = async (t, e, o) => {
1275
+ if (o?.lean) return (async (t, e) => {
1276
+ const o = new Oo();
1277
+ let s;
1278
+ e.elementScanners && o.setElementScanners(e.elementScanners), e.onOpenTag && o.on("opentag", e.onOpenTag), e.onCloseTag && o.on("closetag", e.onCloseTag), e.onText && o.on("text", e.onText), e.onError && o.on("error", e.onError);
1279
+ const r = e.onEnd;
1280
+ for (r && o.on("end", () => {
1281
+ s = r();
1282
+ });;) {
1283
+ const { value: e, done: s } = await t.read();
1284
+ if (s) break;
1285
+ o.write(e);
1286
+ }
1287
+ return o.close(), s;
1288
+ })(t, e);
1289
+ const s = new So({
1290
+ position: !1,
1291
+ ...o
1292
+ });
1293
+ let r;
1294
+ e.onOpenTagStart && s.on(yo.Events.OpenTagStart, e.onOpenTagStart), e.onOpenTag && s.on(yo.Events.OpenTag, e.onOpenTag), e.onCloseTag && s.on(yo.Events.CloseTag, e.onCloseTag), e.onAttribute && s.on(yo.Events.Attribute, e.onAttribute), e.onText && s.on(yo.Events.Text, e.onText), e.onError && s.on(yo.Events.Error, e.onError);
1295
+ const n = e.onEnd;
1296
+ if (n) {
1297
+ const t = () => {
1298
+ r = n();
1299
+ };
1300
+ s.on(yo.Events.End, t);
1301
+ }
1302
+ for (;;) {
1303
+ const { value: e, done: o } = await t.read();
1304
+ if (o) break;
1305
+ s.write(e);
1306
+ }
1307
+ return s.close(), r;
1308
+ };
1309
+ })(yo || (yo = {}));
1310
+ var Do = (t) => !0 === t || "1" === t || "on" === t || "true" === t || !1 !== t && "0" !== t && "off" !== t && "false" !== t && null, No = (t) => {
1311
+ const e = parseInt(t);
1312
+ return isNaN(e) ? null : e;
1313
+ }, _o = (t) => {
1314
+ const e = parseFloat(t);
1315
+ return isNaN(e) ? null : e;
1316
+ }, $o = null, Mo = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), Ro = (t) => Mo(t).replace(/"/g, "&quot;"), Vo = class {
1317
+ constructor() {
1318
+ this._registeredVisitors = /* @__PURE__ */ new Map();
1319
+ }
1320
+ registerVisitor(t) {
1321
+ this._registeredVisitors.set(t.from, t);
1322
+ }
1323
+ createEventHandler(t, e, o) {
1324
+ const s = this._registeredVisitors, r = [], n = [];
1325
+ let i = null, a = null, l = null, c = null;
1326
+ const u = [], h = {
1327
+ key: null,
1328
+ source: t,
1329
+ parent: null
1330
+ };
1331
+ let d = null, p = !1, f = null, g = null, m = null;
1332
+ const b = (t, e) => {
1333
+ let o = l.attributes[t];
1334
+ if (e) if (Array.isArray(e)) {
1335
+ const t = e.length;
1336
+ for (let s = 0; s < t; s++) {
1337
+ if (null == o) return;
1338
+ if (o = e[s](o), null == o) return;
1339
+ }
1340
+ } else {
1341
+ if (null == o) return;
1342
+ if (o = e(o), null == o) return;
1343
+ }
1344
+ return o;
1345
+ }, x = {
1346
+ getSource: () => d?.source ?? null,
1347
+ setSource: (t) => {
1348
+ d.source = t;
1349
+ },
1350
+ setKey: (t) => {
1351
+ d.key = t;
1352
+ },
1353
+ getFrom: () => l,
1354
+ getAttribute: (t, e) => b(t, e) ?? null,
1355
+ hasAttribute: (t) => null !== x.getAttribute(t),
1356
+ getParent: () => {
1357
+ const t = u[u.length - 2];
1358
+ return t.parent ?? t.source;
1359
+ },
1360
+ getPath: () => {
1361
+ const t = [], e = n.length;
1362
+ for (let o = 0; o < e; o++) t.push(n[o].local);
1363
+ return t.join("\\");
1364
+ },
1365
+ parseAttribute: b,
1366
+ getRawXml: () => m,
1367
+ copyToObject: (t, e, o, s) => {
1368
+ const r = b(s ?? e, o);
1369
+ void 0 !== r && (t[e] = r);
1370
+ },
1371
+ copyTo: (t, e, o) => {
1372
+ const s = b(o ?? t, e);
1373
+ void 0 !== s && (d.source[t] = s);
1374
+ },
1375
+ warn: (t, e) => {
1376
+ o ? o(t, void 0, e?.onceKey) : console.warn(t);
1377
+ }
1378
+ };
1379
+ return {
1380
+ onOpenTag: (t) => {
1381
+ let e = t.name;
1382
+ const o = e.indexOf(":");
1383
+ if (-1 !== o && (e = e.slice(o + 1)), f) return f.push(((t) => {
1384
+ const e = t.attributes ?? {};
1385
+ let o = `<${t.name}`;
1386
+ for (const t in e) {
1387
+ const s = e[t];
1388
+ o += ` ${t}="${Ro("string" == typeof s ? s : s?.value ?? "")}"`;
1389
+ }
1390
+ return o + ">";
1391
+ })(t)), i = {
1392
+ local: e,
1393
+ tag: t,
1394
+ destination: null
1395
+ }, n.push(i), a = e, void (l = t);
1396
+ const m = (r.length > 0 ? r[r.length - 1] : s).get(e);
1397
+ if (i = {
1398
+ local: e,
1399
+ visitor: m,
1400
+ tag: t,
1401
+ destination: null
1402
+ }, p) return n.push(i), a = e, void (l = t);
1403
+ c = i?.visitor ?? null, a = e, l = t;
1404
+ let b = !!m && null === m.to;
1405
+ if (m && !b && m.scope) {
1406
+ const t = m.scope(x);
1407
+ null === t ? b = !0 : t && (r.push(t), i.pushedScope = !0);
1408
+ }
1409
+ m && (0 === n.length ? (d = h, i.destination = d, i.pushedDestination = !0, u.push(d)) : b ? (d = null, i.destination = null) : m.transparent ? i.destination = d : (d = {
1410
+ key: null,
1411
+ source: {},
1412
+ parent: null
1413
+ }, i.destination = d, i.pushedDestination = !0, u.push(d))), n.push(i), p = b;
1414
+ const y = c?.openTag?.(x);
1415
+ void 0 !== y && (d.parent = y), m?.raw && !b && (f = [], g = i);
1416
+ },
1417
+ onCloseTag: (t) => {
1418
+ let e = t.name;
1419
+ const s = e.indexOf(":");
1420
+ if (-1 !== s && (e = e.slice(s + 1)), e !== a) throw new Error(`mismatch open/close tag: '${e}'/'${a}'`);
1421
+ let b = !1;
1422
+ if (f) {
1423
+ if (n[n.length - 1] !== g) return f.push(`</${t.name}>`), n.pop(), i = n[n.length - 1] ?? null, a = i?.local ?? null, void (l = i?.tag ?? null);
1424
+ m = f.join(""), f = null, g = null, b = !0;
1425
+ }
1426
+ p || c?.closeTag?.(x), b && (m = null);
1427
+ const y = n.pop() ?? null;
1428
+ i = n[n.length - 1] ?? null, y?.pushedScope && r.pop();
1429
+ const v = y?.destination;
1430
+ if (v && y.pushedDestination) {
1431
+ u.pop(), d = u[u.length - 1] ?? h;
1432
+ const t = y.visitor;
1433
+ t && t.to && void 0 !== v.source && (Array.isArray(t.to) ? d.source.push ? d.source.push(v.source) : o?.(`Unable to parse array for ${t.from} at ${x.getPath()}`) : v.key ? d.source[v.key] = v.source : "string" == typeof t.to && (d.source[t.to] = v.source));
1434
+ } else v || (d = u[u.length - 1] ?? h);
1435
+ a = i?.local ?? null, l = i?.tag ?? null, c = i?.visitor ?? null, p = !i?.destination;
1436
+ },
1437
+ onText: (t) => {
1438
+ f ? f.push(Mo(t)) : c?.text?.(t, x);
1439
+ },
1440
+ onEnd: e
1441
+ };
1442
+ }
1443
+ }, Lo = `IFERROR(${S}(`, jo = Lo.toUpperCase(), Bo = m.toUpperCase(), Fo = { kind: "none" }, Ho = { kind: "spilled" }, Wo = (t, e) => {
1444
+ if (34 !== t.charCodeAt(e)) return null;
1445
+ let o = "", s = e + 1;
1446
+ for (; s < t.length;) if (34 === t.charCodeAt(s)) {
1447
+ if (34 !== t.charCodeAt(s + 1)) return {
1448
+ value: o,
1449
+ end: s + 1
1450
+ };
1451
+ o += "\"", s += 2;
1452
+ } else o += t[s], s++;
1453
+ return null;
1454
+ }, zo = (t) => {
1455
+ const e = [];
1456
+ let o = 0;
1457
+ for (; o < t.length;) {
1458
+ const s = t.charCodeAt(o);
1459
+ if (34 === s) {
1460
+ const e = Wo(t, o);
1461
+ if (null === e) break;
1462
+ o = e.end;
1463
+ continue;
1464
+ }
1465
+ if (!(s >= 65 && s <= 90 || s >= 97 && s <= 122 || 95 === s)) {
1466
+ o++;
1467
+ continue;
1468
+ }
1469
+ let r = o + 1;
1470
+ for (; r < t.length;) {
1471
+ const e = t.charCodeAt(r);
1472
+ if (!(e >= 65 && e <= 90 || e >= 97 && e <= 122 || e >= 48 && e <= 57 || 95 === e || 46 === e)) break;
1473
+ r++;
1474
+ }
1475
+ 40 === t.charCodeAt(r) && e.push(t.slice(o, r).toUpperCase().replace(/^_XLFN\./, "").replace(/^_XLWS\./, "")), o = r;
1476
+ }
1477
+ return e;
1478
+ }, Xo = class {
1479
+ constructor(t) {
1480
+ this._restored = [], this._byColumn = /* @__PURE__ */ new Map(), this._isKnown = t;
1481
+ }
1482
+ anchor(t, e, o) {
1483
+ const s = this._byColumn.get(e);
1484
+ s && t === s.rowEnd + 1 && t > s.rowStart && (s.closed = !0);
1485
+ const r = zo(o);
1486
+ let n = !0;
1487
+ for (let t = 0; t < r.length && n; t++) n = this._isKnown(r[t]);
1488
+ const i = {
1489
+ rowStart: t,
1490
+ colStart: e,
1491
+ rowEnd: t,
1492
+ colEnd: e,
1493
+ closed: !1,
1494
+ restored: n
1495
+ };
1496
+ return this._byColumn.set(e, i), n && this._restored.push(i), n;
1497
+ }
1498
+ placeholder(t, e) {
1499
+ const o = this._byColumn.get(e);
1500
+ if (o && !o.closed && t > o.rowStart && t <= o.rowEnd + 1 && e >= o.colStart && e <= o.colEnd) return o.rowEnd = t, o.restored;
1501
+ const s = this._byColumn.get(e - 1);
1502
+ return !(!s || s.rowStart !== t || s.colEnd !== e - 1) && (s.colEnd = e, this._byColumn.set(e, s), s.restored);
1503
+ }
1504
+ getFormulaArray() {
1505
+ return this._restored.map((t) => [Nt.rangeToString(t), "dynamic"]);
1506
+ }
1507
+ }, qo = /^\s*TABLE\s*\(([^()]*)\)\s*$/i, Uo = /^\s*(\$?)([A-Za-z]{1,3})(\$?)(\d{1,7})\s*$/, Go = (t) => {
1508
+ const e = Uo.exec(t);
1509
+ if (!e) return null;
1510
+ const o = Nt.fastStringToCol(e[2]), s = parseInt(e[4], 10) - 1;
1511
+ return o < 0 || s < 0 ? null : {
1512
+ row: s,
1513
+ col: o,
1514
+ colAbsolute: "$" === e[1],
1515
+ rowAbsolute: "$" === e[3]
1516
+ };
1517
+ }, Ko = (t) => Nt.cellToString({
1518
+ rowIndex: t.row,
1519
+ colIndex: t.col
1520
+ }), Jo = (t, e) => {
1521
+ const o = qo.exec(t);
1522
+ if (!o) return null;
1523
+ const s = o[1].split(",");
1524
+ if (3 !== s.length && 5 !== s.length) return null;
1525
+ const r = [];
1526
+ for (let t = 0; t < s.length; t++) {
1527
+ const e = Go(s[t]);
1528
+ if (!e) return null;
1529
+ r.push(e);
1530
+ }
1531
+ const n = e.rowStart, i = e.colStart, a = (t) => t.colAbsolute && !t.rowAbsolute && t.col === i - 1 && t.row === n, l = (t) => t.rowAbsolute && !t.colAbsolute && t.row === n - 1 && t.col === i, c = {
1532
+ rowStart: n,
1533
+ colStart: i,
1534
+ rowEnd: e.rowEnd,
1535
+ colEnd: e.colEnd
1536
+ }, u = r[0];
1537
+ if (3 === r.length) {
1538
+ const [, t, e] = r;
1539
+ return a(e) && l(u) ? {
1540
+ ref: c,
1541
+ columnInput: Ko(t)
1542
+ } : l(e) && a(u) ? {
1543
+ ref: c,
1544
+ rowInput: Ko(t)
1545
+ } : null;
1546
+ }
1547
+ if (!u.rowAbsolute || !u.colAbsolute || u.row !== n - 1 || u.col !== i - 1) return null;
1548
+ const [, h, d, p, f] = r;
1549
+ return a(d) && l(f) ? {
1550
+ ref: c,
1551
+ rowInput: Ko(p),
1552
+ columnInput: Ko(h)
1553
+ } : l(d) && a(f) ? {
1554
+ ref: c,
1555
+ rowInput: Ko(h),
1556
+ columnInput: Ko(p)
1557
+ } : null;
1558
+ }, Zo = /^(?:(\d{4})-(\d{2})-(\d{2}))?T?(?:(\d{2}):(\d{2})(?::(\d{2})(\.\d+)?)?)?(?:Z|[+-]\d{2}:?\d{2})?$/, Qo = /^PT(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?$/, Yo = (t, e, o) => {
1559
+ const s = Math.floor((14 - e) / 12), r = t + 4800 - s, n = e + 12 * s - 3;
1560
+ return o + Math.floor((153 * n + 2) / 5) + 365 * r + Math.floor(r / 4) - Math.floor(r / 100) + Math.floor(r / 400) - 32045;
1561
+ }, ts = Yo(1899, 12, 30), es = (t) => {
1562
+ const e = t.indexOf(":");
1563
+ return -1 === e ? t : t.slice(e + 1);
1564
+ }, os = class {
1565
+ constructor() {
1566
+ this._runs = null, this._text = "", this._font = null, this._inRun = !1, this._inRPr = !1;
1567
+ }
1568
+ reset() {
1569
+ this._runs = null, this._inRun = !1, this._inRPr = !1;
1570
+ }
1571
+ onOpenTag(t, o) {
1572
+ "r" === t ? (this._inRun = !0, this._text = "", this._font = null, this._runs ??= []) : "rPr" === t ? this._inRun && (this._inRPr = !0) : this._inRPr && function(t, o, s) {
1573
+ switch (t) {
1574
+ case "b":
1575
+ s.weight = ns(o) ? 700 : 400;
1576
+ break;
1577
+ case "i":
1578
+ s.style = ns(o) ? Wt.Style.Italic : Wt.Style.Normal;
1579
+ break;
1580
+ case "strike":
1581
+ s.strike = St(ns(o));
1582
+ break;
1583
+ case "outline":
1584
+ s.outline = ns(o);
1585
+ break;
1586
+ case "shadow":
1587
+ s.shadow = ns(o);
1588
+ break;
1589
+ case "condense":
1590
+ case "extend": {
1591
+ const e = n(t, ns(o));
1592
+ void 0 !== e && (s.letterSpacing = e);
1593
+ break;
1594
+ }
1595
+ case "u":
1596
+ s.underline = I(o.val);
1597
+ break;
1598
+ case "vertAlign": {
1599
+ const t = Ct(o.val);
1600
+ void 0 !== t && (s.baseline = t);
1601
+ break;
1602
+ }
1603
+ case "sz": {
1604
+ const t = parseFloat(o.val ?? "");
1605
+ isNaN(t) || (s.size = t);
1606
+ break;
1607
+ }
1608
+ case "rFont": {
1609
+ const t = o.val;
1610
+ t && (s.family = t);
1611
+ break;
1612
+ }
1613
+ case "family": {
1614
+ const t = rs[o.val ?? ""];
1615
+ t && (s.fallbacks = [t]);
1616
+ break;
1617
+ }
1618
+ case "charset": {
1619
+ const t = parseInt(o.val ?? "", 10);
1620
+ isNaN(t) || (s.charset = t);
1621
+ break;
1622
+ }
1623
+ case "scheme":
1624
+ k(s, o.val);
1625
+ break;
1626
+ case "color": {
1627
+ const t = o.rgb;
1628
+ if (t && void 0 === o.theme) {
1629
+ s.color = "#" + (8 === t.length ? t.substring(2) : t).toUpperCase();
1630
+ break;
1631
+ }
1632
+ const r = e((t) => o[t]);
1633
+ r && (s.color = r);
1634
+ break;
1635
+ }
1636
+ }
1637
+ }(t, o, this._font ??= {});
1638
+ }
1639
+ onText(t) {
1640
+ this._inRun && (this._text += t);
1641
+ }
1642
+ onCloseTag(t) {
1643
+ if ("rPr" === t) this._inRPr = !1, this._font ??= {};
1644
+ else if ("r" === t && this._inRun) {
1645
+ const t = l(this._text), e = this._font;
1646
+ this._runs.push(e ? {
1647
+ text: t,
1648
+ font: e
1649
+ } : { text: t }), this._inRun = !1;
1650
+ }
1651
+ }
1652
+ take() {
1653
+ const t = this._runs;
1654
+ if (this.reset(), !t) return null;
1655
+ for (let e = 0; e < t.length; e++) if (t[e].font) return t;
1656
+ return null;
1657
+ }
1658
+ };
1659
+ function ss(t, e) {
1660
+ const o = {
1661
+ family: "Calibri",
1662
+ size: 11,
1663
+ ...e,
1664
+ weight: 400,
1665
+ style: Wt.Style.Normal,
1666
+ underline: Wt.UnderlineStyle.None,
1667
+ strike: Wt.StrikeStyle.None,
1668
+ baseline: 0
1669
+ }, s = new Array(t.length);
1670
+ for (let e = 0; e < t.length; e++) {
1671
+ const r = t[e];
1672
+ if (!r.font) {
1673
+ s[e] = r;
1674
+ continue;
1675
+ }
1676
+ const n = {
1677
+ ...o,
1678
+ ...r.font
1679
+ };
1680
+ s[e] = {
1681
+ text: r.text,
1682
+ font: n
1683
+ };
1684
+ }
1685
+ return s;
1686
+ }
1687
+ var rs = {
1688
+ 1: "serif",
1689
+ 2: "sans-serif",
1690
+ 3: "monospace",
1691
+ 4: "cursive",
1692
+ 5: "fantasy"
1693
+ }, ns = (t) => {
1694
+ const e = t.val;
1695
+ return void 0 === e || "1" === e || "true" === e;
1696
+ };
1697
+ var is = (t) => {
1698
+ const e = (e) => {
1699
+ if (t) return new RegExp(`<(?:[\\w.-]+:)?${e}\\b[^>]*>([^<]*)<`).exec(t)?.[1];
1700
+ }, o = (t) => {
1701
+ const e = parseInt(t ?? "", 10);
1702
+ return isNaN(e) ? 0 : e;
1703
+ };
1704
+ return {
1705
+ c: o(e("col")),
1706
+ r: o(e("row")),
1707
+ x: D(e("colOff") ?? "0") ?? 0,
1708
+ y: D(e("rowOff") ?? "0") ?? 0
1709
+ };
1710
+ }, as = "formulaDialect", ls = "isKnownFunction", cs = "date1904", us = "richStrings", hs = "defaultFont", ds = (o, s, r, n, i, a, u, h) => {
1711
+ const d = new Vo(), p = (t) => {
1712
+ const e = t.getAttribute("dxfId", No);
1713
+ if (null === e) return;
1714
+ return n?.get(e) || (a?.(`A color filter or sort names a format that does not exist (dxfId '${e}').`), {});
1715
+ };
1716
+ let f = !1;
1717
+ const g = h?.get("parseInlineDxf"), m = h?.get(as), b = (t) => m && t ? m.readDetached(t) : t, x = new te.TransposedBuilder();
1718
+ let v = null, w = "topLeft";
1719
+ d.registerVisitor({
1720
+ from: "autoFilter",
1721
+ to: "autoTable",
1722
+ openTag: (t) => {
1723
+ const e = t.getAttribute("ref"), o = Nt.fastStringToRange(e);
1724
+ t.getSource().r = o, t.getSource().v = {};
1725
+ },
1726
+ closeTag: (t) => {
1727
+ const e = t.getSource(), o = e.v, s = o.hiddenButtons;
1728
+ if (Array.isArray(s)) {
1729
+ const t = s.length, r = e.r, n = r.colEnd - r.colStart + 1;
1730
+ 0 === t ? o.hiddenButtons = !1 : t === n && (o.hiddenButtons = !0);
1731
+ }
1732
+ }
1733
+ }), d.registerVisitor({
1734
+ from: "conditionalFormatting",
1735
+ to: {},
1736
+ openTag: (t) => {
1737
+ const e = t.getParent();
1738
+ e.conditionals || (e.conditionals = []);
1739
+ let o = t.getAttribute("sqref");
1740
+ o && (o = o.trim().split(/\s+/).join(","));
1741
+ const s = {
1742
+ r: o,
1743
+ conditionals: e.conditionals
1744
+ }, r = t.getAttribute("pivot", Do);
1745
+ null !== r && (s.pivot = r), t.setSource(s);
1746
+ }
1747
+ }), d.registerVisitor({
1748
+ from: "cfRule",
1749
+ to: {},
1750
+ openTag: (t) => {
1751
+ const e = t.getParent();
1752
+ if (!e?.r) return;
1753
+ const o = t.getSource() ?? {};
1754
+ void 0 !== e.pivot && (o.pivot = e.pivot), e.conditionals.push({
1755
+ r: e.r,
1756
+ v: null,
1757
+ rule: o
1758
+ }), t.copyToObject(o, "type", $o), t.copyToObject(o, "priority", No), t.copyToObject(o, "stopIfTrue", Do);
1759
+ const s = t.getAttribute("dxfId", No);
1760
+ if (null !== s) {
1761
+ let e = n?.get(s);
1762
+ e || (a?.(`Unable to load conditional color. Invalid dxfI: '${s}' at '${t.getPath()}'.`), e = {}), o.style = e;
1763
+ }
1764
+ t.copyToObject(o, "aboveAverage", Do), t.copyToObject(o, "equalAverage", Do), t.copyToObject(o, "stdDev", No), t.copyToObject(o, "bottom", Do), t.copyToObject(o, "percent", Do), t.copyToObject(o, "rank", No), t.copyToObject(o, "operator", $o), t.copyToObject(o, "text", $o), t.copyToObject(o, "timePeriod", $o);
1765
+ },
1766
+ closeTag: (t) => {
1767
+ const e = t.getParent();
1768
+ if (!e?.r) return;
1769
+ const o = e.conditionals[e.conditionals.length - 1], s = o?.rule;
1770
+ if (!s) return;
1771
+ const r = {}, n = B(s, a);
1772
+ n && (r.condition = n), s.style && (r.style = s.style), s.scale && (r.scale = s.scale), s.stopIfTrue && (r.stopIfTrue = !0), s.pivot && "number" == typeof s.priority && (r.pivotKey = s.priority), o.v = r, o.priority = s.priority, s.x14Id && (o.x14Id = s.x14Id), delete o.rule;
1773
+ }
1774
+ });
1775
+ const T = (t, e) => {
1776
+ const o = e.minLength ?? 10, s = e.maxLength ?? 90;
1777
+ 0 === o ? delete t.minLength : t.minLength = o, 100 === s ? delete t.maxLength : t.maxLength = s;
1778
+ }, S = (t, e) => {
1779
+ const o = (t, e) => !t || t.type === e && void 0 === t.value && !t.exclusive, [s, r] = e;
1780
+ o(s, Ft.ColorStopType.Min) ? delete t.minPoint : t.minPoint = s, o(r, Ft.ColorStopType.Max) ? delete t.maxPoint : t.maxPoint = r;
1781
+ }, k = (t) => {
1782
+ const e = t.conditions ?? [], o = [];
1783
+ for (let t = 0; t < e.length; t++) {
1784
+ const s = e[t], r = {};
1785
+ s.type && (r.type = s.type), void 0 !== s.value && (r.value = s.value), s.exclusive && (r.exclusive = !0), o.push(r);
1786
+ }
1787
+ return o;
1788
+ };
1789
+ d.registerVisitor({
1790
+ from: "colorScale",
1791
+ to: {},
1792
+ openTag: (t) => {},
1793
+ closeTag: (t) => {
1794
+ const e = t.getSource(), o = e.colors ?? [], s = k(e);
1795
+ for (let t = 0; t < s.length; t++) s[t].color = o[t];
1796
+ t.getParent().scale = {
1797
+ type: Ft.ScaleType.ColorScale,
1798
+ stops: s
1799
+ };
1800
+ }
1801
+ }), d.registerVisitor({
1802
+ from: "dataBar",
1803
+ to: {},
1804
+ openTag: (t) => {
1805
+ t.copyTo("maxLength", No), t.copyTo("minLength", No), t.copyTo("showValue", Do);
1806
+ },
1807
+ closeTag: (t) => {
1808
+ const e = t.getSource(), o = { type: Ft.ScaleType.DataBar };
1809
+ S(o, k(e));
1810
+ const s = e.colors?.[0];
1811
+ s && (o.color = s), T(o, e), void 0 !== e.showValue && (o.showValue = e.showValue), t.getParent().scale = o;
1812
+ }
1813
+ }), d.registerVisitor({
1814
+ from: "iconSet",
1815
+ to: {},
1816
+ openTag: (t) => {
1817
+ t.copyTo("iconSet", $o), t.copyTo("reverse", Do), t.copyTo("showValue", Do);
1818
+ },
1819
+ closeTag: (t) => {
1820
+ const e = t.getSource(), o = {
1821
+ type: Ft.ScaleType.IconSet,
1822
+ stops: k(e)
1823
+ };
1824
+ void 0 !== e.iconSet && (o.iconSet = e.iconSet), void 0 !== e.reverse && (o.reverse = e.reverse), void 0 !== e.showValue && (o.showValue = e.showValue), t.getParent().scale = o;
1825
+ }
1826
+ }), d.registerVisitor({
1827
+ from: "formula",
1828
+ to: {},
1829
+ text: (t, e) => {
1830
+ const o = e.getParent();
1831
+ let s = o.formulas;
1832
+ s || (s = [], o.formulas = s), s.push(b(t));
1833
+ }
1834
+ }), d.registerVisitor({
1835
+ from: "cfvo",
1836
+ to: {},
1837
+ openTag: (t) => {
1838
+ const e = t.getParent();
1839
+ e.conditions || (e.conditions = []);
1840
+ const o = t.getSource();
1841
+ if (e.conditions.push(o), t.copyTo("type", $o), o.type === Ft.ColorStopType.Formula) {
1842
+ const e = t.getAttribute("val");
1843
+ null != e && (o.value = b(String(e)));
1844
+ } else t.copyTo("value", _o, "val");
1845
+ !1 === t.getAttribute("gte", Do) && (o.exclusive = !0);
1846
+ }
1847
+ }), d.registerVisitor({
1848
+ from: "color",
1849
+ to: {},
1850
+ openTag: (t) => {
1851
+ const o = t.getParent();
1852
+ o.colors || (o.colors = []);
1853
+ const s = e((e) => t.getAttribute(e));
1854
+ o.colors.push(s);
1855
+ }
1856
+ }), d.registerVisitor({
1857
+ from: "filterColumn",
1858
+ to: {},
1859
+ openTag: (t) => {
1860
+ const e = t.getParent().v, o = parseInt(t.getAttribute("colId")), s = t.getSource();
1861
+ s.index = o;
1862
+ let r = e.filter;
1863
+ r || (r = { conditions: [] }, e.filter = r);
1864
+ let n = r.conditions;
1865
+ if (n || (n = [], r.conditions = n), n.push(s), t.getAttribute("hiddenButton", Do) && e) {
1866
+ let t = e.hiddenButtons;
1867
+ t || (t = [], e.hiddenButtons = t), t.push(o);
1868
+ }
1869
+ if (t.getAttribute("showButton", Do) && e) {
1870
+ let t = e.showButtons;
1871
+ t || (t = [], e.showButtons = t), t.push(o);
1872
+ }
1873
+ return s;
1874
+ }
1875
+ }), d.registerVisitor({
1876
+ from: "colorFilter",
1877
+ openTag: (t) => {
1878
+ const e = t.getParent(), o = {};
1879
+ e.operator = Bt.BuiltInOperatorNames.Color, e.param = o, t.copyToObject(o, "cellColor", Do);
1880
+ const s = p(t);
1881
+ s && (o.style = s);
1882
+ }
1883
+ }), d.registerVisitor({
1884
+ from: "iconFilter",
1885
+ openTag: (t) => {
1886
+ const e = t.getParent(), o = {};
1887
+ e.operator = Bt.BuiltInOperatorNames.Icon, e.param = o, t.copyToObject(o, "iconId", No), t.copyToObject(o, "iconSet", $o);
1888
+ }
1889
+ }), d.registerVisitor({
1890
+ from: "top10",
1891
+ openTag: (t) => {
1892
+ const e = t.getParent(), o = {};
1893
+ e.operator = Bt.BuiltInOperatorNames.TopN, e.param = o, t.copyToObject(o, "filterVal", _o), t.copyToObject(o, "percent", Do), t.copyToObject(o, "top", Do), t.copyToObject(o, "limit", _o, "val");
1894
+ }
1895
+ }), d.registerVisitor({
1896
+ from: "dynamicFilter",
1897
+ openTag: (t) => {
1898
+ const e = t.getParent(), o = F(t.getAttribute("type"), t.getAttribute("val"), t.getAttribute("maxVal"));
1899
+ e.operator = o.operator, e.param = o.param;
1900
+ }
1901
+ });
1902
+ const A = {
1903
+ from: "filters",
1904
+ to: {},
1905
+ openTag: (t) => {
1906
+ const e = t.getParent(), o = {};
1907
+ return e.selector = Bt.BuiltInSelectorNames.Display, e.operator = Bt.BuiltInOperatorNames.InSet, e.param = o, t.copyToObject(o, "blank", Do), t.copyToObject(o, "calendarType", $o), o;
1908
+ }
1909
+ };
1910
+ d.registerVisitor(A);
1911
+ const E = {
1912
+ from: "filter",
1913
+ openTag: (t) => {
1914
+ const e = t.getParent();
1915
+ let o = e.items;
1916
+ o || (o = [], e.items = o), o.push(t.getAttribute("val", $o));
1917
+ }
1918
+ };
1919
+ d.registerVisitor(E);
1920
+ const I = {
1921
+ from: "dateGroupItem",
1922
+ to: {},
1923
+ openTag: (t) => {
1924
+ const e = t.getParent();
1925
+ let o = e.dateGroups;
1926
+ o || (o = [], e.dateGroups = o), o.push(t.getSource()), t.copyTo("group", $o, "dateTimeGrouping"), t.copyTo("day", No), t.copyTo("hour", No), t.copyTo("minute", No), t.copyTo("month", No), t.copyTo("second", No), t.copyTo("year", No);
1927
+ }
1928
+ };
1929
+ d.registerVisitor(I);
1930
+ const O = /* @__PURE__ */ new Map();
1931
+ O.set("filterColumn", {
1932
+ from: "filterColumn",
1933
+ transparent: !0
1934
+ }), O.set("filters", A), O.set("filter", E), O.set("dateGroupItem", I), d.registerVisitor({
1935
+ from: "customFilters",
1936
+ openTag: (t) => {
1937
+ const e = t.getParent(), o = t.getAttribute("and"), s = "and" === o || "1" === o, r = [];
1938
+ return e.operator = s ? Bt.BuiltInOperatorNames.And : Bt.BuiltInOperatorNames.Or, e.param = r, t.setSource(e), r;
1939
+ },
1940
+ closeTag: (t) => {
1941
+ const e = t.getSource(), o = e?.param;
1942
+ if (!e || !o) return;
1943
+ const s = 1 === o.length ? o[0] : X(e);
1944
+ s !== e && (e.operator = s.operator, e.param = s.param);
1945
+ }
1946
+ }), d.registerVisitor({
1947
+ from: "customFilter",
1948
+ openTag: (t) => {
1949
+ const e = t.getParent();
1950
+ let o;
1951
+ Array.isArray(e) ? (o = {}, e.push(o)) : o = e;
1952
+ const s = kt({
1953
+ operator: t.getAttribute("operator"),
1954
+ val: t.getAttribute("val")
1955
+ }, (e) => t.warn(e));
1956
+ s && (o.operator = s.operator, o.param = s.param);
1957
+ }
1958
+ });
1959
+ let D = {}, N = null;
1960
+ d.registerVisitor({
1961
+ from: "sortState",
1962
+ to: {},
1963
+ openTag: (t) => {
1964
+ const e = t.getParent();
1965
+ let o = e.v;
1966
+ if (!o) return;
1967
+ const s = {};
1968
+ D = {};
1969
+ const r = t.getAttribute("caseSensitive", Do);
1970
+ null != r && (D.collatorOptions = r ? Qt.CaseSensitiveOptions : Qt.CaseInsensitiveOptions);
1971
+ const n = t.getAttribute("sortMethod");
1972
+ "stroke" !== n && "pinYin" !== n || (D.collatorOptions = {
1973
+ ...D.collatorOptions,
1974
+ collation: "stroke" === n ? "stroke" : "pinyin"
1975
+ }), t.getAttribute("columnSort", Do) && (s.axis = zt.Axis.Column);
1976
+ const i = t.getAttribute("ref"), a = e.r;
1977
+ N = i && a ? Nt.fastStringToRange(i) : null, N && (s.extent = { range: y(a, N) }), o.sort = s, t.setSource(e);
1978
+ }
1979
+ }), d.registerVisitor({
1980
+ from: "sortCondition",
1981
+ to: {},
1982
+ openTag: (t) => {
1983
+ const e = t.getParent(), o = e.v;
1984
+ if (!o) return;
1985
+ const s = o.sort;
1986
+ if (!s) return;
1987
+ let r = s.sorts;
1988
+ r || (r = [], s.sorts = r);
1989
+ const n = t.getAttribute("ref");
1990
+ let i = 0, a = null;
1991
+ if (n) {
1992
+ const t = Nt.fastStringToRange(n, ms), o = t.colStart, s = e.r, r = s.colStart;
1993
+ i = s ? o - r : o, s && N && (a = et(s, N, t));
1994
+ }
1995
+ s.extent && (s.extent.sorts ??= []).push(a);
1996
+ const l = { ...D }, c = st(t.getAttribute("sortBy"));
1997
+ c && (l.sortOn = c);
1998
+ const u = p(t);
1999
+ u && (l.style = u), t.copyToObject(l, "iconSet", $o), t.copyToObject(l, "customList", $o), l.reverse = t.getAttribute("descending", Do) ?? !1;
2000
+ const h = {
2001
+ index: i,
2002
+ criteria: l
2003
+ };
2004
+ r.push(h);
2005
+ }
2006
+ });
2007
+ const _ = (t) => {
2008
+ v = t.getSource(), w = "topLeft", t.copyTo("topLeft", $o, "topLeftCell");
2009
+ const e = P(t.getAttribute("defaultGridColor")), o = t.getAttribute("colorId");
2010
+ null === o || e || (t.getSource().gridLineColor = "index" + parseFloat(o)), t.copyTo("showZeros", Do), t.copyTo("showFormulas", Do), t.copyTo("zoomScale", No), t.copyTo("viewMode", $o, "view");
2011
+ const s = {};
2012
+ for (const [e, o] of J) {
2013
+ const r = t.getAttribute(o, No);
2014
+ r && (s[e] = Math.min(400, Math.max(10, r)));
2015
+ }
2016
+ Object.keys(s).length > 0 && (t.getSource().zoomScales = s), t.copyTo("showRuler", Do), t.copyTo("showWhitespace", Do, "showWhiteSpace"), t.copyTo("windowProtection", Do), t.copyTo("showRowHeaders", Do, "showRowColHeaders"), t.copyTo("showColumnHeaders", Do, "showRowColHeaders"), t.copyTo("showRowGridlines", Do, "showGridLines"), t.copyTo("showColumnGridlines", Do, "showGridLines"), t.copyTo("rightToLeft", Do), t.copyTo("showOutlineSymbols", Do);
2017
+ };
2018
+ d.registerVisitor({
2019
+ from: "sheetView",
2020
+ to: "view",
2021
+ openTag: (t) => {
2022
+ _(t);
2023
+ },
2024
+ closeTag: () => {
2025
+ v = null;
2026
+ }
2027
+ }), d.registerVisitor({
2028
+ from: "customSheetViews",
2029
+ to: "customSheetViews",
2030
+ openTag: (t) => {
2031
+ t.setSource([]);
2032
+ }
2033
+ }), d.registerVisitor({
2034
+ from: "customSheetView",
2035
+ to: [],
2036
+ openTag: (t) => {
2037
+ M = !0, _(t);
2038
+ },
2039
+ closeTag: () => {
2040
+ M = !1, v = null;
2041
+ }
2042
+ }), d.registerVisitor({
2043
+ from: "selection",
2044
+ to: null,
2045
+ openTag: (t) => {
2046
+ if (!v) return;
2047
+ const e = t.getAttribute("activeCell")?.replace(/\$/g, ""), o = t.getAttribute("sqref")?.replace(/\$/g, ""), s = t.getAttribute("pane") ?? "topLeft";
2048
+ if (s !== w) {
2049
+ const t = v.freezePanes;
2050
+ if (t && e) {
2051
+ const r = { activeCell: e };
2052
+ o && o !== e && (r.sqref = o), (t.paneSelections ??= {})[s] = r;
2053
+ }
2054
+ return;
2055
+ }
2056
+ const r = {};
2057
+ e && (r.cell = e);
2058
+ const n = t.getAttribute("activeCellId", No);
2059
+ null !== n && (r.rangeIndex = n), o && o !== e && (r.ranges = o.trim().split(/\s+/)), v.selection = r;
2060
+ }
2061
+ }), d.registerVisitor({
2062
+ from: "pane",
2063
+ to: null,
2064
+ openTag: (t) => {
2065
+ if (!v) return;
2066
+ w = t.getAttribute("activePane") ?? "topLeft";
2067
+ const e = t.getAttribute("state");
2068
+ if ("frozen" === e || "frozenSplit" === e) {
2069
+ const e = {};
2070
+ v.freezePanes = e, t.copyToObject(e, "topLeft", $o, "topLeftCell");
2071
+ const o = (v.topLeft ? Nt.fastStringToCell(v.topLeft) : void 0) ?? {
2072
+ colIndex: 0,
2073
+ rowIndex: 0
2074
+ }, s = {
2075
+ colIndex: 0,
2076
+ rowIndex: 0
2077
+ };
2078
+ t.copyToObject(s, "colIndex", No, "xSplit"), t.copyToObject(s, "rowIndex", No, "ySplit");
2079
+ const r = {
2080
+ colIndex: o.colIndex + s.colIndex,
2081
+ rowIndex: o.rowIndex + s.rowIndex
2082
+ };
2083
+ e.coords = Nt.cellToString(r);
2084
+ }
2085
+ }
2086
+ }), d.registerVisitor({
2087
+ from: "sheetPr",
2088
+ transparent: !0,
2089
+ openTag: (t) => {
2090
+ const e = t.getAttribute("codeName");
2091
+ e && (o.codeName = e), !1 === t.getAttribute("enableFormatConditionsCalculation", Do) && (o.conditionalFormatCalculation = !1), !0 === t.getAttribute("transitionEvaluation", Do) && (o.transitionFormulaEvaluation = !0), !0 === t.getAttribute("transitionEntry", Do) && (o.transitionFormulaEntry = !0), !1 === t.getAttribute("published", Do) && (o.excludeFromPublishing = !0);
2092
+ const s = {};
2093
+ !0 === t.getAttribute("syncHorizontal", Do) && (s.horizontal = !0), !0 === t.getAttribute("syncVertical", Do) && (s.vertical = !0);
2094
+ const r = t.getAttribute("syncRef");
2095
+ r && (s.anchor = r), Object.keys(s).length > 0 && (o.syncScroll = s);
2096
+ }
2097
+ }), d.registerVisitor({
2098
+ from: "tabColor",
2099
+ to: null,
2100
+ openTag: (t) => {
2101
+ const s = e((e) => t.getAttribute(e));
2102
+ s && (o.tabColor = s);
2103
+ }
2104
+ });
2105
+ let M = !1;
2106
+ const W = () => o.pageLayout ??= {};
2107
+ d.registerVisitor({
2108
+ from: "pageSetUpPr",
2109
+ to: null,
2110
+ openTag: (t) => {
2111
+ !0 === t.getAttribute("fitToPage", Do) && (W().fitToPage = !0), !1 === t.getAttribute("autoPageBreaks", Do) && (W().hideAutoPageBreaks = !0);
2112
+ }
2113
+ }), d.registerVisitor({
2114
+ from: "outlinePr",
2115
+ to: null,
2116
+ openTag: (t) => {
2117
+ const e = (e) => {
2118
+ const o = t.getAttribute(e);
2119
+ return "0" === o || "false" === o;
2120
+ }, s = {};
2121
+ e("summaryBelow") && (s.summaryRow = "up"), e("summaryRight") && (s.summaryColumn = "left"), ((e) => {
2122
+ const o = t.getAttribute(e);
2123
+ return "1" === o || "true" === o;
2124
+ })("applyStyles") && (s.automaticStyles = !0), Object.keys(s).length > 0 && (o.outline = s);
2125
+ }
2126
+ }), d.registerVisitor({
2127
+ from: "pageMargins",
2128
+ to: null,
2129
+ openTag: (t) => {
2130
+ if (M) return;
2131
+ const e = (e, o) => t.getAttribute(e, _o) ?? o, o = {
2132
+ left: e("left", .7),
2133
+ right: e("right", .7),
2134
+ top: e("top", .75),
2135
+ bottom: e("bottom", .75),
2136
+ header: e("header", .3),
2137
+ footer: e("footer", .3)
2138
+ };
2139
+ .7 === o.left && .7 === o.right && .75 === o.top && .75 === o.bottom && .3 === o.header && .3 === o.footer || (W().margins = o);
2140
+ }
2141
+ }), d.registerVisitor({
2142
+ from: "pageSetup",
2143
+ to: null,
2144
+ openTag: (t) => {
2145
+ if (M) return;
2146
+ const e = W(), o = (e) => t.getAttribute(e, No) ?? void 0, r = (e) => t.getAttribute(e, Do), n = t.getAttribute("orientation");
2147
+ "landscape" !== n && "portrait" !== n || (e.orientation = n);
2148
+ for (const t of [
2149
+ "paperSize",
2150
+ "scale",
2151
+ "fitToWidth",
2152
+ "fitToHeight",
2153
+ "firstPageNumber",
2154
+ "horizontalDpi",
2155
+ "verticalDpi",
2156
+ "copies"
2157
+ ]) {
2158
+ const s = o(t);
2159
+ void 0 !== s && (e[t] = s);
2160
+ }
2161
+ const i = t.getAttribute("paperHeight");
2162
+ i && (e.paperHeight = i);
2163
+ const a = t.getAttribute("paperWidth");
2164
+ a && (e.paperWidth = a), "overThenDown" === t.getAttribute("pageOrder") && (e.printOrder = "overThenDown"), !0 === r("blackAndWhite") && (e.blackAndWhite = !0), !0 === r("draft") && (e.draftMode = !0), !0 === r("useFirstPageNumber") && (e.useFirstPageNumber = !0), !1 === r("usePrinterDefaults") && (e.ignorePrinterDefaults = !0);
2165
+ const l = t.getAttribute("cellComments"), c = U.find(([t]) => t === l)?.[1];
2166
+ c && (e.printComments = c);
2167
+ const u = t.getAttribute("errors"), h = rt.find(([t]) => t === u)?.[1];
2168
+ h && (e.printErrors = h);
2169
+ const d = t.getAttribute("r:id"), p = d ? s(d, "part") : null;
2170
+ p && (e.printerSettings = p);
2171
+ }
2172
+ }), d.registerVisitor({
2173
+ from: "printOptions",
2174
+ to: null,
2175
+ openTag: (t) => {
2176
+ if (M) return;
2177
+ const e = (e) => !0 === t.getAttribute(e, Do);
2178
+ e("horizontalCentered") && (W().centerHorizontally = !0), e("verticalCentered") && (W().centerVertically = !0), e("gridLines") && (W().printGridlines = !0), e("headings") && (W().printHeadings = !0);
2179
+ }
2180
+ }), d.registerVisitor({
2181
+ from: "headerFooter",
2182
+ to: {},
2183
+ openTag: (t) => {
2184
+ if (M) return;
2185
+ const e = {}, o = (e) => t.getAttribute(e, Do);
2186
+ !0 === o("differentOddEven") && (e.differentOddEven = !0), !0 === o("differentFirst") && (e.differentFirst = !0), !1 === o("scaleWithDoc") && (e.ignoreSheetScale = !0), !1 === o("alignWithMargins") && (e.ignoreSheetMargins = !0), Object.keys(e).length > 0 && (W().headerFooter = e);
2187
+ }
2188
+ });
2189
+ for (const t of dt) d.registerVisitor({
2190
+ from: t,
2191
+ to: {},
2192
+ text: (e, o) => {
2193
+ if (M) return;
2194
+ const s = W(), r = s.headerFooter ??= {};
2195
+ r[t] = (r[t] ?? "") + l(e);
2196
+ }
2197
+ });
2198
+ let z = "rowBreaks";
2199
+ for (const [t, e] of [["rowBreaks", "rowBreaks"], ["colBreaks", "columnBreaks"]]) d.registerVisitor({
2200
+ from: t,
2201
+ to: {},
2202
+ openTag: () => {
2203
+ z = e;
2204
+ }
2205
+ });
2206
+ d.registerVisitor({
2207
+ from: "brk",
2208
+ to: null,
2209
+ openTag: (t) => {
2210
+ if (M) return;
2211
+ const e = t.getAttribute("id", No);
2212
+ if (null == e) return;
2213
+ const o = { index: e }, s = t.getAttribute("min", No);
2214
+ null != s && (o.min = s);
2215
+ const r = t.getAttribute("max", No);
2216
+ null != r && (o.max = r), !0 !== t.getAttribute("man", Do) && (o.automatic = !0), !0 === t.getAttribute("pt", Do) && (o.pivot = !0);
2217
+ const n = W();
2218
+ (n[z] ??= []).push(o);
2219
+ }
2220
+ }), d.registerVisitor({
2221
+ from: "ignoredErrors",
2222
+ transparent: !0
2223
+ }), d.registerVisitor({
2224
+ from: "ignoredError",
2225
+ to: null,
2226
+ openTag: (t) => {
2227
+ const e = t.getAttribute("sqref");
2228
+ if (!e) return;
2229
+ const s = [];
2230
+ for (const e of c) !0 === t.getAttribute(e, Do) && s.push(e);
2231
+ if (0 !== s.length) for (const t of e.trim().split(/\s+/)) (o.ignoredErrors ??= []).push({
2232
+ r: t,
2233
+ v: s
2234
+ });
2235
+ }
2236
+ }), d.registerVisitor({
2237
+ from: "mergeCells",
2238
+ to: "merges",
2239
+ openTag: (t) => {
2240
+ t.setSource([]);
2241
+ }
2242
+ }), d.registerVisitor({
2243
+ from: "dataValidations",
2244
+ to: "validations",
2245
+ openTag: (t) => {
2246
+ t.setSource([]);
2247
+ const e = {};
2248
+ !0 === t.getAttribute("disablePrompts", Do) && (e.disablePrompts = !0);
2249
+ const s = t.getAttribute("xWindow", No);
2250
+ null !== s && (e.windowX = s);
2251
+ const r = t.getAttribute("yWindow", No);
2252
+ null !== r && (e.windowY = r), Object.keys(e).length > 0 && (o.validationSettings = {
2253
+ ...o.validationSettings,
2254
+ ...e
2255
+ });
2256
+ }
2257
+ });
2258
+ const G = {
2259
+ from: "dataValidation",
2260
+ to: [],
2261
+ openTag: (t) => {
2262
+ let e = t.getAttribute("sqref");
2263
+ e && (e = e.trim().split(/\s+/).join(","));
2264
+ const o = {}, s = {
2265
+ r: e,
2266
+ v: o,
2267
+ rule: {
2268
+ type: t.getAttribute("type") ?? void 0,
2269
+ operator: t.getAttribute("operator") ?? void 0
2270
+ }
2271
+ };
2272
+ !0 === t.getAttribute("showDropDown", Do) && (o.hideDropdown = !0), t.copyToObject(o, "alert", $o, "error"), t.copyToObject(o, "alertTitle", $o, "errorTitle"), t.copyToObject(o, "showAlertMessage", Do, "showErrorMessage"), o.alertStyle = t.getAttribute("errorStyle") ?? "stop", t.copyToObject(o, "imeMode"), t.copyToObject(o, "prompt"), t.copyToObject(o, "promptTitle"), t.copyToObject(o, "showPromptMessage", Do, "showInputMessage"), t.setSource(s);
2273
+ },
2274
+ closeTag: (t) => {
2275
+ const e = t.getSource();
2276
+ if (!e?.rule) return;
2277
+ const o = ut(e.rule, a);
2278
+ o && (t.getAttribute("allowBlank", Do) && (o.includeBlanks = !0), e.v.condition = o), delete e.rule;
2279
+ }
2280
+ };
2281
+ d.registerVisitor(G), d.registerVisitor({
2282
+ from: "formula1",
2283
+ to: {},
2284
+ text: (t, e) => {
2285
+ const o = e.getParent().rule;
2286
+ o?.type && (o.formula1 = Y(b(t), o.type));
2287
+ }
2288
+ }), d.registerVisitor({
2289
+ from: "formula2",
2290
+ to: {},
2291
+ text: (t, e) => {
2292
+ const o = e.getParent().rule;
2293
+ o?.type && (o.formula2 = Y(b(t), o.type));
2294
+ }
2295
+ }), d.registerVisitor({
2296
+ from: "picture",
2297
+ to: "picture",
2298
+ openTag: (t) => {
2299
+ const e = t.getAttribute("r:id");
2300
+ if (!e) return void t.warn("A picture names no image; it was not imported.", { onceKey: "xlsx.sheet.picture.noRel" });
2301
+ const o = s(e, "resource");
2302
+ t.getSource().resId = o;
2303
+ }
2304
+ });
2305
+ const Z = {
2306
+ from: "slicer",
2307
+ to: {},
2308
+ openTag: (t) => {
2309
+ const e = t.getAttribute("r:id");
2310
+ if (!e) return void t.warn("A slicer names no cache; it was not imported.", { onceKey: "xlsx.sheet.slicer.noRel" });
2311
+ const o = s(e)?.slicers, r = t.getParent();
2312
+ r.slicers || (r.slicers = {});
2313
+ const n = Object.keys(o);
2314
+ for (const t of n) r.slicers[t] = o[t];
2315
+ }
2316
+ };
2317
+ d.registerVisitor(Z);
2318
+ const tt = {
2319
+ from: "timelineRef",
2320
+ to: {},
2321
+ openTag: (t) => {
2322
+ const e = t.getAttribute("r:id"), o = e ? s(e)?.slicers : void 0;
2323
+ if (!o) return void t.warn("A timeline names no part; it was not imported.", { onceKey: "xlsx.sheet.timeline.noRel" });
2324
+ const r = t.getParent();
2325
+ r.slicers ??= {};
2326
+ for (const t of Object.keys(o)) r.slicers[t] = o[t];
2327
+ }
2328
+ }, ot = (t, e) => ({
2329
+ from: t,
2330
+ to: {},
2331
+ openTag: (t) => {
2332
+ t.setSource("");
2333
+ },
2334
+ text: (t, e) => {
2335
+ e.setSource((e.getSource() ?? "") + t);
2336
+ },
2337
+ closeTag: (t) => {
2338
+ e(String(t.getSource() ?? ""), t);
2339
+ }
2340
+ }), nt = /* @__PURE__ */ new Map();
2341
+ nt.set("dataValidations", {
2342
+ from: "dataValidations",
2343
+ to: "validations",
2344
+ openTag: (t) => {
2345
+ const e = t.getParent();
2346
+ t.setSource(e.validations ?? []);
2347
+ },
2348
+ closeTag: (t) => {
2349
+ 0 === (t.getSource()?.length ?? 0) && t.setSource(void 0);
2350
+ }
2351
+ }), nt.set("dataValidation", {
2352
+ ...G,
2353
+ closeTag: (t) => {
2354
+ G.closeTag(t);
2355
+ const e = t.getSource();
2356
+ e && !e.r && (t.warn("x14 dataValidation with no xm:sqref was dropped."), t.setSource(void 0));
2357
+ }
2358
+ });
2359
+ const it = (t) => ({
2360
+ from: t,
2361
+ to: {},
2362
+ openTag: (e) => {
2363
+ e.setSource({
2364
+ rule: e.getParent()?.rule,
2365
+ key: t
2366
+ });
2367
+ }
2368
+ });
2369
+ nt.set("formula1", it("formula1")), nt.set("formula2", it("formula2")), nt.set("f", ot("f", (t, e) => {
2370
+ const o = e.getParent(), s = o?.rule;
2371
+ s && (s[o.key] = Y(b(t), s.type));
2372
+ })), nt.set("sqref", ot("sqref", (t, e) => {
2373
+ const o = e.getParent(), s = t.trim();
2374
+ o && s && (o.r = s.split(/\s+/).join(","));
2375
+ }));
2376
+ const lt = /* @__PURE__ */ new Map(), ht = [], pt = /* @__PURE__ */ new Map();
2377
+ pt.set("conditionalFormattings", {
2378
+ from: "conditionalFormattings",
2379
+ transparent: !0
2380
+ }), pt.set("conditionalFormatting", {
2381
+ from: "conditionalFormatting",
2382
+ to: {},
2383
+ openTag: (t) => {
2384
+ t.setSource({ rules: [] });
2385
+ },
2386
+ closeTag: (t) => {
2387
+ const e = t.getSource(), o = e?.rules ?? [];
2388
+ for (let t = 0; t < o.length; t++) {
2389
+ const s = o[t];
2390
+ s.sqref = e.sqref, s.id ? lt.set(s.id, s) : ht.push(s);
2391
+ }
2392
+ }
2393
+ }), pt.set("cfRule", {
2394
+ from: "cfRule",
2395
+ to: {},
2396
+ openTag: (t) => {
2397
+ t.copyTo("id", $o), t.copyTo("type", $o), t.copyTo("priority", No), t.copyTo("stopIfTrue", Do), t.copyTo("operator", $o), t.copyTo("text", $o), t.copyTo("timePeriod", $o), t.copyTo("aboveAverage", Do), t.copyTo("equalAverage", Do), t.copyTo("stdDev", No), t.copyTo("bottom", Do), t.copyTo("percent", Do), t.copyTo("rank", No);
2398
+ },
2399
+ closeTag: (t) => {
2400
+ const e = t.getSource();
2401
+ e && t.getParent()?.rules?.push(e);
2402
+ }
2403
+ }), pt.set("sqref", ot("sqref", (t, e) => {
2404
+ const o = e.getParent(), s = t.trim();
2405
+ o && s && (o.sqref = s);
2406
+ })), pt.set("dataBar", {
2407
+ from: "dataBar",
2408
+ to: {},
2409
+ openTag: (t) => {
2410
+ t.copyTo("minLength", No), t.copyTo("maxLength", No), t.copyTo("gradient", Do), t.copyTo("border", Do), t.copyTo("direction", $o), t.copyTo("axisPosition", $o), t.copyTo("negativeBarColorSameAsPositive", Do), t.copyTo("negativeBarBorderColorSameAsPositive", Do);
2411
+ },
2412
+ closeTag: (t) => {
2413
+ t.getParent().dataBar = t.getSource();
2414
+ }
2415
+ }), pt.set("iconSet", {
2416
+ from: "iconSet",
2417
+ to: {},
2418
+ openTag: (t) => {
2419
+ t.copyTo("iconSet", $o), t.copyTo("custom", Do), t.copyTo("reverse", Do), t.copyTo("showValue", Do);
2420
+ },
2421
+ closeTag: (t) => {
2422
+ t.getParent().iconSet = t.getSource();
2423
+ }
2424
+ });
2425
+ const mt = /* @__PURE__ */ new Map();
2426
+ mt.set("f", ot("f", (t, e) => {
2427
+ const o = e.getParent();
2428
+ if (!o) return;
2429
+ const s = t.trim(), r = Number(s);
2430
+ o.value = s.length > 0 && Number.isFinite(r) ? r : b(t);
2431
+ })), pt.set("cfvo", {
2432
+ from: "cfvo",
2433
+ to: {},
2434
+ scope: () => mt,
2435
+ openTag: (t) => {
2436
+ const e = t.getParent();
2437
+ e.conditions || (e.conditions = []);
2438
+ const o = t.getSource();
2439
+ e.conditions.push(o), t.copyTo("type", $o), !1 === t.getAttribute("gte", Do) && (o.exclusive = !0);
2440
+ }
2441
+ }), pt.set("f", ot("f", (t, e) => {
2442
+ const o = e.getParent();
2443
+ o && (o.formulas ??= []).push(b(t));
2444
+ })), pt.set("dxf", {
2445
+ from: "dxf",
2446
+ to: {},
2447
+ raw: !0,
2448
+ closeTag: (t) => {
2449
+ if (!g) return;
2450
+ const e = t.getParent();
2451
+ if (!e) return;
2452
+ const o = g(t.getRawXml() ?? "");
2453
+ o && (e.style = o);
2454
+ }
2455
+ });
2456
+ const bt = (t) => ({
2457
+ from: t,
2458
+ to: {},
2459
+ openTag: (o) => {
2460
+ const s = e((t) => o.getAttribute(t));
2461
+ s && (o.getParent()[t] = s);
2462
+ }
2463
+ });
2464
+ pt.set("borderColor", bt("borderColor")), pt.set("negativeFillColor", bt("negativeFillColor")), pt.set("negativeBorderColor", bt("negativeBorderColor")), pt.set("axisColor", bt("axisColor")), pt.set("cfIcon", {
2465
+ from: "cfIcon",
2466
+ to: {},
2467
+ openTag: (t) => {
2468
+ const e = t.getAttribute("iconSet"), o = t.getAttribute("iconId", No);
2469
+ if (null === e || null === o) return;
2470
+ const s = t.getParent();
2471
+ s.icons || (s.icons = []), s.icons.push({
2472
+ set: e,
2473
+ id: o
2474
+ });
2475
+ }
2476
+ });
2477
+ const xt = /* @__PURE__ */ new Map();
2478
+ xt.set("id", ot("id", (t, e) => {
2479
+ const o = e.getParent(), s = t.trim();
2480
+ o && s && (o.x14Id = s);
2481
+ }));
2482
+ const vt = /* @__PURE__ */ new Map();
2483
+ vt.set("slicerList", {
2484
+ from: "slicerList",
2485
+ transparent: !0
2486
+ }), vt.set("slicer", Z);
2487
+ const wt = /* @__PURE__ */ new Map();
2488
+ wt.set("timelineRefs", {
2489
+ from: "timelineRefs",
2490
+ transparent: !0
2491
+ }), wt.set("timelineRef", tt);
2492
+ const St = /* @__PURE__ */ new Map();
2493
+ St.set("sparklineGroups", {
2494
+ from: "sparklineGroups",
2495
+ to: "sparklineGroups",
2496
+ openTag: (t) => {
2497
+ const e = t.getParent();
2498
+ t.setSource(e.sparklineGroups ?? []);
2499
+ },
2500
+ closeTag: (t) => {
2501
+ 0 === (t.getSource()?.length ?? 0) && t.setSource(void 0);
2502
+ }
2503
+ }), St.set("sparklineGroup", {
2504
+ from: "sparklineGroup",
2505
+ to: [],
2506
+ openTag: (e) => {
2507
+ const o = e.getFrom().attributes ?? {}, s = {};
2508
+ for (const t in o) {
2509
+ const e = o[t];
2510
+ s[t] = "string" == typeof e ? e : e?.value ?? "";
2511
+ }
2512
+ e.setSource({
2513
+ properties: t(s),
2514
+ entries: []
2515
+ });
2516
+ },
2517
+ closeTag: (t) => {
2518
+ const e = t.getSource(), o = at(e.properties, e.entries);
2519
+ o || t.warn("A sparkline group with no sparklines was dropped.", { onceKey: "xlsx.sheet.sparklineGroup.empty" }), t.setSource(o ?? void 0);
2520
+ }
2521
+ });
2522
+ for (const t of $) St.set(t, {
2523
+ from: t,
2524
+ to: {},
2525
+ openTag: (o) => {
2526
+ const s = e((t) => o.getAttribute(t));
2527
+ s && (o.getParent().properties[t] = s);
2528
+ }
2529
+ });
2530
+ St.set("sparklines", {
2531
+ from: "sparklines",
2532
+ transparent: !0
2533
+ }), St.set("sparkline", {
2534
+ from: "sparkline",
2535
+ to: {},
2536
+ openTag: (t) => {
2537
+ t.setSource({ isSparkline: !0 });
2538
+ },
2539
+ closeTag: (t) => {
2540
+ const e = t.getSource(), o = t.getParent(), s = e?.sqref?.trim(), r = s ? Nt.fastStringToRange(s.split(/\s+/)[0]) : null;
2541
+ r ? o.entries.push({
2542
+ location: {
2543
+ rowIndex: r.rowStart,
2544
+ colIndex: r.colStart
2545
+ },
2546
+ data: e.data ?? ""
2547
+ }) : t.warn("A sparkline with no location was dropped.", { onceKey: "xlsx.sheet.sparkline.incomplete" });
2548
+ }
2549
+ }), St.set("f", ot("f", (t, e) => {
2550
+ const o = e.getParent(), s = t.trim();
2551
+ o && s && (o.isSparkline ? o.data = s : o.properties.dateRange = s);
2552
+ })), St.set("sqref", ot("sqref", (t, e) => {
2553
+ const o = e.getParent();
2554
+ o?.isSparkline && (o.sqref = t);
2555
+ }));
2556
+ const Ct = /* @__PURE__ */ new Map([
2557
+ [C(q), St],
2558
+ [C(ct), nt],
2559
+ [C(Q), pt],
2560
+ [C(L), pt],
2561
+ [C(ft), xt],
2562
+ [C(yt), vt],
2563
+ [C(H), vt],
2564
+ [C(K), wt],
2565
+ [C(gt), O]
2566
+ ]), Et = /* @__PURE__ */ new Set();
2567
+ d.registerVisitor({
2568
+ from: "extLst",
2569
+ transparent: !0
2570
+ }), d.registerVisitor({
2571
+ from: "ext",
2572
+ transparent: !0,
2573
+ scope: (t) => {
2574
+ const e = t.getAttribute("uri"), o = C(e), s = Ct.get(o);
2575
+ if (s) return s;
2576
+ if (!At.has(o) && !Et.has(o)) {
2577
+ Et.add(o);
2578
+ const s = j[o];
2579
+ t.warn(s ? `Extension content '${s}' (${e}) is not read; it will be lost on resave.` : `Unknown extension content (uri ${e}) is not read; it will be lost on resave.`);
2580
+ }
2581
+ return null;
2582
+ }
2583
+ }), d.registerVisitor({
2584
+ from: "mergeCell",
2585
+ to: [],
2586
+ openTag: (t) => {
2587
+ const e = t.getAttribute("ref");
2588
+ t.setSource(e);
2589
+ }
2590
+ }), d.registerVisitor({
2591
+ from: "hyperlinks",
2592
+ to: "hyperlinks",
2593
+ openTag: (t) => {
2594
+ t.setSource([]);
2595
+ }
2596
+ }), d.registerVisitor({
2597
+ from: "hyperlink",
2598
+ to: [],
2599
+ openTag: (t) => {
2600
+ const e = t.getAttribute("r:id"), o = t.getAttribute("ref");
2601
+ if (!o) return void t.warn("A hyperlink has no ref; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.noRef" });
2602
+ t.setKey(o);
2603
+ let r = e ? s(e) : "";
2604
+ if ("string" != typeof r) return void t.warn("A hyperlink has an invalid address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
2605
+ r.endsWith("\\") && (r = r.substring(0, r.length - 1));
2606
+ const n = t.getAttribute("location");
2607
+ if (n && (r += "#" + n), !r) return void t.warn("A hyperlink has no address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
2608
+ let i;
2609
+ const a = t.getAttribute("tooltip"), l = t.getAttribute("display");
2610
+ a || l ? (i = { address: r }, a && (i.screenTip = a), l && (i.display = l)) : i = r, t.setSource({
2611
+ r: o,
2612
+ v: i
2613
+ });
2614
+ }
2615
+ }), d.registerVisitor({
2616
+ from: "drawing",
2617
+ to: "movables",
2618
+ openTag: (t) => {
2619
+ const e = t.getAttribute("r:id");
2620
+ if (!e) return;
2621
+ const o = s(e);
2622
+ o ? t.setSource(o.movables) : t.warn("A drawing part is missing; its shapes were not imported.", { onceKey: "xlsx.sheet.drawing.missing" });
2623
+ }
2624
+ }), d.registerVisitor({
2625
+ from: "legacyDrawing",
2626
+ to: "legacyDrawing",
2627
+ openTag: (t) => {
2628
+ t.setSource(s(t.getAttribute("r:id"), "legacyDrawing") ?? void 0);
2629
+ }
2630
+ }), d.registerVisitor({
2631
+ from: "legacyDrawingHF",
2632
+ to: "legacyDrawingHF",
2633
+ openTag: (t) => {
2634
+ t.setSource(s(t.getAttribute("r:id"), "legacyDrawing") ?? void 0);
2635
+ }
2636
+ });
2637
+ let It = null, Pt = !1;
2638
+ const Ot = /* @__PURE__ */ new Map(), Dt = {
2639
+ from: "Fallback",
2640
+ to: null
2641
+ }, _t = {
2642
+ from: "Choice",
2643
+ transparent: !0
2644
+ };
2645
+ Ot.set("Fallback", Dt), Ot.set("Choice", _t), Ot.set("control", {
2646
+ from: "control",
2647
+ transparent: !0,
2648
+ openTag: (t) => {
2649
+ const e = t.getAttribute("name"), o = t.getAttribute("r:id"), r = o ? s(o, "formControl") : null;
2650
+ if (!r) return t.warn(`The form control '${e ?? ""}' has no properties and was not read.`, { onceKey: "xlsx.sheet.control.noProperties" }), void (It = null);
2651
+ const n = r.json, i = parseInt(t.getAttribute("shapeId") ?? "", 10);
2652
+ isNaN(i) || (n.shapeId = i);
2653
+ const a = {
2654
+ anchor: {
2655
+ tl: {
2656
+ c: 0,
2657
+ r: 0,
2658
+ x: 0,
2659
+ y: 0
2660
+ },
2661
+ br: {
2662
+ c: 0,
2663
+ r: 0,
2664
+ x: 0,
2665
+ y: 0
2666
+ }
2667
+ },
2668
+ content: {
2669
+ type: r.type,
2670
+ json: n
2671
+ }
2672
+ };
2673
+ e && (a.content.name = e), It = {
2674
+ movable: a,
2675
+ control: n
2676
+ };
2677
+ },
2678
+ closeTag: () => {
2679
+ It && (o.movables || (o.movables = []), o.movables.push(It.movable), It = null);
2680
+ }
2681
+ }), Ot.set("controlPr", {
2682
+ from: "controlPr",
2683
+ transparent: !0,
2684
+ raw: !0,
2685
+ openTag: (t) => {
2686
+ if (!It) return;
2687
+ const e = t.getFrom().attributes ?? {}, o = {};
2688
+ for (const t in e) {
2689
+ const s = e[t];
2690
+ o[t] = "string" == typeof s ? s : s?.value ?? "";
2691
+ }
2692
+ R(o, It.control);
2693
+ },
2694
+ closeTag: (t) => {
2695
+ if (!It) return;
2696
+ const e = ((t) => {
2697
+ const e = /<(?:[\w.-]+:)?anchor\b([^>]*)>([\s\S]*?)<\/(?:[\w.-]+:)?anchor>/.exec(t);
2698
+ if (!e) return null;
2699
+ const o = e[2], s = (t) => new RegExp(`<(?:[\\w.-]+:)?${t}\\b[^>]*>([\\s\\S]*?)<\\/(?:[\\w.-]+:)?${t}>`).exec(o)?.[1], r = e[1], n = /\bmoveWithCells="(?:1|true)"/.test(r), i = /\bsizeWithCells="(?:1|true)"/.test(r);
2700
+ return {
2701
+ anchor: {
2702
+ tl: is(s("from")),
2703
+ br: is(s("to"))
2704
+ },
2705
+ anchorType: n ? i ? "twoCell" : "oneCell" : "absolute",
2706
+ rest: (t.slice(0, e.index) + t.slice(e.index + e[0].length)).trim()
2707
+ };
2708
+ })(t.getRawXml() ?? "");
2709
+ e ? (It.movable.anchor = e.anchor, "twoCell" !== e.anchorType && (It.movable.anchorType = e.anchorType), e.rest && (It.control.xml = e.rest)) : Pt || (Pt = !0, t.warn("A form control has no anchor; it is placed at the top left of the sheet."));
2710
+ }
2711
+ });
2712
+ const $t = {
2713
+ from: "controls",
2714
+ transparent: !0,
2715
+ scope: () => Ot
2716
+ };
2717
+ d.registerVisitor($t);
2718
+ const Mt = /* @__PURE__ */ new Map([
2719
+ ["Choice", _t],
2720
+ ["Fallback", Dt],
2721
+ ["controls", $t]
2722
+ ]);
2723
+ d.registerVisitor({
2724
+ from: "AlternateContent",
2725
+ transparent: !0,
2726
+ scope: () => Mt
2727
+ }), d.registerVisitor({
2728
+ from: "tableParts",
2729
+ to: "tables",
2730
+ openTag: (t) => {
2731
+ t.setSource([]);
2732
+ }
2733
+ }), d.registerVisitor({
2734
+ from: "tablePart",
2735
+ to: [],
2736
+ openTag: (t) => {
2737
+ const e = t.getAttribute("r:id");
2738
+ if (!e) return;
2739
+ const o = s(e);
2740
+ o ? t.setSource(o) : t.warn("A table part is missing; the table was not imported.", { onceKey: "xlsx.sheet.table.missing" });
2741
+ }
2742
+ });
2743
+ const Rt = (t, e) => {
2744
+ e.conditions?.length && S(t, k(e)), T(t, e), !1 === e.gradient ? t.solidFill = !0 : delete t.solidFill, e.border && e.borderColor && (t.borderColor = e.borderColor), !e.negativeBarColorSameAsPositive && e.negativeFillColor && (t.negativeFillColor = e.negativeFillColor), !(e.negativeBarBorderColorSameAsPositive ?? 1) && e.negativeBorderColor && (t.negativeBorderColor = e.negativeBorderColor), e.axisColor && (t.axisColor = e.axisColor), "middle" !== e.axisPosition && "none" !== e.axisPosition || (t.axisPosition = e.axisPosition), "leftToRight" !== e.direction && "rightToLeft" !== e.direction || (t.direction = e.direction);
2745
+ }, Vt = (t, e) => {
2746
+ e.conditions?.length && (t.stops = k(e)), e.iconSet && e.iconSet !== t.iconSet && (t.iconSet = e.iconSet), e.icons?.length && (t.icon = e.icons), void 0 !== e.reverse && (t.reverse = e.reverse), void 0 !== e.showValue && (t.showValue = e.showValue);
2747
+ }, Lt = (t) => {
2748
+ if (!t.sqref) return null;
2749
+ const e = t.sqref.split(/\s+/).join(",");
2750
+ if ("iconSet" === t.type) {
2751
+ if (!t.iconSet) return null;
2752
+ const o = {
2753
+ type: Ft.ScaleType.IconSet,
2754
+ stops: []
2755
+ };
2756
+ return Vt(o, t.iconSet), {
2757
+ r: e,
2758
+ v: { scale: o },
2759
+ priority: t.priority
2760
+ };
2761
+ }
2762
+ const o = B(t, a);
2763
+ if (!o) return null;
2764
+ const s = { condition: o };
2765
+ return t.style && (s.style = t.style), t.stopIfTrue && (s.stopIfTrue = !0), {
2766
+ r: e,
2767
+ v: s,
2768
+ priority: t.priority
2769
+ };
2770
+ };
2771
+ d.registerVisitor({
2772
+ from: "worksheet",
2773
+ to: {},
2774
+ openTag: (t) => {},
2775
+ closeTag: (t) => {
2776
+ const e = t.getSource();
2777
+ let o = e?.conditionals;
2778
+ if (o) for (let t = 0; t < o.length; t++) {
2779
+ const e = o[t], s = e.x14Id;
2780
+ if (!s) continue;
2781
+ delete e.x14Id;
2782
+ const r = lt.get(s);
2783
+ if (!r) continue;
2784
+ lt.delete(s);
2785
+ const n = e.v?.scale;
2786
+ r.dataBar && n?.type === Ft.ScaleType.DataBar ? Rt(n, r.dataBar) : r.iconSet && n?.type === Ft.ScaleType.IconSet && Vt(n, r.iconSet);
2787
+ }
2788
+ const s = [...lt.values(), ...ht], r = /* @__PURE__ */ new Set();
2789
+ let n = 0;
2790
+ for (let t = 0; t < s.length; t++) {
2791
+ const i = Lt(s[t]);
2792
+ i ? (o || (o = [], e.conditionals = o), o.push(i)) : (r.add(s[t].type ?? "unknown"), n++);
2793
+ }
2794
+ if (n > 0) {
2795
+ const t = [...r].map((t) => `'${t}'`).join(", ");
2796
+ a?.(1 === n ? `An x14-only conditional formatting rule (type ${t}) is not read and will be lost on resave.` : `${n} x14-only conditional formatting rules (types ${t}) are not read and will be lost on resave.`);
2797
+ }
2798
+ if (o) {
2799
+ o.length > 1 && o.sort((t, e) => (t.priority ?? 1 / 0) - (e.priority ?? 1 / 0));
2800
+ for (let t = 0; t < o.length; t++) delete o[t].priority;
2801
+ }
2802
+ }
2803
+ }), d.registerVisitor({
2804
+ from: "customProperties",
2805
+ to: "customProperties",
2806
+ openTag: (t) => {
2807
+ t.setSource([]);
2808
+ },
2809
+ closeTag: (t) => {
2810
+ const e = t.getSource();
2811
+ if (e.length > 0) t.getParent().customProperties = e;
2812
+ }
2813
+ }), d.registerVisitor({
2814
+ from: "customPr",
2815
+ to: {},
2816
+ openTag: (t) => {
2817
+ const e = t.getParent();
2818
+ t.copyTo("name");
2819
+ const o = t.getAttribute("r:id");
2820
+ if (!o) return void t.warn("A custom property names no part; it was not imported.", { onceKey: "xlsx.sheet.customProperty.noRel" });
2821
+ const r = s(o, "resource"), n = t.getSource();
2822
+ n.resId = r, e.push(n);
2823
+ }
2824
+ }), d.registerVisitor({
2825
+ from: "sheetProtection",
2826
+ to: "protection",
2827
+ openTag: (t) => {
2828
+ const e = t.getSource();
2829
+ for (const o of V) {
2830
+ const s = t.hasAttribute(o.attribute) ? t.getAttribute(o.attribute) : null;
2831
+ e[o.key] = Tt(o, s);
2832
+ }
2833
+ if (e.sheet) return;
2834
+ const o = {};
2835
+ if (t.copyToObject(o, "hash", $o, "hashValue"), t.copyToObject(o, "algorithm", $o, "algorithmName"), t.copyToObject(o, "salt", $o, "saltValue"), t.copyToObject(o, "spinCount", No), t.copyToObject(o, "legacyHash", $o, "password"), Object.keys(o).length > 0) t.getSource().password = o;
2836
+ }
2837
+ }), d.registerVisitor({
2838
+ from: "protectedRanges",
2839
+ to: "protectedRanges",
2840
+ openTag: (t) => {
2841
+ t.setSource([]);
2842
+ }
2843
+ }), d.registerVisitor({
2844
+ from: "protectedRange",
2845
+ to: [],
2846
+ openTag: (t) => {
2847
+ let e = t.getAttribute("sqref");
2848
+ e && (e = e.trim().split(/\s+/).join(","));
2849
+ const o = {}, s = {
2850
+ r: e,
2851
+ v: o
2852
+ };
2853
+ t.copyToObject(o, "name"), t.copyToObject(o, "securityDescriptor");
2854
+ const r = {};
2855
+ t.copyToObject(r, "hash", $o, "hashValue"), t.copyToObject(r, "algorithm", $o, "algorithmName"), t.copyToObject(r, "salt", $o, "saltValue"), t.copyToObject(r, "spinCount", No), t.copyToObject(r, "legacyHash", $o, "password"), Object.keys(r).length > 0 && (o.password = r), t.setSource(s);
2856
+ },
2857
+ closeTag: (t) => {
2858
+ const e = t.getSource();
2859
+ e?.r && e.v.name || t.setSource(void 0);
2860
+ }
2861
+ }), d.registerVisitor({
2862
+ from: "sheetFormatPr",
2863
+ to: "sheetFormatPr",
2864
+ openTag: (t) => {
2865
+ t.copyToObject(o, "defaultColSize", _o, "defaultColWidth");
2866
+ const e = t.getAttribute("customHeight");
2867
+ "1" !== e && "true" !== e || t.copyToObject(o, "defaultRowSize", _o, "defaultRowHeight");
2868
+ const s = t.getAttribute("baseColWidth", No);
2869
+ s && 8 !== s && (o.baseColSize = s), f = !!t.getAttribute("zeroHeight", Do);
2870
+ }
2871
+ }), d.registerVisitor({
2872
+ from: "cols",
2873
+ to: "cols",
2874
+ openTag: (t) => {
2875
+ t.setSource([]);
2876
+ }
2877
+ }), d.registerVisitor({
2878
+ from: "col",
2879
+ to: [],
2880
+ openTag: (t) => {
2881
+ const e = t.getSource(), o = t.getAttribute("min"), s = t.getAttribute("max"), r = void 0 === o ? 0 : parseInt(o) - 1, n = void 0 === s ? r : parseInt(s) - 1;
2882
+ e.r = Nt.runToString(r, n, !0);
2883
+ const i = {};
2884
+ e.v = i, t.copyToObject(i, "sz", _o, "width"), t.copyToObject(i, "csz", Do, "customWidth"), t.copyToObject(i, "h", Do, "hidden"), t.copyToObject(i, "l", No, "outlineLevel"), t.copyToObject(i, "cl", Do, "collapsed"), t.getAttribute("bestFit", Do) && (i.bf = !0), t.copyToObject(i, "s", No, "style");
2885
+ }
2886
+ }), d.registerVisitor({
2887
+ from: "oleObjects",
2888
+ to: null,
2889
+ openTag: (t) => {
2890
+ t.warn("'OLE Objects' are not supported.");
2891
+ }
2892
+ });
2893
+ let jt = !1, Ht = !1, Wt = 0, Xt = "", qt = "";
2894
+ const Ut = (t) => {
2895
+ const e = t.indexOf(":");
2896
+ return -1 === e ? t : t.slice(e + 1);
2897
+ }, Gt = new os();
2898
+ return xs(x, o, d.createEventHandler(o, i, a), a, u, {
2899
+ onOpenTag: (t) => {
2900
+ jt = !0;
2901
+ const e = Ut(t.name);
2902
+ "t" === e || "v" === e ? 0 === Wt && (Ht = !0) : "rPh" === e || "phoneticPr" === e ? Wt++ : 0 === Wt && Gt.onOpenTag(e, t.attributes);
2903
+ },
2904
+ onText: (t) => {
2905
+ Ht && (Xt += t, Gt.onText(t));
2906
+ },
2907
+ onCloseTag: (t) => {
2908
+ const e = Ut(t.name);
2909
+ "t" === e || "v" === e ? Ht = !1 : "rPh" === e || "phoneticPr" === e ? Wt > 0 && Wt-- : Gt.onCloseTag(e);
2910
+ },
2911
+ onEnd: () => {
2912
+ if (!jt) return;
2913
+ const t = Gt.take();
2914
+ jt = !1, Ht = !1, Wt = 0;
2915
+ const e = l(Xt);
2916
+ return Xt = "", qt = e, t ? {
2917
+ t: "r",
2918
+ v: {
2919
+ type: "richText",
2920
+ data: { runs: ss(t, h?.get(hs)) }
2921
+ }
2922
+ } : r(e);
2923
+ },
2924
+ onError: (t) => {}
2925
+ }, h, r, () => f, () => qt);
2926
+ }, ps = class {
2927
+ static {
2928
+ this.Collapsed = 1;
2929
+ }
2930
+ static {
2931
+ this.CustomFormat = 2;
2932
+ }
2933
+ static {
2934
+ this.CustomHeight = 4;
2935
+ }
2936
+ static {
2937
+ this.Hidden = 8;
2938
+ }
2939
+ static {
2940
+ this.Ht = 16;
2941
+ }
2942
+ static {
2943
+ this.OutlineLevel = 32;
2944
+ }
2945
+ static {
2946
+ this.Ph = 64;
2947
+ }
2948
+ static {
2949
+ this.R = 128;
2950
+ }
2951
+ static {
2952
+ this.S = 256;
2953
+ }
2954
+ static {
2955
+ this.Spans = 512;
2956
+ }
2957
+ }, fs = (t, e, o) => {
2958
+ if (t[0].value[0] === t[1].value[0]) return e;
2959
+ }, gs = /^\s*TABLE\s*\(/i, ms = {
2960
+ colStart: 0,
2961
+ colEnd: 0,
2962
+ rowStart: 0,
2963
+ rowEnd: 0
2964
+ }, bs = (t) => "1" === t || "true" === t, xs = (t, e, o, s, r, n, i, a, l, c) => {
2965
+ let u = !1;
2966
+ const d = [], p = i?.get(us), f = i?.get(hs), g = /* @__PURE__ */ new Map();
2967
+ let m = !1, b = [], x = !1, y = null, v = null, w = null, S = null, C = null, k = null;
2968
+ const A = i?.get("richData") ?? $t.EmptyArray;
2969
+ let E = null, I = !1;
2970
+ const P = Nt.normalizeA1ToR1C1, O = Mt.createConflatingRanges(), D = /* @__PURE__ */ new Map(), N = [], _ = [];
2971
+ let $ = !1, M = !1, R = null;
2972
+ const V = (t) => {
2973
+ const e = (i?.get("metadata"))?.values;
2974
+ if (!e) return;
2975
+ const o = parseInt(t, 10);
2976
+ if (!Number.isFinite(o) || o < 1) return;
2977
+ const s = e[o - 1]?.get("XLRICHVALUE");
2978
+ return void 0 !== s?.richValueIndex ? A[s.richValueIndex] : void 0;
2979
+ };
2980
+ let L = !1;
2981
+ const j = Mt.createConflatingRanges();
2982
+ let B, F = !1, H = -1, W = -1, z = null, X = null;
2983
+ const q = (t) => ({
2984
+ t: "r",
2985
+ v: {
2986
+ type: "hyperlink",
2987
+ data: {
2988
+ address: B,
2989
+ friendly: t
2990
+ }
2991
+ }
2992
+ });
2993
+ let U = null;
2994
+ const G = [];
2995
+ let K = null, J = -2, Z = 0, Q = "", Y = "", tt = "", et = "", ot = "", st = "", rt = "", nt = "", it = "", at = "", lt = "", ct = "", ut = "", ht = "", dt = !0, pt = null, ft = !1, gt = !1, mt = !1, bt = null, xt = 0;
2996
+ const yt = (t) => {
2997
+ let s = t.name;
2998
+ const a = s.indexOf(":");
2999
+ if (-1 !== a && (s = s.slice(a + 1)), xt++, xt % 196608 == 0 && r?.(xt), X) {
3000
+ const e = t.attributes;
3001
+ switch (s) {
3002
+ case "v":
3003
+ m = !0;
3004
+ break;
3005
+ case "f":
3006
+ switch (x = !0, e.t ?? null) {
3007
+ case null:
3008
+ case "normal": break;
3009
+ case "shared":
3010
+ const t = e.si;
3011
+ v = e.ref, y = t;
3012
+ break;
3013
+ case "array":
3014
+ v = e.ref, R = v;
3015
+ break;
3016
+ case "dataTable": {
3017
+ const t = ((t, e, o) => {
3018
+ const s = t.r1, r = bs(t.del1);
3019
+ if (!s && !r) return null;
3020
+ const n = t.ref ?? Nt.cellToString({
3021
+ rowIndex: e,
3022
+ colIndex: o
3023
+ }), i = Nt.fastStringToRange(n);
3024
+ if (!i) return null;
3025
+ const a = { ref: {
3026
+ rowStart: i.rowStart,
3027
+ colStart: i.colStart,
3028
+ rowEnd: i.rowEnd,
3029
+ colEnd: i.colEnd
3030
+ } }, l = bs(t.dt2D);
3031
+ if (l || bs(t.dtr) ? (s && (a.rowInput = s), r && (a.rowInputDeleted = !0)) : (s && (a.columnInput = s), r && (a.columnInputDeleted = !0)), l) {
3032
+ const e = t.r2;
3033
+ e && (a.columnInput = e), bs(t.del2) && (a.columnInputDeleted = !0);
3034
+ }
3035
+ return a;
3036
+ })(e, H, W);
3037
+ t && (_.push(t), bs(e.ca) && j.append(H, W));
3038
+ return;
3039
+ }
3040
+ }
3041
+ const t = e.ca;
3042
+ void 0 !== t && (L = "1" === t);
3043
+ break;
3044
+ case "is":
3045
+ F = !0;
3046
+ return;
3047
+ }
3048
+ F && !x && n?.onOpenTag?.(t);
3049
+ return;
3050
+ }
3051
+ if (u) {
3052
+ if ("c" === s) {
3053
+ X = t, B = void 0;
3054
+ const e = t.attributes, o = e.r;
3055
+ W = void 0 !== o ? Nt.fastStringToCol(o) : W + 1;
3056
+ const s = e.t;
3057
+ void 0 === s ? U = null : (U = s, "str" === U && (F = !0));
3058
+ let r = e.s;
3059
+ void 0 === r && (null !== bt || mt) && (r = "0"), void 0 !== r && (r = parseInt(r), pt && pt.value === r && pt.colEnd + 1 === W ? pt.colEnd = W : (pt = {
3060
+ colStart: W,
3061
+ rowStart: H,
3062
+ colEnd: W,
3063
+ rowEnd: H,
3064
+ value: r
3065
+ }, b.push(pt))), R = null, M = !1, I = !1;
3066
+ const n = e.cm;
3067
+ $ = void 0 !== n && ((t) => {
3068
+ const e = (i?.get("metadata"))?.cells;
3069
+ if (!e) return !1;
3070
+ const o = parseInt(t, 10);
3071
+ return !(!Number.isFinite(o) || o < 1) && !0 === (e[o - 1]?.get("XLDAPR"))?.fDynamic;
3072
+ })(n);
3073
+ const a = e.vm;
3074
+ if (void 0 !== a) {
3075
+ const t = V(a);
3076
+ if (Rt.isError(t)) {
3077
+ const e = t.getCode();
3078
+ z = {
3079
+ t: "e",
3080
+ v: e
3081
+ }, $ && e === Rt.Code.Spill && (M = !0);
3082
+ }
3083
+ }
3084
+ }
3085
+ } else {
3086
+ if (gt && "row" === s) {
3087
+ u = !0;
3088
+ const e = t.attributes.r;
3089
+ if (H = void 0 !== e ? parseInt(e) - 1 : H + 1, W = -1, l?.()) {
3090
+ const t = d[d.length - 1];
3091
+ t && t.max + 1 === H ? t.max = H : d.push({
3092
+ min: H,
3093
+ max: H
3094
+ });
3095
+ }
3096
+ if (Z = 0, Y = t.attributes.customHeight, void 0 !== Y && (Z |= ps.CustomHeight), Y !== it && (dt = !0, it = Y), Q = t.attributes.ht, void 0 !== Q && (Z |= ps.Ht), Q !== nt && (dt = !0, nt = Q), tt = t.attributes.hidden, void 0 !== tt && (Z |= ps.Hidden), tt !== at && (dt = !0, at = tt), ot = t.attributes.s, void 0 !== ot && (Z |= ps.S), ot !== ct && (dt = !0, ct = ot), et = t.attributes.customFormat, void 0 !== et && (Z |= ps.CustomFormat), et !== lt && (dt = !0, lt = et), st = t.attributes.outlineLevel, void 0 !== st && (Z |= ps.OutlineLevel), st !== ut && (dt = !0, ut = st), rt = t.attributes.collapsed, void 0 !== rt && (Z |= ps.Collapsed), rt !== ht && (dt = !0, ht = rt), 0 !== Z) if (J + 1 !== H || dt) {
3097
+ const t = void 0 !== Y && ("1" === Y || "true" === Y), e = void 0 !== et && ("1" === et || "true" === et);
3098
+ bt = e && void 0 !== ot ? ot : null, e && null === bt && (bt = "0"), K = {
3099
+ min: H,
3100
+ max: H,
3101
+ value: {
3102
+ sz: void 0 === Q ? -1 : parseFloat(Q),
3103
+ csz: t,
3104
+ h: void 0 !== tt && ("1" === tt || "true" === tt),
3105
+ s: null === bt ? void 0 : "0" === bt ? 0 : parseInt(bt),
3106
+ l: void 0 === st || "0" === st ? 0 : parseInt(st),
3107
+ cl: void 0 !== rt && ("1" === rt || "true" === rt)
3108
+ }
3109
+ }, G.push(K);
3110
+ } else K.max = H;
3111
+ J = H, dt = !1;
3112
+ return;
3113
+ }
3114
+ if ("sheetData" === s && (gt = !0), !ft && "sheetData" === s) {
3115
+ ft = !0;
3116
+ const t = e.cols, o = t ? t.length : 0;
3117
+ for (let e = 0; !mt && e < o; e++) t[e].v.s && (mt = !0);
3118
+ }
3119
+ o?.onOpenTag?.(t);
3120
+ }
3121
+ }, wt = (e) => {
3122
+ let s = e.name;
3123
+ if ("sheetData" === s && (gt = !1), !x || "c" !== s && "f" !== s || (y && (S = D.get(y) ?? null), S && (B = ((t) => {
3124
+ if (t.length < 11 || 104 != (32 | t.charCodeAt(0))) return;
3125
+ if (!/^HYPERLINK\(/i.test(t)) return;
3126
+ let e = 1, o = !1, s = 10;
3127
+ for (; s < t.length && e > 0; s++) {
3128
+ const r = t.charCodeAt(s);
3129
+ o ? 34 === r && (34 === t.charCodeAt(s + 1) ? s++ : o = !1) : 34 === r ? o = !0 : 40 === r ? e++ : 41 === r && e--;
3130
+ }
3131
+ if (0 !== e || t.slice(s).trim().length > 0) return;
3132
+ const r = /^HYPERLINK\(\s*"((?:[^"]|"")*)"\s*[,)]/i.exec(t);
3133
+ return r ? r[1].replace(/""/g, "\"") : null;
3134
+ })(S[2]), O.append(H, W, S), L && j.append(H, W)), null !== R && N.push([R, $ ? M ? "error" : "dynamic" : "fixed"]), x = !1, S = null, y = null, v = null, m = !1, L = !1, R = null, $ = !1, M = !1), X) {
3135
+ const o = s.indexOf(":");
3136
+ if (-1 !== o && (s = s.slice(o + 1)), F) if ("is" === s || "v" === s) {
3137
+ const e = n?.onEnd?.();
3138
+ null == e || I && "" === c?.() || t.pushAt(H, W, void 0 !== B && "number" == typeof e ? q(c?.() ?? "") : "number" == typeof e ? "" + e : e);
3139
+ } else "f" !== s && n?.onCloseTag?.(e);
3140
+ m && (m = !1), "c" === s && (X = null, F = !1);
3141
+ return;
3142
+ }
3143
+ if (u) return u = !1, void (pt = null);
3144
+ o?.onCloseTag?.(e);
3145
+ }, Tt = (e) => {
3146
+ const r = e.trim();
3147
+ if (m) {
3148
+ switch (z = null, U) {
3149
+ case null:
3150
+ case "n":
3151
+ z = Zt.flushSubnormal(parseFloat(r));
3152
+ break;
3153
+ case "b":
3154
+ z = "1" === r || "true" === r;
3155
+ break;
3156
+ case "s": {
3157
+ const t = parseInt(r, 10);
3158
+ let e = g.get(t);
3159
+ if (void 0 === e) {
3160
+ const o = p?.get(t);
3161
+ e = o ? ss(o, f) : null, g.set(t, e);
3162
+ }
3163
+ z = e ? {
3164
+ t: "r",
3165
+ v: {
3166
+ type: "richText",
3167
+ data: { runs: e }
3168
+ }
3169
+ } : r;
3170
+ break;
3171
+ }
3172
+ case "d": {
3173
+ const t = ((t, e = !1) => {
3174
+ if (!t) return null;
3175
+ const o = Qo.exec(t);
3176
+ if (o) {
3177
+ const [, t, e, s] = o;
3178
+ return void 0 === t && void 0 === e && void 0 === s ? null : (3600 * parseFloat(t ?? "0") + 60 * parseFloat(e ?? "0") + parseFloat(s ?? "0")) / 86400;
3179
+ }
3180
+ const s = Zo.exec(t);
3181
+ if (!s) return null;
3182
+ const [, r, n, i, a, l, c, u] = s;
3183
+ if (void 0 === r && void 0 === a) return null;
3184
+ let h = 0;
3185
+ if (void 0 !== r) {
3186
+ const t = parseInt(r, 10), o = parseInt(n, 10), s = parseInt(i, 10);
3187
+ if (o < 1 || o > 12 || s < 1 || s > 31) return null;
3188
+ const a = Yo(t, o, s) - ts;
3189
+ if (h = a <= 60 ? a - 1 : a, e && (h -= 1462), h < 0) return null;
3190
+ }
3191
+ void 0 !== a && (h += (3600 * parseInt(a, 10) + 60 * parseInt(l, 10) + (void 0 !== c ? parseInt(c, 10) : 0) + (void 0 !== u ? parseFloat(u) : 0)) / 86400);
3192
+ return h;
3193
+ })(r, !0 === i?.get(cs));
3194
+ null !== t ? z = t : a && (s?.(`Date '${r}' in cell ${Nt.cellToString({
3195
+ colIndex: W,
3196
+ rowIndex: H
3197
+ })} is not a date this workbook can hold; kept as text.`, void 0, "xlsx.cell.isoDateText"), z = "" + a(r));
3198
+ break;
3199
+ }
3200
+ case "e":
3201
+ if ("#VALUE!" === r) {
3202
+ const t = X.attributes.vm;
3203
+ if (void 0 !== t) {
3204
+ const e = V(t);
3205
+ if (Rt.isError(e)) {
3206
+ z = {
3207
+ t: "e",
3208
+ v: e.getCode()
3209
+ };
3210
+ break;
3211
+ }
3212
+ if (Jt.isJSON(e)) {
3213
+ z = {
3214
+ t: "r",
3215
+ v: e
3216
+ };
3217
+ break;
3218
+ }
3219
+ }
3220
+ }
3221
+ const t = Rt.getBuiltInByLabel(r);
3222
+ t ? z = {
3223
+ t: "e",
3224
+ v: t.getCode()
3225
+ } : (z = r, s?.(`Unknown formula error '${r}' in cell ${Nt.cellToString({
3226
+ colIndex: W,
3227
+ rowIndex: H
3228
+ })}`));
3229
+ break;
3230
+ case "str":
3231
+ case "inlineStr": F = !0;
3232
+ }
3233
+ null !== z && t.pushAt(H, W, void 0 === B || "number" != typeof z && "boolean" != typeof z ? z : q(z));
3234
+ }
3235
+ const l = null !== y;
3236
+ if (y) {
3237
+ if (C === y) S = k;
3238
+ else {
3239
+ if (S = D.get(y) ?? null, !S) {
3240
+ const t = [];
3241
+ w = P(r, H, W, t), S = [
3242
+ w,
3243
+ t,
3244
+ r
3245
+ ], D.set(y, S);
3246
+ }
3247
+ C = y, k = S;
3248
+ }
3249
+ y = null;
3250
+ }
3251
+ if (x) {
3252
+ let t = r;
3253
+ const e = l ? void 0 : i?.get(ls);
3254
+ if (e) {
3255
+ const o = ((t) => {
3256
+ if (t.length < Lo.length) return Fo;
3257
+ if (t.slice(0, Lo.length).toUpperCase() !== jo) return Fo;
3258
+ const e = Wo(t, Lo.length);
3259
+ if (null === e) return Fo;
3260
+ if (41 !== t.charCodeAt(e.end)) return Fo;
3261
+ if (44 !== t.charCodeAt(e.end + 1)) return Fo;
3262
+ if (41 !== t.charCodeAt(t.length - 1)) return Fo;
3263
+ const o = e.value;
3264
+ return o.toUpperCase() === Bo ? Ho : 0 === o.length ? Fo : {
3265
+ kind: "formula",
3266
+ formula: o
3267
+ };
3268
+ })(r);
3269
+ "none" !== o.kind && (E ??= new Xo(e), "spilled" === o.kind ? I = E.placeholder(H, W) : E.anchor(H, W, o.formula) && (t = o.formula, L ||= ((t) => zo(t).some((t) => T(t) || !0 === Lt.get(t)?.getDeclaration().getReturnType()?.isVolatile()))(t)));
3270
+ }
3271
+ if (I) L = !1;
3272
+ else {
3273
+ const e = [];
3274
+ w = P(t, H, W, e), S = [
3275
+ w,
3276
+ e,
3277
+ t
3278
+ ];
3279
+ }
3280
+ }
3281
+ F ? n?.onText?.(e) : u || o?.onText?.(r);
3282
+ }, St = {
3283
+ r: void 0,
3284
+ t: void 0,
3285
+ s: void 0,
3286
+ cm: void 0,
3287
+ vm: void 0
3288
+ }, Ct = {
3289
+ name: "c",
3290
+ attributes: St,
3291
+ isSelfClosing: !1
3292
+ }, kt = {
3293
+ t: void 0,
3294
+ si: void 0,
3295
+ ref: void 0,
3296
+ ca: void 0
3297
+ }, At = {
3298
+ name: "f",
3299
+ attributes: kt,
3300
+ isSelfClosing: !1
3301
+ }, Et = {
3302
+ name: "v",
3303
+ attributes: {},
3304
+ isSelfClosing: !1
3305
+ }, It = {
3306
+ r: void 0,
3307
+ s: void 0,
3308
+ ht: void 0,
3309
+ hidden: void 0,
3310
+ collapsed: void 0,
3311
+ customHeight: void 0,
3312
+ customFormat: void 0,
3313
+ outlineLevel: void 0
3314
+ }, Pt = {
3315
+ name: "row",
3316
+ attributes: It,
3317
+ isSelfClosing: !1
3318
+ }, Ot = Oo.NEED_MORE, Dt = Oo.NOT_HANDLED, _t = Oo.decodeText;
3319
+ let Vt = !1;
3320
+ const jt = (t, e, o, s) => {
3321
+ for (;;) {
3322
+ let r = 0;
3323
+ for (; e < o && (32 === (r = t.charCodeAt(e)) || 9 === r || 10 === r || 13 === r);) e++;
3324
+ if (e >= o) return Ot;
3325
+ if (62 === r) return Vt = !1, e + 1;
3326
+ if (47 === r) return e + 1 >= o ? Ot : 62 !== t.charCodeAt(e + 1) ? Dt : (Vt = !0, e + 2);
3327
+ const n = e;
3328
+ for (; e < o && 61 !== (r = t.charCodeAt(e));) {
3329
+ if (62 === r || 47 === r || 32 === r || 9 === r || 10 === r || 13 === r) return Dt;
3330
+ e++;
3331
+ }
3332
+ if (e + 1 >= o) return Ot;
3333
+ const i = e - n, a = t.charCodeAt(e + 1);
3334
+ if (34 !== a && 39 !== a) return Dt;
3335
+ const l = e + 2;
3336
+ let c = l;
3337
+ for (; c < o && (r = t.charCodeAt(c)) !== a;) {
3338
+ if (38 === r || r < 32) return Dt;
3339
+ c++;
3340
+ }
3341
+ if (c >= o) return Ot;
3342
+ e = c + 1;
3343
+ const u = t.charCodeAt(n);
3344
+ if (2 === s) switch (i) {
3345
+ case 1:
3346
+ 114 === u ? It.r = t.slice(l, c) : 115 === u && (It.s = t.slice(l, c));
3347
+ break;
3348
+ case 2:
3349
+ t.startsWith("ht", n) && (It.ht = t.slice(l, c));
3350
+ break;
3351
+ case 6:
3352
+ t.startsWith("hidden", n) && (It.hidden = t.slice(l, c));
3353
+ break;
3354
+ case 9:
3355
+ t.startsWith("collapsed", n) && (It.collapsed = t.slice(l, c));
3356
+ break;
3357
+ case 12: t.startsWith("customHeight", n) ? It.customHeight = t.slice(l, c) : t.startsWith("customFormat", n) ? It.customFormat = t.slice(l, c) : t.startsWith("outlineLevel", n) && (It.outlineLevel = t.slice(l, c));
3358
+ }
3359
+ else if (0 === s) 1 === i ? 114 === u ? St.r = t.slice(l, c) : 116 === u ? St.t = t.slice(l, c) : 115 === u && (St.s = t.slice(l, c)) : 2 === i && 109 === t.charCodeAt(n + 1) && (99 === u ? St.cm = t.slice(l, c) : 118 === u && (St.vm = t.slice(l, c)));
3360
+ else if (1 === i) 116 === u && (kt.t = t.slice(l, c));
3361
+ else if (2 === i) {
3362
+ const e = t.charCodeAt(n + 1);
3363
+ 115 === u && 105 === e ? kt.si = t.slice(l, c) : 99 === u && 97 === e && (kt.ca = t.slice(l, c));
3364
+ } else 3 === i && t.startsWith("ref", n) && (kt.ref = t.slice(l, c));
3365
+ }
3366
+ }, Bt = (t, e, o) => 47 === t.charCodeAt(e + 1) && t.charCodeAt(e + 2) === o && 62 === t.charCodeAt(e + 3);
3367
+ return {
3368
+ ...o,
3369
+ onEnd: () => {
3370
+ if (l?.()) {
3371
+ let t = 0;
3372
+ const e = [], o = (t, e) => ({
3373
+ min: t,
3374
+ max: e,
3375
+ value: {
3376
+ sz: -1,
3377
+ csz: !1,
3378
+ h: !0,
3379
+ s: void 0,
3380
+ l: 0,
3381
+ cl: !1
3382
+ }
3383
+ });
3384
+ for (const s of d) s.min > t && e.push(o(t, s.min - 1)), t = Math.max(t, s.max + 1);
3385
+ t <= vt && e.push(o(t, vt)), e.length > 0 && (G.push(...e), G.sort((t, e) => t.min - e.min));
3386
+ }
3387
+ G.length > 0 && (e.rows = Nt.runsToRefs(G, !1));
3388
+ let s = O.done(fs);
3389
+ s = ((t, e) => {
3390
+ let o = null;
3391
+ for (let e = 0; e < t.length; e++) {
3392
+ const s = t[e];
3393
+ if (!gs.test(s.value[2])) continue;
3394
+ o ??= /* @__PURE__ */ new Map();
3395
+ const r = s.value[0], n = o.get(r);
3396
+ n ? n.push(s) : o.set(r, [s]);
3397
+ }
3398
+ if (null === o) return t;
3399
+ const s = /* @__PURE__ */ new Set();
3400
+ for (const t of o.values()) {
3401
+ const o = t[0], r = {
3402
+ rowStart: o.rowStart,
3403
+ colStart: o.colStart,
3404
+ rowEnd: o.rowEnd,
3405
+ colEnd: o.colEnd
3406
+ };
3407
+ let n = 0;
3408
+ for (let e = 0; e < t.length; e++) {
3409
+ const o = t[e];
3410
+ o.rowStart < r.rowStart && (r.rowStart = o.rowStart), o.colStart < r.colStart && (r.colStart = o.colStart), o.rowEnd > r.rowEnd && (r.rowEnd = o.rowEnd), o.colEnd > r.colEnd && (r.colEnd = o.colEnd), n += (o.rowEnd - o.rowStart + 1) * (o.colEnd - o.colStart + 1);
3411
+ }
3412
+ if (n !== (r.rowEnd - r.rowStart + 1) * (r.colEnd - r.colStart + 1)) continue;
3413
+ const a = Jo(Nt.resolveRelativeToA1(o.value[1], r.rowStart, r.colStart), r);
3414
+ if (a) {
3415
+ e.push(a);
3416
+ for (let e = 0; e < t.length; e++) s.add(t[e]);
3417
+ }
3418
+ }
3419
+ return 0 === s.size ? t : t.filter((t) => !s.has(t));
3420
+ })(s, _);
3421
+ const r = s.length;
3422
+ if (r > 0 || _.length > 0) {
3423
+ const t = new Array(r);
3424
+ for (let e = 0; e < r; e++) {
3425
+ const o = s[e], r = Nt.rangeToString(o), n = o.value[1], i = Nt.resolveRelativeToA1(n, o.rowStart, o.colStart);
3426
+ t[e] = [r, i];
3427
+ }
3428
+ for (let e = 0; e < _.length; e++) {
3429
+ const o = _[e], s = o.ref;
3430
+ t.push([Nt.cellToString({
3431
+ rowIndex: s.rowStart,
3432
+ colIndex: s.colStart
3433
+ }), h(o)]), N.push([Nt.rangeToString(s), "dynamic"]);
3434
+ }
3435
+ e.formulas = t;
3436
+ }
3437
+ const n = j.done(!0), i = n.length;
3438
+ if (i > 0) {
3439
+ const t = new Array(i);
3440
+ for (let e = 0; e < i; e++) {
3441
+ const o = n[e], s = Nt.rangeToString(o);
3442
+ t[e] = s;
3443
+ }
3444
+ e.volatile = t;
3445
+ }
3446
+ E && N.push(...E.getFormulaArray()), N.length > 0 && (e.formulaArray = [...N]);
3447
+ const a = b.length;
3448
+ if (a > 0) {
3449
+ b.sort(Mt.createRangeComparator(zt.Axis.Column));
3450
+ let t = b[0], o = t.colStart, s = t.colEnd, r = t.rowEnd, n = t.value;
3451
+ const i = [];
3452
+ i.push(t);
3453
+ let l = null;
3454
+ for (let e = 1; e < a; e++) l = b[e], n !== l.value || o !== l.colStart || s !== l.colEnd || r + 1 !== l.rowEnd ? (i.push(l), t = l, o = t.colStart, s = t.colEnd, r = t.rowEnd, n = t.value) : (r = l.rowEnd, t.rowEnd = r);
3455
+ const c = i.length, u = new Array(c);
3456
+ for (let t = 0; t < c; t++) {
3457
+ const e = i[t], o = Nt.rangeToString(e);
3458
+ u[t] = [o, e.value];
3459
+ }
3460
+ e.directStyles = u;
3461
+ }
3462
+ const c = t.build();
3463
+ c && (e.data = c.tuples), o?.onEnd?.();
3464
+ },
3465
+ onOpenTag: yt,
3466
+ onCloseTag: wt,
3467
+ onText: Tt,
3468
+ elementScanners: [{
3469
+ name: "c",
3470
+ scan: (t, e, o) => {
3471
+ if (!u || null !== X) return Dt;
3472
+ St.r = St.t = St.s = St.cm = St.vm = void 0;
3473
+ let s = jt(t, e + 2, o, 0);
3474
+ if (s < 0) return s;
3475
+ const r = St.t;
3476
+ if (void 0 === St.r || "str" === r || "inlineStr" === r) return Dt;
3477
+ let n = !1, i = -1, a = -1, l = -1, c = -1, h = s;
3478
+ if (!Vt) for (kt.t = kt.si = kt.ref = kt.ca = void 0;;) {
3479
+ const e = t.indexOf("<", s);
3480
+ if (-1 === e || e + 3 >= o) return Ot;
3481
+ for (let o = s; o < e; o++) {
3482
+ const e = t.charCodeAt(o);
3483
+ if (32 !== e && 9 !== e && 10 !== e && 13 !== e) return Dt;
3484
+ }
3485
+ const r = t.charCodeAt(e + 1), u = t.charCodeAt(e + 2);
3486
+ if (47 === r) {
3487
+ if (!Bt(t, e, 99)) return Dt;
3488
+ h = e + 4;
3489
+ break;
3490
+ }
3491
+ if (102 === r && !n && -1 === l && (32 === u || 62 === u || 47 === u)) {
3492
+ if (n = !0, s = jt(t, e + 2, o, 1), s < 0) return s;
3493
+ if ("dataTable" === kt.t) return Dt;
3494
+ if (Vt) continue;
3495
+ const r = t.indexOf("<", s);
3496
+ if (-1 === r || r + 3 >= o) return Ot;
3497
+ if (!Bt(t, r, 102)) return Dt;
3498
+ i = s, a = r, s = r + 4;
3499
+ continue;
3500
+ }
3501
+ if (118 === r && 62 === u && -1 === l) {
3502
+ const r = t.indexOf("<", e + 3);
3503
+ if (-1 === r || r + 3 >= o) return Ot;
3504
+ if (!Bt(t, r, 118)) return Dt;
3505
+ l = e + 3, c = r, s = r + 4;
3506
+ continue;
3507
+ }
3508
+ return Dt;
3509
+ }
3510
+ return yt(Ct), n && (yt(At), a > i && Tt(_t(t.slice(i, a))), wt(At)), -1 !== l && (yt(Et), c > l && Tt(_t(t.slice(l, c))), wt(Et)), wt(Ct), h;
3511
+ }
3512
+ }, {
3513
+ name: "row",
3514
+ openTag: Pt,
3515
+ scan: (t, e, o) => {
3516
+ if (!gt || u || null !== X) return Dt;
3517
+ It.r = It.s = It.ht = It.hidden = It.collapsed = It.customHeight = It.customFormat = It.outlineLevel = void 0;
3518
+ const s = jt(t, e + 4, o, 2);
3519
+ return s < 0 ? s : Vt || void 0 === It.r ? Dt : (yt(Pt), s);
3520
+ }
3521
+ }]
3522
+ };
3523
+ }, ys = /* @__PURE__ */ new Map([
3524
+ ["urn:schemas-microsoft-com:vml", "v"],
3525
+ ["urn:schemas-microsoft-com:office:office", "o"],
3526
+ ["urn:schemas-microsoft-com:office:excel", "x"]
3527
+ ]), vs = [...ys].map(([t, e]) => ` xmlns:${e}="${t}"`).join(""), ws = /<(\/?)([A-Za-z_][\w.-]*(?::[\w.-]+)?)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/g, Ts = /(\s+)([A-Za-z_][\w.-]*(?::[\w.-]+)?)(\s*=\s*)("[^"]*"|'[^']*')/g, Ss = /\sxmlns(?::([\w.-]+))?\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
3528
+ function Cs(t) {
3529
+ if (!t || !((t) => {
3530
+ let e;
3531
+ for (Ss.lastIndex = 0; null !== (e = Ss.exec(t));) {
3532
+ const t = ys.get(e[2] ?? e[3] ?? "");
3533
+ if (t && t !== (e[1] ?? "")) return !0;
3534
+ }
3535
+ return !1;
3536
+ })(t)) return t;
3537
+ const e = [], o = (t, o, s) => {
3538
+ const r = t.indexOf(":");
3539
+ if (-1 === r && s) return null;
3540
+ const n = -1 === r ? "" : t.substring(0, r);
3541
+ if ("xmlns" === n) return null;
3542
+ const i = ((t, o) => {
3543
+ const s = o?.get(t);
3544
+ if (void 0 !== s) return s;
3545
+ for (let o = e.length - 1; o >= 0; o--) {
3546
+ const s = e[o].bindings.get(t);
3547
+ if (void 0 !== s) return s;
3548
+ }
3549
+ })(n, o), a = void 0 !== i ? ys.get(i) : void 0;
3550
+ return a ? `${a}:${-1 === r ? t : t.substring(r + 1)}` : null;
3551
+ };
3552
+ let s = !1, r = !1;
3553
+ const n = t.replace(ws, (t, n, i, a, l) => {
3554
+ if (n) {
3555
+ const s = e[e.length - 1], r = o(i, null, !1);
3556
+ return s && s.name === i && (s.nested > 0 ? s.nested-- : e.pop()), r ? `</${r}>` : t;
3557
+ }
3558
+ const c = ((t) => {
3559
+ let e, o = null;
3560
+ for (Ss.lastIndex = 0; null !== (e = Ss.exec(t));) (o ??= /* @__PURE__ */ new Map()).set(e[1] ?? "", e[2] ?? e[3] ?? "");
3561
+ return o;
3562
+ })(a);
3563
+ c?.forEach((t, e) => {
3564
+ const o = [...ys].find(([, t]) => t === e)?.[0];
3565
+ o && o !== t && (s = !0);
3566
+ });
3567
+ const u = o(i, c, !1);
3568
+ let h = a.replace(Ts, (t, e, s, r, n) => {
3569
+ if ("xmlns" === s || s.startsWith("xmlns:")) {
3570
+ const e = n.slice(1, -1);
3571
+ return ys.has(e) ? "" : t;
3572
+ }
3573
+ const i = o(s, c, !0);
3574
+ return i ? `${e}${i}${r}${n}` : t;
3575
+ });
3576
+ if (r || (r = !0, h = h.replace(/\s+$/, "") + vs), !l) {
3577
+ const t = e[e.length - 1];
3578
+ c ? e.push({
3579
+ name: i,
3580
+ bindings: c,
3581
+ nested: 0
3582
+ }) : t && t.name === i && t.nested++;
3583
+ }
3584
+ return `<${u ?? i}${h}${l}>`;
3585
+ });
3586
+ return s ? t : n;
3587
+ }
3588
+ var ks = {
3589
+ creator: "author",
3590
+ category: "category",
3591
+ description: "comments",
3592
+ contentStatus: "contentStatus",
3593
+ created: "creationDate",
3594
+ keywords: "keywords",
3595
+ lastModifiedBy: "lastAuthor",
3596
+ modified: "lastModifiedDate",
3597
+ lastPrinted: "lastPrinted",
3598
+ revision: "revisionNumber",
3599
+ subject: "subject",
3600
+ title: "title"
3601
+ }, As = {
3602
+ Company: "company",
3603
+ Manager: "manager"
3604
+ }, Es = {
3605
+ lpwstr: Ht.Type.String,
3606
+ lpstr: Ht.Type.String,
3607
+ bstr: Ht.Type.String,
3608
+ i1: Ht.Type.Number,
3609
+ i2: Ht.Type.Number,
3610
+ i4: Ht.Type.Number,
3611
+ i8: Ht.Type.Number,
3612
+ int: Ht.Type.Number,
3613
+ ui1: Ht.Type.Number,
3614
+ ui2: Ht.Type.Number,
3615
+ ui4: Ht.Type.Number,
3616
+ ui8: Ht.Type.Number,
3617
+ uint: Ht.Type.Number,
3618
+ r4: Ht.Type.Float,
3619
+ r8: Ht.Type.Float,
3620
+ decimal: Ht.Type.Float,
3621
+ bool: Ht.Type.Boolean,
3622
+ filetime: Ht.Type.Date,
3623
+ date: Ht.Type.Date
3624
+ }, Is = (t) => {
3625
+ const e = t.kind ? Es[t.kind] : void 0;
3626
+ if (!e) return null;
3627
+ const o = t.value.trim();
3628
+ let s;
3629
+ if (e === Ht.Type.String) s = {
3630
+ key: t.key,
3631
+ type: e,
3632
+ value: t.value
3633
+ };
3634
+ else if (e === Ht.Type.Boolean) {
3635
+ if ("true" !== o && "false" !== o && "1" !== o && "0" !== o) return null;
3636
+ s = {
3637
+ key: t.key,
3638
+ type: e,
3639
+ value: "true" === o || "1" === o
3640
+ };
3641
+ } else if (e === Ht.Type.Date) {
3642
+ const r = new Date(o);
3643
+ if (!o || isNaN(r.getTime())) return null;
3644
+ s = {
3645
+ key: t.key,
3646
+ type: e,
3647
+ value: r.toISOString()
3648
+ };
3649
+ } else {
3650
+ const r = Number(o);
3651
+ if (!o || !Number.isFinite(r)) return null;
3652
+ const n = e === Ht.Type.Number && r >= -2147483648 && r <= 2147483647;
3653
+ s = {
3654
+ key: t.key,
3655
+ type: n ? e : Ht.Type.Float,
3656
+ value: r
3657
+ };
3658
+ }
3659
+ return t.linkTarget && (s.linkTarget = t.linkTarget), s;
3660
+ }, Ps = "hiddenXfs", Os = (t) => (Array.isArray(t) ? t[1] : t?.v)?.s, Ds = (t) => {
3661
+ if (!t || 0 === t.length) return !1;
3662
+ const e = Nt.refsToRuns(t, !0);
3663
+ let o = 0;
3664
+ for (const t of e) {
3665
+ if (t.min > o || void 0 === t.value?.s) return !1;
3666
+ o = Math.max(o, t.max + 1);
3667
+ }
3668
+ return o > ot;
3669
+ }, Ns = (t, e) => {
3670
+ t.protection = {
3671
+ ...t.protection,
3672
+ showFormulas: e
3673
+ };
3674
+ }, _s = "pivotButtonXfs", $s = (t, e) => {
3675
+ const o = t.styles?.direct;
3676
+ if (!o || 0 === o.length) return;
3677
+ let s = null;
3678
+ const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = (t, i, a, l) => {
3679
+ let c = "";
3680
+ l && (c = n.get(l) ?? _t.JSONStableStringify(l), n.set(l, c));
3681
+ const u = `${t}|${i ?? ""}|${a ?? ""}|${c}`;
3682
+ let h = r.get(u);
3683
+ if (void 0 !== h) return h;
3684
+ const d = o[t], p = d ? Rs(d, i, a, l) : null, f = e?.get(t);
3685
+ return h = p === d ? t : p || void 0 !== f ? ((t, r) => {
3686
+ if (!s) {
3687
+ s = /* @__PURE__ */ new Map();
3688
+ for (let t = 0; t < o.length; t++) {
3689
+ let r = _t.JSONStableStringify(o[t]);
3690
+ const n = e?.get(t);
3691
+ void 0 !== n && (r += `|${n}`), s.has(r) || s.set(r, t);
3692
+ }
3693
+ }
3694
+ let n = _t.JSONStableStringify(t);
3695
+ void 0 !== r && (n += `|${r}`);
3696
+ let i = s.get(n);
3697
+ return void 0 === i && (i = o.length, o.push(t), s.set(n, i), void 0 !== r && e.set(i, r)), i;
3698
+ })(p ?? {}, f) : null, r.set(u, h), h;
3699
+ }, a = new Map((t.pivotCaches ?? []).map((t) => [t.cacheId, t.fields]));
3700
+ for (const e of t.sheets ?? []) {
3701
+ const t = b(e), o = t?.pivotTables, s = t?.directStyles;
3702
+ if (!t || !o || 0 === o.length || !s || 0 === s.length) continue;
3703
+ let r = s, n = !1;
3704
+ for (const t of o) {
3705
+ const e = Ms(t, a.get(t.cacheId));
3706
+ if (!e) continue;
3707
+ const o = [];
3708
+ for (const t of r) {
3709
+ const s = Nt.fastStringToRange(t[0]), r = Ws(s, e.coords);
3710
+ if (!r) {
3711
+ o.push(t);
3712
+ continue;
3713
+ }
3714
+ n = !0;
3715
+ for (const e of zs(s, r)) o.push([Nt.rangeToString(e), t[1]]);
3716
+ const { rowIndex: a, colIndex: l } = e.origin;
3717
+ for (let s = r.rowStart; s <= r.rowEnd; s++) {
3718
+ let n = r.colStart, c = null;
3719
+ const u = (t) => {
3720
+ null !== c && o.push([Nt.rangeToString({
3721
+ rowStart: s,
3722
+ rowEnd: s,
3723
+ colStart: n,
3724
+ colEnd: t
3725
+ }), c]);
3726
+ };
3727
+ for (let o = r.colStart; o <= r.colEnd; o++) {
3728
+ const { numberFormat: h, labelIndent: d, user: p } = e.formats.formatAt(s - a, o - l), f = i(t[1], h, d, p);
3729
+ o !== r.colStart && f === c || (o !== r.colStart && u(o - 1), n = o, c = f);
3730
+ }
3731
+ u(r.colEnd);
3732
+ }
3733
+ }
3734
+ r = o;
3735
+ }
3736
+ n && (t.directStyles = r);
3737
+ }
3738
+ }, Ms = (t, e) => {
3739
+ const o = oe(t, e);
3740
+ if (!o || !t.location) return null;
3741
+ const s = Nt.fastStringToRange(t.location), r = {
3742
+ rowIndex: s.rowStart - o.top,
3743
+ colIndex: s.colStart
3744
+ };
3745
+ return r.rowIndex < 0 || s.rowEnd !== r.rowIndex + o.rows - 1 ? null : {
3746
+ coords: {
3747
+ rowStart: r.rowIndex,
3748
+ colStart: r.colIndex,
3749
+ rowEnd: s.rowEnd,
3750
+ colEnd: r.colIndex + o.columns - 1
3751
+ },
3752
+ origin: r,
3753
+ formats: o
3754
+ };
3755
+ }, Rs = (t, e, o, s) => {
3756
+ let r = t;
3757
+ const n = s?.numberFormat ?? e ?? 0;
3758
+ if (void 0 !== t.numberFormat && Vs(t.numberFormat, n)) {
3759
+ const { numberFormat: t, ...e } = r;
3760
+ r = e;
3761
+ }
3762
+ const i = r.alignment;
3763
+ if (null !== o && i?.horizontal === Xt.HorizontalAlignment.Left && (i.indent ?? 0) === o) {
3764
+ const { horizontal: t, indent: e, ...o } = i, { alignment: s, ...n } = r;
3765
+ r = Hs(o) ? n : {
3766
+ ...n,
3767
+ alignment: o
3768
+ };
3769
+ }
3770
+ if (s) {
3771
+ const { numberFormat: t, ...e } = s;
3772
+ if (r = Bs(r, e), r.alignment && Hs(r.alignment)) {
3773
+ const { alignment: t, ...e } = r;
3774
+ r = e;
3775
+ }
3776
+ }
3777
+ if (r === t) return t;
3778
+ for (const t of Object.keys(r)) if (void 0 !== r[t] && ("named" !== t || r.named !== jt.BuiltInName.Normal)) return r;
3779
+ return null;
3780
+ }, Vs = (t, e) => t === e || qt.toBuiltInID(t) === qt.toBuiltInID(e), Ls = (t) => "object" == typeof t && null !== t && !Array.isArray(t), js = (t, e) => !(!Ls(t) || !Ls(e)) && ("solid" === t.patternType && "solid" === e.patternType ? t.foreground === e.foreground : _t.JSONStableStringify(t) === _t.JSONStableStringify(e)), Bs = (t, e) => {
3781
+ let o = null;
3782
+ const s = (e, s) => {
3783
+ o ??= { ...t }, void 0 === s ? delete o[e] : o[e] = s;
3784
+ };
3785
+ for (const o of Object.keys(t)) {
3786
+ const r = t[o], n = e[o];
3787
+ if (void 0 !== n && void 0 !== r) if ("fill" === o) js(r, n) && s(o);
3788
+ else if (Ls(r) && Ls(n)) {
3789
+ const t = Bs(r, n);
3790
+ t !== r && s(o, Object.keys(t).some((e) => void 0 !== t[e]) ? t : void 0);
3791
+ } else r === n && s(o);
3792
+ }
3793
+ return o ?? t;
3794
+ }, Fs = {
3795
+ vertical: Xt.VerticalAlignment.Bottom,
3796
+ relativeIndent: 0,
3797
+ overflow: Xt.Overflow.Visible,
3798
+ rotation: 0
3799
+ }, Hs = (t) => Object.keys(t).every((e) => void 0 === t[e] || Fs[e] === t[e]), Ws = (t, e) => {
3800
+ const o = Math.max(t.rowStart, e.rowStart), s = Math.min(t.rowEnd, e.rowEnd), r = Math.max(t.colStart, e.colStart), n = Math.min(t.colEnd, e.colEnd);
3801
+ return o <= s && r <= n ? {
3802
+ rowStart: o,
3803
+ rowEnd: s,
3804
+ colStart: r,
3805
+ colEnd: n
3806
+ } : null;
3807
+ }, zs = (t, e) => {
3808
+ const o = [];
3809
+ return t.rowStart < e.rowStart && o.push({
3810
+ ...t,
3811
+ rowEnd: e.rowStart - 1
3812
+ }), t.rowEnd > e.rowEnd && o.push({
3813
+ ...t,
3814
+ rowStart: e.rowEnd + 1
3815
+ }), t.colStart < e.colStart && o.push({
3816
+ rowStart: e.rowStart,
3817
+ rowEnd: e.rowEnd,
3818
+ colStart: t.colStart,
3819
+ colEnd: e.colStart - 1
3820
+ }), t.colEnd > e.colEnd && o.push({
3821
+ rowStart: e.rowStart,
3822
+ rowEnd: e.rowEnd,
3823
+ colStart: e.colEnd + 1,
3824
+ colEnd: t.colEnd
3825
+ }), o;
3826
+ }, Xs = "xfComplements", qs = (t, e) => {
3827
+ if ("string" == typeof t) return void e.push(t);
3828
+ const o = Array.isArray(t) ? t : [t];
3829
+ for (let t = 0; t < o.length; t++) {
3830
+ const s = Nt.rangeToString(o[t]);
3831
+ s && e.push(s);
3832
+ }
3833
+ }, Us = (t) => {
3834
+ const e = Array.isArray(t) ? t[1] : t.v;
3835
+ if (!e || !("s" in e)) return;
3836
+ const o = e.s;
3837
+ return delete e.s, o;
3838
+ }, Gs = (t, e, o, s) => {
3839
+ if (!t) return;
3840
+ const r = e ? 2 : 1, n = e ? o.rowStart : o.colStart, i = e ? o.rowEnd : o.colEnd;
3841
+ let a, l = -1;
3842
+ for (const o of t) {
3843
+ const t = Nt.refToRun(o, e), c = Us(o);
3844
+ t && void 0 !== c ? c !== l || (e ? a.colEnd : a.rowEnd) + 1 !== t.min ? (a = {
3845
+ colStart: e ? t.min : n,
3846
+ rowStart: e ? n : t.min,
3847
+ colEnd: e ? t.max : i,
3848
+ rowEnd: e ? i : t.max,
3849
+ value: {
3850
+ kind: r,
3851
+ index: c
3852
+ }
3853
+ }, l = c, s.push(a)) : e ? a.colEnd = t.max : a.rowEnd = t.max : l = -1;
3854
+ }
3855
+ }, Ks = {
3856
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
3857
+ "application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks",
3858
+ "application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks",
3859
+ "application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks",
3860
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks",
3861
+ "application/vnd.ms-excel.template.macroEnabled.main+xml": "workbooks",
3862
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets",
3863
+ "application/vnd.ms-excel.worksheet": "sheets",
3864
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts",
3865
+ "application/vnd.ms-excel.chartsheet": "charts",
3866
+ "application/vnd.ms-excel.macrosheet+xml": "macros",
3867
+ "application/vnd.ms-excel.macrosheet": "macros",
3868
+ "application/vnd.ms-excel.intlmacrosheet+xml": "macros",
3869
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs",
3870
+ "application/vnd.ms-excel.dialogsheet": "dialogs",
3871
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs",
3872
+ "application/vnd.ms-excel.sharedStrings": "strs",
3873
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles",
3874
+ "application/vnd.ms-excel.styles": "styles",
3875
+ "application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
3876
+ "application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops",
3877
+ "application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops",
3878
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments",
3879
+ "application/vnd.ms-excel.comments": "comments",
3880
+ "application/vnd.ms-excel.threadedcomments+xml": "threadedcomments",
3881
+ "application/vnd.ms-excel.person+xml": "people",
3882
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata",
3883
+ "application/vnd.ms-excel.sheetMetadata": "metadata",
3884
+ "application/vnd.ms-excel.featurepropertybag+xml": "featurePropertyBag",
3885
+ "application/vnd.ms-excel.externalLink": "links",
3886
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links",
3887
+ "application/vnd.openxmlformats-officedocument.theme+xml": "themes"
3888
+ }, Js = g({ readXLSX: () => er }), Zs = (t) => t.startsWith("/") ? t.slice(1) : t, Qs = [
3889
+ 208,
3890
+ 207,
3891
+ 17,
3892
+ 224,
3893
+ 161,
3894
+ 177,
3895
+ 26,
3896
+ 225
3897
+ ], Ys = /^xl\/worksheets\/[^/]+\.xml$/i, tr = (t) => "string" == typeof t ? t : (t?.runs ?? []).map((t) => t.text ?? "").join(""), er = async (t, e) => {
3898
+ const { password: s, onVBA: n, profile: c, calcOnLoad: h = "auto", createWorkbookOptions: g = {}, ...m } = e ?? {};
3899
+ await Vt.load();
3900
+ const y = !!g.origin && "string" != typeof g.origin, T = c ? new ke("function" == typeof c ? c : void 0) : null, S = [], C = (t, e, o) => {
3901
+ S.push([
3902
+ t,
3903
+ e ?? "",
3904
+ o
3905
+ ]);
3906
+ }, k = { onWarning: C }, I = e?.progress, P = I?.onProgress ? I.onProgress.bind(I) : void 0, D = t.byteLength;
3907
+ let $ = 0, R = 0;
3908
+ const V = P ? (t) => {
3909
+ if ($ <= 0) return;
3910
+ R += t;
3911
+ const e = Math.min(D, Math.round(R / $ * D));
3912
+ P(e, D);
3913
+ } : void 0, L = import("./CVtsY2F9A9NzEGLk.mjs");
3914
+ let j = null;
3915
+ try {
3916
+ j = new DOMParser();
3917
+ } catch (t) {}
3918
+ let B = null;
3919
+ try {
3920
+ B = new XMLSerializer();
3921
+ } catch (t) {}
3922
+ let F, H, X, q = null;
3923
+ j || (q = import("@xmldom/xmldom"));
3924
+ try {
3925
+ const [t, e] = await Promise.all([q, L]);
3926
+ F = new e.DOMTransformer(), H = j ?? new t.DOMParser(), X = B ?? new t.XMLSerializer();
3927
+ } catch (t) {
3928
+ throw new Error("Unable to load XLSX parser.", { cause: t });
3929
+ }
3930
+ const U = (t) => X.serializeToString(t);
3931
+ if (((t) => {
3932
+ if (t.byteLength < Qs.length) return !1;
3933
+ const e = new Uint8Array(t, 0, Qs.length);
3934
+ return Qs.every((t, o) => e[o] === t);
3935
+ })(t)) throw new Pt("This is an Excel 97-2003 workbook (.xls), which cannot be read. Save it as '.xlsx' and try again.");
3936
+ let K;
3937
+ try {
3938
+ K = await Ce.create(t);
3939
+ } catch (t) {
3940
+ throw new Pt("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.", { cause: t });
3941
+ }
3942
+ T?.mark("zip-open");
3943
+ try {
3944
+ if (!K.has("[Content_Types].xml")) throw new Pt("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
3945
+ const t = (t) => {
3946
+ const e = K.getEntry(t);
3947
+ return e ? { content: e } : void 0;
3948
+ }, e = {
3949
+ workbooks: [],
3950
+ sheets: [],
3951
+ charts: [],
3952
+ dialogs: [],
3953
+ macros: [],
3954
+ strs: [],
3955
+ comments: [],
3956
+ threadedcomments: [],
3957
+ links: [],
3958
+ coreprops: [],
3959
+ extprops: [],
3960
+ custprops: [],
3961
+ themes: [],
3962
+ styles: [],
3963
+ metadata: [],
3964
+ people: [],
3965
+ featurePropertyBag: [],
3966
+ overrides: {},
3967
+ sst: "",
3968
+ style: "",
3969
+ defaults: {}
3970
+ };
3971
+ {
3972
+ const t = ((t, e) => ({
3973
+ onOpenTag: (e) => {
3974
+ const o = ((t) => {
3975
+ const e = t.indexOf(":");
3976
+ return -1 === e ? t : t.slice(e + 1);
3977
+ })(e.name), s = e.attributes;
3978
+ if ("Override" === o) {
3979
+ const e = s.ContentType, o = s.PartName;
3980
+ if (!e || !o) return;
3981
+ t.overrides[o.startsWith("/") ? o.slice(1) : o] = e;
3982
+ const r = Ks[e], n = r ? t[r] : void 0;
3983
+ Array.isArray(n) && n.push(o);
3984
+ } else if ("Default" === o) {
3985
+ const e = s.Extension, o = s.ContentType;
3986
+ e && (t.defaults[e.toLowerCase()] = o);
3987
+ }
3988
+ },
3989
+ onEnd: () => {
3990
+ t.sst = t.strs.length > 0 ? t.strs[0] : "", t.style = t.styles.length > 0 ? t.styles[0] : "";
3991
+ },
3992
+ onError: (t) => {
3993
+ e?.(`Error parsing content types: ${t?.message ?? t}`);
3994
+ }
3995
+ }))(e, (t) => {
3996
+ S.push([t, "[Content_Types].xml"]);
3997
+ }), o = await K.getTextStream("[Content_Types].xml");
3998
+ if (!o) throw new Error("Error parsing content types: '[Content_Types].xml'");
3999
+ try {
4000
+ await yo.parseStream(o, t, { xmlns: !1 });
4001
+ } catch (t) {
4002
+ throw new Error("Error parsing content types: '[Content_Types].xml'", { cause: t });
4003
+ }
4004
+ y && await K.getBuffer("[Content_Types].xml");
4005
+ }
4006
+ T?.mark("content-types");
4007
+ const s = e.sst, m = /* @__PURE__ */ new Set();
4008
+ for (const t of e.sheets) m.add(Zs(t));
4009
+ s && m.add(Zs(s));
4010
+ for (const t of m) $ += K.uncompressedSize(t);
4011
+ if (await K.prefetch((t) => !m.has(t) && !Ys.test(t)), T?.mark("prefetch-side-parts"), 0 === e.workbooks.length) {
4012
+ const o = _("_rels/.rels", t, H, F, k), s = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
4013
+ if (o) {
4014
+ for (const t of o.values()) if (t.type === s && t.target) {
4015
+ e.workbooks.push(t.target);
4016
+ break;
4017
+ }
4018
+ }
4019
+ }
4020
+ if (0 === e.workbooks.length) throw new Pt("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
4021
+ const R = g?.resources ?? new Kt(), L = R.beginPersist(), j = {}, B = /* @__PURE__ */ new Set(), X = /* @__PURE__ */ new Map();
4022
+ X.set("parseInlineDxf", (t) => {
4023
+ if (!t) return;
4024
+ const e = H.parseFromString(`<dxf xmlns:x14="${G}" xmlns:xm="${wt}">${t}</dxf>`, "text/xml")?.documentElement;
4025
+ if (!e) return;
4026
+ const o = F.parseDxf(e, "", k);
4027
+ return Object.keys(o).length > 0 ? o : void 0;
4028
+ });
4029
+ const q = w("metadata", e, t, H, F, k).entries().next()?.value?.[1]?.metadata;
4030
+ q && X.set("metadata", q), X.set(as, u());
4031
+ const J = /* @__PURE__ */ new Map(), Q = [], Y = /* @__PURE__ */ new Set(), et = (t) => {
4032
+ Y.add(Zs(t));
4033
+ }, st = (e, o = J) => {
4034
+ const s = e.lastIndexOf("/"), r = e.substring(0, s + 1) + "_rels/" + e.substring(s + 1, e.length) + ".rels";
4035
+ let n = o.get(r);
4036
+ return n || (n = _(r, t, H, F, At), o.set(r, n)), n;
4037
+ }, rt = (e, o, s, r = J) => {
4038
+ let n = st(o, r).get(e), i = n?.target;
4039
+ if (!i) return null;
4040
+ if ("External" === n.targetMode) {
4041
+ if (!s) return n.target;
4042
+ const t = R.add({ source: { external: n.target } });
4043
+ return t.addReference(j), B.add(t), L.toResourceId(t);
4044
+ }
4045
+ const a = o.lastIndexOf("/"), l = o.substring(0, a + 1);
4046
+ i.startsWith("/") || (i = l + i), i = xt(i);
4047
+ const c = F?.getVisitorParamsState().get("dxfs");
4048
+ let u = r.get(i);
4049
+ if (!u) {
4050
+ const e = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", o = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink";
4051
+ if (n.type === e) {
4052
+ const t = {};
4053
+ u = t;
4054
+ const e = async () => {
4055
+ const e = ds(t, (t, e) => "legacyDrawing" === e ? ut(t, i) : "formControl" === e ? dt(t, i) : "part" === e ? ft(t, i) : rt(t, i, "resource" === e) ?? null, Bt, c, () => {}, (t, e, o) => {
4056
+ C(t, e ? `${e} (${i})` : i, o);
4057
+ }, void 0, X), o = await K.getTextStream(i, V);
4058
+ if (o) try {
4059
+ await yo.parseStream(o, e, {
4060
+ xmlns: !1,
4061
+ lean: !0
4062
+ });
4063
+ } catch (t) {
4064
+ throw new Error(`Error parsing sheet: '${i}'`, { cause: t });
4065
+ }
4066
+ const s = st(i, r);
4067
+ if (s) {
4068
+ ct(t, i, s, r), ht(t), z(t);
4069
+ const e = [];
4070
+ s.forEach((t, o) => {
4071
+ if ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable" !== t.type) return;
4072
+ const s = ft(o, i, t.type, (t) => "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition" !== t);
4073
+ if (!s?.xml) return;
4074
+ const r = /<pivotTableDefinition\b[^>]*>/.exec(s.xml)?.[0] ?? "", n = parseInt(/\scacheId="(\d+)"/.exec(r)?.[1] ?? "", 10);
4075
+ if (isNaN(n)) return void S.push([`Pivot table '${s.name}' names no cache and was dropped.`, i]);
4076
+ const a = /\sname="([^"]*)"/.exec(r)?.[1], l = bt(s.xml);
4077
+ if (!l) return void S.push([`Pivot table '${s.name}' states no location and was dropped.`, i]);
4078
+ const c = F?.getVisitorParamsState(), u = pt(c?.get("numFmts"), c?.get("dxfs")), h = it(s.xml, u), d = h ? void 0 : Z(s.xml, u);
4079
+ e.push({
4080
+ ...a ? { name: O(a) } : {},
4081
+ cacheId: n,
4082
+ location: l,
4083
+ part: s,
4084
+ ...d ? { partFormats: d } : {},
4085
+ ...h
4086
+ });
4087
+ }), e.length > 0 && (t.pivotTables = e);
4088
+ }
4089
+ };
4090
+ Q.push(e());
4091
+ } else if (n.type === o) {
4092
+ const e = M(i, t, H, F, At);
4093
+ if (e && 0 !== Object.keys(e).length) {
4094
+ const t = e, o = t.__bookRelId, s = t.__absoluteUrlRelId;
4095
+ delete t.__bookRelId, delete t.__absoluteUrlRelId;
4096
+ const n = [];
4097
+ st(i, r)?.forEach((t, e) => {
4098
+ if ("External" === t.targetMode && t.type && t.target) {
4099
+ const r = {
4100
+ type: t.type,
4101
+ target: t.target
4102
+ };
4103
+ e === o ? r.role = "book" : e === s && (r.role = "absoluteUrl"), n.push(r);
4104
+ }
4105
+ }), n.sort((t, e) => ("book" === t.role ? 0 : 1) - ("book" === e.role ? 0 : 1)), t.sources = n, et(i), u = t;
4106
+ } else u = null;
4107
+ } else u = s ? N(i, t, (t, e) => {
4108
+ const o = R.add({ source: { buffer: t } });
4109
+ return o.addReference(j), B.add(o), L.toResourceId(o);
4110
+ }, At) : M(i, t, H, F, At);
4111
+ }
4112
+ return u;
4113
+ }, at = (t, e) => {
4114
+ if (!t) return null;
4115
+ const o = st(e, J)?.get(t);
4116
+ if (!o?.target || "External" === o.targetMode) return null;
4117
+ let s = o.target;
4118
+ return s.startsWith("/") || (s = e.substring(0, e.lastIndexOf("/") + 1) + s), xt(s);
4119
+ }, ct = (t, e, o, s) => {
4120
+ const n = [], i = /* @__PURE__ */ new Map(), l = [];
4121
+ o.forEach((t, o) => {
4122
+ if ("http://schemas.microsoft.com/office/2017/10/relationships/threadedComment" !== t.type) return;
4123
+ const r = rt(o, e, !1, s)?.comments;
4124
+ if (!r) return;
4125
+ for (let t = 0; t < r.length; t++) {
4126
+ const e = r[t];
4127
+ if (!e?.v?.id) continue;
4128
+ const { parentId: o, done: s, content: a, ...c } = e.v, u = {
4129
+ ...c,
4130
+ content: tr(a)
4131
+ };
4132
+ o ? l.push({
4133
+ parentId: o,
4134
+ json: u
4135
+ }) : (s && (u.done = !0), i.set(u.id, u), n.push({
4136
+ r: e.r,
4137
+ v: u
4138
+ }));
4139
+ }
4140
+ const a = at(o, e);
4141
+ a && et(a);
4142
+ });
4143
+ for (let t = 0; t < l.length; t++) {
4144
+ const { parentId: e, json: o } = l[t], s = i.get(e);
4145
+ s && (s.replies ??= []).push(o);
4146
+ }
4147
+ const c = [];
4148
+ if (o.forEach((t, o) => {
4149
+ if ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" !== t.type) return;
4150
+ const r = rt(o, e, !1, s), n = r?.comments;
4151
+ if (!n) return;
4152
+ const a = r?.authors;
4153
+ for (let t = 0; t < n.length; t++) {
4154
+ const e = n[t];
4155
+ if (!e?.r) continue;
4156
+ let o = a && void 0 !== e.v.authorId ? a[e.v.authorId] : void 0;
4157
+ if (o && o.startsWith("tc=")) {
4158
+ if (i.has(W(o.substring(3)))) continue;
4159
+ o = void 0;
4160
+ }
4161
+ const s = {
4162
+ id: It.uuidV4().toUpperCase(),
4163
+ asNote: !0,
4164
+ content: e.v.content ?? ""
4165
+ }, r = o ? kt({ displayName: o }) : void 0;
4166
+ r && (s.personId = r.id), c.push({
4167
+ r: e.r,
4168
+ v: s
4169
+ });
4170
+ }
4171
+ const l = at(o, e);
4172
+ l && et(l);
4173
+ }), 0 === n.length && 0 === c.length) return;
4174
+ const u = [...n, ...c], h = t.legacyDrawing;
4175
+ if (h?.xml) {
4176
+ const { rest: e, notes: o } = a(h.xml);
4177
+ if (o.length > 0) {
4178
+ const s = /* @__PURE__ */ new Map();
4179
+ for (let t = 0; t < o.length; t++) {
4180
+ const e = o[t];
4181
+ s.set(Nt.cellToString({
4182
+ rowIndex: e.row,
4183
+ colIndex: e.col
4184
+ }), e);
4185
+ }
4186
+ for (let t = 0; t < u.length; t++) {
4187
+ const e = u[t], o = s.get(String(e.r).toUpperCase());
4188
+ if (!o) continue;
4189
+ if (s.delete(String(e.r).toUpperCase()), !e.v.asNote) continue;
4190
+ const r = A(o.xml), n = {};
4191
+ if (r.anchor) {
4192
+ const [t, e, s, i, a, l, c, u] = r.anchor;
4193
+ n.anchor = {
4194
+ tl: {
4195
+ c: t - o.col,
4196
+ x: e,
4197
+ r: s - o.row,
4198
+ y: i
4199
+ },
4200
+ br: {
4201
+ c: a - o.col,
4202
+ x: l,
4203
+ r: c - o.row,
4204
+ y: u
4205
+ }
4206
+ };
4207
+ } else r.bounds && (n.bounds = r.bounds);
4208
+ r.style.fill && (n.fill = r.style.fill), r.style.stroke && (n.stroke = r.style.stroke), r.xml && (n.xml = r.xml), (n.anchor || n.bounds || n.fill || n.stroke || n.xml) && (e.v.box = n), r.visible && (e.v.shown = !0), r.alt && (e.v.description = r.alt);
4209
+ }
4210
+ const n = [];
4211
+ s.forEach((t) => {
4212
+ n.push(t.xml);
4213
+ });
4214
+ const i = r(e, n);
4215
+ i ? h.xml = i : delete t.legacyDrawing;
4216
+ }
4217
+ }
4218
+ t.comments = u;
4219
+ }, ut = (e, o) => {
4220
+ const s = at(e, o);
4221
+ if (!s) return null;
4222
+ const r = t(Zs(s));
4223
+ if (!r) return null;
4224
+ const n = { xml: Cs(new TextDecoder("utf-8").decode(r.content)) }, i = [];
4225
+ return st(s, J)?.forEach((t, e) => {
4226
+ if ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" !== t.type) return;
4227
+ const o = rt(e, s, !0);
4228
+ "number" == typeof o && i.push({
4229
+ id: e,
4230
+ resId: o
4231
+ });
4232
+ }), i.length > 0 && (n.images = i), et(s), n;
4233
+ }, dt = (e, o) => {
4234
+ const s = at(e, o);
4235
+ if (!s) return null;
4236
+ const r = M(s, t, H, F, At)?.formControl ?? null;
4237
+ return r && et(s), r;
4238
+ }, ft = (o, s, r, n, i = /* @__PURE__ */ new Set()) => {
4239
+ const a = at(o, s);
4240
+ if (!a || i.has(a)) return null;
4241
+ const l = r ?? st(s, J)?.get(o)?.type;
4242
+ if (!l) return null;
4243
+ const c = t(Zs(a));
4244
+ if (!c) return null;
4245
+ i.add(a);
4246
+ const u = a.substring(a.lastIndexOf("/") + 1), h = e.overrides[Zs(a)] ?? e.defaults[u.substring(u.lastIndexOf(".") + 1).toLowerCase()], d = {
4247
+ id: o,
4248
+ type: l,
4249
+ name: u
4250
+ };
4251
+ if (h && (d.contentType = h), ((t, e) => t ? t.endsWith("+xml") || "application/xml" === t : /\.(xml|rels|vml)$/i.test(e))(h, u)) d.xml = new TextDecoder("utf-8").decode(c.content);
4252
+ else {
4253
+ const t = rt(o, s, !0);
4254
+ if ("number" != typeof t) return null;
4255
+ d.resId = t;
4256
+ }
4257
+ const p = [];
4258
+ return st(a, J)?.forEach((t, e) => {
4259
+ if (!t?.type) return;
4260
+ if (n && !n(t.type)) return;
4261
+ if ("External" === t.targetMode) {
4262
+ const o = rt(e, a, !0);
4263
+ "number" == typeof o && p.push({
4264
+ id: e,
4265
+ type: t.type,
4266
+ resId: o
4267
+ });
4268
+ return;
4269
+ }
4270
+ const o = ft(e, a, t.type, n, i);
4271
+ o && p.push(o);
4272
+ }), p.length > 0 && (d.parts = p), et(a), d;
4273
+ }, gt = w("coreprops", e, t, H, F, k), yt = w("extprops", e, t, H, F, k), Tt = w("custprops", e, t, H, F, k);
4274
+ Tt.forEach((t, e) => {
4275
+ t?.custom && et(e);
4276
+ });
4277
+ const St = new Gt(), Ct = w("people", e, t, H, F, k);
4278
+ if (Ct.size > 0) {
4279
+ const [t, e] = Ct.entries().next().value;
4280
+ St.fromJSON(e?.persons), et(t);
4281
+ }
4282
+ const kt = (t) => {
4283
+ if (t) return St.add(t).toJSON();
4284
+ }, At = {
4285
+ paramMap: X,
4286
+ getRefs: st,
4287
+ getRef: rt,
4288
+ parsedRefs: J,
4289
+ readEmbeddedPart: (t, e) => ft(t, e),
4290
+ addPerson: kt,
4291
+ serializeElement: U,
4292
+ onWarning: C
4293
+ }, _t = [], $t = /* @__PURE__ */ new Map();
4294
+ if (X.set(us, $t), s) {
4295
+ const t = await K.getTextStream(s, V);
4296
+ if (t) {
4297
+ const e = ((t, e) => {
4298
+ let o = !1, s = !1, r = 0, n = "";
4299
+ const i = new os();
4300
+ return {
4301
+ onOpenTag: (t) => {
4302
+ const e = es(t.name);
4303
+ "t" === e ? o && 0 === r && (s = !0) : "si" === e ? (o = !0, n = "", i.reset(), r = 0) : "rPh" === e || "phoneticPr" === e ? r++ : o && 0 === r && i.onOpenTag(e, t.attributes);
4304
+ },
4305
+ onText: (t) => {
4306
+ s && (n += t, i.onText(t));
4307
+ },
4308
+ onCloseTag: (e) => {
4309
+ const a = es(e.name);
4310
+ "t" === a ? s = !1 : "si" === a ? (t(l(n), i.take() ?? void 0), o = !1, n = "") : "rPh" === a || "phoneticPr" === a ? r > 0 && r-- : i.onCloseTag(a);
4311
+ },
4312
+ onError: (t) => {
4313
+ e?.(`Error parsing shared strings: ${t?.message ?? t}`);
4314
+ }
4315
+ };
4316
+ })((t, e) => {
4317
+ e && $t.set(_t.length, e), _t.push(t);
4318
+ }, (t) => {
4319
+ C(t, s);
4320
+ });
4321
+ try {
4322
+ await yo.parseStream(t, e, { xmlns: !1 });
4323
+ } catch (t) {
4324
+ throw new Error(`Error parsing shared strings: '${s}'`, { cause: t });
4325
+ }
4326
+ }
4327
+ }
4328
+ T?.mark("shared-strings");
4329
+ let Mt = _t.length;
4330
+ const Rt = /* @__PURE__ */ new Map();
4331
+ let Vt = Mt;
4332
+ const Bt = (t) => {
4333
+ const e = Rt.get(t);
4334
+ if (void 0 !== e) return e;
4335
+ const o = Vt;
4336
+ return Rt.set(t, Vt++), _t.push(t), o;
4337
+ }, Ft = [];
4338
+ e.slicersCache = Ft;
4339
+ const Ht = K.getNames(), Wt = Ht.length;
4340
+ for (let t = 0; t < Wt; t++) {
4341
+ const e = Ht[t];
4342
+ e && (e.startsWith("xl/slicerCache") || e.startsWith("xl/timelineCaches/") && e.endsWith(".xml")) && Ft.push(`/${e}`);
4343
+ }
4344
+ const zt = w("slicersCache", e, t, H, F, At), Xt = /* @__PURE__ */ new Map();
4345
+ zt.forEach((t, e) => {
4346
+ t?.cacheName && (t.cachePath = e, Xt.set(t.cacheName, t));
4347
+ }), X.set("slicerCaches", Xt);
4348
+ const qt = [];
4349
+ e.slicers = qt;
4350
+ for (let t = 0; t < Wt; t++) {
4351
+ const e = Ht[t];
4352
+ e && (e.startsWith("xl/slicers/") || e.startsWith("xl/timelines/")) && e.endsWith(".xml") && qt.push(`/${e}`);
4353
+ }
4354
+ const Ut = {
4355
+ getFile: t,
4356
+ domParser: H,
4357
+ getAddress: (t, e) => {
4358
+ const o = rt(e, t, !1);
4359
+ return "string" == typeof o ? o : null;
4360
+ },
4361
+ getBytes: (e, o) => {
4362
+ const s = at(o, e), r = s ? t(s.substring(1))?.content : void 0;
4363
+ return r ? r.slice().buffer : null;
4364
+ },
4365
+ addFetched: (t, e) => {
4366
+ const o = R.add({
4367
+ source: { buffer: t },
4368
+ fetchedFrom: e
4369
+ });
4370
+ return o.addReference(j), B.add(o), L.toResourceId(o);
4371
+ },
4372
+ markAbsorbed: et
4373
+ }, Jt = /* @__PURE__ */ new Map();
4374
+ for (const t of d.getAll()) Jt.set(t.structure, t.beginRead(Ut));
4375
+ const Zt = ((t, e) => {
4376
+ const o = (o) => {
4377
+ const s = t(o);
4378
+ return s ? e.parseFromString(new TextDecoder().decode(s.content), "text/xml").documentElement ?? null : null;
4379
+ }, s = ye(o(de), "s").map((t) => ({
4380
+ t: t.getAttribute("t") ?? "",
4381
+ keys: ve(t)
4382
+ })), r = ye(o(pe), "rv").map((t) => {
4383
+ const e = ye(t, "fb")[0];
4384
+ return {
4385
+ s: parseInt(t.getAttribute("s") ?? "-1", 10),
4386
+ values: ye(t, "v").map((t) => t.textContent ?? ""),
4387
+ fb: e ? e.textContent ?? "" : null
4388
+ };
4389
+ }), n = ye(o(fe), "a").map((t) => {
4390
+ const e = we(t), o = parseInt(t.getAttribute("r") ?? "", 10), s = parseInt(t.getAttribute("c") ?? "", 10), r = o > 0 ? o : e.length;
4391
+ return {
4392
+ rows: r,
4393
+ columns: s > 0 ? s : Math.max(1, Math.ceil(e.length / Math.max(1, r))),
4394
+ items: e
4395
+ };
4396
+ }), i = ye(o(ge), "s").map(ve), a = o(me), l = ye(ye(a, "spbArrays")[0], "a").map(we), c = ye(ye(a, "spbData")[0], "spb").map((t) => ({
4397
+ s: parseInt(t.getAttribute("s") ?? "-1", 10),
4398
+ values: ye(t, "v").map((t) => t.textContent ?? "")
4399
+ })), u = o(be), h = Te(ye(ye(u, "global")[0], "keyFlags")[0]), d = /* @__PURE__ */ new Map();
4400
+ for (const t of ye(ye(u, "types")[0], "type")) d.set(t.getAttribute("name") ?? "", Te(ye(t, "keyFlags")[0]));
4401
+ const p = o(xe), f = ye(ye(p, "dxfs")[0], "dxf").map((t) => ye(t, "numFmt")[0]?.getAttribute("formatCode") ?? null), g = ye(ye(p, "richProperties")[0], "rPr").map((t) => t.getAttribute("n") ?? "");
4402
+ return {
4403
+ structures: s,
4404
+ values: r,
4405
+ arrays: n,
4406
+ bagStructures: i,
4407
+ bagArrays: l,
4408
+ bags: c,
4409
+ globalKeyFlags: h,
4410
+ typeKeyFlags: d,
4411
+ richStyles: ye(ye(p, "richStyles")[0], "rSty").map((t) => {
4412
+ const e = /* @__PURE__ */ new Map();
4413
+ for (const o of ye(t, "rpv")) {
4414
+ const t = g[parseInt(o.getAttribute("i") ?? "-1", 10)];
4415
+ t && e.set(t, o.textContent ?? "");
4416
+ }
4417
+ const o = parseInt(t.getAttribute("dxfid") ?? "", 10);
4418
+ return {
4419
+ numberFormat: e.get("NumberFormat") ?? (o >= 0 ? f[o] ?? null : null),
4420
+ isTitle: "1" === e.get("IsTitleField"),
4421
+ isHero: "1" === e.get("IsHeroField")
4422
+ };
4423
+ })
4424
+ };
4425
+ })(t, H), Qt = p(Zt, Jt, (t) => {
4426
+ C(t, "/xl/richData/rdrichvalue.xml");
4427
+ });
4428
+ X.set("richData", Zt.values.map((t, e) => Qt.cellValue(e)));
4429
+ for (let t = 0; t < Wt; t++) {
4430
+ const e = Ht[t];
4431
+ e.startsWith("xl/richData/") && !e.includes("/_rels/") && et(e);
4432
+ }
4433
+ const te = w("themes", e, t, H, F, At);
4434
+ let oe = null;
4435
+ if (te && te.entries) {
4436
+ let t = te.entries().next();
4437
+ t?.value?.[1] && (oe = t.value[1]);
4438
+ }
4439
+ const se = new Yt(oe);
4440
+ let re = w("styles", e, t, H, F, At).entries().next()?.value?.[1];
4441
+ re && (re = JSON.parse(Et.JSONStableStringify(re)));
4442
+ const ne = w("workbooks", e, t, H, F, At);
4443
+ X.set(cs, !0 === ne.entries().next().value?.[1]?.date1904), "none" !== (g.calcOnLoad ?? h) && X.set(ls, ((t, e) => {
4444
+ const o = /* @__PURE__ */ new Set();
4445
+ if (t) for (let e = 0; e < t.length; e++) o.add(String(t[e]?.name).toUpperCase());
4446
+ if (e) for (let t = 0; t < e.length; t++) try {
4447
+ const s = e[t](() => {
4448
+ throw new Error("Not evaluating.");
4449
+ }, (t, e, s, r) => {
4450
+ for (const t of Object.keys(r)) o.add(t.toUpperCase());
4451
+ }, /* @__PURE__ */ new Map());
4452
+ for (const t of s.keys()) o.add(t.toUpperCase());
4453
+ } catch {}
4454
+ return (t) => o.has(t) || Lt.has(t);
4455
+ })(ne.entries().next().value?.[1]?.names, g.functions)), T?.mark("side-parts-json"), await Promise.all(Q);
4456
+ {
4457
+ const t = ne.entries().next().value?.[1], e = u(t?.names), o = t?.sheets ?? [];
4458
+ for (let t = 0; t < o.length; t++) {
4459
+ const s = o[t], r = i(s);
4460
+ if ("macro" === s?.kind && r?.part.xml) {
4461
+ r.part.xml = E(r.part.xml, _t);
4462
+ continue;
4463
+ }
4464
+ const n = b(s);
4465
+ n && f(n, e);
4466
+ }
4467
+ const s = t?.names;
4468
+ if (s) for (let t = 0; t < s.length; t++) {
4469
+ const o = s[t]?.ref;
4470
+ "string" == typeof o && (s[t].ref = e.readDetached(o));
4471
+ }
4472
+ }
4473
+ P && $ > 0 && (P(D, D), await new Promise((t) => setTimeout(t, 0))), T?.mark("sheets");
4474
+ const ie = {
4475
+ ...ne.entries().next().value?.[1],
4476
+ styles: re,
4477
+ theme: se.toJSON()
4478
+ }, ae = ((t, e, o, s) => {
4479
+ const r = {}, n = (t, e) => {
4480
+ if (t) for (const { key: o, value: s } of t) {
4481
+ const t = e[o];
4482
+ if (t && s) if ("revisionNumber" === t) {
4483
+ const t = parseInt(s, 10);
4484
+ Number.isFinite(t) && (r.revisionNumber = t);
4485
+ } else r[t] = s;
4486
+ }
4487
+ };
4488
+ if (n(t, ks), n(e, As), o) {
4489
+ const t = [];
4490
+ for (const e of o) {
4491
+ const o = Is(e);
4492
+ o ? t.push(o) : s?.(`The custom document property '${e.key}' holds a value of a kind that is not read (${e.kind ? "vt:" + e.kind : "none"}); it was dropped.`, "xlsx.docProps.custom.kind");
4493
+ }
4494
+ t.length > 0 && (r.custom = t);
4495
+ }
4496
+ return Object.keys(r).length > 0 ? r : void 0;
4497
+ })(gt.values().next().value?.properties, yt.values().next().value?.properties, Tt.values().next().value?.custom, (t, e) => {
4498
+ C(t, "docProps/custom.xml", e);
4499
+ });
4500
+ ae && (ie.properties = ae), ((t, e) => {
4501
+ if (!e || 0 === e.size) return;
4502
+ const o = t.styles;
4503
+ if (!o) return;
4504
+ const s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
4505
+ for (const o of t.sheets ?? []) {
4506
+ const t = b(o);
4507
+ if (!t) continue;
4508
+ const n = /* @__PURE__ */ new Set();
4509
+ Ds(t.cols) || n.add(0);
4510
+ for (const e of t.directStyles ?? []) n.add(Array.isArray(e) ? e[1] : e.v);
4511
+ for (const e of t.rows ?? []) {
4512
+ const t = Os(e);
4513
+ void 0 !== t && n.add(t);
4514
+ }
4515
+ for (const e of t.cols ?? []) {
4516
+ const t = Os(e);
4517
+ void 0 !== t && n.add(t);
4518
+ }
4519
+ let i = !1;
4520
+ for (const t of n) if (e.has(t)) {
4521
+ i = !0;
4522
+ break;
4523
+ }
4524
+ if (i) {
4525
+ t.protection = {
4526
+ ...t.protection ?? { sheet: !0 },
4527
+ showFormulas: !1
4528
+ };
4529
+ for (const t of n) (e.has(t) ? r : s).add(t);
4530
+ }
4531
+ }
4532
+ if (0 === s.size) return;
4533
+ const n = o.direct ?? (o.direct = []);
4534
+ for (const t of s) 0 !== t && Ns(n[t] ?? (n[t] = {}), !0);
4535
+ for (const t of r) 0 !== t && Ns(n[t] ?? (n[t] = {}), !1);
4536
+ if (s.has(0)) {
4537
+ const t = o.named ?? (o.named = []), e = jt.BuiltInName.Normal.toLowerCase();
4538
+ let s = t.find((t) => t.name?.toLowerCase() === e);
4539
+ s || (s = {
4540
+ name: jt.BuiltInName.Normal,
4541
+ style: {}
4542
+ }, t.push(s)), Ns(s.style, !0);
4543
+ }
4544
+ })(ie, X.get(Ps)), ((t, e) => {
4545
+ if (e && 0 !== e.size) for (const o of t.sheets ?? []) {
4546
+ const t = b(o), s = t?.pivotTables;
4547
+ if (!t || !s || 0 === s.length) continue;
4548
+ const r = s.map(lt), n = s.map(() => []);
4549
+ for (const [o, s] of t.directStyles ?? []) {
4550
+ if (!e.has(s)) continue;
4551
+ const t = Nt.fastStringToRange(o);
4552
+ for (let e = 0; e < r.length; e++) {
4553
+ const o = r[e];
4554
+ if (!o) continue;
4555
+ const s = Math.max(t.rowStart, o.rowStart), i = Math.min(t.rowEnd, o.rowEnd), a = Math.max(t.colStart, o.colStart), l = Math.min(t.colEnd, o.colEnd);
4556
+ if (s > i || a > l) continue;
4557
+ const c = Nt.rangeToString({
4558
+ rowStart: s - o.rowStart,
4559
+ rowEnd: i - o.rowStart,
4560
+ colStart: a - o.colStart,
4561
+ colEnd: l - o.colStart
4562
+ });
4563
+ c && n[e].push(c);
4564
+ }
4565
+ }
4566
+ for (let t = 0; t < s.length; t++) n[t].length > 0 && (s[t].buttons = n[t]);
4567
+ }
4568
+ })(ie, X.get(_s));
4569
+ const ce = X.get(Xs);
4570
+ if ($s(ie, ce), ((t) => {
4571
+ const e = {
4572
+ colStart: 0,
4573
+ rowStart: 0,
4574
+ colEnd: ot,
4575
+ rowEnd: vt
4576
+ };
4577
+ for (const o of t.sheets ?? []) {
4578
+ const t = b(o);
4579
+ if (!t) continue;
4580
+ const s = [];
4581
+ if (Gs(t.cols, !0, e, s), Gs(t.rows, !1, e, s), 0 === s.length) continue;
4582
+ const r = [];
4583
+ for (const [e, o] of t.directStyles ?? []) r.push({
4584
+ ...Nt.fastStringToRange(e),
4585
+ value: {
4586
+ kind: 0,
4587
+ index: o
4588
+ }
4589
+ });
4590
+ r.push(...s);
4591
+ const n = [], i = new Ot.IteratorInstance(r, { axis: Dt.Column });
4592
+ for (let t = i.next(); !t.done; t = i.next()) {
4593
+ const o = t.value.overlaps;
4594
+ let s;
4595
+ if (1 === o.length) {
4596
+ if (s = o[0].value, 0 === s.index) continue;
4597
+ } else {
4598
+ let t, e, r;
4599
+ for (let s = 0; !t && s < o.length; s++) {
4600
+ const n = o[s].value;
4601
+ 0 === n.kind ? t = n : 1 === n.kind ? e = n : r = n;
4602
+ }
4603
+ s = t ?? e ?? r;
4604
+ }
4605
+ n.push([Nt.rangeToString(t.value.range, e), s.index]);
4606
+ }
4607
+ n.length > 0 ? t.directStyles = n : delete t.directStyles;
4608
+ }
4609
+ })(ie), ce) ((t, e, o) => {
4610
+ if (!e || 0 === e.size || !o) return;
4611
+ const s = (t) => {
4612
+ if (void 0 === t || 0 === t) return null;
4613
+ const s = e.get(t);
4614
+ return void 0 !== s ? o.controls[s] ?? null : null;
4615
+ };
4616
+ for (const e of t.sheets ?? []) {
4617
+ const t = b(e);
4618
+ if (!t) continue;
4619
+ const o = /* @__PURE__ */ new Map();
4620
+ for (const e of t.directStyles ?? []) {
4621
+ const t = Array.isArray(e) ? e[0] : e.r, r = s(Array.isArray(e) ? e[1] : e.v);
4622
+ if (!r) continue;
4623
+ const n = JSON.stringify(r);
4624
+ let i = o.get(n);
4625
+ i || (i = {
4626
+ control: r,
4627
+ addresses: []
4628
+ }, o.set(n, i)), qs(t, i.addresses);
4629
+ }
4630
+ if (0 === o.size) continue;
4631
+ const r = [...t.cellControls ?? []];
4632
+ for (const { control: t, addresses: e } of o.values()) r.push({
4633
+ r: e.join(","),
4634
+ v: t
4635
+ });
4636
+ t.cellControls = r;
4637
+ }
4638
+ })(ie, ce, w("featurePropertyBag", e, t, H, F, At).values().next().value?.featurePropertyBag);
4639
+ {
4640
+ const o = /* @__PURE__ */ new Map();
4641
+ w("slicers", e, t, H, F, At).forEach((t, e) => {
4642
+ t?.slicers && o.set(e, t.slicers);
4643
+ }), le(ie, {
4644
+ warn: (t, e) => {
4645
+ C(t, "xl/slicers", e);
4646
+ },
4647
+ markAbsorbed: et,
4648
+ slicerParts: o
4649
+ });
4650
+ }
4651
+ ie.calc = {
4652
+ ...ie.calc ?? {},
4653
+ legacyIntersect: !0
4654
+ }, _t.length > 0 && (ie.strings = _t);
4655
+ const ue = St.toJSON();
4656
+ ue && ue.length > 0 && (ie.people = ue);
4657
+ const he = K.getEntry("xl/vbaProject.bin");
4658
+ if (he) try {
4659
+ const { VBAProject: t } = await import("./zZFe3mW0xjmobowq.mjs"), e = t.extract(he);
4660
+ if (e) {
4661
+ const o = /* @__PURE__ */ new Map();
4662
+ for (const t of ie.sheets ?? []) {
4663
+ const e = b(t), s = e?.codeName;
4664
+ s && o.set(s, e);
4665
+ }
4666
+ for (const s of e.modules) {
4667
+ const e = { language: "vba" }, { header: r, body: n } = t.splitAttributes(s.code);
4668
+ n && (e.source = n), r && (e.sourceHeader = r);
4669
+ const i = "document" === s.type ? o.get(s.name) : void 0;
4670
+ i || "document" !== s.type || (e.scope = "workbook");
4671
+ const a = i ? i.modules ??= {} : ie.modules ??= {};
4672
+ a[s.name] || (a[s.name] = e);
4673
+ }
4674
+ n?.(e);
4675
+ } else S.push(["Unable to parse VBA project.", "xl/vbaProject.bin"]);
4676
+ } catch (t) {
4677
+ S.push([`Error extracting VBA: ${t?.message ?? t}`, "xl/vbaProject.bin"]);
4678
+ }
4679
+ const Se = X.get("calcId"), Ce = void 0 === Se || !(Number(Se) >= 191029), ke = g.calcOnLoad ?? ("auto" === h && Ce ? "full" : h), Ae = {
4680
+ ...g,
4681
+ calcOnLoad: ke,
4682
+ resources: R,
4683
+ json: ie
4684
+ };
4685
+ if (void 0 === Ae.disableLoadAutoFit) {
4686
+ const t = X.get(mt);
4687
+ Ae.disableLoadAutoFit = !!t?.declared && t.normalIsThemeFont && await nt(t.faces);
4688
+ }
4689
+ T?.mark("json-assembled");
4690
+ const Ee = new ee(Ae);
4691
+ if (T?.mark("workbook-constructed"), B.forEach((t) => {
4692
+ t.deleteReference(j);
4693
+ }), L.endPersist(), y) {
4694
+ x(Ee);
4695
+ const t = /* @__PURE__ */ new Map();
4696
+ let e = 0;
4697
+ for (const o of K.getNames()) {
4698
+ const s = K.getEntry(o);
4699
+ if (!s) continue;
4700
+ const r = K.getRawEntry(o), n = r ? {
4701
+ data: s,
4702
+ uncompressedSize: K.uncompressedSize(o),
4703
+ raw: {
4704
+ compressedData: r.data,
4705
+ compressionMethod: r.compressionMethod,
4706
+ signature: r.signature
4707
+ }
4708
+ } : {
4709
+ data: s,
4710
+ uncompressedSize: K.uncompressedSize(o)
4711
+ };
4712
+ t.set(o, n), e += s.byteLength;
4713
+ }
4714
+ if (e > 67108864) S.push([`Source package too large to retain (${e} bytes, limit ${o}); unmodeled parts will be dropped on save.`, "SourcePackage"]);
4715
+ else if (t.size > 0) {
4716
+ const e = new tt(t, Y);
4717
+ v(Ee, e);
4718
+ let o = Ee.getWorksheets().getItems();
4719
+ const s = Ee.getTransactions().addListener({ onCommitEnd: (t) => {
4720
+ const o = t.getOperation()?.name;
4721
+ "insertCells" !== o && "deleteCells" !== o || e.markStructuralChange();
4722
+ } }), r = Ee.addListeners({ onSheetsChange: () => {
4723
+ const t = Ee.getWorksheets().getItems();
4724
+ (t.length !== o.length || t.some((t, e) => t !== o[e])) && e.markStructuralChange(), o = t;
4725
+ } });
4726
+ Ee.addListeners({ onClose: () => {
4727
+ s(), r(), x(Ee);
4728
+ } });
4729
+ }
4730
+ }
4731
+ if (S.length && I?.onWarning) {
4732
+ const t = /* @__PURE__ */ new Set();
4733
+ for (const e of S) {
4734
+ const [o, s, r] = e, n = r ?? o;
4735
+ t.has(n) || (t.add(n), I.onWarning(o, s));
4736
+ }
4737
+ }
4738
+ return T && !0 === c && console.table(T.toTable()), await Ee.whenFontsReady(), Ee;
4739
+ } catch (t) {
4740
+ let e = "Unable to parse XLSX.";
4741
+ throw t instanceof Ut && (e = "Unable to open XLSX. There are too many rows or columns."), new Error(e, { cause: t });
4742
+ } finally {
4743
+ await K.close().catch(() => {});
4744
+ }
4745
+ };
4746
+ export { hs as a, Ps as i, Xs as n, _s as r, er as readXLSX, Js as t };