@sheetxl/studio-vanilla
Version:
SheetXL Studio - Vanilla entry point for integrating SheetXL UI.
1,157 lines • 69.7 kB
JavaScript
import { a0 as Lt, M as Mt, ag as ve, ah as Se, ai as Ce, aj as Ft, ak as wt, t as oe, al as ke, am as Ae, af as De, an as Ee, H as re, w as Pe, ao as Oe, n as Ie } from "./elB9a338Kjeh3S89.js";
/**
* @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.7.27
*
* (C) 2025-present SheetXL Inc. & Michael T. Ford
* License: The license can be found at https://www.sheetxl.com/license.
*/
const he = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", Ve = new RegExp(`^[${he}][-${he}.0-9·̀-ͯ‿-⁀]*$`, "u");
function Te(i) {
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;
}
const ue = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", Ne = new RegExp(`^[${ue}][-${ue}.0-9·̀-ͯ‿-⁀]*$`, "u");
function ye(i) {
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;
}
const nt = function(i) {
return i === 32 || i === 10 || i === 13 || i === 9;
}, Le = function(i) {
return i >= 32 && i <= 55295 || i === 10 || i === 13 || i === 9 || i >= 57344 && i <= 65533 || i >= 65536 && i <= 1114111;
}, Ut = Te, de = function(i) {
return Te(i) || i >= 48 && i <= 57 || i === 45 || i === 46 || i === 183 || i >= 768 && i <= 879 || i >= 8255 && i <= 8256;
}, be = [32, 10, 13, 9], Re = Ve, $e = function(i) {
return i >= 1 && i <= 55295 || i >= 57344 && i <= 65533 || i >= 65536 && i <= 1114111;
}, Me = ye, He = function(i) {
return ye(i) || i === 45 || i === 46 || i >= 48 && i <= 57 || i === 183 || i >= 768 && i <= 879 || i >= 8255 && i <= 8256;
}, je = Ne, ie = "http://www.w3.org/XML/1998/namespace", _t = "http://www.w3.org/2000/xmlns/", Fe = { __proto__: null, xml: ie, xmlns: _t }, Xe = { __proto__: null, amp: "&", gt: ">", lt: "<", quot: '"', apos: "'" }, N = -1, bt = -2, et = 13, Rt = 33, mt = 10, Pt = 60, Bt = 61, _ = 62, z = 63, Wt = 93, se = (i) => i === 34 || i === 39, xe = [34, 39], Be = [...xe, 91, _], We = [...xe, Pt, Wt], _e = [Bt, z, ...be], qe = [...be, _, 38, Pt];
function ne(i, t, s) {
switch (t) {
case "xml":
s !== ie && i.fail(`xml prefix must be bound to ${ie}.`);
break;
case "xmlns":
s !== _t && i.fail(`xmlns prefix must be bound to ${_t}.`);
}
switch (s) {
case _t:
i.fail(t === "" ? `the default namespace may not be set to ${s}.` : `may not assign a prefix (even "xmlns") to the URI ${_t}.`);
break;
case ie:
switch (t) {
case "xml":
break;
case "":
i.fail(`the default namespace may not be set to ${s}.`);
break;
default:
i.fail("may not assign the xml namespace to another prefix.");
}
}
}
const ze = (i) => je.test(i), Ge = (i) => Re.test(i), pe = { 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" };
class Ue {
constructor(t) {
this.i = 0, this.prevI = 0, this.opt = t ?? {}, this.fragmentOpt = !!this.opt.fragment;
const s = this.xmlnsOpt = !!this.opt.xmlns;
if (this.trackPosition = this.opt.position !== !1, this.fileName = this.opt.fileName, s) {
this.nameStartCheck = Me, this.nameCheck = He, this.isName = ze, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = { __proto__: null, ...Fe };
const o = this.opt.additionalNamespaces;
o != null && ((function(a, n) {
for (const h of Object.keys(n)) ne(a, h, n[h]);
})(this, o), Object.assign(this.ns, o));
} else this.nameStartCheck = Ut, this.nameCheck = de, this.isName = Ge, this.processAttribs = this.processAttribsPlain, this.pushAttrib = this.pushAttribPlain;
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();
}
get closed() {
return this._closed;
}
_init() {
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 = [];
const { fragmentOpt: t } = this;
this.state = t ? et : 0, this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = t, this.xmlDeclPossible = !t, this.xmlDeclExpects = ["version"], this.entityReturnState = void 0;
let { defaultXMLVersion: s } = this.opt;
if (s === void 0) {
if (this.opt.forceXMLVersion === !0) throw new Error("forceXMLVersion set but defaultXMLVersion is not set");
s = "1.0";
}
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(Xe), this.readyHandler?.();
}
get position() {
return this.chunkPosition + this.i;
}
get columnIndex() {
return this.position - this.positionAtNewLine;
}
on(t, s) {
this[pe[t]] = s;
}
off(t) {
this[pe[t]] = void 0;
}
makeError(t) {
let s = this.fileName ?? "";
return this.trackPosition && (s.length > 0 && (s += ":"), s += `${this.line}:${this.column}`), s.length > 0 && (s += ": "), new Error(s + t);
}
fail(t) {
const s = this.makeError(t), o = this.errorHandler;
if (o === void 0) throw s;
return o(s), this;
}
write(t) {
if (this.closed) return this.fail("cannot write after close.");
let s = !1;
t === null ? (s = !0, t = "") : typeof t == "object" && (t = t.toString()), this.carriedFromPrevious !== void 0 && (t = `${this.carriedFromPrevious}${t}`, this.carriedFromPrevious = void 0);
let o = t.length;
const a = t.charCodeAt(o - 1);
!s && (a === 13 || a >= 55296 && a <= 56319) && (this.carriedFromPrevious = t[o - 1], o--, t = t.slice(0, o));
const { stateTable: n } = this;
for (this.chunk = t, this.i = 0; this.i < o; ) n[this.state].call(this);
return this.chunkPosition += o, s ? this.end() : this;
}
close() {
return this.write(null);
}
getCode10() {
const t = this.chunk, s = this.i;
if (this.prevI = s, this.i++, s >= t.length) return N;
const o = t.charCodeAt(s);
if (this.column++, o < 55296) {
if (o >= 32 || o === 9) return o;
switch (o) {
case mt:
return this.line++, this.column = 0, this.positionAtNewLine = this.position, mt;
case 13:
return t.charCodeAt(s + 1) === mt && (this.i = s + 2), this.line++, this.column = 0, this.positionAtNewLine = this.position, bt;
default:
return this.fail("disallowed character."), o;
}
}
if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o;
const a = 65536 + 1024 * (o - 55296) + (t.charCodeAt(s + 1) - 56320);
return this.i = s + 2, a > 1114111 && this.fail("disallowed character."), a;
}
getCode11() {
const { chunk: t, i: s } = this;
if (this.prevI = s, this.i = s + 1, s >= t.length) return N;
const o = t.charCodeAt(s);
if (this.column++, o < 55296) {
if (o > 31 && o < 127 || o > 159 && o !== 8232 || o === 9) return o;
switch (o) {
case mt:
return this.line++, this.column = 0, this.positionAtNewLine = this.position, mt;
case 13: {
const n = t.charCodeAt(s + 1);
n !== mt && n !== 133 || (this.i = s + 2);
}
case 133:
case 8232:
return this.line++, this.column = 0, this.positionAtNewLine = this.position, bt;
default:
return this.fail("disallowed character."), o;
}
}
if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o;
const a = 65536 + 1024 * (o - 55296) + (t.charCodeAt(s + 1) - 56320);
return this.i = s + 2, a > 1114111 && this.fail("disallowed character."), a;
}
getCodeNorm() {
const t = this.getCode();
return t === bt ? mt : t;
}
unGet() {
this.i = this.prevI, this.column--;
}
captureTo(t) {
let { i: s } = this;
const { chunk: o } = this;
for (; ; ) {
const a = this.getCode(), n = a === bt, h = n ? mt : a;
if (h === N || t.includes(h)) return this.text += o.slice(s, this.prevI), h;
n && (this.text += `${o.slice(s, this.prevI)}
`, s = this.i);
}
}
captureToChar(t) {
let { i: s } = this;
const { chunk: o } = this;
for (; ; ) {
let a = this.getCode();
switch (a) {
case bt:
this.text += `${o.slice(s, this.prevI)}
`, s = this.i, a = mt;
break;
case N:
return this.text += o.slice(s), !1;
}
if (a === t) return this.text += o.slice(s, this.prevI), !0;
}
}
captureNameChars() {
const { chunk: t, i: s } = this;
for (; ; ) {
const o = this.getCode();
if (o === N) return this.name += t.slice(s), N;
if (!de(o)) return this.name += t.slice(s, this.prevI), o === bt ? mt : o;
}
}
skipSpaces() {
for (; ; ) {
const t = this.getCodeNorm();
if (t === N || !nt(t)) return t;
}
}
setXMLVersion(t) {
this.currentXMLVersion = t, t === "1.0" ? (this.isChar = Le, this.getCode = this.getCode10) : (this.isChar = $e, this.getCode = this.getCode11);
}
sBegin() {
this.chunk.charCodeAt(0) === 65279 && (this.i++, this.column++), this.state = 1;
}
sBeginWhitespace() {
const t = this.i, s = this.skipSpaces();
switch (this.prevI !== t && (this.xmlDeclPossible = !1), s) {
case Pt:
if (this.state = 15, this.text.length !== 0) throw new Error("no-empty text at start");
break;
case N:
break;
default:
this.unGet(), this.state = et, this.xmlDeclPossible = !1;
}
}
sDoctype() {
const t = this.captureTo(Be);
switch (t) {
case _:
this.doctypeHandler?.(this.text), this.text = "", this.state = et, this.doctype = !0;
break;
case N:
break;
default:
this.text += String.fromCodePoint(t), t === 91 ? this.state = 4 : se(t) && (this.state = 3, this.q = t);
}
}
sDoctypeQuote() {
const t = this.q;
this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.q = null, this.state = 2);
}
sDTD() {
const t = this.captureTo(We);
t !== N && (this.text += String.fromCodePoint(t), t === Wt ? this.state = 2 : t === Pt ? this.state = 6 : se(t) && (this.state = 5, this.q = t));
}
sDTDQuoted() {
const t = this.q;
this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.state = 4, this.q = null);
}
sDTDOpenWaka() {
const t = this.getCodeNorm();
switch (this.text += String.fromCodePoint(t), t) {
case 33:
this.state = 7, this.openWakaBang = "";
break;
case z:
this.state = 11;
break;
default:
this.state = 4;
}
}
sDTDOpenWakaBang() {
const t = String.fromCodePoint(this.getCodeNorm()), s = this.openWakaBang += t;
this.text += t, s !== "-" && (this.state = s === "--" ? 8 : 4, this.openWakaBang = "");
}
sDTDComment() {
this.captureToChar(45) && (this.text += "-", this.state = 9);
}
sDTDCommentEnding() {
const t = this.getCodeNorm();
this.text += String.fromCodePoint(t), this.state = t === 45 ? 10 : 8;
}
sDTDCommentEnded() {
const t = this.getCodeNorm();
this.text += String.fromCodePoint(t), t === _ ? this.state = 4 : (this.fail("malformed comment."), this.state = 8);
}
sDTDPI() {
this.captureToChar(z) && (this.text += "?", this.state = 12);
}
sDTDPIEnding() {
const t = this.getCodeNorm();
this.text += String.fromCodePoint(t), t === _ && (this.state = 4);
}
sText() {
this.tags.length !== 0 ? this.handleTextInRoot() : this.handleTextOutsideRoot();
}
sEntity() {
let { i: t } = this;
const { chunk: s } = this;
t: for (; ; ) switch (this.getCode()) {
case bt:
this.entity += `${s.slice(t, this.prevI)}
`, t = this.i;
break;
case 59: {
const { entityReturnState: o } = this, a = this.entity + s.slice(t, this.prevI);
let n;
this.state = o, a === "" ? (this.fail("empty entity name."), n = "&;") : (n = this.parseEntity(a), this.entity = ""), o === et && this.textHandler === void 0 || (this.text += n);
break t;
}
case N:
this.entity += s.slice(t);
break t;
}
}
sOpenWaka() {
const t = this.getCode();
if (Ut(t)) this.state = 34, this.unGet(), this.xmlDeclPossible = !1;
else switch (t) {
case 47:
this.state = 43, this.xmlDeclPossible = !1;
break;
case 33:
this.state = 16, this.openWakaBang = "", this.xmlDeclPossible = !1;
break;
case z:
this.state = 23;
break;
default:
this.fail("disallowed character in tag name"), this.state = et, this.xmlDeclPossible = !1;
}
}
sOpenWakaBang() {
switch (this.openWakaBang += String.fromCodePoint(this.getCodeNorm()), this.openWakaBang) {
case "[CDATA[":
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 = "";
break;
case "--":
this.state = 17, this.openWakaBang = "";
break;
case "DOCTYPE":
this.state = 2, (this.doctype || this.sawRoot) && this.fail("inappropriately located doctype declaration."), this.openWakaBang = "";
break;
default:
this.openWakaBang.length >= 7 && this.fail("incorrect syntax.");
}
}
sComment() {
this.captureToChar(45) && (this.state = 18);
}
sCommentEnding() {
const t = this.getCodeNorm();
t === 45 ? (this.state = 19, this.commentHandler?.(this.text), this.text = "") : (this.text += `-${String.fromCodePoint(t)}`, this.state = 17);
}
sCommentEnded() {
const t = this.getCodeNorm();
t !== _ ? (this.fail("malformed comment."), this.text += `--${String.fromCodePoint(t)}`, this.state = 17) : this.state = et;
}
sCData() {
this.captureToChar(Wt) && (this.state = 21);
}
sCDataEnding() {
const t = this.getCodeNorm();
t === Wt ? this.state = 22 : (this.text += `]${String.fromCodePoint(t)}`, this.state = 20);
}
sCDataEnding2() {
const t = this.getCodeNorm();
switch (t) {
case _:
this.cdataHandler?.(this.text), this.text = "", this.state = et;
break;
case Wt:
this.text += "]";
break;
default:
this.text += `]]${String.fromCodePoint(t)}`, this.state = 20;
}
}
sPIFirstChar() {
const t = this.getCodeNorm();
this.nameStartCheck(t) ? (this.piTarget += String.fromCodePoint(t), this.state = 24) : t === z || nt(t) ? (this.fail("processing instruction without a target."), this.state = t === z ? 26 : 25) : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(t), this.state = 24);
}
sPIRest() {
const { chunk: t, i: s } = this;
for (; ; ) {
const o = this.getCodeNorm();
if (o === N) return void (this.piTarget += t.slice(s));
if (!this.nameCheck(o)) {
this.piTarget += t.slice(s, this.prevI);
const a = o === z;
a || nt(o) ? this.piTarget === "xml" ? (this.xmlDeclPossible || this.fail("an XML declaration must be at the start of the document."), this.state = a ? Rt : 27) : this.state = a ? 26 : 25 : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(o));
break;
}
}
}
sPIBody() {
if (this.text.length === 0) {
const t = this.getCodeNorm();
t === z ? this.state = 26 : nt(t) || (this.text = String.fromCodePoint(t));
} else this.captureToChar(z) && (this.state = 26);
}
sPIEnding() {
const t = this.getCodeNorm();
if (t === _) {
const { piTarget: s } = this;
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 = et;
} else t === z ? this.text += "?" : (this.text += `?${String.fromCodePoint(t)}`, this.state = 25);
this.xmlDeclPossible = !1;
}
sXMLDeclNameStart() {
const t = this.skipSpaces();
t !== z ? t !== N && (this.state = 28, this.name = String.fromCodePoint(t)) : this.state = Rt;
}
sXMLDeclName() {
const t = this.captureTo(_e);
if (t === z) return this.state = Rt, this.name += this.text, this.text = "", void this.fail("XML declaration is incomplete.");
if (nt(t) || t === Bt) {
if (this.name += this.text, this.text = "", !this.xmlDeclExpects.includes(this.name)) switch (this.name.length) {
case 0:
this.fail("did not expect any more name/value pairs.");
break;
case 1:
this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);
break;
default:
this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`);
}
this.state = t === Bt ? 30 : 29;
}
}
sXMLDeclEq() {
const t = this.getCodeNorm();
if (t === z) return this.state = Rt, void this.fail("XML declaration is incomplete.");
nt(t) || (t !== Bt && this.fail("value required."), this.state = 30);
}
sXMLDeclValueStart() {
const t = this.getCodeNorm();
if (t === z) return this.state = Rt, void this.fail("XML declaration is incomplete.");
nt(t) || (se(t) ? this.q = t : (this.fail("value must be quoted."), this.q = 32), this.state = 31);
}
sXMLDeclValue() {
const t = this.captureTo([this.q, z]);
if (t === z) return this.state = Rt, this.text = "", void this.fail("XML declaration is incomplete.");
if (t === N) return;
const s = this.text;
switch (this.text = "", this.name) {
case "version": {
this.xmlDeclExpects = ["encoding", "standalone"];
const o = s;
this.xmlDecl.version = o, /^1\.[0-9]+$/.test(o) ? this.opt.forceXMLVersion || this.setXMLVersion(o) : this.fail("version number must match /^1\\.[0-9]+$/.");
break;
}
case "encoding":
/^[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;
break;
case "standalone":
s !== "yes" && s !== "no" && this.fail('standalone value must match "yes" or "no".'), this.xmlDeclExpects = [], this.xmlDecl.standalone = s;
}
this.name = "", this.state = 32;
}
sXMLDeclSeparator() {
const t = this.getCodeNorm();
t !== z ? (nt(t) || (this.fail("whitespace required."), this.unGet()), this.state = 27) : this.state = Rt;
}
sXMLDeclEnding() {
this.getCodeNorm() === _ ? (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 = et) : this.fail("The character ? is disallowed anywhere in XML declarations."), this.xmlDeclPossible = !1;
}
sOpenTag() {
const t = this.captureNameChars();
if (t === N) return;
const s = this.tag = { name: this.name, attributes: /* @__PURE__ */ Object.create(null) };
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) {
case _:
this.openTag();
break;
case 47:
this.state = 35;
break;
default:
nt(t) || this.fail("disallowed character in tag name."), this.state = 36;
}
}
sOpenTagSlash() {
this.getCode() === _ ? this.openSelfClosingTag() : (this.fail("forward-slash in opening tag not followed by >."), this.state = 36);
}
sAttrib() {
const t = this.skipSpaces();
t !== N && (Ut(t) ? (this.unGet(), this.state = 37) : t === _ ? this.openTag() : t === 47 ? this.state = 35 : this.fail("disallowed character in attribute name."));
}
sAttribName() {
const t = this.captureNameChars();
t === Bt ? this.state = 39 : nt(t) ? this.state = 38 : t === _ ? (this.fail("attribute without value."), this.pushAttrib(this.name, this.name), this.name = this.text = "", this.openTag()) : t !== N && this.fail("disallowed character in attribute name.");
}
sAttribNameSawWhite() {
const t = this.skipSpaces();
switch (t) {
case N:
return;
case Bt:
this.state = 39;
break;
default:
this.fail("attribute without value."), this.text = "", this.name = "", t === _ ? this.openTag() : Ut(t) ? (this.unGet(), this.state = 37) : (this.fail("disallowed character in attribute name."), this.state = 36);
}
}
sAttribValue() {
const t = this.getCodeNorm();
se(t) ? (this.q = t, this.state = 40) : nt(t) || (this.fail("unquoted attribute value."), this.state = 42, this.unGet());
}
sAttribValueQuoted() {
const { q: t, chunk: s } = this;
let { i: o } = this;
for (; ; ) switch (this.getCode()) {
case t:
return this.pushAttrib(this.name, this.text + s.slice(o, this.prevI)), this.name = this.text = "", this.q = null, void (this.state = 41);
case 38:
return this.text += s.slice(o, this.prevI), this.state = 14, void (this.entityReturnState = 40);
case mt:
case bt:
case 9:
this.text += `${s.slice(o, this.prevI)} `, o = this.i;
break;
case Pt:
return this.text += s.slice(o, this.prevI), void this.fail("disallowed character.");
case N:
return void (this.text += s.slice(o));
}
}
sAttribValueClosed() {
const t = this.getCodeNorm();
nt(t) ? this.state = 36 : t === _ ? this.openTag() : t === 47 ? this.state = 35 : Ut(t) ? (this.fail("no whitespace between attributes."), this.unGet(), this.state = 37) : this.fail("disallowed character in attribute name.");
}
sAttribValueUnquoted() {
const t = this.captureTo(qe);
switch (t) {
case 38:
this.state = 14, this.entityReturnState = 42;
break;
case Pt:
this.fail("disallowed character.");
break;
case N:
break;
default:
this.text.includes("]]>") && this.fail('the string "]]>" is disallowed in char data.'), this.pushAttrib(this.name, this.text), this.name = this.text = "", t === _ ? this.openTag() : this.state = 36;
}
}
sCloseTag() {
const t = this.captureNameChars();
t === _ ? this.closeTag() : nt(t) ? this.state = 44 : t !== N && this.fail("disallowed character in closing tag.");
}
sCloseTagSawWhite() {
switch (this.skipSpaces()) {
case _:
this.closeTag();
break;
case N:
break;
default:
this.fail("disallowed character in closing tag.");
}
}
handleTextInRoot() {
let { i: t, forbiddenState: s } = this;
const { chunk: o, textHandler: a } = this;
t: for (; ; ) switch (this.getCode()) {
case Pt:
if (this.state = 15, a !== void 0) {
const { text: n } = this, h = o.slice(t, this.prevI);
n.length !== 0 ? (a(n + h), this.text = "") : h.length !== 0 && a(h);
}
s = 0;
break t;
case 38:
this.state = 14, this.entityReturnState = et, a !== void 0 && (this.text += o.slice(t, this.prevI)), s = 0;
break t;
case Wt:
switch (s) {
case 0:
s = 1;
break;
case 1:
s = 2;
break;
case 2:
break;
default:
throw new Error("impossible state");
}
break;
case _:
s === 2 && this.fail('the string "]]>" is disallowed in char data.'), s = 0;
break;
case bt:
a !== void 0 && (this.text += `${o.slice(t, this.prevI)}
`), t = this.i, s = 0;
break;
case N:
a !== void 0 && (this.text += o.slice(t));
break t;
default:
s = 0;
}
this.forbiddenState = s;
}
handleTextOutsideRoot() {
let { i: t } = this;
const { chunk: s, textHandler: o } = this;
let a = !1;
t: for (; ; ) {
const n = this.getCode();
switch (n) {
case Pt:
if (this.state = 15, o !== void 0) {
const { text: h } = this, p = s.slice(t, this.prevI);
h.length !== 0 ? (o(h + p), this.text = "") : p.length !== 0 && o(p);
}
break t;
case 38:
this.state = 14, this.entityReturnState = et, o !== void 0 && (this.text += s.slice(t, this.prevI)), a = !0;
break t;
case bt:
o !== void 0 && (this.text += `${s.slice(t, this.prevI)}
`), t = this.i;
break;
case N:
o !== void 0 && (this.text += s.slice(t));
break t;
default:
nt(n) || (a = !0);
}
}
a && (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));
}
pushAttribNS(t, s) {
const { prefix: o, local: a } = this.qName(t), n = { name: t, prefix: o, local: a, value: s };
if (this.attribList.push(n), this.attributeHandler?.(n), o === "xmlns") {
const h = s.trim();
this.currentXMLVersion === "1.0" && h === "" && this.fail("invalid attempt to undefine prefix in XML 1.0"), this.topNS[a] = h, ne(this, a, h);
} else if (t === "xmlns") {
const h = s.trim();
this.topNS[""] = h, ne(this, "", h);
}
}
pushAttribPlain(t, s) {
const o = { name: t, value: s };
this.attribList.push(o), this.attributeHandler?.(o);
}
end() {
this.sawRoot || this.fail("document must contain a root element.");
const { tags: t } = this;
for (; t.length > 0; ) {
const o = t.pop();
this.fail(`unclosed tag: ${o.name}`);
}
this.state !== 0 && this.state !== et && this.fail("unexpected end.");
const { text: s } = this;
return s.length !== 0 && (this.textHandler?.(s), this.text = ""), this._closed = !0, this.endHandler?.(), this._init(), this;
}
resolve(t) {
let s = this.topNS[t];
if (s !== void 0) return s;
const { tags: o } = this;
for (let a = o.length - 1; a >= 0; a--) if (s = o[a].ns[t], s !== void 0) return s;
return s = this.ns[t], s !== void 0 ? s : this.opt.resolvePrefix?.(t);
}
qName(t) {
const s = t.indexOf(":");
if (s === -1) return { prefix: "", local: t };
const o = t.slice(s + 1), a = t.slice(0, s);
return (a === "" || o === "" || o.includes(":")) && this.fail(`malformed name: ${t}.`), { prefix: a, local: o };
}
processAttribsNS() {
const { attribList: t } = this, s = this.tag;
{
const { prefix: n, local: h } = this.qName(s.name);
s.prefix = n, s.local = h;
const p = s.uri = this.resolve(n) ?? "";
n !== "" && (n === "xmlns" && this.fail('tags may not have "xmlns" as prefix.'), p === "" && (this.fail(`unbound namespace prefix: ${JSON.stringify(n)}.`), s.uri = n));
}
if (t.length === 0) return;
const { attributes: o } = s, a = /* @__PURE__ */ new Set();
for (const n of t) {
const { name: h, prefix: p, local: A } = n;
let x, w;
p === "" ? (x = h === "xmlns" ? _t : "", w = h) : (x = this.resolve(p), x === void 0 && (this.fail(`unbound namespace prefix: ${JSON.stringify(p)}.`), x = p), w = `{${x}}${A}`), a.has(w) && this.fail(`duplicate attribute: ${w}.`), a.add(w), n.uri = x, o[h] = n;
}
this.attribList = [];
}
processAttribsPlain() {
const { attribList: t } = this, s = this.tag.attributes;
for (const { name: o, value: a } of t) s[o] !== void 0 && this.fail(`duplicate attribute: ${o}.`), s[o] = a;
this.attribList = [];
}
openTag() {
this.processAttribs();
const { tags: t } = this, s = this.tag;
s.isSelfClosing = !1, this.openTagHandler?.(s), t.push(s), this.state = et, this.name = "";
}
openSelfClosingTag() {
this.processAttribs();
const { tags: t } = this, s = this.tag;
s.isSelfClosing = !0, this.openTagHandler?.(s), this.closeTagHandler?.(s), (this.tag = t[t.length - 1] ?? null) === null && (this.closedRoot = !0), this.state = et, this.name = "";
}
closeTag() {
const { tags: t, name: s } = this;
if (this.state = et, this.name = "", s === "") return this.fail("weird empty close tag."), void (this.text += "</>");
const o = this.closeTagHandler;
let a = t.length;
for (; a-- > 0; ) {
const n = this.tag = t.pop();
if (this.topNS = n.ns, o?.(n), n.name === s) break;
this.fail(`unexpected close tag: ${s}.`);
}
a === 0 ? this.closedRoot = !0 : a < 0 && (this.fail(`unmatched closing tag: ${s}.`), this.text += `</${s}>`);
}
parseEntity(t) {
if (t[0] !== "#") {
const o = this.ENTITIES[t];
return o !== void 0 ? o : (this.fail(this.isName(t) ? "undefined entity." : "disallowed character in entity name."), `&${t};`);
}
let s = NaN;
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};`);
}
}
var ae, kt;
(kt = ae || (ae = {})).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" }, kt.parseStream = async (i, t, s) => {
const o = new Ue({ position: !1, ...s });
let a;
if (t.onOpenTagStart && o.on(kt.Events.OpenTagStart, t.onOpenTagStart), t.onOpenTag && o.on(kt.Events.OpenTag, t.onOpenTag), t.onCloseTag && o.on(kt.Events.CloseTag, t.onCloseTag), t.onAttribute && o.on(kt.Events.Attribute, t.onAttribute), t.onText && o.on(kt.Events.Text, t.onText), t.onError && o.on(kt.Events.Error, t.onError), t.onEnd) {
t.onEnd;
const n = () => {
a = t.onEnd();
};
o.on(kt.Events.End, n);
}
for (; ; ) {
const { value: n, done: h } = await i.read();
if (h) break;
o.write(n);
}
return o.close(), a;
};
const E = (i) => i === !0 || i === "1" || i === "on" || i === "true" || i !== !1 && i !== "0" && i !== "off" && i !== "false" && null, V = (i) => {
const t = parseInt(i);
return isNaN(t) ? null : t;
}, xt = (i) => {
const t = parseFloat(i);
return isNaN(t) ? null : t;
}, P = null;
class Ze {
constructor() {
this._registeredVisitors = /* @__PURE__ */ new Map();
}
registerVisitor(t) {
this._registeredVisitors.set(t.from, t);
}
createEventHandler(t, s, o) {
const a = this._registeredVisitors, n = [];
let h = null, p = null, A = null, x = null;
const w = [], v = { key: null, source: t };
let b = null, O = !1;
const L = (l, d) => {
let m = A.attributes[l];
if (d) {
if (Array.isArray(d)) {
for (let H = 0; H < d.length; H++) if (m == null || (m = d[H](m), m == null)) return;
} else if (m == null || (m = d(m), m == null)) return;
}
return m;
}, D = { getSource: () => b.source, setSource: (l) => {
b.source = l;
}, setKey: (l) => {
b.key = l;
}, getFrom: () => A, getAttribute: (l, d) => L(l, d) ?? null, hasAttribute: (l) => D.getAttribute(l) !== null, getParent: () => w[w.length - 2].source, getPath: () => {
const l = [];
for (let d = 0; d < n.length; d++) l.push(n[d].local);
return l.join("\\");
}, parseAttribute: L, copyToObject: (l, d, m, H) => {
const G = L(H ?? d, m);
G !== void 0 && (l[d] = G);
}, copyTo: (l, d, m) => {
const H = L(m ?? l, d);
H !== void 0 && (b.source[l] = H);
}, warn: (l) => {
o ? o?.(l) : console.warn(l);
} };
return { onOpenTag: (l) => {
let d = l.name;
const m = d.indexOf(":");
m !== -1 && (d = d.slice(m + 1));
const H = a.get(d);
if (h = { local: d, visitor: H, tag: l, destination: null }, O) return n.push(h), p = d, void (A = l);
x = h?.visitor ?? null, H && (b = n.length === 0 ? v : x?.to !== null ? { key: null, source: {} } : null, h.destination = b, b && w.push(b)), n.push(h), p = d, A = l, O = x?.to === null, x?.openTag?.(D);
}, onCloseTag: (l) => {
let d = l.name;
const m = d.indexOf(":");
if (m !== -1 && (d = d.slice(m + 1)), d !== p) throw new Error(`mismatch open/close tag: '${d}'/'${p}'`);
O || x?.closeTag?.(D);
const H = n.pop() ?? null;
h = n[n.length - 1] ?? null;
const G = H?.destination;
if (G) {
w.pop(), b = w[w.length - 1] ?? v;
const at = H.visitor;
at && at.to && G.source !== void 0 && (Array.isArray(at.to) ? b.source.push ? b.source.push(G.source) : o?.(`Unable to parse array for ${at.from} at ${D.getPath()}`) : G.key ? b.source[G.key] = G.source : typeof at.to == "string" && (b.source[at.to] = G.source));
}
p = h?.local ?? null, A = h?.tag ?? null, x = h?.visitor ?? null, O = !h?.destination;
}, onText: (l) => {
x?.text?.(l, D);
}, onEnd: s };
}
}
const ge = (i, t, s, o = null) => {
if (!i) return null;
let a = i;
a.startsWith("/") && (a = a.substring(1));
let n = o?.parsedRefs?.get(i);
if (n !== void 0) return n;
const h = t(a);
if (!h) return null;
let p = h.content;
try {
s && (p = s(p));
} catch (A) {
console.warn(A);
}
return o?.parsedRefs?.set(i, p), p;
}, le = (i, t, s, o, a = null) => {
if (!i) return null;
let n = i;
n.startsWith("/") && (n = n.substring(1));
let h = a?.parsedRefs?.get(i);
if (h !== void 0) return h;
const p = t(n);
if (!p) return null;
const A = p.content;
try {
const x = new TextDecoder().decode(A), w = s.parseFromString(x, "text/xml"), v = o.convert(w, i, a);
return a?.parsedRefs?.set(i, v), v;
} catch (x) {
console.warn(x);
}
return null;
}, Xt = (i, t, s, o, a = null) => {
const n = /* @__PURE__ */ new Map();
let h = t.Directory[i];
const p = h ? h.length : 0;
for (let A = 0; A < p; A++) {
const x = h[A];
if (!x) continue;
let w = x;
w.startsWith("/") && (w = w.substring(1));
const v = le(w, (b) => t.files[b], s, o, a);
n.set(w, v);
}
return n;
}, Qe = ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "hlink", "folHlink"], fe = (i, t = "dk1") => {
let s;
const o = i("auto");
o === void 0 || o !== "1" && o !== "true" || (s = t);
const a = i("indexed");
a && (s = `index${a}`);
const n = i("rgb");
n && (s = n.toLowerCase(), n.length !== 8 || n.startsWith("FF") || (s = "FF" + n.substring(2, n.length)));
const h = i("theme");
h && (s = Qe[h]);
let p = i("tint");
if (p && (s += ` ${Ee.AdjustmentType.ETint} ${parseFloat(p)}`), s) return s;
}, Je = (i) => i && i.replace(/^\{([\s\S]+)\}$/, "$1"), ss = (i) => i ? oe.roundAccurately(parseFloat(i) / 12700, 4) : null, is = (i) => i ? oe.roundAccurately(parseFloat(i) / 9525, 1) : null, os = (i) => parseFloat(i) / 1e3, rs = (i) => parseFloat(i) / 6e4, Ke = (i) => i === "true" || i === "1";
class $t {
static {
this.Collapsed = 1;
}
static {
this.CustomFormat = 2;
}
static {
this.CustomHeight = 4;
}
static {
this.Hidden = 8;
}
static {
this.Ht = 16;
}
static {
this.OutlineLevel = 32;
}
static {
this.Ph = 64;
}
static {
this.R = 128;
}
static {
this.S = 256;
}
static {
this.Spans = 512;
}
static {
this.ThickBot = 1024;
}
static {
this.ThickTop = 2048;
}
}
const Ye = (i, t, s) => {
if (i[0].value[0] === i[1].value[0]) return t;
}, me = { colStart: 0, colEnd: 0, rowStart: 0, rowEnd: 0 }, ts = (i, t, s, o, a, n, h) => {
let p = !1, A = !1, x = [], w = !1, v = null, b = null, O = null, L = null, D = null, l = null;
const d = h?.get("richData") ?? [], m = wt.normalizeA1ToR1C1, H = re.createConflatingRanges(), G = /* @__PURE__ */ new Map(), at = [];
let At = null;
const Ht = re.createConflatingRanges();
let Dt, Tt = !1, X = -1, U = -1, st = null, it = null;
const Et = [];
let Ot = null, Zt = -2, dt = 0, vt = "", St = "", pt = "", yt = "", Ct = "", J = "", gt = "", qt = "", Qt = "", It = "", Jt = "", jt = "", Kt = "", Yt = "", T = !0, R = null, Z = !1, K = !1, Y = null, I = 0;
return { ...s, onEnd: () => {
Et.length > 0 && (t.rows = Et);
let g = H.done(Ye);
const C = g.length;
if (C > 0) {
const y = new Array(C);
for (let k = 0; k < C; k++) {
const q = g[k], Q = wt.rangeToString(q), ot = q.value[1], lt = wt.resolveRelativeToA1(ot, q.rowStart, q.colStart);
y[k] = [Q, lt];
}
t.formulas = y;
}
const tt = Ht.done(!0), S = tt.length;
if (S > 0) {
const y = new Array(S);
for (let k = 0; k < S; k++) {
const q = tt[k], Q = wt.rangeToString(q);
y[k] = Q;
}
t.volatile = y;
}
if (at.length > 0 && (t.dynamicArray = [...at]), x.length > 0) {
x.sort(re.createRangeComparator(Pe.Orientation.Column));
const y = [];
let k = null, q = -1, Q = -1, ot = -1, lt = -1, ft = null;
const M = x.length;
M > 0 && (k = x[0], q = k.colStart, Q = k.colEnd, ot = k.rowEnd, lt = k.value, y.push(k));
for (let ct = 1; ct < M; ct++) ft = x[ct], lt !== ft.value || q !== ft.colStart || Q !== ft.colEnd || ot + 1 !== ft.rowEnd ? (y.push(ft), k = ft, q = k.colStart, Q = k.colEnd, ot = k.rowEnd, lt = k.value) : (ot = ft.rowEnd, k.rowEnd = ot);
let j = [];
for (let ct = 0; ct < y.length; ct++) {
const B = y[ct];
j.push({ r: { colStart: B.colStart, colEnd: B.colEnd, rowStart: B.rowStart, rowEnd: B.rowEnd }, v: B.value });
}
t.directStyles = j;
}
const $ = i.build();
if ($) {
const y = $.tuples;
t.data = y;
}
s?.onEnd?.();
}, onOpenTag: (g) => {
let C = g.name;
const tt = C.indexOf(":");
if (tt !== -1 && (C = C.slice(tt + 1)), I++, I % 196608 == 0 && a(I), Dt) {
const S = g.attributes;
switch (C) {
case "v":
A = !0;
break;
case "f":
switch (S.t ?? null) {
case null:
case "normal":
w = !0;
break;
case "shared":
const $ = S.si;
b = S.ref, v = $;
break;
case "array":
w = !0, b = S.ref, At = [b, !1];
break;
case "datatable":
w = !0, b = S.ref, w = !0;
}
S.ca !== void 0 && Ht.append(X, U);
break;
case "is":
return void (Tt = !0);
}
return void (Tt && n?.onOpenTag(g));
}
if (p) {
if (C === "c") {
Dt = g;
const S = g.attributes.r;
U = wt.fastStringToCol(S);
const $ = g.attributes.t;
$ === void 0 ? it = null : (it = $, it === "str" && (Tt = !0));
let y = g.attributes.s;
y === void 0 && (Y !== null || K) && (y = "0"), y !== void 0 && (y = parseInt(y), R && R.value === y && R.colEnd + 1 === U ? R.colEnd = U : (R = { colStart: U, rowStart: X, colEnd: U, rowEnd: X, value: y }, x.push(R)));
}
} else {
if (C === "row") {
p = !0;
const S = g.attributes.r;
if (X = parseInt(S) - 1, dt = 0, St = g.attributes.customHeight, St !== void 0 && (dt |= $t.CustomHeight), St !== Qt && (T = !0, Qt = St), vt = g.attributes.ht, vt !== void 0 && (dt |= $t.Ht), vt !== qt && (T = !0, qt = vt), pt = g.attributes.hidden, pt !== void 0 && (dt |= $t.Hidden), pt !== It && (T = !0, It = pt), Ct = g.attributes.s, Ct !== void 0 && (dt |= $t.S), Ct !== jt && (T = !0, jt = Ct), yt = g.attributes.customFormat, yt !== void 0 && (dt |= $t.CustomFormat), yt !== Jt && (T = !0, Jt = yt), J = g.attributes.outlineLevel, J !== void 0 && (dt |= $t.OutlineLevel), J !== Kt && (T = !0, Kt = J), gt = g.attributes.collapsed, gt !== void 0 && (dt |= $t.Collapsed), gt !== Yt && (T = !0, Yt = gt), dt !== 0) if (Zt + 1 !== X || T) {
const $ = St !== void 0 && (St === "1" || St === "true");
Y = yt === void 0 || yt !== "1" && yt !== "true" || Ct === void 0 ? null : Ct, Ot = { min: X, max: X, sz: vt === void 0 ? -1 : parseFloat(vt), csz: $, h: pt !== void 0 && (pt === "1" || pt === "true"), s: Y === null ? void 0 : Y === "0" ? 0 : parseInt(Y), l: J === void 0 || J === "0" ? 0 : parseInt(J), cl: gt !== void 0 && (gt === "1" || gt === "true") }, Et.push(Ot);
} else Ot.max = X;
return Zt = X, void (T = !1);
}
if (!Z && C === "sheetData") {
Z = !0;
const S = t.cols, $ = S ? S.length : 0;
for (let y = 0; !K && y < $; y++) S[y].s && (K = !0);
}
s?.onOpenTag(g);
}
}, onCloseTag: (g) => {
if (Dt) {
let C = g.name;
const tt = C.indexOf(":");
if (tt !== -1 && (C = C.slice(tt + 1)), Tt) if (C === "is" || C === "v") {
const S = n?.onEnd();
S !== null && i.addValue(X, U, "" + S);
} else n?.onCloseTag?.(g);
return A && (A = !1), void (C === "c" && (Dt = null, Tt = !1));
}
if (p) return p = !1, void (R = null);
s?.onCloseTag(g);
}, onText: (g) => {
if (g = g.trim(), A) {
switch (st = null, it) {
case null:
case "n":
st = parseFloat(g);
break;
case "b":
st = g === "1" || g === "true";
break;
case "s":
st = g;
break;
case "e":
if (g === "#VALUE!") {
const tt = Dt.attributes.vm;
if (tt !== void 0) {
const S = d[parseInt(tt) - 1];
if (S && S.isFormulaError) {
st = { t: Mt.Error, v: S.getCode() };
break;
}
}
}
const C = Ie.getBuiltInByLabel(g);
C ? st = { t: Mt.Error, v: C.getCode() } : (st = g, o?.(`Unknown formula error '${g}' in cell ${wt.cellToString({ colIndex: U, rowIndex: X })}`));
break;
case "str":
case "inlineStr":
Tt = !0;
}
st !== null && i.addValue(X, U, st);
}
if (At && (it === "e" && (At[1] = !0), at.push(At), At = null), v) if (D === v) L = l;
else {
if (L = G.get(v), !L) {
const C = [];
O = m(g, X, U, C), L = [O, C, g], G.set(v, L);
}
D = v, l = L;
}
if (w) {
const C = [];
O = m(g, X, U, C), L = [O, C, g];
}
if (L) return H.append(X, U, L), L = null, w = !1, v = null, void (b = null);
Tt ? n?.onText(g) : p || s?.onText(g);
} };
}, ns = Object.freeze(Object.defineProperty({ __proto__: null, readBufferXLSX: async (i, t) => {
const { password: s, createWorkbookOptions: o = {}, ...a } = t ?? {}, n = [], h = t?.progress, p = h?.onProgress;
let A = 0;
const x = import("./DyDIjUa1cJg1phRP.js"), w = import("./DOlWiguat-REPjhX.js");
let v = null;
try {
v = new DOMParser();
} catch {
}
let b = null;
v || (b = import("./D7NOWhgE6vnHVxx-.js").then((l) => l.i));
let O = null, L = null, D = null;
try {
const l = await Promise.all([x, w, b]);
O = l[0], L = l[1], D = l[2];
} catch (l) {
throw new Error("Unable to load XLSX parser.", { cause: l });
}
try {
const l = O.read(i, { type: "array", sheets: [], cellStyles: !1, bookFiles: !0 });
if (!l.Directory) throw new ve("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
l.Directory.richstructure = ["/xl/richData/rdrichvaluestructure.xml"], l.Directory.richdata = ["/xl/richData/rdrichvalue.xml"];
const d = new L.FromOOXMLConverter(), m = v ?? new D.DOMParser(), H = o?.resources ?? new Se(), G = H.beginPersist(), at = {}, At = /* @__PURE__ */ new Set(), Ht = /* @__PURE__ */ new Map();
Ht.set("richTypes", []);
const Dt = /* @__PURE__ */ new Map(), Tt = [], X = (T) => l.files[T], U = (T, R) => {
const Z = T.lastIndexOf("/"), K = T.substring(0, Z + 1) + "_rels/" + T.substring(Z + 1, T.length) + ".rels";
let Y = R.get(K);
return Y || (Y = ((I, g, C, tt, S = null) => {
if (!I) return null;
const $ = le(I, g, C, tt, S);
if (!$) return null;
const y = /* @__PURE__ */ new Map(), k = Object.keys($), q = k.length;
for (let Q = 0; Q < q; Q++) {
const ot = k[Q], lt = $[ot];
y.set(ot, lt);
}
return y;
})(K, X, m, d, it), R.set(K, Y)), Y;
}, st = (T, R, Z, K = Dt) => {
let Y = U(R, K).get(T), I = Y?.target;
if (!I) return null;
if (Y.targetMode === "External") return Y.target;
const g = R.lastIndexOf("/"), C = R.substring(0, g + 1);
I.startsWith("/") || (I = C + I), I = (($) => {
const y = $.split(/\/+/);
return y.reduce((k, q, Q) => (q === "." ? k.splice(Q, 1) : q === ".." && k.splice(Q - 1, 2), k), y).join("/");
})(I);
const tt = d?.getVisitorParamsState().get("dxfs");
let S = K.get(I);
if (!S) if (Y.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
const $ = {};
S = $;
const y = async () => {
const k = ((M, j, ct, B, ht, rt, zt, Vt) => {
const u = new Ze(), ut = new Ce.TransposedBuilder();
let W = null;
u.registerVisitor({ from: "autoFilter", to: "filter", openTag: (e) => {
e.copyTo("ref", P);
} }), u.registerVisitor({ from: "conditionalFormatting", to: {}, openTag: (e) => {
const r = e.getParent();
r.conditionals || (r.conditionals = []), r.conditionals.push(e.getSource());
const c = e.getAttribute("sqref");
c && (e.getSource().ref = c.split(" ").join(",")), e.copyTo("pivot", E);
}, closeTag: (e) => {
const r = e.getSource();
if (r.rule) {
const c = Object.keys(r.rule);
for (let f = 0; f < c.length; f++) {
const F = c[f];
F !== "rule" && (r[F] = r.rule[F]);
}
}
delete r.rule;
} }), u.registerVisitor({ from: "cfRule", to: "rule", openTag: (e) => {
const r = e.getParent();
e.copyToObject(r, "type", P), e.copyToObject(r, "priority", V), e.copyToObject(r, "stopIfTrue", E);
const c = e.getAttribute("dxfId", V);
if (c !== null) {
let f = B?.get(c);
f || (rt?.(`Unable to load conditional color. Invalid dxfI: '${c}' at '${e.getPath()}'.`), f = {}), r.style = f;
}
e.copyToObject(r, "aboveAverage", E), e.copyToObject(r, "equalAverage", E), e.copyToObject(r, "stdDev", V), e.copyToObject(r, "bottom", E), e.copyToObject(r, "percent", E), e.copyToObject(r, "rank", V), e.copyToObject(r, "operator", P), e.copyToObject(r, "text", P), e.copyToObject(r, "timePeriod", P);
} }), u.registerVisitor({ from: "colorScale", to: "colorScale" }), u.registerVisitor({ from: "dataBar", to: "dataBar", openTag: (e) => {
e.copyTo("maxLength", V), e.copyTo("minLength", V), e.copyTo("showValue", E);
} }), u.registerVisitor({ from: "iconSet", to: "iconSet", openTag: (e) => {
e.copyTo("iconSet", P), e.copyTo("reverse", E), e.copyTo("showValue", E);
} }), u.registerVisitor({ from: "formula", to: null, text: (e, r) => {
const c = r.getParent();
let f = c.formulas;
f || (f = [], c.formulas = f), f.push(e);
} }), u.registerVisitor({ from: "cfvo", to: {}, openTag: (e) => {
cons