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