@sheetxl/studio-vanilla 0.4.10 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/browser/cjs/B0rdyyttE2Aibsag.cjs +7 -0
  2. package/browser/cjs/B2e7dDI-zKoqXpIW.cjs +107 -0
  3. package/browser/cjs/BAyEOOtO-9sHQQRW.cjs +7 -0
  4. package/browser/cjs/BPTHTRDvNOVkUJGa.cjs +7 -0
  5. package/browser/cjs/BlSFY6zLlebuejdV.cjs +7 -0
  6. package/browser/cjs/BplA5pDzOJpfTZuA.cjs +7 -0
  7. package/browser/cjs/BshvMtUxTJHj3JQN.cjs +7 -0
  8. package/browser/cjs/BuWtGFX0HiBezGjw.cjs +7 -0
  9. package/browser/cjs/C5FXOMLhAu_KTjVe.cjs +7 -0
  10. package/browser/cjs/C7EZCTczsC-gkRcq.cjs +7 -0
  11. package/browser/cjs/CFcjX5-nVsgzdZ4F.cjs +7 -0
  12. package/browser/cjs/CjZbhk41S1qO_74G.cjs +7 -0
  13. package/browser/cjs/CuTW2Pt-L5n-hNxV.cjs +7 -0
  14. package/browser/cjs/D3iOk-Q2tRdUeTcn.cjs +7 -0
  15. package/browser/cjs/DFspSkki779xN-Ey.cjs +7 -0
  16. package/browser/cjs/DFtyXc7YFh9dIp74.cjs +7 -0
  17. package/browser/cjs/Db_Ew1r6yOMYylvA.cjs +7 -0
  18. package/browser/cjs/DgBn3aW39yjgm0X_.cjs +7 -0
  19. package/browser/cjs/DiBy6-IxLscyMW2y.cjs +7 -0
  20. package/browser/cjs/DrlS1oz9Nea8Pm3j.cjs +7 -0
  21. package/browser/cjs/Dx-jp_LJxWbAScyA.cjs +7 -0
  22. package/browser/cjs/SzxJv7OUs5ojl8gx.cjs +7 -0
  23. package/browser/cjs/T4SHYo66xDT3l9JN.cjs +7 -0
  24. package/browser/cjs/index.cjs +4 -3
  25. package/browser/cjs/vfUix5Di0Ro8tEID.cjs +7 -0
  26. package/browser/esm/B5kkStdEkTczERyM.mjs +7 -0
  27. package/browser/esm/B905wKzTtod-jbsD.mjs +7 -0
  28. package/browser/esm/BALnKy2Fp7fyk-lc.mjs +7 -0
  29. package/browser/esm/BDVJ7eOPpW5FnEAP.mjs +7 -0
  30. package/browser/esm/BGpv6Kq7eBlJy43T.mjs +7 -0
  31. package/browser/esm/BUSR_OK5Qi6hRPfw.mjs +7 -0
  32. package/browser/esm/BXUGsC1Mo3FP8vnW.mjs +7 -0
  33. package/browser/esm/BlGoi1_x9rUMpWMd.mjs +7 -0
  34. package/browser/esm/Bo_ZPRrOQrqOVHAF.mjs +7 -0
  35. package/browser/esm/BuURCm92KsyGHG9e.mjs +7 -0
  36. package/browser/esm/CFFC0SNc24a0Dxnh.mjs +7 -0
  37. package/browser/esm/CGZ5MX7afzMxDkCe.mjs +7 -0
  38. package/browser/esm/Cc_VWd0wF5-39LsI.mjs +7 -0
  39. package/browser/esm/Cq8D_M0jeHLcnRjg.mjs +7 -0
  40. package/browser/esm/CzmNwV9tfFYUp_gS.mjs +7 -0
  41. package/browser/esm/De6RPxc4p_jXLlT5.mjs +7 -0
  42. package/browser/esm/DlVZFM9ZR5jGyG0_.mjs +7 -0
  43. package/browser/esm/DqXxZP6yKF4U1YfY.mjs +7 -0
  44. package/browser/esm/DtmE60AvstK9u0Ta.mjs +107 -0
  45. package/browser/esm/Dz2OVgq3kxi1TkfX.mjs +7 -0
  46. package/browser/esm/PS0cqYnlMVEGOQpI.mjs +7 -0
  47. package/browser/esm/QBGUD1XS5_pysBLL.mjs +7 -0
  48. package/browser/esm/index.mjs +2 -8
  49. package/browser/esm/tFhROdVSw9KLQfUN.mjs +7 -0
  50. package/browser/esm/uGDCdtqxjqRCo4Xn.mjs +7 -0
  51. package/cdn/index.js +40 -44
  52. package/cdn/loader.js +1 -1
  53. package/package.json +5 -5
  54. package/browser/cjs/B1UGqZP_7Z0Ewpog.cjs +0 -6
  55. package/browser/cjs/B6m9VXoFseD4zuZ5.cjs +0 -6
  56. package/browser/cjs/BKePSaEpM6Z063z-.cjs +0 -161
  57. package/browser/cjs/Bqn0ZeP_srNfL9rG.cjs +0 -6
  58. package/browser/cjs/C-izbj62pQuZjOrT.cjs +0 -304
  59. package/browser/cjs/C-w-GX8N54TxTjjf.cjs +0 -6
  60. package/browser/cjs/C1QGdcqJ-9sdGTQR.cjs +0 -6
  61. package/browser/cjs/C38aiRglHLxZ8KRY.cjs +0 -6
  62. package/browser/cjs/C4JMn_hMnlOnDpQO.cjs +0 -6
  63. package/browser/cjs/CApEj4LhhPUvQjIG.cjs +0 -16
  64. package/browser/cjs/CFcJbmmXjWjl6fQH.cjs +0 -6
  65. package/browser/cjs/CKiDbCZ6rGgXK7yN.cjs +0 -42
  66. package/browser/cjs/CM8btXQsJbnFKXUm.cjs +0 -6
  67. package/browser/cjs/Cb0K3Wzp7BAa4zni.cjs +0 -15
  68. package/browser/cjs/CiAUhPU7v1BK-8Bb.cjs +0 -7
  69. package/browser/cjs/CsXS-EN0N5SZHTnQ.cjs +0 -145
  70. package/browser/cjs/Cu2eUomoF0HToa4l.cjs +0 -6
  71. package/browser/cjs/Cy7ii9B_Vqx94pbu.cjs +0 -19
  72. package/browser/cjs/CzI4ZcsmzsyPBpWN.cjs +0 -12
  73. package/browser/cjs/DKHzUx2gKXwboKy1.cjs +0 -11
  74. package/browser/cjs/DKc8wAq8dwbDddQn.cjs +0 -11
  75. package/browser/cjs/DMyKApbUVRtNYC4e.cjs +0 -6
  76. package/browser/cjs/DROR08HMGyg7rizQ.cjs +0 -6
  77. package/browser/cjs/DfGDZlbFVknGyu_X.cjs +0 -6
  78. package/browser/cjs/OQdqVM_6m78kE5Aj.cjs +0 -7
  79. package/browser/cjs/v4OEtYXaUw_GeiXM.cjs +0 -12
  80. package/browser/esm/4uEr84M4w57AMyDg.mjs +0 -1703
  81. package/browser/esm/B8Ja5DlyKAy8xfQD.mjs +0 -1365
  82. package/browser/esm/B9bN60uAvy62vnwt.mjs +0 -22
  83. package/browser/esm/BAOzSQdzHl43K9Hd.mjs +0 -50
  84. package/browser/esm/BQYSD5Nb35y0WeeV.mjs +0 -421
  85. package/browser/esm/BVcaNvORp_uKPQgJ.mjs +0 -46
  86. package/browser/esm/BqXO_cQhrMJu7JoQ.mjs +0 -3756
  87. package/browser/esm/C18A_DcIEHNYBDvR.mjs +0 -46
  88. package/browser/esm/C7FoKZbSzjvuY3UB.mjs +0 -43
  89. package/browser/esm/CCIJpHSbFPjTEF8S.mjs +0 -1665
  90. package/browser/esm/CHNPjJxb0GY_naLa.mjs +0 -25025
  91. package/browser/esm/CKHsU9LUNYowimxS.mjs +0 -1346
  92. package/browser/esm/C_Zx1tYjI3n7KKZH.mjs +0 -21
  93. package/browser/esm/Cm-m3bZh0V44y0li.mjs +0 -390
  94. package/browser/esm/D1e_ccSgcNXvWHgy.mjs +0 -151
  95. package/browser/esm/D47D26mVYSAdb5C8.mjs +0 -2178
  96. package/browser/esm/D9CdO3PtV12RnK8K.mjs +0 -1467
  97. package/browser/esm/D9x-Q8y57gePf-tE.mjs +0 -944
  98. package/browser/esm/DHhXutXh7b5LsU1m.mjs +0 -2346
  99. package/browser/esm/DIGFi66CQPMV3HsL.mjs +0 -84
  100. package/browser/esm/DamiTeQsSMP2Cwld.mjs +0 -58
  101. package/browser/esm/DhD48oFrbrnZ6Zg5.mjs +0 -13208
  102. package/browser/esm/Ln2ZalJgj1CiJJue.mjs +0 -50
  103. package/browser/esm/S9fgUO7h8YgZxoKH.mjs +0 -633
  104. package/browser/esm/qVAHcpq07IhtAaQc.mjs +0 -24
  105. package/browser/esm/xrzJ8ILZHb118Oyt.mjs +0 -41
  106. package/cdn/assets/2-xJlw77WsCoyz09.js +0 -24872
  107. package/cdn/assets/B-9FcTf3xBEVGdjV.js +0 -1467
  108. package/cdn/assets/B-p1i2SNRMunPXCF.js +0 -43
  109. package/cdn/assets/B3J6oAmsS7oLNFPd.js +0 -46
  110. package/cdn/assets/B8Ja5DlyKAy8xfQD.js +0 -1365
  111. package/cdn/assets/BG3YTMAzNKPRGoLs.js +0 -50
  112. package/cdn/assets/BQYSD5Nb35y0WeeV.js +0 -421
  113. package/cdn/assets/BbzUpvQOkxsN-yIH.js +0 -2346
  114. package/cdn/assets/BqXO_cQhrMJu7JoQ.js +0 -3756
  115. package/cdn/assets/Bt1JSlSpWXDOBfq3.js +0 -1703
  116. package/cdn/assets/CCIJpHSbFPjTEF8S.js +0 -1665
  117. package/cdn/assets/CKHsU9LUNYowimxS.js +0 -1346
  118. package/cdn/assets/CWLJZwD2GVXljoWG.js +0 -46
  119. package/cdn/assets/Cm-m3bZh0V44y0li.js +0 -390
  120. package/cdn/assets/CtQlXGkNWgI-vtGy.js +0 -2178
  121. package/cdn/assets/DIGFi66CQPMV3HsL.js +0 -84
  122. package/cdn/assets/DK4S0DbayChkfTD6.js +0 -58
  123. package/cdn/assets/DQvsBz9F1GS_S7r9.js +0 -50
  124. package/cdn/assets/DTOgv_zwXSur-yCq.js +0 -151
  125. package/cdn/assets/DYZjOnD8WWQkCYuH.js +0 -944
  126. package/cdn/assets/DhD48oFrbrnZ6Zg5.js +0 -13208
  127. package/cdn/assets/DhyAyTCDkMBf392P.js +0 -21
  128. package/cdn/assets/P7HeVw5SHROLSWBz.js +0 -24
  129. package/cdn/assets/S4Z0SN8x6EltjsHT.js +0 -22
  130. package/cdn/assets/S9fgUO7h8YgZxoKH.js +0 -633
  131. package/cdn/assets/guYe4C_6pE93QsDV.js +0 -41
@@ -1,1467 +0,0 @@
1
- import { NumberFormat as Ht, ScalarType as Ft, ResourceCollection as vs, Tuple as Ss, IAutoFilter as Zt, AddressUtils as at, CoordUtils as De, FormulaError as Cs, IRange as ks, CommonUtils as es, Theme as As, JSONStableStringify as Es, Workbook as Ds, IColor as Ps, OutOfBoundsError as Os } from "@sheetxl/sdk";
2
- import { Y as cs } from "./CHNPjJxb0GY_naLa.mjs";
3
- /**
4
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.4.10
5
- *
6
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
7
- * License: The license can be found at https://www.sheetxl.com/license.
8
- */
9
- const ss = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", Is = new RegExp(`^[${ss}][-${ss}.0-9·̀-ͯ‿-⁀]*$`, "u");
10
- function hs(i) {
11
- return i >= 65 && i <= 90 || i >= 97 && i <= 122 || i === 58 || i === 95 || i === 8204 || i === 8205 || i >= 192 && i <= 214 || i >= 216 && i <= 246 || i >= 248 && i <= 767 || i >= 880 && i <= 893 || i >= 895 && i <= 8191 || i >= 8304 && i <= 8591 || i >= 11264 && i <= 12271 || i >= 12289 && i <= 55295 || i >= 63744 && i <= 64975 || i >= 65008 && i <= 65533 || i >= 65536 && i <= 983039;
12
- }
13
- const is = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", Vs = new RegExp(`^[${is}][-${is}.0-9·̀-ͯ‿-⁀]*$`, "u");
14
- function us(i) {
15
- return i >= 65 && i <= 90 || i === 95 || i >= 97 && i <= 122 || i >= 192 && i <= 214 || i >= 216 && i <= 246 || i >= 248 && i <= 767 || i >= 880 && i <= 893 || i >= 895 && i <= 8191 || i >= 8204 && i <= 8205 || i >= 8304 && i <= 8591 || i >= 11264 && i <= 12271 || i >= 12289 && i <= 55295 || i >= 63744 && i <= 64975 || i >= 65008 && i <= 65533 || i >= 65536 && i <= 983039;
16
- }
17
- const q = function(i) {
18
- return i === 32 || i === 10 || i === 13 || i === 9;
19
- }, Ls = function(i) {
20
- return i >= 32 && i <= 55295 || i === 10 || i === 13 || i === 9 || i >= 57344 && i <= 65533 || i >= 65536 && i <= 1114111;
21
- }, le = hs, os = function(i) {
22
- return hs(i) || i >= 48 && i <= 57 || i === 45 || i === 46 || i === 183 || i >= 768 && i <= 879 || i >= 8255 && i <= 8256;
23
- }, ds = [32, 10, 13, 9], Ns = Is, Rs = function(i) {
24
- return i >= 1 && i <= 55295 || i >= 57344 && i <= 65533 || i >= 65536 && i <= 1114111;
25
- }, $s = us, Ms = function(i) {
26
- return us(i) || i === 45 || i === 46 || i >= 48 && i <= 57 || i === 183 || i >= 768 && i <= 879 || i >= 8255 && i <= 8256;
27
- }, js = Vs, Te = "http://www.w3.org/XML/1998/namespace", Yt = "http://www.w3.org/2000/xmlns/", Hs = { __proto__: null, xml: Te, xmlns: Yt }, Fs = { __proto__: null, amp: "&", gt: ">", lt: "<", quot: '"', apos: "'" }, O = -1, lt = -2, B = 13, Xt = 33, it = 10, St = 60, Jt = 61, M = 62, F = 63, Kt = 93, me = (i) => i === 34 || i === 39, ps = [34, 39], Xs = [...ps, 91, M], Bs = [...ps, St, Kt], Ws = [Jt, F, ...ds], _s = [...ds, M, 38, St];
28
- function Pe(i, t, s) {
29
- switch (t) {
30
- case "xml":
31
- s !== Te && i.fail(`xml prefix must be bound to ${Te}.`);
32
- break;
33
- case "xmlns":
34
- s !== Yt && i.fail(`xmlns prefix must be bound to ${Yt}.`);
35
- }
36
- switch (s) {
37
- case Yt:
38
- i.fail(t === "" ? `the default namespace may not be set to ${s}.` : `may not assign a prefix (even "xmlns") to the URI ${Yt}.`);
39
- break;
40
- case Te:
41
- switch (t) {
42
- case "xml":
43
- break;
44
- case "":
45
- i.fail(`the default namespace may not be set to ${s}.`);
46
- break;
47
- default:
48
- i.fail("may not assign the xml namespace to another prefix.");
49
- }
50
- }
51
- }
52
- const qs = (i) => js.test(i), zs = (i) => Ns.test(i), rs = { xmldecl: "xmldeclHandler", text: "textHandler", processinginstruction: "piHandler", doctype: "doctypeHandler", comment: "commentHandler", opentagstart: "openTagStartHandler", attribute: "attributeHandler", opentag: "openTagHandler", closetag: "closeTagHandler", cdata: "cdataHandler", error: "errorHandler", end: "endHandler", ready: "readyHandler" };
53
- class Us {
54
- constructor(t) {
55
- this.i = 0, this.prevI = 0, this.opt = t ?? {}, this.fragmentOpt = !!this.opt.fragment;
56
- const s = this.xmlnsOpt = !!this.opt.xmlns;
57
- if (this.trackPosition = this.opt.position !== !1, this.fileName = this.opt.fileName, s) {
58
- this.nameStartCheck = $s, this.nameCheck = Ms, this.isName = qs, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = { __proto__: null, ...Hs };
59
- const o = this.opt.additionalNamespaces;
60
- o != null && (function(n, a) {
61
- for (const c of Object.keys(a)) Pe(n, c, a[c]);
62
- }(this, o), Object.assign(this.ns, o));
63
- } else this.nameStartCheck = le, this.nameCheck = os, this.isName = zs, this.processAttribs = this.processAttribsPlain, this.pushAttrib = this.pushAttribPlain;
64
- this.stateTable = [this.sBegin, this.sBeginWhitespace, this.sDoctype, this.sDoctypeQuote, this.sDTD, this.sDTDQuoted, this.sDTDOpenWaka, this.sDTDOpenWakaBang, this.sDTDComment, this.sDTDCommentEnding, this.sDTDCommentEnded, this.sDTDPI, this.sDTDPIEnding, this.sText, this.sEntity, this.sOpenWaka, this.sOpenWakaBang, this.sComment, this.sCommentEnding, this.sCommentEnded, this.sCData, this.sCDataEnding, this.sCDataEnding2, this.sPIFirstChar, this.sPIRest, this.sPIBody, this.sPIEnding, this.sXMLDeclNameStart, this.sXMLDeclName, this.sXMLDeclEq, this.sXMLDeclValueStart, this.sXMLDeclValue, this.sXMLDeclSeparator, this.sXMLDeclEnding, this.sOpenTag, this.sOpenTagSlash, this.sAttrib, this.sAttribName, this.sAttribNameSawWhite, this.sAttribValue, this.sAttribValueQuoted, this.sAttribValueClosed, this.sAttribValueUnquoted, this.sCloseTag, this.sCloseTagSawWhite], this._init();
65
- }
66
- get closed() {
67
- return this._closed;
68
- }
69
- _init() {
70
- 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 = [];
71
- const { fragmentOpt: t } = this;
72
- this.state = t ? B : 0, this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = t, this.xmlDeclPossible = !t, this.xmlDeclExpects = ["version"], this.entityReturnState = void 0;
73
- let { defaultXMLVersion: s } = this.opt;
74
- if (s === void 0) {
75
- if (this.opt.forceXMLVersion === !0) throw new Error("forceXMLVersion set but defaultXMLVersion is not set");
76
- s = "1.0";
77
- }
78
- this.setXMLVersion(s), this.positionAtNewLine = 0, this.doctype = !1, this._closed = !1, this.xmlDecl = { version: void 0, encoding: void 0, standalone: void 0 }, this.line = 1, this.column = 0, this.ENTITIES = Object.create(Fs), this.readyHandler?.();
79
- }
80
- get position() {
81
- return this.chunkPosition + this.i;
82
- }
83
- get columnIndex() {
84
- return this.position - this.positionAtNewLine;
85
- }
86
- on(t, s) {
87
- this[rs[t]] = s;
88
- }
89
- off(t) {
90
- this[rs[t]] = void 0;
91
- }
92
- makeError(t) {
93
- let s = this.fileName ?? "";
94
- return this.trackPosition && (s.length > 0 && (s += ":"), s += `${this.line}:${this.column}`), s.length > 0 && (s += ": "), new Error(s + t);
95
- }
96
- fail(t) {
97
- const s = this.makeError(t), o = this.errorHandler;
98
- if (o === void 0) throw s;
99
- return o(s), this;
100
- }
101
- write(t) {
102
- if (this.closed) return this.fail("cannot write after close; assign an onready handler.");
103
- let s = !1;
104
- t === null ? (s = !0, t = "") : typeof t == "object" && (t = t.toString()), this.carriedFromPrevious !== void 0 && (t = `${this.carriedFromPrevious}${t}`, this.carriedFromPrevious = void 0);
105
- let o = t.length;
106
- const n = t.charCodeAt(o - 1);
107
- !s && (n === 13 || n >= 55296 && n <= 56319) && (this.carriedFromPrevious = t[o - 1], o--, t = t.slice(0, o));
108
- const { stateTable: a } = this;
109
- for (this.chunk = t, this.i = 0; this.i < o; ) a[this.state].call(this);
110
- return this.chunkPosition += o, s ? this.end() : this;
111
- }
112
- close() {
113
- return this.write(null);
114
- }
115
- getCode10() {
116
- const t = this.chunk, s = this.i;
117
- if (this.prevI = s, this.i++, s >= t.length) return O;
118
- const o = t.charCodeAt(s);
119
- if (this.column++, o < 55296) {
120
- if (o >= 32 || o === 9) return o;
121
- switch (o) {
122
- case it:
123
- return this.line++, this.column = 0, this.positionAtNewLine = this.position, it;
124
- case 13:
125
- return t.charCodeAt(s + 1) === it && (this.i = s + 2), this.line++, this.column = 0, this.positionAtNewLine = this.position, lt;
126
- default:
127
- return this.fail("disallowed character."), o;
128
- }
129
- }
130
- if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o;
131
- const n = 65536 + 1024 * (o - 55296) + (t.charCodeAt(s + 1) - 56320);
132
- return this.i = s + 2, n > 1114111 && this.fail("disallowed character."), n;
133
- }
134
- getCode11() {
135
- const { chunk: t, i: s } = this;
136
- if (this.prevI = s, this.i = s + 1, s >= t.length) return O;
137
- const o = t.charCodeAt(s);
138
- if (this.column++, o < 55296) {
139
- if (o > 31 && o < 127 || o > 159 && o !== 8232 || o === 9) return o;
140
- switch (o) {
141
- case it:
142
- return this.line++, this.column = 0, this.positionAtNewLine = this.position, it;
143
- case 13: {
144
- const a = t.charCodeAt(s + 1);
145
- a !== it && a !== 133 || (this.i = s + 2);
146
- }
147
- case 133:
148
- case 8232:
149
- return this.line++, this.column = 0, this.positionAtNewLine = this.position, lt;
150
- default:
151
- return this.fail("disallowed character."), o;
152
- }
153
- }
154
- if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o;
155
- const n = 65536 + 1024 * (o - 55296) + (t.charCodeAt(s + 1) - 56320);
156
- return this.i = s + 2, n > 1114111 && this.fail("disallowed character."), n;
157
- }
158
- getCodeNorm() {
159
- const t = this.getCode();
160
- return t === lt ? it : t;
161
- }
162
- unget() {
163
- this.i = this.prevI, this.column--;
164
- }
165
- captureTo(t) {
166
- let { i: s } = this;
167
- const { chunk: o } = this;
168
- for (; ; ) {
169
- const n = this.getCode(), a = n === lt, c = a ? it : n;
170
- if (c === O || t.includes(c)) return this.text += o.slice(s, this.prevI), c;
171
- a && (this.text += `${o.slice(s, this.prevI)}
172
- `, s = this.i);
173
- }
174
- }
175
- captureToChar(t) {
176
- let { i: s } = this;
177
- const { chunk: o } = this;
178
- for (; ; ) {
179
- let n = this.getCode();
180
- switch (n) {
181
- case lt:
182
- this.text += `${o.slice(s, this.prevI)}
183
- `, s = this.i, n = it;
184
- break;
185
- case O:
186
- return this.text += o.slice(s), !1;
187
- }
188
- if (n === t) return this.text += o.slice(s, this.prevI), !0;
189
- }
190
- }
191
- captureNameChars() {
192
- const { chunk: t, i: s } = this;
193
- for (; ; ) {
194
- const o = this.getCode();
195
- if (o === O) return this.name += t.slice(s), O;
196
- if (!os(o)) return this.name += t.slice(s, this.prevI), o === lt ? it : o;
197
- }
198
- }
199
- skipSpaces() {
200
- for (; ; ) {
201
- const t = this.getCodeNorm();
202
- if (t === O || !q(t)) return t;
203
- }
204
- }
205
- setXMLVersion(t) {
206
- this.currentXMLVersion = t, t === "1.0" ? (this.isChar = Ls, this.getCode = this.getCode10) : (this.isChar = Rs, this.getCode = this.getCode11);
207
- }
208
- sBegin() {
209
- this.chunk.charCodeAt(0) === 65279 && (this.i++, this.column++), this.state = 1;
210
- }
211
- sBeginWhitespace() {
212
- const t = this.i, s = this.skipSpaces();
213
- switch (this.prevI !== t && (this.xmlDeclPossible = !1), s) {
214
- case St:
215
- if (this.state = 15, this.text.length !== 0) throw new Error("no-empty text at start");
216
- break;
217
- case O:
218
- break;
219
- default:
220
- this.unget(), this.state = B, this.xmlDeclPossible = !1;
221
- }
222
- }
223
- sDoctype() {
224
- const t = this.captureTo(Xs);
225
- switch (t) {
226
- case M:
227
- this.doctypeHandler?.(this.text), this.text = "", this.state = B, this.doctype = !0;
228
- break;
229
- case O:
230
- break;
231
- default:
232
- this.text += String.fromCodePoint(t), t === 91 ? this.state = 4 : me(t) && (this.state = 3, this.q = t);
233
- }
234
- }
235
- sDoctypeQuote() {
236
- const t = this.q;
237
- this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.q = null, this.state = 2);
238
- }
239
- sDTD() {
240
- const t = this.captureTo(Bs);
241
- t !== O && (this.text += String.fromCodePoint(t), t === Kt ? this.state = 2 : t === St ? this.state = 6 : me(t) && (this.state = 5, this.q = t));
242
- }
243
- sDTDQuoted() {
244
- const t = this.q;
245
- this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.state = 4, this.q = null);
246
- }
247
- sDTDOpenWaka() {
248
- const t = this.getCodeNorm();
249
- switch (this.text += String.fromCodePoint(t), t) {
250
- case 33:
251
- this.state = 7, this.openWakaBang = "";
252
- break;
253
- case F:
254
- this.state = 11;
255
- break;
256
- default:
257
- this.state = 4;
258
- }
259
- }
260
- sDTDOpenWakaBang() {
261
- const t = String.fromCodePoint(this.getCodeNorm()), s = this.openWakaBang += t;
262
- this.text += t, s !== "-" && (this.state = s === "--" ? 8 : 4, this.openWakaBang = "");
263
- }
264
- sDTDComment() {
265
- this.captureToChar(45) && (this.text += "-", this.state = 9);
266
- }
267
- sDTDCommentEnding() {
268
- const t = this.getCodeNorm();
269
- this.text += String.fromCodePoint(t), this.state = t === 45 ? 10 : 8;
270
- }
271
- sDTDCommentEnded() {
272
- const t = this.getCodeNorm();
273
- this.text += String.fromCodePoint(t), t === M ? this.state = 4 : (this.fail("malformed comment."), this.state = 8);
274
- }
275
- sDTDPI() {
276
- this.captureToChar(F) && (this.text += "?", this.state = 12);
277
- }
278
- sDTDPIEnding() {
279
- const t = this.getCodeNorm();
280
- this.text += String.fromCodePoint(t), t === M && (this.state = 4);
281
- }
282
- sText() {
283
- this.tags.length !== 0 ? this.handleTextInRoot() : this.handleTextOutsideRoot();
284
- }
285
- sEntity() {
286
- let { i: t } = this;
287
- const { chunk: s } = this;
288
- t: for (; ; ) switch (this.getCode()) {
289
- case lt:
290
- this.entity += `${s.slice(t, this.prevI)}
291
- `, t = this.i;
292
- break;
293
- case 59: {
294
- const { entityReturnState: o } = this, n = this.entity + s.slice(t, this.prevI);
295
- let a;
296
- this.state = o, n === "" ? (this.fail("empty entity name."), a = "&;") : (a = this.parseEntity(n), this.entity = ""), o === B && this.textHandler === void 0 || (this.text += a);
297
- break t;
298
- }
299
- case O:
300
- this.entity += s.slice(t);
301
- break t;
302
- }
303
- }
304
- sOpenWaka() {
305
- const t = this.getCode();
306
- if (le(t)) this.state = 34, this.unget(), this.xmlDeclPossible = !1;
307
- else switch (t) {
308
- case 47:
309
- this.state = 43, this.xmlDeclPossible = !1;
310
- break;
311
- case 33:
312
- this.state = 16, this.openWakaBang = "", this.xmlDeclPossible = !1;
313
- break;
314
- case F:
315
- this.state = 23;
316
- break;
317
- default:
318
- this.fail("disallowed character in tag name"), this.state = B, this.xmlDeclPossible = !1;
319
- }
320
- }
321
- sOpenWakaBang() {
322
- switch (this.openWakaBang += String.fromCodePoint(this.getCodeNorm()), this.openWakaBang) {
323
- case "[CDATA[":
324
- 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 = "";
325
- break;
326
- case "--":
327
- this.state = 17, this.openWakaBang = "";
328
- break;
329
- case "DOCTYPE":
330
- this.state = 2, (this.doctype || this.sawRoot) && this.fail("inappropriately located doctype declaration."), this.openWakaBang = "";
331
- break;
332
- default:
333
- this.openWakaBang.length >= 7 && this.fail("incorrect syntax.");
334
- }
335
- }
336
- sComment() {
337
- this.captureToChar(45) && (this.state = 18);
338
- }
339
- sCommentEnding() {
340
- const t = this.getCodeNorm();
341
- t === 45 ? (this.state = 19, this.commentHandler?.(this.text), this.text = "") : (this.text += `-${String.fromCodePoint(t)}`, this.state = 17);
342
- }
343
- sCommentEnded() {
344
- const t = this.getCodeNorm();
345
- t !== M ? (this.fail("malformed comment."), this.text += `--${String.fromCodePoint(t)}`, this.state = 17) : this.state = B;
346
- }
347
- sCData() {
348
- this.captureToChar(Kt) && (this.state = 21);
349
- }
350
- sCDataEnding() {
351
- const t = this.getCodeNorm();
352
- t === Kt ? this.state = 22 : (this.text += `]${String.fromCodePoint(t)}`, this.state = 20);
353
- }
354
- sCDataEnding2() {
355
- const t = this.getCodeNorm();
356
- switch (t) {
357
- case M:
358
- this.cdataHandler?.(this.text), this.text = "", this.state = B;
359
- break;
360
- case Kt:
361
- this.text += "]";
362
- break;
363
- default:
364
- this.text += `]]${String.fromCodePoint(t)}`, this.state = 20;
365
- }
366
- }
367
- sPIFirstChar() {
368
- const t = this.getCodeNorm();
369
- this.nameStartCheck(t) ? (this.piTarget += String.fromCodePoint(t), this.state = 24) : t === F || q(t) ? (this.fail("processing instruction without a target."), this.state = t === F ? 26 : 25) : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(t), this.state = 24);
370
- }
371
- sPIRest() {
372
- const { chunk: t, i: s } = this;
373
- for (; ; ) {
374
- const o = this.getCodeNorm();
375
- if (o === O) return void (this.piTarget += t.slice(s));
376
- if (!this.nameCheck(o)) {
377
- this.piTarget += t.slice(s, this.prevI);
378
- const n = o === F;
379
- n || q(o) ? this.piTarget === "xml" ? (this.xmlDeclPossible || this.fail("an XML declaration must be at the start of the document."), this.state = n ? Xt : 27) : this.state = n ? 26 : 25 : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(o));
380
- break;
381
- }
382
- }
383
- }
384
- sPIBody() {
385
- if (this.text.length === 0) {
386
- const t = this.getCodeNorm();
387
- t === F ? this.state = 26 : q(t) || (this.text = String.fromCodePoint(t));
388
- } else this.captureToChar(F) && (this.state = 26);
389
- }
390
- sPIEnding() {
391
- const t = this.getCodeNorm();
392
- if (t === M) {
393
- const { piTarget: s } = this;
394
- s.toLowerCase() === "xml" && this.fail("the XML declaration must appear at the start of the document."), this.piHandler?.({ target: s, body: this.text }), this.piTarget = this.text = "", this.state = B;
395
- } else t === F ? this.text += "?" : (this.text += `?${String.fromCodePoint(t)}`, this.state = 25);
396
- this.xmlDeclPossible = !1;
397
- }
398
- sXMLDeclNameStart() {
399
- const t = this.skipSpaces();
400
- t !== F ? t !== O && (this.state = 28, this.name = String.fromCodePoint(t)) : this.state = Xt;
401
- }
402
- sXMLDeclName() {
403
- const t = this.captureTo(Ws);
404
- if (t === F) return this.state = Xt, this.name += this.text, this.text = "", void this.fail("XML declaration is incomplete.");
405
- if (q(t) || t === Jt) {
406
- if (this.name += this.text, this.text = "", !this.xmlDeclExpects.includes(this.name)) switch (this.name.length) {
407
- case 0:
408
- this.fail("did not expect any more name/value pairs.");
409
- break;
410
- case 1:
411
- this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);
412
- break;
413
- default:
414
- this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`);
415
- }
416
- this.state = t === Jt ? 30 : 29;
417
- }
418
- }
419
- sXMLDeclEq() {
420
- const t = this.getCodeNorm();
421
- if (t === F) return this.state = Xt, void this.fail("XML declaration is incomplete.");
422
- q(t) || (t !== Jt && this.fail("value required."), this.state = 30);
423
- }
424
- sXMLDeclValueStart() {
425
- const t = this.getCodeNorm();
426
- if (t === F) return this.state = Xt, void this.fail("XML declaration is incomplete.");
427
- q(t) || (me(t) ? this.q = t : (this.fail("value must be quoted."), this.q = 32), this.state = 31);
428
- }
429
- sXMLDeclValue() {
430
- const t = this.captureTo([this.q, F]);
431
- if (t === F) return this.state = Xt, this.text = "", void this.fail("XML declaration is incomplete.");
432
- if (t === O) return;
433
- const s = this.text;
434
- switch (this.text = "", this.name) {
435
- case "version": {
436
- this.xmlDeclExpects = ["encoding", "standalone"];
437
- const o = s;
438
- this.xmlDecl.version = o, /^1\.[0-9]+$/.test(o) ? this.opt.forceXMLVersion || this.setXMLVersion(o) : this.fail("version number must match /^1\\.[0-9]+$/.");
439
- break;
440
- }
441
- case "encoding":
442
- /^[A-Za-z][A-Za-z0-9._-]*$/.test(s) || this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."), this.xmlDeclExpects = ["standalone"], this.xmlDecl.encoding = s;
443
- break;
444
- case "standalone":
445
- s !== "yes" && s !== "no" && this.fail('standalone value must match "yes" or "no".'), this.xmlDeclExpects = [], this.xmlDecl.standalone = s;
446
- }
447
- this.name = "", this.state = 32;
448
- }
449
- sXMLDeclSeparator() {
450
- const t = this.getCodeNorm();
451
- t !== F ? (q(t) || (this.fail("whitespace required."), this.unget()), this.state = 27) : this.state = Xt;
452
- }
453
- sXMLDeclEnding() {
454
- this.getCodeNorm() === M ? (this.piTarget !== "xml" ? this.fail("processing instructions are not allowed before root.") : this.name !== "version" && this.xmlDeclExpects.includes("version") && this.fail("XML declaration must contain a version."), this.xmldeclHandler?.(this.xmlDecl), this.name = "", this.piTarget = this.text = "", this.state = B) : this.fail("The character ? is disallowed anywhere in XML declarations."), this.xmlDeclPossible = !1;
455
- }
456
- sOpenTag() {
457
- const t = this.captureNameChars();
458
- if (t === O) return;
459
- const s = this.tag = { name: this.name, attributes: /* @__PURE__ */ Object.create(null) };
460
- switch (this.name = "", this.xmlnsOpt && (this.topNS = s.ns = /* @__PURE__ */ Object.create(null)), this.openTagStartHandler?.(s), this.sawRoot = !0, !this.fragmentOpt && this.closedRoot && this.fail("documents may contain only one root."), t) {
461
- case M:
462
- this.openTag();
463
- break;
464
- case 47:
465
- this.state = 35;
466
- break;
467
- default:
468
- q(t) || this.fail("disallowed character in tag name."), this.state = 36;
469
- }
470
- }
471
- sOpenTagSlash() {
472
- this.getCode() === M ? this.openSelfClosingTag() : (this.fail("forward-slash in opening tag not followed by >."), this.state = 36);
473
- }
474
- sAttrib() {
475
- const t = this.skipSpaces();
476
- t !== O && (le(t) ? (this.unget(), this.state = 37) : t === M ? this.openTag() : t === 47 ? this.state = 35 : this.fail("disallowed character in attribute name."));
477
- }
478
- sAttribName() {
479
- const t = this.captureNameChars();
480
- t === Jt ? this.state = 39 : q(t) ? this.state = 38 : t === M ? (this.fail("attribute without value."), this.pushAttrib(this.name, this.name), this.name = this.text = "", this.openTag()) : t !== O && this.fail("disallowed character in attribute name.");
481
- }
482
- sAttribNameSawWhite() {
483
- const t = this.skipSpaces();
484
- switch (t) {
485
- case O:
486
- return;
487
- case Jt:
488
- this.state = 39;
489
- break;
490
- default:
491
- this.fail("attribute without value."), this.text = "", this.name = "", t === M ? this.openTag() : le(t) ? (this.unget(), this.state = 37) : (this.fail("disallowed character in attribute name."), this.state = 36);
492
- }
493
- }
494
- sAttribValue() {
495
- const t = this.getCodeNorm();
496
- me(t) ? (this.q = t, this.state = 40) : q(t) || (this.fail("unquoted attribute value."), this.state = 42, this.unget());
497
- }
498
- sAttribValueQuoted() {
499
- const { q: t, chunk: s } = this;
500
- let { i: o } = this;
501
- for (; ; ) switch (this.getCode()) {
502
- case t:
503
- return this.pushAttrib(this.name, this.text + s.slice(o, this.prevI)), this.name = this.text = "", this.q = null, void (this.state = 41);
504
- case 38:
505
- return this.text += s.slice(o, this.prevI), this.state = 14, void (this.entityReturnState = 40);
506
- case it:
507
- case lt:
508
- case 9:
509
- this.text += `${s.slice(o, this.prevI)} `, o = this.i;
510
- break;
511
- case St:
512
- return this.text += s.slice(o, this.prevI), void this.fail("disallowed character.");
513
- case O:
514
- return void (this.text += s.slice(o));
515
- }
516
- }
517
- sAttribValueClosed() {
518
- const t = this.getCodeNorm();
519
- q(t) ? this.state = 36 : t === M ? this.openTag() : t === 47 ? this.state = 35 : le(t) ? (this.fail("no whitespace between attributes."), this.unget(), this.state = 37) : this.fail("disallowed character in attribute name.");
520
- }
521
- sAttribValueUnquoted() {
522
- const t = this.captureTo(_s);
523
- switch (t) {
524
- case 38:
525
- this.state = 14, this.entityReturnState = 42;
526
- break;
527
- case St:
528
- this.fail("disallowed character.");
529
- break;
530
- case O:
531
- break;
532
- default:
533
- this.text.includes("]]>") && this.fail('the string "]]>" is disallowed in char data.'), this.pushAttrib(this.name, this.text), this.name = this.text = "", t === M ? this.openTag() : this.state = 36;
534
- }
535
- }
536
- sCloseTag() {
537
- const t = this.captureNameChars();
538
- t === M ? this.closeTag() : q(t) ? this.state = 44 : t !== O && this.fail("disallowed character in closing tag.");
539
- }
540
- sCloseTagSawWhite() {
541
- switch (this.skipSpaces()) {
542
- case M:
543
- this.closeTag();
544
- break;
545
- case O:
546
- break;
547
- default:
548
- this.fail("disallowed character in closing tag.");
549
- }
550
- }
551
- handleTextInRoot() {
552
- let { i: t, forbiddenState: s } = this;
553
- const { chunk: o, textHandler: n } = this;
554
- t: for (; ; ) switch (this.getCode()) {
555
- case St:
556
- if (this.state = 15, n !== void 0) {
557
- const { text: a } = this, c = o.slice(t, this.prevI);
558
- a.length !== 0 ? (n(a + c), this.text = "") : c.length !== 0 && n(c);
559
- }
560
- s = 0;
561
- break t;
562
- case 38:
563
- this.state = 14, this.entityReturnState = B, n !== void 0 && (this.text += o.slice(t, this.prevI)), s = 0;
564
- break t;
565
- case Kt:
566
- switch (s) {
567
- case 0:
568
- s = 1;
569
- break;
570
- case 1:
571
- s = 2;
572
- break;
573
- case 2:
574
- break;
575
- default:
576
- throw new Error("impossible state");
577
- }
578
- break;
579
- case M:
580
- s === 2 && this.fail('the string "]]>" is disallowed in char data.'), s = 0;
581
- break;
582
- case lt:
583
- n !== void 0 && (this.text += `${o.slice(t, this.prevI)}
584
- `), t = this.i, s = 0;
585
- break;
586
- case O:
587
- n !== void 0 && (this.text += o.slice(t));
588
- break t;
589
- default:
590
- s = 0;
591
- }
592
- this.forbiddenState = s;
593
- }
594
- handleTextOutsideRoot() {
595
- let { i: t } = this;
596
- const { chunk: s, textHandler: o } = this;
597
- let n = !1;
598
- t: for (; ; ) {
599
- const a = this.getCode();
600
- switch (a) {
601
- case St:
602
- if (this.state = 15, o !== void 0) {
603
- const { text: c } = this, m = s.slice(t, this.prevI);
604
- c.length !== 0 ? (o(c + m), this.text = "") : m.length !== 0 && o(m);
605
- }
606
- break t;
607
- case 38:
608
- this.state = 14, this.entityReturnState = B, o !== void 0 && (this.text += s.slice(t, this.prevI)), n = !0;
609
- break t;
610
- case lt:
611
- o !== void 0 && (this.text += `${s.slice(t, this.prevI)}
612
- `), t = this.i;
613
- break;
614
- case O:
615
- o !== void 0 && (this.text += s.slice(t));
616
- break t;
617
- default:
618
- q(a) || (n = !0);
619
- }
620
- }
621
- n && (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));
622
- }
623
- pushAttribNS(t, s) {
624
- const { prefix: o, local: n } = this.qname(t), a = { name: t, prefix: o, local: n, value: s };
625
- if (this.attribList.push(a), this.attributeHandler?.(a), o === "xmlns") {
626
- const c = s.trim();
627
- this.currentXMLVersion === "1.0" && c === "" && this.fail("invalid attempt to undefine prefix in XML 1.0"), this.topNS[n] = c, Pe(this, n, c);
628
- } else if (t === "xmlns") {
629
- const c = s.trim();
630
- this.topNS[""] = c, Pe(this, "", c);
631
- }
632
- }
633
- pushAttribPlain(t, s) {
634
- const o = { name: t, value: s };
635
- this.attribList.push(o), this.attributeHandler?.(o);
636
- }
637
- end() {
638
- this.sawRoot || this.fail("document must contain a root element.");
639
- const { tags: t } = this;
640
- for (; t.length > 0; ) {
641
- const o = t.pop();
642
- this.fail(`unclosed tag: ${o.name}`);
643
- }
644
- this.state !== 0 && this.state !== B && this.fail("unexpected end.");
645
- const { text: s } = this;
646
- return s.length !== 0 && (this.textHandler?.(s), this.text = ""), this._closed = !0, this.endHandler?.(), this._init(), this;
647
- }
648
- resolve(t) {
649
- let s = this.topNS[t];
650
- if (s !== void 0) return s;
651
- const { tags: o } = this;
652
- for (let n = o.length - 1; n >= 0; n--) if (s = o[n].ns[t], s !== void 0) return s;
653
- return s = this.ns[t], s !== void 0 ? s : this.opt.resolvePrefix?.(t);
654
- }
655
- qname(t) {
656
- const s = t.indexOf(":");
657
- if (s === -1) return { prefix: "", local: t };
658
- const o = t.slice(s + 1), n = t.slice(0, s);
659
- return (n === "" || o === "" || o.includes(":")) && this.fail(`malformed name: ${t}.`), { prefix: n, local: o };
660
- }
661
- processAttribsNS() {
662
- const { attribList: t } = this, s = this.tag;
663
- {
664
- const { prefix: a, local: c } = this.qname(s.name);
665
- s.prefix = a, s.local = c;
666
- const m = s.uri = this.resolve(a) ?? "";
667
- a !== "" && (a === "xmlns" && this.fail('tags may not have "xmlns" as prefix.'), m === "" && (this.fail(`unbound namespace prefix: ${JSON.stringify(a)}.`), s.uri = a));
668
- }
669
- if (t.length === 0) return;
670
- const { attributes: o } = s, n = /* @__PURE__ */ new Set();
671
- for (const a of t) {
672
- const { name: c, prefix: m, local: v } = a;
673
- let b, x;
674
- m === "" ? (b = c === "xmlns" ? Yt : "", x = c) : (b = this.resolve(m), b === void 0 && (this.fail(`unbound namespace prefix: ${JSON.stringify(m)}.`), b = m), x = `{${b}}${v}`), n.has(x) && this.fail(`duplicate attribute: ${x}.`), n.add(x), a.uri = b, o[c] = a;
675
- }
676
- this.attribList = [];
677
- }
678
- processAttribsPlain() {
679
- const { attribList: t } = this, s = this.tag.attributes;
680
- for (const { name: o, value: n } of t) s[o] !== void 0 && this.fail(`duplicate attribute: ${o}.`), s[o] = n;
681
- this.attribList = [];
682
- }
683
- openTag() {
684
- this.processAttribs();
685
- const { tags: t } = this, s = this.tag;
686
- s.isSelfClosing = !1, this.openTagHandler?.(s), t.push(s), this.state = B, this.name = "";
687
- }
688
- openSelfClosingTag() {
689
- this.processAttribs();
690
- const { tags: t } = this, s = this.tag;
691
- s.isSelfClosing = !0, this.openTagHandler?.(s), this.closeTagHandler?.(s), (this.tag = t[t.length - 1] ?? null) === null && (this.closedRoot = !0), this.state = B, this.name = "";
692
- }
693
- closeTag() {
694
- const { tags: t, name: s } = this;
695
- if (this.state = B, this.name = "", s === "") return this.fail("weird empty close tag."), void (this.text += "</>");
696
- const o = this.closeTagHandler;
697
- let n = t.length;
698
- for (; n-- > 0; ) {
699
- const a = this.tag = t.pop();
700
- if (this.topNS = a.ns, o?.(a), a.name === s) break;
701
- this.fail("unexpected close tag.");
702
- }
703
- n === 0 ? this.closedRoot = !0 : n < 0 && (this.fail(`unmatched closing tag: ${s}.`), this.text += `</${s}>`);
704
- }
705
- parseEntity(t) {
706
- if (t[0] !== "#") {
707
- const o = this.ENTITIES[t];
708
- return o !== void 0 ? o : (this.fail(this.isName(t) ? "undefined entity." : "disallowed character in entity name."), `&${t};`);
709
- }
710
- let s = NaN;
711
- return t[1] === "x" && /^#x[0-9a-f]+$/i.test(t) ? s = parseInt(t.slice(2), 16) : /^#[0-9]+$/.test(t) && (s = parseInt(t.slice(1), 10)), this.isChar(s) ? String.fromCodePoint(s) : (this.fail("malformed character entity."), `&${t};`);
712
- }
713
- }
714
- var Oe, Tt;
715
- (Tt = Oe || (Oe = {})).Events = { XmlDecl: "xmldecl", Text: "text", ProcessingInstruction: "processinginstruction", Doctype: "doctype", Comment: "comment", OpenTagStart: "opentagstart", Attribute: "attribute", OpenTag: "opentag", CloseTag: "closetag", CDdata: "cdata", Error: "error", End: "end", Ready: "ready" }, Tt.parseStream = async (i, t, s) => {
716
- const o = new Us({ position: !1, ...s });
717
- let n;
718
- if (t.onOpenTagStart && o.on(Tt.Events.OpenTagStart, t.onOpenTagStart), t.onOpenTag && o.on(Tt.Events.OpenTag, t.onOpenTag), t.onCloseTag && o.on(Tt.Events.CloseTag, t.onCloseTag), t.onAttribute && o.on(Tt.Events.Attribute, t.onAttribute), t.onText && o.on(Tt.Events.Text, t.onText), t.onError && o.on(Tt.Events.Error, t.onError), t.onEnd) {
719
- t.onEnd;
720
- const a = () => {
721
- n = t.onEnd();
722
- };
723
- o.on(Tt.Events.End, a);
724
- }
725
- for (; ; ) {
726
- const { value: a, done: c } = await i.read();
727
- if (c) break;
728
- o.write(a);
729
- }
730
- return o.close(), n;
731
- };
732
- const w = (i) => i === !0 || i === "1" || i === "on" || i === "true" || i !== !1 && i !== "0" && i !== "off" && i !== "false" && null, A = (i) => {
733
- const t = parseInt(i);
734
- return isNaN(t) ? null : t;
735
- }, ct = (i) => {
736
- const t = parseFloat(i);
737
- return isNaN(t) ? null : t;
738
- }, k = null;
739
- class Gs {
740
- constructor() {
741
- this._registeredVisitors = /* @__PURE__ */ new Map();
742
- }
743
- registerVisitor(t) {
744
- this._registeredVisitors.set(t.from, t);
745
- }
746
- createEventHandler(t, s, o) {
747
- const n = this._registeredVisitors, a = [];
748
- let c = null, m = null, v = null, b = null;
749
- const x = [], E = { key: null, source: t };
750
- let y = null, u = !1;
751
- const D = (T, f) => {
752
- let I = v.attributes[T];
753
- if (f) {
754
- if (Array.isArray(f)) {
755
- for (let H = 0; H < f.length; H++) if (I == null || (I = f[H](I), I == null)) return;
756
- } else if (I == null || (I = f(I), I == null)) return;
757
- }
758
- return I;
759
- }, g = { getSource: () => y.source, setSource: (T) => {
760
- y.source = T;
761
- }, setKey: (T) => {
762
- y.key = T;
763
- }, getFrom: () => v, getAttribute: (T, f) => D(T, f) ?? null, hasAttribute: (T) => g.getAttribute(T) !== null, getParent: () => x[x.length - 2].source, getPath: () => {
764
- const T = [];
765
- for (let f = 0; f < a.length; f++) T.push(a[f].local);
766
- return T.join("\\");
767
- }, parseAttribute: D, copyToObject: (T, f, I, H) => {
768
- const W = D(H ?? f, I);
769
- W !== void 0 && (T[f] = W);
770
- }, copyTo: (T, f, I) => {
771
- const H = D(I ?? T, f);
772
- H !== void 0 && (y.source[T] = H);
773
- }, warn: (T) => {
774
- o ? o?.(T) : console.warn(T);
775
- } };
776
- return { onOpenTag: (T) => {
777
- let f = T.name;
778
- const I = f.indexOf(":");
779
- I !== -1 && (f = f.slice(I + 1));
780
- const H = n.get(f);
781
- if (c = { local: f, visitor: H, tag: T, destination: null }, u) return a.push(c), m = f, void (v = T);
782
- b = c?.visitor ?? null, H && (y = a.length === 0 ? E : b?.to !== null ? { key: null, source: {} } : null, c.destination = y, y && x.push(y)), a.push(c), m = f, v = T, u = b?.to === null, b?.openTag?.(g);
783
- }, onCloseTag: (T) => {
784
- let f = T.name;
785
- const I = f.indexOf(":");
786
- if (I !== -1 && (f = f.slice(I + 1)), f !== m) throw new Error(`mismatch open/close tag: '${f}'/'${m}'`);
787
- u || b?.closeTag?.(g);
788
- const H = a.pop() ?? null;
789
- c = a[a.length - 1] ?? null;
790
- const W = H?.destination;
791
- if (W) {
792
- x.pop(), y = x[x.length - 1] ?? E;
793
- const ht = H.visitor;
794
- ht && ht.to && W.source !== void 0 && (Array.isArray(ht.to) ? y.source.push ? y.source.push(W.source) : o?.(`Unable to parse array for ${ht.from} at ${g.getPath()}`) : W.key ? y.source[W.key] = W.source : typeof ht.to == "string" && (y.source[ht.to] = W.source));
795
- }
796
- m = c?.local ?? null, v = c?.tag ?? null, b = c?.visitor ?? null, u = !c?.destination;
797
- }, onText: (T) => {
798
- b?.text?.(T, g);
799
- }, onEnd: s };
800
- }
801
- }
802
- const ns = (i, t, s, o = null) => {
803
- if (!i) return null;
804
- let n = i;
805
- n.startsWith("/") && (n = n.substring(1));
806
- let a = o?.parsedRefs?.get(i);
807
- if (a !== void 0) return a;
808
- const c = t(n);
809
- if (!c) return null;
810
- let m = c.content;
811
- try {
812
- s && (m = s(m));
813
- } catch (v) {
814
- console.warn(v);
815
- }
816
- return o?.parsedRefs?.set(i, m), m;
817
- }, Ie = (i, t, s, o, n = null) => {
818
- if (!i) return null;
819
- let a = i;
820
- a.startsWith("/") && (a = a.substring(1));
821
- let c = n?.parsedRefs?.get(i);
822
- if (c !== void 0) return c;
823
- const m = t(a);
824
- if (!m) return null;
825
- const v = m.content;
826
- try {
827
- const b = new TextDecoder().decode(v), x = s.parseFromString(b, "text/xml"), E = o.convert(x, i, n);
828
- return n?.parsedRefs?.set(i, E), E;
829
- } catch (b) {
830
- console.warn(b);
831
- }
832
- return null;
833
- }, Qt = (i, t, s, o, n = null) => {
834
- const a = /* @__PURE__ */ new Map();
835
- let c = t.Directory[i];
836
- const m = c ? c.length : 0;
837
- for (let v = 0; v < m; v++) {
838
- const b = c[v];
839
- if (!b) continue;
840
- let x = b;
841
- x.startsWith("/") && (x = x.substring(1));
842
- const E = Ie(x, (y) => t.files[y], s, o, n);
843
- a.set(x, E);
844
- }
845
- return a;
846
- }, Zs = ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "hlink", "folHlink"], as = (i, t = "dk1") => {
847
- let s;
848
- const o = i("auto");
849
- o === void 0 || o !== "1" && o !== "true" || (s = t);
850
- const n = i("indexed");
851
- n && (s = `index${n}`);
852
- const a = i("rgb");
853
- a && (s = a.toLowerCase(), a.length !== 8 || a.startsWith("FF") || (s = "FF" + a.substring(2, a.length)));
854
- const c = i("theme");
855
- c && (s = Zs[c]);
856
- let m = i("tint");
857
- if (m && (s += ` ${Ps.AdjustmentType.ETint} ${parseFloat(m)}`), s) return s;
858
- }, Qs = (i) => i && i.replace(/^\{([\s\S]+)\}$/, "$1"), ei = (i) => i ? cs.roundAccurately(parseFloat(i) / 12700, 4) : null, si = (i) => i ? cs.roundAccurately(parseFloat(i) / 9525, 1) : null, ii = (i) => parseFloat(i) / 1e3, oi = (i) => parseFloat(i) / 6e4, Js = (i) => i === "true" || i === "1";
859
- class Bt {
860
- static {
861
- this.Collapsed = 1;
862
- }
863
- static {
864
- this.CustomFormat = 2;
865
- }
866
- static {
867
- this.CustomHeight = 4;
868
- }
869
- static {
870
- this.Hidden = 8;
871
- }
872
- static {
873
- this.Ht = 16;
874
- }
875
- static {
876
- this.OutlineLevel = 32;
877
- }
878
- static {
879
- this.Ph = 64;
880
- }
881
- static {
882
- this.R = 128;
883
- }
884
- static {
885
- this.S = 256;
886
- }
887
- static {
888
- this.Spans = 512;
889
- }
890
- static {
891
- this.ThickBot = 1024;
892
- }
893
- static {
894
- this.ThickTop = 2048;
895
- }
896
- }
897
- const Ks = (i, t, s) => {
898
- if (i[0].value[0] === i[1].value[0]) return t;
899
- }, ls = { colStart: 0, colEnd: 0, rowStart: 0, rowEnd: 0 }, ri = Object.freeze(Object.defineProperty({ __proto__: null, fromBufferXLSX: async (i, t) => {
900
- const { password: s, onWarning: o, createWorkbookOptions: n = {}, ...a } = t ?? {}, c = import("./DhD48oFrbrnZ6Zg5.mjs"), m = import("./4uEr84M4w57AMyDg.mjs");
901
- let v = null;
902
- try {
903
- v = new DOMParser();
904
- } catch {
905
- }
906
- let b = null;
907
- v || (b = import("./CKHsU9LUNYowimxS.mjs").then((u) => u.i));
908
- let x = null, E = null, y = null;
909
- try {
910
- const u = await Promise.all([c, m, b]);
911
- x = u[0], E = u[1], y = u[2];
912
- } catch (u) {
913
- throw new Error("Unable to load XLSX parser.", { cause: u });
914
- }
915
- try {
916
- const u = x.read(i, { type: "array", sheets: [], cellStyles: !1, bookFiles: !0 });
917
- if (!u.Directory) throw new Error("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
918
- u.Directory.richstructure = ["/xl/richData/rdrichvaluestructure.xml"], u.Directory.richdata = ["/xl/richData/rdrichvalue.xml"];
919
- const D = new E.FromOOXMLConverter(), g = v ?? new y.DOMParser(), T = n?.resources ?? new vs(), f = T.beginPersist(), I = {}, H = /* @__PURE__ */ new Set(), W = /* @__PURE__ */ new Map();
920
- W.set("richTypes", []);
921
- const ht = /* @__PURE__ */ new Map(), Ve = [], ce = (P) => u.files[P], ye = (P, z) => {
922
- const K = P.lastIndexOf("/"), ut = P.substring(0, K + 1) + "_rels/" + P.substring(K + 1, P.length) + ".rels";
923
- let dt = z.get(ut);
924
- return dt || (dt = ((R, ve, Se, Ce, Wt = null) => {
925
- if (!R) return null;
926
- const Y = Ie(R, ve, Se, Ce, Wt);
927
- if (!Y) return null;
928
- const tt = /* @__PURE__ */ new Map(), bt = Object.keys(Y), _t = bt.length;
929
- for (let xt = 0; xt < _t; xt++) {
930
- const qt = bt[xt], kt = Y[qt];
931
- tt.set(qt, kt);
932
- }
933
- return tt;
934
- })(ut, ce, g, D, yt), z.set(ut, dt)), dt;
935
- }, he = (P, z, K, ut = ht) => {
936
- let dt = ye(z, ut).get(P), R = dt?.target;
937
- if (!R) return null;
938
- if (dt.targetMode === "External") return dt.target;
939
- const ve = z.lastIndexOf("/"), Se = z.substring(0, ve + 1);
940
- R.startsWith("/") || (R = Se + R), R = ((Y) => {
941
- const tt = Y.split(/\/+/);
942
- return tt.reduce((bt, _t, xt) => (_t === "." ? bt.splice(xt, 1) : _t === ".." && bt.splice(xt - 1, 2), bt), tt).join("/");
943
- })(R);
944
- const Ce = D?.getVisitorParamsState().get("dxfs");
945
- let Wt = ut.get(R);
946
- if (!Wt) if (dt.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
947
- const Y = {};
948
- Wt = Y;
949
- const tt = async () => {
950
- const bt = ((V, U, te, _, G, Z, wt) => {
951
- const h = new Gs(), Q = new Ss.TransposedBuilder();
952
- let j = null;
953
- h.registerVisitor({ from: "autoFilter", to: "filter", openTag: (e) => {
954
- e.copyTo("ref", k);
955
- } }), h.registerVisitor({ from: "conditionalFormatting", to: {}, openTag: (e) => {
956
- const r = e.getParent();
957
- r.conditionals || (r.conditionals = []), r.conditionals.push(e.getSource());
958
- const l = e.getAttribute("sqref");
959
- l && (e.getSource().ref = l.split(" ").join(",")), e.copyTo("pivot", w);
960
- }, closeTag: (e) => {
961
- const r = e.getSource();
962
- if (r.rule) {
963
- const l = Object.keys(r.rule);
964
- for (let d = 0; d < l.length; d++) {
965
- const S = l[d];
966
- S !== "rule" && (r[S] = r.rule[S]);
967
- }
968
- }
969
- delete r.rule;
970
- } }), h.registerVisitor({ from: "cfRule", to: "rule", openTag: (e) => {
971
- const r = e.getParent();
972
- e.copyToObject(r, "type", k), e.copyToObject(r, "priority", A), e.copyToObject(r, "stopIfTrue", w);
973
- const l = e.getAttribute("dxfId", A);
974
- if (l !== null) {
975
- let d = _?.get(l);
976
- d || (Z?.(`Unable to load conditional color. Invalid dxfI: '${l}' at '${e.getPath()}'.`), d = {}), r.style = d;
977
- }
978
- e.copyToObject(r, "aboveAverage", w), e.copyToObject(r, "equalAverage", w), e.copyToObject(r, "stdDev", A), e.copyToObject(r, "bottom", w), e.copyToObject(r, "percent", w), e.copyToObject(r, "rank", A), e.copyToObject(r, "operator", k), e.copyToObject(r, "text", k), e.copyToObject(r, "timePeriod", k);
979
- } }), h.registerVisitor({ from: "colorScale", to: "colorScale" }), h.registerVisitor({ from: "dataBar", to: "dataBar", openTag: (e) => {
980
- e.copyTo("maxLength", A), e.copyTo("minLength", A), e.copyTo("showValue", w);
981
- } }), h.registerVisitor({ from: "iconSet", to: "iconSet", openTag: (e) => {
982
- e.copyTo("iconSet", k), e.copyTo("reverse", w), e.copyTo("showValue", w);
983
- } }), h.registerVisitor({ from: "formula", to: null, text: (e, r) => {
984
- const l = r.getParent();
985
- let d = l.formulas;
986
- d || (d = [], l.formulas = d), d.push(e);
987
- } }), h.registerVisitor({ from: "cfvo", to: {}, openTag: (e) => {
988
- const r = e.getParent();
989
- r.conditions || (r.conditions = []), r.conditions.push(e.getSource()), e.copyTo("type", k), e.copyTo("value", ct, "val"), e.copyTo("gte", w);
990
- } }), h.registerVisitor({ from: "color", to: {}, openTag: (e) => {
991
- const r = e.getParent();
992
- r.colors || (r.colors = []);
993
- const l = as((d) => e.getAttribute(d));
994
- r.colors.push(l);
995
- } }), h.registerVisitor({ from: "filterColumn", to: "filterColumn", openTag: (e) => {
996
- const r = e.getParent();
997
- r.fields || (r.fields = []), r.fields.push(e.getSource()), e.copyTo("offset", A, "colId"), e.copyTo("hiddenButton", w), e.copyTo("showButton", w);
998
- } }), h.registerVisitor({ from: "colorFilter", to: "colorFilter", openTag: (e) => {
999
- const r = e.getParent();
1000
- r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Zt.Type.Color, e.copyTo("cellColor", w), e.copyTo("styleId", A, "dxfId");
1001
- } }), h.registerVisitor({ from: "dynamicFilter", to: "dynamicFilter", openTag: (e) => {
1002
- const r = e.getParent();
1003
- r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Zt.Type.Dynamic, e.copyTo("dynamicType", k, "type"), e.copyTo("val", ct), e.copyTo("maxVal", ct, "maxVal");
1004
- } }), h.registerVisitor({ from: "iconFilter", to: "iconFilter", openTag: (e) => {
1005
- const r = e.getParent();
1006
- r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Zt.Type.Icon, e.copyTo("iconId", A), e.copyTo("iconSet", k);
1007
- } }), h.registerVisitor({ from: "top10", to: "top10", openTag: (e) => {
1008
- const r = e.getParent();
1009
- r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Zt.Type.Top10, e.copyTo("filterVal", ct), e.copyTo("percent", w), e.copyTo("top", w), e.copyTo("val", ct);
1010
- } }), h.registerVisitor({ from: "filters", to: "filters", openTag: (e) => {
1011
- const r = e.getParent();
1012
- r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Zt.Type.Items, e.copyTo("blank", w), e.copyTo("calendarType", k);
1013
- } }), h.registerVisitor({ from: "dateGroupItem", to: "dateGroupItem", openTag: (e) => {
1014
- const r = e.getParent();
1015
- r.dateGroups || (r.dateGroups = []), r.dateGroups.push(e.getSource()), e.copyTo("group", k, "dateTimeGrouping"), e.copyTo("day", A), e.copyTo("hour", A), e.copyTo("minute", A), e.copyTo("month", A), e.copyTo("second", A), e.copyTo("year", A);
1016
- } }), h.registerVisitor({ from: "filter", to: "filter", openTag: (e) => {
1017
- const r = e.getParent();
1018
- r.items || (r.items = []), r.items.push(e.getAttribute("val", ct));
1019
- } }), h.registerVisitor({ from: "customFilters", to: "customFilters", openTag: (e) => {
1020
- const r = e.getParent();
1021
- r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Zt.Type.Custom, e.copyTo("and", w);
1022
- } }), h.registerVisitor({ from: "customFilter", to: "customFilter", openTag: (e) => {
1023
- const r = e.getParent();
1024
- r.filters || (r.filters = []), r.filters.push(e.getSource()), e.copyTo("operator", k), e.copyTo("value", ct, "val");
1025
- } }), h.registerVisitor({ from: "sortState", to: "sort", openTag: (e) => {
1026
- e.copyTo("ref", k);
1027
- } }), h.registerVisitor({ from: "sortCondition", to: "sortCondition", openTag: (e) => {
1028
- const r = e.getParent();
1029
- r.fields || (r.fields = []);
1030
- const l = e.getSource();
1031
- r.fields.push(l), e.copyTo("sortOn", k, "sortBy"), e.copyTo("dxfId", k, "sortBy"), e.copyTo("iconSet", k), e.copyTo("customList", k);
1032
- const d = e.getAttribute("ref");
1033
- if (d) {
1034
- const S = at.fastStringToRange(d, ls).colStart, pt = at.fastStringToRange(r.ref, ls), ot = pt.colStart;
1035
- l.offset = pt ? S - ot : S;
1036
- }
1037
- l.reverse = e.getAttribute("descending", w) ?? !1;
1038
- } }), h.registerVisitor({ from: "AlternateContent", to: null });
1039
- const ge = (e) => {
1040
- j = e.getSource(), e.copyTo("topLeft", k, "topLeftCell");
1041
- const r = Js(e.getAttribute("defaultGridColor")), l = e.getAttribute("colorId");
1042
- l === null || r || (e.getSource().gridLineColor = "index" + parseFloat(l)), e.copyTo("showZeros", w), e.copyTo("showFormulas", w), e.copyTo("zoomScale", A), e.copyTo("showRowHeaders", w, "showRowColHeaders"), e.copyTo("showColumnHeaders", w, "showRowColHeaders"), e.copyTo("showRowGridlines", w, "showGridLines"), e.copyTo("showColumnGridlines", w, "showGridLines");
1043
- };
1044
- h.registerVisitor({ from: "sheetView", to: "view", openTag: (e) => {
1045
- ge(e);
1046
- }, closeTag: () => {
1047
- j = null;
1048
- } }), h.registerVisitor({ from: "customSheetViews", to: "customSheetViews", openTag: (e) => {
1049
- e.setSource([]);
1050
- } }), h.registerVisitor({ from: "customSheetView", to: [], openTag: (e) => {
1051
- ge(e);
1052
- }, closeTag: () => {
1053
- j = null;
1054
- } }), h.registerVisitor({ from: "selection", to: "selection", openTag: (e) => {
1055
- if (!j) return;
1056
- e.copyTo("cell", k, "activeCell"), e.copyTo("rangeIndex", A, "activeCellId");
1057
- const r = e.getAttribute("activeCell"), l = e.getAttribute("sqref");
1058
- l && l !== r && (e.getSource().ranges = l.split(" "));
1059
- } }), h.registerVisitor({ from: "pane", to: "pane", openTag: (e) => {
1060
- if (j && e.getAttribute("state") === "frozen") {
1061
- const r = {};
1062
- j.freezePanes = r, e.copyToObject(r, "topLeft", k, "topLeftCell");
1063
- const l = j.topLeft ? at.fastStringToCell(j.topLeft) : { colIndex: 0, rowIndex: 0 }, d = { colIndex: 0, rowIndex: 0 };
1064
- e.copyToObject(d, "colIndex", A, "xSplit"), e.copyToObject(d, "rowIndex", A, "ySplit");
1065
- const S = { colIndex: l.colIndex + d.colIndex, rowIndex: l.rowIndex + d.rowIndex };
1066
- r.coords = at.cellToString(S);
1067
- }
1068
- } }), h.registerVisitor({ from: "tabColor", to: null, openTag: (e) => {
1069
- const r = as((l) => e.getAttribute(l));
1070
- r && (V.tabColor = r);
1071
- } }), h.registerVisitor({ from: "pageSetUpPr", to: "pageSetUpPr", openTag: (e) => {
1072
- } }), h.registerVisitor({ from: "outlinePr", to: "outlinePr", openTag: (e) => {
1073
- } }), h.registerVisitor({ from: "pageMargins", to: "pageMargins", openTag: (e) => {
1074
- } }), h.registerVisitor({ from: "pageSetup", to: "pageSetup", openTag: (e) => {
1075
- } }), h.registerVisitor({ from: "printOptions", to: "printOptions", openTag: (e) => {
1076
- } }), h.registerVisitor({ from: "mergeCells", to: "merges", openTag: (e) => {
1077
- e.setSource([]);
1078
- } }), h.registerVisitor({ from: "mergeCell", to: [], openTag: (e) => {
1079
- const r = e.getAttribute("ref");
1080
- e.setSource(r);
1081
- } }), h.registerVisitor({ from: "hyperlinks", to: "hyperlinks", openTag: (e) => {
1082
- e.setSource([]);
1083
- } }), h.registerVisitor({ from: "hyperlink", to: [], openTag: (e) => {
1084
- const r = e.getAttribute("r:id"), l = e.getAttribute("ref");
1085
- if (!l) return void console.warn("No ref found for hyperlink");
1086
- e.setKey(l);
1087
- let d = r ? U(r) : "";
1088
- if (typeof d != "string") return void console.warn("Invalid address ", d);
1089
- const S = e.getAttribute("location");
1090
- d.endsWith("\\") && (d = d.substring(0, d.length - 1));
1091
- const pt = e.getAttribute("location");
1092
- if (pt && (S && S !== pt && console.warn("display and location are different", S, pt), d += "#" + pt), !d) return void console.warn("No address found for hyperlink. r:id", r);
1093
- let ot;
1094
- const At = e.getAttribute("tooltip");
1095
- ot = At ? { address: d, tooltip: At } : d, e.setSource({ r: l, v: ot });
1096
- } }), h.registerVisitor({ from: "drawing", to: "movables", openTag: (e) => {
1097
- const r = e.getAttribute("r:id");
1098
- if (!r) return;
1099
- const l = U(r);
1100
- l ? e.setSource(l.movables) : console.warn("no drawing found for rId", r);
1101
- } }), h.registerVisitor({ from: "tableParts", to: "tables", openTag: (e) => {
1102
- e.setSource([]);
1103
- } }), h.registerVisitor({ from: "tablePart", to: [], openTag: (e) => {
1104
- const r = e.getAttribute("r:id");
1105
- if (!r) return;
1106
- const l = U(r);
1107
- l ? e.setSource(l) : console.warn("no table found for rId", r);
1108
- } }), h.registerVisitor({ from: "worksheet", to: "worksheet", openTag: (e) => {
1109
- } }), h.registerVisitor({ from: "sheetProtection", to: "protection", openTag: (e) => {
1110
- let r = !1;
1111
- if (e.hasAttribute("sheet") && w(e.getAttribute("sheet")) && (r = !0), !r) return void e.setSource(void 0);
1112
- const l = (S) => S === !0 || S === "1" || S === "on" || S === "true" || S === !1 || S === "0" || S === "off" || S === "false" || null;
1113
- e.copyTo("autoFilter", l), e.copyTo("deleteColumns", l), e.copyTo("formatCells", l), e.copyTo("formatColumns", l), e.copyTo("formatRows", l), e.copyTo("insertColumns", l), e.copyTo("insertHyperlinks", l), e.copyTo("insertRows", l), e.copyTo("objects", l), e.copyTo("pivotTables", l), e.copyTo("scenarios", l), e.copyTo("selectUnlockedCells", l), e.copyTo("selectUnlockedCells", l), e.copyTo("sort", l);
1114
- const d = {};
1115
- e.copyToObject(d, "hash", k, "hashValue"), e.copyToObject(d, "algorithm", k, "algorithmName"), e.copyToObject(d, "salt", k, "saltValue"), e.copyToObject(d, "spinCount", A), Object.keys(d).length > 0 && (e.getSource().password = d);
1116
- } }), h.registerVisitor({ from: "protectedRanges", to: "protectedRanges", openTag: (e) => {
1117
- e.setSource({});
1118
- } }), h.registerVisitor({ from: "protectedRange", to: {}, openTag: (e) => {
1119
- const r = e.getAttribute("sqref");
1120
- e.setKey(r), e.copyTo("name"), e.copyTo("securityDescriptor");
1121
- const l = {};
1122
- e.copyToObject(l, "hash", k, "hashValue"), e.copyToObject(l, "algorithm", k, "algorithmName"), e.copyToObject(l, "salt", k, "saltValue"), e.copyToObject(l, "spinCount", A), Object.keys(l).length > 0 && (e.getSource().password = l);
1123
- } }), h.registerVisitor({ from: "sheetFormatPr", to: "sheetFormatPr", openTag: (e) => {
1124
- e.copyToObject(V, "defaultColSize", ct, "defaultColWidth"), e.copyToObject(V, "outlineLevelCol", A, "outlineLevelCol");
1125
- const r = e.getAttribute("customHeight");
1126
- r !== "1" && r !== "true" || e.copyToObject(V, "defaultRowSize", ct, "defaultRowHeight"), e.copyToObject(V, "outlineLevelRow", A, "outlineLevelRow");
1127
- } }), h.registerVisitor({ from: "cols", to: "cols", openTag: (e) => {
1128
- e.setSource([]);
1129
- } }), h.registerVisitor({ from: "col", to: [], openTag: (e) => {
1130
- e.copyTo("min", (r) => parseInt(r) - 1), e.copyTo("max", (r) => parseInt(r) - 1), e.copyTo("sz", ct, "width"), e.copyTo("cs", w, "customWidth"), e.copyTo("h", w, "hidden"), e.copyTo("l", A, "outlineLevel"), e.copyTo("s", A, "style");
1131
- } }), h.registerVisitor({ from: "oleObjects", to: null, openTag: (e) => {
1132
- e.warn("'OLE Objects' are not supported.");
1133
- } });
1134
- let ee = null;
1135
- const xs = { onOpenTag: (e) => {
1136
- ee === null && (ee = "");
1137
- }, onText: (e) => {
1138
- ee += e;
1139
- }, onEnd: () => {
1140
- const e = te(ee);
1141
- return ee = null, e;
1142
- }, onError: (e) => {
1143
- } };
1144
- return ((e, r, l, d, S, pt) => {
1145
- let ot = !1, At = !1, zt = [], Ut = !1, Et = null, se = null, fe = null, rt = null, He = null, Fe = null;
1146
- const ws = pt?.get("richData") ?? [], Xe = at.normalizeA1ToR1C1, Be = De.createConflatingRanges(), We = /* @__PURE__ */ new Map(), ke = [];
1147
- let ie = null;
1148
- const _e = De.createConflatingRanges();
1149
- let oe, Dt = !1, X = -1, J = -1, gt = null, re = null;
1150
- const Ae = [];
1151
- let Ee = null, qe = -2, ft = 0, Gt = "", Pt = "", Ot = "", It = "", Vt = "", Lt = "", Nt = "", ze = "", Ue = "", Ge = "", Ze = "", Qe = "", Je = "", Ke = "", mt = !0, Rt = null;
1152
- return { ...l, onEnd: () => {
1153
- Ae.length > 0 && (r.rows = Ae);
1154
- let p = Be.done(Ks);
1155
- const C = p.length;
1156
- if (C > 0) {
1157
- const $ = new Array(C);
1158
- for (let L = 0; L < C; L++) {
1159
- const nt = p[L], $t = at.rangeToString(nt), Mt = nt.value[1], ne = at.resolveRelativeToA1(Mt, nt.rowStart, nt.colStart);
1160
- $[L] = [$t, ne];
1161
- }
1162
- r.formulas = $;
1163
- }
1164
- const et = _e.done(!0), N = et.length;
1165
- if (N > 0) {
1166
- const $ = new Array(N);
1167
- for (let L = 0; L < N; L++) {
1168
- const nt = et[L], $t = at.rangeToString(nt);
1169
- $[L] = $t;
1170
- }
1171
- r.volatile = $;
1172
- }
1173
- if (ke.length > 0 && (r.dynamicArray = [...ke]), zt.length > 0) {
1174
- zt.sort(De.createRangeComparator(ks.Orientation.Column));
1175
- const $ = [];
1176
- let L = null, nt = -1, $t = -1, Mt = -1, ne = -1, vt = null;
1177
- const Ye = zt.length;
1178
- Ye > 0 && (L = zt[0], nt = L.colStart, $t = L.colEnd, Mt = L.rowEnd, ne = L.value, $.push(L));
1179
- for (let jt = 1; jt < Ye; jt++) vt = zt[jt], ne !== vt.value || nt !== vt.colStart || $t !== vt.colEnd || Mt + 1 !== vt.rowEnd ? ($.push(vt), L = vt, nt = L.colStart, $t = L.colEnd, Mt = L.rowEnd, ne = L.value) : (Mt = vt.rowEnd, L.rowEnd = Mt);
1180
- let ts = [];
1181
- for (let jt = 0; jt < $.length; jt++) {
1182
- const ae = $[jt];
1183
- ts.push({ r: { colStart: ae.colStart, colEnd: ae.colEnd, rowStart: ae.rowStart, rowEnd: ae.rowEnd }, v: ae.value });
1184
- }
1185
- r.directStyles = ts;
1186
- }
1187
- const st = e.build();
1188
- if (st) {
1189
- const $ = st.tuples;
1190
- r.data = $;
1191
- }
1192
- l?.onEnd?.();
1193
- }, onOpenTag: (p) => {
1194
- let C = p.name;
1195
- const et = C.indexOf(":");
1196
- if (et !== -1 && (C = C.slice(et + 1)), oe) {
1197
- const N = p.attributes;
1198
- switch (C) {
1199
- case "v":
1200
- At = !0;
1201
- break;
1202
- case "f":
1203
- switch (N.t ?? null) {
1204
- case null:
1205
- case "normal":
1206
- Ut = !0;
1207
- break;
1208
- case "shared":
1209
- const st = N.si;
1210
- se = N.ref, Et = st;
1211
- break;
1212
- case "array":
1213
- Ut = !0, se = N.ref, ie = [se, !1];
1214
- break;
1215
- case "datatable":
1216
- Ut = !0, se = N.ref, Ut = !0;
1217
- }
1218
- N.ca !== void 0 && _e.append(X, J);
1219
- break;
1220
- case "is":
1221
- return void (Dt = !0);
1222
- }
1223
- return void (Dt && S?.onOpenTag(p));
1224
- }
1225
- if (ot) {
1226
- if (C === "c") {
1227
- oe = p;
1228
- const N = p.attributes.r;
1229
- J = at.fastStringToCol(N);
1230
- const st = p.attributes.t;
1231
- st === void 0 ? re = null : (re = st, re === "str" && (Dt = !0));
1232
- let $ = p.attributes.s;
1233
- $ !== void 0 && ($ = parseInt($), Rt && Rt.value === $ && Rt.colEnd + 1 === J ? Rt.colEnd = J : (Rt = { colStart: J, rowStart: X, colEnd: J, rowEnd: X, value: $ }, zt.push(Rt)));
1234
- }
1235
- } else {
1236
- if (C === "row") {
1237
- ot = !0;
1238
- const N = p.attributes.r;
1239
- if (X = parseInt(N) - 1, ft = 0, Pt = p.attributes.customHeight, Pt !== void 0 && (ft |= Bt.CustomHeight), Pt !== Ue && (mt = !0, Ue = Pt), Gt = p.attributes.ht, Gt !== void 0 && (ft |= Bt.Ht), Gt !== ze && (mt = !0, ze = Gt), Ot = p.attributes.hidden, Ot !== void 0 && (ft |= Bt.Hidden), Ot !== Ge && (mt = !0, Ge = Ot), Vt = p.attributes.s, Vt !== void 0 && (ft |= Bt.S), Vt !== Qe && (mt = !0, Qe = Vt), It = p.attributes.customFormat, It !== void 0 && (ft |= Bt.CustomFormat), It !== Ze && (mt = !0, Ze = It), Lt = p.attributes.outlineLevel, Lt !== void 0 && (ft |= Bt.OutlineLevel), Lt !== Je && (mt = !0, Je = Lt), Nt = p.attributes.collapsed, Nt !== void 0 && (ft |= Bt.Collapsed), Nt !== Ke && (mt = !0, Ke = Nt), ft !== 0) if (qe + 1 !== X || mt) {
1240
- const st = Pt !== void 0 && (Pt === "1" || Pt === "true"), $ = It !== void 0 && (It === "1" || It === "true");
1241
- Ee = { min: X, max: X, sz: st && Gt !== void 0 ? parseFloat(Gt) : -1, csz: st, h: Ot !== void 0 && (Ot === "1" || Ot === "true"), s: st && Vt !== void 0 && Vt !== "0" ? parseInt(Vt) : 0, cs: $, l: Lt === void 0 || Lt === "0" ? 0 : parseInt(Lt), cl: Nt !== void 0 && (Nt === "1" || Nt === "true") }, Ae.push(Ee);
1242
- } else Ee.max = X;
1243
- return qe = X, void (mt = !1);
1244
- }
1245
- l?.onOpenTag(p);
1246
- }
1247
- }, onCloseTag: (p) => {
1248
- if (oe) {
1249
- let C = p.name;
1250
- const et = C.indexOf(":");
1251
- if (et !== -1 && (C = C.slice(et + 1)), Dt) if (C === "is" || C === "v") {
1252
- const N = S?.onEnd();
1253
- N !== null && e.addValue(X, J, "" + N);
1254
- } else S?.onCloseTag?.(p);
1255
- return At && (At = !1), void (C === "c" && (oe = null, Dt = !1));
1256
- }
1257
- if (ot) return ot = !1, void (Rt = null);
1258
- l?.onCloseTag(p);
1259
- }, onText: (p) => {
1260
- if (p = p.trim(), At) {
1261
- switch (gt = null, re) {
1262
- case null:
1263
- case "n":
1264
- gt = parseFloat(p);
1265
- break;
1266
- case "b":
1267
- gt = p === "1" || p === "true";
1268
- break;
1269
- case "s":
1270
- gt = p;
1271
- break;
1272
- case "e":
1273
- if (p === "#VALUE!") {
1274
- const et = oe.attributes.vm;
1275
- if (et !== void 0) {
1276
- const N = ws[parseInt(et) - 1];
1277
- if (N && N.isFormulaError) {
1278
- gt = { t: Ft.Error, v: N.getCode() };
1279
- break;
1280
- }
1281
- }
1282
- }
1283
- const C = Cs.getBuiltInByLabel(p);
1284
- C ? gt = { t: Ft.Error, v: C.getCode() } : (gt = p, d?.(`Unknown formula error '${p}' in cell ${at.cellToString({ colIndex: J, rowIndex: X })}`));
1285
- break;
1286
- case "str":
1287
- case "inlineStr":
1288
- Dt = !0;
1289
- }
1290
- gt !== null && e.addValue(X, J, gt);
1291
- }
1292
- if (ie && (re === "e" && (ie[1] = !0), ke.push(ie), ie = null), Et) if (He === Et) rt = Fe;
1293
- else {
1294
- if (rt = We.get(Et), !rt) {
1295
- const C = [];
1296
- fe = Xe(p, X, J, C), rt = [fe, C, p], We.set(Et, rt);
1297
- }
1298
- He = Et, Fe = rt;
1299
- }
1300
- if (Ut) {
1301
- const C = [];
1302
- fe = Xe(p, X, J, C), rt = [fe, C, p];
1303
- }
1304
- if (rt) return Be.append(X, J, rt), rt = null, Ut = !1, Et = null, void (se = null);
1305
- Dt ? S?.onText(p) : ot || l?.onText(p);
1306
- } };
1307
- })(Q, V, h.createEventHandler(V, () => {
1308
- }, Z), Z, xs, wt);
1309
- })(Y, (V, U = !1) => he(V, R, U) ?? null, fs, Ce, 0, (V) => {
1310
- o && (V = R + ": " + V, o?.(V));
1311
- }, W), _t = ns(R, ce), xt = await (async (V, U = 8388608) => {
1312
- await (async () => {
1313
- if (typeof ReadableStream > "u") if (typeof window > "u") {
1314
- const { ReadableStream: Z } = await import("./CCIJpHSbFPjTEF8S.mjs");
1315
- globalThis.ReadableStream = Z;
1316
- } else console.warn("Browser does not support ReadableStream; consider loading a polyfill.");
1317
- })();
1318
- const te = new TextDecoder("utf-8");
1319
- let _ = 0;
1320
- const G = V instanceof Uint8Array ? V : new Uint8Array(V);
1321
- return new ReadableStream({ pull(Z) {
1322
- if (_ >= G.byteLength) return void Z.close();
1323
- const wt = G.subarray(_, Math.min(_ + U, G.byteLength)), h = te.decode(wt, { stream: _ + U < G.byteLength });
1324
- Z.enqueue(h), _ += wt.length;
1325
- } }).getReader();
1326
- })(_t);
1327
- try {
1328
- await Oe.parseStream(xt, bt, { xmlns: !1 });
1329
- } catch (V) {
1330
- throw console.warn(`Error parsing sheet: '${R}'`, V), new Error(`Error parsing sheet: '${R}'`, { cause: V });
1331
- }
1332
- const qt = ye(R, ut);
1333
- let kt, je = /* @__PURE__ */ new Map();
1334
- if (qt) {
1335
- const V = "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment";
1336
- let U;
1337
- qt.forEach((_, G) => {
1338
- _.type === V && (kt = he(G, R, !1, ut)?.comments, kt && kt.forEach((Z) => {
1339
- je.set(Z.id, Z);
1340
- }));
1341
- });
1342
- const te = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";
1343
- if (qt.forEach((_, G) => {
1344
- _.type === te && (U = he(G, R, !1, ut));
1345
- }), U || kt) {
1346
- const _ = kt ?? [], G = U?.comments;
1347
- if (G) {
1348
- const Z = U?.authors;
1349
- for (let wt = 0; wt < G.length; wt++) {
1350
- const h = G[wt];
1351
- let Q = h.authorId !== void 0 ? Z[h.authorId] : void 0;
1352
- if ((!Q || Q.startsWith("tc=")) && (Q = Qs(Q.substring(3)), je.has(Q))) continue;
1353
- let j = de.get(Q);
1354
- j || (j = Re.get(Q)), j || (j = { id: es.uuidV4(), displayName: Q }, Re.set(j.displayName, j), de.set(j.id, j)), Q = j?.id ?? null;
1355
- const ge = { id: es.uuidV4(), personId: Q, ref: h.ref, done: !1, asNote: !0, content: h.content };
1356
- _.push(ge);
1357
- }
1358
- }
1359
- Y.comments = _;
1360
- }
1361
- }
1362
- };
1363
- Ve.push(tt());
1364
- } else Wt = K ? ns(R, ce, (Y) => {
1365
- const tt = T.add({ buffer: Y });
1366
- return tt.addReference(I), H.add(tt), f.toResourceId(tt);
1367
- }, yt) : Ie(R, ce, g, D, yt);
1368
- return Wt;
1369
- }, yt = { paramMap: W, getRefs: ye, getRef: he, parsedRefs: ht, onWarning: o, addPerson: (P) => null }, ue = [];
1370
- let be = 0;
1371
- u.Strings && (be = parseInt(u.Strings.Unique ?? u.Strings.length ?? 0));
1372
- const gs = u.Strings ?? [];
1373
- for (let P = 0; P < be; P++) ue.push(gs[P]?.t ?? "");
1374
- const Le = /* @__PURE__ */ new Map();
1375
- let Ne = be;
1376
- const fs = (P) => {
1377
- const z = Le.get(P);
1378
- if (z !== void 0) return z;
1379
- const K = Ne;
1380
- return Le.set(P, Ne++), ue.push(P), K;
1381
- }, de = (Qt("richstructure", u, g, D, yt), Qt("richdata", u, g, D, yt), /* @__PURE__ */ new Map()), Re = /* @__PURE__ */ new Map(), $e = Qt("people", u, g, D);
1382
- let Ct = null;
1383
- if ($e.size > 0 && (Ct = $e.entries().next()?.value?.[1]?.persons, Ct)) {
1384
- const P = Ct.length;
1385
- for (let z = 0; z < P; z++) {
1386
- const K = Ct[z];
1387
- de.set(K.id, K), de.set(K.displayName, K);
1388
- }
1389
- }
1390
- const xe = Qt("themes", u, g, D, yt);
1391
- let Me = null;
1392
- if (xe && xe.entries) {
1393
- let P = xe.entries().next();
1394
- P?.value?.[1] && (Me = P.value[1]);
1395
- }
1396
- const ms = new As(Me);
1397
- let pe = Qt("styles", u, g, D, yt).entries().next()?.value[1];
1398
- pe && (pe = JSON.parse(Es(pe)));
1399
- const Ts = Qt("workbooks", u, g, D, yt);
1400
- await Promise.all(Ve);
1401
- const we = { ...Ts.entries().next().value[1], styles: pe, theme: ms.toJSON() };
1402
- ue.length > 0 && (we.strings = ue), Ct && Ct.length > 0 && (we.people = Ct);
1403
- const ys = { ...n, resources: T, json: we }, bs = new Ds(ys);
1404
- return H.forEach((P) => {
1405
- P.deleteReference(I);
1406
- }), f.endPersist(), bs;
1407
- } catch (u) {
1408
- let D = "Unable to parse XLSX.";
1409
- throw u instanceof Os && (D = "Unable to open XLSX. There are too many rows or columns."), new Error(D, { cause: u });
1410
- }
1411
- }, toBufferXLSX: async (i, t) => {
1412
- const s = await import("./DhD48oFrbrnZ6Zg5.mjs"), o = await i.toJSON(!0), n = s.utils.book_new();
1413
- for (let a = 0; a < o.sheets.length; a++) {
1414
- const c = o.sheets[a], m = s.utils.json_to_sheet([{}]);
1415
- s.utils.book_append_sheet(n, m, c.name);
1416
- const v = c.sheet, b = i.getSheetAt(a), x = b.getUsedRange();
1417
- if (x ? (m["!ref"] = x.getA1(), x.forEach((E, y) => {
1418
- const u = { t: "z" }, D = y.getCell().getStyle();
1419
- if (!D.isNormal()) {
1420
- let g = D.getNumberFormat();
1421
- g !== Ht.Type.General && (g === Ht.Type.ShortDate ? g = "m/d/yyyy" : g === Ht.Type.MediumDate ? g = "d-mmm-yy" : g === Ht.Type.LongDate ? g = "[$-x-sysdate]dddd, mmmm dd, yyyy" : g === Ht.Type.ShortTime ? g = "h:mm" : g === Ht.Type.MediumTime ? g = "h:mm AM/PM" : g === Ht.Type.LongTime && (g = "h:mm:ss AM/PM"), u.z = g);
1422
- }
1423
- if (E !== null) switch (y.getType()) {
1424
- case Ft.Number:
1425
- u.t = "n", u.v = E;
1426
- break;
1427
- case Ft.String:
1428
- u.t = "s", u.v = E;
1429
- break;
1430
- case Ft.Boolean:
1431
- u.t = "b", u.v = E;
1432
- break;
1433
- case Ft.Error:
1434
- u.t = "e", u.v = E.toString();
1435
- case Ft.RichData:
1436
- }
1437
- m[y.getA1()] = u;
1438
- })) : m["!ref"] = "A1:A1", v.merges?.length > 0) {
1439
- const E = [];
1440
- m["!merges"] = E;
1441
- for (let y = 0; y < v.merges.length; y++) E.push(s.utils.decode_range(v.merges[y]));
1442
- }
1443
- if (v.cols?.length > 0) {
1444
- const E = [];
1445
- m["!cols"] = E;
1446
- const y = v.cols, u = { width: v.defaultColSize ?? b.getColumnWidthAsFontUnit(b.getColumnHeaders().getDefaultSize()) };
1447
- for (let D = 0; D < y.length; D++) {
1448
- const g = y[D];
1449
- for (let f = E.length; f <= g.min - 1; f++) E.push(u);
1450
- const T = {};
1451
- g.sz !== void 0 && (T.width = g.sz), g.h !== void 0 && (T.hidden = g.h), g.l !== void 0 && (T.level = g.l);
1452
- for (let f = g.min; f <= g.max; f++) E.push(T);
1453
- }
1454
- }
1455
- }
1456
- return s.write(n, { type: "array", bookType: "xlsx" }), s.write(n, { type: "array", bookType: "xlsx" });
1457
- } }, Symbol.toStringTag, { value: "Module" }));
1458
- export {
1459
- ii as a,
1460
- Js as b,
1461
- si as c,
1462
- as as d,
1463
- ri as i,
1464
- oi as p,
1465
- Qs as r,
1466
- ei as t
1467
- };