@lotics/cli 0.224.0 → 0.226.0
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/dist/probe_page.js +4 -2
- package/dist/render_page.js +377 -341
- package/dist/src/cli.js +50986 -40534
- package/dist/src/cli.js.LEGAL.txt +16 -0
- package/docs/building_an_app.md +2 -1
- package/docs/cli_reference.md +5 -5
- package/package.json +1 -1
package/dist/render_page.js
CHANGED
|
@@ -27225,12 +27225,140 @@ ${e.toString()}`);
|
|
|
27225
27225
|
// ../ooxml/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js
|
|
27226
27226
|
var json2xml_default = Builder;
|
|
27227
27227
|
|
|
27228
|
+
// ../office-io/src/ole.ts
|
|
27229
|
+
var OLE2_MAGIC = [208, 207, 17, 224, 161, 177, 26, 225];
|
|
27230
|
+
var ENDOFCHAIN = 4294967294;
|
|
27231
|
+
var FREESECT = 4294967295;
|
|
27232
|
+
function isOle2(bytes) {
|
|
27233
|
+
return bytes.length >= 8 && OLE2_MAGIC.every((b, i3) => bytes[i3] === b);
|
|
27234
|
+
}
|
|
27235
|
+
function readCfbStreams(bytes) {
|
|
27236
|
+
const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
27237
|
+
const u163 = (o) => dv.getUint16(o, true);
|
|
27238
|
+
const u322 = (o) => dv.getUint32(o, true);
|
|
27239
|
+
const sectorSize = 1 << u163(30);
|
|
27240
|
+
const miniSectorSize = 1 << u163(32);
|
|
27241
|
+
const firstDirSector = u322(48);
|
|
27242
|
+
const miniCutoff = u322(56);
|
|
27243
|
+
const firstMiniFatSector = u322(60);
|
|
27244
|
+
const firstDifatSector = u322(68);
|
|
27245
|
+
if (sectorSize < 512 || sectorSize > 1 << 20) {
|
|
27246
|
+
throw new Error("Unsupported OLE2 file: invalid sector size");
|
|
27247
|
+
}
|
|
27248
|
+
const sectorOffset = (n) => sectorSize * (n + 1);
|
|
27249
|
+
const maxSectors = Math.ceil(bytes.length / sectorSize) + 1;
|
|
27250
|
+
const difat = [];
|
|
27251
|
+
for (let i3 = 0; i3 < 109; i3++) {
|
|
27252
|
+
const v = u322(76 + i3 * 4);
|
|
27253
|
+
if (v !== FREESECT) difat.push(v);
|
|
27254
|
+
}
|
|
27255
|
+
let ds = firstDifatSector;
|
|
27256
|
+
const entriesPerSector = sectorSize / 4;
|
|
27257
|
+
const seenDifat = /* @__PURE__ */ new Set();
|
|
27258
|
+
while (ds !== ENDOFCHAIN && ds !== FREESECT && ds < maxSectors && !seenDifat.has(ds)) {
|
|
27259
|
+
seenDifat.add(ds);
|
|
27260
|
+
const base2 = sectorOffset(ds);
|
|
27261
|
+
for (let i3 = 0; i3 < entriesPerSector - 1; i3++) {
|
|
27262
|
+
const v = u322(base2 + i3 * 4);
|
|
27263
|
+
if (v !== FREESECT) difat.push(v);
|
|
27264
|
+
}
|
|
27265
|
+
ds = u322(base2 + (entriesPerSector - 1) * 4);
|
|
27266
|
+
}
|
|
27267
|
+
const fat = [];
|
|
27268
|
+
for (const fatSector of difat) {
|
|
27269
|
+
if (fat.length >= maxSectors) break;
|
|
27270
|
+
if (fatSector >= maxSectors) continue;
|
|
27271
|
+
const base2 = sectorOffset(fatSector);
|
|
27272
|
+
for (let i3 = 0; i3 < entriesPerSector && fat.length < maxSectors; i3++) {
|
|
27273
|
+
fat.push(u322(base2 + i3 * 4));
|
|
27274
|
+
}
|
|
27275
|
+
}
|
|
27276
|
+
const readChain = (src, start, size, ss, offOf, chain) => {
|
|
27277
|
+
const maxSectors2 = Math.floor(src.length / ss) + 2;
|
|
27278
|
+
const parts = [];
|
|
27279
|
+
let s = start;
|
|
27280
|
+
for (let guard = 0; s !== ENDOFCHAIN && s !== FREESECT && s < chain.length && guard < maxSectors2; guard++) {
|
|
27281
|
+
const o = offOf(s);
|
|
27282
|
+
parts.push(src.subarray(o, o + ss));
|
|
27283
|
+
s = chain[s];
|
|
27284
|
+
}
|
|
27285
|
+
const merged = concat(parts);
|
|
27286
|
+
return size != null ? merged.subarray(0, size) : merged;
|
|
27287
|
+
};
|
|
27288
|
+
const readBig = (start, size) => readChain(bytes, start, size, sectorSize, sectorOffset, fat);
|
|
27289
|
+
const dirBytes = readBig(firstDirSector, null);
|
|
27290
|
+
const ddv = new DataView(dirBytes.buffer, dirBytes.byteOffset, dirBytes.byteLength);
|
|
27291
|
+
const dir = [];
|
|
27292
|
+
for (let off = 0; off + 128 <= dirBytes.length; off += 128) {
|
|
27293
|
+
const nameLen = ddv.getUint16(off + 64, true);
|
|
27294
|
+
const type = ddv.getUint8(off + 66);
|
|
27295
|
+
if (nameLen < 2 || type === 0) continue;
|
|
27296
|
+
const name2 = utf16le(dirBytes.subarray(off, off + nameLen - 2));
|
|
27297
|
+
dir.push({ name: name2, type, start: ddv.getUint32(off + 116, true), size: Number(ddv.getBigUint64(off + 120, true)) });
|
|
27298
|
+
}
|
|
27299
|
+
const root = dir.find((e) => e.type === 5);
|
|
27300
|
+
const miniStream = root ? readBig(root.start, root.size) : new Uint8Array(0);
|
|
27301
|
+
const miniFatBytes = readBig(firstMiniFatSector, null);
|
|
27302
|
+
const miniFat = [];
|
|
27303
|
+
for (let i3 = 0; i3 + 4 <= miniFatBytes.length; i3 += 4) miniFat.push(miniFatBytes[i3] | miniFatBytes[i3 + 1] << 8 | miniFatBytes[i3 + 2] << 16 | miniFatBytes[i3 + 3] << 24);
|
|
27304
|
+
const readMini = (start, size) => readChain(miniStream, start, size, miniSectorSize, (n) => n * miniSectorSize, miniFat);
|
|
27305
|
+
const readStream = (e) => e.size >= miniCutoff ? readBig(e.start, e.size) : readMini(e.start, e.size);
|
|
27306
|
+
return dir.filter((e) => e.type === 2).map((e) => ({ name: e.name, bytes: readStream(e) }));
|
|
27307
|
+
}
|
|
27308
|
+
function utf16le(b) {
|
|
27309
|
+
let s = "";
|
|
27310
|
+
for (let i3 = 0; i3 + 1 < b.length; i3 += 2) s += String.fromCharCode(b[i3] | b[i3 + 1] << 8);
|
|
27311
|
+
return s;
|
|
27312
|
+
}
|
|
27313
|
+
function concat(parts) {
|
|
27314
|
+
let total = 0;
|
|
27315
|
+
for (const p of parts) total += p.length;
|
|
27316
|
+
const out = new Uint8Array(total);
|
|
27317
|
+
let o = 0;
|
|
27318
|
+
for (const p of parts) {
|
|
27319
|
+
out.set(p, o);
|
|
27320
|
+
o += p.length;
|
|
27321
|
+
}
|
|
27322
|
+
return out;
|
|
27323
|
+
}
|
|
27324
|
+
|
|
27325
|
+
// ../office-io/src/password_protected_error.ts
|
|
27326
|
+
var PasswordProtectedError = class extends Error {
|
|
27327
|
+
constructor() {
|
|
27328
|
+
super("This file is password-protected and cannot be previewed");
|
|
27329
|
+
this.name = "PasswordProtectedError";
|
|
27330
|
+
}
|
|
27331
|
+
};
|
|
27332
|
+
|
|
27333
|
+
// ../office-io/src/xml_text.ts
|
|
27334
|
+
var REFERENCE = /&(?:#(\d+)|#x([0-9a-fA-F]+)|(lt|gt|amp|quot|apos));/g;
|
|
27335
|
+
var PREDEFINED = { lt: "<", gt: ">", amp: "&", quot: '"', apos: "'" };
|
|
27336
|
+
function isXmlChar(cp) {
|
|
27337
|
+
return cp === 9 || cp === 10 || cp === 13 || cp >= 32 && cp <= 55295 || cp >= 57344 && cp <= 65533 || cp >= 65536 && cp <= 1114111;
|
|
27338
|
+
}
|
|
27339
|
+
function decodeXmlText(text) {
|
|
27340
|
+
if (!text.includes("&")) return text;
|
|
27341
|
+
return text.replace(REFERENCE, (ref2, dec, hex, name2) => {
|
|
27342
|
+
if (name2 !== void 0) return PREDEFINED[name2];
|
|
27343
|
+
const cp = dec !== void 0 ? parseInt(dec, 10) : parseInt(hex ?? "", 16);
|
|
27344
|
+
if (!isXmlChar(cp)) {
|
|
27345
|
+
throw new Error(`XML character reference ${ref2} names no legal XML character \u2014 the part is not well-formed XML`);
|
|
27346
|
+
}
|
|
27347
|
+
return String.fromCodePoint(cp);
|
|
27348
|
+
});
|
|
27349
|
+
}
|
|
27350
|
+
|
|
27228
27351
|
// ../ooxml/src/xml.ts
|
|
27229
27352
|
var parserOptions = {
|
|
27230
27353
|
preserveOrder: true,
|
|
27231
27354
|
ignoreAttributes: false,
|
|
27232
27355
|
parseTagValue: false,
|
|
27233
|
-
trimValues: false
|
|
27356
|
+
trimValues: false,
|
|
27357
|
+
// The builder escapes on write, so every value must leave the parser fully
|
|
27358
|
+
// decoded — `decodeXmlText` says why the parser's own decoding falls short.
|
|
27359
|
+
processEntities: false,
|
|
27360
|
+
tagValueProcessor: (_tag, value2) => decodeXmlText(value2),
|
|
27361
|
+
attributeValueProcessor: (_name, value2) => decodeXmlText(value2)
|
|
27234
27362
|
};
|
|
27235
27363
|
var builderOptions = {
|
|
27236
27364
|
preserveOrder: true,
|
|
@@ -51960,6 +52088,35 @@ ${e.toString()}`);
|
|
|
51960
52088
|
}
|
|
51961
52089
|
};
|
|
51962
52090
|
|
|
52091
|
+
// ../xlsx/src/malformed_part_error.ts
|
|
52092
|
+
var MalformedPartError = class extends Error {
|
|
52093
|
+
constructor(reason) {
|
|
52094
|
+
super(
|
|
52095
|
+
`${reason} \u2014 the file is not a readable spreadsheet. If it opens in Excel, the reader is at fault: report the producer that wrote it.`
|
|
52096
|
+
);
|
|
52097
|
+
this.name = "MalformedPartError";
|
|
52098
|
+
}
|
|
52099
|
+
};
|
|
52100
|
+
|
|
52101
|
+
// ../xlsx/src/xml_entities.ts
|
|
52102
|
+
var XSTRING_ESCAPE = /_x([0-9A-Fa-f]{4})_/g;
|
|
52103
|
+
function decodeXstring(text) {
|
|
52104
|
+
if (!text.includes("_x")) return text;
|
|
52105
|
+
return text.replace(XSTRING_ESCAPE, (_match, hex) => String.fromCharCode(parseInt(hex, 16)));
|
|
52106
|
+
}
|
|
52107
|
+
var decodeXml = (_name, value2) => decodeXmlText(value2);
|
|
52108
|
+
var decodeSpreadsheetMl = (_name, value2) => decodeXstring(decodeXmlText(value2));
|
|
52109
|
+
var DECODED_XML_VALUES = {
|
|
52110
|
+
processEntities: false,
|
|
52111
|
+
tagValueProcessor: decodeXml,
|
|
52112
|
+
attributeValueProcessor: decodeXml
|
|
52113
|
+
};
|
|
52114
|
+
var DECODED_SPREADSHEETML_VALUES = {
|
|
52115
|
+
processEntities: false,
|
|
52116
|
+
tagValueProcessor: decodeSpreadsheetMl,
|
|
52117
|
+
attributeValueProcessor: decodeSpreadsheetMl
|
|
52118
|
+
};
|
|
52119
|
+
|
|
51963
52120
|
// ../xlsx/src/ooxml_color.ts
|
|
51964
52121
|
var DEFAULT_INDEXED_COLORS = [
|
|
51965
52122
|
"000000",
|
|
@@ -52038,7 +52195,7 @@ ${e.toString()}`);
|
|
|
52038
52195
|
var xmlParser = new XMLParser2({
|
|
52039
52196
|
ignoreAttributes: false,
|
|
52040
52197
|
attributeNamePrefix: "@_",
|
|
52041
|
-
|
|
52198
|
+
...DECODED_XML_VALUES,
|
|
52042
52199
|
isArray: (tagName) => tagName === "a:srgbClr" || tagName === "a:sysClr"
|
|
52043
52200
|
});
|
|
52044
52201
|
function parseTheme(themeXml) {
|
|
@@ -52219,9 +52376,179 @@ ${e.toString()}`);
|
|
|
52219
52376
|
return p;
|
|
52220
52377
|
}
|
|
52221
52378
|
|
|
52222
|
-
// ../xlsx/src/
|
|
52223
|
-
|
|
52224
|
-
|
|
52379
|
+
// ../xlsx/src/ooxml_workbook.ts
|
|
52380
|
+
var xmlParser2 = new XMLParser2({
|
|
52381
|
+
ignoreAttributes: false,
|
|
52382
|
+
attributeNamePrefix: "@_",
|
|
52383
|
+
// A producer may bind spreadsheetml to a prefix (`<x:workbook>`) rather than
|
|
52384
|
+
// making it the default namespace; the prefix carries no meaning, so it is
|
|
52385
|
+
// dropped before anything looks a tag up — see `stripNsPrefix`.
|
|
52386
|
+
transformTagName: stripNsPrefix,
|
|
52387
|
+
// Shared-string and workbook text is textual BY DEFINITION (tax IDs, phone
|
|
52388
|
+
// numbers, account codes, sheet/defined names). fast-xml-parser's default tag
|
|
52389
|
+
// coercion would parse `<t>0312345678</t>` as the number 312345678 — silently
|
|
52390
|
+
// dropping the leading zero before we can read it. Cell `<v>` numerics are
|
|
52391
|
+
// parsed deliberately (parseFloat) in ooxml_sheet.ts, so this never affects them.
|
|
52392
|
+
parseTagValue: false,
|
|
52393
|
+
trimValues: false,
|
|
52394
|
+
...DECODED_SPREADSHEETML_VALUES,
|
|
52395
|
+
isArray: (tagName) => tagName === "sheet" || tagName === "si" || tagName === "r" || tagName === "definedName"
|
|
52396
|
+
});
|
|
52397
|
+
var relsParser = new XMLParser2({
|
|
52398
|
+
ignoreAttributes: false,
|
|
52399
|
+
attributeNamePrefix: "@_",
|
|
52400
|
+
transformTagName: stripNsPrefix,
|
|
52401
|
+
...DECODED_XML_VALUES,
|
|
52402
|
+
isArray: (tagName) => tagName === "Relationship"
|
|
52403
|
+
});
|
|
52404
|
+
function parseWorkbook(workbookXml) {
|
|
52405
|
+
const doc3 = xmlParser2.parse(workbookXml);
|
|
52406
|
+
const wb = doc3?.["workbook"];
|
|
52407
|
+
if (!wb) throw new MalformedPartError("xl/workbook.xml has no <workbook> root");
|
|
52408
|
+
const sheetsEl = wb["sheets"];
|
|
52409
|
+
const sheetArr = sheetsEl?.["sheet"];
|
|
52410
|
+
const sheets = (sheetArr ?? []).map((s) => ({
|
|
52411
|
+
name: s["@_name"] ?? "Sheet",
|
|
52412
|
+
rId: s["@_r:id"] ?? "",
|
|
52413
|
+
state: s["@_state"]
|
|
52414
|
+
}));
|
|
52415
|
+
let activeSheetIndex = 0;
|
|
52416
|
+
const bookViews = wb["bookViews"];
|
|
52417
|
+
if (bookViews) {
|
|
52418
|
+
const wbView = bookViews["workbookView"];
|
|
52419
|
+
if (wbView) {
|
|
52420
|
+
const activeTab = (Array.isArray(wbView) ? wbView[0] : wbView)?.["@_activeTab"];
|
|
52421
|
+
if (activeTab !== void 0) {
|
|
52422
|
+
activeSheetIndex = parseInt(activeTab, 10);
|
|
52423
|
+
if (isNaN(activeSheetIndex)) activeSheetIndex = 0;
|
|
52424
|
+
}
|
|
52425
|
+
}
|
|
52426
|
+
}
|
|
52427
|
+
const wp = wb["workbookPr"];
|
|
52428
|
+
const date1904 = wp?.["@_date1904"] === "1" || wp?.["@_date1904"] === "true";
|
|
52429
|
+
const calcPr = wb["calcPr"];
|
|
52430
|
+
const fullCalcOnLoad = calcPr?.["@_fullCalcOnLoad"] === "1" || calcPr?.["@_fullCalcOnLoad"] === "true";
|
|
52431
|
+
const namedRanges = /* @__PURE__ */ new Map();
|
|
52432
|
+
const printTitlesBySheet = /* @__PURE__ */ new Map();
|
|
52433
|
+
const defNamesEl = wb["definedNames"];
|
|
52434
|
+
if (defNamesEl) {
|
|
52435
|
+
const raw = defNamesEl["definedName"];
|
|
52436
|
+
const defArr = Array.isArray(raw) ? raw : raw && typeof raw === "object" ? [raw] : [];
|
|
52437
|
+
for (const dn of defArr) {
|
|
52438
|
+
const name2 = dn["@_name"];
|
|
52439
|
+
const text = dn["#text"];
|
|
52440
|
+
if (!name2 || !text) continue;
|
|
52441
|
+
const localSheetIdRaw = dn["@_localSheetId"];
|
|
52442
|
+
if (name2 === "_xlnm.Print_Titles" && localSheetIdRaw !== void 0) {
|
|
52443
|
+
const idx = parseInt(localSheetIdRaw, 10);
|
|
52444
|
+
if (!Number.isNaN(idx)) printTitlesBySheet.set(idx, text);
|
|
52445
|
+
continue;
|
|
52446
|
+
}
|
|
52447
|
+
namedRanges.set(name2, text);
|
|
52448
|
+
}
|
|
52449
|
+
}
|
|
52450
|
+
return { sheets, activeSheetIndex, date1904, namedRanges, printTitlesBySheet, fullCalcOnLoad };
|
|
52451
|
+
}
|
|
52452
|
+
function parseWorkbookRels(relsXml) {
|
|
52453
|
+
const doc3 = relsParser.parse(relsXml);
|
|
52454
|
+
const rels = doc3?.["Relationships"];
|
|
52455
|
+
if (!rels) return /* @__PURE__ */ new Map();
|
|
52456
|
+
const relArr = rels["Relationship"];
|
|
52457
|
+
if (!relArr) return /* @__PURE__ */ new Map();
|
|
52458
|
+
const map3 = /* @__PURE__ */ new Map();
|
|
52459
|
+
for (const rel of relArr) {
|
|
52460
|
+
const id = rel["@_Id"];
|
|
52461
|
+
const target = rel["@_Target"];
|
|
52462
|
+
if (id && target) {
|
|
52463
|
+
map3.set(id, target);
|
|
52464
|
+
}
|
|
52465
|
+
}
|
|
52466
|
+
return map3;
|
|
52467
|
+
}
|
|
52468
|
+
function parseSharedStrings(ssXml, theme, indexedColors) {
|
|
52469
|
+
const doc3 = xmlParser2.parse(ssXml);
|
|
52470
|
+
const sst = doc3?.["sst"];
|
|
52471
|
+
if (!sst) return [];
|
|
52472
|
+
const siArr = sst["si"];
|
|
52473
|
+
if (!siArr) return [];
|
|
52474
|
+
return siArr.map((si) => parseStringItem(si, theme, indexedColors));
|
|
52475
|
+
}
|
|
52476
|
+
function parseStringItem(si, theme, indexedColors) {
|
|
52477
|
+
const t = si["t"];
|
|
52478
|
+
if (t !== void 0) {
|
|
52479
|
+
return { text: typeof t === "object" && t !== null ? t["#text"] ?? "" : String(t) };
|
|
52480
|
+
}
|
|
52481
|
+
const rArr = si["r"];
|
|
52482
|
+
if (!rArr) return { text: "" };
|
|
52483
|
+
const parts = [];
|
|
52484
|
+
let fullText = "";
|
|
52485
|
+
for (const run of rArr) {
|
|
52486
|
+
const runT = run["t"];
|
|
52487
|
+
const text = typeof runT === "object" && runT !== null ? runT["#text"] ?? "" : String(runT ?? "");
|
|
52488
|
+
fullText += text;
|
|
52489
|
+
const rPr = run["rPr"];
|
|
52490
|
+
const part = { text };
|
|
52491
|
+
if (rPr) {
|
|
52492
|
+
const font = parseRichTextFont(rPr, theme, indexedColors);
|
|
52493
|
+
if (font) part.font = font;
|
|
52494
|
+
}
|
|
52495
|
+
parts.push(part);
|
|
52496
|
+
}
|
|
52497
|
+
const hasFormatting = parts.some((p) => p.font !== void 0);
|
|
52498
|
+
if (!hasFormatting) {
|
|
52499
|
+
return { text: fullText };
|
|
52500
|
+
}
|
|
52501
|
+
return { text: fullText, richText: parts };
|
|
52502
|
+
}
|
|
52503
|
+
function parseRichTextFont(rPr, theme, indexedColors) {
|
|
52504
|
+
const result = {};
|
|
52505
|
+
let hasProps = false;
|
|
52506
|
+
if (rPr["b"] !== void 0) {
|
|
52507
|
+
result.bold = true;
|
|
52508
|
+
hasProps = true;
|
|
52509
|
+
}
|
|
52510
|
+
if (rPr["i"] !== void 0) {
|
|
52511
|
+
result.italic = true;
|
|
52512
|
+
hasProps = true;
|
|
52513
|
+
}
|
|
52514
|
+
if (rPr["strike"] !== void 0) {
|
|
52515
|
+
result.strike = true;
|
|
52516
|
+
hasProps = true;
|
|
52517
|
+
}
|
|
52518
|
+
const u = rPr["u"];
|
|
52519
|
+
if (u !== void 0) {
|
|
52520
|
+
if (typeof u === "object" && u["@_val"] === "double") {
|
|
52521
|
+
result.underline = "double";
|
|
52522
|
+
} else {
|
|
52523
|
+
result.underline = "single";
|
|
52524
|
+
}
|
|
52525
|
+
hasProps = true;
|
|
52526
|
+
}
|
|
52527
|
+
const va = rPr["vertAlign"];
|
|
52528
|
+
if (va?.["@_val"] === "superscript" || va?.["@_val"] === "subscript") {
|
|
52529
|
+
result.vertAlign = va["@_val"];
|
|
52530
|
+
hasProps = true;
|
|
52531
|
+
}
|
|
52532
|
+
const sz = rPr["sz"];
|
|
52533
|
+
if (sz?.["@_val"]) {
|
|
52534
|
+
result.size = parseFloat(sz["@_val"]);
|
|
52535
|
+
hasProps = true;
|
|
52536
|
+
}
|
|
52537
|
+
const name2 = rPr["rFont"];
|
|
52538
|
+
if (name2?.["@_val"]) {
|
|
52539
|
+
result.name = name2["@_val"];
|
|
52540
|
+
hasProps = true;
|
|
52541
|
+
}
|
|
52542
|
+
const colorEl = rPr["color"];
|
|
52543
|
+
if (colorEl) {
|
|
52544
|
+
const ooxmlColor = parseColorElement(colorEl);
|
|
52545
|
+
const hex = resolveColor(ooxmlColor, theme, indexedColors, "font");
|
|
52546
|
+
if (hex) {
|
|
52547
|
+
result.color = prefixHex(hex);
|
|
52548
|
+
hasProps = true;
|
|
52549
|
+
}
|
|
52550
|
+
}
|
|
52551
|
+
return hasProps ? result : void 0;
|
|
52225
52552
|
}
|
|
52226
52553
|
|
|
52227
52554
|
// ../xlsx/src/ooxml_cell_format.ts
|
|
@@ -52258,16 +52585,6 @@ ${e.toString()}`);
|
|
|
52258
52585
|
return { type: "plain", text: displayValue };
|
|
52259
52586
|
}
|
|
52260
52587
|
|
|
52261
|
-
// ../xlsx/src/malformed_part_error.ts
|
|
52262
|
-
var MalformedPartError = class extends Error {
|
|
52263
|
-
constructor(reason) {
|
|
52264
|
-
super(
|
|
52265
|
-
`${reason} \u2014 the file is not a readable spreadsheet. If it opens in Excel, the reader is at fault: report the producer that wrote it.`
|
|
52266
|
-
);
|
|
52267
|
-
this.name = "MalformedPartError";
|
|
52268
|
-
}
|
|
52269
|
-
};
|
|
52270
|
-
|
|
52271
52588
|
// ../../node_modules/fflate/esm/browser.js
|
|
52272
52589
|
var u8 = Uint8Array;
|
|
52273
52590
|
var u16 = Uint16Array;
|
|
@@ -52727,111 +53044,6 @@ ${e.toString()}`);
|
|
|
52727
53044
|
return files;
|
|
52728
53045
|
}
|
|
52729
53046
|
|
|
52730
|
-
// ../office-io/src/ole.ts
|
|
52731
|
-
var OLE2_MAGIC = [208, 207, 17, 224, 161, 177, 26, 225];
|
|
52732
|
-
var ENDOFCHAIN = 4294967294;
|
|
52733
|
-
var FREESECT = 4294967295;
|
|
52734
|
-
function isOle2(bytes) {
|
|
52735
|
-
return bytes.length >= 8 && OLE2_MAGIC.every((b, i3) => bytes[i3] === b);
|
|
52736
|
-
}
|
|
52737
|
-
function readCfbStreams(bytes) {
|
|
52738
|
-
const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
52739
|
-
const u163 = (o) => dv.getUint16(o, true);
|
|
52740
|
-
const u322 = (o) => dv.getUint32(o, true);
|
|
52741
|
-
const sectorSize = 1 << u163(30);
|
|
52742
|
-
const miniSectorSize = 1 << u163(32);
|
|
52743
|
-
const firstDirSector = u322(48);
|
|
52744
|
-
const miniCutoff = u322(56);
|
|
52745
|
-
const firstMiniFatSector = u322(60);
|
|
52746
|
-
const firstDifatSector = u322(68);
|
|
52747
|
-
if (sectorSize < 512 || sectorSize > 1 << 20) {
|
|
52748
|
-
throw new Error("Unsupported OLE2 file: invalid sector size");
|
|
52749
|
-
}
|
|
52750
|
-
const sectorOffset = (n) => sectorSize * (n + 1);
|
|
52751
|
-
const maxSectors = Math.ceil(bytes.length / sectorSize) + 1;
|
|
52752
|
-
const difat = [];
|
|
52753
|
-
for (let i3 = 0; i3 < 109; i3++) {
|
|
52754
|
-
const v = u322(76 + i3 * 4);
|
|
52755
|
-
if (v !== FREESECT) difat.push(v);
|
|
52756
|
-
}
|
|
52757
|
-
let ds = firstDifatSector;
|
|
52758
|
-
const entriesPerSector = sectorSize / 4;
|
|
52759
|
-
const seenDifat = /* @__PURE__ */ new Set();
|
|
52760
|
-
while (ds !== ENDOFCHAIN && ds !== FREESECT && ds < maxSectors && !seenDifat.has(ds)) {
|
|
52761
|
-
seenDifat.add(ds);
|
|
52762
|
-
const base2 = sectorOffset(ds);
|
|
52763
|
-
for (let i3 = 0; i3 < entriesPerSector - 1; i3++) {
|
|
52764
|
-
const v = u322(base2 + i3 * 4);
|
|
52765
|
-
if (v !== FREESECT) difat.push(v);
|
|
52766
|
-
}
|
|
52767
|
-
ds = u322(base2 + (entriesPerSector - 1) * 4);
|
|
52768
|
-
}
|
|
52769
|
-
const fat = [];
|
|
52770
|
-
for (const fatSector of difat) {
|
|
52771
|
-
if (fat.length >= maxSectors) break;
|
|
52772
|
-
if (fatSector >= maxSectors) continue;
|
|
52773
|
-
const base2 = sectorOffset(fatSector);
|
|
52774
|
-
for (let i3 = 0; i3 < entriesPerSector && fat.length < maxSectors; i3++) {
|
|
52775
|
-
fat.push(u322(base2 + i3 * 4));
|
|
52776
|
-
}
|
|
52777
|
-
}
|
|
52778
|
-
const readChain = (src, start, size, ss, offOf, chain) => {
|
|
52779
|
-
const maxSectors2 = Math.floor(src.length / ss) + 2;
|
|
52780
|
-
const parts = [];
|
|
52781
|
-
let s = start;
|
|
52782
|
-
for (let guard = 0; s !== ENDOFCHAIN && s !== FREESECT && s < chain.length && guard < maxSectors2; guard++) {
|
|
52783
|
-
const o = offOf(s);
|
|
52784
|
-
parts.push(src.subarray(o, o + ss));
|
|
52785
|
-
s = chain[s];
|
|
52786
|
-
}
|
|
52787
|
-
const merged = concat(parts);
|
|
52788
|
-
return size != null ? merged.subarray(0, size) : merged;
|
|
52789
|
-
};
|
|
52790
|
-
const readBig = (start, size) => readChain(bytes, start, size, sectorSize, sectorOffset, fat);
|
|
52791
|
-
const dirBytes = readBig(firstDirSector, null);
|
|
52792
|
-
const ddv = new DataView(dirBytes.buffer, dirBytes.byteOffset, dirBytes.byteLength);
|
|
52793
|
-
const dir = [];
|
|
52794
|
-
for (let off = 0; off + 128 <= dirBytes.length; off += 128) {
|
|
52795
|
-
const nameLen = ddv.getUint16(off + 64, true);
|
|
52796
|
-
const type = ddv.getUint8(off + 66);
|
|
52797
|
-
if (nameLen < 2 || type === 0) continue;
|
|
52798
|
-
const name2 = utf16le(dirBytes.subarray(off, off + nameLen - 2));
|
|
52799
|
-
dir.push({ name: name2, type, start: ddv.getUint32(off + 116, true), size: Number(ddv.getBigUint64(off + 120, true)) });
|
|
52800
|
-
}
|
|
52801
|
-
const root = dir.find((e) => e.type === 5);
|
|
52802
|
-
const miniStream = root ? readBig(root.start, root.size) : new Uint8Array(0);
|
|
52803
|
-
const miniFatBytes = readBig(firstMiniFatSector, null);
|
|
52804
|
-
const miniFat = [];
|
|
52805
|
-
for (let i3 = 0; i3 + 4 <= miniFatBytes.length; i3 += 4) miniFat.push(miniFatBytes[i3] | miniFatBytes[i3 + 1] << 8 | miniFatBytes[i3 + 2] << 16 | miniFatBytes[i3 + 3] << 24);
|
|
52806
|
-
const readMini = (start, size) => readChain(miniStream, start, size, miniSectorSize, (n) => n * miniSectorSize, miniFat);
|
|
52807
|
-
const readStream = (e) => e.size >= miniCutoff ? readBig(e.start, e.size) : readMini(e.start, e.size);
|
|
52808
|
-
return dir.filter((e) => e.type === 2).map((e) => ({ name: e.name, bytes: readStream(e) }));
|
|
52809
|
-
}
|
|
52810
|
-
function utf16le(b) {
|
|
52811
|
-
let s = "";
|
|
52812
|
-
for (let i3 = 0; i3 + 1 < b.length; i3 += 2) s += String.fromCharCode(b[i3] | b[i3 + 1] << 8);
|
|
52813
|
-
return s;
|
|
52814
|
-
}
|
|
52815
|
-
function concat(parts) {
|
|
52816
|
-
let total = 0;
|
|
52817
|
-
for (const p of parts) total += p.length;
|
|
52818
|
-
const out = new Uint8Array(total);
|
|
52819
|
-
let o = 0;
|
|
52820
|
-
for (const p of parts) {
|
|
52821
|
-
out.set(p, o);
|
|
52822
|
-
o += p.length;
|
|
52823
|
-
}
|
|
52824
|
-
return out;
|
|
52825
|
-
}
|
|
52826
|
-
|
|
52827
|
-
// ../office-io/src/password_protected_error.ts
|
|
52828
|
-
var PasswordProtectedError = class extends Error {
|
|
52829
|
-
constructor() {
|
|
52830
|
-
super("This file is password-protected and cannot be previewed");
|
|
52831
|
-
this.name = "PasswordProtectedError";
|
|
52832
|
-
}
|
|
52833
|
-
};
|
|
52834
|
-
|
|
52835
53047
|
// ../xlsx/src/ooxml_zip.ts
|
|
52836
53048
|
var OLE2_MAGIC2 = [208, 207, 17, 224, 161, 177, 26, 225];
|
|
52837
53049
|
function unzipXlsx(buffer) {
|
|
@@ -52865,32 +53077,35 @@ ${e.toString()}`);
|
|
|
52865
53077
|
}
|
|
52866
53078
|
return String(node);
|
|
52867
53079
|
}
|
|
52868
|
-
var
|
|
53080
|
+
var xmlParser3 = new XMLParser2({
|
|
52869
53081
|
ignoreAttributes: false,
|
|
52870
53082
|
attributeNamePrefix: "@_",
|
|
52871
|
-
|
|
53083
|
+
...DECODED_SPREADSHEETML_VALUES,
|
|
52872
53084
|
// A producer may bind spreadsheetml to a prefix (`<x:worksheet>`) instead of
|
|
52873
53085
|
// making it the default namespace. The prefix carries no meaning, so it is
|
|
52874
53086
|
// dropped before anything looks a tag up — see `stripNsPrefix`.
|
|
52875
53087
|
transformTagName: stripNsPrefix,
|
|
52876
|
-
|
|
53088
|
+
// Element text stays text: an inline string `<t>0312345678</t>` is a code,
|
|
53089
|
+
// not 312345678. Numerics (`<v>`) are parsed deliberately where read.
|
|
53090
|
+
parseTagValue: false,
|
|
53091
|
+
isArray: (tagName) => tagName === "row" || tagName === "r" || tagName === "c" || tagName === "col" || tagName === "mergeCell" || tagName === "conditionalFormatting" || tagName === "cfRule" || tagName === "cfvo" || tagName === "color" || tagName === "hyperlink" || tagName === "Relationship" || tagName === "sheetView" || tagName === "dataValidation" || tagName === "filterColumn" || tagName === "filter" || tagName === "brk" || tagName === "ext",
|
|
52877
53092
|
// Preserve whitespace in cell values
|
|
52878
53093
|
trimValues: false
|
|
52879
53094
|
});
|
|
52880
|
-
var
|
|
53095
|
+
var relsParser2 = new XMLParser2({
|
|
52881
53096
|
ignoreAttributes: false,
|
|
52882
53097
|
attributeNamePrefix: "@_",
|
|
52883
|
-
|
|
53098
|
+
...DECODED_XML_VALUES,
|
|
52884
53099
|
isArray: (tagName) => tagName === "Relationship"
|
|
52885
53100
|
});
|
|
52886
53101
|
var drawingParser = new XMLParser2({
|
|
52887
53102
|
ignoreAttributes: false,
|
|
52888
53103
|
attributeNamePrefix: "@_",
|
|
52889
|
-
|
|
53104
|
+
...DECODED_XML_VALUES,
|
|
52890
53105
|
isArray: (tagName) => tagName === "xdr:twoCellAnchor" || tagName === "xdr:oneCellAnchor" || tagName === "Relationship"
|
|
52891
53106
|
});
|
|
52892
53107
|
function parseSheet(sheetXml, sheetRelsXml, styles, sharedStrings, theme, indexedColors, zipEntries, date1904, maxRows = MAX_ROWS_PER_SHEET) {
|
|
52893
|
-
const doc3 =
|
|
53108
|
+
const doc3 = xmlParser3.parse(sheetXml);
|
|
52894
53109
|
const worksheet = doc3?.["worksheet"];
|
|
52895
53110
|
if (!worksheet) throw new MalformedPartError("A worksheet part has no <worksheet> root");
|
|
52896
53111
|
const rels = sheetRelsXml ? parseSheetRels(sheetRelsXml) : /* @__PURE__ */ new Map();
|
|
@@ -52915,6 +53130,7 @@ ${e.toString()}`);
|
|
|
52915
53130
|
worksheet,
|
|
52916
53131
|
styles,
|
|
52917
53132
|
sharedStrings,
|
|
53133
|
+
(item) => parseStringItem(item, theme, indexedColors),
|
|
52918
53134
|
hyperlinkMap,
|
|
52919
53135
|
defaultRowHeight,
|
|
52920
53136
|
date1904,
|
|
@@ -53001,12 +53217,11 @@ ${e.toString()}`);
|
|
|
53001
53217
|
const out = {};
|
|
53002
53218
|
const readText = (key) => {
|
|
53003
53219
|
const val = hf[key];
|
|
53004
|
-
|
|
53005
|
-
if (typeof val === "
|
|
53006
|
-
|
|
53007
|
-
raw = val["#text"];
|
|
53220
|
+
if (typeof val === "string") return val;
|
|
53221
|
+
if (val && typeof val === "object" && "#text" in val && typeof val["#text"] === "string") {
|
|
53222
|
+
return val["#text"];
|
|
53008
53223
|
}
|
|
53009
|
-
return
|
|
53224
|
+
return void 0;
|
|
53010
53225
|
};
|
|
53011
53226
|
const oh = readText("oddHeader");
|
|
53012
53227
|
const of = readText("oddFooter");
|
|
@@ -53025,7 +53240,7 @@ ${e.toString()}`);
|
|
|
53025
53240
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
53026
53241
|
}
|
|
53027
53242
|
function parseSheetRels(relsXml) {
|
|
53028
|
-
const doc3 =
|
|
53243
|
+
const doc3 = relsParser2.parse(relsXml);
|
|
53029
53244
|
const relationships = doc3?.["Relationships"];
|
|
53030
53245
|
if (!relationships) return /* @__PURE__ */ new Map();
|
|
53031
53246
|
const relArr = relationships["Relationship"];
|
|
@@ -53133,7 +53348,7 @@ ${e.toString()}`);
|
|
|
53133
53348
|
...styles.hasXf(xfIndex) ? { originalXfIndex: xfIndex } : {}
|
|
53134
53349
|
};
|
|
53135
53350
|
}
|
|
53136
|
-
function parseSheetData(worksheet, styles, sharedStrings, hyperlinkMap, defaultRowHeight, date1904, maxRows, colStyleIndex) {
|
|
53351
|
+
function parseSheetData(worksheet, styles, sharedStrings, readStringItem, hyperlinkMap, defaultRowHeight, date1904, maxRows, colStyleIndex) {
|
|
53137
53352
|
const sheetData = worksheet["sheetData"];
|
|
53138
53353
|
if (!sheetData) {
|
|
53139
53354
|
return {
|
|
@@ -53182,7 +53397,7 @@ ${e.toString()}`);
|
|
|
53182
53397
|
const cells = [];
|
|
53183
53398
|
if (cellArr) {
|
|
53184
53399
|
for (const cellEl of cellArr) {
|
|
53185
|
-
const parsed = parseCell(cellEl, styles, sharedStrings, hyperlinkMap, date1904, inheritedXfIndex);
|
|
53400
|
+
const parsed = parseCell(cellEl, styles, sharedStrings, readStringItem, hyperlinkMap, date1904, inheritedXfIndex);
|
|
53186
53401
|
if (parsed) {
|
|
53187
53402
|
cells.push(parsed);
|
|
53188
53403
|
if (parsed.column > maxCol) maxCol = parsed.column;
|
|
@@ -53218,7 +53433,7 @@ ${e.toString()}`);
|
|
|
53218
53433
|
if (!match) return void 0;
|
|
53219
53434
|
return { col: colLettersToNum(match[1]), row: parseInt(match[2], 10) };
|
|
53220
53435
|
}
|
|
53221
|
-
function parseCell(cellEl, styles, sharedStrings, hyperlinkMap, date1904, inheritedXfIndex) {
|
|
53436
|
+
function parseCell(cellEl, styles, sharedStrings, readStringItem, hyperlinkMap, date1904, inheritedXfIndex) {
|
|
53222
53437
|
const ref2 = cellEl["@_r"];
|
|
53223
53438
|
if (!ref2) return void 0;
|
|
53224
53439
|
const cellRef = parseCellRef(ref2);
|
|
@@ -53227,16 +53442,10 @@ ${e.toString()}`);
|
|
|
53227
53442
|
const declaredStyle = cellEl["@_s"];
|
|
53228
53443
|
const styleIndex = declaredStyle !== void 0 ? parseInt(declaredStyle, 10) : inheritedXfIndex(cellRef.col);
|
|
53229
53444
|
const rawValue = extractElementText(cellEl["v"]);
|
|
53230
|
-
|
|
53231
|
-
if (type === "inlineStr") {
|
|
53232
|
-
const is = cellEl["is"];
|
|
53233
|
-
if (is) {
|
|
53234
|
-
const raw = extractElementText(is["t"]);
|
|
53235
|
-
inlineStr = raw !== void 0 ? decodeXmlEntities(raw) : void 0;
|
|
53236
|
-
}
|
|
53237
|
-
}
|
|
53445
|
+
const is = type === "inlineStr" ? cellEl["is"] : void 0;
|
|
53238
53446
|
const ssIndex = type === "s" && rawValue !== void 0 ? parseInt(rawValue, 10) : -1;
|
|
53239
|
-
const sharedString = ssIndex >= 0 && ssIndex < sharedStrings.length ? sharedStrings[ssIndex] : void 0;
|
|
53447
|
+
const sharedString = is ? readStringItem(is) : ssIndex >= 0 && ssIndex < sharedStrings.length ? sharedStrings[ssIndex] : void 0;
|
|
53448
|
+
const inlineStr = is ? sharedString?.text : void 0;
|
|
53240
53449
|
const numFmt = styles.getNumFmt(styleIndex);
|
|
53241
53450
|
const effectiveValue = type === "inlineStr" ? inlineStr ?? "" : rawValue;
|
|
53242
53451
|
const displayValue = formatCellValue(effectiveValue, type, numFmt, sharedString, date1904);
|
|
@@ -53263,7 +53472,6 @@ ${e.toString()}`);
|
|
|
53263
53472
|
} else {
|
|
53264
53473
|
formula = String(fEl);
|
|
53265
53474
|
}
|
|
53266
|
-
if (formula !== void 0) formula = decodeXmlEntities(formula);
|
|
53267
53475
|
}
|
|
53268
53476
|
let typedValue;
|
|
53269
53477
|
let cellRawValue;
|
|
@@ -53368,7 +53576,7 @@ ${e.toString()}`);
|
|
|
53368
53576
|
return images;
|
|
53369
53577
|
}
|
|
53370
53578
|
function parseDrawingRels(relsXml) {
|
|
53371
|
-
const doc3 =
|
|
53579
|
+
const doc3 = relsParser2.parse(relsXml);
|
|
53372
53580
|
const relationships = doc3?.["Relationships"];
|
|
53373
53581
|
if (!relationships) return /* @__PURE__ */ new Map();
|
|
53374
53582
|
const relArr = relationships["Relationship"];
|
|
@@ -53578,11 +53786,8 @@ ${e.toString()}`);
|
|
|
53578
53786
|
const operatorStr = dv["@_operator"];
|
|
53579
53787
|
const validOperators = ["between", "notBetween", "equal", "notEqual", "greaterThan", "lessThan", "greaterThanOrEqual", "lessThanOrEqual"];
|
|
53580
53788
|
const operator = operatorStr && validOperators.includes(operatorStr) ? operatorStr : void 0;
|
|
53581
|
-
const
|
|
53582
|
-
const
|
|
53583
|
-
const formula2Text = extractElementText(dv["formula2"]);
|
|
53584
|
-
const formula2 = formula2Text !== void 0 ? decodeXmlEntities(formula2Text) : void 0;
|
|
53585
|
-
const decodeAttr = (v) => v !== void 0 ? decodeXmlEntities(v) : void 0;
|
|
53789
|
+
const formula1 = extractElementText(dv["formula1"]);
|
|
53790
|
+
const formula2 = extractElementText(dv["formula2"]);
|
|
53586
53791
|
result.push({
|
|
53587
53792
|
ref: ref2,
|
|
53588
53793
|
type,
|
|
@@ -53591,10 +53796,10 @@ ${e.toString()}`);
|
|
|
53591
53796
|
formula2,
|
|
53592
53797
|
showDropdown: dv["@_showDropDown"] !== "1",
|
|
53593
53798
|
errorStyle: dv["@_errorStyle"],
|
|
53594
|
-
errorTitle:
|
|
53595
|
-
errorMessage:
|
|
53596
|
-
promptTitle:
|
|
53597
|
-
promptMessage:
|
|
53799
|
+
errorTitle: dv["@_errorTitle"],
|
|
53800
|
+
errorMessage: dv["@_error"],
|
|
53801
|
+
promptTitle: dv["@_promptTitle"],
|
|
53802
|
+
promptMessage: dv["@_prompt"]
|
|
53598
53803
|
});
|
|
53599
53804
|
}
|
|
53600
53805
|
return result;
|
|
@@ -53696,7 +53901,7 @@ ${e.toString()}`);
|
|
|
53696
53901
|
if (filterArr) {
|
|
53697
53902
|
for (const f of filterArr) {
|
|
53698
53903
|
const val = f["@_val"];
|
|
53699
|
-
if (val !== void 0) filterValues.push(
|
|
53904
|
+
if (val !== void 0) filterValues.push(val);
|
|
53700
53905
|
}
|
|
53701
53906
|
}
|
|
53702
53907
|
}
|
|
@@ -53707,7 +53912,7 @@ ${e.toString()}`);
|
|
|
53707
53912
|
if (cf) {
|
|
53708
53913
|
customFilter = {
|
|
53709
53914
|
operator: cf["@_operator"] ?? "equal",
|
|
53710
|
-
value:
|
|
53915
|
+
value: cf["@_val"] ?? ""
|
|
53711
53916
|
};
|
|
53712
53917
|
}
|
|
53713
53918
|
}
|
|
@@ -65204,18 +65409,18 @@ ${e.toString()}`);
|
|
|
65204
65409
|
48: "##0.0E+0",
|
|
65205
65410
|
49: "@"
|
|
65206
65411
|
};
|
|
65207
|
-
var
|
|
65412
|
+
var xmlParser4 = new XMLParser2({
|
|
65208
65413
|
ignoreAttributes: false,
|
|
65209
65414
|
attributeNamePrefix: "@_",
|
|
65210
65415
|
// A producer may bind spreadsheetml to a prefix (`<x:styleSheet>`) rather than
|
|
65211
65416
|
// making it the default namespace; the prefix carries no meaning, so it is
|
|
65212
65417
|
// dropped before anything looks a tag up — see `stripNsPrefix`.
|
|
65213
65418
|
transformTagName: stripNsPrefix,
|
|
65214
|
-
|
|
65419
|
+
...DECODED_SPREADSHEETML_VALUES,
|
|
65215
65420
|
isArray: (tagName) => tagName === "numFmt" || tagName === "font" || tagName === "fill" || tagName === "border" || tagName === "xf" || tagName === "dxf" || tagName === "rgbColor" || tagName === "stop"
|
|
65216
65421
|
});
|
|
65217
65422
|
function parseStyles(stylesXml, theme) {
|
|
65218
|
-
const doc3 =
|
|
65423
|
+
const doc3 = xmlParser4.parse(stylesXml);
|
|
65219
65424
|
const root = doc3?.["styleSheet"];
|
|
65220
65425
|
if (!root) {
|
|
65221
65426
|
return emptyStyleResolver();
|
|
@@ -65350,7 +65555,7 @@ ${e.toString()}`);
|
|
|
65350
65555
|
const id = parseInt(fmt["@_numFmtId"], 10);
|
|
65351
65556
|
const code2 = fmt["@_formatCode"];
|
|
65352
65557
|
if (!isNaN(id) && code2) {
|
|
65353
|
-
map3.set(id,
|
|
65558
|
+
map3.set(id, code2);
|
|
65354
65559
|
}
|
|
65355
65560
|
}
|
|
65356
65561
|
return map3;
|
|
@@ -65577,178 +65782,6 @@ ${e.toString()}`);
|
|
|
65577
65782
|
};
|
|
65578
65783
|
}
|
|
65579
65784
|
|
|
65580
|
-
// ../xlsx/src/ooxml_workbook.ts
|
|
65581
|
-
var xmlParser4 = new XMLParser2({
|
|
65582
|
-
ignoreAttributes: false,
|
|
65583
|
-
attributeNamePrefix: "@_",
|
|
65584
|
-
// A producer may bind spreadsheetml to a prefix (`<x:workbook>`) rather than
|
|
65585
|
-
// making it the default namespace; the prefix carries no meaning, so it is
|
|
65586
|
-
// dropped before anything looks a tag up — see `stripNsPrefix`.
|
|
65587
|
-
transformTagName: stripNsPrefix,
|
|
65588
|
-
// Shared-string and workbook text is textual BY DEFINITION (tax IDs, phone
|
|
65589
|
-
// numbers, account codes, sheet/defined names). fast-xml-parser's default tag
|
|
65590
|
-
// coercion would parse `<t>0312345678</t>` as the number 312345678 — silently
|
|
65591
|
-
// dropping the leading zero before we can read it. Cell `<v>` numerics are
|
|
65592
|
-
// parsed deliberately (parseFloat) in ooxml_sheet.ts, so this never affects them.
|
|
65593
|
-
parseTagValue: false,
|
|
65594
|
-
trimValues: false,
|
|
65595
|
-
processEntities: false,
|
|
65596
|
-
isArray: (tagName) => tagName === "sheet" || tagName === "si" || tagName === "r" || tagName === "Relationship" || tagName === "definedName"
|
|
65597
|
-
});
|
|
65598
|
-
function parseWorkbook(workbookXml) {
|
|
65599
|
-
const doc3 = xmlParser4.parse(workbookXml);
|
|
65600
|
-
const wb = doc3?.["workbook"];
|
|
65601
|
-
if (!wb) throw new MalformedPartError("xl/workbook.xml has no <workbook> root");
|
|
65602
|
-
const sheetsEl = wb["sheets"];
|
|
65603
|
-
const sheetArr = sheetsEl?.["sheet"];
|
|
65604
|
-
const sheets = (sheetArr ?? []).map((s) => ({
|
|
65605
|
-
name: decodeXmlEntities(s["@_name"] ?? "Sheet"),
|
|
65606
|
-
rId: s["@_r:id"] ?? "",
|
|
65607
|
-
state: s["@_state"]
|
|
65608
|
-
}));
|
|
65609
|
-
let activeSheetIndex = 0;
|
|
65610
|
-
const bookViews = wb["bookViews"];
|
|
65611
|
-
if (bookViews) {
|
|
65612
|
-
const wbView = bookViews["workbookView"];
|
|
65613
|
-
if (wbView) {
|
|
65614
|
-
const activeTab = (Array.isArray(wbView) ? wbView[0] : wbView)?.["@_activeTab"];
|
|
65615
|
-
if (activeTab !== void 0) {
|
|
65616
|
-
activeSheetIndex = parseInt(activeTab, 10);
|
|
65617
|
-
if (isNaN(activeSheetIndex)) activeSheetIndex = 0;
|
|
65618
|
-
}
|
|
65619
|
-
}
|
|
65620
|
-
}
|
|
65621
|
-
const wp = wb["workbookPr"];
|
|
65622
|
-
const date1904 = wp?.["@_date1904"] === "1" || wp?.["@_date1904"] === "true";
|
|
65623
|
-
const calcPr = wb["calcPr"];
|
|
65624
|
-
const fullCalcOnLoad = calcPr?.["@_fullCalcOnLoad"] === "1" || calcPr?.["@_fullCalcOnLoad"] === "true";
|
|
65625
|
-
const namedRanges = /* @__PURE__ */ new Map();
|
|
65626
|
-
const printTitlesBySheet = /* @__PURE__ */ new Map();
|
|
65627
|
-
const defNamesEl = wb["definedNames"];
|
|
65628
|
-
if (defNamesEl) {
|
|
65629
|
-
const raw = defNamesEl["definedName"];
|
|
65630
|
-
const defArr = Array.isArray(raw) ? raw : raw && typeof raw === "object" ? [raw] : [];
|
|
65631
|
-
for (const dn of defArr) {
|
|
65632
|
-
const nameRaw = dn["@_name"];
|
|
65633
|
-
const textRaw = dn["#text"];
|
|
65634
|
-
if (!nameRaw || !textRaw) continue;
|
|
65635
|
-
const name2 = decodeXmlEntities(nameRaw);
|
|
65636
|
-
const text = decodeXmlEntities(textRaw);
|
|
65637
|
-
const localSheetIdRaw = dn["@_localSheetId"];
|
|
65638
|
-
if (name2 === "_xlnm.Print_Titles" && localSheetIdRaw !== void 0) {
|
|
65639
|
-
const idx = parseInt(localSheetIdRaw, 10);
|
|
65640
|
-
if (!Number.isNaN(idx)) printTitlesBySheet.set(idx, text);
|
|
65641
|
-
continue;
|
|
65642
|
-
}
|
|
65643
|
-
namedRanges.set(name2, text);
|
|
65644
|
-
}
|
|
65645
|
-
}
|
|
65646
|
-
return { sheets, activeSheetIndex, date1904, namedRanges, printTitlesBySheet, fullCalcOnLoad };
|
|
65647
|
-
}
|
|
65648
|
-
function parseWorkbookRels(relsXml) {
|
|
65649
|
-
const doc3 = xmlParser4.parse(relsXml);
|
|
65650
|
-
const rels = doc3?.["Relationships"];
|
|
65651
|
-
if (!rels) return /* @__PURE__ */ new Map();
|
|
65652
|
-
const relArr = rels["Relationship"];
|
|
65653
|
-
if (!relArr) return /* @__PURE__ */ new Map();
|
|
65654
|
-
const map3 = /* @__PURE__ */ new Map();
|
|
65655
|
-
for (const rel of relArr) {
|
|
65656
|
-
const id = rel["@_Id"];
|
|
65657
|
-
const target = rel["@_Target"];
|
|
65658
|
-
if (id && target) {
|
|
65659
|
-
map3.set(id, decodeXmlEntities(target));
|
|
65660
|
-
}
|
|
65661
|
-
}
|
|
65662
|
-
return map3;
|
|
65663
|
-
}
|
|
65664
|
-
function parseSharedStrings(ssXml, theme, indexedColors) {
|
|
65665
|
-
const doc3 = xmlParser4.parse(ssXml);
|
|
65666
|
-
const sst = doc3?.["sst"];
|
|
65667
|
-
if (!sst) return [];
|
|
65668
|
-
const siArr = sst["si"];
|
|
65669
|
-
if (!siArr) return [];
|
|
65670
|
-
return siArr.map((si) => parseSharedStringItem(si, theme, indexedColors));
|
|
65671
|
-
}
|
|
65672
|
-
function parseSharedStringItem(si, theme, indexedColors) {
|
|
65673
|
-
const t = si["t"];
|
|
65674
|
-
if (t !== void 0) {
|
|
65675
|
-
const raw = typeof t === "object" && t !== null ? t["#text"] ?? "" : String(t);
|
|
65676
|
-
return { text: decodeXmlEntities(raw) };
|
|
65677
|
-
}
|
|
65678
|
-
const rArr = si["r"];
|
|
65679
|
-
if (!rArr) return { text: "" };
|
|
65680
|
-
const parts = [];
|
|
65681
|
-
let fullText = "";
|
|
65682
|
-
for (const run of rArr) {
|
|
65683
|
-
const runT = run["t"];
|
|
65684
|
-
const rawRun = typeof runT === "object" && runT !== null ? runT["#text"] ?? "" : String(runT ?? "");
|
|
65685
|
-
const text = decodeXmlEntities(rawRun);
|
|
65686
|
-
fullText += text;
|
|
65687
|
-
const rPr = run["rPr"];
|
|
65688
|
-
const part = { text };
|
|
65689
|
-
if (rPr) {
|
|
65690
|
-
const font = parseRichTextFont(rPr, theme, indexedColors);
|
|
65691
|
-
if (font) part.font = font;
|
|
65692
|
-
}
|
|
65693
|
-
parts.push(part);
|
|
65694
|
-
}
|
|
65695
|
-
const hasFormatting = parts.some((p) => p.font !== void 0);
|
|
65696
|
-
if (!hasFormatting) {
|
|
65697
|
-
return { text: fullText };
|
|
65698
|
-
}
|
|
65699
|
-
return { text: fullText, richText: parts };
|
|
65700
|
-
}
|
|
65701
|
-
function parseRichTextFont(rPr, theme, indexedColors) {
|
|
65702
|
-
const result = {};
|
|
65703
|
-
let hasProps = false;
|
|
65704
|
-
if (rPr["b"] !== void 0) {
|
|
65705
|
-
result.bold = true;
|
|
65706
|
-
hasProps = true;
|
|
65707
|
-
}
|
|
65708
|
-
if (rPr["i"] !== void 0) {
|
|
65709
|
-
result.italic = true;
|
|
65710
|
-
hasProps = true;
|
|
65711
|
-
}
|
|
65712
|
-
if (rPr["strike"] !== void 0) {
|
|
65713
|
-
result.strike = true;
|
|
65714
|
-
hasProps = true;
|
|
65715
|
-
}
|
|
65716
|
-
const u = rPr["u"];
|
|
65717
|
-
if (u !== void 0) {
|
|
65718
|
-
if (typeof u === "object" && u["@_val"] === "double") {
|
|
65719
|
-
result.underline = "double";
|
|
65720
|
-
} else {
|
|
65721
|
-
result.underline = "single";
|
|
65722
|
-
}
|
|
65723
|
-
hasProps = true;
|
|
65724
|
-
}
|
|
65725
|
-
const va = rPr["vertAlign"];
|
|
65726
|
-
if (va?.["@_val"] === "superscript" || va?.["@_val"] === "subscript") {
|
|
65727
|
-
result.vertAlign = va["@_val"];
|
|
65728
|
-
hasProps = true;
|
|
65729
|
-
}
|
|
65730
|
-
const sz = rPr["sz"];
|
|
65731
|
-
if (sz?.["@_val"]) {
|
|
65732
|
-
result.size = parseFloat(sz["@_val"]);
|
|
65733
|
-
hasProps = true;
|
|
65734
|
-
}
|
|
65735
|
-
const name2 = rPr["rFont"];
|
|
65736
|
-
if (name2?.["@_val"]) {
|
|
65737
|
-
result.name = name2["@_val"];
|
|
65738
|
-
hasProps = true;
|
|
65739
|
-
}
|
|
65740
|
-
const colorEl = rPr["color"];
|
|
65741
|
-
if (colorEl) {
|
|
65742
|
-
const ooxmlColor = parseColorElement(colorEl);
|
|
65743
|
-
const hex = resolveColor(ooxmlColor, theme, indexedColors, "font");
|
|
65744
|
-
if (hex) {
|
|
65745
|
-
result.color = prefixHex(hex);
|
|
65746
|
-
hasProps = true;
|
|
65747
|
-
}
|
|
65748
|
-
}
|
|
65749
|
-
return hasProps ? result : void 0;
|
|
65750
|
-
}
|
|
65751
|
-
|
|
65752
65785
|
// ../xlsx/src/ooxml_chart.ts
|
|
65753
65786
|
function parseChartXml(xml, parseXml4) {
|
|
65754
65787
|
const doc3 = parseXml4(xml);
|
|
@@ -67187,15 +67220,18 @@ ${e.toString()}`);
|
|
|
67187
67220
|
const wbRels = wbRelsEntry ? parseWorkbookRels(decodeUtf8(wbRelsEntry)) : /* @__PURE__ */ new Map();
|
|
67188
67221
|
const ssEntry = findEntry(zip, "xl/sharedStrings.xml");
|
|
67189
67222
|
const sharedStrings = ssEntry ? parseSharedStrings(decodeUtf8(ssEntry), theme, styles.indexedColors) : [];
|
|
67190
|
-
const
|
|
67223
|
+
const isArray2 = (tagName) => tagName === "Relationship" || tagName === "xdr:twoCellAnchor" || tagName === "xdr:oneCellAnchor" || tagName === "tableColumn" || tagName === "pivotField" || tagName === "cacheField" || tagName === "field" || tagName === "pageField" || tagName === "dataField" || tagName === "pivotCache";
|
|
67224
|
+
const xmlParser5 = new XMLParser2({ ignoreAttributes: false, attributeNamePrefix: "@_", ...DECODED_XML_VALUES, isArray: isArray2 });
|
|
67225
|
+
const spreadsheetMlParser = new XMLParser2({
|
|
67191
67226
|
ignoreAttributes: false,
|
|
67192
67227
|
attributeNamePrefix: "@_",
|
|
67193
|
-
|
|
67194
|
-
isArray:
|
|
67228
|
+
...DECODED_SPREADSHEETML_VALUES,
|
|
67229
|
+
isArray: isArray2
|
|
67195
67230
|
});
|
|
67196
67231
|
const parseXmlDoc = (xml) => xmlParser5.parse(xml);
|
|
67232
|
+
const parseSpreadsheetMlDoc = (xml) => spreadsheetMlParser.parse(xml);
|
|
67197
67233
|
const pivotCaches = /* @__PURE__ */ new Map();
|
|
67198
|
-
const wbDoc =
|
|
67234
|
+
const wbDoc = parseSpreadsheetMlDoc(decodeUtf8(wbEntry));
|
|
67199
67235
|
const wbCacheMap = extractWorkbookPivotCaches(wbDoc);
|
|
67200
67236
|
for (const [cacheId, rId] of wbCacheMap) {
|
|
67201
67237
|
const cacheTarget = wbRels.get(rId);
|
|
@@ -67206,7 +67242,7 @@ ${e.toString()}`);
|
|
|
67206
67242
|
try {
|
|
67207
67243
|
pivotCaches.set(
|
|
67208
67244
|
cacheId,
|
|
67209
|
-
parsePivotCacheDefinitionXml(decodeUtf8(cacheEntry), cacheId,
|
|
67245
|
+
parsePivotCacheDefinitionXml(decodeUtf8(cacheEntry), cacheId, parseSpreadsheetMlDoc)
|
|
67210
67246
|
);
|
|
67211
67247
|
} catch {
|
|
67212
67248
|
}
|
|
@@ -67311,7 +67347,7 @@ ${e.toString()}`);
|
|
|
67311
67347
|
const tablePath = resolveRelTarget(target, sheetDir);
|
|
67312
67348
|
const tableEntry = findEntry(zip, tablePath);
|
|
67313
67349
|
if (!tableEntry) continue;
|
|
67314
|
-
tables2.push(parseTableXml(decodeUtf8(tableEntry),
|
|
67350
|
+
tables2.push(parseTableXml(decodeUtf8(tableEntry), parseSpreadsheetMlDoc));
|
|
67315
67351
|
}
|
|
67316
67352
|
if (tables2.length > 0) parsed.tables = tables2;
|
|
67317
67353
|
const pivotRIds = extractPivotTableRIds(relsDoc);
|
|
@@ -67322,7 +67358,7 @@ ${e.toString()}`);
|
|
|
67322
67358
|
if (!pivotEntry) continue;
|
|
67323
67359
|
try {
|
|
67324
67360
|
pivotTables.push(
|
|
67325
|
-
parsePivotTableXml(decodeUtf8(pivotEntry),
|
|
67361
|
+
parsePivotTableXml(decodeUtf8(pivotEntry), parseSpreadsheetMlDoc)
|
|
67326
67362
|
);
|
|
67327
67363
|
} catch {
|
|
67328
67364
|
}
|