UNPKG

lexio

Version:

Quickest way to production grade RAG UI.

1,298 lines 1.39 MB
function qe(be, Fe) { for (var s = 0; s < Fe.length; s++) { const T = Fe[s]; if (typeof T != "string" && !Array.isArray(T)) { for (const S in T) if (S !== "default" && !(S in be)) { const m = Object.getOwnPropertyDescriptor(T, S); m && Object.defineProperty(be, S, m.get ? m : { enumerable: !0, get: () => T[S] }); } } } return Object.freeze(Object.defineProperty(be, Symbol.toStringTag, { value: "Module" })); } var Kt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function We(be) { return be && be.__esModule && Object.prototype.hasOwnProperty.call(be, "default") ? be.default : be; } function De(be) { throw new Error('Could not dynamically require "' + be + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var ze = { exports: {} }; /*! ExcelJS 19-10-2023 */ var He; function Xe() { return He || (He = 1, function(be, Fe) { (function(s) { be.exports = s(); })(function() { return function s(T, S, m) { function a(t, e) { if (!S[t]) { if (!T[t]) { var l = typeof De == "function" && De; if (!e && l) return l(t, !0); if (o) return o(t, !0); var n = new Error("Cannot find module '" + t + "'"); throw n.code = "MODULE_NOT_FOUND", n; } var i = S[t] = { exports: {} }; T[t][0].call(i.exports, function(f) { return a(T[t][1][f] || f); }, i, i.exports, s, T, S, m); } return S[t].exports; } for (var o = typeof De == "function" && De, r = 0; r < m.length; r++) a(m[r]); return a; }({ 1: [function(s, T, S) { const m = s("fs"), a = s("fast-csv"), o = s("dayjs/plugin/customParseFormat"), r = s("dayjs/plugin/utc"), t = s("dayjs").extend(o).extend(r), e = s("../utils/stream-buf"), { fs: { exists: l } } = s("../utils/utils"), n = { true: !0, false: !1, "#N/A": { error: "#N/A" }, "#REF!": { error: "#REF!" }, "#NAME?": { error: "#NAME?" }, "#DIV/0!": { error: "#DIV/0!" }, "#NULL!": { error: "#NULL!" }, "#VALUE!": { error: "#VALUE!" }, "#NUM!": { error: "#NUM!" } }; T.exports = class { constructor(i) { this.workbook = i, this.worksheet = null; } async readFile(i, f) { if (f = f || {}, !await l(i)) throw new Error("File not found: " + i); const c = m.createReadStream(i), u = await this.read(c, f); return c.close(), u; } read(i, f) { return f = f || {}, new Promise((c, u) => { const d = this.workbook.addWorksheet(f.sheetName), h = f.dateFormats || ["YYYY-MM-DD[T]HH:mm:ssZ", "YYYY-MM-DD[T]HH:mm:ss", "MM-DD-YYYY", "YYYY-MM-DD"], w = f.map || function(A) { if (A === "") return null; const N = Number(A); if (!Number.isNaN(N) && N !== 1 / 0) return N; const L = h.reduce((P, D) => { if (P) return P; const U = t(A, D, !0); return U.isValid() ? U : null; }, null); if (L) return new Date(L.valueOf()); const I = n[A]; return I !== void 0 ? I : A; }, _ = a.parse(f.parserOptions).on("data", (A) => { d.addRow(A.map(w)); }).on("end", () => { _.emit("worksheet", d); }); _.on("worksheet", c).on("error", u), i.pipe(_); }); } createInputStream() { throw new Error("`CSV#createInputStream` is deprecated. You should use `CSV#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md"); } write(i, f) { return new Promise((c, u) => { f = f || {}; const d = this.workbook.getWorksheet(f.sheetName || f.sheetId), h = a.format(f.formatterOptions); i.on("finish", () => { c(); }), h.on("error", u), h.pipe(i); const { dateFormat: w, dateUTC: _ } = f, A = f.map || ((I) => { if (I) { if (I.text || I.hyperlink) return I.hyperlink || I.text || ""; if (I.formula || I.result) return I.result || ""; if (I instanceof Date) return w ? _ ? t.utc(I).format(w) : t(I).format(w) : _ ? t.utc(I).format() : t(I).format(); if (I.error) return I.error; if (typeof I == "object") return JSON.stringify(I); } return I; }), N = f.includeEmptyRows === void 0 || f.includeEmptyRows; let L = 1; d && d.eachRow((I, P) => { if (N) for (; L++ < P - 1; ) h.write([]); const { values: D } = I; D.shift(), h.write(D.map(A)), L = P; }), h.end(); }); } writeFile(i, f) { const c = { encoding: (f = f || {}).encoding || "utf8" }, u = m.createWriteStream(i, c); return this.write(u, f); } async writeBuffer(i) { const f = new e(); return await this.write(f, i), f.read(); } }; }, { "../utils/stream-buf": 24, "../utils/utils": 27, dayjs: 391, "dayjs/plugin/customParseFormat": 392, "dayjs/plugin/utc": 393, "fast-csv": 424, fs: 216 }], 2: [function(s, T, S) { const m = s("../utils/col-cache"); class a { constructor(r, t) { let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; if (this.worksheet = r, t) if (typeof t == "string") { const l = m.decodeAddress(t); this.nativeCol = l.col + e, this.nativeColOff = 0, this.nativeRow = l.row + e, this.nativeRowOff = 0; } else t.nativeCol !== void 0 ? (this.nativeCol = t.nativeCol || 0, this.nativeColOff = t.nativeColOff || 0, this.nativeRow = t.nativeRow || 0, this.nativeRowOff = t.nativeRowOff || 0) : t.col !== void 0 ? (this.col = t.col + e, this.row = t.row + e) : (this.nativeCol = 0, this.nativeColOff = 0, this.nativeRow = 0, this.nativeRowOff = 0); else this.nativeCol = 0, this.nativeColOff = 0, this.nativeRow = 0, this.nativeRowOff = 0; } static asInstance(r) { return r instanceof a || r == null ? r : new a(r); } get col() { return this.nativeCol + Math.min(this.colWidth - 1, this.nativeColOff) / this.colWidth; } set col(r) { this.nativeCol = Math.floor(r), this.nativeColOff = Math.floor((r - this.nativeCol) * this.colWidth); } get row() { return this.nativeRow + Math.min(this.rowHeight - 1, this.nativeRowOff) / this.rowHeight; } set row(r) { this.nativeRow = Math.floor(r), this.nativeRowOff = Math.floor((r - this.nativeRow) * this.rowHeight); } get colWidth() { return this.worksheet && this.worksheet.getColumn(this.nativeCol + 1) && this.worksheet.getColumn(this.nativeCol + 1).isCustomWidth ? Math.floor(1e4 * this.worksheet.getColumn(this.nativeCol + 1).width) : 64e4; } get rowHeight() { return this.worksheet && this.worksheet.getRow(this.nativeRow + 1) && this.worksheet.getRow(this.nativeRow + 1).height ? Math.floor(1e4 * this.worksheet.getRow(this.nativeRow + 1).height) : 18e4; } get model() { return { nativeCol: this.nativeCol, nativeColOff: this.nativeColOff, nativeRow: this.nativeRow, nativeRowOff: this.nativeRowOff }; } set model(r) { this.nativeCol = r.nativeCol, this.nativeColOff = r.nativeColOff, this.nativeRow = r.nativeRow, this.nativeRowOff = r.nativeRowOff; } } T.exports = a; }, { "../utils/col-cache": 19 }], 3: [function(s, T, S) { const m = s("../utils/col-cache"), a = s("../utils/under-dash"), o = s("./enums"), { slideFormula: r } = s("../utils/shared-formula"), t = s("./note"); class e { constructor(i, f, c) { if (!i || !f) throw new Error("A Cell needs a Row"); this._row = i, this._column = f, m.validateAddress(c), this._address = c, this._value = l.create(e.Types.Null, this), this.style = this._mergeStyle(i.style, f.style, {}), this._mergeCount = 0; } get worksheet() { return this._row.worksheet; } get workbook() { return this._row.worksheet.workbook; } destroy() { delete this.style, delete this._value, delete this._row, delete this._column, delete this._address; } get numFmt() { return this.style.numFmt; } set numFmt(i) { this.style.numFmt = i; } get font() { return this.style.font; } set font(i) { this.style.font = i; } get alignment() { return this.style.alignment; } set alignment(i) { this.style.alignment = i; } get border() { return this.style.border; } set border(i) { this.style.border = i; } get fill() { return this.style.fill; } set fill(i) { this.style.fill = i; } get protection() { return this.style.protection; } set protection(i) { this.style.protection = i; } _mergeStyle(i, f, c) { const u = i && i.numFmt || f && f.numFmt; u && (c.numFmt = u); const d = i && i.font || f && f.font; d && (c.font = d); const h = i && i.alignment || f && f.alignment; h && (c.alignment = h); const w = i && i.border || f && f.border; w && (c.border = w); const _ = i && i.fill || f && f.fill; _ && (c.fill = _); const A = i && i.protection || f && f.protection; return A && (c.protection = A), c; } get address() { return this._address; } get row() { return this._row.number; } get col() { return this._column.number; } get $col$row() { return `$${this._column.letter}$${this.row}`; } get type() { return this._value.type; } get effectiveType() { return this._value.effectiveType; } toCsvString() { return this._value.toCsvString(); } addMergeRef() { this._mergeCount++; } releaseMergeRef() { this._mergeCount--; } get isMerged() { return this._mergeCount > 0 || this.type === e.Types.Merge; } merge(i, f) { this._value.release(), this._value = l.create(e.Types.Merge, this, i), f || (this.style = i.style); } unmerge() { this.type === e.Types.Merge && (this._value.release(), this._value = l.create(e.Types.Null, this), this.style = this._mergeStyle(this._row.style, this._column.style, {})); } isMergedTo(i) { return this._value.type === e.Types.Merge && this._value.isMergedTo(i); } get master() { return this.type === e.Types.Merge ? this._value.master : this; } get isHyperlink() { return this._value.type === e.Types.Hyperlink; } get hyperlink() { return this._value.hyperlink; } get value() { return this._value.value; } set value(i) { this.type !== e.Types.Merge ? (this._value.release(), this._value = l.create(l.getType(i), this, i)) : this._value.master.value = i; } get note() { return this._comment && this._comment.note; } set note(i) { this._comment = new t(i); } get text() { return this._value.toString(); } get html() { return a.escapeHtml(this.text); } toString() { return this.text; } _upgradeToHyperlink(i) { this.type === e.Types.String && (this._value = l.create(e.Types.Hyperlink, this, { text: this._value.value, hyperlink: i })); } get formula() { return this._value.formula; } get result() { return this._value.result; } get formulaType() { return this._value.formulaType; } get fullAddress() { const { worksheet: i } = this._row; return { sheetName: i.name, address: this.address, row: this.row, col: this.col }; } get name() { return this.names[0]; } set name(i) { this.names = [i]; } get names() { return this.workbook.definedNames.getNamesEx(this.fullAddress); } set names(i) { const { definedNames: f } = this.workbook; f.removeAllNames(this.fullAddress), i.forEach((c) => { f.addEx(this.fullAddress, c); }); } addName(i) { this.workbook.definedNames.addEx(this.fullAddress, i); } removeName(i) { this.workbook.definedNames.removeEx(this.fullAddress, i); } removeAllNames() { this.workbook.definedNames.removeAllNames(this.fullAddress); } get _dataValidations() { return this.worksheet.dataValidations; } get dataValidation() { return this._dataValidations.find(this.address); } set dataValidation(i) { this._dataValidations.add(this.address, i); } get model() { const { model: i } = this._value; return i.style = this.style, this._comment && (i.comment = this._comment.model), i; } set model(i) { if (this._value.release(), this._value = l.create(i.type, this), this._value.model = i, i.comment) switch (i.comment.type) { case "note": this._comment = t.fromModel(i.comment); } i.style ? this.style = i.style : this.style = {}; } } e.Types = o.ValueType; const l = { getType: (n) => n == null ? e.Types.Null : n instanceof String || typeof n == "string" ? e.Types.String : typeof n == "number" ? e.Types.Number : typeof n == "boolean" ? e.Types.Boolean : n instanceof Date ? e.Types.Date : n.text && n.hyperlink ? e.Types.Hyperlink : n.formula || n.sharedFormula ? e.Types.Formula : n.richText ? e.Types.RichText : n.sharedString ? e.Types.SharedString : n.error ? e.Types.Error : e.Types.JSON, types: [{ t: e.Types.Null, f: class { constructor(n) { this.model = { address: n.address, type: e.Types.Null }; } get value() { return null; } set value(n) { } get type() { return e.Types.Null; } get effectiveType() { return e.Types.Null; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return ""; } release() { } toString() { return ""; } } }, { t: e.Types.Number, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.Number, value: i }; } get value() { return this.model.value; } set value(n) { this.model.value = n; } get type() { return e.Types.Number; } get effectiveType() { return e.Types.Number; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return this.model.value.toString(); } release() { } toString() { return this.model.value.toString(); } } }, { t: e.Types.String, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.String, value: i }; } get value() { return this.model.value; } set value(n) { this.model.value = n; } get type() { return e.Types.String; } get effectiveType() { return e.Types.String; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return `"${this.model.value.replace(/"/g, '""')}"`; } release() { } toString() { return this.model.value; } } }, { t: e.Types.Date, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.Date, value: i }; } get value() { return this.model.value; } set value(n) { this.model.value = n; } get type() { return e.Types.Date; } get effectiveType() { return e.Types.Date; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return this.model.value.toISOString(); } release() { } toString() { return this.model.value.toString(); } } }, { t: e.Types.Hyperlink, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.Hyperlink, text: i ? i.text : void 0, hyperlink: i ? i.hyperlink : void 0 }, i && i.tooltip && (this.model.tooltip = i.tooltip); } get value() { const n = { text: this.model.text, hyperlink: this.model.hyperlink }; return this.model.tooltip && (n.tooltip = this.model.tooltip), n; } set value(n) { this.model = { text: n.text, hyperlink: n.hyperlink }, n.tooltip && (this.model.tooltip = n.tooltip); } get text() { return this.model.text; } set text(n) { this.model.text = n; } get hyperlink() { return this.model.hyperlink; } set hyperlink(n) { this.model.hyperlink = n; } get type() { return e.Types.Hyperlink; } get effectiveType() { return e.Types.Hyperlink; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return this.model.hyperlink; } release() { } toString() { return this.model.text; } } }, { t: e.Types.Formula, f: class { constructor(n, i) { this.cell = n, this.model = { address: n.address, type: e.Types.Formula, shareType: i ? i.shareType : void 0, ref: i ? i.ref : void 0, formula: i ? i.formula : void 0, sharedFormula: i ? i.sharedFormula : void 0, result: i ? i.result : void 0 }; } _copyModel(n) { const i = {}, f = (c) => { const u = n[c]; u && (i[c] = u); }; return f("formula"), f("result"), f("ref"), f("shareType"), f("sharedFormula"), i; } get value() { return this._copyModel(this.model); } set value(n) { this.model = this._copyModel(n); } validate(n) { switch (l.getType(n)) { case e.Types.Null: case e.Types.String: case e.Types.Number: case e.Types.Date: break; case e.Types.Hyperlink: case e.Types.Formula: default: throw new Error("Cannot process that type of result value"); } } get dependencies() { return { ranges: this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g), cells: this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g, "").match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g) }; } get formula() { return this.model.formula || this._getTranslatedFormula(); } set formula(n) { this.model.formula = n; } get formulaType() { return this.model.formula ? o.FormulaType.Master : this.model.sharedFormula ? o.FormulaType.Shared : o.FormulaType.None; } get result() { return this.model.result; } set result(n) { this.model.result = n; } get type() { return e.Types.Formula; } get effectiveType() { const n = this.model.result; return n == null ? o.ValueType.Null : n instanceof String || typeof n == "string" ? o.ValueType.String : typeof n == "number" ? o.ValueType.Number : n instanceof Date ? o.ValueType.Date : n.text && n.hyperlink ? o.ValueType.Hyperlink : n.formula ? o.ValueType.Formula : o.ValueType.Null; } get address() { return this.model.address; } set address(n) { this.model.address = n; } _getTranslatedFormula() { if (!this._translatedFormula && this.model.sharedFormula) { const { worksheet: n } = this.cell, i = n.findCell(this.model.sharedFormula); this._translatedFormula = i && r(i.formula, i.address, this.model.address); } return this._translatedFormula; } toCsvString() { return "" + (this.model.result || ""); } release() { } toString() { return this.model.result ? this.model.result.toString() : ""; } } }, { t: e.Types.Merge, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.Merge, master: i ? i.address : void 0 }, this._master = i, i && i.addMergeRef(); } get value() { return this._master.value; } set value(n) { n instanceof e ? (this._master && this._master.releaseMergeRef(), n.addMergeRef(), this._master = n) : this._master.value = n; } isMergedTo(n) { return n === this._master; } get master() { return this._master; } get type() { return e.Types.Merge; } get effectiveType() { return this._master.effectiveType; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return ""; } release() { this._master.releaseMergeRef(); } toString() { return this.value.toString(); } } }, { t: e.Types.JSON, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.String, value: JSON.stringify(i), rawValue: i }; } get value() { return this.model.rawValue; } set value(n) { this.model.rawValue = n, this.model.value = JSON.stringify(n); } get type() { return e.Types.String; } get effectiveType() { return e.Types.String; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return this.model.value; } release() { } toString() { return this.model.value; } } }, { t: e.Types.SharedString, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.SharedString, value: i }; } get value() { return this.model.value; } set value(n) { this.model.value = n; } get type() { return e.Types.SharedString; } get effectiveType() { return e.Types.SharedString; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return this.model.value.toString(); } release() { } toString() { return this.model.value.toString(); } } }, { t: e.Types.RichText, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.String, value: i }; } get value() { return this.model.value; } set value(n) { this.model.value = n; } toString() { return this.model.value.richText.map((n) => n.text).join(""); } get type() { return e.Types.RichText; } get effectiveType() { return e.Types.RichText; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return `"${this.text.replace(/"/g, '""')}"`; } release() { } } }, { t: e.Types.Boolean, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.Boolean, value: i }; } get value() { return this.model.value; } set value(n) { this.model.value = n; } get type() { return e.Types.Boolean; } get effectiveType() { return e.Types.Boolean; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return this.model.value ? 1 : 0; } release() { } toString() { return this.model.value.toString(); } } }, { t: e.Types.Error, f: class { constructor(n, i) { this.model = { address: n.address, type: e.Types.Error, value: i }; } get value() { return this.model.value; } set value(n) { this.model.value = n; } get type() { return e.Types.Error; } get effectiveType() { return e.Types.Error; } get address() { return this.model.address; } set address(n) { this.model.address = n; } toCsvString() { return this.toString(); } release() { } toString() { return this.model.value.error.toString(); } } }].reduce((n, i) => (n[i.t] = i.f, n), []), create(n, i, f) { const c = this.types[n]; if (!c) throw new Error("Could not create Value of type " + n); return new c(i, f); } }; T.exports = e; }, { "../utils/col-cache": 19, "../utils/shared-formula": 23, "../utils/under-dash": 26, "./enums": 7, "./note": 9 }], 4: [function(s, T, S) { const m = s("../utils/under-dash"), a = s("./enums"), o = s("../utils/col-cache"); class r { constructor(e, l, n) { this._worksheet = e, this._number = l, n !== !1 && (this.defn = n); } get number() { return this._number; } get worksheet() { return this._worksheet; } get letter() { return o.n2l(this._number); } get isCustomWidth() { return this.width !== void 0 && this.width !== 9; } get defn() { return { header: this._header, key: this.key, width: this.width, style: this.style, hidden: this.hidden, outlineLevel: this.outlineLevel }; } set defn(e) { e ? (this.key = e.key, this.width = e.width !== void 0 ? e.width : 9, this.outlineLevel = e.outlineLevel, e.style ? this.style = e.style : this.style = {}, this.header = e.header, this._hidden = !!e.hidden) : (delete this._header, delete this._key, delete this.width, this.style = {}, this.outlineLevel = 0); } get headers() { return this._header && this._header instanceof Array ? this._header : [this._header]; } get header() { return this._header; } set header(e) { e !== void 0 ? (this._header = e, this.headers.forEach((l, n) => { this._worksheet.getCell(n + 1, this.number).value = l; })) : this._header = void 0; } get key() { return this._key; } set key(e) { (this._key && this._worksheet.getColumnKey(this._key)) === this && this._worksheet.deleteColumnKey(this._key), this._key = e, e && this._worksheet.setColumnKey(this._key, this); } get hidden() { return !!this._hidden; } set hidden(e) { this._hidden = e; } get outlineLevel() { return this._outlineLevel || 0; } set outlineLevel(e) { this._outlineLevel = e; } get collapsed() { return !!(this._outlineLevel && this._outlineLevel >= this._worksheet.properties.outlineLevelCol); } toString() { return JSON.stringify({ key: this.key, width: this.width, headers: this.headers.length ? this.headers : void 0 }); } equivalentTo(e) { return this.width === e.width && this.hidden === e.hidden && this.outlineLevel === e.outlineLevel && m.isEqual(this.style, e.style); } get isDefault() { if (this.isCustomWidth || this.hidden || this.outlineLevel) return !1; const e = this.style; return !e || !(e.font || e.numFmt || e.alignment || e.border || e.fill || e.protection); } get headerCount() { return this.headers.length; } eachCell(e, l) { const n = this.number; l || (l = e, e = null), this._worksheet.eachRow(e, (i, f) => { l(i.getCell(n), f); }); } get values() { const e = []; return this.eachCell((l, n) => { l && l.type !== a.ValueType.Null && (e[n] = l.value); }), e; } set values(e) { if (!e) return; const l = this.number; let n = 0; e.hasOwnProperty("0") && (n = 1), e.forEach((i, f) => { this._worksheet.getCell(f + n, l).value = i; }); } _applyStyle(e, l) { return this.style[e] = l, this.eachCell((n) => { n[e] = l; }), l; } get numFmt() { return this.style.numFmt; } set numFmt(e) { this._applyStyle("numFmt", e); } get font() { return this.style.font; } set font(e) { this._applyStyle("font", e); } get alignment() { return this.style.alignment; } set alignment(e) { this._applyStyle("alignment", e); } get protection() { return this.style.protection; } set protection(e) { this._applyStyle("protection", e); } get border() { return this.style.border; } set border(e) { this._applyStyle("border", e); } get fill() { return this.style.fill; } set fill(e) { this._applyStyle("fill", e); } static toModel(e) { const l = []; let n = null; return e && e.forEach((i, f) => { i.isDefault ? n && (n = null) : n && i.equivalentTo(n) ? n.max = f + 1 : (n = { min: f + 1, max: f + 1, width: i.width !== void 0 ? i.width : 9, style: i.style, isCustomWidth: i.isCustomWidth, hidden: i.hidden, outlineLevel: i.outlineLevel, collapsed: i.collapsed }, l.push(n)); }), l.length ? l : void 0; } static fromModel(e, l) { const n = []; let i = 1, f = 0; for (l = (l = l || []).sort(function(c, u) { return c.min - u.min; }); f < l.length; ) { const c = l[f++]; for (; i < c.min; ) n.push(new r(e, i++)); for (; i <= c.max; ) n.push(new r(e, i++, c)); } return n.length ? n : null; } } T.exports = r; }, { "../utils/col-cache": 19, "../utils/under-dash": 26, "./enums": 7 }], 5: [function(s, T, S) { T.exports = class { constructor(m) { this.model = m || {}; } add(m, a) { return this.model[m] = a; } find(m) { return this.model[m]; } remove(m) { this.model[m] = void 0; } }; }, {}], 6: [function(s, T, S) { const m = s("../utils/under-dash"), a = s("../utils/col-cache"), o = s("../utils/cell-matrix"), r = s("./range"), t = /[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/; T.exports = class { constructor() { this.matrixMap = {}; } getMatrix(e) { return this.matrixMap[e] || (this.matrixMap[e] = new o()); } add(e, l) { const n = a.decodeEx(e); this.addEx(n, l); } addEx(e, l) { const n = this.getMatrix(l); if (e.top) for (let i = e.left; i <= e.right; i++) for (let f = e.top; f <= e.bottom; f++) { const c = { sheetName: e.sheetName, address: a.n2l(i) + f, row: f, col: i }; n.addCellEx(c); } else n.addCellEx(e); } remove(e, l) { const n = a.decodeEx(e); this.removeEx(n, l); } removeEx(e, l) { this.getMatrix(l).removeCellEx(e); } removeAllNames(e) { m.each(this.matrixMap, (l) => { l.removeCellEx(e); }); } forEach(e) { m.each(this.matrixMap, (l, n) => { l.forEach((i) => { e(n, i); }); }); } getNames(e) { return this.getNamesEx(a.decodeEx(e)); } getNamesEx(e) { return m.map(this.matrixMap, (l, n) => l.findCellEx(e) && n).filter(Boolean); } _explore(e, l) { l.mark = !1; const { sheetName: n } = l, i = new r(l.row, l.col, l.row, l.col, n); let f, c; function u(h, w) { const _ = e.findCellAt(n, h, l.col); return !(!_ || !_.mark) && (i[w] = h, _.mark = !1, !0); } for (c = l.row - 1; u(c, "top"); c--) ; for (c = l.row + 1; u(c, "bottom"); c++) ; function d(h, w) { const _ = []; for (c = i.top; c <= i.bottom; c++) { const A = e.findCellAt(n, c, h); if (!A || !A.mark) return !1; _.push(A); } i[w] = h; for (let A = 0; A < _.length; A++) _[A].mark = !1; return !0; } for (f = l.col - 1; d(f, "left"); f--) ; for (f = l.col + 1; d(f, "right"); f++) ; return i; } getRanges(e, l) { return (l = l || this.matrixMap[e]) ? (l.forEach((n) => { n.mark = !0; }), { name: e, ranges: l.map((n) => n.mark && this._explore(l, n)).filter(Boolean).map((n) => n.$shortRange) }) : { name: e, ranges: [] }; } normaliseMatrix(e, l) { e.forEachInSheet(l, (n, i, f) => { n && (n.row === i && n.col === f || (n.row = i, n.col = f, n.address = a.n2l(f) + i)); }); } spliceRows(e, l, n, i) { m.each(this.matrixMap, (f) => { f.spliceRows(e, l, n, i), this.normaliseMatrix(f, e); }); } spliceColumns(e, l, n, i) { m.each(this.matrixMap, (f) => { f.spliceColumns(e, l, n, i), this.normaliseMatrix(f, e); }); } get model() { return m.map(this.matrixMap, (e, l) => this.getRanges(l, e)).filter((e) => e.ranges.length); } set model(e) { const l = this.matrixMap = {}; e.forEach((n) => { const i = l[n.name] = new o(); n.ranges.forEach((f) => { t.test(f.split("!").pop() || "") && i.addCell(f); }); }); } }; }, { "../utils/cell-matrix": 18, "../utils/col-cache": 19, "../utils/under-dash": 26, "./range": 10 }], 7: [function(s, T, S) { T.exports = { ValueType: { Null: 0, Merge: 1, Number: 2, String: 3, Date: 4, Hyperlink: 5, Formula: 6, SharedString: 7, RichText: 8, Boolean: 9, Error: 10 }, FormulaType: { None: 0, Master: 1, Shared: 2 }, RelationshipType: { None: 0, OfficeDocument: 1, Worksheet: 2, CalcChain: 3, SharedStrings: 4, Styles: 5, Theme: 6, Hyperlink: 7 }, DocumentType: { Xlsx: 1 }, ReadingOrder: { LeftToRight: 1, RightToLeft: 2 }, ErrorValue: { NotApplicable: "#N/A", Ref: "#REF!", Name: "#NAME?", DivZero: "#DIV/0!", Null: "#NULL!", Value: "#VALUE!", Num: "#NUM!" } }; }, {}], 8: [function(s, T, S) { const m = s("../utils/col-cache"), a = s("./anchor"); T.exports = class { constructor(o, r) { this.worksheet = o, this.model = r; } get model() { switch (this.type) { case "background": return { type: this.type, imageId: this.imageId }; case "image": return { type: this.type, imageId: this.imageId, hyperlinks: this.range.hyperlinks, range: { tl: this.range.tl.model, br: this.range.br && this.range.br.model, ext: this.range.ext, editAs: this.range.editAs } }; default: throw new Error("Invalid Image Type"); } } set model(o) { let { type: r, imageId: t, range: e, hyperlinks: l } = o; if (this.type = r, this.imageId = t, r === "image") if (typeof e == "string") { const n = m.decode(e); this.range = { tl: new a(this.worksheet, { col: n.left, row: n.top }, -1), br: new a(this.worksheet, { col: n.right, row: n.bottom }, 0), editAs: "oneCell" }; } else this.range = { tl: new a(this.worksheet, e.tl, 0), br: e.br && new a(this.worksheet, e.br, 0), ext: e.ext, editAs: e.editAs, hyperlinks: l || e.hyperlinks }; } }; }, { "../utils/col-cache": 19, "./anchor": 2 }], 9: [function(s, T, S) { const m = s("../utils/under-dash"); class a { constructor(r) { this.note = r; } get model() { let r = null; switch (typeof this.note) { case "string": r = { type: "note", note: { texts: [{ text: this.note }] } }; break; default: r = { type: "note", note: this.note }; } return m.deepMerge({}, a.DEFAULT_CONFIGS, r); } set model(r) { const { note: t } = r, { texts: e } = t; e.length === 1 && Object.keys(e[0]).length === 1 ? this.note = e[0].text : this.note = t; } static fromModel(r) { const t = new a(); return t.model = r, t; } } a.DEFAULT_CONFIGS = { note: { margins: { insetmode: "auto", inset: [0.13, 0.13, 0.25, 0.25] }, protection: { locked: "True", lockText: "True" }, editAs: "absolute" } }, T.exports = a; }, { "../utils/under-dash": 26 }], 10: [function(s, T, S) { const m = s("../utils/col-cache"); class a { constructor() { this.decode(arguments); } setTLBR(r, t, e, l, n) { if (arguments.length < 4) { const i = m.decodeAddress(r), f = m.decodeAddress(t); this.model = { top: Math.min(i.row, f.row), left: Math.min(i.col, f.col), bottom: Math.max(i.row, f.row), right: Math.max(i.col, f.col), sheetName: e }, this.setTLBR(i.row, i.col, f.row, f.col, n); } else this.model = { top: Math.min(r, e), left: Math.min(t, l), bottom: Math.max(r, e), right: Math.max(t, l), sheetName: n }; } decode(r) { switch (r.length) { case 5: this.setTLBR(r[0], r[1], r[2], r[3], r[4]); break; case 4: this.setTLBR(r[0], r[1], r[2], r[3]); break; case 3: this.setTLBR(r[0], r[1], r[2]); break; case 2: this.setTLBR(r[0], r[1]); break; case 1: { const t = r[0]; if (t instanceof a) this.model = { top: t.model.top, left: t.model.left, bottom: t.model.bottom, right: t.model.right, sheetName: t.sheetName }; else if (t instanceof Array) this.decode(t); else if (t.top && t.left && t.bottom && t.right) this.model = { top: t.top, left: t.left, bottom: t.bottom, right: t.right, sheetName: t.sheetName }; else { const e = m.decodeEx(t); e.top ? this.model = { top: e.top, left: e.left, bottom: e.bottom, right: e.right, sheetName: e.sheetName } : this.model = { top: e.row, left: e.col, bottom: e.row, right: e.col, sheetName: e.sheetName }; } break; } case 0: this.model = { top: 0, left: 0, bottom: 0, right: 0 }; break; default: throw new Error("Invalid number of arguments to _getDimensions() - " + r.length); } } get top() { return this.model.top || 1; } set top(r) { this.model.top = r; } get left() { return this.model.left || 1; } set left(r) { this.model.left = r; } get bottom() { return this.model.bottom || 1; } set bottom(r) { this.model.bottom = r; } get right() { return this.model.right || 1; } set right(r) { this.model.right = r; } get sheetName() { return this.model.sheetName; } set sheetName(r) { this.model.sheetName = r; } get _serialisedSheetName() { const { sheetName: r } = this.model; return r ? /^[a-zA-Z0-9]*$/.test(r) ? r + "!" : `'${r}'!` : ""; } expand(r, t, e, l) { (!this.model.top || r < this.top) && (this.top = r), (!this.model.left || t < this.left) && (this.left = t), (!this.model.bottom || e > this.bottom) && (this.bottom = e), (!this.model.right || l > this.right) && (this.right = l); } expandRow(r) { if (r) { const { dimensions: t, number: e } = r; t && this.expand(e, t.min, e, t.max); } } expandToAddress(r) { const t = m.decodeEx(r); this.expand(t.row, t.col, t.row, t.col); } get tl() { return m.n2l(this.left) + this.top; } get $t$l() { return `$${m.n2l(this.left)}$${this.top}`; } get br() { return m.n2l(this.right) + this.bottom; } get $b$r() { return `$${m.n2l(this.right)}$${this.bottom}`; } get range() { return `${this._serialisedSheetName + this.tl}:${this.br}`; } get $range() { return `${this._serialisedSheetName + this.$t$l}:${this.$b$r}`; } get shortRange() { return this.count > 1 ? this.range : this._serialisedSheetName + this.tl; } get $shortRange() { return this.count > 1 ? this.$range : this._serialisedSheetName + this.$t$l; } get count() { return (1 + this.bottom - this.top) * (1 + this.right - this.left); } toString() { return this.range; } intersects(r) { return (!r.sheetName || !this.sheetName || r.sheetName === this.sheetName) && !(r.bottom < this.top) && !(r.top > this.bottom) && !(r.right < this.left) && !(r.left > this.right); } contains(r) { const t = m.decodeEx(r); return this.containsEx(t); } containsEx(r) { return (!r.sheetName || !this.sheetName || r.sheetName === this.sheetName) && r.row >= this.top && r.row <= this.bottom && r.col >= this.left && r.col <= this.right; } forEachAddress(r) { for (let t = this.left; t <= this.right; t++) for (let e = this.top; e <= this.bottom; e++) r(m.encodeAddress(e, t), e, t); } } T.exports = a; }, { "../utils/col-cache": 19 }], 11: [function(s, T, S) { const m = s("../utils/under-dash"), a = s("./enums"), o = s("../utils/col-cache"), r = s("./cell"); T.exports = class { constructor(t, e) { this._worksheet = t, this._number = e, this._cells = [], this.style = {}, this.outlineLevel = 0; } get number() { return this._number; } get worksheet() { return this._worksheet; } commit() { this._worksheet._commitRow(this); } destroy() { delete this._worksheet, delete this._cells, delete this.style; } findCell(t) { return this._cells[t - 1]; } getCellEx(t) { let e = this._cells[t.col - 1]; if (!e) { const l = this._worksheet.getColumn(t.col); e = new r(this, l, t.address), this._cells[t.col - 1] = e; } return e; } getCell(t) { if (typeof t == "string") { const e = this._worksheet.getColumnKey(t); t = e ? e.number : o.l2n(t); } return this._cells[t - 1] || this.getCellEx({ address: o.encodeAddress(this._number, t), row: this._number, col: t }); } splice(t, e) { const l = t + e; for (var n = arguments.length, i = new Array(n > 2 ? n - 2 : 0), f = 2; f < n; f++) i[f - 2] = arguments[f]; const c = i.length - e, u = this._cells.length; let d, h, w; if (c < 0) for (d = t + i.length; d <= u; d++) w = this._cells[d - 1], h = this._cells[d - c - 1], h ? (w = this.getCell(d), w.value = h.value, w.style = h.style, w._comment = h._comment) : w && (w.value = null, w.style = {}, w._comment = void 0); else if (c > 0) for (d = u; d >= l; d--) h = this._cells[d - 1], h ? (w = this.getCell(d + c), w.value = h.value, w.style = h.style, w._comment = h._comment) : this._cells[d + c - 1] = void 0; for (d = 0; d < i.length; d++) w = this.getCell(t + d), w.value = i[d], w.style = {}, w._comment = void 0; } eachCell(t, e) { if (e || (e = t, t = null), t && t.includeEmpty) { const l = this._cells.length; for (let n = 1; n <= l; n++) e(this.getCell(n), n); } else this._cells.forEach((