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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/LICENSE.md +8 -7
  2. package/browser/esm/Bw35-W8cnzxxvqQy.mjs +104 -0
  3. package/browser/esm/{CMHb6pUUmsCP9r_9.mjs → C16bEh6IrUpJONhS.mjs} +3 -3
  4. package/browser/esm/CPK1-z95jtLOfCXG.mjs +2474 -0
  5. package/browser/esm/CSOuRlSN9bhykqDr.mjs +4627 -0
  6. package/browser/esm/{DhqYgh9G2vLn7mIE.mjs → D2872f7aTugYxhht.mjs} +3 -3
  7. package/browser/esm/D7ogsrtXfjU5NW7r.mjs +10312 -0
  8. package/browser/esm/D8CQKL3Y3CMFOPqD.mjs +7007 -0
  9. package/browser/esm/{CMzkLUwbgA73RvCb.mjs → DpPFQ7-tBwVyjvWr.mjs} +3 -3
  10. package/browser/esm/{IZf0hIeLYj3T0Xvu.mjs → PgUWs0pPSCSFYJtU.mjs} +194 -144
  11. package/browser/esm/RFSuXvJ9sgsaA2LC.mjs +2433 -0
  12. package/browser/esm/{_UDbQq5-pHbU1f82.mjs → S4Uq85YdUb6O5Pz0.mjs} +2 -2
  13. package/browser/esm/index.mjs +3 -4
  14. package/licenses/dependencies.txt +2 -2
  15. package/node/esm/BOAucs-qLpjtUOcZ.mjs +6957 -0
  16. package/node/esm/{CY-pSutJLHskZfXZ.mjs → BSHqfcsR9hY-JB30.mjs} +2 -2
  17. package/node/esm/{CB1ijGbhl-e2l6Mm.mjs → C6eSWtTkyDQKbQdT.mjs} +3 -3
  18. package/node/esm/{Bi_kZVtZams7taqa.mjs → CPhiu1T7tl-leKh2.mjs} +3 -3
  19. package/node/esm/D2vDZOgLcv-YiWnB.mjs +4741 -0
  20. package/node/esm/DFw0ibBUmPyd-wey.mjs +2479 -0
  21. package/node/esm/DGuQIj077oygCTGu.mjs +2562 -0
  22. package/node/esm/Qn2Bv4QG3mOLiJHh.mjs +7269 -0
  23. package/node/esm/index.mjs +65 -28
  24. package/package.json +8 -9
  25. package/types/src/AutoFilterRules.d.ts +85 -22
  26. package/types/src/ConditionalFormatRules.d.ts +2 -2
  27. package/types/src/DataTableFormula.d.ts +26 -0
  28. package/types/src/DataValidationRules.d.ts +0 -5
  29. package/types/src/DefinedNameAttributes.d.ts +8 -0
  30. package/types/src/ExcelCalcStamp.d.ts +0 -36
  31. package/types/src/ExcelCompat.d.ts +15 -143
  32. package/types/src/ExcelFunctionFacts.d.ts +0 -272
  33. package/types/src/ExcelReservedNames.d.ts +0 -65
  34. package/types/src/KnownFonts.d.ts +37 -0
  35. package/types/src/LegacyFormula.d.ts +1 -46
  36. package/types/src/OOXMLExtensions.d.ts +30 -2
  37. package/types/src/PageLayoutAttributes.d.ts +8 -0
  38. package/types/src/Plugin.d.ts +15 -3
  39. package/types/src/ProtectionAttributes.d.ts +2 -2
  40. package/types/src/SheetKinds.d.ts +42 -0
  41. package/types/src/SheetViewAttributes.d.ts +4 -0
  42. package/types/src/SortExtent.d.ts +16 -0
  43. package/types/src/SourcePackage.d.ts +0 -44
  44. package/types/src/SparklineGroups.d.ts +52 -0
  45. package/types/src/Types.d.ts +13 -3
  46. package/types/src/XlsxHeader.d.ts +19 -0
  47. package/types/src/chart/ChartExXml.d.ts +38 -0
  48. package/types/src/chart/ChartPartXml.d.ts +47 -0
  49. package/types/src/chart/ChartSpaceXml.d.ts +37 -0
  50. package/types/src/chart/_XmlTree.d.ts +34 -0
  51. package/types/src/chart/_chartCodecs.d.ts +12 -0
  52. package/types/src/chart/_chartExCodecs.d.ts +7 -0
  53. package/types/src/chart/_chartExFold.d.ts +14 -0
  54. package/types/src/chart/_chartExMarkup.d.ts +236 -0
  55. package/types/src/chart/_chartExStyle.d.ts +13 -0
  56. package/types/src/chart/_codec.d.ts +78 -0
  57. package/types/src/chart/_drawingml.d.ts +10 -0
  58. package/types/src/chart/_xml.d.ts +70 -0
  59. package/types/src/pivot/PivotArea.d.ts +20 -0
  60. package/types/src/pivot/PivotCacheRead.d.ts +30 -0
  61. package/types/src/pivot/PivotCacheWrite.d.ts +23 -0
  62. package/types/src/pivot/PivotFilters.d.ts +29 -0
  63. package/types/src/pivot/PivotFormats.d.ts +60 -0
  64. package/types/src/pivot/PivotTableRead.d.ts +44 -0
  65. package/types/src/pivot/PivotTableWrite.d.ts +13 -0
  66. package/types/src/pivot/_PivotCacheXml.d.ts +48 -0
  67. package/types/src/pivot/_PivotTableXml.d.ts +23 -0
  68. package/types/src/reader/CellControls.d.ts +18 -0
  69. package/types/src/reader/DocumentPropertiesRead.d.ts +16 -0
  70. package/types/src/reader/DummyFunctionUnwrap.d.ts +43 -23
  71. package/types/src/reader/HeaderStyles.d.ts +15 -0
  72. package/types/src/reader/IsoDateCell.d.ts +20 -0
  73. package/types/src/reader/LibreOfficeDataTable.d.ts +12 -0
  74. package/types/src/reader/PivotButtons.d.ts +14 -0
  75. package/types/src/reader/PivotCellFormats.d.ts +22 -0
  76. package/types/src/reader/SlicerJoin.d.ts +26 -0
  77. package/types/src/reader/ZipReader.d.ts +1 -1
  78. package/types/src/reader/_SlicerRecord.d.ts +59 -0
  79. package/types/src/reader/dom/CustGeomUtils.d.ts +7 -0
  80. package/types/src/reader/dom/DOMTransformer.d.ts +2 -2
  81. package/types/src/reader/domVisitors/AppPropertiesVisitor.d.ts +13 -1
  82. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +8 -3
  83. package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +15 -2
  84. package/types/src/reader/domVisitors/CommentVisitor.d.ts +7 -2
  85. package/types/src/reader/domVisitors/DrawingCxnSpVisitor.d.ts +1 -0
  86. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +34 -1
  87. package/types/src/reader/domVisitors/DrawingGraphicFrameVisitor.d.ts +9 -0
  88. package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +14 -2
  89. package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +30 -2
  90. package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +20 -1
  91. package/types/src/reader/domVisitors/DrawingVisitor.d.ts +10 -0
  92. package/types/src/reader/domVisitors/ExternalLinkVisitor.d.ts +1 -11
  93. package/types/src/reader/domVisitors/FeaturePropertyBagVisitor.d.ts +18 -0
  94. package/types/src/reader/domVisitors/FmtSchemeVisitor.d.ts +0 -11
  95. package/types/src/reader/domVisitors/FontSchemeVisitor.d.ts +3 -2
  96. package/types/src/reader/domVisitors/FormControlPrVisitor.d.ts +9 -0
  97. package/types/src/reader/domVisitors/ObjectDefaultsVisitor.d.ts +11 -0
  98. package/types/src/reader/domVisitors/ShapeTextVisitor.d.ts +44 -0
  99. package/types/src/reader/domVisitors/SheetColorContainerVisitor.d.ts +2 -2
  100. package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +26 -5
  101. package/types/src/reader/domVisitors/SlicerCacheDefinitionVisitor.d.ts +11 -2
  102. package/types/src/reader/domVisitors/SlicersVisitor.d.ts +9 -3
  103. package/types/src/reader/domVisitors/SortStateVisitor.d.ts +2 -2
  104. package/types/src/reader/domVisitors/TextPropertiesVisitor.d.ts +13 -1
  105. package/types/src/reader/domVisitors/ThreadedCommentVisitor.d.ts +9 -0
  106. package/types/src/reader/domVisitors/ThreadedCommentsVisitor.d.ts +2 -2
  107. package/types/src/reader/domVisitors/TimelinesVisitor.d.ts +13 -0
  108. package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +0 -9
  109. package/types/src/reader/domVisitors/_Dxfs.d.ts +10 -0
  110. package/types/src/reader/domVisitors/index.d.ts +10 -36
  111. package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +1 -0
  112. package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +31 -6
  113. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +26 -8
  114. package/types/src/richValue/ErrorRichValueHandler.d.ts +22 -0
  115. package/types/src/richValue/IRichValueHandler.d.ts +109 -0
  116. package/types/src/richValue/LocalImageRichValueHandler.d.ts +18 -0
  117. package/types/src/richValue/RichDataParts.d.ts +69 -0
  118. package/types/src/richValue/RichRecordWriter.d.ts +61 -0
  119. package/types/src/richValue/RichValueHandlers.d.ts +25 -0
  120. package/types/src/richValue/RichValueResolver.d.ts +54 -0
  121. package/types/src/richValue/WebImageRichValueHandler.d.ts +37 -0
  122. package/types/src/richValue/index.d.ts +7 -0
  123. package/types/src/utils/DrawingMLText.d.ts +39 -0
  124. package/types/src/utils/FormControls.d.ts +170 -0
  125. package/types/src/utils/SharedNames.d.ts +13 -0
  126. package/types/src/utils/SpreadsheetFont.d.ts +38 -0
  127. package/types/src/utils/VmlNoteShapes.d.ts +88 -35
  128. package/types/src/utils/VmlNoteStyle.d.ts +25 -0
  129. package/types/src/utils/VmlPrefixes.d.ts +24 -0
  130. package/types/src/vba/VBAProject.d.ts +0 -19
  131. package/types/src/writer/EvaluationSheet.d.ts +5 -0
  132. package/types/src/writer/builder/Emitter.d.ts +5 -0
  133. package/types/src/writer/builder/OpcXmlUtils.d.ts +0 -8
  134. package/types/src/writer/builder/PackageBuilder.d.ts +4 -41
  135. package/types/src/writer/builder/Types.d.ts +28 -28
  136. package/types/src/writer/emitters/CommentsEmitter.d.ts +10 -4
  137. package/types/src/writer/emitters/DrawingEmitter.d.ts +2 -2
  138. package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +0 -11
  139. package/types/src/writer/emitters/FeaturePropertyBagEmitter.d.ts +8 -0
  140. package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +4 -4
  141. package/types/src/writer/emitters/PivotTableEmitter.d.ts +30 -1
  142. package/types/src/writer/emitters/PropsCoreEmitter.d.ts +7 -2
  143. package/types/src/writer/emitters/PropsCustomEmitter.d.ts +15 -0
  144. package/types/src/writer/emitters/RichValuePartsEmitters.d.ts +36 -0
  145. package/types/src/writer/emitters/RichValueRelEmitter.d.ts +12 -0
  146. package/types/src/writer/emitters/RichValueStructureEmitter.d.ts +4 -3
  147. package/types/src/writer/emitters/RichValueTypesEmitter.d.ts +3 -2
  148. package/types/src/writer/emitters/RichValueWebImageEmitter.d.ts +24 -0
  149. package/types/src/writer/emitters/SharedStringsEmitter.d.ts +6 -3
  150. package/types/src/writer/emitters/SlicerEmitter.d.ts +132 -0
  151. package/types/src/writer/emitters/StylesEmitter.d.ts +35 -2
  152. package/types/src/writer/emitters/TableEmitter.d.ts +14 -0
  153. package/types/src/writer/emitters/ThreadedCommentsEmitter.d.ts +7 -1
  154. package/types/src/writer/emitters/WorkbookEmitter.d.ts +24 -2
  155. package/types/src/writer/emitters/WorksheetEmitter.d.ts +4 -3
  156. package/types/src/writer/utils/AutoFilter.d.ts +3 -3
  157. package/types/src/writer/utils/CellControlComplements.d.ts +29 -0
  158. package/types/src/writer/utils/CustGeomUtils.d.ts +5 -0
  159. package/types/src/writer/utils/DateSystem.d.ts +6 -0
  160. package/types/src/writer/utils/DefaultRows.d.ts +22 -0
  161. package/types/src/writer/utils/DrawMLUtils.d.ts +42 -3
  162. package/types/src/writer/utils/DummyFunction.d.ts +0 -25
  163. package/types/src/writer/utils/DxfCollector.d.ts +14 -11
  164. package/types/src/writer/utils/PrstGeomUtils.d.ts +6 -0
  165. package/types/src/writer/utils/RichValueCollector.d.ts +81 -129
  166. package/types/src/writer/utils/SheetStyleLayout.d.ts +86 -0
  167. package/types/src/writer/utils/TextUtils.d.ts +26 -2
  168. package/types/src/writer/utils/UnsupportedFunctions.d.ts +2 -2
  169. package/types/src/writer/utils/XfVariants.d.ts +61 -0
  170. package/browser/cjs/B6sirGz6w-Bm7Ofo.cjs +0 -1
  171. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  172. package/browser/cjs/BzOEBR0jaxXg9wvt.cjs +0 -5
  173. package/browser/cjs/C8oC1tPbhgR0Dqtx.cjs +0 -2
  174. package/browser/cjs/CIpMN7SDVREKQUQE.cjs +0 -6
  175. package/browser/cjs/Ca-xJDjg5bOpUPXX.cjs +0 -1
  176. package/browser/cjs/D3EWCPfCu-qMOIGd.cjs +0 -1
  177. package/browser/cjs/DULsYP_GcPGLVYSE.cjs +0 -11
  178. package/browser/cjs/DtBN3UOzNJjYBwJ6.cjs +0 -1
  179. package/browser/cjs/index.cjs +0 -1
  180. package/browser/cjs/sNZR19Wk-XQ2xZ9E.cjs +0 -1
  181. package/browser/cjs/xQ6-wbTw5UzZUM1Y.cjs +0 -1
  182. package/browser/esm/B9q618XELV7uWJsA.mjs +0 -67
  183. package/browser/esm/BwbMurFOptAFs7gC.mjs +0 -5214
  184. package/browser/esm/D75_rfogFUfXADKc.mjs +0 -3324
  185. package/browser/esm/DfuBawaydlvgZMR-.mjs +0 -4428
  186. package/browser/esm/DoMlKUCnMSlR2qX5.mjs +0 -159
  187. package/browser/esm/DtpWa7tZahylJ3HS.mjs +0 -2310
  188. package/node/esm/BD03jrMQ_UKA196-.mjs +0 -4535
  189. package/node/esm/BxHvzSROx_N_7nJH.mjs +0 -2356
  190. package/node/esm/CO1M1H1N6fB422K-.mjs +0 -2959
  191. package/node/esm/CWpezSa6TERGEv-B.mjs +0 -3410
  192. package/node/esm/Dezt2uIDqlxjiuk5.mjs +0 -170
  193. package/types/src/legacyChart/OOXMLMappings.d.ts +0 -8
  194. package/types/src/legacyChart/OOXMLUtils.d.ts +0 -78
  195. package/types/src/legacyChart/ToOOXMLConverter.d.ts +0 -30
  196. package/types/src/reader/domVisitors/AxisVisitor.d.ts +0 -12
  197. package/types/src/reader/domVisitors/BarChartTypeVisitor.d.ts +0 -6
  198. package/types/src/reader/domVisitors/ChartSpaceVisitor.d.ts +0 -6
  199. package/types/src/reader/domVisitors/ChartTypeVisitor.d.ts +0 -7
  200. package/types/src/reader/domVisitors/ChartVisitor.d.ts +0 -7
  201. package/types/src/reader/domVisitors/DataLabelsVisitor.d.ts +0 -8
  202. package/types/src/reader/domVisitors/DataPointVisitor.d.ts +0 -6
  203. package/types/src/reader/domVisitors/HyperlinkVisitor.d.ts +0 -6
  204. package/types/src/reader/domVisitors/LayoutVisitor.d.ts +0 -5
  205. package/types/src/reader/domVisitors/LegendEntryVisitor.d.ts +0 -5
  206. package/types/src/reader/domVisitors/LegendVisitor.d.ts +0 -5
  207. package/types/src/reader/domVisitors/MarkerVisitor.d.ts +0 -5
  208. package/types/src/reader/domVisitors/NegativeShapeVisitor.d.ts +0 -6
  209. package/types/src/reader/domVisitors/PlotAreaVisitor.d.ts +0 -5
  210. package/types/src/reader/domVisitors/RichValueDataVisitor.d.ts +0 -7
  211. package/types/src/reader/domVisitors/RichValueStructureVisitor.d.ts +0 -6
  212. package/types/src/reader/domVisitors/SeriesVisitor.d.ts +0 -8
  213. package/types/src/reader/domVisitors/TitleVisitor.d.ts +0 -9
  214. package/types/src/writer/emitters/ChartColorsEmitter.d.ts +0 -7
  215. package/types/src/writer/emitters/ChartEmitter.d.ts +0 -14
  216. package/types/src/writer/emitters/ChartStyleEmitter.d.ts +0 -46
  217. package/types/src/writer/utils/HiddenFormulaXfs.d.ts +0 -28
@@ -0,0 +1,4741 @@
1
+ /**
2
+ * @license @sheetxl/io-xlsx - SheetXL - Import/Export from/to Excel - v0.8.0-beta.20
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 k, St as C, 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 R, _ as M, _t as L, ar as V, 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 kt, yn as Ct, yr as At } from "./BOAucs-qLpjtUOcZ.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 Rt, FormulaError as Mt, FormulaText as Lt, FunctionDeclarations as Vt, 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, Lt.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), ke = 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
+ }, Ce = 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 Re = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", Me = `-${Re}.0-9·̀-ͯ‿-⁀`;
256
+ new RegExp(`^[${Re}]$`, "u"), new RegExp(`^[${Me}]$`, "u"), new RegExp(`^[${Re}][${Me}]*$`, "u"), new RegExp(`^[${Me}]+$`, "u");
257
+ var Le = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", Ve = `-${Le}.0-9·̀-ͯ‿-⁀`, je = (new RegExp(`^[${Le}]$`, "u"), new RegExp(`^[${Ve}]$`, "u"), new RegExp(`^[${Le}][${Ve}]*$`, "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
+ }, ko = /&(#x[0-9a-fA-F]+|#[0-9]+|amp|lt|gt|quot|apos);/g, Co = {
1039
+ amp: "&",
1040
+ lt: "<",
1041
+ gt: ">",
1042
+ quot: "\"",
1043
+ apos: "'"
1044
+ }, Ao = (t, e) => {
1045
+ const o = Co[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(ko, 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(ko, 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, Ro = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), Mo = (t) => Ro(t).replace(/"/g, "&quot;"), Lo = 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}="${Mo("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(Ro(t)) : c?.text?.(t, x);
1439
+ },
1440
+ onEnd: e
1441
+ };
1442
+ }
1443
+ }, Vo = `IFERROR(${S}(`, jo = Vo.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 = kt(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
+ C(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 Lo(), 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) => {
1776
+ const e = t.conditions ?? [], o = [];
1777
+ for (let t = 0; t < e.length; t++) {
1778
+ const s = e[t], r = {};
1779
+ s.type && (r.type = s.type), void 0 !== s.value && (r.value = s.value), s.exclusive && (r.exclusive = !0), o.push(r);
1780
+ }
1781
+ return o;
1782
+ };
1783
+ d.registerVisitor({
1784
+ from: "colorScale",
1785
+ to: {},
1786
+ openTag: (t) => {},
1787
+ closeTag: (t) => {
1788
+ const e = t.getSource(), o = e.colors ?? [], s = T(e);
1789
+ for (let t = 0; t < s.length; t++) s[t].color = o[t];
1790
+ t.getParent().scale = {
1791
+ type: Ft.ScaleType.ColorScale,
1792
+ stops: s
1793
+ };
1794
+ }
1795
+ }), d.registerVisitor({
1796
+ from: "dataBar",
1797
+ to: {},
1798
+ openTag: (t) => {
1799
+ t.copyTo("maxLength", No), t.copyTo("minLength", No), t.copyTo("showValue", Do);
1800
+ },
1801
+ closeTag: (t) => {
1802
+ const e = t.getSource(), o = {
1803
+ type: Ft.ScaleType.DataBar,
1804
+ stops: T(e)
1805
+ }, s = e.colors?.[0];
1806
+ s && (o.color = s), void 0 !== e.minLength && (o.minLength = e.minLength), void 0 !== e.maxLength && (o.maxLength = e.maxLength), void 0 !== e.showValue && (o.showValue = e.showValue), t.getParent().scale = o;
1807
+ }
1808
+ }), d.registerVisitor({
1809
+ from: "iconSet",
1810
+ to: {},
1811
+ openTag: (t) => {
1812
+ t.copyTo("iconSet", $o), t.copyTo("reverse", Do), t.copyTo("showValue", Do);
1813
+ },
1814
+ closeTag: (t) => {
1815
+ const e = t.getSource(), o = {
1816
+ type: Ft.ScaleType.IconSet,
1817
+ stops: T(e)
1818
+ };
1819
+ 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;
1820
+ }
1821
+ }), d.registerVisitor({
1822
+ from: "formula",
1823
+ to: {},
1824
+ text: (t, e) => {
1825
+ const o = e.getParent();
1826
+ let s = o.formulas;
1827
+ s || (s = [], o.formulas = s), s.push(b(t));
1828
+ }
1829
+ }), d.registerVisitor({
1830
+ from: "cfvo",
1831
+ to: {},
1832
+ openTag: (t) => {
1833
+ const e = t.getParent();
1834
+ e.conditions || (e.conditions = []);
1835
+ const o = t.getSource();
1836
+ if (e.conditions.push(o), t.copyTo("type", $o), o.type === Ft.ColorStopType.Formula) {
1837
+ const e = t.getAttribute("val");
1838
+ null != e && (o.value = b(String(e)));
1839
+ } else t.copyTo("value", _o, "val");
1840
+ !1 === t.getAttribute("gte", Do) && (o.exclusive = !0);
1841
+ }
1842
+ }), d.registerVisitor({
1843
+ from: "color",
1844
+ to: {},
1845
+ openTag: (t) => {
1846
+ const o = t.getParent();
1847
+ o.colors || (o.colors = []);
1848
+ const s = e((e) => t.getAttribute(e));
1849
+ o.colors.push(s);
1850
+ }
1851
+ }), d.registerVisitor({
1852
+ from: "filterColumn",
1853
+ to: {},
1854
+ openTag: (t) => {
1855
+ const e = t.getParent().v, o = parseInt(t.getAttribute("colId")), s = t.getSource();
1856
+ s.index = o;
1857
+ let r = e.filter;
1858
+ r || (r = { conditions: [] }, e.filter = r);
1859
+ let n = r.conditions;
1860
+ if (n || (n = [], r.conditions = n), n.push(s), t.getAttribute("hiddenButton", Do) && e) {
1861
+ let t = e.hiddenButtons;
1862
+ t || (t = [], e.hiddenButtons = t), t.push(o);
1863
+ }
1864
+ if (t.getAttribute("showButton", Do) && e) {
1865
+ let t = e.showButtons;
1866
+ t || (t = [], e.showButtons = t), t.push(o);
1867
+ }
1868
+ return s;
1869
+ }
1870
+ }), d.registerVisitor({
1871
+ from: "colorFilter",
1872
+ openTag: (t) => {
1873
+ const e = t.getParent(), o = {};
1874
+ e.operator = Bt.BuiltInOperatorNames.Color, e.param = o, t.copyToObject(o, "cellColor", Do);
1875
+ const s = p(t);
1876
+ s && (o.style = s);
1877
+ }
1878
+ }), d.registerVisitor({
1879
+ from: "iconFilter",
1880
+ openTag: (t) => {
1881
+ const e = t.getParent(), o = {};
1882
+ e.operator = Bt.BuiltInOperatorNames.Icon, e.param = o, t.copyToObject(o, "iconId", No), t.copyToObject(o, "iconSet", $o);
1883
+ }
1884
+ }), d.registerVisitor({
1885
+ from: "top10",
1886
+ openTag: (t) => {
1887
+ const e = t.getParent(), o = {};
1888
+ 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");
1889
+ }
1890
+ }), d.registerVisitor({
1891
+ from: "dynamicFilter",
1892
+ openTag: (t) => {
1893
+ const e = t.getParent(), o = F(t.getAttribute("type"), t.getAttribute("val"), t.getAttribute("maxVal"));
1894
+ e.operator = o.operator, e.param = o.param;
1895
+ }
1896
+ });
1897
+ const S = {
1898
+ from: "filters",
1899
+ to: {},
1900
+ openTag: (t) => {
1901
+ const e = t.getParent(), o = {};
1902
+ 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;
1903
+ }
1904
+ };
1905
+ d.registerVisitor(S);
1906
+ const C = {
1907
+ from: "filter",
1908
+ openTag: (t) => {
1909
+ const e = t.getParent();
1910
+ let o = e.items;
1911
+ o || (o = [], e.items = o), o.push(t.getAttribute("val", $o));
1912
+ }
1913
+ };
1914
+ d.registerVisitor(C);
1915
+ const A = {
1916
+ from: "dateGroupItem",
1917
+ to: {},
1918
+ openTag: (t) => {
1919
+ const e = t.getParent();
1920
+ let o = e.dateGroups;
1921
+ 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);
1922
+ }
1923
+ };
1924
+ d.registerVisitor(A);
1925
+ const E = /* @__PURE__ */ new Map();
1926
+ E.set("filterColumn", {
1927
+ from: "filterColumn",
1928
+ transparent: !0
1929
+ }), E.set("filters", S), E.set("filter", C), E.set("dateGroupItem", A), d.registerVisitor({
1930
+ from: "customFilters",
1931
+ openTag: (t) => {
1932
+ const e = t.getParent(), o = t.getAttribute("and"), s = "and" === o || "1" === o, r = [];
1933
+ return e.operator = s ? Bt.BuiltInOperatorNames.And : Bt.BuiltInOperatorNames.Or, e.param = r, t.setSource(e), r;
1934
+ },
1935
+ closeTag: (t) => {
1936
+ const e = t.getSource(), o = e?.param;
1937
+ if (!e || !o) return;
1938
+ const s = 1 === o.length ? o[0] : X(e);
1939
+ s !== e && (e.operator = s.operator, e.param = s.param);
1940
+ }
1941
+ }), d.registerVisitor({
1942
+ from: "customFilter",
1943
+ openTag: (t) => {
1944
+ const e = t.getParent();
1945
+ let o;
1946
+ Array.isArray(e) ? (o = {}, e.push(o)) : o = e;
1947
+ const s = Ct({
1948
+ operator: t.getAttribute("operator"),
1949
+ val: t.getAttribute("val")
1950
+ }, (e) => t.warn(e));
1951
+ s && (o.operator = s.operator, o.param = s.param);
1952
+ }
1953
+ });
1954
+ let I = {}, O = null;
1955
+ d.registerVisitor({
1956
+ from: "sortState",
1957
+ to: {},
1958
+ openTag: (t) => {
1959
+ const e = t.getParent();
1960
+ let o = e.v;
1961
+ if (!o) return;
1962
+ const s = {};
1963
+ I = {};
1964
+ const r = t.getAttribute("caseSensitive", Do);
1965
+ null != r && (I.collatorOptions = r ? Qt.CaseSensitiveOptions : Qt.CaseInsensitiveOptions);
1966
+ const n = t.getAttribute("sortMethod");
1967
+ "stroke" !== n && "pinYin" !== n || (I.collatorOptions = {
1968
+ ...I.collatorOptions,
1969
+ collation: "stroke" === n ? "stroke" : "pinyin"
1970
+ }), t.getAttribute("columnSort", Do) && (s.axis = zt.Axis.Column);
1971
+ const i = t.getAttribute("ref"), a = e.r;
1972
+ O = i && a ? Nt.fastStringToRange(i) : null, O && (s.extent = { range: y(a, O) }), o.sort = s, t.setSource(e);
1973
+ }
1974
+ }), d.registerVisitor({
1975
+ from: "sortCondition",
1976
+ to: {},
1977
+ openTag: (t) => {
1978
+ const e = t.getParent(), o = e.v;
1979
+ if (!o) return;
1980
+ const s = o.sort;
1981
+ if (!s) return;
1982
+ let r = s.sorts;
1983
+ r || (r = [], s.sorts = r);
1984
+ const n = t.getAttribute("ref");
1985
+ let i = 0, a = null;
1986
+ if (n) {
1987
+ const t = Nt.fastStringToRange(n, ms), o = t.colStart, s = e.r, r = s.colStart;
1988
+ i = s ? o - r : o, s && O && (a = et(s, O, t));
1989
+ }
1990
+ s.extent && (s.extent.sorts ??= []).push(a);
1991
+ const l = { ...I }, c = st(t.getAttribute("sortBy"));
1992
+ c && (l.sortOn = c);
1993
+ const u = p(t);
1994
+ u && (l.style = u), t.copyToObject(l, "iconSet", $o), t.copyToObject(l, "customList", $o), l.reverse = t.getAttribute("descending", Do) ?? !1;
1995
+ const h = {
1996
+ index: i,
1997
+ criteria: l
1998
+ };
1999
+ r.push(h);
2000
+ }
2001
+ });
2002
+ const D = (t) => {
2003
+ v = t.getSource(), w = "topLeft", t.copyTo("topLeft", $o, "topLeftCell");
2004
+ const e = P(t.getAttribute("defaultGridColor")), o = t.getAttribute("colorId");
2005
+ 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");
2006
+ const s = {};
2007
+ for (const [e, o] of J) {
2008
+ const r = t.getAttribute(o, No);
2009
+ r && (s[e] = Math.min(400, Math.max(10, r)));
2010
+ }
2011
+ 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);
2012
+ };
2013
+ d.registerVisitor({
2014
+ from: "sheetView",
2015
+ to: "view",
2016
+ openTag: (t) => {
2017
+ D(t);
2018
+ },
2019
+ closeTag: () => {
2020
+ v = null;
2021
+ }
2022
+ }), d.registerVisitor({
2023
+ from: "customSheetViews",
2024
+ to: "customSheetViews",
2025
+ openTag: (t) => {
2026
+ t.setSource([]);
2027
+ }
2028
+ }), d.registerVisitor({
2029
+ from: "customSheetView",
2030
+ to: [],
2031
+ openTag: (t) => {
2032
+ N = !0, D(t);
2033
+ },
2034
+ closeTag: () => {
2035
+ N = !1, v = null;
2036
+ }
2037
+ }), d.registerVisitor({
2038
+ from: "selection",
2039
+ to: null,
2040
+ openTag: (t) => {
2041
+ if (!v) return;
2042
+ const e = t.getAttribute("activeCell")?.replace(/\$/g, ""), o = t.getAttribute("sqref")?.replace(/\$/g, ""), s = t.getAttribute("pane") ?? "topLeft";
2043
+ if (s !== w) {
2044
+ const t = v.freezePanes;
2045
+ if (t && e) {
2046
+ const r = { activeCell: e };
2047
+ o && o !== e && (r.sqref = o), (t.paneSelections ??= {})[s] = r;
2048
+ }
2049
+ return;
2050
+ }
2051
+ const r = {};
2052
+ e && (r.cell = e);
2053
+ const n = t.getAttribute("activeCellId", No);
2054
+ null !== n && (r.rangeIndex = n), o && o !== e && (r.ranges = o.trim().split(/\s+/)), v.selection = r;
2055
+ }
2056
+ }), d.registerVisitor({
2057
+ from: "pane",
2058
+ to: null,
2059
+ openTag: (t) => {
2060
+ if (!v) return;
2061
+ w = t.getAttribute("activePane") ?? "topLeft";
2062
+ const e = t.getAttribute("state");
2063
+ if ("frozen" === e || "frozenSplit" === e) {
2064
+ const e = {};
2065
+ v.freezePanes = e, t.copyToObject(e, "topLeft", $o, "topLeftCell");
2066
+ const o = (v.topLeft ? Nt.fastStringToCell(v.topLeft) : void 0) ?? {
2067
+ colIndex: 0,
2068
+ rowIndex: 0
2069
+ }, s = {
2070
+ colIndex: 0,
2071
+ rowIndex: 0
2072
+ };
2073
+ t.copyToObject(s, "colIndex", No, "xSplit"), t.copyToObject(s, "rowIndex", No, "ySplit");
2074
+ const r = {
2075
+ colIndex: o.colIndex + s.colIndex,
2076
+ rowIndex: o.rowIndex + s.rowIndex
2077
+ };
2078
+ e.coords = Nt.cellToString(r);
2079
+ }
2080
+ }
2081
+ }), d.registerVisitor({
2082
+ from: "sheetPr",
2083
+ transparent: !0,
2084
+ openTag: (t) => {
2085
+ const e = t.getAttribute("codeName");
2086
+ 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);
2087
+ const s = {};
2088
+ !0 === t.getAttribute("syncHorizontal", Do) && (s.horizontal = !0), !0 === t.getAttribute("syncVertical", Do) && (s.vertical = !0);
2089
+ const r = t.getAttribute("syncRef");
2090
+ r && (s.anchor = r), Object.keys(s).length > 0 && (o.syncScroll = s);
2091
+ }
2092
+ }), d.registerVisitor({
2093
+ from: "tabColor",
2094
+ to: null,
2095
+ openTag: (t) => {
2096
+ const s = e((e) => t.getAttribute(e));
2097
+ s && (o.tabColor = s);
2098
+ }
2099
+ });
2100
+ let N = !1;
2101
+ const _ = () => o.pageLayout ??= {};
2102
+ d.registerVisitor({
2103
+ from: "pageSetUpPr",
2104
+ to: null,
2105
+ openTag: (t) => {
2106
+ !0 === t.getAttribute("fitToPage", Do) && (_().fitToPage = !0), !1 === t.getAttribute("autoPageBreaks", Do) && (_().hideAutoPageBreaks = !0);
2107
+ }
2108
+ }), d.registerVisitor({
2109
+ from: "outlinePr",
2110
+ to: null,
2111
+ openTag: (t) => {
2112
+ const e = (e) => {
2113
+ const o = t.getAttribute(e);
2114
+ return "0" === o || "false" === o;
2115
+ }, s = {};
2116
+ e("summaryBelow") && (s.summaryRow = "up"), e("summaryRight") && (s.summaryColumn = "left"), ((e) => {
2117
+ const o = t.getAttribute(e);
2118
+ return "1" === o || "true" === o;
2119
+ })("applyStyles") && (s.automaticStyles = !0), Object.keys(s).length > 0 && (o.outline = s);
2120
+ }
2121
+ }), d.registerVisitor({
2122
+ from: "pageMargins",
2123
+ to: null,
2124
+ openTag: (t) => {
2125
+ if (N) return;
2126
+ const e = (e, o) => t.getAttribute(e, _o) ?? o, o = {
2127
+ left: e("left", .7),
2128
+ right: e("right", .7),
2129
+ top: e("top", .75),
2130
+ bottom: e("bottom", .75),
2131
+ header: e("header", .3),
2132
+ footer: e("footer", .3)
2133
+ };
2134
+ .7 === o.left && .7 === o.right && .75 === o.top && .75 === o.bottom && .3 === o.header && .3 === o.footer || (_().margins = o);
2135
+ }
2136
+ }), d.registerVisitor({
2137
+ from: "pageSetup",
2138
+ to: null,
2139
+ openTag: (t) => {
2140
+ if (N) return;
2141
+ const e = _(), o = (e) => t.getAttribute(e, No) ?? void 0, r = (e) => t.getAttribute(e, Do), n = t.getAttribute("orientation");
2142
+ "landscape" !== n && "portrait" !== n || (e.orientation = n);
2143
+ for (const t of [
2144
+ "paperSize",
2145
+ "scale",
2146
+ "fitToWidth",
2147
+ "fitToHeight",
2148
+ "firstPageNumber",
2149
+ "horizontalDpi",
2150
+ "verticalDpi",
2151
+ "copies"
2152
+ ]) {
2153
+ const s = o(t);
2154
+ void 0 !== s && (e[t] = s);
2155
+ }
2156
+ const i = t.getAttribute("paperHeight");
2157
+ i && (e.paperHeight = i);
2158
+ const a = t.getAttribute("paperWidth");
2159
+ 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);
2160
+ const l = t.getAttribute("cellComments"), c = U.find(([t]) => t === l)?.[1];
2161
+ c && (e.printComments = c);
2162
+ const u = t.getAttribute("errors"), h = rt.find(([t]) => t === u)?.[1];
2163
+ h && (e.printErrors = h);
2164
+ const d = t.getAttribute("r:id"), p = d ? s(d, "part") : null;
2165
+ p && (e.printerSettings = p);
2166
+ }
2167
+ }), d.registerVisitor({
2168
+ from: "printOptions",
2169
+ to: null,
2170
+ openTag: (t) => {
2171
+ if (N) return;
2172
+ const e = (e) => !0 === t.getAttribute(e, Do);
2173
+ e("horizontalCentered") && (_().centerHorizontally = !0), e("verticalCentered") && (_().centerVertically = !0), e("gridLines") && (_().printGridlines = !0), e("headings") && (_().printHeadings = !0);
2174
+ }
2175
+ }), d.registerVisitor({
2176
+ from: "headerFooter",
2177
+ to: {},
2178
+ openTag: (t) => {
2179
+ if (N) return;
2180
+ const e = {}, o = (e) => t.getAttribute(e, Do);
2181
+ !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 && (_().headerFooter = e);
2182
+ }
2183
+ });
2184
+ for (const t of dt) d.registerVisitor({
2185
+ from: t,
2186
+ to: {},
2187
+ text: (e, o) => {
2188
+ if (N) return;
2189
+ const s = _(), r = s.headerFooter ??= {};
2190
+ r[t] = (r[t] ?? "") + l(e);
2191
+ }
2192
+ });
2193
+ let R = "rowBreaks";
2194
+ for (const [t, e] of [["rowBreaks", "rowBreaks"], ["colBreaks", "columnBreaks"]]) d.registerVisitor({
2195
+ from: t,
2196
+ to: {},
2197
+ openTag: () => {
2198
+ R = e;
2199
+ }
2200
+ });
2201
+ d.registerVisitor({
2202
+ from: "brk",
2203
+ to: null,
2204
+ openTag: (t) => {
2205
+ if (N) return;
2206
+ const e = t.getAttribute("id", No);
2207
+ if (null == e) return;
2208
+ const o = { index: e }, s = t.getAttribute("min", No);
2209
+ null != s && (o.min = s);
2210
+ const r = t.getAttribute("max", No);
2211
+ null != r && (o.max = r), !0 !== t.getAttribute("man", Do) && (o.automatic = !0), !0 === t.getAttribute("pt", Do) && (o.pivot = !0);
2212
+ const n = _();
2213
+ (n[R] ??= []).push(o);
2214
+ }
2215
+ }), d.registerVisitor({
2216
+ from: "ignoredErrors",
2217
+ transparent: !0
2218
+ }), d.registerVisitor({
2219
+ from: "ignoredError",
2220
+ to: null,
2221
+ openTag: (t) => {
2222
+ const e = t.getAttribute("sqref");
2223
+ if (!e) return;
2224
+ const s = [];
2225
+ for (const e of c) !0 === t.getAttribute(e, Do) && s.push(e);
2226
+ if (0 !== s.length) for (const t of e.trim().split(/\s+/)) (o.ignoredErrors ??= []).push({
2227
+ r: t,
2228
+ v: s
2229
+ });
2230
+ }
2231
+ }), d.registerVisitor({
2232
+ from: "mergeCells",
2233
+ to: "merges",
2234
+ openTag: (t) => {
2235
+ t.setSource([]);
2236
+ }
2237
+ }), d.registerVisitor({
2238
+ from: "dataValidations",
2239
+ to: "validations",
2240
+ openTag: (t) => {
2241
+ t.setSource([]);
2242
+ const e = {};
2243
+ !0 === t.getAttribute("disablePrompts", Do) && (e.disablePrompts = !0);
2244
+ const s = t.getAttribute("xWindow", No);
2245
+ null !== s && (e.windowX = s);
2246
+ const r = t.getAttribute("yWindow", No);
2247
+ null !== r && (e.windowY = r), Object.keys(e).length > 0 && (o.validationSettings = {
2248
+ ...o.validationSettings,
2249
+ ...e
2250
+ });
2251
+ }
2252
+ });
2253
+ const W = {
2254
+ from: "dataValidation",
2255
+ to: [],
2256
+ openTag: (t) => {
2257
+ let e = t.getAttribute("sqref");
2258
+ e && (e = e.trim().split(/\s+/).join(","));
2259
+ const o = {}, s = {
2260
+ r: e,
2261
+ v: o,
2262
+ rule: {
2263
+ type: t.getAttribute("type") ?? void 0,
2264
+ operator: t.getAttribute("operator") ?? void 0
2265
+ }
2266
+ };
2267
+ !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);
2268
+ },
2269
+ closeTag: (t) => {
2270
+ const e = t.getSource();
2271
+ if (!e?.rule) return;
2272
+ const o = ut(e.rule, a);
2273
+ o && (t.getAttribute("allowBlank", Do) && (o.includeBlanks = !0), e.v.condition = o), delete e.rule;
2274
+ }
2275
+ };
2276
+ d.registerVisitor(W), d.registerVisitor({
2277
+ from: "formula1",
2278
+ to: {},
2279
+ text: (t, e) => {
2280
+ const o = e.getParent().rule;
2281
+ o?.type && (o.formula1 = Y(b(t), o.type));
2282
+ }
2283
+ }), d.registerVisitor({
2284
+ from: "formula2",
2285
+ to: {},
2286
+ text: (t, e) => {
2287
+ const o = e.getParent().rule;
2288
+ o?.type && (o.formula2 = Y(b(t), o.type));
2289
+ }
2290
+ }), d.registerVisitor({
2291
+ from: "picture",
2292
+ to: "picture",
2293
+ openTag: (t) => {
2294
+ const e = t.getAttribute("r:id");
2295
+ if (!e) return void t.warn("A picture names no image; it was not imported.", { onceKey: "xlsx.sheet.picture.noRel" });
2296
+ const o = s(e, "resource");
2297
+ t.getSource().resId = o;
2298
+ }
2299
+ });
2300
+ const z = {
2301
+ from: "slicer",
2302
+ to: {},
2303
+ openTag: (t) => {
2304
+ const e = t.getAttribute("r:id");
2305
+ if (!e) return void t.warn("A slicer names no cache; it was not imported.", { onceKey: "xlsx.sheet.slicer.noRel" });
2306
+ const o = s(e)?.slicers, r = t.getParent();
2307
+ r.slicers || (r.slicers = {});
2308
+ const n = Object.keys(o);
2309
+ for (const t of n) r.slicers[t] = o[t];
2310
+ }
2311
+ };
2312
+ d.registerVisitor(z);
2313
+ const G = {
2314
+ from: "timelineRef",
2315
+ to: {},
2316
+ openTag: (t) => {
2317
+ const e = t.getAttribute("r:id"), o = e ? s(e)?.slicers : void 0;
2318
+ if (!o) return void t.warn("A timeline names no part; it was not imported.", { onceKey: "xlsx.sheet.timeline.noRel" });
2319
+ const r = t.getParent();
2320
+ r.slicers ??= {};
2321
+ for (const t of Object.keys(o)) r.slicers[t] = o[t];
2322
+ }
2323
+ }, Z = (t, e) => ({
2324
+ from: t,
2325
+ to: {},
2326
+ openTag: (t) => {
2327
+ t.setSource("");
2328
+ },
2329
+ text: (t, e) => {
2330
+ e.setSource((e.getSource() ?? "") + t);
2331
+ },
2332
+ closeTag: (t) => {
2333
+ e(String(t.getSource() ?? ""), t);
2334
+ }
2335
+ }), tt = /* @__PURE__ */ new Map();
2336
+ tt.set("dataValidations", {
2337
+ from: "dataValidations",
2338
+ to: "validations",
2339
+ openTag: (t) => {
2340
+ const e = t.getParent();
2341
+ t.setSource(e.validations ?? []);
2342
+ },
2343
+ closeTag: (t) => {
2344
+ 0 === (t.getSource()?.length ?? 0) && t.setSource(void 0);
2345
+ }
2346
+ }), tt.set("dataValidation", {
2347
+ ...W,
2348
+ closeTag: (t) => {
2349
+ W.closeTag(t);
2350
+ const e = t.getSource();
2351
+ e && !e.r && (t.warn("x14 dataValidation with no xm:sqref was dropped."), t.setSource(void 0));
2352
+ }
2353
+ });
2354
+ const ot = (t) => ({
2355
+ from: t,
2356
+ to: {},
2357
+ openTag: (e) => {
2358
+ e.setSource({
2359
+ rule: e.getParent()?.rule,
2360
+ key: t
2361
+ });
2362
+ }
2363
+ });
2364
+ tt.set("formula1", ot("formula1")), tt.set("formula2", ot("formula2")), tt.set("f", Z("f", (t, e) => {
2365
+ const o = e.getParent(), s = o?.rule;
2366
+ s && (s[o.key] = Y(b(t), s.type));
2367
+ })), tt.set("sqref", Z("sqref", (t, e) => {
2368
+ const o = e.getParent(), s = t.trim();
2369
+ o && s && (o.r = s.split(/\s+/).join(","));
2370
+ }));
2371
+ const nt = /* @__PURE__ */ new Map(), it = [], lt = /* @__PURE__ */ new Map();
2372
+ lt.set("conditionalFormattings", {
2373
+ from: "conditionalFormattings",
2374
+ transparent: !0
2375
+ }), lt.set("conditionalFormatting", {
2376
+ from: "conditionalFormatting",
2377
+ to: {},
2378
+ openTag: (t) => {
2379
+ t.setSource({ rules: [] });
2380
+ },
2381
+ closeTag: (t) => {
2382
+ const e = t.getSource(), o = e?.rules ?? [];
2383
+ for (let t = 0; t < o.length; t++) {
2384
+ const s = o[t];
2385
+ s.sqref = e.sqref, s.id ? nt.set(s.id, s) : it.push(s);
2386
+ }
2387
+ }
2388
+ }), lt.set("cfRule", {
2389
+ from: "cfRule",
2390
+ to: {},
2391
+ openTag: (t) => {
2392
+ 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);
2393
+ },
2394
+ closeTag: (t) => {
2395
+ const e = t.getSource();
2396
+ e && t.getParent()?.rules?.push(e);
2397
+ }
2398
+ }), lt.set("sqref", Z("sqref", (t, e) => {
2399
+ const o = e.getParent(), s = t.trim();
2400
+ o && s && (o.sqref = s);
2401
+ })), lt.set("dataBar", {
2402
+ from: "dataBar",
2403
+ to: {},
2404
+ openTag: (t) => {
2405
+ 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);
2406
+ },
2407
+ closeTag: (t) => {
2408
+ t.getParent().dataBar = t.getSource();
2409
+ }
2410
+ }), lt.set("iconSet", {
2411
+ from: "iconSet",
2412
+ to: {},
2413
+ openTag: (t) => {
2414
+ t.copyTo("iconSet", $o), t.copyTo("custom", Do), t.copyTo("reverse", Do), t.copyTo("showValue", Do);
2415
+ },
2416
+ closeTag: (t) => {
2417
+ t.getParent().iconSet = t.getSource();
2418
+ }
2419
+ });
2420
+ const ht = /* @__PURE__ */ new Map();
2421
+ ht.set("f", Z("f", (t, e) => {
2422
+ const o = e.getParent();
2423
+ if (!o) return;
2424
+ const s = t.trim(), r = Number(s);
2425
+ o.value = s.length > 0 && Number.isFinite(r) ? r : b(t);
2426
+ })), lt.set("cfvo", {
2427
+ from: "cfvo",
2428
+ to: {},
2429
+ scope: () => ht,
2430
+ openTag: (t) => {
2431
+ const e = t.getParent();
2432
+ e.conditions || (e.conditions = []);
2433
+ const o = t.getSource();
2434
+ e.conditions.push(o), t.copyTo("type", $o), !1 === t.getAttribute("gte", Do) && (o.exclusive = !0);
2435
+ }
2436
+ }), lt.set("f", Z("f", (t, e) => {
2437
+ const o = e.getParent();
2438
+ o && (o.formulas ??= []).push(b(t));
2439
+ })), lt.set("dxf", {
2440
+ from: "dxf",
2441
+ to: {},
2442
+ raw: !0,
2443
+ closeTag: (t) => {
2444
+ if (!g) return;
2445
+ const e = t.getParent();
2446
+ if (!e) return;
2447
+ const o = g(t.getRawXml() ?? "");
2448
+ o && (e.style = o);
2449
+ }
2450
+ });
2451
+ const pt = (t) => ({
2452
+ from: t,
2453
+ to: {},
2454
+ openTag: (o) => {
2455
+ const s = e((t) => o.getAttribute(t));
2456
+ s && (o.getParent()[t] = s);
2457
+ }
2458
+ });
2459
+ lt.set("borderColor", pt("borderColor")), lt.set("negativeFillColor", pt("negativeFillColor")), lt.set("negativeBorderColor", pt("negativeBorderColor")), lt.set("axisColor", pt("axisColor")), lt.set("cfIcon", {
2460
+ from: "cfIcon",
2461
+ to: {},
2462
+ openTag: (t) => {
2463
+ const e = t.getAttribute("iconSet"), o = t.getAttribute("iconId", No);
2464
+ if (null === e || null === o) return;
2465
+ const s = t.getParent();
2466
+ s.icons || (s.icons = []), s.icons.push({
2467
+ set: e,
2468
+ id: o
2469
+ });
2470
+ }
2471
+ });
2472
+ const mt = /* @__PURE__ */ new Map();
2473
+ mt.set("id", Z("id", (t, e) => {
2474
+ const o = e.getParent(), s = t.trim();
2475
+ o && s && (o.x14Id = s);
2476
+ }));
2477
+ const bt = /* @__PURE__ */ new Map();
2478
+ bt.set("slicerList", {
2479
+ from: "slicerList",
2480
+ transparent: !0
2481
+ }), bt.set("slicer", z);
2482
+ const xt = /* @__PURE__ */ new Map();
2483
+ xt.set("timelineRefs", {
2484
+ from: "timelineRefs",
2485
+ transparent: !0
2486
+ }), xt.set("timelineRef", G);
2487
+ const vt = /* @__PURE__ */ new Map();
2488
+ vt.set("sparklineGroups", {
2489
+ from: "sparklineGroups",
2490
+ to: "sparklineGroups",
2491
+ openTag: (t) => {
2492
+ const e = t.getParent();
2493
+ t.setSource(e.sparklineGroups ?? []);
2494
+ },
2495
+ closeTag: (t) => {
2496
+ 0 === (t.getSource()?.length ?? 0) && t.setSource(void 0);
2497
+ }
2498
+ }), vt.set("sparklineGroup", {
2499
+ from: "sparklineGroup",
2500
+ to: [],
2501
+ openTag: (e) => {
2502
+ const o = e.getFrom().attributes ?? {}, s = {};
2503
+ for (const t in o) {
2504
+ const e = o[t];
2505
+ s[t] = "string" == typeof e ? e : e?.value ?? "";
2506
+ }
2507
+ e.setSource({
2508
+ properties: t(s),
2509
+ entries: []
2510
+ });
2511
+ },
2512
+ closeTag: (t) => {
2513
+ const e = t.getSource(), o = at(e.properties, e.entries);
2514
+ o || t.warn("A sparkline group with no sparklines was dropped.", { onceKey: "xlsx.sheet.sparklineGroup.empty" }), t.setSource(o ?? void 0);
2515
+ }
2516
+ });
2517
+ for (const t of $) vt.set(t, {
2518
+ from: t,
2519
+ to: {},
2520
+ openTag: (o) => {
2521
+ const s = e((t) => o.getAttribute(t));
2522
+ s && (o.getParent().properties[t] = s);
2523
+ }
2524
+ });
2525
+ vt.set("sparklines", {
2526
+ from: "sparklines",
2527
+ transparent: !0
2528
+ }), vt.set("sparkline", {
2529
+ from: "sparkline",
2530
+ to: {},
2531
+ openTag: (t) => {
2532
+ t.setSource({ isSparkline: !0 });
2533
+ },
2534
+ closeTag: (t) => {
2535
+ const e = t.getSource(), o = t.getParent(), s = e?.sqref?.trim(), r = s ? Nt.fastStringToRange(s.split(/\s+/)[0]) : null;
2536
+ r ? o.entries.push({
2537
+ location: {
2538
+ rowIndex: r.rowStart,
2539
+ colIndex: r.colStart
2540
+ },
2541
+ data: e.data ?? ""
2542
+ }) : t.warn("A sparkline with no location was dropped.", { onceKey: "xlsx.sheet.sparkline.incomplete" });
2543
+ }
2544
+ }), vt.set("f", Z("f", (t, e) => {
2545
+ const o = e.getParent(), s = t.trim();
2546
+ o && s && (o.isSparkline ? o.data = s : o.properties.dateRange = s);
2547
+ })), vt.set("sqref", Z("sqref", (t, e) => {
2548
+ const o = e.getParent();
2549
+ o?.isSparkline && (o.sqref = t);
2550
+ }));
2551
+ const wt = /* @__PURE__ */ new Map([
2552
+ [k(q), vt],
2553
+ [k(ct), tt],
2554
+ [k(Q), lt],
2555
+ [k(V), lt],
2556
+ [k(ft), mt],
2557
+ [k(yt), bt],
2558
+ [k(H), bt],
2559
+ [k(K), xt],
2560
+ [k(gt), E]
2561
+ ]), St = /* @__PURE__ */ new Set();
2562
+ d.registerVisitor({
2563
+ from: "extLst",
2564
+ transparent: !0
2565
+ }), d.registerVisitor({
2566
+ from: "ext",
2567
+ transparent: !0,
2568
+ scope: (t) => {
2569
+ const e = t.getAttribute("uri"), o = k(e), s = wt.get(o);
2570
+ if (s) return s;
2571
+ if (!At.has(o) && !St.has(o)) {
2572
+ St.add(o);
2573
+ const s = j[o];
2574
+ 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.`);
2575
+ }
2576
+ return null;
2577
+ }
2578
+ }), d.registerVisitor({
2579
+ from: "mergeCell",
2580
+ to: [],
2581
+ openTag: (t) => {
2582
+ const e = t.getAttribute("ref");
2583
+ t.setSource(e);
2584
+ }
2585
+ }), d.registerVisitor({
2586
+ from: "hyperlinks",
2587
+ to: "hyperlinks",
2588
+ openTag: (t) => {
2589
+ t.setSource([]);
2590
+ }
2591
+ }), d.registerVisitor({
2592
+ from: "hyperlink",
2593
+ to: [],
2594
+ openTag: (t) => {
2595
+ const e = t.getAttribute("r:id"), o = t.getAttribute("ref");
2596
+ if (!o) return void t.warn("A hyperlink has no ref; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.noRef" });
2597
+ t.setKey(o);
2598
+ let r = e ? s(e) : "";
2599
+ if ("string" != typeof r) return void t.warn("A hyperlink has an invalid address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
2600
+ r.endsWith("\\") && (r = r.substring(0, r.length - 1));
2601
+ const n = t.getAttribute("location");
2602
+ if (n && (r += "#" + n), !r) return void t.warn("A hyperlink has no address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
2603
+ let i;
2604
+ const a = t.getAttribute("tooltip"), l = t.getAttribute("display");
2605
+ a || l ? (i = { address: r }, a && (i.screenTip = a), l && (i.display = l)) : i = r, t.setSource({
2606
+ r: o,
2607
+ v: i
2608
+ });
2609
+ }
2610
+ }), d.registerVisitor({
2611
+ from: "drawing",
2612
+ to: "movables",
2613
+ openTag: (t) => {
2614
+ const e = t.getAttribute("r:id");
2615
+ if (!e) return;
2616
+ const o = s(e);
2617
+ o ? t.setSource(o.movables) : t.warn("A drawing part is missing; its shapes were not imported.", { onceKey: "xlsx.sheet.drawing.missing" });
2618
+ }
2619
+ }), d.registerVisitor({
2620
+ from: "legacyDrawing",
2621
+ to: "legacyDrawing",
2622
+ openTag: (t) => {
2623
+ t.setSource(s(t.getAttribute("r:id"), "legacyDrawing") ?? void 0);
2624
+ }
2625
+ }), d.registerVisitor({
2626
+ from: "legacyDrawingHF",
2627
+ to: "legacyDrawingHF",
2628
+ openTag: (t) => {
2629
+ t.setSource(s(t.getAttribute("r:id"), "legacyDrawing") ?? void 0);
2630
+ }
2631
+ });
2632
+ let kt = null, Et = !1;
2633
+ const It = /* @__PURE__ */ new Map(), Pt = {
2634
+ from: "Fallback",
2635
+ to: null
2636
+ }, Ot = {
2637
+ from: "Choice",
2638
+ transparent: !0
2639
+ };
2640
+ It.set("Fallback", Pt), It.set("Choice", Ot), It.set("control", {
2641
+ from: "control",
2642
+ transparent: !0,
2643
+ openTag: (t) => {
2644
+ const e = t.getAttribute("name"), o = t.getAttribute("r:id"), r = o ? s(o, "formControl") : null;
2645
+ if (!r) return t.warn(`The form control '${e ?? ""}' has no properties and was not read.`, { onceKey: "xlsx.sheet.control.noProperties" }), void (kt = null);
2646
+ const n = r.json, i = parseInt(t.getAttribute("shapeId") ?? "", 10);
2647
+ isNaN(i) || (n.shapeId = i);
2648
+ const a = {
2649
+ anchor: {
2650
+ tl: {
2651
+ c: 0,
2652
+ r: 0,
2653
+ x: 0,
2654
+ y: 0
2655
+ },
2656
+ br: {
2657
+ c: 0,
2658
+ r: 0,
2659
+ x: 0,
2660
+ y: 0
2661
+ }
2662
+ },
2663
+ content: {
2664
+ type: r.type,
2665
+ json: n
2666
+ }
2667
+ };
2668
+ e && (a.content.name = e), kt = {
2669
+ movable: a,
2670
+ control: n
2671
+ };
2672
+ },
2673
+ closeTag: () => {
2674
+ kt && (o.movables || (o.movables = []), o.movables.push(kt.movable), kt = null);
2675
+ }
2676
+ }), It.set("controlPr", {
2677
+ from: "controlPr",
2678
+ transparent: !0,
2679
+ raw: !0,
2680
+ openTag: (t) => {
2681
+ if (!kt) return;
2682
+ const e = t.getFrom().attributes ?? {}, o = {};
2683
+ for (const t in e) {
2684
+ const s = e[t];
2685
+ o[t] = "string" == typeof s ? s : s?.value ?? "";
2686
+ }
2687
+ M(o, kt.control);
2688
+ },
2689
+ closeTag: (t) => {
2690
+ if (!kt) return;
2691
+ const e = ((t) => {
2692
+ const e = /<(?:[\w.-]+:)?anchor\b([^>]*)>([\s\S]*?)<\/(?:[\w.-]+:)?anchor>/.exec(t);
2693
+ if (!e) return null;
2694
+ 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);
2695
+ return {
2696
+ anchor: {
2697
+ tl: is(s("from")),
2698
+ br: is(s("to"))
2699
+ },
2700
+ anchorType: n ? i ? "twoCell" : "oneCell" : "absolute",
2701
+ rest: (t.slice(0, e.index) + t.slice(e.index + e[0].length)).trim()
2702
+ };
2703
+ })(t.getRawXml() ?? "");
2704
+ e ? (kt.movable.anchor = e.anchor, "twoCell" !== e.anchorType && (kt.movable.anchorType = e.anchorType), e.rest && (kt.control.xml = e.rest)) : Et || (Et = !0, t.warn("A form control has no anchor; it is placed at the top left of the sheet."));
2705
+ }
2706
+ });
2707
+ const Dt = {
2708
+ from: "controls",
2709
+ transparent: !0,
2710
+ scope: () => It
2711
+ };
2712
+ d.registerVisitor(Dt);
2713
+ const _t = /* @__PURE__ */ new Map([
2714
+ ["Choice", Ot],
2715
+ ["Fallback", Pt],
2716
+ ["controls", Dt]
2717
+ ]);
2718
+ d.registerVisitor({
2719
+ from: "AlternateContent",
2720
+ transparent: !0,
2721
+ scope: () => _t
2722
+ }), d.registerVisitor({
2723
+ from: "tableParts",
2724
+ to: "tables",
2725
+ openTag: (t) => {
2726
+ t.setSource([]);
2727
+ }
2728
+ }), d.registerVisitor({
2729
+ from: "tablePart",
2730
+ to: [],
2731
+ openTag: (t) => {
2732
+ const e = t.getAttribute("r:id");
2733
+ if (!e) return;
2734
+ const o = s(e);
2735
+ o ? t.setSource(o) : t.warn("A table part is missing; the table was not imported.", { onceKey: "xlsx.sheet.table.missing" });
2736
+ }
2737
+ });
2738
+ const $t = (t, e) => {
2739
+ e.conditions?.length && (t.stops = T(e)), void 0 !== e.minLength && (t.minLength = e.minLength), void 0 !== e.maxLength && (t.maxLength = e.maxLength), (e.gradient ?? 1) && (t.gradient = !0), 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);
2740
+ }, Rt = (t, e) => {
2741
+ e.conditions?.length && (t.stops = T(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);
2742
+ }, Mt = (t) => {
2743
+ if (!t.sqref) return null;
2744
+ const e = t.sqref.split(/\s+/).join(",");
2745
+ if ("iconSet" === t.type) {
2746
+ if (!t.iconSet) return null;
2747
+ const o = {
2748
+ type: Ft.ScaleType.IconSet,
2749
+ stops: []
2750
+ };
2751
+ return Rt(o, t.iconSet), {
2752
+ r: e,
2753
+ v: { scale: o },
2754
+ priority: t.priority
2755
+ };
2756
+ }
2757
+ const o = B(t, a);
2758
+ if (!o) return null;
2759
+ const s = { condition: o };
2760
+ return t.style && (s.style = t.style), t.stopIfTrue && (s.stopIfTrue = !0), {
2761
+ r: e,
2762
+ v: s,
2763
+ priority: t.priority
2764
+ };
2765
+ };
2766
+ d.registerVisitor({
2767
+ from: "worksheet",
2768
+ to: {},
2769
+ openTag: (t) => {},
2770
+ closeTag: (t) => {
2771
+ const e = t.getSource();
2772
+ let o = e?.conditionals;
2773
+ if (o) for (let t = 0; t < o.length; t++) {
2774
+ const e = o[t], s = e.x14Id;
2775
+ if (!s) continue;
2776
+ delete e.x14Id;
2777
+ const r = nt.get(s);
2778
+ if (!r) continue;
2779
+ nt.delete(s);
2780
+ const n = e.v?.scale;
2781
+ r.dataBar && n?.type === Ft.ScaleType.DataBar ? $t(n, r.dataBar) : r.iconSet && n?.type === Ft.ScaleType.IconSet && Rt(n, r.iconSet);
2782
+ }
2783
+ const s = [...nt.values(), ...it], r = /* @__PURE__ */ new Set();
2784
+ let n = 0;
2785
+ for (let t = 0; t < s.length; t++) {
2786
+ const i = Mt(s[t]);
2787
+ i ? (o || (o = [], e.conditionals = o), o.push(i)) : (r.add(s[t].type ?? "unknown"), n++);
2788
+ }
2789
+ if (n > 0) {
2790
+ const t = [...r].map((t) => `'${t}'`).join(", ");
2791
+ 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.`);
2792
+ }
2793
+ if (o) {
2794
+ o.length > 1 && o.sort((t, e) => (t.priority ?? 1 / 0) - (e.priority ?? 1 / 0));
2795
+ for (let t = 0; t < o.length; t++) delete o[t].priority;
2796
+ }
2797
+ }
2798
+ }), d.registerVisitor({
2799
+ from: "customProperties",
2800
+ to: "customProperties",
2801
+ openTag: (t) => {
2802
+ t.setSource([]);
2803
+ },
2804
+ closeTag: (t) => {
2805
+ const e = t.getSource();
2806
+ if (e.length > 0) t.getParent().customProperties = e;
2807
+ }
2808
+ }), d.registerVisitor({
2809
+ from: "customPr",
2810
+ to: {},
2811
+ openTag: (t) => {
2812
+ const e = t.getParent();
2813
+ t.copyTo("name");
2814
+ const o = t.getAttribute("r:id");
2815
+ if (!o) return void t.warn("A custom property names no part; it was not imported.", { onceKey: "xlsx.sheet.customProperty.noRel" });
2816
+ const r = s(o, "resource"), n = t.getSource();
2817
+ n.resId = r, e.push(n);
2818
+ }
2819
+ }), d.registerVisitor({
2820
+ from: "sheetProtection",
2821
+ to: "protection",
2822
+ openTag: (t) => {
2823
+ const e = t.getSource();
2824
+ for (const o of L) {
2825
+ const s = t.hasAttribute(o.attribute) ? t.getAttribute(o.attribute) : null;
2826
+ e[o.key] = Tt(o, s);
2827
+ }
2828
+ if (e.sheet) return;
2829
+ const o = {};
2830
+ 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;
2831
+ }
2832
+ }), d.registerVisitor({
2833
+ from: "protectedRanges",
2834
+ to: "protectedRanges",
2835
+ openTag: (t) => {
2836
+ t.setSource([]);
2837
+ }
2838
+ }), d.registerVisitor({
2839
+ from: "protectedRange",
2840
+ to: [],
2841
+ openTag: (t) => {
2842
+ let e = t.getAttribute("sqref");
2843
+ e && (e = e.trim().split(/\s+/).join(","));
2844
+ const o = {}, s = {
2845
+ r: e,
2846
+ v: o
2847
+ };
2848
+ t.copyToObject(o, "name"), t.copyToObject(o, "securityDescriptor");
2849
+ const r = {};
2850
+ 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);
2851
+ },
2852
+ closeTag: (t) => {
2853
+ const e = t.getSource();
2854
+ e?.r && e.v.name || t.setSource(void 0);
2855
+ }
2856
+ }), d.registerVisitor({
2857
+ from: "sheetFormatPr",
2858
+ to: "sheetFormatPr",
2859
+ openTag: (t) => {
2860
+ t.copyToObject(o, "defaultColSize", _o, "defaultColWidth");
2861
+ const e = t.getAttribute("customHeight");
2862
+ "1" !== e && "true" !== e || t.copyToObject(o, "defaultRowSize", _o, "defaultRowHeight");
2863
+ const s = t.getAttribute("baseColWidth", No);
2864
+ s && 8 !== s && (o.baseColSize = s), f = !!t.getAttribute("zeroHeight", Do);
2865
+ }
2866
+ }), d.registerVisitor({
2867
+ from: "cols",
2868
+ to: "cols",
2869
+ openTag: (t) => {
2870
+ t.setSource([]);
2871
+ }
2872
+ }), d.registerVisitor({
2873
+ from: "col",
2874
+ to: [],
2875
+ openTag: (t) => {
2876
+ 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;
2877
+ e.r = Nt.runToString(r, n, !0);
2878
+ const i = {};
2879
+ 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");
2880
+ }
2881
+ }), d.registerVisitor({
2882
+ from: "oleObjects",
2883
+ to: null,
2884
+ openTag: (t) => {
2885
+ t.warn("'OLE Objects' are not supported.");
2886
+ }
2887
+ });
2888
+ let Lt = !1, Vt = !1, jt = 0, Ht = "", Wt = "";
2889
+ const Xt = (t) => {
2890
+ const e = t.indexOf(":");
2891
+ return -1 === e ? t : t.slice(e + 1);
2892
+ }, qt = new os();
2893
+ return xs(x, o, d.createEventHandler(o, i, a), a, u, {
2894
+ onOpenTag: (t) => {
2895
+ Lt = !0;
2896
+ const e = Xt(t.name);
2897
+ "t" === e || "v" === e ? 0 === jt && (Vt = !0) : "rPh" === e || "phoneticPr" === e ? jt++ : 0 === jt && qt.onOpenTag(e, t.attributes);
2898
+ },
2899
+ onText: (t) => {
2900
+ Vt && (Ht += t, qt.onText(t));
2901
+ },
2902
+ onCloseTag: (t) => {
2903
+ const e = Xt(t.name);
2904
+ "t" === e || "v" === e ? Vt = !1 : "rPh" === e || "phoneticPr" === e ? jt > 0 && jt-- : qt.onCloseTag(e);
2905
+ },
2906
+ onEnd: () => {
2907
+ if (!Lt) return;
2908
+ const t = qt.take();
2909
+ Lt = !1, Vt = !1, jt = 0;
2910
+ const e = l(Ht);
2911
+ return Ht = "", Wt = e, t ? {
2912
+ t: "r",
2913
+ v: {
2914
+ type: "richText",
2915
+ data: { runs: ss(t, h?.get(hs)) }
2916
+ }
2917
+ } : r(e);
2918
+ },
2919
+ onError: (t) => {}
2920
+ }, h, r, () => f, () => Wt);
2921
+ }, ps = class {
2922
+ static {
2923
+ this.Collapsed = 1;
2924
+ }
2925
+ static {
2926
+ this.CustomFormat = 2;
2927
+ }
2928
+ static {
2929
+ this.CustomHeight = 4;
2930
+ }
2931
+ static {
2932
+ this.Hidden = 8;
2933
+ }
2934
+ static {
2935
+ this.Ht = 16;
2936
+ }
2937
+ static {
2938
+ this.OutlineLevel = 32;
2939
+ }
2940
+ static {
2941
+ this.Ph = 64;
2942
+ }
2943
+ static {
2944
+ this.R = 128;
2945
+ }
2946
+ static {
2947
+ this.S = 256;
2948
+ }
2949
+ static {
2950
+ this.Spans = 512;
2951
+ }
2952
+ }, fs = (t, e, o) => {
2953
+ if (t[0].value[0] === t[1].value[0]) return e;
2954
+ }, gs = /^\s*TABLE\s*\(/i, ms = {
2955
+ colStart: 0,
2956
+ colEnd: 0,
2957
+ rowStart: 0,
2958
+ rowEnd: 0
2959
+ }, bs = (t) => "1" === t || "true" === t, xs = (t, e, o, s, r, n, i, a, l, c) => {
2960
+ let u = !1;
2961
+ const d = [], p = i?.get(us), f = i?.get(hs), g = /* @__PURE__ */ new Map();
2962
+ let m = !1, b = [], x = !1, y = null, v = null, w = null, S = null, k = null, C = null;
2963
+ const A = i?.get("richData") ?? $t.EmptyArray;
2964
+ let E = null, I = !1;
2965
+ const P = Nt.normalizeA1ToR1C1, O = Rt.createConflatingRanges(), D = /* @__PURE__ */ new Map(), N = [], _ = [];
2966
+ let $ = !1, R = !1, M = null;
2967
+ const L = (t) => {
2968
+ const e = (i?.get("metadata"))?.values;
2969
+ if (!e) return;
2970
+ const o = parseInt(t, 10);
2971
+ if (!Number.isFinite(o) || o < 1) return;
2972
+ const s = e[o - 1]?.get("XLRICHVALUE");
2973
+ return void 0 !== s?.richValueIndex ? A[s.richValueIndex] : void 0;
2974
+ };
2975
+ let V = !1;
2976
+ const j = Rt.createConflatingRanges();
2977
+ let B, F = !1, H = -1, W = -1, z = null, X = null;
2978
+ const q = (t) => ({
2979
+ t: "r",
2980
+ v: {
2981
+ type: "hyperlink",
2982
+ data: {
2983
+ address: B,
2984
+ friendly: t
2985
+ }
2986
+ }
2987
+ });
2988
+ let U = null;
2989
+ const G = [];
2990
+ 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;
2991
+ const yt = (t) => {
2992
+ let s = t.name;
2993
+ const a = s.indexOf(":");
2994
+ if (-1 !== a && (s = s.slice(a + 1)), xt++, xt % 196608 == 0 && r?.(xt), X) {
2995
+ const e = t.attributes;
2996
+ switch (s) {
2997
+ case "v":
2998
+ m = !0;
2999
+ break;
3000
+ case "f":
3001
+ switch (x = !0, e.t ?? null) {
3002
+ case null:
3003
+ case "normal": break;
3004
+ case "shared":
3005
+ const t = e.si;
3006
+ v = e.ref, y = t;
3007
+ break;
3008
+ case "array":
3009
+ v = e.ref, M = v;
3010
+ break;
3011
+ case "dataTable": {
3012
+ const t = ((t, e, o) => {
3013
+ const s = t.r1, r = bs(t.del1);
3014
+ if (!s && !r) return null;
3015
+ const n = t.ref ?? Nt.cellToString({
3016
+ rowIndex: e,
3017
+ colIndex: o
3018
+ }), i = Nt.fastStringToRange(n);
3019
+ if (!i) return null;
3020
+ const a = { ref: {
3021
+ rowStart: i.rowStart,
3022
+ colStart: i.colStart,
3023
+ rowEnd: i.rowEnd,
3024
+ colEnd: i.colEnd
3025
+ } }, l = bs(t.dt2D);
3026
+ if (l || bs(t.dtr) ? (s && (a.rowInput = s), r && (a.rowInputDeleted = !0)) : (s && (a.columnInput = s), r && (a.columnInputDeleted = !0)), l) {
3027
+ const e = t.r2;
3028
+ e && (a.columnInput = e), bs(t.del2) && (a.columnInputDeleted = !0);
3029
+ }
3030
+ return a;
3031
+ })(e, H, W);
3032
+ t && (_.push(t), bs(e.ca) && j.append(H, W));
3033
+ return;
3034
+ }
3035
+ }
3036
+ const t = e.ca;
3037
+ void 0 !== t && (V = "1" === t);
3038
+ break;
3039
+ case "is":
3040
+ F = !0;
3041
+ return;
3042
+ }
3043
+ F && !x && n?.onOpenTag?.(t);
3044
+ return;
3045
+ }
3046
+ if (u) {
3047
+ if ("c" === s) {
3048
+ X = t, B = void 0;
3049
+ const e = t.attributes, o = e.r;
3050
+ W = void 0 !== o ? Nt.fastStringToCol(o) : W + 1;
3051
+ const s = e.t;
3052
+ void 0 === s ? U = null : (U = s, "str" === U && (F = !0));
3053
+ let r = e.s;
3054
+ 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 = {
3055
+ colStart: W,
3056
+ rowStart: H,
3057
+ colEnd: W,
3058
+ rowEnd: H,
3059
+ value: r
3060
+ }, b.push(pt))), M = null, R = !1, I = !1;
3061
+ const n = e.cm;
3062
+ $ = void 0 !== n && ((t) => {
3063
+ const e = (i?.get("metadata"))?.cells;
3064
+ if (!e) return !1;
3065
+ const o = parseInt(t, 10);
3066
+ return !(!Number.isFinite(o) || o < 1) && !0 === (e[o - 1]?.get("XLDAPR"))?.fDynamic;
3067
+ })(n);
3068
+ const a = e.vm;
3069
+ if (void 0 !== a) {
3070
+ const t = L(a);
3071
+ if (Mt.isError(t)) {
3072
+ const e = t.getCode();
3073
+ z = {
3074
+ t: "e",
3075
+ v: e
3076
+ }, $ && e === Mt.Code.Spill && (R = !0);
3077
+ }
3078
+ }
3079
+ }
3080
+ } else {
3081
+ if (gt && "row" === s) {
3082
+ u = !0;
3083
+ const e = t.attributes.r;
3084
+ if (H = void 0 !== e ? parseInt(e) - 1 : H + 1, W = -1, l?.()) {
3085
+ const t = d[d.length - 1];
3086
+ t && t.max + 1 === H ? t.max = H : d.push({
3087
+ min: H,
3088
+ max: H
3089
+ });
3090
+ }
3091
+ 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) {
3092
+ const t = void 0 !== Y && ("1" === Y || "true" === Y), e = void 0 !== et && ("1" === et || "true" === et);
3093
+ bt = e && void 0 !== ot ? ot : null, e && null === bt && (bt = "0"), K = {
3094
+ min: H,
3095
+ max: H,
3096
+ value: {
3097
+ sz: void 0 === Q ? -1 : parseFloat(Q),
3098
+ csz: t,
3099
+ h: void 0 !== tt && ("1" === tt || "true" === tt),
3100
+ s: null === bt ? void 0 : "0" === bt ? 0 : parseInt(bt),
3101
+ l: void 0 === st || "0" === st ? 0 : parseInt(st),
3102
+ cl: void 0 !== rt && ("1" === rt || "true" === rt)
3103
+ }
3104
+ }, G.push(K);
3105
+ } else K.max = H;
3106
+ J = H, dt = !1;
3107
+ return;
3108
+ }
3109
+ if ("sheetData" === s && (gt = !0), !ft && "sheetData" === s) {
3110
+ ft = !0;
3111
+ const t = e.cols, o = t ? t.length : 0;
3112
+ for (let e = 0; !mt && e < o; e++) t[e].v.s && (mt = !0);
3113
+ }
3114
+ o?.onOpenTag?.(t);
3115
+ }
3116
+ }, wt = (e) => {
3117
+ let s = e.name;
3118
+ if ("sheetData" === s && (gt = !1), !x || "c" !== s && "f" !== s || (y && (S = D.get(y) ?? null), S && (B = ((t) => {
3119
+ if (t.length < 11 || 104 != (32 | t.charCodeAt(0))) return;
3120
+ if (!/^HYPERLINK\(/i.test(t)) return;
3121
+ let e = 1, o = !1, s = 10;
3122
+ for (; s < t.length && e > 0; s++) {
3123
+ const r = t.charCodeAt(s);
3124
+ o ? 34 === r && (34 === t.charCodeAt(s + 1) ? s++ : o = !1) : 34 === r ? o = !0 : 40 === r ? e++ : 41 === r && e--;
3125
+ }
3126
+ if (0 !== e || t.slice(s).trim().length > 0) return;
3127
+ const r = /^HYPERLINK\(\s*"((?:[^"]|"")*)"\s*[,)]/i.exec(t);
3128
+ return r ? r[1].replace(/""/g, "\"") : null;
3129
+ })(S[2]), O.append(H, W, S), V && j.append(H, W)), null !== M && N.push([M, $ ? R ? "error" : "dynamic" : "fixed"]), x = !1, S = null, y = null, v = null, m = !1, V = !1, M = null, $ = !1, R = !1), X) {
3130
+ const o = s.indexOf(":");
3131
+ if (-1 !== o && (s = s.slice(o + 1)), F) if ("is" === s || "v" === s) {
3132
+ const e = n?.onEnd?.();
3133
+ null == e || I && "" === c?.() || t.pushAt(H, W, void 0 !== B && "number" == typeof e ? q(c?.() ?? "") : "number" == typeof e ? "" + e : e);
3134
+ } else "f" !== s && n?.onCloseTag?.(e);
3135
+ m && (m = !1), "c" === s && (X = null, F = !1);
3136
+ return;
3137
+ }
3138
+ if (u) return u = !1, void (pt = null);
3139
+ o?.onCloseTag?.(e);
3140
+ }, Tt = (e) => {
3141
+ const r = e.trim();
3142
+ if (m) {
3143
+ switch (z = null, U) {
3144
+ case null:
3145
+ case "n":
3146
+ z = Zt.flushSubnormal(parseFloat(r));
3147
+ break;
3148
+ case "b":
3149
+ z = "1" === r || "true" === r;
3150
+ break;
3151
+ case "s": {
3152
+ const t = parseInt(r, 10);
3153
+ let e = g.get(t);
3154
+ if (void 0 === e) {
3155
+ const o = p?.get(t);
3156
+ e = o ? ss(o, f) : null, g.set(t, e);
3157
+ }
3158
+ z = e ? {
3159
+ t: "r",
3160
+ v: {
3161
+ type: "richText",
3162
+ data: { runs: e }
3163
+ }
3164
+ } : r;
3165
+ break;
3166
+ }
3167
+ case "d": {
3168
+ const t = ((t, e = !1) => {
3169
+ if (!t) return null;
3170
+ const o = Qo.exec(t);
3171
+ if (o) {
3172
+ const [, t, e, s] = o;
3173
+ return void 0 === t && void 0 === e && void 0 === s ? null : (3600 * parseFloat(t ?? "0") + 60 * parseFloat(e ?? "0") + parseFloat(s ?? "0")) / 86400;
3174
+ }
3175
+ const s = Zo.exec(t);
3176
+ if (!s) return null;
3177
+ const [, r, n, i, a, l, c, u] = s;
3178
+ if (void 0 === r && void 0 === a) return null;
3179
+ let h = 0;
3180
+ if (void 0 !== r) {
3181
+ const t = parseInt(r, 10), o = parseInt(n, 10), s = parseInt(i, 10);
3182
+ if (o < 1 || o > 12 || s < 1 || s > 31) return null;
3183
+ const a = Yo(t, o, s) - ts;
3184
+ if (h = a <= 60 ? a - 1 : a, e && (h -= 1462), h < 0) return null;
3185
+ }
3186
+ 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);
3187
+ return h;
3188
+ })(r, !0 === i?.get(cs));
3189
+ null !== t ? z = t : a && (s?.(`Date '${r}' in cell ${Nt.cellToString({
3190
+ colIndex: W,
3191
+ rowIndex: H
3192
+ })} is not a date this workbook can hold; kept as text.`, void 0, "xlsx.cell.isoDateText"), z = "" + a(r));
3193
+ break;
3194
+ }
3195
+ case "e":
3196
+ if ("#VALUE!" === r) {
3197
+ const t = X.attributes.vm;
3198
+ if (void 0 !== t) {
3199
+ const e = L(t);
3200
+ if (Mt.isError(e)) {
3201
+ z = {
3202
+ t: "e",
3203
+ v: e.getCode()
3204
+ };
3205
+ break;
3206
+ }
3207
+ if (Jt.isJSON(e)) {
3208
+ z = {
3209
+ t: "r",
3210
+ v: e
3211
+ };
3212
+ break;
3213
+ }
3214
+ }
3215
+ }
3216
+ const t = Mt.getBuiltInByLabel(r);
3217
+ t ? z = {
3218
+ t: "e",
3219
+ v: t.getCode()
3220
+ } : (z = r, s?.(`Unknown formula error '${r}' in cell ${Nt.cellToString({
3221
+ colIndex: W,
3222
+ rowIndex: H
3223
+ })}`));
3224
+ break;
3225
+ case "str":
3226
+ case "inlineStr": F = !0;
3227
+ }
3228
+ null !== z && t.pushAt(H, W, void 0 === B || "number" != typeof z && "boolean" != typeof z ? z : q(z));
3229
+ }
3230
+ const l = null !== y;
3231
+ if (y) {
3232
+ if (k === y) S = C;
3233
+ else {
3234
+ if (S = D.get(y) ?? null, !S) {
3235
+ const t = [];
3236
+ w = P(r, H, W, t), S = [
3237
+ w,
3238
+ t,
3239
+ r
3240
+ ], D.set(y, S);
3241
+ }
3242
+ k = y, C = S;
3243
+ }
3244
+ y = null;
3245
+ }
3246
+ if (x) {
3247
+ let t = r;
3248
+ const e = l ? void 0 : i?.get(ls);
3249
+ if (e) {
3250
+ const o = ((t) => {
3251
+ if (t.length < Vo.length) return Fo;
3252
+ if (t.slice(0, Vo.length).toUpperCase() !== jo) return Fo;
3253
+ const e = Wo(t, Vo.length);
3254
+ if (null === e) return Fo;
3255
+ if (41 !== t.charCodeAt(e.end)) return Fo;
3256
+ if (44 !== t.charCodeAt(e.end + 1)) return Fo;
3257
+ if (41 !== t.charCodeAt(t.length - 1)) return Fo;
3258
+ const o = e.value;
3259
+ return o.toUpperCase() === Bo ? Ho : 0 === o.length ? Fo : {
3260
+ kind: "formula",
3261
+ formula: o
3262
+ };
3263
+ })(r);
3264
+ "none" !== o.kind && (E ??= new Xo(e), "spilled" === o.kind ? I = E.placeholder(H, W) : E.anchor(H, W, o.formula) && (t = o.formula, V ||= ((t) => zo(t).some((t) => T(t) || !0 === Vt.get(t)?.getDeclaration().getReturnType()?.isVolatile()))(t)));
3265
+ }
3266
+ if (I) V = !1;
3267
+ else {
3268
+ const e = [];
3269
+ w = P(t, H, W, e), S = [
3270
+ w,
3271
+ e,
3272
+ t
3273
+ ];
3274
+ }
3275
+ }
3276
+ F ? n?.onText?.(e) : u || o?.onText?.(r);
3277
+ }, St = {
3278
+ r: void 0,
3279
+ t: void 0,
3280
+ s: void 0,
3281
+ cm: void 0,
3282
+ vm: void 0
3283
+ }, kt = {
3284
+ name: "c",
3285
+ attributes: St,
3286
+ isSelfClosing: !1
3287
+ }, Ct = {
3288
+ t: void 0,
3289
+ si: void 0,
3290
+ ref: void 0,
3291
+ ca: void 0
3292
+ }, At = {
3293
+ name: "f",
3294
+ attributes: Ct,
3295
+ isSelfClosing: !1
3296
+ }, Et = {
3297
+ name: "v",
3298
+ attributes: {},
3299
+ isSelfClosing: !1
3300
+ }, It = {
3301
+ r: void 0,
3302
+ s: void 0,
3303
+ ht: void 0,
3304
+ hidden: void 0,
3305
+ collapsed: void 0,
3306
+ customHeight: void 0,
3307
+ customFormat: void 0,
3308
+ outlineLevel: void 0
3309
+ }, Pt = {
3310
+ name: "row",
3311
+ attributes: It,
3312
+ isSelfClosing: !1
3313
+ }, Ot = Oo.NEED_MORE, Dt = Oo.NOT_HANDLED, _t = Oo.decodeText;
3314
+ let Lt = !1;
3315
+ const jt = (t, e, o, s) => {
3316
+ for (;;) {
3317
+ let r = 0;
3318
+ for (; e < o && (32 === (r = t.charCodeAt(e)) || 9 === r || 10 === r || 13 === r);) e++;
3319
+ if (e >= o) return Ot;
3320
+ if (62 === r) return Lt = !1, e + 1;
3321
+ if (47 === r) return e + 1 >= o ? Ot : 62 !== t.charCodeAt(e + 1) ? Dt : (Lt = !0, e + 2);
3322
+ const n = e;
3323
+ for (; e < o && 61 !== (r = t.charCodeAt(e));) {
3324
+ if (62 === r || 47 === r || 32 === r || 9 === r || 10 === r || 13 === r) return Dt;
3325
+ e++;
3326
+ }
3327
+ if (e + 1 >= o) return Ot;
3328
+ const i = e - n, a = t.charCodeAt(e + 1);
3329
+ if (34 !== a && 39 !== a) return Dt;
3330
+ const l = e + 2;
3331
+ let c = l;
3332
+ for (; c < o && (r = t.charCodeAt(c)) !== a;) {
3333
+ if (38 === r || r < 32) return Dt;
3334
+ c++;
3335
+ }
3336
+ if (c >= o) return Ot;
3337
+ e = c + 1;
3338
+ const u = t.charCodeAt(n);
3339
+ if (2 === s) switch (i) {
3340
+ case 1:
3341
+ 114 === u ? It.r = t.slice(l, c) : 115 === u && (It.s = t.slice(l, c));
3342
+ break;
3343
+ case 2:
3344
+ t.startsWith("ht", n) && (It.ht = t.slice(l, c));
3345
+ break;
3346
+ case 6:
3347
+ t.startsWith("hidden", n) && (It.hidden = t.slice(l, c));
3348
+ break;
3349
+ case 9:
3350
+ t.startsWith("collapsed", n) && (It.collapsed = t.slice(l, c));
3351
+ break;
3352
+ 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));
3353
+ }
3354
+ 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)));
3355
+ else if (1 === i) 116 === u && (Ct.t = t.slice(l, c));
3356
+ else if (2 === i) {
3357
+ const e = t.charCodeAt(n + 1);
3358
+ 115 === u && 105 === e ? Ct.si = t.slice(l, c) : 99 === u && 97 === e && (Ct.ca = t.slice(l, c));
3359
+ } else 3 === i && t.startsWith("ref", n) && (Ct.ref = t.slice(l, c));
3360
+ }
3361
+ }, Bt = (t, e, o) => 47 === t.charCodeAt(e + 1) && t.charCodeAt(e + 2) === o && 62 === t.charCodeAt(e + 3);
3362
+ return {
3363
+ ...o,
3364
+ onEnd: () => {
3365
+ if (l?.()) {
3366
+ let t = 0;
3367
+ const e = [], o = (t, e) => ({
3368
+ min: t,
3369
+ max: e,
3370
+ value: {
3371
+ sz: -1,
3372
+ csz: !1,
3373
+ h: !0,
3374
+ s: void 0,
3375
+ l: 0,
3376
+ cl: !1
3377
+ }
3378
+ });
3379
+ for (const s of d) s.min > t && e.push(o(t, s.min - 1)), t = Math.max(t, s.max + 1);
3380
+ t <= vt && e.push(o(t, vt)), e.length > 0 && (G.push(...e), G.sort((t, e) => t.min - e.min));
3381
+ }
3382
+ G.length > 0 && (e.rows = Nt.runsToRefs(G, !1));
3383
+ let s = O.done(fs);
3384
+ s = ((t, e) => {
3385
+ let o = null;
3386
+ for (let e = 0; e < t.length; e++) {
3387
+ const s = t[e];
3388
+ if (!gs.test(s.value[2])) continue;
3389
+ o ??= /* @__PURE__ */ new Map();
3390
+ const r = s.value[0], n = o.get(r);
3391
+ n ? n.push(s) : o.set(r, [s]);
3392
+ }
3393
+ if (null === o) return t;
3394
+ const s = /* @__PURE__ */ new Set();
3395
+ for (const t of o.values()) {
3396
+ const o = t[0], r = {
3397
+ rowStart: o.rowStart,
3398
+ colStart: o.colStart,
3399
+ rowEnd: o.rowEnd,
3400
+ colEnd: o.colEnd
3401
+ };
3402
+ let n = 0;
3403
+ for (let e = 0; e < t.length; e++) {
3404
+ const o = t[e];
3405
+ 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);
3406
+ }
3407
+ if (n !== (r.rowEnd - r.rowStart + 1) * (r.colEnd - r.colStart + 1)) continue;
3408
+ const a = Jo(Nt.resolveRelativeToA1(o.value[1], r.rowStart, r.colStart), r);
3409
+ if (a) {
3410
+ e.push(a);
3411
+ for (let e = 0; e < t.length; e++) s.add(t[e]);
3412
+ }
3413
+ }
3414
+ return 0 === s.size ? t : t.filter((t) => !s.has(t));
3415
+ })(s, _);
3416
+ const r = s.length;
3417
+ if (r > 0 || _.length > 0) {
3418
+ const t = new Array(r);
3419
+ for (let e = 0; e < r; e++) {
3420
+ const o = s[e], r = Nt.rangeToString(o), n = o.value[1], i = Nt.resolveRelativeToA1(n, o.rowStart, o.colStart);
3421
+ t[e] = [r, i];
3422
+ }
3423
+ for (let e = 0; e < _.length; e++) {
3424
+ const o = _[e], s = o.ref;
3425
+ t.push([Nt.cellToString({
3426
+ rowIndex: s.rowStart,
3427
+ colIndex: s.colStart
3428
+ }), h(o)]), N.push([Nt.rangeToString(s), "dynamic"]);
3429
+ }
3430
+ e.formulas = t;
3431
+ }
3432
+ const n = j.done(!0), i = n.length;
3433
+ if (i > 0) {
3434
+ const t = new Array(i);
3435
+ for (let e = 0; e < i; e++) {
3436
+ const o = n[e], s = Nt.rangeToString(o);
3437
+ t[e] = s;
3438
+ }
3439
+ e.volatile = t;
3440
+ }
3441
+ E && N.push(...E.getFormulaArray()), N.length > 0 && (e.formulaArray = [...N]);
3442
+ const a = b.length;
3443
+ if (a > 0) {
3444
+ b.sort(Rt.createRangeComparator(zt.Axis.Column));
3445
+ let t = b[0], o = t.colStart, s = t.colEnd, r = t.rowEnd, n = t.value;
3446
+ const i = [];
3447
+ i.push(t);
3448
+ let l = null;
3449
+ 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);
3450
+ const c = i.length, u = new Array(c);
3451
+ for (let t = 0; t < c; t++) {
3452
+ const e = i[t], o = Nt.rangeToString(e);
3453
+ u[t] = [o, e.value];
3454
+ }
3455
+ e.directStyles = u;
3456
+ }
3457
+ const c = t.build();
3458
+ c && (e.data = c.tuples), o?.onEnd?.();
3459
+ },
3460
+ onOpenTag: yt,
3461
+ onCloseTag: wt,
3462
+ onText: Tt,
3463
+ elementScanners: [{
3464
+ name: "c",
3465
+ scan: (t, e, o) => {
3466
+ if (!u || null !== X) return Dt;
3467
+ St.r = St.t = St.s = St.cm = St.vm = void 0;
3468
+ let s = jt(t, e + 2, o, 0);
3469
+ if (s < 0) return s;
3470
+ const r = St.t;
3471
+ if (void 0 === St.r || "str" === r || "inlineStr" === r) return Dt;
3472
+ let n = !1, i = -1, a = -1, l = -1, c = -1, h = s;
3473
+ if (!Lt) for (Ct.t = Ct.si = Ct.ref = Ct.ca = void 0;;) {
3474
+ const e = t.indexOf("<", s);
3475
+ if (-1 === e || e + 3 >= o) return Ot;
3476
+ for (let o = s; o < e; o++) {
3477
+ const e = t.charCodeAt(o);
3478
+ if (32 !== e && 9 !== e && 10 !== e && 13 !== e) return Dt;
3479
+ }
3480
+ const r = t.charCodeAt(e + 1), u = t.charCodeAt(e + 2);
3481
+ if (47 === r) {
3482
+ if (!Bt(t, e, 99)) return Dt;
3483
+ h = e + 4;
3484
+ break;
3485
+ }
3486
+ if (102 === r && !n && -1 === l && (32 === u || 62 === u || 47 === u)) {
3487
+ if (n = !0, s = jt(t, e + 2, o, 1), s < 0) return s;
3488
+ if ("dataTable" === Ct.t) return Dt;
3489
+ if (Lt) continue;
3490
+ const r = t.indexOf("<", s);
3491
+ if (-1 === r || r + 3 >= o) return Ot;
3492
+ if (!Bt(t, r, 102)) return Dt;
3493
+ i = s, a = r, s = r + 4;
3494
+ continue;
3495
+ }
3496
+ if (118 === r && 62 === u && -1 === l) {
3497
+ const r = t.indexOf("<", e + 3);
3498
+ if (-1 === r || r + 3 >= o) return Ot;
3499
+ if (!Bt(t, r, 118)) return Dt;
3500
+ l = e + 3, c = r, s = r + 4;
3501
+ continue;
3502
+ }
3503
+ return Dt;
3504
+ }
3505
+ return yt(kt), 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(kt), h;
3506
+ }
3507
+ }, {
3508
+ name: "row",
3509
+ openTag: Pt,
3510
+ scan: (t, e, o) => {
3511
+ if (!gt || u || null !== X) return Dt;
3512
+ It.r = It.s = It.ht = It.hidden = It.collapsed = It.customHeight = It.customFormat = It.outlineLevel = void 0;
3513
+ const s = jt(t, e + 4, o, 2);
3514
+ return s < 0 ? s : Lt || void 0 === It.r ? Dt : (yt(Pt), s);
3515
+ }
3516
+ }]
3517
+ };
3518
+ }, ys = /* @__PURE__ */ new Map([
3519
+ ["urn:schemas-microsoft-com:vml", "v"],
3520
+ ["urn:schemas-microsoft-com:office:office", "o"],
3521
+ ["urn:schemas-microsoft-com:office:excel", "x"]
3522
+ ]), 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;
3523
+ function ks(t) {
3524
+ if (!t || !((t) => {
3525
+ let e;
3526
+ for (Ss.lastIndex = 0; null !== (e = Ss.exec(t));) {
3527
+ const t = ys.get(e[2] ?? e[3] ?? "");
3528
+ if (t && t !== (e[1] ?? "")) return !0;
3529
+ }
3530
+ return !1;
3531
+ })(t)) return t;
3532
+ const e = [], o = (t, o, s) => {
3533
+ const r = t.indexOf(":");
3534
+ if (-1 === r && s) return null;
3535
+ const n = -1 === r ? "" : t.substring(0, r);
3536
+ if ("xmlns" === n) return null;
3537
+ const i = ((t, o) => {
3538
+ const s = o?.get(t);
3539
+ if (void 0 !== s) return s;
3540
+ for (let o = e.length - 1; o >= 0; o--) {
3541
+ const s = e[o].bindings.get(t);
3542
+ if (void 0 !== s) return s;
3543
+ }
3544
+ })(n, o), a = void 0 !== i ? ys.get(i) : void 0;
3545
+ return a ? `${a}:${-1 === r ? t : t.substring(r + 1)}` : null;
3546
+ };
3547
+ let s = !1, r = !1;
3548
+ const n = t.replace(ws, (t, n, i, a, l) => {
3549
+ if (n) {
3550
+ const s = e[e.length - 1], r = o(i, null, !1);
3551
+ return s && s.name === i && (s.nested > 0 ? s.nested-- : e.pop()), r ? `</${r}>` : t;
3552
+ }
3553
+ const c = ((t) => {
3554
+ let e, o = null;
3555
+ for (Ss.lastIndex = 0; null !== (e = Ss.exec(t));) (o ??= /* @__PURE__ */ new Map()).set(e[1] ?? "", e[2] ?? e[3] ?? "");
3556
+ return o;
3557
+ })(a);
3558
+ c?.forEach((t, e) => {
3559
+ const o = [...ys].find(([, t]) => t === e)?.[0];
3560
+ o && o !== t && (s = !0);
3561
+ });
3562
+ const u = o(i, c, !1);
3563
+ let h = a.replace(Ts, (t, e, s, r, n) => {
3564
+ if ("xmlns" === s || s.startsWith("xmlns:")) {
3565
+ const e = n.slice(1, -1);
3566
+ return ys.has(e) ? "" : t;
3567
+ }
3568
+ const i = o(s, c, !0);
3569
+ return i ? `${e}${i}${r}${n}` : t;
3570
+ });
3571
+ if (r || (r = !0, h = h.replace(/\s+$/, "") + vs), !l) {
3572
+ const t = e[e.length - 1];
3573
+ c ? e.push({
3574
+ name: i,
3575
+ bindings: c,
3576
+ nested: 0
3577
+ }) : t && t.name === i && t.nested++;
3578
+ }
3579
+ return `<${u ?? i}${h}${l}>`;
3580
+ });
3581
+ return s ? t : n;
3582
+ }
3583
+ var Cs = {
3584
+ creator: "author",
3585
+ category: "category",
3586
+ description: "comments",
3587
+ contentStatus: "contentStatus",
3588
+ created: "creationDate",
3589
+ keywords: "keywords",
3590
+ lastModifiedBy: "lastAuthor",
3591
+ modified: "lastModifiedDate",
3592
+ lastPrinted: "lastPrinted",
3593
+ revision: "revisionNumber",
3594
+ subject: "subject",
3595
+ title: "title"
3596
+ }, As = {
3597
+ Company: "company",
3598
+ Manager: "manager"
3599
+ }, Es = {
3600
+ lpwstr: Ht.Type.String,
3601
+ lpstr: Ht.Type.String,
3602
+ bstr: Ht.Type.String,
3603
+ i1: Ht.Type.Number,
3604
+ i2: Ht.Type.Number,
3605
+ i4: Ht.Type.Number,
3606
+ i8: Ht.Type.Number,
3607
+ int: Ht.Type.Number,
3608
+ ui1: Ht.Type.Number,
3609
+ ui2: Ht.Type.Number,
3610
+ ui4: Ht.Type.Number,
3611
+ ui8: Ht.Type.Number,
3612
+ uint: Ht.Type.Number,
3613
+ r4: Ht.Type.Float,
3614
+ r8: Ht.Type.Float,
3615
+ decimal: Ht.Type.Float,
3616
+ bool: Ht.Type.Boolean,
3617
+ filetime: Ht.Type.Date,
3618
+ date: Ht.Type.Date
3619
+ }, Is = (t) => {
3620
+ const e = t.kind ? Es[t.kind] : void 0;
3621
+ if (!e) return null;
3622
+ const o = t.value.trim();
3623
+ let s;
3624
+ if (e === Ht.Type.String) s = {
3625
+ key: t.key,
3626
+ type: e,
3627
+ value: t.value
3628
+ };
3629
+ else if (e === Ht.Type.Boolean) {
3630
+ if ("true" !== o && "false" !== o && "1" !== o && "0" !== o) return null;
3631
+ s = {
3632
+ key: t.key,
3633
+ type: e,
3634
+ value: "true" === o || "1" === o
3635
+ };
3636
+ } else if (e === Ht.Type.Date) {
3637
+ const r = new Date(o);
3638
+ if (!o || isNaN(r.getTime())) return null;
3639
+ s = {
3640
+ key: t.key,
3641
+ type: e,
3642
+ value: r.toISOString()
3643
+ };
3644
+ } else {
3645
+ const r = Number(o);
3646
+ if (!o || !Number.isFinite(r)) return null;
3647
+ const n = e === Ht.Type.Number && r >= -2147483648 && r <= 2147483647;
3648
+ s = {
3649
+ key: t.key,
3650
+ type: n ? e : Ht.Type.Float,
3651
+ value: r
3652
+ };
3653
+ }
3654
+ return t.linkTarget && (s.linkTarget = t.linkTarget), s;
3655
+ }, Ps = "hiddenXfs", Os = (t) => (Array.isArray(t) ? t[1] : t?.v)?.s, Ds = (t) => {
3656
+ if (!t || 0 === t.length) return !1;
3657
+ const e = Nt.refsToRuns(t, !0);
3658
+ let o = 0;
3659
+ for (const t of e) {
3660
+ if (t.min > o || void 0 === t.value?.s) return !1;
3661
+ o = Math.max(o, t.max + 1);
3662
+ }
3663
+ return o > ot;
3664
+ }, Ns = (t, e) => {
3665
+ t.protection = {
3666
+ ...t.protection,
3667
+ showFormulas: e
3668
+ };
3669
+ }, _s = "pivotButtonXfs", $s = (t, e) => {
3670
+ const o = t.styles?.direct;
3671
+ if (!o || 0 === o.length) return;
3672
+ let s = null;
3673
+ const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = (t, i, a, l) => {
3674
+ let c = "";
3675
+ l && (c = n.get(l) ?? _t.JSONStableStringify(l), n.set(l, c));
3676
+ const u = `${t}|${i ?? ""}|${a ?? ""}|${c}`;
3677
+ let h = r.get(u);
3678
+ if (void 0 !== h) return h;
3679
+ const d = o[t], p = d ? Ms(d, i, a, l) : null, f = e?.get(t);
3680
+ return h = p === d ? t : p || void 0 !== f ? ((t, r) => {
3681
+ if (!s) {
3682
+ s = /* @__PURE__ */ new Map();
3683
+ for (let t = 0; t < o.length; t++) {
3684
+ let r = _t.JSONStableStringify(o[t]);
3685
+ const n = e?.get(t);
3686
+ void 0 !== n && (r += `|${n}`), s.has(r) || s.set(r, t);
3687
+ }
3688
+ }
3689
+ let n = _t.JSONStableStringify(t);
3690
+ void 0 !== r && (n += `|${r}`);
3691
+ let i = s.get(n);
3692
+ return void 0 === i && (i = o.length, o.push(t), s.set(n, i), void 0 !== r && e.set(i, r)), i;
3693
+ })(p ?? {}, f) : null, r.set(u, h), h;
3694
+ }, a = new Map((t.pivotCaches ?? []).map((t) => [t.cacheId, t.fields]));
3695
+ for (const e of t.sheets ?? []) {
3696
+ const t = b(e), o = t?.pivotTables, s = t?.directStyles;
3697
+ if (!t || !o || 0 === o.length || !s || 0 === s.length) continue;
3698
+ let r = s, n = !1;
3699
+ for (const t of o) {
3700
+ const e = Rs(t, a.get(t.cacheId));
3701
+ if (!e) continue;
3702
+ const o = [];
3703
+ for (const t of r) {
3704
+ const s = Nt.fastStringToRange(t[0]), r = Ws(s, e.coords);
3705
+ if (!r) {
3706
+ o.push(t);
3707
+ continue;
3708
+ }
3709
+ n = !0;
3710
+ for (const e of zs(s, r)) o.push([Nt.rangeToString(e), t[1]]);
3711
+ const { rowIndex: a, colIndex: l } = e.origin;
3712
+ for (let s = r.rowStart; s <= r.rowEnd; s++) {
3713
+ let n = r.colStart, c = null;
3714
+ const u = (t) => {
3715
+ null !== c && o.push([Nt.rangeToString({
3716
+ rowStart: s,
3717
+ rowEnd: s,
3718
+ colStart: n,
3719
+ colEnd: t
3720
+ }), c]);
3721
+ };
3722
+ for (let o = r.colStart; o <= r.colEnd; o++) {
3723
+ const { numberFormat: h, labelIndent: d, user: p } = e.formats.formatAt(s - a, o - l), f = i(t[1], h, d, p);
3724
+ o !== r.colStart && f === c || (o !== r.colStart && u(o - 1), n = o, c = f);
3725
+ }
3726
+ u(r.colEnd);
3727
+ }
3728
+ }
3729
+ r = o;
3730
+ }
3731
+ n && (t.directStyles = r);
3732
+ }
3733
+ }, Rs = (t, e) => {
3734
+ const o = oe(t, e);
3735
+ if (!o || !t.location) return null;
3736
+ const s = Nt.fastStringToRange(t.location), r = {
3737
+ rowIndex: s.rowStart - o.top,
3738
+ colIndex: s.colStart
3739
+ };
3740
+ return r.rowIndex < 0 || s.rowEnd !== r.rowIndex + o.rows - 1 ? null : {
3741
+ coords: {
3742
+ rowStart: r.rowIndex,
3743
+ colStart: r.colIndex,
3744
+ rowEnd: s.rowEnd,
3745
+ colEnd: r.colIndex + o.columns - 1
3746
+ },
3747
+ origin: r,
3748
+ formats: o
3749
+ };
3750
+ }, Ms = (t, e, o, s) => {
3751
+ let r = t;
3752
+ const n = s?.numberFormat ?? e ?? 0;
3753
+ if (void 0 !== t.numberFormat && Ls(t.numberFormat, n)) {
3754
+ const { numberFormat: t, ...e } = r;
3755
+ r = e;
3756
+ }
3757
+ const i = r.alignment;
3758
+ if (null !== o && i?.horizontal === Xt.HorizontalAlignment.Left && (i.indent ?? 0) === o) {
3759
+ const { horizontal: t, indent: e, ...o } = i, { alignment: s, ...n } = r;
3760
+ r = Hs(o) ? n : {
3761
+ ...n,
3762
+ alignment: o
3763
+ };
3764
+ }
3765
+ if (s) {
3766
+ const { numberFormat: t, ...e } = s;
3767
+ if (r = Bs(r, e), r.alignment && Hs(r.alignment)) {
3768
+ const { alignment: t, ...e } = r;
3769
+ r = e;
3770
+ }
3771
+ }
3772
+ if (r === t) return t;
3773
+ for (const t of Object.keys(r)) if (void 0 !== r[t] && ("named" !== t || r.named !== jt.BuiltInName.Normal)) return r;
3774
+ return null;
3775
+ }, Ls = (t, e) => t === e || qt.toBuiltInID(t) === qt.toBuiltInID(e), Vs = (t) => "object" == typeof t && null !== t && !Array.isArray(t), js = (t, e) => !(!Vs(t) || !Vs(e)) && ("solid" === t.patternType && "solid" === e.patternType ? t.foreground === e.foreground : _t.JSONStableStringify(t) === _t.JSONStableStringify(e)), Bs = (t, e) => {
3776
+ let o = null;
3777
+ const s = (e, s) => {
3778
+ o ??= { ...t }, void 0 === s ? delete o[e] : o[e] = s;
3779
+ };
3780
+ for (const o of Object.keys(t)) {
3781
+ const r = t[o], n = e[o];
3782
+ if (void 0 !== n && void 0 !== r) if ("fill" === o) js(r, n) && s(o);
3783
+ else if (Vs(r) && Vs(n)) {
3784
+ const t = Bs(r, n);
3785
+ t !== r && s(o, Object.keys(t).some((e) => void 0 !== t[e]) ? t : void 0);
3786
+ } else r === n && s(o);
3787
+ }
3788
+ return o ?? t;
3789
+ }, Fs = {
3790
+ vertical: Xt.VerticalAlignment.Bottom,
3791
+ relativeIndent: 0,
3792
+ overflow: Xt.Overflow.Visible,
3793
+ rotation: 0
3794
+ }, Hs = (t) => Object.keys(t).every((e) => void 0 === t[e] || Fs[e] === t[e]), Ws = (t, e) => {
3795
+ 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);
3796
+ return o <= s && r <= n ? {
3797
+ rowStart: o,
3798
+ rowEnd: s,
3799
+ colStart: r,
3800
+ colEnd: n
3801
+ } : null;
3802
+ }, zs = (t, e) => {
3803
+ const o = [];
3804
+ return t.rowStart < e.rowStart && o.push({
3805
+ ...t,
3806
+ rowEnd: e.rowStart - 1
3807
+ }), t.rowEnd > e.rowEnd && o.push({
3808
+ ...t,
3809
+ rowStart: e.rowEnd + 1
3810
+ }), t.colStart < e.colStart && o.push({
3811
+ rowStart: e.rowStart,
3812
+ rowEnd: e.rowEnd,
3813
+ colStart: t.colStart,
3814
+ colEnd: e.colStart - 1
3815
+ }), t.colEnd > e.colEnd && o.push({
3816
+ rowStart: e.rowStart,
3817
+ rowEnd: e.rowEnd,
3818
+ colStart: e.colEnd + 1,
3819
+ colEnd: t.colEnd
3820
+ }), o;
3821
+ }, Xs = "xfComplements", qs = (t, e) => {
3822
+ if ("string" == typeof t) return void e.push(t);
3823
+ const o = Array.isArray(t) ? t : [t];
3824
+ for (let t = 0; t < o.length; t++) {
3825
+ const s = Nt.rangeToString(o[t]);
3826
+ s && e.push(s);
3827
+ }
3828
+ }, Us = (t) => {
3829
+ const e = Array.isArray(t) ? t[1] : t.v;
3830
+ if (!e || !("s" in e)) return;
3831
+ const o = e.s;
3832
+ return delete e.s, o;
3833
+ }, Gs = (t, e, o, s) => {
3834
+ if (!t) return;
3835
+ const r = e ? 2 : 1, n = e ? o.rowStart : o.colStart, i = e ? o.rowEnd : o.colEnd;
3836
+ let a, l = -1;
3837
+ for (const o of t) {
3838
+ const t = Nt.refToRun(o, e), c = Us(o);
3839
+ t && void 0 !== c ? c !== l || (e ? a.colEnd : a.rowEnd) + 1 !== t.min ? (a = {
3840
+ colStart: e ? t.min : n,
3841
+ rowStart: e ? n : t.min,
3842
+ colEnd: e ? t.max : i,
3843
+ rowEnd: e ? i : t.max,
3844
+ value: {
3845
+ kind: r,
3846
+ index: c
3847
+ }
3848
+ }, l = c, s.push(a)) : e ? a.colEnd = t.max : a.rowEnd = t.max : l = -1;
3849
+ }
3850
+ }, Ks = {
3851
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
3852
+ "application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks",
3853
+ "application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks",
3854
+ "application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks",
3855
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks",
3856
+ "application/vnd.ms-excel.template.macroEnabled.main+xml": "workbooks",
3857
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets",
3858
+ "application/vnd.ms-excel.worksheet": "sheets",
3859
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts",
3860
+ "application/vnd.ms-excel.chartsheet": "charts",
3861
+ "application/vnd.ms-excel.macrosheet+xml": "macros",
3862
+ "application/vnd.ms-excel.macrosheet": "macros",
3863
+ "application/vnd.ms-excel.intlmacrosheet+xml": "macros",
3864
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs",
3865
+ "application/vnd.ms-excel.dialogsheet": "dialogs",
3866
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs",
3867
+ "application/vnd.ms-excel.sharedStrings": "strs",
3868
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles",
3869
+ "application/vnd.ms-excel.styles": "styles",
3870
+ "application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
3871
+ "application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops",
3872
+ "application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops",
3873
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments",
3874
+ "application/vnd.ms-excel.comments": "comments",
3875
+ "application/vnd.ms-excel.threadedcomments+xml": "threadedcomments",
3876
+ "application/vnd.ms-excel.person+xml": "people",
3877
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata",
3878
+ "application/vnd.ms-excel.sheetMetadata": "metadata",
3879
+ "application/vnd.ms-excel.featurepropertybag+xml": "featurePropertyBag",
3880
+ "application/vnd.ms-excel.externalLink": "links",
3881
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links",
3882
+ "application/vnd.openxmlformats-officedocument.theme+xml": "themes"
3883
+ }, Js = g({ readXLSX: () => er }), Zs = (t) => t.startsWith("/") ? t.slice(1) : t, Qs = [
3884
+ 208,
3885
+ 207,
3886
+ 17,
3887
+ 224,
3888
+ 161,
3889
+ 177,
3890
+ 26,
3891
+ 225
3892
+ ], Ys = /^xl\/worksheets\/[^/]+\.xml$/i, tr = (t) => "string" == typeof t ? t : (t?.runs ?? []).map((t) => t.text ?? "").join(""), er = async (t, e) => {
3893
+ const { password: s, onVBA: n, profile: c, calcOnLoad: h = "auto", createWorkbookOptions: g = {}, ...m } = e ?? {};
3894
+ await Lt.load();
3895
+ const y = !!g.origin && "string" != typeof g.origin, T = c ? new Ce("function" == typeof c ? c : void 0) : null, S = [], k = (t, e, o) => {
3896
+ S.push([
3897
+ t,
3898
+ e ?? "",
3899
+ o
3900
+ ]);
3901
+ }, C = { onWarning: k }, I = e?.progress, P = I?.onProgress ? I.onProgress.bind(I) : void 0, D = t.byteLength;
3902
+ let $ = 0, M = 0;
3903
+ const L = P ? (t) => {
3904
+ if ($ <= 0) return;
3905
+ M += t;
3906
+ const e = Math.min(D, Math.round(M / $ * D));
3907
+ P(e, D);
3908
+ } : void 0, V = import("./DFw0ibBUmPyd-wey.mjs");
3909
+ let j = null;
3910
+ try {
3911
+ j = new DOMParser();
3912
+ } catch (t) {}
3913
+ let B = null;
3914
+ try {
3915
+ B = new XMLSerializer();
3916
+ } catch (t) {}
3917
+ let F, H, X, q = null;
3918
+ j || (q = import("@xmldom/xmldom"));
3919
+ try {
3920
+ const [t, e] = await Promise.all([q, V]);
3921
+ F = new e.DOMTransformer(), H = j ?? new t.DOMParser(), X = B ?? new t.XMLSerializer();
3922
+ } catch (t) {
3923
+ throw new Error("Unable to load XLSX parser.", { cause: t });
3924
+ }
3925
+ const U = (t) => X.serializeToString(t);
3926
+ if (((t) => {
3927
+ if (t.byteLength < Qs.length) return !1;
3928
+ const e = new Uint8Array(t, 0, Qs.length);
3929
+ return Qs.every((t, o) => e[o] === t);
3930
+ })(t)) throw new Pt("This is an Excel 97-2003 workbook (.xls), which cannot be read. Save it as '.xlsx' and try again.");
3931
+ let K;
3932
+ try {
3933
+ K = await ke.create(t);
3934
+ } catch (t) {
3935
+ throw new Pt("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.", { cause: t });
3936
+ }
3937
+ T?.mark("zip-open");
3938
+ try {
3939
+ if (!K.has("[Content_Types].xml")) throw new Pt("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
3940
+ const t = (t) => {
3941
+ const e = K.getEntry(t);
3942
+ return e ? { content: e } : void 0;
3943
+ }, e = {
3944
+ workbooks: [],
3945
+ sheets: [],
3946
+ charts: [],
3947
+ dialogs: [],
3948
+ macros: [],
3949
+ strs: [],
3950
+ comments: [],
3951
+ threadedcomments: [],
3952
+ links: [],
3953
+ coreprops: [],
3954
+ extprops: [],
3955
+ custprops: [],
3956
+ themes: [],
3957
+ styles: [],
3958
+ metadata: [],
3959
+ people: [],
3960
+ featurePropertyBag: [],
3961
+ overrides: {},
3962
+ sst: "",
3963
+ style: "",
3964
+ defaults: {}
3965
+ };
3966
+ {
3967
+ const t = ((t, e) => ({
3968
+ onOpenTag: (e) => {
3969
+ const o = ((t) => {
3970
+ const e = t.indexOf(":");
3971
+ return -1 === e ? t : t.slice(e + 1);
3972
+ })(e.name), s = e.attributes;
3973
+ if ("Override" === o) {
3974
+ const e = s.ContentType, o = s.PartName;
3975
+ if (!e || !o) return;
3976
+ t.overrides[o.startsWith("/") ? o.slice(1) : o] = e;
3977
+ const r = Ks[e], n = r ? t[r] : void 0;
3978
+ Array.isArray(n) && n.push(o);
3979
+ } else if ("Default" === o) {
3980
+ const e = s.Extension, o = s.ContentType;
3981
+ e && (t.defaults[e.toLowerCase()] = o);
3982
+ }
3983
+ },
3984
+ onEnd: () => {
3985
+ t.sst = t.strs.length > 0 ? t.strs[0] : "", t.style = t.styles.length > 0 ? t.styles[0] : "";
3986
+ },
3987
+ onError: (t) => {
3988
+ e?.(`Error parsing content types: ${t?.message ?? t}`);
3989
+ }
3990
+ }))(e, (t) => {
3991
+ S.push([t, "[Content_Types].xml"]);
3992
+ }), o = await K.getTextStream("[Content_Types].xml");
3993
+ if (!o) throw new Error("Error parsing content types: '[Content_Types].xml'");
3994
+ try {
3995
+ await yo.parseStream(o, t, { xmlns: !1 });
3996
+ } catch (t) {
3997
+ throw new Error("Error parsing content types: '[Content_Types].xml'", { cause: t });
3998
+ }
3999
+ y && await K.getBuffer("[Content_Types].xml");
4000
+ }
4001
+ T?.mark("content-types");
4002
+ const s = e.sst, m = /* @__PURE__ */ new Set();
4003
+ for (const t of e.sheets) m.add(Zs(t));
4004
+ s && m.add(Zs(s));
4005
+ for (const t of m) $ += K.uncompressedSize(t);
4006
+ if (await K.prefetch((t) => !m.has(t) && !Ys.test(t)), T?.mark("prefetch-side-parts"), 0 === e.workbooks.length) {
4007
+ const o = _("_rels/.rels", t, H, F, C), s = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
4008
+ if (o) {
4009
+ for (const t of o.values()) if (t.type === s && t.target) {
4010
+ e.workbooks.push(t.target);
4011
+ break;
4012
+ }
4013
+ }
4014
+ }
4015
+ if (0 === e.workbooks.length) throw new Pt("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
4016
+ const M = g?.resources ?? new Kt(), V = M.beginPersist(), j = {}, B = /* @__PURE__ */ new Set(), X = /* @__PURE__ */ new Map();
4017
+ X.set("parseInlineDxf", (t) => {
4018
+ if (!t) return;
4019
+ const e = H.parseFromString(`<dxf xmlns:x14="${G}" xmlns:xm="${wt}">${t}</dxf>`, "text/xml")?.documentElement;
4020
+ if (!e) return;
4021
+ const o = F.parseDxf(e, "", C);
4022
+ return Object.keys(o).length > 0 ? o : void 0;
4023
+ });
4024
+ const q = w("metadata", e, t, H, F, C).entries().next()?.value?.[1]?.metadata;
4025
+ q && X.set("metadata", q), X.set(as, u());
4026
+ const J = /* @__PURE__ */ new Map(), Q = [], Y = /* @__PURE__ */ new Set(), et = (t) => {
4027
+ Y.add(Zs(t));
4028
+ }, st = (e, o = J) => {
4029
+ const s = e.lastIndexOf("/"), r = e.substring(0, s + 1) + "_rels/" + e.substring(s + 1, e.length) + ".rels";
4030
+ let n = o.get(r);
4031
+ return n || (n = _(r, t, H, F, At), o.set(r, n)), n;
4032
+ }, rt = (e, o, s, r = J) => {
4033
+ let n = st(o, r).get(e), i = n?.target;
4034
+ if (!i) return null;
4035
+ if ("External" === n.targetMode) {
4036
+ if (!s) return n.target;
4037
+ const t = M.add({ source: { external: n.target } });
4038
+ return t.addReference(j), B.add(t), V.toResourceId(t);
4039
+ }
4040
+ const a = o.lastIndexOf("/"), l = o.substring(0, a + 1);
4041
+ i.startsWith("/") || (i = l + i), i = xt(i);
4042
+ const c = F?.getVisitorParamsState().get("dxfs");
4043
+ let u = r.get(i);
4044
+ if (!u) {
4045
+ const e = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", o = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink";
4046
+ if (n.type === e) {
4047
+ const t = {};
4048
+ u = t;
4049
+ const e = async () => {
4050
+ 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) => {
4051
+ k(t, e ? `${e} (${i})` : i, o);
4052
+ }, void 0, X), o = await K.getTextStream(i, L);
4053
+ if (o) try {
4054
+ await yo.parseStream(o, e, {
4055
+ xmlns: !1,
4056
+ lean: !0
4057
+ });
4058
+ } catch (t) {
4059
+ throw new Error(`Error parsing sheet: '${i}'`, { cause: t });
4060
+ }
4061
+ const s = st(i, r);
4062
+ if (s) {
4063
+ ct(t, i, s, r), ht(t), z(t);
4064
+ const e = [];
4065
+ s.forEach((t, o) => {
4066
+ if ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable" !== t.type) return;
4067
+ const s = ft(o, i, t.type, (t) => "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition" !== t);
4068
+ if (!s?.xml) return;
4069
+ const r = /<pivotTableDefinition\b[^>]*>/.exec(s.xml)?.[0] ?? "", n = parseInt(/\scacheId="(\d+)"/.exec(r)?.[1] ?? "", 10);
4070
+ if (isNaN(n)) return void S.push([`Pivot table '${s.name}' names no cache and was dropped.`, i]);
4071
+ const a = /\sname="([^"]*)"/.exec(r)?.[1], l = bt(s.xml);
4072
+ if (!l) return void S.push([`Pivot table '${s.name}' states no location and was dropped.`, i]);
4073
+ 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);
4074
+ e.push({
4075
+ ...a ? { name: O(a) } : {},
4076
+ cacheId: n,
4077
+ location: l,
4078
+ part: s,
4079
+ ...d ? { partFormats: d } : {},
4080
+ ...h
4081
+ });
4082
+ }), e.length > 0 && (t.pivotTables = e);
4083
+ }
4084
+ };
4085
+ Q.push(e());
4086
+ } else if (n.type === o) {
4087
+ const e = R(i, t, H, F, At);
4088
+ if (e && 0 !== Object.keys(e).length) {
4089
+ const t = e, o = t.__bookRelId, s = t.__absoluteUrlRelId;
4090
+ delete t.__bookRelId, delete t.__absoluteUrlRelId;
4091
+ const n = [];
4092
+ st(i, r)?.forEach((t, e) => {
4093
+ if ("External" === t.targetMode && t.type && t.target) {
4094
+ const r = {
4095
+ type: t.type,
4096
+ target: t.target
4097
+ };
4098
+ e === o ? r.role = "book" : e === s && (r.role = "absoluteUrl"), n.push(r);
4099
+ }
4100
+ }), n.sort((t, e) => ("book" === t.role ? 0 : 1) - ("book" === e.role ? 0 : 1)), t.sources = n, et(i), u = t;
4101
+ } else u = null;
4102
+ } else u = s ? N(i, t, (t, e) => {
4103
+ const o = M.add({ source: { buffer: t } });
4104
+ return o.addReference(j), B.add(o), V.toResourceId(o);
4105
+ }, At) : R(i, t, H, F, At);
4106
+ }
4107
+ return u;
4108
+ }, at = (t, e) => {
4109
+ if (!t) return null;
4110
+ const o = st(e, J)?.get(t);
4111
+ if (!o?.target || "External" === o.targetMode) return null;
4112
+ let s = o.target;
4113
+ return s.startsWith("/") || (s = e.substring(0, e.lastIndexOf("/") + 1) + s), xt(s);
4114
+ }, ct = (t, e, o, s) => {
4115
+ const n = [], i = /* @__PURE__ */ new Map(), l = [];
4116
+ o.forEach((t, o) => {
4117
+ if ("http://schemas.microsoft.com/office/2017/10/relationships/threadedComment" !== t.type) return;
4118
+ const r = rt(o, e, !1, s)?.comments;
4119
+ if (!r) return;
4120
+ for (let t = 0; t < r.length; t++) {
4121
+ const e = r[t];
4122
+ if (!e?.v?.id) continue;
4123
+ const { parentId: o, done: s, content: a, ...c } = e.v, u = {
4124
+ ...c,
4125
+ content: tr(a)
4126
+ };
4127
+ o ? l.push({
4128
+ parentId: o,
4129
+ json: u
4130
+ }) : (s && (u.done = !0), i.set(u.id, u), n.push({
4131
+ r: e.r,
4132
+ v: u
4133
+ }));
4134
+ }
4135
+ const a = at(o, e);
4136
+ a && et(a);
4137
+ });
4138
+ for (let t = 0; t < l.length; t++) {
4139
+ const { parentId: e, json: o } = l[t], s = i.get(e);
4140
+ s && (s.replies ??= []).push(o);
4141
+ }
4142
+ const c = [];
4143
+ if (o.forEach((t, o) => {
4144
+ if ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" !== t.type) return;
4145
+ const r = rt(o, e, !1, s), n = r?.comments;
4146
+ if (!n) return;
4147
+ const a = r?.authors;
4148
+ for (let t = 0; t < n.length; t++) {
4149
+ const e = n[t];
4150
+ if (!e?.r) continue;
4151
+ let o = a && void 0 !== e.v.authorId ? a[e.v.authorId] : void 0;
4152
+ if (o && o.startsWith("tc=")) {
4153
+ if (i.has(W(o.substring(3)))) continue;
4154
+ o = void 0;
4155
+ }
4156
+ const s = {
4157
+ id: It.uuidV4().toUpperCase(),
4158
+ asNote: !0,
4159
+ content: e.v.content ?? ""
4160
+ }, r = o ? Ct({ displayName: o }) : void 0;
4161
+ r && (s.personId = r.id), c.push({
4162
+ r: e.r,
4163
+ v: s
4164
+ });
4165
+ }
4166
+ const l = at(o, e);
4167
+ l && et(l);
4168
+ }), 0 === n.length && 0 === c.length) return;
4169
+ const u = [...n, ...c], h = t.legacyDrawing;
4170
+ if (h?.xml) {
4171
+ const { rest: e, notes: o } = a(h.xml);
4172
+ if (o.length > 0) {
4173
+ const s = /* @__PURE__ */ new Map();
4174
+ for (let t = 0; t < o.length; t++) {
4175
+ const e = o[t];
4176
+ s.set(Nt.cellToString({
4177
+ rowIndex: e.row,
4178
+ colIndex: e.col
4179
+ }), e);
4180
+ }
4181
+ for (let t = 0; t < u.length; t++) {
4182
+ const e = u[t], o = s.get(String(e.r).toUpperCase());
4183
+ if (!o) continue;
4184
+ if (s.delete(String(e.r).toUpperCase()), !e.v.asNote) continue;
4185
+ const r = A(o.xml), n = {};
4186
+ if (r.anchor) {
4187
+ const [t, e, s, i, a, l, c, u] = r.anchor;
4188
+ n.anchor = {
4189
+ tl: {
4190
+ c: t - o.col,
4191
+ x: e,
4192
+ r: s - o.row,
4193
+ y: i
4194
+ },
4195
+ br: {
4196
+ c: a - o.col,
4197
+ x: l,
4198
+ r: c - o.row,
4199
+ y: u
4200
+ }
4201
+ };
4202
+ } else r.bounds && (n.bounds = r.bounds);
4203
+ 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);
4204
+ }
4205
+ const n = [];
4206
+ s.forEach((t) => {
4207
+ n.push(t.xml);
4208
+ });
4209
+ const i = r(e, n);
4210
+ i ? h.xml = i : delete t.legacyDrawing;
4211
+ }
4212
+ }
4213
+ t.comments = u;
4214
+ }, ut = (e, o) => {
4215
+ const s = at(e, o);
4216
+ if (!s) return null;
4217
+ const r = t(Zs(s));
4218
+ if (!r) return null;
4219
+ const n = { xml: ks(new TextDecoder("utf-8").decode(r.content)) }, i = [];
4220
+ return st(s, J)?.forEach((t, e) => {
4221
+ if ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" !== t.type) return;
4222
+ const o = rt(e, s, !0);
4223
+ "number" == typeof o && i.push({
4224
+ id: e,
4225
+ resId: o
4226
+ });
4227
+ }), i.length > 0 && (n.images = i), et(s), n;
4228
+ }, dt = (e, o) => {
4229
+ const s = at(e, o);
4230
+ if (!s) return null;
4231
+ const r = R(s, t, H, F, At)?.formControl ?? null;
4232
+ return r && et(s), r;
4233
+ }, ft = (o, s, r, n, i = /* @__PURE__ */ new Set()) => {
4234
+ const a = at(o, s);
4235
+ if (!a || i.has(a)) return null;
4236
+ const l = r ?? st(s, J)?.get(o)?.type;
4237
+ if (!l) return null;
4238
+ const c = t(Zs(a));
4239
+ if (!c) return null;
4240
+ i.add(a);
4241
+ const u = a.substring(a.lastIndexOf("/") + 1), h = e.overrides[Zs(a)] ?? e.defaults[u.substring(u.lastIndexOf(".") + 1).toLowerCase()], d = {
4242
+ id: o,
4243
+ type: l,
4244
+ name: u
4245
+ };
4246
+ 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);
4247
+ else {
4248
+ const t = rt(o, s, !0);
4249
+ if ("number" != typeof t) return null;
4250
+ d.resId = t;
4251
+ }
4252
+ const p = [];
4253
+ return st(a, J)?.forEach((t, e) => {
4254
+ if (!t?.type) return;
4255
+ if (n && !n(t.type)) return;
4256
+ if ("External" === t.targetMode) {
4257
+ const o = rt(e, a, !0);
4258
+ "number" == typeof o && p.push({
4259
+ id: e,
4260
+ type: t.type,
4261
+ resId: o
4262
+ });
4263
+ return;
4264
+ }
4265
+ const o = ft(e, a, t.type, n, i);
4266
+ o && p.push(o);
4267
+ }), p.length > 0 && (d.parts = p), et(a), d;
4268
+ }, gt = w("coreprops", e, t, H, F, C), yt = w("extprops", e, t, H, F, C), Tt = w("custprops", e, t, H, F, C);
4269
+ Tt.forEach((t, e) => {
4270
+ t?.custom && et(e);
4271
+ });
4272
+ const St = new Gt(), kt = w("people", e, t, H, F, C);
4273
+ if (kt.size > 0) {
4274
+ const [t, e] = kt.entries().next().value;
4275
+ St.fromJSON(e?.persons), et(t);
4276
+ }
4277
+ const Ct = (t) => {
4278
+ if (t) return St.add(t).toJSON();
4279
+ }, At = {
4280
+ paramMap: X,
4281
+ getRefs: st,
4282
+ getRef: rt,
4283
+ parsedRefs: J,
4284
+ readEmbeddedPart: (t, e) => ft(t, e),
4285
+ addPerson: Ct,
4286
+ serializeElement: U,
4287
+ onWarning: k
4288
+ }, _t = [], $t = /* @__PURE__ */ new Map();
4289
+ if (X.set(us, $t), s) {
4290
+ const t = await K.getTextStream(s, L);
4291
+ if (t) {
4292
+ const e = ((t, e) => {
4293
+ let o = !1, s = !1, r = 0, n = "";
4294
+ const i = new os();
4295
+ return {
4296
+ onOpenTag: (t) => {
4297
+ const e = es(t.name);
4298
+ "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);
4299
+ },
4300
+ onText: (t) => {
4301
+ s && (n += t, i.onText(t));
4302
+ },
4303
+ onCloseTag: (e) => {
4304
+ const a = es(e.name);
4305
+ "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);
4306
+ },
4307
+ onError: (t) => {
4308
+ e?.(`Error parsing shared strings: ${t?.message ?? t}`);
4309
+ }
4310
+ };
4311
+ })((t, e) => {
4312
+ e && $t.set(_t.length, e), _t.push(t);
4313
+ }, (t) => {
4314
+ k(t, s);
4315
+ });
4316
+ try {
4317
+ await yo.parseStream(t, e, { xmlns: !1 });
4318
+ } catch (t) {
4319
+ throw new Error(`Error parsing shared strings: '${s}'`, { cause: t });
4320
+ }
4321
+ }
4322
+ }
4323
+ T?.mark("shared-strings");
4324
+ let Rt = _t.length;
4325
+ const Mt = /* @__PURE__ */ new Map();
4326
+ let Lt = Rt;
4327
+ const Bt = (t) => {
4328
+ const e = Mt.get(t);
4329
+ if (void 0 !== e) return e;
4330
+ const o = Lt;
4331
+ return Mt.set(t, Lt++), _t.push(t), o;
4332
+ }, Ft = [];
4333
+ e.slicersCache = Ft;
4334
+ const Ht = K.getNames(), Wt = Ht.length;
4335
+ for (let t = 0; t < Wt; t++) {
4336
+ const e = Ht[t];
4337
+ e && (e.startsWith("xl/slicerCache") || e.startsWith("xl/timelineCaches/") && e.endsWith(".xml")) && Ft.push(`/${e}`);
4338
+ }
4339
+ const zt = w("slicersCache", e, t, H, F, At), Xt = /* @__PURE__ */ new Map();
4340
+ zt.forEach((t, e) => {
4341
+ t?.cacheName && (t.cachePath = e, Xt.set(t.cacheName, t));
4342
+ }), X.set("slicerCaches", Xt);
4343
+ const qt = [];
4344
+ e.slicers = qt;
4345
+ for (let t = 0; t < Wt; t++) {
4346
+ const e = Ht[t];
4347
+ e && (e.startsWith("xl/slicers/") || e.startsWith("xl/timelines/")) && e.endsWith(".xml") && qt.push(`/${e}`);
4348
+ }
4349
+ const Ut = {
4350
+ getFile: t,
4351
+ domParser: H,
4352
+ getAddress: (t, e) => {
4353
+ const o = rt(e, t, !1);
4354
+ return "string" == typeof o ? o : null;
4355
+ },
4356
+ getBytes: (e, o) => {
4357
+ const s = at(o, e), r = s ? t(s.substring(1))?.content : void 0;
4358
+ return r ? r.slice().buffer : null;
4359
+ },
4360
+ addFetched: (t, e) => {
4361
+ const o = M.add({
4362
+ source: { buffer: t },
4363
+ fetchedFrom: e
4364
+ });
4365
+ return o.addReference(j), B.add(o), V.toResourceId(o);
4366
+ },
4367
+ markAbsorbed: et
4368
+ }, Jt = /* @__PURE__ */ new Map();
4369
+ for (const t of d.getAll()) Jt.set(t.structure, t.beginRead(Ut));
4370
+ const Zt = ((t, e) => {
4371
+ const o = (o) => {
4372
+ const s = t(o);
4373
+ return s ? e.parseFromString(new TextDecoder().decode(s.content), "text/xml").documentElement ?? null : null;
4374
+ }, s = ye(o(de), "s").map((t) => ({
4375
+ t: t.getAttribute("t") ?? "",
4376
+ keys: ve(t)
4377
+ })), r = ye(o(pe), "rv").map((t) => {
4378
+ const e = ye(t, "fb")[0];
4379
+ return {
4380
+ s: parseInt(t.getAttribute("s") ?? "-1", 10),
4381
+ values: ye(t, "v").map((t) => t.textContent ?? ""),
4382
+ fb: e ? e.textContent ?? "" : null
4383
+ };
4384
+ }), n = ye(o(fe), "a").map((t) => {
4385
+ const e = we(t), o = parseInt(t.getAttribute("r") ?? "", 10), s = parseInt(t.getAttribute("c") ?? "", 10), r = o > 0 ? o : e.length;
4386
+ return {
4387
+ rows: r,
4388
+ columns: s > 0 ? s : Math.max(1, Math.ceil(e.length / Math.max(1, r))),
4389
+ items: e
4390
+ };
4391
+ }), 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) => ({
4392
+ s: parseInt(t.getAttribute("s") ?? "-1", 10),
4393
+ values: ye(t, "v").map((t) => t.textContent ?? "")
4394
+ })), u = o(be), h = Te(ye(ye(u, "global")[0], "keyFlags")[0]), d = /* @__PURE__ */ new Map();
4395
+ for (const t of ye(ye(u, "types")[0], "type")) d.set(t.getAttribute("name") ?? "", Te(ye(t, "keyFlags")[0]));
4396
+ 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") ?? "");
4397
+ return {
4398
+ structures: s,
4399
+ values: r,
4400
+ arrays: n,
4401
+ bagStructures: i,
4402
+ bagArrays: l,
4403
+ bags: c,
4404
+ globalKeyFlags: h,
4405
+ typeKeyFlags: d,
4406
+ richStyles: ye(ye(p, "richStyles")[0], "rSty").map((t) => {
4407
+ const e = /* @__PURE__ */ new Map();
4408
+ for (const o of ye(t, "rpv")) {
4409
+ const t = g[parseInt(o.getAttribute("i") ?? "-1", 10)];
4410
+ t && e.set(t, o.textContent ?? "");
4411
+ }
4412
+ const o = parseInt(t.getAttribute("dxfid") ?? "", 10);
4413
+ return {
4414
+ numberFormat: e.get("NumberFormat") ?? (o >= 0 ? f[o] ?? null : null),
4415
+ isTitle: "1" === e.get("IsTitleField"),
4416
+ isHero: "1" === e.get("IsHeroField")
4417
+ };
4418
+ })
4419
+ };
4420
+ })(t, H), Qt = p(Zt, Jt, (t) => {
4421
+ k(t, "/xl/richData/rdrichvalue.xml");
4422
+ });
4423
+ X.set("richData", Zt.values.map((t, e) => Qt.cellValue(e)));
4424
+ for (let t = 0; t < Wt; t++) {
4425
+ const e = Ht[t];
4426
+ e.startsWith("xl/richData/") && !e.includes("/_rels/") && et(e);
4427
+ }
4428
+ const te = w("themes", e, t, H, F, At);
4429
+ let oe = null;
4430
+ if (te && te.entries) {
4431
+ let t = te.entries().next();
4432
+ t?.value?.[1] && (oe = t.value[1]);
4433
+ }
4434
+ const se = new Yt(oe);
4435
+ let re = w("styles", e, t, H, F, At).entries().next()?.value?.[1];
4436
+ re && (re = JSON.parse(Et.JSONStableStringify(re)));
4437
+ const ne = w("workbooks", e, t, H, F, At);
4438
+ X.set(cs, !0 === ne.entries().next().value?.[1]?.date1904), "none" !== (g.calcOnLoad ?? h) && X.set(ls, ((t, e) => {
4439
+ const o = /* @__PURE__ */ new Set();
4440
+ if (t) for (let e = 0; e < t.length; e++) o.add(String(t[e]?.name).toUpperCase());
4441
+ if (e) for (let t = 0; t < e.length; t++) try {
4442
+ const s = e[t](() => {
4443
+ throw new Error("Not evaluating.");
4444
+ }, (t, e, s, r) => {
4445
+ for (const t of Object.keys(r)) o.add(t.toUpperCase());
4446
+ }, /* @__PURE__ */ new Map());
4447
+ for (const t of s.keys()) o.add(t.toUpperCase());
4448
+ } catch {}
4449
+ return (t) => o.has(t) || Vt.has(t);
4450
+ })(ne.entries().next().value?.[1]?.names, g.functions)), T?.mark("side-parts-json"), await Promise.all(Q);
4451
+ {
4452
+ const t = ne.entries().next().value?.[1], e = u(t?.names), o = t?.sheets ?? [];
4453
+ for (let t = 0; t < o.length; t++) {
4454
+ const s = o[t], r = i(s);
4455
+ if ("macro" === s?.kind && r?.part.xml) {
4456
+ r.part.xml = E(r.part.xml, _t);
4457
+ continue;
4458
+ }
4459
+ const n = b(s);
4460
+ n && f(n, e);
4461
+ }
4462
+ const s = t?.names;
4463
+ if (s) for (let t = 0; t < s.length; t++) {
4464
+ const o = s[t]?.ref;
4465
+ "string" == typeof o && (s[t].ref = e.readDetached(o));
4466
+ }
4467
+ }
4468
+ P && $ > 0 && (P(D, D), await new Promise((t) => setTimeout(t, 0))), T?.mark("sheets");
4469
+ const ie = {
4470
+ ...ne.entries().next().value?.[1],
4471
+ styles: re,
4472
+ theme: se.toJSON()
4473
+ }, ae = ((t, e, o, s) => {
4474
+ const r = {}, n = (t, e) => {
4475
+ if (t) for (const { key: o, value: s } of t) {
4476
+ const t = e[o];
4477
+ if (t && s) if ("revisionNumber" === t) {
4478
+ const t = parseInt(s, 10);
4479
+ Number.isFinite(t) && (r.revisionNumber = t);
4480
+ } else r[t] = s;
4481
+ }
4482
+ };
4483
+ if (n(t, Cs), n(e, As), o) {
4484
+ const t = [];
4485
+ for (const e of o) {
4486
+ const o = Is(e);
4487
+ 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");
4488
+ }
4489
+ t.length > 0 && (r.custom = t);
4490
+ }
4491
+ return Object.keys(r).length > 0 ? r : void 0;
4492
+ })(gt.values().next().value?.properties, yt.values().next().value?.properties, Tt.values().next().value?.custom, (t, e) => {
4493
+ k(t, "docProps/custom.xml", e);
4494
+ });
4495
+ ae && (ie.properties = ae), ((t, e) => {
4496
+ if (!e || 0 === e.size) return;
4497
+ const o = t.styles;
4498
+ if (!o) return;
4499
+ const s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
4500
+ for (const o of t.sheets ?? []) {
4501
+ const t = b(o);
4502
+ if (!t) continue;
4503
+ const n = /* @__PURE__ */ new Set();
4504
+ Ds(t.cols) || n.add(0);
4505
+ for (const e of t.directStyles ?? []) n.add(Array.isArray(e) ? e[1] : e.v);
4506
+ for (const e of t.rows ?? []) {
4507
+ const t = Os(e);
4508
+ void 0 !== t && n.add(t);
4509
+ }
4510
+ for (const e of t.cols ?? []) {
4511
+ const t = Os(e);
4512
+ void 0 !== t && n.add(t);
4513
+ }
4514
+ let i = !1;
4515
+ for (const t of n) if (e.has(t)) {
4516
+ i = !0;
4517
+ break;
4518
+ }
4519
+ if (i) {
4520
+ t.protection = {
4521
+ ...t.protection ?? { sheet: !0 },
4522
+ showFormulas: !1
4523
+ };
4524
+ for (const t of n) (e.has(t) ? r : s).add(t);
4525
+ }
4526
+ }
4527
+ if (0 === s.size) return;
4528
+ const n = o.direct ?? (o.direct = []);
4529
+ for (const t of s) 0 !== t && Ns(n[t] ?? (n[t] = {}), !0);
4530
+ for (const t of r) 0 !== t && Ns(n[t] ?? (n[t] = {}), !1);
4531
+ if (s.has(0)) {
4532
+ const t = o.named ?? (o.named = []), e = jt.BuiltInName.Normal.toLowerCase();
4533
+ let s = t.find((t) => t.name?.toLowerCase() === e);
4534
+ s || (s = {
4535
+ name: jt.BuiltInName.Normal,
4536
+ style: {}
4537
+ }, t.push(s)), Ns(s.style, !0);
4538
+ }
4539
+ })(ie, X.get(Ps)), ((t, e) => {
4540
+ if (e && 0 !== e.size) for (const o of t.sheets ?? []) {
4541
+ const t = b(o), s = t?.pivotTables;
4542
+ if (!t || !s || 0 === s.length) continue;
4543
+ const r = s.map(lt), n = s.map(() => []);
4544
+ for (const [o, s] of t.directStyles ?? []) {
4545
+ if (!e.has(s)) continue;
4546
+ const t = Nt.fastStringToRange(o);
4547
+ for (let e = 0; e < r.length; e++) {
4548
+ const o = r[e];
4549
+ if (!o) continue;
4550
+ 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);
4551
+ if (s > i || a > l) continue;
4552
+ const c = Nt.rangeToString({
4553
+ rowStart: s - o.rowStart,
4554
+ rowEnd: i - o.rowStart,
4555
+ colStart: a - o.colStart,
4556
+ colEnd: l - o.colStart
4557
+ });
4558
+ c && n[e].push(c);
4559
+ }
4560
+ }
4561
+ for (let t = 0; t < s.length; t++) n[t].length > 0 && (s[t].buttons = n[t]);
4562
+ }
4563
+ })(ie, X.get(_s));
4564
+ const ce = X.get(Xs);
4565
+ if ($s(ie, ce), ((t) => {
4566
+ const e = {
4567
+ colStart: 0,
4568
+ rowStart: 0,
4569
+ colEnd: ot,
4570
+ rowEnd: vt
4571
+ };
4572
+ for (const o of t.sheets ?? []) {
4573
+ const t = b(o);
4574
+ if (!t) continue;
4575
+ const s = [];
4576
+ if (Gs(t.cols, !0, e, s), Gs(t.rows, !1, e, s), 0 === s.length) continue;
4577
+ const r = [];
4578
+ for (const [e, o] of t.directStyles ?? []) r.push({
4579
+ ...Nt.fastStringToRange(e),
4580
+ value: {
4581
+ kind: 0,
4582
+ index: o
4583
+ }
4584
+ });
4585
+ r.push(...s);
4586
+ const n = [], i = new Ot.IteratorInstance(r, { axis: Dt.Column });
4587
+ for (let t = i.next(); !t.done; t = i.next()) {
4588
+ const o = t.value.overlaps;
4589
+ let s;
4590
+ if (1 === o.length) {
4591
+ if (s = o[0].value, 0 === s.index) continue;
4592
+ } else {
4593
+ let t, e, r;
4594
+ for (let s = 0; !t && s < o.length; s++) {
4595
+ const n = o[s].value;
4596
+ 0 === n.kind ? t = n : 1 === n.kind ? e = n : r = n;
4597
+ }
4598
+ s = t ?? e ?? r;
4599
+ }
4600
+ n.push([Nt.rangeToString(t.value.range, e), s.index]);
4601
+ }
4602
+ n.length > 0 ? t.directStyles = n : delete t.directStyles;
4603
+ }
4604
+ })(ie), ce) ((t, e, o) => {
4605
+ if (!e || 0 === e.size || !o) return;
4606
+ const s = (t) => {
4607
+ if (void 0 === t || 0 === t) return null;
4608
+ const s = e.get(t);
4609
+ return void 0 !== s ? o.controls[s] ?? null : null;
4610
+ };
4611
+ for (const e of t.sheets ?? []) {
4612
+ const t = b(e);
4613
+ if (!t) continue;
4614
+ const o = /* @__PURE__ */ new Map();
4615
+ for (const e of t.directStyles ?? []) {
4616
+ const t = Array.isArray(e) ? e[0] : e.r, r = s(Array.isArray(e) ? e[1] : e.v);
4617
+ if (!r) continue;
4618
+ const n = JSON.stringify(r);
4619
+ let i = o.get(n);
4620
+ i || (i = {
4621
+ control: r,
4622
+ addresses: []
4623
+ }, o.set(n, i)), qs(t, i.addresses);
4624
+ }
4625
+ if (0 === o.size) continue;
4626
+ const r = [...t.cellControls ?? []];
4627
+ for (const { control: t, addresses: e } of o.values()) r.push({
4628
+ r: e.join(","),
4629
+ v: t
4630
+ });
4631
+ t.cellControls = r;
4632
+ }
4633
+ })(ie, ce, w("featurePropertyBag", e, t, H, F, At).values().next().value?.featurePropertyBag);
4634
+ {
4635
+ const o = /* @__PURE__ */ new Map();
4636
+ w("slicers", e, t, H, F, At).forEach((t, e) => {
4637
+ t?.slicers && o.set(e, t.slicers);
4638
+ }), le(ie, {
4639
+ warn: (t, e) => {
4640
+ k(t, "xl/slicers", e);
4641
+ },
4642
+ markAbsorbed: et,
4643
+ slicerParts: o
4644
+ });
4645
+ }
4646
+ ie.calc = {
4647
+ ...ie.calc ?? {},
4648
+ legacyIntersect: !0
4649
+ }, _t.length > 0 && (ie.strings = _t);
4650
+ const ue = St.toJSON();
4651
+ ue && ue.length > 0 && (ie.people = ue);
4652
+ const he = K.getEntry("xl/vbaProject.bin");
4653
+ if (he) try {
4654
+ const { VBAProject: t } = await import("./C6eSWtTkyDQKbQdT.mjs"), e = t.extract(he);
4655
+ if (e) {
4656
+ const o = /* @__PURE__ */ new Map();
4657
+ for (const t of ie.sheets ?? []) {
4658
+ const e = b(t), s = e?.codeName;
4659
+ s && o.set(s, e);
4660
+ }
4661
+ for (const s of e.modules) {
4662
+ const e = { language: "vba" }, { header: r, body: n } = t.splitAttributes(s.code);
4663
+ n && (e.source = n), r && (e.sourceHeader = r);
4664
+ const i = "document" === s.type ? o.get(s.name) : void 0;
4665
+ i || "document" !== s.type || (e.scope = "workbook");
4666
+ const a = i ? i.modules ??= {} : ie.modules ??= {};
4667
+ a[s.name] || (a[s.name] = e);
4668
+ }
4669
+ n?.(e);
4670
+ } else S.push(["Unable to parse VBA project.", "xl/vbaProject.bin"]);
4671
+ } catch (t) {
4672
+ S.push([`Error extracting VBA: ${t?.message ?? t}`, "xl/vbaProject.bin"]);
4673
+ }
4674
+ const Se = X.get("calcId"), ke = void 0 === Se || !(Number(Se) >= 191029), Ce = g.calcOnLoad ?? ("auto" === h && ke ? "full" : h), Ae = {
4675
+ ...g,
4676
+ calcOnLoad: Ce,
4677
+ resources: M,
4678
+ json: ie
4679
+ };
4680
+ if (void 0 === Ae.disableLoadAutoFit) {
4681
+ const t = X.get(mt);
4682
+ Ae.disableLoadAutoFit = !!t?.declared && t.normalIsThemeFont && await nt(t.faces);
4683
+ }
4684
+ T?.mark("json-assembled");
4685
+ const Ee = new ee(Ae);
4686
+ if (T?.mark("workbook-constructed"), B.forEach((t) => {
4687
+ t.deleteReference(j);
4688
+ }), V.endPersist(), y) {
4689
+ x(Ee);
4690
+ const t = /* @__PURE__ */ new Map();
4691
+ let e = 0;
4692
+ for (const o of K.getNames()) {
4693
+ const s = K.getEntry(o);
4694
+ if (!s) continue;
4695
+ const r = K.getRawEntry(o), n = r ? {
4696
+ data: s,
4697
+ uncompressedSize: K.uncompressedSize(o),
4698
+ raw: {
4699
+ compressedData: r.data,
4700
+ compressionMethod: r.compressionMethod,
4701
+ signature: r.signature
4702
+ }
4703
+ } : {
4704
+ data: s,
4705
+ uncompressedSize: K.uncompressedSize(o)
4706
+ };
4707
+ t.set(o, n), e += s.byteLength;
4708
+ }
4709
+ if (e > 67108864) S.push([`Source package too large to retain (${e} bytes, limit ${o}); unmodeled parts will be dropped on save.`, "SourcePackage"]);
4710
+ else if (t.size > 0) {
4711
+ const e = new tt(t, Y);
4712
+ v(Ee, e);
4713
+ let o = Ee.getWorksheets().getItems();
4714
+ const s = Ee.getTransactions().addListener({ onCommitEnd: (t) => {
4715
+ const o = t.getOperation()?.name;
4716
+ "insertCells" !== o && "deleteCells" !== o || e.markStructuralChange();
4717
+ } }), r = Ee.addListeners({ onSheetsChange: () => {
4718
+ const t = Ee.getWorksheets().getItems();
4719
+ (t.length !== o.length || t.some((t, e) => t !== o[e])) && e.markStructuralChange(), o = t;
4720
+ } });
4721
+ Ee.addListeners({ onClose: () => {
4722
+ s(), r(), x(Ee);
4723
+ } });
4724
+ }
4725
+ }
4726
+ if (S.length && I?.onWarning) {
4727
+ const t = /* @__PURE__ */ new Set();
4728
+ for (const e of S) {
4729
+ const [o, s, r] = e, n = r ?? o;
4730
+ t.has(n) || (t.add(n), I.onWarning(o, s));
4731
+ }
4732
+ }
4733
+ return T && !0 === c && console.table(T.toTable()), await Ee.whenFontsReady(), Ee;
4734
+ } catch (t) {
4735
+ let e = "Unable to parse XLSX.";
4736
+ throw t instanceof Ut && (e = "Unable to open XLSX. There are too many rows or columns."), new Error(e, { cause: t });
4737
+ } finally {
4738
+ await K.close().catch(() => {});
4739
+ }
4740
+ };
4741
+ export { hs as a, Ps as i, Xs as n, _s as r, er as readXLSX, Js as t };