UNPKG

sheetxl

Version:

SheetXL - Command line tool

1,057 lines (1,056 loc) 75.4 kB
/** * @license sheetxl - SheetXL - Command line tool - v0.7.26 * * (C) 2025-present SheetXL Inc. & Michael T. Ford * License: The license can be found at https://www.sheetxl.com/license. */ import { A as t, e, S as s, b as i, B as o, N as r, R as n, a, c as l, w as c, o as h, q as u, _ as d, t as p, E as g, n as f } from "../cli.js"; import "chalk"; import "fs"; import "path"; import "commander"; const m = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", T = new RegExp(`^[${m}][-${m}.0-9·̀-ͯ‿-⁀]*$`, "u"); function y(t2) { return t2 >= 65 && t2 <= 90 || t2 >= 97 && t2 <= 122 || 58 === t2 || 95 === t2 || 8204 === t2 || 8205 === t2 || t2 >= 192 && t2 <= 214 || t2 >= 216 && t2 <= 246 || t2 >= 248 && t2 <= 767 || t2 >= 880 && t2 <= 893 || t2 >= 895 && t2 <= 8191 || t2 >= 8304 && t2 <= 8591 || t2 >= 11264 && t2 <= 12271 || t2 >= 12289 && t2 <= 55295 || t2 >= 63744 && t2 <= 64975 || t2 >= 65008 && t2 <= 65533 || t2 >= 65536 && t2 <= 983039; } const b = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", x = new RegExp(`^[${b}][-${b}.0-9·̀-ͯ‿-⁀]*$`, "u"); function w(t2) { return t2 >= 65 && t2 <= 90 || 95 === t2 || t2 >= 97 && t2 <= 122 || t2 >= 192 && t2 <= 214 || t2 >= 216 && t2 <= 246 || t2 >= 248 && t2 <= 767 || t2 >= 880 && t2 <= 893 || t2 >= 895 && t2 <= 8191 || t2 >= 8204 && t2 <= 8205 || t2 >= 8304 && t2 <= 8591 || t2 >= 11264 && t2 <= 12271 || t2 >= 12289 && t2 <= 55295 || t2 >= 63744 && t2 <= 64975 || t2 >= 65008 && t2 <= 65533 || t2 >= 65536 && t2 <= 983039; } const v = function(t2) { return 32 === t2 || 10 === t2 || 13 === t2 || 9 === t2; }, S = function(t2) { return t2 >= 32 && t2 <= 55295 || 10 === t2 || 13 === t2 || 9 === t2 || t2 >= 57344 && t2 <= 65533 || t2 >= 65536 && t2 <= 1114111; }, C = y, k = function(t2) { return y(t2) || t2 >= 48 && t2 <= 57 || 45 === t2 || 46 === t2 || 183 === t2 || t2 >= 768 && t2 <= 879 || t2 >= 8255 && t2 <= 8256; }, A = [32, 10, 13, 9], D = T, E = function(t2) { return t2 >= 1 && t2 <= 55295 || t2 >= 57344 && t2 <= 65533 || t2 >= 65536 && t2 <= 1114111; }, P = w, O = function(t2) { return w(t2) || 45 === t2 || 46 === t2 || t2 >= 48 && t2 <= 57 || 183 === t2 || t2 >= 768 && t2 <= 879 || t2 >= 8255 && t2 <= 8256; }, I = x, V = "http://www.w3.org/XML/1998/namespace", N = "http://www.w3.org/2000/xmlns/", L = { __proto__: null, xml: V, xmlns: N }, R = { __proto__: null, amp: "&", gt: ">", lt: "<", quot: '"', apos: "'" }, $ = -1, M = -2, j = 13, H = 33, F = 10, X = 60, B = 61, W = 62, _ = 63, q = 93, z = (t2) => 34 === t2 || 39 === t2, G = [34, 39], U = [...G, 91, W], Z = [...G, X, q], Q = [B, _, ...A], J = [...A, W, 38, X]; function K(t2, e2, s2) { switch (e2) { case "xml": s2 !== V && t2.fail(`xml prefix must be bound to ${V}.`); break; case "xmlns": s2 !== N && t2.fail(`xmlns prefix must be bound to ${N}.`); } switch (s2) { case N: t2.fail("" === e2 ? `the default namespace may not be set to ${s2}.` : `may not assign a prefix (even "xmlns") to the URI ${N}.`); break; case V: switch (e2) { case "xml": break; case "": t2.fail(`the default namespace may not be set to ${s2}.`); break; default: t2.fail("may not assign the xml namespace to another prefix."); } } } const Y = (t2) => I.test(t2), tt = (t2) => D.test(t2), et = { 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 st { constructor(t2) { this.i = 0, this.prevI = 0, this.opt = t2 ?? {}, this.fragmentOpt = !!this.opt.fragment; const e2 = this.xmlnsOpt = !!this.opt.xmlns; if (this.trackPosition = false !== this.opt.position, this.fileName = this.opt.fileName, e2) { this.nameStartCheck = P, this.nameCheck = O, this.isName = Y, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = { __proto__: null, ...L }; const t3 = this.opt.additionalNamespaces; null != t3 && ((function(t4, e3) { for (const s2 of Object.keys(e3)) K(t4, s2, e3[s2]); })(this, t3), Object.assign(this.ns, t3)); } else this.nameStartCheck = C, this.nameCheck = k, this.isName = tt, 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: t2 } = this; this.state = t2 ? j : 0, this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = t2, this.xmlDeclPossible = !t2, this.xmlDeclExpects = ["version"], this.entityReturnState = void 0; let { defaultXMLVersion: e2 } = this.opt; if (void 0 === e2) { if (true === this.opt.forceXMLVersion) throw new Error("forceXMLVersion set but defaultXMLVersion is not set"); e2 = "1.0"; } this.setXMLVersion(e2), this.positionAtNewLine = 0, this.doctype = false, this._closed = false, this.xmlDecl = { version: void 0, encoding: void 0, standalone: void 0 }, this.line = 1, this.column = 0, this.ENTITIES = Object.create(R), this.readyHandler?.(); } get position() { return this.chunkPosition + this.i; } get columnIndex() { return this.position - this.positionAtNewLine; } on(t2, e2) { this[et[t2]] = e2; } off(t2) { this[et[t2]] = void 0; } makeError(t2) { let e2 = this.fileName ?? ""; return this.trackPosition && (e2.length > 0 && (e2 += ":"), e2 += `${this.line}:${this.column}`), e2.length > 0 && (e2 += ": "), new Error(e2 + t2); } fail(t2) { const e2 = this.makeError(t2), s2 = this.errorHandler; if (void 0 === s2) throw e2; return s2(e2), this; } write(t2) { if (this.closed) return this.fail("cannot write after close."); let e2 = false; null === t2 ? (e2 = true, t2 = "") : "object" == typeof t2 && (t2 = t2.toString()), void 0 !== this.carriedFromPrevious && (t2 = `${this.carriedFromPrevious}${t2}`, this.carriedFromPrevious = void 0); let s2 = t2.length; const i2 = t2.charCodeAt(s2 - 1); !e2 && (13 === i2 || i2 >= 55296 && i2 <= 56319) && (this.carriedFromPrevious = t2[s2 - 1], s2--, t2 = t2.slice(0, s2)); const { stateTable: o2 } = this; for (this.chunk = t2, this.i = 0; this.i < s2; ) o2[this.state].call(this); return this.chunkPosition += s2, e2 ? this.end() : this; } close() { return this.write(null); } getCode10() { const t2 = this.chunk, e2 = this.i; if (this.prevI = e2, this.i++, e2 >= t2.length) return $; const s2 = t2.charCodeAt(e2); if (this.column++, s2 < 55296) { if (s2 >= 32 || 9 === s2) return s2; switch (s2) { case F: return this.line++, this.column = 0, this.positionAtNewLine = this.position, F; case 13: return t2.charCodeAt(e2 + 1) === F && (this.i = e2 + 2), this.line++, this.column = 0, this.positionAtNewLine = this.position, M; default: return this.fail("disallowed character."), s2; } } if (s2 > 56319) return s2 >= 57344 && s2 <= 65533 || this.fail("disallowed character."), s2; const i2 = 65536 + 1024 * (s2 - 55296) + (t2.charCodeAt(e2 + 1) - 56320); return this.i = e2 + 2, i2 > 1114111 && this.fail("disallowed character."), i2; } getCode11() { const { chunk: t2, i: e2 } = this; if (this.prevI = e2, this.i = e2 + 1, e2 >= t2.length) return $; const s2 = t2.charCodeAt(e2); if (this.column++, s2 < 55296) { if (s2 > 31 && s2 < 127 || s2 > 159 && 8232 !== s2 || 9 === s2) return s2; switch (s2) { case F: return this.line++, this.column = 0, this.positionAtNewLine = this.position, F; case 13: { const s3 = t2.charCodeAt(e2 + 1); s3 !== F && 133 !== s3 || (this.i = e2 + 2); } case 133: case 8232: return this.line++, this.column = 0, this.positionAtNewLine = this.position, M; default: return this.fail("disallowed character."), s2; } } if (s2 > 56319) return s2 >= 57344 && s2 <= 65533 || this.fail("disallowed character."), s2; const i2 = 65536 + 1024 * (s2 - 55296) + (t2.charCodeAt(e2 + 1) - 56320); return this.i = e2 + 2, i2 > 1114111 && this.fail("disallowed character."), i2; } getCodeNorm() { const t2 = this.getCode(); return t2 === M ? F : t2; } unGet() { this.i = this.prevI, this.column--; } captureTo(t2) { let { i: e2 } = this; const { chunk: s2 } = this; for (; ; ) { const i2 = this.getCode(), o2 = i2 === M, r2 = o2 ? F : i2; if (r2 === $ || t2.includes(r2)) return this.text += s2.slice(e2, this.prevI), r2; o2 && (this.text += `${s2.slice(e2, this.prevI)} `, e2 = this.i); } } captureToChar(t2) { let { i: e2 } = this; const { chunk: s2 } = this; for (; ; ) { let i2 = this.getCode(); switch (i2) { case M: this.text += `${s2.slice(e2, this.prevI)} `, e2 = this.i, i2 = F; break; case $: return this.text += s2.slice(e2), false; } if (i2 === t2) return this.text += s2.slice(e2, this.prevI), true; } } captureNameChars() { const { chunk: t2, i: e2 } = this; for (; ; ) { const s2 = this.getCode(); if (s2 === $) return this.name += t2.slice(e2), $; if (!k(s2)) return this.name += t2.slice(e2, this.prevI), s2 === M ? F : s2; } } skipSpaces() { for (; ; ) { const t2 = this.getCodeNorm(); if (t2 === $ || !v(t2)) return t2; } } setXMLVersion(t2) { this.currentXMLVersion = t2, "1.0" === t2 ? (this.isChar = S, this.getCode = this.getCode10) : (this.isChar = E, this.getCode = this.getCode11); } sBegin() { 65279 === this.chunk.charCodeAt(0) && (this.i++, this.column++), this.state = 1; } sBeginWhitespace() { const t2 = this.i, e2 = this.skipSpaces(); switch (this.prevI !== t2 && (this.xmlDeclPossible = false), e2) { case X: if (this.state = 15, 0 !== this.text.length) throw new Error("no-empty text at start"); break; case $: break; default: this.unGet(), this.state = j, this.xmlDeclPossible = false; } } sDoctype() { const t2 = this.captureTo(U); switch (t2) { case W: this.doctypeHandler?.(this.text), this.text = "", this.state = j, this.doctype = true; break; case $: break; default: this.text += String.fromCodePoint(t2), 91 === t2 ? this.state = 4 : z(t2) && (this.state = 3, this.q = t2); } } sDoctypeQuote() { const t2 = this.q; this.captureToChar(t2) && (this.text += String.fromCodePoint(t2), this.q = null, this.state = 2); } sDTD() { const t2 = this.captureTo(Z); t2 !== $ && (this.text += String.fromCodePoint(t2), t2 === q ? this.state = 2 : t2 === X ? this.state = 6 : z(t2) && (this.state = 5, this.q = t2)); } sDTDQuoted() { const t2 = this.q; this.captureToChar(t2) && (this.text += String.fromCodePoint(t2), this.state = 4, this.q = null); } sDTDOpenWaka() { const t2 = this.getCodeNorm(); switch (this.text += String.fromCodePoint(t2), t2) { case 33: this.state = 7, this.openWakaBang = ""; break; case _: this.state = 11; break; default: this.state = 4; } } sDTDOpenWakaBang() { const t2 = String.fromCodePoint(this.getCodeNorm()), e2 = this.openWakaBang += t2; this.text += t2, "-" !== e2 && (this.state = "--" === e2 ? 8 : 4, this.openWakaBang = ""); } sDTDComment() { this.captureToChar(45) && (this.text += "-", this.state = 9); } sDTDCommentEnding() { const t2 = this.getCodeNorm(); this.text += String.fromCodePoint(t2), this.state = 45 === t2 ? 10 : 8; } sDTDCommentEnded() { const t2 = this.getCodeNorm(); this.text += String.fromCodePoint(t2), t2 === W ? this.state = 4 : (this.fail("malformed comment."), this.state = 8); } sDTDPI() { this.captureToChar(_) && (this.text += "?", this.state = 12); } sDTDPIEnding() { const t2 = this.getCodeNorm(); this.text += String.fromCodePoint(t2), t2 === W && (this.state = 4); } sText() { 0 !== this.tags.length ? this.handleTextInRoot() : this.handleTextOutsideRoot(); } sEntity() { let { i: t2 } = this; const { chunk: e2 } = this; t: for (; ; ) switch (this.getCode()) { case M: this.entity += `${e2.slice(t2, this.prevI)} `, t2 = this.i; break; case 59: { const { entityReturnState: s2 } = this, i2 = this.entity + e2.slice(t2, this.prevI); let o2; this.state = s2, "" === i2 ? (this.fail("empty entity name."), o2 = "&;") : (o2 = this.parseEntity(i2), this.entity = ""), s2 === j && void 0 === this.textHandler || (this.text += o2); break t; } case $: this.entity += e2.slice(t2); break t; } } sOpenWaka() { const t2 = this.getCode(); if (C(t2)) this.state = 34, this.unGet(), this.xmlDeclPossible = false; else switch (t2) { case 47: this.state = 43, this.xmlDeclPossible = false; break; case 33: this.state = 16, this.openWakaBang = "", this.xmlDeclPossible = false; break; case _: this.state = 23; break; default: this.fail("disallowed character in tag name"), this.state = j, this.xmlDeclPossible = false; } } 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 = true), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = true), 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 t2 = this.getCodeNorm(); 45 === t2 ? (this.state = 19, this.commentHandler?.(this.text), this.text = "") : (this.text += `-${String.fromCodePoint(t2)}`, this.state = 17); } sCommentEnded() { const t2 = this.getCodeNorm(); t2 !== W ? (this.fail("malformed comment."), this.text += `--${String.fromCodePoint(t2)}`, this.state = 17) : this.state = j; } sCData() { this.captureToChar(q) && (this.state = 21); } sCDataEnding() { const t2 = this.getCodeNorm(); t2 === q ? this.state = 22 : (this.text += `]${String.fromCodePoint(t2)}`, this.state = 20); } sCDataEnding2() { const t2 = this.getCodeNorm(); switch (t2) { case W: this.cdataHandler?.(this.text), this.text = "", this.state = j; break; case q: this.text += "]"; break; default: this.text += `]]${String.fromCodePoint(t2)}`, this.state = 20; } } sPIFirstChar() { const t2 = this.getCodeNorm(); this.nameStartCheck(t2) ? (this.piTarget += String.fromCodePoint(t2), this.state = 24) : t2 === _ || v(t2) ? (this.fail("processing instruction without a target."), this.state = t2 === _ ? 26 : 25) : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(t2), this.state = 24); } sPIRest() { const { chunk: t2, i: e2 } = this; for (; ; ) { const s2 = this.getCodeNorm(); if (s2 === $) return void (this.piTarget += t2.slice(e2)); if (!this.nameCheck(s2)) { this.piTarget += t2.slice(e2, this.prevI); const i2 = s2 === _; i2 || v(s2) ? "xml" === this.piTarget ? (this.xmlDeclPossible || this.fail("an XML declaration must be at the start of the document."), this.state = i2 ? H : 27) : this.state = i2 ? 26 : 25 : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(s2)); break; } } } sPIBody() { if (0 === this.text.length) { const t2 = this.getCodeNorm(); t2 === _ ? this.state = 26 : v(t2) || (this.text = String.fromCodePoint(t2)); } else this.captureToChar(_) && (this.state = 26); } sPIEnding() { const t2 = this.getCodeNorm(); if (t2 === W) { const { piTarget: t3 } = this; "xml" === t3.toLowerCase() && this.fail("the XML declaration must appear at the start of the document."), this.piHandler?.({ target: t3, body: this.text }), this.piTarget = this.text = "", this.state = j; } else t2 === _ ? this.text += "?" : (this.text += `?${String.fromCodePoint(t2)}`, this.state = 25); this.xmlDeclPossible = false; } sXMLDeclNameStart() { const t2 = this.skipSpaces(); t2 !== _ ? t2 !== $ && (this.state = 28, this.name = String.fromCodePoint(t2)) : this.state = H; } sXMLDeclName() { const t2 = this.captureTo(Q); if (t2 === _) return this.state = H, this.name += this.text, this.text = "", void this.fail("XML declaration is incomplete."); if (v(t2) || t2 === B) { 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 = t2 === B ? 30 : 29; } } sXMLDeclEq() { const t2 = this.getCodeNorm(); if (t2 === _) return this.state = H, void this.fail("XML declaration is incomplete."); v(t2) || (t2 !== B && this.fail("value required."), this.state = 30); } sXMLDeclValueStart() { const t2 = this.getCodeNorm(); if (t2 === _) return this.state = H, void this.fail("XML declaration is incomplete."); v(t2) || (z(t2) ? this.q = t2 : (this.fail("value must be quoted."), this.q = 32), this.state = 31); } sXMLDeclValue() { const t2 = this.captureTo([this.q, _]); if (t2 === _) return this.state = H, this.text = "", void this.fail("XML declaration is incomplete."); if (t2 === $) return; const e2 = this.text; switch (this.text = "", this.name) { case "version": { this.xmlDeclExpects = ["encoding", "standalone"]; const t3 = e2; this.xmlDecl.version = t3, /^1\.[0-9]+$/.test(t3) ? this.opt.forceXMLVersion || this.setXMLVersion(t3) : this.fail("version number must match /^1\\.[0-9]+$/."); break; } case "encoding": /^[A-Za-z][A-Za-z0-9._-]*$/.test(e2) || this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."), this.xmlDeclExpects = ["standalone"], this.xmlDecl.encoding = e2; break; case "standalone": "yes" !== e2 && "no" !== e2 && this.fail('standalone value must match "yes" or "no".'), this.xmlDeclExpects = [], this.xmlDecl.standalone = e2; } this.name = "", this.state = 32; } sXMLDeclSeparator() { const t2 = this.getCodeNorm(); t2 !== _ ? (v(t2) || (this.fail("whitespace required."), this.unGet()), this.state = 27) : this.state = H; } sXMLDeclEnding() { this.getCodeNorm() === W ? ("xml" !== this.piTarget ? this.fail("processing instructions are not allowed before root.") : "version" !== this.name && this.xmlDeclExpects.includes("version") && this.fail("XML declaration must contain a version."), this.xmlDeclHandler?.(this.xmlDecl), this.name = "", this.piTarget = this.text = "", this.state = j) : this.fail("The character ? is disallowed anywhere in XML declarations."), this.xmlDeclPossible = false; } sOpenTag() { const t2 = this.captureNameChars(); if (t2 === $) return; const e2 = this.tag = { name: this.name, attributes: /* @__PURE__ */ Object.create(null) }; switch (this.name = "", this.xmlnsOpt && (this.topNS = e2.ns = /* @__PURE__ */ Object.create(null)), this.openTagStartHandler?.(e2), this.sawRoot = true, !this.fragmentOpt && this.closedRoot && this.fail("documents may contain only one root."), t2) { case W: this.openTag(); break; case 47: this.state = 35; break; default: v(t2) || this.fail("disallowed character in tag name."), this.state = 36; } } sOpenTagSlash() { this.getCode() === W ? this.openSelfClosingTag() : (this.fail("forward-slash in opening tag not followed by >."), this.state = 36); } sAttrib() { const t2 = this.skipSpaces(); t2 !== $ && (C(t2) ? (this.unGet(), this.state = 37) : t2 === W ? this.openTag() : 47 === t2 ? this.state = 35 : this.fail("disallowed character in attribute name.")); } sAttribName() { const t2 = this.captureNameChars(); t2 === B ? this.state = 39 : v(t2) ? this.state = 38 : t2 === W ? (this.fail("attribute without value."), this.pushAttrib(this.name, this.name), this.name = this.text = "", this.openTag()) : t2 !== $ && this.fail("disallowed character in attribute name."); } sAttribNameSawWhite() { const t2 = this.skipSpaces(); switch (t2) { case $: return; case B: this.state = 39; break; default: this.fail("attribute without value."), this.text = "", this.name = "", t2 === W ? this.openTag() : C(t2) ? (this.unGet(), this.state = 37) : (this.fail("disallowed character in attribute name."), this.state = 36); } } sAttribValue() { const t2 = this.getCodeNorm(); z(t2) ? (this.q = t2, this.state = 40) : v(t2) || (this.fail("unquoted attribute value."), this.state = 42, this.unGet()); } sAttribValueQuoted() { const { q: t2, chunk: e2 } = this; let { i: s2 } = this; for (; ; ) switch (this.getCode()) { case t2: return this.pushAttrib(this.name, this.text + e2.slice(s2, this.prevI)), this.name = this.text = "", this.q = null, void (this.state = 41); case 38: return this.text += e2.slice(s2, this.prevI), this.state = 14, void (this.entityReturnState = 40); case F: case M: case 9: this.text += `${e2.slice(s2, this.prevI)} `, s2 = this.i; break; case X: return this.text += e2.slice(s2, this.prevI), void this.fail("disallowed character."); case $: return void (this.text += e2.slice(s2)); } } sAttribValueClosed() { const t2 = this.getCodeNorm(); v(t2) ? this.state = 36 : t2 === W ? this.openTag() : 47 === t2 ? this.state = 35 : C(t2) ? (this.fail("no whitespace between attributes."), this.unGet(), this.state = 37) : this.fail("disallowed character in attribute name."); } sAttribValueUnquoted() { const t2 = this.captureTo(J); switch (t2) { case 38: this.state = 14, this.entityReturnState = 42; break; case X: this.fail("disallowed character."); break; case $: break; default: this.text.includes("]]>") && this.fail('the string "]]>" is disallowed in char data.'), this.pushAttrib(this.name, this.text), this.name = this.text = "", t2 === W ? this.openTag() : this.state = 36; } } sCloseTag() { const t2 = this.captureNameChars(); t2 === W ? this.closeTag() : v(t2) ? this.state = 44 : t2 !== $ && this.fail("disallowed character in closing tag."); } sCloseTagSawWhite() { switch (this.skipSpaces()) { case W: this.closeTag(); break; case $: break; default: this.fail("disallowed character in closing tag."); } } handleTextInRoot() { let { i: t2, forbiddenState: e2 } = this; const { chunk: s2, textHandler: i2 } = this; t: for (; ; ) switch (this.getCode()) { case X: if (this.state = 15, void 0 !== i2) { const { text: e3 } = this, o2 = s2.slice(t2, this.prevI); 0 !== e3.length ? (i2(e3 + o2), this.text = "") : 0 !== o2.length && i2(o2); } e2 = 0; break t; case 38: this.state = 14, this.entityReturnState = j, void 0 !== i2 && (this.text += s2.slice(t2, this.prevI)), e2 = 0; break t; case q: switch (e2) { case 0: e2 = 1; break; case 1: e2 = 2; break; case 2: break; default: throw new Error("impossible state"); } break; case W: 2 === e2 && this.fail('the string "]]>" is disallowed in char data.'), e2 = 0; break; case M: void 0 !== i2 && (this.text += `${s2.slice(t2, this.prevI)} `), t2 = this.i, e2 = 0; break; case $: void 0 !== i2 && (this.text += s2.slice(t2)); break t; default: e2 = 0; } this.forbiddenState = e2; } handleTextOutsideRoot() { let { i: t2 } = this; const { chunk: e2, textHandler: s2 } = this; let i2 = false; t: for (; ; ) { const o2 = this.getCode(); switch (o2) { case X: if (this.state = 15, void 0 !== s2) { const { text: i3 } = this, o3 = e2.slice(t2, this.prevI); 0 !== i3.length ? (s2(i3 + o3), this.text = "") : 0 !== o3.length && s2(o3); } break t; case 38: this.state = 14, this.entityReturnState = j, void 0 !== s2 && (this.text += e2.slice(t2, this.prevI)), i2 = true; break t; case M: void 0 !== s2 && (this.text += `${e2.slice(t2, this.prevI)} `), t2 = this.i; break; case $: void 0 !== s2 && (this.text += e2.slice(t2)); break t; default: v(o2) || (i2 = true); } } i2 && (this.sawRoot || this.reportedTextBeforeRoot || (this.fail("text data outside of root node."), this.reportedTextBeforeRoot = true), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = true)); } pushAttribNS(t2, e2) { const { prefix: s2, local: i2 } = this.qName(t2), o2 = { name: t2, prefix: s2, local: i2, value: e2 }; if (this.attribList.push(o2), this.attributeHandler?.(o2), "xmlns" === s2) { const t3 = e2.trim(); "1.0" === this.currentXMLVersion && "" === t3 && this.fail("invalid attempt to undefine prefix in XML 1.0"), this.topNS[i2] = t3, K(this, i2, t3); } else if ("xmlns" === t2) { const t3 = e2.trim(); this.topNS[""] = t3, K(this, "", t3); } } pushAttribPlain(t2, e2) { const s2 = { name: t2, value: e2 }; this.attribList.push(s2), this.attributeHandler?.(s2); } end() { this.sawRoot || this.fail("document must contain a root element."); const { tags: t2 } = this; for (; t2.length > 0; ) { const e3 = t2.pop(); this.fail(`unclosed tag: ${e3.name}`); } 0 !== this.state && this.state !== j && this.fail("unexpected end."); const { text: e2 } = this; return 0 !== e2.length && (this.textHandler?.(e2), this.text = ""), this._closed = true, this.endHandler?.(), this._init(), this; } resolve(t2) { let e2 = this.topNS[t2]; if (void 0 !== e2) return e2; const { tags: s2 } = this; for (let i2 = s2.length - 1; i2 >= 0; i2--) if (e2 = s2[i2].ns[t2], void 0 !== e2) return e2; return e2 = this.ns[t2], void 0 !== e2 ? e2 : this.opt.resolvePrefix?.(t2); } qName(t2) { const e2 = t2.indexOf(":"); if (-1 === e2) return { prefix: "", local: t2 }; const s2 = t2.slice(e2 + 1), i2 = t2.slice(0, e2); return ("" === i2 || "" === s2 || s2.includes(":")) && this.fail(`malformed name: ${t2}.`), { prefix: i2, local: s2 }; } processAttribsNS() { const { attribList: t2 } = this, e2 = this.tag; { const { prefix: t3, local: s3 } = this.qName(e2.name); e2.prefix = t3, e2.local = s3; const i3 = e2.uri = this.resolve(t3) ?? ""; "" !== t3 && ("xmlns" === t3 && this.fail('tags may not have "xmlns" as prefix.'), "" === i3 && (this.fail(`unbound namespace prefix: ${JSON.stringify(t3)}.`), e2.uri = t3)); } if (0 === t2.length) return; const { attributes: s2 } = e2, i2 = /* @__PURE__ */ new Set(); for (const e3 of t2) { const { name: t3, prefix: o2, local: r2 } = e3; let n2, a2; "" === o2 ? (n2 = "xmlns" === t3 ? N : "", a2 = t3) : (n2 = this.resolve(o2), void 0 === n2 && (this.fail(`unbound namespace prefix: ${JSON.stringify(o2)}.`), n2 = o2), a2 = `{${n2}}${r2}`), i2.has(a2) && this.fail(`duplicate attribute: ${a2}.`), i2.add(a2), e3.uri = n2, s2[t3] = e3; } this.attribList = []; } processAttribsPlain() { const { attribList: t2 } = this, e2 = this.tag.attributes; for (const { name: s2, value: i2 } of t2) void 0 !== e2[s2] && this.fail(`duplicate attribute: ${s2}.`), e2[s2] = i2; this.attribList = []; } openTag() { this.processAttribs(); const { tags: t2 } = this, e2 = this.tag; e2.isSelfClosing = false, this.openTagHandler?.(e2), t2.push(e2), this.state = j, this.name = ""; } openSelfClosingTag() { this.processAttribs(); const { tags: t2 } = this, e2 = this.tag; e2.isSelfClosing = true, this.openTagHandler?.(e2), this.closeTagHandler?.(e2), null === (this.tag = t2[t2.length - 1] ?? null) && (this.closedRoot = true), this.state = j, this.name = ""; } closeTag() { const { tags: t2, name: e2 } = this; if (this.state = j, this.name = "", "" === e2) return this.fail("weird empty close tag."), void (this.text += "</>"); const s2 = this.closeTagHandler; let i2 = t2.length; for (; i2-- > 0; ) { const i3 = this.tag = t2.pop(); if (this.topNS = i3.ns, s2?.(i3), i3.name === e2) break; this.fail(`unexpected close tag: ${e2}.`); } 0 === i2 ? this.closedRoot = true : i2 < 0 && (this.fail(`unmatched closing tag: ${e2}.`), this.text += `</${e2}>`); } parseEntity(t2) { if ("#" !== t2[0]) { const e3 = this.ENTITIES[t2]; return void 0 !== e3 ? e3 : (this.fail(this.isName(t2) ? "undefined entity." : "disallowed character in entity name."), `&${t2};`); } let e2 = NaN; return "x" === t2[1] && /^#x[0-9a-f]+$/i.test(t2) ? e2 = parseInt(t2.slice(2), 16) : /^#[0-9]+$/.test(t2) && (e2 = parseInt(t2.slice(1), 10)), this.isChar(e2) ? String.fromCodePoint(e2) : (this.fail("malformed character entity."), `&${t2};`); } } var it, ot; (ot = it || (it = {})).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" }, ot.parseStream = async (t2, e2, s2) => { const i2 = new st({ position: false, ...s2 }); let o2; if (e2.onOpenTagStart && i2.on(ot.Events.OpenTagStart, e2.onOpenTagStart), e2.onOpenTag && i2.on(ot.Events.OpenTag, e2.onOpenTag), e2.onCloseTag && i2.on(ot.Events.CloseTag, e2.onCloseTag), e2.onAttribute && i2.on(ot.Events.Attribute, e2.onAttribute), e2.onText && i2.on(ot.Events.Text, e2.onText), e2.onError && i2.on(ot.Events.Error, e2.onError), e2.onEnd) { e2.onEnd; const t3 = () => { o2 = e2.onEnd(); }; i2.on(ot.Events.End, t3); } for (; ; ) { const { value: e3, done: s3 } = await t2.read(); if (s3) break; i2.write(e3); } return i2.close(), o2; }; const rt = (t2) => true === t2 || "1" === t2 || "on" === t2 || "true" === t2 || false !== t2 && "0" !== t2 && "off" !== t2 && "false" !== t2 && null, nt = (t2) => { const e2 = parseInt(t2); return isNaN(e2) ? null : e2; }, at = (t2) => { const e2 = parseFloat(t2); return isNaN(e2) ? null : e2; }, lt = null; class ct { constructor() { this._registeredVisitors = /* @__PURE__ */ new Map(); } registerVisitor(t2) { this._registeredVisitors.set(t2.from, t2); } createEventHandler(t2, e2, s2) { const i2 = this._registeredVisitors, o2 = []; let r2 = null, n2 = null, a2 = null, l2 = null; const c2 = [], h2 = { key: null, source: t2 }; let u2 = null, d2 = false; const p2 = (t3, e3) => { let s3 = a2.attributes[t3]; if (e3) if (Array.isArray(e3)) for (let t4 = 0; t4 < e3.length; t4++) { if (null == s3) return; if (s3 = e3[t4](s3), null == s3) return; } else { if (null == s3) return; if (s3 = e3(s3), null == s3) return; } return s3; }, g2 = { getSource: () => u2.source, setSource: (t3) => { u2.source = t3; }, setKey: (t3) => { u2.key = t3; }, getFrom: () => a2, getAttribute: (t3, e3) => p2(t3, e3) ?? null, hasAttribute: (t3) => null !== g2.getAttribute(t3), getParent: () => c2[c2.length - 2].source, getPath: () => { const t3 = []; for (let e3 = 0; e3 < o2.length; e3++) t3.push(o2[e3].local); return t3.join("\\"); }, parseAttribute: p2, copyToObject: (t3, e3, s3, i3) => { const o3 = p2(i3 ?? e3, s3); void 0 !== o3 && (t3[e3] = o3); }, copyTo: (t3, e3, s3) => { const i3 = p2(s3 ?? t3, e3); void 0 !== i3 && (u2.source[t3] = i3); }, warn: (t3) => { s2 ? s2?.(t3) : console.warn(t3); } }; return { onOpenTag: (t3) => { let e3 = t3.name; const s3 = e3.indexOf(":"); -1 !== s3 && (e3 = e3.slice(s3 + 1)); const p3 = i2.get(e3); if (r2 = { local: e3, visitor: p3, tag: t3, destination: null }, d2) return o2.push(r2), n2 = e3, void (a2 = t3); l2 = r2?.visitor ?? null, p3 && (u2 = 0 === o2.length ? h2 : null !== l2?.to ? { key: null, source: {} } : null, r2.destination = u2, u2 && c2.push(u2)), o2.push(r2), n2 = e3, a2 = t3, d2 = null === l2?.to, l2?.openTag?.(g2); }, onCloseTag: (t3) => { let e3 = t3.name; const i3 = e3.indexOf(":"); if (-1 !== i3 && (e3 = e3.slice(i3 + 1)), e3 !== n2) throw new Error(`mismatch open/close tag: '${e3}'/'${n2}'`); d2 || l2?.closeTag?.(g2); const p3 = o2.pop() ?? null; r2 = o2[o2.length - 1] ?? null; const f2 = p3?.destination; if (f2) { c2.pop(), u2 = c2[c2.length - 1] ?? h2; const t4 = p3.visitor; t4 && t4.to && void 0 !== f2.source && (Array.isArray(t4.to) ? u2.source.push ? u2.source.push(f2.source) : s2?.(`Unable to parse array for ${t4.from} at ${g2.getPath()}`) : f2.key ? u2.source[f2.key] = f2.source : "string" == typeof t4.to && (u2.source[t4.to] = f2.source)); } n2 = r2?.local ?? null, a2 = r2?.tag ?? null, l2 = r2?.visitor ?? null, d2 = !r2?.destination; }, onText: (t3) => { l2?.text?.(t3, g2); }, onEnd: e2 }; } } const ht = (t2, e2, s2, i2 = null) => { if (!t2) return null; let o2 = t2; o2.startsWith("/") && (o2 = o2.substring(1)); let r2 = i2?.parsedRefs?.get(t2); if (void 0 !== r2) return r2; const n2 = e2(o2); if (!n2) return null; let a2 = n2.content; try { s2 && (a2 = s2(a2)); } catch (t3) { console.warn(t3); } return i2?.parsedRefs?.set(t2, a2), a2; }, ut = (t2, e2, s2, i2, o2 = null) => { if (!t2) return null; let r2 = t2; r2.startsWith("/") && (r2 = r2.substring(1)); let n2 = o2?.parsedRefs?.get(t2); if (void 0 !== n2) return n2; const a2 = e2(r2); if (!a2) return null; const l2 = a2.content; try { const e3 = new TextDecoder().decode(l2), r3 = s2.parseFromString(e3, "text/xml"), n3 = i2.convert(r3, t2, o2); return o2?.parsedRefs?.set(t2, n3), n3; } catch (t3) { console.warn(t3); } return null; }, dt = (t2, e2, s2, i2, o2 = null) => { const r2 = /* @__PURE__ */ new Map(); let n2 = e2.Directory[t2]; const a2 = n2 ? n2.length : 0; for (let t3 = 0; t3 < a2; t3++) { const a3 = n2[t3]; if (!a3) continue; let l2 = a3; l2.startsWith("/") && (l2 = l2.substring(1)); const c2 = ut(l2, (t4) => e2.files[t4], s2, i2, o2); r2.set(l2, c2); } return r2; }, pt = ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "hlink", "folHlink"], gt = (t2, e2 = "dk1") => { let s2; const i2 = t2("auto"); void 0 === i2 || "1" !== i2 && "true" !== i2 || (s2 = e2); const o2 = t2("indexed"); o2 && (s2 = `index${o2}`); const r2 = t2("rgb"); r2 && (s2 = r2.toLowerCase(), 8 !== r2.length || r2.startsWith("FF") || (s2 = "FF" + r2.substring(2, r2.length))); const n2 = t2("theme"); n2 && (s2 = pt[n2]); let a2 = t2("tint"); if (a2 && (s2 += ` ${u.AdjustmentType.ETint} ${parseFloat(a2)}`), s2) return s2; }, ft = (t2) => t2 ? t2.replace(/^\{([\s\S]+)\}$/, "$1") : t2, mt = (t2) => t2 ? a.roundAccurately(parseFloat(t2) / 12700, 4) : null, Tt = (t2) => t2 ? a.roundAccurately(parseFloat(t2) / 9525, 1) : null, yt = (t2) => parseFloat(t2) / 1e3, bt = (t2) => parseFloat(t2) / 6e4, xt = (t2) => "true" === t2 || "1" === t2; class wt { 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 vt = (t2, e2, s2) => { if (t2[0].value[0] === t2[1].value[0]) return e2; }, St = { colStart: 0, colEnd: 0, rowStart: 0, rowEnd: 0 }, Ct = Object.freeze(Object.defineProperty({ __proto__: null, readBufferXLSX: async (t2, u2) => { const { password: m2, createWorkbookOptions: T2 = {}, ...y2 } = u2 ?? {}, b2 = [], x2 = u2?.progress, w2 = x2?.onProgress; let v2 = 0; const S2 = import("./yEfzthTMUqG_Nl1_.js"), C2 = import("./BN8HKPZXhLIxwktv.js"); let k2 = null; try { k2 = new DOMParser(); } catch (t3) { } let A2 = null; k2 || (A2 = import("./mG02s9F6vdai-D7K.js").then((t3) => t3.i)); let D2 = null, E2 = null, P2 = null; try { const t3 = await Promise.all([S2, C2, A2]); D2 = t3[0], E2 = t3[1], P2 = t3[2]; } catch (t3) { throw new Error("Unable to load XLSX parser.", { cause: t3 }); } try { const u3 = D2.read(t2, { type: "array", sheets: [], cellStyles: false, bookFiles: true }); if (!u3.Directory) throw new s("Unable to parse as an Excel document. Try to save as '.xlsx' and try again."); u3.Directory.richstructure = ["/xl/richData/rdrichvaluestructure.xml"], u3.Directory.richdata = ["/xl/richData/rdrichvalue.xml"]; const g2 = new E2.FromOOXMLConverter(), m3 = k2 ?? new P2.DOMParser(), y3 = T2?.resources ?? new i(), S3 = y3.beginPersist(), C3 = {}, A3 = /* @__PURE__ */ new Set(), O2 = /* @__PURE__ */ new Map(); O2.set("richTypes", []); const I2 = /* @__PURE__ */ new Map(), V2 = [], N2 = (t3) => u3.files[t3], L2 = (t3, e2) => { const s2 = t3.lastIndexOf("/"), i2 = t3.substring(0, s2 + 1) + "_rels/" + t3.substring(s2 + 1, t3.length) + ".rels"; let o2 = e2.get(i2); return o2 || (o2 = ((t4, e3, s3, i3, o3 = null) => { if (!t4) return null; const r2 = ut(t4, e3, s3, i3, o3); if (!r2) return null; const n2 = /* @__PURE__ */ new Map(), a2 = Object.keys(r2), l2 = a2.length; for (let t5 = 0; t5 < l2; t5++) { const e4 = a2[t5], s4 = r2[e4]; n2.set(e4, s4); } return n2; })(i2, N2, m3, g2, $2), e2.set(i2, o2)), o2; }, R2 = (t3, s2, i2, l2 = I2) => { let c2 = L2(s2, l2).get(t3), h2 = c2?.target; if (!h2) return null; if ("External" === c2.targetMode) return c2.target; const u4 = s2.lastIndexOf("/"), T3 = s2.substring(0, u4 + 1); h2.startsWith("/") || (h2 = T3 + h2), h2 = ((t4) => { const e2 = t4.split(/\/+/); return e2.reduce((t5, e3, s3) => ("." === e3 ? t5.splice(s3, 1) : ".." === e3 && t5.splice(s3 - 1, 2), t5), e2).join("/"); })(h2); const x3 = g2?.getVisitorParamsState().get("dxfs"); let k3 = l2.get(h2); if (!k3) { const t4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"; if (c2.type === t4) { const t5 = {}; k3 = t5; const s3 = async () => { const s4 = ((t6, s5, i4, a2, l3, c4, h3, u6) => { const g4 = new ct(), m5 = new o.TransposedBuilder(); let T4 = null; g4.registerVisitor({ from: "autoFilter", to: "filter", openTag: (t7) => { t7.copyTo("ref", lt); } }), g4.registerVisitor({ from: "conditionalFormatting", to: {}, openTag: (t7) => { const e2 = t7.getParent(); e2.conditionals || (e2.conditionals = []), e2.conditionals.push(t7.getSource()); const s6 = t7.getAttribute("sqref"); s6 && (t7.getSource().ref = s6.split(" ").join(",")), t7.copyTo("pivot", rt); }, closeTag: (t7) => { const e2 = t7.getSource(); if (e2.rule) { const t8 = Object.keys(e2.rule); for (let s6 = 0; s6 < t8.length; s6++) { const i5 = t8[s6]; "rule" !== i5 && (e2[i5] = e2.rule[i5]); } } delete e2.rule; } }), g4.registerVisitor({ from: "cfRule", to: "rule", openTag: (t7) => { const e2 = t7.getParent(); t7.copyToObject(e2, "type", lt), t7.copyToObject(e2, "priority", nt), t7.copyToObject(e2, "stopIfTrue", rt); const s6 = t7.getAttribute("dxfId", nt); if (null !== s6) { let i5 = a2?.get(s6); i5 || (c4?.(`Unable to load conditional color. Invalid dxfI: '${s6}' at '${t7.getPath()}'.`), i5 = {}), e2.style = i5; } t7.copyToObject(e2, "aboveAverage", rt), t7.copyToObject(e2, "equalAverage", rt), t7.copyToObject(e2, "stdDev", nt), t7.copyToObject(e2, "bottom", rt), t7.copyToObject(e2, "percent", rt), t7.copyToObject(e2, "rank", nt), t7.copyToObject(e2, "operator", lt), t7.copyToObject(e2, "text", lt), t7.copyToObject(e2, "timePeriod", lt); } }), g4.registerVisitor({ from: "colorScale", to: "colorScale" }), g4.registerVisitor({ from: "dataBar", to: "dataBar", openTag: (t7) => { t7.copyTo("maxLength", nt), t7.copyTo("minLength", nt), t7.copyTo("showValue", rt); } }), g4.registerVisitor({ from: "iconSet", to: "iconSet", openTag: (t7) => { t7.copyTo("iconSet", lt), t7.copyTo("reverse", rt), t7.copyTo("showValue", rt); } }), g4.registerVisitor({ from: "formula", to: null, text: (t7, e2) => { const s6 = e2.getParent(); let i5 = s6.formulas; i5 || (i5 = [], s6.formulas = i5), i5.push(t7); } }), g4.registerVisitor({ from: "cfvo", to: {}, openTag: (t7) => { const e2 = t7.getParent(); e2.conditions || (e2.conditions = []), e2.conditions.push(t7.getSource()), t7.copyTo("type", lt), t7.copyTo("value", at, "val"), t7.copyTo("gte", rt); } }), g4.registerVisitor({ from: "color", to: {}, openTag: (t7) => { const e2 = t7.getParent(); e2.colors || (e2.colors = []); const s6 = gt((e3) => t7.getAttribute(e3)); e2.colors.push(s6); } }), g4.registerVisitor({ from: "filterColumn", to: "filterColumn", openTag: (t7) => { const e2 = t7.getParent(); e2.fields || (e2.fields = []), e2.fields.push(t7.getSource()), t7.copyTo("offset", nt, "colId"), t7.copyTo("hiddenButton", rt), t7.copyTo("showButton", rt); } }), g4.registerVisitor({ from: "colorFilter", to: "colorFilter", openTag: (t7) => { const e2 = t7.getParent(); e2.criteria || (e2.criteria = []), e2.criteria.push(t7.getSource()), t7.getSource().type = r.Type.Color, t7.copyTo("cellColor", rt), t7.copyTo("styleId", nt, "dxfId"); } }), g4.registerVisitor({ from: "dynamicFilter", to: "dynamicFilter", openTag: (t7) => { const e2 = t7.getParent(); e2.criteria || (e2.criteria = []), e2.criteria.push(t7.getSource()), t7.getSource().type = r.Type.Dynamic, t7.copyTo("dynamicType", lt, "type"), t7.copyTo("val", at), t7.copyTo("maxVal", at, "maxVal"); } }), g4.registerVisitor({ from: "iconFilter", to: "iconFilter", openTag: (t7) => { const e2 = t7.getParent(); e2.criteria || (e2.criteria = []), e2.criteria.push(t7.getSource()), t7.getSource().type = r.Type.Icon, t7.copyTo("iconId", nt), t7.copyTo("iconSet", lt); } }), g4.registerVisitor({ from: "top10", to: "top10", openTag: (t7) => { const e2 = t7.getParent(); e2.criteria || (e2.criteria = []), e2.criteria.push(t7.getSource()), t7.getSource().type = r.Type.Top10, t7.copyTo("filterVal", at), t7.copyTo("percent", rt), t7.copyTo("top", rt), t7.copyTo("val", at); } }), g4.registerVisitor({ from: "filters", to: "filters", openTag: (t7) => { const e2 = t7.getParent(); e2.criteria || (e2.criteria = []), e2.criteria.push(t7.getSource()), t7.getSource().type = r.Type.Items, t7.copyTo("blank", rt), t7.copyTo("calendarType", lt); } }), g4.registerVisitor({ from: "dateGroupItem", to: "dateGroupItem", openTag: (t7) => { const e2 = t7.getParent(); e2.dateGroups || (e2.dateGroups = []), e2.dateGroups.push(t7.getSource()), t7.copyTo("group", lt, "dateTimeGrouping"), t7.copyTo("day", nt), t7.copyTo("hour", nt), t7.copyTo("minute", nt), t7.copyTo("month", nt), t7.copyTo("second", nt), t7.copyTo("year", nt); } }), g4.registerVisitor({ from: "filter", to: "filter", openTag: (t7) => { const e2 = t7.getParent(); e2.items || (e2.items = []), e2.items.push(t7.getAttribute("val", at)); } }), g4.registerVisitor({ from: "customFilters", to: "customFilters", openTag: (t7) => { const e2 = t7.getParent(); e2.criteria || (e2.criteria = []), e2.criteria.push(t7.getSource()), t7.getSource().type = r.Type.Custom, t7.copyTo("and", rt); } }), g4.registerVisitor({ from: "customFilter", to: "customFilter", openTag: (t7) => { const e2 = t7.getParent(); e2.filters || (e2.filters = []), e2.filters.push(t7.getSource()), t7.copyTo("operator", lt), t7.copyTo("value", at, "val"); } }), g4.registerVisitor({ from: "sortState", to: "sort", openTag: (t7) => { t7.copyTo("ref", lt); } }), g4.registerVisitor({ from: "sortCondition", to: "sortCondition", openTag: (t7) => { const e2 = t7.getParent(); e2.fields || (e2.fields = []); const s6 = t7.getSource(); e2.fields.push(s6), t7.copyTo("sortOn", lt, "sortBy"), t7.copyTo("dxfId", lt, "sortBy"), t7.copyTo("iconSet", lt), t7.copyTo("customList", lt); const i5 = t7.getAttribute("ref"); if (i5) { const t8 = n.fastStringToRange(i5, St).colStart, o2 = n.fastStringToRange(e2.ref, St), r2 = o2.colStart; s6.offset = o2 ? t8 - r2 : t8; } s6.reverse = t7.getAttribute("descending", rt) ?? false; } }), g4.registerVisitor({ from: "AlternateContent", to: null }); const y4 = (t7) => { T4 = t7.getSource(), t7.copyTo("topLeft", lt, "topLeftCell"); const e2 = xt(t7.getAttribute("defaultGridColor")), s6 = t7.getAttribute("colorId"); null === s6 || e2 || (t7.getSource().gridLineColor = "index" + parseFloat(s6)), t7.copyTo("showZeros", rt), t7.copyTo("showFormulas", rt), t7.copyTo("zoomScale", nt), t7.copyTo("showRowHeaders", rt, "showRowColHeaders"), t7.copyTo("showColumnHeaders", rt, "showRowColHeaders"), t7.copyTo("showRowGridlines", rt, "showGridLines"), t7.copyTo("showColumnGridlines", rt, "showGridLines"); }; g4.registerVisitor({ from: "sheetView", to: "view", openTag: (t7) => { y4(t7); }, closeTag: () => {