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

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